:root {
  --bg: #0E1024;
  --surface: #151833;
  --surface-2: #1C2042;
  --line: #2A2F57;
  --text: #ECEAF6;
  --muted: #9AA0B8;
  --accent: #FFB45E;
  --haiku: #7FD6C2;
  --sonnet: #AFA4FF;
  --opus: #FFB45E;
  --hit: #8FD694;
  --fail: #FF8A7A;
  --radius: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
h1, h2, h3 { font-family: "Bricolage Grotesque", "Figtree", sans-serif; line-height: 1.2; margin: 0; }
h1 { font-size: 44px; font-weight: 700; margin: 24px 0 12px; letter-spacing: -0.5px; }
h2 { font-size: 28px; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: 16px; font-weight: 500; color: var(--muted); margin: 20px 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
section.wrap { padding-top: 48px; }
.top { padding-top: 24px; }
.nav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.lede { max-width: 720px; color: var(--text); margin: 0 0 16px; }
.flow {
  margin: 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--muted); overflow-x: auto; white-space: pre;
}

/* try the router */
.try { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
.label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
textarea {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; font: inherit; font-size: 15px; resize: vertical; line-height: 1.5;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.try-out { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.decision { display: flex; align-items: center; gap: 12px; }
.tier {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 20px; padding: 4px 12px;
  border-radius: var(--radius); background: var(--surface-2); min-width: 72px; text-align: center;
}
.tier.easy { color: var(--haiku); }
.tier.hard { color: var(--opus); }
.model-name { font-weight: 600; }
.meter { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; margin: 16px 0 4px; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--haiku); width: 0; transition: width 120ms ease-out; }
.meter-fill.hard { background: var(--opus); }
.meter-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); font-size: 14px; }
.reasons li:first-child { border-top: 0; }
.w { font-family: ui-monospace, Menlo, monospace; font-weight: 600; }
.w.pos { color: var(--opus); }
.w.neg { color: var(--haiku); }
.try-out code { word-break: break-all; color: var(--text); }

/* recorded run */
.recorded { display: inline-block; font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; margin: 0 0 16px; }
.recorded strong { color: var(--accent); font-weight: 600; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.total { background: var(--surface); padding: 16px; min-width: 0; }
.total .v { font-family: "Bricolage Grotesque", sans-serif; font-size: 28px; font-weight: 700; }
.total .k { font-size: 14px; color: var(--muted); }
.total .s { font-size: 13px; color: var(--muted); }
.spend { margin-top: 24px; }
.bar-row { display: grid; grid-template-columns: 220px 1fr 96px; gap: 12px; align-items: center; margin: 8px 0; font-size: 14px; }
.bar { height: 16px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }
.bar-row .amt { text-align: right; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.timeline { display: grid; grid-template-columns: repeat(40, 1fr); gap: 4px; }
.cell {
  height: 36px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; position: relative;
  background: var(--surface-2);
}
.cell.m-haiku { background: var(--haiku); }
.cell.m-sonnet { background: var(--sonnet); }
.cell.m-opus { background: var(--opus); }
.cell.hit { background: transparent; border: 2px solid var(--hit); }
.cell.fb::after { content: ""; position: absolute; left: 50%; top: -6px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--fail); }
.cell.sel { outline: 2px solid var(--text); outline-offset: 2px; }

.table { margin-top: 24px; border-top: 1px solid var(--line); }
.tr { display: grid; grid-template-columns: 40px minmax(0, 1fr) 56px 96px 120px 88px 80px 88px; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.tr.head { color: var(--muted); font-size: 13px; cursor: default; }
.tr:not(.head):hover { background: var(--surface); }
.tr.sel { background: var(--surface-2); }
.tr .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.tag.hit { color: var(--hit); border-color: var(--hit); }
.tag.fb { color: var(--fail); border-color: var(--fail); }
.mdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.detail { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.detail h4 { font-family: "Bricolage Grotesque", sans-serif; font-size: 20px; margin: 0 0 8px; }
.detail .meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.detail .meta b { color: var(--text); font-weight: 600; }
.detail pre { white-space: pre-wrap; word-wrap: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0 0; max-height: 480px; overflow-y: auto; font-size: 13px; line-height: 1.55; }
.attempts { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.attempts li { padding: 4px 0; }
.ok { color: var(--hit); }
.bad { color: var(--fail); }

/* eval */
.eval-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 16px 0; }
.eval-grid .total .v.bad { color: var(--fail); }
.mis { border-top: 1px solid var(--line); padding: 12px 0; }
.mis .h { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.mis .h b { font-weight: 600; }
.mis p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.notes { padding-left: 20px; color: var(--muted); max-width: 820px; }
.notes li { margin: 8px 0; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 48px; padding-bottom: 48px; font-size: 14px; }

@media (max-width: 860px) {
  h1 { font-size: 34px; }
  .try { grid-template-columns: 1fr; }
  .totals, .eval-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline { grid-template-columns: repeat(20, 1fr); }
  .tr { grid-template-columns: 28px minmax(0, 1fr) 80px 72px; }
  .tr .c-route, .tr .c-tok, .tr .c-lat, .tr .c-cache { display: none; }
  .bar-row { grid-template-columns: 1fr 72px; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
}
