:root {
  --bg: #14162b;
  --panel: #20233f;
  --text: #f4f4fb;
  --muted: #a4a7c8;
  --accent: #ffc145;
  --c0: #e4572e;
  --c1: #2e86ab;
  --c2: #d9a404;
  --c3: #3f9f6d;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
h1 { margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.muted { color: var(--muted); }
.c0 { background: var(--c0); }
.c1 { background: var(--c1); }
.c2 { background: var(--c2); }
.c3 { background: var(--c3); }

button { font: inherit; border: 0; cursor: pointer; color: inherit; }
button.primary {
  background: var(--accent);
  color: #241a00;
  font-weight: 700;
  padding: .7em 1.4em;
  border-radius: .5em;
}

/* Shared screen. Sizes follow the viewport, so a TV across the room stays readable. */
.screen { font-size: clamp(16px, 2.2vmin, 40px); }
.screen main { height: 100%; padding: 3vmin 4vmin; }

.lobby { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 5vmin; align-items: center; }
.join { display: flex; flex-direction: column; align-items: center; gap: .4em; text-align: center; }
.qr { width: min(52vmin, 100%); border-radius: .5em; background: #fff; margin-bottom: .6em; }
.url { font-size: 1.4em; font-weight: 600; }
.code { font-size: 3em; font-weight: 800; letter-spacing: .15em; color: var(--accent); }
.roster { display: flex; flex-direction: column; gap: 1em; align-items: flex-start; }
.roster h1 { font-size: 3em; }
.chips { display: flex; flex-wrap: wrap; gap: .5em; }
.chips li { background: var(--panel); padding: .35em .8em; border-radius: 2em; font-size: 1.2em; }
.chips li.away { opacity: .45; }

.question { height: 100%; display: flex; flex-direction: column; gap: 2.5vmin; }
.qhead { display: flex; justify-content: space-between; }
.qtext { font-size: 2.6em; line-height: 1.15; text-align: center; padding: 1vmin 0; }
.bar { height: 1vmin; min-height: 6px; background: var(--panel); border-radius: 1em; overflow: hidden; }
.fill { height: 100%; background: var(--accent); }
.options { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2vmin; }
.option { display: flex; align-items: center; gap: .7em; padding: 0 1em; border-radius: .6em; font-size: 1.7em; font-weight: 600; min-width: 0; }
.letter { font-weight: 800; opacity: .8; }
.otext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.count { font-weight: 800; }
.option.wrong { opacity: .3; }
.option.right { outline: .18em solid var(--text); }
.mini { display: flex; flex-wrap: wrap; gap: .4em 1.6em; justify-content: center; }
.mini li { display: flex; gap: .5em; }

.final { height: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.2em; }
.final h1 { font-size: 3em; color: var(--accent); text-align: center; }
.board { width: min(100%, 30em); flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: .4em; }
.board li { display: flex; justify-content: space-between; background: var(--panel); padding: .5em 1em; border-radius: .4em; font-size: 1.3em; }

/* Phone controller */
.phone { overflow: hidden; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.phone main { height: 100dvh; display: flex; flex-direction: column; }
.phead { display: flex; justify-content: space-between; padding: 12px 16px; background: var(--panel); font-size: 18px; }
.pad { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 8px; padding: 8px; }
.pad button { font-size: 56px; font-weight: 800; border-radius: 12px; }
.pad button:active { filter: brightness(1.25); }
.status { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; font-size: 18px; }
.status h1 { font-size: 34px; }
.status.good { background: var(--c3); }
.status.bad { background: var(--c0); }
.status.good .muted, .status.bad .muted { color: var(--text); }
.joinform { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px; max-width: 420px; width: 100%; margin: 0 auto; }
.joinform h1 { text-align: center; margin-bottom: 8px; }
.joinform input { font: inherit; font-size: 20px; padding: 14px; border-radius: 8px; border: 2px solid var(--panel); background: var(--panel); color: var(--text); }
.joinform input:focus { outline: none; border-color: var(--accent); }
.joinform button { font-size: 20px; }
.error { color: #ff9a85; }
.offline { position: fixed; left: 0; right: 0; bottom: 0; background: var(--c0); text-align: center; padding: 8px; }
