/* Training quiz – one dark look for projector and phones (matches the Haslin training slides). */
:root {
  --bg: #20262e; --panel: #2b323b; --panel2: #353d47; --line: #46505c;
  --fg: #f3f1ec; --muted: #b5bcc5; --accent: #ec7a2e; --accent2: #f59a5b;
  --good: #3fae6a; --bad: #e0574c;
  --a: #d9463d; --b: #2f6fd6; --c: #d99a09; --d: #2e9555;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.brand { font-weight: 700; letter-spacing: .02em; color: var(--accent); }

/* ---------- player (phone) */
.play { min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.play header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.play header .who { color: var(--muted); font-size: 14px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.play main { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.play h1 { font-size: 24px; margin: 0 0 6px; text-wrap: balance; }
.play h2 { font-size: 18px; margin: 0; text-wrap: balance; }
.field { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.field label { font-size: 14px; color: var(--muted); }
.field input { font: inherit; font-size: 20px; padding: 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { border: 0; border-radius: 12px; padding: 14px 20px; font-size: 18px; font-weight: 600; background: var(--accent); color: #1b1f24; }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--bad); min-height: 1.4em; margin: 6px 0 0; }
.qtext { font-size: 18px; font-weight: 600; }
.timer { font-variant-numeric: tabular-nums; color: var(--accent2); font-weight: 700; }
.choices { display: grid; gap: 12px; grid-template-columns: 1fr; }
.choice { display: flex; align-items: center; gap: 14px; text-align: left; min-height: 64px; padding: 12px 14px;
  border: 0; border-radius: 12px; color: #fff; font-size: 16px; font-weight: 600; }
.choice .k { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px;
  background: rgba(0, 0, 0, .22); font-size: 20px; }
.choice[data-i="0"] { background: var(--a); } .choice[data-i="1"] { background: var(--b); }
.choice[data-i="2"] { background: var(--c); } .choice[data-i="3"] { background: var(--d); }
.choice[disabled] { opacity: .35; } .choice.picked { opacity: 1; outline: 4px solid #fff; outline-offset: 2px; }
.big { font-size: 44px; font-weight: 800; line-height: 1.1; }
.result.good { border-color: var(--good); } .result.bad { border-color: var(--bad); }
.result .big { color: var(--good); } .result.bad .big { color: var(--bad); }
.stat { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.stat:first-of-type { border-top: 0; }
.stat b { font-variant-numeric: tabular-nums; }
.choice.sel { outline: 4px solid #fff; outline-offset: 2px; }
.submit { width: 100%; }
.qimg { display: block; width: 100%; margin-top: 12px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #fff; position: relative; cursor: zoom-in; }
.qimg img { display: block; width: 100%; max-height: 34vh; object-fit: contain; }
.qimg span { position: absolute; right: 8px; bottom: 8px; background: rgba(20, 24, 29, .78); color: #fff; font-size: 13px; padding: 3px 9px; border-radius: 999px; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(12, 14, 17, .96); overflow: auto; display: grid; place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 24px); background: #fff; border-radius: 8px; cursor: zoom-in; }
.lightbox.zoom { display: block; }
.lightbox.zoom img { width: 260%; max-width: none; max-height: none; cursor: zoom-out; }
.lbclose { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); color: var(--fg); font-size: 28px; line-height: 1; }
@media (min-width: 640px) { .choices { grid-template-columns: 1fr 1fr; } .play main { max-width: 720px; width: 100%; margin: 0 auto; } }

/* ---------- presenter (projector) */
.host { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.host .top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 28px;
  border-bottom: 3px solid var(--accent); background: var(--panel); }
.host .top .title { font-size: 22px; font-weight: 700; min-width: 0; }
.host .top .meta { display: flex; gap: 20px; color: var(--muted); font-size: 18px; white-space: nowrap; }
.host .stage { padding: 28px clamp(20px, 4vw, 64px); display: flex; flex-direction: column; gap: 24px; min-height: 0; }
.host .bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 28px; background: var(--panel); border-top: 1px solid var(--line); }
.host .bar .btn { font-size: 16px; padding: 10px 16px; }
.host .bar .ghost { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); }
.host .bar .sp { flex: 1; }
.host .bar kbd { font: 12px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.lobby { display: grid; grid-template-columns: minmax(280px, 42%) 1fr; gap: 40px; align-items: start; }
.qrbox { background: #fff; border-radius: 18px; padding: 22px; display: grid; place-items: center; }
.qrbox svg, .qrbox img { width: 100%; height: auto; max-height: 62vh; }
.joinurl { font-size: clamp(20px, 2.4vw, 34px); font-weight: 700; color: var(--accent2); overflow-wrap: anywhere; }
.names { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 20px; }
.hq { font-size: clamp(28px, 3.4vw, 52px); font-weight: 700; line-height: 1.2; text-wrap: balance; }
.hopts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hopt { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: 16px; color: #fff;
  font-size: clamp(18px, 1.9vw, 30px); font-weight: 600; min-height: 110px; position: relative; overflow: hidden; }
.hopt .k { flex: 0 0 auto; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 12px; background: rgba(0, 0, 0, .22); font-size: 30px; }
.hopt[data-i="0"] { background: var(--a); } .hopt[data-i="1"] { background: var(--b); }
.hopt[data-i="2"] { background: var(--c); } .hopt[data-i="3"] { background: var(--d); }
.hopt.dim { opacity: .3; }
.hopt .n { margin-left: auto; font-size: clamp(26px, 2.6vw, 44px); font-weight: 800; font-variant-numeric: tabular-nums; }
.hopt .fill { position: absolute; inset: auto 0 0 0; height: 8px; background: rgba(255, 255, 255, .75); transform-origin: left; }
.hopt.right { outline: 6px solid #fff; outline-offset: 3px; opacity: 1; }
.hopt.right .k::after { content: "✓"; }
.hopt.right .k span { display: none; }
.statusline { display: flex; gap: 28px; align-items: baseline; font-size: clamp(20px, 2vw, 32px); }
.countdown { font-size: clamp(54px, 6vw, 96px); font-weight: 800; color: var(--accent2); font-variant-numeric: tabular-nums; line-height: 1; }
.explain { background: var(--panel); border-left: 6px solid var(--accent); border-radius: 10px; padding: 18px 22px; font-size: clamp(18px, 1.8vw, 28px); }
.lb { display: grid; gap: 10px; max-width: 1100px; width: 100%; }
.lbrow { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 18px; font-size: clamp(20px, 2vw, 32px); }
.lbrow .r { font-weight: 800; color: var(--muted); text-align: center; }
.lbrow .s { font-weight: 800; font-variant-numeric: tabular-nums; }
.lbrow:nth-child(1) { border-color: #d4af37; } .lbrow:nth-child(1) .r { color: #d4af37; }
.lbrow:nth-child(2) .r { color: #c0c0c0; } .lbrow:nth-child(3) .r { color: #cd7f32; }
.setup { max-width: 820px; display: grid; gap: 18px; }
.setup .opt { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px; font-size: 22px; }
.setup .opt .muted { font-size: 16px; }
.setup input[type=number] { width: 90px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.toast { position: fixed; right: 20px; bottom: 78px; background: var(--bad); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 16px; }
.login { max-width: 460px; margin: 12vh auto; }
.sm { font-size: 14px; }
.tag { align-self: center; background: var(--accent); color: #1b1f24; font-weight: 700; border-radius: 999px; padding: 4px 16px; font-size: clamp(16px, 1.4vw, 24px); }
.hq.withimg { font-size: clamp(20px, min(2.6vw, 4.6vh), 42px); }
/* picture questions fill the screen exactly: the picture takes whatever height is left */
/* (sizes follow the screen height too, so a 720p projector fits as well as 1080p) */
.host.fit { height: 100vh; min-height: 0; }
.host.fit .stage { min-height: 0; overflow: hidden; padding-block: clamp(12px, 2.4vh, 28px); gap: clamp(10px, 2vh, 24px); }
.host.fit .countdown { font-size: clamp(40px, min(6vw, 9vh), 96px); }
.host.fit .statusline { font-size: clamp(16px, min(2vw, 3.4vh), 32px); }
.qgrid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: clamp(14px, 2.4vh, 24px); }
.qgrid.reveal { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
.qside { display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 14px); min-width: 0; min-height: 0; overflow: auto; }
.qgrid .hopts { grid-template-columns: 1fr; gap: clamp(8px, 1.4vh, 12px); }
.qgrid .hopt { min-height: 0; gap: 14px; padding: clamp(7px, 1.5vh, 14px) 16px; font-size: clamp(14px, min(1.5vw, 2.7vh), 26px); }
.qgrid .hopt .k { width: clamp(32px, 5.2vh, 46px); height: clamp(32px, 5.2vh, 46px); font-size: clamp(17px, 2.8vh, 24px); }
.qgrid .hopt .n { font-size: clamp(20px, min(2.6vw, 4.4vh), 44px); }
.qgrid.reveal .hopt { padding-block: clamp(6px, 1.1vh, 12px); font-size: clamp(14px, min(1.35vw, 2.5vh), 24px); }
.qgrid .explain { font-size: clamp(14px, min(1.3vw, 2.4vh), 22px); padding: clamp(8px, 1.4vh, 12px) 16px; }
.himg { position: relative; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 14px; background: #fff; cursor: zoom-in; overflow: hidden; }
.himg img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; }
.host-lb, .host-lb img { cursor: zoom-out; }
@media (max-width: 900px) { .lobby { grid-template-columns: 1fr; } .hopts { grid-template-columns: 1fr; } .qgrid { grid-template-columns: 1fr; } }
