/* Layout: scanline masthead (wordmark + stage tiles) → sticky filter bar → sortable table, cards on phones → tier-list legend → footer */

/* Fontworks fonts, used only where they're installed on the viewer's computer
   (their licence doesn't allow embedding them in a website). Everyone else
   gets the web fonts after them in the --font-* stacks below.

   NewCezanne Pro B is one bold face, so it serves every display weight as is.
   Rodin Pro is installed only as DB: it's declared as the regular face, so
   regular text uses it as is and bold text (600 and up) gets it thickened by
   the browser, keeping today's bold/regular contrast. Its curly quotes are
   full-width, leaving a gap after every apostrophe, so those come from the
   next font in the stack (unicode-range skips U+2018 to U+201F). */
@font-face {
  font-family: "RH Display";
  src: local("NewCezannePro-B"), local("FOT-NewCezanne Pro B");
  font-weight: 100 900;
}
@font-face {
  font-family: "RH Text";
  src: local("RodinPro-DB"), local("FOT-Rodin Pro DB");
  font-weight: 100 500;
  unicode-range: U+0000-2017, U+2020-10FFFF;
}

:root {
  --bg: #f2f3f7;
  --surface: #ffffff;
  --surface-2: #e8eaf1;
  --line: #d3d7e2;
  --fg: #141622;
  --muted: #586074;
  --accent: #0b7a66;
  --accent-soft: #d6f2ea;
  --on-accent: #ffffff;
  --ok: #1e8549;
  --beta: #0a7a7a;
  --warn: #9e640a;
  --error: #c2412d;
  --off: #737a8f;
  --wanted: #a3459b;
  --tier-ink: #1a1a1a;
  --scan: rgb(20 22 34 / 0.035);
  --shadow: 0 1px 2px rgb(20 22 34 / 0.06), 0 12px 32px rgb(20 22 34 / 0.12);
  --backdrop: rgb(10 12 20 / 0.5);
  /* Logo pixels (of 1615) before the R's visible edge: its black outline on light,
     its white stroke on dark, where the outline melts into the background. */
  --logo-inset: 40;

  --font-display: "RH Display", "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "RH Text", "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "RH Text", "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --radius: 10px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1017;
    --surface: #161924;
    --surface-2: #1e2230;
    --line: #2a2f40;
    --fg: #e8eaf2;
    --muted: #979db3;
    --accent: #4fd1b5;
    --accent-soft: #16352f;
    --on-accent: #0e1017;
    --ok: #4cc47f;
    --beta: #3fc7c1;
    --warn: #e3a63c;
    --error: #ff8a7a;
    --off: #7d8398;
  --wanted: #e08bd6;
    --wanted: #e08bd6;
    --scan: rgb(255 255 255 / 0.025);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px rgb(0 0 0 / 0.5);
    --backdrop: rgb(0 0 0 / 0.65);
    --logo-inset: 40;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1017;
  --surface: #161924;
  --surface-2: #1e2230;
  --line: #2a2f40;
  --fg: #e8eaf2;
  --muted: #979db3;
  --accent: #4fd1b5;
  --accent-soft: #16352f;
  --on-accent: #0e1017;
  --ok: #4cc47f;
  --beta: #3fc7c1;
  --warn: #e3a63c;
  --error: #ff8a7a;
  --off: #7d8398;
  --scan: rgb(255 255 255 / 0.025);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px rgb(0 0 0 / 0.5);
  --backdrop: rgb(0 0 0 / 0.65);
  --logo-inset: 40;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { text-wrap: balance; }

a { color: var(--accent); text-underline-offset: 2px; }

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  padding: 8px 14px; border-radius: 6px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

.wrap {
  max-width: 1320px;
  margin-inline: auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

/* ── Masthead ─────────────────────────────────────────── */

.masthead {
  background-color: var(--surface);
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, var(--scan) 3px 4px);
  border-bottom: 1px solid var(--line);
  padding-block: 14px 18px;
  display: grid;
  gap: 16px;
}

.masthead > .wrap { width: 100%; }

.masthead__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* The wordmark sits at button height, with the tagline beside it. */
.wordmark { margin: 0; line-height: 0; flex: none; }
.wordmark img { display: block; height: 42px; width: auto; max-width: none; }

.tagline { margin: 0; font-size: 0.95rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) { .tagline { display: none; } }
.nav-link { font-weight: 600; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.nav-link:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 1059px) { .nav-link { display: none; } }


.masthead__actions { display: flex; align-items: center; gap: 10px; flex: none; }
.submit-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 42px;
  padding: 0 18px 0 15px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.submit-btn:hover { filter: brightness(1.1); }
/* Send feedback: the same pill, outlined, so Submit a game stays the main action. */
.feedback-btn { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.feedback-btn:hover { filter: none; background: var(--accent-soft); }
/* As the header narrows, Newsletter and Send feedback (both outlined) drop their labels
   first, so Submit a game keeps its own; then it goes too. */
@media (max-width: 1059px) {
  .feedback-btn { width: 42px; padding: 0; justify-content: center; }
  .feedback-btn span { display: none; }
}
@media (max-width: 660px) {
  .submit-btn { width: 42px; padding: 0; justify-content: center; }
  .submit-btn span { display: none; }
}

.d-correct { margin-left: auto; align-self: center; font-size: 0.85rem; color: var(--muted); }
.d-correct:hover { color: var(--accent); }

.icon-btn {
  flex: none;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .icon-btn .i-moon { display: none; }
}

.stage-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stage-tile {
  --c: var(--muted);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "n n" "dot label" ". blurb";
  column-gap: 8px;
  align-items: center;
  text-align: left;
  padding: 12px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.stage-tile:hover { border-color: var(--c); }
.stage-tile[aria-pressed="true"] {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, var(--bg));
  box-shadow: inset 0 0 0 1px var(--c);
}
.stage-tile__n {
  grid-area: n;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stage-tile__dot { grid-area: dot; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.stage-tile__label { grid-area: label; font-weight: 600; }
.stage-tile__blurb { grid-area: blurb; font-size: 0.8rem; color: var(--muted); line-height: 1.35; }

.stage-tile[data-stage="released"], .stage[data-stage="released"] { --c: var(--ok); }
.stage-tile[data-stage="beta"], .stage[data-stage="beta"] { --c: var(--beta); }
.stage-tile[data-stage="development"], .stage[data-stage="development"] { --c: var(--warn); }
.stage-tile[data-stage="abandoned"], .stage[data-stage="abandoned"] { --c: var(--off); }
.stage-tile[data-stage="wanted"], .stage[data-stage="wanted"] { --c: var(--wanted); }

/* ── Controls ─────────────────────────────────────────── */

.controls {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  padding-block: 14px;
  z-index: 10;
}
@media (min-width: 960px) {
  .controls {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.controls__inner { display: grid; gap: 12px; }

.controls__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}
.controls__row--chips { align-items: center; justify-content: space-between; }

.search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.search input::placeholder { color: var(--muted); }

.field { display: grid; gap: 4px; flex: 0 1 auto; min-width: 0; }
.field > span, .field > label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field select {
  height: 42px;
  width: 184px;
  max-width: 100%;
  text-overflow: ellipsis;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  cursor: pointer;
}
.field select:hover, .search input:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.field select.is-set { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.sort-inline { display: flex; align-items: center; gap: 8px; }
.sort-inline > label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.sort-pair { display: flex; }
.sort-pair select {
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  cursor: pointer;
}
.dir-btn {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.dir-btn:hover { color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips__label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.chip {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle__track {
  position: relative;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--line);
  transition: background-color 0.15s;
}
.toggle__track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: translate 0.15s;
}
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::after { translate: 16px 0; }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Results ──────────────────────────────────────────── */

.results { padding-block: 18px 40px; }
.results:focus { outline: none; }

.results__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.count { margin: 0; color: var(--muted); }
.count strong { color: var(--fg); font-variant-numeric: tabular-nums; }

.count__guess { color: var(--muted); font-size: 0.9em; }
.results__actions { display: flex; align-items: center; gap: 14px; }

.text-btn {
  border: 0; background: none; padding: 4px 2px;
  color: var(--accent); font-weight: 600; cursor: pointer;
}
.text-btn:disabled { color: var(--muted); opacity: 0.6; cursor: default; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented button {
  border: 0; background: none;
  padding: 7px 14px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); }

/* If the table is still wider than its frame (narrow screens), soft shadows at
   the edges show there's more to scroll to. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / 0.16), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 0.16), transparent) right / 14px 100% no-repeat scroll,
    var(--surface);
}

.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid th {
  padding: 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid th button {
  display: inline-flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 12px 8px 10px;
  border: 0; background: none;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.grid th button:hover { color: var(--fg); }
.grid th[aria-sort] button { color: var(--fg); }
.grid th button::after { content: ""; width: 0; height: 0; border: 4px solid transparent; opacity: 0; }
.grid th[aria-sort="ascending"] button::after { border-bottom-color: currentColor; border-top-width: 0; opacity: 1; }
.grid th[aria-sort="descending"] button::after { border-top-color: currentColor; border-bottom-width: 0; opacity: 1; }
.grid th.num button { justify-content: flex-end; }

.grid td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.grid th .th-label {
  display: block;
  padding: 12px 8px 10px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}

/* ── Operating systems ── */
.os-icon { width: 15px; height: 15px; fill: currentColor; flex: none; display: block; }
.os-set { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); }
.os-set--inline { gap: 6px; margin-left: 2px; color: var(--muted); }
/* In the table, at most three logos to a row, so a project on all five systems doesn't
   widen Runs on and push Stars past the edge. */
.grid .os-set { display: inline-grid; grid-template-columns: repeat(3, 15px); gap: 6px; vertical-align: middle; }
.os-set--inline .os-icon { width: 13px; height: 13px; }

.os-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.os-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.84rem; font-weight: 600;
}
.os-chip .os-icon { width: 13px; height: 13px; }
.os-note { display: block; margin-top: 5px; }
.facts .fact--wide { grid-column: span 2; }

.chip-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
/* The AI switch sits at the end of the dropdown row, level with the select boxes. */
.toggle--field { height: 42px; flex: none; margin-left: 4px; }
.os-group { display: flex; align-items: center; gap: 8px; }
.os-filter {
  display: inline-flex;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.os-filter button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px;
  border: 0; background: none;
  font-size: 0.85rem; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.os-filter button + button { border-left: 1px solid var(--line); }
.os-filter button:hover { color: var(--fg); }
.os-filter .os-icon { width: 13px; height: 13px; }
.os-filter button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); font-weight: 600; }
.os-filter button[data-os]:not([data-os=""])[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.os-filter button:focus-visible { outline-offset: -3px; }

/* Long version tags and toolchain names end in "…"; the full text is on hover. */
.trunc {
  display: inline-block;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Narrower windows drop the columns the detail panel also shows, so Stars always fits. */
/* Columns drop out as the window narrows, so the table never scrolls sideways. */
@media (max-width: 1340px) { .grid .col-release { display: none; } }
@media (max-width: 1175px) { .grid .col-genre { display: none; } }
@media (max-width: 1040px) { .grid .col-activity { display: none; } }
@media (max-width: 905px) { .grid .col-coop .pct__track { width: 44px; } }
@media (max-width: 820px) { .grid .col-score { display: none; } }
@media (max-width: 860px) { .table-wrap .grid td:first-child { min-width: 200px; } }
@media (max-width: 800px) { .table-wrap .grid td:first-child { min-width: 170px; } }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.grid td.num { text-align: right; }
.grid td.col-score { white-space: nowrap; }
.grid .score { font-size: 0.95rem; font-weight: 600; }

.game { display: grid; gap: 2px; min-width: 0; max-width: 400px; }
.game-cell { display: flex; align-items: center; gap: 12px; }
.grid td:first-child { min-width: 280px; }

/* Box art sits whole inside a square (boxes run from landscape N64 to tall DVD cases). */
.cover {
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
}
.cover img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cover--sm { width: 44px; height: 44px; }
.cover--md { width: 72px; height: 72px; }
.cover--lg { width: 132px; height: 132px; border-radius: 8px; }
.cover--none {
  background: var(--c);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}
.cover--sm.cover--none { font-size: 1rem; }
.cover--md.cover--none { font-size: 1.5rem; }
.cover--lg.cover--none { font-size: 2.6rem; }
.grid td.col-genre { white-space: nowrap; font-size: 0.9rem; }
.game__title {
  justify-self: start;
  padding: 0; border: 0; background: none;
  font-weight: 650; font-size: 0.98rem; text-align: left; line-height: 1.3;
  cursor: pointer;
}
.game__title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.game__sub { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.game__sub .ai { margin-left: 6px; }

.mono { font-family: var(--font-mono); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 1px; }
.small { font-size: 0.76rem; }

.ctag {
  display: inline-block;
  padding: 3px 7px 2px;
  border-radius: 4px;
  background: var(--c, #555);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.4;
  white-space: nowrap;
}

.stage {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.84rem; font-weight: 600;
  color: var(--c);
  white-space: nowrap;
}
.stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.stage[data-stage="abandoned"] { text-decoration: line-through; text-decoration-thickness: 1px; }

.tier {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 6px;
  background: var(--t);
  color: var(--tier-ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1;
}
[data-tier="S"] { --t: #ff7f7f; }
[data-tier="A"] { --t: #ffbf7f; }
[data-tier="B"] { --t: #ffdf7f; }
[data-tier="C"] { --t: #ffff7f; }
[data-tier="D"] { --t: #bfff7f; }
[data-tier="X"] { --t: #c9cdd8; }

.ai {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  vertical-align: 1px;
}

.act { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.act::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--a); flex: none; }
.act--active { --a: var(--ok); }
.act--quiet { --a: var(--warn); }
.act--stalled, .act--unknown { --a: var(--off); }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}
.card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s, translate 0.15s;
}
.card:hover { border-color: var(--accent); translate: 0 -1px; }
.card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.8rem; color: var(--muted); }
.card .game { max-width: none; }
.card__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.card__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}
.card__foot .muted { display: inline-flex; gap: 12px; }

.feats { display: flex; flex-wrap: wrap; gap: 5px; }
.feat {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.empty {
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty__title { font-weight: 650; font-size: 1.1rem; margin: 0 0 4px; }
.empty p { margin: 0 0 14px; color: var(--muted); }
.empty .empty__title { color: var(--fg); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn--ghost { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.08); }

/* ── Legend ───────────────────────────────────────────── */

.legend { padding-block: 8px 40px; }
.legend__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.legend h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.legend__text h2:not(:first-child) { margin-top: 28px; }
.legend p { margin: 0 0 12px; max-width: 65ch; }
.fine { font-size: 0.85rem; color: var(--muted); margin-top: 12px !important; }

.tier-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.tier-row { display: grid; grid-template-columns: 64px 1fr; }
.tier-row + .tier-row { border-top: 1px solid var(--line); }
.tier-row__label {
  display: grid; place-items: center;
  background: var(--t);
  color: var(--tier-ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.9rem;
}
.tier-row__text { padding: 10px 14px; }
.tier-row__text strong { display: block; }
.tier-row__text span { font-size: 0.86rem; color: var(--muted); }
.tier-row__text em { font-style: normal; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }

.stage-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.stage-list dt { margin: 0; }
.stage-list dd { margin: 0; color: var(--muted); font-size: 0.9rem; }

.stage-list .act { font-size: 0.84rem; font-weight: 600; }

/* ── Email sign-ups (newsletter/worker.js) ────────────── */

.newsletter { padding-block: 0 40px; }
.newsletter__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 40px;
  align-items: start;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.newsletter h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.newsletter__text p { margin: 0; max-width: 60ch; color: var(--muted); }
.newsletter__text strong { color: var(--fg); font-weight: 600; }

.mail-form { display: grid; gap: 8px; margin: 0; }
.mail-form__row { display: flex; gap: 8px; }
.mail-form input[type="email"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
}
.mail-form input[type="email"]::placeholder { color: var(--muted); }
.mail-form .btn { flex: none; }
.mail-form .btn:disabled { opacity: 0.6; cursor: progress; }
.mail-form__lead { margin: 0; font-weight: 600; }
.mail-form__check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.mail-form__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.mail-form__status { margin: 0; font-size: 0.9rem; min-height: 0; }
.mail-form__status:empty { display: none; }
.mail-form__status[data-state="ok"] { color: var(--ok); font-weight: 600; }
.mail-form__status[data-state="error"] { color: var(--error); font-weight: 600; }
.mail-form__fine { margin: 0; font-size: 0.8rem; color: var(--muted); }
/* A field people never see; bots that fill it in are ignored. */
.mail-form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* The update-alert form opens under its card's or the dialog's buttons. */
.mail-form--follow {
  flex-basis: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

@media (max-width: 760px) {
  .newsletter__inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .mail-form__row { flex-direction: column; }
  .mail-form .btn { justify-content: center; }
}

/* ── Featured playthrough (a YouTube video, loaded on play) ── */

.video { margin: 0; display: grid; gap: 6px; }
.video__play, .video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  background: #000;
}
.video__play { position: relative; padding: 0; overflow: hidden; cursor: pointer; }
.video__play img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter 0.15s; }
.video__play svg { position: absolute; left: 50%; top: 50%; translate: -50% -50%; filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.4)); }
.video__play:hover img, .video__play:focus-visible img { filter: brightness(0.85); }
.video figcaption { font-size: 0.85rem; color: var(--muted); }
.gp-video { display: grid; gap: 12px; max-width: 760px; }
.gp-video h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* ── Thanks (data/credits.js) ─────────────────────────── */

.thanks { padding-block: 0 40px; }
.thanks__inner { padding-top: 32px; border-top: 1px solid var(--line); }
.thanks h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.thanks__intro { margin: 0 0 16px; max-width: 70ch; color: var(--muted); }
.thanks__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.thanks__list li {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.thanks__list a { font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.thanks__list a:hover { text-decoration: underline; text-underline-offset: 2px; }
.thanks__list span { font-size: 0.85rem; color: var(--muted); }

.footer {
  padding-block: 20px 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer p { margin: 0 0 6px; max-width: 90ch; }

/* ── Detail dialog ────────────────────────────────────── */

dialog {
  width: min(700px, calc(100% - 24px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
  overflow: auto;
}
dialog::backdrop { background: var(--backdrop); }

.d-body { display: grid; gap: 18px; padding: 22px 24px 24px; }
.d-head { display: flex; align-items: flex-start; gap: 20px; padding-right: 44px; }

/* The whole box at its own shape: tall DVD cases and wide N64 boxes alike. */
.d-cover { flex: none; width: 180px; margin: 0; }
.d-cover img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 280px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 6px 18px rgb(0 0 0 / 0.18);
}
.d-head__text { display: grid; gap: 8px; min-width: 0; }
.d-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }
.d-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0.005em;
}
.d-close {
  position: absolute; top: 14px; right: 14px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg);
  font-size: 1.3rem; line-height: 1;
  cursor: pointer;
}
.d-close:hover { border-color: var(--accent); color: var(--accent); }

.d-verdict {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.d-verdict .tier { width: 56px; height: 56px; font-size: 2.1rem; border-radius: 8px; }
.d-verdict strong { display: block; }
.d-verdict span { font-size: 0.88rem; color: var(--muted); }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 0;
}
.facts div { min-width: 0; }
.facts dt { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.d-section h3 {
  margin: 0 0 6px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.d-section p { margin: 0; }
.d-note { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); font-size: 0.9rem; }
.d-links { display: flex; flex-wrap: wrap; gap: 10px; }

.d-compare {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--fg);
  text-decoration: none;
}
.d-compare strong { color: var(--accent); white-space: nowrap; }
.d-compare:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.d-minor { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-left: auto; align-self: center; }
.d-minor .d-correct { margin-left: 0; }

/* ── What's new: latest releases and trending ─────────── */

.pulse {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-block: 20px 4px;
}
.pulse__panel {
  min-width: 0;
  padding: 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.pulse__head { display: flex; align-items: baseline; gap: 14px; padding: 0 10px 6px; }
.pulse__head h2 {
  margin: 0 auto 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.pulse__link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0; border: 0; background: none;
  font-size: 0.82rem; color: var(--accent); text-decoration: none; white-space: nowrap;
  cursor: pointer;
}
.pulse__link:hover { text-decoration: underline; text-underline-offset: 2px; }
.pulse__list { margin: 0; padding: 0; list-style: none; }
.pulse__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.pulse__row:hover { background: var(--surface-2); }
.pulse .cover--sm { width: 36px; height: 36px; }
.pulse__main { display: grid; min-width: 0; }
.pulse__title, .pulse__main .game__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulse__title { font-size: 0.92rem; font-weight: 650; }
.pulse__meta { font-size: 0.8rem; color: var(--muted); white-space: nowrap; text-align: right; }
.pulse__empty { padding: 8px 10px 12px; color: var(--muted); font-size: 0.9rem; }

/* Stars gained this week (tools/track_stars.py). */
.gain { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; color: var(--ok); white-space: nowrap; }
/* Rating trend: the score since the latest release against the one before it. */
.trend { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.trend--up { color: var(--ok); }
.trend--down { color: var(--error); }
.trend--flat { color: var(--muted); }

/* ── Releases page (releases/, built by tools/build_pages.py) ── */

.rl-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.rl-month { display: grid; gap: 14px; }
.rl-month .gp-h2 { margin: 8px 0 0; }
.rl-list {
  margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.rl-row {
  display: grid;
  grid-template-columns: 56px auto minmax(0, 1fr) 140px 30px 130px;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
}
.rl-row + .rl-row { border-top: 1px solid var(--line); }
.rl-date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.rl-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.rl-title { font-weight: 650; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.rl-title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.rl-main .game__sub { flex-basis: 100%; }
.rl-notes { justify-self: end; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.rl-notes:hover { color: var(--accent); }

@media (max-width: 760px) {
  .pulse {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 88%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter-l);
    scrollbar-width: none;
  }
  .pulse__panel { scroll-snap-align: start; }
  .pulse__head { flex-wrap: wrap; gap: 2px 14px; }
  .pulse__head h2 { flex-basis: 100%; font-size: 1.15rem; }
  .rl-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "cover main tier" "cover date notes";
    gap: 4px 12px;
    padding: 10px 14px;
  }
  .rl-row > .cover { grid-area: cover; align-self: start; }
  .rl-main { grid-area: main; }
  .rl-row > .tier { grid-area: tier; }
  .rl-date { grid-area: date; }
  .rl-notes { grid-area: notes; }
  .rl-stage { display: none; }
}

/* ── Game pages (games/<slug>/, built by tools/build_pages.py) ── */

.masthead--slim { padding-block: 16px; }
.masthead--slim .masthead__top { align-items: center; }
.home-link { display: block; line-height: 0; }
.home-link img { height: 42px !important; width: auto !important; margin: 0 !important; }
.home-link img {
  display: block;
  width: var(--logo-w);
  max-width: none;
  height: auto;
  margin-left: calc(var(--logo-w) * var(--logo-inset) / -1615 + 1px);
}

.gp { display: grid; gap: 24px; padding-block: 20px 40px; }
.gp:focus { outline: none; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--accent); }

.gp-hero { display: flex; align-items: flex-end; gap: 28px; }
.gp-hero .d-cover { width: auto; }
.gp-hero .d-cover img { max-width: 220px; max-height: 300px; }
.gp-hero__text { display: grid; gap: 10px; min-width: 0; }
.gp-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
}
.gp-lede { margin: 0; font-size: 1.05rem; max-width: 62ch; }

.gp-pick {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.gp-pick > .tier { width: 64px; height: 64px; font-size: 2.4rem; border-radius: 8px; }
.gp-pick__text { display: grid; gap: 4px; min-width: 0; }
.gp-label, .gp-badge {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.gp-pick h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1; overflow-wrap: anywhere; }
.gp-pick h2 a { color: inherit; text-decoration: none; }
.gp-pick h2 a:hover { color: var(--accent); }
.gp-by { font-family: var(--font-body); font-weight: 400; font-size: 0.95rem; color: var(--muted); white-space: nowrap; }
.gp-pick p { margin: 0; max-width: 80ch; }

.gp-h2 {
  margin: 8px 0 -8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* One card per project. Subgrid lines the rows up across cards, so each fact
   sits at the same height in every column. */
.gp-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 14px;
}
.gp-compare--one { grid-template-columns: minmax(0, 760px); }
.gp-card {
  display: grid;
  grid-row: span var(--rows);
  grid-template-rows: subgrid;
  row-gap: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scroll-margin-top: 16px;
}
.gp-card.is-pick { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.gp-cell { min-width: 0; padding: 11px 16px; border-top: 1px solid var(--line); }
.gp-card__head { display: grid; gap: 3px; align-content: start; padding-top: 16px; border-top: 0; }
.gp-card__title { margin: 0; font-size: 1.15rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.gp-card__head .game__sub { margin: 0; }
.gp-card__head .game__sub:empty { display: none; }
.gp-verdict { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.gp-verdict .tier { width: 44px; height: 44px; font-size: 1.6rem; border-radius: 7px; }
.gp-verdict strong { display: block; }
.gp-verdict div span { display: block; font-size: 0.84rem; line-height: 1.4; color: var(--muted); }
.gp-fact { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; }
.gp-k { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.gp-v { min-width: 0; }
.gp-text { display: grid; gap: 4px; align-content: start; }
.gp-text p { margin: 0; font-size: 0.92rem; }
.gp-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 16px; }
.btn svg { flex: none; }
.gp-missing { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Ratings and comments (giscus) */
.gp-comments { display: grid; gap: 14px; scroll-margin-top: 16px; }
.gp-comments .gp-h2 { margin: 8px 0 0; }
.gp-comments__intro { margin: 0; max-width: 75ch; color: var(--muted); }
.gp-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-tabs button {
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  font-size: 0.86rem; font-weight: 600;
  cursor: pointer;
}
.gp-tabs button:hover { border-color: var(--accent); }
.gp-tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.gp-rate {
  display: grid; gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.gp-rate__buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-rate__buttons button {
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg);
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  cursor: pointer;
}
.gp-rate__buttons button:hover { border-color: var(--accent); color: var(--accent); }
.gp-rate__buttons button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.gp-rate__status { margin: 0; min-height: 1.2em; }
.gp-rate__status:empty { display: none; }

/* ── Small screens ────────────────────────────────────── */

@media (max-width: 1100px) {
  .stage-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .stage-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legend__grid { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .masthead { padding-block: 20px 18px; gap: 18px; }
  .stage-tile { padding: 10px 12px 12px; }
  .stage-tile__n { font-size: 2rem; }
  .stage-tile__blurb { display: none; }
  .controls__row > .field { flex: 1 1 calc(50% - 6px); }
  .field select { width: 100%; }
  .chip-groups, .os-group { width: 100%; }
  .controls__row > .toggle--field { flex-basis: 100%; height: auto; margin-left: 0; }
  .os-filter { flex: 1; display: flex; }
  .os-filter button { flex: 1; justify-content: center; padding: 0 6px; }
  /* Four systems don't fit with their names on a phone: logos only (named by aria-label). */
  .os-filter button[data-os]:not([data-os=""]) span { display: none; }
  .results__actions { flex-wrap: wrap; width: 100%; justify-content: space-between; }
  .sort-inline { order: -1; flex: 1 1 100%; }
  .sort-pair { flex: 1; }
  .sort-pair select { flex: 1; min-width: 0; }
  .d-body { padding: 18px 16px 20px; }
  /* The four round buttons sit two by two beside the wordmark, which leaves the logo
     its full 240px on a 375px phone; on game pages' one-line header they stay in a row. */
  .wordmark { --logo-w: min(240px, 100vw - 136px); }
  .masthead__actions { gap: 8px; }
  .masthead:not(.masthead--slim) .masthead__actions { display: grid; grid-template-columns: repeat(2, 40px); }
  .masthead--slim .home-link { --logo-w: min(150px, 100vw - 232px); }
  .masthead__actions .icon-btn { width: 40px; height: 40px; }
  .submit-btn { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .submit-btn span { display: none; }
  .d-correct { margin-left: 0; flex-basis: 100%; }
  .cover--lg { width: 88px; height: 88px; }
  .cover--lg.cover--none { font-size: 1.8rem; }
  .d-head { flex-direction: column; gap: 14px; }
  .d-cover { width: auto; }
  .d-cover img { max-width: min(220px, 70vw); max-height: 240px; }
  .d-compare { flex-wrap: wrap; }
  .d-minor { margin-left: 0; flex-basis: 100%; }
  .gp-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .gp-hero .d-cover img { max-width: min(200px, 60vw); max-height: 240px; }
  .gp-pick { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .gp-pick > .tier { width: 52px; height: 52px; font-size: 2rem; align-self: start; }
  .gp-pick > .btn { grid-column: 1 / -1; justify-self: start; }
  .gp-fact { grid-template-columns: 100px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}


/* ── CoOp:Anything additions ────────────────────────────── */

/* The search is the first thing on the page: big, full width, focusable with "/". */
.search--hero { flex: 1 1 100%; }
.search--hero svg { left: 16px; }
.search--hero input {
  height: 56px;
  padding: 0 52px 0 50px;
  border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 14px;
  font-size: 1.15rem;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.06);
}
.search--hero input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.search__key {
  position: absolute; right: 14px; top: 50%; translate: 0 -50%;
  padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); background: var(--surface-2);
  pointer-events: none;
}
.search--hero input:focus ~ .search__key, .search--hero input:not(:placeholder-shown) ~ .search__key { display: none; }
@media (max-width: 560px) {
  .search--hero input { height: 50px; font-size: 1rem; padding-right: 14px; }
  .search__key { display: none; }
}

/* Co-op %: a bar that goes from red to green with the value. */
.pct { --p: 0; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pct__track {
  position: relative; width: 64px; height: 8px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden; flex: none;
}
.pct__fill {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 1%); border-radius: inherit;
  background: hsl(calc(var(--p) * 1.2) 65% 45%);
}
.pct__n { font-size: 0.85rem; font-variant-numeric: tabular-nums; min-width: 3.2ch; }
.pct__voted { color: var(--ok); font-size: 0.8rem; font-weight: 700; }
.card__pct { margin-top: -2px; }
.card__pct .pct__track { width: 120px; }
.facts .pct__track { width: 90px; }

/* What's synced: one row per part of the game. */
.scope { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
.scope li { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.scope__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: none; }
.scope__v { margin-left: auto; font-weight: 500; font-size: 0.8rem; color: var(--muted); }
.scope li[data-v="yes"] .scope__dot, .scope li[data-v="shared"] .scope__dot, .scope li[data-v="per-player"] .scope__dot { background: var(--ok); }
.scope li[data-v="partial"] .scope__dot { background: var(--warn); }
.scope li[data-v="no"] .scope__dot { background: var(--error); }
.scope li[data-v="unknown"] { color: var(--muted); font-weight: 500; }
.scope li[data-v="unknown"] .scope__dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--off); }

.d-sources { margin: 0; padding-left: 18px; display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 0.9rem; }
.d-wanted p { margin: 0; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--wanted) 12%, var(--surface)); }

/* Community check: the numbers, then the vote form. */
.vote { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; background: var(--bg); }
.vote h3 { margin-top: 0; }
.vote__now { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.vote__now > div { display: grid; }
.vote__big { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.vote__outcomes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.85rem; color: var(--muted); }
.vote__outcomes .mono { color: var(--fg); font-weight: 600; }
.vote__form { display: grid; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.vote__q { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; font-weight: 600; font-size: 0.92rem; }
.vote__q legend { padding: 0; margin-bottom: 8px; }
.vote__q output { color: var(--accent); margin-left: 6px; }
.vote__form input[type="range"] { width: 100%; accent-color: var(--accent); }
.vote__form input[type="range"][data-touched="false"] { opacity: 0.6; }
.vote__scores, .vote__opts { display: flex; flex-wrap: wrap; gap: 6px; }
.vote__scores label, .vote__opts label { position: relative; cursor: pointer; }
.vote__scores input, .vote__opts input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.vote__scores span, .vote__opts span {
  display: inline-grid; place-items: center; min-width: 36px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-weight: 600; font-size: 0.88rem;
}
.vote__opts span { font-weight: 500; }
.vote__scores label:hover span, .vote__opts label:hover span { border-color: var(--accent); }
.vote__scores input:checked + span, .vote__opts input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.vote__scores input:focus-visible + span, .vote__opts input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.vote__send { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.vote__status { margin: 0; color: var(--muted); }
.vote__status[data-state="ok"] { color: var(--ok); font-weight: 600; }
.vote__status[data-state="error"] { color: var(--error); font-weight: 600; }

/* Game pages: the community line on each project card. */
.gp-community .pct__track { width: 90px; }
.col-genre .trunc, .card__meta .trunc { max-width: 160px; }
.gp-fact .scope { grid-template-columns: minmax(0, 1fr); gap: 4px; }

/* Made with Co-op Anything: the spotlight toggle under the search, and the badge on rows. */
.spotlight-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.spotlight {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 7px 14px 7px 8px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-soft), var(--surface));
  cursor: pointer; text-align: left;
}
.spotlight:hover { box-shadow: 0 0 0 4px var(--accent-soft); }
.spotlight__mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: #0e1017; color: #4fd1b5; font-family: var(--font-display); font-weight: 900; font-size: 1.05rem;
  box-shadow: inset 0 0 0 2px #4fd1b5;
}
.spotlight__text { display: grid; line-height: 1.25; }
.spotlight__text strong { font-size: 1rem; }
.spotlight__text span { font-size: 0.8rem; color: var(--muted); }
.spotlight__switch {
  position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line); margin-left: 4px; flex: none;
  transition: background-color 0.15s;
}
.spotlight__switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); transition: translate 0.15s;
}
.spotlight[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.spotlight[aria-pressed="true"] .spotlight__text span { color: var(--on-accent); opacity: 0.85; }
.spotlight[aria-pressed="true"] .spotlight__switch { background: var(--on-accent); }
.spotlight[aria-pressed="true"] .spotlight__switch::after { translate: 16px 0; background: var(--accent); }
.spotlight-link { font-weight: 600; font-size: 0.9rem; }
.ca-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.03em; vertical-align: 1px; white-space: nowrap;
}
.d-ca { border-left: 3px solid var(--accent); }

/* Made with Co-op Anything, as a filter in the dropdown row: the same pill at select height. */
.spotlight--field { height: 42px; padding: 0 10px 0 4px; gap: 9px; flex: none; }
.spotlight--field .spotlight__mark { width: 32px; height: 32px; font-size: 0.9rem; }
.spotlight--field .spotlight__text { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.spotlight--field .spotlight__text strong { font-size: 0.92rem; }

/* Latest releases: one slim strip under the filters. */
.pulse { display: block; padding-block: 14px 0; }
.pulse__strip {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.pulse__label {
  margin: 0; flex: none; font-family: var(--font-display); font-weight: 800; font-size: 0.95rem;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.pulse__strip .pulse__list {
  display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.pulse__chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 0; border-radius: 999px;
  background: var(--surface-2); font-size: 0.82rem; white-space: nowrap; cursor: pointer;
}
.pulse__chip:hover { background: var(--accent-soft); }
.pulse__chip strong { font-weight: 650; }
.pulse__chip .mono, .pulse__chip time { color: var(--muted); }
.pulse__strip .pulse__link { flex: none; }
@media (max-width: 760px) { .pulse__label { display: none; } }

/* /listing from Discord: the devs' topic button and their latest note. */
.btn--discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn--discord svg { margin-right: 6px; }
.d-devnote { border-left: 3px solid #5865f2; padding-left: 12px; }
.d-devnote p { margin: 0; }
.gp-listing { display: contents; }
.gp-devnote { flex-basis: 100%; font-size: 0.9rem; color: var(--muted); }
.gp-devnote strong { color: var(--fg); }

/* EN / RU switch (i18n.js), next to the theme button. */
.lang-btn { font-weight: 800; font-size: 0.82rem; letter-spacing: 0.04em; text-decoration: none; color: var(--fg); }

/* Latest releases now sits in the masthead, right under the stage tiles. */
.masthead .pulse { padding-block: 0; }

/* The details panel's buttons (Discord topic, repository...) stay pinned to the bottom while it scrolls. */
.d-links {
  position: sticky; bottom: 0; z-index: 3;
  margin: 0 -24px -24px; padding: 12px 24px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 18px -14px rgb(0 0 0 / 0.45);
}
@media (max-width: 560px) {
  .d-links { margin: 0 -16px -20px; padding: 10px 16px 12px; }
}

/* Dev login (account.js) */
.account { position: relative; }
.account__me { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px 0 8px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--fg); font-weight: 600; cursor: pointer; }
.account__me img { border-radius: 50%; }
.account__menu { position: absolute; right: 0; top: 48px; z-index: 20; min-width: 200px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.account__menu p { margin: 0 0 6px; }
@media (max-width: 1059px) { .account__me span, .account__login span { display: none; } .account__login { width: 42px; padding: 0; justify-content: center; } }

/* Devs' description and video (md.js) */
.md h4, .md h5, .md h6 { margin: 12px 0 4px; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md code { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 4px; border-radius: 4px; background: var(--surface-2); }
.d-devsummary { border-left: 3px solid #5865f2; padding-left: 12px; }
.video-embed { position: relative; aspect-ratio: 16 / 9; margin-top: 10px; border-radius: 10px; overflow: hidden; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.gp-devsummary { flex-basis: 100%; }
.btn--edit { background: var(--surface-2); color: var(--fg); border-color: var(--line); }

/* Listing editor (editor.js) */
dialog.editor { width: min(760px, calc(100% - 24px)); }
.editor__form { display: grid; gap: 12px; padding: 20px 22px 18px; }
.editor__head { position: relative; padding-right: 40px; }
.editor__head h2 { margin: 0; font-family: var(--font-display); text-transform: uppercase; }
.editor__head p { margin: 2px 0 0; }
.editor__head .d-close { position: absolute; right: 0; top: 0; }
.editor__form label { display: grid; gap: 4px; font-size: 0.88rem; font-weight: 600; }
.editor__form input, .editor__form select, .editor__form textarea { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--fg); }
.editor__form textarea { min-height: 200px; resize: vertical; font-family: var(--font-mono); font-size: 0.9rem; }
.editor__tabs { display: flex; align-items: center; gap: 4px; }
.editor__tabs [data-tab] { border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 4px 12px; border-radius: 8px; cursor: pointer; }
.editor__tabs [aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.editor__tools { margin-left: auto; display: flex; gap: 2px; }
.editor__tools button { min-width: 32px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); cursor: pointer; }
.editor__preview { min-height: 200px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.editor__count { margin: -6px 0 0; text-align: right; }
.editor__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 12px; }
.editor__sync { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.editor__sync legend { font-weight: 700; font-size: 0.88rem; padding: 0 4px; }
.editor__status { margin: 0; min-height: 1.2em; font-size: 0.9rem; }
.editor__status[data-state="ok"] { color: var(--ok); }
.editor__status[data-state="error"] { color: var(--error); }
.editor__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* My projects (my.js) */
.my-projects { display: grid; gap: 12px; padding-bottom: 40px; }
.my-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.my-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.my-row__main { display: grid; gap: 2px; min-width: 0; }
.my-row__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.my-search { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); max-width: 520px; }
.account__link { display: block; margin: 4px 0 8px; font-weight: 600; }

/* The details panel: the essentials, then one clear way to the game's full page. */
.d-fullpage {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; text-decoration: none; color: var(--on-accent);
  background: var(--accent); border-radius: var(--radius); box-shadow: 0 6px 18px -10px var(--accent);
}
.d-fullpage:hover { filter: brightness(1.08); }
.d-fullpage > span { display: grid; gap: 2px; }
.d-fullpage strong { font-size: 1.1rem; }
.d-fullpage span span { font-size: 0.88rem; opacity: 0.9; }
.d-rate > summary { cursor: pointer; font-weight: 700; padding: 4px 0; list-style-position: inside; }
.d-rate[open] > summary { margin-bottom: 8px; }

/* What's synced in the details panel: two even columns of label + value. */
#d-body .scope { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
#d-body .scope li { padding: 7px 10px; border-radius: 8px; background: var(--surface-2); min-width: 0; }
@media (max-width: 480px) { #d-body .scope { grid-template-columns: minmax(0, 1fr); } }
.d-devrated { display: block; margin-top: 2px; }

/* "Open full page" is the main button in the panel's sticky footer. */
.d-links .d-open { order: -1; flex: 1 1 100%; justify-content: center; min-height: 48px; font-size: 1.05rem; font-weight: 700;
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px -10px var(--accent); }
.d-links .d-open:hover { filter: brightness(1.08); }
@media (min-width: 620px) { .d-links .d-open { flex: 1 1 auto; } }

/* Editing a listing in place: the panel's own layout, with every value turned into a field. */
.ed { display: grid; gap: 18px; }
.ed-bar { display: grid; gap: 2px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent); }
.ed-bar span { font-size: 0.85rem; color: var(--muted); }
.ed-field { font: inherit; color: var(--fg); background: transparent; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 8px; padding: 5px 8px; width: 100%; min-width: 0; }
.ed-field:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ed-field:focus { outline: none; border-style: solid; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-field::placeholder { color: var(--muted); opacity: 0.85; }
select.ed-field { cursor: pointer; }
.ed-big { font-weight: 700; font-size: 1rem; }
.ed-grow { display: grid; gap: 4px; flex: 1; }
.ed-cover { display: grid; gap: 6px; width: 140px; flex: none; }
.ed-cover .ed-field { font-size: 0.75rem; padding: 4px 6px; }
.ed-facts dd { margin-top: 2px; }
.ed-scope li { gap: 8px; }
.ed-mini { margin-left: auto; width: auto; padding: 2px 6px; font-size: 0.82rem; }
.ed-tools { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.ed-tools button { min-width: 30px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); cursor: pointer; }
.ed-count { margin-left: auto; }
.ed-text { min-height: 140px; resize: vertical; font-family: var(--font-mono); font-size: 0.88rem; }
.ed-preview { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.ed-video:not(:empty) { margin-top: 4px; }
.ed-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.ed-pair label { display: grid; gap: 4px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ed-status { margin: 0; min-height: 1.2em; font-size: 0.9rem; }
.ed-status[data-state="ok"] { color: var(--ok); }
.ed-status[data-state="error"] { color: var(--error); }
@media (max-width: 560px) { .ed-cover { width: 110px; } }
.ed-cover__img .d-cover, .ed-cover__img .cover { width: 100%; }
.ed-cover__img .d-cover img { width: 100%; height: auto; max-height: 200px; object-fit: contain; }

/* Lucide icons in buttons and labels */
.icon { flex: none; vertical-align: -0.15em; }
.btn .icon { margin-right: 6px; }
.ed-tools button { display: inline-grid; place-items: center; }
.ed-tools .icon, .d-rate summary .icon, .ed-bar .icon { margin: 0; }
.d-rate summary .icon { color: var(--warn); }
