:root {
  --bg: #090b24;
  --bg2: #141846;
  --panel: #1a1f5c;
  --line: rgba(255, 255, 255, 0.12);
  --gold: #ffc93c;
  --pink: #ff3d7f;
  --cyan: #35e0ff;
  --green: #3ddc84;
  --red: #ff4d5e;
  --text: #f6f7ff;
  --muted: #a9addb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .btn sets display, which would otherwise beat the hidden attribute */
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: 'Sora', system-ui, sans-serif; }
button, input { font: inherit; }
a { color: var(--cyan); }
.dot { opacity: 0.5; margin: 0 0.3em; }
.hint { color: var(--muted); font-size: 0.9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.85rem; color: var(--muted); margin: 0 0 0.6rem; }
.eyebrow.gold { color: var(--gold); }

.logo { font-weight: 800; letter-spacing: 0.06em; line-height: 1; }
.logo .mall { color: var(--gold); }
.logo .show { color: var(--pink); margin-left: 0.3em; }

.btn {
  border: 0; border-radius: 999px; padding: 0.7rem 1.4rem; cursor: pointer;
  background: var(--gold); color: #1b1300; font-weight: 800; text-decoration: none; display: inline-block;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.big { padding: 1rem 2rem; font-size: 1.15rem; }
.btn.small { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.cyan { background: var(--cyan); color: #00222b; }

.pill { display: inline-block; padding: 0.2rem 0.75rem; border-radius: 999px; font-weight: 800; font-size: 0.85em; margin-right: 0.5rem; background: var(--panel); text-transform: uppercase; letter-spacing: 0.06em; }
.pill.gold { background: var(--gold); color: #1b1300; }
.pill.red { background: var(--red); }
.pill.green { background: var(--green); color: #002611; }
.pill.cyan { background: var(--cyan); color: #00222b; }
.pill.dim { opacity: 0.7; }
.pulse { animation: pulse 0.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.timer { height: 8px; border-radius: 8px; background: var(--panel); overflow: hidden; margin-top: 1rem; }
.timer-bar { height: 100%; width: 0; background: var(--cyan); transition: background 0.3s; }
.timer-bar.urgent { background: var(--red); }

/* ---------- big screen ---------- */

body.main {
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% 115%, #3c1d80 0%, transparent 70%),
    radial-gradient(ellipse 70% 45% at 50% -15%, #14317d 0%, transparent 70%),
    var(--bg);
}
#stage { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; }
.top { display: flex; align-items: center; gap: 1.2rem; padding: 1rem 2rem; }
.top > * { white-space: nowrap; }
@media (max-width: 1500px) { .crowd-count { display: none; } }
@media (max-width: 1100px) { .sponsor-tag { display: none; } }
.top .logo { font-size: clamp(1.5rem, 2.6vw, 2.5rem); }
.brand { display: flex; flex-direction: column; gap: 0.15rem; }
.byline { color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; }
.hosted { color: var(--muted); }
.hosted b { color: var(--cyan); }
.spacer { flex: 1; }
.sponsor-tag { color: var(--muted); }
.sponsor-tag b { color: var(--gold); margin-left: 0.4em; }
.crowd-count { color: var(--muted); font-size: 0.85rem; }

#screen { display: flex; align-items: center; justify-content: center; padding: 1rem 3vw; min-height: 0; }

.card { background: rgba(26, 31, 92, 0.75); border: 1px solid var(--line); border-radius: 20px; padding: 1.6rem 1.8rem; }
.card h2 { margin: 0 0 1rem; font-size: 1.3rem; }

.lobby { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 1.4rem; width: min(1240px, 100%); align-self: start; margin-top: 1vh; }
.lobby .card { padding: 1.3rem 1.4rem; }
.lobby label { display: block; margin-bottom: 0.75rem; color: var(--muted); font-size: 0.9rem; }
.lobby input[maxlength], .lobby select {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.65rem 0.9rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
#screen { overflow-y: auto; }
.lobby .check { display: flex; gap: 0.6rem; align-items: center; color: var(--text); }
.join { text-align: center; }
.qr { display: inline-block; padding: 12px; background: #fff; border-radius: 14px; min-height: 60px; }
.qr p { color: #333; margin: 0; }
.url { word-break: break-all; font-size: 0.9rem; }
.p2status { font-weight: 800; color: var(--gold); }
.game-code { margin: 0.8rem 0 0.2rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.85rem; }
.game-code b { display: block; font-size: 2.4rem; letter-spacing: 0.3em; color: var(--gold); margin-top: 0.1rem; }

.raffle, .intro, .winner, .walk { text-align: center; max-width: 980px; }
.raffle h2 { margin: 0 0 2rem; font-size: clamp(1.4rem, 2.6vw, 2.2rem); }
.tickets { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; }
.ticket {
  position: relative; width: 340px; padding: 1.5rem 1rem; border-radius: 14px;
  background: linear-gradient(135deg, #ffe08a, var(--gold)); color: #2a1a00;
  border: 3px dashed rgba(42, 26, 0, 0.35); box-shadow: 0 20px 60px rgba(255, 201, 60, 0.15);
  transition: transform 0.3s;
}
.ticket::before, .ticket::after { content: ''; position: absolute; top: 50%; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%; background: var(--bg); }
.ticket::before { left: -15px; }
.ticket::after { right: -15px; }
.tlabel { display: block; text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.8rem; opacity: 0.7; }
.tname { display: block; font-size: 2.2rem; font-weight: 800; margin-top: 0.4rem; min-height: 2.8rem; }
.ticket.landed { transform: scale(1.06) rotate(-1.5deg); box-shadow: 0 0 0 4px var(--pink), 0 20px 80px rgba(255, 61, 127, 0.4); }

.sponsor-name { font-size: clamp(2.4rem, 6vw, 5rem); margin: 0.2rem 0 1.4rem; color: var(--gold); }
.prize-card { display: inline-flex; flex-direction: column; gap: 0.3rem; padding: 1.2rem 2.4rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.prize-card span { text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.8rem; color: var(--muted); }
.prize-card b { font-size: clamp(1.4rem, 3vw, 2.2rem); color: var(--pink); }
.rules { color: var(--muted); margin-top: 1.6rem; font-size: 1.1rem; }

.question { width: min(1100px, 100%); text-align: center; }
.qmeta { color: var(--muted); text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.9rem; margin: 0; }
.qtext { font-size: clamp(1.6rem, 3.4vw, 3rem); line-height: 1.2; margin: 0.6rem 0 1.6rem; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.choice {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 1rem; text-align: left;
  padding: 1rem 1.2rem; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); color: var(--text);
  font-size: clamp(1rem, 1.8vw, 1.5rem); font-weight: 600; cursor: default; transition: transform 0.15s, border-color 0.2s, background 0.2s, opacity 0.2s;
}
.choice .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(53, 224, 255, 0.22); transition: width 0.25s; }
.choice .key, .choice .ctext, .choice .votes { position: relative; }
.choice .key { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--bg); color: var(--gold); font-weight: 800; flex: none; }
.choice .votes { margin-left: auto; color: var(--cyan); font-weight: 800; }
.choice.pickable { cursor: pointer; border-color: var(--gold); }
.choice.pickable:hover { transform: translateY(-2px); }
.choice.struck { opacity: 0.3; text-decoration: line-through; }
.choice.correct { border-color: var(--green); background: rgba(61, 220, 132, 0.2); }
.status { margin-top: 1.4rem; font-size: 1.15rem; min-height: 2rem; }

.winner { position: relative; }
.win-name { font-size: clamp(2.8rem, 7vw, 6rem); margin: 0; color: var(--gold); }
.win-prize { font-size: clamp(1.1rem, 2.2vw, 1.7rem); margin: 0.6rem 0; }
.final { color: var(--muted); font-size: 1.1rem; }
.final b { color: var(--text); font-size: 1.4rem; }
.row { display: flex; gap: 1rem; justify-content: center; margin-top: 1.6rem; flex-wrap: wrap; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 10px; height: 16px; background: var(--c); animation: fall var(--d) linear var(--delay) infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.walk h1 { font-size: clamp(2rem, 4.4vw, 3.6rem); margin: 0 0 1.2rem; }
.walk-body { font-size: clamp(1.05rem, 1.9vw, 1.45rem); line-height: 1.5; color: #dfe1ff; max-width: 820px; margin: 0 auto 1rem; }
.walk .btn.big { margin-top: 1rem; }
.dots { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.6rem; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--gold); }

.lecterns { display: grid; grid-template-columns: 1fr minmax(240px, 0.9fr) 1fr; align-items: end; gap: 2vw; padding: 0 3vw 1.4rem; }
.lectern { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.lec-screen {
  width: min(360px, 100%); padding: 0.9rem 1rem 1rem; text-align: center;
  background: linear-gradient(180deg, #232a7a, #141846); border: 2px solid var(--line);
  clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%); transition: border-color 0.2s, box-shadow 0.2s;
}
.lec-name { font-weight: 800; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lec-score { font-size: 2.8rem; font-weight: 800; color: var(--gold); line-height: 1.1; }
.lec-state { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.lectern.empty .lec-name { color: var(--muted); font-weight: 600; }
.lectern.buzzed .lec-screen { background: linear-gradient(180deg, #ff6a9a, var(--pink)); }
.lectern.buzzed .lec-state { color: #fff; font-weight: 800; }
.lectern.buzzed .lec-score { color: #fff; }
.lectern.locked .lec-screen { opacity: 0.45; }
.lectern.champ .lec-screen { background: linear-gradient(180deg, #ffe08a, var(--gold)); color: #2a1a00; }
.lectern.champ .lec-score, .lectern.champ .lec-state { color: #2a1a00; }
.tag { font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 6px; background: var(--bg); color: var(--cyan); vertical-align: middle; }

.buzzer {
  width: 128px; height: 64px; border-radius: 64px 64px 14px 14px; border: 0; cursor: pointer;
  background: radial-gradient(circle at 50% 30%, #ff7a86, var(--red)); color: #fff; font-weight: 800; font-size: 1.1rem;
  box-shadow: 0 6px 0 #8e1622; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.buzzer small { font-size: 0.6rem; font-weight: 600; opacity: 0.85; }
.buzzer:active { transform: translateY(4px); box-shadow: 0 2px 0 #8e1622; }
.lectern.armed .buzzer { animation: glow 0.9s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 6px 0 #8e1622, 0 0 30px 8px rgba(255, 77, 94, 0.7); } }

.host { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; }
.caption { min-height: 2.6rem; max-width: 440px; font-size: 0.95rem; color: #dfe1ff; }

/* Ayewon: still image + live SVG face, or a short animated pose */
.ayewon { --ay-h: clamp(150px, 26vh, 250px); position: relative; height: var(--ay-h); width: calc(var(--ay-h) * 0.8725); }
.ayewon::after {
  content: ''; position: absolute; left: 8%; right: 22%; bottom: -6px; height: 16px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent); z-index: -1;
}
.ay-body { position: absolute; inset: 0; animation: aybob 3.2s ease-in-out infinite; }
.ay-tilt { position: absolute; inset: 0; transform-origin: 45% 92%; }
.ay-still { position: absolute; inset: 0; }
.ay-still img, .ay-still svg { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; }
.ay-anim { position: absolute; width: auto; max-width: none; user-select: none; }
.ayewon.posing .ay-still { visibility: hidden; }
.ayewon.talking .ay-tilt { animation: aytalk 0.55s ease-in-out infinite alternate; }
.ayewon.shake .ay-tilt { animation: ayshake 0.55s ease-in-out; }
.ayewon.hop .ay-tilt { animation: ayhop 0.55s ease-out; }
@keyframes aybob { 50% { transform: translateY(-5px); } }
@keyframes aytalk { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
@keyframes ayshake { 20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
@keyframes ayhop { 40% { transform: translateY(-18px); } }

.mic.listening, .mic.armed { background: var(--red); color: #fff; border-color: transparent; animation: pulse 0.9s ease-in-out infinite; }
.mic.thinking { background: var(--cyan); color: #00222b; border-color: transparent; }
.mic.wake { border-color: var(--cyan); color: var(--cyan); }
.mic.blocked, .mic.error { border-color: var(--red); color: var(--red); }
.caption.cohost { color: var(--gold); font-style: italic; }

.voice-sel {
  max-width: 220px; padding: 0.4rem 0.6rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font-size: 0.85rem;
}

@media (max-width: 1150px) { .lobby { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  body.main { overflow: auto; }
  #stage { height: auto; min-height: 100vh; }
  .lecterns { grid-template-columns: 1fr 1fr; }
  .host { grid-column: 1 / -1; order: -1; }
}

/* ---------- phone ---------- */

body.phone {
  min-height: 100vh; display: flex; flex-direction: column; padding: 16px;
  background: radial-gradient(ellipse 120% 60% at 50% 110%, #3c1d80 0%, transparent 70%), var(--bg);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.ptop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.ptop .logo { font-size: 1.4rem; }
.pscore { color: var(--gold); font-weight: 800; }
#app { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.pcenter { text-align: center; }
.pcenter h1 { font-size: 2.2rem; margin: 0 0 0.6rem; }
.pcenter.small h1 { font-size: 1.8rem; }
.pcenter h1.good { color: var(--green); }
.pcenter p { color: #dfe1ff; }
.pjoin { display: flex; flex-direction: column; gap: 1rem; text-align: center; }
.pjoin h1 { margin: 0; }
.pjoin input { width: 100%; min-width: 0; padding: 1rem; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 1.2rem; text-align: center; }
.pq { font-size: 1.05rem; color: #dfe1ff; text-align: center; margin: 0; }
.pbuzzer {
  align-self: center; width: min(72vw, 320px); aspect-ratio: 1; border-radius: 50%; border: 0;
  font-size: 2rem; font-weight: 800; color: #fff; touch-action: manipulation;
  background: radial-gradient(circle at 50% 35%, #555b8f, #2a2f66); box-shadow: 0 12px 0 #151842;
}
.pbuzzer.armed { background: radial-gradient(circle at 50% 35%, #ff7a86, var(--red)); box-shadow: 0 12px 0 #8e1622, 0 0 50px rgba(255, 77, 94, 0.6); animation: pulse 0.8s ease-in-out infinite; }
.pbuzzer.armed:active { transform: translateY(8px); box-shadow: 0 4px 0 #8e1622; }
.pbuzzer.locked { opacity: 0.35; font-size: 1.4rem; }
.pchoices { display: grid; gap: 0.7rem; }
.pchoice { text-align: left; padding: 1rem; border-radius: 14px; border: 2px solid var(--gold); background: var(--panel); color: var(--text); font-size: 1.1rem; font-weight: 600; }
.pchoice b { color: var(--gold); margin-right: 0.5rem; }
.pchoice em { float: right; color: var(--cyan); font-style: normal; }
.pchoice:disabled { opacity: 0.3; text-decoration: line-through; border-color: var(--line); }
.pbars { display: grid; gap: 0.6rem; }
.pbar { position: relative; overflow: hidden; padding: 0.8rem 1rem; border-radius: 12px; background: var(--panel); }
.pbar .fill { position: absolute; inset: 0 auto 0 0; background: rgba(53, 224, 255, 0.25); transition: width 0.25s; }
.pbar b, .pbar em { position: relative; }
.pbar b { color: var(--gold); margin-right: 0.4rem; }
.pbar em { float: right; color: var(--cyan); font-style: normal; font-weight: 800; }
