:root {
  --bg1: #1c0f36; --bg2: #3b1468; --card: rgba(255, 255, 255, .08); --line: rgba(255, 255, 255, .15);
  --text: #fff; --muted: rgba(255, 255, 255, .72);
  --fox: #ff7a1a; --fox-dark: #b84d00; --sun: #ffd23f; --ok: #22c47a; --bad: #ff4d6d;
  --a0: #e8384f; --a1: #2d7ff9; --a2: #e09a00; --a3: #1fae68;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased;
  background: radial-gradient(1100px 600px at 0% -10%, #5c1f92 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 0%, #8c2a5e 0%, transparent 55%), linear-gradient(160deg, var(--bg1), var(--bg2));
  background-color: var(--bg1); background-attachment: fixed;
}
a { color: var(--sun); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.1; }
.hide { display: none !important; }
.muted { color: var(--muted); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; }
.logo { font-weight: 900; font-size: 1.4rem; text-decoration: none; color: #fff; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em; border: 0; border-radius: 14px;
  padding: .75em 1.3em; font-weight: 800; font-size: 1.05rem; cursor: pointer; text-decoration: none;
  background: var(--fox); color: #fff; box-shadow: 0 5px 0 var(--fox-dark); transition: transform .06s, box-shadow .06s, filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--fox-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: rgba(255, 255, 255, .12); box-shadow: 0 5px 0 rgba(0, 0, 0, .3); }
.btn.small { font-size: .9rem; padding: .5em .9em; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.btn.big { font-size: clamp(1.1rem, 2.2vw, 1.7rem); padding: .75em 1.6em; }
input, textarea, select {
  width: 100%; background: rgba(0, 0, 0, .28); border: 2px solid var(--line); border-radius: 12px; padding: .7em .9em; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--fox); }
textarea { resize: vertical; min-height: 7.5em; }
label { font-weight: 700; font-size: .9rem; color: var(--muted); display: grid; gap: 6px; }
.opt0 { background: var(--a0); } .opt1 { background: var(--a1); } .opt2 { background: var(--a2); } .opt3 { background: var(--a3); }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ok); color: #fff; font-weight: 800; padding: .7em 1.2em; border-radius: 14px; z-index: 10; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.error { color: #ffb3c0; font-weight: 700; }
.spin { display: inline-block; animation: wob 1s ease-in-out infinite; }
@keyframes wob { 50% { transform: rotate(14deg) scale(1.15); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Landing / create ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0; flex-wrap: wrap; }
.joinbar { display: flex; gap: 8px; align-items: center; }
.joinbar span { font-weight: 700; color: var(--muted); white-space: nowrap; }
.joinbar input { width: 7.5em; text-transform: uppercase; letter-spacing: .15em; font-weight: 800; text-align: center; padding: .55em .6em; }
.hero h1 { font-size: clamp(2.2rem, 6.5vw, 4.4rem); margin: .35em 0 .25em; }
.hero p { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--muted); max-width: 40em; margin: 0 0 1.5rem; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: transparent; border: 2px solid var(--line); border-radius: 999px; padding: .5em 1em; font-weight: 800; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { background: #fff; color: var(--bg1); border-color: #fff; }
.form { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tpl { text-align: left; cursor: pointer; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); border-radius: 16px; padding: 14px; font-weight: 800; display: grid; gap: 4px; }
.tpl:hover { border-color: var(--fox); }
.tpl small { font-weight: 600; color: var(--muted); }
.qedit { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.qedit .head { display: flex; gap: 8px; align-items: center; }
.qedit .head b { color: var(--muted); }
.qedit .opt { display: flex; gap: 8px; align-items: center; }
.qedit .opt input[type="radio"] { width: 1.4rem; height: 1.4rem; flex: none; accent-color: var(--ok); }
.qedit .opt i { width: 8px; align-self: stretch; border-radius: 6px; flex: none; }
.qlist { display: grid; gap: 12px; margin: 16px 0; }
.sticky { position: sticky; bottom: 0; padding: 12px 0; display: flex; gap: 10px; flex-wrap: wrap; background: linear-gradient(transparent, var(--bg1) 35%); }
section { margin: 56px 0; }
section h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin: 0 0 16px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; counter-reset: s; }
.steps .card::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--fox); font-weight: 900; margin-bottom: 8px; }
.prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.prices .card b { font-size: 1.8rem; display: block; margin: 4px 0; }
.prices .card.hot { border-color: var(--fox); box-shadow: 0 0 0 2px var(--fox) inset; }
details { border-bottom: 1px solid var(--line); padding: 12px 0; }
summary { font-weight: 800; cursor: pointer; }
footer { padding: 24px 0 40px; color: var(--muted); font-size: .9rem; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Host screen (TV / projector) ---------- */
.host main { min-height: 100vh; display: flex; flex-direction: column; padding: 2.5vh 3vw; gap: 2.5vh; }
.hbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hbar .pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .4em 1em; font-weight: 800; }
.lobby { flex: 1; display: grid; grid-template-columns: auto 1fr; gap: 4vw; align-items: center; }
.qr { background: #fff; padding: 14px; border-radius: 22px; width: min(40vh, 36vw); aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; }
.joinurl { font-size: clamp(1.2rem, 2.6vw, 2.2rem); font-weight: 800; color: var(--muted); }
.joinurl b { color: #fff; }
.code { font-size: clamp(3rem, 11vw, 10rem); font-weight: 900; letter-spacing: .08em; line-height: 1; margin: 1vh 0 3vh; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 30vh; overflow: auto; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .35em .95em; font-weight: 800; font-size: clamp(.95rem, 1.6vw, 1.3rem); cursor: pointer; }
.chip.new { animation: pop .3s ease-out; }
.chip.off { opacity: .45; }
.chip.kick { background: var(--bad); border-color: var(--bad); }
.upsell { border-color: var(--sun); display: grid; gap: 10px; }
.upsell .row > * { flex: 1 1 220px; }
.question { font-size: clamp(1.6rem, 4.4vw, 3.8rem); font-weight: 900; text-align: center; line-height: 1.15; margin: auto 0; padding: 0 2vw; text-wrap: balance; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6vh 1.2vw; }
.answer { border-radius: 18px; padding: 2.2vh 1.4vw; font-size: clamp(1rem, 2.5vw, 2.1rem); font-weight: 800; display: flex; align-items: center; gap: .7em; min-height: 12vh; transition: opacity .3s, transform .3s; }
.answer .shape { font-size: 1.2em; opacity: .9; }
.answer .count { margin-left: auto; font-size: 1.2em; }
.answer.dim { opacity: .28; }
.answer.right { transform: scale(1.03); box-shadow: 0 0 0 5px #fff; }
.timer { --p: 1; width: clamp(64px, 9vw, 120px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--sun) calc(var(--p) * 1turn), rgba(255, 255, 255, .12) 0); flex: none; }
.timer span { background: var(--bg1); width: 80%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: clamp(1.4rem, 3.2vw, 2.8rem); }
.split { flex: 1; display: grid; grid-template-columns: 1.4fr 1fr; gap: 3vw; align-items: start; }
.board { display: grid; gap: 8px; }
.board .r { display: flex; justify-content: space-between; gap: 12px; background: var(--card); border-radius: 14px; padding: .55em 1em; font-weight: 800; font-size: clamp(1rem, 2vw, 1.6rem); animation: pop .35s ease-out both; }
.board .r:first-of-type { background: rgba(255, 210, 63, .25); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 2vw; margin-top: auto; }
.podium > div { text-align: center; font-weight: 900; font-size: clamp(1rem, 2.2vw, 1.8rem); width: min(22vw, 260px); }
.podium .step { border-radius: 18px 18px 0 0; display: grid; place-items: center; font-size: clamp(2rem, 6vw, 5rem); margin-top: 1vh; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* ---------- Player screen (phone) ---------- */
.play main { min-height: 100svh; display: flex; flex-direction: column; padding: 16px; gap: 14px; max-width: 560px; margin: 0 auto; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; }
.center h1 { margin: 0; font-size: 2rem; }
.huge { font-size: 4.5rem; line-height: 1; animation: pop .4s ease-out; }
.pad { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pad button { border: 0; border-radius: 18px; color: #fff; font-weight: 800; font-size: 1.05rem; padding: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; box-shadow: 0 6px 0 rgba(0, 0, 0, .3); cursor: pointer; }
.pad button:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.pad .shape { font-size: 2rem; }
.qtext { font-weight: 800; font-size: 1.15rem; text-align: center; }
.score { font-size: 1.3rem; font-weight: 800; }
.status { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .6); padding: .3em .9em; border-radius: 999px; font-size: .85rem; }

@media (max-width: 760px) {
  .lobby, .split { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .qr { width: min(70vw, 320px); }
  .answers { grid-template-columns: 1fr; }
}

/* ---------- Legal pages ---------- */
.legal { max-width: 780px; padding-bottom: 48px; }
.legal h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .5em 0 .2em; }
.legal h2 { font-size: 1.25rem; margin: 1.8em 0 .4em; }
.legal h3 { font-size: 1.05rem; margin: 1.4em 0 .3em; }
.legal p, .legal li { color: rgba(255, 255, 255, .88); }
.legal ul.plain { list-style: none; padding-left: 0; }
.legal hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0 8px; }
.legal ol.qa li { margin-bottom: 10px; }
.compare { width: 100%; border-collapse: collapse; margin: 16px 0; }
.compare th, .compare td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }
.compare tr > :nth-child(2) { color: var(--sun); font-weight: 800; }
