:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1d1b19;
  --muted: #6c675f;
  --line: #e4dfd6;
  --accent: #5b4bdb;
  --accent-ink: #ffffff;
  --good: #1f8a4c;
  --good-bg: #e3f4ea;
  --bad: #c2372b;
  --bad-bg: #fbe7e4;
  --pick: #efeafe;
  --gold: #d79b00;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15141a;
    --card: #201f27;
    --ink: #f1eff7;
    --muted: #a19db0;
    --line: #34323e;
    --accent: #8b7dff;
    --accent-ink: #111;
    --good: #4cc982;
    --good-bg: #183324;
    --bad: #ff7a6b;
    --bad-bg: #3a1d1a;
    --pick: #2d2848;
    --gold: #f2c14e;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 64px; }
main.wide { max-width: 1100px; }
h1 { font-size: 1.6rem; margin: 8px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: .8rem; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .85rem; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.dot.on { background: var(--good); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }

input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 6px; }
.field { margin-bottom: 12px; }

button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  padding: 11px 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
button:hover:not(:disabled) { border-color: var(--accent); }
a.button {
  display: inline-block; text-align: center; text-decoration: none; font-weight: 600;
  border-radius: 10px; padding: 11px 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
a.button:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 500; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }

/* Voting choices */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--card);
  font-weight: 500; position: relative; overflow: hidden;
}
.choice .num {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem; background: var(--bg); border: 1px solid var(--line);
}
.choice .text { flex: 1; position: relative; z-index: 1; }
.choice .count { font-variant-numeric: tabular-nums; font-weight: 700; position: relative; z-index: 1; }
.choice .bar { position: absolute; inset: 0 auto 0 0; background: var(--pick); opacity: .6; transition: width .4s ease; z-index: 0; }
.choice .num { position: relative; z-index: 1; }
.choice.picked { border-color: var(--accent); background: var(--pick); }
.choice.picked .num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.choice.lie { border-color: var(--bad); background: var(--bad-bg); }
.choice.lie .num { background: var(--bad); color: #fff; border-color: var(--bad); }
.choice.truth { opacity: .75; }
.choice .tag { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--bad); position: relative; z-index: 1; }
.choice:disabled { opacity: 1; cursor: default; }
.choices.big .choice { padding: 18px; font-size: 1.05rem; }

.banner { border-radius: 14px; padding: 14px 16px; font-weight: 600; margin-bottom: 14px; }
.banner.good { background: var(--good-bg); color: var(--good); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--pick); color: var(--ink); }

.round-head { margin-bottom: 14px; }
.round-head .kicker { color: var(--accent); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.round-head .subject { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; overflow-wrap: anywhere; }

/* Leaderboard */
table.board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board td, .board th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.board th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.board td.num, .board th.num { text-align: right; width: 1%; white-space: nowrap; }
.board td.name { overflow-wrap: anywhere; }
.board tr.me td { background: var(--pick); font-weight: 700; }
.board tr:last-child td { border-bottom: none; }
.rank { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: .9rem; }
.rank.r1 { background: var(--gold); color: #1d1b19; }
.rank.r2 { background: #c0c4cc; color: #1d1b19; }
.rank.r3 { background: #cf8f5a; color: #1d1b19; }

.podium { text-align: center; padding: 8px 0 16px; }
.podium .trophy { font-size: 3rem; line-height: 1; }
.podium .winner { font-size: 1.8rem; font-weight: 800; margin: 6px 0 2px; overflow-wrap: anywhere; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 10;
}

/* Mod layout */
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 3fr 2fr; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list li .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list button { padding: 4px 10px; font-size: .8rem; }
.chip { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.chip.yes { background: var(--good-bg); color: var(--good); border-color: transparent; }
.joinurl { font-size: 1.2rem; font-weight: 800; color: var(--accent); overflow-wrap: anywhere; }
.lie-buttons button { flex: 1; font-size: 1.05rem; padding: 14px; }

.code-big { font-size: 2.2rem; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.linkbox { display: flex; gap: 8px; margin-top: 8px; }
.linkbox input { font-weight: 600; }
.hero { text-align: center; padding: 28px 20px; }
.hero button.primary { font-size: 1.15rem; padding: 16px 28px; }

/* Voting countdown */
.countdown { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.cd-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.cd-label { font-weight: 600; color: var(--muted); font-size: .9rem; }
.cd-time { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.cd-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.cd-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s linear; }
.countdown.urgent .cd-time { color: var(--bad); }
.countdown.urgent .cd-fill { background: var(--bad); }
.countdown.urgent:not(.done) { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { border-color: var(--bad); } }
@media (prefers-reduced-motion: reduce) { .countdown.urgent { animation: none; } .cd-fill { transition: none; } }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 9px 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.timer-custom { display: inline-flex; align-items: center; gap: 6px; }
.timer-custom input { width: 90px; padding: 8px 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 12px 0 0; }
.check input { width: auto; }

#code::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; }

.podiums { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 8px; }
.podiums .podium { background: var(--bg); border-radius: 14px; padding: 16px 8px; }
.podiums .winner { font-size: 1.35rem; }
@media (max-width: 380px) { .podiums { grid-template-columns: 1fr; } }
.board-title { margin: 18px 0 6px; }
.bad-text { color: var(--bad); font-weight: 600; }
input[aria-invalid="true"] { border-color: var(--bad); }
.topbar .help-link { margin-left: auto; font-size: .9rem; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.topbar .help-link:hover { text-decoration: underline; }
a { color: var(--accent); }

/* End of game */
.you-won { text-align: center; padding: 22px 16px; border-radius: 16px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--pick), var(--good-bg)); border: 2px solid var(--gold); }
.you-won .big { font-size: 2.6rem; line-height: 1; }
.you-won h2 { font-size: 1.7rem; margin: 8px 0 10px; }
.you-won .cats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.you-won .cat { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 800; }
.you-won p { margin: 0; color: var(--muted); }
.game-over { text-align: center; margin-bottom: 12px; }
.game-over h2 { font-size: 1.5rem; margin: 0 0 2px; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .95;
  animation: confetti-fall linear forwards; }
@keyframes confetti-fall {
  to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: .8; }
}
button.end { border-color: var(--gold); }

/* Presenter queue */
.queue { list-style: none; margin: 0; padding: 0; counter-reset: q; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; counter-increment: q; }
.queue li::before { content: counter(q); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: .8rem; background: var(--bg); border: 1px solid var(--line); }
.queue li.next { background: var(--pick); }
.queue li.next::before { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.queue li.chosen { outline: 2px solid var(--accent); }
.queue .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.queue button, .small-btn { padding: 4px 10px; font-size: .8rem; }
.queue .empty { display: block; padding: 4px 0; }
.queue .empty::before { display: none; }
