/* Black Budget Bird: manila dossiers, typewriter, stencil, grease-pencil red, scope green, rescue orange, the near-black of the airframe. */
:root {
  --manila: #d8bd84; --manila-2: #c9a868; --paper: #f2ede0; --ink: #16181c; --ink-2: #4a4e56; --red: #c4141a; --orange: #e0702a; --scope: #7affb0; --amber: #ffc84a; --night: #0d0f12; --steel: #2a2d33;
  --type: "Special Elite", "Courier New", Courier, monospace; --stencil: "Stardos Stencil", Impact, sans-serif; --mono: "Share Tech Mono", "Lucida Console", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--paper); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: #2a4a8a; }
#app-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.eyebrow { margin: 0 0 .35rem; font: 400 .8rem var(--stencil); letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.micro { font-size: .64rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.gold { color: var(--red); }

/* the loader, in this machine's colours */
.bb-boot { --tl-bg: #0d0f12; --tl-bg-2: #16181c; --tl-ink: #f2ede0; --tl-muted: #a8b0b8; --tl-line: #2a2d33; --tl-accent: #7affb0; --tl-accent-2: #e0702a; --tl-lamp: #ffc84a; --tl-bad: #ff5a4a; }
.bb-boot h1 { font-family: var(--stencil); font-weight: 700; letter-spacing: .02em; font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: .92; }
.bb-boot h1 em { color: var(--orange); font-style: normal; }
.bb-boot .tl-field .scope { fill: none; stroke: rgba(122,255,176,.35); stroke-width: 1; }
.bb-boot .tl-field .sweep { stroke: #7affb0; stroke-width: 2; transform-origin: 30px 36px; animation: bb-sweep 4s ease-in-out infinite alternate; }
.bb-boot .tl-field .redline { stroke: #ff5a4a; stroke-width: 2.5; stroke-dasharray: 6 5; animation: bb-dash 1s linear infinite; }
.bb-boot .tl-field .jet { fill: #0d0f12; stroke: #a8b0b8; stroke-width: 1; }
@keyframes bb-sweep { from { transform: rotate(-10deg); } to { transform: rotate(70deg); } }
@keyframes bb-dash { to { stroke-dashoffset: -22; } }

/* buttons: stencilled plates */
.btn { position: relative; min-height: 46px; padding: 0 18px; border: 0; border-radius: 3px; cursor: pointer;
  background: var(--steel); color: var(--paper); font: 400 1.05rem var(--stencil); letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(0,0,0,.4), inset 0 0 0 1.5px rgba(242,237,224,.18); transition: transform .12s, background .12s; }
.btn:hover, .btn:focus-visible { background: #3a3e46; outline: none; transform: translateY(-1px); }
.btn.primary { background: var(--orange); color: #1a0e04; box-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 24px rgba(224,112,42,.35); }
.btn.primary:hover, .btn.primary:focus-visible { background: #f08a42; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(22,24,28,.45); color: var(--ink); }
.chip { min-width: 40px; min-height: 40px; border: 0; border-radius: 50%; background: rgba(13, 15, 18, .7); color: var(--paper); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(242,237,224,.25); font-size: 1rem; }
.chip[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.chip:focus-visible { outline: 2px solid var(--amber); }

/* top bar */
.topbar { position: fixed; z-index: 20; top: calc(var(--st) + 10px); left: calc(var(--sl) + 12px); right: calc(var(--sr) + 12px); display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--paper); font: 400 1.05rem var(--stencil); letter-spacing: .06em; padding: 5px 14px; border-radius: 999px; background: rgba(13, 15, 18, .7); }
.brand .edition { color: var(--orange); }
.brand-mark { width: 16px; height: 16px; background: var(--paper); clip-path: polygon(50% 0, 62% 40%, 100% 72%, 62% 70%, 58% 100%, 42% 100%, 38% 70%, 0 72%, 38% 40%); }
.top-actions { display: flex; gap: 8px; }
body[data-screen="loading"] .topbar { display: none; }

/* a dossier: manila, a tab, a paperclip */
.dossier { color: var(--ink); background: var(--manila) linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.05)); box-shadow: 0 30px 80px rgba(0,0,0,.55); border-radius: 2px 10px 2px 2px; }
.dossier::after { content: ''; position: absolute; right: 22px; top: -16px; width: 26px; height: 64px; border: 4px solid #b8bcc4; border-radius: 14px; box-shadow: 0 2px 2px rgba(0,0,0,.2); }

/* screens */
.screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: end start; padding: calc(var(--st) + 64px) calc(var(--sr) + 16px) calc(var(--sb) + 18px) calc(var(--sl) + 16px); overflow-y: auto; pointer-events: none; }
.screen > * { pointer-events: auto; }
.intro-card { position: relative; width: min(620px, 100%); padding: 20px 24px 18px; }
.intro-card h1 { margin: 0 0 .25rem; font: 700 clamp(2.6rem, 8vw, 4.2rem)/.92 var(--stencil); letter-spacing: .01em; color: var(--ink); }
.intro-card h1 em { color: var(--red); font-style: normal; }
.intro-copy { margin: 0 0 .7rem; font: .98rem/1.5 var(--type); color: var(--ink); }
.intro-card .label { margin: .3rem 0 .3rem; font: 400 1rem var(--stencil); color: var(--red); letter-spacing: .1em; text-transform: uppercase; }
.starts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: .6rem; }
.start { display: grid; justify-items: start; padding: 5px 8px; min-height: 48px; border: 0; border-radius: 2px; background: var(--paper); box-shadow: inset 0 -3px 0 var(--ink), 0 1px 2px rgba(0,0,0,.2); color: var(--ink); cursor: pointer; text-align: left; }
.start b { font: 400 1.15rem/1 var(--stencil); color: var(--red); } .start span { font: .78rem var(--type); }
.start.is-on { background: var(--amber); } .start.is-locked { opacity: .5; cursor: default; background: repeating-linear-gradient(135deg, #e8e2d0 0 8px, #d8d0b8 8px 16px); }
.start.is-flown b::after { content: ' \2713'; color: #2a6a3a; }
.start:focus-visible { outline: 2px solid var(--red); }
.brief { margin: 0 0 .8rem; padding: 8px 10px; background: var(--paper); font: .86rem/1.45 var(--type); color: var(--ink); min-height: 4.4em; box-shadow: inset 4px 0 0 var(--red); }
.brief b { font-family: var(--stencil); font-weight: 400; letter-spacing: .04em; } .brief em { color: var(--ink-2); }
.intro-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.intro-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: .8rem; font: .82rem var(--type); color: var(--ink-2); }
.intro-meta strong { color: var(--red); font: 400 1.05rem var(--stencil); }

/* HUD: the score on a scope, the sortie on a flight strip, the Mach tape */
.hud { position: fixed; z-index: 12; left: calc(var(--sl) + 12px); top: calc(var(--st) + 62px); display: grid; gap: 8px; width: min(320px, calc(100vw - 24px)); pointer-events: none; }
.hud-score { display: grid; grid-template-columns: 1fr auto; padding: 6px 12px 8px; border-radius: 4px; background: #04120a; box-shadow: inset 0 0 0 3px #2a2c2e, 0 6px 18px rgba(0,0,0,.4); }
.hud-score .micro { grid-column: 1 / -1; color: rgba(122,255,176,.55); }
.hud-score strong { font: 400 2rem/1 var(--mono); color: var(--scope); text-shadow: 0 0 10px rgba(122,255,176,.6); font-variant-numeric: tabular-nums; }
.hud-ball { align-self: end; font: .95rem var(--mono); color: var(--amber); }
.hud-sortie { display: grid; gap: 2px; padding: 7px 12px 9px 46px; position: relative; background: var(--paper); color: var(--ink); box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.hud-sortie::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 34px; background: #9aa0a8; }
.hud-sortie strong { font: 400 1.15rem/1.05 var(--stencil); letter-spacing: .04em; color: var(--red); }
.hud-sortie > span { font: .8rem/1.3 var(--type); color: var(--ink); }
.obj-track { height: 5px; background: rgba(22,24,28,.15); overflow: hidden; margin-top: 3px; }
.obj-track i { display: block; height: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform .2s; }
.mach-box { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.mach-box b { font: 400 1.6rem/1 var(--mono); color: rgba(242,237,224,.55); text-shadow: 0 1px 3px #000; min-width: 3.4ch; }
.mach-box em { font: 400 1.1rem var(--mono); font-style: normal; color: rgba(242,237,224,.55); min-width: 2ch; }
.mach-box.is-hot b, .mach-box.is-hot em { color: var(--amber); }
.mach-box.is-unstart b { color: #ff5a4a; animation: bb-blink .3s steps(2) infinite; }
.mach-box .meter { flex: 1; height: 6px; border-radius: 3px; background: rgba(242,237,224,.15); overflow: hidden; }
.mach-box .meter i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #5aff8a, var(--amber) 55%, #ff4a3a); transform-origin: left; transform: scaleX(var(--fill, 0)); transition: transform .1s linear; }
.mach-box span { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(242,237,224,.7); text-shadow: 0 1px 2px #000; }
.mach-box .jam b { font: inherit; color: inherit; min-width: 0; text-shadow: none; }
.mach-box .jam { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 3px; background: rgba(154,216,255,.18); color: #9ad8ff; font: .8rem var(--mono); }
@keyframes bb-blink { 50% { opacity: .35; } }
.hud-tags { font: .92rem/1.35 var(--mono); color: var(--amber); text-shadow: 0 1px 3px #000; padding: 0 4px; }

/* the radio: a callsign, the line typing out */
.radio { position: fixed; z-index: 13; left: 50%; bottom: calc(var(--sb) + 108px); transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); padding: 8px 14px 10px; border-radius: 4px; background: rgba(4,18,10,.88); box-shadow: inset 0 0 0 1px rgba(122,255,176,.3), 0 8px 24px rgba(0,0,0,.4); pointer-events: none; opacity: 0; transition: opacity .3s; }
.radio.is-on { opacity: 1; }
.radio b { display: block; font: 400 .74rem var(--mono); letter-spacing: .16em; color: var(--amber); }
.radio span { display: block; font: 400 1rem/1.4 var(--mono); color: var(--scope); min-height: 1.4em; }

/* a photograph, pinned */
.pin { position: fixed; z-index: 14; right: calc(var(--sr) + 14px); bottom: calc(var(--sb) + 20px); width: min(250px, 44vw); margin: 0; padding: 8px 8px 10px; background: #f4f1e8; color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.5); pointer-events: none; transform-origin: right bottom; }
.pin::before { content: ''; position: absolute; left: 50%; top: -7px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--red); box-shadow: 0 2px 2px rgba(0,0,0,.4); }
.pin img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #16181c; }
.pin b { display: block; margin-top: 5px; font: 400 .9rem var(--stencil); letter-spacing: .06em; color: var(--red); }
.pin span { display: block; font: .78rem/1.35 var(--type); }
.pin.is-in { animation: bb-pin 3.6s ease-out both; }
@keyframes bb-pin { 0% { opacity: 0; transform: translateY(30px) rotate(6deg); } 10% { opacity: 1; transform: rotate(-2deg); } 90% { opacity: 1; transform: rotate(-2deg); } 100% { opacity: 0; transform: translateY(10px) rotate(2deg); } }

.toasts { position: fixed; z-index: 13; right: calc(var(--sr) + 14px); top: calc(var(--st) + 64px); display: grid; gap: 6px; justify-items: end; pointer-events: none; }
.toast { padding: 4px 12px 5px; border-radius: 2px; background: var(--paper); color: var(--ink); font: .92rem var(--type); box-shadow: 0 4px 10px rgba(0,0,0,.35); transition: opacity .5s, transform .5s; }
.toast.big, .toast.claim, .toast.lock, .toast.frame { background: var(--amber); color: #2a1a04; }
.toast.jackpot { background: #9ad8ff; color: #0e1a3a; }
.toast.graze { background: #04120a; color: var(--scope); }
.toast.warn { background: var(--red); color: #fff; }
.toast.next { background: var(--steel); color: var(--paper); }
.toast.is-gone { opacity: 0; transform: translateX(20px); }

.callout { position: fixed; z-index: 14; left: 50%; top: 30%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 2px; text-align: center; pointer-events: none; width: min(92vw, 720px); }
.callout span { font: 400 .82rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--scope); text-shadow: 0 1px 3px #000; }
.callout strong { font: 700 clamp(2.4rem, 8vw, 4.4rem)/1 var(--stencil); letter-spacing: .02em; color: var(--paper); text-shadow: 3px 4px 0 var(--red), 0 0 30px rgba(0, 0, 0, .6); }
.callout em { font: italic 1rem var(--type); color: var(--paper); text-shadow: 0 1px 4px #000; }
.callout.is-in { animation: bb-callout 2.2s ease-out both; }
@keyframes bb-callout { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1deg); } 85% { opacity: 1; } 100% { opacity: 0; } }

.bonus { position: fixed; z-index: 15; left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(400px, calc(100vw - 24px)); padding: 16px 20px; }
#bonus-list { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid; gap: 2px; }
#bonus-list li { display: flex; justify-content: space-between; font: 1rem/1.7 var(--type); color: var(--ink); animation: bb-in .3s ease-out both; }
#bonus-list b { color: var(--red); font-family: var(--mono); font-weight: 400; }
.bonus-total { margin: 0; text-align: right; font: 1.1rem var(--type); color: var(--ink); } .bonus-total strong { color: var(--red); font: 400 1.6rem var(--mono); }
@keyframes bb-in { from { opacity: 0; transform: translateX(-10px); } }

/* touch pads */
.controls { position: fixed; z-index: 16; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr minmax(84px, 18vw) minmax(64px, 13vw) 1fr; gap: 8px; padding: 8px calc(var(--sr) + 8px) calc(var(--sb) + 8px) calc(var(--sl) + 8px); pointer-events: none; }
.pad { pointer-events: auto; min-height: 84px; border: 0; border-radius: 6px; background: rgba(13, 15, 18, .32); color: var(--paper); display: grid; place-items: center; align-content: center; gap: 2px; font: 800 1.4rem var(--sans); touch-action: none; box-shadow: inset 0 0 0 1px rgba(242,237,224,.14); opacity: .55; transition: opacity .2s, background .1s; }
.pad kbd { font: 600 .62rem var(--sans); letter-spacing: .12em; opacity: .75; }
.pad.is-down { background: rgba(224, 112, 42, .4); opacity: .9; }
.pad-c b, .pad-j b { font: 400 .82rem var(--stencil); letter-spacing: .14em; }
.pad-j { color: #9ad8ff; }
.pad .charge { width: 70%; height: 5px; border-radius: 3px; background: rgba(242,237,224,.2); overflow: hidden; }
.pad .charge i { display: block; height: 100%; background: var(--orange); transform-origin: left; transform: scaleX(0); }
@media (pointer: fine) { .controls { opacity: 0; pointer-events: none; } .controls .pad { pointer-events: none; } }

/* the modal: a dossier */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: calc(var(--st) + 16px) 16px calc(var(--sb) + 16px); background: rgba(6, 8, 10, .6); overflow-y: auto; }
.sheet { position: relative; width: min(700px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px 26px; }
.modal.is-wide .sheet { width: min(1080px, 100%); }
.sheet h2 { margin: 0 0 .5rem; font: 700 clamp(1.9rem, 4.6vw, 2.7rem)/1 var(--stencil); letter-spacing: .02em; color: var(--ink); }
.sheet p, .sheet li { font: .96rem/1.55 var(--type); }
.close { position: absolute; top: 8px; right: 54px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 1.6rem; cursor: pointer; }
.menu.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.rules { padding-left: 1.1rem; margin: 0; display: grid; gap: .45rem; }
.rules b { color: var(--red); }
.settings { display: grid; gap: .5rem; }
.check, .range { display: flex; align-items: center; gap: .6rem; font: .98rem var(--type); min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.range input { flex: 1; accent-color: var(--red); }
.evidence { list-style: none; padding: 0; margin: .6rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.evidence figure { margin: 0; padding: 7px 7px 9px; background: #f4f1e8; box-shadow: 0 4px 12px rgba(0,0,0,.25); transform: rotate(-.6deg); }
.evidence li:nth-child(2n) figure { transform: rotate(.7deg); }
.evidence img, .evidence .redacted { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #16181c; }
.evidence .redacted { display: grid; place-items: center; background: repeating-linear-gradient(0deg, #16181c 0 14px, #e8e2d0 14px 22px); color: var(--red); font: 400 1.1rem var(--stencil); letter-spacing: .12em; }
.evidence .redacted { background: #e8e2d0; box-shadow: inset 0 0 0 3px var(--red); }
.evidence figcaption { margin-top: 6px; font: .76rem/1.35 var(--type); }
.evidence figcaption b { display: block; font: 400 .86rem var(--stencil); letter-spacing: .06em; color: var(--red); }
.evidence figcaption a { display: block; margin-top: 3px; font-size: .7rem; }
.evidence li.is-locked figure { opacity: .75; }
.sources { font-size: .84rem !important; }
.results-line { font-size: 1.02rem; }
.results-best { color: var(--ink-2); }

body[data-screen="inspect"] .intro, body[data-screen="inspect"] .hud { display: none; }
#inspect-back { position: fixed; z-index: 20; left: 50%; bottom: calc(var(--sb) + 20px); transform: translateX(-50%); }

@media (max-width: 640px) {
  .screen { place-items: end center; padding-top: calc(var(--st) + 56px); }
  .intro-card { padding: 14px 14px 14px; }
  .starts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brief { font-size: .8rem; }
  .hud { top: calc(var(--st) + 56px); width: min(250px, 64vw); }
  .hud-score strong { font-size: 1.5rem; }
  .toasts { top: auto; bottom: calc(var(--sb) + 104px); }
  .radio { bottom: calc(var(--sb) + 100px); }
  .pin { width: min(200px, 56vw); bottom: calc(var(--sb) + 180px); }
  .sheet { padding: 18px 16px; }
  .brand { font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) { .callout.is-in, .pin.is-in, .bb-boot .tl-field .sweep, .bb-boot .tl-field .redline, .mach-box.is-unstart b { animation: none; } }

/* the way back to TiltLab, on the title card */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* the Feel button makes four in the top bar: on a phone the edition number gives way */
@media (max-width: 440px) { .brand .edition { display: none; } .brand { white-space: nowrap; } }
@media (max-width: 380px) { .top-actions { gap: 5px; } .top-actions .chip { min-width: 36px; min-height: 36px; font-size: .9rem; } .brand { padding: 4px 10px; } }
