@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ── Design tokens ───────────────────────────────────── */
:root {
  /* Surface */
  --bg:          #F6F5F1;
  --surface:     #FFFFFF;
  --surface-2:   #F1F0EC;
  /* Ink */
  --ink:         #111827;
  --ink-muted:   #6B7280;
  --ink-faint:   #9CA3AF;
  /* Border */
  --border:      #E5E7EB;
  --border-focus:#93C5FD;
  /* Brand */
  --primary:     #0A6B3A;
  --primary-hov: #09552E;
  --primary-soft:#D1F4E3;
  /* Accent (hot, amber) */
  --hot:         #E0821A;
  --hot-soft:    #FEF3E2;
  /* Semantic */
  --success:     #0A6B3A;
  --success-soft:#D1F4E3;
  --danger:      #DC2626;
  --danger-soft: #FDE2E2;
  --info:        #2563EB;
  /* Live */
  --live-dot:    #EF4444;
  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  /* Radius */
  --rd: 10px;
  --rd-sm: 6px;
  /* Shadow */
  --shadow: 0 1px 2px rgba(17,24,39,.05), 0 1px 3px rgba(17,24,39,.10);
  --shadow-lg: 0 4px 12px rgba(17,24,39,.08);
  /* Font */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
  /* Theme-dependent bits used outside the palette above */
  --row-hover:   rgba(10,107,58,.03);
  /* Provider/category logos are near-universally white-on-transparent SVGs drawn for the
     dark public site (measured: 27 of 49 light-ink only, 0 dark-ink only), so the plate is
     dark in BOTH themes. A light plate makes most of them invisible. */
  --logo-plate:  #23251E;
  --logo-plate-ink: rgba(255,255,255,.10);
  --alert-success-ink:    #064E3B;
  --alert-success-border: #A7F3D0;
  --alert-danger-ink:     #7F1D1D;
  --alert-danger-border:  #FECACA;
  color-scheme: light;
}

/* ── Dark theme ──────────────────────────────────────
   Only the palette is redefined; every rule below reads tokens. */
:root[data-theme="dark"] {
  --bg:          #121310;
  --surface:     #1B1D18;
  --surface-2:   #24261F;
  --ink:         #ECEDE6;
  --ink-muted:   #A3A89B;
  --ink-faint:   #767B6E;
  --border:      #33362C;
  --border-focus:#3B82F6;
  --primary:     #1E9C57;
  --primary-hov: #26B364;
  --primary-soft:#123A26;
  --hot:         #F0A23C;
  --hot-soft:    #3A2A12;
  --success:     #1E9C57;
  --success-soft:#123A26;
  --danger:      #F87171;
  --danger-soft: #3B1A1A;
  --info:        #60A5FA;
  --live-dot:    #F87171;
  --row-hover:   rgba(255,255,255,.04);
  --alert-success-ink:    #A7F3D0;
  --alert-success-border: #1E5A3C;
  --alert-danger-ink:     #FECACA;
  --alert-danger-border:  #7F2A2A;
  --shadow:    0 1px 2px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.55);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ── Reset + base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────── */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--sp-4);
}

/* ── Header + nav ────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.site-header .logo a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.site-nav { display: none; }
.site-nav.open { display: flex; }
.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--rd-sm);
}
.site-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.site-nav a.active,
.site-nav a[href]:hover { color: var(--ink); }
.user-badge {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
}

/* Mobile hamburger */
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:last-child  { transform: translateY(-6px) rotate(-45deg); }

/* Mobile nav sheet */
.mobile-nav-sheet {
  display: none;
  position: fixed;
  inset: 0;
  top: 52px;
  background: var(--surface);
  padding: var(--sp-4);
  z-index: 99;
  flex-direction: column;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.mobile-nav-sheet.open { display: flex; }
.mobile-nav-sheet a {
  font-size: 1rem;
  font-weight: 500;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.mobile-nav-sheet a:last-child { border-bottom: none; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: 8px 16px;
  border-radius: var(--rd-sm);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hov);
  border-color: var(--primary-hov);
  text-decoration: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-1);
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(147,197,253,.25);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ── Filter bar ──────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rd);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.filter-bar .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: end;
}
.filter-bar .form-control { width: auto; min-width: 0; flex: 1 1 160px; }
.filter-bar .form-control.search { flex: 2 1 280px; }
.filter-toggle { display: none; }

/* ── Tables (desktop) ────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--rd);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
.data-table thead th {
  background: var(--surface-2);
  padding: var(--sp-3) var(--sp-3);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--row-hover); }
.data-table .mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* ── Cards (mobile game list) ──────────────────────── */
.card-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rd);
  padding: var(--sp-4);
  box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-img {
  width: 64px; height: 48px;
  border-radius: var(--rd-sm);
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.card-meta  { font-size: 0.8rem; color: var(--ink-muted); margin-top: 2px; }
.card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.card-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* ── Badges & chips ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.4;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-hot     { background: var(--hot-soft);     color: var(--hot); }
.badge-pill    { background: var(--surface-2);    color: var(--ink-muted); }

/* Hot number chip (amber) */
.hot-chip {
  background: var(--hot-soft);
  color: var(--hot);
  font-size: 0.72rem;
  font-weight: 700;
}
.hot-chip::before { content: '🔥'; font-size: 0.8em; margin-right: 2px; }

/* Hot flame icon (unicode, styled) — legacy badge use */
.hot-flame::before { content: '🔥'; font-size: 0.85em; margin-right: 2px; }

/* Priority chip */
.priority-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
}

/* Live dot */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live-dot);
  box-shadow: 0 0 0 2px rgba(239,68,68,.25);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%     { opacity: .55; }
}

/* ── Image thumb (games) ─────────────────────────────── */
.game-thumb {
  width: 60px; height: 44px;
  border-radius: var(--rd-sm);
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}

/* Hot banner: portrait 2:3, shown small beside the thumbnail and larger on Hot Images */
.thumb-pair { display: flex; align-items: center; gap: 4px; }
.game-thumb-hot { width: 30px; height: 44px; flex-shrink: 0; }
.hot-preview {
  width: 60px; height: 90px;
  border-radius: var(--rd-sm);
  object-fit: cover;
  background: var(--surface-2);
  display: block;
  flex-shrink: 0;
}

/* ── Pagination bar ─────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-5);
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border-radius: var(--rd-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
}
.page-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-size-select { width: auto !important; min-width: 110px; margin-left: var(--sp-3); }

/* ── Alerts ────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  margin-bottom: var(--sp-4);
  border-radius: var(--rd-sm);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.alert-success { background: var(--success-soft); color: var(--alert-success-ink); border: 1px solid var(--alert-success-border); }
.alert-danger  { background: var(--danger-soft);  color: var(--alert-danger-ink);  border: 1px solid var(--alert-danger-border); }

/* ── Upload file input ─────────────────────────────── */
.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--rd);
  padding: var(--sp-4);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
}
.file-drop:hover, .file-drop.has-file { border-color: var(--primary); background: rgba(10,107,58,.03); }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop .label { font-size: 0.85rem; font-weight: 500; color: var(--ink-muted); }
.file-drop .filename { font-size: 0.8rem; color: var(--primary); font-weight: 600; margin-top: 4px; }

/* Compact file-drop inside table cells */
td .file-drop {
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.8rem;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
}
td .file-drop .label { font-size: 0.78rem; }
td .file-drop .filename { font-size: 0.75rem; }

/* ── Page header ─────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ── Hide / show helpers (responsive) ────────────────── */
.hide-mobile  { display: none; }
.hide-desktop { display: block; }

/* ── Empty state ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  color: var(--ink-muted);
}
.empty-state h3 { color: var(--ink); margin-bottom: var(--sp-2); }

/* ── Logo tables (images/logos, provider + category lists) ── */
.provider-logo-cell img {
  width: 48px; height: 48px;
  border-radius: var(--rd-sm);
  object-fit: contain;
  background: var(--logo-plate);
  box-shadow: inset 0 0 0 1px var(--logo-plate-ink);
  padding: 5px;
}

/* ── Footer ────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: var(--sp-5) var(--sp-4);
  color: var(--ink-faint);
  font-size: 0.8rem;
}

/* ── Form page (narrow centered form) ───────────────── */
.form-page { max-width: 640px; }

/* ── Form layout grids ──────────────────────────────── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: var(--sp-4); }

/* ── Form hint (small help text) ────────────────────── */
.form-hint { font-size: 0.78rem; color: var(--ink-muted); margin-top: var(--sp-1); display: block; }
.form-hint code { font-family: var(--font-mono); font-size: 0.78rem; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }

/* ── Form actions row ───────────────────────────────── */
.form-actions { display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--border); }

/* ── Stat cards (import result) ─────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rd); padding: var(--sp-4); text-align: center; box-shadow: var(--shadow); }
.stat-card .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--ink-muted); margin-top: var(--sp-1); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card.stat-success .stat-value { color: var(--success); }
.stat-card.stat-warn    .stat-value { color: var(--hot); }
.stat-card.stat-danger  .stat-value { color: var(--danger); }

/* ── Info box ───────────────────────────────────────── */
.info-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--rd-sm); padding: var(--sp-4); margin-bottom: var(--sp-4); font-size: 0.88rem; }
.info-box code { font-family: var(--font-mono); font-size: 0.82rem; background: var(--surface); padding: 1px 4px; border-radius: 3px; border: 1px solid var(--border); }

/* Collapse grids to single column on mobile */
@media (max-width: 767px) {
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════════════════════
   Desktop (min-width: 1024px)
   ═════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .hide-mobile  { display: block; }
  .hide-desktop { display: none !important; }

  .site-header { padding: var(--sp-3) var(--sp-5); }
  .nav-toggle { display: none; }
  .mobile-nav-sheet { display: none !important; }
  .site-nav {
    display: flex !important;
    align-items: center;
    gap: var(--sp-1);
  }

  .container { padding: var(--sp-5); }

  .filter-bar .filter-row { flex-wrap: nowrap; }
  .filter-toggle { display: none; }

  h1 { font-size: 2rem; }
}

/* ── Medium (768–1023px) ─────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .hide-mobile  { display: block; }
  .hide-desktop { display: none !important; }
}

/* ── Theme toggle ──────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 6px 9px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-faint); }
:root[data-theme="dark"] .theme-toggle .icon-dark,
.theme-toggle .icon-light { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-light,
.theme-toggle .icon-dark { display: none; }

/* ── Public asset URL cells (provider + category logo URLs) ── */
.asset-url {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .7rem;
  line-height: 1.35;
  color: var(--ink-faint);
  word-break: break-all;
}
.asset-url:hover { color: var(--primary); }

/* ── Games: filters that wrap onto a second row ─────── */
.filter-bar .filter-row.filter-row-wrap { flex-wrap: wrap; }
#results[aria-busy="true"] { opacity: .55; transition: opacity .15s; }

/* ── Games: category chips ──────────────────────────── */
.cat-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.card .cat-chips { margin-top: var(--sp-2); }
.cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.cat-chip.is-inactive { border-style: dashed; opacity: .75; }
.cat-none { font-size: 0.78rem; color: var(--ink-faint); }

/* ── Games: row selection ───────────────────────────── */
.col-select { width: 40px; }
.col-select input, .card-select input, .select-page-mobile input {
  width: 16px; height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}
.data-table tbody tr:has(.col-select) { cursor: pointer; }
.data-table tbody tr.is-selected td { background: var(--primary-soft); }
.card:has(.card-select) { cursor: pointer; }
.card.is-selected { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.card-select { display: flex; align-items: center; padding: 4px; margin: -4px 0 -4px -4px; }
.select-page-mobile {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.85rem;
  color: var(--ink-muted);
}
#results.has-selection { padding-bottom: 96px; }

/* ── Games: floating bulk-categorise bar ────────────── */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: var(--sp-4);
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  width: max-content;
  max-width: calc(100vw - 2 * var(--sp-4));
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rd);
  box-shadow: var(--shadow-lg);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .form-control { width: auto; min-width: 190px; padding-top: 5px; padding-bottom: 5px; font-size: 0.85rem; }
.bulk-count { font-weight: 700; font-size: 0.85rem; white-space: nowrap; padding: 0 var(--sp-1); }
.bulk-matching { font-size: 0.82rem; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
@media (max-width: 767px) {
  /* The bar wraps to three rows on a phone; keep the page's last rows and pagination clear of it */
  .bulk-bar .form-control { flex: 1 1 100%; min-width: 0; }
  #results.has-selection { padding-bottom: 176px; }
}

/* ── Game form: category picker (checkbox chips) ────── */
.chip-picker { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.form-group .chip-option { position: relative; display: inline-flex; margin: 0; font-weight: 500; }
.chip-option input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip-option span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.82rem;
  transition: background .15s, border-color .15s, color .15s;
}
.chip-option:hover span { border-color: var(--ink-faint); color: var(--ink); }
/* "~" not "+": th:field puts Spring's hidden _categoryIds marker between the checkbox and the span */
.chip-option input:checked ~ span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip-option input:checked ~ span::before { content: '✓'; }
.chip-option input:focus-visible ~ span { box-shadow: 0 0 0 3px rgba(147,197,253,.35); }
.chip-option.is-inactive span { border-style: dashed; }
