/* QuizCast: one stylesheet for every page. Dark "studio" look that reads well on a TV across a room. */
:root {
  --bg: #0d1330;
  --bg2: #151d45;
  --card: #1c2655;
  --line: #2c3a78;
  --ink: #f4f6ff;
  --muted: #a9b2dd;
  --accent: #ffcc33;
  --good: #2ed47a;
  --bad: #ff5a6a;
  --a: #e8475f;
  --b: #2f80ed;
  --c: #f2a60c;
  --d: #27ae60;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 700px at 20% -10%, #24306e 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 480px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: 1080px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: .3px; color: var(--ink); text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
.brand b { color: var(--accent); }
nav.links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
nav.links a { color: var(--muted); text-decoration: none; font-weight: 600; }
nav.links a:hover { color: var(--ink); }
h1 { font-size: clamp(28px, 5vw, 46px); line-height: 1.1; margin: 8px 0 10px; }
h2 { font-size: 22px; margin: 26px 0 10px; }
h3 { margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #1a1400; border: 0; border-radius: 999px; padding: 12px 22px;
  font-weight: 800; cursor: pointer; text-decoration: none; min-height: 46px;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { padding: 6px 14px; min-height: 34px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 46px;
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 2px; }
.msg { margin: 10px 0 0; min-height: 1.2em; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--good); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hide { display: none !important; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pill.live { color: var(--good); border-color: var(--good); }
.pill.draft { color: var(--accent); border-color: var(--accent); }
.pill.retired { color: var(--bad); border-color: var(--bad); }
table.board { width: 100%; border-collapse: collapse; }
table.board td, table.board th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.board td.num, table.board th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.tabs button[aria-pressed=true] { background: var(--accent); color: #1a1400; border-color: var(--accent); }
footer { color: var(--muted); font-size: 14px; padding: 30px 16px; text-align: center; }
footer a { color: var(--muted); }
.hero { display: grid; gap: 20px; grid-template-columns: 1.2fr 1fr; align-items: center; padding: 10px 0 20px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
.cat-tile h3 { font-size: 19px; }
.top3 { list-style: none; padding: 0; margin: 10px 0; }
.top3 li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.top3 li:last-child { border: 0; }
.venue-cta { background: linear-gradient(120deg, #3a2a00, #5a3f00); border-color: #8a6a10; }

/* ---------- Answer letters and colors (shape + letter, never color alone) ---------- */
.ans { --c0: var(--a); }
.ans.b1 { --c0: var(--b); }
.ans.b2 { --c0: var(--c); }
.ans.b3 { --c0: var(--d); }

/* ---------- TV ---------- */
body.tv { overflow: hidden; height: 100vh; }
.tv-stage { height: 100vh; display: flex; flex-direction: column; padding: 3vh 4vw; gap: 2.5vh; }
.tv-bar { display: flex; justify-content: space-between; align-items: center; font-size: 2.4vh; color: var(--muted); }
.tv-bar .brand { font-size: 3vh; }
.tv-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3vh; min-height: 0; }
.tv-q { font-size: 5.2vh; font-weight: 800; line-height: 1.2; text-align: center; max-width: 85vw; margin: 0 auto; }
.tv-ans { display: grid; grid-template-columns: 1fr 1fr; gap: 2vh 2vw; }
.tv-ans .ans { display: flex; align-items: center; gap: 2vw; background: var(--card); border: .5vh solid var(--c0); border-radius: 2vh; padding: 2.2vh 2vw; font-size: 3.6vh; font-weight: 700; transition: transform .4s, opacity .4s, background .4s; }
.tv-ans .ans .L { flex: none; width: 7vh; height: 7vh; border-radius: 50%; background: var(--c0); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 4vh; }
.tv-ans .ans .pct { margin-left: auto; font-size: 3vh; color: var(--muted); }
.tv-ans .ans.right { background: #11402a; border-color: var(--good); transform: scale(1.03); }
.tv-ans .ans.right .L { background: var(--good); }
.tv-ans .ans.wrong { opacity: .45; }
.timer { height: 1.6vh; background: var(--bg2); border-radius: 1vh; overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.tv-foot { display: flex; justify-content: space-between; align-items: center; font-size: 2.6vh; color: var(--muted); }
.tv-big { font-size: 9vh; font-weight: 900; letter-spacing: 1vh; color: var(--accent); }
.tv-lobby { display: grid; grid-template-columns: auto 1fr; gap: 5vw; align-items: center; }
.tv-lobby .qr { background: #fff; border-radius: 2vh; padding: 1.5vh; width: 42vh; height: 42vh; }
.tv-lobby .qr img { width: 100%; height: 100%; display: block; }
.tv-names { display: flex; flex-wrap: wrap; gap: 1.2vh; margin-top: 2vh; max-height: 30vh; overflow: hidden; }
.tv-names span { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .8vh 2vh; font-size: 2.8vh; animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.tv-rank { list-style: none; padding: 0; margin: 0 auto; width: min(70vw, 900px); font-size: 3.6vh; }
.tv-rank li { display: flex; gap: 2vw; padding: 1.2vh 2vw; border-radius: 1.4vh; background: var(--card); margin: 1vh 0; }
.tv-rank li b { width: 5vh; color: var(--accent); }
.tv-rank li span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; }
.tv-why { text-align: center; font-size: 2.8vh; color: var(--muted); }
.tv-center { text-align: center; }
.tv-center .tv-q { margin-bottom: 2vh; }

/* ---------- Phone (player) ---------- */
body.phone { min-height: 100svh; }
.p-stage { max-width: 520px; margin: 0 auto; padding: 16px; min-height: 100svh; display: flex; flex-direction: column; gap: 14px; }
.p-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 15px; }
.p-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; }
.p-buttons button { border: 0; border-radius: 18px; background: var(--c0); color: #fff; font-weight: 800; font-size: 18px; padding: 14px; min-height: 120px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.p-buttons button .L { font-size: 40px; line-height: 1; }
.p-buttons button .T { font-size: 15px; font-weight: 600; opacity: .95; }
.p-buttons button.chosen { outline: 5px solid #fff; outline-offset: -5px; transform: scale(.98); }
.p-buttons button.dim { opacity: .35; }
.p-big { font-size: 34px; font-weight: 900; text-align: center; }
.p-result { text-align: center; padding: 24px 12px; border-radius: 18px; }
.p-result.right { background: #11402a; }
.p-result.wrong { background: #4a1420; }
.p-score { text-align: center; color: var(--muted); }
.p-timer { height: 10px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.p-timer i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.mt { margin-top: 16px; }
.mt2 { margin-top: 26px; }
.full { width: 100%; }
.center { margin-left: auto; margin-right: auto; }
.narrow.center { max-width: 480px; }
.lead { font-size: 18px; }
.code-input { text-transform: uppercase; font-size: 28px !important; letter-spacing: 8px; text-align: center; }
.tv-lobby .tv-q, .tv-lobby .tv-why { text-align: left; margin-left: 0; }
