:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #edf5e9;
  --muted: #b4c5c0;
  --mint: #b7f7d2;
  --mint-dark: #183c31;
  --amber: #ffbb82;
  --line: rgba(196, 233, 220, .19);
  --panel: #101b1b;
  --space: clamp(16px, 3.1vw, 46px);
  --edge: max(var(--space), env(safe-area-inset-left));
  --chrome: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #121b1b; color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
#app { isolation: isolate; position: relative; min-height: 100vh; min-height: 100svh; height: 100dvh; overflow: hidden; }
#field, .stage-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
#field { display: block; background: #252e30; touch-action: none; }
.stage-shade { pointer-events: none; background: linear-gradient(180deg, #0b1314bd, transparent 23%, transparent 74%, #0a1114c7), radial-gradient(ellipse 78% 78% at 50% 45%, transparent 39%, #0b12173b 70%, #0b1217a0); }
[data-phase="ready"] .stage-shade { background: linear-gradient(90deg, #0c1517f2 0%, #0c1517bd 22%, #0c151754 55%, transparent 80%), linear-gradient(180deg,#0b1416c9, transparent 32%, transparent 60%, #0a1115da); }
.topbar { position: absolute; inset: 0 0 auto; height: var(--chrome); z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space); padding-left: var(--edge); border-bottom: 1px solid var(--line); background: #10191aab; }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 12px; font-size: .81rem; font-weight: 900; letter-spacing: .135em; white-space: nowrap; }
.brand-accent { color: var(--mint); }
.brand-mark { width: 24px; height: 23px; display: flex; align-items: flex-end; gap: 3px; transform: skew(-19deg); }
.brand-mark i { background: var(--mint); display: block; width: 5px; height: 13px; }
.brand-mark i:nth-child(2) { height: 19px; }
.brand-mark i:nth-child(3) { height: 15px; opacity: .55; }
.top-actions { display: flex; gap: 7px; align-items: center; }
.utility, .text-button { background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 7px 9px; color: var(--muted); font-size: .83rem; font-weight: 700; white-space: nowrap; }
.utility:hover, .text-button:hover { background: #b7f7d21a; border-color: var(--line); color: var(--ink); }
.pause-button { display: none; border-color: var(--line); }
[data-phase="playing"] .pause-button { display: inline-block; }
.briefing { position: absolute; inset: auto auto clamp(87px, 15.5vh, 168px) var(--edge); z-index: 2; max-width: min(590px, calc(100% - var(--space) * 2)); }
.mission-label { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--mint); text-transform: uppercase; letter-spacing: .18em; font-weight: 800; font-size: .77rem; line-height: 1.5; }
.mission-label > span { width: 24px; height: 2px; background: currentColor; }
h1 { margin: 15px 0 20px -.065em; font-family: "Arial Narrow", "Liberation Sans Narrow", Impact, system-ui, sans-serif; font-stretch: condensed; font-size: clamp(67px, 10.6vw, 161px); font-weight: 950; line-height: .76; letter-spacing: -.073em; text-transform: uppercase; }
h1 span { display: block; }
h1 span + span { color: var(--mint); }
.briefing-copy { color: #d0ded9; max-width: 420px; margin: 26px 0; font-size: clamp(.97rem, 1.4vw, 1.14rem); line-height: 1.55; }
.start-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { min-height: 49px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 18px; border: 1px solid transparent; border-radius: 4px; font-size: .91rem; font-weight: 850; transition: background .15s, border-color .15s; }
.button.primary { color: #14261e; background: var(--mint); border-color: var(--mint); }
.button.primary:hover { background: #e1ffec; border-color: #e1ffec; }
.button.secondary { color: #e5f4ef; border-color: #9dc4b85c; background: #142020a8; }
.button.secondary:hover { background: #263c36; border-color: #9dc4b8a8; }
.camera-icon { width: 16px; height: 12px; position: relative; border-radius: 2px; border: 2px solid currentColor; }
.camera-icon::before { content: ""; position: absolute; left: 3px; top: -5px; width: 6px; height: 4px; border: 2px solid currentColor; border-bottom: 0; border-radius: 1px; }
.camera-icon::after { content: ""; position: absolute; inset: 2px 4px; border-radius: 50%; border: 1px solid currentColor; }
.briefing-note { color: var(--muted); margin: 13px 0 0; font-size: .83rem; }
.camera-panel { position: absolute; z-index: 3; width: clamp(174px, 20.4vw, 282px); top: calc(var(--chrome) + 22px); right: var(--space); border: 1px solid var(--line); border-radius: 6px; background: #111d1de8; padding: 11px; box-shadow: 0 12px 25px #060b0c38; }
.camera-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 1px 8px; color: #e2efe9; font-size: .81rem; font-weight: 800; }
.camera-tag { display: inline-flex; align-items: center; gap: 5px; color: #9cafaa; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.camera-tag::before, .camera-signals i { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.camera-tag[data-status="ready"], .camera-signals .active { color: var(--mint); }
.camera-tag[data-status="loading"], .camera-tag[data-status="error"] { color: var(--amber); }
.camera-screen { isolation: isolate; position: relative; background: #0b1417; border: 1px solid #6f9e923d; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 3px; }
.camera-screen video, .camera-screen canvas { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; transform: scaleX(-1); opacity: 0; }
.camera-screen[data-live="true"] video { opacity: .84; }
.camera-screen[data-status="ready"] canvas { opacity: 1; }
.camera-placeholder { background: repeating-linear-gradient(180deg, transparent 0 3px, #b8e7db08 3px 4px), radial-gradient(ellipse at center,#30413b,#0e191c 72%); position: absolute; inset: 0; display: grid; place-items: center; }
.camera-screen[data-live="true"] .camera-placeholder { display: none; }
.scan-target { position: relative; width: 52%; height: 70%; display: grid; place-items: center; color: #a7d3bd9c; }
.scan-target > i { position: absolute; width: 11px; height: 11px; border: 1px solid currentColor; }
.scan-target > i:nth-child(1) { inset: 0 auto auto 0; border-right: 0; border-bottom: 0; }
.scan-target > i:nth-child(2) { inset: 0 0 auto auto; border-left: 0; border-bottom: 0; }
.scan-target > i:nth-child(3) { inset: auto 0 0 auto; border-left: 0; border-top: 0; }
.scan-target > i:nth-child(4) { inset: auto auto 0 0; border-right: 0; border-top: 0; }
.scan-person { width: 44px; height: 49px; position: relative; display: block; color: #8cb6a5c9; }
.scan-person b { position: absolute; display: block; }
.scan-person b:nth-child(1) { width: 17px; height: 17px; border-radius: 50%; border: 1px solid currentColor; left: 13px; top: 1px; }
.scan-person b:nth-child(2) { top: 21px; left: 2px; right: 2px; height: 24px; border: 1px solid currentColor; border-bottom: 0; border-radius: 18px 18px 0 0; }
.scan-person b:nth-child(3) { width: 1px; height: 11px; background: currentColor; bottom: 4px; left: 13px; transform: rotate(12deg); }
.scan-person b:nth-child(4) { width: 1px; height: 11px; background: currentColor; bottom: 4px; right: 13px; transform: rotate(-12deg); }
.camera-corner { position: absolute; width: 10px; height: 10px; border: 1px solid #b7f7d2aa; pointer-events: none; }
.corner-tl { inset: 5px auto auto 5px; border-right: 0; border-bottom: 0; }
.corner-br { inset: auto 5px 5px auto; border-left: 0; border-top: 0; }
.camera-signals { display: flex; gap: 10px; justify-content: space-between; padding: 9px 1px 0; }
.camera-signals span { display: flex; align-items: center; gap: 4px; color: #93a6a1; font-size: .67rem; text-transform: uppercase; font-weight: 750; }
.camera-signals i { width: 5px; height: 5px; }
.camera-message { margin: 8px 1px 0; line-height: 1.4; color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.camera-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 4px; }
.camera-actions:has(> :not([hidden])) { margin-top: 4px; }
.text-button { padding: 4px 5px; margin-left: -2px; font-size: .72rem; text-decoration: none; }
[data-phase="playing"][data-mode="keyboard"] .camera-panel { display: none; }
.footer { position: absolute; inset: auto 0 0; z-index: 2; min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; border-top: 1px solid var(--line); padding: 7px var(--space) max(7px, env(safe-area-inset-bottom)); background: #0c171ae0; color: #b8cac6; font-size: .78rem; }
#footer-context { color: #d2e7df; font-weight: 800; }
#footer-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; }
#footer-hint i { display: block; width: 3px; height: 3px; border-radius: 50%; background: #80a497; }
.combat-ui { position: absolute; inset: 0; pointer-events: none; }
.integrity { position: absolute; top: calc(var(--chrome) + 25px); left: var(--edge); width: min(170px, 28vw); }
.integrity > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #ecf9f1; text-shadow: 0 1px 6px black; font-size: .76rem; font-weight: 850; }
.health-track { margin-top: 6px; height: 6px; overflow: hidden; border: 1px solid #e2f8ed5e; border-radius: 2px; background: #0e1818cb; }
.health-track span { display: block; width: 100%; height: 100%; background: var(--mint); transition: width .14s; }
.health-track.low span { background: var(--amber); }
.mission-strip { position: absolute; left: 50%; top: calc(var(--chrome) + 21px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 3px; background: #101b1be0; font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
#wave-label { color: var(--mint); }
#enemy-label { color: var(--muted); }
.strip-divider { height: 12px; width: 1px; background: var(--line); }
.boss-hud { --boss-color: #ffc287; position: absolute; top: calc(var(--chrome) + 62px); left: 50%; transform: translateX(-50%); width: min(310px, 38vw); padding: 7px 10px; border: 1px solid #f6a05b70; border-radius: 4px; background: #191921ed; color: var(--boss-color); }
.boss-hud.overdrive { --boss-color: #ff907f; }
.boss-hud.charging { border-color: var(--boss-color); }
.boss-label { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.boss-label span { font-size: .65rem; text-align: right; white-space: nowrap; }
.boss-track { height: 6px; margin-top: 6px; overflow: hidden; border-radius: 2px; background: #563132; }
.boss-track span { display: block; height: 100%; width: 100%; background: var(--boss-color); transition: width .15s; }
.combat-notice { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font-size: clamp(.88rem, 2vw, 1.3rem); letter-spacing: .08em; font-weight: 900; text-align: center; color: var(--mint); text-transform: uppercase; text-shadow: 0 2px 8px #000; }
.reticle-position { position: absolute; top: 0; left: 0; will-change: transform; }
.reticle { position: absolute; top: 0; left: 0; width: clamp(31px, 4.4vh, 48px); aspect-ratio: 1; transform: translate(-50%, -50%); color: #defff0; }
.reticle i, .reticle b { position: absolute; display: block; background: currentColor; border-radius: 1px; box-shadow: 0 0 0 1px #10221ed9; }
.reticle i:nth-child(1), .reticle i:nth-child(3) { left: calc(50% - 1px); width: 2px; height: 24%; }
.reticle i:nth-child(2), .reticle i:nth-child(4) { top: calc(50% - 1px); height: 2px; width: 24%; }
.reticle i:nth-child(1) { top: 0; }
.reticle i:nth-child(2) { right: 0; }
.reticle i:nth-child(3) { bottom: 0; }
.reticle i:nth-child(4) { left: 0; }
.reticle b { width: 4px; height: 4px; left: calc(50% - 2px); top: calc(50% - 2px); }
.reticle.motion-armed { color: var(--mint); }
.reticle.motion-assisted { color: #ffe09a; }
.reticle.motion-assisted::after { content: ""; position: absolute; inset: -5px; border: 1px solid #ffe09a9c; border-radius: 50%; }
.reticle.confirmed { color: #ffae68; transform: translate(-50%, -50%) rotate(45deg) scale(1.28); }
.arsenal { position: absolute; left: var(--edge); bottom: 65px; display: flex; gap: 8px; }
.hud-block { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-width: 100px; gap: 2px; border: 1px solid var(--line); border-radius: 4px; background: #101b1be0; padding: 8px 11px; }
.hud-block > span:first-child { color: var(--muted); text-transform: uppercase; font-size: .67rem; letter-spacing: .075em; font-weight: 800; }
.hud-block strong { color: var(--ink); font-size: 1.72rem; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-block small { color: var(--mint); font-size: .68rem; line-height: 1.3; }
#ammo-max { color: var(--muted); font-size: .8rem; font-weight: 700; }
.fire-controls { display: none; }
.dialog { width: min(550px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid #719f8e79; border-radius: 8px; background: #111d1df7; color: var(--ink); box-shadow: 0 20px 70px #0009; }
.dialog::backdrop { background: #081011a8; backdrop-filter: blur(4px); }
.dialog-inner { padding: clamp(18px, 4vw, 32px); }
.dialog h2 { font-size: clamp(1.88rem, 5vw, 2.8rem); margin: 4px 0 13px; letter-spacing: -.055em; line-height: 1.05; }
.dialog p { color: var(--muted); line-height: 1.52; }
.dialog .mission-label { color: var(--mint); }
.control-list { border-block: 1px solid var(--line); }
.control-list > div { display: grid; grid-template-columns: 60px 1fr; gap: 9px; padding: 10px 0; color: var(--muted); font-size: .9rem; line-height: 1.42; }
.control-list > div + div { border-top: 1px solid var(--line); }
.control-list strong { color: var(--ink); }
.input-help { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 13px; margin: 12px 0 4px; font-size: .78rem; color: var(--muted); }
.input-help > span { display: flex; align-items: center; gap: 3px; }
kbd { font-family: inherit; font-weight: 750; color: var(--ink); min-width: 18px; text-align: center; border: 1px solid var(--line); padding: 1px 4px; border-radius: 3px; }
.input-note { font-size: .8rem; margin: 6px 0 0; }
.sound-check { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.sound-check .utility { border-color: var(--line); }
.dialog-actions { margin-top: 18px; }
[data-phase="playing"] .fire-controls {
  display: flex;
}
.fire-controls { position: absolute; right: var(--space); bottom: max(60px, env(safe-area-inset-bottom)); align-items: center; gap: 8px; }
.fire-controls button { pointer-events: auto; user-select: none; touch-action: manipulation; padding: 0 12px; min-height: 44px; background: #101b1be6; border: 1px solid #9dc4b86e; border-radius: 5px; font-size: .82rem; font-weight: 800; color: var(--ink); }
.fire-controls button:active { filter: brightness(.82); }
.fire-controls .fire-button { min-height: 54px; min-width: 64px; background: var(--mint); color: #14261e; }
@media (max-width: 420px) {
  [data-phase="playing"] .arsenal { bottom: 125px; }
}
@media (max-width: 620px) {
  :root { --chrome: 52px; }
  .brand { gap: 7px; font-size: .65rem; letter-spacing: .07em; }
  .brand-mark { transform: skew(-19deg) scale(.78); width: 20px; }
  .top-actions { gap: 1px; }
  .utility { font-size: .74rem; padding: 6px 5px; }
  .briefing { inset-block-end: clamp(71px, 15vh, 127px); }
  .briefing-copy { max-width: 330px; margin: 18px 0; }
  h1 { font-size: clamp(53px, 15.6vw, 100px); }
  .camera-panel { top: calc(var(--chrome) + 13px); width: clamp(130px, 42vw, 205px); padding: 6px; }
  .camera-heading { font-size: .71rem; margin-bottom: 5px; }
  .camera-tag, .camera-signals span { font-size: .59rem; }
  .camera-message { font-size: .68rem; }
  .camera-signals { gap: 3px; padding-top: 5px; }
  .camera-signals span { gap: 2px; }
  .mission-strip { top: calc(var(--chrome) + 61px); left: var(--edge); transform: none; font-size: .65rem; gap: 5px; padding: 6px; }
  .boss-hud { top: calc(var(--chrome) + 96px); left: var(--edge); transform: none; width: min(218px, 47vw); padding: 6px; }
  .boss-label { gap: 3px; font-size: .66rem; letter-spacing: .03em; }
  .boss-label span { font-size: .59rem; }
  .integrity { top: calc(var(--chrome) + 17px); width: min(145px, 41vw); }
  .integrity > div:first-child { font-size: .71rem; }
  .footer { flex-wrap: wrap; gap: 2px 7px; font-size: .7rem; }
  #footer-hint { gap: 4px 7px; }
  .button { min-height: 44px; padding-inline: 11px; font-size: .82rem; }
}
@media (max-height: 690px) and (min-width: 621px) {
  .briefing { bottom: 74px; }
  h1 { font-size: clamp(62px, min(10vw, 16vh), 112px); }
  .briefing-copy { margin: 18px 0; }
}
@media (max-height: 675px) and (max-width: 620px) and (orientation: portrait) {
  .briefing { bottom: 63px; }
  .camera-panel { width: 133px; }
  .camera-screen { aspect-ratio: 1.9; }
  .camera-message { margin-top: 4px; }
  h1 { margin-block: 10px 13px; }
}
@media (max-height: 460px) and (orientation: landscape) {
  :root { --chrome: 39px; --space: 15px; }
  .briefing { bottom: 48px; }
  h1 { font-size: clamp(53px, 16vh, 77px); margin-block: 7px 8px; }
  .briefing-copy { margin: 10px 0; font-size: .86rem; }
  .briefing-note { margin-top: 5px; }
  .button { min-height: 36px; padding-block: 4px; }
  .camera-panel { top: calc(var(--chrome) + 8px); width: 160px; padding: 6px; }
  .footer { min-height: 34px; }
  .arsenal { bottom: 42px; }
  .fire-controls { bottom: 40px; }
  .mission-strip { top: calc(var(--chrome) + 11px); }
  .boss-hud { top: calc(var(--chrome) + 49px); }
  .integrity { top: calc(var(--chrome) + 12px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
