:root {
  --bg1: #24083a;
  --bg2: #4b136b;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.16);
  --text: #fff7fb;
  --muted: #d9c3e6;
  --pink: #ff4fa3;
  --yellow: #ffd23f;
  --mint: #3ee0b0;
  --blue: #5b8cff;
  --red: #ff5a5f;
  --good: #3ee0b0;
  --bad: #ff6b7a;
  --radius: 22px;
  --font: 'Fredoka', 'Baloo 2', ui-rounded, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 79, 163, 0.35), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(62, 224, 176, 0.22), transparent 45%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }

/* ---------- shared bits ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--card-strong); font-weight: 600; white-space: nowrap;
}
.pill.coins { background: var(--yellow); color: #3a2400; }
.btn {
  border: 0; border-radius: 16px; padding: 14px 22px;
  font-size: 1.1rem; font-weight: 700; color: #2a0b3d;
  background: var(--yellow); box-shadow: 0 5px 0 #b38f12;
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b38f12; }
.btn.pink { background: var(--pink); color: #fff; box-shadow: 0 5px 0 #b02a6d; }
.btn.mint { background: var(--mint); box-shadow: 0 5px 0 #1f9474; }
.btn.ghost { background: var(--card-strong); color: var(--text); box-shadow: none; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.big { width: 100%; padding: 18px; font-size: 1.3rem; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
h1, h2, h3 { margin: 0 0 10px; line-height: 1.15; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--muted); font-weight: 600; }

.lolly {
  width: 120px; height: 160px; margin: 0 auto; position: relative;
}
.lolly .head {
  width: 120px; height: 120px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--pink) 0 30deg, #fff 30deg 60deg);
  box-shadow: inset -10px -10px 0 rgba(0,0,0,.12), 0 8px 30px rgba(255,79,163,.45);
  animation: spin 9s linear infinite;
}
.lolly .stick { width: 14px; height: 60px; margin: -6px auto 0; background: #f3e9ff; border-radius: 0 0 8px 8px; }
.lolly .note { position: absolute; font-size: 28px; animation: floaty 2.4s ease-in-out infinite; }
.lolly .note.n1 { left: -26px; top: 10px; }
.lolly .note.n2 { right: -24px; top: 40px; animation-delay: .8s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%,100% { transform: translateY(0); opacity: .6 } 50% { transform: translateY(-14px); opacity: 1 } }

/* quiz answer colours + shapes (shape = no colour-only meaning) */
.opt-0 { --oc: #ff4fa3; --os: #b02a6d; }
.opt-1 { --oc: #5b8cff; --os: #2f55b8; }
.opt-2 { --oc: #ffd23f; --os: #b38f12; }
.opt-3 { --oc: #3ee0b0; --os: #1f9474; }
.shape { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(0,0,0,.18); font-size: 18px; flex: none; }

.bar { height: 14px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--pink); border-radius: 999px; transition: width .4s; }

.delta-pos { color: var(--good); font-weight: 700; }
.delta-neg { color: var(--bad); font-weight: 700; }

/* ======================= PLAYER (phone) ======================= */
.player { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.player header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.player header .name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player main { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.stepline { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }

.join-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; text-align: center; }
.join-wrap h1 { font-size: 2.2rem; }
.input {
  width: 100%; padding: 16px 18px; font-size: 1.2rem; font-family: inherit;
  border-radius: 16px; border: 2px solid var(--line); background: rgba(255,255,255,.1); color: var(--text);
  outline: none; text-align: center;
}
.input:focus { border-color: var(--yellow); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  border: 2px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 18px; padding: 14px 10px; font-size: 1rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.choice .emo { font-size: 2rem; }
.choice.sel { border-color: var(--yellow); background: rgba(255,210,63,.18); box-shadow: 0 0 0 3px rgba(255,210,63,.25); }

.answers { display: grid; grid-template-columns: 1fr; gap: 10px; }
.answer {
  border: 0; border-radius: 18px; padding: 16px; min-height: 64px;
  background: var(--oc); box-shadow: 0 5px 0 var(--os); color: #1d0630;
  font-size: 1.1rem; font-weight: 700; text-align: left; display: flex; gap: 12px; align-items: center;
}
.answer:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--os); }
.answer.dim { opacity: .3; }
.answer.picked { outline: 4px solid #fff; }
.answer.right { opacity: 1; outline: 4px solid #fff; }
.timer { height: 10px; border-radius: 999px; background: rgba(255,255,255,.14); overflow: hidden; }
.timer > i { display: block; height: 100%; background: var(--yellow); transition: width .25s linear; }
.qtext { font-size: 1.35rem; font-weight: 700; }

.result { text-align: center; padding: 26px 18px; }
.result .big { font-size: 3.2rem; line-height: 1; margin-bottom: 8px; }

.comp { display: flex; flex-direction: column; gap: 8px; }
.comp h3 { font-size: 1.05rem; margin: 0; }
.opt {
  border: 2px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 14px; padding: 12px 14px; text-align: left; font-size: 1rem; font-weight: 600;
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.opt.sel { border-color: var(--yellow); background: rgba(255,210,63,.16); }
.opt small { font-weight: 600; color: var(--muted); white-space: nowrap; text-align: right; }
.sticky-bottom { position: sticky; bottom: 10px; z-index: 5; }
.summary { background: #2c0c45; border: 2px solid var(--yellow); }

.history { display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
.history div { display: flex; gap: 10px; }
.history .d { min-width: 52px; text-align: right; }

.event-card { text-align: center; padding: 22px; }
.event-card .emo { font-size: 3.4rem; }

.toast {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%) translateY(-250%);
  padding: 12px 22px; border-radius: 999px; font-size: 1.3rem; font-weight: 700;
  background: var(--mint); color: #062b22; z-index: 50; transition: transform .35s cubic-bezier(.2,1.4,.4,1);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.toast.neg { background: var(--bad); color: #fff; }
.toast.show { transform: translateX(-50%) translateY(0); }

.conn { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: .9rem; z-index: 60; }

/* ======================= HOST / SCREEN ======================= */
.screen { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.screen .top { display: flex; align-items: center; gap: 18px; padding: 18px 28px 6px; }
.screen .top h1 { font-size: clamp(1.6rem, 3vw, 2.8rem); margin: 0; }
.screen .top .mini-qr { margin-left: auto; display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 8px 12px 8px 8px; }
.screen .top .mini-qr img { width: 74px; height: 74px; border-radius: 10px; background: #fff; display: block; }
.screen .top .mini-qr .u { font-size: 1rem; font-weight: 600; }
.stage { padding: 14px 28px 20px; overflow: auto; min-height: 0; }
.stage-inner { height: 100%; display: flex; flex-direction: column; gap: 18px; }

.lobby { display: grid; grid-template-columns: minmax(260px, 38vh) 1fr; gap: 36px; align-items: center; height: 100%; }
.lobby .qr { background: #fff; border-radius: 26px; padding: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lobby .qr img { width: 100%; display: block; }
.lobby .url { font-size: clamp(1.4rem, 2.6vw, 2.4rem); font-weight: 700; color: var(--yellow); word-break: break-all; }
.lobby .count { font-size: clamp(3rem, 7vw, 6rem); font-weight: 700; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-height: 40vh; overflow: hidden; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--card-strong); font-weight: 600; font-size: 1.05rem; animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.chip.off { opacity: .45; }
@keyframes pop { from { transform: scale(.3); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.statrow { display: grid; grid-template-columns: minmax(140px, 34%) 1fr 48px; gap: 12px; align-items: center; font-size: 1.15rem; margin: 10px 0; }
.statrow b { text-align: right; }

.hq { font-size: clamp(1.8rem, 3.6vw, 3.2rem); font-weight: 700; line-height: 1.15; }
.hanswers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hanswer {
  border-radius: 20px; padding: 18px 20px; background: var(--oc); color: #1d0630;
  font-size: clamp(1.2rem, 2.2vw, 1.9rem); font-weight: 700; display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden;
}
.hanswer .shape { width: 44px; height: 44px; font-size: 24px; }
.hanswer .cnt { margin-left: auto; font-size: 1.6em; }
.hanswer.dim { opacity: .28; }
.hanswer.right { outline: 6px solid #fff; }
.bigtimer { font-size: clamp(3rem, 6vw, 5rem); font-weight: 700; width: 1.8em; height: 1.8em; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: #2a0b3d; flex: none; }

.board { display: flex; flex-direction: column; gap: 8px; }
.board .r { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; border-radius: 14px; background: var(--card); font-size: 1.2rem; }
.board .r b:first-child { color: var(--yellow); }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 18px; height: 52vh; }
.podium .col { width: min(24vw, 260px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.podium .col .nm { font-size: clamp(1.3rem, 2.4vw, 2.2rem); font-weight: 700; text-align: center; }
.podium .col .blk { width: 100%; border-radius: 20px 20px 0 0; display: grid; place-items: start center; padding-top: 14px; font-size: 3rem; font-weight: 700; color: #2a0b3d; }
.podium .p1 .blk { height: 34vh; background: var(--yellow); }
.podium .p2 .blk { height: 24vh; background: #e4dcef; }
.podium .p3 .blk { height: 17vh; background: #ffb38a; }

.hevent { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.hevent .emo { font-size: clamp(5rem, 12vw, 10rem); line-height: 1; }
.hevent h2 { font-size: clamp(2rem, 4vw, 3.4rem); }
.hevent p { font-size: clamp(1.2rem, 2vw, 1.7rem); margin: 0 0 14px; color: var(--muted); }
.rule { display: inline-block; padding: 10px 18px; border-radius: 14px; background: rgba(255,90,95,.2); border: 2px solid var(--bad); font-size: 1.3rem; font-weight: 600; }
.hitsaved { display: flex; gap: 16px; margin-top: 18px; }
.hitsaved .card { font-size: 1.4rem; font-weight: 700; }

.demo-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.demo-steps .card { font-size: clamp(1.1rem, 1.8vw, 1.6rem); text-align: center; }
.demo-steps .emo { font-size: 3.6rem; display: block; margin-bottom: 8px; }
.wave { display: flex; gap: 6px; align-items: center; justify-content: center; height: 80px; }
.wave i { width: 10px; border-radius: 6px; background: var(--pink); animation: wave 1s ease-in-out infinite; }
@keyframes wave { 0%,100% { height: 16px } 50% { height: 76px } }

.controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px; background: rgba(10, 0, 20, .55); border-top: 1px solid var(--line);
}
.controls .btn { padding: 10px 16px; font-size: 1rem; box-shadow: 0 3px 0 #b38f12; }
.controls .btn.pink { box-shadow: 0 3px 0 #b02a6d; }
.controls .btn.ghost { box-shadow: none; }
.controls select { font-family: inherit; font-size: 1rem; padding: 9px 10px; border-radius: 12px; background: var(--card-strong); color: var(--text); border: 1px solid var(--line); }
.controls select option { color: #000; }
.controls #ctx { flex: 1; }
.controls .hint { order: 10; flex-basis: 100%; font-size: .9rem; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.controls .hint:empty { display: none; }
.screen.no-controls .controls { display: none; }

.login { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,0,35,.85); z-index: 100; }
.login .card { width: min(420px, 90vw); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20,0,35,.7); z-index: 90; }
.modal .card { width: min(460px, 92vw); display: flex; flex-direction: column; gap: 14px; background: #3a1157; }

@media (max-width: 800px) {
  .lobby, .grid2, .grid3, .demo-steps, .hanswers, .hevent { grid-template-columns: 1fr; }
  .screen { height: auto; min-height: 100vh; }
  .screen .top .mini-qr .u { display: none; }
}
