/* Trivia Rumble Elite — dark theme */
:root {
  --bg: #0d0e14;
  --bg2: #141624;
  --card: #191c2e;
  --border: #2a2e4a;
  --text: #eef0ff;
  --muted: #9aa0c0;
  --primary: #7c5cff;
  --primary-2: #4fc3f7;
  --success: #2ecc71;
  --danger: #ff4d6d;
  --warning: #ffd166;
  --radius: 14px;
}

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

html, body {
  height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, #1c1f3a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

.hidden { display: none !important; }

/* ── Top bar ── */
.topbar {
  background: rgba(13, 14, 20, 0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; white-space: nowrap; }
.logo-elite {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.me-chip { display: flex; align-items: center; gap: 8px; min-width: 0; }
.me-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.me-score { font-size: 13px; font-weight: 800; color: var(--warning); white-space: nowrap; }
.tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.8px;
  padding: 3px 7px; border-radius: 999px; white-space: nowrap;
}
.tag-discord { background: #5865F2; color: #fff; }
.tag-browser { background: #2a2e4a; color: var(--muted); }

/* ── Layout ── */
.container {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}
.column { display: flex; flex-direction: column; gap: 14px; }
.center-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 50vh; text-align: center; }
.text-center { text-align: center; }

.footer {
  text-align: center;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ── Game grid ── */
.game-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}
.main-col { min-width: 0; }

/* ── Cards & buttons ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  background: #262b47;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(90deg, var(--primary), #9a7bff);
  color: #fff;
}
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}
.spinner.big { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Avatars ── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.avatar-fallback {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 50%;
}

/* ── Question ── */
.q-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.timer-wrap { margin: 4px 0 2px; }
.timer-track { height: 8px; background: #10121f; border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border-radius: 999px;
  transition: width 0.1s linear;
}
.timer-fill.danger { background: var(--danger); }
.timer-label { text-align: right; margin-top: 4px; }
.q-time { font-family: ui-monospace, Menlo, monospace; font-size: 14px; font-weight: 700; color: var(--muted); }
.q-time.danger { color: var(--danger); animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

.q-card { border-left: 4px solid var(--primary); }
.q-text { font-size: 19px; font-weight: 700; line-height: 1.45; text-align: center; text-wrap: balance; }

.opt-grid { display: flex; flex-direction: column; gap: 10px; }
.opt-btn {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.opt-btn:not(:disabled):hover { border-color: var(--primary); background: rgba(124, 92, 255, 0.08); }
.opt-btn:disabled { cursor: default; }
.opt-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #262b47;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.opt-btn.correct { border-color: var(--success); background: rgba(46, 204, 113, 0.15); }
.opt-btn.correct .opt-letter { background: var(--success); color: #fff; }
.opt-btn.wrong { border-color: var(--danger); background: rgba(255, 77, 109, 0.15); }
.opt-btn.wrong .opt-letter { background: var(--danger); color: #fff; }
.opt-btn.dimmed { opacity: 0.45; }

.result-box {
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
}
.result-box.good { background: rgba(46, 204, 113, 0.15); border: 1px solid var(--success); color: var(--success); }
.result-box.bad { background: rgba(255, 77, 109, 0.15); border: 1px solid var(--danger); color: var(--danger); }

/* ── Leaderboard ── */
.lb-card { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
.lb-card::-webkit-scrollbar { width: 6px; }
.lb-card::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.lb-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 5px;
}
.lb-row.me {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.28), rgba(124, 92, 255, 0.08));
  border: 1px solid var(--primary);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.3), inset 0 0 8px rgba(124, 92, 255, 0.12);
}
.lb-row.first { background: linear-gradient(90deg, rgba(255, 209, 102, 0.12), rgba(255, 209, 102, 0.03)); border: 1px solid rgba(255, 209, 102, 0.4); }
.lb-row.offline { opacity: 0.45; }
.lb-rank { width: 26px; text-align: center; flex-shrink: 0; display: flex; justify-content: center; }
.rank-badge {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px; color: #fff;
  flex-shrink: 0;
}
.rank-badge.gold {
  background: linear-gradient(135deg, #ffe08a 0%, #ffb347 55%, #e8921e 100%);
  box-shadow: 0 0 10px rgba(255, 179, 71, 0.55);
  color: #6b3a00;
}
.rank-badge.gold .crown { color: #7a4500; }
.rank-badge.silver { background: linear-gradient(135deg, #f0f0f6 0%, #c9c9d6 60%, #9a9aac 100%); color: #3a3a48; box-shadow: 0 0 8px rgba(201, 201, 214, 0.4); }
.rank-badge.bronze { background: linear-gradient(135deg, #f2b98d 0%, #d9894a 60%, #b06a2c 100%); color: #4a2608; box-shadow: 0 0 8px rgba(217, 137, 74, 0.4); }
.rank-badge.n { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); color: var(--muted); font-size: 10px; }
.rank-num { font-weight: 800; color: var(--muted); font-size: 12px; }
.lb-name { flex: 1; font-weight: 600; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.you-tag {
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.5px;
  padding: 1px 5px; border-radius: 6px;
  background: var(--primary); color: #fff; flex-shrink: 0;
}
.lb-score { font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.lb-score .star { color: var(--warning); }
.star { display: inline-block; vertical-align: -2px; }
.me-score { display: inline-flex; align-items: center; gap: 3px; }
.plat-badge {
  width: 15px; height: 15px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.plat-badge svg { width: 10px; height: 10px; display: block; }
.plat-badge.discord { background: #5865f2; color: #fff; }
.plat-badge.browser { background: rgba(255, 255, 255, 0.1); color: var(--muted); }
.lb-meta { font-size: 10px; font-weight: 700; color: var(--muted); margin-left: 6px; }
.lb-live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; color: var(--success);
  background: rgba(46, 204, 113, 0.12); border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 2px 8px; border-radius: 999px; vertical-align: 2px;
}
.lb-live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  animation: lb-pulse 1.8s ease-in-out infinite;
}
@keyframes lb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.lb-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); opacity: 0.6;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  padding: 5px 2px;
}
.lb-divider span { flex: 1; border-top: 2px dashed rgba(154, 160, 192, 0.35); }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #3a3f5c;
  flex-shrink: 0;
}
.dot.online { background: var(--success); box-shadow: 0 0 6px rgba(46, 204, 113, 0.6); }
.my-rank-line { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 4px; }
.my-rank-line b { color: var(--warning); }
.my-rank-line .star { color: var(--warning); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* ── Legal pages (privacy / terms) ── */
.card h2 { font-size: 22px; margin-bottom: 4px; }
.card h3 { font-size: 15px; margin: 18px 0 8px; color: var(--primary-2); }
.card p { margin: 8px 0; line-height: 1.6; font-size: 14.5px; }
.card ul { margin: 8px 0 8px 20px; line-height: 1.65; font-size: 14.5px; }
.card li { margin-bottom: 5px; }
.card a { color: var(--primary-2); text-decoration: none; }
.card a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .game-grid { grid-template-columns: 1fr; }
  .lb-card { position: static; max-height: 320px; order: 2; }
  .main-col { order: 1; }
  .q-text { font-size: 17px; }
}
