/* art-crit viewer. One stylesheet, system fonts, tokens on :root, dark mode via prefers-color-scheme.
   Direction: a quiet lab notebook. Warm neutral paper, ink text, one indigo accent, green only for
   "best / verified", red only for failures, tabular numerals everywhere numbers are compared. */

:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f2f1ed;
  --surface-3: #e9e7e2;
  --line: #e4e1db;
  --line-strong: #cfcbc3;
  --ink: #1c1b18;
  --ink-2: #55524b;
  --ink-3: #87837a;
  --accent: #3f5bd8;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --good: #1d7a4c;
  --good-soft: color-mix(in srgb, var(--good) 12%, transparent);
  --bad: #c0392b;
  --bad-soft: color-mix(in srgb, var(--bad) 10%, transparent);
  --overlay: rgba(14, 14, 12, 0.5);
  --shadow: 0 1px 2px rgba(28, 27, 24, 0.05), 0 2px 8px rgba(28, 27, 24, 0.04);
  --shadow-lift: 0 2px 4px rgba(28, 27, 24, 0.06), 0 10px 24px rgba(28, 27, 24, 0.08);
  --checker-a: #efede8;
  --checker-b: #f7f6f3;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --page: 1240px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111213;
    --surface: #18191b;
    --surface-2: #1f2023;
    --surface-3: #292a2e;
    --line: #2a2b2f;
    --line-strong: #3b3d42;
    --ink: #ecebe7;
    --ink-2: #b4b1aa;
    --ink-3: #85827b;
    --accent: #8fa3ff;
    --accent-ink: #0d1330;
    --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
    --good: #52c48c;
    --good-soft: color-mix(in srgb, var(--good) 14%, transparent);
    --bad: #ff7b6b;
    --bad-soft: color-mix(in srgb, var(--bad) 13%, transparent);
    --overlay: rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 10px 24px rgba(0, 0, 0, 0.35);
    --checker-a: #1c1d20;
    --checker-b: #232428;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, pre, kbd { font-family: var(--mono); }

.container { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter) 64px; }

/* ---- site header: aligned to the content column ---- */
.site-header {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  margin-bottom: 32px;
  font-size: 14px;
}
.site-header .brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: -0.01em; font-size: 15px; text-decoration: none; color: var(--ink);
}
/* the mark: three rising bars */
.site-header .brand::before {
  content: ""; width: 16px; height: 14px; flex: none;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 100% / 4px 6px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 6px 100% / 4px 10px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 12px 100% / 4px 14px no-repeat;
  border-radius: 1px;
}
.site-header .crumb { color: var(--ink-3); min-width: 0; overflow-wrap: anywhere; }
.site-header .crumb a { color: var(--ink-2); text-decoration: none; }
.site-header .crumb a:hover { color: var(--ink); text-decoration: underline; }

/* ---- type ---- */
h1 { font-size: 1.85rem; line-height: 1.2; letter-spacing: -0.022em; font-weight: 700; margin: 0 0 8px; text-wrap: balance; }
h2 { font-size: 1.05rem; letter-spacing: -0.01em; font-weight: 650; margin: 0; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.lede { color: var(--ink-2); font-size: 1.02rem; max-width: 62ch; margin: 0; }
.page-head { margin-bottom: 24px; }
.page-meta { color: var(--ink-2); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.page-meta > * + *::before { content: "·"; color: var(--ink-3); margin-right: 14px; margin-left: -8px; }

.section { margin-top: 36px; }
.section-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head .count { color: var(--ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.section-head .spacer { flex: 1; }

/* ---- messages / states ---- */
.msg {
  margin: 0; padding: 18px 20px; border-radius: var(--r); background: var(--surface);
  border: 1px dashed var(--line-strong); color: var(--ink-2); font-size: 14px;
}
.msg-error { border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); color: var(--bad); }
.run-error {
  color: var(--bad); background: var(--bad-soft); border-radius: var(--r-sm); font-size: 13px;
  padding: 8px 12px; margin: 0 0 12px; font-family: var(--mono); overflow-wrap: anywhere;
}
.run-error::before { content: "Error  "; font-family: var(--font); font-weight: 700; }

/* ---- buttons / chips / badges ---- */
a.btn { display: inline-flex; text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink); border-radius: 999px;
  padding: 7px 16px; font: 600 13.5px/1.2 var(--font); cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s;
}
.btn:hover { box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn[hidden] { display: none; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: middle;
}
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-bad, .badge-error { background: var(--bad-soft); color: var(--bad); }
.badge-neutral { color: var(--ink-3); }
.kind-chip {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); background: var(--surface);
}

/* Effort: the level name plus a 6-step meter (minimal .. max). --lvl is set per pill. */
.effort {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; white-space: nowrap;
  color: color-mix(in oklab, var(--accent) calc(var(--lvl, 0) * 14% + 16%), var(--ink-2));
}
.effort::before {
  content: ""; width: 29px; height: 9px; flex: none; border-radius: 1px;
  background: linear-gradient(90deg, currentColor calc(var(--lvl, 0) / 6 * 100%), var(--line-strong) 0);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 5px);
  mask: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 5px);
}
.effort[data-level="unknown"]::before { display: none; }

/* Model names: provider prefix quiet, model name strong. */
.model { display: inline-flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.model-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.model-provider { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.model-via { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
a:has(> .model) { text-decoration: none; }
a:hover > .model .model-name { text-decoration: underline; text-underline-offset: 3px; }

.best-tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--good); background: var(--good-soft); border-radius: 999px; padding: 0 7px; line-height: 1.7; white-space: nowrap;
}

/* ---- home ---- */
.hero { margin-bottom: 28px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  text-decoration: none; color: var(--ink); background: var(--surface); box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.card-media { position: relative; }
.card-media .kind-chip { position: absolute; top: 10px; left: 10px; box-shadow: var(--shadow); }
.card .thumb, .thumb-ph {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--ink-3); font-size: 13px; border-bottom: 1px solid var(--line);
}
.card .thumb-contain { object-fit: contain; background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 14px 14px; }
.card .card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .card-title { font-weight: 650; font-size: 1rem; line-height: 1.3; letter-spacing: -0.01em; }
.card .card-meta { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.model-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.model-chip {
  font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-foot { margin-top: auto; padding-top: 4px; display: flex; justify-content: space-between; gap: 8px; }

/* ---- prompt ---- */
.prompt-box {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 20px 18px; margin: 20px 0 0; box-shadow: var(--shadow);
}
.prompt-box[hidden] { display: none; }
.prompt-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin-bottom: 6px; }
.prompt-text { white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; }
.prompt-box .prompt-text { font-size: 1.12rem; line-height: 1.5; letter-spacing: -0.005em; max-width: 80ch; }
details.final-prompt { margin: 8px 0 0; font-size: 14px; }
details.final-prompt[hidden] { display: none; }
details.final-prompt summary { cursor: pointer; font-weight: 600; padding: 6px 4px; color: var(--ink-2); width: fit-content; }
details.final-prompt summary .muted { font-weight: 400; }
details.final-prompt .prompt-text {
  max-height: 40vh; overflow: auto; margin-top: 4px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface-2); font-size: 13.5px; color: var(--ink-2);
}

/* ---- highlights (page summary): one line of small chips ---- */
.highlights { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 18px; }
.highlights[hidden] { display: none; }
.hl {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 12.5px; min-width: 0; max-width: 100%;
  transition: border-color 0.15s;
}
a.hl:hover { border-color: var(--line-strong); }
.hl-label { font-weight: 600; color: var(--ink-3); }
.hl-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-sub { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); min-width: 0; }
.hl-sub .effort { font-size: 11.5px; }
.hl-sub .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hl-good .hl-value { color: var(--good); }

/* ---- table ---- */
.col-tip {
  position: fixed; z-index: 20; display: none; max-width: 320px; padding: 9px 12px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.45; white-space: pre-line;
  box-shadow: var(--shadow-lift); pointer-events: none;
}
.col-tip.show { display: block; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
table.runs { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.runs th, table.runs td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
table.runs tbody tr:last-child td { border-bottom: 0; }
table.runs th {
  cursor: pointer; user-select: none; color: var(--ink-3); font-weight: 600; font-size: 12px; letter-spacing: 0.01em;
  background: var(--surface-2); padding-top: 9px; padding-bottom: 9px;
}
table.runs th:first-child { border-top-left-radius: var(--r-lg); }
table.runs th:last-child { border-top-right-radius: var(--r-lg); }
table.runs th:hover { color: var(--ink); }
table.runs th.has-help { text-decoration: underline dotted; text-underline-offset: 4px; text-decoration-color: var(--line-strong); }
table.runs th.is-num, table.runs td.is-num { text-align: right; padding-left: 6px; padding-right: 6px; }
table.runs th[aria-sort] { color: var(--ink); }
table.runs th[aria-sort="ascending"]::after { content: " \2191"; color: var(--accent); }
table.runs th[aria-sort="descending"]::after { content: " \2193"; color: var(--accent); }
table.runs tbody tr.run-row:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
table.runs td.harness-cell, table.runs td.started-cell { color: var(--ink-3); font-size: 12.5px; }
table.runs td.started-cell { white-space: nowrap; }
.harness { display: inline-flex; flex-direction: column; line-height: 1.25; }
.harness-version { font-size: 11.5px; color: var(--ink-3); }
table.runs td[data-col="model"] { white-space: normal; }
table.runs td[data-col="model"] .model-name { overflow-wrap: anywhere; }
td.thumb-cell { padding: 6px 4px 6px 0; width: 1px; }
img.row-thumb {
  display: block; width: 96px; height: 56px; object-fit: cover; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2);
}
.thumb-none { display: flex; width: 96px; height: 56px; align-items: center; justify-content: center; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-3); }
.media-page img.row-thumb { object-fit: contain; background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 12px 12px; }

/* numeric cells: value on top, a thin bar scaled to the column max below */
.bar-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 56px; }
.bar-cell .val { font-variant-numeric: tabular-nums; }
.bar-cell .track { width: 100%; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; display: flex; justify-content: flex-end; }
.bar-cell .bar { display: block; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
td.is-best .val { color: var(--good); font-weight: 700; }
td.is-best .bar { background: var(--good); }
td.is-best .val::before { content: "\2605 "; font-size: 10px; vertical-align: 1px; }

tr.run-row { cursor: pointer; }
tr.run-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.run-row td:first-child { padding-left: 14px; padding-right: 4px; width: 1px; }
tr.run-row .caret {
  display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 4px;
  color: var(--ink-3); font-size: 11px; transition: transform 0.15s, background 0.15s;
}
tr.run-row:hover .caret { background: var(--surface-3); color: var(--ink); }
tr.run-row[aria-expanded="true"] .caret { transform: rotate(90deg); }
tr.run-row[aria-expanded="true"] td { border-bottom-color: transparent; background: var(--surface-2); }
/* Vendor grouping: a faint tint and a thin stripe in the vendor's hue (set as --vh by vendorOptions()). */
[data-vendor] { --vendor: hsl(var(--vh) 55% 48%); }
tr.run-row[data-vendor] { background: color-mix(in srgb, var(--vendor) 5%, transparent); }
tr.run-row[data-vendor] td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--vendor) 50%, transparent); }
tr.run-row.is-failed td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.run-row.is-failed .model-name { color: var(--ink-2); }
tr.run-detail td { white-space: normal; padding: 4px 16px 20px 44px; background: var(--surface-2); }
tr.run-detail:hover { background: none; }
.detail-inner { display: flex; flex-direction: column; gap: 10px; max-width: 960px; }
.check { color: var(--good); font-weight: 700; }

/* ---- run page ---- */
.run-header { margin-bottom: 18px; }
.run-header h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; }
.run-header h1 .effort { font-size: 15px; }
.metric-strip { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.stat {
  display: flex; flex-direction: column; gap: 1px; padding: 11px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); min-width: 0;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.stat-value { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-rank { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.stat-rank.is-best { color: var(--good); font-weight: 600; }
.run-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13.5px; color: var(--ink-2); }
.run-meta .k { color: var(--ink-3); margin-right: 4px; }

.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 5; background: var(--bg);
}
.tabs button {
  background: none; border: none; padding: 11px 14px 10px; font: 500 14px/1.2 var(--font); cursor: pointer; white-space: nowrap;
  color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 650; }
.tab-count {
  font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--surface-3); border-radius: 999px; padding: 0 6px; line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.tab-panel[hidden] { display: none; }

/* ---- game / play overlay ---- */
.game-frame {
  position: relative; width: 100%; max-width: 960px; aspect-ratio: 16 / 9; background: #000;
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
}
.game-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.play-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; cursor: pointer; color: #fff; background-size: cover; background-position: center; border: 0; padding: 0;
  font: 600 13px var(--font);
}
.play-overlay::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.15), var(--overlay)); transition: background 0.2s; }
.play-overlay:hover::before { background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.35)); }
.play-overlay .play-icon {
  position: relative; width: 60px; height: 60px; border-radius: 50%; background: rgba(255, 255, 255, 0.95);
  display: flex; align-items: center; justify-content: center; color: #111; font-size: 20px; padding-left: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); transition: transform 0.15s;
}
.play-overlay:hover .play-icon { transform: scale(1.07); }
.play-overlay .play-label { position: relative; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); letter-spacing: 0.02em; }
.game-links { margin-top: 10px; font-size: 13px; color: var(--ink-3); display: flex; gap: 6px 16px; flex-wrap: wrap; }

/* ---- transcript ---- */
.transcript-toolbar {
  display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; align-items: center;
}
.transcript-toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 4px 12px; font: 500 13px/1.4 var(--font); cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-active:hover { color: var(--bg); }

.transcript { max-width: 980px; }
.turn { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); margin-left: 5px; }
.turn::before {
  content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink-3);
}
.turn-system::before { border-color: var(--ink-3); }
.turn-user::before { border-color: var(--accent); background: var(--accent); }
.turn-assistant::before { border-color: var(--ink-2); }
.turn-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.role-badge { font-weight: 700; color: var(--ink); font-size: 12.5px; }
.turn-head .elapsed { font-family: var(--mono); font-size: 11.5px; }
.turn-head .usage { margin-left: auto; font-family: var(--mono); font-size: 11.5px; }
.turn-user > .content-plain {
  background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; font-size: 14px; max-width: 80ch;
}
.content-plain { white-space: pre-wrap; word-break: break-word; }
.content-md { max-width: 80ch; overflow-wrap: anywhere; }
.content-md :first-child { margin-top: 0; }
.content-md :last-child { margin-bottom: 0; }
.content-md p, .content-md ul, .content-md ol { margin: 0 0 0.6em; }
.content-md code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }
.content-md pre { background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--r-sm); overflow-x: auto; font-size: 13px; }
.content-md pre code { background: none; padding: 0; }

.thinking-block {
  display: none; white-space: pre-wrap; color: var(--ink-2); font-style: italic; font-size: 13.5px;
  border-left: 2px dashed var(--line-strong); padding: 2px 0 2px 10px; margin: 6px 0; max-width: 80ch;
}
.transcript[data-show-thinking="true"] .thinking-block { display: block; }

.tool-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin: 8px 0; overflow: hidden; }
.tool-block:has(.badge-error) { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.tool-head { display: flex; gap: 10px; align-items: center; padding: 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.tool-name { font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: var(--ink); }
.tool-duration { color: var(--ink-3); font-size: 11.5px; font-family: var(--mono); margin-left: auto; }
.tool-path { font-family: var(--mono); font-size: 12.5px; padding: 8px 12px 0; color: var(--ink-2); overflow-wrap: anywhere; }
pre.cmd, pre.code, pre.out, pre.tool-args {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--surface-2);
  padding: 8px 10px; border-radius: var(--r-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 4px 0;
}
.tool-block > pre.cmd, .tool-block > pre.code, .tool-block > pre.out, .tool-block > pre.tool-args, .tool-block > details { margin: 8px 12px; }
.tool-block > :last-child { margin-bottom: 12px; }
details.out-collapse > pre { margin: 6px 0 0; }
figure.tool-image { margin: 8px 12px; }
figure.tool-image img { display: block; max-width: min(320px, 100%); height: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
figure.tool-image figcaption { margin-top: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
pre.cmd { background: transparent; padding: 0; color: var(--ink); font-weight: 600; }
pre.code { max-height: 26em; overflow-y: auto; }
pre.out { color: var(--ink-2); }
pre.out-error { box-shadow: inset 3px 0 0 var(--bad); background: var(--bad-soft); color: var(--ink); }
pre.diff-old { box-shadow: inset 3px 0 0 var(--bad); background: var(--bad-soft); }
pre.diff-new { box-shadow: inset 3px 0 0 var(--good); background: var(--good-soft); }
details.system-block summary, details.out-collapse summary { cursor: pointer; color: var(--ink-2); font-size: 13px; width: fit-content; }
details.system-block .content-plain { margin-top: 8px; font-size: 13px; color: var(--ink-2); max-height: 50vh; overflow: auto; background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-sm); }

.transcript[data-filter="tools"] .turn:not([data-has-tool="1"]) { display: none; }
.transcript[data-filter="errors"] .turn:not([data-has-error="1"]) { display: none; }

/* ---- source tab ---- */
.source-layout { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
.source-files {
  display: flex; flex-direction: column; gap: 1px; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); position: sticky; top: 56px; max-height: 75vh; overflow: auto;
}
.source-files button {
  display: block; width: 100%; text-align: left; background: none; border: none; padding: 6px 9px;
  color: var(--ink-2); cursor: pointer; border-radius: var(--r-sm); font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere;
}
.source-files button:hover { background: var(--surface-2); color: var(--ink); }
.source-files button.active { background: var(--ink); color: var(--bg); }
.source-view { min-width: 0; }
.source-view pre {
  margin: 0; background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; border-radius: var(--r);
  overflow: auto; max-height: 75vh; font-size: 12.5px; line-height: 1.55; tab-size: 4;
}

/* ---- metrics tab ---- */
table.metrics { border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; min-width: min(100%, 520px); }
table.metrics td { padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: top; }
table.metrics tr:last-child td { border-bottom: 0; }
table.metrics td:first-child { color: var(--ink-3); font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
table.metrics td:nth-child(2) { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
table.metrics .hint { color: var(--ink-3); margin-left: 8px; }
.downloads { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.downloads .k { color: var(--ink-3); margin-right: 4px; }
.downloads a { font-family: var(--mono); font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; }
.downloads a:hover { background: var(--accent-soft); }

/* ---- compare ---- */
/* Cards are grouped by vendor: a quiet label in the vendor's hue with a run count and a thin rule, no box. */
.vendor-groups { display: flex; flex-direction: column; gap: 26px; }
.vendor-head {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; padding-bottom: 6px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: color-mix(in srgb, var(--vendor) 75%, var(--ink));
  border-bottom: 1px solid color-mix(in srgb, var(--vendor) 30%, var(--line));
}
.vendor-count { color: var(--ink-3); font-weight: 500; letter-spacing: 0; text-transform: none; }
/* A grid: as many ~380px columns as fit, wrapping into more rows (one column on phones). */
.compare-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); column-gap: 18px; }
/* Each card spans three rows of the grid (heading, metrics, output) as a subgrid, so those line up across a row of cards. */
.compare-col {
  grid-row: span 3; display: grid; grid-template-rows: subgrid; row-gap: 10px; margin-bottom: 18px;
  min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; background: var(--surface);
  box-shadow: var(--shadow);
}
.compare-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.compare-col[data-vendor] { background: color-mix(in srgb, var(--vendor) 4%, var(--surface)); box-shadow: inset 0 3px 0 color-mix(in srgb, var(--vendor) 50%, transparent), var(--shadow); }
.compare-col.is-failed { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.compare-col h3 { margin: 0; font-size: 1rem; display: flex; align-items: flex-start; gap: 6px 12px; flex-wrap: wrap; justify-content: space-between; }
.card-title { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.card-title > a { min-width: 0; }
.card-tags { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-tags .effort { margin-top: 0; }
.compare-col .rank-chip { font-size: 1.25rem; }
input.run-select { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
/* Few runs (compare, up to 4): equal columns filling the page, two across on mid widths, one on phones. */
.compare-columns.is-few { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
@media (max-width: 1000px) { .compare-columns.is-few { grid-template-columns: repeat(var(--cols-mid), minmax(0, 1fr)); } }
@media (max-width: 640px) { .compare-columns.is-few { grid-template-columns: minmax(0, 1fr); } }
/* page.html's grid: denser cards, the harness dropped from the metrics line (it is on the run page and in the table). */
.compare-columns.is-dense { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.is-dense .compare-col { padding: 12px; }
.is-dense .compare-metrics .harness-label, .is-dense .compare-metrics .harness-label + .sep { display: none; }
.is-dense .compare-metrics { font-size: 12.5px; }
.compare-col .run-error, .compare-col .msg { margin: 0; }
.compare-metrics { font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 2px 0; font-variant-numeric: tabular-nums; }
.compare-metrics b { color: var(--ink); font-weight: 650; }
.compare-metrics .is-best b { color: var(--good); }
.compare-metrics .sep { margin: 0 7px; }
.compare-col .game-frame { border-radius: var(--r-sm); }

/* ---- media outputs (kind "media") ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.media-item { margin: 0; min-width: 0; }
.media-box {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r);
  background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 16px 16px;
}
.media-box img, .media-box video { display: block; width: 100%; height: 100%; object-fit: contain; }
.media-item figcaption { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; overflow-wrap: anywhere; display: flex; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.media-item figcaption a { flex: none; }
.media-box { position: relative; }
.media-link { display: block; width: 100%; height: 100%; }
/* The run page's gallery: one output per row at its own size, never wider than the page. */
.media-grid.is-full { grid-template-columns: minmax(0, 1fr); }
.media-grid.is-full .media-item { width: fit-content; max-width: 100%; }
.media-full {
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 16px 16px;
}
.media-full img, .media-full video { display: block; max-width: 100%; height: auto; }
.compare-col .media-box { border-radius: var(--r-sm); }
/* "3 files · 1 video" (cards) / "×3" (table thumbnail): in the corner of the media, readable on any image. */
.media-count {
  position: absolute; top: 6px; right: 6px; z-index: 1; padding: 1px 8px; border-radius: 999px; pointer-events: none;
  background: rgba(14, 14, 12, 0.72); color: #fff; font: 600 12px/1.6 var(--font); white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* A media card: the hero (fixed 4:3 box) and below it one fixed-height strip of thumbnails that swap the hero. */
.media-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.media-strip { display: flex; gap: 6px; height: 46px; overflow-x: auto; scrollbar-width: thin; }
.media-thumb {
  position: relative; flex: none; width: 60px; height: 100%; padding: 0; overflow: hidden; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--r-sm); background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 10px 10px;
}
.media-thumb:hover { border-color: var(--line-strong); }
.media-thumb[aria-current="true"] { border-color: var(--accent); }
.media-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.media-thumb.is-video::after {
  content: "\25B6"; position: absolute; right: 2px; bottom: 2px; font-size: 8px; line-height: 1; color: #fff;
  background: rgba(14, 14, 12, 0.72); padding: 2px 3px 2px 4px; border-radius: 3px;
}

/* ---- runs: view toggle, filter bar, selection ---- */
.view-toggle { display: inline-flex; gap: 4px; }
.view-toggle .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.run-grid[hidden] { display: none; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 0 0 16px; }
.filters[hidden] { display: none; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-right: 2px; }
.filter-chip { padding: 2px 10px; font-size: 12.5px; }
.filter-chip[data-vendor] { border-color: color-mix(in srgb, var(--vendor) 45%, var(--line-strong)); background: color-mix(in srgb, var(--vendor) 7%, var(--surface)); }
.filter-chip.chip-active[data-vendor] { background: var(--vendor); border-color: var(--vendor); color: #fff; }
.filter-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.filter-clear { background: none; border: 0; padding: 2px 4px; color: var(--accent); font: 500 13px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.select-bar {
  position: fixed; left: 50%; bottom: 18px; z-index: 30; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 18px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  box-shadow: var(--shadow-lift); font-size: 14px; font-weight: 600; white-space: nowrap; max-width: calc(100vw - 24px);
}
.select-bar[hidden] { display: none; }
td.select-cell { white-space: nowrap; }
td.select-cell input.run-select { vertical-align: middle; margin: 0 6px 0 0; }
.thumb-box { position: relative; }
.thumb-box .media-count { top: 4px; right: 4px; padding: 0 6px; font-size: 11px; }

/* ---- phones ---- */
/* ---- your ranking ---- */
td.rank-cell { width: 1%; text-align: center; }
td.rank-cell .rank { font-size: 1.35rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.rank-select {
  font: inherit; font-size: 13px; padding: 3px 4px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.rank-status { font-size: 12.5px; color: var(--ink-3); }
.rank-status.is-error { color: var(--bad); }
.rank-chip { font-size: 1rem; line-height: 1; }

/* Runs table below the full 1240px page: hide columns by priority (least important first) so it never scrolls.
   Model, effort, verified, duration and cost always stay; the rest is on the run page and in compare. */
@media (min-width: 721px) and (max-width: 1199px) {
  table.runs th[data-key="tokens_reasoning"], table.runs td[data-col="tokens_reasoning"] { display: none; }
}
@media (min-width: 721px) and (max-width: 959px) {
  table.runs th[data-key="harness"], table.runs td[data-col="harness"],
  table.runs th[data-key="tool_calls"], table.runs td[data-col="tool_calls"] { display: none; }
}
@media (min-width: 721px) and (max-width: 799px) {
  table.runs th[data-key="thumb"], table.runs td[data-col="thumb"] { display: none; }
  tr.run-row .caret { display: none; }
  tr.run-row td:first-child { padding-left: 8px; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 14.5px; }
  h1 { font-size: 1.5rem; }
  .site-header { margin-bottom: 22px; }
  .prompt-box { padding: 14px 16px; }
  .prompt-box .prompt-text { font-size: 1.02rem; }
  .source-layout { grid-template-columns: minmax(0, 1fr); }
  .source-files { position: static; max-height: 200px; }
  .stat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 9px 10px; }
  .stat-value { font-size: 1.08rem; }
  .turn { padding-left: 16px; }
  .select-bar { bottom: 10px; padding-left: 14px; gap: 8px; }
  .filters { gap: 10px; }

  .tabs button { padding: 10px 10px 9px; }
  .page-meta .last-run { display: none; }

  /* The runs table becomes a list of cards: header cells turn into sort chips, each row a small grid. */
  .table-wrap { overflow: visible; background: none; border: 0; box-shadow: none; border-radius: 0; }
  table.runs, table.runs thead, table.runs tbody { display: block; }
  table.runs thead tr { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
  table.runs th { border: 1px solid var(--line-strong); border-radius: 999px !important; padding: 3px 10px; background: var(--surface); text-decoration: none !important; }
  table.runs th:nth-child(-n+2), table.runs th[data-key="harness"], table.runs th[data-key="verified"] { display: none; }
  table.runs th[aria-sort] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  table.runs th[aria-sort]::after { color: inherit; }
  table.runs tr.run-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 10px; padding: 12px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  }
  table.runs tr.run-row[aria-expanded="true"] { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; background: var(--surface); }
  table.runs tr.run-row[aria-expanded="true"] td { background: none; }
  table.runs tr.run-row[data-vendor] { background: color-mix(in srgb, var(--vendor) 5%, var(--surface)); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--vendor) 50%, transparent), var(--shadow); }
  table.runs tr.run-row[data-vendor] td:first-child { box-shadow: none; }
  table.runs tr.run-row.is-failed { box-shadow: inset 3px 0 0 var(--bad), var(--shadow); }
  table.runs td { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; text-align: left !important; }
  table.runs tr.run-row { position: relative; }
  table.runs td.select-cell { position: absolute; top: 12px; right: 12px; padding: 0; }
  td.select-cell input.run-select { width: 20px; height: 20px; margin: 0; }
  td.select-cell .caret { display: none; }
  table.runs td[data-col="model"] { padding-right: 28px; }
  table.runs td.thumb-cell { grid-row: 1 / span 2; grid-column: 1; width: auto; padding: 0; }
  img.row-thumb, .thumb-none { width: 100%; height: auto; aspect-ratio: 16 / 10; }
  table.runs td[data-col="model"] { grid-column: 2 / -1; }
  table.runs td[data-col="effort"] { grid-column: 2; display: flex; align-items: center; }
  table.runs td[data-col="verified"] { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
  table.runs td[data-col="rank"] { grid-column: 1; grid-row: 3; order: 0; text-align: left !important; width: auto; }
  table.runs td[data-col="rank"]:has(> .muted) { display: none; }
  table.runs td[data-col="harness"], table.runs td[data-col="tokens_reasoning"] { display: none; }
  table.runs td.is-num::before { content: attr(data-label); display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; margin-bottom: 1px; }
  table.runs td[data-col="started_at"] { grid-column: 1 / -1; order: 3; }
  table.runs td[data-col="cost_usd"] { order: 1; }
  table.runs td[data-col="tokens_total"], table.runs td[data-col="tool_calls"] { order: 2; }
  .bar-cell { display: flex; align-items: stretch; min-width: 0; }
  table.runs tr.run-detail { display: block; margin-bottom: 10px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); overflow: hidden; }
  table.runs tr.run-detail td { display: block; padding: 12px; }
}

/* play.html: one run's output alone in a window */
body.play { margin: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.play-bar { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; white-space: nowrap; overflow: hidden; }
.play-bar .model { flex-direction: row; gap: 8px; align-items: baseline; min-width: 0; }
.play-bar .model-name, .play-bar .model-provider, .play-bar .model-via { overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.play-bar a:last-child { margin-left: auto; font-size: 13px; }
.play-main { flex: 1; min-height: 0; overflow: auto; }
.play-frame, .play-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.play-main .media-grid { padding: 16px; }
.play-main > .msg, .play-main > .run-error { margin: 16px; }

/* the compare card's "open in its own window" button */
.popout { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; color: var(--ink-3); text-decoration: none; font-size: 14px; vertical-align: middle; }
.popout:hover { color: var(--ink); background: var(--surface-2); }
.popout:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
