:root {
  --bg: #15110e; --bg2: #1d1713; --panel: #241c16; --panel2: #2f251d; --line: #3f3228; --line2: #5a483b;
  --text: #f6eee2; --muted: #b3a38e; --faint: #7d6f5e;
  --accent: #e8913a; --accent2: #f2b35e; --ink: #1b120a;
  --good: #4ade80; --bad: #f87171; --gold: #f2c14e;
  --r: 16px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #2a1e14 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
a { color: var(--accent2); }
main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 16px; }
.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
.foot a { color: var(--muted); }

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

/* Brand */
.brand { text-align: center; padding: 22px 0 6px; }
.brand h1 { font-size: clamp(44px, 13vw, 64px); font-weight: 900; letter-spacing: -.035em; }
.brand h1 span { color: var(--accent); }
.brand p { color: var(--muted); margin: 6px 0 0; }
.demo { margin: 18px auto 0; font-size: clamp(22px, 7vw, 30px); font-weight: 800; }

/* Cards and forms */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 20px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field { display: flex; flex-direction: column; gap: 6px; }
input[type=text] {
  width: 100%; font: inherit; font-size: 18px; /* 16px+ stops iOS zooming in */
  color: var(--text); background: var(--bg2); border: 2px solid var(--line2); border-radius: 12px; padding: 14px 14px; outline: none;
}
input[type=text]:focus { border-color: var(--accent); }
input.code { text-transform: uppercase; letter-spacing: .35em; font-weight: 800; font-size: 26px; text-align: center; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; touch-action: manipulation; }
.btn { background: var(--accent); color: var(--ink); font-weight: 800; font-size: 18px; padding: 15px 18px; min-height: 54px; width: 100%; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { filter: grayscale(.8) brightness(.6); cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line2); }
.btn.sm { font-size: 15px; min-height: 42px; padding: 9px 14px; width: auto; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; background: var(--bg2); color: var(--text); border: 2px solid var(--line2); padding: 10px 0; font-weight: 700; }
.seg button.on { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.seg button:disabled { opacity: .6; cursor: default; }

/* Top bar during a game */
.top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); font-weight: 600; }
.top .code-pill { background: var(--panel2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; letter-spacing: .15em; color: var(--text); }
.timer { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s linear; }
.timer.low i { background: var(--bad); }
.secs { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text); }
.secs.low { color: var(--bad); }

/* Prompt */
.prompt { font-weight: 900; font-size: clamp(26px, 8.5vw, 40px); line-height: 1.15; letter-spacing: -.02em; text-align: center; word-break: break-word; padding: 14px 4px; }
.prompt .r { color: var(--faint); }
.prompt .blank { display: inline-block; min-width: 3.2em; border-bottom: .12em solid var(--accent); color: var(--accent); padding: 0 .1em; }
.prompt .blank.fill { min-width: 0; }
.prompt .blank.real { color: var(--good); border-color: var(--good); }
.hint { text-align: center; color: var(--muted); margin-top: -6px; }

/* Lobby */
.qrwrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr { width: 168px; height: 168px; border-radius: 12px; display: block; }
.bigcode { text-align: center; }
.bigcode .lbl { color: var(--muted); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.bigcode .val { font-size: clamp(56px, 20vw, 84px); font-weight: 900; letter-spacing: .14em; line-height: 1; margin: 4px 0 6px; }
.bigcode .url { color: var(--muted); font-size: 15px; }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pl { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.pl .dot, .sc .dot { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #120c07; }
.pl .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pl.off { opacity: .45; }
.pl .tag { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.pl .x { background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 0 4px; }
.pl.done { border-color: var(--good); }
.pl .ok { color: var(--good); font-weight: 800; font-size: 13px; }

/* Voting */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; background: var(--panel); color: var(--text); border: 2px solid var(--line2); padding: 15px 16px; font-size: 19px; font-weight: 700; min-height: 58px; word-break: break-word; }
.opt .sub { display: block; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt.picked { border-color: var(--accent); background: #3a2716; }
.opt:disabled:not(.picked) { opacity: .5; }

/* Reveal */
.rv { background: var(--panel); border: 2px solid var(--line2); border-radius: var(--r); padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 12px; animation: pop .35s ease-out; }
.rv .ans { font-size: clamp(26px, 8vw, 38px); font-weight: 900; word-break: break-word; }
.rv .who { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 4px 10px 4px 4px; background: var(--panel2); font-weight: 700; font-size: 14px; }
.chip .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #120c07; font-weight: 800; }
.verdict { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; animation: pop .35s ease-out; }
.verdict.real { color: var(--good); }
.verdict.fake { color: var(--bad); }
.rv.is-real { border-color: var(--good); box-shadow: 0 0 0 4px rgba(74,222,128,.12); }
.past { display: flex; flex-direction: column; gap: 6px; }
.past div { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); padding: 6px 10px; background: var(--panel); border-radius: 10px; }
.past b { color: var(--text); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* Scores */
.board { display: flex; flex-direction: column; gap: 8px; }
.sc { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.sc .pos { width: 22px; color: var(--faint); font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.sc .nm { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc .gain { color: var(--good); font-weight: 800; font-size: 14px; }
.sc .pts { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.sc.first { border-color: var(--gold); background: #2d2414; }
.winner { text-align: center; padding: 10px 0; }
.winner .lbl { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
.winner .nm { font-size: clamp(34px, 11vw, 52px); font-weight: 900; color: var(--gold); word-break: break-word; }

.wait { text-align: center; color: var(--muted); padding: 8px 0; }
.big-ok { text-align: center; font-size: 22px; font-weight: 800; color: var(--good); }
.status { text-align: center; color: var(--muted); font-size: 14px; }
.banner { background: #3b1d1d; border: 1px solid #6b2b2b; color: #fecaca; padding: 10px 14px; border-radius: 12px; text-align: center; font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #2b1b1b; border: 1px solid #7f2f2f; color: #fde2e2; padding: 12px 16px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 10; }
#toast.info { background: #1e2a20; border-color: #2f6b3f; color: #dcfce7; }

/* Wide screens (host on a TV or laptop): give the prompt room to breathe. */
@media (min-width: 900px) {
  main { max-width: 760px; }
  .prompt { font-size: 52px; }
  .players { grid-template-columns: 1fr 1fr 1fr; }
  .qr { width: 240px; height: 240px; }
}
