/* SpaceFace — UI theme + layout. Existing tokens preserve runtime compatibility with older screens.
   They are not an art-direction mandate. New UI must not automatically inherit the old cyan/purple,
   glass, rounded-card, visor, or console vocabulary; choose a deliberate surface-specific direction. */
@import "./commsradial.css";
@import "./hud.css";

:root {
  /* Visual identity (2026-08 revision): quiet modern neutral. Desaturated surfaces, one
     restrained interaction accent, colour spent only on state. No neon, no rails, no glass. */
  --bg: #0a0c10;
  --panel: #151a21; --panel-2: #1b212a; --panel-edge: #2c343f; --panel-edge-2: #3d4754;
  --ink: #e7eaee; --ink-dim: #9aa4b0; --ink-mute: #6e7885;
  --accent: #4f8fdd; --accent-2: #4fbf8f; --accent-3: #4f8fdd;
  --warn: #d9a054; --danger: #d95f6a; --good: #4fbf8f;
  --hull: #d95f6a; --shield: #4f8fdd; --energy: #d4b45f; --cargo: #4fbf8f;
  /* The kit's faces (styles/fonts.css, DIRECTION_SHEET §3) are the only ones loaded, so the legacy
     tokens resolve to them: every unmigrated surface that still reads --font / --mono renders in
     Instrument Sans. No monospace face on any player surface except Asteroid Works (the sheet's
     never-list); numerals stay aligned through tabular figures on the root (below). */
  --font: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ui-scale: 1;
  /* Responsive policy (A_LIST_GAPS §4): ultrawide anchors clamp to a centered safe frame. */
  --sf-safe-inset-x: max(0px, calc((100vw - 100vh * 16 / 9) / 2));
  /* Shared max content stage width for full-screen instruments; backdrops stay full-bleed. */
  --sf-stage-max: 2200px;

  /* ===== Instrument grammar role tokens (design/frontend/INSTRUMENT_GRAMMAR.md §4, binding) =====
     Colour is assigned by MEANING, not by palette, so a screen cannot be restyled into
     incoherence. Exact-hex mapping from SCREENS_B §0.1; each equals an existing compatibility
     token, so contrast is already proven. At rest a screen is ≥80% calm+paper on the surface;
     you/foe/goal are SPENT on state, never worn as chrome. Every colour-coded state carries a
     second channel (shape or word) — never encode by colour alone. */
  --sf-you: #4fbf8f;    /* you, your agency, a gain        (14.0:1 on surface) */
  --sf-foe: #d95f6a;    /* threat, cost, over-budget, loss (6.0:1) */
  --sf-goal: #d9a054;   /* next unlock, objective, opportunity (9.6:1) */
  --sf-calm: #9aa4b0;   /* structure, chrome, labels, rest (7.2:1) */
  --sf-paper: #dfe3e8;  /* all body copy                   (~13:1) */
  --sf-surface: #12161c; /* screen backdrop base            */
  --sf-edge: #2c343f;   /* 1px separators, socket rings    */

  /* ===== Instrument grammar type tokens (§3: four roles, no fifth) =====
     Faces are vendored and loaded at boot (styles/fonts.css). 12px floor; tracking above .06em
     only on MICRO; every screen has exactly one DISPLAY-sized element. */
  --sf-display-face: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif; /* 600/700 · 28/40/64px */
  --sf-subhead-face: "Instrument Sans", "Segoe UI", sans-serif;         /* 600 · 15/19/22px */
  --sf-body-face: "Instrument Sans", "Segoe UI", sans-serif;            /* 400/500 · 13/14/15px */
  --sf-data-face: "Instrument Sans", "Segoe UI", sans-serif;            /* 500 · 13/15/20px, tabular-nums, numerals only */

  /* ===== Instrument grammar motion tokens (§5: nothing exceeds 180ms) ===== */
  --sf-t-latch: 90ms;   /* discrete state change seats with a short travel and a hard stop */
  --sf-t-settle: 180ms; /* a value arriving; instruments overshoot, text never does */
  --sf-ease: cubic-bezier(.2, .9, .3, 1);
  /* No --sf-t-spool. SPOOL must be bound to real progress (§5), and nothing supplies one yet;
     declaring the token would invite an unbound loop to claim it. Add it WITH its first honest
     consumer, not before. */

  /* ===== Instrument grammar SHAPE tokens =====
     Introduced because sections 11/13/14 had already drifted apart on the same three decisions —
     a 2px rail against a 3px one, `var(--r-sm,5px)` against two hardcoded 3px radii, and the same
     color-mix literal written twice. This repo has a documented history of an append-only
     stylesheet becoming an override pile (styles/station.css: 202 selectors redefined at
     brace-depth 0). Three drifts in the first two consumers is where that starts. */
  --sf-rail-w: 0px;                                                    /* left accent rails are retired; state carries a word or glyph */
  --sf-goal-edge: color-mix(in srgb, var(--sf-goal) 40%, transparent); /* the resting edge of a verb */
  --sf-track-micro: .06em;                                             /* MICRO tracking, one value */

  /* ===== Legacy visor palette, compatibility only =====
     Do not extend these tokens or use them as a visual direction. Values desaturated 2026-08. */
  --visor-cyan: #4f8fdd;
  --visor-cyan-dim: rgba(79, 143, 221, 0.28);
  --visor-amber: #d9a054;
  --visor-red: #d95f6a;

  /* Text and glows */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --visor-glow-red: 0px 0px 8px rgba(217, 95, 106, 0.45);

  /* Text shadow for legibility without backgrounds */
  --text-shadow-hard: 0px 1px 3px rgba(0, 0, 0, 1), 0px 0px 2px rgba(0, 0, 0, 0.8);
}
* { box-sizing: border-box; }
/* `el.hidden = true` is silently defeated by ANY author rule that sets `display` on that element,
   because an author declaration outranks the user agent's [hidden]{display:none}. The JS then
   believes it hid the thing and the thing is still on screen. That is how the Footprint board kept
   drawing its ACT / INCIDENT / STANDING / CONSEQUENCE headers while `board.hidden = true` — the
   empty state took a full viewport height and pushed the headers 40px off the bottom, where
   nothing could scroll to them. `.aw-lens[hidden]` in asteroid-ops.css was already carrying this
   patch locally; the class of bug is worth closing once rather than per component. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); font-variant-numeric: tabular-nums; }
#gl-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }
/* Combat stick alone replaces the native target pointer with a centered DOM sight. */
body.sf-flight-cursor, body.sf-flight-cursor * { cursor: none !important; }
#ui-root { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-size: calc(15px * var(--ui-scale)); contain: layout style paint; }
#ui-root > div { position: absolute; }
/* FB-100: --sf-hud-scale/--sf-hud-opacity (settings.video.hudScale/hudOpacity, applied on the
   root by applyHudPresentationFromSettings) let the player size and dim the flight HUD without
   touching global --ui-scale or screen surfaces. font-size composes both scales for em-sized
   children; opacity sits on this layer only so pause-dim/blowout animation on the element
   still wins during its transient. */
#hud { inset: 0; z-index: 10; transition: opacity .12s ease; contain: layout style paint;
  font-size: calc(15px * var(--ui-scale, 1) * var(--sf-hud-scale, 1));
  opacity: var(--sf-hud-opacity, 1); }
#hud.sf-hud--blowout {
  animation: sf-shield-blowout-glitch 400ms steps(2, start) forwards;
}
@keyframes sf-shield-blowout-glitch {
  0% { transform: translate(0, 0); filter: brightness(1.6) drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 80%, transparent)); opacity: 1; }
  20% { transform: translate(-4px, 2px); filter: invert(0.3) brightness(2.0) drop-shadow(0 0 16px color-mix(in srgb, var(--sf-foe) 90%, transparent)); opacity: 0.4; }
  40% { transform: translate(3px, -2px); filter: brightness(1.2); opacity: 0.85; }
  60% { transform: translate(-2px, -1px); filter: invert(0.5) brightness(1.8); opacity: 0.3; }
  80% { transform: translate(2px, 1px); filter: brightness(1.3); opacity: 0.9; }
  100% { transform: translate(0, 0); filter: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #hud.sf-hud--blowout {
    animation: none;
    transform: none;
    filter: none;
    opacity: 0.85;
  }
}
/* The OS-level media query above does not cover the in-game "Reduce flashing" toggle: the
   blowout invert-strobe must also yield to html.sf-reduce-flash (the blanket flash guard only
   matches pulse/blink/flash class names, and the orbital.css rules target #hud descendants,
   not #hud itself). */
html.sf-reduce-flash #hud.sf-hud--blowout {
  animation: none;
  transform: none;
  filter: none;
  opacity: 0.85;
}
/* Display stays block and visibility animates the swap: a none->block toggle cannot transition,
   which is why the backdrop used to hard-cut under every screen open. The hide transition delays
   visibility until after the fade so the layer stays clickable-looking but non-interactive. */
#modal-backdrop { inset: 0; z-index: 90; display: block; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--bg) 62%, transparent), color-mix(in srgb, var(--bg) 86%, transparent)); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 180ms var(--ease, ease), visibility 0s linear 180ms; }
#modal-backdrop[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  #modal-backdrop, body.ui-modal-open #modal-backdrop { transition: none; }
}
html.sf-reduce-motion #modal-backdrop { transition: none; }
#screens { inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
#screens > * { pointer-events: auto; }

/* --- Screen push/pop transitions (fade in/out + slide) --- */
.screen {
  transition: opacity 150ms var(--ease, ease), transform 150ms var(--ease, ease);
  transform: translateY(0);
}
.screen.sf-screen--entering {
  opacity: 0;
  transform: translateY(6px);
}
.screen.sf-screen--visible {
  opacity: 1;
  transform: translateY(0);
}
.screen.sf-screen--exiting {
  opacity: 0;
  transform: translateY(6px);
  transition-duration: 150ms;
  pointer-events: none;
}

/* --- Docking overlay (radial-gradient vignette fade for dock/undock transitions) --- */
#sf-dock-overlay { position: fixed; inset: 0; z-index: 2500; pointer-events: none;
  background: radial-gradient(ellipse at 50% 60%, transparent 0%, var(--bg) 70%);
  opacity: 0; transition: opacity 0.4s ease-in-out; }
#sf-dock-overlay[hidden] { display: none !important; }
#sf-dock-overlay.active { opacity: 1; }
#sf-dock-overlay.sf-administrative-blackout { background: var(--bg); }
/* --- Continue veil (title screen -> game; src/ui/screens/mainMenu.js _showContinueFade) ---
   Black to game with the location name bottom-left. It mounts on #ui-root above the title and
   below the loading shell (z-index 1900 < 2000: test/startup-loading-presentation.test.mjs). The
   label reads in the frontend kit's text face and fine size (styles/kit.css tokens). */
.sf-continue-fade { position:fixed; inset:0; z-index:1900; background:#000; opacity:0;
  pointer-events:auto; transition:opacity 1s ease; display:flex; align-items:flex-end;
  justify-content:flex-start; padding:0 0 calc(var(--k-margin, 5vw) * 0.42) var(--k-margin, 5vw); }
.sf-continue-fade.open { opacity:1; }
.sf-continue-fade__loc { font-family: var(--k-text, system-ui, sans-serif); font-size: var(--k-fs-fine, 12px);
  color: var(--k-bone-62, rgb(234 230 223 / 0.62)); }
/* --- First-run splash (spec2/03 §3; src/ui/screens/newGame.js showFirstRunSplash) ---
   After Launch, a single full-screen line on black for 2.5 s, once per profile. A cinematic, not a
   screen: it used to ride the New Game screen's injected style block, which Task B deleted when that
   screen moved onto the kit. The line reads in the kit's text face and body size. */
.sf-firstrun-splash { position:fixed; inset:0; z-index:3200; background:#000; display:flex;
  align-items:center; justify-content:center; opacity:0; transition:opacity .5s ease;
  pointer-events:auto; }
.sf-firstrun-splash.open { opacity:1; }
.sf-firstrun-splash__line { font-family: var(--k-text, system-ui, sans-serif); font-size: var(--k-fs-body, 16px);
  color: var(--k-bone, #eae6df); text-align:center; max-width:80vw; line-height:1.7; }
/* #toasts is absolutely placed; it is usually re-parented into #hud by toasts.js, so it cannot
   rely on the `#ui-root > div` absolute rule — without an explicit position its left/top are
   inert and the receipt lane renders at the top of #hud's flow. */
#toasts { position: absolute; left: calc(50% + (var(--sf-safe-inset-x, 0px) * 0)); bottom: 155px; top: auto; right: auto; z-index: 11; display: flex; flex-direction: column; gap: 4px; align-items: center; transform: translateX(-50%); pointer-events: none; }
#alerts { left: var(--sf-safe-inset-x, 0px); right: var(--sf-safe-inset-x, 0px); top: 13%; transform: none; z-index: 1100; display: flex; flex-direction: column; gap: 6px; align-items: center; }

/* G16-01 the Stage (design/program/fleet/drafts/G16-one-glass.md): one host for every transient
   popup. The named slot containers live in index.html and are layout-transparent — the hosts
   inside keep their own ids, z-order and pointer rules. `.sf-stage-slot > div` restores the
   `#ui-root > div` absolute contract for the hosts that used to be direct children
   (#modal-backdrop, #screens, #alerts); the feed slot sits inside #hud so `#hud #toasts` keeps
   binding. Items shown through stage.show() mount in .sf-stage__flow inside the slot, framed by
   the shared .dp-glass — no new visual design. */
.sf-stage-slot { position: absolute; inset: 0; pointer-events: none; }
.sf-stage-slot > div { position: absolute; }
.sf-stage__flow { display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.sf-stage__item { pointer-events: auto; }
#sf-stage-dialog .sf-stage__flow { inset: 0; align-items: center; justify-content: center; }
/* banner and feed items join their host's own lane (#alerts, #toasts — see stage.js `lane`), so the
   flow is an ordinary column child there; only the dialog and prompt slots place their own flow. */
#sf-stage-banner .sf-stage__flow, #sf-stage-feed .sf-stage__flow { position: static; align-items: center; }
/* The prompt flow seats items in the decision lane: above the HUD, under the screens — the same
   z 20 the prompt deck holds (src/ui/AGENTS.md DOM layering). */
/* G16-03: the prompt slot seats where the deck actually sits — upper-right of the HUD on
   desktop, the bottom-left sheet on small viewports, the right column on short landscape —
   the same seats #sf-prompt-deck owns in styles/prompt-deck.css. The flow spans the slot so a
   bare item's own absolute seat (the deck root) resolves against the same box it measures. */
#sf-stage-prompt .sf-stage__flow { position: absolute; inset: 0; justify-content: flex-start; align-items: flex-end; padding-top: max(56px, calc(var(--sf-hud-edge, 20px) + 36px)); padding-right: calc(100vw - var(--sf-rightdock-left, calc(100vw - 250px)) + 14px); box-sizing: border-box; z-index: 20; }
#sf-stage-prompt .sf-stage__item { width: min(328px, calc(100vw - 32px)); }
@media (max-width: 900px), (max-height: 620px) {
  #sf-stage-prompt .sf-stage__flow { justify-content: flex-end; align-items: flex-start; padding-top: 0; padding-right: 0; padding-bottom: max(224px, 25vh); padding-left: 12px; }
  #sf-stage-prompt .sf-stage__item { width: min(392px, calc(100vw - 172px)); }
}
@media (min-width: 640px) and (max-height: 620px) {
  #sf-stage-prompt .sf-stage__flow { justify-content: flex-start; align-items: flex-end; padding-top: 112px; padding-right: 12px; padding-bottom: 0; padding-left: 0; }
  #sf-stage-prompt .sf-stage__item { width: min(392px, calc(100vw - 350px)); }
}

body.ui-modal-open #hud { opacity: 0; pointer-events: none; }
body.ui-modal-open #modal-backdrop { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 200ms var(--ease, ease), visibility 0s; }
body.ui-modal-open #sf-onboarding,
body.ui-modal-open .sf-ob-intro { display: none; }

button:disabled { opacity: .4; cursor: default; }
.mono { font-family: var(--mono); }

/* boot overlay — the intro console styling lives in styles/intro.css (boot + title
   share one sheet). Kept here only: nothing. Hooks other code depends on:
   #boot-overlay(.hidden), [data-loading-label/detail/progress]. */

.panel {
  background: color-mix(in srgb, var(--sf-surface) 92%, transparent);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,.65);
}
button, .btn {
  font-family: inherit;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, box-shadow .12s ease, translate .08s ease, filter .08s ease;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: max(12px, 0.92em);
}
button:hover, .btn:hover {
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 30%, transparent);
  translate: 0 -1px;
}
button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--dp-ink, #e8e2d4);
  outline-offset: 3px;
  border-color: var(--dp-ink, #e8e2d4);
  color: #fff;
}
/* Press feedback uses the INDIVIDUAL `translate` property, not `transform`.
   `transform` is a single value: a press rule written as `transform:translateY(1px)` REPLACES any
   transform the element uses for positioning. Station hardpoints are centred on their hull anchor
   with `transform:translate(-50%,-50%)`, so the old rule made a 34px reticle jump ~17px right and
   ~16px down while held — it fled the cursor and read as a dead control. `translate` composes with
   `transform` instead of overwriting it, so positioning survives the press. */
button:active, .btn:active {
  translate: 0 1px;
  filter: brightness(0.95);
}
button:disabled, .btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(0.5);
  box-shadow: none;
  translate: none !important;
}

.hud-bar {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--panel-edge);
}

/* Pilot "SpaceFace" identity — the generated portrait makes the game personal and branded */
#pilot-portrait {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 50%, transparent);
  z-index: 20;
  pointer-events: auto;
  background: var(--panel-2);
}
#pilot-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: crisp-edges;
}

/* The flight target cursor sits above instruments and prompts, independently of HUD effects. */
#aim-reticle {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  transform: translate3d(50vw, 50vh, 0) translate(-50%, -50%);
  pointer-events: none;
  z-index: 1200;
  opacity: 1;
  filter: none;
  will-change: transform;
}
#aim-reticle img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
/* Mouse flight's open gunsight is a native custom cursor. The DOM marker keeps its hit
   ticks without drawing a second cursor that can lag or disappear with presentation. */
#aim-reticle[data-mode="manual"] .sf-reticle-shape--open,
#aim-reticle[data-mode="manual"] > svg > circle { display: none; }

/* Hit-confirm crosshair feedback */
#aim-reticle .sf-reticle-hit-ticks {
  opacity: 0;
  stroke: transparent;
  transform-origin: 50px 50px;
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
}

#aim-reticle[data-hit="shield"] .sf-reticle-hit-ticks {
  opacity: 1;
  stroke: #38bdf8;
  filter: drop-shadow(0 0 3px #0284c7);
  transform: scale(1.05);
}

#aim-reticle[data-hit="hull"] .sf-reticle-hit-ticks {
  opacity: 1;
  stroke: #f43f5e;
  filter: drop-shadow(0 0 4px #e11d48);
  transform: scale(1.18);
}

#aim-reticle[data-hit="kill"] .sf-reticle-hit-ticks {
  opacity: 1;
  stroke: #fbbf24;
  filter: drop-shadow(0 0 7px #f59e0b);
  transform: scale(1.36);
}

/* Top-level circle only — a descendant :last-of-type would also catch the r=40 ring inside
   .sf-reticle-shape--open and flash a large faint disc on kill. */
#aim-reticle[data-hit="kill"] > svg > circle:last-of-type {
  fill: #fbbf24;
}

/* Receipts / telemetry feedback (clean HUD type, restrained lines, no heavy cards) */
.toast {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink);
  background: color-mix(in srgb, var(--sf-surface) 88%, transparent);
  border: 1px solid var(--panel-edge);
  padding: 5px 12px;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.toast.good, .toast[data-kind="good"], .toast[data-kind="credits"], .toast[data-kind="success"] { color: #b9e6cd; }
.toast.warn, .toast[data-kind="warn"] { color: #ecd7b5; }
.toast.danger, .toast.error, .toast[data-kind="danger"], .toast[data-kind="error"] { color: #f0c9cd; }


/* J05 removed `.icon-ref`, the only referrer to assets/ui/icons_atlas.jpg. It was a "usage hint" for
   future sliced icons that no markup ever claimed — a dead class keeping a 271 KB labelled contact
   sheet alive in the bundle. Icons are inline 24×24 stroke SVG; see src/ui/station/icons.js. */

/* Screen titles and pro touches */
#screens h1, #screens .title {
  font-family: var(--sf-display-face);
  letter-spacing: .04em;
  color: var(--ink);
}
#screens .subtle { color: var(--ink-dim); font-size: 0.82em; }

/* ============================================================================================
   PHASE 5 — DESIGN SYSTEM
   A formalized token + component layer so every screen shares one cohesive, modern identity.
   Adds spacing/radius/type/motion/elevation scales, reusable components (cards, badges, tabs,
   dividers, section headers), and refined buttons/inputs. Existing screens inherit these via the
   tokens without a risky per-screen rewrite.
   ============================================================================================ */
:root {
  /* spacing scale (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  /* radius scale */
  --r-sm: 4px; --r-md: 7px; --r-lg: 10px; --r-xl: 14px; --r-pill: 999px;
  /* type scale */
  --t-xs: 10px; --t-sm: 12px; --t-md: 14px; --t-lg: 17px; --t-xl: 22px; --t-2xl: 30px;
  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: .1s; --dur: .18s; --dur-slow: .3s;
  /* elevation */
  --sh-1: 0 2px 10px rgba(0,0,0,.35);
  --sh-2: 0 6px 24px rgba(0,0,0,.45);
  /* surface (former "glass" tokens, now plain translucent panel values) */
  --glass: rgba(18,22,28,.82);
  --glass-edge: rgba(255,255,255,.09);
  /* accent (flattened: solid colour, no gradient fills) */
  --grad-accent: var(--accent);
}

/* ---- reusable components --------------------------------------------------------------- */

/* Card: the workhorse surface for list rows, ship cards, stat blocks. */
.sf-card {
  background: color-mix(in srgb, var(--sf-surface) 88%, transparent);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.sf-card--hover:hover {
  border-color: var(--glass-edge);
  box-shadow: var(--sh-2);
  transform: translateY(-2px);
}
.sf-card--hover:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sf-card--hover:active {
  transform: translateY(0);
}
.sf-card--accent { border-color: var(--panel-edge-2); }

/* Badge / tag: legality, facing, tier, event pills. */
.sf-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--r-pill);
  font-size: var(--t-xs); letter-spacing: .05em; text-transform: uppercase;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.sf-badge--good { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.sf-badge--warn { background: color-mix(in srgb, var(--sf-goal) 12%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--sf-goal) 30%, transparent); }
.sf-badge--danger { background: color-mix(in srgb, var(--sf-foe) 12%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--sf-foe) 30%, transparent); }
.sf-badge--muted { background: color-mix(in srgb, var(--sf-calm) 10%, transparent); color: var(--ink-dim); border-color: color-mix(in srgb, var(--sf-calm) 20%, transparent); }

/* Section header: the small all-caps label above a group. */
.sf-section-h {
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-mute);
  display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2);
}
.sf-section-h::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--panel-edge), transparent);
}

/* Tabs: shared station-hub tab strip styling. */
.sf-tabs { display: flex; gap: var(--sp-1); padding: var(--sp-1); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bg) 50%, transparent); border: 1px solid var(--panel-edge); }
.sf-tab { padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); cursor: pointer;
  color: var(--ink-dim); font-size: var(--t-sm); letter-spacing: .04em; pointer-events: auto;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease); border: none; background: none; text-transform: none; }
.sf-tab:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sf-tab.active { color: #fff; background: var(--accent); }

/* Primary / ghost button variants for clear affordance hierarchy. */
.sf-btn { font-family: inherit; cursor: pointer; pointer-events: auto; border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-4); font-size: var(--t-sm); letter-spacing: .06em; text-transform: uppercase;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.sf-btn--primary { background: var(--accent); color: #fff; border: none; font-weight: 600; }
.sf-btn--primary:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); transform: translateY(-1px); }
.sf-btn--ghost { background: var(--glass); color: var(--ink); border: 1px solid var(--panel-edge); }
.sf-btn--ghost:hover { border-color: var(--accent); color: #fff; }
.sf-btn--danger { background: color-mix(in srgb, var(--sf-foe) 15%, transparent); color: var(--danger); border: 1px solid color-mix(in srgb, var(--sf-foe) 40%, transparent); }
.sf-btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }

/* Inputs */
.sf-input { font-family: inherit; background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--ink);
  border: 1px solid var(--panel-edge); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3);
  font-size: var(--t-sm); pointer-events: auto; transition: border-color var(--dur) var(--ease); }
.sf-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }

/* Stat readout (label over value) — used in shipyard/market headers. */
.sf-stat-block { display: flex; flex-direction: column; gap: 2px; }
.sf-stat-block__k { font-size: var(--t-xs); letter-spacing: .06em; color: var(--ink-mute); text-transform: uppercase; }
.sf-stat-block__v { font-size: var(--t-lg); color: var(--ink); font-family: var(--mono); }

/* Screen title bar: consistent header for every modal screen. */
.sf-screen-title {
  font-family: var(--sf-display-face); font-size: var(--t-xl); letter-spacing: .04em;
  color: var(--ink);
  display: flex; align-items: baseline; gap: var(--sp-3);
}
.sf-screen-title .sf-screen-sub { font-family: var(--font); font-size: var(--t-sm);
  letter-spacing: .04em; color: var(--ink-dim); text-shadow: none; text-transform: none; }

/* Divider */
.sf-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--panel-edge), transparent);
  border: none; margin: var(--sp-3) 0; }

/* Empty state — LEGACY, superseded by .sf-state (section 13). Zero consumers; kept only so any
   out-of-tree screen still renders. New panes use uiPrimitives.mountDataState(). */
.sf-empty { color: var(--ink-mute); font-style: italic; font-size: var(--t-sm); padding: var(--sp-3); text-align: center; }

/* Fade-in for screens/panels so they feel responsive, not pop-in. */
@keyframes sf-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.sf-fadein { animation: sf-fadein var(--dur-slow) var(--ease) both; }

/* Scrollbars: slim, on-theme (the station lists get long). */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--panel-edge-2) color-mix(in srgb, var(--bg) 40%, transparent);
}
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: color-mix(in srgb, var(--bg) 40%, transparent); }
*::-webkit-scrollbar-thumb { background: var(--panel-edge-2); border-radius: var(--r-pill); }
*::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Precision range sliders: tactile aerospace thumb and glowing track across all surfaces */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--panel-edge-2) 60%, transparent);
  border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
input[type="range"]:hover::-webkit-slider-runnable-track {
  border-color: var(--panel-edge-2);
  background: color-mix(in srgb, var(--panel-edge-2) 80%, transparent);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
  cursor: grab;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), filter .12s var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.18);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 80%, transparent);
  filter: brightness(1.1);
}
input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.28);
  background: #ffffff;
  box-shadow: 0 0 18px var(--accent);
  filter: brightness(1.2);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--panel-edge-2) 60%, transparent);
  border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
}
input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 60%, transparent);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
  cursor: grab;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
input[type="range"]:hover::-moz-range-thumb {
  transform: scale(1.18);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 80%, transparent);
}
input[type="range"]:active::-moz-range-thumb {
  cursor: grabbing;
  transform: scale(1.28);
  background: #ffffff;
  box-shadow: 0 0 18px var(--accent);
}

/* Keycaps & keyboard shortcut badges: physical tactile chip */
kbd, .sf-keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: var(--t-sm, 12px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel-2) 90%, transparent);
  border: 1px solid var(--panel-edge-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  vertical-align: baseline;
  letter-spacing: .02em;
}

/* Precision input fields & selects: responsive aerospace feel */
input[type="text"], input[type="number"], select, textarea {
  font-family: var(--mono);
  font-size: var(--t-sm, 12px);
  color: var(--ink);
  background: color-mix(in srgb, var(--panel-2) 85%, transparent);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r-sm, 4px);
  padding: 6px 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
  box-sizing: border-box;
}
input[type="text"]:hover, input[type="number"]:hover, select:hover, textarea:hover {
  border-color: var(--panel-edge-2);
  background: color-mix(in srgb, var(--panel-2) 95%, transparent);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5), 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Tactile aerospace checkboxes & radio inputs */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  padding: 0;
  border: 1px solid var(--panel-edge-2);
  border-radius: var(--r-sm, 3px);
  background: color-mix(in srgb, var(--panel-2) 90%, transparent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
  vertical-align: middle;
  cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type="checkbox"]:hover, input[type="radio"]:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent);
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input[type="checkbox"]::before {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #020617;
  border-bottom: 2px solid #020617;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform .12s var(--ease);
}
input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 50%, transparent);
}
input[type="checkbox"]:checked::before {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}
input[type="radio"] {
  border-radius: 50%;
}
input[type="radio"]::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #020617;
  transform: scale(0);
  transition: transform .12s var(--ease);
}
input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 50%, transparent);
}
input[type="radio"]:checked::before {
  transform: scale(1);
}

/* Screen-reader-only live-region text (still announced, never visually shown). */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Contrast safety: caption + flat control hints over bright raw nebulae. */
#hud .sf-caption { text-shadow:0 1px 5px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.7) !important; }


/* ============================================================================================
   CURRENT CONSOLE COMPATIBILITY TOKENS (UI full-pass Slice 1 foundation)
   ============================================================================================
   These tokens support the existing non-diegetic HUD and several current screen primitives. They
   document the implementation that is on disk; they are not a command-console art-direction
   constitution for new work. New surfaces may use a different coherent visual language when normal
   player-route evidence, accessibility, and measured performance support it.

   Tokens here are ADDITIVE and semantic. They coexist with the existing --ink*/--accent* text
   tokens (which the WCAG audit reads); screens and the flight HUD adopt them slice-by-slice without
   breaking anything that already works.

   THE LOAD-BEARING RULE — brightness encodes state (the fix for "everything screams all the time"):
     dim    = healthy / nominal / idle   (a full health bar is calm steel, not screaming red)
     bright = active system or problem   (energy regenerating, shield recently hit, heat climbing)
     red    = damage taken / alarm / critical  (NEVER the default state of anything)
   This inverts the old "full-brightness always." The eye goes to what needs attention because
   everything else is quiet — how Elite/Star Citizen health rings read.

   The current tokens use steel/cyan for structure and active systems, amber for heat, red for
   danger, and mint for cargo/income. Those mappings describe existing semantics, not a universal
   palette ceiling.
   ============================================================================================ */
:root {
  /* Structure / hull — desaturated steel-blue. Calm "this is the ship itself."
     (These mirror the existing well-behaved --ink-mute/--ink-dim text values, now given a semantic
     name so vitals can reference them without overloading text tokens.) */
  --console-steel:      #9aa4b0;   /* bright steel — the healthy / nominal state */
  --console-steel-dim:  #6e7885;   /* dim structural — bars at full health read quiet */
  /* Active systems — the single blue accent. Bright = the system is live / regenerating. */
  --console-cyan:       #4f8fdd;   /* bright accent — active system / regenerating (== --accent) */
  --console-cyan-dim:   #2c4a68;   /* dim accent — shield/energy at rest */
  /* Heat — amber. A bar at 0% is nearly invisible; it EARNS its presence as it climbs. */
  --console-amber:      #d9a054;   /* bright amber — heat climbing, attention warranted (== --warn) */
  --console-amber-dim:  #4a3a1e;   /* dim amber — idle/cool (barely visible = correct) */
  /* Danger — red. ONLY for damage taken, low health, alarms. Never a default state. */
  --console-red:        #d95f6a;   /* bright red — critical / taking damage (== --danger) */
  /* Cargo / income — the calm green. */
  --console-mint:       #4fbf8f;   /* bright green — resource gained (== --accent-2) */

  /* Console surfaces (panel + edge) — reusable by the command bar + screens. */
  --console-bg:         rgba(13,16,21,.85);    /* semi-transparent (flight HUD, over the canvas) */
  --console-bg-solid:   #151a21;               /* opaque (screens/modals, over the menu bg) */
  --console-edge:       rgba(255,255,255,.10); /* calm neutral edge */
}

/* ---- Current console primitives (additive compatibility variants) ----------------------------

   This panel uses the existing asymmetric cut treatment. It is one available component treatment,
   not a universal replacement for other panel geometry. */

/* General-purpose variant for screens/modals — MAY use shadow + transition (not flight-mounted). */
.sf-console-panel {
  background: var(--console-bg-solid);
  border: 1px solid var(--console-edge);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  padding: var(--sp-3) var(--sp-4);
}
/* Flight-HUD variant — current low-cost baseline for an always-mounted surface. Any richer treatment
   must prove idle frame-sleep and measured compositor performance; this selector is not a universal
   opaque/no-blur art-direction rule for other screens. */
.sf-console-panel--hud {
  background: var(--console-bg);
  border: 1px solid var(--console-edge);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

/* Current console-button variant: cut-corner, uppercase, and letter-spaced. */
.sf-console-btn {
  font-family: inherit; cursor: pointer; pointer-events: auto;
  background: var(--console-bg-solid); color: var(--ink);
  border: 1px solid var(--console-edge);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--t-sm); letter-spacing: .05em; text-transform: uppercase;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sf-console-btn:hover { border-color: var(--console-cyan); color: #fff; }
.sf-console-btn:disabled { opacity: .4; cursor: default; }
.sf-console-btn--primary { background: var(--console-cyan); color: var(--sf-surface); border-color: var(--console-cyan); font-weight: 700; }

/* Stat: the command-bar readout — uppercase mono label + mono value. tabular-nums keeps digits
   from jittering as the value changes (credits counting up, cargo filling). */
.sf-console-stat { display: flex; flex-direction: column; gap: 1px; line-height: 1.1; }
.sf-console-stat__k {
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-mute);
}
.sf-console-stat__v {
  font-family: var(--mono); font-size: var(--t-md); color: var(--ink);
  font-variant-numeric: tabular-nums; text-align: right;
}

/* ===== DIALOGS, ACCESSIBILITY, TARGET & OVERVIEW STYLES (spec2/06) ===== */

/* All modals & cards drop the inset cyan glow */
.sf-card {
  background: color-mix(in srgb, var(--sf-surface) 92%, transparent) !important;
  border: 1px solid var(--panel-edge) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: none !important;
}

/* a11y focus outlines */
/* Warm bone, not the legacy blue: the focus ring is an instrument light like every other rule. */
*:focus-visible {
  outline: 2px solid var(--dp-ink, #e8e2d4) !important;
  outline-offset: 3px !important;
}

/* Destructive buttons - no red solid fills, #ff5c5c text only */
.sf-btn--danger, .btn-danger, [data-destructive] {
  color: #ff5c5c !important;
  border-color: rgba(255, 92, 92, 0.4) !important;
  background: color-mix(in srgb, var(--sf-surface) 92%, transparent) !important;
}
.sf-btn--danger:hover, .btn-danger:hover, [data-destructive]:hover {
  border-color: #ff5c5c !important;
  box-shadow: 0 0 12px rgba(255, 92, 92, 0.3) !important;
  color: #fff !important;
}

/* Target Panel v2 Segmented Bars */
.sf-target__bars {
  display: flex;
  gap: 4px;
  margin: 6px 0;
  /* J07: was a hard 220px inside a 212px content box - a 9px overhang at every
     viewport, which is the stagger the dock actually showed. The column owns the width now. */
  width: 100%;
  justify-content: space-between;
  contain: layout paint style;
}
.sf-bar--segmented {
  width: 72px;
  height: 5px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  border-radius: 0;
  overflow: hidden;
}
.sf-bar--segmented .sf-bar__fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
}
.sf-bar--segmented.sf-bar--shield .sf-bar__fill {
  background: var(--accent);
  box-shadow: none;
}
.sf-bar--segmented.sf-bar--armor .sf-bar__fill {
  background: #8fa3bd;
  box-shadow: none;
}
.sf-bar--segmented.sf-bar--hull .sf-bar__fill {
  background: #ff7c5c;
  box-shadow: none;
}
.sf-target__gimmick {
  font-size: 12px;
  color: var(--warn);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 4px;
  border: 1px solid color-mix(in srgb, var(--sf-goal) 30%, transparent);
  background: color-mix(in srgb, var(--sf-goal) 8%, transparent);
  padding: 2px 6px;
  display: inline-block;
}

/* In-world target rings — the arc-gauge treatment the ORRERY Cluster uses for the same three
   readings (src/ui/orrery/flightCluster.js: shield = bright phos, armour = quiet hairline,
   hull = the vital body). Token palette only; the fill dasharray is the quantity, so the rings
   run at full strength and the hierarchy is carried by weight, not by one flat 0.55 dimmer.
   The viewBox is 1:1 with CSS pixels, so these widths are true screen weights. */
.sf-target-arcs {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: transform;
}
.sf-target-arcs.visible {
  opacity: 1;
}
.sf-target-arcs circle {
  fill: none;
  stroke-linecap: round;
}
.sf-arc-shield {
  stroke: var(--dp-phos, #dfeeff);
  stroke-width: 2.5px;
  opacity: 0.95;
}
.sf-arc-armor {
  stroke: var(--k-bone-38, #8b887e);
  stroke-width: 1.25px;
  opacity: 0.85;
}
.sf-arc-hull {
  stroke: var(--dp-ink, #e8e2d4);
  stroke-width: 2px;
  opacity: 0.9;
}

/* Overview Strip */
.sf-overview {
  width: 100%;   /* J07: the right dock column owns this number (--sf-dock-w). */
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: auto;
  margin: 4px 0;
  font-family: var(--mono);
  font-size: 12px;
  user-select: none;
  contain: layout paint style;
}
.sf-overview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--sf-surface) 65%, transparent);
  cursor: pointer;
  border-left: 1px solid var(--iff-color, var(--console-edge));
}
.sf-overview-row:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left-width: 2px;
}
.sf-overview-row.selected {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-left-width: 2px;
}
.sf-overview-row__left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.sf-overview-row__name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.sf-overview-row__right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-dim);
}
.sf-overview-footer {
  padding: 4px 8px;
  background: color-mix(in srgb, var(--sf-surface) 40%, transparent);
  color: var(--ink-mute);
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* G dynamic combat stick: compact center instrument, not a mobile-game chrome panel.
   The visible radius is intentionally smaller than the physical control radius; the hand gets a
   generous 118-176px throw while the HUD stays out of the fight. */
#auto-target-flight-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  pointer-events: none;
  z-index: 16;
  display: none;
  opacity: 0.58;
  transition: opacity 90ms linear;
}
#auto-target-flight-stick.is-active { opacity: 0.92; }
.sf-combat-stick__base {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(126, 225, 255, 0.34);
  border-radius: 50%;
  box-shadow:
    inset 0 0 18px rgba(126, 225, 255, 0.045),
    0 0 10px rgba(126, 225, 255, 0.08);
}
.sf-combat-stick__crosshair::before,
.sf-combat-stick__crosshair::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(126, 225, 255, 0.24);
  transform: translate(-50%, -50%);
}
.sf-combat-stick__crosshair::before { width: 18px; height: 1px; }
.sf-combat-stick__crosshair::after { width: 1px; height: 18px; }
.sf-combat-stick__knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 1px solid rgba(190, 241, 255, 0.92);
  border-radius: 50%;
  background: rgba(126, 225, 255, 0.12);
  box-shadow:
    0 0 8px rgba(126, 225, 255, 0.35),
    inset 0 0 6px rgba(220, 250, 255, 0.16);
  will-change: transform;
}
#auto-target-flight-stick.is-active .sf-combat-stick__knob {
  background: rgba(126, 225, 255, 0.24);
  box-shadow:
    0 0 12px rgba(126, 225, 255, 0.54),
    inset 0 0 8px rgba(220, 250, 255, 0.20);
}
@media (prefers-reduced-motion: reduce) {
  #auto-target-flight-stick { transition: none; }
}

/* Auto-target draw-to-fly route; target diamonds and lead pips remain weapon feedback. */
#auto-target-flight-path {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 15;
  display: none;
  opacity: 0;
  transition: opacity 90ms linear;
}
#auto-target-flight-path .sf-flight-path__route {
  fill: none;
  stroke: rgba(126, 225, 255, 0.66);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 3 7;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 55%, transparent));
}
#auto-target-flight-path .sf-flight-path__endpoint-ring {
  fill: color-mix(in srgb, var(--accent) 6%, transparent);
  stroke: rgba(126, 225, 255, 0.78);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 64%, transparent));
}
#auto-target-flight-path .sf-flight-path__endpoint {
  fill: #7ee1ff;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 85%, transparent));
}
#auto-target-flight-path.is-drawing .sf-flight-path__route {
  stroke: rgba(126, 225, 255, 0.9);
}
@media (prefers-reduced-motion: reduce) {
  #auto-target-flight-path { transition: none; }
}

/* Contacts strip v2: one-word state chip, threat-tier pips, derelict manifest line. */
.sf-overview-row { flex-wrap: wrap; }
.sf-overview-row__state {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: 0.85;
}
/* Threat tier is drawn (hud.js writes three <i> segments, .is-lit to the tier), never typeset —
   the ▰/▱ codepoints showed as missing-glyph boxes on fonts that lack them. Slanted hairline
   slots, filled where lit, in the row's state colour (hostile still reads red). */
.sf-overview-row__tier {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.sf-overview-row__tier i {
  display: block;
  width: 5px;
  height: 9px;
  transform: skewX(-16deg);
  border: 1px solid currentColor;
  opacity: .62;   /* unlit slots must still read at 720 — .45 washed out against a bright field */
}
.sf-overview-row__tier i.is-lit {
  background: currentColor;
  opacity: 1;
}
.sf-overview-row__detail {
  flex-basis: 100%;
  margin-top: 2px;
  padding-left: 20px;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Unscanned derelict: ghost outline + italic "??? UNSCANNED" until a scan pulse resolves it. */
.sf-overview-row.unscanned {
  border-left-style: dashed;
  opacity: 0.72;
}
.sf-overview-row.unscanned .sf-overview-row__detail { font-style: italic; }
/* State colours (mirrors radar/IFF language). */
.sf-cs--hostile { color: var(--danger); }
.sf-cs--patrol { color: var(--visor-cyan, var(--accent)); }
.sf-cs--derelict { color: var(--ink-mute); }
.sf-cs--trader { color: var(--good); }
.sf-cs--miner { color: var(--visor-amber, var(--warn)); }
.sf-cs--ally { color: var(--good); }
.sf-cs--neutral { color: var(--ink-dim); }

@media (max-width: 900px), (max-height: 650px) {
  .sf-overview { width: 100%; gap: 2px; font-size: 12px; }
  .sf-overview-row { padding: 3px 5px; }
  .sf-overview-row__name { max-width: 54px; }
  .sf-overview-row__right { gap: 3px; }
  .sf-overview-row__detail { display: none; }
  .sf-overview-footer { padding: 3px 5px; font-size: 12px; }
}

/* ==============================================================================================
   UI PRIMITIVE LAYER  ·  frontend-reboot reusable building blocks (design/revamp/FRONTEND_REBOOT_AUDIT.md)
   ----------------------------------------------------------------------------------------------
   One additive compatibility vocabulary of reusable primitives. Matching DOM factory helpers live
   in src/ui/uiPrimitives.js. New work may extend or replace the visual technique, including colors,
   compositing, or dependencies, when accessibility, maintenance, and measured performance support
   it. Kept as ONE contiguous end-of-file section so
   concurrent writers merge cleanly. It EXTENDS the existing .sf-console-* / .sf-card / .sf-badge /
   .sf-bar--segmented layers; it does not redefine or break them.

   THE VOCABULARY (primitive → supersedes / relates to → flight-HUD-safe? → motion policy)
   ┌────────────────────┬──────────────────────────────────┬────────────┬─────────────────────────┐
   │ .sf-panel[--cut]   │ .sf-console-panel (cut-corner)    │ yes(--hud) │ none at rest            │
   │ .sf-card__label/…  │ .sf-console-stat (label + value)  │ yes        │ none at rest            │
   │ .sf-chip           │ .sf-badge (static → LIVE state)   │ yes        │ hover/focus only        │
   │ .sf-rail           │ .st-rail / .sf-tabs (station rail)│ yes        │ hover/focus/active only │
   │ .sf-glyph          │ emoji / unicode tab icons         │ yes        │ inherits colour only    │
   │ .sf-data-bar       │ .sf-bar--segmented (target panel) │ yes        │ opt-in --animate (xform)│
   │ .sf-asset-stage    │ (new — outfitting 3D preview)     │ yes        │ none at rest            │
   │ .sf-border-trace   │ (new — state-change edge sweep)   │ screens    │ ONE-SHOT ≤250ms, state  │
   │ .sf-spotlight      │ (new — hover/focus highlight)     │ screens    │ hover/focus opacity only│
   └────────────────────┴──────────────────────────────────┴────────────┴─────────────────────────┘
   .sf-chip is the canonical status primitive going forward; .sf-badge is its legacy equivalent.

   MOTION CONTRACT: motion must communicate state, respect reduced-motion, and avoid idle work on
   always-mounted flight surfaces. Durations and visual technique are chosen per interaction and
   judged in the player route; the values below describe the current implementation, not a global
   timing or glow ceiling. Base primitives currently sleep until an explicit interaction/state class.

   ── WHEN IS .sf-border-trace ALLOWED? ─────────────────────────────────────────────────────────
   ONLY as a one-shot acknowledgement of a discrete STATE CHANGE on a SCREEN / menu surface — e.g. a
   panel that just received new data, a tab that became available, a module that was installed. Add
   the `.is-tracing` class for the sweep (uiPrimitives.trace() re-triggers it); the animation ENDS at
   opacity:0 so nothing lingers lit. NEVER put it on an always-mounted flight-HUD element, never loop
   it, never leave `.is-tracing` on at rest. It is punctuation for a change, not decoration.

   ── WHEN IS .sf-spotlight ALLOWED? ────────────────────────────────────────────────────────────
   ONLY to raise a hover/focus target on a SCREEN / menu surface (list row, card, rail item). It is a
   STATIC radial wash revealed by an opacity transition on :hover / :focus-within — there is NO idle
   animation and NO cursor tracking (per-frame style writes are forbidden by the frame-sleep budget).
   The current alpha is deliberately quiet. Re-evaluate it from screenshots and measured idle cost
   before applying the effect to always-mounted HUD chrome.
   ============================================================================================== */

/* Primitive-scoped defaults for the current implementation; not a palette or quality ceiling. */
:root {
  --sf-trace-dur: 220ms;   /* current one-shot edge sweep duration */
  --sf-cut: 10px;          /* command-console corner-cut depth */
}

/* 1 ─ sf-panel : current quiet compatibility surface ------------------------------------------ */
.sf-panel {
  background: var(--console-bg-solid);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
/* --cut : the command-console corner tell (asymmetric clip, same grammar as .sf-console-panel).
   NOTE: clip-path clips the border box, so the two cut diagonals render without their edge line —
   the accepted console look, matched to .sf-console-panel. Do NOT add a double-layer border hack. */
.sf-panel--cut {
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - var(--sf-cut)) 0, 100% var(--sf-cut),
                     100% 100%, var(--sf-cut) 100%, 0 calc(100% - var(--sf-cut)));
}
/* --hud : flight-mounted variant — semi-transparent, still shadow/transition-free (compositor-cheap). */
.sf-panel--hud { background: var(--console-bg); }
/* --raised : screens MAY opt into elevation (never used on the flight HUD). */
.sf-panel--raised { box-shadow: var(--sh-2); }

/* 2 ─ sf-card body hierarchy : label / value / body ------------------------------------------
   Additive to the existing .sf-card box (untouched). STRICT child classes only — never a loose
   `.sf-card .label` descendant selector — so existing card innards across every screen stay safe.
   Mirrors the .sf-console-stat metric recipe. Label stays --ink-dim (not --ink-mute) to hold 4.5:1
   over the .88 panel ground (check-wcag-contrast). */
.sf-card__label {
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-dim); line-height: 1.2;
}
.sf-card__value {
  font-family: var(--mono); font-size: var(--t-lg); color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.sf-card__body { font-size: var(--t-sm); color: var(--ink-dim); line-height: 1.45; }
.sf-card__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }

/* 3 ─ sf-chip : small LIVE status chip (state that CHANGES) ----------------------------------
   Earns its place beside static .sf-badge via three capabilities badge lacks: a state-dot channel,
   a leading glyph slot, and a focusable interactive variant. Token-driven tints via color-mix (the
   same technique already shipped in styles/accessibility.css) so no raw hex enters this layer. */
.sf-chip {
  --sf-chip-color: var(--ink-dim);
  display: inline-flex; align-items: center; gap: .4em;
  padding: .15em .6em; border-radius: var(--r-pill);
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase;
  color: var(--sf-chip-color);
  background: color-mix(in srgb, var(--sf-chip-color) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--sf-chip-color) 32%, transparent);
  white-space: nowrap;
}
.sf-chip__dot   { width: .5em; height: .5em; border-radius: 50%; background: currentColor; flex: none; }
.sf-chip__glyph { display: inline-flex; width: 1em; height: 1em; flex: none; }
.sf-chip--info   { --sf-chip-color: var(--accent);   }
.sf-chip--good   { --sf-chip-color: var(--good);     }
.sf-chip--warn   { --sf-chip-color: var(--warn);     }
.sf-chip--danger { --sf-chip-color: var(--danger);   }
.sf-chip--story  { --sf-chip-color: var(--accent-3); }
.sf-chip--muted  { --sf-chip-color: var(--ink-mute); }
/* interactive chip (rendered as a <button> or role="button"): hover/focus lift + obvious keyboard ring. */
.sf-chip--btn { cursor: pointer; pointer-events: auto;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.sf-chip--btn:hover { background: color-mix(in srgb, var(--sf-chip-color) 20%, transparent);
  border-color: var(--sf-chip-color); }
.sf-chip--btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 4 ─ sf-rail : vertical (default) / horizontal nav rail ------------------------------------- */
.sf-rail { display: flex; flex-direction: column; gap: var(--sp-1); }
.sf-rail--h { flex-direction: row; }
.sf-rail__item {
  display: flex; align-items: center; gap: .6em; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--ink-dim); font-family: inherit; font-size: var(--t-sm); letter-spacing: .04em;
  padding: var(--sp-2) var(--sp-3); cursor: pointer; pointer-events: auto;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.sf-rail__item:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sf-rail__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--ink); }
.sf-rail__item[aria-current="true"], .sf-rail__item.active {
  color: var(--ink);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* 5 ─ sf-glyph : 1em SVG icon wrapper (retires emoji / unicode tab icons) ----------------------
   Sizes in em so it tracks font-size AND --ui-scale (#hud / #ui-root font-size). SVG strokes with
   currentColor, so a glyph inherits its context's state colour (hover / active / IFF) for free. */
.sf-glyph { display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; flex: none; line-height: 1; vertical-align: -0.125em; }
.sf-glyph > svg { width: 100%; height: 100%; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sf-glyph--lg { width: 1.35em; height: 1.35em; }

/* 6 ─ sf-data-bar : segmented value bar (hull, shield, heat, cargo, route risk…) --------------
   The fill is a FLAT solid colour scaled by transform:scaleX(var(--sf-bar-v)) — compositor-cheap and
   reflow-free (JS sets ONE custom property, never touches layout). Segmentation is a mask on the
   CONTAINER, so gaps reveal whatever truly sits behind the bar and can never distort the scaled fill.
   Base has NO transition (a heat bar updates every frame while firing and must stay quiet at rest);
   --animate opts screens into a transform-only ease so rapidly changing threshold colors remain
   legible and do not accidentally animate layout or unrelated properties. */
.sf-data-bar {
  --sf-bar-v: 0; --sf-bar-color: var(--accent); --sf-bar-seg: 9px; --sf-bar-gap: 2px;
  position: relative; height: 6px; overflow: hidden; border-radius: 1px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  -webkit-mask-image: repeating-linear-gradient(90deg, var(--ink) 0 calc(var(--sf-bar-seg) - var(--sf-bar-gap)), transparent calc(var(--sf-bar-seg) - var(--sf-bar-gap)) var(--sf-bar-seg));
          mask-image: repeating-linear-gradient(90deg, var(--ink) 0 calc(var(--sf-bar-seg) - var(--sf-bar-gap)), transparent calc(var(--sf-bar-seg) - var(--sf-bar-gap)) var(--sf-bar-seg));
}
.sf-data-bar__fill {
  position: absolute; inset: 0; transform-origin: left center;
  transform: scaleX(var(--sf-bar-v)); background: var(--sf-bar-color);
}
.sf-data-bar--animate .sf-data-bar__fill { transition: transform var(--dur) var(--ease); }
.sf-data-bar--shield { --sf-bar-color: var(--shield); }
.sf-data-bar--hull   { --sf-bar-color: var(--hull);   }
.sf-data-bar--energy { --sf-bar-color: var(--energy); }
.sf-data-bar--cargo  { --sf-bar-color: var(--cargo);  }
.sf-data-bar--heat   { --sf-bar-color: var(--warn);   }
.sf-data-bar--risk   { --sf-bar-color: var(--warn);   }
.sf-data-bar--danger { --sf-bar-color: var(--danger); }
.sf-data-bar--tall   { height: 10px; }

/* 7 ─ sf-asset-stage : dark 3D-preview shell + fallback silhouette (outfitting debt #5) --------
   A dark, quiet staging box (space is dark) a UI mini-renderer canvas can mount into; until then a
   low-contrast ship silhouette holds the frame. Add --loaded once a canvas mounts to hide the
   fallback. No animation at rest; the faint floor lift is a static studio backdrop, not a glow. */
.sf-asset-stage {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3;
  background: radial-gradient(130% 100% at 50% 118%, color-mix(in srgb, var(--console-steel) 10%, var(--bg)), var(--bg) 62%);
  border: 1px solid var(--console-edge); border-radius: var(--r-md);
}
.sf-asset-stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sf-asset-stage__fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); color: var(--ink-mute); pointer-events: none;
}
.sf-asset-stage__fallback svg { width: 42%; max-width: 160px; opacity: .5; }
.sf-asset-stage__fallback span { font-family: var(--mono); font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase; }
.sf-asset-stage--loaded .sf-asset-stage__fallback { display: none; }

/* 8 ─ sf-border-trace : ONE-SHOT edge sweep on a state change (see WHEN-ALLOWED note above) ----- */
.sf-border-trace { position: relative; }
.sf-border-trace::after {
  content: ""; position: absolute; inset: -1px; pointer-events: none; border-radius: inherit;
  border: 1px solid var(--sf-trace-color, var(--accent)); opacity: 0;
}
.sf-border-trace.is-tracing::after { animation: sf-trace-sweep var(--sf-trace-dur) var(--ease) forwards; }
.sf-border-trace--good   { --sf-trace-color: var(--good);   }
.sf-border-trace--warn   { --sf-trace-color: var(--warn);   }
.sf-border-trace--danger { --sf-trace-color: var(--danger); }
/* Final keyframe is opacity:0 → nothing lingers lit, AND the reduce-motion blanket (which snaps to
   the last frame via `forwards`) degrades to "invisible" — the correct quiet fallback for free. */
@keyframes sf-trace-sweep {
  0%   { opacity: 1; clip-path: inset(0 100% 0 0); }
  70%  { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 0 0); }
}

/* 9 ─ sf-spotlight : hover/focus wash, no idle animation (see WHEN-ALLOWED note above) ---------- */
.sf-spotlight { position: relative; }
.sf-spotlight::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  opacity: 0; transition: opacity 150ms var(--ease);
}
.sf-spotlight:hover::before,
.sf-spotlight:focus-within::before,
.sf-spotlight:focus-visible::before { opacity: 1; }

/* 10 ─ sf-select : styled replacement for native <select> (uiPrimitives.sfSelect) ----------------
   Native OS dropdown chrome is deleted from screens (FRONTEND_DIRECTION §4.4). Field is a real
   <button>; the drop list is a role=listbox anchored inside the root. No idle animation: the list
   appears/disappears on open state only, and reduce-motion gets an instant state for free. */
.sf-select { position: relative; display: inline-flex; min-width: 0; }
.sf-select__field {
  display: inline-flex; align-items: center; gap: var(--sp-2, 6px);
  font: inherit; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--panel-edge); border-radius: var(--r-sm, 5px);
  padding: 5px 10px; cursor: pointer; pointer-events: auto;
  transition: border-color .1s var(--ease, ease), color .1s var(--ease, ease);
  text-transform: none; letter-spacing: normal; box-shadow: none;
}
.sf-select__field:hover { border-color: var(--accent); }
.sf-select__field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sf-select__field:disabled { opacity: .4; cursor: default; }
.sf-select__field svg { width: 12px; height: 12px; flex: none; color: var(--ink-mute); }
.sf-select--open .sf-select__field svg { transform: rotate(180deg); }
.sf-select__value { min-width: 3ch; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-select__list {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 30;
  width: max-content; min-width: 100%; max-width: min(340px, calc(100vw - 24px));
  max-height: 220px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel-2); border: 1px solid var(--panel-edge); border-radius: var(--r-sm, 5px);
  box-shadow: 0 10px 34px rgba(0,0,0,.55);
  padding: 4px; display: none;
}
.sf-select--up .sf-select__list { top: auto; bottom: calc(100% + 4px); }
.sf-select--open .sf-select__list { display: block; }
.sf-select__opt {
  padding: 6px 9px; border-radius: 4px; cursor: pointer; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sf-select__opt:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.sf-select__opt.is-active { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.sf-select__opt.is-selected { color: var(--accent); }
.sf-select__opt[aria-disabled="true"] { opacity: .4; cursor: default; background: none; }
@media (prefers-reduced-motion: reduce) {
  .sf-select__field, .sf-select__field svg { transition: none; }
}

/* 11 ─ instrument skeleton : CREST / STAGE / APRON / DRAWER (grammar §6, Phase 0) ---------------
   Every instrument uses the same three zones so muscle memory transfers between screens even
   though the centerpieces differ completely. Proportions per screen spec (12/58/30 etc. via
   grid-template-rows on .sf-instrument). The APRON always holds ≥1 verb; the STAGE is the
   manipulable centerpiece. Class vocabulary follows grammar §8 (no banned substrings).
   J10+ screens: keep backdrop layers full-bleed and clamp reading zones to --sf-stage-max. */
.sf-instrument { display: grid; grid-template-rows: 12fr 58fr 30fr; width: 100%; height: 100%; min-height: 0; }
.sf-instrument > .sf-crest,
.sf-instrument > .sf-stage,
.sf-instrument > .sf-apron {
  width: min(100%, var(--sf-stage-max));
  margin-inline: auto;
}
.sf-crest { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 22px 10px; }
.sf-crest__title { font-family: var(--sf-display-face); font-weight: 700; font-size: 40px; line-height: 1.04; color: var(--sf-paper); }
.sf-crest__line { font-family: var(--sf-subhead-face); font-weight: 600; font-size: 22px; line-height: 1.25; color: var(--sf-calm); }
.sf-stage { position: relative; min-height: 0; }
.sf-apron { display: flex; flex-direction: column; gap: 8px; padding: 10px 22px 14px; min-height: 0; }
.sf-deck { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.sf-deck__label { font-family: var(--sf-subhead-face); font-weight: 600; font-size: 12px; letter-spacing: var(--sf-track-micro); text-transform: uppercase; color: var(--sf-calm); }
.sf-tile { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; }
.sf-housing { display: flex; flex-direction: column; gap: 6px; }
.sf-anchor { position: absolute; transform: translate(-50%, -50%); }
/* absolute, NOT fixed: a drawer always lives inside a .screen, which carries a transform for its
   enter/exit transition and is therefore the containing block for fixed descendants. Shipping
   `fixed` here and patching it with a descendant selector in §14 is how an override pile starts. */
/* The drawer is a sheet of deep glass whose leading edge dissolves into the world — no border, no
   drop shadow (popup language, styles/kit.css "POPUPS"). */
.sf-drawer { position: absolute; top: 0; bottom: 0; width: min(520px, 42vw); right: 0; z-index: 40;
  background: linear-gradient(90deg, rgb(8 10 14 / 0) 0, rgb(10 12 17 / .94) 64px, rgb(8 10 14 / .97));
  transform: translateX(36px); opacity: 0;
  transition: transform 360ms var(--dp-ease-settle, cubic-bezier(.16, 1, .3, 1)), opacity 240ms var(--dp-ease-settle, ease); }
.sf-drawer.is-open { transform: translateX(0); opacity: 1; }
.sf-drawer__deck { display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow-y: auto; height: 100%; }
@media (prefers-reduced-motion: reduce) { .sf-drawer { transition: none; } }
html.sf-reduce-motion .sf-drawer { transition: none; }

/* Text-expansion base (A_LIST_GAPS #1, binding from Phase 0): no fixed-width text container;
   design against +40%; nowrap only on numerals and keycaps; sentences get a two-line budget. */
.sf-instrument .sf-crest__line, .sf-instrument .sf-tile, .sf-instrument .sf-deck__label { min-width: 0; }
.sf-instrument .sf-tile span[data-sf-text] { overflow-wrap: break-word; }

/* 12 ─ THE SHIP screen host (src/ui/ship/shipScreen.js; SCREENS_B §1.2/§1.3) ---------------------
   The shared shipworks stage re-parented into a pausing flight screen (F2). Full-bleed with its
   own opaque bay backdrop so it never reads as the same room as the menu plate. Absolute inset
   full-bleed (not flex-child sizing): #screens flex-centers its children, so a plain width:100%
   child can still end up content-sized and clipped (vision-review blocker, frame 04). The flight
   host hides commerce: no Fleet/Buy segment (fleet rail stays, inspect-only). */
.sf-ship { position: absolute; inset: 0; width: 100%; height: 100%; background: linear-gradient(160deg, var(--bg) 0%, var(--sf-surface) 100%); }
.sf-ship .sx-sw { width: min(100%, var(--sf-stage-max)); margin-inline: auto; }
.sf-ship .sx-sw--flight .sx-seg { display: none; }
.sf-ship .sx-sw--flight .sx-sw__railstep { display: none; }
/* With the commerce segment hidden, the rail kept the station host's 190px left reservation —
   the lone hull card floated beside a dead gap and rode the viewport top edge. */
.sf-ship .sx-sw--flight .sx-sw__rail { padding: 8px 8px 10px 12px; }
/* 12a ─ THE RANGE (F4) : playable teaching box ---------------------------------------------------
   Own-room flat backdrop + boundary rectangle, one canvas stage, one left-edge drawer. */
#screens:has(> .screen[data-screen="range"].sf-screen--visible),
#screens:has(> .screen[data-screen="range"].sf-screen--entering) {
  background-image: none;
  background-color: var(--bg);
}
#screens:has(> .screen[data-screen="range"].sf-screen--visible)::before,
#screens:has(> .screen[data-screen="range"].sf-screen--entering)::before {
  background: none;
}
.sf-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--sf-paper);
  font-family: var(--sf-body-face);
  pointer-events: auto;
  /* Single source for the rail width so the ≤1280px override below retunes the PROPERTY, not the
     drawer's `width`, and the empty-state inset below can track the same number. */
  --sf-range-rail: min(440px, 40vw);
}
.sf-range__shell {
  position: relative;
  grid-template-rows: 12fr 64fr 24fr;
}
.sf-range__crest {
  align-items: flex-start;
  gap: 20px;
}
.sf-range__crest-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.sf-range__rule {
  margin: 0;
}
.sf-range__instruction {
  margin: 0;
  font: 500 14px/1.35 var(--sf-body-face);
  color: var(--sf-paper);
}
.sf-range__crest-side {
  margin-left: auto;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.sf-range__progress,
.sf-range__cleared {
  font: 500 20px/1.15 var(--sf-data-face);
  font-variant-numeric: tabular-nums;
  color: var(--sf-paper);
}
.sf-range__cleared {
  font-size: 13px;
  color: var(--sf-calm);
}
.sf-range__stage {
  padding: 0 20px;
}
.sf-range__box {
  position: relative;
  width: 100%;
  height: 100%;
}
.sf-range__canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg);
  outline: none;
}
.sf-range__canvas:focus-visible {
  box-shadow: inset 0 0 0 2px var(--sf-you);
}
.sf-range__beam {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sf-range .sf-drawer {
  left: 0;
  right: auto;
  width: var(--sf-range-rail);
  transform: translateX(-100%);
  opacity: 1;
  background: var(--sf-surface);
  border-left: 0;
  border-right: 1px solid var(--sf-edge);
  box-shadow: 18px 0 48px rgba(0, 0, 0, .5);
}
.sf-range .sf-drawer.is-open { transform: translateX(0); }
.sf-range__drawer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sf-edge);
}
.sf-range__drawer-tab,
.sf-range__drawer-close {
  min-height: 34px;
  padding: 6px 10px;
  font: 600 12px/1.2 var(--sf-subhead-face);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sf-range__drawer-tab.is-on {
  border-color: var(--sf-you);
  color: var(--sf-you);
}
.sf-range__drawer-close {
  margin-left: auto;
}
.sf-range__drawer-body {
  gap: 12px;
}
.sf-range__drawer-title {
  font: 600 12px/1.2 var(--sf-subhead-face);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sf-calm);
}
.sf-range__drawer-pane { display: none; }
.sf-range__drawer-pane.is-on {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sf-range__rail {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sf-range__rail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sf-range__rail-group-head {
  font: 600 12px/1.2 var(--sf-subhead-face);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sf-calm);
}
.sf-range__rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sf-range__rail-row {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 500 13px/1.3 var(--sf-body-face);
  text-transform: none;
  letter-spacing: .01em;
  color: var(--sf-paper);
  border: 1px solid var(--sf-edge);
  border-radius: var(--r-sm, 5px);
  background: color-mix(in srgb, var(--sf-surface) 92%, black);
  padding: 6px 8px;
}
.sf-range__rail-row[data-state="new"] .sf-range__rail-state { color: var(--sf-calm); }
.sf-range__rail-row[data-state="flown"] .sf-range__rail-state { color: var(--sf-goal); }
.sf-range__rail-row[data-state="cleared"] .sf-range__rail-state { color: var(--sf-you); }
.sf-range__rail-row.is-active {
  border-color: var(--sf-paper);
}
.sf-range__rail-rule {
  min-width: 0;
  text-align: left;
}
.sf-range__rail-state {
  font: 500 13px/1.2 var(--sf-data-face);
  font-variant-numeric: tabular-nums;
}
.sf-range__bestiary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sf-range__b-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}
.sf-range__b-row .k {
  font: 600 12px/1.2 var(--sf-subhead-face);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--sf-calm);
}
.sf-range__b-row .v {
  font: 500 13px/1.35 var(--sf-body-face);
  color: var(--sf-paper);
  overflow-wrap: anywhere;
}
.sf-range__apron {
  gap: 10px;
  padding-bottom: 16px;
}
.sf-range__verdict-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sf-range__verdict-mount {
  font: 600 22px/1.2 var(--sf-subhead-face);
  color: var(--sf-paper);
  min-height: 28px;
}
.sf-range__verdict-plain {
  display: inline-block;
  font: 600 22px/1.2 var(--sf-subhead-face);
  color: var(--sf-paper);
}
.sf-range__who {
  margin-left: auto;
  min-height: 32px;
  padding: 5px 10px;
  font: 600 12px/1.2 var(--sf-subhead-face);
  letter-spacing: .05em;
}
.sf-range__because {
  margin: 0;
  font: 500 14px/1.35 var(--sf-body-face);
  color: var(--sf-paper);
}
.sf-range__verbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sf-range__verbs .sf-btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: .05em;
}
.sf-range__empty {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px;
  text-align: center;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
}
.sf-range__empty-title {
  margin: 0;
  font: 700 40px/1.04 var(--sf-display-face);
  color: var(--sf-paper);
}
.sf-range__empty-copy {
  max-width: 56ch;
  margin: 0;
  font: 500 14px/1.45 var(--sf-body-face);
  color: var(--sf-paper);
}
/* The rail paints OVER the empty state (drawer z-index 40 vs empty z-index 30), and the rail gets
   WIDER as the viewport narrows (440px at 1920 → 480px at 1280) while the centre point moves left,
   so at 1280×720 the centred copy started around x≈405 — behind the rail. When the drawer is open,
   add the rail's width to the empty state's LEFT PADDING so the centred column sits in the space
   actually visible. Two reasons this is padding and NOT left/inset: the empty state's background is
   a near-opaque full-screen scrim, and its box is what paints that scrim — moving left/inset moves
   the scrim too, leaving everything left of the rail (header title, bottom strip) un-dimmed with a
   hard vertical seam splitting one title into a bright half and a dim half. Padding shrinks only the
   content box the flex centring uses while the background still paints the full screen. Do not
   "simplify" this back to a plain centred box or an inset box. Layout only: no forced-colors
   counterpart needed. */
.sf-range:has(.sf-drawer.is-open) .sf-range__empty {
  padding-left: calc(26px + var(--sf-range-rail));
}
@media (max-width: 1280px) {
  .sf-range__crest-side { min-width: 170px; }
  .sf-range__progress { font-size: 17px; }
  .sf-range { --sf-range-rail: min(480px, 54vw); }
}
@media (prefers-reduced-motion: reduce) {
  .sf-range__rail-row,
  .sf-range__drawer-tab,
  .sf-range__verbs .sf-btn {
    transition: none;
  }
}
@media (forced-colors: active) {
  #screens:has(> .screen[data-screen="range"].sf-screen--visible),
  #screens:has(> .screen[data-screen="range"].sf-screen--entering) {
    background-color: Canvas;
  }
  .sf-range,
  .sf-range__canvas,
  .sf-range .sf-drawer,
  .sf-range__rail-row,
  .sf-range__empty {
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
  }
  .sf-range__who,
  .sf-range__drawer-tab,
  .sf-range__drawer-close,
  .sf-range__verbs .sf-btn {
    border-color: CanvasText;
    color: CanvasText;
  }
}
/* Keep map backdrops full-bleed while clamping the reading columns on ultrawide. */
#screens #sf-galaxymap .gm-head,
#screens #sf-galaxymap .gm-body-container {
  width: min(100%, var(--sf-stage-max));
  margin-inline: auto;
}

/* 12b ─ THE FOOTPRINT (F3) : the consequence board on the frontend kit -------------------------
   design/frontend/direction/tasks/TASK_C_STATION_INSTRUMENTS_CHART.md §1.10. The screen root is a
   `.k-screen` (styles/kit.css); these rules are layout only and spend nothing but kit tokens: the
   board is hairlines on the sky, the nodes are kit words, the traced node is the signal colour.
   Nothing here paints, borders, rounds, shadows or animates. */
.fp-stage { display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); row-gap: var(--k-gap); min-height: 0; }
.fp-statehost { min-height: 0; align-self: start; }
.fp-board { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.fp-head, .fp-chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--k-gap); }
.fp-head { padding-bottom: calc(8px * var(--k-s)); border-bottom: 1px solid var(--k-hair); }
.fp-col-head { display: flex; flex-direction: column; gap: calc(4px * var(--k-s)); min-width: 0; }
.fp-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.fp-edge { fill: none; stroke: var(--k-hair); stroke-width: 1; }
.fp-edge--stub { stroke-dasharray: 4 4; }
.fp-edge--spillover { stroke-dasharray: 6 4; }
.fp-edge-arrow { fill: var(--k-bone-38); }
.fp-nodes { position: relative; min-height: 0; padding-top: calc(16px * var(--k-s)); overflow: hidden auto; scrollbar-width: thin; scrollbar-color: var(--k-hair) transparent; }
.fp-cell { display: flex; flex-direction: column; align-items: flex-start; gap: calc(12px * var(--k-s)); min-width: 0; }
/* A node is a kit word (.k-word.k-word--body) that may wrap to its column. Strength is a colour
   token — live 100 %, spent 38 %, the traced node the signal — never opacity. The `.k-screen`
   scope outranks the kit's own .k-word colour, which is declared in a later sheet. */
.k-screen .fp-node { white-space: normal; text-align: left; max-width: 100%; line-height: 1.4; }
.k-screen .fp-node--live { color: var(--k-text-live); }
.k-screen .fp-node--spent { color: var(--k-bone-38); }
.k-screen .fp-node--latch, .k-screen .fp-node--latch:hover, .k-screen .fp-node--latch:focus-visible { color: var(--k-signal); }
/* The record (the old drawer) is the stage's lower half: caps, sentences and hairline rows. */
.fp-drawer { display: flex; flex-direction: column; gap: calc(12px * var(--k-s)); min-height: 0; overflow: hidden auto; scrollbar-width: thin; scrollbar-color: var(--k-hair) transparent; }
@media (forced-colors: active) {
  .fp-edge { stroke: CanvasText; }
  .fp-edge-arrow { fill: CanvasText; }
}

/* 13 ─ sf-state : the four required data states (J3; uiPrimitives.dataState) --------------------
   EMPTY / LOADING / ERROR / DENIED. Each names what would fill it and carries a verb — a
   correct-but-blank pane reads as broken (grammar §12 item 9). Supersedes .sf-empty.

   Colour: grammar §4 roles only; `--accent` is roleless and banned here. At rest the block is
   calm+paper (the 80% rule) and spends exactly ONE hot colour on the rail + glyph. Meaning never
   lives in colour alone — the state word and the glyph silhouette are the second and third
   channels, both of which survive forced-colors.

   Naming: no `panel|card|menu|modal` substring (forced-colors strips background-image/box-shadow
   from those) and no `pulse|blink|flash` (sf-reduce-flash blanket-kills [class*=…] animation). */
.sf-state {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap;
  padding: clamp(16px, 3.4vh, 30px) clamp(16px, 2.6vw, 30px);
  min-width: 0; width: 100%; max-width: min(62ch, 640px); margin-inline: auto; margin-block: auto;
  font-size: 14px;                 /* anchors the ch measure; it otherwise resolves against whatever
                                      the host inherits (12px inside the Chart's inspector) */
  container-type: inline-size;     /* so type sizes to the PANE, not the monitor */
  color: var(--sf-paper);
  border-inline-start: var(--sf-rail-w) solid var(--sf-calm);
}
.sf-state--error, .sf-state--denied { border-inline-start-color: var(--sf-foe); }
.sf-state--empty { border-inline-start-style: dashed; }
.sf-state--denied { border-inline-start-width: calc(var(--sf-rail-w) * 2); }
.sf-state--compact { padding: 12px 14px; gap: 10px; }

.sf-state__glyph { flex: none; width: 30px; height: 30px; color: var(--sf-calm); }
.sf-state--error .sf-state__glyph, .sf-state--denied .sf-state__glyph { color: var(--sf-foe); }
.sf-state__glyph svg { width: 100%; height: 100%; display: block; }

.sf-state__body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; flex: 1 1 22ch; }

/* The state word is the non-colour channel. 12px floor, per the ship polish pass. */
.sf-state__word {
  font-family: var(--sf-subhead-face); font-weight: 600; font-size: 12px;
  letter-spacing: var(--sf-track-micro); text-transform: uppercase; color: var(--sf-calm);
}
.sf-state--error .sf-state__word, .sf-state--denied .sf-state__word { color: var(--sf-foe); }

/* Headline is the pane's DISPLAY element while the state is up. No fixed width, +40% safe. */
.sf-state__head {
  margin: 0; font-family: var(--sf-display-face); font-weight: 700;
  font-size: clamp(19px, 7cqi, 28px); line-height: 1.12; color: var(--sf-paper);
  overflow-wrap: break-word; text-wrap: balance;
}
.sf-state--compact .sf-state__head { font-size: clamp(15px, 1.5vw, 19px); }
.sf-state__fills, .sf-state__detail {
  margin: 0; font-size: 14px; line-height: 1.45; color: var(--sf-calm); overflow-wrap: break-word;
}
.sf-state__detail { font-size: 13px; opacity: .85; }

/* The verb carries --sf-goal: it is the way out, which is exactly "what you're heading for". */
.sf-state__verb {
  margin-top: 4px; display: inline-flex; align-items: center; gap: 8px;
  font: 600 15px/1.2 var(--sf-subhead-face); letter-spacing: .01em; text-transform: none;
  color: var(--sf-goal); background: transparent;
  border: 1px solid color-mix(in srgb, var(--sf-goal) 70%, transparent);
  border-radius: var(--r-sm, 5px); padding: 7px 14px; cursor: pointer; box-shadow: none;
  transition: border-color var(--sf-t-latch) var(--sf-ease), color var(--sf-t-latch) var(--sf-ease);
}
.sf-state__verb:hover { border-color: var(--sf-goal); }
.sf-state__verb:focus-visible { outline: 2px solid var(--sf-goal); outline-offset: 2px; }
.sf-state__verb:active { transform: none; }   /* ui.css `button:active{transform}` clobbers centering */
/* The failure pane's second control, "Copy details" (runtimeFailurePresenter.js): it sits beside the way out
   and stays quiet (calm, not goal) so Retry remains the one lit verb. The status line answers the click in
   words; the report box appears only when the clipboard refused, so the text can still be selected. */
.sf-state__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.sf-state__actions .sf-state__verb { margin-top: 0; }
.sf-state__verb--quiet { color: var(--sf-calm); border-color: var(--sf-edge); }
.sf-state__verb--quiet:hover { color: var(--sf-paper); border-color: var(--sf-calm); }
.sf-state__copy-status { margin: 0; font-size: 13px; line-height: 1.45; color: var(--sf-calm); overflow-wrap: break-word; }
.sf-state__copy-status:empty { display: none; }
.sf-state__report {
  box-sizing: border-box; width: 100%; max-height: 38vh; margin: 0; padding: 8px 10px; resize: vertical; overflow: auto;
  font: 400 12px/1.45 var(--sf-data-face); color: var(--sf-paper); white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
  background: color-mix(in srgb, var(--sf-calm) 10%, transparent);
  border: 1px solid var(--sf-edge); border-radius: var(--r-sm, 5px);
}
.sf-state__report[hidden] { display: none; }
.sf-state__report:focus-visible { outline: 2px solid var(--sf-goal); outline-offset: 2px; }
/* The failure pane is a centered flex item of #boot-overlay (overflow hidden): once the report box opens it
   can be taller than a short screen, and a centered item clips at BOTH ends. Cap it and let it scroll. */
#boot-overlay > .sf-state { max-height: 100%; min-height: 0; overflow-y: auto; box-sizing: border-box; }
/* Keycap. 12px floor applies here too — this was 11px in a `font:` shorthand, which the check's
   `font-size:` scan could not see. nowrap is allowed on a keycap (grammar §12 item 11). */
.sf-state__key {
  font: 600 12px/1 var(--sf-data-face); letter-spacing: .06em; white-space: nowrap;
  padding: 3px 5px; border: 1px solid var(--sf-edge); border-radius: var(--r-sm, 5px); color: var(--sf-calm);
}

/* LOADING skeleton — echoes the REAL layout so the pane's shape reads before its content does.

   IT DOES NOT SHIMMER, and that is the design, not an omission. Grammar §5: "no motion ships
   without a named state variable behind it," and a spinner that outlives its work is a lie.
   dataState's callers supply no progress signal, so a perpetual sweep would encode nothing — it
   would be decoration, and it is exactly the compositor-side `infinite` keyframe that
   check:ui-frame-sleep cannot see because it inspects rAF. The state is carried honestly by the
   BUS_OFFLINE word, the arc glyph, `aria-busy`, and the skeleton's shape.

   If a caller ever supplies real progress, the bar's WIDTH becomes the encoding and earns a
   `--sf-t-spool` motion token. Until then the correct implementation is the subtraction. */
.sf-state__skel { flex: 1 0 100%; display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.sf-state__bar {
  width: 72%; height: 12px; border-radius: var(--r-sm, 5px);
  background: color-mix(in srgb, var(--sf-calm) 14%, transparent);
}
.sf-state__bar:nth-child(2) { width: 92%; }
.sf-state__bar:nth-child(3) { width: 54%; }

@media (prefers-reduced-motion: reduce) {
  .sf-state__verb { transition: none; }
}
/* forced-colors: gradients/shadows are stripped, so the sweep and the tinted bars vanish. Give the
   skeleton a real border so LOADING stays legible rather than blank (grammar §11). */
@media (forced-colors: active) {
  .sf-state { border-inline-start-color: CanvasText; }   /* colour only — keep the per-state style/width */
  .sf-state__bar { border: 1px solid CanvasText; background: none; }
  .sf-state__verb { border: 1px solid ButtonText; color: ButtonText; }
  .sf-state__report { border: 1px solid CanvasText; color: CanvasText; background: Canvas; }
}

/* 14 ─ entity links + the entity DRAWER (J5; entityLinks.js) ------------------------------------
   Every noun is a door: [data-entity="type:id"] anywhere under #screens opens that entity's
   dossier in a tier-3 drawer. Progressive disclosure stops here — a drawer REPLACES its content
   and never stacks a second surface (grammar §7).

   POSITIONING, and why it is absolute rather than fixed: `.screen` carries transform:translateY(0)
   for its enter/exit transition, and any transform other than `none` makes that element the
   containing block for position:fixed descendants. #screens flex-centres its children, so a screen
   root can be content-sized — a "fixed" drawer would anchor to that small box, not the viewport.
   The layer therefore stretches its host while open (.sf-drawerhost) and the class comes off on
   close, so no screen is left relaid-out. */
.screen.sf-drawerhost { position: absolute; inset: 0; width: 100%; height: 100%; }
.sf-drawerlayer { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.sf-drawerlayer > .sf-drawer { pointer-events: auto; }   /* position now correct at source (§11) */

/* An entity link reads as a link by UNDERLINE, not by colour alone — forced-colors and colour-blind
   modes both need the second channel (grammar §4). */
.sf-entity-link {
  font: inherit; color: var(--sf-paper); background: none; border: 0; padding: 0;
  /* The underline is the LAMP, not green (2026-09-22, ONE_PHOTOGRAPH.md section 4.8: a hue leak).
     A name you can open is a thing you can act on, and amber is the one colour for that. It was
     --sf-you at 55%, which put a green bar under every station name and commodity title. Its
     weight follows the type (a hairline on body text, a 3px rule under an 80px title) so a title
     link never reads as a thick coloured border. */
  text-decoration: underline; text-decoration-color: rgb(242 185 80 / .5);
  text-decoration-thickness: max(1px, .045em);
  text-underline-offset: max(3px, .12em); cursor: pointer; text-transform: none; letter-spacing: normal;
  box-shadow: none; text-align: left; min-width: 0; overflow-wrap: break-word;
}
.sf-entity-link:hover { color: var(--dp-ink, #e8e2d4); text-decoration-color: var(--dp-lamp-hot, #ffd98c); }
/* Focus is the rule thickening and warming (plus a field behind the words), never a hard rectangle. */
.sf-entity-link:focus-visible { outline: none !important; color: var(--dp-ink, #e8e2d4); text-decoration-color: var(--dp-lamp-hot, #ffd98c); text-decoration-thickness: max(2px, .08em); background: var(--dp-field-ink, rgb(232 226 212 / .08)); }
.sf-entity-link:active { transform: none; }
.sf-drawer__links { display: flex; flex-direction: column; min-width: 0; }
/* A link row is a ladder rung: hairline dividers that fade out, one lamp tick on the leading edge when the
   rung is the one in hand, the name sliding a few px toward the tick. */
.sf-entity-link--row {
  position: relative; padding: 11px 2px 11px 0; width: 100%; font-size: 17px;
  text-decoration-color: transparent;   /* the row IS the affordance; underline returns on hover/focus */
  background: linear-gradient(90deg, var(--dp-rule, rgb(232 226 212 / .1)), transparent 90%) bottom / 100% 1px no-repeat;
  transition: padding-left 200ms var(--dp-ease-settle, ease), color 120ms var(--dp-ease-settle, ease);
}
.sf-entity-link--row::before { content: ""; position: absolute; left: 0; top: 24%; bottom: 24%; width: 2px; background: var(--dp-lamp, #f2b950);
  transform: scaleY(0); transition: transform 220ms var(--dp-ease-snap, ease); }
.sf-entity-link--row:last-child { background-image: none; }
.sf-entity-link--row:hover, .sf-entity-link--row:focus-visible { padding-left: 14px; text-decoration-color: transparent; background-color: transparent; }
.sf-entity-link--row:focus-visible { background: linear-gradient(90deg, var(--dp-field-ink-hi, rgb(232 226 212 / .14)), transparent 90%); }
.sf-entity-link--row:hover::before, .sf-entity-link--row:focus-visible::before { transform: scaleY(1); }
@media (prefers-reduced-motion: reduce) { .sf-entity-link--row, .sf-entity-link--row::before { transition: none; } }
html.sf-reduce-motion .sf-entity-link--row, html.sf-reduce-motion .sf-entity-link--row::before { transition: none; }

.sf-drawer--entity { --sf-entity-accent: var(--sf-calm); }
/* The dossier is a full-height sheet of glass: its leading edge dissolves (mask), its content sits in
   the fully opaque 88 px+ of the sheet, and its head, facts, record, graph and apron arrive in order. */
.sf-drawerlayer > .sf-drawer--entity { top: 0; bottom: 0; height: auto; max-height: none; width: min(600px, 48vw);
  -webkit-backdrop-filter: blur(20px) saturate(1.12); backdrop-filter: blur(20px) saturate(1.12);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 72px); mask-image: linear-gradient(90deg, transparent 0, #000 72px); }
.sf-drawer--entity .sf-drawer__deck { gap: 24px; padding: 40px 36px 32px 88px; }
.sf-drawer--entity .sf-drawer__deck > * { animation: sf-pop-rise 420ms var(--sf-pop-settle, cubic-bezier(.16, 1, .3, 1)) backwards; }
.sf-drawer--entity .sf-drawer__deck > :nth-child(1) { animation-delay: 90ms; }
.sf-drawer--entity .sf-drawer__deck > :nth-child(2) { animation-delay: 140ms; }
.sf-drawer--entity .sf-drawer__deck > :nth-child(3) { animation-delay: 190ms; }
.sf-drawer--entity .sf-drawer__deck > :nth-child(4) { animation-delay: 230ms; }
.sf-drawer--entity .sf-drawer__deck > :nth-child(n+5) { animation-delay: 270ms; }
/* The deck scrolls; its sections keep their own height. Shrunk to fit, a long record let each label
   print over the value under it (FLEET DOCTRINE over the controls line, PLACES over the next row). */
.sf-drawer--entity .sf-drawer__deck > * { flex-shrink: 0; }
/* With the sections at full height a long record scrolls, so the verbs ride the foot of the sheet
   (sticky, on the sheet's own glass) instead of scrolling out of reach. Short screens close the gaps. */
.sf-drawer--entity .sf-drawer__deck { padding-bottom: 0; }
/* The first fact row's own hairline already closes the crest; two rules 24px apart read as a stray line. */
.sf-drawer--entity .sf-drawer__crest:has(+ .sf-drawer__facts)::after { content: none; }
.sf-drawer--entity .sf-drawer__apron { position: sticky; bottom: 0; z-index: 1; padding-bottom: 28px; background: rgb(9 11 15); box-shadow: 0 -20px 18px -8px rgb(9 11 15); }
@media (max-height: 760px) {
  .sf-drawer--entity .sf-drawer__deck { gap: 18px; padding-top: 30px; }
  .sf-drawer--entity .sf-drawer__crest { padding-bottom: 16px; }
  .sf-drawer--entity .sf-drawer__apron { padding-top: 18px; padding-bottom: 20px; }
}
/* Phone: 48vw left a ~60px text column (one letter a line). The sheet takes the whole width and is
   opaque from its edge, with the deck's side padding cut to the phone gutters. */
@media (max-width: 640px) {
  .sf-drawerlayer > .sf-drawer--entity { width: 100%; background: rgb(10 12 17 / .96); -webkit-mask-image: none; mask-image: none; }
  .sf-drawer--entity .sf-drawer__deck { gap: 20px; padding: 56px 20px 0; }
  .sf-drawer--entity .sf-drawer__apron { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .sf-drawer--entity .sf-drawer__x { top: 12px; right: 12px; width: 44px; height: 44px; }
}
/* The graph is the drawer's STAGE. A CREST and an APRON with nothing between them is what read as
   an unfinished sidebar; grouped, full-width link rows are the centerpiece (grammar §6). */
.sf-drawer__stage { display: flex; flex-direction: column; gap: 20px; min-height: 0; }
.sf-drawer__x {
  position: absolute; top: 22px; right: 24px; z-index: 1;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--dp-ink-mute, #b0aea6); background: none; border: 0; border-radius: 0;
  cursor: pointer; padding: 0; box-shadow: none; outline: none !important;
  transition: color 120ms var(--dp-ease-settle, ease), background 120ms var(--dp-ease-settle, ease);
}
.sf-drawer__x:hover, .sf-drawer__x:focus-visible { color: var(--dp-ink, #e8e2d4); background: var(--dp-field-ink, rgb(232 226 212 / .08)); box-shadow: none; translate: none; }
.sf-drawer__x:active { transform: none; }
.sf-drawer__x svg { width: 15px; height: 15px; }

.sf-drawer__crest { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 0 44px 22px 0; border: 0; }
.sf-drawer__crest::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--dp-rule-hi, rgb(232 226 212 / .22)), transparent); }
.sf-drawer__kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--dp-face-etch, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 650, "wdth" 112;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--dp-ink-mute, #b0aea6);
}
.sf-drawer__kicker::before { content: ""; flex: none; width: 16px; height: 16px; background: var(--dp-lamp, #f2b950);
  -webkit-mask: var(--sf-pop-emblem) center / contain no-repeat; mask: var(--sf-pop-emblem) center / contain no-repeat; }
.sf-drawer__title {
  margin: 0; font-family: var(--dp-face-display, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 780, "wdth" 116;
  font-size: clamp(30px, 2.9vw, 46px); letter-spacing: -.015em; line-height: 1.02; color: var(--dp-ink, #e8e2d4);
  overflow-wrap: break-word; text-wrap: balance;
}

.sf-drawer__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16ch), 1fr)); gap: 20px 32px; }
.sf-drawer__facts .sf-tile {
  flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; padding: 14px 0 0; border: 0; border-radius: 0;
  background: linear-gradient(90deg, var(--dp-rule-hi, rgb(232 226 212 / .22)), transparent 85%) top / 100% 1px no-repeat;
}
.sf-tile__k { font-family: var(--dp-face-etch, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 650, "wdth" 108;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dp-ink-mute, #b0aea6); }
.sf-tile__v { font-family: var(--dp-face-read, "Instrument Sans", system-ui, sans-serif); font-size: 18px; font-weight: 500; line-height: 1.25; color: var(--dp-ink, #e8e2d4); overflow-wrap: break-word; }
.sf-tile--data .sf-tile__v {
  font-family: var(--dp-face-numeral, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 300, "wdth" 100; font-size: 26px; font-variant-numeric: tabular-nums;
  letter-spacing: -.005em; line-height: 1.1;
}
.sf-tile--you .sf-tile__v { color: var(--sf-you); }
.sf-tile--foe .sf-tile__v { color: var(--sf-foe); }
.sf-tile--goal .sf-tile__v { color: var(--dp-lamp-hot, #ffd98c); }

/* Tier-2 engineering readings: one quiet disclosure under the decision facts. */
.sf-drawer__details { display: grid; gap: 0; }
.sf-drawer__details-summary {
  display: inline-flex; align-items: center; gap: 9px; width: fit-content; min-height: 32px;
  font-family: var(--dp-face-etch, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 650, "wdth" 108;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dp-ink-mute, #b0aea6);
  cursor: pointer; list-style: none;
}
.sf-drawer__details-summary::-webkit-details-marker { display: none; }
.sf-drawer__details-summary::after {
  content: ""; flex: none; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: rotate(45deg); transition: transform 140ms var(--dp-ease-settle, ease);
}
.sf-drawer__details-summary:hover,
.sf-drawer__details-summary:focus-visible { color: var(--dp-lamp-hot, #ffd98c); }
.sf-drawer__details[open] .sf-drawer__details-summary { color: var(--dp-ink, #e8e2d4); }
.sf-drawer__details[open] .sf-drawer__details-summary::after { transform: rotate(225deg); margin-top: 3px; }
.sf-drawer__details .sf-drawer__facts { margin-top: 12px; }

.sf-drawer--entity .sf-deck { gap: 8px; }
.sf-drawer--entity .sf-deck__label { font-family: var(--dp-face-etch, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 650, "wdth" 108;
  font-size: 12px; letter-spacing: .16em; color: var(--dp-ink-mute, #b0aea6); }
.sf-drawer__prose { margin: 0; max-width: 52ch; font-family: var(--dp-face-read, "Instrument Sans", system-ui, sans-serif); font-size: 16px; line-height: 1.55; color: var(--dp-ink-dim, #b7b4a6); overflow-wrap: break-word; text-wrap: pretty; }
.sf-drawer__prose--foe { color: var(--dp-danger-hot, #ff8a70); }

.sf-drawer__apron { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: auto; padding-top: 24px; border: 0; }
.sf-drawer__apron::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, var(--dp-rule-hi, rgb(232 226 212 / .22)), transparent); }
/* Verbs: the first (the route) is the one lamp-lit key; the rest are quiet keys with a hairline.
   Rounded fields (card pass, shadcn drift), matching the confirm dialog's keys. */
.sf-drawer__verb {
  position: relative; display: inline-flex; align-items: center; min-height: 42px; padding: 0 20px; border: 0; border-radius: 8px; cursor: pointer; box-shadow: none; outline: none !important;
  font-family: var(--dp-face-etch, "Archivo", "Instrument Sans", system-ui, sans-serif); font-variation-settings: "wght" 700, "wdth" 96;
  font-size: 13px; letter-spacing: .13em; text-transform: uppercase; line-height: 1;
  color: var(--dp-metal-0, #10131a);
  background: var(--dp-lamp, #f2b950);
  transition: color 140ms var(--dp-ease-settle, ease), background 140ms var(--dp-ease-settle, ease), box-shadow 200ms var(--dp-ease-settle, ease);
}
.sf-drawer__verb:hover, .sf-drawer__verb:focus-visible { background: var(--dp-lamp-hot, #ffd98c); box-shadow: 0 0 22px var(--dp-lamp-bloom, rgb(242 185 80 / .35)); translate: none; }
.sf-drawer__verb::after { --sf-bk: var(--dp-lamp-hot, #ffd98c); }
.sf-drawer__verb--quiet { color: var(--dp-ink, #e8e2d4); background: var(--dp-field-ink, rgb(232 226 212 / .08));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dp-ink, rgb(232 226 212)) 14%, transparent); }
.sf-drawer__verb--quiet:hover, .sf-drawer__verb--quiet:focus-visible { color: var(--dp-lamp-hot, #ffd98c); background: var(--dp-field-ink-hi, rgb(232 226 212 / .14));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dp-ink, rgb(232 226 212)) 22%, transparent); }
.sf-drawer__verb--quiet::after { --sf-bk: var(--dp-ink, #e8e2d4); }
/* Focus: one rounded ring that follows the key, in place of the shared eight-tick bracket. */
button.sf-drawer__verb::after { inset: -4px; border-radius: 11px; background: none; box-shadow: 0 0 0 1.5px var(--sf-bk); }
.sf-drawer__verb:active { transform: translateY(1px); }

@media (prefers-reduced-motion: reduce) {
  .sf-drawer__verb, .sf-drawer__x { transition: none; }
  .sf-drawer__details-summary::after { transition: none; }
  .sf-drawer--entity .sf-drawer__deck > * { animation: none; }
}
html.sf-reduce-motion .sf-drawer__verb, html.sf-reduce-motion .sf-drawer__x { transition: none; }
html.sf-reduce-motion .sf-drawer__details-summary::after { transition: none; }
html.sf-reduce-motion .sf-drawer--entity .sf-drawer__deck > * { animation: none; }
@media (forced-colors: active) {
  .sf-drawerlayer > .sf-drawer { background: Canvas; -webkit-mask-image: none; mask-image: none; border-inline-start: 1px solid CanvasText; }
  .sf-entity-link { color: LinkText; text-decoration-color: LinkText; }
  .sf-drawer__verb, .sf-drawer__x { background: Canvas; color: ButtonText; border: 1px solid ButtonText; }
  .sf-drawer__verb:focus-visible, .sf-drawer__x:focus-visible { outline: 2px solid Highlight !important; }
  .sf-drawer__details-summary { color: ButtonText; }
  .sf-drawer__details-summary:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
  .sf-drawer__facts .sf-tile { border: 1px solid CanvasText; }
}

/* Dock refusal: a compact dataState card, vacuum vignette, pointer-events for the verb. G16-02 —
   shown through the Stage's banner slot (the shared .dp-glass frame owns placement); the #hud
   seat below only remains for hosts with no live Stage. */
.sf-dock-deny {
  width: min(52ch, 90vw); pointer-events: auto;
}
#hud > .sf-dock-deny {
  position: absolute; top: 14%; left: 50%; transform: translateX(-50%);
  z-index: 41;
}
.sf-dock-deny .sf-state {
  margin: 0; max-width: none;
  background: radial-gradient(70% 80% at 50% 50%, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 55%, transparent) 70%, transparent);
}

/* Comms tape frequency trace (audio-state driven; parked when no transmission is live). */
.sf-fx-comms-trace {
  --sf-comms-amp: 0;
  --sf-comms-density: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 128px;
  padding: 1px 0 1px 6px;
  border-inline-start: 1px solid color-mix(in srgb, var(--sf-calm) 42%, transparent);
  color: var(--sf-you);
  opacity: calc(.45 + var(--sf-comms-amp) * .55);
}
.sf-fx-comms-trace[hidden] { display: none !important; }
.sf-fx-comms-trace__crest {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--sf-you) 88%, var(--sf-paper));
}
.sf-fx-comms-trace__wave {
  min-width: 102px;
  display: inline-flex;
  font-family: var(--sf-data-face);
  font-size: 12px;
  letter-spacing: .06em;
  line-height: 1;
  color: var(--sf-you);
  opacity: calc(.52 + var(--sf-comms-density) * .38);
  text-shadow: 0 0 8px color-mix(in srgb, var(--sf-you) 45%, transparent);
}
.sf-fx-comms-trace__wave .sf-fx-morph { min-width: 102px; }

/* ------------------------------------------------------------------------- *
 * ORRERY Wave 2 — Replay (src/ui/screens/replay.js). The instrument is the  *
 * TAPE: a 30s tracing-beam timeline. Migrated screens own no CSS, so the    *
 * view's placement lives here, scoped to .orr-replay; material (words, Lamp *
 * Key, bands) comes from Deckplate and the orrery library at runtime.       *
 * ------------------------------------------------------------------------- */
.orr-replay { position:absolute; inset:0; overflow:hidden; }
.orr-replay__veil-top { position:absolute; inset:0 0 auto 0; height:36%; pointer-events:none;
  background:linear-gradient(rgb(5 7 10 / .74), rgb(5 7 10 / .30) 55%, transparent); }
.orr-replay__veil-foot { position:absolute; inset:auto 0 0 0; height:54%; pointer-events:none;
  background:linear-gradient(transparent, rgb(5 7 10 / .55) 34%, rgb(5 7 10 / .86)); }
.orr-replay__exit { position:absolute; top:20px; left:26px; z-index:3; }
.orr-replay__read { position:absolute; top:14px; right:30px; z-index:3; text-align:right; }
.orr-replay__count { font-family:var(--dp-face-numeral, "Archivo"); font-stretch:100%; font-weight:250;
  font-size:clamp(52px, 7.2vw, 96px); line-height:1; letter-spacing:-.02em;
  color:rgb(236 230 216); font-variant-numeric:tabular-nums; white-space:nowrap;
  text-shadow:0 2px 18px rgb(0 0 0 / .55); }
.orr-replay__count .orr-replay__total { font-size:.42em; font-weight:280; color:rgb(236 230 216 / .72); }
.orr-replay__count .orr-replay__sep { font-size:.42em; font-weight:280; color:rgb(236 230 216 / .45); margin:0 .35em; }
.orr-replay__codes { font-family:var(--dp-face-code, "Spline Sans Mono"); font-size:12px;
  letter-spacing:.08em; color:rgb(236 230 216 / .68); margin-top:10px; white-space:nowrap; }
.orr-replay__tape { position:absolute; left:6%; right:6%; bottom:96px; height:172px; z-index:2; }
.orr-replay__tape:focus-visible { outline:1px solid rgb(255 217 140 / .9); outline-offset:6px; }
.orr-replay__tape svg.orr-svg { position:absolute; inset:0; width:100%; height:100%; }
.orr-replay__readout { position:absolute; top:0; left:2px; right:2px; margin:0;
  font-family:var(--dp-face-label, "Archivo"); font-stretch:112%; font-weight:600; font-size:12px;
  letter-spacing:.12em; text-transform:uppercase; line-height:1.4; color:rgb(236 230 216 / .78);
  text-shadow:0 1px 8px rgb(0 0 0 / .8); white-space:normal; text-wrap:balance; max-width:96ch; }
.orr-replay__ev { position:absolute; margin:0; transform:translateX(-50%); white-space:nowrap;
  font-family:var(--dp-face-label, "Archivo"); font-stretch:112%; font-weight:600; font-size:12px;
  letter-spacing:.1em; text-transform:uppercase; color:rgb(236 230 216 / .88);
  text-shadow:0 1px 8px rgb(0 0 0 / .9); pointer-events:none; }
.orr-replay__sec { position:absolute; margin:0; transform:translateX(-50%); white-space:nowrap;
  font-family:var(--dp-face-numeral, "Archivo"); font-stretch:100%; font-weight:300; font-size:12px;
  font-variant-numeric:tabular-nums; color:rgb(236 230 216 / .6); pointer-events:none; }
.orr-replay__transport { position:absolute; left:0; right:0; bottom:22px; z-index:3;
  display:flex; justify-content:center; align-items:center; gap:clamp(18px, 3vw, 44px); }
html.sf-reduce-motion .orr-replay__pulse { display:none; }
/* ui-polish-380: opaque lamp curtain + fade apron + short densify for empty-tape
 * how-to. Soft ui.css veil alone left "Choose FLY TO RECORD…" readable through the
 * transparent foot top at ≤560 tall (651×461 / 700×461 / 801×461 / 960×500), mashing
 * the legend against the FLY TO RECORD lamp. Mirror Clips #892 spirit in-place (no
 * layouts file): denser foot, transport apron, lift/shrink tape so the readout seats
 * above the curtain. Selectors/IDs unchanged. */
@media (max-height:560px) {
  .orr-replay__veil-foot {
    background:
      linear-gradient(transparent, rgb(5 7 10 / .62) 22%, rgb(5 7 10 / .94) 55%, rgb(5 7 10 / .98));
  }
  .orr-replay__transport {
    z-index:4; isolation:isolate;
  }
  .orr-replay__transport::before {
    content:""; position:absolute; left:0; right:0; bottom:100%; height:40px;
    pointer-events:none; z-index:0;
    background:linear-gradient(180deg, rgb(5 7 10 / 0), rgb(5 7 10 / .88) 55%, rgb(5 7 10 / .98));
  }
  .orr-replay__transport > * { position:relative; z-index:1; }
  /* ui-polish-425: the SVG draws a fixed 172-unit-tall tape, so squeezing the host to 100px
   * scaled the track down ~0.58 and centred it (240–720 of 960 at 960×540) while the HTML
   * second marks kept the full width and sank under the curtain. Keep the authored 172px;
   * the lift clears the readout off the lamp. The lift ramps with the frame height (84px at
   * <=420 tall up to 124px at >=460) so the tape never jumps when the window shrinks by a pixel;
   * below 420 the readout top tracks the height and the second marks keep 5px over the apron. */
  .orr-replay__tape { bottom:clamp(84px, calc(100vh - 336px), 124px); height:172px; }
  .orr-replay__readout {
    padding:6px 4px;
    background:linear-gradient(90deg, rgb(5 7 10 / 0), rgb(5 7 10 / .92) 12%, rgb(5 7 10 / .92) 88%, rgb(5 7 10 / 0));
  }
}
/* ui-polish-425 (#997): under 420 tall the host used to squeeze to min(100px, 24vh), which put
 * the same mismatch back (track scaled ~0.5 and centred, second marks full width under the
 * curtain). The tape keeps its authored 172px at every height; see the ramp above. Under ~330
 * tall (700x320) the readout's first line sat tight under the EXIT plate, so the lamp and the
 * tape ease down together by up to 8px (lamp 22->14px off the bottom, tape 84->76px), keeping
 * the marks' 5px over the apron; both ramps meet the rule above with no step. */
@media (min-width:561px) and (max-height:420px) {
  .orr-replay__transport { bottom:clamp(14px, calc(100vh - 306px), 22px); }
  .orr-replay__tape { bottom:clamp(76px, calc(100vh - 244px), 84px); }
}
/* Phone: same curtain so wrapped how-to cannot paint through the lamp apron. */
@media (max-width:560px) {
  .orr-replay__veil-foot {
    background:
      linear-gradient(transparent, rgb(5 7 10 / .55) 28%, rgb(5 7 10 / .92) 62%, rgb(5 7 10 / .98));
  }
  .orr-replay__transport { z-index:4; isolation:isolate; }
  .orr-replay__transport::before {
    content:""; position:absolute; left:0; right:0; bottom:100%; height:48px;
    pointer-events:none; z-index:0;
    background:linear-gradient(180deg, rgb(5 7 10 / 0), rgb(5 7 10 / .88) 55%, rgb(5 7 10 / .98));
  }
  .orr-replay__transport > * { position:relative; z-index:1; }
}
/* Phone short frames (560x419/400/360): the 48px phone apron ran 3px over the second marks
 * that sit on the shared ramp above, so on short phones the apron keeps the 40px desktop height
 * (marks 5px clear). Under 420 tall the legend, which grows upward from the hand, also met the
 * SEED · NO TAPE line (560x360); the count (52->42px) and its code line (10->4px) ease down
 * between 430 and 420 tall so the legend clears it without a step. */
@media (max-width:560px) and (max-height:560px) {
  .orr-replay__transport::before { height:40px; }
  .orr-replay__count { font-size:clamp(42px, calc(100vh - 378px), 52px); }
  .orr-replay__codes { margin-top:clamp(4px, calc(100vh - 416px), 10px); }
}
/* Phone widths: the legend wraps to 4-5 lines, taller than the 64px above the
 * playhead, so it grows upward from just above the hand instead of down into it. */
@media (max-width:560px) {
  .orr-replay__readout { top:auto; bottom:calc(100% - 52px); }
}
/* Very short narrow frames (<=355 tall, 568x320 / 480x320 / 420x320): the eased tape puts the
 * legend level with the top-right count and its SEED · NO TAPE line. Up to 700 wide the legend
 * ends left of that column (right inset = the column's ~170px less the tape's 6vw margin); on
 * phones it hangs from just under the code line (y90) instead of growing up into it. Either way
 * it then reaches down beside the playhead, so it starts 24px (phones 16px) in, clear of the Hand. */
@media (min-width:561px) and (max-width:700px) and (max-height:355px) {
  .orr-replay__readout { left:24px; right:calc(170px - 6vw); }
}
@media (max-width:560px) and (max-height:355px) {
  .orr-replay__readout { top:max(0px, calc(346px - 100vh)); bottom:auto; left:16px; right:0; }
}
/* The 355 cut (was 345) keeps the full-width legend off the SEED line through 346-352 at 561-640 wide.
 * Phones (<420 wide, or under 318 tall) wrapped its last line onto the tape and faded the 0-25 s ticks:
 * narrow ones pack the lines to 15px in the regular width, and under 318 tall the lines and tracking ease
 * the same way while the legend rises up to 6px (still clear of the code line) by 312; under 306 the face
 * also drops to the regular width, so the last wrap comes back off the ticks. */
@media (max-width:419px) and (max-height:355px) {
  .orr-replay__readout { padding:3px 4px; line-height:1.25; letter-spacing:.08em; font-stretch:100%; }
}
/* At <=359 wide the 4-line phone legend still meets the SEED line from 356 through ~363
 * (it clears by 370). Extend the top-hung / tight-face packing through 370 at that width only;
 * 360-419 stay on the 355 cut, where three lines already clear. */
@media (max-width:359px) and (max-height:370px) {
  .orr-replay__readout { top:max(0px, calc(346px - 100vh)); bottom:auto; left:16px; right:0; padding:3px 4px; line-height:1.25; letter-spacing:.08em; font-stretch:100%; }
}
@media (max-width:560px) and (max-height:317px) {
  .orr-replay__readout { top:calc(346px - 100vh - clamp(0px, calc(318px - 100vh), 6px)); }
}
@media (min-width:420px) and (max-width:560px) and (max-height:317px) {
  .orr-replay__readout { line-height:clamp(15px, calc(15vh - 30.75px), 16.8px); letter-spacing:clamp(.84px, calc(5vh - 14.41px), 1.44px); }
}
@media (min-width:420px) and (max-width:560px) and (max-height:306px) {
  .orr-replay__readout { font-stretch:100%; }
}
@media (forced-colors:active) {
  .orr-replay__count, .orr-replay__total, .orr-replay__sep { color:CanvasText; text-shadow:none; }
  .orr-replay__codes, .orr-replay__readout, .orr-replay__ev, .orr-replay__sec {
    color:CanvasText; text-shadow:none; }
}

/* ------------------------------------------------------------------------- *
 * ORRERY Wave 2 — Clips (src/ui/screens/clips.js). The instrument is the    *
 * REEL: rated moments on a curved rail. Placement scoped to .orr-clips /    *
 * .orr-clip; material from Deckplate and the orrery library at runtime.      *
 * ------------------------------------------------------------------------- */
.orr-clips { position:absolute; inset:0; overflow:hidden; }
.orr-clips__veil-top { position:absolute; inset:0 0 auto 0; height:34%; pointer-events:none;
  background:linear-gradient(rgb(5 7 10 / .74), rgb(5 7 10 / .30) 55%, transparent); }
.orr-clips__veil-foot { position:absolute; inset:auto 0 0 0; height:46%; pointer-events:none;
  background:linear-gradient(transparent, rgb(5 7 10 / .55) 34%, rgb(5 7 10 / .86)); }
.orr-clips__exit { position:absolute; top:20px; left:26px; z-index:3; }
/* Replay and Clips: Exit is the only way back besides Esc, so it sits in the same hairline
 * frame and keycap the Records Wall Back key uses instead of floating as a bare word. */
.orr-replay__exit .dp-lit__item, .orr-clips__exit .dp-lit__item {
  display:inline-flex; align-items:center; gap:.65em; padding:.45em .6em .45em .9em;
  border:1px solid rgb(236 230 216 / .22); border-radius:8px; background:rgb(5 7 10 / .52);
  font-size:clamp(15px, 1vw, 19px); letter-spacing:.14em; line-height:1;
  transition:border-color .14s ease, background-color .14s ease; }
.orr-replay__exit .dp-lit__item:hover, .orr-clips__exit .dp-lit__item:hover {
  border-color:rgb(236 230 216 / .44); background:rgb(236 230 216 / .06); }
.orr-replay__exit .dp-lit__item:focus-visible, .orr-clips__exit .dp-lit__item:focus-visible {
  border-color:rgb(255 217 140 / .9); outline:none; }
html.sf-reduce-motion .orr-replay__exit .dp-lit__item, html.sf-reduce-motion .orr-clips__exit .dp-lit__item { transition:none !important; }
.orr-replay__exit .dp-kbd, .orr-clips__exit .dp-kbd {
  font-size:max(12px, .66em); letter-spacing:.08em; padding:.3em .55em; border:1px solid rgb(236 230 216 / .3);
  border-radius:4px; color:rgb(236 230 216 / .72); line-height:1; }
@media (max-width:560px) {
  .orr-replay__exit, .orr-clips__exit { top:16px; left:16px; }
}
@media (forced-colors:active) {
  .orr-replay__exit .dp-lit__item, .orr-clips__exit .dp-lit__item { border-color:ButtonText; background:ButtonFace; }
}
.orr-clips__read { position:absolute; top:14px; right:30px; z-index:3; text-align:right; }
.orr-clips__count { font-family:var(--dp-face-numeral, "Archivo"); font-stretch:100%; font-weight:250;
  font-size:clamp(48px, 6vw, 84px); line-height:1; color:rgb(236 230 216);
  font-variant-numeric:tabular-nums; text-shadow:0 2px 18px rgb(0 0 0 / .55); }
.orr-clips__count-label { font-family:var(--dp-face-label, "Archivo"); font-stretch:112%; font-weight:600;
  font-size:12px; letter-spacing:.16em; text-transform:uppercase; color:rgb(236 230 216 / .66);
  margin-top:6px; }
.orr-clips__runtime { font-family:var(--dp-face-numeral, "Archivo"); font-stretch:100%; font-weight:300;
  font-size:20px; color:rgb(236 230 216 / .9); font-variant-numeric:tabular-nums; margin-top:8px; }
.orr-clips__rail { position:absolute; left:4%; right:4%; top:27%; height:380px; z-index:2; }
.orr-clips__rail > svg.orr-rail-svg { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.orr-clips__plates { position:absolute; inset:0; }
.orr-clip__plate { position:absolute; top:0; left:0; margin:0; padding:0; border:0; background:none;
  transform-origin:50% 0; transition:transform 480ms var(--dp-ease-out, cubic-bezier(.16,1,.3,1)), opacity 320ms linear;
  cursor:pointer; }
/* Focus is the dp-attend bracket (a bone mark at the leading edge), never a box: a rect outline
   round a Tilt Plate reads as a bordered box, which ORRERY forbids absolutely. The !important is
   the same load-bearing answer dp-attend gives: kit.css outranks this sheet on :focus, so only an
   important declaration can replace the ring — and the bracket plus the lit foot replace it. */
.orr-clip__plate:focus-visible { outline:none !important; outline-offset:0 !important; }
.orr-clip__plate:focus-visible::before { content:""; position:absolute; left:-12px; top:6%; bottom:6%;
  width:2px; background:rgb(236 230 216 / .9); }
.orr-clip__plate:focus-visible .orr-clip__foot {
  background:linear-gradient(90deg, rgb(248 244 234 / .95), rgb(248 244 234 / .45)); }
.orr-clip__art { position:relative; width:100%; overflow:hidden;
  -webkit-mask-image:linear-gradient(rgb(0 0 0) 78%, transparent); mask-image:linear-gradient(rgb(0 0 0) 78%, transparent); }
.orr-clip__art canvas, .orr-clip__art svg { display:block; width:100%; height:100%; }
.orr-clip__foot { height:3px; margin-top:6px;
  background:linear-gradient(90deg, rgb(236 230 216 / .75), rgb(236 230 216 / .30)); }
.orr-clip__plate.is-ghost .orr-clip__foot { background:linear-gradient(90deg, rgb(236 230 216 / .4), rgb(236 230 216 / .12)); }
.orr-clip__name { margin:8px 0 0; font-family:var(--dp-face-display, "Archivo"); font-stretch:125%;
  font-weight:800; font-size:19px; letter-spacing:-.01em; line-height:1.05; color:rgb(236 230 216);
  text-shadow:0 1px 10px rgb(0 0 0 / .85); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.orr-clip__plate:not(.is-chosen) .orr-clip__name { color:rgb(236 230 216 / .72); }
.orr-clip__sub { margin:5px 0 0; font-family:var(--dp-face-label, "Archivo"); font-stretch:112%;
  font-weight:600; font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color:rgb(236 230 216 / .62); white-space:nowrap; }
.orr-clip__bounds { margin:5px 0 0; font-family:var(--dp-face-numeral, "Archivo"); font-stretch:100%;
  font-weight:300; font-size:14px; font-variant-numeric:tabular-nums; color:rgb(236 230 216 / .9);
  white-space:nowrap; }
.orr-clip__tickcode { margin:3px 0 0; font-family:var(--dp-face-code, "Spline Sans Mono"); font-size:12px;
  letter-spacing:.06em; color:rgb(236 230 216 / .5); white-space:nowrap; }
.orr-clip__plate:not(.is-chosen) .orr-clip__sub, .orr-clip__plate:not(.is-chosen) .orr-clip__bounds,
.orr-clip__plate:not(.is-chosen) .orr-clip__tickcode, .orr-clip__plate:not(.is-chosen) .orr-clip__beam,
.orr-clip__plate:not(.is-chosen) .orr-clip__gauge { display:none; }
.orr-clip__plate.is-ghost .orr-clip__sub { display:block; white-space:normal; line-height:1.35; }
.orr-clips__runtime-unit { font-family:var(--dp-face-label, "Archivo"); font-stretch:112%; font-weight:600;
  font-size:12px; letter-spacing:.16em; color:rgb(236 230 216 / .66); }
.orr-clip__gauge { position:absolute; top:-6px; right:-6px; width:46px; height:46px; pointer-events:none; }
.orr-clip__beam { position:relative; margin-top:6px; height:30px; }
.orr-clip__beam svg { position:absolute; inset:0; width:100%; height:100%; }
.orr-clip__thumb { position:absolute; top:2px; width:14px; height:26px; margin-left:-7px; cursor:ew-resize;
  touch-action:none; }
.orr-clip__thumb::before { content:""; position:absolute; left:5px; top:0; width:4px; height:100%;
  background:rgb(236 230 216 / .85); box-shadow:0 0 8px rgb(236 230 216 / .35); }
.orr-clip__thumb:focus-visible { outline:1px solid rgb(255 217 140 / .9); outline-offset:2px; }
.orr-clips__readline { position:absolute; left:0; right:0; bottom:92px; z-index:2; text-align:center;
  display:flex; justify-content:center; align-items:baseline; gap:14px; padding:0 6%; }
.orr-clips__pos { font-family:var(--dp-face-code, "Spline Sans Mono"); font-size:12px; letter-spacing:.08em;
  color:rgb(236 230 216 / .6); white-space:nowrap; }
.orr-clips__readout { margin:0; font-family:var(--dp-face-label, "Archivo"); font-stretch:112%;
  font-weight:600; font-size:12px; letter-spacing:.12em; text-transform:uppercase; line-height:1.4;
  color:rgb(236 230 216 / .8); text-shadow:0 1px 8px rgb(0 0 0 / .8);
  min-width:0; max-width:96ch; white-space:normal; text-wrap:balance; }
.orr-clips__actions { position:absolute; left:0; right:0; bottom:22px; z-index:3;
  display:flex; justify-content:center; align-items:center; gap:clamp(18px, 3vw, 40px); }
.orr-clip__dial { display:flex; align-items:flex-end; gap:0; }
.orr-clip__dial-svg { display:block; }
.orr-clip__dial-opt { font-family:var(--dp-face-label, "Archivo"); font-stretch:112%; font-weight:600;
  font-size:12px; letter-spacing:.14em; color:rgb(236 230 216 / .55); cursor:pointer; padding:4px 2px; }
.orr-clip__dial-opt[aria-checked="true"] { color:rgb(236 230 216); }
.orr-clip__dial-opt:focus-visible { outline:1px solid rgb(255 217 140 / .9); outline-offset:2px; }
@media (max-width:640px) {
  .orr-clips__readline { flex-direction:column; align-items:center; gap:6px; }
  .orr-clip__plate.is-ghost .orr-clip__name { font-size:15px; letter-spacing:0; }
  /* ~107px ghosts at 390: tighter tracking and balanced wrap keep each caption to two even lines. */
  .orr-clip__plate.is-ghost .orr-clip__sub { font-size:12px; font-stretch:100%; letter-spacing:.04em; word-spacing:.12em; line-height:1.3; text-wrap:balance; }
}
@media (max-height:640px) and (min-width:641px) {
  .orr-clips__rail { top:20%; }
}
/* Short desktop frame, empty reel: the default bottom:92px legend crossed the rail's arc (it dips
   lower the wider the frame). It drops into the band just above FLY TO MAKE ONE instead, under the
   arc's crown, as at 720p, so the how-to reads with the key it explains. ≤460 tall keeps its own
   bottom placement below. */
@media (min-width:641px) and (min-height:461px) and (max-height:640px) {
  .orr-clips:has(.orr-clip__plate.is-ghost) .orr-clips__readline { bottom:72px; }
  .orr-clips:has(.orr-clip__plate.is-ghost) .orr-clips__readout { max-width:58ch; }
}
@media (max-width:640px) and (min-height:700px) {
  .orr-clips__rail { top:33%; }
}
@media (min-width:641px) and (min-height:900px) {
  .orr-clips__rail { top:calc(27% + 7vh); }
  .orr-clips__readline { bottom:calc(92px + 5vh); }
}
/* Short frame (desktop window or phone landscape): empty-reel ghosts clear the readout.
   Rail lift and readout drop are scoped to the empty reel (ghost plates present): on a populated
   reel the readout at 64px sat under the EXPORT lamp and the verbs, hiding the trim instructions.
   They follow layoutGhosts' own gate (host ≤460 tall, any width): at ≤640 wide (e.g. 640×400) the
   lifted ghosts otherwise sat with their names on the un-dropped readout. */
@media (max-height:460px) {
  .orr-clips:has(.orr-clip__plate.is-ghost) .orr-clips__rail { top:12%; }
  .orr-clips:has(.orr-clip__plate.is-ghost) .orr-clips__readline { bottom:64px; }
}
@media (min-width:641px) and (max-height:460px) {
  .orr-clips__count { font-size:clamp(36px, 5.2vw, 56px); }
  .orr-clips__runtime { font-size:16px; margin-top:4px; }
  /* No clear band for a wrapped legend this short (arc below, plates above): keep one line. */
  .orr-clips__readout { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .orr-clip__plate.is-ghost .orr-clip__name { font-size:15px; }
  .orr-clip__plate.is-ghost .orr-clip__sub { font-size:12px; letter-spacing:.06em; }
}
.orr-clips__pos:empty { display:none; }
html.sf-reduce-motion .orr-clip__plate { transition:none; }
/* polish293: at 1920×1080 Replay and Clips printed the same 12px words and keys as at 960×540,
   the smallest type of any 1080p screen; Settings, Save/Load, Automation and the Crucible pages
   already scale up in this band. The fixed furniture (Exit key, the count, the legend, the
   transport and action keys) zooms with them. The tape and the reel are laid out and dragged by
   JS against their own boxes, so they keep their size and only their labels step up a size. */
@media (min-width:1800px) and (max-width:2199px) and (min-height:1000px) {
  .orr-replay__exit, .orr-replay__read, .orr-replay__transport,
  .orr-clips__exit, .orr-clips__read, .orr-clips__readline, .orr-clips__actions { zoom:1.14; }
  .orr-replay__readout, .orr-replay__ev, .orr-replay__sec { font-size:14px; }
  .orr-clip__name { font-size:22px; }
  .orr-clip__sub, .orr-clip__tickcode, .orr-clip__dial-opt { font-size:14px; }
  .orr-clip__bounds { font-size:16px; }
}
@media (forced-colors:active) {
  .orr-clips__count, .orr-clips__runtime { color:CanvasText; text-shadow:none; }
  .orr-clips__count-label, .orr-clips__pos, .orr-clips__readout, .orr-clip__name,
  .orr-clip__sub, .orr-clip__bounds, .orr-clip__tickcode, .orr-clip__dial-opt { color:CanvasText; text-shadow:none; }
  .orr-clip__foot { background:CanvasText; }
  .orr-clip__thumb::before { background:CanvasText; box-shadow:none; }
}

/* ============================================================================
   G16-02 — every popup through one door (design/program/fleet/drafts/G16-one-glass.md §2).
   The straggler popups retired their injected <style> blocks here. Base rules stay
   unconditional; mount placement/frame props each popup loses are scoped to the legacy
   parents (#hud > …, #ui-root > …) that only ever see the element on a host with no live
   Stage. Inside a Stage frame (.sf-stage__item, the shared .dp-glass) only the content
   rules apply — the frame owns the face and the slot owns the place.
   ========================================================================== */

/* ── Tutorial flight card (hudAttention.js — once per profile, dismisses itself) ─────────── */
.sf-tutorial-flight-card {
  box-sizing: border-box; max-width: min(42rem, 86vw); pointer-events: none;
  text-align: center; line-height: 1.35;
  color: var(--dp-ink, #e8e2d4); text-shadow: var(--dp-text-legible, 0 1px 0 rgb(0 0 0 / .5));
}
/* Legacy #hud seat — only on a host where the Stage never ran. */
#hud > .sf-tutorial-flight-card {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  padding: .45rem .7rem; background: var(--dp-glass-deep, rgb(6 8 12 / .82)); z-index: 30;
}

/* ── Contact hail (contactHailPrompt.js) ─────────────────────────────────────────────────────
   The HAIL button host (#sf-contact-hail) is HUD chrome the comms tape adopts — unchanged.
   The panel is the transient card: shown through the Stage's prompt slot inside the shared
   frame, so only its content rules are unconditional. The face and the anchored seat survive
   solely under the fallback #ui-root mount. */
#sf-contact-hail { position: absolute; left: 85px; top: 20px; z-index: 20;
  font-family: var(--hud-data, var(--mono, Consolas, monospace)); contain: layout style; }
.sf-contact-hail__button { width: 72px; height: 32px; padding: 0 10px; border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--sf-calm) 38%, transparent);
  background: color-mix(in srgb, var(--sf-surface) 90%, transparent); color: var(--sf-calm);
  font: 600 12px var(--sf-subhead-face, "IBM Plex Sans", sans-serif); letter-spacing: .04em; cursor: default;
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease, translate .1s ease; }
.sf-contact-hail--ready .sf-contact-hail__button { color: var(--sf-paper); border-color: var(--sf-goal);
  cursor: pointer; }
.sf-contact-hail--ready .sf-contact-hail__button:hover {
  background: color-mix(in srgb, var(--sf-surface) 80%, var(--sf-goal) 15%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--sf-goal) 22%, transparent); }
.sf-contact-hail--ready .sf-contact-hail__button:active { translate: 0 1px; }
.sf-contact-hail__button:hover:not(:disabled), .sf-contact-hail__button:focus-visible,
.sf-contact-hail__actions button:hover, .sf-contact-hail__actions button:focus-visible,
.sf-contact-hail__deck:focus-visible {
  outline: 2px solid var(--sf-goal); outline-offset: 2px; }
.sf-contact-hail__button:disabled { opacity: .72; }
/* Content rules — the card reads the same inside the kit frame and on the fallback mount. */
.sf-contact-hail__panel { width: min(332px, calc(100vw - 28px));
  box-sizing: border-box;
  font-family: var(--hud-data, var(--mono, Consolas, monospace));
  color: var(--hud-paper, rgb(236 244 253 / .97)); }
/* The panel's own glass face + anchored seat — fallback mount only. In the Stage frame the
   shared .dp-glass face and the prompt slot replace both. */
#ui-root > .sf-contact-hail__panel { position: fixed; left: 8px; top: 58px; z-index: 20;
  pointer-events: auto; padding: 10px 11px; border-radius: 8px;
  background-color: var(--glass-fill, rgb(9 14 22 / .82));
  background-image: var(--glass-sheen, linear-gradient(180deg, rgb(255 255 255 / .08), rgb(255 255 255 / 0) 46%));
  border: 1px solid var(--glass-edge, rgb(188 220 255 / .2)); border-top: 2px solid var(--glass-neon, rgb(141 217 255));
  box-shadow: var(--glass-drop, 0 10px 26px rgb(2 6 14 / .4)), var(--glass-inner, inset 0 1px 0 rgb(255 255 255 / .05));
  animation: sf-contact-hail-in .15s ease-out 1; }
@keyframes sf-contact-hail-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.sf-contact-hail__panel[hidden] { display: none !important; }
.sf-contact-hail__deck { width: 100%; border-radius: 3px; border: 1px solid var(--sf-edge);
  background: color-mix(in srgb, var(--sf-surface) 88%, transparent);
  color: var(--sf-paper); padding: 8px; display: grid; grid-template-columns: 24px 1fr; grid-template-rows: auto auto auto;
  column-gap: 9px; row-gap: 2px; text-align: left; cursor: pointer; margin-bottom: 8px;
  transition: border-color .15s ease, background .15s ease, translate .1s ease; }
.sf-contact-hail__deck:hover {
  background: color-mix(in srgb, var(--sf-surface) 75%, rgba(255,255,255,.06));
  border-color: color-mix(in srgb, var(--sf-goal) 50%, var(--sf-edge)); }
.sf-contact-hail__deck:active { translate: 0 1px; }
.sf-contact-hail__crest { grid-row: 1 / span 2; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--sf-calm); }
.sf-contact-hail__who { grid-column: 2; display: grid; gap: 1px; }
.sf-contact-hail__pilot { font: 600 13px var(--hud-data, var(--mono, Consolas, monospace)); line-height: 1.15; letter-spacing: .03em; }
.sf-contact-hail__class { font-size: 12px; color: var(--hud-muted, rgb(178 199 222 / .8)); line-height: 1.2; }
.sf-contact-hail__freq { grid-column: 2; font: 500 12px var(--hud-data, var(--mono, Consolas, monospace)); color: var(--glass-neon, rgb(141 217 255)); }
.sf-contact-hail__ribbon { grid-column: 1 / -1; width: 100%; height: 22px; color: var(--sf-you); }
.sf-contact-hail__ribbon path { fill: none; stroke: currentColor; stroke-width: 1.4; }
.sf-contact-hail__lines { display: grid; gap: 2px; }
.sf-contact-hail__line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; line-height: 1.35; letter-spacing: .02em; }
.sf-contact-hail__panel--detail { max-height: min(480px, calc(100dvh - 90px));
  overflow-y: auto; overscroll-behavior: contain; }
.sf-contact-hail__panel--resident { max-height: min(480px, calc(100dvh - 90px));
  overflow-y: auto; overscroll-behavior: contain; }
.sf-contact-hail__close { margin-top: 8px; min-height: 30px; width: 100%;
  border: 1px solid var(--sf-edge); border-radius: 3px; background: var(--sf-surface);
  color: var(--sf-paper); font: 500 12px var(--hud-data, monospace); cursor: pointer; }
.sf-contact-hail__close[hidden] { display: none; }
.sf-contact-hail__close:focus-visible { outline: 2px solid var(--sf-goal); outline-offset: 2px; }
.sf-contact-hail__panel--detail:focus-visible { outline: 2px solid var(--sf-goal); outline-offset: 2px; }
.sf-contact-hail__panel--resident:focus-visible { outline: 2px solid var(--sf-goal); outline-offset: 2px; }
.sf-contact-hail__panel--detail .sf-contact-hail__line,
.sf-contact-hail__line.sf-contact-hail__tow-advice { white-space: normal;
  overflow: visible; overflow-wrap: anywhere; text-overflow: clip; }
.sf-contact-hail__panel--resident .sf-contact-hail__line { white-space: normal;
  overflow: visible; overflow-wrap: anywhere; text-overflow: clip; }
.sf-contact-hail__line + .sf-contact-hail__line { color: var(--sf-calm); }
.sf-contact-hail__actions { display: flex; gap: 6px; margin-top: 8px; }
.sf-contact-hail__actions:empty { display: none; }
.sf-contact-hail__actions button { min-height: 30px; flex: 1 1 0; border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--sf-calm) 40%, transparent);
  background: color-mix(in srgb, var(--sf-surface) 88%, transparent); color: var(--sf-paper); cursor: pointer;
  font: 500 12px var(--sf-data-face, "IBM Plex Mono", monospace); letter-spacing: .03em;
  transition: border-color .15s ease, background .15s ease, color .15s ease, translate .1s ease; }
.sf-contact-hail__actions button:hover {
  border-color: var(--sf-goal);
  background: color-mix(in srgb, var(--sf-surface) 75%, var(--sf-goal) 14%);
  color: var(--sf-paper); }
.sf-contact-hail__actions button:active { translate: 0 1px; }
body.ui-modal-open #sf-contact-hail,
body.ui-live-screen #sf-contact-hail,
body.ui-modal-open .sf-contact-hail__panel,
body.ui-live-screen .sf-contact-hail__panel { opacity: 0; visibility: hidden; pointer-events: none; }
/* Staged, the panel fills its frame: its own 332px width ran 16px past the prompt slot at every size
   (bench hail-resident 2026-11-15: the card's right edge stood outside the glass). */
#sf-stage-prompt .sf-contact-hail__panel { width: auto; max-width: 100%; }
@media (max-width: 900px), (max-height: 620px) {
  #sf-contact-hail { left: 85px; top: 12px; }
  /* the two choices stack when the slot is narrow, so neither word is squeezed */
  #sf-stage-prompt .sf-contact-hail__actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  #sf-contact-hail, .sf-contact-hail__button, .sf-contact-hail__panel, .sf-contact-hail__deck, .sf-contact-hail__actions button { transition: none; }
  .sf-contact-hail__panel { animation: none; }
}
html.sf-reduce-motion #sf-contact-hail, html.sf-reduce-motion #sf-contact-hail .sf-contact-hail__button,
html.sf-reduce-motion #sf-contact-hail .sf-contact-hail__panel, html.sf-reduce-motion #sf-contact-hail .sf-contact-hail__deck,
html.sf-reduce-motion #sf-contact-hail .sf-contact-hail__actions button { transition: none; animation: none; }

/* ── Command bar (commandBar.js — flag-gated persistent top strip; mounts in the banner
   slot, the same tier it always held) ──────────────────────────────────────────────────── */
#sf-command-bar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 10px 18px 9px;
  background: var(--dp-veil-head);
  font-size: var(--dp-fs-etch);
  pointer-events: none;
  /* visibility is gated by .sf-cb--active below */
  opacity: 0;
  transition: opacity var(--dp-d-settle, 220ms) var(--dp-ease-settle, cubic-bezier(.16, 1, .3, 1));
}
#sf-command-bar.sf-cb--active { opacity: 1; }
/* Hidden whenever a modal/menu is open or the player is docked — same gate as #hud. Live
   (non-pausing) overlays also own pointer input, so the bar steps aside for them too. */
body.ui-modal-open #sf-command-bar,
body.ui-live-screen #sf-command-bar { opacity: 0; }

#sf-command-bar .sf-cb-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
  line-height: 1.1;
  min-width: 0;
}
#sf-command-bar .sf-cb-cell + .sf-cb-cell {
  border-left: 1px solid var(--dp-rule, rgb(232 226 212 / .10));
}
#sf-command-bar .sf-cb-k {
  font-family: var(--dp-face-etch, "Archivo", sans-serif);
  font-stretch: 112%;
  font-weight: 600;
  font-size: var(--dp-fs-etch);
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--dp-ink-mute, #b0aea6);
}
#sf-command-bar .sf-cb-v {
  font-family: var(--dp-face-numeral, var(--dp-face-read, "Archivo", sans-serif));
  font-stretch: 100%;
  font-weight: 520;
  font-size: var(--dp-fs-data);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0;
  color: var(--dp-ink, #e8e2d4);
  white-space: nowrap;
}

/* Identity cell (left) — etched name + sector. Anchors the strip, spends no accent. */
#sf-command-bar .sf-cb-cell--id { min-width: 132px; }
#sf-command-bar .sf-cb-brand {
  font-family: var(--dp-face-etch, "Archivo", sans-serif);
  font-stretch: 112%;
  font-weight: 650;
  font-size: var(--dp-fs-etch);
  letter-spacing: .18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--dp-ink-dim, #b7b4a6);
}
#sf-command-bar .sf-cb-sector {
  font-family: var(--dp-face-etch, "Archivo", sans-serif);
  font-stretch: 112%;
  font-weight: 600;
  font-size: var(--dp-fs-etch);
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--dp-ink-mute, #b0aea6);
}

/* Vitals — thin linear gauges (scales: the sanctioned straight edge for a ruled reading; the
   arc form of these quantities is the Cluster's job). Brightness encodes state: dim = nominal,
   danger red = the layer failing. */
#sf-command-bar .sf-cb-vitals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0;
}
#sf-command-bar .sf-cb-vrow {
  display: flex;
  align-items: center;
  gap: 6px;
}
#sf-command-bar .sf-cb-vlabel {
  width: 38px;
  font-family: var(--dp-face-etch, "Archivo", sans-serif);
  font-stretch: 112%;
  font-weight: 600;
  font-size: var(--dp-fs-etch);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dp-ink-mute, #b0aea6);
}
#sf-command-bar .sf-cb-track {
  position: relative;
  width: 92px;
  height: 5px;
  background: var(--dp-field-ink, rgb(232 226 212 / .08));
  overflow: hidden;
}
#sf-command-bar .sf-cb-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
}
#sf-command-bar .sf-cb-num {
  font-family: var(--dp-face-numeral, var(--dp-face-read, "Archivo", sans-serif));
  font-stretch: 100%;
  font-weight: 520;
  font-size: var(--dp-fs-etch);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: var(--dp-ink-dim, #b7b4a6);
  width: 38px;
  text-align: right;
}
/* The fills: bone for the physical layers, phosphor for the energy readings, the idle lamp for
   heat (the lamp you could wake). A failing layer is threat: danger red. */
#sf-command-bar .sf-cb-fill--hull { background: color-mix(in srgb, var(--dp-ink, #e8e2d4) 62%, transparent); }
#sf-command-bar .sf-cb-fill--armor { background: color-mix(in srgb, var(--dp-ink, #e8e2d4) 38%, transparent); }
#sf-command-bar .sf-cb-fill--shield { background: color-mix(in srgb, var(--dp-phos, #dfeeff) 58%, transparent); }
#sf-command-bar .sf-cb-fill--energy { background: color-mix(in srgb, var(--dp-phos, #dfeeff) 32%, transparent); }
#sf-command-bar .sf-cb-fill--heat { background: color-mix(in srgb, var(--dp-lamp-dim, #8a6b3a) 85%, transparent); }
/* Bright = problem state (overrides rest): hull critical, armor bitten through, energy starving,
   heat failing. All four are threats to the hull, so all four speak danger red. */
#sf-command-bar.sf-cb--hull-crit .sf-cb-fill--hull { background: var(--dp-danger, #ff5038); }
#sf-command-bar.sf-cb--armor-crit .sf-cb-fill--armor { background: var(--dp-danger, #ff5038); }
#sf-command-bar.sf-cb--energy-low .sf-cb-fill--energy { background: var(--dp-danger, #ff5038); }
#sf-command-bar.sf-cb--heat-high .sf-cb-fill--heat { background: var(--dp-danger, #ff5038); }

/* Economy cell — cargo + credits, always pinned (the core fix for "am I gaining anything?"). */
#sf-command-bar .sf-cb-cell--cargo { min-width: 96px; }
#sf-command-bar .sf-cb-cell--credits { min-width: 96px; }
/* Credits delta arrow — surfaces gain/loss direction with a shape, never colour alone.
   Gain is money you earned (the lamp); loss is a debit (danger); flat stays quiet. */
#sf-command-bar .sf-cb-delta {
  font-family: var(--dp-face-etch, "Archivo", sans-serif);
  font-size: var(--dp-fs-etch);
  margin-left: 4px;
}
#sf-command-bar .sf-cb-delta--up { color: var(--dp-lamp, #f2b950); }
#sf-command-bar .sf-cb-delta--down { color: var(--dp-danger, #ff5038); }
#sf-command-bar .sf-cb-delta--flat { color: var(--dp-ink-mute, #b0aea6); }

/* Cargo full warning — the one warm accent on the strip: a full hold is a decision point
   (sell or jettison), which is exactly what the lamp means. */
#sf-command-bar.sf-cb--cargo-full .sf-cb-v--cargo { color: var(--dp-lamp, #f2b950); }

/* Role/class cell — your ship's function (Miner/Fighter/...). */
#sf-command-bar .sf-cb-cell--role { min-width: 78px; }

/* Recent impact is one anchored receipt, not floating text or a visor arc. It appears only
   after player damage, then yields to the normal strip. Screen readers already receive the
   damage alert channel (alerts.js), so this visual status is intentionally not assertive.
   Arrival is a 180 ms opacity settle on transforms/opacity only — nothing just appears. */
#sf-command-bar .sf-cb-cell--impact { display:none; min-width:210px; max-width:290px; }
#sf-command-bar.sf-cb--impact .sf-cb-cell--impact { display:flex;
  animation: sf-cb-impact-in 180ms var(--dp-ease-out, cubic-bezier(.16, 1, .3, 1)) 1; }
@keyframes sf-cb-impact-in { from { opacity: 0; } to { opacity: 1; } }
html.sf-reduce-motion #sf-command-bar.sf-cb--impact .sf-cb-cell--impact { animation: none; }
#sf-command-bar .sf-cb-impact {
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-family: var(--dp-face-etch, "Archivo", sans-serif);
  font-stretch: 112%;
  font-weight: 600;
  font-size: var(--dp-fs-etch);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dp-ink-dim, #b7b4a6);
}

@media (forced-colors: active) {
  #sf-command-bar { background: Canvas; }
  #sf-command-bar .sf-cb-cell + .sf-cb-cell { border-left-color: CanvasText; }
}

/* P10 condense: at a squeezed frame the strip tightens its gutters and gauges — the type floor
   and the row structure hold, nothing is shrunk below the token scale. */
@media (max-width: 1500px) {
  #sf-command-bar { padding: 8px 12px 7px; }
  #sf-command-bar .sf-cb-cell { padding: 0 9px; }
  #sf-command-bar .sf-cb-cell--id { min-width: 0; }
  #sf-command-bar .sf-cb-cell--cargo,
  #sf-command-bar .sf-cb-cell--credits { min-width: 0; }
  #sf-command-bar .sf-cb-cell--impact { min-width: 0; max-width: 200px; }
  #sf-command-bar .sf-cb-track { width: 64px; }
  #sf-command-bar .sf-cb-vlabel { width: 34px; }
}

/* ── Stunt callout (stuntCallout.js — trick/score layer; seats in the feed slot, inside #hud
   so it survives the hud rebuild the slot itself already re-seats through) ────────────────── */
.sf-stuntcall { position:fixed; left:calc(var(--sf-hud-edge, 16px) + var(--sf-safe-inset-x, 0px)); bottom:32vh; z-index:12; display:flex; flex-direction:column;
  align-items:flex-start; gap:5px; pointer-events:none; }
.sf-stuntcall[hidden] { display:none; }
.sf-stuntcall__line { display:inline-flex; align-items:center; gap:8px; white-space:nowrap;
  padding:3px 9px; border-radius:4px; border:1px solid rgb(236 230 216 / .12);
  background:linear-gradient(180deg, rgb(16 20 28 / .86), rgb(11 14 20 / .86));
  box-shadow:inset 0 1px 0 rgb(255 255 255 / .05), 0 6px 16px -4px rgb(0 0 0 / .60); }
.sf-stuntcall__lines { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.sf-stuntcall__name { font-family:var(--dp-face-read, "Instrument Sans", sans-serif); font-stretch:100%; font-weight:600;
  font-size:12px; letter-spacing:.05em; text-transform:uppercase; color:rgb(248 244 234 / .92); }
.sf-stuntcall__line[data-rarity="common"] .sf-stuntcall__name { font-weight:450;
  color:rgb(248 244 234 / .78); }
.sf-stuntcall__line[data-rarity="uncommon"] .sf-stuntcall__name { font-weight:550;
  color:rgb(248 244 234 / .88); }
.sf-stuntcall__line[data-rarity="rare"] .sf-stuntcall__name { font-weight:700;
  color:rgb(248 244 234 / .96); }
.sf-stuntcall__line[data-rarity="legendary"] .sf-stuntcall__name { font-weight:800;
  color:rgb(248 244 234 / 1); }
.sf-stuntcall__pts { font-family:var(--dp-face-num, "Spline Sans Mono", monospace); font-stretch:100%; font-weight:500;
  font-size:12px; font-variant-numeric:tabular-nums; letter-spacing:.02em; color:rgb(236 230 216 / .76); }
.sf-stuntcall__line.is-bank { border-color:rgb(242 185 80 / .36); }
.sf-stuntcall__line.is-bank .sf-stuntcall__name { color:var(--dp-hand, #f2b950); }
.sf-stuntcall__line.is-bank .sf-stuntcall__pts { color:var(--dp-hand, #f2b950); }
.sf-stuntcall__meter { display:flex; flex-direction:column; gap:4px; margin-top:2px;
  padding:6px 10px; border-radius:4px; border:1px solid rgb(236 230 216 / .12);
  background:linear-gradient(180deg, rgb(16 20 28 / .88), rgb(11 14 20 / .88)); }
.sf-stuntcall__rowtop { display:flex; align-items:baseline; gap:10px; }
.sf-stuntcall__mult { font-family:var(--dp-face-num, "Spline Sans Mono", monospace); font-stretch:100%; font-weight:600;
  font-size:24px; line-height:1; letter-spacing:-.02em; font-variant-numeric:tabular-nums;
  color:rgb(248 244 234 / .95); }
.sf-stuntcall__names { font-family:var(--dp-face-read, "Instrument Sans", sans-serif); font-stretch:100%; font-weight:600;
  font-size:12px; letter-spacing:.04em; text-transform:uppercase; color:rgb(236 230 216 / .78); }
.sf-stuntcall__scale { position:relative; width:190px; height:3px; border-radius:1.5px;
  background:rgb(236 230 216 / .20); }
.sf-stuntcall__scale-fill { position:absolute; inset:0; transform-origin:left center;
  transform:scaleX(var(--sf-stuntcall-w, 1)); background:rgb(248 244 234 / .82); }
.sf-stuntcall__scale-notch { position:absolute; top:-3px; width:1px; height:9px;
  background:rgb(236 230 216 / .55); }
.sf-stuntcall__rowsub { display:flex; gap:12px; font-family:var(--dp-face-num, "Spline Sans Mono", monospace);
  font-weight:500; font-size:12px; letter-spacing:.04em; text-transform:uppercase;
  font-variant-numeric:tabular-nums; color:rgb(236 230 216 / .64); }
.sf-stuntcall__rise { animation:sf-stuntcall-rise .34s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes sf-stuntcall-rise { from { opacity:0; transform:translateY(7px); } to { opacity:1; transform:none; } }
html.sf-reduce-motion .sf-stuntcall__rise { animation:none; }
@media (prefers-reduced-motion:reduce) { .sf-stuntcall__rise { animation:none; } }
.sf-stuntcall__sr { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; }

/* ── Comms surfaces (comms.js — G16-02: the injected sheet retired here verbatim) ───────────
   The backlog log and the endgame choice scrim seat inside the Stage's dialog slot — their
   placement rules are unconditional because the slot reproduces the same viewport rect. */
/* ===== comms feed — joined to the flight context rail when the HUD is present ===== */
#sf-comms { position:relative; width:100%; max-height:124px; display:flex;
  flex-direction:column-reverse; gap:4px; pointer-events:none; z-index:20; overflow:hidden;
  font-family:var(--hud-data, var(--mono, Consolas, monospace)); }
#ui-root > #sf-comms { position:absolute; left:20px; top:118px; width:340px; }
#sf-comms .sf-comm { pointer-events:auto; }
body.ui-modal-open #sf-comms,
body.ui-live-screen #sf-comms { opacity:0; pointer-events:none; }
body.ui-modal-open .sf-comm-backlog-btn,
body.ui-live-screen .sf-comm-backlog-btn { opacity:0; visibility:hidden; pointer-events:none; }
/* An open backlog is a HUD overlay, not a screen — without this it keeps painting at
   z-index 2400 over whatever modal the player opens next (map over open comms, etc.). */
body.ui-modal-open .sf-comm-backlog,
body.ui-live-screen .sf-comm-backlog { visibility:hidden; pointer-events:none; }
.sf-comm { --comm-color:var(--text-secondary); --comm-glow:none; position:relative; padding:7px 10px 8px;
  border:1px solid rgba(147,174,195,.24); border-top-color:rgba(147,196,211,.42); border-radius:2px;
  background:linear-gradient(108deg, rgba(17,25,36,.91), rgba(7,12,20,.78)); box-shadow:0 10px 24px rgba(0,0,0,.22);
  color:var(--hud-paper,#e7edf5); font-size:12px; text-shadow:none;
  cursor:pointer; transform:translateX(-130%); opacity:0; transition:transform .18s ease, opacity .18s ease; }
.sf-comm--in { transform:translateX(0); opacity:1; }
.sf-comm--out { transform:translateX(-130%); opacity:0; }
.sf-comm__head { display:flex; align-items:baseline; gap:7px; margin-bottom:3px; }
.sf-comm__tag { padding:1px 4px; background:color-mix(in srgb, var(--comm-color) 13%, transparent);
  font:700 12px var(--hud-display,"IBM Plex Sans",sans-serif); letter-spacing:.06em; color:var(--comm-color); text-shadow:none; }
.sf-comm__sender { font:600 12px var(--hud-display,"IBM Plex Sans",sans-serif); letter-spacing:.06em;
  color:var(--hud-muted,#718298); text-transform:uppercase;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sf-comm__body { line-height:1.38; color:var(--hud-paper,#e7edf5); }
.sf-comm--personal .sf-comm__body, .sf-comm--late .sf-comm__body, .sf-comm--story .sf-comm__body { color:#eaf4ff; }
/* Player-addressed traffic stands forward of the ambient channel noise: personal lines set one
   step larger and brighter, ambient lines recede. Tag-only difference was unreadable at speed. */
.sf-comm--personal { font-size:13px; }
.sf-comm--personal .sf-comm__body { color:#f2f7ff; }
.sf-comm--ambient { opacity:.85; }

/* Joined top-left utility rail: explicit words beat another ambiguous glyph. */
#ui-root > .sf-comm-backlog-btn { position:absolute; left:20px; top:20px; width:66px; height:32px; z-index:1060;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(180deg,rgba(20,29,41,.88),rgba(8,13,21,.9));
  border:1px solid rgba(147,174,195,.34); border-radius:2px 0 0 2px; color:#aebdce;
  font:700 12px var(--hud-display,"IBM Plex Sans",sans-serif); letter-spacing:.06em; cursor:pointer; pointer-events:auto;
  transition:color .12s, border-color .12s; text-shadow:none; }
.sf-comm-backlog-btn:hover { border-color:var(--accent,#4f8fdd); color:#e7edf5; }
/* The backlog lamp used to pulse an inset box-shadow — a repaint every frame. The same 2px
   bottom line now rides an ::after whose opacity animates, which the compositor owns. */
.sf-comm-backlog-btn--pulse { color:#e7edf5; border-color:var(--accent,#4f8fdd); }
.sf-comm-backlog-btn--pulse::after { content:""; position:absolute; left:0; right:0; bottom:0; height:2px;
  background:var(--accent,#4f8fdd); opacity:.15; will-change:opacity;
  animation:sf-commpulse 1.3s ease-in-out infinite alternate; }
@keyframes sf-commpulse { from { opacity:.15; } to { opacity:1; } }
.sf-comm-backlog { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%) scale(.97);
  width:min(620px, 92vw); max-height:78vh; display:none; flex-direction:column; z-index:2400;
  background:var(--sf-pop-glass); border:1px solid var(--sf-pop-seam); border-top:2px solid var(--dp-phos); border-radius:2px; box-shadow:var(--sf-pop-shadow);
  pointer-events:auto; opacity:0; transition:opacity .18s ease, transform .18s ease; }
.sf-comm-backlog.open { display:flex; opacity:1; transform:translate(-50%,-50%) scale(1); }
.sf-comm-backlog__head { display:flex; align-items:center; justify-content:space-between; padding:12px 16px;
  border-bottom:1px solid var(--panel-edge); }
.sf-comm-backlog__title { font:650 15px/1.3 var(--dp-face-display); letter-spacing:.04em; color:var(--dp-ink); text-transform:uppercase; }
.sf-comm-backlog__close { background:none; border:1px solid var(--ink-mute); border-radius:4px; color:var(--ink-dim);
  font-size:12px; padding:2px 9px; cursor:pointer; font-family:var(--mono); }
.sf-comm-backlog__close:hover { border-color:var(--accent); color:var(--accent); }
.sf-comm-backlog__hint { padding:7px 16px; font-size:12px; color:var(--ink-mute); font-style:italic;
  border-bottom:1px solid rgba(79,143,221,.07); }
.sf-comm-backlog__list { overflow-y:auto; padding:4px 0; }
.sf-comm-backlog__list::-webkit-scrollbar { width:5px; }
.sf-comm-backlog__list::-webkit-scrollbar-thumb { background:var(--accent); border-radius:3px; }
.sf-comm-backlog__row { --comm-color:var(--ink-dim); padding:8px 16px; border-bottom:1px solid rgba(79,143,221,.05);
  display:flex; flex-direction:column; gap:2px; }
.sf-comm-backlog__row:hover { background:rgba(79,143,221,.04); }
.sf-comm-backlog__sender { font-size:12px; letter-spacing:.06em; color:var(--comm-color); text-transform:uppercase; }
.sf-comm-backlog__text { font-family:var(--dp-face-read); font-size:14px; color:var(--ink); line-height:1.4; }
.sf-comm-backlog__note { margin-top:4px; font-size:12px; color:var(--ink-mute); font-style:italic; line-height:1.4;
  border-left:1px solid var(--sf-edge); padding-left:8px; }
.sf-comm-backlog__empty { padding:30px 16px; text-align:center; color:var(--ink-mute); font-style:italic; }

/* ===== bulkhead graffiti (player's own ship) ===== */
.sf-bulkhead { position:absolute; left:clamp(300px, 24vw, 460px); top:24%; transform:none; z-index:9;
  pointer-events:none; opacity:0; transition:opacity 1.2s ease; max-width:min(420px, 32vw); text-align:left; }
.sf-bulkhead--visible { opacity:.22; }
.sf-bulkhead__line { font-family:var(--mono); font-size:clamp(12px, 1.2vw, 13px); letter-spacing:.06em;
  color:#b9c4d6; text-transform:uppercase; text-shadow:0 0 12px rgba(0,0,0,.85), 0 1px 2px #000;
  transform:rotate(-1.5deg); }
/* Flight place lines float over the scene; docked lines move into the berth tape's normal flow. */
.sf-airlock { position:absolute; left:50%; bottom:14%; transform:translateX(-50%); z-index:140;
  pointer-events:none; opacity:0; transition:opacity .4s ease; max-width:min(520px, 84vw); text-align:center; }
.sf-airlock--station { position:relative; inset:auto; left:auto; bottom:auto; z-index:auto; transform:none;
  flex:0 0 100%; width:100%; max-width:100%; margin:0; text-align:left; }
.sf-airlock--station .sf-airlock__line { display:block; max-width:100%; line-height:1.35; overflow-wrap:anywhere; text-align:left; }
.sf-airlock--visible { opacity:1; }
body.ui-modal-open .sf-airlock--visible { opacity:1; }
.sf-airlock__line { font-family:var(--mono); font-size:clamp(13px, 1.5vw, 16px); letter-spacing:.08em;
  color:#d7deea; text-transform:uppercase; text-shadow:0 0 16px rgba(0,0,0,.9), 0 1px 2px #000; }
@media (prefers-reduced-motion: reduce) { .sf-airlock { transition:none; } }
html.sf-reduce-motion .sf-airlock { transition:none; }
@media (max-width: 760px) { .sf-bulkhead { left:18px; right:18px; top:auto; bottom:150px; max-width:none; } .sf-bulkhead__line { font-size:12px; letter-spacing:.06em; }
  #ui-root > #sf-comms { width:260px; top:88px; }
  #ui-root > .sf-comm-backlog-btn { top:12px; }
  .sf-comm { font-size:12px; padding:6px 9px; } }

/* ===== endgame choice modal ===== */
.sf-endgame { position:fixed; inset:0; z-index:2600; display:none; align-items:center; justify-content:center;
  background:rgba(3,5,10,.94); opacity:0; transition:opacity .3s ease; pointer-events:auto; }
.sf-endgame.open { display:flex; opacity:1; }
.sf-endgame__panel { width:min(880px, 94vw); max-height:90vh; overflow-y:auto; padding:24px 28px;
  background:linear-gradient(180deg, var(--panel-2), var(--panel)); border:1px solid var(--accent); border-radius:10px;
  box-shadow:0 0 60px rgba(79,143,221,.15), 0 20px 60px rgba(0,0,0,.6); }
.sf-endgame__head { text-align:center; margin-bottom:18px; }
.sf-endgame__title { margin:0; font-family:var(--mono); font-size:18px; letter-spacing:.06em; color:var(--accent);
  text-transform:uppercase; text-shadow:0 0 14px rgba(79,143,221,.4); }
.sf-endgame__sub { margin-top:6px; font-size:12px; color:var(--ink-mute); font-style:italic; }
.sf-endgame__choices { display:flex; flex-direction:column; gap:14px; }
.sf-endgame__choice { padding:14px 16px; background:rgba(4,9,18,.6); border:1px solid var(--panel-edge); border-radius:7px;
  transition:border-color .15s, background .15s; }
.sf-endgame__choice:hover { border-color:var(--accent-3); background:rgba(167,139,202,.05); }
.sf-endgame__choice-head { display:flex; align-items:baseline; gap:10px; margin-bottom:6px; }
.sf-endgame__choice-id { font-size:20px; color:var(--accent-3); letter-spacing:.06em; }
.sf-endgame__choice-title { font-size:15px; color:var(--ink); letter-spacing:.04em; }
.sf-endgame__choice-board { font-size:12px; color:var(--accent); margin-bottom:6px; }
.sf-endgame__choice-noboard { color:var(--ink-mute); font-style:italic; }
.sf-endgame__choice-summary { font-size:12.5px; color:var(--ink); line-height:1.5; margin-bottom:6px; }
.sf-endgame__choice-cost { font-size:12px; color:var(--ink-mute); font-style:italic; line-height:1.5;
  border-left:1px solid var(--sf-edge); padding-left:9px; }
.sf-endgame__choice-actions { margin-top:10px; display:flex; justify-content:flex-end; }
.sf-endgame__accept { background:rgba(167,139,202,.12); border:1px solid var(--accent-3); color:var(--accent-3);
  font-family:var(--mono); font-size:12px; letter-spacing:.06em; padding:6px 18px; border-radius:5px; cursor:pointer; }
.sf-endgame__accept:hover { background:rgba(167,139,202,.25); color:#fff; }
.sf-endgame__footer { margin-top:18px; text-align:center; font-size:12px; color:var(--ink-mute); font-style:italic; }
/* Physical-story decisions share the same instrument field as the station confirmation. */
.sf-endgame--c { background: var(--sf-pop-scrim); }
.sf-endgame--c .sf-endgame__panel--c {
  box-sizing: border-box; width: min(500px, calc(100vw - 24px)); padding: clamp(18px,3vw,30px);
  background: var(--sf-pop-glass); border: 1px solid var(--sf-pop-seam); border-top: 2px solid var(--dp-lamp);
  border-radius: 2px; box-shadow: var(--sf-pop-shadow); text-align: left;
}
.sf-endgame__c-prompt { margin: 0 0 10px; font: 700 clamp(20px,3vw,28px)/1.15 var(--dp-face-display); color: var(--dp-ink); overflow-wrap: anywhere; }
.sf-endgame__c-hint { margin: 0 0 18px; font: 450 15px/1.5 var(--dp-face-read); color: var(--dp-ink-dim); }
.sf-endgame__c-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--dp-rule-hi); }
.sf-endgame__c-actions button { min-height: 42px; padding: 8px 18px; font: 650 13px/1.25 var(--dp-face-etch);
  letter-spacing: .045em; cursor: pointer; color: var(--dp-ink); border: 1px solid var(--sf-pop-seam); border-radius: 2px; background: var(--dp-field); }
.sf-endgame__c-actions .sf-endgame__c-yes { border-color: var(--dp-lamp); color: var(--dp-lamp-hot); }
.sf-endgame__c-actions button:is(:hover,:focus-visible) { border-color: var(--dp-lamp-hot); background: var(--dp-field-ink-hi); }

/* ── Nemesis transmission (nemesisComms.js — G16-02: the <style> embedded in its innerHTML
   retired here verbatim; the card rides the Stage's prompt slot while visible) ───────────── */
[data-nemesis-comms]{--nm-ink:#e6f1ed;--nm-dim:#a3b7b0;--nm-line:#40574e;--nm-accent:#c3e4a8;box-sizing:border-box;max-width:320px;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--nm-ink);background:#101b1bf5;border:1px solid var(--nm-line);border-left:3px solid var(--nm-accent);padding:14px 16px;pointer-events:auto;box-shadow:0 8px 25px #0005}
[data-nemesis-comms][hidden]{display:none!important}
[data-nemesis-comms] header{display:flex;align-items:center;gap:10px;padding-bottom:10px;border-bottom:1px solid var(--nm-line)}
[data-nemesis-comms] svg{width:32px;flex:none;fill:none;stroke:var(--nm-accent);stroke-width:1.4}
[data-nemesis-comms] h2{font:600 14px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.10em;margin:0}
[data-nemesis-comms] .nm-status{font-size: 12px;letter-spacing:.1em;color:var(--nm-dim)}
[data-nemesis-comms] p{margin:10px 0 0}
[data-nemesis-comms] details{margin-top:9px;color:var(--nm-dim)}
[data-nemesis-comms] summary{cursor:pointer;color:var(--nm-accent)}
[data-nemesis-comms] button{font:600 12px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;width:100%;padding:10px;margin-top:12px;color:#14221a;background:var(--nm-accent);border:1px solid var(--nm-accent);cursor:pointer}
[data-nemesis-comms] button:hover{filter:brightness(1.12)}
[data-nemesis-comms] :focus-visible{outline:2px solid #fff;outline-offset:3px}
[data-nemesis-comms] .nm-live{color:var(--nm-dim);font-size: 12px}
@media(prefers-reduced-motion:no-preference){[data-nemesis-comms]{animation:nm-arrival .22s ease-out}@keyframes nm-arrival{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}}

/* ── Ending epilogue (endingEpilogue.js — G16-02: the injected sheet retired here verbatim;
   the scrim seats inside the Stage's dialog slot) ───────────────────────────────────────── */
.sf-ending-epilogue {
  position: fixed; inset: 0; z-index: 2800; display: grid; place-items: center;
  padding: clamp(18px, 4vw, 64px); box-sizing: border-box; pointer-events: auto;
  color: #edf6ff; background:
    radial-gradient(circle at 50% 38%, rgba(39, 91, 121, .18), transparent 44%),
    rgba(3, 7, 13, .96); animation: sf-ending-epilogue-in .42s ease-out both;
}
.sf-ending-epilogue[data-ending-kind="continuation"] {
  background: radial-gradient(circle at 50% 38%, rgba(88, 111, 128, .13), transparent 44%), rgba(3, 7, 13, .96);
}
.sf-ending-epilogue__panel {
  width: min(760px, 100%); max-height: min(760px, 92vh); overflow: auto;
  padding: clamp(26px, 5vw, 58px); box-sizing: border-box;
  border: 1px solid var(--sf-pop-seam); border-top: 2px solid var(--dp-phos);
  background: var(--sf-pop-glass);
  box-shadow: 0 32px 90px rgba(0, 0, 0, .58); text-align: left;
}
.sf-ending-epilogue__eyebrow,
.sf-ending-epilogue__section-title {
  margin: 0; font-family: var(--mono, monospace); text-transform: uppercase;
  letter-spacing:.06em; color: #76d9f3;
}
.sf-ending-epilogue__eyebrow { font-size: 12px; margin-bottom: 14px; }
.sf-ending-epilogue__title {
  margin: 0; max-width: 18ch; font-family: var(--dp-face-display, "Archivo", sans-serif); font-size: clamp(30px, 6vw, 62px);
  line-height: .98; letter-spacing: .025em; font-weight: 650; text-wrap: balance;
}
.sf-ending-epilogue__resolution {
  margin: 22px 0 0; max-width: 58ch; color: #c9d7e3; font-size: clamp(15px, 2vw, 19px); line-height: 1.55;
}
.sf-ending-epilogue__rule { width: 72px; height: 1px; margin: 30px 0; background: #76d9f3; opacity: .75; }
.sf-ending-epilogue__sections { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.sf-ending-epilogue__section-title { font-size: 12px; margin-bottom: 9px; color: #89a9bc; }
.sf-ending-epilogue__section-copy { margin: 0; color: #e1ebf2; font-size: 14px; line-height: 1.55; }
.sf-ending-epilogue__record { grid-column: 1 / -1; }
.sf-ending-epilogue__record .sf-ending-epilogue__section-copy { white-space: pre-wrap; overflow-wrap: anywhere; }
.sf-ending-epilogue__objective-name { display: block; margin-bottom: 5px; color: #76d9f3; }
.sf-ending-epilogue__dismiss {
  margin-top: 34px; min-height: 42px; padding: 9px 18px; border: 1px solid rgba(118, 217, 243, .72);
  border-radius: 3px; background: rgba(33, 107, 130, .12); color: #dff8ff;
  font: 12px var(--mono, monospace); letter-spacing:.06em; cursor: pointer;
}
.sf-ending-epilogue__dismiss:hover { background: rgba(52, 158, 190, .2); }
.sf-ending-epilogue__dismiss:focus-visible { outline: 3px solid #f5c35b; outline-offset: 4px; }
@keyframes sf-ending-epilogue-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 620px) {
  .sf-ending-epilogue__sections { grid-template-columns: 1fr; gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .sf-ending-epilogue { animation: none; }
  .sf-ending-epilogue *, .sf-ending-epilogue *::before, .sf-ending-epilogue *::after {
    transition: none !important; animation: none !important;
  }
}

/* ── Rope class-up / discovery moment plate (discoveryPlate.js show()) ──────────────────────
   Inside a Stage frame the shared glass is the only face: the plate's own legacy card (cyan
   edge, gradient, border, shadow) retires, and the three authored lines get a real hierarchy —
   one amber title, then the lines in bone on a readable measure. */
.sf-stage__item .sf-discovery-plate__frame {
  padding: 0; background: none; border: 0; box-shadow: none; max-width: 292px; text-align: left; }
.sf-stage__item .sf-discovery-plate__title {
  font-family: var(--dp-face-label, var(--hud-data)); font-size: 15px; font-weight: 800;
  letter-spacing: .08em; line-height: 1.2; margin: 0 0 7px; color: var(--dp-amber, #e8c98a); }
.sf-stage__item .sf-discovery-plate__meta {
  font-family: var(--dp-face-read, var(--hud-data)); font-size: 13px; font-weight: 500;
  letter-spacing: .01em; line-height: 1.35; margin-top: 4px; color: var(--dp-ink, #e8e2d4); }

/* ── G16-04 receipt plates ───────────────────────────────────────────────────────────────────
   Every line in the notice/receipt feed rides the shared flight-glass plate: padding, a hairline
   rim, a max measure, and text that wraps to two lines then ellipsises — never bare type over the
   world. The id selector outranks the several older flattening passes on .sf-toast. */
#toasts .sf-toast, #sf-stage-feed .sf-toast {
  box-sizing: border-box; width: fit-content; max-width: min(320px, calc(100vw - 24px));
  padding: 6px 12px; border-radius: var(--dp-r-plate, 3px);
  background: var(--dp-glass-flight, rgb(8 10 14 / .72)); background-color: rgb(8 10 14 / .5);
  border: 1px solid var(--dp-rule, rgb(232 226 212 / .16));
  box-shadow: var(--dp-glass-depth, 0 2px 10px rgb(0 0 0 / .45));
  line-height: 1.3;
}
#toasts .sf-toast__text, #sf-stage-feed .sf-toast__text {
  min-width: 0; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
@media (forced-colors: active) { #toasts .sf-toast, #sf-stage-feed .sf-toast { border-color: CanvasText; } }

/* ── OPENING-3 speaker card (speakerCard.js) ─────────────────────────────────────────────────
   A named cast member's face: portrait, name, one line, ~6 s. Seats on the left rail under the
   objective line, where the comms feed lives — clear of the radar and the centre of the screen. */
#sf-stage-speaker .sf-stage__flow { position: absolute; left: var(--sf-hud-edge, 20px); top: var(--sf-speaker-top, 218px); z-index: 20; display: flex; flex-direction: column; align-items: flex-start; }
.sf-speaker { display: flex; align-items: center; gap: 10px; box-sizing: border-box; width: min(320px, calc(100vw - 24px)); padding: 6px 12px 6px 6px;
  border-radius: var(--dp-r-plate, 3px); background: var(--dp-glass-flight, rgb(8 10 14 / .72)); border: 1px solid var(--dp-rule, rgb(232 226 212 / .16));
  box-shadow: var(--dp-glass-depth, 0 2px 10px rgb(0 0 0 / .45)); }
/* Entry is the kit's settle (slide) or cut (reduced motion: it just appears); the exit is a fade only. */
.sf-speaker.sf-speaker--out { opacity: 0; transform: none; transition: opacity .3s ease; }
.sf-speaker__face { flex: 0 0 auto; width: 60px; height: 60px; object-fit: cover; border-radius: 2px; border: 1px solid var(--dp-rule, rgb(232 226 212 / .16)); background: rgb(8 10 14 / .6); }
.sf-speaker--faceless .sf-speaker__face { display: none; }
.sf-speaker__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sf-speaker__name { font-family: var(--dp-face-label, var(--hud-display, sans-serif)); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dp-lamp, #f2b950); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-speaker__line { font-family: var(--dp-face-read, var(--hud-data)); font-size: 13px; line-height: 1.35; color: var(--dp-ink, #e8e2d4);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
body.ui-modal-open #sf-stage-speaker, body.ui-live-screen #sf-stage-speaker { opacity: 0; visibility: hidden; }
@media (max-width: 760px) { #sf-stage-speaker .sf-stage__flow { top: auto; bottom: max(262px, 31vh); left: 12px; }
  .sf-speaker { width: min(300px, calc(100vw - 24px)); gap: 8px; padding: 4px 8px 4px 4px; }
  .sf-speaker__face { width: 40px; height: 40px; } .sf-speaker__line { font-size: 12px; } }
@media (forced-colors: active) { .sf-speaker { border-color: CanvasText; } }
