/* Inter is self-hosted: no third-party request, and it renders the same for
   every visitor instead of silently falling back to the system font. */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Design tokens. Colours derive from the Gamelude logo: mint, violet, near-black.
   `--accent` is the global default; cards/hero/detail override it inline per game. */
:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* brand */
  --mint: #3df5c6;
  --violet: #8b5cf6;
  --violet-2: #a855f7;
  --brand-gradient: linear-gradient(135deg, var(--mint) 0%, var(--violet) 100%);
  --accent: var(--mint);

  /* one neutral scale */
  --bg-0: #0f1115;
  --bg-1: #15181e;
  --bg-2: #1c2027;
  --text: #f4f5f7;
  --text-2: #b3b9c6;
  --text-3: #7d8494;
  --text-inverse: #0f1115;

  /* surfaces and borders */
  --surface-1: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(255, 255, 255, 0.11);
  --panel-solid: rgba(21, 24, 30, 0.96);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-active: rgba(255, 255, 255, 0.32);
  --overlay: rgba(8, 9, 12, 0.6);

  /* semantics */
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.14);
  --danger-border: rgba(248, 113, 113, 0.4);
  --danger-text: #fecaca;
  --success: var(--mint);
  --success-bg: rgba(61, 245, 198, 0.12);
  --success-border: rgba(61, 245, 198, 0.4);
  --success-text: #9df5d6;
  --warning: #ffd166;

  /* Stat tile tones */
  --tone-mint: var(--mint);
  --tone-sky: #7cf7ff;
  --tone-gold: #ffd166;
  --tone-coral: #ff7a59;
  --tone-violet: var(--violet-2);

  /* shape, depth, motion, spacing */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.28);
  --shadow-raised: 0 16px 44px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 8px 26px color-mix(in srgb, var(--accent), transparent 55%);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --dur-fast: 150ms;
  --dur-med: 240ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  background: var(--bg-0);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 40% 0%, color-mix(in srgb, var(--mint), transparent 88%), transparent 24rem),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--violet), transparent 90%), transparent 30rem),
    var(--bg-0);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* Keyboard users get one consistent, visible ring everywhere. */
:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--mint);
  color: var(--text-inverse);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: var(--sp-4);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-0), transparent 22%);
  backdrop-filter: blur(24px);
}

/* Only this middle region scrolls; the brand above and the account box below
   stay pinned. The 4px of padding keeps focus rings (2px + 2px offset) from
   being clipped by the scroll box. */
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 4px 4px 0;
}

.sidebar-scroll > .search {
  margin-bottom: 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  /* 18 + the scroll region's 4px top padding = the old 22px gap. */
  margin-bottom: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  background: var(--brand-gradient);
  color: var(--text-inverse);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.2rem;
}

.brand span {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 0.86rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
}

.search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  min-width: 0;
}

.page-nav {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.page-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  color: var(--text);
}

.page-nav button.active {
  border-color: color-mix(in srgb, var(--mint), transparent 45%);
  background: color-mix(in srgb, var(--mint), transparent 86%);
  color: var(--text);
}

.games-filter-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface-1)),
    var(--surface-1);
}

.filter-panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 900;
}

.platform-filter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}

.platform-filter-list button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  color: var(--text);
  text-align: left;
}

.platform-filter-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--bg-0), transparent 48%);
}

.platform-filter-list button.active {
  border-color: color-mix(in srgb, var(--mint), transparent 25%);
  background: color-mix(in srgb, var(--mint), transparent 85%);
  color: var(--text);
}

.platform-filter-list button.active .platform-filter-logo {
  background: color-mix(in srgb, var(--mint), transparent 82%);
}

.platform-logo {
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
  filter: invert(1);
  opacity: 0.95;
}

.content-shell {
  padding: 24px;
  /* Entrance animations (hero-zoom starts at scale 1.07) must not widen the
     page mid-animation; clip, unlike hidden, creates no scroll container. */
  overflow-x: clip;
}

.main {
  display: grid;
  gap: 18px;
}

.games-page {
  display: block;
}

.hero {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background-position: center;
  background-size: cover;
  isolation: isolate;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg-0), transparent 8%), color-mix(in srgb, var(--bg-0), transparent 58%), color-mix(in srgb, var(--bg-0), transparent 16%)),
    linear-gradient(0deg, color-mix(in srgb, var(--bg-0), transparent 65%), transparent);
  z-index: -1;
}

.hero::after {
  position: absolute;
  right: 30px;
  bottom: 24px;
  width: 30%;
  height: 5px;
  content: "";
  border-radius: var(--r-pill);
  background: var(--brand-gradient);
  box-shadow: 0 0 34px color-mix(in srgb, var(--accent), transparent 40%);
}

.hero-content {
  display: grid;
  align-content: center;
  max-width: 690px;
  min-height: 410px;
  padding: 42px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-bottom: 16px;
  color: var(--accent);
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(3rem, 7vw, 6.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero p {
  max-width: 650px;
  margin: 18px 0 26px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.65;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 112px));
  gap: 10px;
}

.countdown-cell strong {
  font-variant-numeric: tabular-nums;
}

.countdown-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.countdown-grid.compact strong {
  font-size: 1.7rem;
}

/* "Out now" replaces the ticker once a game has shipped. */
.countdown-grid.released {
  grid-template-columns: 1fr;
}

.countdown-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: left;
  color: var(--accent);
}

.countdown-status svg {
  flex: 0 0 auto;
}

.countdown-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.countdown-status-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Only the hero's status hugs its content; in the detail meta row it fills its span. */
.hero .countdown-grid.released {
  width: fit-content;
  max-width: 100%;
}

.countdown-grid .countdown-status strong {
  font-size: 1.4rem;
  line-height: 1.1;
}

.countdown-status span {
  color: var(--text-2);
  font-size: 0.85rem;
}

.countdown-grid > div,
.stat,
.panel,
.library,
.watch-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  backdrop-filter: blur(18px);
}

.countdown-grid div {
  padding: 14px;
  border-radius: var(--r-sm);
}

.countdown-grid strong {
  display: block;
  font-size: 2.3rem;
  line-height: 1;
}

.countdown-grid span,
.stat span,
.panel-heading span {
  color: var(--text-2);
  font-size: 0.85rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  --tone: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 14px;
  border-radius: var(--r-sm);
}

.stat.tone-mint { --tone: var(--tone-mint); }
.stat.tone-sky { --tone: var(--tone-sky); }
.stat.tone-gold { --tone: var(--tone-gold); }
.stat.tone-coral { --tone: var(--tone-coral); }
.stat.tone-violet { --tone: var(--tone-violet); }

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--tone), transparent 78%);
  color: var(--tone);
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-size: 1.8rem;
}

.panel,
.library {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--r-sm);
}

.games-library {
  margin-top: 0;
}

.track-wide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent), white 18%);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
}

.track-wide.active {
  background: var(--accent);
  color: var(--text-inverse);
}

.sync-button,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
}

.sync-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.back-button {
  width: fit-content;
  margin-bottom: 16px;
}

.detail-page {
  display: grid;
  gap: 18px;
}

.detail-hero {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background-position: center;
  background-size: cover;
  isolation: isolate;
}

.detail-content {
  display: grid;
  align-content: end;
  max-width: 760px;
  min-height: 560px;
  padding: 42px;
}

.detail-content h1 {
  margin: 0;
  font-size: clamp(3rem, 6vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.detail-content p {
  max-width: 690px;
  margin: 18px 0 16px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.65;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.detail-actions .track-wide {
  width: auto;
  min-width: 160px;
  padding: 0 18px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.detail-ticker {
  grid-column: span 2;
}

.detail-ticker .countdown-grid > div {
  min-height: 82px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(280px, 0.8fr);
  gap: 12px;
}

.info-panel {
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  backdrop-filter: blur(18px);
}

.info-panel h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.info-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.detail-list {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
  margin-bottom: 14px;
}

.detail-list span {
  color: var(--text-2);
}

.detail-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-list span {
  min-height: 28px;
  padding: 6px 9px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--mint), transparent 88%);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
}

.screenshot-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.screenshot-strip img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  object-fit: cover;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.12rem;
}

.watch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.watch-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.watch-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent), white 18%);
  background: var(--surface-3);
}

.watch-cover-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-0), transparent 28%);
}

.watch-cover-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.watch-card-content {
  padding: 12px;
}

.watch-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.watch-card p {
  margin: 0 0 12px;
  color: var(--text-2);
}

.watch-card strong {
  display: block;
  margin-top: 10px;
  color: var(--accent);
}

.watch-card .platform-chips.compact {
  margin-bottom: 10px;
}

.progress-track {
  overflow: hidden;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.game-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent), white 18%);
}

.game-card.selected {
  border-color: var(--border);
}

.game-cover-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: color-mix(in srgb, var(--bg-0), transparent 25%);
}

.game-cover-wrap::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--bg-0), transparent 65%));
}

.game-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-content {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 178px;
  padding: 14px;
}

.select-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--bg-0), transparent 35%);
  color: var(--text);
  backdrop-filter: blur(16px);
}

.select-button.active {
  background: var(--accent);
  color: var(--text-inverse);
}

.release-chip.released {
  color: var(--text-2);
}

.release-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin-bottom: 10px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--bg-0), transparent 32%);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.game-card-content .release-chip {
  margin-top: -32px;
  backdrop-filter: blur(12px);
}

.game-card h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.08;
}

.game-card p {
  margin: 8px 0 10px;
  color: var(--text);
}

.platform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
}

.platform-chips.compact {
  gap: 6px;
  margin-bottom: 12px;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  max-width: 100%;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--bg-0), transparent 44%);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.platform-chips.compact .platform-chip {
  min-height: 22px;
  padding: 0 7px;
  font-size: 0.72rem;
}

.platform-chip.more {
  color: var(--accent);
}

.date-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed var(--surface-3);
  border-radius: var(--r-sm);
  color: var(--text-2);
  text-align: center;
}

@media (max-width: 1050px) {
  /* minmax(0, …), not a bare 1fr: a 1fr track's minimum is min-content, so the
     non-wrapping platform chip strip would widen the page past the viewport
     (pushing the menu button off-screen) instead of scrolling within itself. */
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats-row,
  .watch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-info-grid,
  .screenshot-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .content-shell {
    padding: 14px;
  }

  .hero,
  .hero-content {
    min-height: 500px;
  }

  .hero-content {
    padding: 24px;
  }

  .hero h1 {
    font-size: 3.15rem;
  }

  .countdown-grid,
  .stats-row,
  .watch-grid,
  .detail-meta {
    grid-template-columns: 1fr;
  }

  /* `span 2` in a one-column grid adds an implicit second column, which
     widened the page past the viewport on released games. */
  .detail-ticker {
    grid-column: 1 / -1;
  }

  .detail-hero,
  .detail-content {
    min-height: 560px;
  }

  .detail-content {
    padding: 24px;
  }

  .detail-content h1 {
    font-size: 3rem;
  }

  .admin-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .admin-head {
    display: none;
  }
}

/* --- Account box (sidebar) --- */
.account-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-1);
}

.account-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  background: var(--mint);
  color: var(--text-inverse);
  font-weight: 900;
}

.account-meta {
  min-width: 0;
}

.account-meta strong {
  display: block;
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta span {
  color: var(--text-2);
  font-size: 0.8rem;
}

.account-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
}

.account-action.primary {
  border-color: color-mix(in srgb, var(--mint), transparent 40%);
  background: color-mix(in srgb, var(--mint), transparent 84%);
  color: var(--text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-cta.secondary {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--bg-0), transparent 40%);
  color: var(--text);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid color-mix(in srgb, var(--accent), white 18%);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--bg-0), transparent 30%);
  color: var(--text);
  font-weight: 800;
  backdrop-filter: blur(12px);
}

/* --- Auth pages --- */
.auth-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 48px);
}

.auth-card {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-1);
  backdrop-filter: blur(18px);
}


.auth-card h1 {
  margin: 4px 0 0;
  font-size: 1.7rem;
}

.auth-sub {
  margin: 0;
  color: var(--text-2);
  line-height: 1.5;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--r-sm);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 0.9rem;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field span {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-field input {
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
}

.auth-field input:focus {
  border-color: color-mix(in srgb, var(--mint), transparent 30%);
}

.auth-submit {
  min-height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--mint);
  color: var(--text-inverse);
  font-weight: 900;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.auth-switch {
  color: var(--text-2);
  font-size: 0.9rem;
  text-align: center;
}

.auth-switch button {
  border: 0;
  background: transparent;
  color: var(--mint);
  font-weight: 800;
}

/* --- Admin panel --- */
.admin-page {
  display: grid;
  gap: 18px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: 0.86rem;
}

.admin-status-error {
  color: var(--danger-text);
}

.admin-table {
  display: grid;
  gap: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-1);
}

.admin-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-head {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-admin {
  color: var(--mint);
}

/* --- Admin API keys --- */
.keys-form {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.keys-field span {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.keys-current {
  color: var(--text-3);
  font-weight: 600;
  font-size: 0.78rem;
}

.keys-unset {
  color: var(--warning);
}

.keys-save {
  background: color-mix(in srgb, var(--mint), transparent 84%);
}

.keys-results {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.keys-result {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 0.88rem;
}

.keys-result.ok {
  border-color: color-mix(in srgb, var(--mint), transparent 55%);
  background: color-mix(in srgb, var(--mint), transparent 90%);
}

.keys-result.bad {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.page-empty {
  margin-top: 24px;
  min-height: 200px;
}

/* --- Compact account chip + popup menu --- */
.account {
  position: relative;
  margin-top: 14px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text);
}

.account-chip.open,
.account-chip:hover {
  border-color: color-mix(in srgb, var(--mint), transparent 55%);
  background: var(--surface-2);
}

.account-chip-email {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip-chevron {
  flex: 0 0 auto;
  color: var(--text-2);
  transition: transform 150ms ease;
}

.account-chip-chevron.flip {
  transform: rotate(180deg);
}

.account-avatar.small {
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
}

.account-avatar.large {
  width: 56px;
  height: 56px;
  font-size: 1.35rem;
}

.account-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--panel-solid);
  box-shadow: var(--shadow-raised);
  backdrop-filter: blur(20px);
}

.account-pop-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 6px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.account-pop-menu {
  display: grid;
  gap: 2px;
}

.account-pop-menu button,
.account-pop-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.account-pop-menu button:hover,
.account-pop-signout:hover {
  background: var(--surface-2);
}

.account-pop-signout {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  color: var(--danger-text);
}

/* --- Profile & Settings pages --- */
.profile-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.profile-name {
  margin: 0 0 4px;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.profile-role {
  color: var(--text-2);
}

.profile-list {
  grid-template-columns: 120px minmax(0, 1fr);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-label {
  display: flex;
  gap: 12px;
  align-items: center;
}

.settings-label strong {
  display: block;
}

.settings-label span {
  color: var(--text-2);
  font-size: 0.85rem;
}

/* ===================== Motion & interactions ===================== */

/* Tactile press + smooth transitions on every button. */
button {
  transition:
    transform 130ms var(--ease-out),
    background-color 170ms ease,
    border-color 170ms ease,
    box-shadow 220ms ease,
    color 170ms ease,
    filter 170ms ease;
}

button:active {
  transform: scale(0.95);
}

/* Hover lift / glow for the main interactive buttons (no transform here so it
   never fights the :active press scale). */
.page-nav button:hover,
.platform-filter-list button:hover,
.account-action:hover,
.account-chip:hover,
.sync-button:hover,
.back-button:hover,
.account-pop-menu button:hover,
.auth-switch button:hover {
  box-shadow: var(--shadow-hover);
  filter: brightness(1.08);
}

.track-wide:hover,
.auth-submit:hover:not(:disabled),
.account-action.primary:hover,
.hero-cta:hover {
  box-shadow: 0 8px 26px color-mix(in srgb, var(--accent), transparent 55%);
  filter: brightness(1.05);
}

.platform-filter-list button:hover .platform-filter-logo {
  filter: brightness(1.18);
}

/* Page navigation entrance — replays because content-shell is keyed by route. */
@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-shell {
  animation: page-enter 320ms var(--ease-out) both;
}

/* Card grid pop-in. */
@keyframes card-pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cards-grid .game-card,
.watch-grid .watch-card {
  animation: card-pop 360ms var(--ease-out) both;
}

/* Lively reveal when opening a game's detail page. */
@keyframes hero-zoom {
  from {
    opacity: 0.35;
    transform: scale(1.07);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.detail-hero {
  animation: hero-zoom 620ms var(--ease-out) both;
}

.detail-content > * {
  animation: rise 520ms var(--ease-out) both;
}

.detail-content > *:nth-child(1) { animation-delay: 0.04s; }
.detail-content > *:nth-child(2) { animation-delay: 0.10s; }
.detail-content > *:nth-child(3) { animation-delay: 0.16s; }
.detail-content > *:nth-child(4) { animation-delay: 0.22s; }
.detail-content > *:nth-child(5) { animation-delay: 0.28s; }
.detail-content > *:nth-child(6) { animation-delay: 0.34s; }

.detail-meta .stat,
.detail-info-grid .info-panel,
.screenshot-strip img {
  animation: rise 520ms var(--ease-out) both;
  animation-delay: 0.18s;
}

/* ===================== Platform brand colours ===================== */

.platform-chip {
  transition: transform 140ms ease, box-shadow 160ms ease;
}

.platform-chip.pf-playstation {
  border-color: rgba(30, 111, 240, 0.6); /* token-allow: platform brand */
  background: rgba(30, 111, 240, 0.2); /* token-allow: platform brand */
  color: #dbe8ff; /* token-allow: platform brand tint */
}

.platform-chip.pf-xbox {
  border-color: rgba(31, 178, 74, 0.55); /* token-allow: platform brand */
  background: rgba(31, 178, 74, 0.18); /* token-allow: platform brand */
  color: #d6ffe0; /* token-allow: platform brand tint */
}

.platform-chip.pf-switch {
  border-color: rgba(255, 68, 76, 0.55); /* token-allow: platform brand */
  background: rgba(255, 68, 76, 0.18); /* token-allow: platform brand */
  color: #ffdde0; /* token-allow: platform brand tint */
}

.platform-chip.pf-pc {
  border-color: rgba(56, 189, 248, 0.55); /* token-allow: platform brand */
  background: rgba(56, 189, 248, 0.16); /* token-allow: platform brand */
  color: #d6f2ff; /* token-allow: platform brand tint */
}

.platform-chip.pf-all {
  border-color: color-mix(in srgb, var(--mint), transparent 50%);
  background: color-mix(in srgb, var(--mint), transparent 86%);
  color: #d6fff4; /* token-allow: platform brand tint */
}

/* Sidebar platform filter list — tinted logo tiles + branded active state. */
.platform-filter-list button.pf-playstation .platform-filter-logo { background: rgba(30, 111, 240, 0.22); /* token-allow: platform brand */ }
.platform-filter-list button.pf-xbox .platform-filter-logo { background: rgba(31, 178, 74, 0.22); /* token-allow: platform brand */ }
.platform-filter-list button.pf-switch .platform-filter-logo { background: rgba(255, 68, 76, 0.22); /* token-allow: platform brand */ }
.platform-filter-list button.pf-pc .platform-filter-logo { background: rgba(56, 189, 248, 0.22); /* token-allow: platform brand */ }
.platform-filter-list button.pf-all .platform-filter-logo { background: color-mix(in srgb, var(--mint), transparent 82%); }

.platform-filter-list button.pf-playstation.active {
  border-color: rgba(30, 111, 240, 0.85); /* token-allow: platform brand */
  background: rgba(30, 111, 240, 0.16); /* token-allow: platform brand */
  color: var(--text);
}

.platform-filter-list button.pf-xbox.active {
  border-color: rgba(31, 178, 74, 0.8); /* token-allow: platform brand */
  background: rgba(31, 178, 74, 0.15); /* token-allow: platform brand */
  color: var(--text);
}

.platform-filter-list button.pf-switch.active {
  border-color: rgba(255, 68, 76, 0.8); /* token-allow: platform brand */
  background: rgba(255, 68, 76, 0.15); /* token-allow: platform brand */
  color: var(--text);
}

.platform-filter-list button.pf-pc.active {
  border-color: rgba(56, 189, 248, 0.8); /* token-allow: platform brand */
  background: rgba(56, 189, 248, 0.15); /* token-allow: platform brand */
  color: var(--text);
}

.platform-filter-list button.pf-all.active {
  border-color: color-mix(in srgb, var(--mint), transparent 20%);
  background: color-mix(in srgb, var(--mint), transparent 85%);
  color: var(--text);
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Infinite scroll */
.scroll-sentinel {
  width: 100%;
  height: 1px;
}

.load-more-note {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  color: var(--text-2);
  text-align: center;
  font-size: 0.9rem;
}

/* --- Profiles, avatars and member management ---------------------------- */

.account-avatar.avatar-image {
  object-fit: cover;
  display: block;
}

.avatar-edit {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar-edit-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.avatar-file {
  display: none;
}

.field-hint {
  font-size: 12px;
  color: var(--text-3);
}

.field-hint.bad {
  color: var(--danger-text);
}

.profile-form,
.member-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 18px 0 8px;
  max-width: 520px;
}

.profile-form textarea {
  resize: vertical;
  font: inherit;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg-0), transparent 45%);
  color: inherit;
  padding: 10px 12px;
}

.member-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.member-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--mint);
}

.members-table .admin-row {
  grid-template-columns: minmax(180px, 2fr) 100px 150px minmax(200px, 1fr);
  align-items: center;
}

.member-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.member-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member-names strong,
.member-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-email {
  font-size: 12px;
  color: var(--text-3);
}

.member-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: inherit;
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.link-button:hover:not(:disabled) {
  background: var(--surface-3);
}

.link-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.link-button.danger:hover:not(:disabled) {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

@media (max-width: 860px) {
  .members-table .admin-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* --- Admin area: its own sidebar ---------------------------------------- */

.admin-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bg-0), transparent 45%);
  border: 1px solid var(--border);
}

.admin-nav-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.admin-nav-title strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.admin-nav-title span {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 11px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.admin-nav-item.active {
  background: color-mix(in srgb, var(--mint), transparent 88%);
  border-color: color-mix(in srgb, var(--mint), transparent 68%);
  color: var(--success-text);
  border-left: 3px solid transparent;
  border-image: var(--brand-gradient) 1;
  border-image-width: 0 0 0 3px;
}

.admin-nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.admin-nav-text strong {
  font-size: 14px;
  font-weight: 600;
}

.admin-nav-text span {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-item.active .admin-nav-text span {
  color: color-mix(in srgb, var(--success-text), transparent 40%);
}

.admin-nav-count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
}

.admin-content {
  display: grid;
  gap: 18px;
  min-width: 0;
  animation: page-enter 280ms var(--ease-out) both;
}

.admin-stack {
  display: grid;
  gap: 18px;
}

.overview-notes {
  display: grid;
  gap: 4px;
  margin: 14px 0 4px;
  color: var(--text-2);
  font-size: 14px;
}

.overview-notes p {
  margin: 0;
}

@media (max-width: 980px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
  }

  .admin-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .admin-nav-item {
    width: auto;
    flex: 1 1 150px;
  }
}

/* --- Toasts ------------------------------------------------------------- */

.toast-region {
  position: fixed;
  inset: auto 0 var(--sp-4) 0;
  z-index: 60;
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
  padding: 0 var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: min(480px, 100%);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text-2);
  border-radius: var(--r-md);
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow-raised);
  pointer-events: auto;
  animation: page-enter var(--dur-med) var(--ease-out) both;
}

.toast.ok {
  border-left-color: var(--success);
}

.toast.bad {
  border-left-color: var(--danger);
  color: var(--danger-text);
}

.toast-dismiss {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  opacity: 0.7;
}

.toast-dismiss:hover {
  background: var(--surface-2);
  opacity: 1;
}

@media (min-width: 681px) {
  .toast-region {
    inset: auto var(--sp-5) var(--sp-5) auto;
    justify-items: end;
    padding: 0;
  }
}

/* --- Brand ---------------------------------------------------------------- */

.sidebar-top {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}

.brand-wordmark-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.brand-wordmark {
  display: block;
  width: 100%;
  height: auto;
}

/* Sidebar header: cat mark + text wordmark on one row, tagline beneath. */
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Both files are cropped to their exact artwork, so matching heights line the
   cat and the wordmark up optically — no manual nudging. */
.brand-row img.brand-mark-image,
.brand-row img.brand-wordmark {
  flex: 0 0 auto;
  width: auto;
  height: 36px;
  max-width: none;
}

/* Sidebar/drawer: mark beside the name, so the brand block stays one row tall
   and the navigation starts near the top of the panel. */
.brand-compact {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-compact strong,
.brand-compact span {
  display: block;
}

.brand-compact strong {
  font-size: 1.16rem;
  line-height: 1.15;
}

.brand-compact span {
  margin-top: 1px;
  color: var(--text-2);
  font-size: 0.82rem;
}

/* Auth card: the full stacked lockup, centred. */
.auth-brand {
  display: grid;
  justify-items: center;
  margin-bottom: 4px;
}

.auth-brand .brand-wordmark {
  max-width: 186px;
}

.brand-wordmark-wrap.is-lockup {
  align-items: center;
}

.brand-tagline {
  color: var(--text-2);
  font-size: 0.85rem;
}

.brand-mark-image {
  display: block;
  object-fit: contain;
  background: transparent;
}

/* --- Search field --------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.search input[type="search"]::-webkit-search-cancel-button,
.search input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
}

.search-clear:hover {
  color: var(--text);
}

.search-hint {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* --- Top bar + drawer (small screens) ------------------------------------- */

.topbar,
.sidebar-backdrop,
.filter-strip,
.drawer-close {
  display: none;
}

@media (max-width: 1050px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-solid);
    backdrop-filter: blur(18px);
  }

  .topbar .search {
    flex: 1 1 auto;
    height: 40px;
    min-width: 0;
  }

  .topbar-brand {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
  }

  .topbar-brand .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-text {
    font-weight: 700;
  }

  .menu-toggle,
  .drawer-close {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
  }

  .drawer-close {
    width: 36px;
    height: 36px;
  }

  /* The drawer puts a close button beside the brand, and the rigid 36px
     wordmark row pushed it half out of the panel. Let the row shrink instead:
     both images by the same fraction, so their heights still match. */
  .sidebar-top .brand,
  .sidebar-top .brand-wordmark-wrap {
    min-width: 0;
  }

  .sidebar-top .brand-row {
    max-width: 100%;
  }

  .sidebar-top .brand-row img.brand-mark-image,
  .sidebar-top .brand-row img.brand-wordmark {
    flex: 0 1 auto;
    min-width: 0;
    height: auto;
    max-height: 36px;
  }

  /* The sidebar keeps its markup and becomes an off-canvas drawer. The
     visibility transition keeps it out of the tab order while closed. */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(320px, 86vw);
    height: 100dvh;
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--shadow-raised);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform var(--dur-med) var(--ease-out),
      visibility 0s linear var(--dur-med);
  }

  .sidebar.open {
    transform: none;
    visibility: visible;
    transition-delay: 0s;
  }

  .sidebar .search {
    display: none;
  }

  .sidebar-scroll {
    overscroll-behavior: contain;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    padding: 0;
    border: 0;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-med) ease;
  }

  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  html.nav-open {
    overflow: hidden;
  }

  /* Horizontal platform chips so filtering never needs the drawer. */
  .filter-strip {
    display: block;
    padding: 10px 14px 0;
  }

  .platform-filter-list.strip {
    display: flex;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .platform-filter-list.strip::-webkit-scrollbar {
    display: none;
  }

  .platform-filter-list.strip button {
    display: inline-flex;
    flex: 0 0 auto;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px 0 6px;
    border-radius: var(--r-pill);
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .platform-filter-list.strip .platform-filter-logo {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 680px) {
  .topbar .brand-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .content-shell {
    padding: 12px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .hero h1,
  .detail-content h1 {
    font-size: 2.4rem;
  }

  .countdown-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* --- Images: shimmer while loading, branded fallback on error ------------- */

.cover-frame,
.cover-fallback {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.cover-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-med) ease;
}

.cover-frame.loading .cover-img {
  opacity: 0;
}

.cover-frame.loading::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(100deg, var(--surface-1) 30%, var(--surface-3) 50%, var(--surface-1) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.cover-fallback {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  background: var(--bg-1);
  color: var(--text-3);
  font-weight: 700;
  font-size: 1.4rem;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* --- Cards: real links, hover lift, press, selected state ----------------- */

.game-card {
  display: flex;
  flex-direction: column;
  transition:
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-med) ease;
}

.game-card-content {
  flex: 1 1 auto;
  min-height: 0;
}

.game-card .date-row {
  margin-top: auto;
  padding-top: 10px;
}

.game-card-link {
  color: inherit;
  text-decoration: none;
}

/* The link's overlay makes the whole card the hit area; the star sits above it. */
.game-card-link::after {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: inherit;
}

.game-card-link:focus-visible {
  outline: 0;
}

.game-card:has(.game-card-link:focus-visible),
.watch-card:has(.game-card-link:focus-visible) {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.game-card .select-button {
  z-index: 2;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent), white 18%);
  box-shadow: var(--shadow-raised);
}

.game-card:hover .cover-img {
  transform: scale(1.04);
}

.game-card:active {
  transform: translateY(-2px) scale(0.985);
}

.game-card.selected {
  border-color: color-mix(in srgb, var(--mint), transparent 50%);
}

.game-card.selected .select-button {
  background: var(--mint);
  border-color: var(--mint);
  color: var(--text-inverse);
}

/* Only the first batch after a load animates in, staggered; appended pages
   and re-renders don't replay it. */
.cards-grid .game-card:not(.animate) {
  animation: none;
}

.cards-grid .game-card.animate {
  animation-delay: calc(var(--i, 0) * 30ms);
}

.watch-card {
  position: relative;
}

/* --- Catalog grid chrome: filters, skeletons, errors, load more ----------- */

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border: 1px solid color-mix(in srgb, var(--mint), transparent 55%);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--mint), transparent 88%);
  font-size: 0.85rem;
}

.filter-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: inherit;
}

.filter-chip button:hover {
  background: var(--surface-3);
}

.skeleton-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-1);
}

.skeleton-block {
  border-radius: 6px;
  background: linear-gradient(100deg, var(--surface-1) 30%, var(--surface-3) 50%, var(--surface-1) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-cover {
  aspect-ratio: 16 / 9;
  border-radius: 0;
}

.skeleton-lines {
  display: grid;
  gap: 10px;
  padding: 16px 14px 18px;
}

.skeleton-lines .skeleton-block {
  height: 12px;
}

.skeleton-lines .tall {
  height: 20px;
}

.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-55 { width: 55%; }
.w-80 { width: 80%; }

.error-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--danger-border);
  border-radius: var(--r-sm);
  background: var(--danger-bg);
}

.error-state p {
  margin: 0 0 6px;
  color: var(--text-2);
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 18px 0 4px;
}

/* --- Detail page ---------------------------------------------------------- */

.info-panel {
  min-height: 0;
}

.detail-info-grid.single {
  grid-template-columns: minmax(0, 1fr);
}

.detail-info-grid.double {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Two columns leave ~170px each on a phone, which broke the Game details
   values mid-word; stack them like the rest of the page. */
@media (max-width: 680px) {
  .detail-info-grid.double {
    grid-template-columns: minmax(0, 1fr);
  }
}

.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -6px 0 12px;
}

.genre-chips span {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--bg-0), transparent 40%);
  font-size: 0.8rem;
  color: var(--text-2);
}

.detail-actions .store-link {
  text-decoration: none;
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--bg-0), transparent 40%);
}

.screenshot-thumb {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  cursor: zoom-in;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) ease;
}

.screenshot-thumb:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
}

.lightbox {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-1);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.lightbox::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(6px);
}

.lightbox-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.lightbox-body img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 80px);
  border-radius: var(--r-sm);
  object-fit: contain;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
}

/* --- Hero without a cover yet: keep the accent glow instead of a flat box -- */

.hero.no-cover,
.detail-hero.no-cover {
  background-image:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent), transparent 78%), transparent 55%),
    linear-gradient(135deg, var(--bg-2), var(--bg-0));
}

/* --- Auth: password visibility ------------------------------------------- */

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.8rem;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--text);
}

.platform-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-rest);
}

.info-panel,
.stat {
  transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.info-panel:hover,
.stat:hover {
  border-color: var(--border-strong);
}

/* Safety net for long store copy: hero and detail intros stay a few lines,
   whatever the sync writes into `description`. */
.hero-content > p,
.detail-content > p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

@media (max-width: 680px) {
  .hero-content > p,
  .detail-content > p {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }
}

/* --- Admin: per-key guidance -------------------------------------------- */

.panel-intro {
  max-width: 68ch;
  margin: 14px 0 4px;
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.55;
}

.keys-form {
  gap: 22px;
}

.keys-field-block {
  display: grid;
  gap: 8px;
  max-width: 640px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.keys-help {
  display: grid;
  gap: 5px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-2);
}

.keys-help p {
  margin: 0;
}

.keys-help a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--mint);
  text-decoration: none;
  white-space: nowrap;
}

.keys-help a:hover {
  text-decoration: underline;
}

.keys-help-note {
  color: var(--text-3);
}

/* The cover is a click target for the game page. */
.game-cover-wrap,
.watch-cover-wrap {
  cursor: pointer;
}

/* --- Search focus: light up the whole field, not a box inside it ---------- */

.search input:focus-visible {
  outline: none;
}

.search:focus-within {
  border-color: color-mix(in srgb, var(--mint), transparent 30%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mint), transparent 75%);
}

/* --- Legal pages, links and account deletion ------------------------------ */

.sidebar-legal {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) 2px var(--sp-2);
  color: var(--text-3);
  font-size: 0.82rem;
}

.sidebar-legal a,
.auth-legal a {
  color: var(--text-2);
  text-decoration: none;
}

.sidebar-legal a:hover,
.auth-legal a:hover {
  color: var(--text);
  text-decoration: underline;
}

.auth-legal {
  margin: 0;
  color: var(--text-3);
  font-size: 0.82rem;
  line-height: 1.5;
}

.legal-page {
  max-width: 760px;
  line-height: 1.65;
}

.legal-page h1 {
  margin: 0 0 var(--sp-1);
  font-size: 1.9rem;
}

.legal-page h2 {
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: 1.1rem;
}

.legal-page p,
.legal-page li {
  color: var(--text-2);
}

.legal-page ul {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding-left: 1.2rem;
}

.legal-page strong {
  color: var(--text);
}

.legal-page a {
  color: var(--mint);
}

.legal-updated {
  margin: 0;
  color: var(--text-3);
  font-size: 0.85rem;
}

.not-found h1 {
  margin: 0 0 var(--sp-2);
}

.not-found p {
  margin: 0 0 var(--sp-4);
  color: var(--text-2);
}

.sync-button.danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}
