/* Base styles */
:root {
  --bg: #0c0f14;
  --card: #141a22;
  --text: #e6edf3;
  --muted: #9fb0c4;
  --accent: #00d8ff;
  --accent-2: #24ff8a;
  --danger: #ff5c5c;
}
* { box-sizing: border-box; }
html, body { height: 100%; width: 100%; }
body {
  margin: 0; padding: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  /* Extend gradient to farthest-corner so falloff stays off-screen */
  background: radial-gradient(farthest-corner at 20% 10%, #16202d 0%, var(--bg) 80%), var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
}

#view-landing { text-align: center; margin: auto 0;}
/* Center CTA buttons on landing */
#view-landing .cta-row { justify-content: center; margin-top: 2rem;}

.site-header, .site-footer { text-align: center; padding: 1rem 0; }
.site-header h1 { margin: 0; font-size: 2rem; margin-top: 1rem;}
.site-footer small { color: var(--muted); }
.site-footer a { color: var(--text); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #0e1520;
  border: 1px solid #233040;
  color: var(--muted);
  font-size: 0.75rem;
}
.event-badge { border-color: #2a3646; }

main { max-width: 960px; margin: 0 auto; padding: 1rem; }
.view { display: none; }
.view.active { display: block; }

.lead { color: var(--muted); font-size: 1.1rem; }

.btn {
  border: 0; padding: 0.75rem 1.25rem; border-radius: 8px; cursor: pointer; font-weight: 600; color: #09121b;
  background: var(--accent); transition: transform .08s ease, box-shadow .12s ease; will-change: transform;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,216,255,.2); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid #2a3646; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }

.card { background: linear-gradient(180deg, #111822, var(--card)); border: 1px solid #2a3646; border-radius: 12px; padding: 1rem; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.card h3 { margin-top: 0; }

.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.hud-item { background: #0f1620; border: 1px solid #233040; border-radius: 8px; padding: 0.5rem 0.75rem; }
.hud-item .label { color: var(--muted); font-size: 0.8rem; }
.hud-item .value { font-weight: 700; }

.timer-bar { height: 6px; background: #0a1018; border-radius: 999px; overflow: hidden; margin-top: 0.5rem; }
#timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--danger), var(--accent)); transform-origin: left; }

.question { font-size: 1.25rem; margin-bottom: 1rem; }
.choices { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.choice-btn {
  width: 100%; text-align: left; background: #122030; color: var(--text); border: 1px solid #223244; border-radius: 8px; padding: 0.75rem; font-weight: 600; cursor: pointer;
}
.choice-btn:hover { border-color: #2f4a65; }
.choice-btn.correct { border-color: var(--accent-2); }
.choice-btn.incorrect { border-color: var(--danger); }

.feedback { min-height: 1.25rem; color: var(--muted); margin-top: 0.25rem; }

.final-score { font-size: 2.5rem; font-weight: 800; margin: 0.5rem 0 1rem; }
.save-row { display: flex; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.save-row input { flex: 1; background: #0e1520; border: 1px solid #233040; color: var(--text); padding: 0.75rem; border-radius: 8px; }
.save-status { color: var(--muted); min-height: 1.25rem; }

.leaderboard { width: 100%; border-collapse: collapse; }
.leaderboard th, .leaderboard td { text-align: left; padding: 0.5rem; border-bottom: 1px solid #233040; }
.leaderboard th { color: var(--muted); font-weight: 600; }

/* Accessibility */
.visually-hidden { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.choice-btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

#view-leaderboard { margin-bottom: 2rem; }

/* Responsive */
@media (max-width: 640px) {
  .hud { grid-template-columns: 1fr; }
}
