:root {
  color-scheme: light;
  --paper: #ffffff;
  --panel: #f6f6f5;
  --panel-2: #efefed;
  --line: #e4e4e1;
  --line-2: #cfcfcb;
  --ink: #141414;
  --ink-2: #3a3a38;
  --muted: #6b6b67;
  --faint: #9a9a95;
  --ref: #bdbdb8;
  --upd: #141414;
  --orig: #7a7a75;
  --focus: #141414;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --wrap: 1120px;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--paper); color: var(--ink-2); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
p { margin: 0; }
.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; padding: 8px 12px; background: var(--ink); color: var(--paper); border-radius: 6px; }
.skip:focus { left: 8px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; background: rgb(255 255 255 / 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 56px; }
.mark { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 14px; text-decoration: none; white-space: nowrap; transition: background-color 120ms, color 120ms; }
nav a:hover { color: var(--ink); background: var(--panel); }
nav a[aria-current="true"] { color: var(--ink); background: var(--panel-2); }
.banner { background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); padding: 10px 0; }

/* Intro */
.intro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: end; padding: 72px 0 40px; }
h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); letter-spacing: -0.045em; line-height: 0.98; }
.lede { margin-top: 20px; max-width: 46ch; font-size: 1.15rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 2px solid var(--ink); }
.stats div { padding: 14px 16px 0 0; }
.stats div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 6px 0 0; font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 650; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats .tie { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.status { color: var(--muted); padding-bottom: 16px; }
.status:empty { display: none; }

/* Blocks */
.block { padding: 48px 0 8px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 32px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.block-head h2 { font-size: 1.75rem; }
.block-head p { max-width: 62ch; color: var(--muted); font-size: 15px; }
.scroll { overflow-x: auto; }

/* Race: one lane per program, and a ball that crosses it in the program's time
   (the fastest takes 1 second), as on the original benchmark page. */
.race { --pad: 10px; --gap: 8px; margin: 0 0 32px; padding: var(--pad); background: #eee; border: 2px solid #444; border-radius: 6px; color: #0b0b0b;
  display: grid; gap: 4px; font: 17.1px/1.2 var(--mono); }
.race:empty { display: none; }
/* A ball is 2px taller than its lane: with the 4px between lanes, 2px is left
   between one ball and the next. */
.lane { --size: 55px; --ball: calc(var(--size) + 2px); display: grid; grid-template-columns: 48px minmax(167px, 220px) 1fr;
  column-gap: var(--gap); align-items: center; height: var(--size); }
.lane .logo { width: 48px; height: 48px; object-fit: contain; justify-self: center;
  filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, .3)); }
.lane .who { background: #444; color: #fff; height: var(--size); border-radius: 4px; display: flex;
  align-items: center; justify-content: center; white-space: nowrap;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, .15); }
.lane.updated .who { background: #0b0b0b; font-weight: 700; }
/* The track runs from the label's edge to the inside of the frame, so the ball
   touches both. */
.lane .track { position: relative; height: var(--size);
  margin: 0 calc(-1 * var(--pad)) 0 calc(-1 * var(--gap)); }
.lane .ball { position: absolute; top: -1px; left: calc((100% - var(--ball)) * var(--at));
  width: var(--ball); height: var(--ball); border-radius: 50%; border: 1px solid #444;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, .15);
  /* Wait half a second at the start line (held there by `backwards`), then bounce. */
  animation: race var(--t) linear 0.5s infinite alternate backwards; }
@keyframes race { from { left: 0; } to { left: calc(100% - var(--ball)); } }
@media (prefers-reduced-motion: reduce) { .lane .ball { animation: none; } }
@media (max-width: 560px) {
  .race { --pad: 6px; --gap: 6px; font-size: 11.7px; }
  .lane { --size: 42px; grid-template-columns: 33px 142px 1fr; }
  .lane .logo { width: 33px; height: 33px; }
}

/* Leaderboard */
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.board li { display: grid; grid-template-columns: 28px 132px minmax(80px, 1fr) 96px 84px; align-items: center; gap: 14px; min-height: 38px; padding: 0 10px; border-radius: 8px; }
.board li.csharp { background: var(--panel); }
.board .rank { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
.board .name { color: var(--ink); font-weight: 550; white-space: nowrap; }
.board .bar { height: 12px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.board li.csharp .bar { background: var(--paper); }
.board .fill { display: block; height: 100%; width: var(--w); background: var(--ref); border-radius: 3px; transform-origin: left; animation: grow 700ms cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d); }
.board li.updated .fill { background: var(--upd); }
.board li.original .fill { background: var(--orig); }
.board .ms { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.board .rel { text-align: right; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Matrix */
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.matrix th, .matrix td { padding: 0; text-align: center; white-space: nowrap; }
.matrix thead th { padding: 0 4px 10px; font-size: 13px; font-weight: 550; color: var(--muted); vertical-align: bottom; }
.matrix thead th.cs { color: var(--ink); }
.matrix tbody th, .matrix tfoot th, .matrix thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); }
.matrix tbody th { text-align: left; padding-right: 16px; }
.matrix tbody th button { all: unset; cursor: pointer; padding: 8px 0; color: var(--ink); font-weight: 550; border-bottom: 1px dotted var(--line-2); }
.matrix tbody th button:hover { border-bottom-color: var(--ink); }
.matrix tbody th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.matrix td { padding: 2px; }
.matrix td span { display: block; min-width: 56px; padding: 9px 6px; border-radius: 6px; font-size: 14px; background: var(--c); color: var(--t); }
.matrix td.best span { font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--ink); }
.matrix td.cs span { outline: 1px solid var(--line-2); outline-offset: -1px; }
.matrix tr.selected th button { border-bottom: 2px solid var(--ink); }
.matrix tfoot th { text-align: left; padding: 14px 16px 0 0; font-weight: 650; color: var(--ink); }
.matrix tfoot td { padding: 12px 2px 0; }
.matrix tfoot tr { border-top: 1px solid var(--line); }

/* Workloads */
.picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.picker button { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink-2); font: 500 14px/1 var(--sans); cursor: pointer; transition: background-color 120ms, border-color 120ms, color 120ms; }
.picker button:hover { border-color: var(--line-2); background: var(--panel); }
.picker button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-upd { background: var(--upd); }
.dot-orig { background: var(--paper); box-shadow: inset 0 0 0 2px var(--orig); }
.dot-ref { width: 8px; height: 8px; background: var(--ref); }
.strips svg { display: block; width: 100%; height: auto; overflow: visible; }
.strips .label { fill: var(--ink); font: 500 13px var(--sans); }
.strips .sub { fill: var(--muted); font: 12px var(--sans); }
.strips .tick { fill: var(--faint); font: 11px var(--sans); }
.strips .grid { stroke: var(--line); stroke-width: 1; }
.strips .row-bg { fill: var(--panel); }
.strips .ref { fill: var(--ref); }
.strips .ref.hot { fill: var(--ink-2); }
.strips .orig { fill: var(--paper); stroke: var(--orig); stroke-width: 2; }
.strips .upd { fill: var(--upd); }
.strips .hit { fill: transparent; cursor: default; }
.strips .link { stroke: var(--orig); stroke-width: 1.5; stroke-dasharray: 2 3; }
.table-toggle { margin-top: 16px; }
.table-toggle summary { cursor: pointer; color: var(--ink); font-size: 14px; width: fit-content; }
.times, .builds { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.times th, .times td, .builds th, .builds td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.times th:first-child, .builds th, .builds td { text-align: left; }
.times thead th, .builds thead th { color: var(--muted); font-weight: 550; font-size: 13px; }
.times .cs { color: var(--ink); font-weight: 600; }

/* Changes */
.changes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.changes li { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.changes h3 { font-size: 1.05rem; letter-spacing: -0.01em; }
.changes .delta { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.changes .speed { font-size: 1.6rem; font-weight: 650; color: var(--ink); letter-spacing: -0.03em; }
.changes .speed.flat { color: var(--faint); }
.changes .fromto { color: var(--muted); font-size: 14px; }
.changes p { color: var(--ink-2); font-size: 14px; }
.changes .spark { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; align-items: end; height: 28px; margin-top: auto; }
.changes .spark i { display: block; background: var(--line-2); border-radius: 2px 2px 0 0; min-height: 2px; }
.changes .spark i.up { background: var(--ink); }

/* Method */
.method-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; }
.method-text p + p { margin-top: 12px; }
.method-side { padding: 20px; background: var(--panel); border-radius: var(--radius); }
.method-side h3 { font-size: 1.05rem; }
.method-side p { margin: 6px 0 12px; color: var(--muted); font-size: 14px; }
pre { margin: 0; padding: 14px; overflow-x: auto; background: var(--ink); color: #f2f2ef; border-radius: 8px; font: 13px/1.5 var(--mono); }
.links { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; font-size: 14px; }
.table-title { margin: 36px 0 0; font-size: 1.05rem; }
.builds td:nth-child(2) { color: var(--muted); }

.foot { margin-top: 72px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot-inner { display: flex; justify-content: space-between; gap: 16px; padding: 20px 0 28px; }

.tip { position: fixed; z-index: 40; pointer-events: none; padding: 6px 9px; background: var(--ink); color: var(--paper); border-radius: 6px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }

@media (max-width: 900px) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 48px; }
  .changes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .top-inner { flex-direction: column; align-items: stretch; gap: 0; padding-top: 10px; }
  nav { margin: 0 -10px; min-height: 40px; align-items: center; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stats div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
  .board li { grid-template-columns: 20px 92px minmax(40px, 1fr) 76px; gap: 8px; padding: 0 6px; }
  .board .rel { display: none; }
  .changes { grid-template-columns: minmax(0, 1fr); }
  .foot-inner { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .board .fill { animation: none; }
  * { transition: none !important; }
}
