/* Layout: the 3D scene is the page. A thin top bar with text links, a spectral rule under it,
   documentary captions in the lower third, a details sheet on the right, and a slim time track at
   the bottom. The signature element is the SPHEREx spectral ramp (0.75 um deep red to 5 um white-hot);
   the water clue is cyan-blue so it reads as water against it. */
:root {
  /* the stage (always dark) */
  --space: #07080b;
  --ink: #ece8e2;
  --ink-2: rgba(236, 232, 226, 0.66);
  --ink-3: rgba(236, 232, 226, 0.42);
  --rule: rgba(236, 232, 226, 0.14);
  --veil: rgba(7, 8, 11, 0.72);
  /* data colors */
  --water: #3cc8f0;
  --noclue: #b3a89a;
  --pending: #6b6f78;
  --cand: #9d7dff;
  --accent: #f2c14e;               /* the ramp's gold: focus, current chapter, SPHEREx line of sight */
  --ramp: linear-gradient(90deg, #5c0f1f 0%, #a3202e 18%, #d9472f 38%, #f08a35 58%, #f2c14e 78%, #fff1cf 100%);
  /* names app.js reads for canvas drawing */
  --space-text: var(--ink);
  --space-muted: var(--ink-2);
  --band: var(--water);
  --noband: var(--noclue);
  --rec-ring: #ece8e2;
  --grid: rgba(236, 232, 226, 0.10);
  --gridlabel: rgba(236, 232, 226, 0.55);
  --track: rgba(236, 232, 226, 0.38);
  --real: #8fd19e;
  /* the data drawer follows the viewer's theme */
  --bg: #f4f2ee;
  --surface: #ffffff;
  --text: #1b1a18;
  --muted: #5f5b55;
  --line: #dcd7cf;
  --error-bg: #fbe9e7;
  --error-text: #7a1d12;
  --plot-bg: #ffffff;
  --plot-axis: #5f5b55;
  --plot-grid: #ece8e2;
  --plot-window: rgba(60, 200, 240, 0.16);
  --plot-fit: #1b1a18;
  --plot-point: #a3202e;
  --plot-later: rgba(163, 32, 46, 0.25);
  --tip-bg: #1b1a18;
  --tip-text: #f4f2ee;
  /* type */
  --f-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --gutter: 16px;
  --top-h: 56px;
  --time-h: 44px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --surface: #1a1b1e; --text: #ece8e2; --muted: #a39d94; --line: #2c2d31;
    --error-bg: #3a1714; --error-text: #ffb8ad;
    --plot-bg: #1a1b1e; --plot-axis: #a39d94; --plot-grid: #2c2d31; --plot-fit: #ece8e2;
    --plot-point: #f08a35; --plot-later: rgba(240, 138, 53, 0.25);
    --tip-bg: #ece8e2; --tip-text: #111214;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --surface: #1a1b1e; --text: #ece8e2; --muted: #a39d94; --line: #2c2d31;
  --error-bg: #3a1714; --error-text: #ffb8ad;
  --plot-bg: #1a1b1e; --plot-axis: #a39d94; --plot-grid: #2c2d31; --plot-fit: #ece8e2;
  --plot-point: #f08a35; --plot-later: rgba(240, 138, 53, 0.25);
  --tip-bg: #ece8e2; --tip-text: #111214;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--space); color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
.num, output, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---------- stage ---------- */
.space3d, .sketch { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.space3d { background: var(--space); --o3d-caption-bottom: calc(var(--time-h) + 28px); }
body.touring .space3d { --o3d-caption-bottom: 46%; }
/* a soft vignette pulls the eye to the middle of the scene; purely decorative */
.space3d::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 45%, rgba(7, 8, 11, 0) 55%, rgba(7, 8, 11, 0.55) 100%);
}

/* ---------- controls: quiet text, instrument-like ---------- */
.link, .close, .menubtn {
  font: 500 0.86rem/1.2 var(--f-body);
  letter-spacing: 0.01em;
  color: var(--ink);
  background: none; border: 0; padding: 6px 2px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.link:hover, .close:hover, .menubtn:hover { border-bottom-color: var(--accent); }
.link.quiet { color: var(--ink-2); }
.link:disabled { color: var(--ink-3); cursor: default; border-bottom-color: transparent; }
/* buttons app.js generates inside cards keep their classes; style them the same way */
.btn {
  font: 500 0.84rem/1.2 var(--f-body); color: var(--ink); background: none; cursor: pointer;
  border: 1px solid var(--ink-3); border-radius: 3px; padding: 7px 12px;
  transition: border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
:is(.link, .close, .menubtn, .btn, .tag, .tip, summary, .card, input, .rail button):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px;
}
.close { position: absolute; top: 12px; right: 16px; color: var(--ink-2); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 6; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--gutter) 10px;
  background: linear-gradient(to bottom, rgba(7, 8, 11, 0.94), rgba(7, 8, 11, 0.55));
}
.brand { min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.brand h1 { font: 500 1.28rem/1.1 var(--f-display); letter-spacing: -0.005em; white-space: nowrap; }
.tagline { margin: 0; color: var(--ink-2); font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topactions { display: flex; align-items: center; gap: 22px; }
.menubtn { display: none; }
.tag {
  font: 500 0.72rem/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); background: none; cursor: help;
  border: 1px solid var(--rule); border-radius: 2px; padding: 5px 7px;
}
.tag.real { color: var(--real); border-color: rgba(143, 209, 158, 0.45); }
.ramp { height: 2px; background: var(--ramp); }
.topramp { position: fixed; z-index: 6; left: 0; right: 0; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); opacity: 0.9; }

.error {
  position: fixed; z-index: 9; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 2 * var(--gutter)));
  background: var(--error-bg); color: var(--error-text); padding: 14px 16px; border-radius: 4px;
}
.error code { font-family: var(--f-mono); }

/* ---------- layers: a small legend-like list ---------- */
.layers {
  position: fixed; z-index: 5;
  left: var(--gutter); top: calc(var(--top-h) + 18px + env(safe-area-inset-top, 0px));
  font-size: 0.84rem; color: var(--ink-2);
}
.layers summary { cursor: pointer; font: 500 0.72rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); list-style: none; padding: 4px 0; }
.layers summary::-webkit-details-marker { display: none; }
.layers summary::after { content: " +"; }
.layers[open] summary::after { content: " –"; }
.layers label { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 0; }
.layers input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.layers[open] { background: var(--veil); padding: 6px 12px 8px 0; box-shadow: 12px 0 0 var(--veil), -16px 0 0 var(--veil); }
body.touring .layers { display: none; }

/* ---------- narration (lower third) ---------- */
.narration {
  position: fixed; z-index: 5;
  left: 0; right: 0; bottom: 0;
  padding: 72px calc(var(--gutter) + 8px) calc(16px + env(safe-area-inset-bottom, 0px));
  /* a long, eased veil: solid behind the words, gone before it reaches the scene's subject */
  background: linear-gradient(to top, rgba(7, 8, 11, 0.96) 0%, rgba(7, 8, 11, 0.93) 50%, rgba(7, 8, 11, 0.8) 74%, rgba(7, 8, 11, 0.45) 89%, rgba(7, 8, 11, 0) 100%);
  pointer-events: none;
}
.narration > * { pointer-events: auto; }
.rail {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  font-size: 0.8rem; counter-reset: chapter;
}
.rail li { counter-increment: chapter; }
.rail button {
  font: inherit; color: var(--ink-2); background: none; border: 0; padding: 3px 0; cursor: pointer;
  border-bottom: 1px solid transparent; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  transition: color 0.15s, border-color 0.15s;
}
.rail button::before {
  content: counter(chapter, decimal-leading-zero); margin-right: 6px;
  font: 400 0.68rem var(--f-mono); color: var(--ink-3); letter-spacing: 0.04em;
}
.rail button:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.rail button[aria-current="step"] { color: var(--ink); border-bottom-color: var(--accent); }
.rail button[aria-current="step"]::before { color: var(--accent); }
.capgrid { display: grid; grid-template-columns: minmax(0, 58ch) minmax(0, 340px); gap: 36px; align-items: end; max-width: 1180px; }
@media (min-width: 981px) { .capgrid:has(.inset.wide) { grid-template-columns: minmax(0, 58ch) minmax(0, 420px); } }
.captext {
  margin: 0;
  font: 400 clamp(1.15rem, 0.95rem + 0.72vw, 1.5rem)/1.4 var(--f-display);
  color: var(--ink); text-wrap: pretty; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}
.captext .num { font-size: 0.86em; }
.capnav { display: flex; gap: 22px; margin-top: 14px; }
.capnav .quiet { margin-left: auto; }

.inset { display: grid; gap: 6px; }
.inset canvas { width: 100%; display: block; }
#insetSky { aspect-ratio: 1 / 1; width: min(100%, 200px); background: #000; border: 1px solid var(--rule); }
.inset[data-kind="strip"] #insetSky { width: min(100%, 150px); }
#insetStrip { height: 96px; }
.inset[data-kind="clue"] #insetStrip { height: 200px; }
.inset[data-kind="clue"] #insetStrip.single { height: 130px; }
.inset[data-kind="parallax"] .insetcap { order: 2; }
.caveat { grid-column: 1 / -1; margin: 10px 0 0; color: var(--ink-2); font-size: 0.82rem; line-height: 1.45; }
.card.gold .num, .ledger dd.gold { color: var(--accent); }
.insetcap { margin: 0; color: var(--ink-2); font: 400 0.76rem/1.4 var(--f-mono); }

/* result tallies (cards in the code; a ruled ledger on screen) */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--rule); }
.card {
  display: grid; gap: 1px; text-align: left; font: inherit; color: inherit;
  padding: 10px 12px 10px 0; background: none; border: 0; border-bottom: 1px solid var(--rule);
}
button.card { cursor: pointer; }
button.card:hover .what { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.card .num { font-size: 1.35rem; line-height: 1.15; color: var(--ink); }
.card.clue .num { color: var(--water); }
.card .what { font-size: 0.86rem; font-weight: 500; }
.card .why { color: var(--ink-2); font-size: 0.78rem; line-height: 1.35; }
.proofopen { grid-column: 1 / -1; justify-self: start; margin-top: 10px; }

/* ---------- details sheet ---------- */
.sheet {
  position: fixed; z-index: 7;
  right: 0; top: calc(var(--top-h) + 2px + env(safe-area-inset-top, 0px)); bottom: 0;
  width: min(400px, 100%);
  overflow: auto;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 11, 14, 0.975);
  border-left: 1px solid var(--rule);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.45);
  scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
}
.info h3, .detail h3 { font: 500 1.7rem/1.12 var(--f-display); margin: 4px 64px 12px 0; letter-spacing: -0.005em; }
.kind { margin: 0; color: var(--ink-2); font: 500 0.7rem/1.4 var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.story { margin: 0 0 12px; }
.label { margin: 0 0 12px; padding: 2px 0 2px 10px; font-size: 0.9rem; border-left: 2px solid var(--noclue); }
.label.flag { border-left-color: var(--water); }
canvas.strip { width: 100%; height: 120px; display: block; background: #000; border: 1px solid var(--rule); }
.caption { color: var(--ink-2); font-size: 0.8rem; margin: 6px 0 0; }
/* flipbook of real SPHEREx pictures */
.flip { margin: 18px 0 0; }
.fliphead, .info h4.fliphead { font: 500 0.7rem/1.4 var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); margin: 0 0 6px; }
.flipstage { width: min(100%, 288px); aspect-ratio: 1 / 1; background: #000; border: 1px solid var(--rule); }
.flipstage canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.flipmeta, .info p.flipmeta { margin: 6px 0 0; color: var(--ink-2); font: 400 0.76rem/1.4 var(--f-mono); }
.flipsw { display: inline-block; width: 9px; height: 9px; margin-right: 7px; }
.flipctl { display: flex; align-items: center; gap: 12px; width: min(100%, 288px); }
.detail .fliphead, .detail .flipmeta { color: var(--muted); }
.detail .flipstage { border-color: var(--line); }
.sci { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 8px; font-size: 0.84rem; color: var(--ink-2); }
.sci summary { cursor: pointer; font-weight: 500; color: var(--ink); }
.sci ul { margin: 8px 0 0; padding-left: 16px; display: grid; gap: 4px; font-family: var(--f-mono); font-size: 0.78rem; }
canvas.specplot { width: 100%; height: 200px; display: block; margin-top: 8px; }
.info h4 { font: 500 1.14rem/1.25 var(--f-display); margin: 22px 0 6px; }
.info p { margin: 0 0 8px; }
.info .small { color: var(--ink-2); font-size: 0.8rem; margin: 6px 0 2px; }
.names { margin: 0 0 8px; padding-left: 16px; columns: 2; column-gap: 16px; font-size: 0.84rem; }
.checks { list-style: none; margin: 6px 0 8px; padding: 0; display: grid; gap: 8px; font-size: 0.86rem; }
.checks li { padding-left: 10px; border-left: 2px solid var(--noclue); }
.checks li.ok { border-left-color: var(--water); }
.checks .verdict { display: block; font: 500 0.72rem/1.4 var(--f-mono); color: var(--ink-2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }
/* the distant-object test inside the evidence sheet */
.slowproof { margin-top: 26px; padding-top: 4px; border-top: 2px solid; border-image: var(--ramp) 1; scroll-margin-top: 8px; }
.ledger { display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0; border-top: 1px solid var(--rule); }
.ledger div { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--rule); }
.ledger dd { margin: 0; font: 400 1.2rem/1.2 var(--f-mono); font-variant-numeric: tabular-nums; }
.ledger dt { color: var(--ink-2); font-size: 0.8rem; margin-top: 2px; }
.caveats { margin: 4px 0 14px; padding-left: 18px; display: grid; gap: 6px; font-size: 0.88rem; }
.share { margin-top: 16px; display: grid; gap: 6px; }
.share .btn { justify-self: start; }
.sharefield { width: 100%; font: 0.78rem var(--f-mono); padding: 6px 8px; border: 1px solid var(--rule); background: #000; color: var(--ink); }

/* ---------- time track ---------- */
.timebar {
  position: fixed; z-index: 5;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  height: var(--time-h);
  display: flex; align-items: center; gap: 14px;
}
body.touring .timebar { display: none; }
.timebar output { color: var(--ink-2); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%; }
.ramprange { flex: 1; min-width: 0; -webkit-appearance: none; appearance: none; height: 18px; background: transparent; cursor: pointer; }
.ramprange::-webkit-slider-runnable-track { height: 2px; background: var(--ramp); }
.ramprange::-moz-range-track { height: 2px; background: var(--ramp); }
.ramprange::-webkit-slider-thumb { -webkit-appearance: none; width: 2px; height: 16px; margin-top: -7px; background: var(--ink); border: 0; }
.ramprange::-moz-range-thumb { width: 2px; height: 16px; background: var(--ink); border: 0; border-radius: 0; }

/* ---------- tooltips ---------- */
.tip {
  display: inline-grid; place-items: center;
  width: 1.1em; height: 1.1em; padding: 0; margin: 0 1px;
  border-radius: 50%; border: 1px solid currentColor;
  background: transparent; color: inherit; opacity: 0.7;
  font: 500 0.68em/1 var(--f-mono); vertical-align: 0.12em; cursor: help;
}
.tip[aria-expanded="true"] { background: var(--ink); color: var(--space); opacity: 1; }
.tooltip {
  position: fixed; z-index: 20; max-width: min(300px, calc(100vw - 24px));
  background: var(--tip-bg); color: var(--tip-text);
  padding: 8px 11px; border-radius: 3px; font-size: 0.84rem; line-height: 1.4;
}

/* ---------- data drawer (secondary, follows the viewer's theme) ---------- */
.drawer {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, 0.6); overflow: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) var(--gutter) calc(16px + env(safe-area-inset-bottom, 0px));
}
.drawerinner { max-width: 1180px; margin: 0 auto; background: var(--bg); color: var(--text); padding: 22px; border-radius: 4px; }
.drawerhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; position: relative; }
.drawerhead h2 { font: 500 1.6rem/1.15 var(--f-display); }
.drawerhead .close { position: static; color: var(--muted); }
.drawerinner .hint { color: var(--muted); margin: 6px 0 16px; max-width: 70ch; }
.drawerinner .btn { color: var(--text); border-color: var(--line); }
.drawerinner .link { color: var(--text); }
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0 0 18px; padding: 12px 0; border-block: 1px solid var(--line); }
.stats div { display: flex; flex-direction: column; max-width: 24ch; }
.stats dd { margin: 0; }
.stats dd.val { order: -1; font: 500 1.35rem/1.15 var(--f-mono); font-variant-numeric: tabular-nums; }
.stats dt { font-weight: 500; font-size: 0.88rem; }
.stats .why { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.explore { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 20px; }
.mapwrap { position: relative; background: #000; overflow: hidden; aspect-ratio: 1 / 1; max-height: 70vh; width: 100%; }
#sky { width: 100%; height: 100%; display: block; cursor: crosshair; }
.controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.controls output { color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 0.8rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.sw-rec { background: transparent; border: 1.5px solid var(--muted); }
.sw-cand { background: transparent; border: 1.5px solid var(--cand); border-radius: 1px; transform: rotate(45deg); width: 9px; height: 9px; }
.sw-band { background: var(--water); }
.sw-noband { background: var(--noclue); }
.sw-pending { background: var(--pending); }
.sidecol { min-width: 0; display: flex; flex-direction: column; }
.detail { color: var(--text); }
.detail .kind, .detail .caption, .detail .sci { color: var(--muted); }
.detail .sci summary { color: var(--text); }
.detail .sci { border-top-color: var(--line); }
.detail canvas.strip { border-color: var(--line); }
.detail .hint { color: var(--muted); }
.listhead { font: 500 0.72rem/1.4 var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 18px 0 6px; }
.tablewrap { overflow: auto; max-height: 40vh; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
th, td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--bg); }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.sel { background: var(--surface); }
tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.foot { color: var(--muted); font-size: 0.82rem; margin: 18px 0 0; max-width: 80ch; }

@media (prefers-reduced-motion: no-preference) {
  .captext { animation: fadein 0.5s ease-out; }
  .sheet { animation: slidein 0.25s ease-out; }
  @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
  @keyframes slidein { from { transform: translateX(12px); opacity: 0.6; } to { transform: none; opacity: 1; } }
}

/* ---------- tablets and phones ---------- */
@media (max-width: 980px) {
  .tagline { display: none; }
  .capgrid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .inset { max-width: 340px; }
}
@media (max-width: 720px) {
  :root { --top-h: 50px; }
  .brand h1 { font-size: 1.1rem; }
  .menubtn { display: inline-block; }
  .topactions {
    display: none;
    position: fixed; top: calc(var(--top-h) + 2px + env(safe-area-inset-top, 0px)); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 10px var(--gutter) 14px; background: rgba(7, 8, 11, 0.96); border-bottom: 1px solid var(--rule);
  }
  .topactions.open { display: flex; }
  .topactions .link { font-size: 0.95rem; padding: 8px 0; }
  .rail { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail li { flex: none; }
  .narration { max-height: 62%; overflow-y: auto; padding: 40px var(--gutter) calc(14px + env(safe-area-inset-bottom, 0px)); pointer-events: auto;
    background: linear-gradient(to top, rgba(7, 8, 11, 0.96) 0%, rgba(7, 8, 11, 0.92) 80%, rgba(7, 8, 11, 0) 100%); }
  .sheet { box-shadow: 0 -24px 48px rgba(0, 0, 0, 0.45); }
  .captext { font-size: 1.1rem; }
  .capnav { gap: 18px; }
  #insetSky { width: min(100%, 140px); }
  .inset[data-kind="clue"] #insetStrip { height: 170px; }
  .sheet { top: auto; height: 62%; width: 100%; border-left: 0; border-top: 1px solid var(--rule); }
  .layers { top: auto; bottom: calc(var(--time-h) + 22px + env(safe-area-inset-bottom, 0px)); }
  .timebar output { max-width: 38%; }
  .explore { grid-template-columns: 1fr; }
  .mapwrap { max-height: none; }
  .drawerinner { padding: 16px; }
}
.captext:focus { outline: none; }

/* ================= replay: the archived observation on a mission clock ================= */
:root { --rp-sky: clamp(230px, 21vw, 330px); --rp-panel: clamp(330px, 26vw, 400px); --rp-glass: rgba(10, 11, 15, 0.94); }

/* play glyph (a CSS triangle) and its pause twin */
.rpicon {
  display: inline-block; width: 0; height: 0; vertical-align: -1px; margin-right: 8px;
  border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.playing > .rpicon {
  width: 11px; height: 12px; border: 0; margin: 0;
  background: linear-gradient(90deg, currentColor 0 36%, transparent 36% 64%, currentColor 64%);
}

/* the top-bar entry and the calls to action */
.rpbtn { color: var(--accent); }
.rpbtn[aria-pressed="true"] { border-bottom-color: var(--accent); }
.cta {
  display: inline-grid; grid-template-columns: auto auto; column-gap: 2px; align-items: center; justify-content: start;
  padding: 9px 20px 9px 16px; cursor: pointer; text-align: left;
  font: 600 0.95rem/1.2 var(--f-body); color: var(--ink); letter-spacing: 0.005em;
  background: rgba(242, 193, 78, 0.12); border: 1px solid rgba(242, 193, 78, 0.75); border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(242, 193, 78, 0.35);
  transition: background 0.15s, border-color 0.15s;
}
.cta:hover { background: rgba(242, 193, 78, 0.22); border-color: var(--accent); }
.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cta .rpicon { grid-row: span 2; color: var(--accent); border-left-width: 12px; border-top-width: 7px; border-bottom-width: 7px; margin-right: 12px; }
.cta small { grid-column: 2; font: 400 0.72rem/1.3 var(--f-mono); color: var(--ink-2); letter-spacing: 0.01em; }
.capnav { align-items: center; flex-wrap: wrap; }
.capnav .cta { margin-left: 8px; }
.cta.floating { background-color: rgba(20, 17, 9, 0.88); position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(var(--time-h) + 26px + env(safe-area-inset-bottom, 0px)); }
body.touring .cta.floating, body.replaying .cta.floating, body.drawer-open .cta.floating { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .cta { animation: rp-beckon 3.2s ease-out 1.5s 3; }
  @keyframes rp-beckon { 0% { box-shadow: 0 0 0 0 rgba(242, 193, 78, 0.4); } 70%, 100% { box-shadow: 0 0 0 14px rgba(242, 193, 78, 0); } }
}

/* while replaying, the replay owns the screen around the 3D scene */
body.replaying .timebar, body.replaying .layers { display: none; }
.replay { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.replay > * { pointer-events: auto; }
.rpglass, .rpsky, .rppanel, .rpclock {
  background: var(--rp-glass); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}
.rplabel { font: 500 0.68rem/1.3 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.rptag {
  display: inline-block; font: 600 0.64rem/1 var(--f-mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: #15120a; background: var(--accent); padding: 4px 6px 3px; border-radius: 2px; white-space: nowrap;
}
.replay :is(button, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the one-line notice: archived, replayed, not live */
.rpnotice {
  position: absolute; top: calc(var(--top-h) + 14px + env(safe-area-inset-top, 0px));
  left: calc(var(--gutter) + var(--rp-sky) + 18px); right: calc(var(--gutter) + var(--rp-panel) + 18px);
  width: fit-content; margin-inline: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 9px; font-size: 0.85rem; line-height: 1.35;
  background: rgba(14, 14, 18, 0.93); border: 1px solid rgba(242, 193, 78, 0.45); border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.rpnotice p { margin: 0; }
.rpnotice .link { white-space: nowrap; color: var(--accent); }

/* the sky panel */
.rpsky {
  position: absolute; margin: 0; left: var(--gutter); top: calc(var(--top-h) + 14px + env(safe-area-inset-top, 0px));
  width: var(--rp-sky); padding: 11px 12px 12px;
}
.rpskyhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.rpskystate { font: 500 0.62rem/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.rpskystate.on { color: var(--accent); }
.rpskystate.on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; box-shadow: 0 0 8px var(--accent); }
.rpskywrap { aspect-ratio: 1 / 1; background: #000; border-radius: 3px; overflow: hidden; }
#rpSky { width: 100%; height: 100%; display: block; cursor: crosshair; }
.rpwl { display: flex; align-items: center; gap: 8px; margin-top: 9px; font: 400 0.62rem/1 var(--f-mono); color: var(--ink-3); }
.rpwl .ramp { flex: 1; height: 3px; border-radius: 2px; }
.rpskycap { margin: 8px 0 0; color: var(--ink-2); font-size: 0.74rem; line-height: 1.42; }

/* the "Now tracking" panel */
.rppanel {
  position: absolute; right: var(--gutter); top: calc(var(--top-h) + 14px + env(safe-area-inset-top, 0px));
  bottom: calc(var(--rp-clock, 112px) + 26px + env(safe-area-inset-bottom, 0px));
  width: var(--rp-panel); display: flex; flex-direction: column; overflow: hidden;
}
.rphandle { display: none; }
.rphead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px 0; }
.rphead .rplabel { color: var(--ink); }
.rpheadnote { font: 400 0.64rem/1 var(--f-mono); color: var(--ink-3); letter-spacing: 0.04em; }
.rpcounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 10px; margin: 0; padding: 10px 14px 12px; border-bottom: 1px solid var(--rule); }
.rpcounts div { display: flex; flex-direction: column; min-width: 0; }
.rpcounts dd { margin: 0; order: -1; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rpcounts dd b { font-weight: 500; font-size: 1.22rem; color: var(--ink); }
.rpcounts dd span { font-size: 0.72rem; color: var(--ink-3); }
.rpcounts dt { font-size: 0.66rem; line-height: 1.25; color: var(--ink-2); margin-top: 2px; }
.rpbody { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
.rplist { list-style: none; margin: 0; padding: 0; }
.rprow, .rplisthead {
  display: grid; grid-template-columns: 9px minmax(0, 1fr) 50px 44px 40px; gap: 9px; align-items: center;
  width: 100%; padding: 6px 14px; text-align: left;
}
.rplisthead { padding-top: 9px; padding-bottom: 5px; font: 400 0.6rem/1.2 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.rplisthead span:nth-child(n+4) { text-align: right; }
.rprow {
  --glow: 0; --flash: var(--accent);
  font: inherit; color: var(--ink); cursor: pointer; border: 0; border-bottom: 1px solid var(--rule);
  background: linear-gradient(90deg, color-mix(in srgb, var(--flash) calc(var(--glow) * 42%), transparent), color-mix(in srgb, var(--flash) calc(var(--glow) * 8%), transparent) 85%);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--flash) calc(var(--glow) * 100%), transparent);
  transition: opacity 0.5s;
}
.rprow:hover { background-color: rgba(236, 232, 226, 0.04); }
.rprow[data-state="waiting"] { opacity: 0.42; }
.rprow[aria-pressed="true"] { background-color: rgba(242, 193, 78, 0.09); box-shadow: inset 2px 0 0 var(--accent); }
.rpchip {
  width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink-3);
  box-shadow: 0 0 calc(var(--glow) * 12px) calc(var(--glow) * 2px) var(--flash);
}
.rprow:not([data-state="waiting"]) .rpchip { border-color: transparent; }
.rpwho { min-width: 0; display: flex; flex-direction: column; }
.rpname { font-weight: 600; font-size: 0.86rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpstatus { font-size: 0.68rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.rpbadge {
  font: 500 0.56rem/1 var(--f-mono); font-style: normal; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 4px 1px; margin-right: 6px; border-radius: 2px; vertical-align: 1px;
}
.rpbadge.rec { color: var(--real); border: 1px solid rgba(143, 209, 158, 0.42); }
.rpbadge.cand { color: #b9a4ff; border: 1px solid rgba(157, 125, 255, 0.5); }
.rpspark { width: 50px; height: 24px; display: block; }
.rpn { font: 400 0.76rem/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); text-align: right; white-space: nowrap; }
.rpn b { font-weight: 500; color: var(--ink); }
.rprow[data-state="done"] .rpn b { color: var(--accent); }
.rprate { font: 400 0.74rem/1 var(--f-mono); color: var(--ink-2); text-align: right; white-space: nowrap; }
.rprate small { color: var(--ink-3); font-size: 0.66rem; }
.rppick { flex: none; padding: 12px 14px; border-top: 1px solid var(--rule); background: rgba(255, 255, 255, 0.02); }
.rphint { margin: 0; font-size: 0.78rem; color: var(--ink-2); }
.rppickgrid { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: start; }
.rpstamp { position: relative; aspect-ratio: 1 / 1; background: #000; border: 1px solid var(--rule); border-radius: 2px; }
.rpstamp canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.rpstampnote { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; text-align: center; font: 400 0.62rem/1.3 var(--f-mono); color: var(--ink-3); pointer-events: none; }
.rppicktext h3 { font: 500 1.12rem/1.15 var(--f-display); margin: 2px 0 4px; }
.rpstampmeta { margin: 0 0 6px; font: 400 0.68rem/1.45 var(--f-mono); color: var(--ink-2); }
.rpverdict { margin: 0 0 8px; font-size: 0.74rem; line-height: 1.4; color: var(--ink-2); }
.btn.small { padding: 5px 10px; font-size: 0.76rem; }
.rpfoot { margin: 0; padding: 10px 14px 14px; font-size: 0.7rem; line-height: 1.4; color: var(--ink-3); }

/* the mission clock */
.rpclock {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding: 11px 16px 6px;
}
.rpclockrow { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.rpwhen { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; row-gap: 2px; min-width: 0; }
.rpdate { font: 400 1.55rem/1.1 var(--f-display); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpdate small { font: 500 0.68rem/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin-right: 4px; vertical-align: 0.3em; }
.rpsub { grid-column: 2; font: 400 0.74rem/1.35 var(--f-mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpsub.on { color: var(--ink-2); }
.rpctl { display: flex; align-items: center; gap: 14px; flex: none; }
.rpplay {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0;
  background: rgba(242, 193, 78, 0.14); border: 1px solid var(--accent); color: var(--accent);
}
.rpplay:hover { background: rgba(242, 193, 78, 0.26); }
.rpplay .rpicon { margin: 0 0 0 3px; border-left-width: 13px; border-top-width: 8px; border-bottom-width: 8px; }
.rpplay.playing .rpicon { margin: 0; width: 13px; height: 15px; }
.rpspeeds { display: flex; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.rpspeeds button {
  font: 500 0.76rem/1 var(--f-mono); color: var(--ink-2); background: none; border: 0; padding: 8px 10px; cursor: pointer;
  min-width: 40px; min-height: 32px;
}
.rpspeeds button + button { border-left: 1px solid var(--rule); }
.rpspeeds button:hover { color: var(--ink); }
.rpspeeds button[aria-pressed="true"] { color: var(--accent); background: rgba(242, 193, 78, 0.14); }
.rptimeline { position: relative; height: 48px; margin-top: 4px; }
.rpticks { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rprange { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.rprange::-webkit-slider-runnable-track { height: 48px; background: transparent; }
.rprange::-moz-range-track { height: 48px; background: transparent; }
.rprange::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 44px; margin-top: 0; border: 0;
  background: radial-gradient(circle at 50% 36px, var(--accent) 0 4px, transparent 4.5px), linear-gradient(90deg, transparent 8px, var(--ink) 8px 10px, transparent 10px);
}
.rprange::-moz-range-thumb {
  width: 18px; height: 44px; border: 0; border-radius: 0;
  background: radial-gradient(circle at 50% 36px, var(--accent) 0 4px, transparent 4.5px), linear-gradient(90deg, transparent 8px, var(--ink) 8px 10px, transparent 10px);
}
.rprange:focus-visible { outline-offset: -2px; }

@media (max-width: 1100px) and (min-width: 721px) {
  .rpskycap { display: none; }
  .rpdate { font-size: 1.3rem; }
}

/* phones: the sky shrinks to an inset, the tracking panel becomes a bottom sheet with the clock riding on it */
@media (max-width: 720px) {
  .cta.floating { white-space: nowrap; bottom: calc(var(--time-h) + 22px + env(safe-area-inset-bottom, 0px)); }
  .capnav .cta { margin-left: 0; order: 5; flex-basis: 100%; justify-self: start; width: fit-content; }
  .rpnotice { left: var(--gutter); right: var(--gutter); top: calc(var(--top-h) + 10px + env(safe-area-inset-top, 0px)); width: auto; font-size: 0.78rem; gap: 10px; align-items: flex-start; }
  .rpnotice .rptag { display: none; }
  .rpsky { left: auto; right: var(--gutter); width: 132px; padding: 6px; top: calc(var(--top-h) + 10px + env(safe-area-inset-top, 0px)); }
  .replay:has(.rpnotice:not([hidden])) .rpsky { top: calc(var(--top-h) + 96px + env(safe-area-inset-top, 0px)); }
  .rpskyhead { margin-bottom: 5px; }
  .rpskyhead .rplabel, .rpskycap { display: none; }
  .rpwl { margin-top: 5px; gap: 4px; font-size: 0.55rem; }
  .rppanel {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 64%;
    border-radius: 12px 12px 0 0; border-bottom: 0; border-left: 0; border-right: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .rphead { display: none; }
  .rphandle {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px var(--gutter) 4px;
    background: none; border: 0; color: var(--ink); cursor: pointer; font: inherit; text-align: left;
  }
  .rphandle .rplabel { color: var(--ink); }
  .rphandlecount { font: 400 0.7rem/1 var(--f-mono); color: var(--ink-3); }
  .rpchev { margin-left: auto; width: 8px; height: 8px; border-left: 1.5px solid var(--ink-2); border-top: 1.5px solid var(--ink-2); transform: rotate(45deg) translate(2px, 2px); }
  .rppanel.open .rpchev { transform: rotate(225deg) translate(2px, 2px); }
  .rpcounts { padding: 4px var(--gutter) 10px; gap: 0 8px; border-bottom: 0; }
  .rppanel.open .rpcounts { border-bottom: 1px solid var(--rule); }
  .rpcounts dd b { font-size: 1.02rem; }
  .rpcounts dd span { font-size: 0.64rem; }
  .rpcounts dt { font-size: 0.6rem; }
  .rpbody, .rppanel:not(.open) .rppick { display: none; }
  .rppanel.open .rpbody { display: block; }
  .rprow, .rplisthead { grid-template-columns: 9px minmax(0, 1fr) 48px 42px 36px; gap: 8px; padding-inline: var(--gutter); }
  .rpspark { width: 48px; }
  .rppick { padding-inline: var(--gutter); }
  .rpclock {
    left: 0; right: 0; bottom: var(--rp-sheet, 96px); border-radius: 10px 10px 0 0; border-bottom: 0; border-left: 0; border-right: 0;
    padding: 9px var(--gutter) 2px; box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.35);
  }
  .rpclockrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "tag ctl" "date date" "sub sub"; gap: 4px 10px; align-items: center; }
  .rpwhen { display: contents; }
  .rpwhen .rptag { grid-area: tag; justify-self: start; }
  .rpdate { grid-area: date; font-size: 1.14rem; }
  .rpsub { grid-area: sub; font-size: 0.66rem; }
  .rpctl { grid-area: ctl; gap: 8px; }
  .rpplay { width: 38px; height: 38px; }
  .rpspeeds button { min-width: 34px; padding: 6px 6px; font-size: 0.72rem; }
  #rpExit { font-size: 0.8rem; }
  .rptimeline { margin-top: 0; }
}
.cta.floating:hover { background-color: rgba(58, 46, 18, 0.95); }

/* replay fixes: the list's footnote stays whole at the foot of the scrolling list, and the
   phone sky inset keeps its state label inside its frame */
.replay .rpfoot { position: sticky; bottom: 0; background: rgb(10, 12, 18); border-top: 1px solid var(--rule); }
@media (max-width: 720px) {
  .replay .rpsky .rpskyhead { min-width: 0; }
  .replay .rpsky .rpskystate { font-size: 0.54rem; letter-spacing: 0.05em; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}

/* ================= science desk: library, candidate review, downloads ================= */
a.link { text-decoration: none; display: inline-block; }
@media (min-width: 721px) {
  .topactions .link, .topactions .tag { white-space: nowrap; }
  .topbar .brand { flex: 1 1 auto; }
  .topactions { flex: none; }
}
#proofBtn .short { display: none; }
@media (min-width: 721px) and (max-width: 1180px) { #proofBtn .short { display: inline; } }
@media (min-width: 721px) and (max-width: 1440px) {
  .topactions { gap: 16px; }
  #reviewBtn { display: none; }             /* still one tab away inside the desk */
}
@media (min-width: 721px) and (max-width: 1180px) {
  .topactions { gap: 13px; }
  .topactions .link { font-size: 0.8rem; }
  #proofBtn .long { display: none; }
  .tag { font-size: 0.64rem; }
  #sciBtn .xs { display: none; }
}
.crosslink { margin: 14px 0 0; }
a.btn { display: inline-block; text-decoration: none; }
.btn.quiet { color: var(--ink-2); }
.btn:disabled { color: var(--ink-3); border-color: var(--rule); cursor: default; }
.drawerlinks { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }

body.desk-open .timebar, body.desk-open .layers, body.desk-open .cta.floating { display: none; }
.desk {
  position: fixed; z-index: 5; inset: calc(var(--top-h) + 2px + env(safe-area-inset-top, 0px)) 0 0 0;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, rgba(242, 193, 78, 0.035), transparent 70%), rgba(8, 9, 12, 0.975);
  scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
}
.deskbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1240px; margin: 0 auto; padding: 10px 28px 0;
  background: linear-gradient(to bottom, rgba(8, 9, 12, 0.98) 70%, rgba(8, 9, 12, 0));
}
.desktabs { display: flex; gap: 26px; overflow-x: auto; scrollbar-width: none; }
.desktabs::-webkit-scrollbar { display: none; }
.desktabs a {
  flex: none; padding: 8px 0 9px; color: var(--ink-2); text-decoration: none;
  font: 500 0.7rem/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
  border-bottom: 1.5px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.desktabs a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.desktabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.deskbar .close { position: static; flex: none; }
.deskbody { max-width: 1240px; margin: 0 auto; padding: 8px 28px calc(56px + env(safe-area-inset-bottom, 0px)); }
.desk a { color: var(--ink); text-decoration-color: rgba(242, 193, 78, 0.6); text-underline-offset: 3px; }
.desk a:hover { text-decoration-color: var(--accent); }
.desk :is(a, button, select, summary, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.desk h3 { font: 500 1.18rem/1.25 var(--f-display); margin: 0 0 10px; }
.desk h4 { font: 500 0.68rem/1.3 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 22px 0 6px; }
.desk p { margin: 0 0 10px; max-width: 75ch; }
.desk .note { color: var(--ink-2); font-size: 0.8rem; line-height: 1.5; }
.desk .small { color: var(--ink-2); font-size: 0.8rem; margin: 10px 0 4px; }
.desk .empty { color: var(--ink-2); padding: 28px 0; }

.dhead { padding: 22px 0 18px; }
.kicker { margin: 0 0 6px; font: 500 0.7rem/1.4 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.dhead h2 { font: 400 clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem)/1.1 var(--f-display); letter-spacing: -0.01em; margin: 0 0 12px; max-width: 30ch; }
.dhead h2 small { font: 400 0.9rem var(--f-mono); color: var(--ink-3); letter-spacing: 0; vertical-align: 0.35em; }
.dhead h2:focus { outline: none; }
.lede { color: var(--ink-2); font-size: 0.98rem; line-height: 1.55; }
.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-top: 18px; font-size: 0.8rem; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.crumbnav { margin-left: auto; display: flex; gap: 18px; }
.desk .crumbnav a { text-decoration: none; color: var(--ink-2); }
.desk .crumbnav a:hover { color: var(--ink); }

/* verdict words: water blue for a clue, warm grey for "no dip", dim for "could not tell" */
.vtag {
  display: inline-block; margin-right: 10px; padding: 3px 7px 2px; border-radius: 2px; vertical-align: 1px;
  font: 600 0.62rem/1.2 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid currentColor;
}
.verdictline { font-size: 1rem; padding-left: 12px; border-left: 2px solid var(--pending); color: var(--ink); }
.verdictline.v-clue { border-left-color: var(--water); }
.verdictline.v-clue .vtag { color: var(--water); }
.verdictline.v-nodip { border-left-color: var(--noclue); }
.verdictline.v-nodip .vtag { color: var(--noclue); }
.verdictline.v-unknown .vtag { color: var(--ink-2); }
.lc-verdict { font: 500 0.78rem/1.3 var(--f-body); display: inline-flex; align-items: baseline; gap: 8px; }
.lc-verdict::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; align-self: center; background: var(--pending); }
.lc-verdict.v-clue { color: var(--water); }
.lc-verdict.v-clue::before { background: var(--water); }
.lc-verdict.v-nodip::before { background: var(--noclue); }
.lc-verdict.v-unknown { color: var(--ink-2); }
.lc-verdict.v-unknown::before { background: transparent; border: 1px solid var(--ink-3); }
.lc-verdict .mono { font-size: 0.72rem; color: var(--ink-3); }

/* scorecard: a ruled ledger */
.score { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 0 0 26px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.score > div { padding: 16px 20px 14px 0; display: flex; flex-direction: column; }
.score > div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.score dd { order: -1; margin: 0 0 4px; font: 400 1.9rem/1.05 var(--f-display); color: var(--ink); }
.score dd small { font: 400 0.95rem var(--f-mono); color: var(--ink-3); }
.score > div:first-child dd { color: var(--accent); }
.score > div.pending dd { font-style: italic; color: var(--ink-2); font-size: 1.55rem; }
.score dt { font-weight: 600; font-size: 0.86rem; margin-bottom: 4px; }
.score p { margin: 0; color: var(--ink-2); font-size: 0.78rem; line-height: 1.45; }

/* filters */
.libtools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin: 0 0 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 0.78rem/1.2 var(--f-body); color: var(--ink-2); background: none; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; min-height: 32px;
  display: inline-flex; align-items: center; gap: 6px; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip span { font: 400 0.7rem var(--f-mono); color: var(--ink-3); }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { color: var(--ink); border-color: rgba(242, 193, 78, 0.7); background: rgba(242, 193, 78, 0.1); }
.chip:disabled { opacity: 0.4; cursor: default; }
.sortsel { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--ink-2); }
.sortsel select { font: 500 0.8rem var(--f-body); color: var(--ink); background: #0d0e12; border: 1px solid var(--rule); border-radius: 3px; padding: 6px 8px; min-height: 32px; }
.libtools .btn { margin-left: auto; }

/* small multiples */
.libgrid { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.libcard {
  display: grid; gap: 7px; padding: 12px 12px 11px; height: 100%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.022); border: 1px solid var(--rule); border-radius: 6px;
  transition: border-color 0.15s, background 0.15s;
}
.desk a.libcard { text-decoration: none; }
.libcard:hover { border-color: rgba(242, 193, 78, 0.55); background: rgba(242, 193, 78, 0.035); }
.lc-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lc-num { font: 400 0.74rem var(--f-mono); color: var(--ink-3); }
.lc-name { font: 500 1.12rem/1.15 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-type { margin-left: auto; font: 500 0.66rem/1 var(--f-mono); color: var(--ink-2); border: 1px solid var(--rule); border-radius: 2px; padding: 3px 5px 2px; }
canvas.libmini { width: 100%; height: 108px; display: block; background: #050608; border-radius: 3px; }
.lc-meta { display: flex; justify-content: space-between; gap: 8px; font: 400 0.7rem/1.3 var(--f-mono); color: var(--ink-3); }
.lc-cal { font-size: 0.7rem; color: var(--ink-3); }
.lc-cal.c-agree { color: var(--real); }
.lc-cal.c-disagree { color: #f0a08f; }

/* detail */
.spec { margin: 4px 0 26px; }
.spechead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.spechead h3 { margin: 0; }
.seg { display: flex; gap: 6px; }
canvas.libspec { width: 100%; height: 380px; display: block; background: #050608; border: 1px solid var(--rule); border-radius: 4px; margin-bottom: 8px; }
canvas.libspec.tall { height: 440px; }
.dgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.dgrid > section { padding: 20px 24px 8px 0; min-width: 0; }
.dgrid > section + section { padding-left: 24px; border-left: 1px solid var(--rule); }
canvas.libvisits { width: 100%; height: 170px; display: block; background: #050608; border-radius: 3px; margin-bottom: 8px; }
.facts { display: grid; margin: 10px 0 14px; border-top: 1px solid var(--rule); }
.facts div { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 0.82rem; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.calstate { margin-bottom: 6px; }
.calstate .vtag { color: var(--ink-2); margin: 0; }
.calstate.c-agree .vtag { color: var(--real); }
.calstate.c-disagree .vtag { color: #f0a08f; }
.sizes { display: grid; gap: 10px; margin: 6px 0 12px; }
.szrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.szlab { grid-column: 1 / -1; font-size: 0.76rem; color: var(--ink-2); }
.sztrack { position: relative; height: 10px; background: rgba(236, 232, 226, 0.06); border-radius: 2px; }
.szbar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--ink-3); }
.szrow.ours .szbar { background: linear-gradient(90deg, #d9472f, #f08a35 60%, #f2c14e); }
.szerr { position: absolute; top: -3px; bottom: -3px; border-left: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.szval { font-size: 0.78rem; min-width: 5ch; text-align: right; }
.orbitrow { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 12px; }
.orbitrow .facts { margin: 0; }
.orbitsvg { width: 128px; height: 128px; display: block; }
.orbitsvg .o-planet { fill: none; stroke: rgba(200, 210, 235, 0.28); stroke-width: 0.6; }
.orbitsvg .o-belt { fill: none; stroke: rgba(200, 210, 235, 0.05); }
.orbitsvg .o-path { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.orbitsvg .o-sun { fill: #ffcf5c; }
.orbitsvg .o-lab { fill: var(--ink-2); font: 8px var(--f-mono); }
.dgrid h3:not(:first-child) { margin-top: 24px; }
.cmplinks { display: flex; flex-wrap: wrap; gap: 8px; }
.expert { margin-top: 26px; }
.desk .sci summary { font-size: 0.9rem; }
.cmpchips { margin: 0 0 14px; }
.cmpsw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cmplegend { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 0.86rem; }
.cmplegend li { display: flex; align-items: center; gap: 8px; }
.cmplegend .mono { font-size: 0.72rem; color: var(--ink-3); }

/* candidate review */
.tally { padding: 14px 16px; margin: 0 0 22px; border: 1px solid var(--rule); border-radius: 6px; background: rgba(255, 255, 255, 0.02); }
.tally > p:first-child { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.tl { font-size: 0.82rem; color: var(--ink-2); }
.tl b { font: 500 0.9rem var(--f-mono); color: var(--ink); }
.tallyact { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 8px; }
.tally .copyfield { height: 120px; resize: vertical; margin-bottom: 8px; }
.desk .privacy { color: var(--ink-2); font-size: 0.76rem; margin: 0; }
.candgrid { list-style: none; margin: 0 0 30px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.candcard { display: grid; gap: 8px; align-content: start; padding: 10px 10px 12px; height: 100%; color: var(--ink); background: rgba(255, 255, 255, 0.022); border: 1px solid var(--rule); border-radius: 6px; transition: border-color 0.15s; }
.desk a.candcard { text-decoration: none; }
.candcard:hover { border-color: rgba(157, 125, 255, 0.6); }
.cc-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.cc-strip canvas { width: 100%; aspect-ratio: 1 / 1; display: block; image-rendering: pixelated; background: #000; }
.cc-none { grid-column: 1 / -1; padding: 20px 0; text-align: center; color: var(--ink-3); font-size: 0.76rem; }
.cc-head { display: flex; align-items: center; gap: 8px; }
.cc-id { font: 500 1.05rem var(--f-mono); }
.gtag { font: 600 0.6rem/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 6px 2px; border-radius: 2px; color: #b9a4ff; border: 1px solid rgba(157, 125, 255, 0.5); }
.dhead h2 .gtag { font-size: 0.66rem; vertical-align: 0.5em; }
.gtag.g-plausible { color: var(--real); border-color: rgba(143, 209, 158, 0.5); }
.cc-verdict { font-size: 0.8rem; color: var(--ink-2); line-height: 1.4; }
.cc-mine { font: 500 0.72rem var(--f-mono); color: var(--ink-3); }
.cc-mine.t-real, .tl.t-real b { color: var(--real); }
.cc-mine.t-unsure, .tl.t-unsure b { color: var(--accent); }
.cc-mine.t-noise, .tl.t-noise b { color: #f0a08f; }
.rvgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; margin-bottom: 30px; }
.rvpics .flip { margin: 0; }
.rvpics .flipstage, .rvpics .flipctl { width: min(100%, 420px); }
.filmstrip { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; max-width: 520px; }
.film { padding: 0; background: none; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; width: 62px; display: grid; }
.film canvas { width: 60px; height: 60px; display: block; image-rendering: pixelated; }
.film span { font: 400 0.6rem/1.6 var(--f-mono); color: var(--ink-2); border-top: 2px solid var(--c); }
.film[aria-pressed="true"] { border-color: var(--accent); }
.answer { padding: 16px; border: 1px solid rgba(242, 193, 78, 0.35); border-radius: 6px; background: rgba(242, 193, 78, 0.03); margin-bottom: 22px; }
.ansbtns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.ans {
  font: 600 0.86rem/1.2 var(--f-body); color: var(--ink); background: rgba(255, 255, 255, 0.03); cursor: pointer;
  border: 1px solid var(--rule); border-radius: 4px; padding: 12px 8px; min-height: 46px; transition: border-color 0.15s, background 0.15s;
}
.ans:hover { border-color: var(--ink-3); }
.ans.a-real[aria-pressed="true"] { border-color: var(--real); background: rgba(143, 209, 158, 0.13); color: var(--real); }
.ans.a-unsure[aria-pressed="true"] { border-color: var(--accent); background: rgba(242, 193, 78, 0.13); color: var(--accent); }
.ans.a-noise[aria-pressed="true"] { border-color: #f0a08f; background: rgba(240, 160, 143, 0.12); color: #f0a08f; }
.answer .tally { margin: 0; padding: 0; border: 0; background: none; }
.concerns { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.concerns li { padding-left: 12px; border-left: 2px solid rgba(157, 125, 255, 0.6); font-size: 0.88rem; }
.plainfacts { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 0.86rem; color: var(--ink-2); }
.guides { margin: 0 0 24px; padding-top: 18px; border-top: 1px solid var(--rule); }
.guidegrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.guide { margin: 0; }
.guide canvas { width: 100%; height: 86px; display: block; margin-bottom: 8px; }
.guide figcaption { font-size: 0.82rem; color: var(--ink-2); line-height: 1.45; }
.guide strong { color: var(--ink); font-weight: 600; }
.desk .tablewrap.dark { max-height: none; margin: 10px 0; border: 1px solid var(--rule); border-radius: 4px; }
.desk table { font-size: 0.8rem; }
.desk th { background: #0f1014; color: var(--ink-2); font: 500 0.66rem/1.3 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.desk th, .desk td { border-bottom-color: var(--rule); padding: 8px 10px; vertical-align: top; }
.desk tbody tr { cursor: default; }
.desk tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.dettable td { font-family: var(--f-mono); font-size: 0.74rem; }

/* downloads */
.dsec { padding: 22px 0 10px; border-top: 1px solid var(--rule); }
.dhead + .dsec { border-top: 0; padding-top: 0; }
.futable td small { display: block; color: var(--ink-3); font-size: 0.68rem; margin-top: 2px; }
.futable td.why { white-space: normal; min-width: 260px; max-width: 420px; }
.futable td.why summary { cursor: pointer; color: var(--ink); }
.futable td.why details[open] summary { margin-bottom: 4px; color: var(--ink-2); }
.futable td.why details { color: var(--ink-2); font-size: 0.78rem; line-height: 1.45; }
.reach { font: 500 0.7rem var(--f-mono); padding: 2px 6px; border-radius: 2px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.reach.r-yes { color: var(--real); border-color: rgba(143, 209, 158, 0.5); }
.reach.r-marginal { color: var(--accent); border-color: rgba(242, 193, 78, 0.5); }
.fnotes { margin: 6px 0 14px; padding-left: 18px; display: grid; gap: 5px; font-size: 0.82rem; color: var(--ink-2); max-width: 85ch; }
.desk .draftbanner {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 0 0 14px; max-width: none;
  border: 1px solid rgba(242, 193, 78, 0.55); border-left-width: 3px; border-radius: 4px; background: rgba(242, 193, 78, 0.07);
  font-weight: 600; font-size: 0.95rem;
}
.dsec .facts { max-width: 640px; }
.files { list-style: none; margin: 4px 0 12px; padding: 0; border-top: 1px solid var(--rule); }
.file { display: grid; grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) auto; gap: 4px 18px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.desk a.fname { color: var(--accent); font-size: 0.82rem; text-decoration: none; }
.desk a.fname:hover { text-decoration: underline; }
.fname::after { content: " ↓"; color: var(--ink-3); }
.fwhat { font-size: 0.84rem; color: var(--ink-2); }
.fmeta { font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; text-align: right; }
.cite { padding-bottom: 0; }

@media (max-width: 980px) {
  .dgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dgrid > section:nth-child(3) { grid-column: 1 / -1; padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .rvgrid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}
@media (max-width: 720px) {
  .deskbar { padding: 6px var(--gutter) 0; gap: 10px; }
  .desktabs { gap: 18px; }
  .desktabs .xs { display: none; }
  .deskbody { padding: 4px var(--gutter) calc(40px + env(safe-area-inset-bottom, 0px)); }
  .dhead { padding: 14px 0 12px; }
  .score { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .score > div { padding: 12px 10px 12px 0; }
  .score > div + div { padding-left: 0; border-left: 0; }
  .score > div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--rule); }
  .score > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .score dd { font-size: 1.5rem; }
  .score > div.pending dd { font-size: 1.2rem; }
  .libgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .libcard { padding: 9px 9px 8px; gap: 5px; }
  .lc-name { font-size: 0.98rem; }
  canvas.libmini { height: 84px; }
  .lc-meta { flex-direction: column; gap: 0; font-size: 0.64rem; }
  .lc-cal { font-size: 0.64rem; }
  .lc-verdict { font-size: 0.72rem; flex-wrap: wrap; gap: 2px 6px; }
  .libtools { gap: 10px; }
  .libtools .btn { margin-left: 0; }
  canvas.libspec { height: 270px; }
  canvas.libspec.tall { height: 320px; }
  .dgrid { grid-template-columns: minmax(0, 1fr); }
  .dgrid > section, .dgrid > section + section, .dgrid > section:nth-child(3) { padding: 18px 0 6px; border-left: 0; }
  .dgrid > section + section { border-top: 1px solid var(--rule); }
  .crumbnav { margin-left: 0; width: 100%; justify-content: space-between; }
  .candgrid { grid-template-columns: minmax(0, 1fr); }
  .guidegrid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .guide { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; }
  .guide canvas { height: 46px; margin: 0; }
  .ansbtns { gap: 6px; }
  .ans { font-size: 0.8rem; padding: 10px 4px; }
  .file { grid-template-columns: minmax(0, 1fr) auto; }
  .fwhat { grid-column: 1 / -1; grid-row: 2; }
}
