@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap");

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #f6f4ef;
  --surface: #fffefb;
  --surface-2: #eeebe3;
  --text: #121a26;
  --muted: #5a6473;
  --border: #dcd7cb;
  --accent: #0b6e99;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgb(18 26 38 / 6%), 0 8px 24px -12px rgb(18 26 38 / 18%);
  --good: #1f7a4d;
  --warn: #b25d09;

  --c-otsu: #8a94a3;
  --c-phys: #b7791f;
  --c-mndwi: #6b8e23;
  --c-sar: #6d4fc2;
  --c-fusion: #d63a2f;
  --c-noopt: #e07fa0;
  --c-tm: #0f9488;
  --c-cems: #2b5fd9;
  --c-grid: #e4e0d6;
  --c-gfm: #475569;
  --c-v12: #c026d3;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Source Serif 4", "Iowan Old Style", Charter, Georgia, serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  --text-hero: clamp(2.1rem, 1.3rem + 3.6vw, 3.6rem);
  --text-h2: clamp(1.6rem, 1.2rem + 1.6vw, 2.35rem);
  --space-section: clamp(3.5rem, 2.5rem + 4vw, 6.5rem);
  --radius: 14px;
  --radius-small: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #151b24;
    --surface-2: #1b2330;
    --text: #e7ebf1;
    --muted: #9aa5b5;
    --border: #2a3342;
    --accent: #4fb3e0;
    --accent-ink: #08121c;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
    --good: #4cc38a;
    --warn: #f0a04b;
    --c-otsu: #9aa4b2;
    --c-phys: #e0a446;
    --c-mndwi: #9cc24a;
    --c-sar: #a58bf2;
    --c-fusion: #ff6b5e;
    --c-noopt: #f29bbb;
    --c-tm: #2cc4b5;
    --c-cems: #6d95ff;
    --c-grid: #253041;
  --c-gfm: #a7b4c6;
  --c-v12: #e879f9;
    --c-gfm: #a7b4c6;
    --c-v12: #e879f9;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b24;
  --surface-2: #1b2330;
  --text: #e7ebf1;
  --muted: #9aa5b5;
  --border: #2a3342;
  --accent: #4fb3e0;
  --accent-ink: #08121c;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
  --good: #4cc38a;
  --warn: #f0a04b;
  --c-otsu: #9aa4b2;
  --c-phys: #e0a446;
  --c-mndwi: #9cc24a;
  --c-sar: #a58bf2;
  --c-fusion: #ff6b5e;
  --c-noopt: #f29bbb;
  --c-tm: #2cc4b5;
  --c-cems: #6d95ff;
  --c-grid: #253041;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.62 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.08rem; }
p { margin: 0 0 0.9em; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--font-mono); font-size: 0.88em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
.notice { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 16px; border-radius: var(--radius-small); margin-top: 16px; }
.num, .stat-value, .data-table td.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 58px; }
.brand { font: 700 1.15rem var(--font-head); color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.topnav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 999px; font-size: 0.9rem; white-space: nowrap; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.topnav a:hover, .topnav a.active { color: var(--text); background: var(--surface-2); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 900px) { .topnav { display: none; } .topbar-actions { margin-left: auto; } }

/* ---------------------------------------------------------------- buttons, chips */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-small { padding: 6px 14px; font-size: 0.88rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.chip {
  --chip-color: var(--accent);
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 0.88rem var(--font-body); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.chip:hover { border-color: var(--chip-color); }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { border-color: var(--chip-color); background: color-mix(in srgb, var(--chip-color) 12%, var(--surface)); }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--chip-color); }
.chip[aria-pressed="false"] .swatch { background: transparent; box-shadow: inset 0 0 0 2px var(--chip-color); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; margin: 0 8px 12px 0; }
.segmented button { border: 0; background: transparent; color: var(--muted); font: 500 0.88rem var(--font-body); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.segmented button[aria-checked="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented.small button { font-size: 0.82rem; padding: 5px 11px; }

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(3rem, 2rem + 4vw, 5.5rem) 0 clamp(2.5rem, 2rem + 2vw, 4rem); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 23px, color-mix(in srgb, var(--border) 45%, transparent) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, color-mix(in srgb, var(--border) 45%, transparent) 23px 24px);
  mask-image: linear-gradient(to bottom, black 40%, transparent);
}
.eyebrow, .kicker { font: 600 0.78rem var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-size: var(--text-hero); max-width: 17ch; margin-bottom: 0.45em; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.hero-figure { margin: 0; position: relative; transform: rotate(1.2deg); }
.hero-figure img { width: 100%; height: auto; display: block; border-radius: 12px; box-shadow: 0 24px 48px -20px rgb(18 26 38 / 55%); border: 6px solid var(--surface); }
.hero-figure figcaption { margin-top: 12px; font-size: 0.84rem; color: var(--muted); transform: rotate(-1.2deg); }
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; } .hero-figure { max-width: 420px; transform: none; } .hero-figure figcaption { transform: none; } }
.lede { font-size: clamp(1.05rem, 1rem + 0.35vw, 1.22rem); color: var(--muted); max-width: 60ch; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 40px 0 0; border-top: 1px solid var(--text); }
.stat { padding: 18px 22px 6px 0; }
.stat + .stat { padding-left: 22px; border-left: 1px solid var(--border); }
.stat-value { font: 600 clamp(2rem, 1.5rem + 2vw, 3rem)/1 var(--font-head); margin: 0 0 10px; color: var(--text); }
.stat:nth-child(1) .stat-value { color: var(--c-fusion); }
.stat-label { color: var(--muted); font-size: 0.93rem; max-width: 30ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .stat + .stat { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
}

/* ---------------------------------------------------------------- sections */
.section { padding: var(--space-section) 0; }
.section.alt { background: var(--surface-2); border-block: 1px solid var(--border); }
.section h2 { font-size: var(--text-h2); max-width: 26ch; }
.section-lede { color: var(--muted); max-width: 70ch; font-size: 1.05rem; margin-bottom: 28px; }
h3.sub { font-size: 1.45rem; margin-top: 44px; }
.cards { display: grid; gap: 18px; margin: 22px 0; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .cards.three, .cards.two { grid-template-columns: 1fr; } }
.card, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 26px); box-shadow: var(--shadow); min-width: 0;
}
.panel { margin: 22px 0; }
.cards > .panel { margin: 0; }
.panel-head { margin-bottom: 8px; }
.panel-head h3 { margin-bottom: 4px; }
.card h3 { font-size: 1.12rem; }
.card p:last-child, .panel p:last-child { margin-bottom: 0; }
.footnote { font-size: 0.84rem; color: var(--muted); margin-top: 12px; }
.callout { border-left: 4px solid var(--accent); background: var(--surface); padding: 20px 24px; border-radius: 0 var(--radius) var(--radius) 0; margin: 26px 0; box-shadow: var(--shadow); }
.callout.honest { border-left-color: var(--warn); }
.callout ul { margin: 0; padding-left: 1.1em; }
.callout li + li { margin-top: 8px; }
.ticks { list-style: none; padding: 0; margin: 0 0 1em; }
.ticks li { position: relative; padding-left: 22px; margin-bottom: 8px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }
.ticks.two-col { columns: 2; column-gap: 32px; }
.ticks.two-col li { break-inside: avoid; }
@media (max-width: 720px) { .ticks.two-col { columns: 1; } }
.split { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- terms, tooltip */
.term { color: inherit; text-decoration: underline dotted var(--accent); text-decoration-thickness: 1.5px; cursor: help; }
.tooltip {
  position: fixed; z-index: 40; max-width: 300px; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 8px 11px; border-radius: 8px; font-size: 0.84rem; line-height: 1.45;
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- radar explorer */
.explorer .chip { --chip-color: var(--accent); }
.db-scale { margin: 18px 0 8px; }
.db-bar { position: relative; height: 22px; border-radius: 6px; background: linear-gradient(90deg, #050505, #3b3b3b 40%, #9a9a9a 75%, #f4f4f4); }
.db-range {
  position: absolute; top: -5px; bottom: -5px; border: 2px solid var(--c-fusion); border-radius: 8px;
  background: color-mix(in srgb, var(--c-fusion) 18%, transparent);
  transition: left 0.45s var(--ease), width 0.45s var(--ease);
}
.db-ticks { position: relative; height: 22px; font: 500 0.75rem var(--font-mono); color: var(--muted); }
.db-ticks span { position: absolute; transform: translateX(-50%); top: 4px; }
.surface-info { margin-top: 10px; min-height: 9.5em; }
.surface-info h4 { margin-bottom: 6px; }

/* ---------------------------------------------------------------- pipeline stepper */
.stepper { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.stepper button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  font: 500 0.86rem var(--font-body); color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.stepper button span { font: 600 0.78rem var(--font-mono); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text); }
.stepper button:hover { border-color: var(--accent); transform: translateY(-1px); }
.stepper button[aria-selected="true"] { color: var(--text); border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.stepper button[aria-selected="true"] span { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 900px) { .stepper { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .stepper { grid-template-columns: repeat(2, 1fr); } }
.step-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(18px, 2.4vw, 28px); box-shadow: var(--shadow); }
.step-panel ul { padding-left: 1.1em; }
.why { background: var(--surface-2); border-radius: var(--radius-small); padding: 10px 14px; }
.code-links { font-size: 0.88rem; color: var(--muted); }
.code-links a { font-family: var(--font-mono); font-size: 0.86rem; }
.tau-demo { background: var(--surface-2); border-radius: var(--radius-small); padding: 12px 16px; margin-bottom: 0.9em; }
.tau-demo p { margin: 6px 0 0; }

/* ---------------------------------------------------------------- sliders */
input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-label, .select-label { display: block; font-weight: 600; font-size: 0.92rem; margin: 12px 0 4px; }
select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); }

/* ---------------------------------------------------------------- fusion gate */
.equation { font: 500 clamp(1rem, 0.9rem + 0.5vw, 1.25rem) var(--font-head); background: var(--surface-2); border-radius: var(--radius-small); padding: 12px 16px; overflow-x: auto; white-space: nowrap; }
#gate-diagram { width: 100%; height: auto; display: block; }
#gate-diagram text { font: 500 12px var(--font-body); fill: var(--text); }
#gate-diagram .small { font-size: 10.5px; fill: var(--muted); }
.gate-track { position: relative; height: 14px; margin-top: 2px; }
.gate-track span { position: absolute; top: 0; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--warn) 55%, transparent); }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; margin-top: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 500 11.5px var(--font-body); fill: var(--muted); }
.chart .label { fill: var(--text); font-size: 12.5px; }
.chart .axis line, .chart .grid line { stroke: var(--c-grid); }
.chart .zero { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .dot { stroke: var(--surface); stroke-width: 1.5; transition: r 0.2s var(--ease); }
.chart .row-hover:hover .track { stroke: var(--border); }
.chart .selected-row rect.bg { fill: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tr.highlight td { background: color-mix(in srgb, var(--c-fusion) 8%, transparent); font-weight: 600; }
.data-table .model-cell { display: flex; align-items: center; gap: 8px; }
.data-table .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.data-table.compact th, .data-table.compact td { padding: 6px 8px; font-size: 0.86rem; }
.matrix td { text-align: center; font-variant-numeric: tabular-nums; }
.matrix td.cell { min-width: 74px; }
.matrix td.nearest { outline: 2px solid var(--text); outline-offset: -3px; border-radius: 6px; }
.matrix td small { display: block; color: var(--muted); font-size: 0.74rem; }
.matrix th.pass small { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; }

/* ---------------------------------------------------------------- gaps */
.gap-list { list-style: none; margin: 8px 0 0; padding: 0; }
.gap-list li { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(160px, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.gap-list li:last-child { border-bottom: 0; }
.gap-q { font-size: 0.93rem; }
.gap-q small { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; }
.gap-bar svg { width: 100%; height: 26px; display: block; }
.test-list .gap-bar svg + svg { margin-top: 4px; opacity: 0.8; }
.gap-verdict { text-align: right; font-size: 0.84rem; white-space: nowrap; }
.gap-verdict b { display: block; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.badge { display: inline-block; font: 600 0.72rem var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; margin-top: 3px; }
.badge.sig { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.ns { background: var(--surface-2); color: var(--muted); }
@media (max-width: 720px) {
  .gap-list li { grid-template-columns: 1fr auto; }
  .gap-bar { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 720px) {
  .test-list li { grid-template-columns: 1fr; }
  .test-list .gap-verdict { text-align: left; white-space: normal; }
}

/* ---------------------------------------------------------------- registration arrows */
.arrow-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0 4px; }
@media (max-width: 520px) { .arrow-grid { grid-template-columns: repeat(3, 1fr); } }
.arrow-card { border: 1px solid var(--border); border-radius: 10px; padding: 6px 4px 8px; text-align: center; background: var(--bg); }
.arrow-card svg { width: 100%; max-width: 72px; height: auto; display: block; margin: 0 auto; }
.arrow-card b { display: block; font-size: 0.78rem; }
.arrow-card small { display: block; color: var(--muted); font-size: 0.7rem; font-family: var(--font-mono); }

/* ---------------------------------------------------------------- swipe */
.swipe { position: relative; width: min(100%, 620px); margin: 6px auto 0; aspect-ratio: 397 / 414; border-radius: 10px; overflow: hidden; background: #111; user-select: none; touch-action: pan-y; }
.swipe img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#swipe-right { clip-path: inset(0 0 0 50%); }
.swipe-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; transform: translateX(-1px); pointer-events: none; box-shadow: 0 0 0 1px rgb(0 0 0 / 30%); }
.swipe-handle span { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 40%); }
.swipe-handle span::before, .swipe-handle span::after { content: ""; position: absolute; top: 50%; width: 0; height: 0; border: 6px solid transparent; transform: translateY(-50%); }
.swipe-handle span::before { left: 3px; border-right-color: #333; }
.swipe-handle span::after { right: 3px; border-left-color: #333; }
.swipe-tag { position: absolute; top: 10px; font: 600 0.78rem var(--font-body); color: #fff; background: rgb(0 0 0 / 62%); padding: 4px 9px; border-radius: 999px; pointer-events: none; max-width: 45%; }
.swipe-tag-left { left: 10px; }
.swipe-tag-right { right: 10px; text-align: right; }
.swipe input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.swipe:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: baseline; }
.key-fusion { background: #e8231a; }
.key-cems { background: #1a35e0; }

/* ---------------------------------------------------------------- stress, ablation */
.stress-controls { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; margin-top: 10px; }
.stress-controls .check { grid-column: 1 / -1; }
.stress-readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 720px) { .stress-readout { grid-template-columns: repeat(2, 1fr); } }
.readout { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; border-top: 4px solid var(--c); }
.readout b { display: block; font: 600 1.4rem var(--font-head); font-variant-numeric: tabular-nums; }
.readout span { font-size: 0.8rem; color: var(--muted); }
.stress-insight { margin-top: 14px; background: var(--surface-2); border-radius: var(--radius-small); padding: 10px 14px; }
.ablation-detail { margin-top: 12px; background: var(--surface-2); border-radius: var(--radius-small); padding: 12px 16px; min-height: 4.5em; }
.ablation-detail h4 { margin-bottom: 4px; }

/* ---------------------------------------------------------------- lessons */
#lessons .cards.three > :first-child { grid-column: span 2; }
#lessons .cards.three > :last-child { grid-column: span 3; }
@media (max-width: 900px) { #lessons .cards.three > :first-child, #lessons .cards.three > :last-child { grid-column: auto; } }
.lesson { border-top: 4px solid var(--border); }
.lesson.good { border-top-color: var(--good); }
.lesson.warn { border-top-color: var(--warn); }

/* ---------------------------------------------------------------- reproduce, glossary, footer */
.code-block { position: relative; background: #0f1520; color: #dbe4f0; border-radius: var(--radius); padding: 46px 20px 18px; overflow-x: auto; box-shadow: var(--shadow); margin-bottom: 16px; }
.code-block pre { margin: 0; line-height: 1.7; }
.copy-btn { position: absolute; top: 10px; right: 10px; font: 600 0.78rem var(--font-body); color: #dbe4f0; background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 18%); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.copy-btn:hover { background: rgb(255 255 255 / 18%); }
.glossary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 32px; margin: 0; }
@media (max-width: 720px) { .glossary { grid-template-columns: 1fr; } }
.glossary div { padding: 14px 0; border-bottom: 1px solid var(--border); }
.glossary div:target { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 8px; padding-inline: 10px; }
.glossary dt { font-weight: 600; margin-bottom: 4px; }
.glossary dd { margin: 0; color: var(--muted); font-size: 0.94rem; }
.footer { padding: 36px 0 48px; border-top: 1px solid var(--border); font-size: 0.88rem; }
.wide-figure { margin: 16px 0 0; }
.wide-figure img { width: 100%; height: auto; display: block; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.wide-figure figcaption { font-size: 0.84rem; color: var(--muted); margin-top: 8px; }

/* ---------------------------------------------------------------- Arena (v1.2) */
.arena-hero h1 { max-width: 22ch; }
.arena .stats { grid-template-columns: repeat(4, 1fr); }
.stat-pending { color: var(--muted) !important; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem) !important; font-style: italic; }
@media (max-width: 960px) { .arena .stats { grid-template-columns: repeat(2, 1fr); }
  .arena .stat:nth-child(3) { padding-left: 0; border-left: 0; } }
.arena-controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 14px; }
.arena-select { display: inline-flex; gap: 8px; align-items: center; font: 600 0.82rem var(--font-body); color: var(--muted); }
.arena-select select { font: 500 0.9rem var(--font-body); color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-small); padding: 6px 10px; max-width: 260px; }
.arena-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.research-card h3 { margin-bottom: 8px; }
.cite { font-size: 0.82rem; color: var(--muted); margin-top: 10px; }
.erratum .badge { margin-bottom: 10px; }
.badge-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.erratum-result { font-variant-numeric: tabular-nums; border-left: 3px solid var(--accent); padding-left: 10px; }
.blind-progress { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 12px; align-items: center; margin: 10px 0; }
.blind-label { font: 600 0.85rem var(--font-body); font-variant-numeric: tabular-nums; }
.blind-track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.blind-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.key-hit { background: #0072b2; }
.key-false { background: #e69f00; }
.key-miss { background: #cc79a7; }
.key-edge { background: #ffd23f; }
@media (max-width: 640px) {
  .arena .stats { grid-template-columns: 1fr; }
  .blind-progress { grid-template-columns: 1fr; gap: 4px; }
  .arena-select { width: 100%; justify-content: space-between; }
  .arena-select select { max-width: 70%; }
}

/* ---------------------------------------------------------------- floodfusion Live */
.live .stats { grid-template-columns: repeat(4, 1fr); }
.live .stat-value { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.2rem); overflow-wrap: anywhere; }
.live-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.map-list { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; display: grid; gap: 8px; }
.map-list button { width: 100%; text-align: left; display: grid; gap: 3px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-small); cursor: pointer; }
.map-list button:hover { border-color: var(--accent); }
.map-list button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.map-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-title { font-weight: 600; }
.map-meta { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-view { position: relative; overflow: hidden; aspect-ratio: 3 / 2; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--border); }
.map-view img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; }
.map-view svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.flood-poly { fill: color-mix(in srgb, var(--c-v12) 62%, transparent); stroke: var(--c-v12); stroke-width: 0.6; fill-rule: evenodd; }
.aoi-box { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 6 4; }
.unseen { fill: var(--surface-2); opacity: 0.62; }
.tile-cut { fill: black; }
.map-list .badge { justify-self: start; }
.tile-links a { font-variant-numeric: tabular-nums; }
.map-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 14px 0 0; font-size: 0.93rem; }
.map-details dt { color: var(--muted); }
.map-details dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .map-view img { filter: brightness(0.78) contrast(1.05); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-view img { filter: brightness(0.78) contrast(1.05); } }
@media (max-width: 760px) {
  .live-grid { grid-template-columns: 1fr; }
  .map-list { max-height: 260px; }
  .live .stats { grid-template-columns: repeat(2, 1fr); }
  .live .stat:nth-child(3) { padding-left: 0; border-left: 0; }
}
