:root {
  --bg: #fff;
  --fg: #111;
  --panel: #f2f2f2;
  --line: #ccc;
  --bad: #c62828;
  --accent: #7b3fe4;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #eee;
    --panel: #1e1e1e;
    --line: #333;
    --bad: #ef5350;
    --accent: #9b6bff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
}

main { padding: 16px; max-width: 1400px; margin: 0 auto; }

button, input, textarea {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
button { cursor: pointer; }

.error { color: var(--bad); white-space: pre-line; }

.video-frame { width: 100%; height: 100%; border: 0; display: block; }

.muted { opacity: .65; }
.status { position: fixed; bottom: 8px; right: 12px; margin: 0; font-size: 14px; opacity: .7; }
.badge {
  display: inline-block; padding: 0 8px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .7em; font-weight: 700; vertical-align: middle;
}
button:disabled { opacity: .5; cursor: default; }
button.big { width: 100%; padding: 16px; font-size: 20px; font-weight: 700; }
button.link { background: none; border: 0; padding: 0; text-decoration: underline; color: inherit; }

/* Phone */
.phone main { max-width: 480px; }
.phone footer { text-align: center; padding: 16px; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.stack input { font-size: 20px; }
input[name="code"] { text-transform: uppercase; letter-spacing: .2em; }

/* Host (TV) */
.host main { text-align: center; font-size: 28px; padding-top: 5vh; }
.host h1 { font-size: 64px; margin: 0 0 16px; }
.join-info { margin-bottom: 32px; }
.room-code { font-size: 120px; font-weight: 800; letter-spacing: .15em; line-height: 1.1; }
.players {
  list-style: none; padding: 0; margin: 0 auto 24px; max-width: 900px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.players li { background: var(--panel); border-radius: 12px; padding: 16px 8px; font-weight: 700; }
.players li.empty { opacity: .35; font-weight: 400; }
.players li.away { opacity: .5; }
@media (max-width: 700px) { .players { grid-template-columns: repeat(2, 1fr); } }

/* Rounds (both views) */
.prompt { font-size: 1.3em; font-weight: 800; line-height: 1.25; margin: 8px 0 16px; }
.prompt::before { content: "“"; }
.prompt::after { content: "”"; }
.ok { color: #2e7d32; font-weight: 600; }
@media (prefers-color-scheme: dark) { .ok { color: #66bb6a; } }
.scores { list-style: none; padding: 0; margin: 16px auto; max-width: 420px; }
.scores li { display: flex; justify-content: space-between; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.scores li.top { font-weight: 800; color: var(--accent); }
button.choice, button.pick { text-align: left; }

/* Host rounds */
.host-layout { display: flex; gap: 48px; align-items: center; justify-content: center; min-height: 100vh; }
.host-layout main { flex: 1; max-width: 1000px; margin: 0; }
body[data-stage="on"] .host-layout main { flex: 0 1 520px; min-width: 0; text-align: left; overflow-wrap: anywhere; }
#stage { width: min(calc(90vh * 9 / 16), 50vw); aspect-ratio: 9 / 16; background: #000; border-radius: 16px; overflow: hidden; flex: none; }
.host .big-prompt { font-size: 64px; }
.host .prompt { font-size: 44px; }
.reveal-letter { font-size: 96px; font-weight: 800; color: var(--accent); }
.letters { display: flex; justify-content: center; gap: 16px; }
.letters span {
  width: 96px; height: 96px; display: grid; place-items: center; border-radius: 16px;
  background: var(--panel); font-size: 56px; font-weight: 800;
}
.reveals { list-style: none; padding: 0; margin: 16px auto; max-width: 600px; }
.reveals li { padding: 8px 16px; border-radius: 12px; }
.reveals li.top { background: var(--accent); color: #fff; }
.players li.done { outline: 3px solid var(--accent); }
.big-scores { font-size: 40px; max-width: 700px; }
#sound-banner {
  position: fixed; top: 0; left: 0; right: 0; padding: 12px; text-align: center;
  background: var(--accent); color: #fff; font-size: 22px; font-weight: 700;
}

/* Timers and notices (M3) */
.countdown { font-weight: 800; font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--bad); }
.host #timer { position: fixed; top: 16px; right: 24px; font-size: 48px; }
body[data-stage="on"] #timer { display: none; }
#notice {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); padding: 10px 20px; border-radius: 16px;
  background: var(--fg); color: var(--bg); font-weight: 700; text-align: center;
}
.host #notice { font-size: 28px; }
.phone #notice { position: static; transform: none; margin: 12px 16px; border-radius: 12px; }
.letters span.failed { opacity: .35; text-decoration: line-through; }
.phone .top-bar { display: flex; justify-content: space-between; gap: 8px; }
.pick-row { display: flex; gap: 8px; }
.pick-row .pick { flex: 1; }
.pick-row .replay { flex: none; width: 88px; font-weight: 700; }
#menu { max-width: 480px; margin: 0 auto; padding: 0 16px; }
#menu summary { cursor: pointer; opacity: .65; padding: 8px 0; }
#menu .menu-body { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
#menu .kick-row { display: flex; justify-content: space-between; align-items: center; }
