/* Design canvas is 1080x1920; stage.js scales it to the window. Keep key content between y=190
   and y=1370: TikTok draws its own header above and the chat overlay below. */
:root {
  --ink: #fff8ea;
  --muted: #b9b6e0;
  --gold: #ffc94d;
  --gold-deep: #e8940c;
  --panel: rgba(25, 20, 68, 0.88);
  --line: rgba(255, 255, 255, 0.14);
  --a: #ff5f6d;
  --b: #2f9bff;
  --c: #ffa726;
  --d: #22c58b;
  --good: #2ee58f;
  --ease-pop: cubic-bezier(0.2, 1.4, 0.4, 1);
  /* theme colours: see themes.css */
  --stage-bg:
    radial-gradient(ellipse 900px 700px at 50% 8%, #3b2a8f 0%, transparent 70%),
    radial-gradient(ellipse 800px 800px at 90% 78%, #6a1f6e 0%, transparent 70%),
    linear-gradient(180deg, #120d38 0%, #0a0824 60%, #050414 100%);
  --headline-shadow: 0 4px 24px rgba(255, 190, 60, 0.35);
  --panel-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --chip-bg: rgba(255, 201, 77, 0.16);
  --chip-line: rgba(255, 201, 77, 0.5);
  --card: linear-gradient(160deg, rgba(62, 46, 150, 0.96), rgba(30, 22, 82, 0.96));
  --row-first: linear-gradient(110deg, rgba(150, 105, 10, 0.75), rgba(40, 28, 80, 0.92));
  --pill: rgba(255, 255, 255, 0.1);
  --dot: rgba(255, 255, 255, 0.18);
  --ring-fill: rgba(10, 8, 36, 0.85);
  --ring-gap: #130e3a;
  --fade: rgb(24, 19, 66);
  --lyric-dim: rgba(255, 248, 234, 0.62);
  --disc-1: #17123c;
  --disc-2: #231c58;
  --mote-1: rgba(255, 214, 120, 0.9);
  --mote-2: rgba(150, 130, 255, 0.8);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #07051a; }
body { font-family: 'Stage Ethiopic', 'Noto Sans Ethiopic', 'Segoe UI', sans-serif, 'Noto Color Emoji'; color: var(--ink); }
[hidden] { display: none !important; }

#stage {
  position: absolute;
  width: 1080px;
  height: 1920px;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--stage-bg);
  color: var(--ink);
}
#bg, #fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#fx { z-index: 30; }

/* ---------- header ---------- */
#brand { position: absolute; top: 56px; left: 44px; right: 44px; display: flex; align-items: center; gap: 24px; }
.logo {
  width: 104px; height: 104px; border-radius: 30px; display: grid; place-items: center; flex: none;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #2a1600; font-size: 62px; font-weight: 900;
  box-shadow: 0 8px 36px rgba(255, 180, 40, 0.45);
}
.logo span { animation: bob 2.4s ease-in-out infinite; }
.brand-text { flex: 1; min-width: 0; }
#brand-title { font-size: 46px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#brand-subtitle { font-size: 27px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.live { text-align: right; }
.live-pill {
  display: inline-flex; align-items: center; gap: 12px; background: #ff2d55; border-radius: 40px;
  padding: 6px 24px; font-size: 28px; font-weight: 900; letter-spacing: 3px;
}
.live-pill i { width: 16px; height: 16px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.live-stats { display: flex; gap: 18px; justify-content: flex-end; margin-top: 8px; font-size: 25px; color: var(--muted); }

/* ---------- scene frame ---------- */
#scenes { position: absolute; top: 200px; left: 44px; width: 992px; height: 1170px; }
.scene { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; animation: scene-in 0.55s ease both; }
.scene.leaving { animation: scene-out 0.35s ease both; }

.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 44px; box-shadow: var(--panel-shadow); }
.headline {
  font-size: 62px; font-weight: 900; text-align: center; line-height: 1.3; color: var(--gold);
  text-shadow: var(--headline-shadow); animation: drop 0.7s var(--ease-pop) both;
}
.sub { font-size: 34px; color: var(--muted); text-align: center; line-height: 1.5; animation: fade 0.8s 0.25s ease both; }
.chip { display: inline-block; padding: 8px 30px; border-radius: 40px; background: var(--chip-bg); border: 2px solid var(--chip-line); color: var(--gold); font-size: 30px; font-weight: 700; }

/* ---------- timer ring ---------- */
.ring { position: relative; width: 156px; height: 156px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: var(--ring-fill); stroke-width: 12; }
.ring .track-circle { stroke: rgba(128, 128, 150, 0.25); }
.ring .progress { fill: none; stroke: var(--good); stroke-linecap: round; transition: stroke 0.4s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; font-weight: 900; color: var(--card-ink, var(--ink)); }
.ring.warn .progress { stroke: var(--c); }
.ring.danger .progress { stroke: var(--a); }
.ring.danger { animation: pulse 1s ease-in-out infinite; }

/* ---------- quiz ---------- */
.q-top { width: 100%; height: 160px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.q-number { font-size: 40px; font-weight: 900; }
.q-number small { display: block; font-size: 26px; color: var(--muted); font-weight: 400; }
.dots { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dots i { width: 18px; height: 18px; border-radius: 50%; background: var(--dot); }
.dots i.done { background: var(--gold); }
.dots i.now { background: var(--ink); box-shadow: 0 0 16px var(--ink); }
.q-category { justify-self: end; }
.q-card {
  width: 100%; height: 300px; margin-top: 8px; padding: 28px 44px; display: grid; place-items: center; text-align: center;
  background: var(--card); animation: flip-in 0.8s var(--ease-pop) both;
}
.q-text { font-weight: 700; line-height: 1.4; width: 100%; max-height: 240px; overflow: hidden; }
.choices { width: 100%; display: flex; flex-direction: column; gap: 18px; margin-top: 26px; }
.choice {
  --tone: var(--a);
  position: relative; display: flex; align-items: center; gap: 28px; height: 122px; padding: 0 30px 0 18px; overflow: hidden;
  border-radius: 64px; border: 3px solid var(--tone); background: var(--panel);
  animation: slide-in 0.6s var(--ease-pop) both; transition: opacity 0.6s, transform 0.6s;
}
.choice:nth-child(1) { animation-delay: 0.25s; }
.choice:nth-child(2) { --tone: var(--b); animation-delay: 0.37s; }
.choice:nth-child(3) { --tone: var(--c); animation-delay: 0.49s; }
.choice:nth-child(4) { --tone: var(--d); animation-delay: 0.61s; }
.choice .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--tone); opacity: 0.3; transition: width 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s; }
.choice .letter { position: relative; width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--tone); color: #0d0a2b; font-size: 52px; font-weight: 900; }
.choice .label { position: relative; flex: 1; font-size: 42px; font-weight: 700; line-height: 1.25; max-height: 108px; overflow: hidden; }
.choice .percent { position: relative; font-size: 44px; font-weight: 900; text-align: right; }
.choice .percent small { display: block; font-size: 22px; font-weight: 400; color: var(--muted); }
.revealed .choice { animation: none; }
.revealed .choice.wrong { opacity: 0.45; }
.revealed .choice.right { border-color: var(--good); border-width: 6px; transform: scale(1.035); box-shadow: 0 0 50px rgba(46, 229, 143, 0.65); animation: glow 1.3s ease-in-out 0.4s infinite; }
.revealed .choice.right .bar { background: var(--good); opacity: 0.45; }
.revealed .choice.right .letter { background: var(--good); }
.q-foot { width: 100%; margin-top: 22px; text-align: center; }
.q-hint { font-size: 33px; font-weight: 700; color: var(--gold); }
.q-count { font-size: 30px; color: var(--muted); margin-top: 4px; }
.q-count b { color: var(--ink); font-size: 38px; display: inline-block; }
.bump { animation: bump 0.4s var(--ease-pop); }
.recent { display: flex; justify-content: center; gap: 10px; height: 62px; margin-top: 8px; overflow: hidden; }
.recent .pill { display: flex; align-items: center; gap: 8px; background: var(--pill); border-radius: 40px; padding: 4px 16px 4px 5px; font-size: 22px; white-space: nowrap; max-width: 240px; }
.recent .pill span { overflow: hidden; text-overflow: ellipsis; }
.recent .pill.new { animation: pop 0.5s var(--ease-pop) both; }
.locked .ring { opacity: 0.55; }
.locked .q-hint { color: var(--a); animation: blink 1s infinite; }

/* ---------- people ---------- */
.avatar { position: relative; width: var(--size, 96px); height: var(--size, 96px); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; font-size: calc(var(--size, 96px) * 0.48); font-weight: 900; color: #fff; background: var(--avatar, #6b5bd6); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.who { flex: 1; min-width: 0; text-align: left; }
.who .name { font-size: 46px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .handle { font-size: 28px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list { width: 100%; margin-top: 56px; display: flex; flex-direction: column; gap: 30px; }
.row { display: flex; align-items: center; gap: 28px; height: 190px; padding: 0 38px 0 26px; position: relative; overflow: hidden; animation: fly-in 0.7s var(--ease-pop) both; }
.row::after { content: ''; position: absolute; top: 0; bottom: 0; width: 140px; left: -200px; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.22), transparent); animation: shine 1.6s ease-out 0.9s both; }
.row:nth-child(1) { animation-delay: 0.35s; border-color: var(--gold); background: var(--row-first); }
.row:nth-child(2) { animation-delay: 0.9s; border-color: #cfd8ea; }
.row:nth-child(3) { animation-delay: 1.45s; border-color: #d98e5a; }
.medal { font-size: 78px; width: 96px; text-align: center; flex: none; }
.score { text-align: right; flex: none; }
.score b { display: block; font-size: 56px; font-weight: 900; color: var(--gold); line-height: 1.15; }
.score small { font-size: 26px; color: var(--muted); }
.empty { margin-top: 200px; }

/* ---------- winner ---------- */
.crown { width: 230px; height: 150px; margin-top: 10px; fill: var(--gold); filter: drop-shadow(0 8px 24px rgba(255, 190, 50, 0.7)); animation: crown-drop 1.1s var(--ease-pop) 0.5s both; }
.champion-ring { position: relative; width: 340px; height: 340px; display: grid; place-items: center; margin-top: -4px; animation: pop 0.9s var(--ease-pop) 0.8s both; }
.champion-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--gold), #ff5f9e, #6a7bff, var(--good), var(--gold)); animation: spin 3s linear infinite; }
.champion-ring .avatar { --size: 310px; border: 8px solid var(--ring-gap); }
.champion-name { font-size: 78px; font-weight: 900; margin-top: 20px; max-width: 960px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; animation: drop 0.8s var(--ease-pop) 1.2s both; }
.champion-handle { font-size: 36px; color: var(--muted); animation: fade 0.8s 1.4s both; }
.champion-score { margin-top: 14px; font-size: 40px; animation: pop 0.7s var(--ease-pop) 1.7s both; }
.runners { width: 100%; display: flex; gap: 24px; margin-top: 34px; justify-content: center; }
.runner { width: 480px; display: flex; align-items: center; gap: 18px; padding: 20px 24px; animation: rise 0.8s var(--ease-pop) 2.1s both; }
.runner .medal { font-size: 54px; width: 60px; }
.runner .name { font-size: 32px; }
.runner .handle { font-size: 22px; }
.quote { width: 100%; margin-top: 28px; padding: 28px 44px; font-size: 38px; line-height: 1.5; text-align: center; max-height: 230px; overflow: hidden; animation: rise 0.8s var(--ease-pop) 2s both; }

/* ---------- intro ---------- */
.hero-icon { font-size: 220px; line-height: 1.2; margin-top: 90px; animation: pop 0.9s var(--ease-pop) both, bob 2.2s ease-in-out 1s infinite; }
.intro .headline { font-size: 78px; margin-top: 20px; }
.steps { width: 100%; margin-top: 50px; display: flex; flex-direction: column; gap: 22px; }
.step { display: flex; align-items: center; gap: 26px; padding: 22px 36px; font-size: 36px; line-height: 1.4; animation: slide-in 0.6s var(--ease-pop) both; }
.step:nth-child(1) { animation-delay: 0.5s; }
.step:nth-child(2) { animation-delay: 0.75s; }
.step:nth-child(3) { animation-delay: 1s; }
.step i { font-style: normal; font-size: 58px; }
.prompt-card { width: 100%; margin-top: 40px; padding: 48px; font-size: 54px; font-weight: 700; line-height: 1.5; text-align: center; animation: flip-in 0.8s var(--ease-pop) 0.2s both; }

/* ---------- comment contest ---------- */
.c-top { width: 100%; display: flex; align-items: center; gap: 28px; padding: 24px 32px; }
.c-top .c-prompt { flex: 1; font-size: 38px; font-weight: 700; line-height: 1.4; }
.c-top .c-title { font-size: 27px; color: var(--gold); font-weight: 900; }
.feed { width: 100%; height: 850px; margin-top: 24px; display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; overflow: hidden; }
.bubble { display: flex; gap: 20px; align-items: flex-start; padding: 20px 28px; border-radius: 36px; flex: none; }
.bubble.new { animation: rise 0.6s var(--ease-pop) both; }
.bubble .name { font-size: 28px; color: var(--gold); font-weight: 700; }
.bubble .text { font-size: 33px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bubble .body { min-width: 0; overflow-wrap: anywhere; }
.bubble .avatar { --size: 72px; }

/* ---------- interlude ---------- */
.disc-wrap { position: relative; width: 400px; height: 400px; margin-top: 24px; animation: pop 0.8s var(--ease-pop) both; }
.disc { position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle, var(--disc-1) 0 5px, var(--disc-2) 6px 9px); box-shadow: 0 0 90px rgba(120, 90, 255, 0.55); animation: spin 8s linear infinite; }
.disc-wrap::after { content: '♫'; position: absolute; inset: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 90px; color: #2a1600; background: linear-gradient(145deg, var(--gold), var(--gold-deep)); }
.disc::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(transparent 0 40deg, rgba(255, 255, 255, 0.16) 55deg, transparent 75deg 220deg, rgba(255, 255, 255, 0.12) 235deg, transparent 255deg); }
.note { position: absolute; font-size: 54px; color: var(--gold); opacity: 0; animation: float-note 4s ease-in infinite; }
.note:nth-of-type(2) { left: -20px; bottom: 80px; }
.note:nth-of-type(3) { right: -10px; bottom: 150px; animation-delay: 1.3s; }
.note:nth-of-type(4) { left: 60px; bottom: 0; animation-delay: 2.6s; }
.song { margin-top: 30px; width: 100%; font-size: 44px; font-weight: 900; text-align: center; line-height: 1.4; max-height: 124px; overflow: hidden; }
.next { margin-top: 24px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 22px 40px; font-size: 36px; }
.next b { font-size: 58px; color: var(--gold); font-variant-numeric: tabular-nums; }
.champions { width: 100%; margin-top: 22px; padding: 18px 36px; }
.champions h3 { font-size: 30px; color: var(--gold); text-align: center; }
.champions div { display: flex; gap: 16px; font-size: 31px; padding-top: 8px; }
.champions div span:nth-child(2) { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticker { margin-top: 20px; width: 100%; height: 64px; text-align: center; font-size: 29px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker b { color: var(--ink); }
.ticker .line { animation: rise 0.5s ease both; }

/* ---------- lyrics mode ---------- */
.lyric-head { width: 100%; display: flex; align-items: center; gap: 24px; height: 120px; }
.lyric-head .song { flex: 1; margin: 0; font-size: 36px; text-align: left; max-height: 100px; }
.mini-disc { width: 100px; height: 100px; border-radius: 50%; flex: none; background: radial-gradient(circle, var(--gold) 0 22%, transparent 23%), conic-gradient(var(--disc-1), var(--disc-2), var(--disc-1), var(--disc-2), var(--disc-1)); box-shadow: 0 0 34px rgba(120, 90, 255, 0.6); animation: spin 5s linear infinite; }
.lyric-box { position: relative; width: 100%; height: 820px; margin-top: 18px; overflow: hidden; animation: rise 0.7s var(--ease-pop) both; }
.lyric-box::before, .lyric-box::after { content: ''; position: absolute; left: 0; right: 0; height: 110px; z-index: 2; pointer-events: none; }
.lyric-box::before { top: 0; background: linear-gradient(var(--fade), transparent); }
.lyric-box::after { bottom: 0; background: linear-gradient(transparent, var(--fade)); }
.lyric-roll { position: absolute; top: 0; left: 0; right: 0; padding: 0 70px; transition: transform 0.7s cubic-bezier(0.25, 0.8, 0.25, 1); }
.lyric-roll.untimed { padding-top: 60px; padding-bottom: 80px; transition: transform 0.2s linear; }
.lyric { padding: 17px 0; text-align: center; font-size: 46px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; color: var(--lyric-dim); transition: color 0.4s, transform 0.5s var(--ease-pop), opacity 0.4s; }
.lyric.past { opacity: 0.45; }
.lyric.gap { min-height: 40px; }
.lyric.now { color: var(--gold); transform: scale(1.1); font-weight: 900; text-shadow: 0 0 32px rgba(255, 190, 60, 0.6); }
.untimed .lyric { color: var(--ink); }
.lyric-box ~ .next { margin-top: 20px; padding: 14px 36px; }
.lyric-box ~ .ticker { margin-top: 14px; height: 50px; }

/* ---------- toasts, player, overlays ---------- */
#toasts { position: absolute; left: 44px; right: 44px; top: 1376px; height: 70px; display: flex; justify-content: center; }
.toast { color: #fff; align-self: center; padding: 8px 32px; border-radius: 40px; font-size: 29px; background: linear-gradient(90deg, rgba(255, 70, 130, 0.9), rgba(130, 80, 255, 0.9)); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; animation: toast 3.6s ease both; }
#player { position: absolute; left: 44px; right: 220px; top: 1456px; display: flex; align-items: center; gap: 24px; }
.eq { display: flex; align-items: flex-end; gap: 6px; height: 66px; flex: none; }
.eq i { width: 10px; height: 66px; border-radius: 5px; background: linear-gradient(180deg, var(--gold), #ff5f9e); transform-origin: bottom; transform: scaleY(0.12); transition: transform 0.14s linear; }
.track { min-width: 0; }
.track small { font-size: 22px; color: var(--muted); }
#track-title { font-size: 31px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#handle { position: absolute; left: 44px; bottom: 36px; font-size: 26px; color: var(--muted); opacity: 0.75; }
#paused, #offline { position: absolute; z-index: 40; left: 50%; top: 760px; transform: translateX(-50%); padding: 30px 60px; border-radius: 50px; background: rgba(0, 0, 0, 0.85); color: #fff; font-size: 46px; font-weight: 900; white-space: nowrap; }
#offline { top: 900px; font-size: 34px; }
#unmute { position: absolute; z-index: 50; left: 50%; bottom: 200px; transform: translateX(-50%); font: inherit; font-size: 44px; padding: 20px 50px; border-radius: 50px; border: 0; background: var(--gold); color: #2a1600; cursor: pointer; }

/* ---------- motion ---------- */
@keyframes scene-in { from { opacity: 0; transform: translateY(46px) scale(0.97); } }
@keyframes scene-out { to { opacity: 0; transform: translateY(-40px) scale(1.03); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-60px) scale(0.85); } }
@keyframes rise { from { opacity: 0; transform: translateY(70px) scale(0.9); } }
@keyframes pop { from { opacity: 0; transform: scale(0.35); } }
@keyframes flip-in { from { opacity: 0; transform: perspective(1200px) rotateX(-75deg) scale(0.9); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-320px); } }
@keyframes fly-in { from { opacity: 0; transform: translateX(480px) rotate(5deg); } }
@keyframes shine { to { left: 120%; } }
@keyframes bump { 40% { transform: scale(1.45); color: var(--gold); } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes bob { 50% { transform: translateY(-12px); } }
@keyframes pulse { 50% { transform: scale(1.09); } }
@keyframes glow { 50% { box-shadow: 0 0 18px rgba(46, 229, 143, 0.4); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes crown-drop { from { opacity: 0; transform: translateY(-340px) rotate(-30deg); } }
@keyframes float-note { 15% { opacity: 1; } to { opacity: 0; transform: translateY(-260px) rotate(24deg); } }
@keyframes toast { 0% { opacity: 0; transform: translateY(30px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-20px); } }
