@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #120f24;
  --bg-2: #1c1836;
  --panel: #241f45;
  --panel-2: #2e2856;
  --line: #3b3470;
  --text: #f4f1ff;
  --muted: #a9a2d6;
  --accent: #ffd23f;
  --accent-ink: #1a1400;
  --good: #3ddc84;
  --bad: #ff5470;
  --opt-0: #ff4d6d;
  --opt-1: #3a86ff;
  --opt-2: #ffb703;
  --opt-3: #2ec4b6;
  --opt-4: #a77bff;
  --opt-5: #ff8c42;
  --radius: 16px;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 80% -10%, #3a2a7a55, transparent 60%),
              radial-gradient(900px 700px at -10% 110%, #ff4d6d22, transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px;
  padding: 12px 20px; font-weight: 700; background: var(--panel-2); color: var(--text);
  transition: transform .08s ease, filter .15s ease, background .15s ease;
  box-shadow: 0 3px 0 #0006;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0006; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good); color: #032713; }
.btn.bad { background: var(--bad); color: #2a0009; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 9px; }

.input {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--bg-2); color: var(--text); outline: none; font-size: 18px;
}
.input:focus { border-color: var(--accent); }

.panel { background: var(--panel); border-radius: var(--radius); padding: 20px; box-shadow: 0 10px 30px #0004; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

.code-chip {
  font-family: var(--font-display); font-weight: 800; letter-spacing: .18em;
  background: var(--accent); color: var(--accent-ink); padding: 4px 14px; border-radius: 10px;
}

/* answer option colours */
.opt-0 { --opt: var(--opt-0); } .opt-1 { --opt: var(--opt-1); } .opt-2 { --opt: var(--opt-2); }
.opt-3 { --opt: var(--opt-3); } .opt-4 { --opt: var(--opt-4); } .opt-5 { --opt: var(--opt-5); }

.letter {
  display: inline-grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 10px;
  background: #0003; font-family: var(--font-display); font-weight: 800; flex: none;
}

/* timer bar */
.timerbar { height: 10px; background: #0005; border-radius: 99px; overflow: hidden; }
.timerbar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .2s linear; }
.timerbar.low > i { background: var(--bad); }

/* leaderboard */
.lb { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: grid; grid-template-columns: 48px 1fr auto 28px; align-items: center; gap: 12px;
  background: var(--panel-2); border-radius: 12px; padding: 10px 16px;
  animation: slideIn .4s ease both;
}
.lb-row .rank { font-family: var(--font-display); font-weight: 800; font-size: 1.3em; color: var(--muted); }
.lb-row.r1 { background: linear-gradient(90deg, #ffd23f33, var(--panel-2)); }
.lb-row.r1 .rank { color: #ffd23f; }
.lb-row.r2 .rank { color: #d9dcef; }
.lb-row.r3 .rank { color: #e8a26b; }
.lb-row .score { font-family: var(--font-display); font-weight: 800; }
.lb-row .arrow.up { color: var(--good); } .lb-row .arrow.down { color: var(--bad); }
.lb-row.me { outline: 2px solid var(--accent); }

@keyframes slideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.podium .step {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; width: 30%; max-width: 220px;
}
.podium .block {
  width: 100%; border-radius: 14px 14px 4px 4px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 2.4em; color: #0008;
  animation: rise 1s cubic-bezier(.2,.9,.3,1.2) both;
  transform-origin: bottom;
}
.podium .p1 .block { height: 220px; background: linear-gradient(#ffe27a, #ffb703); animation-delay: 1.6s; }
.podium .p2 .block { height: 160px; background: linear-gradient(#eef0ff, #a9b0d6); animation-delay: .9s; }
.podium .p3 .block { height: 115px; background: linear-gradient(#f4b98a, #c97a45); animation-delay: .3s; }
.podium .who { text-align: center; animation: pop .6s ease both; }
.podium .p1 .who { animation-delay: 2.3s; } .podium .p2 .who { animation-delay: 1.6s; } .podium .p3 .who { animation-delay: 1s; }
.podium .who b { display: block; font-family: var(--font-display); font-size: 1.4em; }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1000; }

.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; text-align: center; padding: 6px; background: var(--bad); color: #fff;
  font-weight: 600; z-index: 999; font-size: 14px;
}
