:root {
  --background: #fff;
  --ink: #172033;
  --muted: #606877;
  --line: #e5e7eb;
  --soft: #f8f9fa;
  --driver: #f7cac9;
  --responder: #faebcb;
  --max-width: 1080px;
  --radius: 10px;
  --font-size-min: 17px;
}

* { box-sizing: border-box; }
html { background: var(--background); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--background); font-size: var(--font-size-min); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid #586781; outline-offset: 5px; }
[hidden] { display: none !important; }
h1, h2, h3, p, figure { margin: 0; }
svg { display: block; }
.page { width: min(var(--max-width), calc(100% - 56px)); margin: 0 auto; }
.skip-link { position: fixed; z-index: 10; left: 16px; top: 16px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 6px; background: white; transform: translateY(-180%); }
.skip-link:focus { transform: none; }

.project-header { padding: 40px 0 24px; text-align: center; }
h1 { font-size: 56px; line-height: 1.1; font-weight: 760; letter-spacing: -.045em; }
.title-dot { color: #c89198; }
.project-subtitle { margin-top: 13px; font-size: clamp(21px, 2.35vw, 27px); font-weight: 500; line-height: 1.35; letter-spacing: -.025em; }
.project-authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin-top: 20px; font-size: 17px; line-height: 1.6; }
.project-authors a { position: relative; color: #434c5c; }
.author-name { display: inline-block; }
.project-authors sup { position: absolute; left: 100%; top: -.25em; margin-left: 2px; font-size: var(--font-size-min); line-height: 1; }
.project-affiliation { margin-top: 7px; color: var(--muted); font-size: var(--font-size-min); line-height: 1.6; }
.project-affiliation > span:first-child { margin: 0 5px; }
.resource-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 20px; }
.resource-link { min-height: 44px; display: inline-flex; gap: 7px; align-items: center; justify-content: center; padding: 8px 15px; border: 1px solid #dfe2e7; border-radius: 24px; background: white; font-size: var(--font-size-min); font-weight: 550; line-height: 1.25; }
.resource-link:disabled { color: #717783; background: #fafafa; }
.resource-link svg, .copy-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.resource-note { font-size: var(--font-size-min); font-weight: 400; color: var(--muted); }
.resource-icon { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; }
.resource-link .resource-icon svg { width: 20px; height: 20px; }
.resource-label, .resource-note { display: block; line-height: 1.25; }
.resource-link .arxiv-icon svg { fill: currentColor; stroke: none; }
.resource-link.is-available { color: var(--ink); border-color: #cfd4dd; }
.resource-link.is-available:hover { background: #f5f6f8; text-decoration: none; }

.teaser-section { scroll-margin-top: 24px; }
.teaser { max-width: 800px; margin: 0 auto; }
.video-frame { position: relative; overflow: hidden; border-radius: var(--radius); background: #f2f3f4; }
.teaser-frame { background: #f6f6f5; }
.result-video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; }
.teaser .result-video { aspect-ratio: 16 / 9; }
.media-error { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.96); color: var(--ink); font-size: var(--font-size-min); }
.teaser-caption { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: var(--font-size-min); padding: 10px 2px; }
.role-legend { display: flex; flex-wrap: wrap; gap: 18px; }
.role-legend > span, .role-label { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(23,32,51,.14); }
.legend-dot.human { background: #eeebf2; }
.legend-dot.driver { background: var(--driver); }
.legend-dot.responder { background: var(--responder); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 32px; padding: 5px 7px; border: 0; border-radius: 5px; background: none; color: var(--muted); font-size: var(--font-size-min); white-space: nowrap; }
.text-button:hover { color: var(--ink); background: var(--soft); }
.motion-icon { font-size: var(--font-size-min); font-weight: 700; }
.takeaway { padding: 26px 0 0; text-align: center; }
.takeaway > p:first-child { font-size: clamp(19px, 2.1vw, 25px); font-weight: 600; letter-spacing: -.025em; line-height: 1.5; }
.takeaway > p:first-child span { color: #606877; }
.takeaway-detail { max-width: none; margin: 9px auto 0; color: var(--muted); font-size: var(--font-size-min); line-height: 1.65; }
.mobile-break { display: none; }
.section-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 13px; padding: 15px 0 24px; font-size: var(--font-size-min); color: var(--muted); }
.section-links > span { color: #d5d8df; }

.section { padding-top: 88px; scroll-margin-top: 26px; }
.section-heading { text-align: center; margin-bottom: 36px; }
.eyebrow { margin-bottom: 12px; font-size: var(--font-size-min); color: var(--muted); font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
h2 { font-size: clamp(25px, 3vw, 31px); line-height: 1.2; font-weight: 650; letter-spacing: -.03em; }
.section-heading > p:last-child:not(.eyebrow) { margin: 13px auto 0; max-width: 680px; color: var(--muted); font-size: var(--font-size-min); line-height: 1.65; }
.role-label { margin-bottom: 13px; font-size: var(--font-size-min); font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; line-height: 1.4; letter-spacing: -.015em; }
.section-note { margin-top: 16px; color: var(--muted); font-size: var(--font-size-min); line-height: 1.6; }
#roles > .section-note, #editing > .section-note { text-align: center; }

.method-figure { padding: 18px 0 0; }
.method-figure img { display: block; width: 100%; height: auto; }
.method-figure figcaption { margin: 18px auto 0; text-align: center; color: var(--muted); font-size: var(--font-size-min); line-height: 1.6; }
.method-process { margin-top: 37px; }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.method-step { padding-top: 20px; border-top: 1px solid var(--line); }
.stage-number { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: var(--font-size-min); line-height: 1.4; min-height: 32px; margin-bottom: 12px; }
.stage-number > span { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; border: 1px solid #e4e5e9; border-radius: 4px; padding: 3px 7px; background: #fafafa; font-size: var(--font-size-min); }
.stage-number > .simulated-label { background: #fffbf3; border-color: #eee3ca; }
.method-step > p:not(.stage-number):not(.stage-flow) { margin-top: 10px; font-size: var(--font-size-min); line-height: 1.75; color: var(--muted); }
.stage-flow { margin-top: 17px; color: #434c5c; font-size: var(--font-size-min); line-height: 1.7; }
.stage-flow span { padding: 0 5px; color: #9097a3; }

.text-section { width: 100%; margin: 0 auto; }
.text-section .section-heading { margin-bottom: 24px; }
.abstract-text { font-size: var(--font-size-min); line-height: 1.75; color: #525b6b; }
.citation-section { max-width: 800px; margin: 0 auto; padding-top: 60px; }
.citation-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.citation-heading h2 { font-size: 25px; }
.citation-code { margin: 18px 0 0; padding: 18px 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: #434c5c; font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; white-space: pre; }
.citation-code code { font: inherit; }
.copy-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: white; color: #525b6b; font-size: var(--font-size-min); }
.copy-button:hover { background: var(--soft); }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 26px 0 31px; margin-top: 65px; border-top: 1px solid var(--line); font-size: var(--font-size-min); color: var(--muted); }
.footer > span > span { padding: 0 5px; }

/* Real media stays mounted. Switching reveals an already decoded frame. */
.video-deck { aspect-ratio: 4 / 3; }
.video-layer { position: absolute; inset: 0; opacity: 0; visibility: hidden; pointer-events: none; }
.video-layer.is-active { opacity: 1; visibility: visible; pointer-events: auto; }
.video-layer .result-video { height: 100%; }
.media-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.demo-caption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; font-size: var(--font-size-min); color: var(--muted); }
.selection-status { min-height: 21px; color: var(--muted); font-size: var(--font-size-min); line-height: 1.6; text-align: center; margin-top: 7px; }
.role-movie { min-width: 0; width: 100%; }
.role-stage { position: relative; aspect-ratio: 27 / 13; overflow: hidden; border-radius: var(--radius); }
.role-scene { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; background: transparent; }
.role-scene .result-video { width: 100%; height: 100%; object-fit: contain; aspect-ratio: 27 / 13; }
.role-labels { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.show-callouts .role-labels { opacity: 1; }
.role-callout { position: absolute; color: #fff; line-height: 1.35; width: max-content; max-width: 26%; }
.role-human { left: 11%; top: 17%; }
.role-driver { left: auto; right: 11%; top: 50%; }
.role-responder { left: auto; right: 11%; top: 17%; }
.role-callout strong { display: block; font-size: 18px; font-weight: 650; }
.role-callout > span { display: block; margin-top: 3px; font-size: var(--font-size-min); }
.role-callout small { display: block; margin-top: 3px; font-size: var(--font-size-min); color: #fff; }
.method-step { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 18px; }
.method-stage { display: flex; min-width: 0; flex-direction: column; }
.method-stage .method-step { flex: 1; }
.method-step > strong { display: block; font-size: 17px; font-weight: 600; }
.stage-description { display: block; margin-top: 10px; font-size: var(--font-size-min); color: var(--muted); line-height: 1.65; }
.process-player { margin-top: 14px; }
.process-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.dataset-actions { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: center; margin-bottom: 17px; }
.dataset-actions .role-legend { font-size: var(--font-size-min); color: var(--muted); }
.sample-selector { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 21px; }
.sample-button { display: flex; align-items: center; gap: 13px; min-width: 245px; padding: 10px 17px 10px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; text-align: left; }
.sample-button img { display: block; width: 72px; height: 54px; border-radius: 5px; object-fit: contain; }
.sample-button strong { display: block; font-size: var(--font-size-min); font-weight: 600; }
.sample-button small { display: block; margin-top: 6px; font-size: var(--font-size-min); color: var(--muted); }
.sample-button.is-active { border-color: #9fa8b7; background: #fafbfc; }
.editing-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }
.section-links { margin-top: 15px; padding-bottom: 0; }
#abstract { padding-top: 55px; }

@media (min-width: 681px) and (max-height: 820px) {
  .project-header { padding-top: 25px; padding-bottom: 20px; }
  .teaser { max-width: 680px; }
  .takeaway { padding-top: 20px; }
}
@media (max-width: 900px) and (min-width: 681px) {
  .method-grid { gap: 20px; }
}
@media (max-width: 680px) {
  .page { width: calc(100% - 36px); }
  .project-header { padding-top: 34px; padding-bottom: 25px; }
  h1 { font-size: 47px; }
  .project-subtitle { font-size: 21px; }
  .resource-links { gap: 7px; }
  .resource-link { padding: 7px 12px; font-size: var(--font-size-min); }
  .resource-note { font-size: var(--font-size-min); }
  .teaser-caption { font-size: var(--font-size-min); gap: 5px; }
  .role-legend { gap: 10px; }
  .role-legend > span { gap: 5px; }
  .legend-dot { width: 7px; height: 7px; }
  .text-button { font-size: var(--font-size-min); }
  .takeaway { padding: 21px 0 0; }
  .takeaway > p:first-child { font-size: 21px; }
  .takeaway-detail { font-size: var(--font-size-min); }
  .mobile-break { display: initial; }
  .desktop-break { display: none; }
  .section-links { gap: 8px 10px; font-size: var(--font-size-min); }
  .section { padding-top: 65px; }
  .section-heading { margin-bottom: 27px; }
  .section-heading > p:last-child:not(.eyebrow) { font-size: var(--font-size-min); }
  .role-grid, .method-grid { grid-template-columns: 1fr; }
  .method-figure { padding-top: 0; }
  .method-process { margin-top: 29px; }
  .method-grid { gap: 23px; }
  .abstract-text { font-size: var(--font-size-min); line-height: 1.8; }
  .citation-section { padding-top: 43px; }
  .footer { margin-top: 45px; font-size: var(--font-size-min); }
  .role-callout small { display: none; }
  .role-callout { max-width: 35%; line-height: 1.1; }
  .role-callout strong { font-size: 17px; }
  .role-human { left: 3%; }
  .role-driver, .role-responder { left: auto; right: 3%; }
  .role-responder { top: 4%; }
  .role-driver { top: 52%; }
  .role-movie .demo-caption { flex-wrap: wrap; }
  .method-step { padding: 17px; }
  .method-grid { gap: 12px; }
  .sample-selector { gap: 9px; }
  .sample-button { flex: 1 1 100%; min-width: 0; }
  .media-actions { gap: 4px; }
  .teaser-caption { flex-wrap: wrap; }
  #abstract { padding-top: 42px; }
}
@media (max-width: 360px) {
  .page { width: calc(100% - 28px); }
  .project-subtitle { font-size: 19px; }
  .resource-link { padding: 7px 10px; }
  .role-legend { gap: 7px; font-size: var(--font-size-min); }
  .teaser-caption .text-button { padding-left: 3px; padding-right: 3px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Spatial labels reuse the supplement's actual upright-phase scene anchors. */
.role-callouts { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.show-callouts .role-callouts { opacity: 1; }
.role-callouts g { color: #fff; }
.role-callouts path { fill: none; stroke: currentColor; stroke-width: 2; }
.role-callouts circle { fill: currentColor; }
.role-callouts [data-callout="driver"] { color: #f7cac9; }
.role-callouts [data-callout="responder"] { color: #faebcb; }
.gallery-heading { margin: 0 0 16px; color: var(--muted); font-size: var(--font-size-min); }
.edit-gallery { display: grid; gap: 12px; align-items: start; }
.pan-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pan-gallery .original-card { grid-column: 1; grid-row: 1 / span 2; }
.tennis-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.edit-card { min-width: 0; }
.edit-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px; margin-bottom: 9px; font-size: var(--font-size-min); color: var(--ink); }
.edit-card figcaption strong, .clip-goal > span { font-size: var(--font-size-min); font-weight: 600; line-height: normal; letter-spacing: normal; text-transform: none; }
.edit-card figcaption > span { font-size: var(--font-size-min); color: #886168; }
.original-card figcaption > span { color: var(--muted); }
.clip-goal { margin-top: 11px; color: #525b6b; font-size: var(--font-size-min); line-height: 1.6; }
.clip-goal > span { display: block; margin-bottom: 4px; color: var(--muted); }
@media (max-width: 680px) {
  .edit-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .pan-gallery .original-card { grid-column: auto; grid-row: auto; }
  .edit-card figcaption { font-size: var(--font-size-min); }
  .clip-goal { font-size: var(--font-size-min); }
}
@media (max-width: 480px) { .edit-gallery { grid-template-columns: 1fr; gap: 24px; } }

.result-video::-webkit-media-controls { display: none !important; }

.teaser-frame.video-deck { aspect-ratio: 16 / 9; }
.teaser-navigation { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 3px; }
.teaser-navigation p { display: grid; gap: 4px; min-width: 150px; text-align: center; }
.teaser-navigation strong { color: var(--ink); font-size: var(--font-size-min); font-weight: 550; }
.teaser-navigation p > span { color: var(--muted); font-size: var(--font-size-min); letter-spacing: .06em; }
.teaser-arrow { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); font-size: 18px; }
.teaser-arrow:hover { background: var(--soft); }
