:root {
  --scale: 1;
  --bg: #0a1230;
  --bg2: #142a6e;
  --fg: #ffffff;
  --muted: #b9c4ec;
  --a: #ef476f;
  --b: #06b6d4;
  --c: #ffd166;
  --d: #06d6a0;
  --ok: #06d6a0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at top, var(--bg2), var(--bg));
  color: var(--fg);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-size: calc(18px * var(--scale));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  background: rgba(0,0,0,0.25);
}
.topbar h1 { font-size: 1.5em; margin: 0; flex: 0 0 auto; }
.scorechips { display: flex; gap: 0.6rem; flex: 1; justify-content: center; flex-wrap: wrap; }
.scorechips.scores-hidden { visibility: hidden; pointer-events: none; }
.chip {
  padding: 0.4em 1em; border-radius: 2em; font-weight: 700;
  background: rgba(255,255,255,0.12); cursor: pointer; user-select: none;
  border: 3px solid transparent; transition: transform .1s, border-color .2s;
}
.chip:hover { transform: translateY(-2px); }
.chip.scored { border-color: #fff; }
.chip .pts { margin-left: .5em; background: rgba(0,0,0,.3); padding: 0 .5em; border-radius: 1em; }

.topcontrols { display: flex; gap: .4rem; }
.tsbtn, .iconbtn { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 8px; padding: .4em .7em; font-size: 1em; cursor: pointer; }
.tsbtn:hover, .iconbtn:hover { background: rgba(255,255,255,.3); }

.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem; position: relative; z-index: 6; }
.view { display: none; width: 100%; max-width: 1200px; text-align: center; }
.view.active { display: block; }

.primary.big { font-size: 1.8em; padding: .6em 1.5em; }
.sub { color: var(--muted); font-size: 1.2em; }

#suspense h2 { font-size: 4em; margin: 0 0 .3em; }
#suspense .sub { font-size: 2.6em; margin-bottom: 2em; }
#suspense #revealWinnerBtn { font-size: .8em; padding: .4em .9em; }

.qmeta { color: var(--muted); margin-bottom: .5rem; font-size: 1.1em; }
.question { font-size: 2.4em; font-weight: 800; margin-bottom: 1.2rem; line-height: 1.2; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ans {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.4rem; border-radius: 16px;
  font-size: 1.6em; font-weight: 700; opacity: 0; transform: scale(.96);
  transition: opacity .3s, transform .3s, box-shadow .3s; text-align: left;
}
.answers.revealed .ans { opacity: 1; transform: scale(1); }
.ans .key { width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.35); flex: 0 0 auto; }
.ans.a { background: var(--a); color:#210; } .ans.b { background: var(--d); color:#012; }
.ans.c { background: var(--b); color:#012; } .ans.d { background: var(--c); color:#321; }
.ans.correct { box-shadow: 0 0 0 6px #fff, 0 0 40px var(--ok); }
.ans.dim { opacity: .35; }

body.hc-answers .ans { background: #fff; color: #000; }
body.hc-answers .ans .key { background: rgba(0,0,0,.1); color: #000; }
body.hc-answers .ans.correct { background: var(--ok); box-shadow: 0 0 0 6px #000, 0 0 40px var(--ok); }

.footbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; background: rgba(0,0,0,.25); }
.hostbtns { display: flex; gap: .6rem; margin-left: auto; }
.hostbtns[hidden] { display: none; }
.primary { background: #fff; color: #142a6e; border: 0; border-radius: 10px; padding: .6em 1.2em; font-weight: 700; font-size: 1.1em; cursor: pointer; }
.primary:hover { background: #e6ecff; }
.ghost { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.4); border-radius: 10px; padding: .6em 1.2em; cursor: pointer; }
.timer { font-size: 2.4em; font-weight: 800; }
.timer.low { color: var(--a); }

.leaderboard { list-style: none; padding: 0; font-size: 1.6em; max-width: 600px; margin: 1rem auto; }
.leaderboard li { display: flex; justify-content: space-between; padding: .6em 1em; margin: .4em 0; border-radius: 12px; background: rgba(255,255,255,.12); }
.leaderboard li.winner { background: var(--c); color:#321; transform: scale(1.05); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 10; }
.modal[hidden] { display: none; }
.modalcard { background: #142a6e; padding: 2rem; border-radius: 16px; min-width: 320px; }
.opt { display: block; margin: 1rem 0; font-size: 1.2em; }
.opt-row { display: flex; align-items: center; gap: .6rem; }
.opt select { font-size: 1em; padding: .3em; border-radius: 6px; }

.errbar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--a); padding: 1em; text-align: center; font-weight: 700; }

#fireworks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
.topbar, .footbar { position: relative; z-index: 6; }
