:root {
  color-scheme: dark;
  font-family: "Bahnschrift", "Arial", sans-serif;
  --salt: #e7edf0;
  --muted: #a2b6bf;
  --amber: #f0ae6c;
  --ice: #88d9dc;
  --ink: #0b1720;
  --edge: clamp(20px, 4.15vw, 76px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ink); color: var(--salt); }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, video:focus-visible { outline: 2px solid var(--ice); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .45; }
#game { width: 100%; height: 100vh; height: 100dvh; position: relative; overflow: hidden; isolation: isolate; }
canvas, .grade { position: absolute; width: 100%; height: 100%; inset: 0; }
#scene { image-rendering: pixelated; touch-action: none; }
#effects, .grade { pointer-events: none; }
#game[data-preview="true"] { min-height: 100dvh; height: auto; overflow: visible; background: #0a131b; }
[data-preview="true"] :is(canvas,.grade) { display: none; }
#field-preview { max-width: 710px; margin: auto; padding: clamp(25px, 6vw, 56px) var(--edge) 42px; }
#field-preview header { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
#field-preview h1 { font-size: clamp(65px, 18vw, 112px); }
#field-preview header p { color: var(--amber); white-space: nowrap; padding-bottom: 5px; }
.preview-player { margin: 22px 0 24px; }
.preview-player :is(img,video) { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #060c12; border: 1px solid #54636b; }
.preview-player figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
#field-preview h2 { font-size: clamp(26px, 7vw, 43px); letter-spacing: -.025em; }
#field-preview > p { max-width: 46ch; line-height: 1.55; margin-top: 10px; }
#preview-requirement { border-top: 1px solid #627078; margin-top: 20px; padding-top: 14px; color: #f3bf92; }
#field-preview small { display: block; max-width: 42ch; margin-top: 19px; color: var(--muted); }
.grade {
  background: radial-gradient(ellipse at 51% 43%, transparent 49%, #02070cb3 110%),
    linear-gradient(0deg, #03080ed9, transparent 23%, transparent 81%, #03080ea6);
}
#game[data-phase="title"] .grade {
  background: linear-gradient(90deg, #050b13ed 0%, #080f18d6 23%, #08101946 49%, transparent 67%),
    linear-gradient(0deg, #050a11e6, transparent 31%, transparent 79%, #050a11bb);
}
#topbar {
  position: absolute; z-index: 2; inset: clamp(18px, 4.6vh, 48px) var(--edge) auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none;
}
.dispatch, .settings { display: flex; align-items: center; gap: 12px; }
.dispatch, .location, .overline, .icon, .meter, #objective-input, #loadout, #hint, #radio, .setup-note {
  font-family: "Cascadia Mono", Consolas, monospace;
}
.dispatch { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: #c0d1d7; }
.signal { width: 7px; height: 7px; background: var(--amber); transform: rotate(45deg); }
.settings { pointer-events: auto; }
.icon { font-size: 11px; background: #0a161dc9; border: 1px solid #647d874d; padding: 8px 10px; }
.icon:hover, .secondary:hover { border-color: var(--amber); }
.icon span { color: var(--amber); margin-left: 5px; }
.icon kbd { font-size: inherit; margin-left: 3px; color: var(--muted); }
.title-card { position: absolute; inset: 50% auto auto var(--edge); transform: translateY(-46%); }
.overline { color: var(--amber); font-size: 11px; font-weight: 600; letter-spacing: .19em; margin: 0 0 12px; }
h1, h2, p { margin: 0; }
h1 {
  font-family: Impact, "Arial Black", sans-serif; font-weight: 900; font-size: clamp(104px, 15.5vw, 242px);
  letter-spacing: .006em; line-height: .91; margin-left: -.035em; color: #f0f1e8;
}
h1 span { color: var(--amber); }
.title-rule { height: 1px; width: min(100%, 362px); background: linear-gradient(90deg, #c2a581ad, #c2a58117); margin: 22px 0 19px; }
.title-card h2 { font-size: clamp(23px, 3vw, 42px); font-weight: 650; letter-spacing: -.035em; }
.synopsis { color: #b4c5cd; max-width: 29ch; margin: 10px 0 28px; line-height: 1.5; font-size: 15px; }
.title-actions { display: flex; flex-wrap: wrap; gap: 9px; max-width: calc(100vw - 2 * var(--edge)); }
.primary, .secondary { min-height: 48px; padding: 0 18px; font-weight: 700; text-align: left; }
.primary {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 29px;
  border: 1px solid #ffd09c; color: #161211; background: #eab17a;
  box-shadow: 0 4px 15px #0005; transition: background .15s ease;
}
.primary:hover { background: #ffd19e; }
.primary span { font-size: 19px; }
.secondary { background: #101b23; border: 1px solid #667b86; }
.setup-note { color: #9fb3bd; font-size: 11px; margin-top: 13px; }
.quick-note { color: #b9c9cf; font-size: 13px; max-width: 35ch; line-height: 1.4; margin-top: 10px; }
.setup-note span { color: #d6a072; margin: 0 5px; }
.location { position: absolute; right: var(--edge); bottom: 5.1vh; color: #b1c2ca; font-size: 11px; text-align: right; letter-spacing: .15em; }
.location span { display: block; margin-top: 5px; }
.location span:first-child { color: var(--amber); }
#hud { pointer-events: none; position: absolute; inset: 0; text-shadow: 0 2px 8px #04080f, 0 1px 3px #04080f; }
.meter { position: absolute; width: clamp(154px, 21vw, 300px); }
.pilot { top: calc(clamp(18px, 4.6vh, 48px) + 52px); left: var(--edge); }
.enemy { top: calc(clamp(18px, 4.6vh, 48px) + 52px); right: var(--edge); }
.meter-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; font-size: 11px; letter-spacing: .06em; font-weight: 700; }
.meter-label small { color: #e1a28b; font-size: 11px; padding-left: 5px; }
.track { height: 6px; background: #131d25ce; border: 1px solid #99b3bf6e; }
.track i { height: 100%; display: block; transform-origin: left; background: var(--ice); }
.enemy .track i { background: #e68a63; }
.enemy .track i { transform-origin: right; }
[data-grade="damaged"] .track i { background: #ecc395; }
[data-grade="critical"] .track i { background: #ff906c; }
#integrity-alert { margin-top: 7px; color: #ffb497; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
#directive { position: absolute; left: var(--edge); bottom: 7vh; max-width: 58%; }
#directive h2 { font-size: clamp(21px, 3.2vw, 48px); letter-spacing: -.04em; line-height: 1.01; }
#directive .overline { margin-bottom: 8px; }
#game[data-phase="fight"] #directive h2 { font-size: clamp(16px, 1.55vw, 23px); font-weight: 650; letter-spacing: -.015em; }
#objective-input { margin-top: 12px; color: #c3d3da; font-size: 12px; line-height: 1.6; }
#objective-input:empty { display: none; }
kbd { font: inherit; }
#objective-input kbd, #loadout kbd, #control-sheet kbd {
  display: inline-block; padding: 1px 5px; border: 1px solid #74919e8f; border-bottom-width: 2px; background: #10212add; color: #f2f6f5;
}
#objective-input .ignition-key { background: linear-gradient(90deg, #875b35 var(--ignition, 0%), #10212a var(--ignition, 0%)); }
#warning {
  position: absolute; left: 50%; top: 21%; max-width: 90%; text-align: center; transform: translateX(-50%);
  font: 700 13px/1.45 "Cascadia Mono", Consolas, monospace; letter-spacing: .09em; color: #ffd3ab;
}
#warning:not(:empty) { padding: 5px 10px; border-bottom: 1px solid #bb875b; background: #1b191ac7; }
#warning[data-style="move"] { color: #ffd7aa; border-color:#ffac64; }
#warning[data-style="open"] { color:#b5eee8; border-color:#76b5b9; background:#10242bdd; }
#dock-meter { width: min(235px,65vw); height: 4px; margin-top: 13px; background:#263139; overflow:hidden; }
#dock-meter i { display:block; width:100%; height:100%; background:var(--amber); transform-origin:left; }
#radio {
  position: absolute; bottom: clamp(110px, 15.5vh, 170px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(85vw, 580px); padding: 7px 11px;
  background: #07131bd9; font-size: 12px; line-height: 1.4; text-align: center;
}
#radio strong { color: var(--amber); margin-right: 8px; font-size: 11px; }
#radio.quiet { visibility: hidden; }
#loadout { position: absolute; right: var(--edge); bottom: 6vh; display: flex; gap: 4px; }
#loadout > div { position: relative; min-width: 68px; background: #0a1821e8; border: 1px solid #58738182;
  padding: 7px 7px 8px; font-size: 11px; white-space: nowrap; }
#loadout kbd { margin-right: 4px; padding-inline: 3px; font-size: 11px; }
#loadout small { display: block; height: 15px; margin-top: 3px; color: #a4d9d8; font-size: 11px; font-variant-numeric: tabular-nums; }
#loadout .cooldown small { color: #e4b38a; }
#loadout i { position: absolute; inset: auto 0 0; height: 2px; transform-origin: left; background: var(--ice); }
#loadout .engaged { color: #ffdbb3; border-color: #efa470; }
#loadout [data-slot="sword"], #loadout [data-slot="plasma"] { min-width: 117px; }
#hint { position: absolute; right: var(--edge); bottom: 3.0vh; color: #f1c29c; font-size: 12px; }
[data-phase="calibration"] #hint { right: auto; left: var(--edge); }
.overlay { position: absolute; z-index: 4; inset: 0; background: #050c13a6; display: grid; place-items: center; padding: 22px; }
.overlay-card { background: #0d1922f5; width: min(100%, 640px); border: 1px solid #8c9ca378; border-top: 1px solid var(--amber);
  padding: clamp(20px, 3vw, 36px); max-height: calc(100dvh - 44px); overflow: auto; }
.overlay h2 { font-size: clamp(29px, 4.5vw, 52px); letter-spacing: -.038em; line-height: 1.02; }
.overlay p:not(.overline) { margin-top: 13px; color: #bdccd2; line-height: 1.5; }
#control-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; line-height: 1.4; margin-top: 20px; }
#control-sheet kbd { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
#preferences {
  margin: 22px 0 0; padding: 13px 12px 11px; border: 1px solid #516976;
  display: grid; grid-template-columns: minmax(120px, 1fr) minmax(80px, 1fr); gap: 7px 15px;
  align-items: center; font: 12px/1.35 "Cascadia Mono", Consolas, monospace;
}
#preferences legend { color: var(--amber); padding: 0 5px; }
#preferences input { margin: 0; accent-color: var(--amber); }
#preferences input[type="checkbox"] { justify-self: end; width: 19px; height: 19px; }
#preferences select { background: #182834; color: var(--salt); font: inherit; border: 1px solid #6d838b; padding: 5px 8px; }
#preferences #graphics-note { grid-column: 1/-1; font: 13px/1.4 "Bahnschrift", Arial, sans-serif; margin: 0 0 4px; }
#fullscreen { grid-column: 1/-1; justify-self: start; min-height: 35px; }
.debrief-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 26px 0 0; border-top: 1px solid #516976; }
.debrief-stats div { display: grid; gap: 7px; padding: 12px 9px 12px 0; border-bottom: 1px solid #516976; }
.debrief-stats dt { font: 11px/1.2 "Cascadia Mono", Consolas, monospace; color: var(--muted); }
.debrief-stats dd { margin: 0; font-size: clamp(22px, 3.1vw, 38px); line-height: 1; font-variant-numeric: tabular-nums; }
.debrief-stats div:nth-child(-n+2) dd { color: var(--amber); }
#game[data-phase="debrief"] #hud { visibility: hidden; }
.overlay[data-kind="debrief"] { place-items: end start; padding: 4vh var(--edge) 7vh;
  background: linear-gradient(90deg,#050c13f4 0%,#050c13c9 27%,#050c134d 53%,transparent 75%), linear-gradient(0deg,#050c13b0,transparent 33%); }
[data-kind="debrief"] .overlay-card { padding: 0; width: min(100%, 485px); border: 0; background: none; }
[data-kind="debrief"] .dialog-actions { gap: 8px; }
[data-kind="debrief"] .dialog-actions button { padding-inline: 12px; min-height: 41px; font-size: 13px; }
[data-kind="confirm"] .overlay-card, [data-kind="loss"] .overlay-card { width: min(100%, 490px); }
#game[data-reduced="true"] *, #game[data-reduced="true"] *::before, #game[data-reduced="true"] *::after { transition: none !important; }
#render-error { position: absolute; z-index: 3; inset: auto var(--edge) 18px; padding: 14px; background: #311f1b; color: #ffd4b5; }
@media (max-width: 810px) {
  #loadout { bottom: 4.3vh; }
  #directive { bottom: 12vh; max-width: 81%; }
  #game[data-phase="fight"] #directive { bottom: 13.5vh; }
  #hint { bottom: 1.2vh; }
  #radio { bottom: 27vh; }
}
@media (max-width: 540px) {
  .dispatch { font-size: 11px; letter-spacing: .075em; }
  .settings { gap: 5px; }
  .icon { padding: 6px; }
  .icon kbd { display: none; }
  .title-card { inset: auto auto 14vh var(--edge); transform: none; }
  h1 { font-size: clamp(90px, 23vw, 125px); }
  .title-rule { margin-block: 10px; }
  .synopsis { margin-bottom: 15px; }
  .enemy { left: var(--edge); right: auto; top: calc(clamp(18px, 4.6vh, 48px) + 88px); }
  #loadout { right: auto; left: var(--edge); max-width: calc(100% - 2 * var(--edge)); gap: 3px; }
  #loadout > div { min-width: 0; padding-inline: 4px; white-space: normal; }
  #loadout [data-slot="sword"], #loadout [data-slot="plasma"] { min-width: 0; }
  #warning { top: 25%; font-size: 11px; }
  .debrief-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 520px) and (min-width: 541px) {
  h1 { font-size: 95px; }
  .title-rule { margin-block: 10px; }
  .synopsis { margin: 7px 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.score-picker { grid-column: 1/-1; margin: 2px 0; border-top: 1px solid #4d616c; color:#cad2d5; font: 12px 'Cascadia Mono', Consolas, monospace; }
.score-picker summary { width: max-content; cursor: pointer; padding: 4px 8px 4px 0; }
.score-picker summary:focus-visible { outline: 1px solid var(--ice); }
.score-controls {
  display: grid; grid-template-columns: 114px minmax(90px, 1fr);
  gap: 9px 12px; align-items: center; padding: 10px 0;
}
.score-controls input { min-width: 0; color:#dfedf0; background:#182934; border:1px solid #405b67; font:inherit; padding:4px; }
.score-controls label span { color:#8da3ab; }
#track-status { grid-column: 1/-1; color: var(--amber); line-height: 1.4; overflow-wrap: anywhere; }

#conn-pod {
  pointer-events: none; position: absolute; inset: 0; color: #a6e5e7;
  font-family: 'Cascadia Mono', Consolas, monospace;
  background: radial-gradient(ellipse at 50% 47%, #4b858606 24%, #10262929 70%, #070d12ae 100%);
}
.visor-scale {
  position:absolute; top:max(14.5%, calc(clamp(18px, 4.6vh, 48px) + 83px)); left:50%; translate:-50% 0; color:#bcf0ee;
  font-size:11px; letter-spacing:.14em; text-shadow:0 1px 8px #09171a;
  padding:2px 18px 8px; border-bottom:1px solid #9ad9dc68;
}
.visor-scale::after {
  content:''; position:absolute; left:-63%; right:-63%; height:5px; bottom:-6px;
  background:repeating-linear-gradient(90deg,#b2e9e66b 0 1px,transparent 1px 13px);
  mask-image:linear-gradient(90deg,transparent,#fff 36%,#fff 64%,transparent);
}
.visor-reticle {
  position:absolute; top:50%; left:50%; width:62px; height:35px; translate:-50% -50%; opacity:.84;
  background:linear-gradient(#b9f3ed,#b9f3ed) center/4px 4px no-repeat,
    linear-gradient(90deg,#a1d8da90 0 21%, transparent 21% 79%,#a1d8da90 79%) center/100% 1px no-repeat;
  filter:drop-shadow(0 1px 2px #122b31);
}
#pod-target { position:absolute; width:82px; height:72px; margin:-36px 0 0 -41px; color:#a2ece8; }
#pod-target i { position:absolute; width:13px; height:13px; border:1px solid currentColor; opacity:.76; }
#pod-target i:nth-child(1) { inset:0 auto auto 0; border-right:0; border-bottom:0; }
#pod-target i:nth-child(2) { inset:0 0 auto auto; border-left:0; border-bottom:0; }
#pod-target i:nth-child(3) { inset:auto auto 0 0; border-right:0; border-top:0; }
#pod-target i:nth-child(4) { inset:auto 0 0 auto; border-left:0; border-top:0; }
#pod-target.armed { color:#ffc180; }
.pod-instrument {
  position:absolute; bottom:clamp(19px,5vh,52px); display:grid; gap:4px;
  background:#071419e8; border:1px solid #4b747d; border-top:2px solid #65969e;
  min-width:112px; padding:8px 13px; text-shadow:0 1px 3px #03080e;
}
.pod-instrument small { color:#87b6ba; font-size:11px; letter-spacing:.11em; }
.pod-instrument b { font-size:12px; letter-spacing:.09em; }
.pod-port { left:2.7%; }
.pod-starboard { right:2.7%; text-align:right; }
[data-view="pod"] .grade { opacity:.58; }
[data-view="pod"] #effects { mask-image: radial-gradient(ellipse at 50% 47%, #fff 39%, #fff9 58%, transparent 85%); }
[data-view="pod"] #directive { bottom:14.5vh; left:9%; }
[data-view="pod"] #directive h2 { font-size:clamp(21px,3vw,40px); }
[data-view="pod"] #loadout { right:8.6%; bottom:14.7vh; }
[data-view="pod"] #hint { bottom:10vh; right:8.6%; }
[data-view="pod"] #radio { bottom:28vh; }
[data-view="pod"] #warning { top:22%; }
@media (max-width:840px) {
  [data-view="pod"] #directive { bottom:24vh; }
  [data-view="pod"] #loadout { left:9%; right:auto; }
  [data-view="pod"] #radio { bottom:39vh; }
  .pod-instrument { min-width:86px; padding:5px 8px; }
}
@media (max-width:530px) {
  #pov-mode { font-size:0; }
  #pov-mode::before { content:'POV'; font-size:11px; }
  #pov-mode kbd { display:none; }
  [data-view="pod"] #loadout { gap:2px; }
}
