/* =========================================================================
   AgentWebBench — project page styles
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  --bg:            #f7f8fc;
  --bg-alt:        #eef1f8;
  --surface:       #ffffff;
  --surface-2:     #f4f6fb;
  --ink:           #14182b;
  --ink-soft:      #424a63;
  --ink-faint:     #565d78; /* AA (≥4.5:1) on white & --surface-2 for caption/note text */
  --line:          #e2e6f0;
  --line-strong:   #cfd5e6;

  --brand:         #4f46e5;
  --brand-2:       #6366f1;
  --brand-ink:     #4338ca;
  --accent:        #f59e0b;
  --accent-soft:   #fde9c4;
  --good:          #10b981;
  --bad:           #ef4444;

  --brand-rgb:     79, 70, 229;
  --accent-rgb:    245, 158, 11;

  --best-bg:       rgba(var(--brand-rgb), .14);
  --best-bar:      var(--brand);
  --second-bg:     rgba(var(--accent-rgb), .16);

  --shadow-sm:     0 1px 2px rgba(20, 24, 43, .06);
  --shadow:        0 6px 24px rgba(20, 24, 43, .08);
  --shadow-lg:     0 24px 60px rgba(20, 24, 43, .14);

  --radius:        16px;
  --radius-sm:     10px;
  --maxw:          1180px;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg:            #0b0e1a;
  --bg-alt:        #0f1426;
  --surface:       #141a2e;
  --surface-2:     #1a2138;
  --ink:           #eef1fb;
  --ink-soft:      #b9c0d6;
  --ink-faint:     #99a2c2; /* lifted for AA contrast on dark surfaces */
  --line:          #242c46;
  --line-strong:   #313a5c;

  --brand:         #818cf8;
  --brand-2:       #a5b4fc;
  --brand-ink:     #c7d2fe;
  --accent:        #fbbf24;
  --accent-soft:   #3a2e12;

  --brand-rgb:     129, 140, 248;
  --accent-rgb:    251, 191, 36;

  --best-bg:       rgba(var(--brand-rgb), .18);
  --second-bg:     rgba(var(--accent-rgb), .15);

  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --shadow:        0 8px 30px rgba(0,0,0,.45);
  --shadow-lg:     0 28px 70px rgba(0,0,0,.6);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  overflow-x: hidden; /* safety net against any horizontal overflow */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s ease, color .4s ease;
}

/* Visible keyboard focus for all interactive controls (WCAG 2.4.7) */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
sub, sup { line-height: 0; }
code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: .1em .4em;
  border-radius: 6px;
  color: var(--brand-ink);
}
::selection { background: rgba(var(--brand-rgb), .25); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: 820px; }

.section { padding: 92px 0; position: relative; }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 760px; margin-bottom: 48px; }
.section__head--wide { max-width: none; }
.overview__more { margin-top: 40px; font-size: 1.02rem; color: var(--ink-soft); }
.overview__more a { font-weight: 600; white-space: nowrap; }

/* First section on a sub-page sits a little lower, clear of the sticky nav */
.section--first { padding-top: 116px; }
.pagenav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.pagenav a { font-weight: 600; font-size: 1rem; padding: .7em 1.2em; border: 1px solid var(--line-strong); border-radius: 100px; background: var(--surface); transition: border-color .2s, transform .2s, color .2s; }
.pagenav a:hover { border-color: var(--brand); color: var(--brand-ink); transform: translateY(-2px); text-decoration: none; }
.pagenav a.is-empty { visibility: hidden; }
/* Keep these headings on a single line on desktop, where there is room */
@media (min-width: 980px) { .nowrap-lg { white-space: nowrap; } }
.section__head h2 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin: .35rem 0 .7rem;
}
.section__sub { color: var(--ink-soft); font-size: 1.06rem; margin: 0; }

/* Intro row with a paragraph on the left and a CTA on the right (leaderboard) */
.lb-intro { display: flex; gap: 32px; align-items: center; justify-content: space-between; }
.lb-intro .section__sub { flex: 1; }
.lb-intro__cta { flex: none; }
.lb-intro__cta svg { transition: transform .2s ease; }
.lb-intro__cta:hover svg { transform: translateX(3px); }
@media (max-width: 760px) { .lb-intro { flex-direction: column; align-items: flex-start; gap: 18px; } }

.eyebrow {
  display: inline-block;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand);
  padding: .3em .7em;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-radius: 100px;
  background: rgba(var(--brand-rgb), .07);
}
.subhead {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -.01em;
  margin: 64px 0 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--sans);
  font-weight: 600; font-size: .96rem;
  padding: .72em 1.25em;
  border-radius: 100px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: .5em .9em; font-size: .85rem; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(var(--brand-rgb), .35); }
.btn--primary:hover { background: var(--brand-2); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(var(--brand-rgb), .42); }
.btn--dark { background: var(--ink); color: var(--bg); }
.btn--dark:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-ink); transform: translateY(-2px); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease, box-shadow .3s;
}
.nav.is-scrolled { border-color: var(--line); box-shadow: var(--shadow-sm); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
}
.nav__brand { display: flex; align-items: center; gap: .55em; color: var(--ink); text-decoration: none !important; }
.nav__logo { color: var(--brand); display: grid; place-items: center; }
.logo-hub { fill: var(--brand); }
.logo-node { fill: var(--accent); }
.nav__name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -.02em; }
.nav__name b { color: var(--brand); font-weight: 800; }
.nav__links { display: flex; gap: 4px; margin-left: 14px; }
.nav__links a {
  color: var(--ink-soft); font-weight: 500; font-size: .94rem;
  padding: .45em .8em; border-radius: 8px; text-decoration: none !important;
  transition: color .15s, background .15s;
}
.nav__links a:hover { color: var(--ink); background: var(--surface-2); }
.nav__links a.active { color: var(--brand-ink); background: rgba(var(--brand-rgb), .1); }
.nav__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); transform: rotate(-12deg); }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

.nav__burger { display: none; flex-direction: column; gap: 4px; width: 38px; height: 38px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; cursor: pointer; align-items: center; justify-content: center; }
.nav__burger span { width: 17px; height: 2px; background: var(--ink); border-radius: 2px; transition: .25s; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(70px, 12vw, 130px) 0 96px;
  text-align: center;
  background:
    radial-gradient(1200px 500px at 50% -8%, rgba(var(--brand-rgb), .14), transparent 60%),
    radial-gradient(900px 420px at 85% 12%, rgba(var(--accent-rgb), .1), transparent 55%);
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .78; }
.hero__glow { position: absolute; left: 50%; top: -120px; width: 620px; height: 620px; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(var(--brand-rgb), .22), transparent 65%); filter: blur(20px); pointer-events: none; }
.hero__inner { position: relative; z-index: 2; max-width: 920px; margin: 0 auto; padding: 0 24px; }

.hero__venue {
  display: inline-flex; align-items: center; gap: .55em;
  font-size: .82rem; font-weight: 600; letter-spacing: .03em;
  color: var(--brand-ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  padding: .45em 1em; border-radius: 100px; box-shadow: var(--shadow-sm);
  text-decoration: none !important; margin-bottom: 26px;
}
.hero__venue .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .2); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0); } }
/* On narrow screens the venue label wraps; make it a tidy rounded tag with the dot on the first line */
@media (max-width: 640px) {
  .hero__venue { align-items: flex-start; border-radius: 16px; line-height: 1.5; padding: .5em .95em; font-size: .78rem; }
  .hero__venue .dot { margin-top: .42em; }
}
/* Keep the nav on one row on phones now that Paper + Code both live in the actions */
@media (max-width: 560px) {
  .nav__inner { gap: 8px; padding-left: 14px; padding-right: 14px; }
  .nav__name { font-size: 1rem; }
  .nav__actions { gap: 6px; }
  .nav__actions .btn--sm { padding: .45em .6em; }
  .theme-toggle, .nav__burger { width: 36px; height: 36px; }
}

.hero__title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.05rem, 9.6vw, 5.6rem);
  line-height: .98; letter-spacing: -.035em;
  margin: 0 0 .15em;
  background: linear-gradient(135deg, var(--ink) 30%, var(--brand) 120%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero__tagline { font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 3vw, 1.7rem); letter-spacing: -.015em; margin: 0 0 1.1rem; color: var(--ink); }
.grad { background: linear-gradient(100deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero__lead { max-width: 700px; margin: 0 auto 2rem; color: var(--ink-soft); font-size: 1.08rem; }
.hero__lead b { color: var(--ink); font-weight: 600; }

.hero__authors { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .2em 1.4em; padding: 0; margin: 0 0 .4rem; font-size: 1.06rem; font-weight: 600; }
.hero__authors a { color: var(--brand-ink); }
.hero__authors sup { color: var(--ink-faint); font-weight: 500; }
.hero__affil { color: var(--ink-soft); font-size: 1.05rem; margin: 0 0 2rem; }
.hero__affil sup { color: var(--brand); font-weight: 700; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 3.2rem; }

.hero__stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  max-width: 680px; margin: 0 auto; padding: 0;
}
.hero__stats > div {
  flex: 0 1 150px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 8px; box-shadow: var(--shadow-sm);
}
.hero__stats dt { font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 3vw, 2rem); color: var(--brand); letter-spacing: -.02em; }
.hero__stats dd { margin: 2px 0 0; font-size: .8rem; color: var(--ink-faint); font-weight: 500; }

.hero__scroll { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); width: 26px; height: 42px; border: 2px solid var(--line-strong); border-radius: 14px; z-index: 2; }
.hero__scroll span { position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px; background: var(--brand); border-radius: 4px; animation: scrolldot 1.8s ease-in-out infinite; }
@keyframes scrolldot { 0%,100% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 80% { opacity: 0; transform: translateY(12px); } }

/* ---------- Abstract ---------- */
.abstract {
  font-size: 1.12rem; line-height: 1.85; color: var(--ink-soft); margin: 1.4rem 0 0;
  padding-left: 24px; border-left: 3px solid var(--brand);
}
.abstract b { color: var(--ink); font-weight: 600; }
.abstract__links { margin-top: 1.4rem; padding-left: 24px; }
.abstract__links a { font-weight: 600; }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 22px; }
.cards--2 { grid-template-columns: repeat(2, 1fr); }
.cards--3 { grid-template-columns: repeat(3, 1fr); margin-top: 44px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow-sm); transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card h3 { font-family: var(--display); font-size: 1.18rem; margin: .2rem 0 .5rem; letter-spacing: -.01em; }
.card p { color: var(--ink-soft); margin: 0; font-size: .98rem; }

.card--contrib { position: relative; padding-top: 30px; }
.card--contrib .card__num { font-family: var(--display); font-weight: 800; font-size: 2.4rem; color: rgba(var(--brand-rgb), .22); line-height: 1; }
.card--contrib h3 { margin-top: .35rem; }

.card__icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; color: #fff; }
.card__icon--user { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.card__icon--content { background: linear-gradient(135deg, var(--accent), #f97316); }
.pill { font-size: .72rem; font-weight: 700; vertical-align: middle; background: var(--accent-soft); color: #b45309; padding: .2em .6em; border-radius: 100px; margin-left: .4em; }
html[data-theme="dark"] .pill { color: var(--accent); }

/* ---------- Figures ---------- */
.figure { margin: 0; }
.figure img { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.figure figcaption { color: var(--ink-faint); font-size: .9rem; margin-top: 14px; line-height: 1.55; }
.figure--hero { margin: 44px 0 12px; }
.figure--hero img { padding: 18px; }

/* ---------- Strategy comparison ---------- */
.strategy { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.strategy__col {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s;
}
.strategy__col:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.strategy__col--hl { border-color: var(--brand); box-shadow: 0 10px 30px rgba(var(--brand-rgb), .18); }
.strategy__badge { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 12px; }
.strategy__badge--base { color: var(--accent); }
.strategy__badge--star { color: var(--brand); }
.strategy__col h4 { font-family: var(--display); font-size: 1.25rem; margin: 0 0 .5rem; }
.strategy__col p { font-size: .92rem; color: var(--ink-soft); margin: 0 0 16px; min-height: 76px; }
.strategy__feats { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.strategy__feats li { font-size: .85rem; padding: .55em 0 .55em 26px; position: relative; color: var(--ink-faint); border-bottom: 1px solid var(--line); }
.strategy__feats li::before { content: "—"; position: absolute; left: 4px; color: var(--ink-faint); }
.strategy__feats li[data-on] { color: var(--ink); font-weight: 500; }
.strategy__feats li[data-on]::before { content: "✓"; color: var(--good); font-weight: 700; }
.strategy__feats li.off::before { content: "✕"; color: var(--bad); opacity: .55; }
.strategy__feats li:last-child { border-bottom: none; }

/* ---------- Task cards ---------- */
.tasks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.taskcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s, border-color .25s;
  position: relative; overflow: hidden;
}
.taskcard::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--brand), var(--accent)); opacity: 0; transition: opacity .25s; }
.taskcard:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.taskcard:hover::after { opacity: 1; }
.taskcard__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--brand-rgb), .1); color: var(--brand); margin-bottom: 14px; }
.taskcard h4 { font-family: var(--display); font-size: 1.1rem; margin: 0 0 .35rem; }
.taskcard p { font-size: .88rem; color: var(--ink-soft); margin: 0 0 16px; }
.taskcard__meta { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.taskcard__row { display: flex; justify-content: space-between; font-size: .82rem; }
.taskcard__row span:first-child { color: var(--ink-faint); }
.taskcard__row span:last-child { font-weight: 600; color: var(--ink); font-family: var(--mono); }
.taskcard__metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.taskcard__metrics b { font-size: .72rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); padding: .22em .55em; border-radius: 6px; }

/* ---------- Leaderboard ---------- */
.lb { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lb__tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.lb__tab {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--sans); font-weight: 600; font-size: .9rem;
  color: var(--ink-soft); background: transparent; border: 1px solid transparent;
  padding: .55em 1em; border-radius: 100px; cursor: pointer; transition: .18s;
}
.lb__tab:hover { color: var(--ink); background: var(--surface); }
.lb__tab.active { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 6px 16px rgba(var(--brand-rgb), .3); }
.lb__tab .cnt { font-size: .72rem; opacity: .7; font-weight: 500; }

.lb__controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.lb__filters { display: flex; flex-wrap: wrap; gap: 6px; }
.lb__chip {
  font-family: inherit; font-size: .82rem; font-weight: 600; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--line); line-height: 1.4;
  padding: .4em .8em; border-radius: 100px; cursor: pointer; transition: .15s; user-select: none;
}
.lb__chip:hover { border-color: var(--line-strong); }
.lb__chip.on { background: rgba(var(--brand-rgb), .12); border-color: var(--brand); color: var(--brand-ink); }
.lb__chip .x { opacity: .6; margin-left: .3em; }
.lb__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lb__check { display: inline-flex; align-items: center; gap: .5em; font-size: .85rem; color: var(--ink-soft); cursor: pointer; user-select: none; }
.lb__check input { accent-color: var(--brand); width: 15px; height: 15px; }
.lb__search { display: flex; align-items: center; gap: .5em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 100px; padding: .35em .85em; color: var(--ink-faint); transition: border-color .18s, box-shadow .18s; }
.lb__search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .18); color: var(--brand); }
.lb__search input { border: none; background: transparent; outline: none; font-family: var(--sans); font-size: .85rem; color: var(--ink); width: 130px; }

.lb__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.lb__scroll::-webkit-scrollbar { height: 9px; }
.lb__scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 100px; }
.lb__scroll::-webkit-scrollbar-track { background: transparent; }
.lb__hint { display: none; padding: 8px 18px 0; font-size: .76rem; color: var(--ink-faint); }
@media (max-width: 640px) { .lb__hint { display: block; } }
.lb__table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px; }
.lb__table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); color: var(--ink-faint);
  font-weight: 600; font-size: .76rem; letter-spacing: .04em; text-transform: uppercase;
  text-align: right; padding: 14px 14px; border-bottom: 2px solid var(--line); white-space: nowrap;
  cursor: pointer; user-select: none; transition: color .15s;
}
.lb__table thead th:hover { color: var(--brand); }
.lb__table thead th.col-rank, .lb__table thead th.col-model, .lb__table thead th.col-method { text-align: left; }
.lb__table thead th.sorted { color: var(--brand); }
.lb__table thead th .arr { font-size: .9em; margin-left: .25em; }

.lb__table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.lb__table tbody tr { transition: background .12s; }
.lb__table tbody tr:hover { background: var(--surface-2); }
.lb__table tbody tr.is-baseline { background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(var(--accent-rgb), .04) 8px, rgba(var(--accent-rgb), .04) 16px); }

.cell-rank { color: var(--ink-faint); font-family: var(--mono); font-weight: 600; text-align: left !important; width: 44px; }
.cell-rank.top1 { color: var(--brand); }
.cell-model { text-align: left !important; }
.cell-model .m-name { font-weight: 700; color: var(--ink); }
.cell-model .m-org { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .03em; padding: .12em .5em; border-radius: 5px; margin-left: .5em; vertical-align: middle; }
.org-Qwen { background: #ede9fe; color: #6d28d9; }
.org-DeepSeek { background: #dbeafe; color: #1d4ed8; }
.org-OpenAI { background: #d1fae5; color: #047857; }
.org-Google { background: #fee2e2; color: #b91c1c; }
html[data-theme="dark"] .org-Qwen { background: #2e2466; color: #c4b5fd; }
html[data-theme="dark"] .org-DeepSeek { background: #16315f; color: #93c5fd; }
html[data-theme="dark"] .org-OpenAI { background: #0d3a2c; color: #6ee7b7; }
html[data-theme="dark"] .org-Google { background: #4a1414; color: #fca5a5; }

.cell-method { text-align: left !important; }
.tag-method { display: inline-block; font-size: .76rem; font-weight: 600; padding: .25em .7em; border-radius: 100px; border: 1px solid var(--line-strong); color: var(--ink-soft); }
.tag-method.m-classical { background: var(--accent-soft); border-color: transparent; color: #b45309; }
.tag-method.m-multi { background: rgba(var(--brand-rgb), .12); border-color: transparent; color: var(--brand-ink); }
html[data-theme="dark"] .tag-method.m-classical { color: var(--accent); }

.cell-val { position: relative; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.cell-val .v { position: relative; z-index: 1; font-weight: 500; }
.cell-val .bar { position: absolute; right: 8px; bottom: 5px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--brand) 35%, transparent); z-index: 0; }
.cell-val.is-best { background: var(--best-bg); }
.cell-val.is-best .v { font-weight: 800; color: var(--brand-ink); }
.cell-val.is-best .v::after { content: "★"; font-size: .7em; margin-left: .3em; color: var(--brand); vertical-align: top; }
.cell-val.is-second { background: var(--second-bg); }
.cell-val.is-second .v { font-weight: 700; }
.cell-val.is-na { color: var(--ink-faint); opacity: .6; }

.lb__note { padding: 14px 18px; margin: 0; font-size: .82rem; color: var(--ink-faint); border-top: 1px solid var(--line); background: var(--surface-2); }
.legend-best, .legend-second { font-weight: 600; white-space: nowrap; }
.legend-best { color: var(--brand-ink); }
.legend-second { color: var(--accent); }

/* ---------- Findings grid ---------- */
.findings-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 38px; }
.finding { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); }
.finding__tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
.finding p { font-size: .88rem; color: var(--ink-soft); margin: 0; }
.finding p b { color: var(--ink); }

/* ---------- Analysis blocks ---------- */
.analysis { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; padding: 40px 0; }
.analysis--rev .analysis__text { order: 2; }
.analysis__kicker { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.analysis__text h3 { font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 1.85rem); letter-spacing: -.02em; margin: 0 0 .8rem; line-height: 1.18; }
.analysis__text p { color: var(--ink-soft); margin: 0 0 1rem; }
.analysis__text p b { color: var(--ink); }
.analysis__fig img { padding: 14px; }

/* Full-width analysis block (e.g. the wide efficiency violin figure) */
.analysis-wide { padding: 40px 0; }
.analysis-wide__text { max-width: none; margin-bottom: 28px; }
.analysis-wide__text h3 { font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 1.85rem); letter-spacing: -.02em; margin: 0 0 .8rem; line-height: 1.18; }
.analysis-wide__text p { color: var(--ink-soft); margin: 0 0 1rem; }
.analysis-wide__text p b { color: var(--ink); }
.figure--wide img { width: 100%; padding: 18px; }

.stat-chips { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 1.5rem; }
.stat-chip { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-sm); flex: 1 1 180px; }
.stat-chip b { display: block; font-family: var(--display); font-size: 1.3rem; color: var(--brand); letter-spacing: -.01em; }
.stat-chip span { font-size: .8rem; color: var(--ink-faint); }

/* ---------- Case box ---------- */
.casebox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.casebox__head { background: var(--ink); color: var(--bg); font-weight: 700; font-size: .92rem; padding: 14px 20px; font-family: var(--display); }
.casebox__body { padding: 20px; }
.casebox__body p { font-size: .92rem; margin: 0 0 .7rem; color: var(--ink-soft); }
.casebox__body p b { color: var(--ink); }
.casebox__ev { background: var(--surface-2); border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: .88rem !important; }
.casebox__note { font-size: .85rem !important; color: var(--ink-faint) !important; border-top: 1px dashed var(--line); padding-top: .8rem; }
.ok { color: var(--good); font-weight: 700; }
.bad { color: var(--bad); font-weight: 700; }

/* ---------- Data blocks (tables) ---------- */
.data-block { margin-top: 40px; }
.data-block--card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); margin-top: 0; }
.data-block__title { font-family: var(--display); font-size: 1.12rem; margin: 0 0 .3rem; }
.data-block__sub { color: var(--ink-faint); font-size: .9rem; margin: 0 0 16px; }
.data-block__scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.data-block--card .data-block__scroll { box-shadow: none; }
.dt { width: 100%; border-collapse: collapse; font-size: .88rem; }
.dt th, .dt td { padding: 10px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.dt thead th { background: var(--surface-2); color: var(--ink-faint); font-weight: 600; font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; }
.dt th:first-child, .dt td:first-child { text-align: left; font-weight: 600; color: var(--ink); }
.dt tbody tr:last-child td { border-bottom: none; }
.dt tbody tr:hover { background: var(--surface-2); }
.dt .grp { background: var(--surface-2); font-weight: 700; color: var(--brand-ink); text-align: left; }
.dt .barcell { position: relative; }
.dt .barcell .bg { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(var(--brand-rgb), .12); z-index: 0; }
.dt .barcell .fg { position: relative; z-index: 1; }
.dt .splitbar { display: flex; height: 18px; border-radius: 5px; overflow: hidden; min-width: 120px; }
.dt .splitbar .u { background: var(--brand); }
.dt .splitbar .c { background: var(--accent); }
.dt .ctr { text-align: center; }
.dt .bdiv { border-right: 2px solid var(--line-strong); }
.dt .splitlabel { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-faint); margin-top: 3px; }

/* ---------- BibTeX ---------- */
.cite__title { font-family: var(--display); font-size: clamp(1.6rem,3.4vw,2.3rem); letter-spacing: -.02em; margin: .4rem 0 1.4rem; }
.bibtex { position: relative; }
.bibtex pre {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  font-family: var(--mono); font-size: .84rem; line-height: 1.7;
  padding: 24px; border-radius: var(--radius); overflow-x: auto; margin: 0;
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .bibtex pre { background: #060a16; color: #e6e9f5; }
.bibtex__copy {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; gap: .4em;
  font-family: var(--sans); font-size: .8rem; font-weight: 600;
  color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line-strong);
  padding: .45em .8em; border-radius: 8px; cursor: pointer; transition: .18s;
}
.bibtex__copy:hover { background: var(--surface); color: var(--ink); border-color: var(--brand); }
.bibtex__copy.copied { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------- Footer ---------- */
.footer { background: var(--bg-alt); border-top: 1px solid var(--line); padding-top: 56px; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; padding-bottom: 40px; }
.footer__brand { max-width: 300px; }
.footer__brand p { color: var(--ink-faint); font-size: .9rem; margin: .6rem 0 0; }
.footer__cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer__cols h3 { font-family: var(--sans); font-weight: 600; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 14px; }
.footer__cols a, .footer__cols span { display: block; color: var(--ink-soft); font-size: .92rem; margin-bottom: 8px; text-decoration: none; }
.footer__cols a:hover { color: var(--brand-ink); }
.footer__bar { border-top: 1px solid var(--line); padding: 20px 24px; max-width: var(--maxw); margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .84rem; color: var(--ink-faint); }
.footer__bar a { color: var(--ink-faint); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Responsive ---------- */

/* Nav collapses to burger earlier (brand + 5 links + Code + toggle is tight < ~900px) */
@media (max-width: 900px) {
  .nav__inner { flex-wrap: wrap; }
  .nav__links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px; box-shadow: var(--shadow); }
  .nav__links.open { display: flex; }
  .nav__links a { padding: .8em 1em; }
  .nav__burger { display: flex; }
  .nav__actions .btn span { display: none; }
}

@media (max-width: 980px) {
  .cards--3, .strategy, .tasks { grid-template-columns: repeat(3, 1fr); }
  .findings-grid { grid-template-columns: repeat(3, 1fr); }
  .analysis { grid-template-columns: 1fr; gap: 28px; }
  .analysis--rev .analysis__text { order: 0; }
  .strategy__col p { min-height: 0; }
}

@media (max-width: 760px) {
  .section { padding: 64px 0; }
  .cards--2, .cards--3, .strategy, .tasks { grid-template-columns: repeat(2, 1fr); }
  .findings-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__stats { grid-template-columns: repeat(3, 1fr); }
  /* Leaderboard controls stack cleanly instead of fighting space-between */
  .lb__controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .lb__right { justify-content: space-between; width: 100%; }
  .lb__search { flex: 1; }
  .lb__search input { width: 100%; }
}

@media (max-width: 520px) {
  html { scroll-padding-top: 66px; }
  .wrap { padding: 0 18px; }
  .cards--3, .strategy, .tasks, .findings-grid { grid-template-columns: 1fr; }
  /* Balance the 5 hero stats so the trailing item isn't orphaned */
  .hero__stats { display: flex; flex-wrap: wrap; justify-content: center; }
  .hero__stats > div { flex: 1 1 124px; }
}
