:root {
  --bg: #0a0d1f;
  --surface: #12172f;
  --surface-2: #1a2142;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2f4ff;
  --muted: #9aa2c8;
  --pro: #3b9cff;
  --pro-2: #1b6fd6;
  --pro-glow: rgba(59, 156, 255, 0.5);
  --con: #ff5470;
  --con-2: #d42446;
  --con-glow: rgba(255, 84, 112, 0.5);
  --gold: #ffc53d;
  --gold-2: #ff9f1c;
  --radius: 16px;
  --display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: radial-gradient(ellipse 80% 40% at 50% 0%, #1a1747, var(--bg) 70%) fixed; }
.hidden { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  outline: none;
}
input:focus { border-color: var(--gold); }
.ico { width: 1.15em; height: 1.15em; fill: currentColor; vertical-align: -0.2em; flex: none; }
.muted { color: var(--muted); }
.hint { font-size: 0.85rem; color: var(--muted); }
.error { color: #ff97a8; font-weight: 600; min-height: 0; }
.error:empty { display: none; }
.row { display: flex; gap: 0.5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.kicker { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.pill { font-size: 0.8rem; font-weight: 800; padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--surface-2); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 0.6rem 1.1rem; font-weight: 700; white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.btn:not(:disabled):hover { background: #252d58; }
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.88rem; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--gold); color: #241300; border: none; }
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  width: 100%; padding: 1rem 1.4rem; border: none; border-radius: 14px;
  font-size: 1.15rem; font-weight: 900; color: #241300;
  background: linear-gradient(135deg, #ffd66b, var(--gold-2));
  box-shadow: 0 8px 24px rgba(255, 159, 28, 0.3);
  transition: transform 0.15s, filter 0.15s;
}
.cta:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.05); }
.cta.small { width: auto; padding: 0.7rem 1.3rem; font-size: 1rem; }
.link-btn { background: none; border: none; color: var(--muted); font-weight: 600; padding: 0.3rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.icon-btn { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.icon-btn:hover { background: var(--surface-2); }
.icon-toggle { display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 0.45rem 0.8rem; font-size: 0.85rem; font-weight: 700; }
.icon-toggle[aria-pressed="true"] { color: #fff; border-color: var(--gold); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.25rem; border-radius: 12px; background: rgba(0, 0, 0, 0.3); }
.seg button { border: none; background: transparent; color: var(--muted); padding: 0.45rem 0.9rem; border-radius: 9px; font-weight: 700; }
.seg button.on { background: var(--surface-2); color: #fff; box-shadow: inset 0 0 0 1px var(--gold); }
.checks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.check { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 0.4rem 0.85rem; font-weight: 600; font-size: 0.88rem; }
.check::before { content: "○ "; }
.check[aria-pressed="true"] { color: #fff; border-color: #22c55e; background: rgba(34, 197, 94, 0.12); }
.check[aria-pressed="true"]::before { content: "✓ "; color: #86efac; }
.opt-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); min-width: 6.5rem; }
.option-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.8rem; }

/* ---------- home ---------- */

#home { max-width: 880px; margin: 0 auto; padding: 1.2rem 1.2rem 3rem; display: grid; gap: 1.4rem; }
.home-top { display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: inherit; text-decoration: none; }
.logo-svg { width: 38px; height: 38px; }
.brand-logo.big .logo-svg { width: 64px; height: 64px; }
.wordmark { font-family: var(--display); font-weight: 900; font-size: 1.5rem; }
.wordmark b, .grad { background: linear-gradient(90deg, var(--pro), #b38cff, var(--con)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-toggles { display: flex; gap: 0.4rem; }
.hero { text-align: center; padding-top: 0.5rem; }
.hero h1 { font-family: var(--display); font-weight: 900; font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.02; letter-spacing: -0.02em; }
.hero p { color: var(--muted); font-size: 1.1rem; margin-top: 0.8rem; }

.setup { display: grid; gap: 0.9rem; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.mode {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem; text-align: center;
  padding: 0.8rem 0.5rem 0.9rem; border-radius: var(--radius); border: 2px solid transparent; background: var(--surface);
  transition: transform 0.15s, border-color 0.15s;
}
.mode:hover { transform: translateY(-2px); }
.mode.on { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 197, 61, 0.12), var(--surface)); }
.mode b { font-size: 1rem; }
.mode small { color: var(--muted); font-size: 0.8rem; }
.mode-art { display: flex; justify-content: center; align-items: flex-end; height: 64px; margin-bottom: 0.25rem; }
.mode-art .avatar { width: 56px; height: 56px; }
.mode-art .avatar + .avatar { margin-left: -12px; }
.mode-art .badge { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--surface-2); color: #b9c3ff; align-self: center; margin: 0 -4px; z-index: 1; }
.mode-art .badge.gold { color: var(--gold); }

.panel { display: grid; gap: 1rem; padding: 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.names { display: flex; gap: 0.6rem; }
.motion-card { padding: 1.1rem 1.2rem; border-radius: 14px; background: linear-gradient(135deg, #1d2450, #161b3a); border: 1px solid rgba(255, 197, 61, 0.25); display: grid; gap: 0.5rem; }
.motion-text { font-family: var(--serif); font-weight: 700; font-size: clamp(1.3rem, 3vw, 1.8rem); line-height: 1.2; }
.motion-text::before { content: "“"; color: var(--gold); }
.motion-text::after { content: "”"; color: var(--gold); }
.motion-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.2rem; }
.packs { display: inline-flex; gap: 0.2rem; margin-left: auto; padding: 0.2rem; border-radius: 10px; background: rgba(0, 0, 0, 0.3); }
.pack { border: none; background: transparent; color: var(--muted); padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 0.82rem; font-weight: 700; }
.pack.on { background: var(--surface-2); color: #fff; }
.side-pick { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.more summary { cursor: pointer; color: var(--muted); font-weight: 700; list-style: none; }
.more summary::before { content: "+ "; }
.more[open] summary::before { content: "– "; }
.join-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; color: var(--muted); }
.join-line input { width: 9rem; text-align: center; text-transform: uppercase; letter-spacing: 0.2em; font-weight: 800; padding: 0.5rem; }
.join-line .error { width: 100%; text-align: center; }
.join-line.highlight input { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 197, 61, 0.2); }
.how { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; color: var(--muted); font-size: 0.92rem; }
.how li { display: block; line-height: 1.45; }
.how .ico { color: var(--gold); margin-right: 0.3rem; }
.how b { color: var(--text); }
.support { color: var(--gold); text-align: center; }
.support:empty { display: none; }

/* invite screen */
#invite-screen { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.invite-dialog { width: min(420px, 100%); }
.invite-form { display: grid; gap: 0.8rem; }
.small-code { font-size: 1rem; padding: 0.1rem 0.4rem; }
.small-link { font-size: 0.85rem; }

/* ---------- stage ---------- */

#stage {
  height: 100vh; height: 100dvh; overflow: hidden; position: relative;
  display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  font-size: clamp(14px, 0.55vw + 0.55vh + 4px, 22px);
  background: radial-gradient(ellipse 50% 60% at 50% 20%, rgba(150, 120, 255, 0.14), transparent 70%), linear-gradient(180deg, #120d33 0%, #0a0d24 60%, #05060f 100%);
}
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem 0.2rem; position: relative; z-index: 6; }
.motion { text-align: center; min-width: 0; }
.motion h2 { font-family: var(--display); font-weight: 900; font-size: 1.5em; line-height: 1.15; text-wrap: balance; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 0.4rem); min-width: 15rem; z-index: 30;
  display: grid; padding: 0.4rem; border-radius: 14px; background: #161c3c; border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); font-size: 15px;
}
.menu button { display: flex; align-items: center; gap: 0.6rem; text-align: left; border: none; background: none; padding: 0.6rem 0.75rem; border-radius: 9px; font-weight: 600; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: #ff97a8; }

.scoreboard {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 2.6fr) auto minmax(0, 1fr); align-items: center; gap: 0.8rem;
  margin: 0.2rem 1rem 0; padding: 0.45rem 0.8rem; border-radius: 14px; background: rgba(10, 14, 40, 0.85); border: 1px solid var(--line);
  position: relative; z-index: 5;
}
.team { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.team.con { align-items: flex-end; text-align: right; }
.team-name { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.team-side { font-size: 0.66em; font-weight: 900; letter-spacing: 0.2em; }
.team.pro .team-side { color: var(--pro); }
.team.con .team-side { color: var(--con); }
.score { font-family: var(--display); font-size: 2.2em; font-weight: 900; min-width: 1.7em; text-align: center; border-radius: 12px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.score.pro { background: linear-gradient(180deg, var(--pro), var(--pro-2)); }
.score.con { background: linear-gradient(180deg, var(--con), var(--con-2)); }
.score.bump { animation: bump 0.6s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes bump { 30% { transform: scale(1.35); } }
.tug-track { position: relative; height: 1.1em; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.tug-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; transition: width 0.9s cubic-bezier(.2, .8, .2, 1); }
.tug-fill.pro { left: 0; background: linear-gradient(90deg, var(--pro-2), var(--pro)); box-shadow: 0 0 14px var(--pro-glow); }
.tug-fill.con { right: 0; background: linear-gradient(270deg, var(--con-2), var(--con)); box-shadow: 0 0 14px var(--con-glow); }
.tug-goal { position: absolute; top: -0.3em; bottom: -0.3em; width: 3px; background: var(--gold); border-radius: 2px; }
.tug-knot { position: absolute; top: 50%; width: 1.4em; height: 1.4em; margin-left: -0.7em; border-radius: 50%; transform: translateY(-50%); background: radial-gradient(circle at 35% 30%, #fff8dc, var(--gold) 60%, #b7791f); box-shadow: 0 0 12px rgba(255, 197, 61, 0.7); transition: left 0.9s cubic-bezier(.2, .8, .2, 1); }
.tug-caption { text-align: center; font-size: max(12px, 0.72em); color: var(--muted); margin-top: 0.3em; }

.ticker { display: flex; align-items: stretch; margin: 0.4em 1rem 0; border-radius: 10px; overflow: hidden; min-height: 2.2em; background: rgba(8, 10, 32, 0.9); border: 1px solid rgba(255, 197, 61, 0.3); position: relative; z-index: 5; }
.lt-tag { flex: none; display: flex; align-items: center; gap: 0.35em; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #2a1600; font-weight: 900; font-size: 0.68em; letter-spacing: 0.14em; padding: 0 0.9em; }
.lt-text { display: flex; align-items: center; padding: 0.3em 1em; font-weight: 700; line-height: 1.25; }
.lt-text small { color: var(--muted); font-size: 0.8em; margin-left: 0.4em; font-weight: 600; }
.lt-text.fresh { animation: lt-in 0.5s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes lt-in { from { transform: translateY(100%); opacity: 0; } }
.ticker.quote { border-color: rgba(255, 84, 112, 0.5); }
.ticker.quote .lt-tag { background: linear-gradient(135deg, #ff7a8f, var(--con)); color: #fff; }
.ticker.quote .lt-text { font-family: var(--serif); }

.arena { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(8em, 13em) minmax(0, 1fr); align-items: end; gap: 1em; padding: 0.5em 3em 0; min-height: 0; overflow-x: clip; }
.backdrop { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.arch { position: absolute; left: 50%; top: 0.8em; width: min(60%, 44em); height: 80%; transform: translateX(-50%); border-radius: 50% 50% 0 0 / 30% 30% 0 0; border: 0.3em solid rgba(255, 197, 61, 0.28); border-bottom: none; }
.bulbs { position: absolute; inset: -0.55em -0.55em 0; border-radius: inherit; border: 0.3em dotted #ffe7a3; border-bottom: none; opacity: 0.7; animation: bulbs 1.2s steps(2) infinite; }
@keyframes bulbs { 50% { opacity: 0.4; } }
.beam { position: absolute; top: -10%; width: 22em; height: 120%; background: linear-gradient(180deg, rgba(255, 244, 214, 0.14), transparent); clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%); transform-origin: 50% 0; }
.beam-l { left: 2%; animation: sweep-l 9s ease-in-out infinite; }
.beam-r { right: 2%; animation: sweep-r 9s ease-in-out infinite; }
@keyframes sweep-l { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(-6deg); } }
@keyframes sweep-r { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(6deg); } }
.arena.hype .beam { animation-duration: 1.4s; }
.floor { position: absolute; left: -10%; right: -10%; bottom: 0; height: 24%; background: linear-gradient(180deg, #1a1446, #0b0a22); transform: perspective(500px) rotateX(55deg); transform-origin: bottom; }

.podium { position: relative; display: flex; flex-direction: column; align-items: center; z-index: 2; min-width: 0; }
.podium::before { content: ""; position: absolute; bottom: 0; left: 50%; width: 22em; height: 30em; transform: translateX(-50%); background: transparent; clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); transition: background 0.5s; pointer-events: none; z-index: -1; }
.podium.active::before { background: linear-gradient(180deg, rgba(255, 240, 200, 0.22), rgba(255, 240, 200, 0.03)); }
.bubble {
  position: relative; width: min(100%, 24em); min-height: 3.4em; max-height: 8.6em; overflow-y: auto; scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 0.75em);
  padding: 0.75em 1em; margin-bottom: 0.9em; border-radius: 18px; background: #fff; color: #11163a;
  font-weight: 600; line-height: 1.38; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); transition: opacity 0.35s, transform 0.35s;
}
.pro .bubble { border-bottom: 4px solid var(--pro); }
.con .bubble { border-bottom: 4px solid var(--con); }
.bubble.stale { opacity: 0.55; transform: scale(0.97); }
.bubble.empty { opacity: 0; }
.bubble .interim { color: #6a7396; font-style: italic; font-weight: 500; }
.dots { display: inline-flex; gap: 0.25em; vertical-align: middle; }
.dots i { width: 0.45em; height: 0.45em; border-radius: 50%; background: currentColor; animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.podium.censored .bubble .final { color: #8a90b0; font-style: italic; }

.figure { position: relative; z-index: 1; margin-bottom: -1.2em; }
.avatar { --level: 0; width: 7.5em; height: 7.5em; position: relative; }
.avatar-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.avatar .mouth-open, .avatar .mouth-flat, .avatar .mouth-wow { display: none; }
.avatar.speaking .mouth-rest { display: none; }
.avatar.speaking .mouth-open { display: inline; transform-box: fill-box; transform-origin: center; transform: scaleY(calc(0.25 + var(--level) * 1.6)); }
.avatar .eyes { transform-box: fill-box; transform-origin: center; animation: blink-eyes 5.5s infinite; animation-delay: var(--blink, 0s); }
@keyframes blink-eyes { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
.figure .avatar { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); transform: translateY(calc(var(--level) * -4px)); transition: transform 0.12s; }
.podium.offline .figure { filter: grayscale(1) brightness(0.6); }
.luna-star { animation: twinkle 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes twinkle { 50% { transform: scale(1.35) rotate(20deg); } }
.crown { position: absolute; top: -1.9em; left: 50%; width: 3.6em; transform: translateX(-50%) rotate(-8deg); z-index: 2; animation: crown 1.6s ease-in-out infinite; }
.crown-svg { width: 100%; height: auto; display: block; }
@keyframes crown { 50% { transform: translateX(-50%) rotate(8deg) translateY(-4px); } }
.podium.winner .crown { display: block !important; }
.lectern { position: relative; width: 12em; height: 8em; clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%); background: linear-gradient(180deg, #252d63, #0b0f2a); display: flex; justify-content: center; padding-top: 1.4em; }
.pro .lectern { box-shadow: inset 0 3px 0 var(--pro); }
.con .lectern { box-shadow: inset 0 3px 0 var(--con); }
.plate { display: flex; flex-direction: column; align-items: center; gap: 0.1em; padding: 0.3em 0.9em 0.4em; max-width: 10em; height: fit-content; border-radius: 8px; background: rgba(0, 0, 0, 0.35); text-align: center; }
.side-tag { font-size: 0.6em; letter-spacing: 0.24em; font-weight: 900; }
.pro .side-tag { color: var(--pro); }
.con .side-tag { color: var(--con); }
.pname { font-weight: 900; font-size: 0.95em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8.5em; }
.led { position: absolute; left: 14%; right: 14%; bottom: 1em; height: 0.3em; border-radius: 999px; opacity: 0.3; }
.pro .led { background: var(--pro); }
.con .led { background: var(--con); }
.podium.active .led { opacity: 1; animation: led 1.2s ease-in-out infinite; }
@keyframes led { 50% { opacity: 0.55; } }

.center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 0.5em; padding-bottom: 2em; text-align: center; }
.timer { position: relative; width: 6.4em; height: 6.4em; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: rgba(8, 10, 30, 0.85); stroke-width: 9; }
.timer .track { stroke: rgba(255, 255, 255, 0.1); }
.timer .ring { fill: none; stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear, stroke 0.3s; }
.timer .ring.pro { stroke: var(--pro); }
.timer .ring.con { stroke: var(--con); }
.timer .ring.judge { stroke: var(--gold); stroke-dasharray: 6 10; }
.timer.urgent .ring { stroke: #ff3b3b; }
.timer.urgent .timer-text { color: #ff6b6b; animation: pulse 0.5s infinite alternate; }
.timer-text { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 2em; font-variant-numeric: tabular-nums; }
.timer-text .ico { width: 0.9em; height: 0.9em; }
@keyframes pulse { to { transform: scale(1.15); } }
.status { font-weight: 800; min-height: 2.6em; text-wrap: balance; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }

.handoff { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 9; display: flex; flex-direction: column; align-items: center; padding: 1em 2em; border-radius: 24px; background: rgba(8, 10, 32, 0.92); border: 2px solid var(--gold); text-align: center; }
.handoff span { font-weight: 800; font-size: 1.2em; }
.handoff b { font-family: var(--display); font-size: 4.5em; line-height: 1; color: var(--gold); }
.handoff small { color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-weight: 800; }

.banners { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.banner { position: absolute; top: 38%; left: -10%; right: -10%; padding: 0.5em 0; display: flex; flex-direction: column; align-items: center; transform: rotate(-4deg); animation: banner 2.6s cubic-bezier(.2, .8, .2, 1) forwards; }
.banner strong { font-family: var(--display); font-weight: 900; font-size: 3em; text-transform: uppercase; line-height: 1; }
.banner span { font-weight: 800; font-size: 1.05em; margin-top: 0.15em; }
.banner-pro { background: linear-gradient(90deg, transparent, var(--pro-2) 15%, var(--pro) 50%, var(--pro-2) 85%, transparent); }
.banner-con { background: linear-gradient(90deg, transparent, var(--con-2) 15%, var(--con) 50%, var(--con-2) 85%, transparent); }
.banner-gold { background: linear-gradient(90deg, transparent, var(--gold-2) 15%, var(--gold) 50%, var(--gold-2) 85%, transparent); color: #2a1600; }
@keyframes banner { 0% { transform: translateX(-100%) rotate(-4deg); } 18%, 78% { transform: translateX(0) rotate(-4deg); } 100% { transform: translateX(100%) rotate(-4deg); } }

/* audience */
.audience { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; padding: 0.3em 1em 0; background: linear-gradient(180deg, transparent 0%, rgba(5, 6, 15, 0.85) 45%); }
.row-seats { display: flex; justify-content: center; gap: 0.6em; position: relative; }
.row-seats + .row-seats { margin-top: 0.45em; }
.row-seats::after { content: ""; position: absolute; left: -1em; right: -1em; bottom: 0.9em; height: 1.5em; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, #4d1430, #300c1c); z-index: 0; }
.juror { position: relative; width: 5em; display: flex; flex-direction: column; align-items: center; z-index: 1; }
.juror .avatar { width: 4em; height: 4em; transition: transform 0.6s cubic-bezier(.2, .8, .2, 1); }
.juror.pro .avatar { transform: rotate(-4deg); }
.juror.con .avatar { transform: rotate(4deg); }
.juror.flip .avatar { animation: hop 0.7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes hop { 35% { transform: translateY(-14px) scale(1.08); } }
.juror .who { position: relative; z-index: 2; margin-top: -0.4em; font-size: max(12px, 0.64em); font-weight: 800; padding: 0.1em 0.5em; border-radius: 6px; background: rgba(5, 6, 15, 0.85); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c8cbe0; }
.juror .likes { display: none; }
.juror.chat-seat .likes { display: block; font-size: max(11px, 0.6em); color: #c4a5ff; font-weight: 800; }
.sign { position: absolute; top: -0.2em; right: -0.3em; z-index: 3; padding: 0.15em 0.4em; border-radius: 6px; font-size: 0.6em; font-weight: 900; background: #2a2f55; color: #c8cbe0; transform: rotate(10deg); transition: background 0.3s; }
.sign::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 0.9em; background: #8a6a3a; }
.juror.pro .sign { background: var(--pro); color: #fff; }
.juror.con .sign { background: var(--con); color: #fff; }
.juror.flip .sign { animation: sign-flip 0.7s; }
@keyframes sign-flip { 50% { transform: rotate(10deg) scale(1.4); } }
.juror.undecided .avatar .mouth-rest { display: none; }
.juror.undecided .avatar .mouth-flat { display: inline; }
.juror.flip .avatar .mouth-rest, .juror.flip .avatar .mouth-flat { display: none; }
.juror.flip .avatar .mouth-wow { display: inline; }
.juror.chat-seat .avatar { filter: drop-shadow(0 0 10px rgba(145, 70, 255, 0.6)); }
.react { position: absolute; bottom: calc(100% - 0.4em); left: 50%; width: max-content; max-width: 9.5em; transform: translate(-50%, 6px) scale(0.7); opacity: 0; pointer-events: none; background: #fffdf2; color: #2b2410; font-size: max(12px, 0.72em); font-weight: 700; line-height: 1.25; padding: 0.4em 0.6em; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); transition: opacity 0.3s, transform 0.35s cubic-bezier(.2, 1.4, .4, 1); z-index: 9; text-align: center; }
.react::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fffdf2; }
.juror.reacting .react { opacity: 1; transform: translate(-50%, 0) scale(1); }
.juror.reacting .avatar .mouth-rest, .juror.reacting .avatar .mouth-flat, .juror.reacting .avatar .mouth-wow { display: none; }
.juror.reacting .avatar .mouth-open { display: inline; animation: chatter 0.22s 6 alternate; transform-box: fill-box; transform-origin: center; }
@keyframes chatter { from { transform: scaleY(0.3); } to { transform: scaleY(1); } }

/* dock: one row that always says what to do now */
.dock { display: flex; justify-content: center; align-items: center; gap: 0.8rem; flex-wrap: wrap; padding: 0.7rem 1rem 0.9rem; background: rgba(4, 5, 14, 0.94); border-top: 1px solid var(--line); position: relative; z-index: 6; font-size: 15px; min-height: 4.2rem; }
.dock-mine, .dock-theirs, .dock-vote { display: flex; align-items: center; justify-content: center; gap: 0.7rem; flex-wrap: wrap; }
.mic-pill { display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.6rem 1rem; border-radius: 999px; background: var(--surface-2); font-weight: 800; min-width: 13rem; }
.mic-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--muted); }
.mic-pill.live { background: rgba(225, 29, 72, 0.16); box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.6); }
.mic-pill.live .mic-dot { background: #ff3b5c; animation: blink 1.2s infinite; }
.mic-pill.ok { box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.7); }
.mic-pill.warn { color: var(--gold); }
@keyframes blink { 50% { opacity: 0.3; } }
.level { display: inline-block; width: 3.5rem; height: 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.level i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #facc15, #ef4444); transition: width 0.08s; }
.level.big { width: 12rem; height: 0.5rem; }
.type-form { flex-basis: 100%; display: flex; justify-content: center; }
.type-form input { max-width: 40rem; border-radius: 999px; padding: 0.6rem 1rem; }
.hint-text { color: var(--muted); font-weight: 600; }
.vote-label { font-weight: 800; }
.vote-label small { color: var(--muted); font-weight: 600; }
.vp.pro.on { background: var(--pro); border-color: var(--pro); }
.vp.con.on { background: var(--con); border-color: var(--con); }

.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 100vw); background: #0d1230; border-left: 1px solid var(--line); z-index: 30; display: flex; flex-direction: column; animation: drawer-in 0.25s ease-out; }
@keyframes drawer-in { from { transform: translateX(100%); } }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--line); }
.drawer ol { list-style: none; margin: 0; padding: 1rem; overflow-y: auto; display: grid; gap: 0.7rem; }
.drawer li { padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--surface); line-height: 1.45; }
.drawer li.pro { border-left: 4px solid var(--pro); }
.drawer li.con { border-left: 4px solid var(--con); }
.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); background: #23285a; border: 1px solid var(--line); padding: 0.75rem 1.2rem; border-radius: 12px; z-index: 50; max-width: 90vw; font-weight: 600; }

/* ---------- overlays ---------- */

.overlay { position: fixed; inset: 0; background: rgba(3, 4, 14, 0.75); backdrop-filter: blur(6px); display: flex; justify-content: center; z-index: 20; padding: 1rem; overflow-y: auto; font-size: 16px; }
.dialog { margin: auto 0; width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem; text-align: center; display: grid; gap: 0.9rem; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: dialog-in 0.35s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes dialog-in { from { transform: scale(0.94) translateY(16px); opacity: 0; } }
.dialog h2 { font-family: var(--display); font-size: 1.6rem; font-weight: 900; }
.lobby-faces { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; }
.lobby-face { display: flex; flex-direction: column; align-items: center; font-weight: 800; }
.lobby-face .avatar { width: 92px; height: 92px; }
.lobby-face small { font-size: 0.7rem; letter-spacing: 0.2em; font-weight: 900; }
.lobby-face.pro small { color: var(--pro); }
.lobby-face.con small { color: var(--con); }
.lobby-face.waiting .avatar { opacity: 0.25; filter: grayscale(1); }
.vs { font-family: var(--display); font-weight: 900; font-size: 1.8rem; padding-bottom: 2rem; color: var(--gold); }
.lobby-motion { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.lobby-side { color: var(--muted); }
.lobby-side b { color: var(--text); }
.rules { text-align: left; margin: 0; padding: 0.8rem 0.9rem 0.8rem 2rem; border-radius: 12px; background: rgba(0, 0, 0, 0.25); display: grid; gap: 0.35rem; line-height: 1.4; }
.mic-check { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.mic-check .level { flex: none; }
.lobby-foot, .result-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.invite { display: grid; gap: 0.5rem; justify-items: center; padding: 0.9rem; border-radius: 14px; border: 1px dashed rgba(255, 197, 61, 0.45); }
.code-box { display: flex; justify-content: center; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.room-invite .row { justify-content: center; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.7rem; font-weight: 900; letter-spacing: 0.3em; padding: 0.1rem 0.6rem; border-radius: 10px; background: rgba(255, 255, 255, 0.08); }
.code.masked { filter: blur(9px); user-select: none; }
.seats { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.3rem; color: var(--muted); font-weight: 600; }
.seats li { display: flex; align-items: center; justify-content: center; gap: 0.35rem; }
.seats li.ready { color: #86efac; }

.result { width: min(600px, 100%); }
.result-hero { position: relative; display: flex; justify-content: center; }
.winner-avatar { width: clamp(90px, 15vh, 130px); height: clamp(90px, 15vh, 130px); }
.result-crown { position: absolute; top: -28px; width: 64px; animation: crown-drop 0.9s cubic-bezier(.2, 1.6, .4, 1) 0.3s both; }
.result.lost .result-crown { display: none; }
@keyframes crown-drop { from { transform: translateY(-80px) rotate(-30deg); opacity: 0; } }
.verdict { color: var(--muted); }
.final-score { display: flex; justify-content: center; gap: 0.8rem; }
.fs { display: flex; flex-direction: column; align-items: center; min-width: 6rem; padding: 0.5rem 1rem; border-radius: 14px; }
.fs b { font-family: var(--display); font-size: 2.4rem; font-weight: 900; line-height: 1; }
.fs span { font-size: 0.7rem; font-weight: 900; letter-spacing: 0.2em; }
.fs.pro { background: rgba(59, 156, 255, 0.16); color: #9fd2ff; }
.fs.con { background: rgba(255, 84, 112, 0.16); color: #ffb0bf; }
.momentum { margin: 0; padding: 0.5rem; border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
.momentum svg { width: 100%; height: clamp(44px, 7vh, 70px); display: block; }
.reasons { display: grid; gap: 0.35rem; text-align: left; }
.reasons h3 { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.reason { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; padding: 0.3rem 0.5rem; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.reason.pro b { color: #7cc4ff; }
.reason.con b { color: #ff8da1; }
.quotes { display: grid; gap: 0.5rem; }
.quote { padding: 0.6rem 0.9rem; border-radius: 12px; background: rgba(255, 255, 255, 0.05); text-align: left; }
.quote.pro { border-left: 4px solid var(--pro); }
.quote.con { border-left: 4px solid var(--con); }
.quote q { font-family: var(--serif); font-weight: 700; }
.quote small { display: block; color: var(--muted); margin-top: 0.2rem; font-weight: 700; }
.result-actions { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.avatar.mini { display: inline-block; width: 2rem; height: 2rem; vertical-align: middle; flex: none; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 40; }

/* ---------- tournament room ---------- */

#room { max-width: 1180px; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
.room-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.room-title { text-align: center; }
.room-title h2 { font-family: var(--display); font-weight: 900; font-size: clamp(1.4rem, 3vw, 2.1rem); }
.room-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card h3 { font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem; }
.room-stage { grid-row: span 2; text-align: center; display: grid; gap: 0.8rem; }
.showdown { display: flex; justify-content: center; align-items: center; gap: 1.5rem; }
.showdown .champ, .showdown .challenger { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; min-width: 9rem; }
.showdown .avatar { width: 120px; height: 120px; }
.showdown b { font-size: 1.15rem; }
.showdown small { color: var(--gold); font-weight: 800; min-height: 1.2em; }
.showdown .tag { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.showdown .tag .crown-svg { width: 1.2rem; }
.room-live { display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.6rem; border-radius: 12px; background: rgba(225, 29, 72, 0.12); font-weight: 700; }
.live-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #ff3b5c; animation: blink 1.2s infinite; }
.room-next { font-weight: 800; color: var(--gold); }
.standings { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.standings th { text-align: left; font-size: 0.7rem; letter-spacing: 0.1em; color: var(--muted); padding: 0.3rem; }
.standings td { padding: 0.35rem 0.3rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.standings tr.champion td { background: rgba(255, 197, 61, 0.08); }
.standings tr.me td:nth-child(2) { font-weight: 900; }
.standings tr.away { opacity: 0.5; }
.crown-mini .crown-svg { width: 1rem; vertical-align: -0.1em; }
.host-tag { font-size: 0.7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 0.3rem; }
.kick { padding: 0.15rem 0.5rem; font-size: 0.75rem; }
.results-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.results-list li { padding: 0.6rem 0.8rem; border-radius: 10px; background: rgba(255, 255, 255, 0.04); display: grid; gap: 0.15rem; }
.results-list small { color: var(--muted); }
.results-list q { font-family: var(--serif); font-weight: 700; }
.room-settings summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.room-settings input { width: 12rem; padding: 0.45rem 0.7rem; }
.room-settings .option-row { display: grid; gap: 0.35rem; justify-items: start; }
.room-settings .seg button { padding: 0.35rem 0.75rem; }
.twitch-state { font-size: 0.8rem; color: #86efac; }

/* ---------- OBS: overlay hides chrome, transparent drops the background ---------- */

body.overlay-mode .dock, body.overlay-mode .chrome, body.overlay-mode .lobby .cta, body.overlay-mode .lobby .mic-check,
body.overlay-mode .lobby .rules, body.overlay-mode .lobby-foot, body.overlay-mode .lobby .hint, body.overlay-mode .result-actions,
body.overlay-mode .result-links, body.overlay-mode .room-top .btn { display: none !important; }
body.overlay-mode #stage { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
html.transparent, body.transparent, body.transparent #stage, body.transparent #room { background: transparent !important; }
body.transparent .backdrop { display: none; }
body.transparent .overlay { background: transparent; backdrop-filter: none; }
body.transparent .motion, body.transparent .status { background: rgba(8, 10, 32, 0.88); border-radius: 12px; padding: 0.2em 0.9em; justify-self: center; }
body.transparent .status:empty { display: none; }
body.transparent .tug-caption { display: inline-block; background: rgba(8, 10, 32, 0.88); border-radius: 8px; padding: 0 0.5em; }
body.transparent .tug { text-align: center; }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .room-grid { grid-template-columns: 1fr; }
  .room-stage { grid-row: auto; }
}
@media (max-width: 760px) {
  .modes { grid-template-columns: repeat(2, 1fr); }
  .names { flex-direction: column; }
  .packs { margin-left: 0; }
  .how { grid-template-columns: 1fr; }
  .icon-toggle .label { display: none; }
  #stage { height: auto; min-height: 100dvh; overflow: visible; font-size: 13px; }
  .scoreboard { grid-template-columns: auto 1fr auto; }
  .scoreboard .team { display: none; }
  .arena { grid-template-columns: 1fr 1fr; padding: 0.5em 0.8em 0; }
  .center { grid-column: 1 / -1; grid-row: 1; flex-direction: row; justify-content: center; padding-bottom: 0.5em; }
  .timer { width: 4.5em; height: 4.5em; }
  .lectern { width: 9em; height: 6em; }
  .avatar { width: 5.5em; height: 5.5em; }
  .bubble { font-size: 0.9em; max-height: 7em; }
  .arch, .beam { display: none; }
  .juror { width: 3.9em; }
  .juror .avatar { width: 3.3em; height: 3.3em; }
  .dock { position: sticky; bottom: 0; }
  .mic-pill { min-width: 0; }
  .handoff { font-size: 0.8em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
