:root {
  color-scheme: dark;
  color: #f0f3f8;
  background: #0b111c;
  font-family: Inter, "Segoe UI", sans-serif;
  --panel: #111c2a;
  --line: #26374d;
  --muted: #a7b8ca;
  --gold: #ffcf62;
  --mint: #83efc0;
  --danger: #ffa189;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 65% 10%, #172438, #0b111c 67%);
}
.shell { width: min(100% - 44px, 1320px); margin: auto; padding: 13px 0 18px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 6px; letter-spacing: .12em; font-weight: 750; font-size: 14px; }
.brand strong { color: var(--gold); }
.brand-mark { width: 23px; height: 17px; margin-right: 5px; background: var(--gold); clip-path: polygon(29% 0, 51% 0, 22% 100%, 0 100%, 29% 0, 100% 0, 71% 100%, 49% 100%, 78% 0); }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.quiet { color: #eff5ff; background: #142132; border: 1px solid #374960; border-radius: 7px; padding: 8px 12px; font-size: 13px; }
.quiet kbd { margin-left: 4px; }
kbd { display: inline-block; padding: 2px 5px; border: 1px solid #3a4b5f; border-radius: 4px; font: 600 11px Consolas, monospace; color: #e2ecf7; }
.hud { display: grid; grid-template-columns: 1fr 1fr 1.15fr 1.5fr; background: var(--panel); border: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.stat { display: grid; align-content: center; min-width: 0; gap: 2px; padding: 10px clamp(9px, 2vw, 24px); border-right: 1px solid var(--line); }
.stat span, .results span { color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.stat strong, .results strong { font: 700 clamp(16px, 3vw, 26px) Consolas, monospace; }
.stat small { font-size: .6em; color: var(--muted); }
.stat.health { border: 0; }
#level { color: var(--gold); }
#health { color: var(--mint); }
.health.critical #health { color: var(--danger); }
progress { display: block; appearance: none; width: 100%; height: 4px; overflow: hidden; border: 0; border-radius: 6px; color: var(--mint); background: #2b3c4f; }
progress::-webkit-progress-bar { background: #2b3c4f; }
progress::-webkit-progress-value { background: currentColor; }
progress::-moz-progress-bar { background: currentColor; }
.health.critical progress, .capture progress { color: var(--danger); }
.stage { height: clamp(365px, calc(100dvh - 185px), 770px); position: relative; isolation: isolate; border-inline: 1px solid var(--line); background: #263444; overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; }
.overlay { position: absolute; inset: 0; display: grid; align-items: center; padding: clamp(20px, 5vw, 76px); background: linear-gradient(90deg, #090e19 0%, #0a111cee 31%, #0b142647 72%, #0b142624); }
.overlay:not(.menu) { justify-items: center; background: #080e19bb; padding: 14px; }
.overlay-content { width: min(100%, 430px); }
.overlay:not(.menu) .overlay-content { text-align: center; padding: clamp(15px, 3.5vw, 33px); background: #111c2a; border: 1px solid #3b4d62; border-radius: 14px; box-shadow: 0 20px 54px #070b14aa; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 9px 0 0; font: 800 clamp(42px, 9vw, 112px)/.79 Impact, "Arial Narrow", sans-serif; letter-spacing: .02em; text-transform: uppercase; }
h1 em { color: var(--gold); font-style: normal; }
.overlay:not(.menu) h1 { font-size: clamp(34px, 5vw, 60px); line-height: .98; }
.overlay p { max-width: 32ch; margin: 15px 0 17px; color: #ced9e7; line-height: 1.4; }
.overlay:not(.menu) p { margin-inline: auto; }
.primary { min-height: 45px; border: 0; padding: 8px 16px; font-weight: 800; color: #22190c; background: var(--gold); border-radius: 6px; }
.primary:hover { background: #ffdd87; }
.primary span { margin-left: 7px; }
.exit { margin-left: 6px; }
.overlay .record { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.results { display: flex; justify-content: center; gap: 32px; margin-bottom: 15px; }
.results div { display: grid; gap: 3px; }
.map { position: absolute; bottom: 13px; right: 13px; padding: 7px 8px 8px; border: 1px solid #43556b; border-radius: 8px; background: #0c1625ec; font-size: 12px; }
#district { padding: 0 0 5px; color: #dce8f5; }
.map canvas { display: block; width: clamp(88px, 13vw, 154px); height: auto; border-radius: 4px; }
.capture, .repair { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); padding: 8px 12px; border-radius: 6px; background: #0c1625f2; text-align: center; border: 1px solid #3d5067; font-weight: 750; font-size: 13px; }
.capture { width: min(245px, calc(100% - 20px)); color: var(--danger); }
.capture progress { margin-top: 5px; }
.repair { top: auto; bottom: 15px; color: var(--mint); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 12px; padding: 10px 14px; color: var(--muted); font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.legend-dot, .grass-dot { display: inline-block; width: 9px; height: 9px; margin-right: 4px; background: var(--mint); border-radius: 2px; }
.grass-dot { background: #5f947d; }
.legend-label { margin-left: 4px; }
.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: flex; justify-content: space-between; gap: 7px; padding: 8px 10px; background: var(--panel); border-inline: 1px solid var(--line); }
  .touch div { display: flex; gap: 7px; }
  .touch button { display: grid; place-items: center; height: 46px; min-width: 50px; border: 1px solid #425671; border-radius: 7px; background: #1e3045; color: #f2f5fa; font-size: 22px; touch-action: none; user-select: none; }
  .touch button.active { background: var(--gold); color: #251b0c; }
}
@media (max-width: 570px) {
  .shell { width: calc(100% - 16px); padding-top: 7px; }
  .stat { padding-inline: 7px; }
  .stat span { font-size: 10px; letter-spacing: 0; }
  .stage { height: clamp(350px, calc(100dvh - 235px), 620px); }
  .legend { font-size: 11px; padding-inline: 8px; }
  .map { bottom: 8px; right: 8px; }
  .repair { left: 7px; transform: none; bottom: 9px; }
}
@media (max-height: 570px) and (orientation: landscape) {
  .stage { height: clamp(275px, calc(100dvh - 130px), 440px); }
  .menu h1 { font-size: clamp(43px, 10vh, 69px); }
}
