/* SaxAbench — deliberately loud. The leaderboard is the product. */

:root {
  --bg: #0d0b14;
  --bg-raised: #17142099;
  --card: #191527;
  --card-hover: #201b31;
  --line: #2e2842;
  --text: #f2eefb;
  --muted: #9d94b8;
  --dim: #6f668a;
  --gold: #ffc94a;
  --hot: #ff5c8a;
  --cool: #4ad9ff;
  --green: #45e0a8;
  --shadow: 0 18px 50px -20px #000a;
  --radius: 16px;
  --wrap: 1080px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 12% -8%, #ff5c8a1f, transparent 65%),
    radial-gradient(800px 520px at 92% 4%, #4ad9ff1a, transparent 62%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }

a { color: var(--cool); }

/* ---------- header ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 0; flex-wrap: wrap;
}
.brand {
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none; display: inline-flex;
  align-items: center; gap: 9px;
}
/* The wordmark must read as one word. .brand is inline-flex with a gap, so a bare
   child span becomes a flex item and renders "Sax -a- Bench" spaced apart. Keep the
   text in a single item and colour the hyphens with an inline element inside it. */
.brand .mark { white-space: nowrap; }
.brand .mark i { font-style: normal; color: var(--gold); }
.navlinks { display: flex; gap: 20px; font-size: 0.9rem; }
.navlinks a { color: var(--muted); text-decoration: none; }
.navlinks a:hover { color: var(--text); }

/* ---------- hero ---------- */

.hero { padding: 46px 0 26px; }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  line-height: 0.98; letter-spacing: -0.035em; font-weight: 850;
}
.hero h1 .gold {
  background: linear-gradient(102deg, var(--gold), var(--hot) 62%, var(--cool));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--muted); max-width: 60ch; margin: 0 0 20px;
}
.tagline strong { color: var(--text); font-weight: 650; }

.premise {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px; margin: 30px 0 8px;
}
.premise div {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 13px; padding: 15px 17px;
}
.premise h3 {
  margin: 0 0 5px; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--gold);
}
.premise p { margin: 0; font-size: 0.9rem; color: var(--muted); }

/* ---------- section headings ---------- */

.section { margin: 52px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.section-head h2 {
  margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; font-weight: 800;
}
.section-head p { margin: 0; color: var(--dim); font-size: 0.87rem; }

/* ---------- leaderboard ---------- */

.board { display: flex; flex-direction: column; gap: 12px; }

/* One board per protocol version. The superseded ones collapse, so the page can
   never be skim-read as a single combined ranking across incompatible rules. */
.protogroup { margin-bottom: 30px; }
.protohead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 6px;
}
.protohead h3 {
  margin: 0; font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--gold);
}
.protocount { color: var(--dim); font-size: 0.8rem; }
.protosum {
  margin: 0 0 16px; color: var(--dim); font-size: 0.87rem;
  max-width: 68ch; line-height: 1.55;
}
.protogroup.superseded {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 16px 20px; background: #ffffff05;
}
.protogroup.superseded > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.protogroup.superseded > summary::-webkit-details-marker { display: none; }
.protogroup.superseded > summary::before {
  content: "▸"; color: var(--dim); font-size: 0.8rem;
}
.protogroup.superseded[open] > summary::before { content: "▾"; }
.protogroup.superseded > summary:hover .protolabel { color: var(--gold); }
.protolabel {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--dim);
}
.protogroup.superseded[open] > summary { margin-bottom: 14px; }
.protogroup.superseded .row { opacity: 0.72; }
.protogroup.superseded .row:hover { opacity: 1; }

/* Runs a host outage killed. Kept, never ranked. */
.voided { margin-top: 18px; }
.voided > summary {
  cursor: pointer; color: var(--dim); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  list-style: none; display: flex; align-items: baseline; gap: 10px;
}
.voided > summary::-webkit-details-marker { display: none; }
.voided > summary::before { content: "▸"; font-size: 0.8rem; }
.voided[open] > summary::before { content: "▾"; }
.voided > summary:hover { color: var(--hot); }
.voided[open] > summary { margin-bottom: 12px; }
.voided .row { opacity: 0.6; }
.voided .row:hover { opacity: 1; }

.row {
  display: grid;
  /* Four columns, not three: the row gained a cost cell and the grid was never
     widened, so every card laid itself out differently. Fixed widths on the two
     number columns keep them in a straight line down the page. */
  grid-template-columns: 44px minmax(0, 1fr) 200px 84px;
  align-items: center; gap: 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
  position: relative; overflow: hidden;
}
.row:hover { transform: translateY(-2px); background: var(--card-hover); border-color: #453a63; }
.row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--dim);
}
.row.rank-1::before { background: var(--gold); }
.row.rank-2::before { background: var(--cool); }
.row.rank-3::before { background: var(--hot); }
.row.dns::before { background: #4a4160; }

.rank {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  color: var(--dim); text-align: center;
}
.rank-1 .rank { color: var(--gold); }
.rank-2 .rank { color: var(--cool); }
.rank-3 .rank { color: var(--hot); }

.who { min-width: 0; }
.model-name {
  font-size: 1.28rem; font-weight: 750; letter-spacing: -0.015em;
  display: block; margin-bottom: 3px;
}
.meta { font-size: 0.8rem; color: var(--dim); display: flex; gap: 8px; flex-wrap: wrap; }
.meta .sep { opacity: 0.45; }

.score { text-align: right; display: flex; align-items: baseline; gap: 9px; }
.score .num {
  font-family: var(--mono); font-weight: 800; letter-spacing: -0.04em;
  font-size: clamp(2.3rem, 6vw, 3.4rem); line-height: 1;
}
.rank-1 .score .num { color: var(--gold); }
.rank-2 .score .num { color: var(--cool); }
.rank-3 .score .num { color: var(--hot); }
.score .unit {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--dim); writing-mode: horizontal-tb;
}
.score .dns {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 800; color: #7c7196;
}

.badge {
  display: inline-block; font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.09em; padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--muted); background: #ffffff08;
}
.badge.warn { color: var(--hot); border-color: #ff5c8a55; }

/* ---------- highlights ---------- */

.highlights { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.hl {
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px; padding: 17px 19px;
}
.hl .q {
  font-family: var(--mono); font-size: 0.88rem; color: var(--text);
  margin: 0 0 9px; line-height: 1.45;
}
.hl .note { margin: 0 0 11px; color: var(--muted); font-size: 0.91rem; }
.hl .src { font-size: 0.76rem; color: var(--dim); }
.hl .src a { color: var(--cool); text-decoration: none; }
.hl .src a:hover { text-decoration: underline; }

/* ---------- run detail ---------- */

.runhead {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 28px; margin: 22px 0 30px;
  box-shadow: var(--shadow);
}
.runhead h1 { margin: 0 0 6px; font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -0.03em; }
.runhead .verdict { color: var(--muted); margin: 0 0 20px; font-size: 1.02rem; }
.runhead .verdict b { color: var(--gold); font-size: 1.28rem; font-family: var(--mono); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat {
  background: #ffffff07; border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 14px;
}
.stat .k {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--dim); display: block; margin-bottom: 3px;
}
.stat .v { font-family: var(--mono); font-size: 1.12rem; font-weight: 700; }

.transcript { display: flex; flex-direction: column; gap: 7px; }
.turn {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 76px;
  gap: 14px; align-items: baseline;
  padding: 11px 16px; border-radius: 10px;
  background: var(--card); border: 1px solid transparent;
}
.turn:hover { border-color: var(--line); }
.turn .n {
  font-family: var(--mono); font-size: 0.82rem; color: var(--dim); text-align: right;
}
/* Transcripts keep every byte, and some "questions" are essays — Kimi's longest
   ran to 24,334 characters. Scroll the cell rather than truncating it, so the
   full reply is still readable without one turn swallowing the whole page. */
.turn .q {
  font-size: 0.97rem;
  white-space: pre-wrap;
  max-height: 11em;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.turn .a {
  font-family: var(--mono); font-size: 0.85rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; text-align: right;
}
.turn .a.yes { color: var(--green); }
.turn .a.no { color: var(--hot); }
/* Protocol 2.0's third host response — the only one that ends the game. */
.turn .a.won { color: var(--gold); }
.turn .a.invalid { color: var(--dim); font-size: 0.68rem; letter-spacing: 0.04em; }
.turn.invalid { opacity: 0.62; }
.turn.win {
  background: linear-gradient(96deg, #ffc94a1f, #ffc94a05);
  border-color: #ffc94a66;
}
.turn.win .q { font-weight: 700; color: var(--gold); }
.turn.marked { border-color: #ffc94a4d; }
.turn .flag {
  display: block; margin-top: 6px; font-size: 0.82rem;
  color: var(--gold); border-left: 2px solid #ffc94a66; padding-left: 10px;
}

.backlink {
  display: inline-block; margin: 26px 0 0; color: var(--muted);
  text-decoration: none; font-size: 0.9rem;
}
.backlink:hover { color: var(--text); }

/* ---------- notices / footer ---------- */

.notice {
  background: #ffffff07; border: 1px solid var(--line);
  border-radius: 13px; padding: 18px 21px; color: var(--muted); font-size: 0.9rem;
}
.notice h3 { margin: 0 0 7px; font-size: 0.95rem; color: var(--text); }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }

footer {
  margin: 66px 0 40px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--dim); font-size: 0.83rem;
}
footer a { color: var(--muted); }

.empty { color: var(--dim); padding: 26px; text-align: center; }

@media (max-width: 620px) {
  .row { grid-template-columns: 40px minmax(0, 1fr); row-gap: 10px; padding: 16px; }
  .score { grid-column: 1 / -1; justify-content: flex-start; }
  .turn { grid-template-columns: 38px minmax(0, 1fr); }
  .turn .a { grid-column: 2; text-align: left; }
}

/* Evidence blocks in the methodology text — small, monospaced, scrollable on
   narrow screens rather than forcing the page to scroll sideways. */
.notice pre.proof {
  margin: 12px 0 16px;
  padding: 12px 14px;
  background: #00000040;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--dim);
  overflow-x: auto;
}

/* A run our own output cap truncated. Deliberately the loudest badge on the
   board: it is the one thing a reader must not mistake for a model's score. */
.badge.ours {
  color: var(--cool);
  border-color: #4ad9ff66;
  background: #4ad9ff14;
}
.score .dns.incomplete { color: var(--cool); font-size: 1.15rem; }

/* ---------- hero with the illustration ---------- */
/* The picture is doing the explaining, so the prose beside it got shorter. Below
   900px it stacks and the art leads, because on a phone the image is the fastest
   way to understand what the answer even is. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 30px; align-items: center;
  padding: 40px 0 18px;
}
.hero-art { margin: 0; }
.hero-art img {
  display: block; width: 100%; height: auto; max-width: 460px; margin-inline: auto;
  /* No shadow and no border: the art is painted on the page's own background colour,
     and any shadow immediately reveals the square edge of the image. */
}
.premise-row { margin-top: 6px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 10px; padding-top: 26px; }
  .hero-art { order: -1; }
  .hero-art img { max-width: 320px; }
}

/* Cost belongs on the row: the two cheapest solvers cost about ten cents between
   them, which is a more interesting fact than either of their scores. */
.meta .cost { color: var(--green); font-variant-numeric: tabular-nums; }

/* Solve rate sits under the question count in the score column. It is the number
   that actually separates models, so it must not read as a footnote. */
.score .rate {
  display: block;
  margin-top: .25rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  text-transform: uppercase;
}
.rank .nodot { color: var(--line); font-size: 1.2rem; }

/* The point on the board where measured differences stop. */
.banddiv {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .35rem 0;
  padding: 0 .25rem;
}
.banddiv::before, .banddiv::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--line);
}
.banddiv span {
  flex: 0 1 auto;
  max-width: 42ch;
  font-size: .74rem;
  line-height: 1.35;
  color: var(--muted);
  text-align: center;
}


/* The two number columns read as columns: same width, same right edge. */
.row .score { text-align: right; }
.row .cost {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: .95rem;
  color: var(--muted);
  white-space: nowrap;
}
.row .score .dns {
  font-family: var(--sans, system-ui, sans-serif);
  font-size: .82rem;
  line-height: 1.3;
  color: var(--muted);
  display: inline-block;
}
@media (max-width: 640px) {
  .row { grid-template-columns: 32px minmax(0, 1fr) auto; row-gap: 6px; }
  .row .cost { grid-column: 2 / -1; text-align: left; }
}
