:root {
  --bg: #0a0a0a;
  --surface: #111;
  --card: #161616;
  --card-hi: #1a1a1a;
  --border: #1e1e1e;
  --border-hi: #2a2a2a;
  --text: #e2e2e2;
  --text-soft: #c8c8c8;
  --dim: #7a7a7a;
  --dim-soft: #888;
  --accent: #00d4aa;
  --accent-hi: #1bf2c4;
  --accent-soft: rgba(0, 212, 170, 0.12);
  --red: #e84057;
  --warn: #f0c040;
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --content-max: 1140px;
  --reading-max: 760px;

  /* type scale — every font-size in this file should reference one of
     these. Mobile values are remapped inside the media queries.
     Lede is collapsed into fs-body so every "running paragraph" on
     the site renders at the same size. */
  --fs-display: 3.4rem;  /* result-num */
  --fs-hero:    2.6rem;  /* hero h1 */
  --fs-h1:      1.85rem; /* detail-page h1 */
  --fs-stat:    1.45rem; /* hypothesis stat value */
  --fs-h3:      1.15rem; /* card / hypothesis title */
  --fs-h2:      1.05rem; /* section h2 */
  --fs-lede:    0.95rem; /* section lede (same as body) */
  --fs-body:    0.95rem; /* default body paragraph */
  --fs-aux:     0.85rem; /* dim / secondary body */
  --fs-small:   0.78rem; /* tagline, captions, page subtitle */
  --fs-micro:   0.62rem; /* tags, badges, micro labels */
  --fs-table:   0.86rem; /* table data cells */
  --fs-th:      0.74rem; /* table headers */

  /* every body-text block on the site shares this line-height so the
     "bigger font" perception that comes from a heavier line-height
     can't drift between blocks. */
  --lh-body: 1.75;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* The body-level <nav> is position: sticky at the top, ~3.6rem tall.
     Without this padding, clicking a TOC anchor scrolls the target
     heading behind the nav and the user sees only 2 lines of content
     under the nav. Match the nav height + a bit of breathing room. */
  scroll-padding-top: 5rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "calt" 1, "liga" 1;
}

/* ── nav ──────────────────────────────────────────────────────── */

/* Scope to the body-level site nav only. The in-page <nav class="page-toc">
   used on the experiments page is a different element and must not pick
   up the sticky / blur / border / padding from the site nav. */
body > nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
}

.nav-logo {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 2px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-links a {
  color: var(--dim-soft);
  text-decoration: none;
  font-size: var(--fs-small);
  letter-spacing: 0.8px;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover { color: var(--accent); }

/* ── hero ─────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 5.5rem 2rem 1.5rem;
}

.hero h1 {
  font-size: var(--fs-hero);
  font-weight: 300;
  letter-spacing: 4px;
  color: var(--text);
  line-height: 1.1;
}

.tagline {
  color: var(--dim);
  font-size: var(--fs-body);
  letter-spacing: 1.5px;
  margin-top: 1.1rem;
}

/* ── result strip (the big number + context) ──────────────────── */

.result-strip {
  max-width: var(--content-max);
  margin: 1.5rem auto 5rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 3.5rem;
  align-items: center;
}

.result-box {
  background: var(--card);
  border: 1px solid var(--border-hi);
  padding: 2.2rem 1.5rem;
  text-align: center;
  border-radius: 2px;
}

.result-num {
  color: var(--accent);
  font-size: var(--fs-display);
  font-weight: 300;
  letter-spacing: 2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-unit {
  color: var(--text);
  font-size: var(--fs-small);
  letter-spacing: 3.5px;
  margin-top: 0.55rem;
}

.result-context {
  color: var(--dim);
  font-size: var(--fs-small);
  letter-spacing: 0.8px;
  margin-top: 1.2rem;
  line-height: 1.65;
}

.result-context-block p {
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  margin-bottom: 0.95rem;
}

.result-context-block em {
  color: var(--text);
  font-style: normal;
  border-bottom: 1px dotted var(--dim);
}

.result-context-block strong {
  color: var(--accent);
  font-weight: 500;
}

.result-context-block .dim {
  color: var(--dim-soft);
  font-size: var(--fs-aux);
}

/* ── generic section ─────────────────────────────────────────── */

section.diagram-section,
section.method-section,
section.experiments,
section.findings,
section.mcts-section,
section.vs-az,
section.next,
section.links {
  max-width: var(--content-max);
  margin: 0 auto 5rem;
  padding: 0 2rem;
}

section h2 {
  color: var(--accent);
  font-size: var(--fs-h2);
  font-weight: 500;
  letter-spacing: 2.5px;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.lede {
  color: var(--text-soft);
  font-size: var(--fs-lede);
  max-width: var(--reading-max);
  margin-bottom: 1.75rem;
  line-height: var(--lh-body);
}

.lede em {
  color: var(--accent);
  font-style: normal;
}

/* method section on the home page */
.method-section h3.sub {
  font-size: var(--fs-body);
  font-weight: 500;
  letter-spacing: 1.2px;
  color: var(--text);
  margin: 2.2rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.method-section ol.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0.5rem 0 1.25rem;
}

.method-section ol.steps li {
  counter-increment: step;
  padding: 0.55rem 0 0.55rem 2.5rem;
  position: relative;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.method-section ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 1.7rem;
  height: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: var(--fs-small);
  border-radius: 50%;
  font-weight: 500;
}

.method-section ol.steps li strong { color: var(--accent); font-weight: 500; }
.method-section ol.steps li em { color: var(--text); font-style: normal; border-bottom: 1px dotted var(--dim); }
.method-section ol.steps li code,
.method-section p code {
  color: var(--text);
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  font-size: 0.86em;
}

.method-section pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: var(--fs-aux);
  line-height: 1.7;
  margin: 0.5rem 0 1.5rem;
  border-radius: 2px;
}

.method-section pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.method-section p { font-size: var(--fs-body); line-height: var(--lh-body); margin-bottom: 1rem; }
.method-section p strong { color: var(--accent); font-weight: 500; }
.method-section p em { color: var(--text); font-style: normal; border-bottom: 1px dotted var(--dim); }
.method-section p.dim { font-size: var(--fs-aux); color: var(--dim-soft); }
.method-section p a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
.method-section p a:hover { border-bottom-style: solid; }

/* ── architecture / mcts / chart frame ─────────────────────────── */

.svg-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.4rem 1.1rem;
  margin: 0.5rem 0 1.5rem;
  overflow-x: auto;
  border-radius: 2px;
}

.diagram { width: 100%; height: auto; display: block; }

/* common SVG primitives */
.diagram text { font-family: var(--font); font-size: 12px; fill: var(--text); }
.diagram text.sub { fill: var(--dim); font-size: 10.5px; }
.diagram text.annot { font-size: 10.5px; fill: var(--dim-soft); }
.diagram text.annot.accent { fill: var(--accent); }
.diagram text.annot.dim { fill: var(--dim); opacity: 0.85; }
.diagram text.small { font-size: 10px; }
.diagram text.big { font-size: 14px; fill: var(--text); font-weight: 500; }
.diagram text.huge { font-size: 22px; fill: var(--accent); font-weight: 500; }

/* architecture */
.arch-block rect {
  fill: var(--card);
  stroke: var(--accent);
  stroke-width: 1.2;
}
.arch-block.stacked .trail  { stroke: var(--accent); opacity: 0.5; }
.arch-block.stacked .trail2 { stroke: var(--accent); opacity: 0.25; }
.arch-block.head rect { stroke-dasharray: none; }

/* mcts */
.tree .edge {
  stroke: var(--dim);
  stroke-width: 1;
  opacity: 0.55;
}
.tree .edge.primary {
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 1;
}
.tree .node circle {
  fill: var(--card);
  stroke: var(--dim);
  stroke-width: 1;
}
.tree .node.primary circle {
  fill: rgba(0, 212, 170, 0.10);
  stroke: var(--accent);
  stroke-width: 1.5;
}
.tree .node.root circle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
}
.tree .legend text { font-size: 10.5px; }

/* chart */
.chart .axis { stroke: var(--dim); stroke-width: 1; }
.chart .tick line { stroke: var(--dim); stroke-width: 1; }
.chart .tick text { fill: var(--dim-soft); font-size: 10.5px; }
.chart .axis-label { fill: var(--dim-soft); font-size: 10.5px; letter-spacing: 1px; }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.5; }
.chart .curve-dashed {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  opacity: 0.55;
}
.chart .curve-solid {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
}
.chart .point.baseline circle { fill: var(--card); stroke: var(--dim); stroke-width: 1.5; }
.chart .point.primary circle  { fill: var(--accent); stroke: var(--accent-hi); stroke-width: 1.5; }
.chart .point.measured circle { fill: var(--accent); stroke: var(--accent-hi); stroke-width: 1.5; }
.chart .delta { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.75; }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { fill: var(--dim); }
.chart .bar.label { fill: var(--text); }
.chart .baseline-line { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 3 3; }

/* ── experiments / hypothesis cards (new) ─────────────────────── */

.hypothesis-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.hypothesis {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 1.75rem 2rem 1.5rem;
  border-radius: 2px;
}

.hypothesis .head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.tag {
  font-size: var(--fs-micro);
  letter-spacing: 1.8px;
  color: var(--dim);
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-hi);
  border-radius: 2px;
}

.badge {
  font-size: var(--fs-micro);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-weight: 600;
}

.badge.confirmed {
  background: var(--accent-soft);
  color: var(--accent-hi);
  border: 1px solid var(--accent);
}

.badge.rejected {
  background: rgba(232, 64, 87, 0.10);
  color: var(--red);
  border: 1px solid rgba(232, 64, 87, 0.55);
}

.badge.partial {
  background: rgba(240, 192, 64, 0.10);
  color: var(--warn);
  border: 1px solid rgba(240, 192, 64, 0.5);
}

.hypothesis h3 {
  font-size: var(--fs-h3);
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.3px;
  text-transform: none;
  line-height: 1.35;
  margin: 0.2rem 0 0.6rem;
}

.hypothesis .hyp-line {
  color: var(--dim-soft);
  font-size: var(--fs-aux);
  margin-bottom: 1rem;
  padding-left: 0.9rem;
  border-left: 1px solid var(--border-hi);
  line-height: var(--lh-body);
}

.hypothesis .hyp-line strong {
  color: var(--text);
  font-weight: 500;
}

.hypothesis .body p {
  font-size: var(--fs-body);
  margin-bottom: 0.9rem;
  line-height: var(--lh-body);
}

.hypothesis .body p:last-child { margin-bottom: 0; }

/* teaser variant — used on the home page so the cards are short
   summaries that link out to the experiments page for the deep dive */
.hypothesis.teaser {
  padding: 1.4rem 1.6rem 1.3rem;
}

.hypothesis.teaser h3 {
  font-size: var(--fs-h3);
  margin: 0.15rem 0 0.6rem;
}

.hypothesis.teaser .hyp-line {
  padding-left: 0;
  border-left: none;
  color: var(--text-soft);
  font-size: var(--fs-body);
  margin-bottom: 0.85rem;
}

.hypothesis.teaser .result-row {
  padding: 0.75rem 0 0.9rem;
  margin: 0;
  gap: 1.6rem;
}

.hypothesis.teaser .card-link {
  margin: 0.6rem 0 0;
  font-size: var(--fs-small);
}

.hypothesis.teaser .card-link a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.hypothesis.teaser .card-link a:hover { border-bottom-style: solid; }

/* horizontal link clusters used on the home page */
.quick-links, .cluster-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.6rem;
  margin: 1rem 0 0;
  font-size: var(--fs-small);
}

.quick-links a, .cluster-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.quick-links a:hover, .cluster-links a:hover { border-bottom-style: solid; }

.cluster-links {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.hypothesis strong { color: var(--accent); font-weight: 500; }
.hypothesis em { color: var(--text); font-style: normal; border-bottom: 1px dotted var(--dim); }
.hypothesis .dim { color: var(--dim-soft); font-size: var(--fs-aux); }

.hypothesis .result-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.8rem;
  padding: 0.9rem 0 1.1rem;
  margin: 0.4rem 0 1.1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.hypothesis .stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hypothesis .stat .label {
  font-size: var(--fs-micro);
  color: var(--dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.hypothesis .stat .value {
  color: var(--accent);
  font-size: var(--fs-stat);
  font-weight: 500;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.hypothesis .stat .value.dim {
  color: var(--dim);
  font-size: var(--fs-stat);
}

.hypothesis .stat .delta {
  color: var(--accent);
  font-size: var(--fs-small);
  letter-spacing: 0.5px;
}

.hypothesis .stat .delta.neg {
  color: var(--red);
}

/* legacy .finding kept for any straggling refs */
.finding {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  border-radius: 2px;
}

.finding-tag {
  display: inline-block;
  font-size: var(--fs-micro);
  letter-spacing: 1.8px;
  color: var(--accent);
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--accent);
  margin-bottom: 0.7rem;
  border-radius: 2px;
}

.finding h3 {
  font-size: var(--fs-h3);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.65rem;
  letter-spacing: 0.3px;
}

.finding p {
  font-size: var(--fs-body);
  margin-bottom: 0.9rem;
}

.finding p:last-child { margin-bottom: 0; }

.finding strong { color: var(--accent); font-weight: 500; }
.finding em { color: var(--text); font-style: normal; border-bottom: 1px dotted var(--dim); }
.finding .dim { color: var(--dim-soft); font-size: var(--fs-aux); }

.findings > p a,
.experiments > p a,
.mcts-section > p a,
.vs-az > p a,
.next > p a {
  color: var(--accent);
  text-decoration: none;
  font-size: var(--fs-aux);
  letter-spacing: 0.5px;
  border-bottom: 1px dotted var(--accent);
}

/* ── vs alphazero table ───────────────────────────────────────── */

/* unified table styling: applies to both `table.compact` (vs-AZ on home)
   and `.content table` (markdown tables on detail pages). Same font
   sizes, same paddings, same header treatment everywhere. */
table.compact,
.content table {
  /* width: auto lets a 2-column table (epoch / Elo) size to its content
     instead of stretching across the full reading column. max-width: 100%
     caps wider tables (vs-AZ) at the container width. */
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: var(--fs-aux);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
}

table.compact th, table.compact td,
.content th, .content td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-aux);
  font-variant-numeric: tabular-nums;
}

table.compact th,
.content th {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 1.2px;
  background: var(--surface);
  font-size: var(--fs-th);
}

table.compact td:first-child,
.content td:first-child {
  color: var(--dim-soft);
  letter-spacing: 0.5px;
  text-transform: lowercase;
}

/* matrix-style tables intentionally fill the reading column —
   they're the summary view, not data points inside prose. */
table.matrix {
  width: 100%;
  max-width: var(--content-max);
  margin: 1rem 0 1.25rem;
}
table.matrix td { font-size: var(--fs-table); }
table.matrix td:first-child { font-size: var(--fs-aux); }

table.compact strong,
.content strong { color: var(--accent); font-weight: 500; }

table.compact tbody tr:last-child td,
.content tbody tr:last-child td { border-bottom: 0; }
table.compact tbody tr:hover td,
.content tbody tr:hover td { background: rgba(0, 212, 170, 0.03); }

/* ── next section ─────────────────────────────────────────────── */

.next p {
  font-size: var(--fs-body);
  margin-bottom: 0.85rem;
}
.next strong { color: var(--accent); font-weight: 500; }

/* ── links / card grid ────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
}

.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1.9rem 1.85rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.card:hover {
  border-color: var(--accent);
  background: var(--card-hi);
  transform: translateY(-1px);
}

.card h3 {
  font-weight: 500;
  font-size: var(--fs-lede);
  margin-bottom: 0.45rem;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.card p {
  font-size: var(--fs-aux);
  color: var(--dim-soft);
  line-height: var(--lh-body);
}

/* ── per-page (detail pages) ──────────────────────────────────── */

.page {
  max-width: 840px;
  margin: 0 auto;
  padding: 3rem 1.85rem 5rem;
}

.page header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--border);
}

.page h1 {
  font-size: var(--fs-h1);
  font-weight: 300;
  letter-spacing: 2.5px;
  color: var(--text);
  line-height: 1.15;
}

.page .subtitle {
  color: var(--dim-soft);
  font-size: var(--fs-aux);
  margin-top: 0.6rem;
  letter-spacing: 0.8px;
}

.content h2 {
  font-size: var(--fs-h2);
  font-weight: 500;
  letter-spacing: 2.2px;
  color: var(--accent);
  margin: 2.85rem 0 0.9rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.content h3 {
  font-size: var(--fs-h3);
  font-weight: 500;
  letter-spacing: 0.8px;
  color: var(--text);
  text-transform: none;
  margin: 1.7rem 0 0.55rem;
}

.content p, .content ul, .content ol {
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  margin-bottom: 1rem;
}

.content ul, .content ol { padding-left: 1.5rem; }

.content li { margin-bottom: 0.4rem; }

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.content a:hover { border-bottom-style: solid; }

.content strong { color: var(--accent); font-weight: 500; }

.content em { color: var(--text); font-style: normal; border-bottom: 1px dotted var(--dim); }

.content code {
  color: var(--text);
  background: var(--surface);
  font-size: var(--fs-aux);
  padding: 0.13rem 0.38rem;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: var(--fs-aux);
  margin-bottom: 1.3rem;
  line-height: 1.72;
  border-radius: 2px;
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* .content table styling moved up into the unified block above */

.content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem;
  margin: 1.2rem 0;
  color: var(--dim-soft);
  font-size: var(--fs-aux);
}

/* sticky sidebar TOC on long detail pages */
.page-with-toc {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.85rem 5rem;
}

.page-with-toc .page-body {
  min-width: 0; /* lets long pre/code lines wrap inside the grid track */
}

.page-side-toc {
  position: sticky;
  top: 5rem;
  align-self: start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 0;
  font-size: var(--fs-small);
  line-height: 1.6;
}

.page-side-toc-inner {
  border-left: 1px solid var(--border);
  padding: 0.2rem 0 0.2rem 0.9rem;
}

.page-side-toc-label {
  font-size: var(--fs-micro);
  color: var(--dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
  font-weight: 500;
}

.page-side-toc ul,
.page-side-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-side-toc li { margin: 0.18rem 0; }

.page-side-toc ul ul {
  padding-left: 0.85rem;
  margin: 0.18rem 0;
  border-left: 1px solid var(--border);
}

.page-side-toc a {
  display: block;
  color: var(--dim-soft);
  text-decoration: none;
  padding: 0.18rem 0.5rem 0.18rem 0.6rem;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.page-side-toc a:hover { color: var(--text); }

.page-side-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* fallback inline TOC (legacy, kept in case any older markdown still uses it) */
.page-toc {
  margin: 0 0 2rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  font-size: var(--fs-aux);
}

.page-toc ul, .page-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
}

.page-toc li { margin: 0; }

.page-toc li::before {
  content: "›";
  color: var(--dim);
  margin-right: 0.4rem;
}

.page-toc a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}

.page-toc a:hover { border-bottom-color: var(--accent); }

.page-next {
  margin-top: 3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.page-next a {
  color: var(--accent);
  text-decoration: none;
  font-size: var(--fs-aux);
  letter-spacing: 0.8px;
}

.page-next a:hover { text-decoration: underline; }

/* ── footer ────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.85rem 2rem;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-small);
  color: var(--dim);
  letter-spacing: 0.4px;
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.dim { color: var(--dim); }

/* ── responsive ───────────────────────────────────────────────── */

@media (max-width: 760px) {
  /* Re-map the global type scale once → every rule using var() picks
     up the smaller size automatically. No per-rule overrides needed. */
  :root {
    --fs-display: 2.6rem;
    --fs-hero:    1.7rem;
    --fs-h1:      1.55rem;
    --fs-stat:    1.15rem;
    --fs-h3:      1rem;
    --fs-h2:      0.9rem;
    --fs-lede:    0.92rem;
    --fs-body:    0.88rem;
    --fs-aux:     0.8rem;
    --fs-small:   0.72rem;
    --fs-micro:   0.58rem;
    --fs-table:   0.78rem;
    --fs-th:      0.66rem;
  }

  body { font-size: 13.5px; line-height: 1.68; }

  /* Layout-only mobile overrides (padding, gap, structure). */
  nav { padding: 0.7rem 0.8rem; gap: 0.7rem; }
  .nav-logo { letter-spacing: 1px; }
  .nav-links { gap: 0.85rem; }
  .nav-links a { letter-spacing: 0.4px; }

  .hero { padding: 2.5rem 1rem 0.4rem; }
  .hero h1 { letter-spacing: 0.4px; word-spacing: 0.15em; }
  .tagline { letter-spacing: 0.3px; line-height: 1.55; }

  .result-strip { grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2.5rem; padding: 0 1rem; }
  .result-box { padding: 1.6rem 1.2rem; }

  section.diagram-section,
  section.method-section,
  section.experiments,
  section.findings,
  section.mcts-section,
  section.vs-az,
  section.next,
  section.links { padding: 0 1rem; margin-bottom: 2.75rem; }

  section h2 { letter-spacing: 1.6px; }

  /* Hypothesis cards: stack the stat row vertically so values don't
     overflow narrow phones. */
  .hypothesis { padding: 1.15rem 1.1rem 1rem; }
  .hypothesis h3 { line-height: 1.3; }
  .hypothesis .hyp-line { padding-left: 0.65rem; }
  .hypothesis .head { gap: 0.4rem; }
  .hypothesis .tag, .hypothesis .badge { padding: 0.16rem 0.45rem; }
  .hypothesis .result-row {
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.8rem 0 0.9rem;
  }
  .hypothesis .stat {
    flex-direction: row;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .hypothesis .stat .label { min-width: 7rem; }
  .hypothesis .stat .delta, .hypothesis .stat .dim {
    width: 100%;
    margin-top: -0.1rem;
    padding-left: 7.6rem;
  }

  .finding { padding: 1.15rem 1.1rem; }

  /* Tables: display:block + width:max-content lets narrow tables stay
     narrow AND wide tables scroll horizontally inside their own box
     instead of stretching the page. max-width caps any table at the
     screen. */
  table.compact, .content table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
  }
  table.compact th, table.compact td,
  .content th, .content td {
    padding: 0.5rem 0.7rem;
    white-space: nowrap;
  }

  .card { padding: 1.4rem 1.4rem; }
  .footer-inner { flex-direction: column; gap: 0.5rem; text-align: center; }

  .page { padding: 2rem 1.1rem 3.5rem; }
  .page-with-toc {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 2rem 1.1rem 3.5rem;
  }
  .page-side-toc {
    position: static;
    max-height: none;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .page-side-toc-inner {
    border-left: none;
    padding: 0;
  }
  .page-side-toc ul ul { padding-left: 1rem; }
  .page h1 { letter-spacing: 1px; }
  .content h2 { letter-spacing: 1.8px; margin-top: 2rem; }
  .content pre { padding: 0.8rem 0.9rem; }
}

/* extra-tight breakpoint for very narrow phones (≤ 380px) */
@media (max-width: 380px) {
  :root {
    --fs-display: 2.2rem;
    --fs-hero:    1.45rem;
    --fs-h1:      1.4rem;
    --fs-stat:    1.05rem;
    --fs-h3:      0.92rem;
    --fs-h2:      0.84rem;
    --fs-lede:    0.86rem;
    --fs-body:    0.82rem;
    --fs-aux:     0.76rem;
    --fs-small:   0.68rem;
    --fs-micro:   0.54rem;
    --fs-table:   0.72rem;
    --fs-th:      0.62rem;
  }
  body { font-size: 13px; }
  .hero h1 { letter-spacing: 0; }
  .nav-links { gap: 0.6rem; }
  .hypothesis .stat .label { min-width: 6rem; }
  .hypothesis .stat .delta, .hypothesis .stat .dim { padding-left: 6.6rem; }
}
