:root {
  --bg: #101113;
  --panel: #17191c;
  --panel-2: #1d2024;
  --line: #2a2e33;
  --text: #eef0f2;
  --dim: #9aa1a9;
  --dim-strong: #b6bdc4;
  --green: #6aaa64;
  --gold: #c9a227;
  --violet: #9d8ceb;
  --danger: #d9584a;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

main { max-width: 1220px; margin: 0 auto; padding: 0 20px 40px; }

a { color: var(--text); }
a:hover { text-decoration: underline; }

button:focus-visible, .tab:focus-visible, .ghost:focus-visible, a:focus-visible,
.table-wrap:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ---------- masthead ---------- */

.masthead {
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 20px 18px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 16px; align-items: flex-start; }

.mark { display: grid; grid-template-columns: repeat(5, 14px); gap: 3px; padding-top: 6px; }
.mark i {
  width: 14px; height: 14px; border-radius: 3px;
  background: #24272c; border: 1px solid #32373d; display: block;
}
.mark i.hit { background: var(--green); border-color: var(--green); }

h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -0.01em; }
.tagline { margin: 0; color: var(--dim); max-width: 62ch; font-size: 14px; }

.today { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--dim); }
.today .label { display: block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.today strong { color: var(--text); font-size: 17px; display: block; }
.today .sub { display: block; font-size: 11px; }

/* ---------- tabs ---------- */

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0 14px; }

.tab {
  appearance: none;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--green));
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, transform 0.15s;
}

.tab:hover { background: var(--panel-2); transform: translateY(-1px); }
.tab .row1 { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.tab .model { display: block; font-weight: 650; margin: 3px 0 2px; }
.tab .quant { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.tab[aria-selected="true"] { background: var(--panel-2); }
.tab[aria-selected="true"] .model { color: var(--accent, var(--green)); }
.tab kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--dim);
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: #5c6269; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--danger); }
.dot.checking { background: var(--gold); }

/* ---------- stage ---------- */

.stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.stage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.stage-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.stage-id .quant, .stage-id .appname { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.stage-actions { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.status { font-family: var(--mono); color: var(--dim-strong); }

button, .ghost {
  font: inherit; font-size: 12px;
  background: #23262b; color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 10px; text-decoration: none; cursor: pointer;
}
button:hover, .ghost:hover { border-color: var(--dim); }

/* The clones are taller than they are wide-friendly: the box is sized so the
   clone's own keyboard is inside the frame instead of below its fold. */
.frame-wrap {
  position: relative;
  height: max(780px, calc(100vh - 150px));
  background: #0c0d0f;
}
.frame-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; display: none; background: #fff;
}
.frame-wrap iframe.active { display: block; }

.frame-loading {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 10px;
  background: var(--panel); color: var(--dim); font-size: 13px; z-index: 2;
}
.frame-loading[hidden] { display: none; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; justify-self: center;
  border: 2px solid #33383e; border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.placeholder {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center;
  gap: 8px; text-align: center; padding: 40px; font-size: 14px;
  background: var(--panel); color: var(--text);
}
.placeholder p { margin: 0; color: var(--dim-strong); font-family: var(--mono); font-size: 12.5px; }
.placeholder .row { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }

.stage-foot { margin: 0; padding: 10px 14px 0; font-size: 12.5px; color: var(--dim-strong); }
.stage-hint { margin: 6px 14px 12px; font-size: 12px; color: var(--dim); }

/* ---------- facts chips ---------- */

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 34px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); padding: 6px 12px; font-size: 12.5px; color: var(--dim);
}
.chip b { color: var(--text); font-family: var(--mono); font-weight: 600; }

/* ---------- comparison table ---------- */

.compare h2, .notes h2 { font-size: 17px; margin: 0 0 6px; }
.lede { color: var(--dim); font-size: 13.5px; max-width: 78ch; margin: 0 0 16px; }

/* Scrollport so the sticky header actually sticks. */
.table-wrap {
  overflow: auto; max-height: 74vh;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
}
table { border-collapse: collapse; width: 100%; min-width: 880px; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2); text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--line); font-weight: 650;
}
thead th button {
  background: none; border: 0; padding: 0; color: inherit; font: inherit;
  font-weight: 650; cursor: pointer; text-align: left;
}
thead th button:hover { text-decoration: underline; }
thead th small { display: block; font-family: var(--mono); font-weight: 400; color: var(--dim); font-size: 11px; }
th.metric, td.metric { width: 24%; color: var(--dim); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #1a1d21; }
td.col-selected { background: rgba(255, 255, 255, 0.085); box-shadow: inset 2px 0 0 var(--col-accent, var(--green)); }
td.num { font-family: var(--mono); }
details.method { margin-top: 6px; }
details.method summary {
  cursor: pointer; font-size: 11.5px; color: var(--dim);
  font-family: var(--mono); list-style: none;
}
details.method summary::after { content: " +"; color: var(--dim-strong); }
details.method[open] summary::after { content: " −"; color: var(--dim-strong); }
details.method p { margin: 6px 0 0; font-size: 12px; color: var(--dim-strong); }

/* Under 760px the table becomes one block per metric: no horizontal scrolling. */
@media (max-width: 760px) {
  table { min-width: 0; }
  thead { display: none; }
  tbody tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  tbody td { display: block; border: 0; padding: 4px 0; }
  td.metric { width: auto; color: var(--text); font-weight: 650; }
  td[data-colname]::before {
    content: attr(data-colname); display: block;
    font-family: var(--mono); font-size: 11px; color: var(--dim);
  }
  td.col-selected { box-shadow: none; background: rgba(255, 255, 255, 0.06); border-radius: 6px; }
  .table-wrap { max-height: none; }
}

/* ---------- notes + footer ---------- */

.notes { margin-top: 34px; }
.notes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.notes-grid > div {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 14px 16px;
}
.notes-grid h3 { margin: 0 0 6px; font-size: 14px; }
.notes-grid p { margin: 0; color: var(--dim); font-size: 13px; }
code { font-family: var(--mono); font-size: 12.5px; background: #22262b; padding: 1px 5px; border-radius: 4px; }

.site-foot {
  max-width: 1220px; margin: 0 auto; padding: 18px 20px 34px;
  border-top: 1px solid var(--line); color: var(--dim); font-size: 12.5px;
  font-family: var(--mono);
}
.site-foot a { color: var(--dim); }
.sep { margin: 0 8px; opacity: 0.5; }

@media (max-width: 900px) {
  .tabs { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
  .today { text-align: left; }
  .frame-wrap { height: 900px; }
}

@media (max-width: 520px) {
  .frame-wrap { height: 960px; }
  .stage-head { padding: 8px 12px; gap: 8px; }
  /* One line each: a wrapped model name alone used to cost 60px of stage. */
  .stage-id { flex-wrap: nowrap; font-size: 13px; min-width: 0; }
  .stage-id strong {
    font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .stage-id .quant, .stage-id .appname { display: none; }
  .stage-actions { width: 100%; flex-wrap: nowrap; justify-content: space-between; }
  .status { flex: 1 1 auto; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  h1 { font-size: 19px; }
}
