:root {
  --bg: #050914;
  --panel: #0c1526;
  --line: #1d2f4d;
  --ink: #e8f1ff;
  --dim: #9db1cc;
  --cyan: #19e3ff;
  --amber: #ffd166;
  --red: #ff5470;
  --green: #7cfc9a;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #0d1c3a, var(--bg));
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--cyan); color: #001; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
.app { max-width: 1180px; margin: 0 auto; padding: 12px 12px 24px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 4px 12px; }
.brand {
  font-weight: 800; letter-spacing: 0.22em; font-size: 15px;
}
.brand .sub { color: var(--dim); font-weight: 600; letter-spacing: 0.3em; font-size: 11px; margin-left: 8px; }
.brand-mark { color: var(--cyan); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.release { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 240px; gap: 12px; align-items: start; }
.side .panel, .stage { background: linear-gradient(180deg, rgba(18,30,52,.92), rgba(8,14,28,.94)); border: 1px solid var(--line); border-radius: var(--radius); }
.side .panel { padding: 12px; margin-bottom: 12px; }
.side h2 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.24em; color: var(--cyan); text-transform: uppercase; }
.row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--dim); }
.row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.meter-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin: 8px 0 4px; }
.meter { height: 12px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #060c18; }
.meter > i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #37ff9e, #19e3ff); transition: width 120ms linear; }
.meter.amber > i { background: linear-gradient(90deg, #ff9d2e, var(--amber)); }
.meter.cyan > i { background: linear-gradient(90deg, #1e90ff, var(--cyan)); }
.meter.red > i { background: linear-gradient(90deg, #ff2e63, #ff9d2e); }
#threatBar > i { width: 0%; }
.power { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.power li { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color: var(--dim); }
.power li b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: #060c18; border: 1px solid var(--line); color: var(--ink); }
.power li.on { color: var(--ink); border-color: var(--cyan); }
.power span { margin-left: auto; font-variant-numeric: tabular-nums; }
.hint { color: var(--dim); font-size: 12.5px; line-height: 1.45; }
.friendly-cue { color: var(--cyan); }
.hostile-cue { color: var(--red); }
noscript > p { padding: 1rem; }
.stage { padding: 10px; }
.game-wrap { position: relative; display: grid; place-items: center; background: #02040a; border-radius: 8px; overflow: hidden; }
/* Cockpit canopy: a subtle glass frame so the battlefield reads as a fighter HUD. */
.game-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
  box-shadow: inset 0 0 90px rgba(2, 6, 14, 0.75), inset 0 0 18px rgba(25, 227, 255, 0.08);
  border: 1px solid rgba(29, 47, 77, 0.9);
}
.game-wrap::before {
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 46px; pointer-events: none;
  background: linear-gradient(180deg, rgba(160, 220, 255, 0.10), rgba(160, 220, 255, 0));
  border-radius: 0 0 50% 50%;
}
canvas { display: block; border-radius: 8px; max-width: 100%; touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }

/* Touch controls: relative drag stick on the battlefield plus big action
   buttons. Hidden on fine-pointer (mouse) setups; shown on touch devices. */
/* Classic Game Boy-style touch cluster: D-pad (left), A/B (right),
   START/PAUSE pill (center), in a control bar BELOW the battlefield so the
   play area stays unobstructed. Hidden on fine-pointer (mouse) setups; shown
   on touch devices. The drag-anywhere stick still works on the canvas. */
.pad-bar {
  display: none;
  grid-template-columns: auto auto auto;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  padding: 10px 6px calc(10px + var(--safe-b));
}
.gbpad, .gb-abc, .gb-start { display: none; }
.gbpad, .gb-abc, .gb-start, .gbpad button {
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.gbpad {
  width: 148px; height: 148px;
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.gbpad button {
  border: 0; padding: 0; font-size: 0; color: transparent; position: relative;
  background: linear-gradient(180deg, #2c2f36, #16181d);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -2px 4px rgba(0,0,0,0.5);
}
.gbpad button::after {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  border: 5px solid transparent; opacity: 0.5;
}
.gb-up { grid-area: 1 / 2; border-radius: 10px 10px 0 0; }
.gb-up::after { border-bottom-color: rgba(255,255,255,0.3); margin-top: -3px; }
.gb-down { grid-area: 3 / 2; border-radius: 0 0 10px 10px; }
.gb-down::after { border-top-color: rgba(255,255,255,0.3); margin-top: 3px; }
.gb-left { grid-area: 2 / 1; border-radius: 10px 0 0 10px; }
.gb-left::after { border-right-color: rgba(255,255,255,0.3); margin-left: -3px; }
.gb-right { grid-area: 2 / 3; border-radius: 0 10px 10px 0; }
.gb-right::after { border-left-color: rgba(255,255,255,0.3); margin-left: 3px; }
.gb-center { grid-area: 2 / 2; display: block; background: linear-gradient(180deg, #2c2f36, #16181d); }
.gbpad button.active, .gbpad button:active { background: #3b404b; }
.gb-abc { position: relative; width: 148px; height: 118px; }
.gb-round {
  position: absolute; width: 62px; height: 62px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 32% 30%, #c25372, #8d2f4f 58%, #6e2340);
  box-shadow: 0 3px 6px rgba(0,0,0,0.55), inset 0 1px 1px rgba(255,255,255,0.25);
}
.gb-round span { color: #f6e9ee; font-weight: 800; font-size: 20px; letter-spacing: 0.02em; }
.gb-round em {
  position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: #93a1b5; white-space: nowrap;
}
.gb-a { right: 2px; top: 0; }
.gb-b { left: 2px; bottom: 14px; }
.gb-round:active { filter: brightness(1.25); }
.gb-start {
  width: 96px; height: 30px; border-radius: 999px; border: 0; padding: 0;
  align-self: center;
  background: linear-gradient(180deg, #2c2f36, #16181d); color: #aab4c4;
  font-size: 10px; font-weight: 800; letter-spacing: 0.22em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 2px 4px rgba(0,0,0,0.5);
  align-items: center; justify-content: center; text-align: center;
}
.gb-start:active { color: #fff; }
.touch-only { display: none; }
.stick {
  display: none;
  position: absolute; z-index: 4; width: 104px; height: 104px; margin: -52px 0 0 -52px;
  border: 2px solid rgba(25, 227, 255, 0.55); border-radius: 50%;
  background: rgba(25, 227, 255, 0.08); pointer-events: none;
}
.stick.on { display: block; }
.stick i {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%; background: rgba(25, 227, 255, 0.35); border: 1px solid var(--cyan);
}
@media (pointer: coarse) {
  .pad-bar { display: grid; }
  .gbpad { display: grid; }
  .gb-abc { display: block; }
  .gb-start { display: grid; }
  .touch-only { display: revert; }
}
.has-touch .pad-bar { display: grid; }
.has-touch .gbpad { display: grid; }
.has-touch .gb-abc { display: block; }
.has-touch .gb-start { display: grid; }
.has-touch .touch-only { display: revert; }
.overlay { z-index: 10; }
@media (hover: none) and (pointer: coarse) {
  html { -webkit-text-size-adjust: 100%; }
}
.banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); max-width: 72%; text-align: center;
  background: rgba(5,10,20,.85); border: 1px solid var(--amber); color: var(--amber);
  padding: 8px 14px; border-radius: 999px; letter-spacing: 0.12em; font-weight: 700; font-size: 13px;
}
.overlay {
  position: absolute; inset: 12px; background: rgba(4,8,18,.9); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; overflow: auto; backdrop-filter: blur(2px);
}
.overlay h1 { margin: 0 0 8px; font-size: clamp(22px, 4vw, 34px); letter-spacing: 0.04em; }
.overlay h2 { font-size: 13px; letter-spacing: 0.2em; color: var(--cyan); text-transform: uppercase; }
.overlay p, .overlay li { line-height: 1.55; }
.controls { padding-left: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
button { font: inherit; cursor: pointer; }
.primary {
  background: linear-gradient(180deg, #25f0ff, #0fa8d8); color: #00141c; border: 0;
  padding: 12px 18px; border-radius: 10px; font-weight: 800; letter-spacing: 0.04em; min-height: 44px;
}
.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 10px; min-height: 44px;
}
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.check input { width: 22px; height: 22px; }
.lock { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-weight: 700; }
.best { color: var(--green); font-weight: 800; }
.credit-body { max-width: 60ch; }
.foot { color: var(--dim); font-size: 12px; text-align: center; padding: 12px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: #060c18; }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side.left { order: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .side.left .panel { margin: 0; }
  .side.right { order: 3; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .side.right .panel { margin: 0; }
  .stage { order: 1; }
}
@media (max-width: 560px) {
  .side.left, .side.right { grid-template-columns: 1fr; }
  .overlay { inset: 6px; padding: 14px; }
  .topbar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .meter > i { transition: none; }
}
