/* ═══════════════════════════════════════════
   TrivGang — Design System
   Premium Blue Game UI — Deep Navy + Electric Blue
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;0,9..40,900;1,9..40,400&display=swap');

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

:root {
  --bg:        #0a1228;
  --bg2:       #0d1630;
  --surface:   #0f1929;
  --surface2:  #141f35;
  --border:    #1a2d47;
  --border2:   #263d5e;

  /* Blue accent — replaces all gold */
  --gold:      #3d6fff;
  --gold-l:    #5d85ff;
  --gold-d:    #2554dc;
  --gold-glow: rgba(61,111,255,0.28);
  --gold-dim:  rgba(61,111,255,0.12);

  /* Keep blue vars too for voice button etc */
  --blue:      #2a5298;
  --blue-l:    #3a6bc4;
  --blue-bright: #4a8eff;

  --cream:     #e8f0ff;
  --cream-2:   #9ab0d8;
  --cream-3:   #5a7099;

  --green:     #2d9e6a;
  --green-l:   #3dbf82;
  --red:       #c0392b;
  --red-l:     #e74c3c;
  --amber:     #e8a020;

  --text:      #e8f0ff;
  --text-2:    #8aa8d4;
  --text-3:    #4d6890;

  --radius:    10px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --shadow:    0 4px 24px rgba(0,0,0,0.55);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.65);
  --shadow-gold: 0 4px 24px rgba(61,111,255,0.28);

  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
  --spring:     0.3s cubic-bezier(0.34,1.56,0.64,1);

  --font-display: 'DM Sans', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Category colors */
  --cat-general:   #3d6fff;
  --cat-science:   #00b890;
  --cat-history:   #c45c3a;
  --cat-pop:       #c03b8e;
  --cat-sports:    #2d9e6a;
  --cat-tech:      #7040ff;
  --cat-geography: #2a88d0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--gold-l); text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; border: none; }
input, select { font-family: var(--font-body); }

/* ── Rich bg gradient — shared across all screens ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(78,238,255,0.13) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 85% 60%, rgba(255,30,142,0.07) 0%, transparent 50%),
    radial-gradient(ellipse 30% 20% at 10% 70%, rgba(78,238,255,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Grid texture — shared across all screens ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(93,133,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93,133,255,0.07) 1px, transparent 1px);
  background-size: 52px 52px;
  background-position: center center;
  pointer-events: none;
  z-index: 0;
}

/* ── Stars layer (shared background) ── */
.bg-stars-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: bgStarTwinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
  opacity: 0;
}

@keyframes bgStarTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: var(--max-opacity, 0.6); transform: scale(1); }
}

/* ── Scanlines (shared) ── */
.bg-scanlines-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.025) 2px,
    rgba(0,0,0,0.025) 4px
  );
}

/* ── Layout ──────────────────────────────── */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 40px;
  position: relative;
  z-index: 1;
}

.page-top {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
  position: relative;
  z-index: 1;
}

.container { width: 100%; max-width: 480px; }
.container-lg { width: 100%; max-width: 680px; }
.container-xl { width: 100%; max-width: 900px; }

/* ── Navbar ──────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(7,13,26,0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(61,111,255,0.18);
  box-shadow: 0 1px 20px rgba(0,0,0,0.4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.navbar-brand:hover { color: var(--text); }

/* ── Brand Mark (SVG logo) ───────────────── */
.brand-mark {
  width: 30px; height: 30px;
  flex-shrink: 0;
}

.navbar-code {
  font-family: 'DM Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(61,111,255,0.1);
  border: 1px solid rgba(61,111,255,0.22);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--gold-l);
  letter-spacing: 0.12em;
}

.navbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-d), var(--gold-l));
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(61,111,255,0.35), 0 1px 0 rgba(255,255,255,0.1) inset;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(61,111,255,0.5); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border2); background: var(--surface2); }
.btn-secondary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--gold-l);
  border: 1.5px solid var(--border);
  padding: 10px 20px;
}
.btn-ghost:hover { border-color: rgba(61,111,255,0.4); background: var(--gold-dim); }

.btn-success {
  background: linear-gradient(135deg, #1d7a52, var(--green));
  color: white;
  box-shadow: 0 4px 20px rgba(45,158,106,0.3);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(45,158,106,0.4); }

.btn-danger {
  background: linear-gradient(135deg, #9b2c2c, var(--red));
  color: white;
}

.btn-lg { padding: 16px 32px; font-size: 1.05rem; border-radius: 14px; min-height: 56px; }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; min-height: 36px; }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ── Inputs ──────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-2); letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 1rem;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  min-height: 50px;
}
.input:focus { border-color: rgba(61,111,255,0.5); box-shadow: 0 0 0 3px rgba(61,111,255,0.12); }
.input::placeholder { color: var(--text-3); }

.input-lg {
  padding: 16px 20px;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  border-radius: 14px;
  min-height: 64px;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235a7099'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  padding-right: 40px;
}

.form-stack { display: flex; flex-direction: column; gap: 18px; }
.form-error {
  color: var(--red-l);
  font-size: 0.8125rem;
  padding: 10px 14px;
  background: rgba(192,57,43,0.1);
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: 10px;
  text-align: center;
  display: none;
}
.form-error.show { display: block; }

/* ── Avatar ──────────────────────────────── */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
  color: white;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }

/* ── Player Items ────────────────────────── */
.player-list { display: flex; flex-direction: column; gap: 8px; }

.player-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: slideInDown 0.3s var(--spring) both;
  transition: border-color var(--transition);
}

.player-item.is-you {
  border-color: rgba(61,111,255,0.3);
  background: var(--gold-dim);
}

.player-name { flex: 1; font-weight: 600; font-size: 0.9375rem; }
.player-score { font-family: monospace; font-weight: 700; color: var(--gold-l); font-size: 0.9375rem; }

.host-badge {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--gold-dim); color: var(--gold-l);
  border: 1px solid rgba(61,111,255,0.2);
  padding: 2px 8px; border-radius: 4px; font-weight: 700;
}

.you-badge {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(45,158,106,0.12); color: var(--green-l);
  border: 1px solid rgba(45,158,106,0.2);
  padding: 2px 8px; border-radius: 4px; font-weight: 700;
}

/* ── Room Code ───────────────────────────── */
.room-code-display {
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1.5px solid rgba(61,111,255,0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.room-code-display:hover { border-color: rgba(61,111,255,0.4); box-shadow: 0 4px 30px rgba(61,111,255,0.12); }

.room-code-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); margin-bottom: 8px;
}

.room-code-value {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5.5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--gold-l);
  line-height: 1;
  text-shadow: 0 0 30px rgba(61,111,255,0.4);
}

.room-code-hint { margin-top: 8px; font-size: 0.8125rem; color: var(--text-3); }

/* ── Countdown Timer Bar (top of viewport) ── */
#timer-bar-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 10px;
  background: rgba(255,255,255,0.07);
  z-index: 1000;
  pointer-events: none;
}
#timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00dd55, #39ff14);
  box-shadow: 0 0 14px rgba(57,255,20,0.8), 0 0 28px rgba(57,255,20,0.4);
  transition: width 0.12s linear, background 0.3s, box-shadow 0.3s;
}

/* ── Timer Ring — kept for legacy compat, hidden in gameplay ── */
.timer-wrap { display: none; }
.timer-ring-wrap { width: 72px; height: 72px; position: relative; flex-shrink: 0; }
.timer-ring { width: 72px; height: 72px; transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--surface2); stroke-width: 7; }
.timer-ring-fg {
  fill: none; stroke: var(--gold); stroke-width: 7;
  stroke-linecap: round; stroke-dasharray: 204; stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.9s linear, stroke 0.3s;
}
.timer-text { display: none; }
@keyframes timerPulse { to { opacity: 0.5; } }

/* ── Question Header ─────────────────────── */
.question-header {
  display: none; /* replaced by timer-bar-top */
}
.question-progress { display: none; }

/* ── Question number badge on card ── */
.question-num-badge {
  font-size: 0.65rem;
  font-weight: 900;
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.07);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

/* ── Question Card — Trivial Pursuit Inspired ── */
.question-card {
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1.5px solid rgba(61,111,255,0.2);
  border-left: 4px solid var(--cat-color, var(--gold));
  border-radius: var(--radius-xl);
  padding: 0;
  text-align: center;
  box-shadow:
    0 0 60px rgba(0,0,0,0.5),
    0 0 0 1px rgba(61,111,255,0.06),
    inset 0 1px 0 rgba(255,255,255,0.05);
  animation: questionIn 0.4s var(--spring) both;
  position: relative;
  overflow: hidden;
}

/* Category label bar */
.question-category-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 10px 20px;
  background: rgba(61,111,255,0.08);
  border-bottom: 1px solid rgba(61,111,255,0.15);
  position: relative;
}

.question-category-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-l);
}

/* Pie wedge decoration in top-right */
.question-category-bar::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 44px; height: 44px;
  background: var(--cat-color, var(--gold));
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  opacity: 0.18;
  border-radius: 0 var(--radius-xl) 0 0;
}

/* Category pip dots (decorative) */
.question-pip-dots {
  display: flex;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.question-pip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  opacity: 0.4;
}
.question-pip-dot.active { opacity: 1; }

/* Question body */
.question-body {
  padding: 22px 20px 22px;
  position: relative;
}

/* Subtle radial glow behind text */
.question-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(61,111,255,0.1) 0%, transparent 65%);
  pointer-events: none;
}

.question-text {
  font-family: var(--font-body);
  font-size: clamp(1.15rem, 4.2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.65;
  color: var(--cream);
  position: relative;
  z-index: 1;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 20px rgba(0,0,0,0.3);
}

@keyframes questionIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Voice Input ─────────────────────────── */
.voice-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.voice-btn {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3d9e, var(--blue-l));
  border: 3px solid rgba(61,111,255,0.35);
  color: white;
  font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 30px rgba(42,82,152,0.45), inset 0 1px 0 rgba(255,255,255,0.1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
  position: relative;
}

.voice-btn:hover { transform: scale(1.05); box-shadow: 0 8px 40px rgba(42,82,152,0.55); }
.voice-btn:active, .voice-btn.listening {
  background: linear-gradient(135deg, #8b2020, #c0392b);
  border-color: rgba(192,57,43,0.6);
  box-shadow: 0 6px 40px rgba(192,57,43,0.5);
  animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 6px 40px rgba(192,57,43,0.4); transform: scale(1); }
  50% { box-shadow: 0 6px 60px rgba(192,57,43,0.7); transform: scale(1.04); }
}

.voice-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  text-align: center;
  letter-spacing: 0.02em;
}

.voice-transcript {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid rgba(61,111,255,0.18);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--cream);
  text-align: center;
  min-height: 54px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s;
}

.voice-transcript.has-text { border-color: rgba(61,111,255,0.45); }
.voice-transcript.placeholder-text { color: var(--text-3); font-weight: 400; font-size: 0.875rem; }

.text-answer-input {
  width: 100%;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  outline: none;
  -webkit-appearance: none;
  min-height: 50px;
  transition: border-color var(--transition);
}
.text-answer-input:focus { border-color: rgba(61,111,255,0.45); box-shadow: 0 0 0 3px rgba(61,111,255,0.1); }
.text-answer-input::placeholder { color: var(--text-3); font-weight: 400; }

.submit-voice-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--gold-d), var(--gold-l));
  color: white;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  min-height: 50px;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(61,111,255,0.3);
}
.submit-voice-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(61,111,255,0.45); }
.submit-voice-btn:active { transform: scale(0.97); }
.submit-voice-btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ── Answer feedback ─────────────────────── */
#answer-feedback {
  text-align: center; padding: 14px;
  border-radius: var(--radius-lg);
  font-weight: 700; font-size: 1rem;
  display: none; animation: scaleIn 0.3s var(--spring);
}
#answer-feedback.correct-fb {
  display: block;
  background: rgba(45,158,106,0.12);
  border: 1.5px solid var(--green);
  color: var(--green-l);
}
#answer-feedback.wrong-fb {
  display: block;
  background: rgba(192,57,43,0.1);
  border: 1.5px solid var(--red);
  color: var(--red-l);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Score bar (legacy, kept for compat) ─── */
.score-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

/* ── Player Corners (fixed at top) ──────────── */
.player-bar { display: none; } /* legacy — replaced by corners */

.player-corner {
  position: fixed;
  top: 12px;
  z-index: 400;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.player-corner-left {
  left: max(12px, calc(50vw - 240px));
  flex-direction: row; /* avatar LEFT, info RIGHT */
}
.player-corner-right {
  right: max(12px, calc(50vw - 240px));
  flex-direction: row-reverse; /* avatar RIGHT, info LEFT */
}
.pc-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(61,111,255,0.1);
  border: 3px solid rgba(77,128,255,0.8);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 14px rgba(61,111,255,0.35);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.pc-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.player-corner-right .pc-info {
  align-items: flex-end;
}
.player-corner-left .pc-info {
  align-items: flex-start;
}
.pc-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.pc-score {
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 18px rgba(61,111,255,0.6);
  letter-spacing: -0.02em;
}
.pc-waiting {
  font-size: 0.7rem;
  color: var(--text-3);
  font-style: italic;
  margin-top: 2px;
}

/* Buzzed-in state for corner player */
.player-corner.buzzed-in .pc-avatar {
  border-color: rgba(77,128,255,0.95);
  animation: cornerBuzzGlow 0.75s ease-in-out infinite;
}
.player-corner.buzzed-in .pc-score {
  color: #fff;
  text-shadow: 0 0 14px rgba(77,128,255,1.0);
}
@keyframes cornerBuzzGlow {
  0%,100% { box-shadow: 0 0 14px rgba(61,111,255,0.8), 0 2px 10px rgba(0,0,0,0.35); }
  50%      { box-shadow: 0 0 30px rgba(77,128,255,1.0), 0 0 50px rgba(61,111,255,0.5); }
}

/* Legacy pb-* classes — kept so JS still works */
.pb-player { display: none; }
.pb-avatar { display: none; }
.pb-vs { display: none; }
.pb-waiting-legacy { display: none; }

/* ── Reveal section ──────────────────────── */
#reveal-scores {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
#reveal-scores.show { display: flex; }

.reveal-player-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  animation: slideInDown 0.3s var(--spring) both;
}
.reveal-player-row.answered-correct { border-color: rgba(45,158,106,0.3); background: rgba(45,158,106,0.06); }
.reveal-player-row.answered-wrong   { border-color: rgba(192,57,43,0.25); background: rgba(192,57,43,0.05); }
.reveal-player-row.not-answered     { opacity: 0.5; }

/* ── Correct answer reveal ───────────────── */
.correct-answer-reveal {
  text-align: center;
  padding: 14px 16px;
  background: rgba(61,111,255,0.08);
  border: 1.5px solid rgba(61,111,255,0.22);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.correct-answer-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); margin-bottom: 4px;
}
.correct-answer-value {
  font-family: var(--font-display);
  font-size: 1.2rem; font-weight: 700;
  color: var(--gold-l);
}

/* ── Progress Bar ────────────────────────── */
.progress-bar {
  height: 3px; background: var(--surface2);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-d), var(--gold-l));
  border-radius: 2px;
  transition: width 0.5s ease;
  box-shadow: 0 0 6px rgba(61,111,255,0.5);
}

/* ── Score Delta ─────────────────────────── */
.score-delta {
  position: fixed;
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 900;
  pointer-events: none; z-index: 9000;
  animation: scoreFly 1.2s ease forwards;
}
.score-delta.pos { color: var(--green-l); }
.score-delta.neg { color: var(--red-l); }
@keyframes scoreFly {
  0%   { opacity: 1; transform: translateY(0) scale(0.8); }
  20%  { opacity: 1; transform: translateY(-10px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.9); }
}

/* ── Toast ───────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.875rem; font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s var(--spring);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--green); color: var(--green-l); }
.toast.error   { border-color: var(--red); color: var(--red-l); }

/* ── Confetti ────────────────────────────── */
.confetti-wrap {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9000; overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px; height: 10px;
  opacity: 0;
  animation: confettiFall linear both;
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-20px) rotate(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(105vh) rotate(720deg); }
}

/* ── Winner ──────────────────────────────── */
.winner-card {
  background: linear-gradient(160deg, rgba(61,111,255,0.12), rgba(42,82,152,0.08));
  border: 1.5px solid rgba(61,111,255,0.3);
  border-radius: var(--radius-xl);
  padding: 32px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: winnerReveal 0.6s var(--spring) both;
  box-shadow: 0 0 60px rgba(61,111,255,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
}

.winner-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(61,111,255,0.14) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes winnerReveal {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

.winner-crown {
  font-size: 2.75rem;
  display: block;
  animation: crownBounce 0.8s var(--spring) 0.3s both;
}
@keyframes crownBounce {
  from { opacity: 0; transform: scale(0) rotate(-15deg); }
  60%  { transform: scale(1.15) rotate(4deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.winner-name {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 900;
  color: var(--gold-l);
  letter-spacing: -0.01em;
  text-shadow: 0 0 30px rgba(61,111,255,0.4);
}

.winner-score {
  font-family: monospace; font-size: 1.25rem; font-weight: 700;
  color: var(--cream-2);
  margin-top: 6px;
}

/* ── Result Rows ─────────────────────────── */
.result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius);
  animation: resultSlide 0.4s var(--spring) both;
}
.result-row:nth-child(1) { background: rgba(61,111,255,0.1); border: 1px solid rgba(61,111,255,0.22); }
.result-row:nth-child(2) { background: rgba(148,163,184,0.04); border: 1px solid var(--border); }
.result-row:nth-child(3) { background: rgba(180,100,50,0.06); border: 1px solid rgba(180,100,50,0.15); }
.result-row:nth-child(n+4) { background: var(--bg2); border: 1px solid var(--border); }

@keyframes resultSlide {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.result-place { font-size: 1.1rem; font-weight: 900; width: 30px; text-align: center; }
.result-info { flex: 1; }
.result-name { font-weight: 700; font-size: 0.9375rem; }
.result-points { font-size: 0.75rem; color: var(--text-3); }
.result-score { font-family: monospace; font-weight: 700; font-size: 1rem; color: var(--gold-l); }

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.7rem; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-gold   { background: var(--gold-dim); color: var(--gold-l); border: 1px solid rgba(61,111,255,0.22); }
.badge-purple { background: rgba(74,60,180,0.12); color: #9090e8; border: 1px solid rgba(74,60,180,0.2); }
.badge-green  { background: rgba(45,158,106,0.1); color: var(--green-l); border: 1px solid rgba(45,158,106,0.2); }
.badge-amber  { background: rgba(232,160,32,0.1); color: var(--amber); border: 1px solid rgba(232,160,32,0.2); }

/* ── Loading ─────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--surface2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 60px 0;
}

/* ── Waiting dots ────────────────────────── */
.waiting-dots { display: flex; gap: 6px; justify-content: center; }
.waiting-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
  animation: dotBounce 1.2s ease infinite;
}
.waiting-dot:nth-child(2) { animation-delay: 0.2s; }
.waiting-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* ── Sound toggle ────────────────────────── */
.sound-toggle {
  width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.sound-toggle:hover { background: var(--surface2); border-color: var(--border2); }
.sound-toggle.muted { opacity: 0.4; }

/* ── Hero Section ────────────────────────── */
.hero-section {
  text-align: center;
  padding: 20px 0 44px;
  position: relative;
}

/* Decorative hexagon rings behind hero */
.hero-section::before {
  content: '';
  position: absolute;
  top: -20px; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 200px;
  background: radial-gradient(ellipse at 50% 50%, rgba(61,111,255,0.14) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.hero-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

/* Large brand mark in hero */
.hero-brand-mark {
  width: 56px; height: 56px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 20px rgba(61,111,255,0.5));
  animation: heroMarkIn 0.6s var(--spring) both;
}

@keyframes heroMarkIn {
  from { opacity: 0; transform: scale(0.6) rotate(-10deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.hero-logo {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 11vw, 5.8rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(160deg, #ffffff 0%, var(--gold-l) 50%, #a0b8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  filter: drop-shadow(0 0 40px rgba(61,111,255,0.25));
  animation: heroLogoIn 0.5s var(--spring) 0.1s both;
}

@keyframes heroLogoIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-tagline {
  font-size: 0.8rem;
  color: var(--text-3); font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: heroTagIn 0.5s ease 0.2s both;
}

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

.hero-divider {
  width: 64px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 18px auto 0;
  animation: heroTagIn 0.5s ease 0.3s both;
}

/* ── Game Card (home) ────────────────────── */
.game-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--border);
  border-top: 1px solid rgba(61,111,255,0.2);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(61,111,255,0.04);
  animation: cardIn 0.4s var(--spring) 0.15s both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Tabs ────────────────────────────────── */
.tabs {
  display: flex; background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; gap: 4px;
  margin-bottom: 4px;
}
.tab-btn {
  flex: 1; padding: 10px 16px;
  font-size: 0.875rem; font-weight: 600;
  color: var(--text-3); background: transparent;
  border: none; border-radius: 7px;
  cursor: pointer; transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--surface2), rgba(61,111,255,0.12));
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 1px solid rgba(61,111,255,0.15);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Divider ─────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 0.8125rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Ad slot ─────────────────────────────── */
.ad-slot {
  width: 100%; max-width: 480px;
  min-height: 56px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  overflow: hidden; margin: 16px auto 0;
}

/* ── Gradient text ───────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--gold-l), #a0c4ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Leaderboard ─────────────────────────── */
.lb-table { display: flex; flex-direction: column; gap: 0; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(61,111,255,0.04); }
.lb-rank { width: 28px; text-align: center; font-weight: 800; font-size: 1rem; }
.lb-name { flex: 1; font-weight: 600; }
.lb-score { font-family: monospace; font-weight: 700; color: var(--gold-l); }
.lb-date { font-size: 0.75rem; color: var(--text-3); }

/* ── Keyframes ───────────────────────────── */
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes scaleIn2 {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}

.animate-fade  { animation: fadeIn 0.3s ease both; }
.animate-scale { animation: scaleIn2 0.3s var(--spring) both; }

/* ── Streak ──────────────────────────────── */
.streak { display: flex; align-items: center; gap: 4px; font-size: 0.8125rem; font-weight: 700; color: var(--amber); }

/* ── Safe area ───────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Mobile fixes ────────────────────────── */
@media (max-width: 480px) {
  .card, .game-card { padding: 16px; }
  .btn-lg { padding: 14px 24px; font-size: 0.975rem; }
  .question-body { padding: 16px 14px 16px; }
}

@media (hover: none) {
  .btn:hover { transform: none; }
  .submit-voice-btn:hover { transform: none; }
  .voice-btn:hover { transform: none; }
}

/* ── Ad Container ────────────────────────── */
.ad-container {
  width: 100%;
  min-height: 56px;
  margin: 16px auto 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ── Premium Banner ──────────────────────── */
.premium-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(61,111,255,0.07), rgba(42,82,152,0.05));
  border: 1px solid rgba(61,111,255,0.18);
  border-radius: var(--radius);
  margin: 12px auto 0;
  width: 100%;
  max-width: 480px;
}

.premium-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
}

.premium-banner-icon { font-size: 1rem; }

.premium-banner-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--gold-d), var(--gold-l));
  color: white;
  border-radius: 7px;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.premium-banner-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(61,111,255,0.4); color: white; }

/* ── Share Card Overlay ──────────────────── */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  transition: background 0.3s ease;
}

.share-overlay.share-overlay-show {
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.share-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px 26px 0 0;
  padding: 28px 20px 40px;
  width: 100%;
  max-width: 520px;
  position: relative;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 92vh;
  overflow-y: auto;
}

.share-overlay.share-overlay-show .share-modal {
  transform: translateY(0);
}

@media (min-width: 520px) {
  .share-overlay {
    align-items: center;
    padding: 20px;
  }
  .share-modal {
    border-radius: var(--radius-xl);
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
    opacity: 0;
  }
  .share-overlay.share-overlay-show .share-modal {
    transform: scale(1);
    opacity: 1;
  }
}

.share-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.share-close:hover { background: var(--border); color: var(--text); }

/* Arcade share card */
.share-card {
  background: linear-gradient(160deg, #0b1223 0%, #101928 50%, #070d1a 100%);
  border: 1.5px solid rgba(61,111,255,0.28);
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.share-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(61,111,255,0.1) 0%, transparent 65%);
  pointer-events: none;
}

.share-card-brand {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold-l);
  margin-bottom: 12px;
  opacity: 0.7;
}

.share-card-result {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 14px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 12px;
}

.share-win {
  background: rgba(61,111,255,0.15);
  border: 1px solid rgba(61,111,255,0.4);
  color: var(--gold-l);
}

.share-loss {
  background: rgba(42,82,152,0.12);
  border: 1px solid rgba(42,82,152,0.3);
  color: var(--blue-bright);
}

.share-card-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.1;
}

.share-card-score {
  font-family: 'DM Mono', monospace;
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 900;
  color: var(--gold-l);
  text-shadow: 0 0 30px rgba(61,111,255,0.35);
  line-height: 1;
  letter-spacing: -0.04em;
}

.share-card-score span {
  font-size: 0.35em;
  opacity: 0.7;
  vertical-align: middle;
}

.share-card-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.share-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.share-card-tag-dim { opacity: 0.7; }

.share-card-url {
  margin-top: 14px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  opacity: 0.5;
}

.share-taunt {
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 0 4px;
}
.share-taunt strong { color: var(--text); }

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 0;
}

.share-btn {
  padding: 12px 8px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}
.share-btn:hover { background: var(--border); transform: translateY(-1px); }
.share-btn:active { transform: scale(0.96); }

.share-btn-twitter { border-color: rgba(255,255,255,0.12); background: rgba(0,0,0,0.3); }
.share-btn-twitter:hover { background: rgba(255,255,255,0.08); }

.share-btn-sms { border-color: rgba(45,158,106,0.25); background: rgba(45,158,106,0.05); color: var(--green-l); }
.share-btn-sms:hover { background: rgba(45,158,106,0.1); }

.share-btn-copy { border-color: rgba(61,111,255,0.25); background: rgba(61,111,255,0.05); color: var(--gold-l); }
.share-btn-copy:hover { background: rgba(61,111,255,0.1); }

/* ── Category Tabs ───────────────────────── */
.cat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.cat-tab:hover { border-color: var(--border2); color: var(--text-2); }
.cat-tab.active {
  background: var(--gold-dim);
  border-color: rgba(61,111,255,0.4);
  color: var(--gold-l);
}

.lb-wins {
  font-size: 0.75rem;
  color: var(--gold-l);
  font-weight: 700;
  white-space: nowrap;
}

.lb-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.9375rem;
}

/* ── Floating Sound Button ───────────────── */
.floating-sound-btn {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(7,13,26,0.9);
  border: 1px solid rgba(61,111,255,0.25);
  color: rgba(93,133,255,0.8);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 14px rgba(0,0,0,0.5);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.floating-sound-btn:hover {
  border-color: rgba(61,111,255,0.5);
  transform: scale(1.08);
}
.floating-sound-btn.muted { opacity: 0.45; }

/* ── Correct Answer Celebration ─────────── */
@keyframes correctFlash {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  60%  { opacity: 0.5; }
  100% { opacity: 0; }
}
@keyframes screenShake {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-6px); }
  30%     { transform: translateX(6px); }
  45%     { transform: translateX(-4px); }
  60%     { transform: translateX(4px); }
  75%     { transform: translateX(-2px); }
}
@keyframes correctPulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.04); }
  60%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}
@keyframes burstParticle {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.3); }
}
.correct-flash-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(61,111,255,0.22) 0%, rgba(77,128,255,0.08) 100%);
  z-index: 8000;
  pointer-events: none;
  animation: correctFlash 0.55s ease forwards;
}
.burst-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  z-index: 8001;
  pointer-events: none;
  animation: burstParticle 0.7s ease-out forwards;
}

/* ── Game Gate Modal ─────────────────────── */
.game-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}
@media (min-width: 520px) {
  .game-gate-overlay { align-items: center; }
}
.game-gate-modal {
  background: linear-gradient(160deg, #0b1223 0%, #0f1929 100%);
  border: 1.5px solid rgba(61,111,255,0.28);
  border-radius: 26px 26px 0 0;
  padding: 32px 24px 48px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(61,111,255,0.06) inset;
  animation: slideInDown 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@media (min-width: 520px) {
  .game-gate-modal {
    border-radius: 26px;
    animation: scaleIn2 0.3s cubic-bezier(0.34,1.56,0.64,1);
  }
}
.game-gate-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
  animation: crownBounce 0.6s var(--spring) both;
}
.game-gate-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold-l);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.game-gate-sub {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 24px;
}
.game-gate-sub strong { color: var(--text); }
.game-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.game-gate-cta {
  width: 100%;
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0a1228;
  background: linear-gradient(135deg, #4eeeff 0%, #2ab8d8 100%);
  border: none;
  cursor: pointer;
  min-height: 56px;
  box-shadow: 0 4px 24px rgba(78,238,255,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
.game-gate-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 36px rgba(78,238,255,0.5); }
.game-gate-cta:active { transform: scale(0.97); }
.game-gate-dismiss {
  background: transparent;
  border: 1.5px solid rgba(61,111,255,0.2);
  color: var(--text-3);
  font-size: 0.875rem;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.game-gate-dismiss:hover { border-color: rgba(61,111,255,0.4); color: var(--text-2); }
.game-gate-feature-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.game-gate-feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 500;
}
.game-gate-feature-list li::before {
  content: '✓';
  width: 20px; height: 20px;
  background: rgba(61,111,255,0.15);
  border: 1px solid rgba(61,111,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--gold-l);
  font-weight: 700;
  flex-shrink: 0;
}
.game-gate-timer {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 6px;
}
.game-gate-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(61,111,255,0.2), transparent);
  margin: 20px 0;
}

/* ── Gameplay page — top padding for fixed corners + timer bar ── */
/* Corners are ~60px tall (horizontal layout), starting at y=12px → bottom ~82px */
/* Add 18px buffer → 100px total is enough, reducing vertical clipping on iPhone 12 */
.gameplay-page .page-top { padding-top: 0 !important; }
.gameplay-page .container { padding-top: 100px; }

/* ── Celebration Overlay ── */
#celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0,0,0,0);
}
#celebration-overlay.show {
  display: flex;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.celebration-text {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  font-weight: 900;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 40px rgba(61,111,255,0.9), 0 2px 20px rgba(0,0,0,0.8);
  padding: 24px 32px;
  border-radius: var(--radius-xl);
  background: rgba(15,25,41,0.7);
  border: 1.5px solid rgba(61,111,255,0.3);
  box-shadow: 0 0 60px rgba(61,111,255,0.2);
  animation: celebIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  line-height: 1.3;
  max-width: 90vw;
}
@keyframes celebIn {
  from { opacity: 0; transform: scale(0.65) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Buzzer button — full-width rect ── */
/* Override the circular styles in play.html <style> block via higher specificity */
#buzzer-zone .buzzer-btn {
  width: 100%;
  height: 68px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold-d) 0%, var(--gold-l) 100%);
  border: none;
  box-shadow: 0 6px 24px rgba(37,84,220,0.45), 0 1px 0 rgba(255,255,255,0.1) inset;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  animation: buzzer-pulse-rect 2s ease-in-out infinite;
}
#buzzer-zone .buzzer-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(37,84,220,0.3), inset 0 3px 6px rgba(0,0,0,0.25);
}
#buzzer-zone .buzzer-btn:disabled,
#buzzer-zone .buzzer-btn.disabled {
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: none;
  opacity: 0.45;
  cursor: not-allowed;
  animation: none;
  transform: none;
}
@keyframes buzzer-pulse-rect {
  0%,100% { box-shadow: 0 6px 24px rgba(37,84,220,0.45), 0 1px 0 rgba(255,255,255,0.1) inset; }
  50%      { box-shadow: 0 8px 36px rgba(37,84,220,0.75), 0 0 60px rgba(77,128,255,0.25), 0 1px 0 rgba(255,255,255,0.1) inset; }
}

/* Buzzer transformed into SUBMIT state */
#buzzer-zone .buzzer-btn.submit-mode {
  background: linear-gradient(135deg, #1d7a52, var(--green));
  box-shadow: 0 6px 24px rgba(45,158,106,0.4), 0 1px 0 rgba(255,255,255,0.1) inset;
  animation: none;
  letter-spacing: 0.1em;
}
#buzzer-zone .buzzer-btn.submit-mode:disabled {
  background: var(--surface2);
  opacity: 0.45;
}

/* ── Avatar Picker Modal ── */
.avatar-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 30000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@media (min-width: 520px) {
  .avatar-picker-overlay { align-items: center; }
}
.avatar-picker-modal {
  background: linear-gradient(160deg, #0b1223 0%, #0f1929 100%);
  border: 1.5px solid rgba(61,111,255,0.25);
  border-radius: 26px 26px 0 0;
  padding: 28px 20px 0;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideInDown 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@media (min-width: 520px) {
  .avatar-picker-modal { border-radius: 26px; overflow: hidden; }
}
.avatar-picker-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
}
.avatar-picker-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 20px;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  padding-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.avatar-grid::-webkit-scrollbar { display: none; }
.avatar-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 10px 6px;
  border-radius: 14px;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  background: rgba(255,255,255,0.02);
  -webkit-tap-highlight-color: transparent;
}
.avatar-grid-item:hover { background: rgba(61,111,255,0.08); border-color: rgba(61,111,255,0.2); }
.avatar-grid-item.selected { border-color: var(--gold-l); background: rgba(61,111,255,0.12); box-shadow: 0 0 16px rgba(61,111,255,0.25); }
.avatar-grid-item img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(61,111,255,0.1);
  object-fit: cover;
  border: 2px solid rgba(77,128,255,0.2);
}
.avatar-grid-item.selected img { border-color: var(--gold-l); }
.avatar-grid-name {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: 0.02em;
}
.avatar-group-header {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin: 10px 0 4px;
  padding: 6px 0 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.avatar-group-header:first-child { border-top: none; margin-top: 0; }
.avatar-picker-confirm {
  width: 100%;
  flex-shrink: 0;
  margin-top: 0;
  padding: 16px;
  border-radius: 0;
  background: linear-gradient(135deg, var(--gold-d), var(--gold-l));
  color: white;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  min-height: 58px;
  font-family: var(--font-body);
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 -4px 20px rgba(61,111,255,0.25), 0 4px 20px rgba(61,111,255,0.35);
  border-top: 1px solid rgba(61,111,255,0.2);
  /* Safe-area support for bottom sheet on iPhone */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.avatar-picker-confirm:hover { box-shadow: 0 -4px 20px rgba(61,111,255,0.3), 0 6px 28px rgba(61,111,255,0.5); }
.avatar-picker-confirm:active { opacity: 0.88; }
@media (min-width: 520px) {
  .avatar-picker-confirm {
    border-radius: 0 0 24px 24px;
    padding-bottom: 16px;
  }
}

/* ── Fullscreen Interstitial Ad ──────────── */
.ad-interstitial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(3,6,18,0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ad-interstitial-overlay.show { opacity: 1; }
.ad-interstitial-inner {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ad-interstitial-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  align-self: flex-start;
}
.ad-interstitial-ad-box {
  width: 100%;
  min-height: 250px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.02);
}
.ad-interstitial-close-btn {
  width: 100%;
  padding: 13px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.ad-interstitial-close-btn:hover:not(:disabled) { background: rgba(255,255,255,0.16); }
.ad-interstitial-close-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ad-interstitial-timer {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  height: 18px;
}
.ad-interstitial-premium {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
}
.ad-interstitial-premium a {
  color: var(--brand-l, #5d85ff);
  text-decoration: none;
}

/* ── Play Page Ad Bar ─────────────────────── */
.play-ad-bar {
  background: rgba(5,10,28,0.98);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.play-ad-bar .ad-container {
  margin: 0;
  border-radius: 0;
  width: 100%;
  border-left: none;
  border-right: none;
  border-radius: 0;
}
.play-ad-bar .ad-slot {
  margin: 0;
  border-radius: 0;
  max-width: 100%;
  min-height: 50px;
  border-left: none;
  border-right: none;
}
