:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --border: #2a2a4a;
  --accent: #e94560;
  --green: #57cc99;
  --red: #e63946;
  --text: #eaeaea;
  --muted: #8a8a9a;
}

/* Alternate neutral-grey palette, toggled via the header button
   (initThemeToggle, shared.js) — see docs/plans/grey-theme-toggle.md.
   --accent/--green/--red/--text are semantic (links, recommend/not-
   recommend, main text) rather than "the grey backdrop", so they stay the
   same in both themes; only the neutral surface levels change. */
:root[data-theme="grey"] {
  --bg: #1a1a1a;
  --surface: #242424;
  --border: #3a3a3a;
  --muted: #9a9a9a;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Scrollbar theming — html (not just body) so it covers the page scrollbar
   and, since scrollbar-color/-width inherit, every scrollable element inside
   it too (dropdowns, textareas, code blocks) without repeating this per
   element. admin.html links this file but redefines these same custom
   property names with its own darker values in its own later <style> block,
   so these rules pick up admin's colors there automatically — no duplicate
   scrollbar CSS needed in admin.html itself. */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--surface);
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 3px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding: 1rem 2rem;
  border-bottom: 2px solid var(--accent);
}

#site-title {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Same "RR" mark as the favicon (FAVICON_SVG, shared.js), just colored via
   currentColor instead of that SVG's own hardcoded light/dark colors — a
   favicon can't see the page's CSS custom properties, but this inline copy
   is in the DOM, so it can just inherit #site-title's color (and its hover
   transition to --accent) directly instead of duplicating that logic. */
#site-logo {
  flex-shrink: 0;
}

#site-title:hover { color: var(--accent); }

#header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#admin-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.3rem;
  line-height: 1;
}

#admin-link:hover { color: var(--text); }

#theme-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

#theme-toggle:hover { color: var(--text); }

#app {
  max-width: 860px;
  margin: 3rem auto 3rem;
  padding: 0 1rem;
}

/* ── Tag filters ── */

#title-search-bar {
  max-width: 860px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
  display: flex;
  gap: 0.5rem;
}

#title-search {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text);
}

#title-search::placeholder { color: var(--muted); }
#title-search:focus { outline: none; border-color: var(--accent); }

#tag-filters {
  /* #app itself has no visible border, so its true 860px extent is never
     apparent — only its .card children are, inset by #app's own 1rem
     padding on each side. #tag-filters' border/background makes its own
     edge directly visible, so it needs that same 2rem taken off to match
     the cards' effective width instead of reading as wider than them. */
  max-width: calc(860px - 2rem);
  margin: 1.5rem auto 0;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

#tag-filters.collapsed { display: none; }

/* Sits directly in #sort-controls next to #date-filter-group (see below),
   not its own panel — picking a year fills the range to that year, picking
   the blank placeholder back clears it (see clearDateRange in app.js).
   Muted by default like the row's other neutral controls; .sort-active
   (toggled in app.js whenever a range is actually applied) reuses the exact
   same active look .tag-filter.sort-active uses elsewhere in this row. */
#date-range-year {
  background: var(--border);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

#date-range-year.sort-active { background: var(--surface); border-color: var(--accent); color: var(--text); }

#date-range-year:focus { outline: none; border-color: var(--accent); }

#recommend-filter-row {
  max-width: calc(860px - 2rem);
  margin: 1rem auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
}

/* Leads #recommend-filter-row now, so only a trailing divider (before
   Recommended) is needed — no border-left, since nothing precedes it. */
#sort-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.6rem;
  border-right: 1px solid var(--border);
}

/* Pushed to the far end of the row via margin-left: auto — same idea
   #tags-toggle-controls used to use before Tags moved next to Recommended,
   just applied straight to the button itself now rather than a wrapper div. */
#clear-all-btn {
  margin-left: auto;
}

/* #date-sort-btn (a plain .tag-filter/.sort-active pill, same as
   #playtime-sort-btn/#price-sort-btn — its label swaps between "Release
   Date"/"Review Date") + #date-field-swap (flips which of those two is
   active) read as one compound pill — same two-zone idea as
   .tag-filter-pinned/.tag-filter-pinned-remove, just built from a .tag-filter
   base plus a bare icon button instead of that class's own markup. */
#date-filter-group {
  display: flex;
  align-items: stretch;
}
#date-filter-group #date-sort-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
#date-field-swap {
  background: var(--border);
  border: 1px solid transparent;
  border-left: 1px solid var(--bg);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
  color: var(--muted);
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
#date-field-swap:hover { color: var(--text); border-color: var(--accent); border-left-color: var(--bg); }

#tag-filters-top {
  display: flex;
  position: relative;
}

#tag-search {
  flex: 1;
  background: var(--border);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.4rem 2rem 0.4rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text);
}

#tag-search::placeholder { color: var(--muted); }
#tag-search:focus { outline: none; border-color: var(--accent); }

#tag-search-clear {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 50%;
  cursor: pointer;
}
#tag-search-clear:hover { color: var(--text); }

#tag-filters-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

/* Always visible, regardless of whether #tag-filters-active has anything in
   it — unlike that row's own visibility, this divider isn't conditional. */
#tag-filter-groups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#tag-filters-bottom {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.tag-filter-empty { color: var(--muted); font-size: 0.85rem; }

.tag-filter {
  background: var(--border);
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.tag-filter:hover { color: var(--text); border-color: var(--accent); }
.tag-filter.included { background: var(--green); border-color: var(--green); color: #0f2a1e; }
.tag-filter.excluded { background: var(--red); border-color: var(--red); color: #fff; text-decoration: line-through; }
/* Playtime/Price sort toggles (#sort-controls) — a direction, not an
   include/exclude choice, so this is deliberately its own neutral "active"
   look rather than reusing .included/.excluded's green/red. */
.tag-filter.sort-active { background: var(--surface); border-color: var(--accent); color: var(--text); }

/* Pinned pills in the "Filter tags:" row (renderActiveTagFilters, app.js) —
   a two-button pill (label + ×) rather than a single .tag-filter button,
   since a native <button> can't nest another clickable <button> inside it. */
.tag-filter-pinned {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  background: var(--border);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.2rem 0.35rem 0.2rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.tag-filter-pinned.included { background: var(--green); border-color: var(--green); color: #0f2a1e; }
.tag-filter-pinned.excluded { background: var(--red); border-color: var(--red); color: #fff; }
.tag-filter-pinned-label {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}
.tag-filter-pinned.excluded .tag-filter-pinned-label { text-decoration: line-through; }
.tag-filter-pinned-label:hover { text-decoration: underline; }
.tag-filter-pinned.excluded .tag-filter-pinned-label:hover { text-decoration: line-through underline; }
.tag-filter-pinned-remove {
  background: none;
  border: none;
  padding: 0.1rem 0.3rem;
  color: inherit;
  opacity: 0.7;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
}
.tag-filter-pinned-remove:hover { opacity: 1; background: rgba(0, 0, 0, 0.15); }

/* Truncation indicator appended by truncateTagGroup() (app.js) — not
   interactive, so it deliberately doesn't pick up .tag-filter's pointer
   cursor/hover styling. line-height: normal matches the <button> tag pills'
   UA-default line-height — without it, this <span> inherits the body's 1.6,
   rendering visibly taller than the row it's in and throwing off
   truncateTagGroup()'s one-line-height measurement. */
.tag-filter-more { cursor: default; flex: none; line-height: normal; }
.tag-filter-more:hover { color: var(--muted); border-color: transparent; }

/* ── Tag badges on cards ── */

.tag-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.tag-badge {
  background: var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.tag-more-btn {
  cursor: pointer;
  border: none;
  font-weight: 700;
  line-height: 1;
  padding: 0.3rem 0.65rem;
}
.tag-more-btn:hover { background: var(--accent); color: #fff; }

/* A two-column grid, label | badges, with .tag-group made display:contents
   so its label + badges become direct grid items instead of a nested flex
   row — that's what makes every group's badges column start at the same x
   position regardless of how long that row's own category label is (grid
   sizes column 1 to the widest label across ALL rows, not just its own).
   Badges still wrap within their own column (see .tag-group-badges), lining
   up under the first badge rather than back under the label. */
.tag-list-full {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  row-gap: 0.85rem;
  column-gap: 0.5rem;
  margin-top: 0.6rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.tag-list-full .tag-group { display: contents; }
.tag-list-full .tag-group-label { padding-top: 0.2rem; }
.tag-group-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.tag-group-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.75;
}

/* ── Cards ── */

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.card:not(:first-of-type){
  margin-top: 3rem;
}

.card:has(.review-tabs) {
  border-top-right-radius: 0;
}

.card:hover,
.card.expanded {
  border-color: var(--accent);
}

.card.expanded:not(:first-of-type) {
  margin-top: 3rem;
}

.card-main {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: center;
}

.card-cover {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-info h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.steam-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: color 0.15s;
}

.steam-link:hover { color: var(--accent); }

.card-chevron {
  color: var(--muted);
  font-size: 0.7rem;
  flex-shrink: 0;
  padding-left: 0.5rem;
}

/* ── Badges ── */

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-weight: 700;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.yes { background: var(--green); color: #0f2a1e; }
.badge.no  { background: var(--red);   color: #fff; }

.summary {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.meta {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Expanded detail ── */

.card-expanded {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  animation: expandIn 0.18s ease;
}

@keyframes expandIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.expanded-body {
  line-height: 1.8;
  margin-bottom: 1rem;
}

/* Hidden by default — the active tab's own name is already readable on the
   .review-tab pill itself at desktop widths. Shown at mobile widths instead,
   where .review-tab-label gets hidden because multi-word tab names wrap
   inside their own narrow pill otherwise (see the mobile breakpoint below). */
.mobile-tab-heading {
  display: none;
}

/* Hidden by default, same reasoning as .mobile-tab-heading above — shown at
   mobile widths in place of .review-tab-label (see renderCard/mobileTabMarker,
   shared.js): that tab's icon if it has one, else an uppercase abbreviation. */
.review-tab-mobile-marker {
  display: none;
}

/* Shared intro text shown above a level's sub-tabs pill row regardless of
   which sub-tab is active (renderSubTabLevel, shared.js) — same spacing
   rhythm as .sub-tabs itself below it. */
.sub-tabs-preamble {
  margin-bottom: 0.75rem;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.sub-tab {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* A sub-tab of a sub-tab (renderSubTabLevel, shared.js) — slightly smaller
   so a stack of these rows reads as a hierarchy rather than duplicate tab
   bars. */
.sub-tabs-nested {
  margin-bottom: 0.6rem;
}
.sub-tabs-nested .sub-tab {
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
}

.expanded-body .bb-h1 {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}

.expanded-body .bb-h2 {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}

.expanded-body .bb-h3 {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}

/* Optional heading for a [list=Header]/[olist=Header] block (renderBBCode,
   shared.js) — same look as .bb-h2, sitting directly above that list's own
   ul/ol below it. */
.expanded-body .bb-list-header {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}

/* Optional heading for a [table=Header] block (docs/plans/table-fields.md)
   — same look as .bb-list-header, sitting directly above that table. */
.expanded-body .bb-table-header {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}

.expanded-body ol {
  margin: 0 0 0.55rem 1.2rem;
}

.expanded-body ol li {
  padding: 0.15rem 0;
}

.expanded-body .bb-quote {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 0.85rem;
  margin: 0.5rem 0;
  color: var(--muted);
  font-style: italic;
}

.expanded-body .bb-code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
  margin: 0.5rem 0;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
}

.expanded-body .bb-spoiler {
  background: var(--border);
  color: var(--border);
  border-radius: 3px;
  padding: 0 0.2rem;
  cursor: default;
}

.expanded-body .bb-spoiler:hover {
  background: transparent;
  color: inherit;
}

.expanded-body a {
  color: var(--accent);
  text-decoration: underline;
}

/* [tablink=...] (renderBBCode, shared.js) — a real <button> for click
   handling (see app.js), styled to read as plain body text (its icon is
   what marks it as a link, not link coloring/underline) rather than a
   default browser button. Deliberately plain `inline`, not `inline-flex`/
   `inline-block` — either of those makes the button an atomic inline-level
   box that, when it doesn't fit the remaining width on its line, shrinks to
   fit and wraps its own text internally instead of flowing with the
   surrounding paragraph text like normal text does. The icon span (see the
   [tablink] handler below) uses the same plain-inline + position:relative
   nudge renderTabIcon already uses elsewhere, not flex, for the same reason. */
.expanded-body .tab-link {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.expanded-body table.bb-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.expanded-body table.bb-table th,
.expanded-body table.bb-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.expanded-body table.bb-table th {
  background: var(--surface);
}

.expanded-body .bb-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

/* ── Review tabs (book-index tabs hanging off the top-right edge) ── */

.review-tabs {
  position: absolute;
  right: -1px;
  left: 1.5rem;
  bottom: calc(100% + 1px);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.review-tab {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 0.5rem 0.9rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 -2px 3px rgba(0, 0, 0, 0.15);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.review-tab:hover  { color: var(--text); }
.review-tab.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
  margin-bottom: -1px;
  border-bottom-width: 2px;
}

.card-expanded section {
  margin-top: 1.25rem;
}

.card-expanded section h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card-permalink {
  margin-top: 1.25rem;
  font-size: 0.78rem;
}

.card-permalink a {
  color: var(--muted);
  text-decoration: none;
}

.card-permalink a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.card-expanded ul {
  list-style: none;
  padding: 0;
}

.card-expanded ul li {
  padding: 0.2rem 0 0.2rem 1.2rem;
  position: relative;
}

.card-expanded ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.card-expanded .verdict {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}

/* ── Empty / error states ── */

.state-msg {
  color: var(--muted);
  text-align: center;
  margin-top: 4rem;
  font-size: 1rem;
}

/* ── Mobile (≤640px) — see docs/plans/mobile-support.md ── */

@media (max-width: 640px) {
  /* .review-tab (book-index tabs) has no white-space:nowrap, so a
     multi-word tab name wraps inside its own narrow pill at this width,
     ballooning the whole .review-tabs row. Emptying the pills and showing
     the name as .mobile-tab-heading instead (see renderCard, shared.js)
     keeps them as clickable, appropriately-highlighted tabs without the
     wrapped text. */
  .review-tab-label {
    display: none;
  }

  /* Without the label, .review-tab shrinks to just its padding/border — big
     enough to notice but too small to comfortably tap. Pad it out to a
     proper touch-target size instead, and center the marker below inside it
     (a <button>'s default display doesn't do that on its own). */
  .review-tab {
    min-width: 3.5rem;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* With the name hidden, show each tab's compact marker instead (its icon,
     or an uppercase abbreviation if it has none — see mobileTabMarker,
     shared.js) so there's still some way to tell them apart at a glance
     before tapping one. */
  .review-tab-mobile-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .mobile-tab-heading {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
  }

  /* #sort-controls' own flex-wrap and #recommend-filter-row's wrap around it
     pack unevenly at this width (e.g. the Year select stranding alone with
     empty space beside it). A deliberate two-column grid instead pairs
     Playtime/Price, Release Date/Year, and Recommended/Tags on their own
     lines regardless of each control's natural content width — flex-wrap
     can't guarantee that pairing, grid placement can. Also gives the whole
     row some breathing room off the screen edges, which it had none of
     before (unlike #title-search-bar/#app, which already pad themselves). */
  #recommend-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  /* Its own three rows (Sort By / Playtime+Price / Release Date+Year), so it
     spans both of #recommend-filter-row's columns rather than sitting in one. */
  #recommend-filter-row > #sort-controls {
    grid-column: 1 / -1;
  }

  #sort-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  #sort-controls > .tag-group-label {
    grid-column: 1 / -1;
  }

  /* Unlike the buttons beside it, a <select>'s own text renders left-aligned
     by default rather than centered, which reads as inconsistent next to
     Playtime/Price/Recommended/etc. */
  #date-range-year {
    text-align: center;
  }

  /* Was a border-right, separating this group from Recommended/Tags/Clear
     on their shared line — now a border-bottom, same job stacked. */
  #sort-controls {
    padding-right: 0;
    border-right: none;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
  }

  #date-filter-group #date-sort-btn {
    flex: 1;
  }

  /* .card-main lays the cover image beside .card-info/.card-chevron on
     desktop — too cramped at this width. Grid so .card-cover spans both
     columns on row 1 (its own full-width row), leaving .card-info/
     .card-chevron to auto-place side by side on row 2, same relative
     layout as desktop. */
  .card-main {
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .card-cover {
    grid-column: 1 / -1;
    width: 100%;
    height: 180px;
  }

  /* Alone rather than paired — spans both columns instead of sitting
     half-width. Was pushed to the row's far end via margin-left:auto on
     desktop, which no longer means anything in a grid. */
  #clear-all-btn {
    grid-column: 1 / -1;
    margin-left: 0;
  }
}
