/* ─── Reset & Variables ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #07080f;
  --bg2:        #0d0f1c;
  --surface:    #111427;
  --surface2:   #161929;
  --surface3:   #1c2035;
  --border:     #252a45;
  --border2:    #333a60;
  --primary:    #7c3aed;
  --primary2:   #9d5bf4;
  --primary3:   #5b21b6;
  --cyan:       #06b6d4;
  --cyan2:      #22d3ee;
  --gold:       #f59e0b;
  --text:       #e2e8f0;
  --text-dim:   #94a3b8;
  --text-muted: #4a5568;
  --success:    #22c55e;
  --error:      #ef4444;
  --warning:    #f59e0b;
  --radius:     12px;
  --radius-sm:  8px;
  --sidebar-w:  240px;
  --nav-h:      64px;
  --glow-p:     0 0 24px rgba(124,58,237,.3), 0 0 48px rgba(124,58,237,.12);
  --glow-c:     0 0 24px rgba(6,182,212,.25), 0 0 48px rgba(6,182,212,.1);
}

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

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ─── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(7,8,15,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 8px;
}
.nav-logo {
  font-size: 1.35rem; font-weight: 800;
  background: linear-gradient(135deg, #fff 20%, var(--cyan2) 60%, var(--primary2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px; white-space: nowrap; margin-right: 16px;
}
.nav-logo span { -webkit-text-fill-color: var(--primary2); }
.nav-links {
  display: flex; align-items: center; gap: 2px; flex: 1;
  overflow-x: auto; scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 0.875rem; color: var(--text-dim); white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--surface3); color: var(--text); }
.nav-links a.active {
  background: rgba(124,58,237,0.15);
  color: var(--primary2); font-weight: 500;
}

/* ─── Hero Banner ──────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 64px 24px 48px;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124,58,237,.18) 0%, transparent 70%);
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 40% 30% at 80% 50%, rgba(6,182,212,.06) 0%, transparent 60%);
  pointer-events: none;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900; line-height: 1.1; margin-bottom: 14px;
  background: linear-gradient(135deg, #ffffff 0%, var(--cyan2) 40%, var(--primary2) 80%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-title span {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--primary2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  color: var(--text-dim); font-size: 1.05rem; margin-bottom: 32px; max-width: 520px; margin-inline: auto;
}
.hero-search {
  display: flex; gap: 10px; max-width: 480px; margin: 0 auto 40px;
}
.hero-search input {
  flex: 1; padding: 12px 18px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.hero-search input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.hero-search button {
  padding: 12px 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff; border: none; border-radius: var(--radius);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.hero-search button:hover { opacity: 0.88; transform: translateY(-1px); }

/* ─── Page Layout ──────────────────────────────────────────────────────────── */
.page { max-width: 1320px; margin: 0 auto; padding: 32px 24px; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.7rem; font-weight: 700; }

/* ─── Category Pills ───────────────────────────────────────────────────────── */
.category-filter {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px;
}
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 24px;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-dim);
  transition: all 0.15s; cursor: pointer;
}
.cat-pill:hover { border-color: var(--primary); color: var(--text); }
.cat-pill.active {
  background: linear-gradient(135deg, var(--primary3), var(--primary));
  border-color: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}

/* ─── Games Grid ───────────────────────────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.games-empty {
  grid-column: 1/-1; text-align: center;
  padding: 80px 20px; color: var(--text-muted);
}
.games-empty .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.games-empty p { font-size: 1.05rem; }

/* ─── Game Card ────────────────────────────────────────────────────────────── */
.game-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--glow-p);
}
.game-card-img {
  position: relative; aspect-ratio: 16/9;
  background: var(--surface2); overflow: hidden;
}
.game-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.game-card:hover .game-card-img img { transform: scale(1.04); }
.game-card-no-thumb {
  width: 100%; height: 100%; display: flex;
  align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text-muted);
  background: linear-gradient(135deg, var(--surface2), var(--surface3));
}
.game-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.22s;
}
.game-card:hover .game-card-overlay { opacity: 1; }
.play-btn {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff; padding: 11px 26px; border-radius: 28px;
  font-size: 0.95rem; font-weight: 700;
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
  transform: translateY(6px); transition: transform 0.22s;
}
.game-card:hover .play-btn { transform: translateY(0); }
.game-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cat-badge-sm {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 600; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.game-card-title { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.game-card-desc { font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; flex: 1; }

/* ─── Game Player ──────────────────────────────────────────────────────────── */
.player-page { padding: 24px; max-width: 1320px; margin: 0 auto; }
.player-container {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--glow-p);
}
.game-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; display: block; }
.player-loading {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 16px; color: var(--text-dim);
  background: var(--bg);
}
.spinner {
  width: 42px; height: 42px; border: 3px solid var(--border2);
  border-top-color: var(--primary2); border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-details { margin-top: 24px; }

.player-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.player-title-left { display: flex; flex-direction: column; gap: 8px; }
.player-game-title { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin: 0; }
.player-title-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

.player-body {
  display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start;
}
.player-desc-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.player-section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-dim); margin: 0 0 12px;
}
.player-desc {
  color: var(--text-dim); font-size: 0.93rem; line-height: 1.75; margin: 0;
  white-space: pre-line;
}
.player-meta-col {}
.player-meta-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 0;
}
.player-meta-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.player-meta-row:last-child { border-bottom: none; padding-bottom: 0; }
.player-meta-row:first-child { padding-top: 0; }
.meta-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-dim);
}
.meta-value { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.meta-link { color: var(--primary2); }
.meta-link:hover { color: var(--cyan); }
.btn-youtube {
  display: inline-flex; align-items: center; gap: 8px;
  background: #dc2626; color: #fff;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  transition: background 0.15s, transform 0.15s;
}
.btn-youtube:hover { background: #b91c1c; transform: translateY(-1px); }

/* ─── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 0.9rem; display: flex; align-items: flex-start; gap: 8px;
}
.alert-success { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25); color: var(--success); }
.alert-error   { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.25);  color: var(--error); }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: var(--warning); }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm); border: none;
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  transition: all 0.15s; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff; box-shadow: 0 2px 12px rgba(124,58,237,0.35);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(124,58,237,0.55); transform: translateY(-1px);
}
.btn-danger   { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; transform: translateY(-1px); }
.btn-ghost    { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border2); color: var(--text); background: var(--surface2); }
.btn-sm   { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg   { padding: 13px 30px; font-size: 1rem; font-weight: 600; }
.btn-block { width: 100%; }

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-draft       { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-published   { background: rgba(34,197,94,0.12);  color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-unpublished { background: rgba(148,163,184,0.1); color: #64748b;        border: 1px solid rgba(148,163,184,0.2); }

/* ─── Card ─────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-pad { padding: 24px; }

/* ─── Count Badge ──────────────────────────────────────────────────────────── */
.count-badge {
  background: var(--surface3); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; color: var(--text-dim);
}

/* ─── Game Modal ────────────────────────────────────────────────────────────── */
.game-modal {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  flex-direction: column;
}
.game-modal.open { display: flex; }
.game-modal-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; flex-shrink: 0;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
}
.game-modal-title {
  flex: 1; font-weight: 600; font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.modal-close-btn {
  background: #ef4444; color: #fff; border: none;
  padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 0.82rem; font-weight: 600;
  transition: opacity 0.15s;
}
.modal-close-btn:hover { opacity: 0.82; }

/* Scrollable content area */
.game-modal-scroll { flex: 1; overflow-y: auto; }

/* Game iframe fixed-height area */
.game-modal-frame-wrap {
  position: relative; width: 100%;
  aspect-ratio: 16/9; max-height: 70vh;
  background: #000; overflow: hidden;
}
.game-modal-frame-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none; display: block;
}

/* Details below game */
.game-modal-details {
  display: grid; grid-template-columns: 1fr 240px; gap: 24px;
  padding: 24px; max-width: 1320px; margin: 0 auto; width: 100%; box-sizing: border-box;
}
.modal-details-left {}
.modal-game-title { font-size: 1.5rem; font-weight: 800; margin: 8px 0 0; line-height: 1.2; }
.modal-detail-desc {
  color: var(--text-dim); font-size: 0.92rem; line-height: 1.75;
  margin: 0; white-space: pre-line;
}
.modal-details-right {}
.modal-meta-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column;
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  margin-top: 80px; padding: 32px 24px;
  border-top: 1px solid var(--border);
  text-align: center; color: var(--text-muted); font-size: 0.85rem;
  background: var(--bg2);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/*  ADMIN PANEL                                                               */
/* ═══════════════════════════════════════════════════════════════════════════ */

.admin-wrap { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0;
}
.sidebar-logo {
  padding: 22px 20px 16px;
  font-size: 1.2rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary2), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo small {
  display: block; font-size: 0.68rem; font-weight: 400;
  color: var(--text-muted); margin-top: 2px;
  -webkit-text-fill-color: var(--text-muted);
}
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover   { background: var(--surface3); color: var(--text); }
.sidebar-nav a.active  {
  background: rgba(124,58,237,0.15);
  color: var(--primary2); font-weight: 500;
  border-left: 2px solid var(--primary);
  padding-left: 12px;
}
.sidebar-nav .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-section {
  padding: 8px 14px 4px;
  font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-top: 6px;
}
.sidebar-footer { padding: 14px 8px; border-top: 1px solid var(--border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.72rem; color: var(--text-muted); }
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--error); font-size: 0.85rem; cursor: pointer;
  background: none; border: none; width: 100%;
  transition: background 0.15s;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.08); }

/* ── Admin Main ──────────────────────────────────────────────────────────── */
.admin-main { flex: 1; min-width: 0; padding: 32px; background: var(--bg); }
.admin-page-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 28px; flex-wrap: wrap;
}
.admin-page-header h2 { font-size: 1.5rem; font-weight: 700; }
.header-actions { margin-left: auto; display: flex; gap: 10px; }

/* ── Stats Grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(124,58,237,0.15); }
.stat-icon { font-size: 1.6rem; }
.stat-value {
  font-size: 2.2rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 0.78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table thead tr { border-bottom: 2px solid var(--border); }
.data-table th { padding: 10px 16px; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-muted); padding: 56px !important; }

/* Game row */
.game-row { display: flex; align-items: center; gap: 12px; }
.game-thumb { width: 60px; height: 34px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.game-row strong { display: block; font-size: 0.9rem; }
.game-slug { font-size: 0.75rem; color: var(--text-muted); }
.cat-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; color: #fff; }
.action-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 7px; font-size: 0.875rem; color: var(--text-dim); font-weight: 500; }
.form-group input[type=text],
.form-group input[type=url],
.form-group input[type=password],
.form-group input[type=number],
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.form-group textarea { resize: vertical; }
.form-group small { display: block; margin-top: 5px; font-size: 0.78rem; color: var(--text-muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 12px; margin-top: 26px; }
.optional { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; margin-left: 4px; }

/* Slug row */
.slug-row { display: flex; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.slug-row:focus-within { border-color: var(--primary); }
.slug-prefix { padding: 0 12px; color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; border-right: 1px solid var(--border); height: 42px; display: flex; align-items: center; }
.slug-row input { border: none; background: transparent; flex: 1; border-radius: 0; }
.slug-row input:focus { outline: none; border: none; box-shadow: none; }

/* YouTube */
.yt-wrap { display: flex; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.yt-wrap:focus-within { border-color: #ef4444; }
.yt-icon { padding: 0 12px; color: #ef4444; font-size: 1.1rem; border-right: 1px solid var(--border); height: 42px; display: flex; align-items: center; }
.yt-wrap input { border: none; background: transparent; flex: 1; border-radius: 0; }
.yt-wrap input:focus { outline: none; border: none; box-shadow: none; }

/* File drop */
.file-drop {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 120px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.file-drop:hover { border-color: var(--primary); background: rgba(124,58,237,0.04); }
.file-drop.has-file { border-color: var(--success); background: rgba(34,197,94,0.04); }
.file-drop-icon { font-size: 2rem; }
.file-drop span { font-size: 0.9rem; color: var(--text-dim); }
.file-drop small { font-size: 0.78rem; color: var(--text-muted); }

/* Upload progress */
.upload-progress { margin: 20px 0; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.85rem; color: var(--text-dim); }
.progress-bar { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: 3px; transition: width 0.3s; }

/* ── Admin Login ─────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; width: 100%; max-width: 400px;
  position: relative; overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}
.login-logo {
  font-size: 1.5rem; font-weight: 800; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 30px; }

/* ── Recent List ─────────────────────────────────────────────────────────── */
.recent-list { display: flex; flex-direction: column; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: none; }
.recent-thumb { width: 48px; height: 27px; object-fit: cover; border-radius: 4px; background: var(--surface3); flex-shrink: 0; }
.recent-info { flex: 1; min-width: 0; }
.recent-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-date { font-size: 0.75rem; color: var(--text-muted); }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .admin-main { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .hero { padding: 40px 20px 32px; }
  .hero-title { font-size: 1.8rem; }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }
  .player-body { grid-template-columns: 1fr; }
  .player-title-row { flex-direction: column; }
  .player-title-actions { width: 100%; }
  .game-modal-details { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 480px) {
  .page { padding: 16px; }
  .navbar { padding: 0 16px; }
  .admin-page-header { flex-direction: column; align-items: flex-start; }
  .header-actions { margin-left: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 1 — accounts (navbar account menu, sign-in, settings)
   Appended; nothing above this line is modified.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Navbar account slot ─────────────────────────────────────────────────── */
.nav-account { margin-left: auto; display: flex; align-items: center; padding-left: 14px; }

.nav-signin {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--primary, #6366f1); color: #fff;
  font-size: .85rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: filter .15s ease;
}
.nav-signin:hover { filter: brightness(1.12); }

.acct { position: relative; }
.acct > summary { list-style: none; cursor: pointer; }
.acct > summary::-webkit-details-marker { display: none; }

.acct-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border, #2a2a35);
  background: var(--surface, #17171f);
}
.acct-trigger:hover { border-color: var(--primary, #6366f1); }

.acct-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; flex: 0 0 32px; display: block;
}
.acct-avatar-gen {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .95rem; line-height: 1;
}
.acct-name {
  font-size: .85rem; font-weight: 600; color: var(--text, #e8e8ef);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 200px; padding: 6px;
  background: var(--surface, #17171f);
  border: 1px solid var(--border, #2a2a35);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.acct-form { margin: 0; }
.acct-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 7px; border: 0; background: none;
  color: var(--text, #e8e8ef); font-size: .875rem; font-family: inherit;
  text-decoration: none; cursor: pointer;
}
.acct-item:hover { background: var(--surface2, #22222c); }
.acct-item-cta { color: var(--primary2, #a5b4fc); font-weight: 600; }
.acct-signout { color: #f87171; }

/* ── Sign-in / username card ─────────────────────────────────────────────── */
.auth-page { max-width: 460px; }
.auth-card {
  background: var(--surface, #17171f);
  border: 1px solid var(--border, #2a2a35);
  border-radius: 14px; padding: 28px 26px;
}
.auth-title { font-size: 1.4rem; margin: 0 0 6px; }
.auth-sub   { color: var(--text-muted, #9a9aae); font-size: .9rem; line-height: 1.55; margin: 0 0 20px; }

.auth-alert {
  padding: 11px 14px; border-radius: 9px; margin-bottom: 16px;
  font-size: .875rem; line-height: 1.5; border: 1px solid transparent;
}
.auth-alert-success { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .35); color: #6ee7b7; }
.auth-alert-error   { background: rgba(239, 68, 68, .12);  border-color: rgba(239, 68, 68, .35);  color: #fca5a5; }
.auth-alert-info    { background: rgba(99, 102, 241, .12); border-color: rgba(99, 102, 241, .35); color: #a5b4fc; }

.auth-google { min-height: 44px; }
.auth-google-stub {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; border-radius: 999px;
  border: 1px solid var(--border, #2a2a35); background: var(--surface2, #22222c);
  color: var(--text-muted, #9a9aae); font-size: .9rem; font-weight: 600;
  font-family: inherit; cursor: not-allowed; opacity: .65;
}
.auth-google-mark {
  width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #444;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}
.auth-stub-note {
  margin: 10px 0 0; font-size: .78rem; line-height: 1.5;
  color: var(--text-muted, #9a9aae);
}
.auth-stub-note code {
  background: var(--surface2, #22222c); padding: 1px 5px; border-radius: 4px; font-size: .95em;
}

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-dim, #6b6b7d); font-size: .78rem; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border, #2a2a35);
}

.auth-form { margin: 0; }
.auth-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 7px; }
.auth-input {
  width: 100%; padding: 11px 14px; margin-bottom: 14px;
  background: var(--bg, #0f0f14); border: 1px solid var(--border, #2a2a35);
  border-radius: 9px; color: var(--text, #e8e8ef); font-size: .95rem; font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--primary, #6366f1); }
.auth-input-code {
  font-size: 1.5rem; letter-spacing: .5em; text-align: center; font-weight: 700;
  padding-left: .5em;
}
.auth-hint { font-size: .78rem; color: var(--text-muted, #9a9aae); margin: -8px 0 14px; line-height: 1.5; }

.btn-block { display: block; width: 100%; text-align: center; justify-content: center; }

.auth-resend { margin: 14px 0 0; text-align: center; }
.auth-linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
  color: var(--primary2, #a5b4fc); font-size: .85rem; text-decoration: underline;
}
.auth-fineprint {
  margin: 18px 0 0; font-size: .78rem; line-height: 1.6; color: var(--text-dim, #6b6b7d);
}
.auth-fineprint a { color: var(--text-muted, #9a9aae); }

/* ── Account settings ────────────────────────────────────────────────────── */
.acct-card {
  background: var(--surface, #17171f);
  border: 1px solid var(--border, #2a2a35);
  border-radius: 12px; padding: 22px 24px; margin-bottom: 18px;
}
.acct-card-danger { border-color: rgba(239, 68, 68, .35); }
.acct-card-title { font-size: 1rem; margin: 0 0 16px; }
.acct-copy { color: var(--text-muted, #9a9aae); font-size: .875rem; line-height: 1.65; margin: 0 0 14px; }

.acct-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.acct-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: 0 0 72px;
  font-size: 1.9rem;
}
.acct-username { font-size: 1.05rem; font-weight: 700; }
.acct-email    { font-size: .85rem; color: var(--text-muted, #9a9aae); margin-top: 2px; }
.acct-meta     { font-size: .78rem; color: var(--text-dim, #6b6b7d); margin-top: 6px; display: inline-block; }
.acct-link     { color: var(--primary2, #a5b4fc); text-decoration: underline; }

.acct-form-row { margin: 0 0 14px; }
.acct-label { display: block; font-size: .85rem; font-weight: 600; margin: 14px 0 7px; }
.acct-label code { background: var(--surface2, #22222c); padding: 1px 6px; border-radius: 4px; }
.acct-input {
  width: 100%; padding: 10px 13px;
  background: var(--bg, #0f0f14); border: 1px solid var(--border, #2a2a35);
  border-radius: 8px; color: var(--text, #e8e8ef); font-size: .9rem; font-family: inherit;
}
.acct-input:focus { outline: none; border-color: var(--primary, #6366f1); }
.acct-input-sm { max-width: 340px; }

@media (max-width: 640px) {
  .nav-account { padding-left: 8px; }
  .acct-name { display: none; }
  .auth-card { padding: 22px 18px; }
}

/* ─── Leaderboards (Phase 3, DESIGN §6) ────────────────────────────────────── */
/* Two consumers, one set of rules: the game-page sidebar widget and the full
   /game/{slug}/leaderboard page. The row markup is identical in both (and in
   the JS that redraws it after a submission), so the layout lives on .lb-row
   and only the card around it changes. */

.player-meta-col { display: flex; flex-direction: column; gap: 16px; }

.lb-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.lb-card-full { padding: 22px; }

.lb-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.lb-title  { font-size: 0.95rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.lb-window { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }

.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-row, .lb-pinned {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  grid-template-areas: "rank who score" ".  when when";
  align-items: center; gap: 2px 8px;
  padding: 7px 6px; border-radius: var(--radius-sm);
  font-size: 0.86rem;
}
.lb-row + .lb-row { border-top: 1px solid var(--border); border-radius: 0; }
.lb-row-you { background: rgba(124, 58, 237, 0.12); }

.lb-rank { grid-area: rank; font-weight: 700; font-size: 0.8rem; color: var(--text-dim); text-align: center; }
.lb-rank-1 { color: var(--gold); }
.lb-rank-2 { color: #cbd5e1; }
.lb-rank-3 { color: #d08a53; }

.lb-who  { grid-area: who; display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-name {
  color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-you {
  margin-left: 6px; padding: 1px 6px; border-radius: 20px;
  background: var(--primary3); color: #fff;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.lb-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 28px;
}
.lb-avatar-gen {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.8rem; font-weight: 700;
}
.lb-score { grid-area: score; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.lb-when  { grid-area: when; font-size: 0.7rem; color: var(--text-muted); text-align: right; }

/* The pinned "your rank" row sits below the board with a clear break — §6.1. */
.lb-pinned {
  margin-top: 8px; padding-top: 12px;
  border-top: 1px dashed var(--border2);
  background: rgba(124, 58, 237, 0.08);
}
.lb-empty { color: var(--text-dim); font-size: 0.85rem; padding: 10px 2px; margin: 0; }

.lb-more {
  display: inline-block; margin-top: 12px;
  font-size: 0.8rem; font-weight: 600; color: var(--primary2);
}
.lb-more:hover { color: var(--cyan); }

/* Where "Sign in to save your score" and post-submission confirmations land. */
.lb-note { display: none; }
.lb-note-visible {
  display: block; margin-top: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 0.8rem; line-height: 1.5;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
}
.lb-note-visible a { color: var(--primary2); font-weight: 600; text-decoration: underline; }
.lb-note-cta { background: rgba(124, 58, 237, 0.12); border-color: rgba(124, 58, 237, 0.35); color: var(--text); }
.lb-note-ok  { background: rgba(34, 197, 94, 0.08);  border-color: rgba(34, 197, 94, 0.25);  color: var(--success); }
.lb-note-err { background: rgba(239, 68, 68, 0.08);  border-color: rgba(239, 68, 68, 0.25);  color: var(--error); }

/* Window tabs on the full board page — plain links, so they work without JS. */
.lb-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.lb-tab {
  padding: 8px 16px; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 0.85rem; font-weight: 600;
  transition: all 0.15s;
}
.lb-tab:hover { border-color: var(--border2); color: var(--text); }
.lb-tab-active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent; color: #fff;
}

.lb-page .lb-row, .lb-page .lb-pinned {
  grid-template-columns: 34px 1fr auto auto;
  grid-template-areas: "rank who score when";
  gap: 12px; padding: 10px 8px; font-size: 0.92rem;
}
.lb-page .lb-when { min-width: 80px; }

@media (max-width: 640px) {
  .lb-page .lb-row, .lb-page .lb-pinned {
    grid-template-columns: 26px 1fr auto;
    grid-template-areas: "rank who score" ".  when when";
    gap: 2px 8px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACHIEVEMENTS · XP · PROFILES  (Phase 4, DESIGN §7 and §8.1/§8.4)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tier colours. One set, used by the cabinet, the game-page list and the
   toasts, so a gold achievement is the same gold everywhere it appears. */
.tier-bronze   { --tier: #b87333; --tier-soft: rgba(184, 115, 51, 0.14); }
.tier-silver   { --tier: #b8c2d0; --tier-soft: rgba(184, 194, 208, 0.14); }
.tier-gold     { --tier: #f5b301; --tier-soft: rgba(245, 179, 1, 0.14); }
.tier-platinum { --tier: #6ee7f9; --tier-soft: rgba(110, 231, 249, 0.14); }

/* ── Level chip in the navbar ─────────────────────────────────────────────── */
.acct-level {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
}

/* ── Achievement cards ────────────────────────────────────────────────────── */
.ach-panel { margin-top: 28px; }
.ach-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.ach-panel-count { font-size: 0.8rem; color: var(--text-dim); }

.ach-grid {
  list-style: none; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ach-card {
  position: relative; display: flex; gap: 12px; padding: 12px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--tier, var(--border2));
  border-radius: var(--radius-sm);
}
/* Locked achievements are dimmed, not hidden: what is left to earn is the
   hook (§7.2), so it has to be legible. */
.ach-locked { opacity: 0.62; }
.ach-unlocked {
  background: var(--tier-soft, var(--surface3));
  border-color: var(--border2);
  /* border-color is a shorthand and resets all four sides, so the tier stripe
     has to be re-asserted after it or an unlocked card loses its colour. */
  border-left-color: var(--tier, var(--border2));
}
.ach-hidden .ach-name, .ach-hidden .ach-desc { font-style: italic; color: var(--text-dim); }

.ach-icon { font-size: 1.7rem; line-height: 1.2; flex: 0 0 auto; }
.ach-body { min-width: 0; }
.ach-name { font-size: 0.92rem; font-weight: 700; margin-bottom: 2px; }
.ach-desc { font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; }
.ach-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 0.72rem; color: var(--text-dim);
}
.ach-tier { color: var(--tier, var(--text-dim)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ach-xp { padding: 1px 6px; border-radius: 4px; background: var(--surface3); }
.ach-rarity { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The game's name is the only variable-length item on the meta line, so it is
   the one that gives way — otherwise a long title pushes the rarity onto a line
   of its own and the row reads as two facts instead of one. */
.ach-game {
  color: var(--primary2); min-width: 0; max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ach-game-platform { color: var(--text-muted); }
.ach-when { margin-top: 4px; font-size: 0.72rem; color: var(--text-muted); }
.ach-tick {
  position: absolute; top: 8px; right: 10px;
  font-size: 0.8rem; font-weight: 700; color: var(--success);
}

/* ── Profile header ───────────────────────────────────────────────────────── */
.profile-page { max-width: 1100px; }
.profile-crumbs { margin-bottom: 16px; font-size: 0.85rem; color: var(--text-muted); }
.profile-crumbs a { color: var(--text-muted); }
.profile-crumbs span { margin: 0 8px; }
.profile-crumb-current { color: var(--text); margin: 0 !important; }

.profile-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
  padding: 24px; margin-bottom: 18px;
  background: linear-gradient(140deg, var(--surface), var(--bg2));
  border: 1px solid var(--border); border-radius: var(--radius);
}

/* The XP ring — §8.1. An SVG circle whose dash array is the fraction of the
   current level completed; rotated so it starts at twelve o'clock. */
.profile-ring-wrap { position: relative; width: 120px; height: 120px; flex: 0 0 auto; }
.profile-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.profile-ring-track { fill: none; stroke: var(--surface3); stroke-width: 8; }
.profile-ring-fill {
  fill: none; stroke: var(--primary2); stroke-width: 8; stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}
.profile-avatar {
  position: absolute; top: 12px; left: 12px;
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
}
.profile-avatar-gen {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 800; color: #fff;
}
.profile-level {
  position: absolute; right: -2px; bottom: 2px;
  min-width: 30px; padding: 3px 8px; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border: 2px solid var(--bg2);
  font-size: 0.8rem; font-weight: 800; color: #fff; text-align: center;
}

.profile-identity { flex: 1 1 260px; min-width: 0; }
.profile-name { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.profile-handle { font-size: 0.9rem; color: var(--text-muted); }
.profile-xp { margin-top: 8px; font-size: 0.85rem; color: var(--text-dim); }
.profile-xp-total { color: var(--text-muted); }

.profile-badges { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.profile-badge {
  padding: 4px 10px; border-radius: 999px; font-size: 0.75rem;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
}
.profile-badge-quiet { color: var(--text-muted); }
.profile-self-note { margin-top: 12px; font-size: 0.8rem; color: var(--text-muted); }
.profile-self-note a { color: var(--primary2); text-decoration: underline; }

.profile-showcase { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-showcase-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 96px; padding: 10px 8px; text-align: center;
  background: var(--tier-soft, var(--surface2));
  border: 1px solid var(--border); border-top: 3px solid var(--tier, var(--border2));
  border-radius: var(--radius-sm);
}
.profile-showcase-icon { font-size: 1.6rem; }
.profile-showcase-name {
  font-size: 0.7rem; font-weight: 700; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.profile-showcase-rarity { font-size: 0.65rem; color: var(--text-muted); }

/* ── Stats row — §8.1 ─────────────────────────────────────────────────────── */
.profile-stats {
  display: grid; gap: 10px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.profile-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.profile-stat-n { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.profile-stat-l { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.profile-stat-soon .profile-stat-n { color: var(--text-muted); }

.profile-tabs { margin-bottom: 0; }
.profile-panel { padding-top: 18px; }
.profile-panel-note { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.profile-empty { font-size: 0.9rem; color: var(--text-dim); padding: 24px 0; }
.profile-empty a { color: var(--primary2); text-decoration: underline; }

/* ── Games grid on the profile ────────────────────────────────────────────── */
.profile-games {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.profile-game {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.profile-game-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface3); }
.profile-game-thumb img { width: 100%; height: 100%; object-fit: cover; }
.profile-game-medal {
  position: absolute; top: 8px; left: 8px; font-size: 1.3rem;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}
.profile-game-body { padding: 10px 12px 12px; }
.profile-game-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.profile-game-title a:hover { color: var(--primary2); }
.profile-game-best { font-size: 1.05rem; font-weight: 800; display: flex; align-items: baseline; gap: 8px; }
.profile-game-rank { font-size: 0.72rem; font-weight: 600; color: var(--text-dim); }
.profile-game-noscore { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.profile-game-when { font-size: 0.72rem; color: var(--text-muted); }
.profile-game-links { display: flex; gap: 12px; margin-top: 8px; font-size: 0.75rem; }
.profile-game-links a { color: var(--primary2); }
.profile-beat { font-weight: 700; }

/* ── Activity feed ────────────────────────────────────────────────────────── */
.feed { list-style: none; }
.feed-row {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: baseline; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
}
.feed-row:last-child { border-bottom: 0; }
.feed-icon { font-size: 1.05rem; text-align: center; }
.feed-text { font-size: 0.88rem; color: var(--text-dim); line-height: 1.5; }
.feed-text strong { color: var(--text); }
.feed-text a { color: var(--primary2); }
.feed-sub { color: var(--text-muted); font-size: 0.78rem; }
.feed-when { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ── "Coming soon" panel (Challenges tab) ─────────────────────────────────── */
.profile-soon {
  text-align: center; padding: 44px 24px;
  background: var(--surface2); border: 1px dashed var(--border2); border-radius: var(--radius);
}
.profile-soon-icon { font-size: 2.4rem; }
.profile-soon-title { font-size: 1.15rem; font-weight: 800; margin: 10px 0 8px; }
.profile-soon-copy { font-size: 0.88rem; color: var(--text-dim); max-width: 460px; margin: 0 auto; line-height: 1.7; }
.profile-soon-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 14px; }

/* ── Toasts — DESIGN §7.2 ─────────────────────────────────────────────────────
   A parent-page overlay, which is what makes it engine-agnostic: the game is in
   an iframe and never draws this. Fixed to the viewport so it is visible over a
   fullscreen game frame too. */
.aaa-toasts {
  position: fixed; z-index: 9999; right: 16px; bottom: 16px;
  display: flex; flex-direction: column-reverse; gap: 10px;
  max-width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}
.aaa-toast {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 34px 13px 14px;
  background: var(--surface); border: 1px solid var(--border2);
  border-left: 3px solid var(--tier, var(--primary2));
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  opacity: 0; transform: translateX(24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.aaa-toast-in  { opacity: 1; transform: translateX(0); }
.aaa-toast-out { opacity: 0; transform: translateX(24px); }
.aaa-toast-level { border-left-color: var(--primary2); background: linear-gradient(135deg, var(--surface), var(--primary3)); }
.aaa-toast-link { cursor: pointer; }
.aaa-toast-icon { font-size: 1.6rem; line-height: 1.1; }
.aaa-toast-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.aaa-toast-title {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--tier, var(--primary2));
}
.aaa-toast-text { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.aaa-toast-meta { font-size: 0.72rem; color: var(--text-dim); }
.aaa-toast-close {
  position: absolute; top: 6px; right: 8px;
  background: none; border: 0; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: var(--text-muted);
}
.aaa-toast-close:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .aaa-toast { transition: none; opacity: 1; transform: none; }
  .profile-ring-fill { transition: none; }
}

@media (max-width: 640px) {
  .profile-header { gap: 16px; padding: 18px; }
  .profile-showcase { width: 100%; justify-content: flex-start; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .aaa-toasts { left: 16px; right: 16px; max-width: none; }
}

/* ─── Phase 5 — challenges, streaks, quests, notifications, social ──────────
   DESIGN §8.2, §8.3, §8.5. Everything below is new surface area; nothing
   above it changed, so a page that carries none of these components renders
   exactly as it did in Phase 4.

   Two rules run through all of it:
     · every one of these controls is signed-in-only, so none of it appears on
       a guest's page and none of it can shift the public layout;
     · the components reuse the existing tokens (--surface, --border,
       --primary, --gold) rather than introducing colours, so the new regions
       sit inside the same visual system as the boards and the cabinet.       */

/* ── Navbar: the streak flame and the bell (§8.3.2, §8.5) ────────────────── */

.nav-streak {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 800; color: var(--gold);
  white-space: nowrap; cursor: default;
}
/* A streak with nothing played today is one evening from being nothing. */
.nav-streak-risk { border-color: rgba(245,158,11,.5); animation: streakPulse 2.4s ease-in-out infinite; }
@keyframes streakPulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }

.notif { position: relative; }
.notif > summary { list-style: none; cursor: pointer; }
.notif > summary::-webkit-details-marker { display: none; }
.notif-trigger {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.notif[open] .notif-trigger, .notif-trigger:hover { border-color: var(--border2); background: var(--surface2); }
.notif-icon { font-size: 1rem; line-height: 1; }
.notif-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--primary); color: #fff;
  font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center;
}
.notif-count-zero { background: var(--surface3); color: var(--text-muted); }

.notif-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 200;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 18px 44px rgba(0,0,0,.55);
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
}
.notif-head-title { font-size: 0.8rem; font-weight: 700; }
.notif-mark {
  background: none; border: 0; cursor: pointer;
  font-size: 0.72rem; color: var(--primary2);
}
.notif-list { list-style: none; max-height: 62vh; overflow-y: auto; }
.notif-empty { padding: 20px 14px; font-size: 0.82rem; color: var(--text-dim); text-align: center; }
.notif-item { border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-unread { background: rgba(124,58,237,.09); }
.notif-link { display: flex; gap: 10px; padding: 11px 14px; align-items: flex-start; }
.notif-link:hover { background: var(--surface2); }
.notif-item-icon { font-size: 1rem; line-height: 1.3; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { display: block; font-size: 0.82rem; font-weight: 700; }
.notif-item-text  { display: block; font-size: 0.76rem; color: var(--text-dim); }
.notif-item-when  { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }
.notif-foot {
  display: block; padding: 10px 14px; text-align: center;
  font-size: 0.74rem; color: var(--text-dim); border-top: 1px solid var(--border);
}
.notif-foot:hover { color: var(--text); }

/* ── Daily quests (§8.3.3) ───────────────────────────────────────────────── */

.quests {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px;
}
.quests-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.quests-title { font-size: 0.98rem; font-weight: 800; margin: 0; }
.quests-meta  { display: flex; gap: 12px; font-size: 0.74rem; color: var(--text-dim); }
.quests-done  { color: var(--text); font-weight: 700; }
.quests-timer { color: var(--gold); }

.quest-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.quest { display: flex; align-items: center; gap: 12px; }
.quest-check {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--border2); color: var(--bg);
  font-size: 0.7rem; font-weight: 900; line-height: 19px; text-align: center;
}
.quest-done .quest-check { background: var(--success); border-color: var(--success); }
.quest-body { flex: 1; min-width: 0; }
.quest-name { display: block; font-size: 0.85rem; font-weight: 600; }
.quest-name:hover { color: var(--primary2); }
.quest-done .quest-name { color: var(--text-dim); text-decoration: line-through; }
.quest-bar {
  height: 5px; margin-top: 6px; border-radius: 999px;
  background: var(--surface3); overflow: hidden;
}
.quest-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.quest-side { text-align: right; white-space: nowrap; }
.quest-progress { display: block; font-size: 0.74rem; color: var(--text-dim); }
.quest-xp { display: block; font-size: 0.72rem; font-weight: 800; color: var(--gold); }

/* ── Home rails: continue playing, favourites (§8.3 point 1) ─────────────── */

.rail { margin-bottom: 22px; }
.rail-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.rail-title { font-size: 0.98rem; font-weight: 800; margin: 0; }
.rail-note  { font-size: 0.74rem; color: var(--text-dim); }
.rail-track {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity;
}
.rail-card {
  flex: 0 0 180px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.rail-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.rail-thumb { display: block; aspect-ratio: 16/9; background: var(--surface2); }
.rail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rail-name { display: block; padding: 8px 10px 0; font-size: 0.82rem; font-weight: 700; }
.rail-meta { display: block; padding: 2px 10px 10px; font-size: 0.7rem; color: var(--text-dim); }

/* ── The favourite heart (§4) ────────────────────────────────────────────── */

/* The card is an <a>, so the heart cannot live inside it — it sits in a
   wrapper that keeps the grid cell's shape. */
.game-card-wrap { position: relative; display: flex; }
.game-card-wrap > .game-card { flex: 1; min-width: 0; }
.fav-form { display: inline-flex; margin: 0; }
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-dim);
  font-size: 0.8rem; font-weight: 600;
}
.fav-btn:hover { border-color: var(--border2); color: var(--text); }
.fav-btn.fav-on { color: #f472b6; border-color: rgba(244,114,182,.45); }
.fav-heart { font-size: 0.95rem; line-height: 1; }
.fav-btn-card {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 6px 8px; border-radius: 999px;
  background: rgba(7,8,15,.78); backdrop-filter: blur(6px);
}
.fav-btn-card .fav-label { display: none; }
.fav-btn-wide { white-space: nowrap; }

/* ── Challenges (§8.2) ───────────────────────────────────────────────────── */

/* The banner above the game frame: present only when the server bound this
   run to a challenge. */
.ch-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 11px 16px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(124,58,237,.22), rgba(6,182,212,.12));
  border: 1px solid var(--border2);
  font-size: 0.86rem;
}
.ch-banner-icon  { font-size: 1.05rem; }
.ch-banner-text  { flex: 1; min-width: 0; }
.ch-banner-tries { color: var(--gold); font-weight: 700; }
.ch-banner-link  { font-size: 0.78rem; color: var(--primary2); }

/* The create panel in the game sidebar. */
.ch-create-body   { display: flex; flex-direction: column; gap: 4px; }
.ch-create-score  { font-size: 0.84rem; color: var(--text-dim); margin-bottom: 6px; }
.ch-create-score strong { color: var(--gold); font-size: 1.05rem; }
.ch-create-scorenote { display: block; font-size: 0.7rem; color: var(--text-muted); }
.ch-create-row    { display: flex; gap: 8px; align-items: center; }
.ch-create-row .acct-input { flex: 1; min-width: 0; }
.ch-create-link   { width: 100%; margin-top: 12px; }

/* The challenge page itself. */
.challenge-page { max-width: 720px; }
.ch-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px;
}
.ch-state-settled { border-color: var(--border2); }
.ch-state-expired { opacity: .92; }
.ch-kicker {
  display: inline-block; font-size: 0.7rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--primary2);
}
.ch-title { font-size: 1.35rem; line-height: 1.3; margin: 8px 0 6px; }
.ch-title strong { color: var(--gold); }
.ch-sub  { font-size: 0.9rem; color: var(--text-dim); }

.ch-versus {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin: 22px 0 6px;
}
.ch-side { flex: 1; text-align: center; min-width: 0; }
.ch-side-won .ch-side-score { color: var(--gold); }
.ch-avatar {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 8px; display: block;
}
.ch-avatar-gen {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: #fff;
}
.ch-avatar-open { background: var(--surface3); color: var(--text-muted); }
.ch-side-name  { display: block; font-size: 0.86rem; font-weight: 700; overflow-wrap: anywhere; }
.ch-side-score { display: block; font-size: 1.25rem; font-weight: 800; margin-top: 2px; }
.ch-vs { font-size: 0.75rem; color: var(--text-muted); font-weight: 800; }

.ch-verdict { text-align: center; font-size: 1rem; margin-top: 10px; }
.ch-record  { text-align: center; font-size: 0.8rem; color: var(--text-dim); margin-top: 6px; }

.ch-attempts { list-style: none; margin: 18px 0 0; display: flex; flex-direction: column; gap: 6px; }
.ch-attempt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface2); font-size: 0.82rem;
}
.ch-attempt-beat { border: 1px solid rgba(34,197,94,.4); }
.ch-attempt-no    { color: var(--text-muted); flex: 0 0 60px; }
.ch-attempt-score { font-weight: 800; flex: 1; }
.ch-attempt-when  { font-size: 0.72rem; color: var(--text-muted); }

.ch-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 22px;
}
.ch-form { margin: 0; }
.ch-note { width: 100%; font-size: 0.8rem; color: var(--text-dim); margin: 4px 0 0; }
.ch-note-quiet { color: var(--text-muted); }

.ch-share {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.ch-share-title { font-size: 0.95rem; margin: 0 0 4px; }
.ch-share-sub   { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 12px; }
.ch-share-row   { display: flex; gap: 8px; }
.ch-share-input {
  flex: 1; min-width: 0; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.82rem;
}
.ch-whatsapp {
  display: inline-block; margin-top: 12px;
  font-size: 0.82rem; font-weight: 700; color: #25d366;
}
.ch-share-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 12px; }

/* The profile's Challenges tab. */
.ch-record-strip {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.ch-record-big    { font-size: 1.2rem; font-weight: 800; }
.ch-record-label  { font-size: 0.78rem; color: var(--text-dim); }
.ch-record-versus { font-size: 0.78rem; color: var(--text-dim); margin-left: auto; }

.ch-list-title { font-size: 0.88rem; font-weight: 700; margin: 20px 0 10px; }
.ch-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
}
.ch-row-badge {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface3); color: var(--text-dim);
  font-size: 0.72rem; font-weight: 900; line-height: 26px; text-align: center;
}
.ch-row-won  .ch-row-badge { background: rgba(34,197,94,.2);  color: var(--success); }
.ch-row-lost .ch-row-badge { background: rgba(239,68,68,.18); color: var(--error); }
.ch-row-open .ch-row-badge { background: rgba(124,58,237,.22); color: var(--primary2); }
.ch-row-body  { flex: 1; min-width: 0; }
.ch-row-game  { display: block; font-size: 0.85rem; font-weight: 700; }
.ch-row-game:hover { color: var(--primary2); }
.ch-row-who   { display: block; font-size: 0.72rem; color: var(--text-dim); }
.ch-row-scores { font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.ch-row-vs     { color: var(--text-muted); font-weight: 400; margin: 0 3px; }
.ch-row-when   { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* ── Profile: follow button, showcase picker, streak badge (§8.1) ────────── */

.profile-follow {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px;
}
.profile-follow-counts { font-size: 0.8rem; color: var(--text-dim); }
.profile-follow-counts strong { color: var(--text); }
.profile-follow-form { margin: 0; }
.profile-badge-risk { border-color: rgba(245,158,11,.5); color: var(--gold); }
.profile-badge-sub  { color: var(--text-dim); font-weight: 400; }

.showcase-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px dashed var(--border2);
}
.showcase-hint    { font-size: 0.78rem; color: var(--text-dim); }
.showcase-actions { display: flex; gap: 8px; }

.ach-card { position: relative; }
.ach-pin { position: absolute; top: 8px; right: 8px; cursor: pointer; }
.ach-pin input { position: absolute; opacity: 0; width: 0; height: 0; }
.ach-pin-mark {
  display: inline-block; padding: 3px 6px; border-radius: 999px;
  background: var(--surface3); font-size: 0.72rem; opacity: .35;
  transition: opacity .15s, background .15s;
}
.ach-pin:hover .ach-pin-mark { opacity: .8; }
.ach-pin input:checked + .ach-pin-mark { opacity: 1; background: rgba(245,158,11,.28); }
.ach-pin input:focus-visible + .ach-pin-mark { outline: 2px solid var(--primary2); }

/* Visually hidden, still read aloud. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Account: the email checkboxes (§8.5) ────────────────────────────────── */

.acct-check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; font-size: 0.85rem; cursor: pointer;
}
.acct-check input { margin-top: 3px; accent-color: var(--primary); }

/* ── Leaderboard: the Following tab (§6.1) ───────────────────────────────── */

.lb-tab-friends { margin-left: auto; }

@media (max-width: 640px) {
  .ch-card { padding: 18px; }
  .ch-versus { gap: 10px; }
  .ch-record-versus { margin-left: 0; }
  .ch-row-when { display: none; }
  .lb-tab-friends { margin-left: 0; }
  .notif-menu { position: fixed; left: 16px; right: 16px; width: auto; top: calc(var(--nav-h) + 8px); }
  .quests { padding: 16px; }
  .rail-card { flex-basis: 150px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 6 — Mobile-first platform UI, game player chrome, PWA (DESIGN §9)
   Appended; nothing above this line is modified. Desktop layout (>=1024px)
   is untouched by everything below: each rule is either scoped to a
   max-width media query, targets a class no wider viewport ever renders
   (.tabbar, .sheet-handle, .pwa-pill, the rotate interstitial), or — like the
   safe-area padding below — resolves to the pre-existing value everywhere
   env() has nothing to report.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Safe-area basics — §9.2 ───────────────────────────────────────────────
   max() falls back to the existing 24px on every device with no notch, so
   this is a no-op everywhere but the phones it is for. */
.player-page {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ── Bottom tab bar — §9.1 ─────────────────────────────────────────────────
   Home · Categories · Search · Profile, <768px only — .nav-links already
   disappears at that width above. Categories and Search are <details>
   sheets, the same no-JS-required pattern the account menu and the
   notification bell use for their own dropdowns. */
.tabbar { display: none; }

@media (max-width: 768px) {
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    background: rgba(7,8,15,0.96); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar-item, .tabbar-sheet > summary {
    flex: 1; min-width: 0; min-height: 46px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 4px 2px;
    color: var(--text-dim); font-size: 0.66rem; font-weight: 600;
    cursor: pointer; list-style: none;
  }
  .tabbar-sheet > summary::-webkit-details-marker { display: none; }
  .tabbar-item.active, .tabbar-sheet[open] > summary { color: var(--primary2); }
  .tabbar-icon { font-size: 1.25rem; line-height: 1; }
  .tabbar-icon-wrap { position: relative; }
  .tabbar-dot {
    position: absolute; top: -2px; right: -5px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--error); border: 2px solid var(--bg);
  }
  .tabbar-label { line-height: 1; }

  .tabbar-sheet { position: static; }
  .tabbar-sheet-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 151;
    max-height: 70vh; overflow-y: auto;
    background: var(--bg2); border-top: 1px solid var(--border2);
    border-radius: 16px 16px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 32px rgba(0,0,0,.5);
  }
  .tabbar-sheet-link {
    display: flex; align-items: center; min-height: 44px;
    padding: 10px 8px; font-size: 0.92rem; color: var(--text);
    border-bottom: 1px solid var(--border);
  }
  .tabbar-sheet-link:last-child { border-bottom: none; }
  .tabbar-search-form { display: flex; gap: 8px; }
  .tabbar-search-form input { flex: 1; }

  /* A dim scrim behind the open sheet, both to signal "this is modal" and to
     give a large closing target — js/social.js closes the <details> when the
     scrim itself is what got clicked (see the note there). */
  .tabbar-sheet[open]::before {
    content: ''; position: fixed; inset: 0; z-index: 149;
    background: rgba(0,0,0,.5);
  }
}

/* ── 2-column game grid on phones — §9.1 ──────────────────────────────────── */
@media (max-width: 600px) {
  .games-grid, .profile-games { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .game-card-body { padding: 10px; gap: 6px; }
  .game-card-title { font-size: 0.86rem; }
  .game-card-desc {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden; font-size: 0.76rem;
  }
}

/* ── Category pill row, horizontally scrollable — §9.1 ────────────────────── */
@media (max-width: 768px) {
  .category-filter {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px; margin-bottom: 24px;
  }
  .category-filter::-webkit-scrollbar { display: none; }
  .cat-pill { flex: 0 0 auto; }
}

/* ── 44px+ touch targets — §9.1 ────────────────────────────────────────────
   Interactive controls only — labels and read-only badges are untouched.
   Cards, rail items and other whole-element tap targets are already well
   past 44px and are not listed here. */
@media (max-width: 768px) {
  .btn, .cat-pill, .lb-tab, .nav-signin, .fav-btn, .acct-item, .acct-trigger,
  .notif-trigger, .quest-name {
    min-height: 44px;
  }
  .btn, .cat-pill, .lb-tab { padding-top: 12px; padding-bottom: 12px; }
  .acct-item, .quest-name { display: flex; align-items: center; }
  .fav-btn-card {
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center; padding: 0;
  }
  .ach-pin {
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
  }
}

/* ── Quest panel stacking on very narrow phones — §9.1 ─────────────────────
   .quest-side is normally a right-aligned column beside the name; below
   ~420px there is not enough width left for it to stay legible there. */
@media (max-width: 420px) {
  .quest { flex-wrap: wrap; }
  .quest-side { flex: 0 0 100%; text-align: left; margin-top: 2px; }
}

/* ── Catalog policy — §9.3 ─────────────────────────────────────────────────
   The 📱 badge is shown at every viewport (DESIGN §9.3 states it plainly,
   with no mobile qualifier) — it costs a desktop visitor nothing and is a
   real, useful fact about the game either way. */
.rail-thumb { position: relative; }
.touch-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7,8,15,.72); backdrop-filter: blur(4px);
  font-size: 0.85rem; line-height: 1;
}
.best-desktop-copy { font-size: 0.84rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 12px; }

/* ── Game player chrome — §9.2 ─────────────────────────────────────────────── */

.player-container {
  overscroll-behavior: contain;
  touch-action: none;
}
@media (max-width: 768px) {
  .player-container { max-height: 100dvh; }
}

/* Fullscreen — visible at every viewport, deliberately (§9.2). */
.player-fs-btn {
  position: absolute; top: 10px; right: 10px; z-index: 6;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7,8,15,.66); border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; color: #fff; font-size: 1.2rem;
  cursor: pointer; backdrop-filter: blur(4px);
}
.player-fs-btn:hover { background: rgba(7,8,15,.85); }
.player-fs-note {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 6;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(7,8,15,.9); border: 1px solid var(--border2);
  color: var(--text-dim); font-size: 0.8rem; line-height: 1.5;
}

/* Fullscreen mode: reach into the safe-area insets instead of leaving black
   bars against a notch — the iframe's inset:0 sits inside this padding
   because absolutely-positioned insets are relative to the padding edge. */
.player-container:fullscreen,
.player-container:-webkit-full-screen {
  max-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Rotate-your-phone interstitial — a landscape game on a portrait phone. */
.rotate-interstitial { display: none; }
@media (max-width: 900px) and (orientation: portrait) {
  .rotate-interstitial {
    display: flex; position: absolute; inset: 0; z-index: 5;
    align-items: center; justify-content: center; text-align: center;
    padding: 24px;
    background: rgba(7,8,15,.94); backdrop-filter: blur(6px);
  }
}
.player-container:fullscreen .rotate-interstitial,
.player-container:-webkit-full-screen .rotate-interstitial { display: none !important; }
.rotate-interstitial-body { max-width: 280px; }
.rotate-icon { font-size: 2.2rem; margin-bottom: 12px; letter-spacing: 4px; }
.rotate-interstitial p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 14px; }
.rotate-hint {
  font-size: 0.78rem !important; color: var(--text-muted) !important;
  margin: 10px 0 0 !important;
}

/* ── The details sheet — §9.2 ───────────────────────────────────────────────
   Normal in-flow content until player-chrome.js adds .sheet-mode once the
   game has visibly loaded; from then on, a swipe-up/tap sheet so the game
   keeps the screen. */
.sheet-handle { display: none; }
@media (max-width: 768px) {
  .player-details.sheet-mode {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
    margin-top: 0;
    background: var(--bg2); border-top: 1px solid var(--border2);
    border-radius: 16px 16px 0 0;
    max-height: 75vh; overflow-y: auto;
    box-shadow: 0 -10px 30px rgba(0,0,0,.5);
    padding: 0 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(calc(100% - 40px));
    transition: transform .28s ease;
  }
  .player-details.sheet-mode.sheet-open { transform: translateY(0); }
  .player-details.sheet-mode .sheet-handle {
    display: flex; justify-content: center;
    position: sticky; top: 0; background: inherit;
    padding: 10px 0 14px; margin: 0 -20px 4px; cursor: pointer;
  }
  .player-details.sheet-mode .sheet-handle span {
    width: 36px; height: 4px; border-radius: 2px; background: var(--border2);
  }
  /* The tab bar is redundant once the game has the screen — the sheet handle
     is the only chrome left at the bottom of the viewport. */
  body.aaa-playing .tabbar { display: none; }
  body.aaa-playing { padding-bottom: 0; }
}

/* ── PWA install pill — §9.1 ────────────────────────────────────────────────
   Hidden until js/pwa.js has both an actual beforeinstallprompt to offer and
   a second visit to show it on; positioned above the tab bar so it never
   covers the Profile tab's badge dot. */
.pwa-pill {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 140;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border2);
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  max-width: 420px; margin-inline: auto;
}
.pwa-pill-text { flex: 1; font-size: 0.85rem; color: var(--text); }
.pwa-pill-dismiss {
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 6px; min-width: 32px; min-height: 32px;
}
@media (max-width: 768px) {
  .pwa-pill { bottom: calc(58px + env(safe-area-inset-bottom) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  .player-details.sheet-mode { transition: none; }
}

/* ═══ Phase 7 — Admin 2.0, moderation, tournament, analytics ═══════════════════
   DESIGN §10, §8.3.4, §6.3.
   The admin half reuses the panel primitives that were already here (.card,
   .data-table, .stat-card, .sidebar, .badge-*); what follows is the handful of
   pieces those did not cover, plus the two player-facing additions this phase
   is allowed to make — the tournament page and the report affordance. */

/* ── Admin: sign-in and TOTP enrolment (§10) ─────────────────────────────── */
.login-note {
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.65;
  margin-bottom: 18px; text-align: center;
}
.login-secondary { margin-top: 10px; }
.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.28em; text-align: center; font-size: 1.15rem;
}
.enrol-steps {
  text-align: left; font-size: 0.85rem; color: var(--text-muted);
  line-height: 1.7; margin: 0 0 16px; padding-left: 20px;
}
.enrol-qr {
  display: flex; justify-content: center; margin-bottom: 16px;
}
.enrol-qr svg {
  width: 200px; height: 200px; border-radius: 8px;
  /* The code is drawn black-on-white whatever the page theme is: a QR scanner
     wants the contrast the spec assumes, not the one the site prefers. */
  background: #fff; padding: 6px;
}
.enrol-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem; letter-spacing: 0.08em; width: 100%;
}
.enrol-uri { margin-bottom: 16px; font-size: 0.8rem; color: var(--text-muted); }
.enrol-uri summary { cursor: pointer; padding: 6px 0; }
.enrol-uri input { margin-top: 8px; letter-spacing: 0; }

/* ── Admin: sidebar badge, layout helpers ────────────────────────────────── */
.nav-badge {
  margin-left: auto; background: var(--error, #ef4444); color: #fff;
  font-size: 0.7rem; font-weight: 700; border-radius: 10px; padding: 1px 7px;
}
.sidebar-nav a { position: relative; }

.admin-page-header.tight { margin-bottom: 12px; }
.admin-page-header.tight h3 { font-size: 1rem; font-weight: 700; }
.card-pad-x { padding: 20px 24px 0; }
.dash-cols {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}
.form-card   { max-width: 820px; margin-bottom: 20px; }
.narrow-card { max-width: 620px; margin-bottom: 24px; }
.muted       { color: var(--text-muted); font-size: 0.85rem; }
.cell-dim    { color: var(--text-dim, var(--text-muted)); font-size: 0.82rem; }
.cell-icon   { font-size: 1.15rem; }
.nowrap      { white-space: nowrap; }
.inline      { display: inline; }
.mt          { margin-top: 18px; }
.rule        { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.grow        { flex: 1; min-width: 180px; }
.row-quiet   { opacity: 0.55; }
.page-note   { max-width: 820px; margin-bottom: 18px; }

.section-note {
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 14px;
}
.field-note { display: block; margin-top: -6px; color: var(--text-muted); }
.dash-lead  { font-size: 0.9rem; line-height: 1.7; margin-bottom: 10px; }
.dash-list  { list-style: none; font-size: 0.85rem; line-height: 1.9; }
.dash-list li { border-bottom: 1px solid var(--border); padding: 4px 0; }
.dash-list li:last-child { border-bottom: 0; }
/* The base .alert is a flex row, which turns every inline <code> in a prose
   warning into its own flex item and shreds the sentence into columns. These
   in-card alerts are paragraphs, so they go back to being paragraphs. */
.inline-alert {
  display: block; margin: 12px 0 0; font-size: 0.82rem; line-height: 1.7;
}
.data-table.compact th,
.data-table.compact td { padding: 8px 12px; font-size: 0.85rem; }
.game-thumb-blank {
  background: var(--surface2); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.status-select {
  background: transparent; border: none; cursor: pointer; font-size: 0.72rem;
  font-weight: 700; text-transform: uppercase; color: inherit;
}
.thumb-preview {
  width: 120px; height: 68px; object-fit: cover; border-radius: 4px; margin: 0 auto 4px;
}
.thumb-current {
  width: 160px; height: 90px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border);
}
.colour-input {
  width: 100%; height: 42px; padding: 4px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2); cursor: pointer;
}
.form-fieldset {
  border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin: 24px 0;
}
.form-fieldset legend { padding: 0 8px; font-size: 0.85rem; color: var(--text-muted); }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check-line {
  display: flex; gap: 8px; align-items: flex-start;
  font-weight: 400; font-size: 0.85rem; margin-bottom: 6px;
}
.check-final { align-items: center; font-weight: 600; font-size: 0.9rem; margin-top: 12px; }
.mobile-check-box {
  margin-top: 20px; padding: 14px; border: 1px dashed var(--border); border-radius: 8px;
}
.mobile-check-box p { font-size: 0.82rem; color: var(--text-muted); margin: 6px 0 10px; }
.build-report h3 { font-size: 0.95rem; margin-bottom: 12px; }
.report-lines { font-size: 0.85rem; line-height: 1.9; }
.report-warn  { color: var(--danger, #f87171); }
.stack-form .form-group { margin-bottom: 12px; }
.danger-card { border-color: rgba(239,68,68,0.35); }
.filter-row {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}
.filter-row .form-group { margin-bottom: 0; }
.tight-form { gap: 8px; }
.admin-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 999; align-items: center; justify-content: center; padding: 20px;
}
.admin-modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px; width: 100%; max-width: 460px;
}
.admin-modal-box h3 { margin-bottom: 20px; font-size: 1rem; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pager-link {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-muted);
}
.pager-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.audit-inline { list-style: none; font-size: 0.82rem; line-height: 1.9; }
.audit-detail summary { cursor: pointer; color: var(--text-muted); font-size: 0.8rem; }
.audit-diff { display: grid; gap: 10px; margin-top: 8px; }
.audit-diff pre {
  font-size: 0.75rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  background: var(--surface2); border-radius: 6px; padding: 8px 10px; margin-top: 4px;
  max-width: 460px;
}
.perm-yes { color: var(--success); font-weight: 700; text-align: center; }
.perm-no  { color: var(--text-muted); text-align: center; }

/* ── Admin: the moderation queue (§6.3, §10) ─────────────────────────────── */
.queue-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.queue-tabs + .filter-row { padding-top: 12px; border-top: 1px solid var(--border); }
.filter-row label { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.queue-tab {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 0.83rem; color: var(--text-muted);
}
.queue-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.queue-count { opacity: 0.75; font-size: 0.76rem; }
.report-card { margin-bottom: 14px; }
.report-head {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  align-items: baseline; margin-bottom: 10px;
}
.report-body { font-size: 0.9rem; line-height: 1.75; }
.report-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; background: var(--surface2); border-radius: 6px;
  padding: 8px 10px; margin: 8px 0; word-break: break-word;
}
.report-resolution { font-size: 0.82rem; margin-top: 8px; }
.report-actions { margin-top: 12px; }
.report-actions summary {
  cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--primary);
}
.report-form { margin-top: 12px; }
.report-buttons { margin-top: 8px; }

/* ── Admin: players ──────────────────────────────────────────────────────── */
.player-avatar,
.player-avatar-lg {
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}
.player-avatar    { width: 32px; height: 32px; font-size: 0.85rem; }
.player-avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }
.player-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.player-name { font-size: 1.15rem; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cat-row { display: flex; align-items: center; gap: 10px; }
.cat-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
}

/* ── Admin: analytics charts (§10 — inline SVG, no chart library) ─────────── */
.a-chart { display: block; width: 100%; margin: 6px 0 4px; }
.a-bar   { display: block; width: 100%; border-radius: 4px; overflow: hidden; }
.chart-caption { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; }
.device-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}

/* ── Admin: tournament picker ────────────────────────────────────────────── */
.tournament-row {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.tournament-row:last-child { border-bottom: 0; }

/* ── Player-facing: the tournament banner — DESIGN §8.3.4 ────────────────── */
.t-banner {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 14px 18px; margin-bottom: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(124,58,237,0.16), rgba(245,158,11,0.12));
  border: 1px solid rgba(245,158,11,0.35);
}
.t-banner-badge {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(245,158,11,0.2); color: var(--warning, #f59e0b); white-space: nowrap;
}
.t-banner-text { flex: 1; min-width: 220px; font-size: 0.9rem; line-height: 1.6; color: var(--text); }
.t-banner-go   { font-size: 0.85rem; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ── Player-facing: the tournament page ──────────────────────────────────── */
.t-arena {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center;
  padding: 22px; margin-bottom: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border2, var(--border));
}
.t-arena-art img { width: 320px; max-width: 100%; height: auto; border-radius: 10px; display: block; }
.t-arena-blank {
  display: flex; align-items: center; justify-content: center;
  width: 320px; height: 180px; border-radius: 10px; background: var(--surface2); font-size: 2.5rem;
}
.t-arena-body { flex: 1; min-width: 260px; }
.t-arena-body h2 { font-size: 1.6rem; font-weight: 800; margin: 2px 0 10px; }
.t-arena-empty { justify-content: center; text-align: center; }
.t-eyebrow {
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--warning, #f59e0b);
}
.t-lead    { font-size: 0.92rem; line-height: 1.75; color: var(--text-muted); margin-bottom: 12px; }
.t-prizes  { font-size: 0.86rem; line-height: 1.8; margin-bottom: 16px; }
.t-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.t-window  { font-size: 0.78rem; color: var(--text-muted); margin-top: 12px; line-height: 1.6; }
.t-empty   { font-size: 0.88rem; color: var(--text-muted); padding: 12px 0; }

.t-hall { margin-top: 36px; }
.t-hall-week {
  padding: 16px 0; border-top: 1px solid var(--border);
}
.t-hall-head {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: baseline;
}
.t-hall-head h3 { font-size: 1.05rem; font-weight: 700; }
.t-hall-when { font-size: 0.82rem; color: var(--text-muted); }
.t-podium { list-style: none; margin-top: 10px; }
.t-podium-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px; font-size: 0.9rem;
}
.t-podium-row:nth-child(odd) { background: rgba(255,255,255,0.02); }
.t-rank-1 { background: rgba(245,158,11,0.10) !important; }
.t-medal  { font-size: 1.05rem; }
.t-place  { font-weight: 700; min-width: 34px; color: var(--text-muted); }
.t-who    { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-score  { font-variant-numeric: tabular-nums; font-weight: 700; }
.t-xp     { font-size: 0.78rem; color: var(--text-muted); min-width: 62px; text-align: right; }

/* ── Player-facing: the report affordance — DESIGN §6.3, §10 ─────────────── */
.lb-report { position: relative; }
.lb-report > summary {
  list-style: none; cursor: pointer; padding: 4px 6px; border-radius: 6px;
  color: var(--text-muted); font-size: 0.85rem; line-height: 1;
  min-width: 28px; min-height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
}
.lb-report > summary::-webkit-details-marker { display: none; }
.lb-report > summary:hover { color: var(--warning, #f59e0b); background: var(--surface2); }
.lb-report[open] > summary { color: var(--warning, #f59e0b); }
.lb-report-form {
  position: absolute; right: 0; top: 100%; z-index: 60; width: 280px; max-width: 78vw;
  margin-top: 6px; padding: 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border2, var(--border));
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; gap: 10px; text-align: left;
}
.lb-report-note  { font-size: 0.76rem; line-height: 1.6; color: var(--text-muted); }
.lb-report-label { font-size: 0.78rem; color: var(--text-muted); display: block; }
.lb-report-label select,
.lb-report-label input { width: 100%; margin-top: 4px; }
.lb-optional { opacity: 0.7; }
.lb-flash {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 8px;
  font-size: 0.85rem; line-height: 1.6;
}
.lb-flash-ok  { background: rgba(34,197,94,0.08);  border: 1px solid rgba(34,197,94,0.25);  color: var(--success); }
.lb-flash-err { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.25);  color: var(--error); }

@media (max-width: 768px) {
  .t-arena { padding: 16px; gap: 16px; }
  .t-arena-art img, .t-arena-blank { width: 100%; }
  .t-arena-body h2 { font-size: 1.3rem; }
  .lb-report-form { right: auto; left: 0; }
  /* The admin panel is a desktop tool; on a phone the sidebar stacks above the
     content rather than trying to be a drawer. */
  .admin-wrap { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
}
