:root {
  --ponder: #126555;
  --random: #D55E00;
  --write: #38bdf8;
  --remask: #f59e0b;
  --conflict: #ef4444;
  --repaired: #22c55e;
  --ink: #1f2937;
  --muted: #5b6472;
  --tint: #f6f7f9;
  --card: #ffffff;
  --line: #e5e7eb;
}

body {
  font-family: 'Noto Sans', sans-serif;
  color: var(--ink);
  background: #fff;
}

.method { font-variant: small-caps; font-weight: 700; letter-spacing: 0.02em; }

/* ---------- hero ---------- */
.publication-title, .publication-authors, .teaser { font-family: 'Google Sans', sans-serif; }
/* The Thinker sits beside the title and scales with its font size. */
.publication-title-row { display: flex; align-items: center; justify-content: center; gap: 0.3em; font-size: 3rem; margin-bottom: 1.25rem; }
.publication-title-row .publication-title { font-size: 1em; margin-bottom: 0; text-wrap: balance; }
.title-thinker { flex: none; width: auto; height: 1.9em; }
.publication-subtitle { font-size: 1.25rem; color: var(--muted); margin: 0.25rem auto 1rem; max-width: 52rem; text-wrap: balance; }
.publication-authors a { color: hsl(204, 86%, 53%) !important; }
.publication-authors a:hover { text-decoration: underline; }
.author-block { display: inline-block; }
.publication-affiliations { color: var(--muted); font-size: 1rem; margin-top: 0.5rem; }
.link-block a { margin-top: 5px; margin-bottom: 5px; }
.footer .icon-link { font-size: 25px; color: #000; }

/* ---------- TL;DR ---------- */
.teaser .hero-body { padding-top: 0; padding-bottom: 2rem; }
.tldr { margin-top: 1.5rem !important; line-height: 1.6; font-size: 1.15rem !important; text-wrap: balance; }
.tag-random, .tag-ponder, .tag-write, .tag-remask { font-weight: 600; white-space: nowrap; }
.tag-random { color: var(--random); }
.tag-ponder { color: var(--ponder); }
.tag-write { color: #0284c7; }
.tag-remask { color: #b45309; }

/* ---------- headline numbers ---------- */
.headline-section { padding-top: 1rem; padding-bottom: 1.5rem; }
.headline-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.headline { background: var(--tint); border-radius: 10px; padding: 1rem 0.75rem; text-align: center; }
.headline-value { font-family: 'Google Sans', sans-serif; font-size: 1.6rem; font-weight: 700; color: var(--ponder); font-variant-numeric: tabular-nums; }
.headline-value .arrow { color: var(--muted); font-weight: 400; }
.headline-label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
.headline-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.35rem; opacity: 0.85; }
@media (min-width: 1024px) { .headline-sub { white-space: nowrap; letter-spacing: -0.01em; } }
.headline-note { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 0.75rem; }

/* ---------- sections ---------- */
.section-tinted { background: var(--tint); }
.section-lead { max-width: 52rem; margin: 0 auto 1.5rem; text-align: center; color: var(--muted); }
.section-next { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; }
.section-next a { color: var(--ponder); font-weight: 600; }
.figure-wide img { width: 100%; border-radius: 6px; }
.figure-wide { margin: 0 0 1.5rem; }
.method-columns p { font-size: 0.95rem; line-height: 1.55; }
.figure-card { background: var(--card); border-radius: 10px; padding: 0.75rem; margin: 0; }
.figure-card img { width: 100%; }
.figure-card figcaption { font-size: 0.85rem; color: var(--muted); text-align: center; }

/* ---------- players ---------- */
.player-controls { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: center; align-items: center; margin-bottom: 1rem; }
.control-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.control-group > label:first-child { font-size: 0.85rem; color: var(--muted); margin-right: 0.15rem; }
.control-group .checkbox { font-size: 0.85rem; color: var(--muted); }
.segmented { margin-bottom: 0 !important; }
.segmented .button, .class-buttons .button { margin-bottom: 0 !important; }
.button.is-selected { background: var(--ponder); color: #fff; border-color: var(--ponder); }
.class-buttons { margin-bottom: 0 !important; justify-content: center; }

.sdk-boards, .mar-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; max-width: 1080px; margin: 0 auto; }
.sdk-board, .mar-panel { background: var(--card); border-radius: 10px; padding: 0.6rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); border-top: 3px solid var(--ponder); }
.sdk-board[data-kind="random"], .mar-panel[data-kind="random"] { border-top-color: var(--random); }
.sdk-title { font-family: 'Google Sans', sans-serif; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.4rem; min-height: 1.4em; }
.sdk-title .r { font-weight: 400; color: var(--muted); }
.sdk-canvas, .mar-canvas { width: 100%; display: block; border-radius: 4px; background: #0b0d12; }
.mar-canvas { background: #ececec; }
.sdk-timeline { width: 100%; display: block; margin-top: 0.4rem; cursor: pointer; border-radius: 3px; }
.sdk-status { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; min-height: 1.6em; font-variant-numeric: tabular-nums; }
.sdk-status .has-conflicts { color: #b91c1c; font-weight: 600; }
.badge { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-weight: 600; font-size: 0.8rem; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.neutral { background: #e5e7eb; color: #374151; }

.player-transport { display: flex; align-items: center; gap: 0.5rem; max-width: 1080px; margin: 1rem auto 0; }
.player-transport input[type="range"] { flex: 1; accent-color: var(--ponder); min-width: 0; }
.transport-label { font-size: 0.85rem; color: var(--muted); min-width: 8.5rem; text-align: right; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; justify-content: center; margin: 0 auto 1rem; max-width: 1080px; font-size: 0.82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 3px; }
.swatch.outline { border: 3px solid; background: #0b0d12; }
.swatch.outline.write { border-color: var(--write); }
.swatch.outline.remask { border-color: var(--remask); }
.swatch.outline.repaired { border-color: var(--repaired); }
.swatch.fill.conflict { background: rgba(239, 68, 68, 0.55); border: 2px solid var(--conflict); }
.swatch.ghost { background: #0b0d12; border: 2px dashed var(--remask); }
.swatch.clue { background: #3a4252; border: 1px solid #64748b; }
.swatch.outline.light, .swatch.ghost.light { background: #ececec; }
.swatch.viridis { width: 48px; background: linear-gradient(90deg, #440154, #3b528b, #21918c, #5ec962, #fde725); }

/* ---------- charts & tables ---------- */
.result-group { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: center; margin-top: 1.5rem; }
.result-group-stacked { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-group-stacked > .table-card { grid-column: 1 / -1; }
.chart-card { min-width: 0; position: relative; margin: 0; height: 300px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem; }
.table-card { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem; }
.table-title { font-weight: 600; margin-bottom: 0.4rem; }
.table-scroll { overflow-x: auto; }
.results-table td:first-child { white-space: nowrap; }
.cost-note { margin-top: 1.5rem; font-size: 0.92rem; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }
.results-table { font-size: 0.85rem; font-variant-numeric: tabular-nums; margin-bottom: 0 !important; }
.results-table td:not(:first-child), .results-table th:not(:first-child) { text-align: right; }
.results-table tr.ponder td:first-child { color: var(--ponder); font-weight: 600; }
.results-table tr.best td { font-weight: 700; background: #e7f2ef; }
.table-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; }

/* ---------- comparison sliders ---------- */
.compare-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.compare-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compare { margin: 0; }
.compare figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; font-style: italic; }
.compare-frame { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #ddd; }
.compare-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; pointer-events: none; }
.compare-handle { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 4px rgba(0, 0, 0, 0.5); pointer-events: none; }
.compare-frame input[type="range"] { touch-action: pan-y; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare-tags { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 0.3rem 0.45rem; pointer-events: none; }
.compare-tags span { background: rgba(255, 255, 255, 0.9); border-radius: 4px; padding: 0 0.35rem; font-size: 0.72rem; }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .sdk-boards, .mar-panels { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
  .sdk-board, .mar-panel { padding: 0.4rem; }
  .sdk-title { font-size: 0.8rem; }
}
@media (max-width: 768px) {
  .publication-title-row { font-size: 2.25rem; }
  .headline-grid { grid-template-columns: 1fr; }
  .sdk-boards, .mar-panels { grid-template-columns: 1fr; max-width: 420px; }
  .result-group, .result-group-stacked { grid-template-columns: minmax(0, 1fr); }
  .legend { gap: 0.3rem 0.8rem; font-size: 0.75rem; }
  .player-transport { flex-wrap: wrap; }
  .player-transport input[type="range"] { order: 10; flex: 1 0 100%; }
  .transport-label { flex: 1; }
  .compare-grid, .compare-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding: 2rem 1rem; }
}

/* ---------- fold-out math ---------- */
.math-toggle { max-width: 52rem; margin: 1rem auto 0; }
.math-toggle summary { cursor: pointer; text-align: center; font-size: 0.9rem; font-weight: 600; color: var(--ponder); list-style: none; }
.math-toggle summary::-webkit-details-marker { display: none; }
.math-toggle summary::after { content: ' ▾'; }
.math-toggle[open] summary::after { content: ' ▴'; }
.math-toggle .content { margin-top: 0.75rem; font-size: 0.92rem; }
.section-lead + .section-lead { margin-top: -0.75rem; }
