:root {
  color-scheme: dark;
  --navy-950: #07132d;
  --navy-900: #0b1d44;
  --navy-800: #102d63;
  --navy-700: #174184;
  --gold: #ffc94a;
  --gold-2: #f2a900;
  --white: #f8fbff;
  --muted: #b8c6e5;
  --ink: #101a35;
  --cyan: #27d5d1;
  --pink: #ff4e8a;
  --green: #21c77a;
  --red: #f1495b;
  --purple: #7a5cff;
  --panel: rgba(14, 34, 76, .86);
  --border: rgba(255, 255, 255, .14);
  --shadow: 0 22px 60px rgba(0, 6, 25, .36);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--navy-950); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(39, 213, 209, .17), transparent 28rem),
    radial-gradient(circle at 90% 85%, rgba(255, 201, 74, .15), transparent 30rem),
    linear-gradient(150deg, var(--navy-950), #102c61 58%, #08183a);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
a { color: var(--gold); }
button, input, select, textarea { font: inherit; }
button, .button {
  border: 0;
  border-radius: 14px;
  min-height: 46px;
  padding: .72rem 1.1rem;
  color: var(--ink);
  background: var(--gold);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 #a66f00;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
button:hover, .button:hover { filter: brightness(1.06); transform: translateY(-2px); }
button:active, .button:active { transform: translateY(3px); box-shadow: 0 2px 0 #a66f00; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--cyan); outline-offset: 3px;
}
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.secondary, button.secondary { color: var(--white); background: #244579; box-shadow: 0 6px 0 #0b1b3e; }
.button.danger, button.danger { color: white; background: var(--red); box-shadow: 0 6px 0 #941d32; }
.button.ghost, button.ghost { color: var(--white); background: transparent; box-shadow: inset 0 0 0 2px var(--border); }
.button.small, button.small { min-height: 36px; padding: .45rem .72rem; font-size: .86rem; box-shadow: none; }
input, select, textarea {
  width: 100%;
  color: var(--white);
  background: rgba(2, 11, 32, .62);
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 13px;
  padding: .8rem .9rem;
}
select option { background: var(--navy-900); }
textarea { resize: vertical; min-height: 90px; }
label { display: grid; gap: .42rem; color: var(--muted); font-size: .9rem; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
h1 { letter-spacing: -.04em; line-height: .98; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { color: var(--gold); letter-spacing: .16em; text-transform: uppercase; font-weight: 900; font-size: .76rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.topbar {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--border);
  background: rgba(5, 18, 45, .72); backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: .8rem; color: white; text-decoration: none; font-weight: 900; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px;
  color: var(--navy-950); background: linear-gradient(145deg, #ffe997, var(--gold-2));
  box-shadow: 0 0 0 4px rgba(255,201,74,.12); transform: rotate(-4deg);
}
.brand-mark span { transform: rotate(4deg); }
.sound-toggle { min-width: 46px; padding: .55rem; }
.utility-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .42rem; white-space: nowrap; }
.utility-toggle[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--gold); }
.shell { position: relative; z-index: 1; width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.5rem, 4vw, 4rem) 0; }
main { position: relative; z-index: 1; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.card { padding: clamp(1.15rem, 3vw, 2rem); }
.hero { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(1rem, 4vw, 4rem); align-items: center; }
.hero-copy h1 { max-width: 760px; font-size: clamp(3rem, 8vw, 7rem); }
.hero-copy h1 span { color: var(--gold); text-shadow: 0 7px 0 rgba(0,0,0,.2); }
.hero-copy > p { max-width: 640px; font-size: clamp(1rem, 2vw, 1.35rem); color: var(--muted); line-height: 1.6; }
.join-card { transform: rotate(1deg); }
.join-card h2 { font-size: 1.8rem; }
.join-form { display: grid; gap: 1rem; }
.pin-input { text-align: center; font-size: 2rem; letter-spacing: .26em; font-weight: 900; }
.join-form button { font-size: 1.05rem; }
.micro { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.lobby-browser { margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.lobby-browser-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.lobby-browser-head h3 { margin: 0; }
.available-lobbies { display: grid; gap: .55rem; margin-top: .75rem; max-height: 230px; overflow-y: auto; }
.lobby-link { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .75rem; border: 1px solid var(--border); border-radius: 12px; color: var(--white); background: rgba(255,255,255,.055); text-decoration: none; }
.lobby-link:hover { border-color: var(--gold); background: rgba(255,255,255,.1); }
.lobby-link strong, .lobby-link small { display: block; }
.lobby-link small { margin-top: .2rem; color: var(--muted); }
.lobby-pin { color: var(--gold); font-size: 1.05rem; font-weight: 950; letter-spacing: .09em; }
.feature-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 2rem; }
.chip { padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.05); font-size: .86rem; }

.auth-wrap { min-height: calc(100vh - 76px); display: grid; place-items: center; }
.auth-card { width: min(430px, 100%); }
.auth-card h1 { font-size: 2.4rem; }
.stack { display: grid; gap: 1rem; }
.error { color: #ffb8c2; background: rgba(241,73,91,.15); border: 1px solid rgba(241,73,91,.4); padding: .8rem; border-radius: 12px; }
.success { color: #bfffe0; background: rgba(33,199,122,.15); border: 1px solid rgba(33,199,122,.4); padding: .8rem; border-radius: 12px; }

.dashboard { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; padding: 1rem; max-width: 1500px; margin: auto; }
.sidebar { padding: 1rem; align-self: start; position: sticky; top: 1rem; }
.nav-list { display: grid; gap: .5rem; }
.nav-list button { text-align: left; box-shadow: none; }
.quiz-list { display: grid; gap: .7rem; max-height: 58vh; overflow: auto; padding-right: .3rem; }
.quiz-item { padding: .85rem; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,.05); cursor: pointer; }
.quiz-item[aria-selected="true"] { border-color: var(--gold); background: rgba(255,201,74,.11); }
.quiz-item strong, .quiz-item span { display: block; }
.quiz-item span { color: var(--muted); font-size: .78rem; margin-top: .3rem; }
.workspace { min-width: 0; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.workspace-header h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 3.2rem); }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.actions label { min-width: 120px; }
.empty-state { min-height: 450px; display: grid; place-items: center; text-align: center; padding: 2rem; }
.empty-state .big-icon { font-size: 4rem; }

.room-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .5fr); gap: 1rem; }
.stage { min-height: 620px; padding: clamp(1rem, 3vw, 2rem); display: flex; flex-direction: column; }
.stage-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.pin { font-size: clamp(2.5rem, 7vw, 6rem); letter-spacing: .12em; color: var(--gold); font-weight: 950; text-shadow: 0 6px 0 rgba(0,0,0,.25); }
.lobby-main { flex: 1; display: grid; grid-template-columns: minmax(230px,.65fr) 1fr; gap: 1.5rem; align-items: center; }
.qr { width: min(100%, 330px); padding: .8rem; border-radius: 24px; background: white; }
.join-url { overflow-wrap: anywhere; color: var(--muted); }
.player-cloud { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; align-content: center; }
.player-pill { animation: pop .28s ease both; padding: .7rem 1rem; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid var(--border); font-weight: 800; }
.player-pill.offline { opacity: .52; }
.control-rail { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.control-rail .actions { display: grid; }
.answer-key { padding: .85rem; border: 1px solid rgba(255,201,74,.38); border-radius: 14px; background: rgba(255,201,74,.09); }
.answer-key .eyebrow { margin-bottom: .55rem; }
.answer-key-value { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: .65rem; }
.answer-key-letter { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: white; background: #e53f54; font-weight: 950; }
.answer-key-value.answer-1 .answer-key-letter { background: #2167d8; }
.answer-key-value.answer-2 .answer-key-letter { background: #d89105; }
.answer-key-value.answer-3 .answer-key-letter { background: #15965d; }
.stage-answer-key { width: min(680px, 100%); margin-inline: auto; }
.submission-summary { margin: -.2rem 0 .65rem; font-size: .88rem; }
.player-admin-list { display: grid; gap: .5rem; max-height: 330px; overflow: auto; }
.player-admin { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem .65rem; border-radius: 10px; background: rgba(255,255,255,.055); }
.player-admin-main { min-width: 0; display: grid; gap: .1rem; }
.player-admin-main > span { overflow-wrap: anywhere; font-weight: 750; }
.player-admin-actions { display: flex; align-items: center; gap: .45rem; }
.submission-status { padding: .3rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 850; white-space: nowrap; }
.submission-status.answered, .submission-status.connected { color: #bfffe0; background: rgba(33,199,122,.17); }
.submission-status.waiting { color: #fff0ba; background: rgba(255,201,74,.16); }
.submission-status.disconnected { color: #d4d9e5; background: rgba(122,137,170,.2); }
.live-dot { display: inline-block; width: .6rem; height: .6rem; margin-right: .35rem; border-radius: 50%; background: var(--green); }
.live-dot.off { background: #7a89aa; }
.question-stage { flex: 1; display: grid; gap: 1rem; align-content: center; }
.question-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); }
.timer { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 50%; color: var(--white); background: conic-gradient(var(--gold) var(--progress,100%), rgba(255,255,255,.12) 0); font-size: 1.5rem; font-weight: 900; }
.timer::before { content: ""; position: absolute; }
.question-text { max-width: 1000px; margin-inline: auto; text-align: center; font-size: clamp(1.65rem, 4vw, 3.7rem); line-height: 1.12; }
.question-image { display: block; max-height: 260px; max-width: min(600px,100%); margin: auto; border-radius: 18px; object-fit: contain; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.answer-card { min-height: 110px; display: flex; align-items: center; gap: 1rem; border-radius: 18px; padding: 1rem; font-size: clamp(1rem, 2vw, 1.3rem); font-weight: 850; box-shadow: 0 7px 0 rgba(0,0,0,.3); }
.answer-card:nth-child(1) { background: #e53f54; }
.answer-card:nth-child(2) { background: #2167d8; }
.answer-card:nth-child(3) { background: #d89105; }
.answer-card:nth-child(4) { background: #15965d; }
.shape { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border: 3px solid white; font-size: 1rem; }
.answer-card.correct { outline: 5px solid white; filter: brightness(1.16); }
.answer-card.dim { opacity: .35; }
.count-bar { height: 7px; border-radius: 5px; background: rgba(255,255,255,.28); overflow: hidden; }
.count-bar span { display: block; height: 100%; background: white; }
.explanation { padding: 1rem; border-left: 4px solid var(--gold); background: rgba(255,201,74,.08); border-radius: 0 12px 12px 0; }
.leaderboard { width: min(820px, 100%); margin: auto; display: grid; gap: .65rem; }
.leader-row { display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: .7rem; padding: .9rem 1.1rem; border-radius: 14px; background: rgba(255,255,255,.08); font-size: 1.1rem; }
.leader-row:first-child { background: linear-gradient(90deg, rgba(255,201,74,.3), rgba(255,255,255,.08)); }
.podium { min-height: 440px; display: flex; align-items: end; justify-content: center; gap: 1rem; padding-top: 4rem; }
.podium-place { width: min(28%, 260px); display: flex; flex-direction: column; justify-content: end; align-items: center; text-align: center; padding: 1rem .7rem; border-radius: 20px 20px 8px 8px; background: linear-gradient(#234b8f, #10244f); border: 1px solid var(--border); animation: rise .65s ease both; }
.podium-place strong { font-size: clamp(1rem,2vw,1.5rem); overflow-wrap: anywhere; }
.podium-place .medal { font-size: 2.3rem; }
.podium-place.first { min-height: 330px; order: 2; background: linear-gradient(#d39a18, #735012); }
.podium-place.second { min-height: 250px; order: 1; }
.podium-place.third { min-height: 205px; order: 3; background: linear-gradient(#9a592f, #4c2e22); }

.player-shell { min-height: calc(100vh - 76px); display: grid; place-items: center; width: min(760px, calc(100% - 1rem)); margin: auto; padding: 1rem 0; }
.player-card { width: 100%; padding: clamp(1rem, 4vw, 2rem); text-align: center; }
.join-ghost { width: 200px; height: 200px; margin: -1rem auto -1.25rem; background: url("./theme/player_01.png") 0 0 / 1800px 400px no-repeat; filter: drop-shadow(0 14px 22px rgba(5, 15, 40, .42)); animation: join-ghost-float 3s ease-in-out infinite, join-ghost-frames 1.1s steps(2) infinite; }
.join-quiz-title { margin-bottom: 1.35rem; font-size: clamp(2.4rem, 10vw, 4.6rem); line-height: .98; overflow-wrap: anywhere; }
.phone-answers { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.phone-answer { min-height: min(24vh, 180px); color: white; font-size: 1.1rem; box-shadow: 0 7px 0 rgba(0,0,0,.35); }
.phone-answer:nth-child(1) { background: #e53f54; box-shadow: 0 7px 0 #8c1e30; }
.phone-answer:nth-child(2) { background: #2167d8; box-shadow: 0 7px 0 #123a80; }
.phone-answer:nth-child(3) { background: #d89105; box-shadow: 0 7px 0 #7d5100; }
.phone-answer:nth-child(4) { background: #15965d; box-shadow: 0 7px 0 #075b36; }
.phone-answer.selected { outline: 5px solid white; transform: translateY(3px); }
.phone-answer.correct { outline: 5px solid #baffdc; }
.phone-answer.wrong { filter: grayscale(.5); outline: 5px solid #ffb0ba; }
.status-orb { width: 96px; height: 96px; margin: 1rem auto; display: grid; place-items: center; border-radius: 50%; font-size: 2.4rem; background: rgba(255,255,255,.1); }
.score-big { color: var(--gold); font-size: clamp(2.4rem, 12vw, 5rem); font-weight: 950; }

.editor-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(0,5,20,.8); }
.editor { width: min(1000px, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1rem; }
.editor-head { position: sticky; z-index: 2; top: -1rem; display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; margin: -1rem -1rem 1rem; background: #102653; border-bottom: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.question-editor { padding: 1rem; margin: 1rem 0; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid var(--border); }
.question-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.answer-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .7rem; }
.answer-edit { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .5rem; }
.answer-edit input[type="radio"] { width: 22px; height: 22px; accent-color: var(--gold); }
.history-modal { width: min(1180px, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1rem; }
.history-section { margin-bottom: 1.5rem; }
.history-section > h3 { margin-bottom: .35rem; font-size: 1.35rem; }
.history-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.history-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.history-table th, .history-table td { padding: .75rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.history-table th:nth-child(2), .history-table td:nth-child(2) { text-align: left; }
.history-table thead th { color: var(--muted); background: rgba(255,255,255,.055); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.history-table tbody tr:last-child > * { border-bottom: 0; }
.history-game { margin-top: .65rem; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.045); }
.history-game summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem; cursor: pointer; }
.history-game summary strong, .history-game summary small { display: block; }
.history-game summary small { margin-top: .2rem; color: var(--muted); }
.history-status { padding: .35rem .55rem; border-radius: 999px; color: #bfffe0; background: rgba(33,199,122,.15); font-size: .75rem; font-weight: 800; white-space: nowrap; }
.history-status.early { color: #ffccd3; background: rgba(241,73,91,.16); }
.history-results { display: grid; gap: .45rem; padding: 0 .9rem .9rem; }
.history-results .leader-row { grid-template-columns: 3rem 1fr auto; font-size: .92rem; }
.toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: 420px; padding: .9rem 1rem; border-radius: 13px; background: #071633; border: 1px solid var(--border); box-shadow: var(--shadow); animation: pop .2s ease; }

.display-body .topbar { padding-block: .65rem; }
.display-body .shell { width: min(1500px, calc(100% - 2rem)); padding: 1rem 0; }
.display-stage { min-height: calc(100vh - 100px); }
.display-body .question-text { font-size: clamp(2.5rem, 5.5vw, 6rem); }

html[data-theme="halloween"] {
  --navy-950: #0b0714;
  --navy-900: #150b28;
  --navy-800: #28104a;
  --navy-700: #482071;
  --gold: #ff9d2e;
  --gold-2: #ff681d;
  --white: #fff9ef;
  --muted: #d9c8eb;
  --ink: #160b25;
  --cyan: #4bdcff;
  --pink: #ee4fba;
  --green: #6fd23d;
  --red: #ec426b;
  --purple: #a848f4;
  --panel: rgba(22, 10, 42, .88);
  --border: rgba(202, 135, 255, .25);
  --shadow: 0 22px 65px rgba(4, 1, 12, .62);
}
html[data-theme="halloween"] body {
  background:
    linear-gradient(180deg, rgba(9, 4, 20, .22), rgba(12, 5, 25, .75)),
    url("./theme/background-single.png") center bottom / cover fixed,
    #0b0714;
}
html[data-theme="halloween"] body::before {
  z-index: 0;
  opacity: .56;
  background:
    radial-gradient(circle at 18% 20%, rgba(93, 218, 255, .2), transparent 24rem),
    radial-gradient(circle at 82% 70%, rgba(151, 53, 220, .24), transparent 28rem),
    linear-gradient(180deg, transparent 48%, rgba(7, 3, 16, .5));
  background-size: auto;
  mask-image: none;
}
html[data-theme="halloween"] body::after {
  content: "";
  position: fixed;
  z-index: 0;
  right: clamp(.5rem, 3vw, 3rem);
  bottom: .75rem;
  width: 160px;
  height: 119px;
  pointer-events: none;
  opacity: .72;
  background: url("./theme/character01.png") 0 0 / 960px 119px no-repeat;
  filter: drop-shadow(0 10px 18px rgba(10, 0, 25, .55));
  animation: halloween-bob 3.2s ease-in-out infinite, halloween-frames .9s steps(6) infinite;
}
html[data-theme="halloween"] .topbar {
  background: rgba(15, 6, 30, .84);
  border-bottom-color: rgba(137, 217, 74, .24);
}
html[data-theme="halloween"] .panel { background: var(--panel); }
html[data-theme="halloween"] .brand-mark {
  overflow: hidden;
  background-color: #24103e;
  background-image: url("./theme/player_01.png"), linear-gradient(145deg, #67229c, #2b0e48);
  background-position: -7px -9px, center;
  background-repeat: no-repeat;
  background-size: 450px 100px, auto;
  box-shadow: 0 0 0 4px rgba(110, 214, 67, .14), 0 0 22px rgba(76, 215, 255, .22);
}
html[data-theme="halloween"] .brand-mark span { opacity: 0; }
html[data-theme="halloween"] button:not(.answer-card):not(.phone-answer),
html[data-theme="halloween"] .button { box-shadow: 0 6px 0 #8e3512; }
html[data-theme="halloween"] .button.secondary,
html[data-theme="halloween"] button.secondary { background: #51277e; box-shadow: 0 6px 0 #24103e; }
html[data-theme="halloween"] .button.ghost,
html[data-theme="halloween"] button.ghost { background: rgba(85, 34, 125, .24); box-shadow: inset 0 0 0 2px var(--border); }
html[data-theme="halloween"] input,
html[data-theme="halloween"] select,
html[data-theme="halloween"] textarea { background: rgba(8, 3, 18, .74); border-color: rgba(182, 104, 234, .34); }
html[data-theme="halloween"] select option { background: #170a29; }
html[data-theme="halloween"] .quiz-item[aria-selected="true"] { border-color: var(--green); background: rgba(111, 210, 61, .12); }
html[data-theme="halloween"] .answer-key { border-color: rgba(111, 210, 61, .38); background: rgba(90, 28, 132, .3); }
html[data-theme="halloween"] .answer-key-value.answer-0 .answer-key-letter { background: #9146cc; }
html[data-theme="halloween"] .answer-key-value.answer-1 .answer-key-letter { background: #1879bd; }
html[data-theme="halloween"] .answer-key-value.answer-2 .answer-key-letter { background: #e36f1e; }
html[data-theme="halloween"] .answer-key-value.answer-3 .answer-key-letter { background: #3f9e35; }
html[data-theme="halloween"] .answer-card:nth-child(1),
html[data-theme="halloween"] .phone-answer:nth-child(1) { background: #9146cc; box-shadow: 0 7px 0 #482064; }
html[data-theme="halloween"] .answer-card:nth-child(2),
html[data-theme="halloween"] .phone-answer:nth-child(2) { background: #1879bd; box-shadow: 0 7px 0 #0b3e66; }
html[data-theme="halloween"] .answer-card:nth-child(3),
html[data-theme="halloween"] .phone-answer:nth-child(3) { background: #e36f1e; box-shadow: 0 7px 0 #84370c; }
html[data-theme="halloween"] .answer-card:nth-child(4),
html[data-theme="halloween"] .phone-answer:nth-child(4) { background: #3f9e35; box-shadow: 0 7px 0 #1d541a; }
html[data-theme="halloween"] .leader-row:first-child { background: linear-gradient(90deg, rgba(111, 210, 61, .28), rgba(145, 70, 204, .18)); }
html[data-theme="halloween"] .podium-place { background: linear-gradient(#54287b, #24103e); }
html[data-theme="halloween"] .podium-place.first { background: linear-gradient(#d97821, #75300c); }
html[data-theme="halloween"] .podium-place.third { background: linear-gradient(#31888b, #153f48); }

@keyframes pop { from { opacity: 0; transform: scale(.88); } }
@keyframes rise { from { opacity: 0; transform: translateY(80px); } }
@keyframes pulse { 50% { transform: scale(1.04); } }
@keyframes halloween-bob { 50% { transform: translateY(-13px) rotate(2deg); } }
@keyframes halloween-frames { to { background-position: -960px 0; } }
@keyframes join-ghost-float { 50% { transform: translateY(-10px) rotate(-2deg); } }
@keyframes join-ghost-frames { to { background-position: 0 -400px; } }
@media (max-width: 900px) {
  .hero, .room-grid { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .quiz-list { max-height: 230px; }
  .stage { min-height: 520px; }
}
@media (max-width: 650px) {
  .hero { padding-top: 2rem; align-content: start; }
  .hero-copy h1 { font-size: 3.5rem; }
  .lobby-main, .answer-grid, .form-grid, .answer-edit-grid { grid-template-columns: 1fr; }
  .topbar { padding: .75rem 1rem; }
  .brand-text { display: none; }
  .workspace-header { align-items: start; flex-direction: column; }
  .phone-answer { min-height: 20vh; padding: .6rem; font-size: .95rem; }
  .join-ghost { width: 180px; height: 180px; margin-top: -1.2rem; background-size: 1620px 360px; animation-name: join-ghost-float; }
  .podium { gap: .35rem; }
  .podium-place { width: 32%; padding-inline: .3rem; }
  .utility-toggle { min-width: 40px; padding-inline: .65rem; }
  .utility-toggle .toggle-label { display: none; }
  .player-admin { align-items: flex-start; }
  .player-admin-actions { align-items: flex-end; flex-direction: column; }
  html[data-theme="halloween"] body::after { right: -.5rem; opacity: .46; transform: scale(.72); transform-origin: bottom right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
  html[data-theme="halloween"] body::after { animation: none !important; background-position: 0 0; }
  .join-ghost { animation: none !important; background-position: 0 0; }
}
