/* Controlled Degradation Bench — leaderboard styles
   Design language after artificialanalysis.ai: white ground, black UI, serif display, purple accent. */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f7;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --line-strong: #cfcfcf;
  --accent: #6b1f7a;
  --accent-soft: #f3e8f6;
  --safety: #1f6feb;
  --comfort: #16a34a;
  --operation: #f59e0b;
  --good: #16a34a;
  --bad: #dc2626;
  --sans: "Inter", "Suisse Intl", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", "Victor Serif", Georgia, Cambria, "Times New Roman", serif;
  --radius: 12px;
  --pill: 999px;
  --shadow: none;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--fg); }
body { margin: 0; font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.005em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.0; }
h2 { font-size: 30px; line-height: 1.15; }
h3 { font-size: 22px; line-height: 1.2; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 20px; }

/* ---- top bar ---- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 8px; background: var(--fg); color: #fff; border-radius: var(--pill); padding: 8px 14px 8px 10px; font-family: var(--serif); font-size: 18px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 18px; height: 18px; display: inline-block; }
.nav { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--pill); padding: 8px 14px; border: 1px solid var(--fg); background: var(--fg); color: #fff; font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; opacity: .9; }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn.icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }

/* ---- hero ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 40px; padding-block: 56px 40px; align-items: start; }
.hero .lede { margin-top: 18px; font-size: 17px; max-width: 46ch; color: var(--fg); }
.hero .lede .note { display: block; margin-top: 10px; color: var(--muted); font-size: 13.5px; }
.updates { border-top: 1px solid var(--line); }
.updates-head { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding-top: 12px; }
a.update { color: inherit; text-decoration: none; }
a.update:hover .title { text-decoration: underline; }
.update { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.update .eyebrow { color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.update .title { font-weight: 600; font-size: 15px; margin-top: 2px; }
.update .text { color: var(--muted); font-size: 13px; margin-top: 2px; }
.update .arrow { width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 8px; display: grid; place-items: center; font-size: 12px; }

/* ---- sections ---- */
.section { padding-block: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 18px; }
.section-head .eyebrow { font-weight: 600; font-size: 13.5px; }
.section-head .sub { color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--pill); padding: 3px 10px; font-size: 12px; font-weight: 500; background: var(--bg-soft); border: 1px solid var(--line); }
.pill.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.pill.muted { color: var(--muted); }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- highlight cards ---- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card .card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .card-title h3 { display: flex; align-items: center; gap: 10px; }
.card .desc { color: var(--muted); font-size: 12.5px; }
.card .chart { width: 100%; aspect-ratio: 420 / 190; }
.card .chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.card .foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 8px; }

/* ---- layout with sticky toc ---- */
.with-toc { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; }
.toc { position: sticky; top: 84px; align-self: start; border-right: 1px solid var(--line); padding-right: 16px; font-size: 13px; }
.toc a { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--muted); }
.toc a::before { content: ""; width: 8px; height: 8px; background: var(--line-strong); }
.toc a.active, .toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.active::before { background: var(--fg); }
.toc .tag { color: var(--accent); font-size: 11px; margin-left: auto; }

/* ---- leaderboard table ---- */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.controls input[type="search"] { border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 12px; font: inherit; min-width: 240px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--pill); padding: 6px 10px; font-size: 13px; background: var(--bg); cursor: pointer; }
.chip select { border: 0; background: transparent; font: inherit; font-weight: 600; cursor: pointer; }
.chip .k { color: var(--muted); }
.controls .spacer { flex: 1; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.lb { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; font-size: 13.5px; }
table.lb th, table.lb td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: middle; }
table.lb th { background: var(--bg-soft); font-weight: 600; font-size: 12.5px; position: relative; }
table.lb thead tr.groups th { text-align: left; color: var(--fg); border-bottom: 1px solid var(--line); font-size: 12px; }
table.lb thead tr.groups th .g { display: inline-flex; align-items: center; gap: 6px; }
table.lb thead tr.groups th .g::after { content: "→"; color: var(--muted); font-size: 11px; }
table.lb th.sortable { cursor: pointer; user-select: none; }
table.lb th.sortable::after { content: " ⇅"; color: var(--muted); font-size: 10px; }
table.lb th.sorted-desc::after { content: " ↓"; color: var(--fg); }
table.lb th.sorted-asc::after { content: " ↑"; color: var(--fg); }
table.lb th .u { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
table.lb td:first-child, table.lb th:first-child { text-align: left; position: sticky; left: 0; background: var(--bg); z-index: 1; width: 320px; max-width: 360px; white-space: normal; }
table.lb thead th:first-child { background: var(--bg-soft); }
table.lb td.model { font-weight: 600; }
table.lb td.model .bar { display: inline-block; width: 4px; height: 18px; border-radius: 2px; margin-right: 10px; vertical-align: middle; }
table.lb td.model .meta { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 14px; }
table.lb td.model a:hover { text-decoration: underline; }
table.lb .grp-start { border-left: 1px solid var(--line); }
table.lb tr.pending td { color: var(--muted); }
table.lb tr.pending td.model { font-weight: 500; }
table.lb .score { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 600; }
table.lb .score .ci { color: var(--muted); font-weight: 400; font-size: 11px; }
table.lb .score.primary { font-size: 15px; }
.dash { color: var(--muted); }
.legend-note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.expand-cols { margin-left: auto; }
.col-abs, .col-prov { display: none; }
.table-wrap.expanded .col-abs, .table-wrap.expanded .col-prov { display: table-cell; }
.ranknum { color: var(--muted); font-size: 12px; width: 22px; display: inline-block; }

/* ---- score bar cell ---- */
.sbar { display: inline-flex; align-items: center; gap: 8px; }
.sbar .track { width: 80px; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.sbar .fill { height: 100%; border-radius: 3px; }

/* ---- heat table ---- */
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 13px; }
table.heat th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: left; padding: 4px 6px; }
table.heat th.axis { text-align: center; color: var(--fg); font-weight: 600; }
table.heat td { padding: 0; }
table.heat td .cell { display: block; padding: 9px 8px; border-radius: 8px; text-align: center; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
table.heat td .cell:hover { border-color: var(--fg); }
table.heat td .cell.sel { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
table.heat td.scn { text-align: left; font-weight: 500; white-space: nowrap; padding-right: 10px; }
table.heat td.scn .d { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.heat-detail { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.heat-detail h3 { margin-bottom: 4px; }
.heat-detail .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.curves { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.curve { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 8px; }
.curve .t { font-size: 12.5px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.curve .t .r { color: var(--muted); font-weight: 500; }
.curve svg { width: 100%; height: 90px; display: block; overflow: visible; margin-top: 6px; }
.curve .lv { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }

/* ---- generic ---- */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.prose { max-width: 70ch; font-size: 15px; line-height: 1.6; }
.prose h2 { margin: 28px 0 10px; }
.prose h3 { margin: 22px 0 8px; font-size: 20px; }
.prose p + p { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 22px; margin: 8px 0; }
.prose li + li { margin-top: 4px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 10px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); font-weight: 600; }
.prose td code, .prose li code, .prose p code { overflow-wrap: anywhere; }
.prose pre { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; background: var(--accent-soft); font-size: 13.5px; }
.formula { font-family: ui-monospace, Menlo, monospace; background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; }
footer { border-top: 1px solid var(--line); margin-top: 40px; padding-block: 24px 40px; color: var(--muted); font-size: 12.5px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 36px 24px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .with-toc { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  h2 { font-size: 26px; }
}
@media (max-width: 640px) {
  .topbar .wrap { height: auto; flex-wrap: wrap; padding-block: 10px; row-gap: 8px; }
  .nav { width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav .btn { flex: 0 0 auto; }
  .prose table { display: block; overflow-x: auto; }
}
.kv dd, .kv dt { overflow-wrap: anywhere; min-width: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

tr.partial td { background: var(--bg-soft, #fafafa); }
