:root {
  --bg: #0b0e1a;
  --bg-glow: radial-gradient(ellipse 1200px 600px at 50% -20%, rgba(66,133,244,0.18), transparent 60%),
             radial-gradient(ellipse 800px 500px at 90% 10%, rgba(255,213,74,0.10), transparent 70%);
  --panel: #161a26;
  --panel-2: #1f2433;
  --text: #e6e8eb;
  --muted: #8a93a4;
  --border: #2a2f3f;
  --accent: #4285f4;
  --accent-2: #7c4dff;
  --good: #34a853;
  --bad: #ea4335;
  --warn: #fbbc04;
  --gold: #ffd54a;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0,0,0,0.35);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; color: var(--text);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.55;
  min-height: 100vh;
}
header {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 2rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: rgba(11,14,26,0.8); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
header h1 {
  margin: 0; font-size: 1.25rem; font-weight: 700; flex: 1;
  display: flex; align-items: center; gap: 0.5rem;
}
header h1 .logo {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(255,213,74,0.6));
}
header h1 .brand { letter-spacing: 0.01em; }
header h1 .brand-mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; font-weight: 800;
}
header nav { display: flex; gap: 0.5rem; align-items: center; }
.tag {
  font-size: 0.62rem; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; padding: 0.15rem 0.5rem; border-radius: 999px;
  vertical-align: middle; margin-left: 0.4rem;
  text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600;
}
.badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: var(--border); color: var(--muted); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.72rem; color: var(--accent); font-weight: 700;
  margin: 0 0 0.4rem;
}

main { max-width: 860px; margin: 1.5rem auto; padding: 0 1rem 4rem; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem 1.75rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
h2 { margin-top: 0; font-weight: 700; }
h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; }

label { display: block; margin-bottom: 1rem; font-size: 0.9rem; color: var(--muted); }
label > input, label > select {
  display: block; width: 100%; margin-top: 0.25rem; padding: 0.55rem 0.7rem;
  background: #0e1320; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem;
}
label > input:focus, label > select:focus, input[type="text"]:focus, input[type="number"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(66,133,244,0.25);
}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }

button, .navbtn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.55rem 1rem; font-size: 0.92rem;
  cursor: pointer; transition: transform 0.05s, background 0.15s, border-color 0.15s;
  font-weight: 500;
}
button:hover:not(:disabled) { background: #262c3d; border-color: #3a4256; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
}
.navbtn { background: transparent; }

/* Primary CTA */
.cta-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; border: 0; font-weight: 700; font-size: 1rem;
  padding: 0.75rem 1.4rem; border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(66,133,244,0.35);
}
.cta-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a99ff, #9466ff);
  border: 0;
}
#quick-start-btn {
  font-size: 1.4rem; padding: 1.1rem 2.4rem;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 30px rgba(124,77,255,0.45);
  animation: pulse-glow 2.4s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 6px 30px rgba(124,77,255,0.35); }
  50%     { box-shadow: 0 8px 38px rgba(124,77,255,0.65); }
}

/* Hero */
.hero {
  background:
    radial-gradient(ellipse at top right, rgba(124,77,255,0.18), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(66,133,244,0.18), transparent 60%),
    var(--panel);
  border: 1px solid var(--border);
  text-align: center;
  padding: 2.5rem 2rem;
}
.hero h2 { font-size: 2rem; margin: 0.2rem 0; }
.hero-sub { color: var(--muted); font-size: 1.05rem; margin: 0.4rem auto 1.5rem; max-width: 480px; }
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.hero-switch {
  display: flex; gap: 0.5rem; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.hero-name { max-width: 320px; margin: 0 auto; }
.hero-name input {
  width: 100%; padding: 0.6rem 0.9rem; text-align: center;
  background: #0e1320; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem;
}

/* Segmented control */
.seg {
  display: inline-flex; border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; background: var(--panel-2);
}
.seg button {
  background: transparent; border: 0; color: var(--muted);
  padding: 0.4rem 1rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600;
}
.seg button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

/* Advanced */
.adv summary {
  cursor: pointer; font-weight: 600; color: var(--text); user-select: none;
  list-style: none;
}
.adv summary::-webkit-details-marker { display: none; }
.adv[open] summary { margin-bottom: 1rem; }
.adv form { margin-top: 0.5rem; }

fieldset {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin-bottom: 1rem;
}
legend { color: var(--muted); padding: 0 0.4rem; font-size: 0.85rem; }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.35rem 1rem; }
.checks label { color: var(--text); font-size: 0.9rem; margin-bottom: 0; display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.2rem 0; cursor: pointer; }
.checks label input { margin-top: 0.2rem; flex-shrink: 0; }

/* Section tile grid */
.sec-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.sec-tile {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.85rem;
  font-size: 0.85rem; color: var(--muted); text-align: left; width: 100%;
  cursor: pointer; transition: border-color 0.12s, background 0.12s, color 0.12s;
  line-height: 1.35; font-weight: 500;
}
.sec-tile:hover { border-color: var(--accent); color: var(--text); background: var(--panel-2); }
.sec-tile[data-selected="true"] {
  background: rgba(66,133,244,0.14); border-color: var(--accent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}
@media (max-width: 600px) { .sec-grid { grid-template-columns: repeat(2, 1fr); } }
.checks label:hover { color: var(--accent); }

.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.8rem; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); font-size: 0.9rem; margin-bottom: 0; cursor: pointer;
  transition: border-color 0.15s;
}
.chip:hover { border-color: var(--accent); }
.chip:has(input:checked) { border-color: var(--accent); background: rgba(66,133,244,0.12); }
.chip input { margin: 0; }
.chip .ct {
  font-family: ui-monospace, monospace; font-size: 0.7rem;
  background: var(--border); padding: 0.05rem 0.45rem; border-radius: 999px;
  color: var(--muted);
}

.confidence { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.confidence label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; color: var(--text); font-size: 0.9rem; }

/* Quiz HUD */
.quiz-hud {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem;
}
.hud-left, .hud-right { display: flex; gap: 0.5rem; align-items: center; }
.hud-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.82rem; color: var(--text); font-weight: 600;
}
.hud-pill.score { border-color: var(--gold); color: var(--gold); }
.streak {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.7rem; border-radius: 999px;
  background: linear-gradient(135deg, rgba(234,67,53,0.25), rgba(251,188,4,0.25));
  border: 1px solid rgba(234,67,53,0.5); color: #ffce5b;
  font-size: 0.82rem; font-weight: 700;
  animation: streak-pop 0.4s ease;
}
@keyframes streak-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.bar { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.35s ease; }

.section-tag {
  display: inline-block; padding: 0.2rem 0.7rem;
  background: rgba(66,133,244,0.12); color: var(--accent);
  font-size: 0.78rem; font-weight: 600;
  border-radius: 999px; margin: 0 0.4rem 0.6rem 0;
  border: 1px solid rgba(66,133,244,0.25);
}
.diff-badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 700;
}
.diff-badge.easy   { background: rgba(52,168,83,0.18); color: var(--good); }
.diff-badge.medium { background: rgba(251,188,4,0.18); color: var(--warn); }
.diff-badge.hard   { background: rgba(234,67,53,0.18); color: var(--bad); }

.options { list-style: none; padding: 0; margin: 1rem 0; counter-reset: opt; }
.options li {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem 0.75rem 2.6rem; margin-bottom: 0.55rem; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
  position: relative;
  background: var(--panel-2);
}
.options li::before {
  counter-increment: opt;
  content: counter(opt, upper-alpha);
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--border); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}
.options li:hover { border-color: var(--accent); }
.options li.selected { border-color: var(--accent); background: rgba(66,133,244,0.10); }
.options li.selected::before { background: var(--accent); color: white; }
.options li.correct { border-color: var(--good); background: rgba(52,168,83,0.14); }
.options li.correct::before { background: var(--good); color: white; }
.options li.incorrect { border-color: var(--bad); background: rgba(234,67,53,0.14); }
.options li.incorrect::before { background: var(--bad); color: white; }
.options li.disabled { cursor: default; }

#explanation { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.verdict { font-size: 1.1rem; margin: 0 0 0.6rem; }
.verdict.correct { color: var(--good); }
.verdict.incorrect { color: var(--bad); }

.doc-links { margin: 0.5rem 0 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.doc-heading { margin: 0.5rem 0 0.2rem; }
.doc-links a {
  color: var(--accent); text-decoration: none; font-size: 0.88rem;
  padding: 0.2rem 0; transition: color 0.1s;
}
.doc-links a:hover { color: #7eaaff; text-decoration: underline; }
.doc-links a::before { content: "📄  "; }

.hidden { display: none !important; }

table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.sec-track {
  width: 100%; min-width: 80px; height: 8px;
  background: var(--border); border-radius: 999px; overflow: hidden;
}
.sec-bar { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.sec-bar.good { background: var(--good); }
.sec-bar.warn { background: var(--warn); }
.sec-bar.bad  { background: var(--bad); }

/* report-card header */
.results-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.grade-block { text-align: center; }
.grade {
  width: 80px; height: 80px; line-height: 80px; text-align: center;
  border-radius: 50%; font-size: 2.4rem; font-weight: 800;
  background: var(--panel-2); border: 3px solid var(--border);
  font-family: Georgia, serif;
}
.grade.A { color: var(--good); border-color: var(--good); box-shadow: 0 0 24px rgba(52,168,83,0.4); }
.grade.B { color: var(--good); border-color: var(--good); }
.grade.C { color: var(--warn); border-color: var(--warn); }
.grade.D { color: var(--bad);  border-color: var(--bad); }
.grade.F { color: var(--bad);  border-color: var(--bad); }
.pass-pill {
  margin-top: 0.5rem; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.07em; font-weight: 700;
}
.pass-pill.pass { color: var(--good); }
.pass-pill.fail { color: var(--bad); }

.score-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
  margin: 1rem 0;
}
.score-stat {
  background: var(--panel-2); padding: 0.7rem; border-radius: var(--radius);
  text-align: center; border: 1px solid var(--border);
}
.score-stat .lbl { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.score-stat .val { font-size: 1.25rem; font-weight: 700; margin-top: 0.25rem; }

.rec-card {
  background: var(--panel-2); border-left: 4px solid var(--warn);
  padding: 0.85rem 1rem; margin-bottom: 0.6rem; border-radius: 6px;
  border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.rec-card.weak { border-left-color: var(--bad); }
.rec-card .head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; margin-bottom: 0.25rem; }
.rec-card .head strong { font-size: 1rem; }
.rec-card .head .pct { font-family: ui-monospace, monospace; color: var(--muted); font-size: 0.85rem; }
.rec-card p { margin: 0.3rem 0; font-size: 0.9rem; }

.next-suggestion {
  margin-top: 1.2rem; padding: 1.1rem 1.2rem;
  background: linear-gradient(135deg, rgba(66,133,244,0.12), rgba(124,77,255,0.12));
  border: 1px solid rgba(66,133,244,0.3);
  border-radius: var(--radius); display: flex; flex-direction: column; gap: 0.6rem;
}
.next-suggestion p { margin: 0 0 0.25rem; font-size: 1rem; }
.next-suggestion button { align-self: flex-start; }
.next-suggestion .ghost { align-self: flex-start; }

#score-submit-block { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
#score-submit-block input { padding: 0.55rem 0.7rem; background: #0e1320; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 0.95rem; min-width: 200px; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.tab {
  background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent;
  padding: 0.5rem 1.1rem; border-radius: 0; cursor: pointer; font-weight: 600;
}
.tab:hover { color: var(--text); background: transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

#lb-table tbody tr { transition: background 0.1s; }
#lb-table tbody tr:hover { background: var(--panel-2); }
#lb-table tbody tr:nth-child(1) td:first-child::before { content: "🥇 "; }
#lb-table tbody tr:nth-child(2) td:first-child::before { content: "🥈 "; }
#lb-table tbody tr:nth-child(3) td:first-child::before { content: "🥉 "; }
#lb-table tbody tr:nth-child(1) { background: rgba(255,213,74,0.06); }

/* Confetti */
#confetti-stage {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
#results-screen { position: relative; }
.confetti {
  position: absolute; top: -10px; width: 8px; height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
  transform-origin: center;
}
@keyframes fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}

@media (max-width: 600px) {
  header { padding: 0.75rem 1rem; }
  .card { padding: 1.1rem 1rem; }
  .hero h2 { font-size: 1.5rem; }
  #quick-start-btn { font-size: 1.15rem; padding: 0.9rem 1.6rem; }
  .score-row { grid-template-columns: repeat(2, 1fr); }
}

/* GitHub nav link */
.github-nav {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.github-nav:hover { color: var(--text); border-color: #3a4256; background: var(--panel-2); }
.gh-icon { width: 16px; height: 16px; flex-shrink: 0; display: block; vertical-align: middle; }

/* GitHub hero — post-exam CTA */
.github-hero {
  margin-top: 1.5rem; padding: 1.1rem 1.25rem;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); border-left: 4px solid var(--accent-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.25rem; flex-wrap: wrap;
}
.github-hero-text { flex: 1; min-width: 200px; }
.github-hero-text strong { font-size: 1rem; display: block; margin-bottom: 0.2rem; }
.github-hero-text p { margin: 0; }
.cta-github {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--accent-2); border-radius: var(--radius);
  padding: 0.65rem 1.25rem; font-size: 0.95rem; font-weight: 600;
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.cta-github svg { width: 18px; height: 18px; fill: currentColor; }
.cta-github:hover {
  background: rgba(124,77,255,0.12); border-color: #9966ff;
  box-shadow: 0 0 14px rgba(124,77,255,0.25);
}

/* ============================================================
   Mode picker
   ============================================================ */
.mode-tabs {
  display: inline-flex; gap: 0.25rem; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px;
  margin: 0.4rem 0 1.2rem;
}
.mode-tabs button {
  background: transparent; border: 0; color: var(--muted);
  padding: 0.55rem 1rem; border-radius: 999px;
  font-weight: 600; font-size: 0.88rem; line-height: 1.1;
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.1rem;
}
.mode-tabs button .mode-sub {
  font-size: 0.65rem; font-weight: 500; opacity: 0.75;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.mode-tabs button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}
.mode-tabs button:hover:not(.active) { color: var(--text); }

/* ============================================================
   Strikes (progressive)
   ============================================================ */
.hud-pill.strikes { color: var(--bad); border-color: rgba(234,67,53,0.45); letter-spacing: 0.1em; }
.strike-slot {
  display: inline-block; transition: transform 0.2s, opacity 0.2s, color 0.2s;
  margin: 0 0.05rem;
}
.strike-slot.struck { color: var(--border); transform: scale(0.85); opacity: 0.5; }

/* ============================================================
   Timer bar (arcade)
   ============================================================ */
.timer-bar {
  position: relative;
  height: 18px; background: var(--border); border-radius: 999px;
  overflow: hidden; margin-bottom: 1rem;
  border: 1px solid var(--border);
}
#timer-fill {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--good), var(--accent));
  width: 100%; transition: width 0.1s linear, background 0.2s;
}
.timer-bar.warn #timer-fill { background: linear-gradient(90deg, var(--warn), var(--gold)); }
.timer-bar.danger #timer-fill {
  background: linear-gradient(90deg, var(--bad), var(--warn));
  animation: timer-pulse 0.6s ease-in-out infinite;
}
@keyframes timer-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.55; }
}
#timer-text {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 0.78rem; color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* In-quiz quit button */
.small-btn { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

/* ============================================================
   Point toast
   ============================================================ */
.toast-stage {
  position: relative; height: 0; pointer-events: none;
}
.point-toast {
  position: absolute; right: 0; top: -1.6rem;
  padding: 0.3rem 0.75rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--warn));
  color: #2b1a00; font-weight: 700; font-size: 0.95rem;
  white-space: nowrap;
  animation: toast-rise 1.1s ease-out forwards;
  box-shadow: 0 4px 16px rgba(255,213,74,0.5);
}
@keyframes toast-rise {
  0%   { transform: translateY(0);    opacity: 0; }
  15%  { transform: translateY(-8px); opacity: 1; }
  100% { transform: translateY(-60px); opacity: 0; }
}

/* ============================================================
   Level-up modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,14,26,0.78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
  max-width: 420px; width: 100%; text-align: center;
  box-shadow: 0 12px 60px rgba(124,77,255,0.35);
  animation: modal-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes modal-pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-card h2 {
  margin: 0 0 0.5rem; font-size: 1.8rem;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal-actions {
  display: flex; gap: 0.6rem; justify-content: center; margin-top: 1.2rem;
}

/* ============================================================
   Alt results
   ============================================================ */
.grade.big-num {
  font-family: ui-monospace, monospace;
  font-size: 1.6rem; line-height: 80px;
  color: var(--gold); border-color: var(--gold);
  box-shadow: 0 0 24px rgba(255,213,74,0.35);
}
.percentile-block {
  margin: 1rem 0; padding: 1rem 1.2rem;
  background: linear-gradient(135deg, rgba(124,77,255,0.12), rgba(66,133,244,0.12));
  border: 1px solid rgba(124,77,255,0.3);
  border-radius: var(--radius);
}
.percentile-block p { margin: 0.2rem 0; }

#alt-score-submit-block {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
#alt-score-submit-block input {
  padding: 0.55rem 0.7rem; background: #0e1320; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 0.95rem; min-width: 200px;
}

/* ============================================================
   Leaderboard mode tabs
   ============================================================ */
.mode-leaderboard-tabs { margin-bottom: 0.5rem; }

.all-exams-note {
  display: inline-block; margin: 0.4rem 0 1rem;
  padding: 0.4rem 0.85rem; border-radius: 999px;
  background: rgba(124,77,255,0.12); color: var(--text);
  border: 1px solid rgba(124,77,255,0.35);
}

/* ============================================================
   Arcade clock — big prominent timer above the question
   ============================================================ */
.arcade-clock {
  margin: 0.4rem 0 1.2rem;
  text-align: center;
}
.arcade-clock-face {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 1rem 3rem 0.7rem;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-2), #0e1320);
  border: 3px solid var(--border);
  box-shadow: 0 0 32px rgba(66,133,244,0.3), inset 0 0 16px rgba(0,0,0,0.45);
  margin-bottom: 0.7rem;
  min-width: 320px;
}
.arcade-clock-face #timer-text {
  position: static; transform: none;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 5.5rem; font-weight: 900; line-height: 1;
  letter-spacing: 0.05em;
  color: var(--good);
  text-shadow: 0 0 22px rgba(52,168,83,0.6);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s, text-shadow 0.2s;
}
.arcade-clock-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--muted); margin-top: 0.4rem;
}
/* The thin progress bar lives inside the clock block now */
.arcade-clock .timer-bar {
  height: 14px; max-width: 440px; margin: 0 auto 0.6rem;
  display: block;
}
.arcade-clock .timer-bar #timer-text { display: none; }
.arcade-rules { margin: 0.3rem 0 0; }
.arcade-rules strong { color: var(--text); }

/* Color the big readout warm/red when low */
.arcade-clock.warn .arcade-clock-face #timer-text {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255,213,74,0.6);
}
.arcade-clock.danger .arcade-clock-face #timer-text {
  color: var(--bad);
  text-shadow: 0 0 18px rgba(234,67,53,0.7);
  animation: clock-flash 0.6s ease-in-out infinite;
}
@keyframes clock-flash {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.6; transform: scale(1.04); }
}

/* Negative point-toast (wrong-answer penalty) */
.point-toast.point-toast-bad {
  background: linear-gradient(135deg, var(--bad), #ff6b5b);
  color: white;
  box-shadow: 0 4px 16px rgba(234,67,53,0.55);
}
