/* ─── CSS Variables & Reset ──────────────────────────────────────────────── */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1e1e38;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(248, 113, 113, 0.4);

  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #555577;

  --accent: #f87171;
  --accent-light: #fca5a5;
  --accent-dark: #dc2626;
  --accent-glow: rgba(248, 113, 113, 0.3);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;

  --gradient-primary: linear-gradient(135deg, #f87171, #ef4444);
  --gradient-warm: linear-gradient(135deg, #f87171, #fca5a5);
  --gradient-cool: linear-gradient(135deg, #ef4444, #f87171);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 50%;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(248, 113, 113, 0.2);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Screens ────────────────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
}
.screen.active {
  display: flex;
  animation: screenIn 0.4s ease;
}
@keyframes screenIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── Login Screen ───────────────────────────────────────────────────────── */
#screen-login {
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(248, 113, 113, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 70%, rgba(239, 68, 68, 0.05) 0%, transparent 50%);
}

.login-container {
  position: relative;
  text-align: center;
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
}

.login-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(248, 113, 113, 0.15), transparent 70%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.logo-section {
  margin-bottom: 40px;
}

.logo-img {
  width: 88px;
  height: 88px;
  margin-bottom: 20px;
  filter: drop-shadow(0 8px 24px rgba(248, 113, 113, 0.3));
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.logo-text {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #f87171, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-dot {
  background: linear-gradient(135deg, #fca5a5, #f87171);
  -webkit-background-clip: text;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  background: white;
  color: #333;
  border: none;
  border-radius: var(--radius-xl);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  margin-bottom: 40px;
}

.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 20px rgba(248, 113, 113, 0.15);
}

.btn-google:active {
  transform: translateY(0);
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.feature:hover {
  background: var(--surface-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}

.feature span {
  font-size: 20px;
}

/* ─── Lobby Tabs ─────────────────────────────────────────────────────────── */
.lobby-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
}

.lobby-tab {
  flex: 1;
  padding: 14px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lobby-tab:hover {
  color: var(--text-secondary);
}

.lobby-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-badge {
  background: var(--accent);
  color: white;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ─── Category Cards ─────────────────────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.category-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.category-card.selected-category {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(239, 68, 68, 0.04));
  box-shadow: var(--shadow-glow);
}

.category-card.selected-category::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--accent);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.category-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.category-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Selected Player ────────────────────────────────────────────────────── */
.user-card.selected-player {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.03));
}

/* ─── Challenge Bar ──────────────────────────────────────────────────────── */
.challenge-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.challenge-bar.hidden {
  display: none;
}

.challenge-bar-selections {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.challenge-selection {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sel-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.sel-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.challenge-vs {
  font-size: 16px;
  color: var(--accent);
}

.btn-challenge {
  padding: 10px 24px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-xl);
  color: white;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-challenge:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-challenge:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-clear-sel {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-clear-sel:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

/* ─── Lobby Screen ───────────────────────────────────────────────────────── */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.header-left { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; gap: 16px; }

.logo-small {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: 14px;
  font-weight: 500;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--accent);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.lobby-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(248, 113, 113, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(239, 68, 68, 0.03) 0%, transparent 50%);
}

.lobby-content {
  max-width: 800px;
  margin: 0 auto;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: var(--radius-full);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.online-count {
  background: var(--accent);
  color: white;
  padding: 2px 10px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  font-weight: 700;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.user-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition);
}

.user-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.user-card:hover::before {
  opacity: 0.05;
}

.user-card.in-game {
  opacity: 0.5;
  pointer-events: none;
}

.user-card.is-self {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.08), rgba(239, 68, 68, 0.03));
  pointer-events: none;
}

.user-card .avatar {
  width: 44px;
  height: 44px;
  position: relative;
  z-index: 1;
}

.user-card-info {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.user-card-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.user-card-status.in-game-status {
  color: var(--warning);
}

.challenge-icon {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: var(--radius-full);
  font-size: 16px;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition);
}

.user-card:hover .challenge-icon {
  opacity: 1;
  transform: scale(1);
}

.you-badge {
  position: relative;
  z-index: 1;
  font-size: 11px;
  padding: 2px 8px;
  background: var(--accent);
  border-radius: var(--radius-xl);
  font-weight: 700;
  color: white;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}

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

.modal-content h3 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.topic-input-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 4px;
}

.topic-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}

.topic-input:focus {
  border-color: var(--accent);
}

.topic-input::placeholder {
  color: var(--text-muted);
}

.topic-send-btn {
  padding: 12px 20px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.topic-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.topic-divider {
  width: 100%;
  text-align: center;
  position: relative;
  margin: 8px 0;
}

.topic-divider span {
  background: var(--bg-secondary);
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

.topic-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.topic-btn {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.topic-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.topic-emoji {
  font-size: 20px;
}

.btn-cancel {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cancel:hover {
  background: var(--surface);
  border-color: var(--error);
  color: var(--error);
}

/* Incoming Invite */
.incoming-invite-content {
  text-align: center;
}

.invite-flash {
  font-size: 56px;
  animation: inviteShake 0.5s ease-in-out;
}

@keyframes inviteShake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.invite-topic-badge {
  display: inline-block;
  padding: 8px 24px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xl);
  color: var(--accent-light);
  font-weight: 700;
  font-size: 16px;
  margin: 16px 0 24px;
}

.invite-actions {
  display: flex;
  gap: 12px;
}

.btn-accept, .btn-reject {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-accept {
  background: var(--success);
  color: white;
}

.btn-accept:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-reject {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-reject:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

/* ─── Game Screen ────────────────────────────────────────────────────────── */
#screen-game {
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
}

/* Countdown */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 50;
}

.countdown-overlay.active {
  display: flex;
}

.countdown-content {
  text-align: center;
}

.countdown-topic {
  font-size: 14px;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 700;
  margin-bottom: 40px;
}

.countdown-vs {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 48px;
}

.countdown-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.countdown-player span {
  font-size: 16px;
  font-weight: 600;
}

.avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  border: 3px solid var(--accent);
  object-fit: cover;
}

.vs-badge {
  font-size: 28px;
  font-weight: 900;
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.countdown-number {
  font-size: 120px;
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: countPulse 1s ease-in-out infinite;
}

@keyframes countPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* Question View - QuizUp Style */
.question-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.question-view.hidden {
  display: none;
}

/* Timer bar at very top */
.qu-timer-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
}

.qu-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #06b6d4, #22d3ee);
  transition: width 0.1s linear;
  width: 100%;
  border-radius: 0 3px 3px 0;
}

.qu-timer-bar.warning {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

/* Player info row */
.qu-players-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.qu-player {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.qu-player-right {
  justify-content: flex-end;
}

.qu-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  object-fit: cover;
}

.qu-player-info {
  display: flex;
  flex-direction: column;
}

.qu-player-info-right {
  text-align: right;
}

.qu-player-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.qu-player-score {
  font-size: 18px;
  font-weight: 900;
  color: #22d3ee;
}

.qu-time-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.qu-time-label {
  font-size: 9px;
  font-weight: 700;
  color: #f97316;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.qu-time-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

/* Vertical side score bars */
.qu-side-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255,255,255,0.05);
  z-index: 10;
}

.qu-side-left {
  left: 0;
}

.qu-side-right {
  right: 0;
}

.qu-side-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, #10b981, #22d3ee);
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  height: 0%;
  border-radius: 4px 4px 0 0;
}

.qu-side-bar-opp {
  background: linear-gradient(to top, #f59e0b, #f97316);
}

/* Question counter */
.qu-q-counter {
  text-align: center;
  padding: 12px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 1px;
}

/* Question text area */
.qu-question-area {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 40px 20px;
  min-height: 120px;
}

.qu-question-text {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  color: var(--text-primary);
  max-width: 600px;
}

/* Options - single column, QuizUp style, full width */
.qu-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 24px;
  width: 100%;
  flex: 1;
  overflow-y: auto;
}

.option-btn {
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid transparent;
  border-radius: 12px;
  color: #1a1a2e;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex: 1;
  min-height: 56px;
  position: relative;
}

.option-btn:hover {
  background: #ffffff;
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(255,255,255,0.15);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-letter {
  display: none;
}

/* Arrow indicators for selections */
.option-btn.my-pick::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 12px solid #22d3ee;
  filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.5));
}

.option-btn.opp-pick::after {
  content: '';
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 12px solid #f97316;
  filter: drop-shadow(0 0 4px rgba(249, 115, 22, 0.5));
}

.option-btn.correct {
  background: #10b981 !important;
  color: white !important;
  border-color: #059669;
  animation: correctPulse 0.5s ease;
}

.option-btn.wrong {
  background: #ef4444 !important;
  color: white !important;
  border-color: #dc2626;
  animation: wrongShake 0.4s ease;
}

.option-btn.opp-wrong {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.5);
}

.option-btn.opp-correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: rgba(16, 185, 129, 0.5);
}

/* Fade out wrong answers when both answered */
.option-btn.fade-wrong {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

/* Keep correct answer steady */
.option-btn.stay-correct {
  transition: none;
}

.option-btn.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.option-btn.selected-waiting {
  background: rgba(139, 92, 246, 0.3) !important;
  border-color: var(--accent);
  color: white !important;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Option reveal animation */
.option-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.option-reveal {
  opacity: 1;
  transform: translateY(0);
  animation: optionSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

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

/* Double points badge */
.double-badge {
  display: inline-block;
  padding: 2px 10px;
  margin-left: 8px;
  background: var(--gradient-warm);
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.5px;
  animation: doublePulse 1.5s ease-in-out infinite;
  vertical-align: middle;
}

.double-badge-sm {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 4px;
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 11px;
  font-weight: 900;
}

@keyframes doublePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(249, 115, 22, 0.3); }
  50% { box-shadow: 0 0 16px rgba(249, 115, 22, 0.6); }
}

/* Answer Feedback */
.answer-feedback {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: feedbackIn 0.3s ease;
  z-index: 20;
}

.answer-feedback.hidden {
  display: none;
}

@keyframes feedbackIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.feedback-icon {
  font-size: 24px;
}

.feedback-text {
  font-size: 16px;
  font-weight: 600;
}

.feedback-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-light);
}

/* Round Interstitial (QuizUp style between-questions screen) */
.question-results {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  background: var(--bg-primary);
}

.question-results:not(.hidden) {
  display: flex;
}

.round-interstitial {
  text-align: center;
  animation: roundFadeIn 0.5s ease;
}

.round-emoji {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(248, 113, 113, 0.4));
}

.round-topic {
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
  margin-bottom: 24px;
}

.round-number {
  font-size: 48px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.round-of {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
}

@keyframes roundFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── Results Screen ─────────────────────────────────────────────────────── */
#screen-results {
  background: var(--bg-primary);
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.results-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  padding: 40px 24px;
}

.results-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.winner-section {
  margin-bottom: 40px;
}

.crown {
  font-size: 64px;
  animation: crownBounce 1s ease;
}

@keyframes crownBounce {
  0% { transform: translateY(-30px); opacity: 0; }
  60% { transform: translateY(5px); }
  100% { transform: translateY(0); opacity: 1; }
}

.avatar-xl {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  object-fit: cover;
  margin: 16px 0;
  box-shadow: var(--shadow-glow);
}

.winner-section h2 {
  font-size: 32px;
  font-weight: 900;
  margin-top: 12px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-subtitle {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 15px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn-secondary {
  padding: 14px 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--surface);
  color: var(--text-primary);
}

/* ─── Stats Page ─────────────────────────────────────────────────────────── */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.stat-header-info {
  flex: 1;
}

.stat-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.stat-record {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-winrate {
  font-size: 20px;
  font-weight: 800;
}

.stat-winrate.positive { color: var(--success); }
.stat-winrate.negative { color: var(--error); }

.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 70px;
}

.stat-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.stat-bar-mine {
  background: linear-gradient(90deg, #10b981, #22d3ee);
}

.stat-bar-opp {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.stat-diff {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.stat-diff-item {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-diff-item.positive { color: var(--success); }
.stat-diff-item.negative { color: #f97316; }

.stat-diff-item strong {
  font-weight: 800;
}

.btn-primary {
  padding: 16px 40px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-xl);
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-glow {
  animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(248, 113, 113, 0.3); }
  50% { box-shadow: 0 0 40px rgba(248, 113, 113, 0.5); }
}

/* ─── Confetti ───────────────────────────────────────────────────────────── */
.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  max-width: 340px;
}

.toast.error {
  border-color: var(--error);
  background: var(--error-bg);
}

.toast.success {
  border-color: var(--success);
  background: var(--success-bg);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .lobby-header { padding: 12px 16px; }
  .lobby-main { padding: 20px 16px; }
  .users-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: 1fr; }
  .question-text { font-size: 20px; }
  .option-btn { padding: 16px; }
  .countdown-vs { gap: 16px; }
  .avatar-lg { width: 56px; height: 56px; }
  .final-scores { flex-direction: column; align-items: center; }
  .final-player { max-width: 100%; }
  .logo-text { font-size: 36px; }
  .results-comparison { gap: 20px; }
  
  .user-info span {
    display: none;
  }
}
