/* TENGER design system (task R1). One set of tokens; every colour pair used for text is checked in
   tests/contrast.test.mjs. Fonts are self-hosted (static/fonts/, SIL OFL 1.1). Spacing on an 8 px grid,
   12 px radius, one shadow. Motion is short and switched off under prefers-reduced-motion. */

@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../fonts/space-grotesk-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #05070d;
  --panel: #0a0f1a;
  --glass: rgba(10, 15, 26, 0.85);
  --raise: #111a2b;
  --border: #1e2738;
  --border-strong: #2e3b52;
  --text: #e6edf7;
  --muted: #8d9bb0;
  --accent: #5cc8ff;
  --accent-rgb: 92, 200, 255;
  --on-accent: #05070d;
  --star: #ffe08a;
  --variable: #c9a0ff;
  --solar: #5cc8ff;
  --hypothetical: #ffa94d;
  --other: #c8d2e3;
  --hit: #5fd38d;
  --miss: #ffb547;
  --waiting: #8d9bb0;
  --bad: #ff8f8f;
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s6: 48px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --blur: blur(16px) saturate(140%);
  --tap: 44px;
  --topbar: 56px;
  --banner: 0px;
  --chrome: calc(var(--topbar) + var(--banner));
  --rail-w: 340px;
  --panel-w: 420px;
  --ease: 200ms ease-out;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-text: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Aliases kept for older rules while pages move to the new names. */
  --ink: var(--text);
  --dim: var(--muted);
  --card: var(--raise);
  --edge: var(--border);
  --edge-strong: var(--border-strong);
  --ok: var(--hit);
  --warn: var(--miss);
  --band: var(--accent-rgb);
  --display: var(--font-head);
  --body: var(--font-text);
}
/* --chrome is re-declared where its parts change: a custom property is resolved where it is declared. */
body.example-data { --banner: 40px; --chrome: calc(var(--topbar) + var(--banner)); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font-text);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin: 0; }
h1 { font: 700 clamp(28px, 3.6vw, 44px)/1.1 var(--font-head); letter-spacing: -0.01em; overflow-wrap: anywhere; }
h2 { font: 600 clamp(19px, 2vw, 24px)/1.25 var(--font-head); }
h3 { font: 600 16px/1.3 var(--font-head); }
/* A card title is an h2 for the outline (h1 → h2) but keeps the h3 size. */
h2.card-title { font: 600 16px/1.3 var(--font-head); }
h4 { font: 600 14px/1.35 var(--font-text); color: var(--muted); }
a { color: var(--accent); }
a:hover { color: var(--text); }
code, .mono, .num { font-family: var(--font-mono); font-size: 0.92em; overflow-wrap: anywhere; }
ul { margin: 0; padding-left: 20px; }
li + li { margin-top: 6px; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: var(--s2);
  top: -80px;
  z-index: 60;
  padding: var(--s1) var(--s2);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}
.skip:focus { top: var(--s1); }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Controls ---------- */

button, select, input[type="text"], input[type="number"] {
  font: 500 14px/1.2 var(--font-text);
  color: var(--text);
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--raise);
  transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}
button { padding: 0 var(--s2); cursor: pointer; }
select, input[type="text"], input[type="number"] { padding: 0 12px; font-size: 16px; font-weight: 400; background: rgba(5, 7, 13, 0.7); }
select option { color: #05070d; background: #fff; }
button:hover { border-color: var(--accent); }
button[aria-pressed="true"], button[aria-current="true"], button[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
}
button[aria-disabled="true"], button:disabled { opacity: 0.55; cursor: not-allowed; border-style: dashed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--bad); }
button.primary, button.glow { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover, button.glow:hover { background: #8ad8ff; border-color: #8ad8ff; color: var(--on-accent); }
button.quiet, button.ghost { background: transparent; border-color: var(--border); }
button.quiet:hover, button.ghost:hover { border-color: var(--accent); color: var(--accent); }

.colour-star { --c: var(--star); }
.colour-variable { --c: var(--variable); }
.colour-solar { --c: var(--solar); }
.colour-hypothetical { --c: var(--hypothetical); }
.colour-other { --c: var(--other); }

/* Shape as well as colour: star filled circle, variable diamond, Solar System ring, hypothetical dashed ring. */
.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--other)); box-shadow: 0 0 8px var(--c, transparent); }
.colour-variable .dot { border-radius: 2px; transform: rotate(45deg) scale(0.9); }
.colour-solar .dot { background: transparent; border: 2.5px solid var(--c); }
.colour-hypothetical .dot { background: transparent; border: 2px dashed var(--c); box-shadow: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--s1);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  background: rgba(5, 7, 13, 0.6);
}
.chip-example { border: 1px dashed var(--miss); color: var(--miss); font-weight: 600; }
.chip-status-processed { border-color: var(--accent); color: var(--accent); }
.chip-status-real { border-color: var(--hit); color: var(--hit); }
.chip-status-difference { border-color: var(--variable); color: var(--variable); }
.chip-status-context { border-color: var(--other); color: var(--other); border-style: dashed; }
.chip-status-artificial { border-color: var(--hypothetical); color: var(--hypothetical); }
.chip-trial-hit { border-color: var(--hit); color: var(--hit); }
.chip-trial-miss { border-color: var(--miss); color: var(--miss); }
.chip-trial-waiting { border-color: var(--waiting); color: var(--waiting); }
.chip-category-retrospective_holdout, .chip-category-catalogue_assisted, .chip-category-illustrative { border-color: var(--miss); color: var(--miss); }
.chip-category-prospective_unexposed { border-color: var(--hit); color: var(--hit); }
.stamps { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Readable at a glance (task B12): one headline, one key number, chips, and closed "Details" ---------- */
details.more-info > summary {
  min-height: var(--tap); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  color: var(--accent); font-size: 14px; font-weight: 600;
}
details.more-info > summary::-webkit-details-marker { display: none; }
details.more-info > summary::before {
  content: ''; flex: none; width: 6px; height: 6px; margin: 0 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
details.more-info[open] > summary::before { transform: rotate(45deg); }
details.more-info > summary:hover { color: var(--text); }
details.more-info { min-width: 0; max-width: 100%; }
details.more-info > :not(summary) { max-width: min(70ch, 100%); }
details.more-info[open] { padding-bottom: var(--s1); }
details.more-info > * { min-width: 0; }
details.more-info > p, details.more-info > ul, details.more-info > div { margin-top: var(--s1); }
.headline { font: 700 clamp(22px, 2.6vw, 30px)/1.2 var(--font-head); max-width: 34ch; margin: 0; }
.headline-sub { max-width: 62ch; color: var(--muted); font-size: 16px; margin: var(--s1) 0 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: var(--s2) 0 0; }
.stat-tile { display: grid; align-content: start; gap: 6px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, 0.025); }
.stat-tile .chip { justify-self: start; margin-top: 4px; }
.stat-value { margin: 0; font: 700 32px/1.1 var(--font-head); color: var(--text); }
.stat-label { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.35; }
.stat-tile.is-hit .stat-value { color: var(--hit); }
.stat-tile.is-miss .stat-value { color: var(--miss); }
.stat-tile.is-waiting .stat-value { color: var(--waiting); }
/* Phones: one compact row per tile, the number on the left. */
@media (max-width: 560px) {
  .stat-tiles { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .stat-tile { grid-template-columns: minmax(84px, auto) minmax(0, 1fr); align-items: center; column-gap: 14px; padding: 10px 14px; }
  .stat-tile .stat-value { grid-row: span 2; font-size: 24px; }
  .stat-tile .chip, .stat-tile .stamps { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { details.more-info > summary::before { transition: none; } }
.stamps:empty { display: none; }

.eyebrow { font: 600 12px/1.3 var(--font-text); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.note { color: var(--muted); font-size: 14px; }
.note.warn, .warn { color: var(--miss); }
.lead { color: var(--muted); font-size: 17px; max-width: 70ch; }
.hint { color: var(--muted); font-size: 13px; }
.form-message { color: var(--miss); font-size: 14px; }
.form-message:empty { display: none; }
.panel-note {
  padding: 12px var(--s2);
  background: var(--raise);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--text);
  text-decoration: none;
  font: 700 18px/1 var(--font-head);
  letter-spacing: 0.06em;
}
.brand:hover { color: var(--accent); }
/* The team's logo (ring and wordmark, 712×176 px, so sharp at 2× too): about 30 px tall, 26 px on phones. */
.brand-logo { display: block; height: 30px; width: auto; flex: none; }
@media (max-width: 720px) { .brand-logo { height: 26px; } }
/* The site's name on printed lessons only (task B14). */
.print-brand { display: none; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav button { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.nav button:hover { color: var(--text); border-color: transparent; }
.nav button[aria-current="page"] { background: transparent; border-color: transparent; color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.menu-toggle { display: none; margin-left: auto; }
/* Task B33: no menu label ever wraps. The full menu shows only from the width where it fits on one line (measured with
   a 1-px sweep; see docs/IMPLEMENTATION_STATUS.md, B33), with 11 px button sides; below that it collapses into "Menu". */
.nav button, .nav-more > summary { white-space: nowrap; }
.nav > * { flex: none; }

.example-banner {
  position: fixed;
  inset: var(--topbar) 0 auto 0;
  z-index: 39;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 0 var(--s2);
  background: #2a1c05;
  border-bottom: 1px dashed var(--miss);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
}
.example-banner a { color: var(--miss); font-weight: 600; display: inline-flex; align-items: center; min-height: var(--tap); }

.caption {
  position: fixed;
  left: 50%;
  bottom: var(--s2);
  z-index: 45;
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 12px var(--s2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tour-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); max-height: calc(100vh - 96px); overflow-y: auto; }
.tour-words { flex: 1 1 300px; display: grid; gap: 4px; }
.tour-bar #tour-text { font-size: 15px; }
.tour-actions { display: flex; flex-wrap: wrap; gap: var(--s1); }
/* In an investigation the tour sits over the side panel, so the picture and the time bar stay visible. */
@media (min-width: 901px) {
  body[data-page="investigate"] .tour-bar { left: auto; right: var(--s3); transform: none; width: min(var(--panel-w), calc(100vw - 32px)); }
}

.notices {
  position: fixed;
  top: calc(var(--chrome) + var(--s1));
  left: 50%;
  z-index: 35;
  width: min(600px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: grid;
  gap: var(--s1);
}
.notices:empty { display: none; }
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--s1);
  padding: var(--s1) var(--s1) var(--s1) var(--s2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-left: 3px solid var(--miss);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.notice p { flex: 1; padding: 10px 0; }
.notice button { flex: none; min-width: var(--tap); background: transparent; border-color: transparent; color: var(--muted); }

main { display: block; min-height: 100vh; padding: calc(var(--chrome) + var(--s3)) var(--s3) var(--s6); max-width: 1440px; margin: 0 auto; }
/* Until main.js has shown the page the address asks for, with its text, the content stays invisible: otherwise the
   empty Home layout paints first and jumps away (layout shift). The min-height above keeps the footer below the
   first screen while a page fills in. Safety net: visible after 4 s whatever happens (it beats the reduced-motion
   rule on purpose, as it is not motion). */
body:not(.booted) main, body:not(.booted) .site-footer { visibility: hidden; animation: boot-fallback 0s 4s forwards !important; }
@keyframes boot-fallback { to { visibility: visible; } }
/* Parts drawn from the data files stay invisible until they are drawn, so nothing above or beside them jumps:
   the Home map (the challenge shortcuts above it fill in first on phones) and the Learn cards. */
.page-home[data-loading] .scene, .page-learn[data-loading] #learn-index { visibility: hidden; }
main:focus { outline: none; }
.page-text { max-width: 860px; display: grid; gap: var(--s2); }
.page-text h2 { margin-top: var(--s1); }

.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--s3);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
  display: grid;
  gap: 4px;
}
body[data-page="home"] .site-footer, body[data-page="investigate"] .site-footer { display: none; }

/* ---------- Home: the map console ---------- */

.page-home {
  position: fixed;
  inset: var(--chrome) 0 0 0;
  overflow: hidden;
}
.scene { position: absolute; inset: 0; }

/* ---------- Home's title block and menu bits (B16, kept by B29) ---------- */
body[data-page="investigate"] .home-hero { display: none; }
.home-stage { position: relative; height: 100%; }
.chip-new { padding: 1px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #1c1205; background: var(--hypothetical); border-color: var(--hypothetical); }
.nav-planetx { position: relative; }
.nav-planetx { display: inline-flex; align-items: center; }
.nav .new-dot { display: inline-block; flex: none; width: 8px; height: 8px; min-width: 0; padding: 0; margin: 0 0 0 7px; border: 0; border-radius: 50%; background: var(--hypothetical); box-shadow: 0 0 0 3px rgba(255, 169, 77, 0.22); }
.more-short { display: none; }
@media (min-width: 1240px) {
  /* The full menu fits on one line: "More" stands for "Guided tour and more" (still its accessible name). */
  .more-short { display: inline; }
  .nav button { padding: 0 11px; }
  .nav-more > summary { padding: 0 10px; }
  .more-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.hero-explore { display: none; }
.reveal-loop-wrap { margin: 0; }
.reveal-loop { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--accent); font-weight: 600; }
.reveal-loop[hidden] { display: none; }
.space-close { display: none; }
/* "Guided tour and more" in the menu. */
.nav-more { position: relative; }
.nav-more > summary { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 12px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); font-weight: 500; list-style: none; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: ''; margin-left: 8px; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.nav-more > summary:hover, .nav-more[open] > summary { color: var(--text); }
.nav-more-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; display: grid; gap: 4px; padding: var(--s1); background: #0b111e; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.nav-more-list button, .nav-more-list a { justify-content: flex-start; text-align: left; min-height: var(--tap); }
.nav-more-list a { display: flex; align-items: center; padding: 0 12px; color: var(--hypothetical); font-weight: 600; }
.starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.map-stage {
  position: absolute;
  top: var(--s2);
  bottom: 72px;
  left: calc(var(--rail-w) + var(--s4));
  right: var(--s2);
  display: grid;
  place-items: center;
  container-type: size;
  overflow: hidden;
}
.map-canvas { position: relative; width: min(100cqw, 100cqh); aspect-ratio: 1; }
.map-waiting { max-width: 420px; padding: var(--s2); text-align: center; }
.map-rings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-rings .ring { fill: none; stroke: rgba(var(--accent-rgb), 0.22); stroke-width: 0.18; }
.map-rings .ring-ly { stroke: rgba(230, 237, 247, 0.14); stroke-dasharray: 0.6 0.9; }
.map-rings .sun { fill: #fff3c4; }
.sun-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 243, 196, 0.95) 0%, rgba(255, 224, 138, 0.55) 22%, rgba(255, 200, 90, 0.12) 55%, rgba(255, 200, 90, 0) 72%);
  pointer-events: none;
}
.ring-label, .sun-label {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -100%);
  padding: 0 4px;
  font: 400 11px/1.3 var(--font-mono);
  color: var(--muted);
  background: rgba(5, 7, 13, 0.75);
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}
.sun-label { top: 55%; transform: translate(-50%, 0); color: var(--star); }
.map-marker {
  position: absolute;
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s1) 0 0;
  transform: translate(-22px, -50%);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: 500 13px/1.2 var(--font-text);
  white-space: nowrap;
  z-index: 2;
}
.map-marker.label-left { flex-direction: row-reverse; padding: 0 0 0 var(--s1); transform: translate(calc(-100% + 22px), -50%); }
.map-marker.label-below { flex-direction: column; padding: 0 0 4px; transform: translate(-50%, -22px); }
.map-marker.label-above { flex-direction: column-reverse; padding: 4px 0 0; transform: translate(-50%, calc(-100% + 22px)); }
.map-marker .dot { width: var(--tap); height: var(--tap); background: none; box-shadow: none; border: 0; display: grid; place-items: center; transform: none; border-radius: 0; }
.map-marker .dot::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 10px 2px var(--c);
  animation: marker-glow 3.2s ease-in-out infinite;
}
@keyframes marker-glow { 50% { box-shadow: 0 0 18px 5px var(--c); } }
.map-marker.colour-variable .dot::before { border-radius: 2px; transform: rotate(45deg) scale(0.9); }
.map-marker.colour-solar .dot::before { background: transparent; border: 2.5px solid var(--c); }
.map-marker.colour-hypothetical .dot::before { width: 15px; height: 15px; background: transparent; border: 2px dashed var(--c); box-shadow: none; animation: none; }
.map-marker span { padding: 2px 6px; border-radius: 6px; background: rgba(5, 7, 13, 0.72); }
button.map-marker:hover span, button.map-marker:focus-visible span { color: var(--c); }
.map-marker.is-off span { color: var(--muted); border: 1px dashed var(--border-strong); }
.map-marker.is-off .dot::before { animation: none; opacity: 0.8; }
.map-caption {
  position: absolute;
  bottom: var(--s2);
  left: calc(var(--rail-w) + var(--s4));
  right: var(--s2);
  width: fit-content;
  max-width: calc(100% - var(--rail-w) - 48px);
  margin: 0 auto;
  padding: 6px 14px;
  color: var(--miss);
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  border-color: rgba(255, 181, 71, 0.45);
  border-radius: 999px;
}
.map-key { position: absolute; top: var(--s2); right: var(--s2); width: 280px; padding: 0 var(--s2) var(--s1); z-index: 3; }
.map-key summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font: 600 14px var(--font-head); }
.map-key[open] { padding-bottom: var(--s2); }
.map-key .note { margin-top: var(--s1); }
/* Wide screens: the colour key (with the Planet Nine note open) scrolls rather than run under the time bar. */
@media (min-width: 901px) {
  .map-key { max-height: calc(100% - var(--s2) - 168px); overflow-y: auto; overscroll-behavior: contain; }
}

/* ---------- Planet X: measured depth panel and the hidden-planet round ---------- */

.planetx-link { margin: 0; }
.planetx-link a, .planetx-line a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; color: var(--hypothetical); }
.planetx-measured { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.planetx-verdict { font-weight: 600; padding: 10px 12px; border-left: 3px solid var(--hypothetical); background: rgba(255, 169, 77, 0.06); }
.planetx-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s2); align-items: start; }
.planetx-bands { display: grid; gap: var(--s2); }
.planetx-band { margin: 0; display: grid; gap: 6px; }
.planetx-band figcaption { display: grid; gap: 2px; }
.planetx-chart { width: 100%; height: auto; display: block; background: rgba(5, 7, 13, 0.5); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.planetx-chart .grid { stroke: var(--border); stroke-width: 1; }
.planetx-chart .level { stroke: var(--border-strong); stroke-dasharray: 4 4; }
.planetx-chart .tick, .planetx-chart .axis { fill: var(--muted); font: 11px var(--font-mono); }
.planetx-chart .interval { fill: rgba(var(--accent-rgb), 0.16); stroke: none; }
.planetx-chart .curve { fill: none; stroke: var(--accent); stroke-width: 2; }
.planetx-chart .pt { fill: var(--accent); }
.planetx-chart .d50, .planetx-chart .d90 { stroke: var(--text); stroke-dasharray: 3 3; }
.planetx-chart text.d50, .planetx-chart text.d90 { fill: var(--text); stroke: none; font: 600 11px var(--font-mono); }
.planetx-chart .model { stroke: var(--hypothetical); stroke-width: 2; }
.planetx-chart .model-range { fill: rgba(255, 169, 77, 0.18); stroke: var(--hypothetical); }
.planetx-chart .wise { stroke: var(--variable); stroke-width: 2; stroke-dasharray: 6 3; }
.planetx-chart .marker-label { font: 11px var(--font-text); stroke: none; }
.planetx-chart text.model { fill: var(--hypothetical); }
.planetx-chart text.wise { fill: var(--variable); }
.planetx-side { display: grid; gap: var(--s1); align-content: start; }
.planetx-assumptions, .planetx-models { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.planetx-models li { display: grid; gap: 2px; }
.planetx-models a { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 13px; }
.chip-artificial { color: var(--hypothetical); border-color: rgba(255, 169, 77, 0.55); }
.chip-measured { color: var(--hit); border-color: rgba(95, 211, 141, 0.5); }
.hidden-round { margin-top: var(--s3); padding: var(--s3); display: grid; gap: 12px; }
.hidden-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: var(--s3); align-items: start; }
.hidden-figure { margin: 0; display: grid; gap: 6px; }
.hidden-figure figcaption { display: grid; gap: 2px; }
.hidden-stage { position: relative; width: 100%; cursor: crosshair; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #000; touch-action: manipulation; }
.hidden-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden-stage img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; user-select: none; -webkit-user-drag: none; }
#hidden-frame-b { transition: opacity 80ms linear; }
.hidden-marks { position: absolute; inset: 0; pointer-events: none; }
.hidden-mark { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; }
.hidden-mark.guess { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6); }
.hidden-mark.injected { border: 2px dashed var(--hypothetical); }
.hidden-mark.pipeline { width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid var(--hit); }
.hidden-badge { position: absolute; left: 8px; top: 8px; margin: 0; padding: 3px 8px; border-radius: 6px; background: rgba(5, 7, 13, 0.78); border: 1px dashed var(--hypothetical); color: var(--hypothetical); font: 600 12px var(--font-text); pointer-events: none; }
.hidden-controls { display: grid; gap: 12px; align-content: start; }
.hidden-buttons { display: flex; flex-wrap: wrap; gap: var(--s1); }
.hidden-buttons button[aria-pressed="true"] { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.5); }
.hidden-result { display: grid; gap: 6px; }
.hidden-artificial { font-weight: 600; color: var(--hypothetical); }
.hidden-hit { color: var(--hit); font-weight: 600; }
.hidden-miss { color: var(--miss); font-weight: 600; }
@media (max-width: 900px) {
  .planetx-grid, .hidden-layout { grid-template-columns: 1fr; }
}

/* ---------- Why Pluto loops ---------- */

.page-loop { max-width: 1280px; margin: 0 auto; display: grid; gap: var(--s2); }
.loop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s2); align-items: start; }
.loop-main { display: grid; gap: var(--s1); }
.loop-stage { position: relative; height: min(62vh, 620px); min-height: 340px; overflow: hidden; padding: 0; isolation: isolate; }
.loop3d { position: absolute; inset: 0; }
.loop-scale { position: absolute; left: 12px; bottom: 10px; right: 12px; margin: 0; padding: 6px 10px; border-left: 2px solid var(--miss); background: rgba(5, 7, 13, 0.72); color: var(--miss); font: 500 12px/1.4 var(--font-mono); pointer-events: none; z-index: 2; }
.loop-controls { display: grid; gap: var(--s1); padding: 12px var(--s2); }
.loop-time { display: flex; gap: var(--s1); align-items: baseline; font-weight: 600; }
.loop-controls input[type="range"] { width: 100%; min-height: var(--tap); }
.loop-buttons { display: flex; flex-wrap: wrap; gap: var(--s1); }
.loop-side { padding: var(--s2); display: grid; gap: 12px; }
.loop-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; }
.loop-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.loop-legend li::before { content: ''; display: inline-block; width: 18px; height: 3px; margin-right: 8px; vertical-align: middle; border-radius: 2px; }
.loop-legend .lg-sun::before { background: var(--star); height: 8px; width: 8px; border-radius: 50%; }
.loop-legend .lg-orbit::before { background: var(--accent); }
.loop-legend .lg-training::before { background: var(--solar); height: 7px; width: 7px; border-radius: 50%; }
.loop-legend .lg-evaluation::before { background: var(--miss); height: 7px; width: 7px; border-radius: 50%; }
.loop-legend .lg-v1::before { background: repeating-linear-gradient(90deg, var(--star) 0 5px, transparent 5px 8px); }
.loop-legend .lg-v2::before { background: var(--variable); }
.loop-links { display: flex; flex-wrap: wrap; gap: 0 var(--s2); font-size: 14px; }
.loop-links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.loop-chart { padding: var(--s2); display: grid; gap: var(--s1); }
.loop-chart-host { overflow-x: auto; }
.loop-chart-svg { width: 100%; min-width: 560px; height: auto; display: block; }
.loop-chart-svg .grid, .loop-inset-svg .grid { stroke: var(--border); stroke-width: 1; }
.loop-chart-svg .tick, .loop-inset-svg .tick { fill: var(--muted); font: 11px var(--font-mono); }
.loop-chart-svg .path { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0.85; }
.loop-chart-svg .track { fill: none; stroke-width: 2; }
.loop-chart-svg .track.v1 { stroke: var(--star); stroke-dasharray: 5 4; }
.loop-chart-svg .track.v2 { stroke: var(--variable); }
.loop-chart-svg .pt.training, .loop-inset-svg .pt.forecast { fill: var(--solar); }
.loop-chart-svg .pt.evaluation { fill: var(--miss); }
.loop-chart-svg .pt.v1 { fill: var(--star); }
.loop-chart-svg .pt.v2 { fill: var(--variable); }
.loop-chart-svg .now-marker circle { fill: none; stroke: #fff; stroke-width: 2; }
.loop-inset { display: grid; gap: 6px; justify-items: start; }
.loop-inset-svg { width: 220px; height: 220px; background: rgba(5, 7, 13, 0.6); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.loop-inset-svg .region { fill: rgba(255, 224, 138, 0.12); stroke: var(--star); stroke-width: 1.5; }
.loop-inset-svg .observed { stroke: #fff; stroke-width: 2.2; }
.loop-inset-svg .scalebar { stroke: var(--text); stroke-width: 2; }
.space-label.loop-v1 { color: var(--star); }
.space-label.loop-v2 { color: var(--variable); }
.loop-link { margin: 0; }
.loop-link a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
@media (max-width: 900px) {
  .loop-layout { grid-template-columns: 1fr; }
  .loop-stage { height: min(70vh, 520px); }
}

/* ---------- Why we missed (exploratory post-mortem) ---------- */

.why-missed { display: grid; gap: 10px; padding: 0 var(--s2) var(--s1); border: 1px dashed rgba(255, 169, 77, 0.55); border-radius: var(--radius-sm); background: rgba(255, 169, 77, 0.04); }
.why-missed > summary { min-height: var(--tap); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); cursor: pointer; font: 600 15px var(--font-head); color: var(--text); }
.why-missed[open] { padding-bottom: var(--s2); }
.chip-exploratory { color: var(--hypothetical); border-color: rgba(255, 169, 77, 0.55); font-family: var(--font-text); }
.why-points { display: grid; gap: var(--s1); padding-left: 18px; margin: 0; }
.why-points li { font-size: 14.5px; }
.why-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.why-table caption { text-align: left; color: var(--muted); padding: 4px 0; font-weight: 600; }
.why-table th, .why-table td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.why-table thead th { color: var(--muted); font-weight: 500; }
.reveal-text .why-missed { margin-top: var(--s1); }
/* Task B22: a card's open details use the whole card; the Pluto card (the one with "Why we missed") takes the full
   content width from 768 px up; tables keep a readable minimum width and scroll inside their own box on phones. */
.ledger-card details.more-info > :not(summary), .ledger-card .why-missed > :not(summary) { max-width: none; }
.why-missed > *, .ledger-card details.more-info > * { min-width: 0; }
/* As a block (not a grid) the open details never grow past the card, so a wide table scrolls in its own box. */
.ledger-card .why-missed { display: block; min-width: 0; max-width: 100%; }
.ledger-card .why-missed > * + * { margin-top: 10px; }
.why-table { min-width: 560px; }
.why-missed .table-scroll { max-height: none; }
@media (min-width: 768px) {
  .story-cards > .story-card:has(.why-missed) { grid-column: 1 / -1; }
}
/* "Check us in 2027" sits right under the Pluto card while "Why we missed" is open (moved there by ledger-ui.js). */
.story-cards > .story-check.is-under-why { grid-column: 1 / -1; margin: 0; }

/* ---------- Home: the 3D view (three.js) and its 2D fallback ---------- */

body:not(.space-3d) .space-3d-only, body.space-3d .map-2d-only { display: none !important; }
body.space-3d .map-stage, body.space-3d #starfield { display: none; }
/* On wide screens the scene fills the whole Home area behind the console; the camera centres the Sun in the free part. */
/* isolation: the label renderer sets its own z-indexes; they must stay below the HUD, buttons and caption. */
.space3d { position: absolute; inset: 0; overflow: hidden; isolation: isolate; }
.space-canvas { display: block; touch-action: none; outline: none; }
.space-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.space-label {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(5, 7, 13, 0.62);
  color: var(--text);
  font: 500 12px/1.3 var(--font-text);
  white-space: nowrap;
  pointer-events: none;
}
.space-label.is-target { font: 600 13px/1.3 var(--font-head); border: 1px solid rgba(var(--accent-rgb), 0.35); }
/* B11: a click on a body's label flies there; overlapping labels fade (focus.js chooseLabels). */
.space-label { transition: opacity 0.2s ease; }
.space-label.is-pick { pointer-events: auto; cursor: pointer; }
.space-label.is-pick:hover { color: var(--accent); }
.space-label.is-target.colour-star { border-color: rgba(255, 224, 138, 0.45); }
.space-label.is-target.colour-variable { border-color: rgba(201, 160, 255, 0.5); }
.space-label.is-target:hover { color: var(--accent); }
.space-label.is-end-on, .space-label.is-faded { opacity: 0; pointer-events: none; }
.space-label.is-sun { color: var(--star); background: none; font: 600 12px var(--font-head); }
.space-label.is-planet { color: var(--muted); background: none; font-size: 11.5px; }
.space-label.is-earth { color: var(--accent); background: none; font-size: 11.5px; }
.space-label.is-ring { color: rgba(141, 155, 176, 0.75); background: none; font: 400 10.5px var(--font-mono); }
.space-label.is-note { color: var(--muted); background: none; font-style: italic; font-size: 11.5px; }
.space-label.is-hypothetical { color: var(--hypothetical); border: 1px dashed rgba(255, 169, 77, 0.6); font-size: 11.5px; }
.space-label.is-hypothetical:hover, .space-label.is-hypothetical.is-active { color: var(--hypothetical); background: rgba(255, 169, 77, 0.16); }
/* The followed body's label: a dark backing, since close up it sits on the body's own disc. */
.space-label.is-focus { background: rgba(5, 7, 13, 0.82); }
@media (prefers-reduced-motion: reduce) { .space-label { transition: none; } }
.space-tools {
  position: absolute;
  top: var(--s2);
  left: calc(var(--rail-w) + var(--s4));
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}
.space-tools button, .space-fly > summary { background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); font-size: 13px; padding: 0 12px; }
/* Fly to (B11): the list opens under the tools row; its buttons are 44 px tall like every control. */
.space-fly > summary {
  list-style: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
}
.space-fly > summary::-webkit-details-marker { display: none; }
.space-fly > summary::after { content: ''; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.space-fly > summary:hover, .space-fly[open] > summary { border-color: var(--accent); color: var(--accent); }
.space-fly-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 5;
  width: min(300px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}
.space-fly-list button { text-align: left; }
/* Planet Nine in the colour key (B11): the entry opens the explanation, which never sits over the scene. */
.legend-button {
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}
.legend-button:hover, .legend-button[aria-expanded="true"] { color: var(--hypothetical); }
.space-nine { display: grid; gap: 6px; margin-top: var(--s1); padding: 10px 12px; border: 1px dashed rgba(255, 169, 77, 0.6); border-radius: var(--radius-sm); color: var(--hypothetical); font-size: 13px; line-height: 1.45; }
.space-nine[hidden] { display: none !important; }
.space-nine .note { margin: 0; color: var(--muted); }
.space-hud {
  position: absolute;
  top: calc(var(--s2) + var(--tap) + var(--s1));
  left: calc(var(--rail-w) + var(--s4));
  z-index: 2;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-left: 2px solid rgba(var(--accent-rgb), 0.6);
  background: rgba(5, 7, 13, 0.55);
  color: var(--muted);
  font: 400 11.5px/1.45 var(--font-mono);
  pointer-events: none;
}
.space-hud #space-target { color: var(--accent); }
/* Time control (B10): under the scene, centred in the area beside the console, above the caption. */
.space-time {
  position: absolute;
  bottom: calc(var(--s2) + 58px);
  left: calc(var(--rail-w) + var(--s4));
  right: var(--s2);
  z-index: 3;
  width: fit-content;
  max-width: calc(100% - var(--rail-w) - 48px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 8px 14px;
}
.space-time[hidden] { display: none !important; }
.time-live {
  min-height: var(--tap);
  min-width: 76px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 14px/1 var(--font-head);
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
}
.time-live i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.time-live.is-live { color: var(--hit); border-color: var(--hit); }
.time-live.is-live i { background: var(--hit); box-shadow: 0 0 0 3px rgba(95, 211, 141, 0.2); }
.time-play { width: var(--tap); min-width: var(--tap); min-height: var(--tap); padding: 0; display: inline-grid; place-items: center; }
.time-play span { width: 14px; height: 16px; }
.time-play[data-state="playing"] span { border-left: 5px solid currentColor; border-right: 5px solid currentColor; box-sizing: border-box; }
.time-play[data-state="paused"] span { width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 14px; border-color: transparent transparent transparent currentColor; }
.time-now { display: flex; align-items: baseline; gap: 6px; margin: 0; }
.time-date { font: 600 22px/1.1 var(--font-mono); color: var(--text); letter-spacing: 0.01em; }
.time-utc { font: 600 12px var(--font-text); color: var(--muted); }
.time-speed { display: grid; justify-items: center; gap: 0; min-width: 220px; }
.time-speed input[type="range"] { width: 220px; height: var(--tap); margin: 0; accent-color: var(--accent); cursor: pointer;
  background: linear-gradient(var(--border-strong), var(--border-strong)) center / 2px 14px no-repeat; }
.time-rate-text { font: 500 12.5px/1.2 var(--font-mono); color: var(--accent); margin: 0; }
.time-note { flex-basis: 100%; margin: 0; text-align: center; font-size: 12.5px; color: var(--hypothetical); }
.legend { list-style: none; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: var(--s1); margin: 0; }

.console-left {
  position: absolute;
  top: var(--s2);
  left: var(--s2);
  bottom: var(--s2);
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  z-index: 4;
}
.search-card { position: relative; z-index: 2; padding: var(--s2); display: grid; gap: 12px; }
.search-lead { font: 600 16px/1.35 var(--font-head); }
.search { position: relative; display: grid; gap: var(--s1); }
.search-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1); }
.search-line input { grid-column: 1 / -1; min-width: 0; }
.search-line select { min-width: 0; }
.search-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); }
.search-tools button { padding: 0 6px; font-size: 13px; }
.search-card .hint { font-size: 12.5px; }
/* How to search (B12): read out with the search box, shown at the top of the place list while the box is empty. */
.search-tip { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search-list p.search-list-tip { margin: 2px var(--s1) var(--s1); padding-bottom: var(--s1); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.search-more[open] > summary { margin-bottom: var(--s1); }
.search-more .planetx-link { margin-top: var(--s1); }
.map-about { margin-top: var(--s1); border-top: 1px solid var(--border); }
.search-list {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: min(60vh, 480px);
  overflow-y: auto;
  padding: var(--s1);
  display: grid;
  gap: 4px;
  background: #0b111e;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search-list h3 { margin: var(--s1) var(--s1) 2px; font-size: 13px; color: var(--accent); }
.search-list p { margin: var(--s1); color: var(--muted); }
.search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: var(--tap);
  padding: 4px var(--s1);
  text-align: left;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}
.search-row:hover { background: rgba(var(--accent-rgb), 0.08); }
.search-row img { flex: none; width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.search-row span { display: grid; gap: 1px; min-width: 0; }
.search-row small { color: var(--muted); font-size: 12.5px; }

.shortcuts { display: grid; gap: var(--s1); }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.chips li { margin: 0; }
.target-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0 12px 0 4px;
  border-left: 3px solid var(--c, var(--border-strong));
  font-size: 13px;
}
.target-chip .blink { width: 34px; height: 34px; border-radius: 6px; flex: none; }
.target-chip .blink b, .target-chip .blink .ring { display: none; }

.blink { position: relative; aspect-ratio: 1; overflow: hidden; background: #000; border-radius: var(--radius-sm); }
.blink.empty { background: repeating-linear-gradient(135deg, var(--panel) 0 6px, var(--raise) 6px 12px); }
.blink img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.blink b { position: absolute; top: 4px; left: 6px; font: 600 11px/1 var(--font-mono); color: #fff; text-shadow: 0 0 6px #000, 0 0 2px #000; }
.blink .plate-b, .blink .label-b { visibility: hidden; }
body[data-blink="b"] .blink .plate-b, body[data-blink="b"] .blink .label-b { visibility: visible; }
body[data-blink="b"] .blink .label-a { visibility: hidden; }
.blink.place .ring { display: none; }
.blink .ring {
  position: absolute;
  left: var(--ax);
  top: var(--ay);
  width: 22%;
  aspect-ratio: 1;
  border: 2px solid var(--star);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
body[data-blink="b"] .blink .ring { left: var(--bx); top: var(--by); }

.rail { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.rail-toggle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s2);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  font: 600 15px var(--font-head);
}
.rail-toggle::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-left: var(--s1); transition: transform var(--ease); }
.rail-toggle[aria-expanded="false"]::after { transform: rotate(-135deg); }
.rail-toggle[aria-expanded="false"] { border-bottom: 0; border-radius: var(--radius); }
.rail-toggle[aria-pressed], .rail-toggle:hover { background: transparent; }
.rail-count { margin-left: auto; font: 500 12.5px var(--font-mono); color: var(--muted); }
.rail-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px var(--s2) var(--s2); display: grid; align-content: start; gap: 12px; }
.rail-toggle[aria-expanded="false"] + .rail-body { display: none; }
.rail:has(> .rail-toggle[aria-expanded="false"]) { flex: 0 0 auto; }
.rail-groups { display: grid; gap: var(--s2); }
.rail-group h3 { display: flex; align-items: center; gap: var(--s1); margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.rail-group ul { list-style: none; padding: 0; display: grid; gap: 4px; }
.rail-group li { margin: 0; }
.rail-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  width: 100%;
  min-height: var(--tap);
  padding: var(--s1) 12px;
  text-align: left;
  border: 1px solid transparent;
  border-left: 3px solid var(--c, var(--border-strong));
  border-radius: var(--radius-sm);
  background: rgba(17, 26, 43, 0.6);
  font-weight: 400;
}
button.rail-item:hover { border-color: var(--border-strong); border-left-color: var(--c); background: rgba(var(--accent-rgb), 0.06); }
.rail-item strong { font: 600 14px/1.3 var(--font-head); color: var(--text); }
.rail-item small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.rail-item.is-off { border-left-style: dashed; }
.rail-item .rail-go { color: var(--accent); font-weight: 600; font-size: 12.5px; }
.rail-credit { color: var(--muted); font-size: 12px; }

.sky-panel {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  z-index: 6;
  width: min(560px, calc(100% - var(--rail-w) - 64px));
  padding: var(--s2);
  display: grid;
  gap: 12px;
}
.sky-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.sky { position: relative; height: 360px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.aladin-container, .aladin-imageCanvas { background: var(--bg) !important; }
.aladin-logo-container { opacity: 0.6; }

/* ---------- Investigation: stage, time bar and the glass panel ---------- */

.page-investigate {
  position: fixed;
  inset: var(--chrome) 0 0 0;
  z-index: 32;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "stage head" "stage panel";
  column-gap: var(--s2);
  padding: var(--s2);
  background: linear-gradient(90deg, rgba(5, 7, 13, 0.82), rgba(5, 7, 13, 0.62));
}
body[data-page="investigate"] .page-home .console-left, body[data-page="investigate"] .page-home .map-key,
body[data-page="investigate"] .page-home .map-caption { visibility: hidden; }

.inv-head, .inv-panel {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: panel-in var(--ease);
}
@keyframes panel-in { from { transform: translateX(calc(100% + 32px)); } }
.inv-head {
  grid-area: head;
  display: grid;
  gap: var(--s1);
  padding: var(--s2) var(--s2) 12px;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.inv-head-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s1); }
.inv-head-actions button { padding: 0 12px; font-size: 13px; }
.inv-head .object { display: grid; gap: 4px; }
.inv-head h1 { font-size: 26px; }
.object-kind { color: var(--accent); }
.object-coords { color: var(--muted); font-size: 12.5px; }
.inv-panel {
  grid-area: panel;
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  overscroll-behavior: contain;
}
.panel-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 2px;
  padding: var(--s1);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.panel-nav button { flex: none; min-width: var(--tap); padding: 0 8px; font-size: 13px; background: transparent; border-color: transparent; color: var(--muted); }
.panel-nav button:hover { color: var(--text); }
.panel-nav button[aria-current="true"] { color: var(--accent); background: rgba(var(--accent-rgb), 0.12); border-color: transparent; }
.panel {
  display: grid;
  gap: 12px;
  padding: 0 var(--s2) var(--s3);
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 62px;
}
.panel-title {
  position: sticky;
  top: 61px;
  z-index: 4;
  margin: 0 calc(-1 * var(--s2));
  padding: 12px var(--s2);
  font-size: 17px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.progress { color: var(--accent); font-size: 14px; }
.progress:empty { display: none; }
.see-tools { display: grid; gap: var(--s2); }

/* The stage holds the plate (or two) and the time bar. */
.stage { grid-area: stage; grid-row: 1 / -1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-view { flex: 1 1 0; min-height: 0; display: flex; }
.plates {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  container-type: size;
  --swipe: 50%;
}
.plate-frame {
  position: relative;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  flex: none;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
body[data-layout="compare"] .plate-frame { width: min(50cqw - 6px, 100cqh); }
#plate, #plate-b { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.plates[data-mode="swipe"] .plate-b {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  clip-path: inset(0 0 0 var(--swipe));
  box-shadow: none;
}
.plates[data-mode="swipe"] #plate-date-b { left: auto; right: 12px; text-align: right; }
.plates[data-mode="swipe"] .plate-date { font-size: 14px; max-width: 45%; }
.swipe-line { display: none; position: absolute; top: 0; bottom: 0; left: var(--swipe); width: 2px; background: #fff; box-shadow: 0 0 8px #000; pointer-events: none; z-index: 3; }
.plates[data-mode="swipe"] .swipe-line { display: block; }
.swipe-control { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.swipe-control input { width: 100%; min-height: var(--tap); accent-color: var(--accent); }
.plate-colour { position: absolute; left: 10px; top: 40px; margin: 0; padding: 2px 8px; border-radius: 6px; background: rgba(5, 7, 13, 0.7); color: var(--text); font: 500 11.5px var(--font-text); pointer-events: none; }
.colour-toggle[aria-pressed="true"] { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.5); }
.plate-hint { position: absolute; right: 10px; bottom: 8px; font-size: 12px; color: rgba(255, 255, 255, 0.85); text-shadow: 0 0 4px #000; pointer-events: none; }
.plate-date {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(5, 7, 13, 0.72);
  font: 600 clamp(13px, 1.3vw, 16px)/1.4 var(--font-mono);
  color: #fff;
  pointer-events: none;
}
.plate-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 18%; text-align: center; color: var(--text); pointer-events: none; }
.lock {
  position: absolute;
  left: 12px;
  bottom: 34px;
  padding: 4px 10px;
  border: 1px solid var(--star);
  border-radius: 6px;
  background: rgba(5, 7, 13, 0.85);
  color: var(--star);
  font-weight: 600;
  font-size: 13px;
  pointer-events: none;
}

.timebar { flex: none; display: grid; gap: 10px; padding: 12px var(--s2); }
.timebar-track { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.play-button { flex: none; min-width: 88px; }
.film {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: var(--s1);
  overflow-x: auto;
  padding: 18px 4px 2px;
  scrollbar-width: thin;
}
.film::before { content: ''; position: absolute; left: 0; right: 0; top: 41px; height: 1px; background: var(--border-strong); }
.film-tile {
  position: relative;
  flex: none;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 64px;
  min-height: 0;
  padding: 0 0 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}
.film-tile:hover { background: rgba(var(--accent-rgb), 0.08); }
.film-tile canvas { display: block; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border-strong); background: #000; }
.film-tile span { font: 400 10.5px/1.2 var(--font-mono); color: var(--muted); text-align: center; }
.film-tile[aria-pressed="true"] { background: transparent; }
.film-tile[aria-pressed="true"] canvas { border-color: var(--accent); box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.6); }
.film-tile[aria-pressed="true"] span { color: var(--text); }
.film-tile[data-ab-label]:not([data-ab-label=""])::after {
  content: attr(data-ab-label);
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 6px;
  border-radius: 4px;
  font: 700 11px/1.45 var(--font-mono);
  color: var(--on-accent);
  background: var(--accent);
}
.film-tile[data-ab="b"]::after { background: var(--star); }
.timebar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
/* Contrast (task B23): in view under the picture, at least 160 px wide with a 44 px touch area, and a Reset link. */
.contrast-control { display: flex; align-items: center; gap: 8px; }
.contrast-control label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.contrast-control input[type="range"] { width: 180px; min-width: 160px; height: var(--tap); margin: 0; accent-color: var(--accent); cursor: pointer; }
.contrast-reset { min-height: var(--tap); padding: 0 6px; border: 0; background: none; color: var(--accent); font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.contrast-reset:hover { background: none; color: var(--text); }
body.preview-mode .contrast-control { display: none; }
@media (max-width: 720px) {
  .contrast-control { flex: 1 1 100%; }
  .contrast-control input[type="range"] { flex: 1 1 auto; width: auto; }
}
.segment { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border-strong); border-radius: 10px; background: rgba(5, 7, 13, 0.6); }
.segment button { padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 13.5px; }
.segment button:hover { color: var(--text); }
.segment button[aria-pressed="true"] { background: rgba(var(--accent-rgb), 0.16); color: var(--accent); }
.segment button[aria-disabled="true"] { border: 0; text-decoration: line-through; text-decoration-color: rgba(141, 155, 176, 0.6); }
.explain { flex: 1 1 260px; min-width: 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
/* The target view for a first-time visitor (task B17). */
.object-plain { font-size: 16px; color: var(--text); margin: 0; }
.object-about > summary { font-size: 13.5px; }
.object-about[open] { display: grid; gap: 6px; }
.inv-share { position: relative; }
.share-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; display: grid; gap: 4px; min-width: 200px; padding: var(--s1); background: #0b111e; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.share-menu[hidden] { display: none; }
.share-menu button { justify-content: flex-start; text-align: left; }
.stage-caption { margin: 0; text-align: center; font: 600 15px/1.35 var(--font-head); color: var(--text); }
.finding { margin: 0; font: 600 clamp(17px, 1.9vw, 21px)/1.4 var(--font-head); color: var(--text); }
.finding[data-source]:not([data-source=""])::after { content: attr(data-source); display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 999px; font: 500 12px var(--font-text); color: var(--muted); vertical-align: 2px; }
.explain-key { color: var(--text); font-weight: 600; }
.changed-finding { font-weight: 600; }
.explain-key:empty { display: none; }
/* Where the shift comes from, as a chip after the sentence (catalogue proper motion, not a measurement here). */
.explain-key[data-source]:not([data-source=""])::after { content: attr(data-source); display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted); vertical-align: 1px; }
.explain-more { flex: 1 1 220px; min-width: 0; }
.explain-more > summary { font-size: 13.5px; }
.explain-more .explain { margin-top: 2px; }

.caption-strip { display: grid; gap: var(--s1); }
.caption-strip h3 { font-size: 14px; }
.caption-cols { display: grid; gap: var(--s1); }
.caption-col { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(5, 7, 13, 0.45); }
.caption-col.is-shown { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.caption-head { display: flex; align-items: center; gap: var(--s1); margin-bottom: 4px; }
.ab-letter { font: 700 14px/1 var(--font-mono); color: var(--accent); min-width: 1.2em; }
.facts { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.caption-more summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--accent); font-size: 13px; }
.ids summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }

.ab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s1); }
.ab-pick { display: flex; align-items: center; gap: var(--s1); min-width: 0; }
.ab-pick select { flex: 1; min-width: 0; width: 100%; font-size: 13px; }
.ab-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--s1); }
.ab-buttons button { font-size: 13px; }

.wavelength { display: grid; gap: var(--s1); }
.wavelength h3 { font-size: 14px; }
.bands { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s1) 12px; }
.bands output { text-align: right; font-size: 13px; color: var(--accent); }
.band-track { grid-column: 1 / -1; position: relative; height: var(--tap); }
.band-scale { position: absolute; inset: 14px 0; display: flex; border-radius: 4px; overflow: hidden; }
.band-scale span { flex: 1; background: rgba(var(--accent-rgb), 0.22); }
.band-scale span.array-start { border-left: 2px solid var(--panel); }
.band-track input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: ew-resize; }
.band-track input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 32px; border-radius: 6px; background: var(--text); border: 2px solid var(--bg); }
.band-track input::-moz-range-thumb { width: 12px; height: 30px; border-radius: 6px; background: var(--text); border: 2px solid var(--bg); }
.arrays { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.arrays button { --tint: 255, 255, 255; position: relative; padding: 0; min-height: var(--tap); aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.arrays canvas { display: block; width: 100%; height: 100%; }
.arrays b { position: absolute; left: 3px; right: 3px; bottom: 3px; font: 500 9.5px/1.15 var(--font-mono); color: #fff; text-shadow: 0 0 4px #000, 0 0 2px #000; }
.arrays .empty canvas { opacity: 0.15; }
body.preview-mode .wavelength, body.preview-mode #more, body.preview-mode .plate-hint { display: none; }

.more { border-top: 1px solid var(--border); padding-top: 4px; }
.more summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 4px var(--s2); align-items: center; }
.tool { display: flex; gap: var(--s1); align-items: center; min-height: var(--tap); font-size: 13.5px; }
.tool input[type="checkbox"] { accent-color: var(--accent); width: 20px; height: 20px; }
.tool input[type="range"] { accent-color: var(--accent); width: 120px; min-height: var(--tap); }
.tool select { padding: 0 8px; }
.try { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s1); }
.try button { font-size: 13px; }
.chooser { display: grid; gap: var(--s1); margin-top: var(--s1); }
.chooser strong { color: var(--star); }
.chooser-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chooser-list button { font-size: 12.5px; }
body.picking #plate { cursor: cell; box-shadow: inset 0 0 0 2px var(--star); }

body.negative #plate, body.negative #plate-b, body.negative .arrays canvas, body.negative .film-tile canvas { filter: invert(1) hue-rotate(180deg); }
.plates:fullscreen { background: #000; }

/* ---------- Panels: What changed, Prediction, Evidence, Spectrum ---------- */

.explore-box { padding: 16px; border: 1px dashed var(--edge-strong); border-radius: 14px; display: grid; gap: 10px; }
.explore-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
.explore-grid > div { display: grid; gap: 8px; align-content: start; }
.explore-grid #measure { justify-self: start; }
.motion-result:empty { display: none; }
.motion-result { display: grid; gap: 6px; }
.big-number { font: 800 clamp(30px, 3.4vw, 46px)/1 var(--display); color: var(--accent); }
.big-number small { font-size: 0.36em; font-weight: 600; margin-left: 4px; }
.big-words { font: 600 18px/1.2 var(--display); color: var(--accent); }
.motion-result table { width: 100%; border-collapse: collapse; font-size: 14px; }
.motion-result th { text-align: left; color: var(--dim); font-weight: 400; padding: 2px 8px 2px 0; }
.motion-result td { text-align: right; }
.motion-result p { font-size: 14px; }
.measurements { list-style: none; padding: 0; display: grid; gap: 8px; }
.measurement { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; background: var(--card); border-radius: 10px; margin: 0; }
.measurement-value { font-weight: 600; }
.measurement small { flex-basis: 100%; color: var(--dim); }

.chart { min-height: 150px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: rgba(255, 255, 255, 0.12); stroke-width: 0.6; }
.chart .tick, .chart .axis { fill: var(--dim); font-size: 11px; }
.chart .feature { stroke: rgba(255, 255, 255, 0.32); stroke-width: 0.7; stroke-dasharray: 2 3; }
.chart .feature-label { fill: var(--ink); font-size: 10px; }
.chart .error { stroke: rgba(255, 255, 255, 0.3); stroke-width: 0.6; }
.chart .point { fill: rgba(255, 255, 255, 0.85); }
.chart .flagged { fill: none; stroke: var(--dim); stroke-width: 0.8; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.chart .area { stroke: none; fill: var(--accent); opacity: 0.16; }
#panel-spectrum .chart { max-width: 760px; }

.missing-measurements summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--solar); font-weight: 600; }
.data-table summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--solar); font-weight: 600; }
.table-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.data-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table caption { text-align: left; color: var(--dim); padding: 4px 0; }
.data-table th { text-align: left; color: var(--dim); font-weight: 500; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--edge-strong); position: sticky; top: 0; background: var(--panel); }
.data-table td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--edge); }

.trial { display: grid; gap: 12px; padding: 16px; background: var(--card); border: 1px solid var(--edge); border-radius: 14px; }
.trial + .trial { margin-top: 12px; }
.trial h4 { margin-top: 4px; }
.pred-figure { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); align-items: start; }
.pred-plot { max-width: 300px; }
.pred-figure .data-table { grid-column: 1 / -1; }
.pred-plot { width: 100%; height: auto; background: var(--panel); border-radius: 10px; }
.pred-plot .axis-line { stroke: rgba(230, 237, 247, 0.22); stroke-width: 1; }
.pred-plot .axis-text { fill: var(--dim); font-size: 12px; }
.pred-plot .region { fill: rgba(var(--band), 0.12); stroke: var(--star); stroke-width: 1.5; }
.pred-plot .pt-model { fill: var(--star); }
.pred-plot .pt-baseline { fill: var(--solar); }
.pred-plot .pt-observed { fill: #fff; stroke: var(--bg); stroke-width: 1.5; }
.plot-legend { list-style: none; padding: 0; display: grid; gap: 4px; font-size: 14px; margin-top: 6px; }
.plot-legend li { display: flex; align-items: center; gap: 8px; margin: 0; }
.plot-legend li::before { content: ''; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.plot-legend .pt-model::before { background: var(--star); }
.plot-legend .pt-baseline::before { background: var(--solar); }
.plot-legend .pt-observed::before { background: #fff; }
.plot-legend .region::before { border-radius: 50%; border: 1.5px solid var(--star); background: rgba(var(--band), 0.12); }
.verification { display: grid; gap: 8px; }
#changed-validated, #prediction-body, #evidence-body, #spectrum-note { display: grid; gap: 12px; }
#evidence-body h3 { margin-top: 8px; }
.credit { color: var(--dim); font-size: 13px; }

/* ---------- Learn and About ---------- */

.page-learn, .page-about { max-width: 1180px; margin: 0 auto; }
.cards-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s2); }
.page-card { position: relative; margin: 0; padding: var(--s3); display: grid; gap: var(--s1); align-content: start; border-radius: var(--radius); }
.lessons .page-card { padding-top: var(--s4); }
.lesson-number { position: absolute; top: var(--s2); right: var(--s2); font: 600 13px var(--font-mono); color: var(--accent); }
.page-card.lab { margin-top: var(--s3); display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s3); align-items: center; border-left: 3px solid var(--hypothetical); }
.lab-orbit { width: 120px; height: 60px; color: var(--hypothetical); }
.lab-sun { fill: var(--star); }
.lab-words { display: grid; gap: var(--s1); }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); align-items: start; }
.about-card { padding: var(--s3); display: grid; gap: 12px; }
.about-card h2 { font-size: 18px; }
.about-card ul { display: grid; gap: var(--s1); padding-left: 18px; }
.about-card li { margin: 0; color: var(--text); }
.about-full { grid-column: 1 / -1; }
.about-story { max-width: 75ch; }
.about-dl { display: grid; gap: var(--s2) var(--s3); margin: 0; }
.about-full .about-dl { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.about-dl > div { display: grid; gap: 4px; }
.about-dl dt { font-weight: 600; color: var(--text); }
/* Task B12: methods and limits as a list of titles, each opening its text. */
.about-terms { gap: 0 var(--s3); }
.about-term > summary { color: var(--text); }
.about-term > p { color: var(--muted); font-size: 14.5px; }
.about-dl dd { margin: 0; color: var(--muted); font-size: 14.5px; }
.about-card .source-list { list-style: none; padding-left: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--s2); }
.source { display: grid; gap: 6px; align-content: start; padding: var(--s2); border: 1px solid var(--edge); border-radius: 10px; }
.source h3 { font-size: 15.5px; }
.source p { font-size: 14px; color: var(--muted); }
.ack { margin: 0; padding: 4px 0 4px 12px; border-left: 2px solid var(--edge-strong); }
.ack p { font-size: 13.5px; color: var(--text); font-style: italic; }
.source-links { display: flex; flex-wrap: wrap; gap: 0 var(--s2); }
.source-links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.software-list li { font-size: 14.5px; }
.software-list code, .about-packages code, #about-packages code { font: 12.5px var(--font-mono); color: var(--muted); }
.team-list li { color: var(--muted); }
.reserved-list { list-style: none; padding-left: 0 !important; display: grid; gap: var(--s1); }
.reserved-item { display: grid; gap: 4px; justify-items: start; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.chip-reserved-released { color: var(--hit); border-color: rgba(95, 211, 141, 0.45); }
.chip-reserved-reserved { color: var(--miss); border-color: rgba(255, 181, 71, 0.45); }
.font-list { list-style: none; padding-left: 0 !important; }
.font-list li { display: grid; gap: 2px; }
.font-list strong { font-size: 17px; }
.font-list .font-head { font-family: var(--font-head); }
.font-list .font-text { font-family: var(--font-text); }
.font-list .font-mono { font-family: var(--font-mono); }
.font-list a { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 13.5px; }

/* ---------- Lessons and the Planet X Lab ---------- */

.learn-index { display: grid; gap: var(--s2); }
.lessons .page-card button { justify-self: start; margin-top: var(--s1); }
.lesson, .lab-view { padding: var(--s4); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); max-width: 920px; }
.lesson-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1); }
.lesson-head { display: grid; gap: var(--s1); }
.lesson-head h2 { font-size: clamp(24px, 3vw, 32px); }
/* Task B12: with a lesson or the Lab open, its own header leads; the Learn page heading steps aside. */
body[data-lesson]:not([data-lesson=""]) .page-learn > .page-head { display: none; }
.lab-head h2 { max-width: 28ch; line-height: 1.2; }
.lab-glance { display: grid; gap: var(--s2); }
.lab-glance:empty { display: none; }
.lab-glance .stat-tiles { margin: var(--s1) 0 0; }
.lab-play { display: grid; gap: var(--s1); }
.planetx-count { font-weight: 600; max-width: 62ch; }
.chip-line { display: flex; flex-wrap: wrap; gap: 6px; }
.round-task { font-weight: 600; max-width: 62ch; }
.lesson-part { display: grid; gap: 12px; }
.lesson-part h3 { font-size: 18px; }
.lesson-part ul { display: grid; gap: 6px; }
.formula { margin: 0; display: grid; gap: 12px; padding: var(--s2); border: 1px solid var(--border-strong); border-radius: var(--radius); background: rgba(5, 7, 13, 0.55); }
.formula figcaption { color: var(--muted); font-size: 14px; }
.math { display: grid; gap: 12px; overflow-x: auto; }
.math math { font-size: 1.35em; color: var(--text); }
.lesson-inputs dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.worked-steps, .worked-answer { font-family: var(--font-mono); font-size: 14px; }
.worked-answer { color: var(--accent); }
.exercises { display: grid; gap: var(--s2); padding-left: 32px; }
.exercises li { margin: 0; padding-left: 4px; }
.exercises li > * + * { margin-top: 6px; }
.exercises li::marker { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.answer-toggle summary { min-height: var(--tap); display: inline-flex; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; }
.answer-toggle p { padding: 10px 14px; border-left: 3px solid var(--hit); background: var(--raise); border-radius: var(--radius-sm); }
.answer-key { display: none; }
.chip-hypothetical { border-color: var(--hypothetical); color: var(--hypothetical); border-style: dashed; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: var(--s3); align-items: start; }
.lab-controls { display: grid; gap: var(--s2); padding: var(--s2); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.lab-controls > button { justify-self: start; }
.lab-slider { display: grid; gap: 4px; }
.lab-slider label { display: flex; justify-content: space-between; gap: var(--s1); font-size: 14px; }
.lab-slider output { color: var(--accent); font-size: 13px; }
.lab-slider input { width: 100%; min-height: var(--tap); accent-color: var(--hypothetical); }
.lab-results h3 { font-size: 16px; margin-bottom: var(--s1); }
.lab-list { display: grid; gap: 10px; margin: 0; }
.lab-row { display: grid; grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.4fr); gap: 4px 12px; padding: 10px 12px; background: var(--raise); border-radius: var(--radius-sm); }
.lab-row dt { color: var(--muted); font-size: 13.5px; }
.lab-row dd { margin: 0; display: grid; gap: 2px; }
.lab-value { color: var(--text); font-size: 16px; }
.lab-row small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* Printing from Learn: a plain white worksheet; answers on their own last page. */
@media print {
  @page { margin: 16mm; }
  body[data-page="learn"] { background: #fff !important; color: #000; font-size: 11pt; }
  body[data-page="learn"] :is(.topbar, .skip, .starfield, .example-banner, .notices, .caption, .tour-bar, .site-footer,
    .page:not(.page-learn), .page-head, .lesson-actions, .answer-toggle) { display: none !important; }
  body[data-page="learn"][data-lesson]:not([data-lesson=""]) .learn-index { display: none !important; }
  body[data-page="learn"] main { padding: 0; max-width: none; }
  body[data-page="learn"] :is(.glass, .lesson, .lab-view, .page-card) { background: #fff !important; box-shadow: none !important; border-color: #999 !important; backdrop-filter: none !important; }
  body[data-page="learn"] :is(.lesson, .lab-view) { border: 0 !important; padding: 0 !important; }
  body[data-page="learn"] :is(.lesson, .lab-view, .learn-index) * { color: #000 !important; }
  body[data-page="learn"] :is(.formula, .panel-note, .lab-row, .chip) { background: #fff !important; border-color: #888 !important; }
  body[data-page="learn"] .lesson-part, body[data-page="learn"] .exercises li { break-inside: avoid; }
  body[data-page="learn"] .exercises li { min-height: 50mm; }
  body[data-page="learn"] .exercises li::marker { color: #000; }
  body[data-page="learn"] .lesson a { text-decoration: none; }
  body[data-page="learn"] .print-brand { display: flex; align-items: center; gap: 3mm; font-size: 9pt; letter-spacing: 0.04em; border-bottom: 1px solid #999; padding-bottom: 2mm; margin-bottom: 2mm; }
  body[data-page="learn"] .print-brand img { height: 8mm; width: auto; }
  body[data-page="learn"] .lesson a::after { content: " (" attr(href) ")"; font-size: 9pt; }
  body[data-page="learn"] .answer-key { display: block; break-before: page; }
  body[data-page="learn"] .answer-key h3 { margin-bottom: 8mm; }
}

/* ---------- Text pages share a header ---------- */

.page-head { display: grid; gap: var(--s1); max-width: 860px; margin-bottom: var(--s3); }
/* Task B12: the page's h1 states the finding, so it reads as a headline rather than a poster title. */
.page-head h1 { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.15; max-width: 30ch; }
.page-head .lead { font-size: 16.5px; max-width: 62ch; }
.page-head .stat-tiles { margin: var(--s1) 0 var(--s1); }
.page-head .lead { color: var(--text); }

/* ---------- Beat the physics ---------- */

.page-game { max-width: 1240px; margin: 0 auto; }
.game-rounds { display: grid; gap: var(--s2); }
.round-picker { display: flex; flex-wrap: wrap; gap: var(--s1); }
.round-picker button { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s1); text-align: left; background: var(--glass); }
.round {
  display: grid;
  gap: var(--s2);
  padding: var(--s3);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.round-head { display: grid; gap: var(--s1); }
.round-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s3); align-items: start; }
.round-figure { margin: 0; display: grid; gap: 12px; }
.round-plot { width: 100%; max-width: 600px; }
.game-plot { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); touch-action: manipulation; cursor: crosshair; }
.game-plot .plot-area { fill: rgba(5, 7, 13, 0.6); stroke: var(--border-strong); }
.game-plot .grid { stroke: rgba(230, 237, 247, 0.08); }
.game-plot .tick { fill: var(--muted); font: 11px var(--font-mono); }
.game-plot .axis { fill: var(--text); font: 12px var(--font-text); }
.game-plot .point-label { fill: var(--muted); font: 11px var(--font-mono); }
.game-plot .track { fill: none; stroke: rgba(230, 237, 247, 0.4); stroke-width: 1.5; }
.game-plot .reveal-line { stroke: var(--accent); stroke-dasharray: 5 5; stroke-width: 1.5; }
.game-plot .baseline-line { stroke: var(--muted); stroke-dasharray: 6 5; stroke-width: 1.5; }
.game-plot .error-line { stroke-dasharray: 2 4; stroke-width: 1.2; }
.game-plot .error-player { stroke: var(--accent); }
.game-plot .error-baseline { stroke: var(--muted); }
.game-plot .error-model { stroke: var(--star); }
.region { fill: rgba(255, 224, 138, 0.12); stroke: var(--star); stroke-width: 1.5; }
.game-plot .mark { transform-box: fill-box; transform-origin: center; animation: mark-in var(--ease); }
@keyframes mark-in { from { transform: scale(0.4); } }
.mark-training circle { fill: var(--text); opacity: 0.8; }
.mark-player circle:first-child { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.mark-player circle:last-child { fill: var(--accent); }
.mark-baseline rect { fill: var(--muted); }
.mark-model path { fill: var(--star); }
.mark-actual path { stroke: var(--hit); stroke-width: 3.5; stroke-linecap: round; fill: none; }
.legend-icon { flex: none; overflow: visible; }
.game-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px var(--s2); font-size: 13.5px; }
.game-legend li { display: flex; align-items: center; gap: 6px; margin: 0; }
.round-side { display: grid; gap: 12px; align-content: start; }
.guess-inputs { margin: 0; padding: 12px var(--s2) var(--s2); border: 1px solid var(--border-strong); border-radius: var(--radius); display: grid; gap: 12px; min-width: 0; }
.guess-inputs legend { padding: 0 6px; font: 600 14px var(--font-head); }
.guess-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.guess-fields .field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.guess-fields input { width: 100%; font-family: var(--font-mono); }
.nudges { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reveal-steps { margin: 0; padding-left: 22px; display: grid; gap: 4px; color: var(--muted); }
.reveal-steps li { margin: 0; }
.reveal-steps li.done { color: var(--text); font-weight: 600; }
.reveal-steps li.done::marker { color: var(--hit); }
.round-status:empty { display: none; }
.round-status { color: var(--text); }
.round-results { display: grid; gap: 12px; }
.round-results:empty { display: none; }
.verdict { font: 600 19px/1.3 var(--font-head); color: var(--accent); }
.results-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.results-table caption { text-align: left; color: var(--muted); padding: 4px 0; font-size: 13px; }
.results-table th, .results-table td { text-align: left; padding: var(--s1) 10px var(--s1) 0; border-bottom: 1px solid var(--border); }
.results-table td { font-family: var(--font-mono); }
.results-table thead th { color: var(--muted); font-weight: 500; }
.results-table tbody th { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.results-table .is-best th, .results-table .is-best td { color: var(--hit); font-weight: 600; }
.actual-image { margin: 0; display: grid; gap: 6px; justify-items: start; }
.actual-image img { width: min(100%, 240px); aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: #000; border: 1px solid var(--border-strong); }
.actual-image figcaption { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.example-link { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s2); border: 1px dashed var(--miss); border-radius: var(--radius-sm); color: var(--miss); font-weight: 600; text-decoration: none; }

/* ---------- Predictions: ledger, open forecasts (task B4) ---------- */

.muted { color: var(--muted); }
.page-predictions { max-width: 1240px; margin: 0 auto; display: grid; gap: var(--s3); }
.page-predictions .page-head { margin-bottom: var(--s2); }
/* While the trial files load, only the heading and one loading line show, so nothing below them jumps. */
.page-predictions[data-loading] > :not(.page-head):not(#ledger-loading) { display: none !important; }
.page-predictions:not([data-loading]) #ledger-loading { display: none; }
.ledger-source {
  padding: 12px var(--s2);
  background: #2a1c05;
  border: 1px dashed var(--miss);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.ledger-board { display: grid; }
.board-details[open] { padding: var(--s2) var(--s3) var(--s3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--glass); }
.board-details > :not(summary) { max-width: none; margin-top: 12px; }
.category-title { font-size: 16px; margin-top: var(--s1); }
.category-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px var(--s2); margin: 0; }
.category-list dd { margin: 0; color: var(--muted); font-size: 14px; max-width: 70ch; }
.card-key { font-size: 15px; }
.card-key strong { font-weight: 600; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.board-table { border-collapse: collapse; font-size: 15px; min-width: 100%; }
.board-table th, .board-table td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.board-table thead th { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.board-table td { font: 500 18px/1 var(--font-mono); color: var(--muted); }
.board-table td.nonzero { color: var(--text); font-weight: 700; }
.board-table td.col-hit.nonzero { color: var(--hit); }
.board-table td.col-miss.nonzero { color: var(--miss); }
.board-notes { color: var(--muted); font-size: 14px; }
.category-notes summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--solar); font-weight: 600; }
.category-notes dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px var(--s2); margin: 0; }
.category-notes dd { margin: 0; color: var(--muted); font-size: 14px; }
.ledger-section { display: grid; gap: 12px; }
.ledger-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: var(--s2); align-items: start; }
.ledger-card { padding: var(--s2) var(--s3) var(--s3); display: grid; gap: 12px; border-left: 3px solid var(--border-strong); min-width: 0; }
.ledger-card.status-hit { border-left-color: var(--hit); }
.ledger-card.status-miss { border-left-color: var(--miss); }
.ledger-card.status-waiting, .forecast-card { border-left-color: var(--accent); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s1) var(--s2); flex-wrap: wrap; }
.card-head h3 { font-size: 19px; }
.card-head .chip-trial { font-size: 14px; font-weight: 700; padding: 4px 12px; }
.predicted { display: grid; gap: 2px; }
.predicted .mono { color: var(--muted); }
.receipt-line { font-size: 14px; }
.receipt-line .sha { font-family: var(--font-mono); font-weight: 600; }
.check-date { color: var(--accent); }
.card-actions { display: flex; flex-wrap: wrap; gap: var(--s1); }
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--raise);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
}
.button-link:hover { border-color: var(--accent); color: var(--accent); }
.residual-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.residual-table caption { text-align: left; color: var(--muted); padding: 0 0 6px; font-size: 13px; caption-side: bottom; padding-top: 6px; }
.residual-table th, .residual-table td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.residual-table td:last-child, .residual-table th:last-child { padding-right: 0; }
.residual-table thead th { color: var(--muted); font-weight: 500; }
.residual-table td { font-family: var(--font-mono); }
.residual-table tbody th { font-weight: 500; }
.chip-trial-insufficient_data, .chip-trial-none { border-color: var(--muted); color: var(--muted); border-style: dashed; }
.chip-trial-ambiguous { border-color: var(--variable); color: var(--variable); }
.chip-trial-invalid_comparison { border-color: var(--bad); color: var(--bad); }
.chip-trial-see_only { border-color: var(--other); color: var(--other); border-style: dashed; }
.chip-trial-open { border-color: var(--accent); color: var(--accent); }
.chip-pending { border: 1px dashed var(--hypothetical); color: var(--hypothetical); }
.forecast-figure { margin: 0; display: grid; gap: var(--s1); }
.forecast-plots { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-start; }
.forecast-plot { display: block; width: min(100%, 260px); height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); }
.forecast-plot.zoom { width: min(100%, 150px); }
.zoom-box { display: grid; gap: 4px; }
.forecast-plot .plot-bg { fill: rgba(5, 7, 13, 0.85); }
.forecast-plot .axis-line { stroke: rgba(230, 237, 247, 0.12); }
.forecast-plot .track { fill: none; stroke: rgba(230, 237, 247, 0.55); stroke-width: 1.5; stroke-dasharray: 4 4; }
.forecast-plot .track-dot { fill: var(--text); }
.forecast-plot .point-label { fill: var(--muted); font: 11px var(--font-mono); }
.forecast-plot .mark-model-dot { fill: var(--star); stroke: #000; }
.forecast-plot .mark-baseline-dot { fill: var(--muted); }
.forecast-plot .scale-bar line { stroke: var(--text); stroke-width: 2; }
.forecast-plot .scale-bar text, .forecast-plot .compass text { fill: var(--text); font: 600 11px var(--font-mono); }
.forecast-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px var(--s2); font-size: 13px; color: var(--muted); }
.forecast-legend li { margin: 0; }
.forecast-legend li::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.forecast-legend .lg-model::before { background: var(--star); transform: rotate(45deg) scale(0.85); }
.forecast-legend .lg-region::before { border: 1.5px solid var(--star); border-radius: 50%; background: rgba(255, 224, 138, 0.15); }
.forecast-legend .lg-track::before { border-top: 2px dashed var(--text); height: 0; width: 14px; vertical-align: 3px; }
.forecast-legend .lg-baseline::before { background: var(--muted); }

/* ---------- The reveal: full screen, made for a 1280×720 recording ---------- */

dialog.reveal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--text);
  overflow: auto;
}
dialog.reveal::backdrop { background: var(--bg); }
.reveal-shell { min-height: 100%; display: grid; grid-template-rows: auto 1fr; gap: 12px; padding: 14px var(--s3) var(--s2); }
.reveal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); }
.reveal-heading { display: grid; gap: 6px; min-width: 0; }
.reveal-heading h2 { font: 700 clamp(20px, 2.3vw, 28px)/1.15 var(--font-head); }
.reveal-head > button { flex: none; }
.reveal-body { display: grid; grid-template-columns: max-content minmax(300px, 640px); gap: var(--s3); align-items: start; }
.reveal-figure { margin: 0; display: grid; gap: 6px; }
.reveal-stage {
  position: relative;
  width: min(calc(100dvh - 150px), 60vw);
  min-width: 260px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #000;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.reveal-svg { display: block; }
.reveal-figure figcaption { font-size: 13px; }
.reveal-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.reveal-progress { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.reveal-progress li { margin: 0; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.reveal-progress li.done { color: var(--text); border-color: var(--border-strong); }
.reveal-progress li.now { color: var(--on-accent); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.reveal-text { display: grid; gap: 8px; }
.reveal-text h3 { font: 600 21px/1.25 var(--font-head); }
.reveal-text p { font-size: 16.5px; line-height: 1.5; }
.reveal-text .receipt-line { font-size: 15px; }
.reveal-text .panel-note { font-size: 14.5px; }
.rv-legend { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 16px; font-size: 14px; color: var(--muted); }
.rv-legend li { margin: 0; display: flex; align-items: center; gap: 8px; }
.rv-legend-icon { flex: none; overflow: visible; }
.reveal-numbers { display: grid; gap: 8px; }
.reveal-numbers:empty { display: none; }
.rv-verdict-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 16px; }
.rv-verdict-line .chip { font-size: 15px; font-weight: 700; padding: 4px 12px; }
.reveal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) 12px; }
.reveal-controls .hint { flex: 1 1 200px; }
.reveal-controls .primary { min-width: 240px; font-size: 16px; }
.verdict-banner {
  position: absolute;
  top: 12px;
  left: 12px;
  display: grid;
  gap: 2px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(5, 7, 13, 0.86);
  border: 2px solid var(--border-strong);
  pointer-events: none;
}
.verdict-banner strong { font: 700 34px/1 var(--font-head); letter-spacing: 0.02em; }
.verdict-banner span { font: 500 15px/1.3 var(--font-mono); }
.verdict-banner .d-words { font: 500 14px/1.3 var(--font-text); color: var(--muted); }
.verdict-banner.status-hit { border-color: var(--hit); }
.verdict-banner.status-hit strong { color: var(--hit); }
.verdict-banner.status-miss { border-color: var(--miss); }
.verdict-banner.status-miss strong { color: var(--miss); }
.verdict-banner.enter { animation: rv-banner 450ms ease-out both; }

.rv-bg { fill: #000; }
.eval-image { image-rendering: pixelated; }
.rv-image-frame { fill: none; stroke: rgba(230, 237, 247, 0.3); stroke-width: 1; }
.rv-focus { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 7 6; }
.rv-focus.fading { opacity: 0.4; }
.rv-track { fill: none; stroke: rgba(230, 237, 247, 0.85); stroke-width: 2.5; stroke-linejoin: round; }
.rv-training circle { fill: var(--text); stroke: #000; stroke-width: 2; }
.rv-model path { fill: var(--star); stroke: #000; stroke-width: 2; }
.rv-region { fill: rgba(255, 224, 138, 0.18); stroke: var(--star); stroke-width: 3; }
.rv-test-region { fill: none; stroke: var(--star); stroke-width: 2.5; stroke-dasharray: 9 7; }
.rv-baseline rect { fill: #b9c4d4; stroke: #000; stroke-width: 2; }
.rv-baseline-line { stroke: #b9c4d4; stroke-width: 2.5; stroke-dasharray: 9 7; }
.rv-observed .cross-halo { stroke: #000; stroke-width: 10; stroke-linecap: round; fill: none; }
.rv-observed .cross { stroke: var(--hit); stroke-width: 5; stroke-linecap: round; fill: none; }
.rv-residual { stroke: var(--hit); stroke-width: 2; stroke-dasharray: 3 5; }
.rv-pulse { fill: none; stroke: var(--hit); stroke-width: 3; }
.rv-callout line { stroke: var(--text); stroke-width: 1.5; }
.rv-callout rect { fill: rgba(5, 7, 13, 0.9); stroke: var(--border-strong); }
.rv-callout text { fill: var(--text); font: 600 16px var(--font-text); }
.rv-callout.small text { font-size: 14px; }
.rv-date { fill: var(--text); font: 600 14px var(--font-mono); paint-order: stroke; stroke: #000; stroke-width: 5px; stroke-linejoin: round; }
.rv-chip-bg { fill: rgba(5, 7, 13, 0.75); }
.rv-scale line { stroke: var(--text); stroke-width: 3; }
.rv-scale text { fill: var(--text); font: 600 14px var(--font-mono); }
.rv-compass line { stroke: var(--text); stroke-width: 2; }
.rv-compass text { fill: var(--text); font: 700 14px var(--font-text); paint-order: stroke; stroke: #000; stroke-width: 4px; }

.enter.pop { animation: rv-pop 420ms cubic-bezier(0.2, 1.5, 0.4, 1) both; transform-box: fill-box; transform-origin: center; }
.enter.grow { animation: rv-grow 700ms cubic-bezier(0.2, 0.9, 0.3, 1) both; transform-box: fill-box; transform-origin: center; }
.enter.fade { animation: rv-fade 500ms ease-out both; }
.rv-track.enter.draw { animation: rv-draw 900ms ease-in-out both; }
.rv-pulse.enter { animation: rv-pulse 900ms ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes rv-pop { from { transform: scale(0); opacity: 0; } }
@keyframes rv-grow { from { transform: scale(0.04); opacity: 0; } }
@keyframes rv-fade { from { opacity: 0; } }
@keyframes rv-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
@keyframes rv-pulse { from { transform: scale(0.6); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
@keyframes rv-banner { from { transform: translateY(-12px); opacity: 0; } }

/* ---------- Top bar extras and the two help dialogs ---------- */

.icon-button { flex: none; width: var(--tap); padding: 0; font: 700 18px/1 var(--font-head); background: transparent; border-color: var(--border-strong); }
.nav .nav-extra { color: var(--accent); border: 1px dashed var(--border-strong); margin-left: var(--s1); }
.nav .nav-extra:hover { border-color: var(--accent); }
dialog.sheet {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet-box { padding: var(--s3); display: grid; gap: var(--s2); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.keys-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--s3); }
.keys-group { display: grid; gap: var(--s1); align-content: start; }
.keys-group h3 { font-size: 15px; color: var(--muted); }
.keys-group dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px var(--s2); margin: 0; align-items: center; }
.keys-group dd { margin: 0; font-size: 14px; }
.keycaps { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.key-sep { color: var(--muted); font-size: 13px; }
kbd {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--raise);
  font: 600 13px/1.5 var(--font-mono);
  text-align: center;
}
.limits-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s3); }
.limits-group { display: grid; gap: var(--s1); align-content: start; }
.limits-group.can h3 { color: var(--hit); }
.limits-group.cannot h3 { color: var(--miss); }
.limits-group li { font-size: 14.5px; }
/* "What Vestigium can and can't do" (task B19): two columns on wide screens, "It can" first on phones; each limit
   is followed by what we do about it, on its own line starting with "→", in a muted colour. */
#limits.sheet { width: min(1220px, calc(100vw - 32px)); }
#limits .limits-body { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--s2) var(--s3); }
#limits .limits-group li { font-size: 14px; }
#limits .limits-group ul { padding-left: 16px; }
.limits-group ul { display: grid; gap: 10px; padding-left: 18px; margin: 0; }
.limits-list li p { margin: 0; }
.limits-do { color: var(--muted); font-size: 14px; margin-top: 2px !important; }

@media (max-width: 1239px) {
  .menu-toggle { display: inline-flex; align-items: center; }
  .nav {
    position: fixed;
    top: var(--topbar);
    right: var(--s1);
    z-index: 41;
    display: none;
    flex-direction: column;
    min-width: 240px;
    padding: var(--s1);
    background: #0b111e;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav button { justify-content: flex-start; text-align: left; }
  .nav button[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  .nav .nav-extra { margin: var(--s1) 0 0; }
}
@media (max-width: 1100px) {
  .reveal-body { grid-template-columns: minmax(0, 1fr); }
  .reveal-stage { width: min(100%, calc(100dvh - 120px)); margin: 0 auto; }
}

@media (max-width: 720px) {
  .reveal-shell { padding: 10px 12px 16px; }
  .reveal-text p { font-size: 16px; }
  .reveal-controls .primary { min-width: 0; flex: 1 1 200px; }
  .verdict-banner { top: auto; left: auto; right: 8px; bottom: 8px; padding: 6px 12px; grid-template-columns: auto auto; align-items: baseline; gap: 10px; }
  .verdict-banner strong { font-size: 22px; }
  .verdict-banner span { font-size: 13px; }
  .verdict-banner .d-words { display: none; }
  .ledger-board, .ledger-card { padding: var(--s2); }
  .sheet-box { padding: var(--s2); }
  .keys-group dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .keys-group dd { margin-bottom: 8px; }
}

/* ---------- Embedded viewer ---------- */

/* ?embed=1: the viewer and its See section only, for an <iframe> on another site. No top bar, map, tour or
   other panels; "Open in TENGER" leads to the same view on the full site (data credits are on About). */
.embed-open { display: none; }
body.embed { --topbar: 0px; --chrome: calc(var(--topbar) + var(--banner)); }
body.embed .topbar, body.embed .site-footer, body.embed .panel-nav, body.embed .inv-share, body.embed #embed-code,
body.embed #inv-back, body.embed .panel:not(.panel-see), body.embed .page-home, body.embed #starfield,
body.embed .tour-bar, body.embed .skip { display: none !important; }
body.embed .embed-open { display: inline-flex; align-items: center; min-height: var(--tap); margin-left: auto; font-size: 13px; font-weight: 600; }
body.embed main { padding: 0; }
body.embed .panel-title { top: 0; }
.inv-share { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s1); }
.embed-code { width: 100%; font-size: 12px; padding: 8px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); resize: vertical; }

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  /* The investigation becomes a full-screen sheet: header, stage, then the panel sections. */
  .page-investigate {
    display: block;
    overflow-y: auto;
    padding: 0;
    background: var(--bg);
    animation: sheet-in var(--ease);
  }
  @keyframes sheet-in { from { transform: translateY(24px); } }
  .inv-head, .inv-panel { animation: none; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .inv-head { border-top: 0; }
  .inv-panel { overflow: visible; }
  .stage { padding: 12px; }
  .stage-view { flex: none; display: block; }
  .plates { flex: none; width: 100%; height: auto; flex-direction: column; container-type: normal; }
  .plate-frame, body[data-layout="compare"] .plate-frame { width: 100%; }
  .plates[data-mode="swipe"] .plate-b { width: 100%; }
  .panel-title { top: 61px; }
}

@media (max-width: 900px) {
  .nav-more { width: 100%; }
  .nav-more-list { position: static; min-width: 0; box-shadow: none; margin-top: 4px; }
  .sky-panel { position: fixed; inset: calc(var(--chrome) + var(--s1)) var(--s1) auto var(--s1); width: auto; max-height: calc(100vh - var(--chrome) - 16px); overflow-y: auto; }
}

@media (max-width: 720px) {
  .example-banner { font-size: 12.5px; }
  main { padding: calc(var(--chrome) + var(--s2)) var(--s2) var(--s4); }
  .site-footer { padding: var(--s2); }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .chips li { flex: none; }
  .timebar { padding: 12px; }
  .timebar-track { flex-wrap: wrap; }
  .film { flex-basis: 100%; order: 2; }
  .segment { width: 100%; }
  .segment button { flex: 1; padding: 0 6px; }
  .pred-figure { grid-template-columns: 1fr; }
  .round { padding: 12px; }
  .about-grid { grid-template-columns: 1fr; }
  .lesson, .lab-view { padding: var(--s2); }
  .lab-grid { grid-template-columns: 1fr; }
  .lab-row { grid-template-columns: 1fr; }
  .page-card.lab { grid-template-columns: 1fr; }
  .round-grid { grid-template-columns: minmax(0, 1fr); }
  .ring-label.minor { display: none; }
  .map-marker { font-size: 12px; }
  .facts { grid-template-columns: minmax(72px, max-content) minmax(0, 1fr); gap: 2px 8px; }
  .sky { height: 300px; }
}

@media (hover: none) {
  .plate-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .site-footer, .panel-nav, .ambient, .starfield, .example-banner a { display: none; }
  body { background: #fff; color: #000; }
  main { padding-top: 0; }
}

/* ---------- Asteroid batch (B6): calibration summary, D chart, error scatter, one card per asteroid ---------- */
#ledger-batch-host[hidden] { display: none; }
.batch-section { padding: var(--s3); border-radius: var(--radius); border: 1px solid var(--border); background: rgba(5, 7, 13, 0.35); }
.batch-summary { display: grid; gap: 6px; padding: var(--s2) var(--s3); border-left: 3px solid var(--accent); background: rgba(var(--accent-rgb), 0.06); border-radius: var(--radius-sm); }
.batch-headline { font-size: clamp(20px, 4.6vw, 26px); line-height: 1.25; }
.batch-charts { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s2); align-items: start; }
.batch-figure { display: grid; gap: 8px; min-width: 0; margin: 0; }
.batch-figure figcaption { color: var(--dim); font-size: 14px; }
.batch-chart { width: 100%; height: auto; display: block; background: rgba(5, 7, 13, 0.5); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.batch-errors { max-width: 300px; }
.batch-chart .grid { stroke: var(--border); stroke-width: 1; }
.batch-chart .tick, .batch-chart .axis { fill: var(--muted); font: 11px var(--font-mono); }
.batch-chart .limit { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; }
.batch-chart .limit-label { fill: var(--text); font: 600 11px var(--font-mono); }
.batch-chart .diagonal { stroke: var(--border-strong); stroke-dasharray: 4 4; }
.batch-chart .inside { fill: var(--hit); }
.batch-chart .outside { fill: var(--miss); stroke: var(--bg); stroke-width: 1; }
.batch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--s2); align-items: start; }
.batch-card { padding: 12px var(--s2); display: grid; gap: 8px; border-left: 3px solid var(--border-strong); min-width: 0; }
.batch-card.is-inside { border-left-color: var(--hit); }
.batch-card.is-outside { border-left-color: var(--miss); }
.batch-card h4 { font-size: 16px; }
.batch-card .chip { font-size: 13px; font-weight: 700; }
.batch-card-body { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; }
/* A forecast not checked yet has no plot: its facts take the whole card. */
.batch-card-body > .batch-facts:only-child { grid-column: 1 / -1; }
.batch-mini { width: 96px; height: 96px; display: block; background: var(--panel); border-radius: 8px; }
.batch-mini .axis-line { stroke: rgba(230, 237, 247, 0.18); stroke-width: 1; }
.batch-mini .axis-text { fill: var(--dim); font-size: 9px; }
.batch-mini .region { fill: rgba(var(--band), 0.12); stroke: var(--star); stroke-width: 1.2; }
.batch-mini .forecast { fill: var(--star); }
.batch-mini .observed { stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.batch-facts { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 14px; }
.batch-facts dt { color: var(--dim); }
.batch-facts dd { margin: 0; overflow-wrap: anywhere; }
.batch-lesson .results-table { max-width: 520px; }
@media (max-width: 720px) {
  .batch-charts { grid-template-columns: minmax(0, 1fr); }
  .batch-errors { max-width: 260px; }
}
@media (max-width: 400px) {
  .batch-card-body { grid-template-columns: minmax(0, 1fr); }
  .batch-section { padding: var(--s2); }
}
.batch-chart .closer-model { fill: var(--star); }
.batch-chart .closer-line { fill: var(--solar); stroke: var(--bg); stroke-width: 1; }
.planetx-gaps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.planetx-gaps td { white-space: nowrap; }
.planetx-gaps td.found, .planetx-gaps td.reach { white-space: normal; min-width: 14em; }
.planetx-gaps tbody th { min-width: 12em; }
.planetx-gaps .found-source { display: block; color: var(--muted); font-size: 12px; }
.planetx-gaps tr.reach-partial > * { background: rgba(255, 169, 77, 0.08); }
.planetx-chart .marker-number { font: 700 11px var(--font-mono); }
.planetx-key { margin: 0; padding-left: 1.6em; display: grid; gap: 2px; font-size: 13px; color: var(--dim); }
.planetx-key li::marker { color: var(--hypothetical); font-weight: 700; font-family: var(--font-mono); }

/* ---------- Beat the physics, help for the player (B7) ---------- */
.howto { border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: var(--radius); background: rgba(var(--accent-rgb), 0.05); padding: 0 var(--s2); }
.howto summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font: 600 16px var(--font-head); }
.howto-body { display: grid; gap: 8px; padding-bottom: var(--s2); }
.howto-body ol { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.timeline { margin: 0; display: grid; gap: 4px; }
.tl-track { position: relative; height: 66px; margin: 0 6px; }
.tl-line { position: absolute; left: 0; right: 0; top: 22px; border-top: 1px dashed var(--border-strong); }
.tl-ahead { position: absolute; top: 21px; height: 3px; background: rgba(var(--accent-rgb), 0.55); border-radius: 2px; }
.tl-mark { position: absolute; top: 17px; height: 11px; border-radius: 6px; background: var(--text); opacity: 0.85; transform: translateX(-3px); }
.tl-date { position: absolute; top: 32px; transform: translateX(-50%); font: 11px var(--font-mono); color: var(--muted); white-space: nowrap; }
.tl-date-first { transform: translateX(-3px); }
.tl-diamond { position: absolute; right: -5px; top: 17px; width: 11px; height: 11px; transform: rotate(45deg); border: 2px solid var(--accent); background: var(--bg); }
.tl-target { position: absolute; right: -4px; top: 0; font: 600 11.5px var(--font-mono); color: var(--accent); white-space: nowrap; }
.tl-summary { font-size: 13.5px; color: var(--accent); }
.hints { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px var(--s2) var(--s2); display: grid; gap: 8px; }
.hints h3 { font-size: 15px; }
.hint-list { display: grid; gap: 8px; }
.hint-list:empty { display: none; }
.game-hint { border-left: 3px solid var(--hypothetical); padding: 2px 0 2px 10px; display: grid; gap: 4px; }
.game-hint h4 { font-size: 14px; color: var(--hypothetical); }
.hint-sketch { margin: 0; display: grid; gap: 2px; }
.hint-sketch svg { width: 100%; max-width: 240px; height: auto; background: var(--panel); border-radius: 8px; }
.hint-sketch .sketch-straight { stroke: var(--muted); stroke-dasharray: 4 4; }
.hint-sketch .sketch-path { fill: none; stroke: var(--hypothetical); stroke-width: 2; }
.game-plot .hint-arrow { stroke: var(--hypothetical); stroke-width: 2.5; }
.game-plot .hint-head { fill: var(--hypothetical); }
.game-plot .hint-ruler { stroke: var(--hypothetical); stroke-width: 1.5; stroke-dasharray: 6 4; }
.game-plot .hint-tick { stroke: var(--hypothetical); stroke-width: 1.5; }
.game-plot .hint-end { fill: none; stroke: var(--hypothetical); stroke-width: 2; }
.game-plot .hint-label { fill: var(--hypothetical); font: 10.5px var(--font-mono); }
.game-plot .hint-label-end { font-weight: 700; }
.explain-line { border-left: 3px solid var(--star); padding-left: 10px; }
.tl-date-end { transform: translateX(calc(-100% + 3px)); }
.tl-date-low { top: 47px; }

@media (max-width: 420px) {
  /* The time control's date stays compact on the narrowest phones (one row with LIVE, play and the slider). */
  .time-date { font-size: 12.5px; }
}

/* ---------- Task B15: the Predictions page as a story ---------- */
.story-head h1 { max-width: 22ch; }
.story-head .lead { max-width: 60ch; }
.story-cta { margin: var(--s2) 0 0; }
.story-cta .primary { min-height: var(--tap); padding: 0 var(--s3); font-size: 16px; }
.story-steps { list-style: none; counter-reset: story-step; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.story-step { counter-increment: story-step; position: relative; padding: var(--s2); display: grid; gap: 6px; align-content: start; min-width: 0; }
.story-step h3 { font-size: 17px; margin: 0; }
.story-step p { margin: 0; font-size: 15px; line-height: 1.45; }
.story-num {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font: 700 15px/1 var(--font-head);
}
.story-num::before { content: counter(story-step); }
.story-arcsec { margin: 0; }
.story-group { display: grid; gap: 12px; margin: 0 0 var(--s3); }
.story-group h3 { font-size: 18px; margin: 0; }
.story-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s2); align-items: start; }
.story-card .card-head h4 { font-size: 19px; margin: 0 0 4px; }
.story-card .stamps { margin: 0; }
.story-sentence { margin: 0; font-size: 16px; line-height: 1.45; }
.story-pending { margin: 0; color: var(--muted); font-size: 13px; }
.text-link { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 14px; color: var(--accent); }
.story-card .card-actions { align-items: center; gap: var(--s1) var(--s2); }
.story-untested { margin: 0; color: var(--muted); }
.story-untested-list { margin: var(--s1) 0 0; padding-left: 1.2em; color: var(--muted); font-size: 14px; }
.story-check { padding: var(--s2) var(--s3); border-left: 3px solid var(--accent); max-width: 560px; }
.story-check h2 { font-size: 20px; margin: 0; }
.story-check p { margin: 0; }
.page-predictions details.more-info > .ledger-list,
.page-predictions details.more-info > #ledger-batch-host,
.page-predictions details.more-info > .ledger-board,
.page-predictions details.more-info > section { max-width: 100%; }
.page-predictions > details.board-details { margin-top: var(--s2); }
.reveal-text .rv-plain { font-size: 17px; line-height: 1.5; }
.reveal-text .rv-more { margin-top: var(--s1); }
@media (max-width: 1000px) { .story-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .story-steps { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .story-step { padding: 12px var(--s2); }
  .story-check { padding: var(--s2); }
}

.story-steps > .story-step { margin: 0; }
.story-step { grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; align-items: center; }
.story-step > :not(.story-num):not(h3) { grid-column: 1 / -1; }
.story-card .card-head h4 { color: var(--text); }

/* Task B18: the zoomed inset of the reveal (steps 4–6). */
.rv-inset-bg { fill: #05070d; }
.rv-inset-frame { fill: none; stroke: var(--text); stroke-width: 1.5; }
.rv-inset-band { fill: rgba(5, 7, 13, 0.85); }
.rv-inset-title { fill: var(--text); font: 600 13px var(--font-text); }
.rv-inset-residual { stroke: var(--hit); stroke-width: 1.5; }
.rv-inset-model { fill: var(--star); stroke: #000; stroke-width: 1; }
.rv-inset-observed { stroke: var(--hit); stroke-width: 1.75; stroke-linecap: round; fill: none; }
.rv-inset-observed-halo { stroke: #000; stroke-width: 3.5; stroke-linecap: round; fill: none; }
.rv-inset-label { fill: var(--text); font: 700 14px var(--font-mono); paint-order: stroke; stroke: #000; stroke-width: 4px; }
.rv-inset-scale { stroke: var(--text); stroke-width: 2.5; }
.rv-inset-scale-text { fill: var(--text); font: 600 12px var(--font-mono); paint-order: stroke; stroke: #000; stroke-width: 3px; }
.rv-inset-pane .rv-region, .rv-inset-pane .rv-test-region { stroke-width: 1.25; }
.rv-inset-pane .rv-test-region { stroke-dasharray: 5 4; }
.rv-zoom-mark { fill: none; stroke: var(--text); stroke-width: 1.5; }
.rv-zoom-link { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.8; }

/* ---------- Task B20: Beat the physics for a first-time player ---------- */
.round-picker button { min-height: var(--tap); font-weight: 600; }
.round-picker button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.page-game .round-head h2 { font-size: 20px; }
.game-plot .track-easy { stroke: rgba(230, 237, 247, 0.75); stroke-width: 2; }
.game-plot .track-head { fill: rgba(230, 237, 247, 0.9); }
.game-plot .game-compass line { stroke: var(--text); stroke-width: 1.5; }
.game-plot .game-compass text { fill: var(--text); font: 700 12px var(--font-text); }
.game-plot .game-scale line { stroke: var(--text); stroke-width: 2.5; }
.game-plot .game-scale text { fill: var(--text); font: 11.5px var(--font-text); }
.game-plot .hint-label { font-size: 11.5px; }
.mode-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.mode-switch .mode-option { min-height: var(--tap); border: 0; border-radius: 0; background: var(--raise); color: var(--muted); padding: 0 var(--s2); font-weight: 600; }
.mode-switch .mode-option[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.mode-switch .mode-option:disabled { opacity: 0.6; }
.easy-note { margin: 0; color: var(--muted); font-size: 14px; }
.plain-result { margin: 0; font-size: 17px; line-height: 1.45; font-weight: 600; }
.stars { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1); margin: 0; }
.star-marks { font-size: 30px; letter-spacing: 2px; color: var(--star); line-height: 1; }
.star-words { color: var(--text); }
.round-next { display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0; }
.round-side { display: grid; gap: 12px; align-content: start; }
.page-game .page-head .lead { max-width: 52ch; }
@media (max-width: 720px) {
  .page-game .page-head h1 { font-size: 26px; }
  .page-game .page-head .lead { font-size: 15px; margin-top: 4px; }
  .round-picker { gap: 6px; }
  .round-picker button { padding: 0 12px; font-size: 14px; }
}
.mode-switch { justify-self: start; }

/* Task B24: Challenge a friend. */
.challenge-banner { margin: 0 0 var(--s2); padding: 12px var(--s2); border: 1px solid var(--star); border-radius: var(--radius-sm); background: rgba(255, 224, 138, 0.08); font-weight: 600; }
.challenge-outcome { margin: 0; font-size: 17px; font-weight: 700; color: var(--star); }
.challenge-form { display: grid; gap: 6px; max-width: 420px; padding: 12px var(--s2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.challenge-form input { min-height: var(--tap); }
.challenge-form .note { margin: 0; }
.challenge-actions { display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0; }

/* Task B27a: an open target covers the live 3D scene completely: an opaque view, and the scene, its controls,
   labels, time bar, colour key and captions hidden (not just faded) and out of reach until Back or All targets. */
body[data-page="investigate"] .page-investigate { background: var(--bg); }
body[data-page="investigate"] .page-home .home-stage :is(.space3d, .space3d *, .space-tools, .space-hud, .space-time, .map-caption.space-3d-only, .map-key, .console-left),
body[data-page="investigate"] .page-home .home-hero { visibility: hidden !important; pointer-events: none !important; }

/* ---------- Home is the Solar System (task B29) ---------- */
/* One view: the 3D Solar System fills Home below the header. Over it: a compact title block (top-left), the Famous
   targets rail (right; phones: a swipe row at the bottom), the icon toolbar, the Key and the "not to scale" chip
   (bottom-left) and one compact time bar (bottom-centre). */
.page-home { --famous-w: 300px; }
.home-hero {
  position: absolute; top: var(--s2); left: var(--s2); z-index: 6; width: min(340px, calc(100% - var(--famous-w) - 64px));
  display: grid; justify-items: start; gap: 8px; padding: 14px 16px 16px;
  background: rgba(5, 7, 13, 0.8); border: 1px solid var(--border); border-radius: var(--radius);
}
.hero-title { font: 700 clamp(26px, 2.5vw, 32px)/1.05 var(--font-head); letter-spacing: -0.01em; margin: 0; }
.hero-title:focus { outline: none; }
.hero-line { margin: 0; font-size: 15px; line-height: 1.4; color: #c3cddb; }
.hero-watch {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 18px; margin-top: 2px;
  border-radius: var(--radius); background: var(--accent); color: #04121d; font: 700 15.5px var(--font-head); text-decoration: none;
  box-shadow: 0 6px 22px rgba(var(--accent-rgb), 0.25);
}
.hero-watch:hover { filter: brightness(1.08); }
.hero-watch:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
/* The Planet X chip: one link to the Lab, in the hypothetical orange. */
.hero-planetx {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255, 169, 77, 0.6); background: rgba(255, 169, 77, 0.1); color: var(--text); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.hero-planetx:hover { background: rgba(255, 169, 77, 0.18); border-color: var(--hypothetical); }
.hero-planetx:focus-visible { outline: 3px solid var(--hypothetical); outline-offset: 3px; }
.hero-planetx-new { color: var(--hypothetical); font-weight: 700; }

/* The Famous targets rail. */
.famous {
  position: absolute; top: var(--s2); right: var(--s2); bottom: var(--s2); width: var(--famous-w); z-index: 5;
  display: flex; flex-direction: column; gap: 6px; padding: 10px; min-height: 0;
  background: rgba(5, 7, 13, 0.74); border: 1px solid var(--border); border-radius: var(--radius);
}
.famous-title { margin: 2px 4px 0; font: 600 12.5px var(--font-head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.famous-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
.filter-chip::before { content: ''; position: absolute; inset: -4px 0; }
.filter-chip { position: relative; }
.filter-chip:hover { color: var(--text); border-color: var(--accent); }
.filter-chip[aria-pressed="true"] { color: #04121d; background: var(--accent); border-color: var(--accent); }
.famous-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.famous-list li { margin: 0; }
.famous-card {
  width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 3px 8px; text-align: left;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: var(--radius-sm);
  color: var(--text); transition: opacity 0.25s ease, background 0.2s ease;
}
.famous-card:hover { border-color: var(--border-strong); border-left-color: var(--c); background: rgba(var(--accent-rgb), 0.07); }
.famous-card[aria-pressed="true"] { border-color: var(--accent); border-left-color: var(--c); background: rgba(var(--accent-rgb), 0.15); }
.famous-card.is-dim { opacity: 0.35; }
.famous-thumb { flex: none; width: 40px; height: 40px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.04); }
.famous-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.famous-dot, .pop-thumb .famous-dot { display: grid; place-items: center; width: 100%; height: 100%; }
.famous-dot::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.famous-words { display: grid; gap: 1px; min-width: 0; }
.famous-words strong { font: 600 14px/1.25 var(--font-head); }
/* Task B29g: a card line wraps rather than cut a qualifier ("confirmation pending") off with an ellipsis. */
.famous-words small { font-size: 12.5px; line-height: 1.3; color: var(--muted); }

/* The popup of a chosen target. */
.target-pop {
  position: absolute; top: var(--s2); right: calc(var(--famous-w) + 2 * var(--s2)); z-index: 7; width: 300px;
  display: grid; gap: 10px; padding: 14px 14px 14px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.target-pop[hidden] { display: none; }
.pop-head { display: flex; gap: 12px; align-items: center; padding-right: 36px; }
.pop-thumb { flex: none; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, 0.04); }
.pop-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.target-pop h3 { margin: 0; font: 700 18px/1.2 var(--font-head); }
.pop-line { margin: 2px 0 0; color: #c3cddb; font-size: 14px; }
.pop-status { margin: 0; }
.pop-close { position: absolute; top: 4px; right: 4px; width: var(--tap); min-width: var(--tap); padding: 0; font-size: 22px; line-height: 1; }
.pop-see { width: 100%; }

/* Space labels: the chosen target and the type filter. */
.space-label.is-selected { color: #04121d; background: var(--accent); border-color: var(--accent); }
.space-label.is-match { border-width: 2px; }
.space-label.is-dimmed:not(.is-faded):not(.is-end-on) { opacity: 0.35; }

/* The icon toolbar, bottom-left. */
.space-tools { top: auto; bottom: var(--s2); left: var(--s2); flex-wrap: nowrap; gap: 6px; }
.tool-icon, .space-fly > summary.tool-icon { width: var(--tap); min-width: var(--tap); padding: 0; justify-content: center; }
.space-fly > summary.tool-icon::after { display: none; }
.tool-text { font: 700 13px var(--font-head); }
.space-fly-list { top: auto; bottom: calc(100% + 6px); width: 300px; }

/* The Key (with the "Planets on …" line, the layers and About this map) and the chip, above the toolbar. */
.map-key { top: auto; right: auto; left: var(--s2); bottom: calc(var(--s2) + var(--tap) + 8px); width: auto; max-width: 320px; padding: 0 12px; }
/* Open, the Key may cover the title block (it is the visitor's choice); it never runs under the toolbar. */
.map-key[open] { z-index: 8; width: 320px; padding-bottom: 12px; max-height: calc(100% - var(--tap) - 40px); overflow-y: auto; overscroll-behavior: contain; }
.map-key summary { min-height: 40px; font-size: 13.5px; }
.map-key .space-hud { position: static; inset: auto; padding: 6px 10px; margin: 4px 0 8px; background: rgba(5, 7, 13, 0.4); pointer-events: auto; }
.key-line { margin: 0 0 8px; }
.key-layers { display: grid; gap: 2px; margin: 10px 0 4px; }
.key-layers .eyebrow { margin: 0; }
.map-caption { left: calc(var(--s2) + 92px); right: auto; bottom: calc(var(--s2) + var(--tap) + 8px); max-width: none; margin: 0; padding: 4px 12px; min-height: 40px; display: inline-flex; align-items: center; font-size: 12.5px; }

/* Switches: Auto rotate (time bar) and the Key's layers. */
.switch { display: inline-flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: var(--tap); padding: 0 6px; background: transparent; border: 0; color: var(--text); font-weight: 600; font-size: 13.5px; }
.switch-track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); border: 1px solid var(--border-strong); transition: background 0.2s ease; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 0.2s ease, background 0.2s ease; }
.switch[aria-checked="true"] .switch-track { background: rgba(var(--accent-rgb), 0.35); border-color: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(16px); background: var(--accent); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* One compact time bar, bottom-centre between the toolbar and the rail. */
.space-time {
  bottom: var(--s2); left: calc(var(--s2) + 4 * var(--tap) + 30px); right: calc(var(--famous-w) + 2 * var(--s2));
  max-width: calc(100% - var(--famous-w) - 4 * var(--tap) - 80px); gap: 6px 12px; padding: 2px 10px;
}
.space-time .time-date { font-size: 15px; }
.space-time .time-speed { min-width: 150px; }
.space-time .time-speed input[type="range"] { width: 150px; }
.space-time .time-live { min-width: 64px; font-size: 12.5px; }

/* The hint over the scene; gone after the first interaction. */
.space-hint {
  position: absolute; z-index: 4; left: calc(var(--s2) + 360px); right: calc(var(--famous-w) + 2 * var(--s2)); top: var(--s2);
  width: fit-content; margin: 0 auto; padding: 6px 14px; border-radius: 999px; pointer-events: none;
  background: rgba(5, 7, 13, 0.72); border: 1px solid var(--border); color: #c3cddb; font-size: 13px; transition: opacity 0.6s ease;
}
.space-hint[hidden] { display: none; }
.space-hint.is-gone { opacity: 0; }

/* The 2D map (no WebGL, or the visitor's choice) in the free area. */
.map-stage { left: var(--s2); right: calc(var(--famous-w) + 2 * var(--s2)); top: var(--s2); bottom: calc(2 * var(--tap) + 32px); }

/* Search: a small icon in the header; the box opens under it. */
.head-search { position: relative; flex: none; }
.head-search > summary { list-style: none; display: inline-grid; place-items: center; height: var(--tap); cursor: pointer; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); }
.head-search > summary::-webkit-details-marker { display: none; }
.head-search[open] > summary { border-color: var(--accent); color: var(--accent); }
.head-search-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: min(380px, calc(100vw - 16px)); padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow); }
.head-search .search-line { grid-template-columns: minmax(0, 1fr) auto; }
.head-search .search-line input { grid-column: auto; min-height: 42px; font-size: 15px; }
.head-search .search-list { top: 64px; }

body[data-page="investigate"] .page-home :is(.famous, .target-pop, .space-hint) { visibility: hidden !important; pointer-events: none !important; }

@media (max-width: 1100px) and (min-width: 901px) {
  .page-home { --famous-w: 260px; }
  .space-hint { display: none; }
}

/* Phones: the Solar System fills the first screen, the title on top and the target row at the bottom. The scene takes
   no touch (dragging scrolls the page); "Explore in 3D" gives full-screen control. */
@media (max-width: 900px) {
  .page-home { position: relative; inset: auto; overflow: visible; }
  /* Task B35: 40 px short of the screen, so the "More to explore" heading shows below the target row. */
  .home-stage { height: calc(100svh - var(--chrome) - 40px); min-height: 540px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
  .scene { position: absolute; inset: 0; }
  .space3d { position: absolute; inset: 0; border-radius: 0; }
  body:not(.exploring) .page-home .space3d { pointer-events: none; }
  body:not(.exploring) .page-home .space3d * { pointer-events: none !important; }
  body:not(.exploring) .page-home :is(.space-tools, .space-time) { display: none !important; }
  .home-hero { position: relative; top: auto; left: auto; width: auto; margin: 8px; padding: 12px 14px; gap: 6px; background: rgba(5, 7, 13, 0.78); }
  .hero-title { font-size: 26px; }
  .hero-line { font-size: 14.5px; }
  .hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .hero-explore { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: rgba(5, 7, 13, 0.6); color: var(--text); font-weight: 600; }
  .hero-explore[hidden] { display: none; }
  .famous { position: relative; inset: auto; width: auto; z-index: 5; margin: 0; padding: 8px 0 10px; gap: 6px; border: 0; border-radius: 0; background: linear-gradient(rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.88) 30%); }
  .famous-title { margin: 0 12px; }
  .famous-filters, .famous-list { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 0 12px; scroll-padding: 0 12px; }
  .famous-filters::-webkit-scrollbar, .famous-list::-webkit-scrollbar { display: none; }
  .famous-filters { display: flex; }
  .filter-chip { flex: none; min-height: 40px; }
  /* Heights reserved before the data load, so the row and what sits on it never shift (CLS). */
  .famous-filters { min-height: 40px; }
  .famous-list { display: flex; gap: 8px; min-height: 66px; scroll-snap-type: x mandatory; touch-action: pan-x pan-y; }
  .famous-card { min-height: 66px; }
  .famous-list li { flex: none; scroll-snap-align: start; }
  .famous-card { width: 264px; }
  .target-pop { position: fixed; top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; z-index: 40; }
  .map-key, .map-caption { position: absolute; bottom: calc(var(--famous-h, 190px) + 6px); z-index: 5; }
  .map-key { left: 8px; right: auto; max-width: calc(100% - 16px); }
  .map-key[open] { width: min(320px, calc(100vw - 16px)); max-height: calc(100svh - var(--chrome) - var(--famous-h, 190px) - 140px); }
  .map-caption { left: 72px; }
  .space-hint { left: 8px; right: 8px; top: auto; bottom: calc(var(--famous-h, 190px) + 56px); }
  .map-stage { position: absolute; inset: 120px 8px calc(var(--famous-h, 190px) + 56px); container-type: size; }
  /* Explore in 3D: the scene full screen with the toolbar, the time bar and Fly to. */
  body.exploring .page-home .scene {
    position: fixed; inset: var(--chrome) 0 0 0; z-index: 36; display: flex; flex-direction: column; gap: 8px;
    padding: 8px; background: var(--bg); overflow-y: auto;
  }
  body.exploring .page-home .space3d { position: relative; inset: auto; flex: 1 1 auto; min-height: 320px; height: auto; order: 2; border-radius: var(--radius); }
  body.exploring .page-home .space-tools { position: relative; inset: auto; order: 1; flex-wrap: wrap; }
  body.exploring .page-home .space-time { position: static; order: 3; width: auto; max-width: none; margin: 0; justify-content: space-between; }
  body.exploring .page-home :is(.map-caption, .map-key, .map-stage, .space-hint) { display: none; }
  body.exploring .space-close { display: inline-flex; }
  body.exploring { overflow: hidden; }
  body.exploring .space-fly-list { top: calc(100% + 6px); bottom: auto; }
  .space-time { flex-wrap: nowrap; gap: 6px; padding: 4px 8px; }
  .time-live { flex: none; padding: 0 8px; }
  .time-now { flex: none; flex-direction: column; align-items: flex-start; gap: 0; }
  .space-time .time-date { font-size: 13px; }
  .time-utc { font-size: 10.5px; }
  .space-time .time-speed, .space-time .time-speed input[type="range"] { width: 100%; min-width: 0; }
  .space-time .time-speed { flex: 1 1 auto; min-width: 64px; }
  .time-rate-text { font-size: 11px; }
  .auto-switch { flex: none; font-size: 12px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .famous-card, .space-hint, .switch-track, .switch-thumb { transition: none; }
}
@media (max-width: 900px) {
  /* Home's first screen runs edge to edge under the header. */
  body[data-page="home"] main { padding: var(--chrome) 0 0; }
}
@media (max-width: 900px) {
  /* The search box opens across the screen under the header. */
  .head-search-pop { position: fixed; left: 8px; right: 8px; top: calc(var(--chrome) + 6px); width: auto; }
}

/* The Space Apps line (task B30) where the site footer is hidden: under the Famous targets and at the end of the
   Investigate panel. */
.famous-foot, .inv-foot { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.famous-foot { margin-top: auto; padding: 4px 4px 0; }
.inv-foot { padding: 12px var(--s2) var(--s2); }
@media (max-width: 900px) {
  .famous-foot { margin: 0; padding: 0 12px; }
}

/* ---------- More to explore (task B35): prepared objects, pictures only ---------- */
/* Wide screens: the section sits in the Famous targets rail under the 8 cards, and the whole rail scrolls. */
.famous { overflow-y: auto; overscroll-behavior: contain; }
.famous > .famous-list { flex: none; overflow: visible; }
.explore-more { display: grid; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.explore-groups { display: grid; gap: 10px; }
.explore-group { display: grid; gap: 4px; }
.explore-group-title { margin: 0 4px; font: 600 12.5px var(--font-head); color: var(--muted); }
.explore-card { border-left-style: dashed; }
.explore-card .explore-only { color: var(--hypothetical); font-weight: 600; }
body[data-page="investigate"] .page-home .explore-more { visibility: hidden; }
/* Phones: below the first screen, one swipe row per group. */
@media (max-width: 900px) {
  .famous { overflow: visible; }
  #page-home > .explore-more { margin: 0; padding: 14px 0 24px; border-top: 1px solid var(--border); background: var(--bg); }
  #page-home > .explore-more > .famous-title { margin: 0 12px; }
  .explore-group-title { margin: 0 12px; }
  .explore-list { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 0 12px; scroll-snap-type: x mandatory; touch-action: pan-x pan-y; }
  .explore-list::-webkit-scrollbar { display: none; }
  .explore-list li { flex: none; scroll-snap-align: start; }
  .explore-list .famous-card { width: 264px; min-height: 66px; }
  body[data-page="home"] .page-home { padding-bottom: 0; }
}

/* ---------- Sky map (task B36): the whole sky over Home, Close returns ---------- */
.skymap { position: fixed; inset: var(--chrome) 0 0 0; z-index: 45; display: flex; flex-direction: column; background: var(--bg); }
.skymap[hidden] { display: none; }
.skymap-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 16px; border-bottom: 1px solid var(--border); }
.skymap-bar h2 { margin: 0 6px 0 0; font: 700 18px var(--font-head); }
.skymap-chip { margin: 0; font-size: 12.5px; }
.skymap-close { margin-left: auto; }
.skymap-status { margin: 0; padding: 6px 16px; }
.skymap-status:empty { display: none; }
.skymap-view { position: relative; flex: 1 1 auto; min-height: 0; }
.skymap-note { position: absolute; z-index: 6; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100% - 32px)); margin: 0; padding: 10px 14px; font-size: 14px; }
.skymap-note[hidden] { display: none; }
body.skymap-open { overflow: hidden; }
.hero-skymap { display: none; }
/* Phones only: "Explore in 3D" and "Sky map" side by side (both hidden on wide screens). */
.hero-actions { display: none; }
@media (max-width: 900px) { .hero-actions { display: flex; flex-wrap: wrap; gap: 8px; } }
@media (max-width: 900px) {
  .hero-skymap { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: rgba(5, 7, 13, 0.6); color: var(--text); font-weight: 600; }
  .skymap-bar { padding: 6px 8px; }
  .skymap-bar h2 { font-size: 16px; }
}


/* ---------- Task B40: Play buttons, a planetarium-like Sky map ---------- */
.hero-game { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--accent); font-weight: 600; font-size: 14.5px; }
.pop-play { width: 100%; }
.pop-play[hidden], .changed-play[hidden] { display: none; }
.changed-play { margin: 8px 0; }
.skymap-readout { position: absolute; z-index: 6; left: 12px; bottom: 56px; margin: 0; padding: 4px 10px; border-radius: var(--radius-sm); background: rgba(5, 7, 13, 0.72); color: #c3cddb; font: 500 12.5px var(--font-mono); pointer-events: none; }
.skymap-readout:empty { display: none; }
.skymap-fly { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.skymap-fly:empty { display: none; }
.skymap-fly::-webkit-scrollbar { display: none; }
.skymap-chip-fly { flex: none; background: rgba(5, 7, 13, 0.72); }
/* Beat the physics: "Where is this in the sky?" (game-sky.js), the real SPHEREx sky around a position round. */
.game-sky { margin-top: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius); }
.game-sky-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.game-sky-head h3 { margin: 0; }
.game-sky-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s3); align-items: start; margin-top: 12px; }
.game-sky-dome { display: grid; justify-items: center; gap: 8px; }
/* A round window onto the sky, like looking up through a dome. */
.game-sky-frame { position: relative; width: min(100%, 560px); aspect-ratio: 1 / 1; border-radius: 50%; overflow: hidden; background: #000; border: 1px solid var(--border-strong); box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.08), 0 0 40px rgba(var(--accent-rgb), 0.15); isolation: isolate; }
.game-sky-dome-bar { display: flex; align-items: center; gap: 10px; }
.game-sky-step { min-width: var(--tap); min-height: var(--tap); font-size: 20px; font-weight: 700; }
.game-sky-fov { min-width: 9ch; text-align: center; color: var(--muted); font-size: 13px; }
.game-sky-colour { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; }
.game-sky-colour[hidden] { display: none; }
.game-sky-colour select { min-height: var(--tap); }
.game-sky-view { position: absolute !important; inset: 0; width: 100%; height: 100%; }
.game-sky-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center; }
.game-sky-controls { display: grid; gap: 10px; }
.game-sky-controls .note { margin: 0; }
.game-sky-zooms { display: flex; flex-wrap: wrap; gap: 6px; }
.game-sky-zooms button { min-height: var(--tap); }
.game-sky-band { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; }
.game-sky-band[hidden] { display: none; }
.game-sky-band input { width: 100%; min-height: var(--tap); accent-color: var(--accent); }
.game-sky-band output { color: var(--accent); }
.game-sky-band-ends { display: flex; justify-content: space-between; color: var(--muted); font-weight: 400; font-size: 12px; }
@media (max-width: 900px) {
  .game-sky { padding: 12px; }
  .game-sky-body { grid-template-columns: minmax(0, 1fr); }
}
