:root {
  --ink: #363636;
  --muted: #4a4a4a;
  --blue: #209cee;
  --accent: #363636;
  --soft: #f5f5f5;
  --line: #dbdbdb;
  --radius: 8px;
  --body: 1.125rem;
  --support: 1rem;
  --heading: clamp(1.875rem, 3.1vw, 2.5rem);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; color: var(--ink); background: #fff; font-family: 'Noto Sans', sans-serif; font-size: var(--body); line-height: 1.65; }
[hidden] { display: none !important; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: var(--heading); font-weight: 600; }
h3 { font-size: 1.375rem; font-weight: 600; }
p + p { margin-top: 1rem; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 4px; }
button, select { font: inherit; font-size: var(--support); }
button { cursor: pointer; }
img, video { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 12px; background: #fff; }
.skip-link:focus { top: 10px; }

/* Navigation and publication heading. */
.nav { min-height: 76px; padding: 12px 5%; display: flex; align-items: center; justify-content: space-between; gap: 24px; position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; align-items: center; gap: 16px; font-family: 'Google Sans', sans-serif; font-size: 1.625rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.wordmark span { padding-left: 16px; border-left: 1px solid var(--line); font-size: var(--support); font-weight: 400; color: var(--muted); }
.nav nav { display: flex; flex-wrap: wrap; gap: 24px; }
.nav nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--support); color: var(--ink); text-decoration: none; }
.nav nav a:hover { text-decoration: underline; }
.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 740px; color: #fff; background: #222; overflow: hidden; }
.hero-visual { position: absolute; inset: 0; z-index: -2; }
.hero-film { display: grid; grid-template-columns: repeat(3, 1fr); height: 100%; opacity: .48; filter: saturate(.7); }
.hero-film video { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #0009, #0004), linear-gradient(0deg, #222 0%, transparent 33%, #0009 100%); }
.hero-content { width: min(1180px, 90%); margin: auto; padding: 72px 0 112px; }
.hero h1 { font-family: 'Google Sans', sans-serif; font-size: clamp(2.75rem, 6vw, 4.75rem); line-height: 1.08; letter-spacing: -.025em; }
.paper-title { margin-top: 20px; max-width: 1000px; text-wrap: balance; font-family: 'Google Sans', sans-serif; font-size: clamp(1.25rem, 2.1vw, 1.625rem); line-height: 1.5; color: #f5f5f5; }
.authors { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; font-family: 'Google Sans', sans-serif; font-size: 1.25rem; line-height: 1.6; }
.authors sup, .affiliations sup { font-size: .75em; padding-left: 2px; }
.affiliations { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; color: #e6e6e6; font-size: var(--support); }
.correspondence { margin-top: 10px; color: #e6e6e6; font-size: var(--support); }
.hero-summary { margin-top: 28px; max-width: 780px; font-size: 1.25rem; line-height: 1.6; }
.hero-links { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 28px; }
.button, .code-pending { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 20px; border: 1px solid transparent; border-radius: var(--radius); font-size: var(--support); font-weight: 500; text-decoration: none; }
.primary { background: #fff; color: var(--ink); }
.ghost { border-color: #b5b5b5; color: #fff; background: #0003; }
.code-pending { color: #e6e6e6; padding-inline: 4px; }
.hero-motion-control { position: absolute; right: 5%; bottom: 24px; min-height: 44px; padding: 8px 14px; border: 1px solid #ffffff70; border-radius: var(--radius); color: #fff; background: #0006; }

/* One type scale and one section rhythm across the page. */
.section { padding: 80px max(calc((100vw - 1160px) / 2), 5vw); }
.section-heading, .results-heading { max-width: 1180px; margin: 0 auto 36px; text-align: center; }
.lead { max-width: 1120px; margin: 24px auto 0; color: var(--muted); font-size: var(--body); line-height: 1.75; }
.lead strong { color: var(--ink); font-weight: 600; }
.showcase, .results, .all-runs { background: var(--soft); }
.idea, .comparison, .controllers { background: #fff; }
.caption, .paper-figure figcaption, caption { color: var(--muted); font-size: var(--support); line-height: 1.65; }
.caption { margin-top: 20px; }
.showcase > .caption, .comparison > .caption { text-align: center; }

/* Shared controls, using the same shape, size and selected state. */
.playback-bar, .gallery-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.playback-bar, .gallery-toolbar label { color: var(--muted); font-size: var(--support); }
.speed-controls, .tabs, .metric-toggle, .controller-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.speed-controls button, .tabs button, .metric-toggle button, .controller-tabs button { min-height: 44px; padding: 8px 16px; border: 1px solid #b5b5b5; border-radius: var(--radius); background: transparent; color: var(--ink); }
.speed-controls button:hover, .tabs button:hover, .metric-toggle button:hover { border-color: var(--blue); }
.speed-controls button.selected, .tabs button.selected, .metric-toggle button.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
.metric-toggle { margin: 28px 0; }
.comparison > .tabs { justify-content: center; margin-bottom: 28px; }
select { min-height: 44px; padding: 8px 32px 8px 12px; margin-left: 8px; border: 1px solid #b5b5b5; border-radius: var(--radius); background: #fff; color: var(--ink); }

/* Recordings. */
.demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.video-card { min-width: 0; }
.video-wrap { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); background: #f5f5f5; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; }
.video-card h3 { margin-top: 18px; }
.video-card p { margin-top: 10px; color: var(--muted); font-size: var(--body); }
.video-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); font-size: var(--support); }
.success { color: #363636; }
#video-gallery { margin-top: 24px; row-gap: 40px; }

/* Method and paper figures. */
.paper-figure { margin: 32px 0 20px; }
.paper-figure img { width: 100%; height: auto; background: #fff; }
.paper-figure figcaption { max-width: 900px; margin: 16px auto 0; text-align: center; }
.method-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 14px 32px; margin-top: 36px; }
.method-steps article { display: grid; grid-row: span 2; grid-template-rows: subgrid; padding-top: 20px; border-top: 1px solid var(--line); }
.method-steps p { margin-top: 0; color: var(--muted); text-wrap: pretty; }
.equation { margin-top: 32px; padding: 24px 0; text-align: center; }
.equation > span { font-family: Georgia, serif; font-size: clamp(1.4rem, 3vw, 2rem); }
.equation p { max-width: 820px; margin: 16px auto 0; color: var(--muted); }
.equation sup { font-size: .65em; }
.effect-description { max-width: 900px; margin: 28px auto 0; color: var(--muted); }
.figure-detail { margin-top: 32px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.comparison-figures { display: grid; gap: 36px; }
.comparison-figures .paper-figure { margin: 16px 0 0; }
.comparison-figures h3 { margin-bottom: 20px; }
.figure-scroll { overflow-x: auto; }
.figure-detail > .caption { margin-bottom: 24px; }
summary { padding: 20px 0; cursor: pointer; font-size: var(--support); }

/* Results: consistent labels, readable tables, no decorative number cards. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--support); font-variant-numeric: tabular-nums; }
caption { text-align: left; margin-bottom: 12px; }
th, td { padding: 18px 14px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th:first-child { text-align: left; }
th { font-weight: 500; }
thead th { color: var(--muted); }
thead th span { display: block; margin-top: 4px; font-weight: 400; }
td { font-size: 1.25rem; font-weight: 400; }
td small { font-size: var(--support); color: var(--muted); font-weight: 400; }
.ours { background: #e4e9ed; color: #363636; }
td.best { font-weight: 700; }
.cost-figure { margin-top: 48px; }
.assembly-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 900px; margin: 0 auto; }
#assembly-comparison > .tabs { justify-content: center; margin-bottom: 28px; }
#assembly-comparison > .caption { text-align: center; }
.ablation-layout .lead { margin: 0 0 20px; text-align: left; }
.cost-figure img { mix-blend-mode: multiply; }
.baseline-description { max-width: 960px; margin: 24px 0; color: var(--muted); font-size: var(--support); }
.ablation-layout { max-width: 1000px; margin: auto; }
.ablation-layout td { font-size: var(--support); }

/* Additional controllers keep the same typography and control hierarchy. */
.controllers-section { color: var(--ink); }
.controllers .lead, .controllers .caption { color: #4a4a4a; }
.controller-tabs { justify-content: center; margin-bottom: 28px; }
.controller-tabs button { color: #363636; border-color: #b5b5b5; }
.controller-tabs button:hover { border-color: #363636; }
.controller-tabs button.selected { color: #fff; background: var(--ink); border-color: var(--ink); }
.controller-content { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.controller-content video { width: 100%; max-height: 540px; object-fit: contain; border-radius: var(--radius); background: #f5f5f5; }
.controller-copy h3 { margin: 12px 0 16px; font-size: 1.375rem; }
.controller-copy p { color: #4a4a4a; }
.controller-copy .controller-label { color: #363636; font-size: var(--support); }
.controller-copy .caption { margin-top: 20px; }
footer { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 32px 5%; color: var(--muted); font-size: var(--support); }
.footer-brand { font-family: 'Google Sans', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--ink); text-decoration: none; }
footer p:last-child { margin: 0 0 0 auto; }
.error-message { padding: 20px; color: #363636; background: #f5f5f5; }
.video-error { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; background: #f5f5f5; text-align: center; font-size: var(--support); }


.pullback-explanation { max-width: 900px; margin: 36px auto; padding-top: 32px; border-top: 1px solid var(--line); }
.pullback-explanation > h3 { margin-bottom: 20px; }
.pullback-explanation p { color: var(--muted); }
.variance-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin: 28px 0; }
.variance-comparison h4 { margin: 0; font-size: var(--body); font-weight: 600; line-height: 1.5; }
.variance-comparison .math-expression { display: flex; align-items: center; justify-content: center; min-height: 90px; margin: 16px 0; color: var(--ink); font: 1.8rem Georgia, serif; }
.math-expression math { font-size: 1.8rem; }

@media (max-width: 1000px) {
  .wordmark span { display: none; }
  .section { padding: 64px 5%; }
  .hero { min-height: 700px; }
  .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
  .method-steps { grid-template-columns: 1fr; gap: 28px; }
  .method-steps article { display: block; grid-row: auto; }
  .method-steps p { margin-top: 14px; }
  .controller-content { grid-template-columns: 1.3fr 1fr; gap: 28px; }
}
@media (min-width: 701px) and (max-width: 850px) {
  .controller-content { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 700px) {
  html { scroll-padding-top: 124px; }
  .nav { align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 5%; }
  .nav nav { width: 100%; justify-content: space-between; gap: 8px 12px; }
  .nav nav a { font-size: var(--support); }
  .hero-content { padding: 56px 0 96px; }
  .hero h1 { font-size: clamp(2.5rem, 9vw, 3.5rem); }
  .paper-title { font-size: 1.25rem; }
  .authors { font-size: 1.125rem; gap: 8px 16px; }
  .affiliations { display: block; }
  .affiliations span { display: block; margin-top: 6px; }
  .hero-summary { font-size: var(--body); }
  .hero-film { grid-template-columns: 1fr; }
  .hero-film video:not(:first-child) { display: none; }
  .desktop { display: none; }
  .section { padding: 56px 5%; }
  .section-heading, .results-heading { margin-bottom: 28px; }
  .demo-grid, .method-steps, .controller-content, .variance-comparison { grid-template-columns: 1fr; gap: 32px; }
  .method-steps article { display: block; grid-row: auto; }
  .method-steps p { margin-top: 14px; }
  .video-card h3 { margin-top: 16px; }
  .video-card p { margin-top: 8px; }
  .gallery-toolbar { align-items: flex-start; }
  .gallery-toolbar label { width: 100%; }
  th, td { padding: 14px 12px; }
  .method-figure, .cost-figure, .figure-detail .figure-scroll { overflow-x: auto; }
  .method-figure img { min-width: 650px; }
  .cost-figure img { min-width: 580px; }
  .figure-detail img { min-width: 650px; }
  footer p:last-child { width: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.times-detail { margin-top: 28px; }
.times-table td { font-size: var(--support); }
.times-table tbody th[scope="rowgroup"] { vertical-align: top; font-weight: 600; background: var(--soft); }
.times-table tbody th[scope="row"] { text-align: left; }

/* Subsections inside a results section. */
.subsection-title { max-width: 1180px; margin: 56px auto 0; text-align: center; font-size: 1.375rem; font-weight: 600; }
.subsection-title + .lead { margin-top: 12px; margin-bottom: 28px; text-align: center; }
#reliability .table-wrap, .measure-table { max-width: 960px; margin: 0 auto; }
#reliability .demo-grid, #minimal-definitions .demo-grid { margin-top: 32px; }
.pair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 900px; margin: 0 auto; }
tr.group th { padding-top: 22px; font-size: var(--support); font-weight: 600; color: var(--muted); background: none; }
.measure-table td { font-size: 1.125rem; }
.pair-grid { margin-top: 32px; }
tr.time-row th, tr.time-row td { color: var(--muted); }

/* Phones: stack paired videos and fit result tables to the screen. */
@media (max-width: 700px) {
  .pair-grid { grid-template-columns: 1fr; }
  table th, table td { white-space: normal; padding: 12px 6px; }
  td { font-size: 1rem; }
  td small { font-size: .75rem; }
  thead th { font-size: .8rem; }
  .measure-table td { font-size: .95rem; }
  .times-table th, .times-table td { white-space: nowrap; }
  .subsection-title { margin-top: 40px; }
}

/* Measurement tables: fixed columns so both tables line up; units sit with the row label. */
.measure-table { table-layout: fixed; max-width: 760px; }
.measure-table th:first-child { width: 46%; }
.measure-table th small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.measure-table td, .measure-table thead th:not(:first-child) { text-align: center; }

/* Minimal-definitions videos: cards come in pairs (CEM-LJS, then a baseline on the same path and seed).
   Wide screens fill the three columns top to bottom, so each baseline sits under its CEM-LJS run;
   two- and one-column layouts keep the default row order, so each pair stays together. */
@media (min-width: 1001px) {
  .demo-grid.pairs-by-column { grid-auto-flow: column; grid-template-rows: repeat(2, auto); }
}

/* Section backgrounds: one per topic, alternating down the page (set on each section in index.html). */
.section.tone-soft { background: var(--soft); }
.section.tone-plain { background: #fff; }
/* The two assembly sections read as one topic. */
#assembly-comparison { padding-top: 24px; }

/* Closed-loop policy trained from one search rollout: the highlighted first section. */
:root { --red: #c8102e; --red-soft: #fdf2f3; }
.section.policy-highlight { background: var(--red-soft); border-top: 4px solid var(--red); border-bottom: 4px solid var(--red); }
.policy-highlight h2 { color: var(--red); text-wrap: balance; }
.new-tag { display: inline-block; margin-bottom: 14px; padding: 4px 14px; border-radius: 999px; background: var(--red); color: #fff; font-size: var(--support); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.policy-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; max-width: 1000px; margin: 0 auto 36px; }
.policy-stats div { padding: 18px 12px; border: 1px solid #f1c3c9; border-radius: var(--radius); background: #fff; text-align: center; }
.policy-stats strong { display: block; color: var(--red); font-size: 1.75rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.policy-stats span { display: block; margin-top: 6px; color: var(--muted); font-size: var(--support); }
.policy-video { max-width: 960px; margin: 0 auto; }
.policy-video video { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); background: #e8e8e8; }
.policy-video figcaption { margin-top: 14px; color: var(--muted); font-size: var(--support); text-align: center; }
.policy-note { margin-top: 24px; color: var(--red); font-weight: 600; text-align: center; }
.button.policy-button { background: var(--red); border-color: var(--red); color: #fff; }
.button.policy-button:hover { background: #a50d26; }
@media (max-width: 700px) { .policy-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .policy-stats strong { font-size: 1.4rem; } }
nav a.nav-policy { color: var(--red); font-weight: 600; }
.live-demo { max-width: 1100px; margin: 48px auto 0; padding: 28px; border: 1px solid #f1c3c9; border-radius: var(--radius); background: #fff; }
.live-head h3 { margin: 0 0 8px; color: var(--red); font-size: 1.5rem; }
.live-head p { max-width: 70ch; margin: 0 0 20px; color: var(--muted); }
.live-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.live-stage { position: relative; border-radius: var(--radius); overflow: hidden; background: #eef1f5; }
.live-stage canvas { display: block; width: 100%; aspect-ratio: 16 / 10; touch-action: none; }
.live-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(238, 241, 245, .85); color: var(--muted); font-size: var(--support); }
.live-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .08); }
.live-track div { width: 0; height: 100%; background: var(--red); transition: width .1s linear; }
.live-panel { display: flex; flex-direction: column; gap: 6px; }
.live-panel label { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: var(--support); font-weight: 600; }
.live-panel output { color: var(--red); font-variant-numeric: tabular-nums; font-weight: 600; }
.live-panel input[type=range] { width: 100%; accent-color: var(--red); }
.live-panel .button { width: 100%; margin-top: 8px; justify-content: center; }
.live-panel button:disabled, .live-panel input:disabled { opacity: .45; cursor: not-allowed; }
.live-speed { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: var(--support); }
.live-speed span { margin-right: auto; font-weight: 600; }
.live-speed button { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.live-speed button[aria-pressed=true] { border-color: var(--red); background: var(--red); color: #fff; }
.live-status { min-height: 3em; margin: 12px 0 0; font-size: var(--support); font-variant-numeric: tabular-nums; }
.live-status[data-state=standing] { color: #1a7f37; font-weight: 600; }
.live-status[data-state=fell], .live-status[data-state=notstanding] { color: var(--red); font-weight: 600; }
.live-note { margin: 16px 0 0; color: var(--muted); font-size: var(--support); text-align: center; }
.live-demo button:focus-visible, .live-demo input:focus-visible { outline: 3px solid rgba(200, 16, 46, .4); outline-offset: 2px; }
@media (max-width: 860px) { .live-body { grid-template-columns: 1fr; } .live-demo { padding: 18px; } }
.live-overlay[hidden] { display: none; }
.live-panel .button.ghost { background: #fff; border: 1px solid var(--red); color: var(--red); }
.live-panel .button.ghost:hover:not(:disabled) { background: var(--red-soft); }
