/* ---------- Sanatan Quiz Live theme ---------- */

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

:root {
  --indigo: #1b1440;
  --indigo-2: #2a1e5e;
  --gold: #f5c542;
  --gold-dark: #d9a52e;
  --peacock: #2ec4b6;
  --text: #f5f0e8;
  --muted: #c9bfe8;
  --card: rgba(255, 255, 255, 0.06);
  --correct: #35c46a;
  --wrong: #ef5350;
}

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(46, 196, 182, 0.16), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(245, 197, 66, 0.14), transparent 60%),
    radial-gradient(1000px 700px at 50% 50%, rgba(90, 60, 160, 0.25), transparent 70%),
    linear-gradient(160deg, var(--indigo) 0%, var(--indigo-2) 55%, #160f33 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* peacock-feather inspired dots speckle (subtle) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  z-index: 0;
}

#app > * { position: relative; z-index: 1; }

.screen { display: none; padding: 24px 16px 48px; max-width: 960px; margin: 0 auto; }
.screen.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 24px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.card.narrow { max-width: 420px; margin: 8vh auto 0; }
.card.center { text-align: center; }

/* ---------- Hero (home) ---------- */

.hero { text-align: center; padding: 6vh 0 4vh; }
.om {
  font-size: 44px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(245, 197, 66, 0.5);
  animation: breathe 4s ease-in-out infinite;
}
.om.small { font-size: 32px; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.hero h1 { font-size: 2.3rem; letter-spacing: 1px; margin: 8px 0 4px; }
.gold { color: var(--gold); }
.tagline { color: var(--muted); margin: 4px 0 4px; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 14px; }

/* ---------- Buttons & inputs ---------- */

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.mode-card {
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px; padding: 28px 16px; color: var(--text);
  font-size: 1.05rem; cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.mode-card .icon { font-size: 2.2rem; }
.mode-card small { color: var(--muted); }
.mode-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.mode-card.host:hover { border-color: var(--gold); }
.mode-card.student:hover { border-color: var(--peacock); }

.btn {
  border: none; border-radius: 12px; padding: 12px 22px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  background: rgba(255, 255, 255, 0.1); color: var(--text);
  transition: filter 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(120deg, var(--gold), var(--gold-dark)); color: #2a1e0e; }
.btn.full { width: 100%; margin-top: 14px; }
.btn:hover { filter: brightness(1.1); }

.link-btn {
  display: block; margin: 10px auto 0; background: none; border: none;
  color: var(--peacock); font-size: 0.95rem; cursor: pointer; text-decoration: underline;
}

input[type="text"] {
  width: 100%; padding: 14px; font-size: 1.05rem; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.25);
  color: var(--text); margin-top: 14px; outline: none;
}
input[type="text"]:focus { border-color: var(--gold); }

/* ---------- Top bars ---------- */

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.topbar h2 { font-size: 1.25rem; }
.back { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.back:hover { color: var(--gold); }

/* ---------- Category grid ---------- */

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.category-card {
  padding: 22px 14px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--card); color: var(--text); font-size: 1.05rem; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.category-card small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.category-card:hover { transform: translateY(-3px); border-color: var(--peacock); }

/* ---------- Live quiz layout ---------- */

.live-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }

.status-chip {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; margin-bottom: 12px;
  background: rgba(245, 197, 66, 0.18); color: var(--gold);
}
.status-chip.reveal { background: rgba(53, 196, 106, 0.18); color: var(--correct); }

.question-text { font-size: 1.35rem; line-height: 1.5; margin-bottom: 20px; }

/* English secondary line under Nepali text/options (bilingual display) */
.q-en { font-size: 0.95em; color: var(--muted, #b7b7c4); margin-top: 4px; line-height: 1.4; }
.opt-main { display: block; }
.opt-en { display: block; font-size: 0.78em; color: var(--muted, #b7b7c4); margin-top: 2px; line-height: 1.35; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .options { grid-template-columns: 1fr; } }

.option {
  text-align: left; padding: 14px 16px; border-radius: 12px; font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.16); cursor: pointer;
  background: rgba(0, 0, 0, 0.2); color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.option:hover:not(:disabled) { border-color: var(--peacock); }
.option:disabled { cursor: default; }
.option .letter { font-weight: 700; color: var(--gold); margin-right: 8px; }

.option.correct { border-color: var(--correct); background: rgba(53, 196, 106, 0.22); }
.option.wrong { border-color: var(--wrong); background: rgba(239, 83, 80, 0.18); }
.option.chosen { outline: 3px solid rgba(245, 197, 66, 0.6); }

/* ---------- Timer ---------- */

.timer-row { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.timer-ring {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--peacock) 100%, rgba(255, 255, 255, 0.12) 0);
  transition: background 0.3s linear;
}
.timer-ring > span {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--indigo-2); font-size: 1.3rem; font-weight: 700;
}
.timer-ring.low { background: conic-gradient(var(--wrong) 100%, rgba(255, 255, 255, 0.12) 0); }

.feedback { color: var(--muted); font-size: 0.95rem; margin-top: 14px; min-height: 20px; }
.feedback.good { color: var(--correct); font-weight: 600; }
.feedback.bad { color: var(--wrong); font-weight: 600; }

.hidden { display: none !important; }

/* ---------- Leaderboard ---------- */

.leaderboard h3 { margin-bottom: 12px; }
.leaderboard ul { list-style: none; }
.leaderboard li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 10px; margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.18); font-size: 0.95rem;
}
.leaderboard li .rank { color: var(--gold); font-weight: 700; margin-right: 8px; }
.leaderboard li.me { outline: 1px solid var(--gold); }
.leaderboard li.tied { box-shadow: inset 0 0 0 1px rgba(245, 197, 66, 0.35); }
.leaderboard li .lstat { display: flex; align-items: center; gap: 8px; }
.leaderboard li .ltime { opacity: 0.65; font-size: 0.8rem; }

/* ---------- Student result ---------- */

.result-badge { font-size: 3rem; text-align: center; }
.score-big { text-align: center; font-size: 3rem; font-weight: 800; color: var(--gold); margin: 6px 0; }

/* ---------- Results table ---------- */

.results-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.results-table th, .results-table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.results-table th { color: var(--gold); }

/* ---------- Toast ---------- */

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85); color: var(--text); padding: 12px 20px;
  border-radius: 12px; font-size: 0.95rem; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 10; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Delete-result confirm modal ---------- */

.modal-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6); z-index: 30; padding: 20px;
}
.modal-box { max-width: 380px; width: 100%; text-align: center; }

/* ---------- Sound controls ---------- */

#sound-controls {
  position: fixed; right: 16px; bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 10px; border-radius: 999px;
  z-index: 20; backdrop-filter: blur(4px);
}
#mute-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; }
#volume-slider { width: 90px; accent-color: var(--gold); cursor: pointer; }

/* ---------- Host setup ---------- */

.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 26px; }
@media (max-width: 760px) { .setup-grid { grid-template-columns: 1fr; } }

.field-row { margin-bottom: 14px; }
.field-row label {
  display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px;
}
.field-row label small { display: block; }
.field-row input[type="text"], .field-row input[type="password"] {
  width: 100%; padding: 11px 14px; font-size: 1rem; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.25);
  color: var(--text); outline: none;
}
.field-row input:focus { border-color: var(--gold); }
.field-row input[type="range"] { width: 100%; accent-color: var(--gold); }

.subtitle { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.music-select {
  width: 100%; padding: 11px 14px; font-size: 0.95rem; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.35);
  color: var(--text); outline: none; cursor: pointer;
}
.music-select:focus { border-color: var(--gold); }
.music-btn-row { margin-top: 12px; gap: 8px; flex-wrap: wrap; }

.pin-row { display: flex; gap: 8px; }
.pin-row input { flex: 1; text-align: center; font-size: 1.3rem; letter-spacing: 4px; font-weight: 700; }

.btn.small { padding: 10px 14px; font-size: 0.85rem; }
.btn.danger { background: rgba(239, 83, 80, 0.2); color: #ff8a80; border: 1px solid rgba(239, 83, 80, 0.4); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
}
.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.18); transition: background 0.2s;
}
.switch span::before {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: transform 0.2s;
}
.switch input:checked + span { background: var(--peacock); }
.switch input:checked + span::before { transform: translateX(20px); }

.sfx-list { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.sfx-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.9rem; padding: 7px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sfx-row .sfx-left { display: flex; align-items: center; gap: 8px; }
.sfx-row input[type="checkbox"] { accent-color: var(--gold); width: 17px; height: 17px; cursor: pointer; }
.sfx-row .btn { padding: 5px 10px; font-size: 0.75rem; }
.sfx-row .sfx-vol { flex: 1; max-width: 130px; accent-color: var(--gold); cursor: pointer; }

.choose-title { margin: 8px 0 12px; font-size: 1.1rem; }

/* ---------- Host live ---------- */

.topinfo h2 { font-size: 1.2rem; }
.chip-host { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.chip-host b { color: var(--gold); letter-spacing: 2px; }

.btn-row { display: flex; gap: 10px; margin-top: 4px; }
.btn-row .btn { flex: 1; }

/* Host-only panel: answer + distribution + explanation */
.host-panel { margin-top: 18px; border-top: 1px dashed rgba(255, 255, 255, 0.2); padding-top: 14px; }
.host-panel h4 { color: var(--gold); margin: 12px 0 8px; font-size: 0.95rem; }

.correct-answer {
  background: rgba(53, 196, 106, 0.16); border: 1px solid rgba(53, 196, 106, 0.5);
  border-radius: 12px; padding: 12px 16px; font-size: 1.1rem; font-weight: 700;
  color: var(--correct);
}

.dist { display: flex; flex-direction: column; gap: 7px; }
.dist-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.dist-row .letter { font-weight: 700; color: var(--gold); width: 18px; }
.dist-row .bar {
  flex: 1; height: 22px; border-radius: 6px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.dist-row .bar > div { height: 100%; background: rgba(46, 196, 182, 0.75); border-radius: 6px; transition: width 0.3s; }
.dist-row.is-correct .bar > div { background: var(--correct); }
.dist-row.is-correct .count { color: var(--correct); font-weight: 700; }
.dist-row .count { color: var(--muted); min-width: 62px; text-align: right; }

.stats-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; font-size: 0.85rem;
}
.stat-pill {
  background: rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 5px 12px;
}
.stat-pill b { color: var(--gold); }
.stat-pill.good b { color: var(--correct); }
.stat-pill.bad b { color: var(--wrong); }

/* Fastest correct answers */
.fastest { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.fastest-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, 0.18); border-radius: 10px; padding: 9px 12px;
  font-size: 0.95rem;
}
.fastest-row.first {
  border: 1px solid rgba(245, 197, 66, 0.6);
  background: rgba(245, 197, 66, 0.12);
}
.fastest-row .medal { font-size: 1.1rem; width: 24px; text-align: center; }
.fastest-row .fname { flex: 1; }
.fastest-row .ftime { color: var(--gold); font-weight: 700; }
.fastest-empty { color: var(--muted); font-size: 0.9rem; padding: 4px 2px; }

.explain-box { margin-top: 12px; }

/* ---------- Student reveal: correct answer + explanation (KBC style) ---------- */

.reveal-explanation {
  margin-top: 18px;
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(160deg, rgba(245, 197, 66, 0.14), rgba(46, 196, 182, 0.08));
  border: 1px solid rgba(245, 197, 66, 0.45);
  box-shadow: 0 0 26px rgba(245, 197, 66, 0.16), inset 0 0 18px rgba(255, 255, 255, 0.03);
  animation: explanation-pop 0.35s ease-out;
}
@keyframes explanation-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.reveal-answer {
  font-size: 1.15rem; font-weight: 700; color: var(--correct);
  padding: 11px 14px; border-radius: 10px; margin-bottom: 12px;
  background: rgba(53, 196, 106, 0.16);
  border: 1px solid rgba(53, 196, 106, 0.5);
}
.reveal-answer b { color: var(--gold); letter-spacing: 1px; }
.reveal-heading {
  color: var(--gold); font-weight: 700; font-size: 1rem;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.reveal-text {
  font-size: 1.02rem; line-height: 1.65; color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--gold); border-radius: 8px;
  padding: 12px 14px;
}
.reveal-absent { color: var(--muted); font-size: 0.9rem; font-style: italic; margin-top: 4px; }
.exp-block {
  background: rgba(0, 0, 0, 0.22); border-left: 3px solid var(--gold);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 10px;
  font-size: 1.05rem; line-height: 1.6;
}
.exp-block div { color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }

/* ---------- Avatar dots + offline ---------- */

.dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  margin-right: 8px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, 0.4);
}
.leaderboard li.offline { opacity: 0.45; }
.results-table .dot { width: 10px; height: 10px; }

/* ---------- Student join ---------- */

.join-error { color: var(--wrong); font-size: 0.9rem; margin-top: 10px; min-height: 18px; }

.verify-card {
  margin-top: 16px; padding: 14px; border-radius: 12px;
  background: rgba(46, 196, 182, 0.1);
  border: 1px solid rgba(46, 196, 182, 0.4);
  display: grid; gap: 10px;
}
.verify-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, 0.25); border-radius: 8px; padding: 10px 12px;
}
.verify-row span { color: var(--muted); font-size: 0.85rem; }
.verify-row b { color: var(--gold); letter-spacing: 0.5px; word-break: break-word; text-align: right; }

/* ---------- Mobile ---------- */

@media (max-width: 520px) {
  #volume-slider { width: 60px; }
}

@media (max-width: 760px) {
  .live-layout { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .question-text { font-size: 1.15rem; }
}

/* ---------- Sound Manager ---------- */

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-head .btn { padding: 7px 12px; font-size: 0.8rem; }

.sm-groups { display: flex; flex-direction: column; gap: 22px; }
.sm-group-title {
  color: var(--gold); font-size: 1.05rem; margin: 6px 0 10px;
  display: flex; align-items: center; gap: 8px; letter-spacing: 0.3px;
}
.sm-rows { display: flex; flex-direction: column; gap: 10px; }

.sm-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px; padding: 14px 16px;
  transition: opacity 0.15s, border-color 0.15s;
}
.sm-row:hover { border-color: rgba(245, 197, 66, 0.45); }
.sm-row.off { opacity: 0.55; }

.sm-main { flex: 1 1 240px; min-width: 200px; }
.sm-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.98rem; }
.sm-name strong { color: var(--text); }

.sm-status { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.sm-status.ok { background: rgba(53, 196, 106, 0.18); color: var(--correct); }
.sm-status.disabled { background: rgba(255, 255, 255, 0.1); color: var(--muted); }
.sm-status.missing { background: rgba(239, 83, 80, 0.2); color: #ff8a80; }

.sm-custom {
  font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(245, 197, 66, 0.18); color: var(--gold);
}
.sm-file { color: var(--muted); font-size: 0.78rem; margin-top: 4px; word-break: break-all; }

.sm-ctrl {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  flex: 1 1 380px; justify-content: flex-end;
}
.sm-vol {
  display: flex; align-items: center; gap: 8px; min-width: 150px; flex: 1 1 140px;
}
.sm-vol-label { color: var(--gold); font-size: 0.8rem; font-weight: 700; width: 38px; text-align: right; }
.sm-slider { flex: 1; accent-color: var(--gold); cursor: pointer; min-width: 80px; }

.sm-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sm-btns .btn { padding: 7px 11px; font-size: 0.75rem; }
.sm-btns .btn:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 560px) {
  .sm-ctrl { justify-content: flex-start; }
  .sm-vol { flex: 1 1 100%; }
}
/* ---------- Quiz Question Manager (host only) ---------- */

.qm-card { margin-top: 18px; }
.qm-head-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qm-head-controls select {
  background: #1d2333; color: #eee; border: 1px solid #39415a;
  border-radius: 8px; padding: 8px 10px; font-size: 0.95rem; max-width: 220px;
}
#qm-lock { display: flex; gap: 10px; }
#qm-lock input { flex: 1; }

#qm-form { border: 1px dashed #39415a; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
#qm-form-title { font-weight: 700; color: var(--gold, #f5c542); margin-bottom: 10px; }
#qm-form textarea, #qm-form input[type="text"], #qm-form input:not([type]) {
  width: 100%; background: #171b28; color: #eee; border: 1px solid #39415a;
  border-radius: 8px; padding: 9px 11px; font-size: 0.98rem;
}
#qm-options-grid .field-row { display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 8px; }
#qm-options-grid .field-row label { text-align: center; font-weight: 800; color: var(--gold, #f5c542); }
#qm-options-grid { display: grid; gap: 6px; }
#qm-marks-time { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#qm-marks-time input {
  width: 100%; background: #171b28; color: #eee; border: 1px solid #39415a;
  border-radius: 8px; padding: 8px 10px;
}
.qm-correct-row { display: flex; gap: 10px; flex-wrap: wrap; }
.qm-radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #171b28; border: 1px solid #39415a; padding: 7px 14px; border-radius: 999px; }
.qm-radio:has(input:checked) { border-color: #2ec4b6; box-shadow: 0 0 0 1px #2ec4b6 inset; }
.qm-radio span { font-weight: 800; }
.qm-extra summary { cursor: pointer; color: #9fb0d0; padding: 6px 0; }
.qm-extra[open] summary { margin-bottom: 8px; }

.qm-list-title { margin: 16px 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qm-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.qm-row {
  display: flex; align-items: center; gap: 10px; background: #171b28;
  border: 1px solid #2a3047; border-radius: 10px; padding: 9px 12px;
}
.qm-row.picked { border-color: #2ec4b6; }
.qm-row.picked::before { content: '✔'; color: #2ec4b6; font-weight: 900; }
.qm-num { font-weight: 800; color: var(--gold, #f5c542); min-width: 38px; }
.qm-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-btns { display: flex; gap: 6px; flex-shrink: 0; }
.qm-empty { color: #9fb0d0; padding: 10px; list-style: none; }
@media (max-width: 720px) {
  .qm-row { flex-wrap: wrap; }
  .qm-text { white-space: normal; flex-basis: 100%; order: 5; }
}

/* ===== WELCOME SCREEN OVERLAY ===== */

#welcome-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; overflow-y: auto;
  background:
    radial-gradient(ellipse 120% 60% at 50% -15%, rgba(90, 60, 160, 0.35), transparent 60%),
    radial-gradient(ellipse 80% 50% at 80% 100%, rgba(245, 197, 66, 0.08), transparent 50%),
    linear-gradient(170deg, #0c0924 0%, #1b1440 40%, #0e0a28 100%);
  opacity: 1; transition: opacity 0.8s ease;
}
#welcome-overlay.fade-out {
  opacity: 0; pointer-events: none;
}
#welcome-overlay.gone { display: none !important; }

#welcome-particles {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}

.welcome-light {
  position: absolute; top: -35%; left: 50%;
  width: 130%; height: 75%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse 45% 85% at 50% 50%, rgba(245, 197, 66, 0.09), transparent 65%),
    radial-gradient(ellipse 25% 100% at 40% 50%, rgba(245, 197, 66, 0.06), transparent 55%),
    radial-gradient(ellipse 25% 100% at 60% 50%, rgba(245, 197, 66, 0.06), transparent 55%);
  pointer-events: none; z-index: 2;
  opacity: 0; animation: welcome-light-in 3s 0.8s ease forwards;
}
@keyframes welcome-light-in {
  from { opacity: 0; transform: translateX(-50%) scale(0.85); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

.welcome-content {
  position: relative; z-index: 10;
  margin: auto;
  text-align: center; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}

.welcome-om-wrap {
  position: relative; width: 110px; height: 110px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
  opacity: 0; transform: scale(0.8);
  animation: welcome-om-in 2s 1.5s ease forwards;
}
@keyframes welcome-om-in {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.welcome-motif {
  position: absolute; inset: 0; width: 110px; height: 110px;
  animation: welcome-rotate-slow 50s linear infinite;
}
@keyframes welcome-rotate-slow { to { transform: rotate(360deg); } }

.welcome-om {
  position: relative; z-index: 2;
  font-size: 52px; line-height: 1;
  color: var(--gold);
  text-shadow:
    0 0 25px rgba(245, 197, 66, 0.55),
    0 0 60px rgba(245, 197, 66, 0.25),
    0 0 100px rgba(245, 197, 66, 0.12);
  animation: welcome-breathe 4.5s ease-in-out infinite;
}
@keyframes welcome-breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.06); filter: brightness(1.12); }
}

.welcome-divider {
  opacity: 0; transform: scaleX(0);
  animation: welcome-line-in 1.2s 2.6s ease forwards;
}
.welcome-divider.small { margin: 12px 0 10px; animation-delay: 3.6s; }
@keyframes welcome-line-in {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

.welcome-org {
  font-size: 1.15rem; letter-spacing: 2.5px; font-weight: 500;
  color: var(--text);
  opacity: 0; transform: translateY(10px);
  animation: welcome-text-in 1.4s 2.9s ease forwards;
}

.welcome-title {
  font-size: 2.4rem; letter-spacing: 1.5px; font-weight: 800;
  margin: 8px 0 0;
  background: linear-gradient(135deg, var(--gold), #ffe08a, var(--gold-dark));
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 20px rgba(245,197,66,0.3));
  opacity: 0; transform: translateY(14px);
  animation: welcome-text-in 1.6s 3.2s ease forwards;
}

.welcome-sub {
  font-size: 1.02rem; color: var(--muted); line-height: 1.65;
  max-width: 360px; margin: 14px auto 0;
  opacity: 0; transform: translateY(10px);
  animation: welcome-text-in 1.4s 3.9s ease forwards;
}

.welcome-btn {
  margin-top: 32px; padding: 15px 52px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1b1440; font-size: 1.12rem; font-weight: 700;
  border: none; border-radius: 999px; cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow:
    0 0 28px rgba(245, 197, 66, 0.3),
    0 0 60px rgba(245, 197, 66, 0.12),
    inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  opacity: 0; transform: translateY(12px);
  animation: welcome-btn-in 1s 4.3s ease forwards;
}
.welcome-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 36px rgba(245, 197, 66, 0.4),
    0 0 80px rgba(245, 197, 66, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.25);
}
.welcome-btn:active { transform: scale(0.97); }

@keyframes welcome-btn-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes welcome-text-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.welcome-sound-btn {
  margin-top: 18px; padding: 10px 24px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px; color: var(--muted);
  font-size: 0.92rem; cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  opacity: 0; animation: welcome-text-in 0.8s 4.6s ease forwards;
}
.welcome-sound-btn:hover {
  background: rgba(255,255,255,0.14);
  color: var(--text); border-color: rgba(245,197,66,0.4);
}
.welcome-sound-btn.hidden { display: none; }

/* Hide sound controls while welcome overlay is active */
body.welcome-covering #sound-controls { display: none !important; }

/* Mobile welcome adjustments */
@media (max-width: 600px) {
  .welcome-title { font-size: 1.75rem; letter-spacing: 0.5px; }
  .welcome-org { font-size: 1rem; letter-spacing: 1.5px; }
  .welcome-sub { font-size: 0.92rem; max-width: 280px; }
  .welcome-om { font-size: 42px; }
  .welcome-om-wrap { width: 90px; height: 90px; }
  .welcome-motif { width: 90px; height: 90px; }
  .welcome-btn { padding: 13px 40px; font-size: 1.05rem; }
}
@media (max-width: 380px) {
  .welcome-title { font-size: 1.45rem; }
  .welcome-org { font-size: 0.88rem; }
  .welcome-sub { font-size: 0.85rem; }
  .welcome-btn { padding: 12px 32px; font-size: 1rem; }
}

/* ---------- Host screen animations ---------- */

.screen.active {
  animation: screen-in 0.45s cubic-bezier(0.22, 0.68, 0.32, 1);
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.anim-q {
  animation: rise-in 0.5s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
.opt-in {
  animation: opt-in 0.45s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}
@keyframes opt-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.pop-in {
  animation: pop-in 0.3s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

.anim-pop {
  animation: anim-pop 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
@keyframes anim-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.x-pop {
  animation: x-pop 0.5s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
@keyframes x-pop {
  0%   { opacity: 0; transform: scale(0.85); }
  55%  { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

.option.correct.reveal-pop {
  animation: correct-pop 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}
@keyframes correct-pop {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(53, 196, 106, 0.7); }
  45%  { transform: scale(1.045); }
  100% { transform: scale(1); box-shadow: 0 0 0 16px rgba(53, 196, 106, 0); }
}

.timer-ring.low {
  animation: low-pulse 1s ease-in-out infinite;
}
@keyframes low-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(239, 83, 80, 0); transform: scale(1); }
  50%      { box-shadow: 0 0 18px rgba(239, 83, 80, 0.55); transform: scale(1.07); }
}

.dist-row.fresh .bar > div {
  animation: bar-fill 0.6s cubic-bezier(0.22, 0.68, 0.32, 1) both;
  transform-origin: left center;
}
.dist-row.fresh:nth-child(1) .bar > div { animation-delay: 0.06s; }
.dist-row.fresh:nth-child(2) .bar > div { animation-delay: 0.16s; }
.dist-row.fresh:nth-child(3) .bar > div { animation-delay: 0.26s; }
.dist-row.fresh:nth-child(4) .bar > div { animation-delay: 0.36s; }
@keyframes bar-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.fastest-row.fresh-row {
  animation: rise-in 0.45s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}

.host-panel.anim-pop {
  animation: rise-in 0.4s cubic-bezier(0.22, 0.68, 0.32, 1);
}

/* Call out the current leader on the host screen */
#host-leaderboard li:first-child { background: rgba(245, 197, 66, 0.1); }

/* ---------- Lifelines (KBC) ---------- */

.lifelines-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px;
}
.lifeline-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.2), rgba(245, 197, 66, 0.08));
  border: 1px solid rgba(245, 197, 66, 0.55);
  color: var(--text); font-size: 0.9rem; font-weight: 700;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 0 14px rgba(245, 197, 66, 0.18);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.lifeline-btn:hover:not(:disabled) {
  transform: translateY(-2px); filter: brightness(1.12);
  box-shadow: 0 0 22px rgba(245, 197, 66, 0.35);
}
.lifeline-btn:active:not(:disabled) { transform: scale(0.95); }
.lifeline-btn.used {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted); box-shadow: none; cursor: default;
  text-decoration: line-through;
}
.lifeline-btn:disabled { cursor: default; }

/* 50:50 eliminated options (kept visible but greyed + locked, KBC style) */
.option.eliminated {
  opacity: 0.3;
  filter: grayscale(1);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  cursor: default;
}
.option.eliminated .letter { color: var(--muted); }
.option.elim-fresh {
  animation: elim-out 0.55s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
@keyframes elim-out {
  0%   { opacity: 1; transform: scale(1); filter: grayscale(0); }
  30%  { opacity: 0.92; transform: scale(0.96); }
  100% { opacity: 0.3; transform: scale(1); filter: grayscale(1); }
}

/* ---------- Audience poll (KBC) ---------- */

.audience {
  margin: 16px 0 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(46, 196, 182, 0.1), rgba(155, 89, 182, 0.08));
  border: 1px solid rgba(46, 196, 182, 0.4);
  animation: rise-in 0.4s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
.audience h4 { color: var(--peacock); margin-bottom: 10px; font-size: 0.95rem; }
.audience-bars { display: flex; flex-direction: column; gap: 7px; }
.aud-bar { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.aud-letter { font-weight: 800; color: var(--gold); width: 18px; text-align: center; }
.aud-track { flex: 1; height: 20px; border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
.aud-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--peacock), #6f8cff);
  border-radius: 6px;
  animation: bar-fill 0.6s cubic-bezier(0.22, 0.68, 0.32, 1) both;
  transform-origin: left center;
}
.aud-pct { color: var(--muted); min-width: 42px; text-align: right; font-weight: 700; }

/* ---------- KBC-style quiz intro splash (question 1) ---------- */

.quiz-intro {
  position: fixed; inset: 0; z-index: 45;
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, rgba(90, 60, 160, 0.4), transparent 60%),
    radial-gradient(ellipse 90% 60% at 15% 110%, rgba(245, 197, 66, 0.14), transparent 55%),
    radial-gradient(ellipse 90% 60% at 85% 110%, rgba(46, 196, 182, 0.12), transparent 55%),
    linear-gradient(170deg, #07051a 0%, #140e33 45%, #0b0726 100%);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  opacity: 1;
  transition: opacity 0.7s ease;
}
.quiz-intro.fade-out { opacity: 0; pointer-events: none; }
.quiz-intro.hidden { display: none !important; }

.qi-beams {
  position: absolute; inset: -20%;
  background:
    conic-gradient(from 0deg, transparent 0deg, rgba(245, 197, 66, 0.05) 12deg, transparent 24deg,
      transparent 90deg, rgba(46, 196, 182, 0.04) 100deg, transparent 112deg,
      transparent 200deg, rgba(245, 197, 66, 0.05) 212deg, transparent 224deg,
      transparent 300deg, rgba(46, 196, 182, 0.04) 310deg, transparent 322deg);
  animation: qi-rotate 26s linear infinite;
}
@keyframes qi-rotate { to { transform: rotate(360deg); } }

.qi-ring {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.qi-ring-1 {
  width: 620px; height: 620px;
  border: 1px solid rgba(245, 197, 66, 0.16);
  box-shadow: 0 0 60px rgba(245, 197, 66, 0.08) inset, 0 0 40px rgba(46, 196, 182, 0.08);
  animation: qi-spin 38s linear infinite;
  background: radial-gradient(circle, rgba(245, 197, 66, 0.04) 0%, transparent 55%);
}
.qi-ring-2 {
  width: 420px; height: 420px;
  border: 1px dashed rgba(46, 196, 182, 0.22);
  animation: qi-spin-rev 30s linear infinite;
}
.qi-ring-1::before, .qi-ring-1::after,
.qi-ring-2::before, .qi-ring-2::after {
  content: ''; position: absolute; border-radius: 50%;
}
.qi-ring-1::before { inset: 12px; border: 1px dotted rgba(245, 197, 66, 0.14); }
.qi-ring-1::after {
  left: 50%; top: -6px; width: 12px; height: 12px; transform: translateX(-50%);
  background: radial-gradient(circle at 35% 35%, #ffe9a8, var(--gold));
  box-shadow: 0 0 18px 4px rgba(245, 197, 66, 0.6);
}
.qi-ring-2::before { inset: 18px; border: 1px solid rgba(46, 196, 182, 0.12); }
.qi-ring-2::after {
  left: 50%; bottom: -5px; width: 10px; height: 10px; transform: translateX(-50%);
  background: radial-gradient(circle at 35% 35%, #b6fff5, var(--peacock));
  box-shadow: 0 0 16px 4px rgba(46, 196, 182, 0.5);
}
@keyframes qi-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes qi-spin-rev { to { transform: translate(-50%, -50%) rotate(-360deg); } }

.qi-sparks {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(rgba(245, 197, 66, 0.5) 1.2px, transparent 1.4px),
    radial-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1.2px);
  background-size: 130px 130px, 90px 90px;
  background-position: 0 0, 40px 70px;
  opacity: 0.5;
  animation: qi-spark-drift 12s ease-in-out infinite alternate;
}
@keyframes qi-spark-drift {
  from { transform: translateY(0) translateX(0); opacity: 0.35; }
  to   { transform: translateY(-30px) translateX(16px); opacity: 0.7; }
}

.qi-inner {
  position: relative; z-index: 3;
  text-align: center; padding: 20px;
  animation: qi-zoom 3s cubic-bezier(0.22, 0.68, 0.32, 1) both;
}
@keyframes qi-zoom {
  from { transform: scale(0.88); }
  to   { transform: scale(1); }
}
.qi-om {
  font-size: 46px; color: var(--gold);
  text-shadow: 0 0 30px rgba(245, 197, 66, 0.6);
  animation: welcome-breathe 2.2s ease-in-out infinite;
}
.qi-title {
  font-size: 2.5rem; font-weight: 800; letter-spacing: 2px; margin-top: 4px;
  color: var(--text);
  text-shadow: 0 0 34px rgba(245, 197, 66, 0.35);
}
.qi-title span {
  background: linear-gradient(135deg, var(--gold), #ffe08a, var(--gold-dark));
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.qi-cat {
  margin-top: 12px; display: inline-block;
  padding: 7px 18px; border-radius: 999px;
  background: rgba(245, 197, 66, 0.14);
  border: 1px solid rgba(245, 197, 66, 0.45);
  color: var(--gold); font-weight: 700; font-size: 1.05rem; letter-spacing: 1px;
}
.qi-sub { margin-top: 12px; color: var(--muted); font-size: 0.9rem; letter-spacing: 3px; text-transform: uppercase; }
.qi-count {
  margin: 18px auto 0; width: 74px; height: 74px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; font-weight: 800; color: var(--gold);
  border-radius: 50%;
  border: 2px solid rgba(245, 197, 66, 0.5);
  box-shadow: 0 0 30px rgba(245, 197, 66, 0.3), 0 0 60px rgba(245, 197, 66, 0.12);
}
.qi-pop { animation: qi-pop 0.4s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
@keyframes qi-pop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .qi-ring-1 { width: 420px; height: 420px; }
  .qi-ring-2 { width: 300px; height: 300px; }
  .qi-title { font-size: 1.8rem; }
  .qi-om { font-size: 36px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #welcome-particles { display: none; }
  .welcome-light { animation: none; opacity: 1; }
  .welcome-om-wrap { animation: none; opacity: 1; transform: none; }
  .welcome-motif { animation: none; }
  .welcome-om { animation: none; }
  .welcome-divider { animation: none; opacity: 1; transform: none; }
  .welcome-org,
  .welcome-title,
  .welcome-sub { animation: none; opacity: 1; transform: none; }
  .welcome-btn { animation: none; opacity: 1; transform: none; }
  .welcome-sound-btn { animation: none; opacity: 1; }
  .screen.active,
  .anim-q,
  .opt-in,
  .pop-in,
  .anim-pop,
  .x-pop,
  .option.correct.reveal-pop,
  .timer-ring.low,
  .dist-row.fresh .bar > div,
  .fastest-row.fresh-row,
  .host-panel.anim-pop {
    animation: none !important;
  }
  .quiz-intro { transition: none; }
  .qi-beams,
  .qi-ring-1,
  .qi-ring-2,
  .qi-sparks,
  .qi-inner,
  .qi-om,
  .qi-pop,
  .option.elim-fresh,
  .aud-fill {
    animation: none !important;
  }
}
