:root {
  color-scheme: dark;
  --bg: #101014;
  --surface: #18181d;
  --surface-hover: #1e1e24;
  --control: #202026;
  --border: #303037;
  --text: #f0f0f3;
  --muted: #a1a1ad;
  --accent: #9147ff;
  --accent-hover: #a368ff;
  --accent-text: #c4a1ff;
  --danger: #f28b8b;
  --radius: 6px;
  --width: 1120px;
  --columns: minmax(0, 1fr) 142px 94px 58px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.hidden { display: none !important; }
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner, .footer-inner, .page { width: min(100% - 64px, var(--width)); margin-inline: auto; }
.header-inner { min-height: 65px; display: flex; align-items: center; gap: 36px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: -.025em; white-space: nowrap; }
.brand-icon { color: var(--accent-text); width: 24px; height: 24px; }
.main-nav { display: flex; align-self: stretch; }
.main-nav a { display: flex; align-items: center; font-weight: 600; font-size: 14px; padding: 0 2px; border-bottom: 2px solid transparent; }
.main-nav .nav-active { color: var(--accent-text); border-bottom-color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.twitch-link { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.twitch-link:hover { color: var(--text); }
.twitch-link svg:first-child { color: var(--accent-text); width: 16px; height: 16px; }
.external-icon { width: 13px; height: 13px; }
.btn { border: 1px solid transparent; min-height: 40px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border-radius: var(--radius); padding: 9px 15px; font-weight: 600; line-height: 1.35; white-space: nowrap; transition: background .14s, border-color .14s; }
.btn-small { min-height: 34px; font-size: 13px; padding: 7px 11px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; }
.btn-secondary { color: var(--text); background: var(--control); border-color: var(--border); }
.btn-secondary:hover { background: #2a2a31; border-color: #484850; }
.btn-secondary[aria-pressed="true"] { color: var(--accent-text); border-color: var(--accent); }
.account-button { color: var(--muted); background: transparent; border-color: var(--border); }
.account-button:hover { color: var(--text); background: var(--control); }
.page { flex: 1; padding-top: 48px; padding-bottom: 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 24px; }
h1 { font-size: 34px; line-height: 1.18; font-weight: 700; letter-spacing: -.04em; margin: 0 0 9px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; max-width: 660px; }
.list-summary { min-height: 28px; margin-bottom: 12px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list-summary strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-dot { margin-inline: 5px; color: #6f6f79; }
.tabs { display: flex; align-items: stretch; gap: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 12px 2px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-count { font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; opacity: .8; }
.tab-count:empty { display: none; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 20px 0 18px; }
.search-field { display: flex; align-items: center; gap: 10px; width: min(340px, 100%); min-height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); }
.search-field:focus-within { border-color: var(--accent); }
.search-field input { background: transparent; border: none; color: var(--text); width: 100%; min-width: 0; min-height: 39px; outline: none; }
.search-field input:focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: #858590; }
.sort-field { display: flex; align-items: center; gap: 10px; }
.sort-field label { color: var(--muted); font-size: 13px; white-space: nowrap; }
select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); min-height: 40px; padding: 7px 10px; max-width: 100%; }
.status-message:empty { display: none; }
.status-message { color: var(--danger); margin-bottom: 12px; }
.games-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; gap: 18px; }
.game-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; transition: border-color .15s ease; }
.game-card:hover { border-color: #52525b; }
.game-cover { display: block; position: relative; width: 100%; aspect-ratio: 460/215; overflow: hidden; background: #232329; border-bottom: 1px solid var(--border); }
.game-cover:focus-visible { outline-offset: -3px; }
.game-body { display: flex; flex-direction: column; flex: 1; gap: 17px; padding: 15px 16px 14px; }
.game-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--border); }
.vote-label { font-weight: 400; font-size: 12px; }
.steam-cover-image { width: 100%; height: 100%; object-fit: cover; }
.cover-loading { opacity: 0; }
.game-info { min-width: 0; }
.game-info h3 { font-weight: 600; font-size: 17px; line-height: 1.35; margin: 8px 0 0; overflow-wrap: anywhere; }
.game-category { font-size: 12px; color: var(--muted); margin-top: 5px; }
.game-note { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.game-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.game-status::before { content: ''; display: inline-block; width: 7px; height: 7px; flex-shrink: 0; background: #777780; border-radius: 50%; }
.badge-planned { color: var(--accent-text); }
.badge-planned::before { background: #a875ff; }
.badge-playing { color: #9bdbb4; }
.badge-playing::before { background: #55c58a; }
.badge-pending { color: #d8bd85; }
.badge-pending::before { background: #c8a361; }
.badge-rejected { color: var(--danger); }
.badge-rejected::before { background: var(--danger); }
.vote-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--control); color: var(--text); padding: 8px 11px; border-radius: var(--radius); min-width: 70px; min-height: 37px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vote-btn:hover:not(:disabled) { border-color: var(--accent); }
.vote-btn.voted { color: var(--accent-text); background: #2b2040; border-color: #7650ad; }
.vote-btn:disabled { color: var(--muted); opacity: .65; }
.vote-btn svg { width: 16px; height: 16px; }
.steam-link { color: var(--muted); display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 12px; }
.steam-link:hover { color: var(--text); }
.steam-link svg { width: 13px; height: 13px; }
.admin-editor { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 9px; border-top: 1px solid var(--border); padding: 12px 16px; background: var(--bg); }
.admin-editor label { color: var(--muted); font-size: 12px; }
.admin-editor select { width: 100%; min-width: 0; }
.admin-editor select { min-height: 34px; }
.delete-game { margin-left: 0; color: var(--danger); }
.empty-state { grid-column: 1 / -1; padding: 48px 20px; text-align: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.empty-state svg { width: 30px; height: 30px; color: var(--muted); margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; margin: 0 0 6px; font-weight: 600; }
.empty-state p { font-size: 14px; color: var(--muted); margin: 0; }
.empty-state .btn { margin-top: 18px; }
.result-count { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.footer-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dialog { width: min(560px, calc(100% - 28px)); max-height: min(86vh, 780px); padding: 0; border: 1px solid #3a3a43; border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 20px 80px #0008; overflow: auto; }
.dialog::backdrop { background: #000b; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.icon-button { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--radius); border: 0; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--control); color: var(--text); }
.dialog-body { padding: 18px 22px; }
.dialog-description { margin: 0 0 13px; color: var(--muted); font-size: 14px; }
.modal-search { width: 100%; background: var(--bg); }
.steam-results { max-height: min(30vh, 260px); overflow-y: auto; margin-top: 12px; }
.search-hint { padding: 16px 0; color: var(--muted); font-size: 13px; }
.search-error { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.steam-result { display: grid; width: 100%; grid-template-columns: 100px minmax(0, 1fr) 20px; gap: 12px; align-items: center; text-align: left; color: var(--text); background: transparent; border: 1px solid transparent; border-bottom: 1px solid var(--border); border-radius: 4px; padding: 9px 8px; }
.steam-result img { width: 100px; aspect-ratio: 460/215; height: auto; border-radius: 3px; background: #232329; }
.steam-result strong { font-weight: 600; overflow-wrap: anywhere; }
.steam-result .result-indicator { color: var(--muted); width: 18px; height: 18px; }
.steam-result:hover { background: var(--surface-hover); }
.steam-result.selected { background: #251d33; border-color: #7650ad; }
.steam-result.selected .result-indicator { color: var(--accent-text); }
.selected-game { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 15px; }
.selected-label { color: var(--muted); font-size: 12px; }
.selected-title { font-size: 15px; font-weight: 600; margin: 3px 0 13px; }
.selected-game label, .field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.selected-game label span { font-weight: 400; color: var(--muted); }
textarea, .password-input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 10px 12px; }
textarea { resize: vertical; min-height: 78px; }
.dialog-footer { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding: 14px 22px; background: var(--surface); }
.dialog-footer span { color: var(--muted); font-size: 12px; }
.auth-dialog { width: min(400px, calc(100% - 28px)); }
.auth-dialog .dialog-footer { justify-content: flex-end; }
.form-error { color: var(--danger); margin: 12px 0 0; font-size: 13px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100% - 40px)); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px; color: var(--text); background: #292930; box-shadow: 0 8px 20px #0005; z-index: 3; }
@media (max-width: 820px) {
  :root { --columns: minmax(0, 1fr) 112px 72px 47px; }
  .header-inner, .footer-inner, .page { width: calc(100% - 40px); }
  .header-inner { gap: 22px; }
  .header-actions { gap: 12px; }
  .games-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
}
@media (max-width: 600px) {
  .header-inner, .footer-inner, .page { width: calc(100% - 32px); }
  .header-inner { gap: 12px; min-height: 60px; flex-wrap: wrap; padding-block: 12px; }
  .brand { font-size: 15px; gap: 7px; }
  .brand-icon { width: 20px; height: 20px; }
  .main-nav { display: none; }
  .header-actions { gap: 10px; }
  .twitch-link .external-icon, .twitch-link span { display: none; }
  .twitch-link { padding: 6px; }
  .account-button { font-size: 12px; min-height: 32px; padding: 6px 9px; }
  .page { padding-top: 29px; padding-bottom: 36px; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 17px; margin-bottom: 18px; }
  h1 { font-size: 29px; }
  .page-heading p { font-size: 13px; }
  .tabs { gap: 12px; }
  .tab { font-size: 12px; gap: 5px; }
  .tab-count { font-size: 11px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; margin: 16px 0 14px; }
  .search-field { width: 100%; }
  .sort-field { justify-content: space-between; }
  .sort-field select { min-height: 36px; }
  .games-grid { grid-template-columns: 1fr; gap: 16px; }
  .game-body { padding: 14px; }
  .game-info h3 { font-size: 15px; }
  .game-category, .game-note { font-size: 12px; }
  .game-status { font-size: 12px; }
  .vote-btn { min-height: 35px; min-width: 62px; }
  .steam-link { padding-left: 4px; }
  .admin-editor { display: grid; grid-template-columns: 1fr 1fr; }

  .delete-game { margin-left: 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 4px; padding-block: 16px; }
  .dialog-header, .dialog-body, .dialog-footer { padding-inline: 16px; }
  .steam-result { grid-template-columns: 86px minmax(0, 1fr) 18px; gap: 9px; }
  .steam-result img { width: 86px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.search-diagnostics {width:100%; padding:10px; border:1px solid var(--line); border-radius:6px; font-size:12px;}
.search-diagnostics pre {white-space:pre-wrap; overflow-wrap:anywhere; margin:6px 0 0; font:12px/1.5 ui-monospace,monospace;}

/* Optional moderation control; the public list has exactly two tabs. */
.admin-archive-control { margin-top: 14px; color: var(--muted); font-size: 13px; }
.admin-archive-control label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.admin-archive-control input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
