/* mcp-arena leaderboard */
:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --fg: #1c1b19;
  --muted: #5c5a55;
  --rule: #dedbd3;
  --rule-strong: #b9b5ab;
  --accent: #1d56b0;
  --accent-soft: #dbe6f7;
  --band: #9dbbe6;
  --tick: #12397a;
  --pass: #2f8f4e;
  --warn-bg: #fff3d4;
  --warn-fg: #5e3d00;
  --warn-rule: #e3b54a;
  --focus: #1d56b0;
  --serif: ui-serif, "Iowan Old Style", "Charter", "Georgia", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1a1b1e;
    --fg: #e9e7e1;
    --muted: #a9a69e;
    --rule: #2f3135;
    --rule-strong: #4a4d53;
    --accent: #86b3ff;
    --accent-soft: #1f2d45;
    --band: #3c5f96;
    --tick: #cfe0ff;
    --pass: #3fae66;
    --warn-bg: #3a2c0c;
    --warn-fg: #f6d88f;
    --warn-rule: #8a6a1f;
    --focus: #86b3ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: 0.88em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 76rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 40rem) { .wrap { padding: 0 24px; } }

.skip {
  position: absolute; left: 8px; top: -100px; z-index: 10;
  background: var(--surface); color: var(--fg); padding: 8px 12px; border: 1px solid var(--rule-strong);
}
.skip:focus { top: 8px; }

.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;
}

/* ---- header ---- */
.site-header { border-bottom: 1px solid var(--rule); padding: 2.5rem 0 1.75rem; }
.eyebrow { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.9rem; }
.eyebrow a { color: inherit; }
h1 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(2rem, 1.4rem + 3vw, 3rem); line-height: 1.1; margin: 0 0 1rem;
}
.lede { max-width: 44rem; margin: 0 0 1rem; font-size: 1.05rem; }
.disclosure { max-width: 44rem; margin: 0; color: var(--muted); font-size: 0.95rem; }
.disclosure strong { color: var(--fg); }

main { padding-top: 1.5rem; padding-bottom: 3rem; }
main:focus { outline: none; }

/* ---- controls ---- */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1rem; }
.controls label { font-weight: 600; }
select {
  font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 6px; padding: 0.35rem 0.5rem;
  max-width: 100%; min-width: 0;
}

details > summary { cursor: pointer; font-weight: 600; padding: 0.35rem 0; }
details > summary .sub { font-weight: 400; }

.legend { margin: 0 0 1.5rem; max-width: 52rem; color: var(--fg); }
.legend dl { margin: 0.5rem 0 0; display: grid; gap: 0.5rem; }
.legend dt { font-weight: 600; }
.legend dd { margin: 0; color: var(--muted); }

/* ---- run ---- */
.run h2 {
  font-family: var(--serif); font-weight: 600; font-size: 1.6rem; line-height: 1.2;
  margin: 0.5rem 0 0.25rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.meta { color: var(--muted); margin: 0 0 0.75rem; font-size: 0.92rem; }
.run-id { overflow-wrap: anywhere; }
.links { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.run-notes { margin: 0 0 1rem; padding-left: 1.2rem; max-width: 52rem; color: var(--muted); font-size: 0.92rem; }
.run-notes li + li { margin-top: 0.25rem; }

.sub { color: var(--muted); font-size: 0.85em; font-weight: 400; }
.note { color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.na { color: var(--muted); }

.badge {
  display: inline-block; font-family: var(--sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.03em; text-transform: uppercase; line-height: 1;
  padding: 0.3em 0.5em; border-radius: 4px; border: 1px solid var(--rule-strong); color: var(--muted);
  vertical-align: middle; white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--fg); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-rule); }

.callout { border-left: 4px solid var(--rule-strong); padding: 0.6rem 0.9rem; margin: 0 0 1rem; max-width: 52rem; }
.callout-warn { background: var(--warn-bg); color: var(--warn-fg); border-left-color: var(--warn-rule); }

.suite { margin-top: 2rem; }
.suite h3 { font-size: 1.15rem; margin: 0 0 0.25rem; }

/* ---- tables ---- */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
  max-width: 100%;
}
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
caption { text-align: left; padding: 0.6rem 0.75rem; color: var(--muted); font-size: 0.85rem; caption-side: top; }
th, td { padding: 0.55rem 0.75rem; border-top: 1px solid var(--rule); text-align: right; vertical-align: top; }
thead th {
  font-weight: 600; font-size: 0.82rem; line-height: 1.25; color: var(--fg);
  vertical-align: bottom; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule-strong);
}
thead th .sub { display: block; font-size: 0.92em; white-space: nowrap; }
tbody tr:first-child > * { border-top: 0; }
tbody th { font-weight: 400; }

.cells td { white-space: nowrap; }
.col-cell {
  text-align: left; position: sticky; left: 0; z-index: 1;
  background: var(--surface); min-width: 10.5rem; max-width: 13rem;
  box-shadow: 1px 0 0 var(--rule);
}
.col-cell .server, .col-cell .model, .col-cell .provider { display: block; }
.col-cell .server { font-weight: 600; }
.col-cell .model { font-family: var(--mono); font-size: 0.85em; overflow-wrap: anywhere; }
@media (min-width: 48rem) {
  .col-cell { max-width: none; }
  .col-cell .model { white-space: nowrap; overflow-wrap: normal; }
}
.col-cell .provider { color: var(--muted); font-size: 0.8em; }
.row-incomplete > * { background: var(--warn-bg); }
.row-incomplete > .col-cell { background: var(--warn-bg); }

.ci { color: var(--muted); font-size: 0.88em; }
.cells td[data-col="success"] { min-width: 9.5rem; }
.bar {
  display: block; position: relative; height: 6px; margin: 0.4rem 0 0.1rem auto; width: 100%; max-width: 8rem;
  background: var(--rule); border-radius: 3px;
}
.bar-ci { position: absolute; top: 0; bottom: 0; background: var(--band); border-radius: 3px; min-width: 2px; }
.bar-pt { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; background: var(--tick); border-radius: 1px; }

/* sort buttons */
th button.sort {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  text-align: inherit; cursor: pointer; display: inline-block; line-height: inherit;
}
th button.sort:hover { color: var(--accent); }
.sort-icon { display: inline-block; width: 0.9em; margin-left: 0.15em; text-align: center; color: var(--muted); }
.sort-icon::before { content: "↕"; }
th[aria-sort="ascending"] .sort-icon::before { content: "↑"; color: var(--accent); }
th[aria-sort="descending"] .sort-icon::before { content: "↓"; color: var(--accent); }
th[aria-sort] { background: var(--accent-soft); }

/* per-task grid */
.tasks { margin-top: 0.9rem; }
.tasks .table-wrap { margin-top: 0.5rem; }
.task-grid th[scope="row"] { text-align: left; max-width: 9.5rem; position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--rule); z-index: 1; }
.task-grid thead th { text-align: right; }
@media (min-width: 48rem) { .task-grid th[scope="row"] { white-space: nowrap; max-width: none; } }
.task-grid thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 2; }
.task-grid thead .server, .task-grid thead .model { display: block; }
.task-grid thead .model { white-space: nowrap; font-weight: 400; font-family: var(--mono); font-size: 0.9em; color: var(--muted); }
.task-grid td { white-space: nowrap; }
.task-grid td.tint { background: color-mix(in srgb, var(--pass) var(--pass-mix, 20%), transparent); }
.task-grid td.zero { color: var(--muted); }
.task-grid .row-total > * { border-top: 1px solid var(--rule-strong); font-weight: 600; background: var(--surface); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--rule); background: var(--surface); padding: 2rem 0 3rem; font-size: 0.93rem; }
.footer-inner { max-width: 52rem; }
.footer-h { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin: 0 0 0.5rem; }
.footer-h + * { margin-top: 0; }
.facts { margin: 0 0 1.5rem; display: grid; gap: 0.3rem; }
.facts > div { display: grid; grid-template-columns: 7rem 1fr; gap: 0.75rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.caveats { padding-left: 1.2rem; margin: 0 0 1rem; }
.caveats li + li { margin-top: 0.4rem; }
@media (max-width: 26rem) { .facts > div { grid-template-columns: 1fr; gap: 0; } }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  a, th button.sort { transition: color 120ms ease; }
}

@media (forced-colors: active) {
  .bar-ci { background: Highlight; }
  .bar-pt { background: CanvasText; }
  .badge { border-color: CanvasText; }
}

@media print {
  .controls, .skip, .legend { display: none; }
  .table-wrap { overflow: visible; border: 0; }
  table.cells, .task-grid { min-width: 0; }
}
