:root{color-scheme:dark;--cyan:#6ff8fa;--pink:#ff559e;--ink:#070812;--soft:#a5acc3;font:15px/1.5 "Helvetica Neue",Arial,sans-serif}
*{box-sizing:border-box}body{margin:0;background:var(--ink);color:#f3f2ff}button{cursor:pointer;font:inherit;color:inherit}button:focus-visible{outline:3px solid white;outline-offset:4px}button:active{transform:translateY(1px)}[hidden]{display:none!important}
header,footer,.brand,.tools,.sector,.rail,.record,footer div,.touch{display:flex;align-items:center}header,footer{max-width:1640px;margin:auto;padding:0 clamp(18px,4vw,78px)}header{height:72px;justify-content:space-between}.brand,.tools button,.sector,.rail,.record,footer,.mid,.touch button,.primary,#signal,#hud small{font-family:"SFMono-Regular",Menlo,Consolas,monospace;text-transform:uppercase;font-weight:700}.brand{gap:12px;letter-spacing:.12em;font-size:12px}.brand i{font:900 italic 44px/.6 Arial;color:var(--cyan);transform:rotate(-17deg);margin-right:3px}.brand b{color:#676983}.tools{gap:8px}.tools button{background:#10111e;border:1px solid #303348;font-size:10px;letter-spacing:.09em;padding:8px 12px;border-radius:4px}
main{position:relative;isolation:isolate;overflow:hidden;height:calc(100svh - 126px);min-height:375px;max-height:1100px;border-block:1px solid #2c2c46;background:#070916}canvas,.screen-texture{position:absolute;inset:0;width:100%;height:100%}.screen-texture{z-index:1;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0 2px,#02030a2a 3px 3.5px);opacity:.6}
.intro{position:absolute;z-index:2;left:6%;top:48%;transform:translateY(-50%)}.sector,.record,.rail,#hud small{font-size:10px;letter-spacing:.17em}.sector{color:var(--cyan);gap:10px}.sector i,.rail i{width:18px;height:2px;background:var(--cyan);box-shadow:0 0 8px #24cef3}
h1{margin:24px 0 22px;line-height:.82;transform:skewX(-9deg);transform-origin:left}h1 span{display:block;font:italic 1000 clamp(56px,7.9vw,155px)/.87 "Arial Black","Helvetica Neue",Arial,sans-serif;letter-spacing:-.082em;background:linear-gradient(#f1ffff 8%,#b1d6fa 40%,#626dae 49%,#171c49 50%,#95a1d7 58%,#e7e8ff 86%);background-clip:text;color:transparent;-webkit-text-stroke:1px #c0c5fb;filter:drop-shadow(0 3px 0 #3f396c) drop-shadow(0 6px 9px #494e944d)}h1 small{display:block;font:italic 900 clamp(17px,2.4vw,45px)/1.5 Arial,sans-serif;letter-spacing:.39em;color:#ff6ca4;margin-left:.19em;text-shadow:0 0 20px #ff388251}
.intro p,#overlay p{font-size:clamp(15px,1.3vw,21px);color:#c2c5da;line-height:1.6;margin:0 0 26px}.primary{display:inline-flex;align-items:center;justify-content:space-between;gap:28px;border:1px solid #a4ffff;background:#80f6f4;color:#091925;box-shadow:4px 4px 0 #244858;padding:14px 22px;font-size:13px;letter-spacing:.08em}.primary:hover{background:#b7ffff}.primary b{font-size:11px}.record{gap:14px;color:#969db7;margin-top:28px;font-size:9px}.record strong{color:#ced4ec;font-size:13px}
.rail{position:absolute;z-index:2;bottom:18px;left:4%;right:4%;justify-content:space-between;color:#8691ae;font-size:9px}.rail span:first-child{display:flex;align-items:center;gap:10px}.rail i{width:6px;height:6px}.rail span:last-child{color:#92afd0}footer{height:54px;gap:26px;justify-content:center;color:#a1a4bb;font-size:10px;letter-spacing:.12em}footer div{gap:6px}kbd{font:inherit;font-size:10px;padding:2px 5px;border:1px solid #47495b;border-radius:3px;color:#d7d9ea}
#hud{position:absolute;z-index:2;top:16px;left:4%;right:4%;display:flex;align-items:start;justify-content:space-between;pointer-events:none}#hud>div{min-width:85px}#hud small{display:block;color:var(--soft);font-size:9px}#hud strong{font:700 clamp(17px,2.3vw,30px)/1.2 Menlo,monospace;color:var(--cyan)}#hud .mid{text-align:center;font-size:12px;letter-spacing:.15em}#hud .right{text-align:right}#hud #shields{color:#ffac7e}#signal{position:absolute;bottom:7%;width:100%;text-align:center;font-size:12px;letter-spacing:.15em;color:#ffd997;text-shadow:0 2px 4px black;pointer-events:none}
#overlay{position:absolute;inset:0;display:grid;place-items:center;text-align:center;background:#040610d9;z-index:4}#overlay section{padding:16px}#overlay .sector{justify-content:center}h2{margin:12px 0;font:italic 950 clamp(37px,6vw,96px)/1 Arial,sans-serif;text-transform:uppercase;letter-spacing:-.06em}.touch{display:none;justify-content:center;gap:10px;padding:8px}.touch button{min-width:58px;height:42px;border:1px solid #454963;background:#171a2b;border-radius:4px;touch-action:none;user-select:none;-webkit-user-select:none}.touch button:last-child{min-width:86px;color:var(--cyan)}
@media(max-width:700px){header{height:52px}.brand{gap:6px;font-size:9px}.brand i{font-size:32px}.tools button{font-size:9px;padding:6px}.intro{top:auto;bottom:7%;left:7%;transform:none}.intro h1{margin:10px 0 12px}.intro p{margin-bottom:14px;font-size:14px}.record{margin-top:16px}.intro .sector{font-size:9px}.rail{bottom:10px}.primary{padding:10px 16px}.touch{display:flex}footer{display:none}main{height:calc(100svh - 111px);min-height:450px}#hud .mid{font-size:9px}}
@media(pointer:coarse) and (min-width:701px){.touch{display:flex}footer{display:none}main{height:calc(100svh - 132px)}}
@media(max-height:510px) and (min-width:701px){header{height:42px}main{min-height:255px;height:calc(100svh - 80px)}footer{height:38px}.intro h1{margin:8px 0}.intro h1 span{font-size:56px}.intro h1 small{font-size:17px}.record{margin-top:9px}.intro p{font-size:13px;margin-bottom:10px}.primary{padding:8px 12px}}

.start-controls{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.start-controls label{display:grid;gap:2px;font:700 10px Menlo,monospace;letter-spacing:.08em;text-transform:uppercase;color:var(--soft)}
#sector-choice{font:700 12px Menlo,monospace;color:#e4ebff;background:#121527;border:1px solid #424865;border-radius:3px;padding:5px}

#ambush{position:absolute;z-index:2;top:13%;left:50%;transform:translateX(-50%);border:1px solid #709b3a;padding:4px 9px;background:#10190e;color:#c1ff74;font:700 clamp(10px,1.1vw,15px) Menlo,monospace;letter-spacing:.07em;white-space:nowrap;pointer-events:none}

/* Chapter dispatch and a live rehearsal of the incoming mechanic. */
main.briefing{height:auto;min-height:calc(100svh - 72px);max-height:none;background:radial-gradient(ellipse at 78% 44%,#191b35,#090b19 60%,#070812)}
body:has(.briefing) :is(footer,.touch),main.briefing>.rail{display:none}
#chapter{position:relative;z-index:2;max-width:1640px;margin:auto;min-height:inherit;padding:clamp(32px,6vw,96px);display:grid;grid-template-columns:minmax(0,0.85fr) minmax(0,1.15fr);align-content:center;align-items:center;gap:clamp(24px,5vw,80px)}
.dispatch{max-width:530px}
#chapter-range{color:var(--chapter-color);letter-spacing:.14em}
#chapter-title{font-size:clamp(40px,5.3vw,85px);text-wrap:balance;line-height:.94;margin:18px 0 20px}
#chapter-title:focus{outline:none}
#chapter-story,#chapter-tactic{font-size:clamp(15px,1.24vw,20px);line-height:1.55;margin:0}
#chapter-story{color:#d8dbef}
#chapter-tactic{border-left:2px solid var(--chapter-color);margin:24px 0;padding-left:16px;color:#afb9ce}
#chapter-carry,.lesson figcaption,.lesson button{font-family:Menlo,Consolas,monospace}
#chapter-carry{margin-top:14px;color:var(--soft);font-size:11px}
.lesson{margin:0;min-width:0;border:1px solid #35394e;background:#090b19}
#lesson-screen{position:relative;aspect-ratio:1.42;overflow:hidden}
.lesson figcaption{border-top:1px solid #35394e;min-height:52px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 14px;font-size:12px;color:#d3dbed}
.lesson button{flex:none;background:transparent;border:1px solid #454963;border-radius:3px;color:#c0cada;padding:5px 7px;font-size:10px}
@media(max-width:700px){
  main.briefing{min-height:calc(100svh - 52px)}
  #chapter{grid-template-columns:1fr;gap:19px;padding:22px 6% 26px;align-content:start}
  .dispatch{display:contents}
  #chapter-range,#chapter-title,#chapter-story,#chapter-tactic,.lesson,#launch,#chapter-carry{margin:0}
  #chapter-title{font-size:clamp(36px,9vw,58px);order:1}
  #chapter-story{order:2}
  .lesson{order:3}
  #lesson-screen{height:clamp(140px,23svh,250px);aspect-ratio:auto}
  .lesson figcaption{min-height:40px;font-size:11px;padding:6px 10px}
  #chapter-tactic{order:4}
  #launch{order:5;justify-self:start}
  #chapter-carry{order:6}
}

/* The epilogue opens the view beyond the vector tube. */
main.ending{height:auto;min-height:calc(100svh - 72px);max-height:none;background:#0b101c}
body:has(.ending) :is(footer,.touch),main.ending>:is(.rail,.screen-texture,canvas){display:none}
#epilogue{min-height:inherit;max-width:1840px;margin:auto}
.ending-scene{min-height:inherit;display:grid;grid-template-columns:minmax(300px,0.78fr) minmax(0,1.22fr);align-items:center;gap:clamp(24px,4vw,84px);padding:clamp(24px,4.2vw,76px);background:radial-gradient(ellipse at 82% 40%,#24243c,#0b101c 72%)}
#galley-scene{background:radial-gradient(ellipse at 80% 46%,#392d33,#0c101a 75%)}
.ending-art{width:100%;height:auto;display:block;box-shadow:0 0 0 1px #53536a70,0 16px 64px #02030a85}
.ending-copy{max-width:560px}
.ending-copy .sector{color:#f7c684}
.ending-copy h2{margin:18px 0 22px;font-size:clamp(44px,5.2vw,88px);line-height:.94;text-wrap:balance;outline:none}
.ending-copy p{font-size:clamp(15px,1.24vw,20px);line-height:1.6;color:#d3d7e4;margin:0 0 14px}
.ending-copy .primary{margin-top:8px}
.ending-tally{display:flex;flex-wrap:wrap;gap:10px 24px;padding:14px 0 0;margin:18px 0 12px;border-top:1px solid #373947;font-family:Menlo,Consolas,monospace}
.ending-tally dt{font-size:10px;color:#a9adbe;text-transform:uppercase;letter-spacing:.07em}
.ending-tally dd{margin:3px 0;font-size:15px;font-weight:700;color:#e0e8ee}
@media(prefers-reduced-motion:no-preference){
  .ending-art{animation:kestrel-sunrise 650ms ease-out both}
  @keyframes kestrel-sunrise{from{opacity:.3}to{opacity:1}}
}
@media(max-width:760px){
  main.ending{min-height:calc(100svh - 52px)}
  .ending-scene{grid-template-columns:1fr;align-content:start;gap:20px;padding:20px 6% 28px}
  .ending-art{grid-row:1}
  .ending-copy{max-width:none}
  .ending-copy h2{margin:12px 0 16px}
  .ending-copy p{font-size:15px}
}
