:root {
  --bg: #120a2e;
  --bg2: #24125c;
  --card: #1d1247;
  --pink: #ff3ea5;
  --gold: #ffd23f;
  --text: #f4f1ff;
  --muted: #a99fd6;
  --good: #2ee6a0;
  --bad: #ff5468;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 50% 0%, var(--bg2), var(--bg) 70%) fixed;
  min-height: 100dvh;
}
h1, h2 { margin: 0 0 .5em; line-height: 1.15; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }
a { color: var(--gold); }

.logo { font-size: 2.2rem; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; text-align: center; }
.logo span { color: var(--gold); text-shadow: 0 0 18px #ffd23f88; }

.card { background: var(--card); border: 2px solid #3b2a8a; border-radius: 18px; padding: 1.2rem; }

.btn {
  font: inherit; font-weight: 800; color: var(--bg); background: var(--gold);
  border: 0; border-radius: 14px; padding: .8rem 1.1rem; cursor: pointer;
  box-shadow: 0 4px 0 #b88f00; transition: transform .05s;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b88f00; }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.btn.big { width: 100%; font-size: 1.25rem; padding: 1rem; margin-top: 1rem; }

input {
  font: inherit; font-size: 1.3rem; width: 100%; margin: .3rem 0 1rem; padding: .7rem .9rem;
  border-radius: 12px; border: 2px solid #3b2a8a; background: var(--bg); color: var(--text);
}
#code { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; }
label { font-weight: 700; color: var(--muted); }

.timer { color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }

.scores { list-style: none; padding: 0; margin: 1rem 0 0; }
.scores li {
  display: flex; justify-content: space-between; padding: .6rem .9rem; margin-bottom: .4rem;
  background: #ffffff10; border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.scores li.me, .scores li.active { background: var(--pink); color: #fff; }
.scores li.offline { opacity: .45; }

/* ---------- Player (phone) ---------- */
.player main { max-width: 480px; margin: 0 auto; padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.bar .score { color: var(--gold); font-weight: 900; font-size: 1.2rem; }
.turn { font-weight: 800; color: var(--pink); font-size: 1.1rem; }
.qtext { font-size: 1.4rem; }
.options { display: grid; gap: .7rem; }
.option { text-align: left; font-size: 1.15rem; background: #fff; box-shadow: 0 4px 0 #8c84b8; }
.option b { color: var(--pink); margin-right: .4rem; }
.option.picked { background: var(--gold); }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; margin-top: 1rem; }
.slot { font-size: 1.6rem; padding: 1.2rem 0; background: var(--pink); color: #fff; box-shadow: 0 4px 0 #a01c62; }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--bad); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; font-weight: 700;
}

/* ---------- Host (big screen) ---------- */
.host { overflow: hidden; }
.stage { display: flex; gap: 2rem; height: 100dvh; padding: 1.5rem; align-items: stretch; justify-content: center; }
#board {
  height: 100%; aspect-ratio: 680 / 860; max-width: 55vw;
  background: linear-gradient(#1a0f40, #0d0724); border: 3px solid #3b2a8a; border-radius: 22px;
  box-shadow: 0 0 60px #ff3ea533;
}
#panel { width: min(520px, 40vw); overflow-y: auto; display: flex; flex-direction: column; font-size: 1.15rem; }
.host .logo { text-align: left; }
.joinurl { font-size: 1.1rem; font-weight: 800; word-break: break-all; margin-top: 0; }
.join { display: flex; gap: 1.2rem; align-items: center; }
.join p { margin: 0 0 .3rem; }
.qr { flex: none; width: clamp(140px, 26vh, 240px); padding: 8px; background: #fff; border-radius: 14px; }
.qr svg { display: block; width: 100%; height: auto; }
.code {
  font-size: clamp(3rem, 10vh, 6rem); font-weight: 900; letter-spacing: .15em; color: var(--gold);
  text-shadow: 0 0 30px #ffd23f88; line-height: 1;
}
.seats { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 1.2rem 0 0; }
.seats li { padding: .8rem 1rem; border-radius: 12px; background: var(--pink); font-weight: 800; font-size: 1.3rem; }
.seats li.empty { background: #ffffff10; color: var(--muted); font-weight: 500; }
.round { color: var(--muted); font-weight: 700; margin-top: 0; }
.question h2 { font-size: 1.6rem; }
.answers { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.answers li { padding: .6rem .9rem; border-radius: 10px; background: #ffffff10; font-weight: 700; }
.answers b { color: var(--pink); margin-right: .6rem; }
.answers li.wrong { text-decoration: line-through; opacity: .4; }
.answers li.correct { background: var(--good); color: var(--bg); }
.answers li.correct b { color: var(--bg); }
.status { font-size: 1.4rem; font-weight: 800; color: var(--gold); }
.banner { font-size: 2.2rem; color: var(--gold); margin-top: 1rem; }

/* Short laptop screens: tighten the host panel so nothing scrolls. */
@media (min-width: 801px) and (max-height: 820px) {
  .stage { padding: 1rem; gap: 1.5rem; }
  #panel { font-size: 1rem; }
  .host .logo { font-size: 1.7rem; }
  .question h2 { font-size: 1.3rem; }
  .answers li, .scores li { padding: .4rem .8rem; }
  .status { font-size: 1.2rem; margin: .6rem 0; }
  .banner { font-size: 1.8rem; }
  .seats li { padding: .6rem .8rem; font-size: 1.1rem; }
  .btn.big { padding: .8rem; }
}

@media (max-width: 800px) {
  .host { overflow: auto; }
  .stage { flex-direction: column; height: auto; }
  #board { height: auto; width: 100%; max-width: none; }
  #panel { width: 100%; }
}
