/* ==========================================================================
   PORT/9 — Abuse web port showcase

   A quiet editorial system. The page is one paper ground in both themes,
   structured by hairlines rather than by slabs of colour.

   Three rules hold the whole thing together:

     Type   — one sans for everything, mono for micro-labels, and a serif
              reserved for numerals. No display face.
     Colour — the accent marks interaction and nothing else; the grade tones
              mark status and nothing else. Everything else is ink on paper.
     Depth  — surfaces differ by a step of value, never by a border-radius,
              a shadow, or a gradient.

   1  Tokens
   2  Base
   3  Header
   4  Hero
   5  Section shell
   6  Leaderboard
   7  Gallery
   8  Matrix
   9  Method
   10 Footer
   11 Player
   12 Notes reader
   13 Responsive
   14 Reduced motion
   ========================================================================== */

/* 1 — Tokens ============================================================== */

:root {
  color-scheme: light;

  /* ground — three steps of value, nothing else */
  --surface: #f4f3ef;
  --surface-raised: #fbfaf7;
  --surface-sunken: #eceae4;
  --on-surface: #1c1c1a;
  --on-surface-muted: #55544f;
  --on-surface-faint: #63625c;
  --line: rgba(28, 28, 26, 0.11);
  --line-strong: rgba(28, 28, 26, 0.22);

  /* data bars — magnitude is length, so the fill stays ink */
  --track: rgba(28, 28, 26, 0.1);
  --track-fill: rgba(28, 28, 26, 0.4);

  /* the one accent: interaction and wayfinding */
  --signal: #a8492c;
  --focus: #2f5bd6;

  /* the one status scale: grade, nothing else */
  --tone-pass: #3f6d54;
  --tone-partial: #82601a;
  --tone-fail: #a3462f;

  /* type */
  --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: Iowan Old Style, Palatino, Baskerville, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --shell: min(calc(100% - 3rem), 1320px);

  font-family: var(--font-ui);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --surface: #131412;
  --surface-raised: #1a1b18;
  --surface-sunken: #0e0f0d;
  --on-surface: #eceae4;
  --on-surface-muted: #a3a29a;
  --on-surface-faint: #8a8981;
  --line: rgba(236, 234, 228, 0.13);
  --line-strong: rgba(236, 234, 228, 0.26);

  --track: rgba(236, 234, 228, 0.12);
  --track-fill: rgba(236, 234, 228, 0.42);

  --signal: #dd8a6c;
  --focus: #7ea2ff;

  --tone-pass: #74b795;
  --tone-partial: #c99f57;
  --tone-fail: #d9836c;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme='auto'] {
    color-scheme: dark;

    --surface: #131412;
    --surface-raised: #1a1b18;
    --surface-sunken: #0e0f0d;
    --on-surface: #eceae4;
    --on-surface-muted: #a3a29a;
    --on-surface-faint: #8a8981;
    --line: rgba(236, 234, 228, 0.13);
    --line-strong: rgba(236, 234, 228, 0.26);

    --track: rgba(236, 234, 228, 0.12);
    --track-fill: rgba(236, 234, 228, 0.42);

    --signal: #dd8a6c;
    --focus: #7ea2ff;

    --tone-pass: #74b795;
    --tone-partial: #c99f57;
    --tone-fail: #d9836c;
  }
}

/* `--tone` is what components paint status with. It resolves per theme, so a
   component never has to know which ground it is sitting on. */
.grade-pass { --tone: var(--tone-pass); }
.grade-partial { --tone: var(--tone-partial); }
.grade-fail { --tone: var(--tone-fail); }

/* 2 — Base =============================================================== */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }

::selection { color: var(--surface-raised); background: var(--on-surface); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  color: var(--surface);
  background: var(--on-surface);
  font-size: 0.8rem;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus { transform: translateY(0); }

/* Micro-labels. Mono, small, muted — they annotate, they never announce. */
.card-tech,
.card-rank,
.section-index,
.hero-kicker {
  font-family: var(--font-mono);
}

/* 3 — Header ============================================================= */

.site-header {
  width: var(--shell);
  min-height: 62px;
  margin: 0 auto;
  padding: 0.6rem 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--on-surface);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand svg {
  width: 26px;
  height: 26px;
  padding: 3px;
  fill: var(--on-surface);
  border: 1px solid var(--line-strong);
}

.brand svg path:last-child {
  fill: none;
  stroke: var(--signal);
  stroke-width: 3;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font: 550 0.78rem/1 var(--font-ui);
}

.header-nav a {
  padding-bottom: 0.2rem;
  color: var(--on-surface-muted);
  border-bottom: 1px solid transparent;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}

.header-nav a:hover { color: var(--on-surface); border-bottom-color: var(--line-strong); }

.theme-switch {
  justify-self: end;
  display: inline-flex;
  border: 1px solid var(--line);
}

.theme-switch button {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
  color: var(--on-surface-faint);
  transition: color 160ms ease, background-color 160ms ease;
}

.theme-switch button:first-child { border-left: 0; }

.theme-switch svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.theme-switch button:hover { color: var(--on-surface); }

.theme-switch button.is-active {
  color: var(--on-surface);
  background: var(--surface-sunken);
}

/* 4 — Hero =============================================================== */

.hero {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 3rem);
}

.hero-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--on-surface-faint);
  font: 500 0.66rem/1 var(--font-mono);
  letter-spacing: 0.11em;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: stretch;
}

.hero-lede {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.hero-title {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.hero-title span, .hero-title em { display: block; }

.hero-title em {
  color: var(--signal);
  font-style: normal;
}

.hero-copy {
  max-width: 38rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.hero-index,
.section-index {
  margin: 0 0 0.9rem;
  color: var(--on-surface-faint);
  font: 500 0.64rem/1 var(--font-mono);
  letter-spacing: 0.11em;
}

.hero-copy > p:not(.hero-index) {
  margin: 0 0 1.4rem;
  max-width: 34rem;
  color: var(--on-surface-muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.text-link {
  width: max-content;
  padding-bottom: 0.3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--signal);
  border-bottom: 1px solid currentColor;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.text-link svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform 180ms ease;
}

.text-link:hover svg { transform: translateX(3px); }

/* the ladder — nine bars, the whole benchmark at a glance */
.hero-ladder {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
}

.hero-ladder figcaption {
  padding-bottom: 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--on-surface-faint);
  font: 500 0.6rem/1 var(--font-mono);
  letter-spacing: 0.09em;
}

.ladder-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ladder-row a {
  padding: 0.46rem 0;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) 5rem 1.9rem;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: color 160ms ease;
}

.ladder-row:last-child a { border-bottom: 0; }
.ladder-row a:hover { color: var(--signal); }

.ladder-rank {
  color: var(--on-surface-faint);
  font: 500 0.6rem/1 var(--font-mono);
}

.ladder-name {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ladder-bar {
  height: 5px;
  display: block;
  background: var(--track);
}

.ladder-bar i {
  height: 100%;
  display: block;
  width: calc(var(--fill) * 100%);
  background: var(--tone);
}

.ladder-score {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  text-align: right;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}

.hero-stats div {
  min-height: 70px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  border-left: 1px solid var(--line);
}

.hero-stats div:first-child { padding-left: 0; border-left: 0; }

.hero-stats strong {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 400;
  line-height: 1;
}

.hero-stats span {
  color: var(--on-surface-muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

/* 5 — Section shell ====================================================== */

.section {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(3rem, 5vw, 4.5rem) 0;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: end;
  margin-bottom: 1.8rem;
}

.section-heading h2,
.method-intro h2 {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

.section-note {
  max-width: 32rem;
  margin: 0;
  justify-self: end;
  color: var(--on-surface-muted);
  font-size: 0.84rem;
  line-height: 1.75;
}

.source-note {
  margin: 0.9rem 0 0;
  color: var(--on-surface-faint);
  font-size: 0.72rem;
  line-height: 1.6;
}

.source-note code,
.overlay-detail code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

/* 6 — Leaderboard ======================================================== */

.leaderboard,
.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.leaderboard th,
.leaderboard td,
.matrix th,
.matrix td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.leaderboard thead th,
.matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  color: var(--on-surface-faint);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line-strong);
  font: 500 0.62rem/1.3 var(--font-mono);
  letter-spacing: 0.05em;
  vertical-align: bottom;
}

.th-label {
  display: block;
  min-width: 0;
}

.th-static { display: block; padding: 0.7rem; }
.matrix thead th .th-label { padding: 0.7rem; }

.leaderboard thead th i,
.matrix thead th i {
  display: block;
  font-style: normal;
  opacity: 0.65;
}

.leaderboard thead button {
  width: 100%;
  padding: 0.7rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
}

.leaderboard thead button:hover { color: var(--on-surface); }
.leaderboard thead button.is-active { color: var(--on-surface); }

.sort-arrow { opacity: 0.5; }
.leaderboard thead button.is-active .sort-arrow { color: var(--signal); opacity: 1; }

.leaderboard tbody tr { transition: background-color 140ms ease; }
.leaderboard tbody tr:hover { background: color-mix(in srgb, var(--on-surface) 4%, transparent); }
.leaderboard tbody tr:last-child td { border-bottom: 0; }

.col-rank { width: 3.2rem; }

.rank-number {
  color: var(--on-surface-muted);
  font-family: var(--font-serif);
  font-size: 1rem;
}

.col-name { min-width: 11rem; }

.cell-model {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cell-model-link {
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.cell-model-link:hover { color: var(--signal); border-bottom-color: currentColor; }

.cell-tech {
  display: block;
  margin-top: 0.2rem;
  color: var(--on-surface-faint);
  font: 400 0.58rem/1.3 var(--font-mono);
  letter-spacing: 0.04em;
}

.grade-mark { color: var(--tone); font-size: 0.66rem; line-height: 1; }

.score-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.score-value {
  min-width: 1.7rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.score-bar {
  width: 4.5rem;
  height: 5px;
  display: block;
  background: var(--track);
}

.score-bar i {
  height: 100%;
  display: block;
  width: calc(var(--fill) * 100%);
  background: var(--tone);
}

.col-dim { width: 5.4rem; }

.dim-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--on-surface-muted);
}

.dim-cell i {
  width: 2.4rem;
  height: 5px;
  display: block;
  background: var(--track);
}

.dim-cell i::before {
  height: 100%;
  display: block;
  width: calc(var(--fill) * 100%);
  content: "";
  background: var(--track-fill);
}

.dim-cell b { color: var(--on-surface); font-weight: 550; }

/* The scoreboard encodes magnitude with length only; colour is reserved for
   the grade (总分 bar) and for the shortfalls in the feature matrix, so the
   two tables never say the same thing two different ways. */

.col-metric { color: var(--on-surface-muted); font-variant-numeric: tabular-nums; }
.is-void { color: var(--tone-fail); }

.col-actions { text-align: right; }

.row-action {
  display: inline-block;
  margin-left: 0.7rem;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  color: var(--on-surface-muted);
  font-size: 0.74rem;
  font-weight: 550;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}

.row-action:hover { color: var(--signal); border-bottom-color: currentColor; }

.row-action.is-quiet {
  color: var(--on-surface-faint);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
}

/* 7 — Gallery ============================================================ */

.gallery-controls {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-button {
  min-height: 34px;
  padding: 0 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-surface-muted);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.filter-button span { color: var(--on-surface-faint); font: 400 0.62rem/1 var(--font-mono); }

.filter-button:hover { color: var(--on-surface); border-color: var(--line-strong); }

.filter-button.is-active {
  color: var(--on-surface);
  background: var(--surface-sunken);
  border-color: var(--line-strong);
}

.filter-button.is-active span { color: var(--on-surface-muted); }

.sort-field {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--on-surface-faint);
  font-size: 0.74rem;
}

.sort-field select {
  min-height: 34px;
  padding: 0 0.6rem;
  color: var(--on-surface);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  font: 500 0.78rem/1 var(--font-ui);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.model-card {
  min-width: 0;
  padding: clamp(1.05rem, 1.8vw, 1.35rem);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  position: relative;
  background: var(--surface-raised);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color 180ms ease;
}

.model-card:hover,
.model-card:focus-within { background: var(--surface); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-tech,
.card-rank {
  color: var(--on-surface-faint);
  font: 400 0.6rem/1.3 var(--font-mono);
  letter-spacing: 0.07em;
}

/* Status is a dot and a word. It never becomes a badge. */
.grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--on-surface-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.grade-pill > span[aria-hidden] { color: var(--tone); font-size: 0.62rem; }

.card-score {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.card-total {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  line-height: 1;
}

.card-outof { color: var(--on-surface-faint); font-size: 0.76rem; }

.card-dims {
  margin: 0;
  display: grid;
  gap: 0.38rem;
}

.dim-row {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
}

.dim-row dt {
  color: var(--on-surface-muted);
  font-size: 0.7rem;
}

.dim-row dd {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.4rem;
  color: var(--on-surface-muted);
  font-size: 0.68rem;
}

.dim-track {
  height: 5px;
  display: block;
  background: var(--track);
}

.dim-track i {
  height: 100%;
  display: block;
  width: calc(var(--fill) * 100%);
  /* Length carries the score; the grade already has its dot in the card head.
     Only a zero — a feature that is simply absent — earns colour here. */
  background: var(--track-fill);
}

.dim-row.is-zero .dim-track i { background: var(--tone-fail); }
.dim-row dd b { color: var(--on-surface); font-variant-numeric: tabular-nums; font-weight: 550; }
.dim-row dd .dim-max { color: var(--on-surface-faint); }

.card-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.card-body h3 a { text-decoration: none; }
.card-body h3 a:hover { color: var(--signal); }

.card-summary {
  margin: 0 0 0.75rem;
  color: var(--on-surface-muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.card-defects { margin: 0; }

.card-defects-label {
  margin: 0 0 0.35rem;
  color: var(--on-surface-faint);
  font: 400 0.58rem/1 var(--font-mono);
  letter-spacing: 0.08em;
}

.card-defects ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.card-defects li {
  padding-left: 0.85rem;
  position: relative;
  color: var(--on-surface-muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.card-defects li::before {
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 0.45rem;
  height: 1px;
  content: "";
  background: var(--line-strong);
}

.card-defects-more { color: var(--on-surface-faint); }

.card-defects.is-clean {
  padding-left: 0.85rem;
  position: relative;
  color: var(--on-surface-muted);
  font-size: 0.72rem;
}

.card-defects.is-clean::before {
  position: absolute;
  left: 0;
  content: "—";
  color: var(--on-surface-faint);
}

.card-metrics {
  margin: auto 0 0;
  padding: 0.8rem 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  list-style: none;
  border-top: 1px solid var(--line);
}

.card-metrics li { display: grid; gap: 0.2rem; min-width: 0; }

.card-metrics span {
  color: var(--on-surface-faint);
  font: 400 0.56rem/1 var(--font-mono);
  letter-spacing: 0.06em;
}

.card-metrics b {
  overflow: hidden;
  font-size: 0.74rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tech { display: block; }

.card-footer {
  padding-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

.card-launch,
.card-notes {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  transition: color 160ms ease;
}

.card-launch {
  font-size: 0.78rem;
  font-weight: 600;
}

.card-launch:hover { color: var(--signal); }

.card-launch svg,
.card-notes svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform 180ms ease;
}

.card-launch:hover svg { transform: translateX(3px); }

.card-notes {
  color: var(--on-surface-faint);
  font: 400 0.6rem/1 var(--font-mono);
  letter-spacing: 0.06em;
}

.card-notes:hover { color: var(--on-surface); }
.card-notes svg { width: 14px; }

.empty-state,
.noscript {
  grid-column: 1 / -1;
  margin: 0;
  padding: 4rem 1.5rem;
  color: var(--on-surface-muted);
  background: var(--surface-raised);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: 0.85rem;
}

/* 8 — Matrix ============================================================= */

.matrix {
  table-layout: fixed;
  min-width: 860px;
}

.matrix td,
.matrix th[scope='row'] { border-right: 1px solid var(--line); }

.matrix .col-name { width: 13rem; }

.matrix th[scope='row'] {
  font-size: 0.8rem;
  font-weight: 550;
}

.matrix th[scope='row'] .grade-mark { margin-right: 0.4rem; }

.matrix th[scope='row'] a { text-decoration: none; border-bottom: 1px solid transparent; }
.matrix th[scope='row'] a:hover { color: var(--signal); border-bottom-color: currentColor; }

.matrix .col-cell {
  text-align: center;
  color: var(--on-surface-muted);
  font-variant-numeric: tabular-nums;
  /* Full marks stay plain; the tint grows with the shortfall so the eye lands
     on what is missing. Kept faint — it is a wash, not a highlight. */
  background: color-mix(in srgb, var(--tone-partial) calc(var(--short, 0) * 22%), transparent);
}

.matrix thead .col-cell { background: var(--surface-raised); }
.matrix .col-cell span { color: var(--on-surface); font-weight: 550; }

.matrix .col-cell.is-zero {
  background: color-mix(in srgb, var(--tone-fail) 16%, transparent);
}

.matrix .col-cell.is-zero span { color: var(--tone-fail); }
.matrix .col-cell.is-full { background: transparent; }

.matrix .col-subtotal {
  /* A subtotal is a value, not a gap — it stays out of the shortfall wash. */
  background: transparent;
  border-left: 1px solid var(--line-strong);
}

.matrix tbody .col-subtotal span { font-family: var(--font-serif); font-size: 0.98rem; font-weight: 400; }

/* 9 — Method ============================================================= */

.method-section {
  padding: clamp(3rem, 5vw, 4.5rem) max(1.5rem, calc((100% - 1320px) / 2));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  background: var(--surface-sunken);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.method-intro h2 { color: var(--on-surface); }

.method-lede {
  max-width: 26rem;
  margin: 1.2rem 0 0;
  color: var(--on-surface-muted);
  font-size: 0.84rem;
  line-height: 1.8;
}

.method-body { display: grid; gap: clamp(2rem, 3vw, 2.75rem); }

.method-grid { border-top: 1px solid var(--line); }

.method-grid article {
  padding: 1.25rem 0;
  display: grid;
  grid-template-columns: 40px 110px 1fr;
  gap: 1.2rem;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.method-grid article > span,
.method-grid h3 {
  font: 500 0.66rem/1.6 var(--font-mono);
  letter-spacing: 0.09em;
}

.method-grid article > span { color: var(--on-surface-faint); }
.method-grid h3 { color: var(--on-surface); margin: 0; }
.method-grid p { margin: 0; }

.method-grid p {
  max-width: 40rem;
  color: var(--on-surface-muted);
  font-size: 0.84rem;
  line-height: 1.8;
}

.rubric-title {
  margin: 0 0 1rem;
  color: var(--on-surface-faint);
  font: 500 0.66rem/1 var(--font-mono);
  letter-spacing: 0.09em;
}

.rubric-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.rubric-list li {
  padding: 1rem 1.1rem;
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.9rem;
  align-items: start;
  background: var(--surface-sunken);
}

.rubric-max {
  color: var(--on-surface-muted);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.1;
}

.rubric-list h4 {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.rubric-list p {
  margin: 0;
  color: var(--on-surface-muted);
  font-size: 0.74rem;
  line-height: 1.65;
}

/* 10 — Footer ============================================================ */

.site-footer {
  min-height: 96px;
  padding: 1.5rem max(1.5rem, calc((100% - 1320px) / 2));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
}

.footer-brand {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.site-footer p {
  margin: 0;
  color: var(--on-surface-faint);
  font: 400 0.6rem/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-align: center;
}

.site-footer a {
  justify-self: end;
  color: var(--on-surface-muted);
  font-size: 0.74rem;
  text-decoration: none;
}

.site-footer a:hover { color: var(--on-surface); }

/* 11 — Player ============================================================ */

.player-dialog,
.notes-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
}

/* The stage is a game, so the player stays dark whatever the page is doing.
   Its palette is local — it must not drift with the theme. */
.player-dialog {
  --ink: #f0efe9;
  --ink-dim: #bcbbb3;
  --ink-muted: #8b8a83;
  --edge: #3a3b36;
  --well: #171815;
  --tone-pass: #74b795;
  --tone-partial: #c99f57;
  --tone-fail: #d9836c;

  color: var(--ink);
  background: #0c0d0b;
  color-scheme: dark;
}

.player-dialog::backdrop,
.notes-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.player-dialog[open],
.notes-dialog[open] {
  display: block;
  animation: dialog-in 200ms ease-out;
}

@keyframes dialog-in { from { opacity: 0; } }

.player-shell {
  height: 100dvh;
  padding: 0.9rem;
  display: grid;
  /* Named areas, not positional rows: the notice only exists for ports that
     have one, and a bare `auto auto 1fr auto` track list would shift every
     row up when it is absent — handing the 1fr to the footer and squeezing
     the stage to nothing. */
  grid-template-areas:
    "header"
    "notice"
    "stage"
    "footer";
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.7rem;
}

.player-header { grid-area: header; }
.player-notice { grid-area: notice; }
.player-stage { grid-area: stage; }
.player-footer { grid-area: footer; }

/* Most ports have no notice; don't leave its gap behind. */
.player-shell:has(.player-notice[hidden]) {
  grid-template-rows: auto 0 minmax(0, 1fr) auto;
  row-gap: 0;
}

.player-shell:has(.player-notice[hidden]) .player-header { margin-bottom: 0.7rem; }
.player-shell:has(.player-notice[hidden]) .player-stage { margin-bottom: 0.7rem; }

.player-header,
.player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.player-header { min-height: 44px; padding: 0 0.3rem; }

.player-identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.player-entry,
.player-tech {
  color: var(--ink-muted);
  font: 400 0.62rem/1.4 var(--font-mono);
  letter-spacing: 0.07em;
}

.player-identity h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.player-identity .grade-pill { color: var(--ink-muted); }

.player-actions { display: flex; gap: 0.4rem; }

.icon-button,
.fullscreen-button {
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--edge);
  cursor: pointer;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.fullscreen-button { padding: 0 0.9rem; font-size: 0.74rem; font-weight: 550; }

.icon-button:hover,
.fullscreen-button:hover {
  color: var(--ink);
  background: var(--well);
  border-color: var(--ink-muted);
}

.icon-button svg,
.fullscreen-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.player-notice {
  padding: 0.65rem 0.9rem;
  color: var(--tone-partial);
  background: color-mix(in srgb, var(--tone-partial) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone-partial) 35%, transparent);
  font-size: 0.76rem;
  line-height: 1.55;
}

.player-stage {
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--edge);
}

.player-stage iframe {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  border: 0;
}

.player-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #0c0d0b;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.player-overlay.is-hidden { opacity: 0; visibility: hidden; }

.overlay-card {
  width: min(100%, 28rem);
  display: grid;
  gap: 0.8rem;
  justify-items: center;
  text-align: center;
}

.overlay-phase {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 550;
}

.overlay-meter {
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: #232420;
}

.overlay-meter-fill {
  height: 100%;
  width: calc(var(--fill, 0) * 100%);
  background: var(--ink-dim);
  transition: width 200ms ease;
}

.overlay-meter[data-state='indeterminate'] .overlay-meter-fill {
  width: 32%;
  animation: meter-sweep 1.4s ease-in-out infinite;
}

@keyframes meter-sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(330%); }
}

.overlay-detail {
  margin: 0;
  max-width: 30rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

.player-overlay[data-tone='stalled'] .overlay-phase { color: var(--tone-partial); }
.player-overlay[data-tone='stalled'] .overlay-meter-fill { background: var(--tone-partial); }
.player-overlay[data-tone='confirm'] .overlay-phase { color: var(--tone-fail); }
.overlay-meter[hidden] { display: none; }

.overlay-actions {
  margin-top: 0.3rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
}

.overlay-action {
  min-height: 34px;
  padding: 0 0.9rem;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--edge);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 500;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.overlay-action:hover { color: var(--ink); background: var(--well); border-color: var(--ink-muted); }

.overlay-action.is-primary {
  color: #0c0d0b;
  background: var(--ink);
  border-color: var(--ink);
}

.overlay-action.is-primary:hover { color: #0c0d0b; background: #fff; border-color: #fff; }

.overlay-action.is-danger {
  color: var(--tone-fail);
  border-color: color-mix(in srgb, var(--tone-fail) 50%, transparent);
}

.overlay-action.is-danger:hover {
  color: #0c0d0b;
  background: var(--tone-fail);
  border-color: var(--tone-fail);
}

/* The footer is chrome around the game, so it stays on one line and never
   competes with the stage for height. */
.player-footer {
  flex-wrap: nowrap;
  align-items: center;
  gap: 1rem;
}

.player-meta { min-width: 0; display: grid; gap: 0.15rem; }

.player-hint {
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 0.7rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Two rows at most, so a long key list cannot push the stage off screen. */
.player-controls {
  display: flex;
  gap: 0.5rem 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
  max-height: 3.2rem;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.68rem;
}

.player-controls span { display: inline-flex; align-items: center; gap: 0.35rem; }

.player-controls kbd,
.player-escape kbd {
  padding: 0.15rem 0.35rem;
  color: var(--ink-dim);
  background: var(--well);
  border: 1px solid var(--edge);
  font: 400 0.62rem/1.3 var(--font-mono);
}

.player-escape {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 12 — Notes reader ====================================================== */

/* The reader is a document, not a stage — it follows the page theme. */
.notes-dialog {
  color: var(--on-surface);
  background: var(--surface);
}

.notes-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.notes-header {
  min-height: 58px;
  padding: 0.6rem 0.8rem 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.notes-heading { min-width: 0; display: grid; gap: 0.2rem; }

.notes-overline {
  color: var(--on-surface-faint);
  font: 400 0.58rem/1 var(--font-mono);
  letter-spacing: 0.11em;
}

.notes-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.notes-actions { display: flex; align-items: center; gap: 0.45rem; }

.notes-action {
  min-height: 34px;
  padding: 0 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-surface-muted);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.notes-action svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.notes-action:hover { color: var(--on-surface); border-color: var(--line-strong); }

.notes-play {
  color: var(--surface-raised);
  background: var(--on-surface);
  border-color: var(--on-surface);
}

.notes-play:hover {
  color: var(--surface-raised);
  background: color-mix(in srgb, var(--on-surface) 82%, var(--surface));
  border-color: transparent;
}

.notes-close {
  min-width: 34px;
  min-height: 34px;
  margin-left: 0.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-muted);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.notes-close svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.notes-close:hover { color: var(--on-surface); border-color: var(--line-strong); }

.notes-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 210px;
}

.notes-nav {
  padding: 0.8rem;
  overflow-y: auto;
  background: var(--surface-sunken);
  border-right: 1px solid var(--line);
}

.notes-nav-label {
  padding: 0 0.3rem 0.65rem;
  display: flex;
  justify-content: space-between;
  color: var(--on-surface-faint);
  font: 400 0.56rem/1 var(--font-mono);
  letter-spacing: 0.09em;
}

.notes-model-list { display: grid; gap: 0.15rem; }

.notes-model-button {
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.55rem;
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-surface-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.notes-model-button:hover { color: var(--on-surface); background: var(--surface); }

.notes-model-button.is-active {
  color: var(--on-surface);
  background: var(--surface-raised);
  border-color: var(--line-strong);
}

.notes-model-index { color: var(--on-surface-faint); font: 400 0.58rem/1 var(--font-mono); }
.notes-model-button strong { overflow: hidden; font-size: 0.76rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.notes-model-score { color: var(--tone); font-family: var(--font-serif); font-size: 0.9rem; }

.notes-reader { min-width: 0; overflow-y: auto; scroll-behavior: smooth; }

.notes-document-meta {
  width: min(calc(100% - 4rem), 720px);
  margin: 0 auto;
  padding: 1.5rem 0 0;
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  color: var(--on-surface-faint);
  font: 400 0.58rem/1 var(--font-mono);
  letter-spacing: 0.07em;
}

.notes-toc {
  padding: 1.5rem 1rem;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.notes-toc-label {
  margin: 0 0 0.7rem;
  color: var(--on-surface-faint);
  font: 400 0.56rem/1 var(--font-mono);
  letter-spacing: 0.09em;
}

.notes-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.1rem; }

.notes-toc a {
  padding: 0.3rem 0.4rem;
  display: block;
  color: var(--on-surface-faint);
  font-size: 0.7rem;
  line-height: 1.45;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.notes-toc a:hover { color: var(--on-surface); }
.notes-toc a.is-current { color: var(--on-surface); border-left-color: var(--line-strong); }
.notes-toc .toc-h3 a { padding-left: 1rem; font-size: 0.66rem; }

.markdown-body {
  width: min(calc(100% - 4rem), 720px);
  margin: 0 auto;
  padding: 1.4rem 0 5rem;
  color: var(--on-surface-muted);
  font-size: 0.88rem;
  line-height: 1.85;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  color: var(--on-surface);
  scroll-margin-top: 1.5rem;
}

.markdown-body h2 {
  margin: 0 0 1.4rem;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.markdown-body h3 {
  margin: 2.4rem 0 0.9rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.markdown-body h4 { margin: 1.8rem 0 0.6rem; font-size: 0.92rem; font-weight: 600; }
.markdown-body h5 { margin: 1.4rem 0 0.5rem; font-size: 0.85rem; font-weight: 600; }
.markdown-body p, .markdown-body ul, .markdown-body ol { margin: 0 0 1.05rem; }
.markdown-body li { margin-bottom: 0.35rem; }
.markdown-body strong { color: var(--on-surface); font-weight: 600; }
.markdown-body a { color: var(--signal); }

.markdown-body code {
  padding: 0.12em 0.35em;
  color: var(--on-surface);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.markdown-body pre {
  margin: 0 0 1.2rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  color: var(--on-surface);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.7;
}

.markdown-body pre code { padding: 0; background: none; }

.markdown-body blockquote {
  margin: 0 0 1.1rem;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 2px solid var(--line-strong);
  color: var(--on-surface-faint);
}

.markdown-body hr { margin: 2.2rem 0; border: 0; border-top: 1px solid var(--line); }

.markdown-body .table-wrap { margin: 0 0 1.2rem; overflow-x: auto; border: 1px solid var(--line); }
.markdown-body table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.markdown-body th, .markdown-body td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line); }
.markdown-body th { color: var(--on-surface); background: var(--surface-sunken); font-weight: 600; white-space: nowrap; }
.markdown-body tr:last-child td { border-bottom: 0; }

.notes-loading, .notes-error { color: var(--on-surface-faint); font-size: 0.85rem; }
.notes-error strong { display: block; margin-bottom: 0.4rem; color: var(--tone-fail); }

/* 13 — Responsive ======================================================== */

@media (max-width: 1180px) {
  .hero-layout { grid-template-columns: minmax(0, 1fr); }
  .hero-ladder { order: 2; }
  .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-section { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .notes-toc { display: none; }
}

@media (max-width: 900px) {
  .rubric-list { grid-template-columns: minmax(0, 1fr); }

  .leaderboard .col-rank,
  .leaderboard .col-name {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface-raised);
  }

  .leaderboard .col-rank { left: 0; }
  .leaderboard .col-name { left: 3.2rem; box-shadow: 1px 0 0 var(--line); }
  .leaderboard thead .col-rank, .leaderboard thead .col-name { z-index: 3; }
}

@media (max-width: 760px) {
  :root { --shell: calc(100% - 1.6rem); }

  .site-header {
    grid-template-columns: auto 1fr;
    row-gap: 0.5rem;
  }

  .header-nav { grid-column: 1 / -1; order: 3; gap: 1rem; font-size: 0.74rem; }
  .theme-switch { grid-column: 2; }

  .hero { padding-top: 2.25rem; }
  .hero-title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stats div { min-height: 62px; }

  .section-heading { grid-template-columns: 1fr; gap: 1.2rem; }
  .section-note { justify-self: start; max-width: 100%; }

  .gallery-controls { align-items: stretch; flex-direction: column; }
  .model-grid { grid-template-columns: 1fr; }

  .method-grid article { grid-template-columns: 36px 1fr; }
  .method-grid article p { grid-column: 2; }

  .site-footer { grid-template-columns: 1fr auto; }
  .site-footer p { display: none; }

  .player-shell { padding: 0.55rem; }
  .player-entry, .player-controls { display: none; }
  .player-footer { justify-content: space-between; }

  .notes-header { min-height: 54px; padding: 0.5rem 0.6rem 0.5rem 0.85rem; gap: 0.7rem; }
  .notes-heading { flex: 1; gap: 0; }
  .notes-overline, .notes-raw { display: none; }

  .notes-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }

  .notes-nav {
    padding: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .notes-nav-label { display: none; }
  .notes-model-list { width: max-content; display: flex; gap: 0.35rem; }
  .notes-model-button { width: auto; min-width: 155px; min-height: 42px; }

  .notes-document-meta, .markdown-body { width: min(calc(100% - 2rem), 920px); }
  .notes-document-meta span:nth-child(3) { display: none; }
  .markdown-body { padding: 1.4rem 0 4rem; }
}

@media (max-width: 430px) {
  .hero-kicker span:first-child { max-width: 12rem; line-height: 1.45; }

  .filter-row { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-button { justify-content: center; }
  .filter-button:first-child { grid-column: 1 / -1; }

  .model-card { padding: 1rem; }
  .card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .player-identity h2 { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-button { min-width: 36px; min-height: 36px; }
  .fullscreen-button { font-size: 0; gap: 0; padding: 0; min-width: 36px; }

  .overlay-actions { flex-direction: column; align-self: stretch; }
  .overlay-action { width: 100%; }

  .notes-actions { gap: 0.3rem; }
  .notes-play { width: 38px; min-width: 38px; padding: 0; gap: 0; overflow: hidden; font-size: 0; }
  .notes-play svg { width: 17px; }
  .notes-close { margin-left: 0; min-width: 38px; }
  .notes-model-button { min-width: 138px; }

  .notes-document-meta, .markdown-body { width: calc(100% - 1.5rem); }
  .markdown-body pre { margin-inline: -0.25rem; padding: 0.85rem; font-size: 0.74rem; }
}

/* 14 — Reduced motion ==================================================== */

@media (prefers-reduced-motion: reduce) {
  html, .notes-reader { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .overlay-meter[data-state='indeterminate'] .overlay-meter-fill { width: 100%; transform: none; }
}
