:root {
  --bg: #0b0b1a;
  --bg2: #15152e;
  --panel: #1c1c3a;
  --line: #2d2d5a;
  --text: #f2f2ff;
  --muted: #9a9ac4;
  --accent: #ffd166;
  --hot: #ff2e63;
  --good: #06d6a0;
  --bad: #ff4d6d;
  --blue: #4cc9f0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #2a1b5e 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.accent { color: var(--accent); }
.center { text-align: center; }

.btn {
  font: inherit; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border: 0; border-radius: 14px; padding: 14px 20px; cursor: pointer;
  color: #1a1030; background: var(--accent); box-shadow: 0 6px 0 #b8902e;
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8902e; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.hot { background: var(--hot); color: #fff; box-shadow: 0 6px 0 #a3153d; }
.btn.hot:active { box-shadow: 0 2px 0 #a3153d; }
.btn.ghost { background: var(--panel); color: var(--text); box-shadow: 0 4px 0 #0a0a1c; border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: .8rem; border-radius: 8px; box-shadow: none; }
.btn.big { font-size: 1.4rem; padding: 22px 28px; width: 100%; }

input[type=text], input[type=number] {
  font: inherit; color: var(--text); background: var(--bg2); border: 2px solid var(--line);
  border-radius: 10px; padding: 12px 14px; width: 100%;
}
input:focus { outline: none; border-color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); }

.option {
  display: flex; align-items: center; gap: .8em; text-align: left;
  background: var(--bg2); border: 2px solid var(--line); border-radius: 14px; padding: .7em 1em;
  color: var(--text); font: inherit; font-weight: 600; width: 100%;
}
.option .letter {
  flex: none; width: 1.9em; height: 1.9em; border-radius: 50%; display: grid; place-items: center;
  background: var(--line); font-weight: 800;
}
.option.chosen { border-color: var(--accent); background: #2b2550; }
.option.good { border-color: var(--good); background: #0b3b34; }
.option.good .letter { background: var(--good); color: #04251f; }
.option.bad { border-color: var(--bad); background: #43162a; }
.option.hint { border-color: var(--blue); box-shadow: 0 0 0 3px #4cc9f044, 0 0 24px #4cc9f066; animation: pulse 1s infinite; }
.option.dim { opacity: .55; }
button.option { cursor: pointer; }
button.option:active { transform: scale(.98); }

@keyframes pulse { 50% { box-shadow: 0 0 0 6px #4cc9f044, 0 0 36px #4cc9f099; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slidein { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes flash { 0% { color: var(--bad); transform: scale(1.15); } 100% { color: var(--accent); transform: scale(1); } }
.pop { animation: pop .5s both; }
.slidein { animation: slidein .5s both; }
.shake { animation: shake .6s; }

/* ---------- TV display ---------- */
body.tv { font-size: calc(11px + .75vw); overflow: hidden; }
#app.tvgrid { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.tv header { display: flex; align-items: center; justify-content: space-between; padding: .6em 1.5em; gap: 1em; }
.tv .logo { font-weight: 900; letter-spacing: .15em; font-size: 1.6em; color: var(--hot); text-shadow: 0 0 22px #ff2e6388; }
.tv .logo.mega { font-size: 6em; margin: 0; }
.tv .round { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.tv .potbox { text-align: right; }
.tv .potbox .label { font-size: .6em; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.tv .pot { font-size: 2.4em; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; text-shadow: 0 0 24px #ffd16655; }
.tv main { padding: .5em 3em; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: .6em; min-height: 0; }
.tv .big { font-size: 3em; font-weight: 900; line-height: 1.1; }
.tv .huge { font-size: 5em; font-weight: 900; line-height: 1; }
.tv .qtext { font-size: 2.1em; font-weight: 800; line-height: 1.2; max-width: 22em; }
.tv .who { font-size: 1.2em; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.tv .options { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; width: min(60em, 100%); font-size: 1.2em; }
.tv .rules { text-align: left; font-size: 1em; max-width: 34em; line-height: 1.5; }
.tv .rules li { margin: .35em 0; }
.tv footer { display: flex; justify-content: center; gap: 1em; padding: .8em 1em 1.2em; }
.chip {
  min-width: 11em; padding: .5em 1em; border-radius: 14px; background: var(--panel);
  border: 3px solid var(--line); text-align: center; font-weight: 800; transition: .25s;
}
.chip small { display: block; font-weight: 600; color: var(--muted); font-size: .6em; letter-spacing: .1em; text-transform: uppercase; min-height: 1.2em; }
.chip.active { transform: translateY(-.3em) scale(1.06); box-shadow: 0 0 30px var(--c); border-color: var(--c); }
.chip.out { opacity: .3; text-decoration: line-through; }
.chip.off { opacity: .65; }
.seat { display: inline-block; min-width: 10em; margin: .3em; padding: .5em 1em; border-radius: 14px; border: 3px dashed var(--line); font-weight: 800; color: var(--muted); }
.seat.filled { border-style: solid; color: var(--text); }
.url { font-size: 1.6em; font-weight: 800; background: var(--panel); border: 2px solid var(--line); padding: .3em .8em; border-radius: 14px; color: var(--accent); }
table.stats { border-collapse: collapse; font-size: 1.1em; min-width: 30em; }
table.stats th { color: var(--muted); text-transform: uppercase; font-size: .6em; letter-spacing: .1em; padding: .3em .8em; }
table.stats td { padding: .5em .8em; font-weight: 800; border-top: 1px solid var(--line); }
table.stats tr.win td { color: var(--accent); }
.penrow { font-size: 1.1em; padding: .4em 1em; background: var(--panel); border-left: 6px solid var(--bad); border-radius: 8px; margin: .3em 0; text-align: left; animation: slidein .4s both; }
.penpot { font-size: 5em; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.penpot.hit { animation: flash .6s; }

/* ---------- phone ---------- */
body.phone #app { max-width: 520px; margin: 0 auto; padding: 14px 16px 32px; display: flex; flex-direction: column; gap: 14px; min-height: 100vh; }
.phone .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.phone .me { font-weight: 800; }
.phone .potsm { font-weight: 900; color: var(--accent); font-size: 1.2rem; }
.phone .q { font-size: 1.3rem; font-weight: 800; line-height: 1.25; }
.phone .options { display: grid; gap: 10px; }
.phone .big { font-size: 1.8rem; font-weight: 900; line-height: 1.15; }
.accuse-btn {
  font: inherit; font-weight: 900; font-size: 2.2rem; letter-spacing: .06em; color: #fff; background: var(--hot);
  border: 0; border-radius: 24px; padding: 54px 10px; width: 100%; box-shadow: 0 10px 0 #a3153d; cursor: pointer;
}
.accuse-btn:active { transform: translateY(8px); box-shadow: 0 2px 0 #a3153d; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--line); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- host ---------- */
body.host #app { padding: 16px; }
.hostgrid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; max-width: 1200px; margin: 0 auto; }
@media (max-width: 800px) { .hostgrid { grid-template-columns: 1fr; } }
.host .phase { font-size: .8rem; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); font-weight: 800; }
.host .col { display: flex; flex-direction: column; gap: 16px; }
.host .row { display: flex; gap: 8px; align-items: center; }
.host .row > label { flex: 1; font-size: .85rem; color: var(--muted); }
.host .row input { width: 110px; padding: 6px 8px; }
.host .secret { border: 2px dashed var(--hot); border-radius: 12px; padding: 12px; }
.host table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.host td, .host th { padding: 4px 6px; text-align: left; }
.host th { color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.linklist a { display: block; margin: 10px 0; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.2rem; }

.answerbox { font-size: 2.6em; font-weight: 900; padding: .25em .9em; border-radius: 18px; background: var(--bg2); border: 3px solid var(--line); max-width: 90%; word-break: break-word; }
.answerbox.good { border-color: var(--good); background: #0b3b34; }
.pulse-text { animation: pulsefade 1.4s infinite; }
@keyframes pulsefade { 50% { opacity: .35; } }

.chip.accusing { background: #ffe600; color: #1a1400; border-color: #fff27a; box-shadow: 0 0 40px 8px #ffe600aa; transform: translateY(-.3em) scale(1.1); animation: buzzflash .5s 2; }
.chip.accusing small { color: #3d3300; font-weight: 800; }
@keyframes buzzflash { 50% { box-shadow: 0 0 70px 20px #ffe600; } }
.sndhint { position: fixed; right: 12px; bottom: 12px; background: #000a; padding: 6px 12px; border-radius: 999px; font-size: .8rem; color: var(--muted); z-index: 9; }
.chip.accusing span { color: #1a1400 !important; }

.joinrow { display: flex; align-items: center; justify-content: center; gap: 1.5em; }
.qr { width: 11em; height: 11em; background: #fff; border-radius: 14px; padding: .4em; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.joininfo { display: flex; flex-direction: column; gap: .4em; text-align: left; }

.roomcode { font-size: 3.2em; font-weight: 900; letter-spacing: .25em; color: var(--accent); line-height: 1; text-shadow: 0 0 24px #ffd16655; }

.pencheat { min-height: 1.6em; font-size: 2.2em; font-weight: 900; }
