:root {
  color-scheme: light;
  --bg: #f8f5ef;
  --text: #302820;
  --muted: #716459;
  --accent: #925735;
  --rule: #ded3c5;
  --rule-strong: #b6a18a;
  --box: #efe7db;
  --panel: #fffdf9;
  --sidebar-bg: #30251e;
  --sidebar-text: #dbccbb;
  --sidebar-active: #594031;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
::selection { background: #e7ceb2; color: var(--text); }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 1.15em; }
strong { font-weight: 600; }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[id] { scroll-margin-top: 32px; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 8px 16px;
  background: var(--panel);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.page {
  display: grid;
  grid-template-columns: 236px minmax(0, 840px);
  column-gap: clamp(56px, 5vw, 100px);
  min-height: 100vh;
  padding: 0 48px 96px 36px;
  background: linear-gradient(to right, var(--sidebar-bg) 300px, var(--bg) 300px);
}
main { min-width: 0; }
.container { width: 100%; }

.label, .tldr > h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.5;
  text-transform: uppercase;
}

.outline {
  position: sticky;
  top: 0;
  align-self: start;
  padding: 30px 10px 32px 0;
  max-height: 100vh;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.4;
}
.sidebar-brand {
  display: block;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgb(255 255 255 / 17%);
  color: #f8eee1;
  font: 600 22px/1 var(--display);
  letter-spacing: -.025em;
  text-decoration: none;
}
.sidebar-brand:hover { color: #fff; }
.brand-light { color: #edc8a5; font-weight: 400; }
.outline nav a, .contents-inline a {
  display: block;
  padding: 10px 12px;
  border-radius: 5px;
  color: var(--sidebar-text);
  text-decoration: none;
}
.outline nav a.toc-subsection { margin-left: 15px; padding-left: 10px; border-left: 1px solid #806957; font-size: 12px; }
.outline nav a.toc-subsubsection { margin-left: 30px; padding-left: 10px; border-left: 1px solid #806957; font-size: 11px; }
.outline .label { margin-bottom: 14px; color: #b99e88; }
.outline .num, .contents-inline .num { margin-right: 7px; color: #c19f81; font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.outline nav a:hover, .outline nav a.active { background: var(--sidebar-active); color: #fff9f0; }
.outline nav a.active .ttl { font-weight: 600; }
.outline nav a.active .num { color: #f0ba8d; }
.outline nav a.within-section .ttl { color: #fff9f0; font-weight: 600; }
.sidebar-note { margin: 34px 12px 0; padding-top: 22px; border-top: 1px solid rgb(255 255 255 / 17%); color: #bda995; font-size: 12px; line-height: 1.55; }
.contents-inline { display: none; margin: 0 0 34px; font-size: 14px; line-height: 1.4; }
.contents-inline summary { cursor: pointer; color: var(--text); font-weight: 600; }
.contents-inline summary span { float: right; color: var(--muted); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.contents-inline nav { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); }
.contents-inline a { color: var(--text); }
.contents-inline a.toc-subsection { margin-left: 16px; padding-left: 10px; border-left: 1px solid var(--rule-strong); }
.contents-inline a.toc-subsubsection { margin-left: 32px; padding-left: 10px; border-left: 1px solid var(--rule-strong); font-size: 13px; }
.contents-inline .num { color: var(--accent); }
.contents-inline a:hover, .contents-inline a.active { background: var(--box); }
.contents-inline a.active .ttl { font-weight: 600; }
.contents-inline a.within-section .ttl { color: var(--accent); font-weight: 600; }

.publication-header { position: relative; padding: 50px 0 32px; border-bottom: 1px solid var(--rule-strong); text-align: left; }
.publication-header::before { position: absolute; top: 0; left: 0; width: 72px; height: 4px; background: var(--accent); content: ""; }
.publication-header .label { margin-bottom: 16px; color: var(--accent); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }
.publication-header .label a { text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; }
h1 {
  max-width: 780px;
  margin: 0 0 16px;
  font-size: clamp(48px, 5vw, 68px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.authors { max-width: 760px; margin: 0; font-size: 15px; font-weight: 450; line-height: 1.55; text-wrap: balance; }
.authors span { display: inline-block; }
.authors a { text-decoration: none; }
.authors a:hover { text-decoration: underline; }
sup {
  position: relative;
  top: -.45em;
  margin-left: 1px;
  vertical-align: baseline;
  font-size: .7em;
  line-height: 0;
}
.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 3px 16px;
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.publication-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 20px;
  color: var(--text);
  font-size: 13px;
}
.publication-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 7px 14px; border: 1px solid var(--rule-strong); border-radius: 99px; background: var(--panel); white-space: nowrap; }
.publication-links a:first-child { border-color: var(--accent); background: var(--accent); color: #fff; }
.publication-links a + a::before {
  display: none;
}
.publication-links a { text-decoration: none; }
.publication-links a:hover { border-color: var(--accent); color: var(--accent); }
.publication-links a:first-child:hover { background: #713f27; color: #fff; }

.teaser-animation { width: min(960px, calc(100% + 60px)); margin: 20px 0 0 50%; transform: translateX(-50%); }
.teaser-animation svg, .teaser-animation img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--bg); }
.teaser-animation svg { font-family: var(--body); background: #fff; }
.teaser-animation svg .storyboard-display { font-family: var(--display); }
.teaser-controls { display: flex; justify-content: center; margin-top: 12px; }
.teaser-controls button { min-width: 92px; min-height: 42px; padding: 6px 18px; border: 1px solid var(--rule-strong); border-radius: 6px; background: #fff; color: var(--text); font-size: 13px; cursor: pointer; }
.teaser-controls button:hover { border-color: var(--accent); color: var(--accent); }
.teaser-section { margin: 6px 0 30px; }
.teaser-section figure { margin: 0; }
.tldr { margin: 6px 0 34px; padding: 20px 26px 12px; border-radius: 10px; background: var(--box); }
.tldr > h2 { font-size: 13px; margin-bottom: 12px; }
.tldr ul { margin: 0; padding-left: 1.15em; }
.tldr li { margin-bottom: .65em; }

.section { margin: 0; padding-top: 56px; }
.section + .section { margin-top: 62px; border-top: 1px solid var(--rule); }
.abstract-section { margin-top: 36px; }
h2 { margin: 0 0 25px; font-size: 37px; font-weight: 500; letter-spacing: -.026em; text-wrap: balance; }
h3 { margin: 1.7em 0 .6em; font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
h4 { margin: 1.9em 0 .75em; padding-left: 14px; border-left: 3px solid var(--accent); font-size: 21px; font-weight: 500; letter-spacing: -.015em; }
h2 .num { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-right: 12px; border: 1px solid #cfb49a; border-radius: 50%; color: var(--accent); font: 12px var(--mono); vertical-align: 5px; }
h3 .num { margin-right: .35em; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.outcome-order {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 26px 0;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 500;
}
.outcome-order span { color: var(--muted); }
.equation { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding-block: 4px; overflow-x: auto; }
.section > p:has(+ .equation) { margin-bottom: .35em; }
math { flex: 1; font-size: 22px; font-family: "STIX Two Math", "Cambria Math", math; }
.equation-parts { display: flex; flex: 1; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px; min-width: 0; }
.equation-parts math { flex: none; }
.equation-number { color: var(--muted); font-size: 15px; }

figure { margin: 2.1em 0; }
.panel { padding: 20px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); box-shadow: 0 12px 35px rgb(58 39 21 / 4%); }
.figure-link { display: block; }
.figure-link.panel { transition: border-color 150ms ease; }
.figure-link.panel:hover { border-color: var(--rule-strong); }
.figure-link img { width: 100%; margin-inline: auto; }
figcaption { margin-top: 10px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
figcaption .fignum { color: var(--text); font-weight: 600; }
.inline-note { position: relative; display: inline; }
.inline-note-trigger { margin-left: 2px; padding: 0 2px; color: var(--accent); font-size: .7em; font-weight: 600; vertical-align: super; line-height: 1; cursor: pointer; }
.inline-note-trigger:hover { text-decoration: underline; }
.inline-note-toggle:focus-visible + .inline-note-trigger { outline: 2px solid var(--accent); outline-offset: 3px; }
.inline-note-popup { display: none; width: min(350px, calc(100vw - 36px)); margin: 6px 0 0 4px; padding: 14px 16px; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--panel); box-shadow: 0 12px 30px rgb(58 39 21 / 16%); color: var(--text); font-size: 14px; line-height: 1.5; font-weight: 400; text-align: left; vertical-align: top; }
.inline-note-toggle:checked ~ .inline-note-popup { display: inline-block; }
.experiment + .experiment { margin-top: 34px; }
.experiment-links { margin-top: -14px; color: var(--muted); font-size: 13px; }
.experiment-links a + a { margin-left: 16px; }

.theorem {
  margin: 30px 0;
  padding: 22px 28px;
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--box);
}
.theorem-title { margin: 0; font-family: var(--display); font-size: 21px; font-weight: 500; }
.theorem .equation { margin: 8px 0 10px; }
.theorem .equation:last-child { margin-bottom: 0; }
.theorem > p:last-child { margin: 0; color: var(--muted); font-size: 14px; }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 24px; }
.figure-pair > * { min-width: 0; }
.training-reward-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.training-reward-grid .figure-link { min-width: 0; }
.panel-title { margin: 0 0 14px; color: var(--text); font-size: 14px; font-weight: 500; text-align: center; }
.figure-pair img { width: 100%; height: auto; }
.aime-training-figure img { width: 100%; }
.aime-training-scroll { overflow-x: auto; }
.chart-scroll-hint { display: none; }
.compute-frontier-figure img { width: 100%; max-width: 660px; margin-inline: auto; }
.figure-labels { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 12px; text-align: center; font-size: 14px; font-weight: 500; }
.maze-results { grid-template-columns: .85fr 1.15fr; }

.simplex-demo { padding: 22px 20px 18px; }
.simplex-heading .panel-title { margin-bottom: 4px; }
.simulation-setup { margin: 0 0 20px; color: var(--muted); text-align: center; font-size: 12px; }
.simplex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.simplex-method { min-width: 0; }
.method-label { margin: 0 0 4px; text-align: center; font-family: var(--display); font-weight: 600; }
.reinforce-color { color: #4c78a8; }
.graceful-color { color: #b66115; }
.simplex-plot { display: block; width: 100%; height: auto; }
.simplex-boundary { fill: var(--bg); stroke: var(--rule-strong); stroke-width: 1.3; }
.simplex-gridline { stroke: var(--rule); stroke-width: .7; }
.vertex-label { fill: var(--text); font: 500 15px var(--body); }
.vertex-probability { fill: var(--muted); font: 12px var(--body); }
.initial-policy { fill: var(--panel); stroke: var(--muted); stroke-width: 1.3; }
.simplex-metrics { margin: 4px 0 0; color: var(--muted); text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.simplex-metrics strong { color: var(--text); }
.animation-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin: 22px 0 18px; color: var(--muted); font-size: 12px; }
.animation-legend span { display: inline-flex; align-items: center; gap: 6px; }
.initial-marker, .current-marker { display: inline-block; width: 9px; height: 9px; border: 1px solid var(--muted); border-radius: 50%; }
.current-marker { background: var(--muted); }
.animation-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 12px 0; border-block: 1px solid var(--rule); background: var(--panel); }
.animation-controls button {
  min-width: 66px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.animation-controls button:hover { border-color: var(--rule-strong); }
.timeline { flex: 1; min-width: 0; padding-left: 8px; }
.timeline label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.timeline output { white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline input { display: block; width: 100%; height: 20px; margin: 4px 0 0; accent-color: var(--accent); cursor: pointer; }

.cot-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 18px; }
.cot-column { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--cot-border); border-radius: 8px; background: var(--cot-bg); }
.cot-maxrl { --cot-accent: #496e96; --cot-border: #8aacc8; --cot-bg: #f4f7fa; }
.cot-graceful { --cot-accent: #b66f29; --cot-border: #d4a06a; --cot-bg: #fdf8f1; }
.cot-column-title { margin: 0; padding: 10px 14px; background: var(--cot-accent); color: #fff; font: 600 14px/1.35 var(--body); }
.cot-entry { flex: 1; padding: 15px 17px; }
.cot-entry + .cot-entry { border-top: 1px dashed var(--cot-border); }
.cot-entry blockquote { margin: 0; font-size: 14px; line-height: 1.55; }
.cot-emphasis, .cot-boxed { color: var(--cot-accent); }
.cot-boxed { display: inline-block; padding: 0 4px; border: 1px solid var(--cot-border); white-space: nowrap; }
.source-note { color: var(--muted); font-size: 13px; }

.minesweeper-results { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: center; }
.minesweeper-results > * { min-width: 0; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; text-align: right; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; white-space: nowrap; }
thead { border-top: 1.5px solid var(--text); border-bottom: 1px solid var(--rule-strong); }
th { font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child { border-bottom: 1.5px solid var(--text); }
.featured-result { background: #f2e4d0; }
.table-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.citation-section { margin-top: 70px; }
.cite-box {
  position: relative;
  margin: 14px auto 0;
  padding: 40px 16px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
  text-align: left;
}
.cite-box pre { margin: 0; color: var(--text); font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.cite-box code { font: inherit; }
.cite-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--muted);
  background: var(--bg);
  font: 12px/1.4 var(--body);
  cursor: pointer;
}
.cite-copy:hover { color: var(--text); border-color: var(--rule-strong); }
footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; }
footer p { margin-bottom: 10px; }

@media (min-width: 1600px) {
  .page {
    grid-template-columns: minmax(236px, 1fr) minmax(0, 840px) minmax(236px, 1fr);
    column-gap: 0;
    padding-right: 36px;
  }
  .outline { width: 236px; }
  .teaser-animation { width: 960px; }
}

@media (max-width: 1040px) {
  .page { display: block; padding: 0 24px 72px; background: var(--bg); }
  main { max-width: 840px; margin-inline: auto; }
  .teaser-animation { width: 100%; margin-left: 0; transform: none; }
  .outline { display: none; }
  .contents-inline { display: block; padding: 16px 20px; border: 1px solid var(--rule); border-radius: 6px; background: var(--box); }
  .publication-header { padding: 42px 0 30px; }
  h1 { font-size: clamp(45px, 6vw, 64px); }
}
@media (max-width: 640px) {
  .inline-note-popup { position: fixed; z-index: 20; inset: auto 18px 18px; width: auto; margin: 0; }
  .page { padding-inline: 18px; }
  .publication-header { padding: 32px 0 24px; }
  .publication-header .label { margin-bottom: 12px; }
  .teaser-animation { margin-top: 16px; }
  h1 { font-size: clamp(42px, 9vw, 55px); }
  .publication-links { gap: 8px; }
  .section { padding-top: 45px; }
  .section + .section { margin-top: 48px; }
  h2 { font-size: 32px; }
  h2 .num { width: 32px; height: 32px; margin-right: 8px; vertical-align: 4px; }
  h3 { font-size: 23px; }
  h4 { font-size: 19px; }
  .training-reward-grid { grid-template-columns: 1fr; gap: 22px; }
  .training-reward-grid img { max-width: 400px; }
  .aime-training-figure img { width: 680px; max-width: none; }
  .chart-scroll-hint { display: block; margin: 5px 0 0; color: var(--muted); font-size: 12px; text-align: right; }
  .figure-pair, .maze-results { grid-template-columns: 1fr; gap: 22px; }
  .figure-pair img { max-width: 460px; margin-inline: auto; }
  .maze-results > div:first-child img { max-width: 290px; }
  .simplex-grid { grid-template-columns: 1fr; gap: 22px; }
  .simplex-plot { max-width: 360px; margin-inline: auto; }
  .simplex-demo { padding: 18px 12px; }
  .simplex-method + .simplex-method { padding-top: 18px; border-top: 1px solid var(--rule); }
  .cot-columns { grid-template-columns: 1fr; gap: 16px; }
  .cot-entry { padding: 14px; }
  .animation-controls { flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
  .timeline { flex-basis: 100%; padding: 4px 0 0; }
  .theorem { padding: 18px; }
  .figure-labels { font-size: 11px; gap: 10px; }
  .minesweeper-results { grid-template-columns: 1fr; gap: 24px; }
  .minesweeper-results img { max-width: 440px; margin-inline: auto; }
  .panel { padding: 10px; }
  .tldr { padding: 18px 20px 10px; }
  .equation { gap: 7px; }
  math { font-size: 18px; }
}
@media (max-width: 420px) {
  body { font-size: 16px; }
  h1 { font-size: 40px; }
  .authors { font-size: 15px; }
  .affiliations { gap: 3px 12px; }
  .publication-links { font-size: 12px; }
  h2 { font-size: 29px; }
  .outcome-order { gap: 10px; font-size: 21px; }
  math { font-size: 15px; }
  .equation-number { font-size: 12px; }
  .experiment-links a { display: block; width: fit-content; padding-block: 5px; }
  .experiment-links a + a { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .figure-link.panel { transition: none; }
}

@media (pointer: coarse) {
  .animation-controls button, .cite-copy { min-height: 44px; min-width: 66px; }
  .timeline input { height: 44px; margin-top: 0; }
  .cite-box { padding-top: 64px; }
  .contents-inline a { display: flex; align-items: center; min-height: 44px; }
  .contents-inline .num { flex-shrink: 0; margin-right: 3px; }
  .publication-links { gap: 0 14px; font-size: 13px; }
  .publication-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .publication-links a + a::before { display: none; }
}
