:root {
  color-scheme: light dark;
  --paper: #f7f7f2;
  --panel: #fff;
  --ink: #182625;
  --muted: #485956;
  --line: #d4ddd6;
  --accent: #0c6253;
  --wash: #ebf3ed;
  --track: #dbe7df;
  --hero: #142d28;
  --hero-ink: #f5faf6;
  --hero-muted: #bbd3c6;
  font: 16px/1.55 system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161e1c;
    --panel: #1e2926;
    --ink: #edf4ee;
    --muted: #b4c5bb;
    --line: #42554b;
    --accent: #96dac5;
    --wash: #263b34;
    --track: #344c42;
    --hero: #203f34;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
main { width: min(calc(100% - 3rem), 68rem); margin-inline: auto; padding: 1.35rem 0 4rem; }
h1, h2 { line-height: 1.04; letter-spacing: -.045em; margin: 0 0 .75rem; }
h1 { font-size: clamp(2.45rem, 6.35vw, 5.4rem); max-width: 11ch; }
h2 { font-size: clamp(1.75rem, 4vw, 2.65rem); }
p { margin: .65rem 0 1rem; }
a { color: var(--accent); text-underline-offset: .24em; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, monospace; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.5rem; margin-bottom: 2rem; font-size: .88rem; }
.section-links { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.section-links a { color: var(--muted); }
main > section { margin-top: clamp(2.75rem, 6vw, 4.5rem); scroll-margin-top: 1rem; }
.label { font: 700 .76rem/1.3 ui-monospace, monospace; letter-spacing: .09em; text-transform: uppercase; }
.eyebrow { color: var(--accent); margin: 0 0 1rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(1.25rem, 4vw, 4rem); align-items: center; }
.intro { max-width: 31rem; font-size: clamp(1.1rem, 2.3vw, 1.35rem); }
.credit { font-size: .86rem; margin-bottom: 0; }

.specimen {
  min-width: 0;
  margin: 0;
  padding: 1rem;
  border-radius: .9rem;
  background: var(--hero);
  color: var(--hero-ink);
}
.specimen figcaption { display: flex; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; color: var(--hero-muted); }
.specimen-color { display: block; min-height: clamp(5rem, 13vw, 9.25rem); border-radius: .4rem; background: var(--swatch); }
.specimen-code { margin: .55rem 0 .75rem; font-size: 1.2rem; }
.palette { display: flex; gap: .23rem; }
.palette span { flex: 1; min-height: .48rem; border-radius: .12rem; background: var(--swatch); }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin: 1.35rem 0; }
.summary-card { margin: 0; padding: .78rem .95rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--panel); }
.summary-card:first-child { background: var(--wash); }
.summary-card dt { color: var(--muted); }
.summary-card dd { margin: .15rem 0 0; }
.summary-card strong { display: block; font-size: clamp(1.35rem, 3vw, 1.9rem); letter-spacing: -.03em; line-height: 1.2; }
.summary-card small { overflow-wrap: anywhere; }

.table-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: .65rem; }
table { border-spacing: 0; width: 100%; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: .62rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { background: var(--wash); color: var(--ink); font-weight: 700; font-size: .86rem; }
tbody tr:last-child > *, tfoot tr:last-child > * { border-bottom: 0; }
tfoot { background: var(--wash); }
tfoot th, tfoot td { border-top: 1px solid var(--line); }
.number { text-align: right; white-space: nowrap; }
.score { display: grid; grid-template-columns: minmax(2.4rem, 5.75rem) 2.8rem; justify-content: end; align-items: center; gap: .6rem; }
.score-track { height: .33rem; border-radius: 1rem; background: var(--track); }
.score-track i { display: block; width: var(--bar); height: 100%; border-radius: inherit; background: var(--accent); }
.best { font-weight: 750; color: var(--accent); }
.swatch-group-table th { white-space: nowrap; }
details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 650; width: fit-content; }
details .table-wrap { margin-top: .7rem; }

.controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: .65rem; margin: 1rem 0 .65rem; }
.controls label { display: grid; gap: .25rem; min-width: 0; font-size: .86rem; font-weight: 650; }
select { width: 100%; min-height: 2.5rem; font: inherit; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: .4rem; padding: .4rem; }
select:disabled { opacity: .64; }
.control-footer { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .88rem; }
.control-footer label { display: inline-flex; align-items: center; gap: .35rem; }
input[type="checkbox"] { accent-color: var(--accent); width: 1rem; height: 1rem; }
.swatch-wrap { max-height: min(70svh, 38rem); scroll-padding: 3rem 0 0 7rem; overscroll-behavior: contain; }
#swatches thead th { position: sticky; top: 0; z-index: 2; }
#swatches tr > :first-child { position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); background: var(--panel); }
#swatches thead tr > :first-child { z-index: 3; background: var(--wash); }
.sample { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.chip { display: inline-block; width: 2rem; height: 1.65rem; flex: none; background: var(--swatch); border-radius: .22rem; border: 1px solid var(--line); }
.answer-detail { display: block; margin: .05rem 0 0 2.5rem; white-space: nowrap; }
.model-cell { min-width: 7.4rem; }
.swatch-group { white-space: nowrap; }
.raw { overflow-wrap: anywhere; white-space: pre-wrap; }
blockquote { margin: 1rem 0; padding: .72rem 1rem; border-left: .2rem solid var(--accent); border-radius: .15rem .4rem .4rem .15rem; background: var(--wash); }
ul { padding-left: 1.3rem; }
.downloads { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0; }
.downloads a { background: var(--panel); border: 1px solid var(--line); border-radius: .4rem; padding: .45rem .65rem; font-weight: 650; }

@media (max-width: 46rem) {
  main { width: calc(100% - 1.5rem); }
  nav { margin-bottom: 1.45rem; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 34rem) {
  th, td { padding: .5rem .38rem; font-size: .85rem; }
  thead th { font-size: .74rem; }
  .score { grid-template-columns: auto; }
  .score-track { display: none; }
  .summary-grid { gap: .36rem; }
  .summary-card { padding: .55rem .43rem; }
  .summary-card .label { font-size: .66rem; letter-spacing: .035em; }
  .chip { width: 1.55rem; height: 1.35rem; }
  .sample { gap: .3rem; }
  .answer-detail { margin-left: 1.85rem; }
  .model-cell { min-width: 5.9rem; }
  .swatch-group { white-space: normal; }
}
