:root {
  color-scheme: light;
  --page: #fffdf9;
  --paper: #ffffff;
  --soft: #f4f3ef;
  --ink: #17232a;
  --muted: #6b726c;
  --rule: #ddded8;
  --blue: #24616e;
  --success: #2f8068;
  --danger: #ae5c3c;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; border-radius: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, #game:focus-visible { outline: 3px solid #5eb8c5; outline-offset: 4px; }
a { color: var(--blue); }
.topbar { height: 84px; padding: 0 40px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 24px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; font: 700 21px var(--mono); letter-spacing: 1.5px; }
.brand svg { width: 42px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; }
.brand-dot { color: var(--success); }
.edition { font: 10px var(--mono); letter-spacing: 1.4px; color: var(--muted); padding: 8px 0 8px 24px; border-left: 1px solid var(--rule); }
.text-button { margin-left: auto; border: 0; padding: 12px 0; background: none; color: var(--ink); font-size: 12px; }
.text-button span { padding-left: 10px; }
.text-button:hover { color: var(--blue); }
.shell { max-width: 1464px; margin: 0 auto; padding: 32px 40px 0; }
.mission-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 18px; }
.eyebrow { font: 10px var(--mono); letter-spacing: 1.5px; margin: 0 0 12px; }
.mission-heading .eyebrow { color: var(--muted); }
.eyebrow span { color: #babdb8; margin: 0 8px; }
h1 { margin: 0; font-size: 32px; font-weight: 450; }
.mission-status { display: flex; align-items: center; gap: 8px; font: 11px var(--mono); color: var(--muted); }
.status-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; background: #74aa89; }
.flight-deck { border: 1px solid #bfc8c3; }
.instrument-panel { display: flex; align-items: center; min-height: 90px; background: var(--paper); }
.metric { min-width: 155px; padding: 0 28px; border-right: 1px solid var(--rule); }
.metric-label { display: block; font: 9px var(--mono); letter-spacing: 1.8px; color: var(--muted); margin-bottom: 8px; }
.metric strong { display: block; font: 500 28px var(--mono); line-height: 1; }
.metric small { font-size: 13px; color: #68746c; }
.metric.rescued strong { color: var(--success); }
.metric.lost strong { color: var(--danger); }
.sorties { border: 0; }
.sorties strong { font-size: 23px; letter-spacing: 2px; }
.deck-actions { display: flex; gap: 8px; margin-left: auto; padding: 0 24px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--rule); color: var(--ink); background: none; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.icon-button:hover { background: var(--soft); }
.icon-button[aria-pressed="true"] { color: var(--muted); background: var(--soft); }
.game-viewport { position: relative; width: 100%; aspect-ratio: 1200 / 570; background: #101d2b; overflow: hidden; }
#game { position: absolute; inset: 0; outline-offset: -4px; }
#game canvas { display: block; image-rendering: pixelated; }
.scanlines { position: absolute; inset: 0; pointer-events: none; opacity: .09; background: repeating-linear-gradient(0deg, #000 0, #000 1px, transparent 1px, transparent 4px); }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #0a17235c; }
.overlay[hidden] { display: none; }
.briefing { width: 448px; padding: 34px 38px; color: #e8ede4; background: #101e2b; border: 1px solid #58717a; box-shadow: 0 12px 50px #0003; }
.briefing .eyebrow { color: #8ad1c7; font-size: 9px; margin-bottom: 18px; }
.briefing h2 { margin: 0 0 16px; font-size: 42px; font-weight: 500; line-height: 1.05; }
.briefing > p:not(.eyebrow):not(.start-hint) { font-size: 13px; line-height: 1.7; color: #acbabf; margin: 0; }
.briefing-facts { display: flex; gap: 25px; border-top: 1px solid #314552; margin-top: 22px; padding-top: 18px; color: #93a7ac; font: 10px var(--mono); }
.briefing-facts[hidden] { display: none; }
.briefing-facts b { font-size: 18px; color: #e5e9dc; font-weight: 500; margin-right: 4px; }
.launch-button { width: 100%; margin-top: 24px; padding: 14px; border: 1px solid #8ad1c7; background: #8ad1c7; color: #10272c; font: 600 12px var(--mono); letter-spacing: 1px; }
.launch-button:hover { background: #b1e6da; }
.start-hint { text-align: center; font: 8px var(--mono); color: #7f999f; letter-spacing: .5px; margin: 14px -15px 0; }
.start-hint span { margin: 0 7px; }
.radio-strip { display: flex; align-items: center; gap: 24px; padding: 15px 24px; background: #eff3ed; font-size: 11px; min-height: 48px; }
.radio-label { display: flex; align-items: center; gap: 8px; font: 9px var(--mono); letter-spacing: 1.2px; white-space: nowrap; color: #557569; }
#radio-message { color: #58695f; }
.radio-frequency { margin-left: auto; color: #586e60; font: 9px var(--mono); white-space: nowrap; }
.field-guide { display: grid; grid-template-columns: 1.15fr 1fr 1fr; margin-top: 26px; gap: 28px; }
.guide-section + .guide-section { padding-left: 28px; border-left: 1px solid var(--rule); }
.guide-section .eyebrow { color: #5a6560; font-size: 9px; }
.guide-section p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 0; }
kbd { display: inline-block; background: #f4f3ed; border: 1px solid #d9ddd4; padding: 3px 5px; font: 9px var(--mono); color: #586660; }
.key-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; margin-bottom: 8px; }
.key-row kbd { margin-right: 3px; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--rule); margin-top: 28px; padding: 18px 0; font-size: 9px; color: #697368; line-height: 1.6; }
footer b { font-weight: 500; color: #5b7766; }
.footer-dot { margin: 0 8px; }
.touch-controls { display: none; user-select: none; touch-action: none; padding-top: 18px; justify-content: space-between; gap: 20px; }
.touch-controls button { min-height: 48px; min-width: 48px; border: 1px solid var(--rule); background: var(--soft); color: var(--ink); touch-action: none; font: 12px var(--mono); }
.touch-controls button.active { background: #cce4dc; }
.dpad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); gap: 3px; }
.dpad [data-control="up"] { grid-column: 2; }
.dpad [data-control="left"] { grid-column: 1; }
.touch-actions { display: flex; gap: 5px; align-items: end; }
.touch-actions button { padding: 0 10px; font-size: 9px; }
.touch-actions .fire-button { background: #dcebe2; border-color: #8aafa1; min-width: 70px; }
dialog { max-width: 600px; width: calc(100% - 32px); padding: 28px; border: 1px solid var(--rule); background: var(--page); color: var(--ink); max-height: 88dvh; }
dialog::backdrop { background: #071a25b8; }
.manual-heading { display: flex; justify-content: space-between; align-items: start; }
.manual-heading h2 { font-weight: 450; margin: 0; font-size: 28px; }
dialog p { font-size: 12px; line-height: 1.8; color: #626e67; }
dialog dl { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 11px; line-height: 1.7; padding: 18px 0; border-block: 1px solid var(--rule); }
dialog dt { font: 11px var(--mono); }
dialog dd { margin: 0; color: #626e67; }
.source-note { border-top: 1px solid var(--rule); padding-top: 14px; font-size: 10px; }
.game-error { position: absolute; inset: 16px 16px auto; background: #fcf4e9; color: #742e14; padding: 15px; font-size: 12px; z-index: 5; }
.game-viewport:fullscreen { aspect-ratio: auto; width: 100vw; height: 100dvh; display: flex; align-items: center; }
.game-viewport:fullscreen .touch-controls { position: absolute; bottom: 12px; left: 20px; right: 20px; z-index: 4; }
@media (pointer: coarse) { .touch-controls { display: flex; } }
@media (min-width: 1500px) { .shell { padding-top: 40px; } }
@media (max-width: 1000px) {
  .topbar { padding: 0 24px; height: 72px; }
  .shell { padding: 26px 24px 0; }
  .metric { min-width: 126px; padding: 0 20px; }
  .deck-actions { padding: 0 16px; gap: 5px; }
  .field-guide { gap: 20px; }
  .guide-section + .guide-section { padding-left: 20px; }
  .briefing { padding: 24px 30px; }
  .briefing h2 { font-size: 32px; }
  .briefing-facts { margin-top: 16px; padding-top: 12px; }
  .launch-button { margin-top: 18px; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 16px; height: 64px; gap: 14px; }
  .brand { font-size: 16px; letter-spacing: .8px; gap: 8px; }
  .brand svg { width: 32px; }
  .edition { display: none; }
  .text-button { font-size: 10px; }
  .shell { padding: 22px 14px 0; }
  .mission-heading { align-items: end; margin-bottom: 20px; gap: 8px; }
  .mission-heading .eyebrow { font-size: 8px; letter-spacing: .5px; }
  h1 { font-size: 25px; }
  .mission-status { font-size: 8px; gap: 5px; padding-bottom: 4px; }
  .instrument-panel { min-height: 76px; flex-wrap: wrap; padding: 14px 0 0; }
  .metric { min-width: 0; flex: 1; padding: 0 10px; }
  .metric-label { font-size: 7px; letter-spacing: .4px; margin-bottom: 6px; }
  .metric strong { font-size: 22px; }
  .metric small { font-size: 10px; }
  .sorties strong { font-size: 16px; letter-spacing: 0; }
  .deck-actions { width: 100%; justify-content: end; padding: 10px; gap: 6px; }
  .icon-button { width: 32px; height: 32px; }
  .game-viewport { aspect-ratio: 1.65; min-height: 270px; }
  .briefing { width: calc(100% - 34px); max-width: 390px; padding: 16px 20px; }
  .briefing .eyebrow { font-size: 8px; margin-bottom: 9px; }
  .briefing h2 { font-size: 27px; margin-bottom: 10px; }
  .briefing > p:not(.eyebrow):not(.start-hint) { font-size: 11px; line-height: 1.5; }
  .briefing-facts { margin-top: 12px; padding-top: 10px; gap: 20px; }
  .briefing-facts b { font-size: 15px; }
  .launch-button { padding: 11px; margin-top: 14px; }
  .start-hint { display: none; }
  .radio-strip { padding: 11px 12px; gap: 12px; align-items: start; }
  .radio-label { font-size: 7px; gap: 5px; margin-top: 2px; letter-spacing: .5px; }
  #radio-message { font-size: 10px; line-height: 1.6; }
  .radio-frequency { display: none; }
  .touch-controls { display: flex; }
  .field-guide { grid-template-columns: 1fr; gap: 16px; margin-top: 22px; }
  .guide-section + .guide-section { border-left: 0; border-top: 1px solid var(--rule); padding: 16px 0 0; }
  .key-row { max-width: 380px; }
  footer { flex-direction: column; align-items: start; gap: 4px; margin-top: 20px; }
  dialog { padding: 22px; }
  dialog dl { grid-template-columns: 100px 1fr; gap: 10px; }
}
@media (max-width: 370px) { .touch-controls { gap: 8px; } .touch-actions { gap: 3px; } .touch-actions button { padding: 0 6px; min-width: 42px; } .touch-actions .fire-button { min-width: 60px; } .dpad { grid-template-columns: repeat(3, 42px); } .dpad button { min-width: 42px; } }
@media (max-height: 500px) and (orientation: landscape) { .briefing { padding: 14px 24px; width: 460px; } .briefing h2 { font-size: 24px; } .briefing-facts, .start-hint { display: none; } .launch-button { margin-top: 12px; padding: 10px; } }
