* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #10456d; color: #f4f1e8;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}
#app { position: fixed; inset: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

.hidden { display: none !important; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  pointer-events: none;
}
.pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(12, 22, 34, .72); border: 1px solid rgba(255,255,255,.12);
  padding: 6px 12px; border-radius: 999px; font-weight: 600;
  backdrop-filter: blur(6px);
}
#terrinfo { margin-left: auto; }
#income { color: #9be89b; }
#income.bad { color: #ff9a90; }
.swatch { width: 14px; height: 14px; border-radius: 4px; background: #d94b3f; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.coin { width: 12px; height: 12px; border-radius: 50%; background: #ffd15c; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }

#bottombar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px; align-items: center;
  padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom));
}
button {
  font: inherit; font-weight: 600; color: #f4f1e8; white-space: nowrap;
  background: rgba(12, 22, 34, .8); border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px; padding: 10px 14px; cursor: pointer;
  backdrop-filter: blur(6px);
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .38; cursor: default; }
button.primary { background: #2f7d4f; border-color: #47a06a; margin-left: auto; padding: 12px 20px; }
button.primary:disabled { background: rgba(12,22,34,.8); border-color: rgba(255,255,255,.14); }
button.on { background: #2f6ea8; border-color: #5aa0dd; }
.buy { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; }
.buy img { height: 26px; width: auto; }
.buy.armed { background: #8a6a12; border-color: #ffd15c; }

#toast {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  background: rgba(12, 22, 34, .9); border: 1px solid rgba(255,255,255,.16);
  padding: 8px 16px; border-radius: 999px; opacity: 0; transition: opacity .25s;
  pointer-events: none; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }

#overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 16, 26, .72); backdrop-filter: blur(3px); padding: 16px; overflow: auto;
}
.panel {
  background: #14283c; border: 1px solid rgba(255,255,255,.14); border-radius: 18px;
  padding: 22px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.panel h1 { margin: 0 0 2px; font-size: 30px; }
.panel h2 { margin: 0 0 10px; }
.panel .sub { margin: 0 0 18px; opacity: .65; font-size: 13px; }
.panel label { display: block; margin: 14px 0 6px; font-size: 13px; opacity: .8; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 10px 4px; border-radius: 10px; }
.wide { width: 100%; margin-top: 18px; padding: 14px; }
button.ghost { background: transparent; margin-top: 8px; }
.panel ul { padding-left: 18px; margin: 0; }
.panel li { margin-bottom: 9px; font-size: 14px; opacity: .92; }

@media (max-width: 430px) {
  #bottombar { gap: 5px; padding: 8px 6px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  button { padding: 9px 10px; border-radius: 10px; }
  button.primary { padding: 11px 13px; font-size: 14px; }
  .buy { padding: 5px 9px 5px 6px; gap: 4px; }
  .buy img { height: 22px; }
  .pill { padding: 5px 10px; font-size: 13px; }
}
