:root {
  --ink: #1f2933;
  --ink-2: #3e4a56;
  --muted: #5f6b76;
  --accent: #1d4f91;
  --accent-dark: #163d70;
  --accent-soft: #e9eff8;
  --accent-track: #d4dff0;
  --line: #e3e7eb;
  --soft: #f6f8fa;
  --paper: #ffffff;
  --yes: #247d52;
  --no: #b83e3e;
  --fam-c: #7c5cc4;
  --fam-r: #b9770e;
  --fam-u: #2f6fb5;
  --fam-x: #1f8a5a;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --page-width: 1080px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 17px/1.65 var(--font); }
a { color: var(--accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 30px; margin: 0 0 16px; }
h3 { font-size: 19px; margin: 0 0 8px; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.container { width: min(var(--page-width), calc(100% - 32px)); margin-inline: auto; }
.narrow { max-width: 880px; }
.nowrap { white-space: nowrap; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 8px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.skip-link:focus { top: 12px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.96); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(6px); }
.nav-inner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
.brand img { width: auto; height: 34px; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { color: var(--muted); font-size: 15px; font-weight: 500; text-decoration: none; }
.nav-links a:hover, .nav-links a.is-current { color: var(--accent); }

/* Hero */
.hero { padding: 48px 0 12px; text-align: center; }
.hero h1 { margin: 0 auto 26px; max-width: 900px; font-size: clamp(24px, 3vw, 34px); font-weight: 600; color: var(--ink-2); }
.hero-logo { width: min(260px, 58vw); height: auto; margin: 0 auto 18px; }
.authors { max-width: 940px; margin: 0 auto 6px; font-size: 17px; line-height: 1.8; }
.author { display: inline-block; white-space: nowrap; margin: 0 7px; }
.author sup, .affiliation sup, .author-notes sup { font-size: 11px; color: var(--muted); margin-left: 1px; }
.affiliations { margin: 0 auto 4px; color: var(--ink-2); font-size: 16px; }
.affiliation { display: inline-block; margin: 0 10px; }
.affiliation sup { margin-right: 2px; }
.author-notes { margin: 0 auto; color: var(--muted); font-size: 14px; }
.author-notes span { display: inline-block; margin: 0 8px; }

.resources { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 24px auto 0; }
.resource { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; transition: background 0.15s; }
.resource:hover { background: var(--accent); }
.resource svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.resource small { font-size: 12px; font-weight: 500; opacity: 0.85; }
.resource.is-soon { background: var(--soft); color: var(--muted); border: 1px solid var(--line); cursor: default; }

/* Teaser */
.teaser { padding: 28px 0 8px; }
.tldr { max-width: 880px; margin: 26px auto 0; padding: 16px 20px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.tldr b { margin-right: 6px; color: var(--accent-dark); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; max-width: 980px; margin: 28px auto 0; }
.stat { padding: 14px 12px; border: 1px solid var(--line); border-radius: 10px; text-align: center; display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat dd { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; }
.stat dt { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.35; }

/* Sections */
.section { padding: 64px 0; }
.section.soft { background: var(--soft); }
.lede { max-width: 880px; color: var(--ink-2); }
.note { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* Figures */
.fig { margin: 0; }
.fig img { width: 100%; border-radius: 6px; background: #fff; }
.fig figcaption { margin-top: 12px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.fig figcaption strong, .fig figcaption b { color: var(--ink-2); }
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.section .fig img, .teaser .fig img { box-shadow: 0 0 0 1px var(--line); }

.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.split-text h3 { margin-top: 22px; color: var(--accent-dark); }
.split-fig { max-width: 470px; justify-self: center; }

/* Task families */
.families { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 26px 0 44px; }
.family { padding: 18px 18px 16px; border: 1px solid var(--line); border-top: 3px solid var(--fam); border-radius: 10px; background: var(--paper); }
.family header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.family h3 { margin: 0; font-size: 18px; }
.fam-letter { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--fam); color: #fff; font-weight: 700; font-size: 15px; align-self: center; }
.fam-count { width: 100%; font-size: 13.5px; color: var(--muted); }
.family p { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }

.compare { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.compare h3 { margin-bottom: 14px; }
.compare-fig { max-width: 430px; justify-self: center; }
.compare-fig img { box-shadow: none !important; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cmp { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.cmp th, .cmp td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.cmp thead th { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.3; vertical-align: bottom; }
.cmp thead tr:first-child th { color: var(--ink-2); border-bottom: 1px solid var(--line); }
.cmp tbody th { text-align: left; font-weight: 500; white-space: nowrap; }
.cmp td { font-size: 17px; line-height: 1; }
.cmp td.y { color: var(--yes); }
.cmp td.n { color: var(--no); opacity: 0.75; }
.cmp tr.ours { background: var(--accent-soft); }
.cmp tr.ours th { font-weight: 700; color: var(--accent-dark); }

/* Construction */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.fact { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.fact h3 { font-size: 17px; }
.fact p { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }

/* Leaderboard */
.lb-tabs { display: flex; gap: 2px; margin-top: 26px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.lb-tabs::-webkit-scrollbar { display: none; }
.lb-tabs button { display: inline-flex; flex: none; align-items: center; gap: 7px; min-height: 44px; margin-bottom: -1px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap; }
.lb-tabs button:hover { color: var(--ink); }
.lb-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.lb-tabs button[data-view="1"][aria-selected="true"] { border-bottom-color: var(--fam-c); }
.lb-tabs button[data-view="2"][aria-selected="true"] { border-bottom-color: var(--fam-r); }
.lb-tabs button[data-view="3"][aria-selected="true"] { border-bottom-color: var(--fam-u); }
.lb-tabs button[data-view="4"][aria-selected="true"] { border-bottom-color: var(--fam-x); }
.lb-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 16px 0 12px; }
.lb-desc { margin: 0; max-width: 640px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.lb-desc b { color: var(--ink); }
.seg { display: inline-flex; flex: none; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); }
.seg button { min-height: 36px; padding: 6px 14px; white-space: nowrap; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 14.5px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }

.lb { --bar: var(--accent); --bar-track: var(--accent-track); width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.lb[data-view="0"] { min-width: 760px; }
.lb[data-view="1"] { --bar: var(--fam-c); --bar-track: #e5def3; }
.lb[data-view="2"] { --bar: var(--fam-r); --bar-track: #f1e4cf; }
.lb[data-view="3"] { --bar: var(--fam-u); --bar-track: #d5e2f0; }
.lb[data-view="4"] { --bar: var(--fam-x); --bar-track: #d2e8de; }
.lb th, .lb td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.lb thead th { border-bottom: 1px solid #cfd6dd; font-size: 13.5px; font-weight: 600; color: var(--ink-2); vertical-align: bottom; }
.lb thead th button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; background: none; font-weight: 600; color: inherit; }
.lb thead th button::after { content: "↕"; font-size: 11px; color: #a3adb7; }
.lb thead th[aria-sort="descending"] button::after { content: "↓"; color: var(--accent); }
.lb thead th[aria-sort="ascending"] button::after { content: "↑"; color: var(--accent); }
.lb thead th[aria-sort] button { color: var(--accent); }
.lb .unit { margin-left: 4px; font-weight: 500; color: var(--muted); }
.lb .lbl-short { display: none; }
.lb .c-rank { width: 36px; text-align: center; color: var(--muted); }
.lb td.c-rank { font-size: 14px; }
.lb .c-model { text-align: left; }
.lb td.c-model { font-weight: 500; }
.model { display: inline-flex; align-items: center; gap: 9px; }
.model img { width: 18px; height: 18px; object-fit: contain; flex: none; }
.tag { margin-left: 8px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.lb .c-main { min-width: 176px; }
.overall { display: inline-flex; align-items: center; gap: 10px; }
.bar { position: relative; display: inline-block; width: 96px; height: 6px; border-radius: 3px; background: var(--bar-track); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--bar); }
.lb td.best { font-weight: 700; color: var(--ink); }
.lb td.dim { color: var(--ink-2); }
.lb tbody tr:hover { background: var(--soft); }
.fam-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--fam); }

/* Analysis */
.finding { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; padding: 26px 0; }
.finding + .finding { border-top: 1px solid var(--line); }
.finding.reverse .finding-text { order: 2; }
.finding .fig { max-width: 540px; justify-self: center; width: 100%; }
.finding .fig-small { max-width: 420px; }
.finding-text p { color: var(--ink-2); }
.finding-wide { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.finding-wide .finding-text { max-width: 880px; }
.finding-wide .fig { max-width: 1000px; }

/* Citation */
.cite-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cite-head h2 { margin: 0; }
.cite-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.copy { min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 14px; font-weight: 500; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.bibtex { margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); font: 13.5px/1.6 var(--mono); }

/* Footer */
.site-footer { padding: 28px 0 36px; border-top: 1px solid var(--line); text-align: center; font-size: 14px; color: var(--muted); }
.site-footer p { margin: 0; }

/* Lightbox */
.lightbox { width: min(96vw, 1600px); max-height: 94vh; padding: 0; border: 0; border-radius: 10px; background: #fff; }
.lightbox::backdrop { background: rgba(15, 23, 42, 0.72); }
.lightbox img { width: 100%; height: auto; max-height: 94vh; object-fit: contain; }
.lightbox form { position: absolute; top: 8px; right: 8px; }
.lightbox-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(15, 23, 42, 0.7); color: #fff; font-size: 24px; line-height: 1; }

@media (max-width: 900px) {
  .nav-links { gap: 16px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .families { grid-template-columns: repeat(2, 1fr); }
  .split, .compare, .finding { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .finding.reverse .finding-text { order: 0; }
  .facts { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  h2 { font-size: 25px; }
  .nav-links { display: none; }
  .hero { padding-top: 32px; }
  .author { margin: 0 5px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:last-child { grid-column: 1 / -1; }
  .families { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
  .lb-controls { flex-direction: column; align-items: flex-start; }
  .lb-tabs button { padding: 8px 11px; font-size: 14px; }
  .tldr { padding: 14px 16px; }
  .resource { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .lb, .lb[data-view="0"] { min-width: 0; font-size: 14px; }
  .lb th, .lb td { padding: 8px 6px; }
  .lb .lbl-long { display: none; }
  .lb .lbl-short { display: inline; }
  .lb thead th:not([aria-sort]) button::after { content: none; }
  .lb .c-context { display: none; }
  .lb .unit { display: none; }
  .lb .c-rank, .lb .bar, .lb .tag { display: none; }
  .lb .c-main { min-width: 0; }
  .lb .c-model { position: sticky; left: 0; z-index: 1; background: var(--paper); box-shadow: 1px 0 0 var(--line); }
  .lb tbody tr:hover .c-model { background: var(--soft); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
