/* LiveQuiz. Light, high-contrast theme for bright classrooms and projectors. */
:root {
  --bg: #ffffff; --fg: #111827; --muted: #4b5563; --line: #d1d5db;
  --brand: #1f3a5f; --brand-fg: #ffffff;
  --pick: #1d4ed8; --pick-bg: #dbeafe;
  --good: #047857; --good-bg: #d1fae5; --bad: #b91c1c; --bad-bg: #fee2e2;
  --bar: #94a3b8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.error { color: var(--bad); font-weight: 600; }
.note, .muted { color: var(--muted); }
sup, sub { line-height: 0; }

/* ---------- phone ---------- */
.phone main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.phone h1 { font-size: 1.8rem; margin: .5em 0 .3em; }
#join-form { display: flex; gap: 12px; margin: 16px 0; }
#pin { flex: 1; min-width: 0; font-size: 2rem; letter-spacing: .3em; text-align: center; padding: 12px; border: 2px solid var(--line); border-radius: 12px; }
.big, #join-form button { padding: 14px 22px; font-size: 1.25rem; font-weight: 700; border: 0; border-radius: 12px; background: var(--brand); color: var(--brand-fg); }
.status { font-size: 1.15rem; font-weight: 600; margin: 16px 0; }
.status.good { color: var(--good); } .status.bad { color: var(--bad); }
.qnum { color: var(--muted); margin: 4px 0; font-weight: 600; }
#qtext { font-size: 1.3rem; line-height: 1.4; margin: 4px 0 16px; font-weight: 600; overflow-wrap: anywhere; }
.choices { display: grid; gap: 12px; }
.choice { display: flex; align-items: flex-start; gap: 14px; width: 100%; min-height: 64px; padding: 14px 16px; text-align: left; font-size: 1.12rem; line-height: 1.35;
  color: var(--fg); background: #f9fafb; border: 3px solid var(--line); border-radius: 14px; touch-action: manipulation; overflow-wrap: anywhere; }
.choice .letter { flex: none; width: 2.1em; height: 2.1em; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--brand-fg); font-weight: 800; }
.choice .ctext { padding-top: .25em; }
.choice.picked { border-color: var(--pick); background: var(--pick-bg); }
.choice.picked .letter { background: var(--pick); }
.choice:disabled { opacity: 1; cursor: default; }
.choice.correct { border-color: var(--good); background: var(--good-bg); }
.choice.correct .letter { background: var(--good); }
.choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice.wrong .letter { background: var(--bad); }
.choice:disabled:not(.correct):not(.wrong) { color: var(--muted); }
.why { margin-top: 12px; padding: 12px 16px; border-left: 5px solid var(--brand); background: #f3f4f6; border-radius: 6px; }
.score { font-size: 1.4rem; text-align: center; } .score b { font-size: 3.5rem; }
.conn { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px; text-align: center; background: #fef3c7; color: #92400e; font-weight: 700; }

/* ---------- presenter (1920x1080, read from the back) ---------- */
.presenter { font-size: 22px; }
.presenter #login, .presenter #setup { max-width: 1100px; margin: 40px auto; padding: 0 16px; }
.presenter input, .presenter select { padding: 8px 12px; border: 2px solid var(--line); border-radius: 8px; }
.presenter button { padding: 10px 18px; border: 2px solid var(--brand); border-radius: 10px; background: #fff; color: var(--brand); font-weight: 600; }
.presenter button.primary { background: var(--brand); color: var(--brand-fg); font-size: 1.2em; padding: 14px 32px; }
.presenter button:disabled { opacity: .5; cursor: default; }
.qlist { font-size: .8em; max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 8px 8px 3em; }
.qlist li { margin: 4px 0; }
#live { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; gap: 24px; padding: 12px 32px; background: var(--brand); color: var(--brand-fg); font-size: 1.1em; }
.topbar b { font-size: 1.15em; }
.lobby { flex: 1; display: flex; align-items: center; justify-content: center; gap: 80px; padding: 32px; }
.qr { background: #fff; padding: 16px; border: 1px solid var(--line); }
.qr img, .qr canvas { display: block; }
.biglabel { margin: 0; color: var(--muted); font-size: 1.4em; }
.bigurl { margin: 0 0 32px; font-size: 2.4em; font-weight: 700; }
.bigpin { margin: 0; font-size: 7em; font-weight: 800; letter-spacing: .12em; line-height: 1.1; }
.devices { font-size: 1.5em; margin-top: 24px; }
#stage, #final { flex: 1; padding: 32px 64px; }
.presenter #qtext { font-size: 2.3em; line-height: 1.3; margin: 0 0 32px; }
.pchoices { display: grid; gap: 18px; }
.pchoice { display: grid; grid-template-columns: 2.4em 1fr 22% 2.5em; align-items: center; gap: 20px; padding: 14px 20px; font-size: 1.7em; border: 3px solid var(--line); border-radius: 14px; }
.pchoice .letter { width: 2.1em; height: 2.1em; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.pchoice .bar { display: block; height: 1.1em; border-radius: 6px; }
.pchoice .fill { display: block; height: 100%; width: 0; background: var(--bar); border-radius: 6px; transition: width .4s; }
.pchoice .count { font-weight: 800; text-align: right; }
.pchoice.correct { border-color: var(--good); background: var(--good-bg); }
.pchoice.correct .letter, .pchoice.correct .fill { background: var(--good); }
.pchoice.revealed:not(.correct) { color: var(--muted); }
.answered { font-size: 1.8em; font-weight: 700; margin: 28px 0 0; }
#pwhy { font-size: 1.35em; }
.summary { list-style: none; padding: 0; columns: 3; font-size: 1.3em; }
.controls { display: flex; align-items: center; gap: 16px; padding: 14px 32px; border-top: 1px solid var(--line); }
.controls .hint { color: var(--muted); font-size: .8em; }
.controls .spacer { flex: 1; }

/* ---------- math (KaTeX) ---------- */
.math-display { display: block; margin: .4em 0; }
.katex-display { margin: .2em 0; overflow-x: auto; overflow-y: hidden; padding: .1em 0; }
.choice .katex, .pchoice .katex { font-size: 1.1em; }
