:root {
  --bg: #0b0716; --bg2: #140c26; --panel: #161029; --panel2: #1e1636; --line: #2c2250;
  --text: #ece8ff; --muted: #9a90c2; --pink: #ff3cac; --cyan: #37e2d5; --yellow: #ffd23f;
  --woot: #39e58c; --meh: #ff5470; --grab: #b06cff;
  --hype: 0; --beat: .5s;
  --radius: 14px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- common ---------- */
.btn { border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; white-space: nowrap; transition: transform .08s, filter .15s, background .15s; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.primary { background: linear-gradient(135deg, var(--pink), #8a3cff); border-color: transparent; color: #fff; box-shadow: 0 4px 18px -6px var(--pink); }
.btn.danger { background: #3a1424; border-color: #6d2440; color: #ffb3c4; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--panel2); }
input { background: #0e0a1d; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; min-width: 0; }
input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px #ff3cac33; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 2px 10px; line-height: 1.4; }

.logo { display: flex; align-items: center; gap: 8px; font-weight: 900; letter-spacing: .5px; font-size: 20px; }
.logo .app-name { background: linear-gradient(90deg, var(--pink), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.disc { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, var(--yellow) 0 3px, #111 4px 6px, #2a1f4a 7px 8px, #111 9px); border: 2px solid var(--pink); box-shadow: 0 0 12px var(--pink); animation: spin 2.4s linear infinite; }
.logo.big { font-size: 40px; justify-content: center; }
.logo.big .disc { width: 42px; height: 42px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- join ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; padding: 16px;
  background: radial-gradient(ellipse at 50% 0%, #3b1260 0%, transparent 60%), radial-gradient(ellipse at 80% 100%, #0b4a55 0%, transparent 50%), var(--bg); }
.join-card { width: min(420px, 100%); background: #140c26cc; border: 1px solid var(--line); border-radius: 22px; padding: 30px 26px; text-align: center; backdrop-filter: blur(8px); box-shadow: 0 30px 80px -30px #000, 0 0 60px -30px var(--pink); }
.tagline { color: var(--muted); margin: 8px 0 18px; }
.join-preview { display: flex; justify-content: center; gap: 4px; height: 96px; margin-bottom: 14px; align-items: flex-end; }
.join-preview .dancer svg { width: 60px; height: 92px; }
#joinForm { display: flex; flex-direction: column; gap: 10px; }
#joinForm input { text-align: center; font-size: 17px; padding: 12px; }
#joinForm .btn { padding: 12px; font-size: 16px; }
.join-err { color: var(--meh); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }
.join-card { position: relative; }
.auth-close { position: absolute; top: 12px; right: 12px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 12px; background: #0e0a1d; border: 1px solid var(--line); border-radius: 12px; }
.auth-tab { border: 0; background: none; padding: 9px; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--muted); }
.auth-tab.active { background: var(--panel2); color: var(--text); box-shadow: inset 0 -2px 0 var(--pink); }
.auth-note { margin: 0 0 12px; padding: 10px 12px; font-size: 14px; line-height: 1.45; text-align: left; background: #1d1440; border: 1px solid #8a3cff66; border-radius: 12px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; margin-top: 4px; }
.guest-row { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.guest-row .btn { width: 100%; }
.rb.guest { background: #1e1636; color: var(--muted); border-color: var(--line); }
.fine { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #0e0920e6; border-bottom: 1px solid var(--line); z-index: 5; }
.room-title { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--line); min-width: 0; }
.room-name { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.owner-chip { display: flex; align-items: center; gap: 5px; background: #2b2108; border: 1px solid #6b4e12; color: var(--yellow); border-radius: 999px; padding: 2px 10px 2px 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.owner-chip .oc-av { width: 20px; height: 20px; display: inline-block; } .owner-chip .oc-av svg { width: 100%; height: 100%; }
.rooms-toggle { font-size: 18px; }
.spacer { flex: 1; }
.vol { display: flex; align-items: center; gap: 4px; }
.vol input { width: 90px; padding: 0; accent-color: var(--pink); }
.points { position: relative; display: flex; align-items: center; gap: 6px; background: #261a07; border: 1px solid #6b4e12; color: var(--yellow); padding: 6px 12px; border-radius: 999px; font-weight: 800; }
.points .star { filter: drop-shadow(0 0 6px var(--yellow)); }
.points .plus { position: absolute; right: -6px; top: -4px; font-size: 12px; color: var(--yellow); opacity: 0; pointer-events: none; }
.points .plus.show { animation: plus 1.2s ease-out; }
@keyframes plus { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-22px); } }
.points.small { padding: 4px 10px; font-size: 14px; }
.me { display: flex; align-items: center; gap: 8px; font-weight: 700; background: none; border: 1px solid transparent; border-radius: 10px; padding: 4px 8px; cursor: pointer; }
.me:hover { border-color: var(--line); background: var(--panel2); }
.me .caret { font-size: 11px; color: var(--muted); }
.acct-wrap { position: relative; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 290px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; z-index: 40; box-shadow: 0 20px 50px -15px #000; display: flex; flex-direction: column; gap: 10px; }
.am-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 16px; }
.am-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--cyan); border: 1px solid #37e2d555; border-radius: 999px; padding: 2px 8px; }
.am-p { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.4; }
#amUser { display: flex; flex-direction: column; gap: 10px; }
.am-sec { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #0e0a1d; }
.am-sec summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.am-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.am-out { margin: 0; font-size: 13px; min-height: 0; word-break: break-word; }
.am-out.ok { color: var(--cyan); } .am-out.bad { color: var(--meh); }
.me-av { width: 26px; height: 26px; display: inline-block; }
.me-av svg { width: 100%; height: 100%; }

main { display: grid; grid-template-columns: 250px minmax(0, 1fr) 360px; min-height: 0; transition: grid-template-columns .25s; }
main.rooms-collapsed { grid-template-columns: 0 minmax(0, 1fr) 360px; }
main.rooms-collapsed .rooms { visibility: hidden; }

/* ---------- stage ---------- */
.stage { position: relative; overflow: hidden; min-height: 0;
  background: radial-gradient(ellipse at 50% 18%, #2a0f4d 0%, transparent 55%), linear-gradient(#0d0820, #090514 60%, #07040f); }
.lights { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.beam { position: absolute; top: -10%; width: 160px; height: 120%; transform-origin: 50% 0;
  background: linear-gradient(to bottom, var(--c) 0%, transparent 85%); filter: blur(10px);
  opacity: calc(.08 + var(--hype) * .5); mix-blend-mode: screen;
  clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
  animation: sweep calc(7s - var(--hype) * 4s) ease-in-out infinite alternate; transition: opacity .6s; }
.b1 { left: 5%;  --c: var(--pink); animation-delay: -1s; }
.b2 { left: 25%; --c: var(--cyan); animation-delay: -3s; }
.b3 { left: 45%; --c: var(--yellow); animation-delay: -2s; }
.b4 { left: 65%; --c: var(--grab); animation-delay: -4s; }
.b5 { left: 82%; --c: var(--pink); animation-delay: -.5s; }
@keyframes sweep { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
.haze { position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at 50% 70%, rgba(255,60,172, calc(.05 + var(--hype) * .25)), transparent 60%);
  animation: pulse var(--beat) ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .6; } to { opacity: 1; } }
.stage.flash .haze { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: 1; filter: brightness(2.2); } 100% { opacity: .8; } }

.screen-wrap { position: relative; z-index: 2; display: flex; justify-content: center; padding-top: 18px; }
.screen { position: relative; width: min(52%, 520px); aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden;
  border: 3px solid #241a40; box-shadow: 0 0 0 1px #000, 0 0 calc(20px + var(--hype) * 60px) -6px var(--pink), 0 0 calc(30px + var(--hype) * 80px) -20px var(--cyan); transition: box-shadow .6s; }
.screen iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.screen-empty { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; color: var(--muted); font-size: 15px; background: radial-gradient(circle, #1a1030, #07040e); padding: 10px; }
.screen-empty small { font-size: 12px; opacity: .8; }
.eq { display: flex; gap: 4px; align-items: flex-end; height: 30px; justify-content: center; }
.eq i { width: 6px; background: linear-gradient(var(--pink), var(--cyan)); border-radius: 2px; animation: eq 1s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -.3s } .eq i:nth-child(3) { animation-delay: -.6s } .eq i:nth-child(4) { animation-delay: -.15s } .eq i:nth-child(5) { animation-delay: -.45s }
@keyframes eq { from { height: 6px; } to { height: 30px; } }
.unmute { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; background: #000c; color: #fff; border: 1px solid var(--pink); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; }

.booth { position: relative; z-index: 3; width: min(46%, 420px); margin: 10px auto 0; display: flex; flex-direction: column; align-items: center; }
.dj-spot { position: relative; height: 112px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: -38px; z-index: 1; }
.dj-spot .avatar { position: relative; left: auto; top: auto; transform: none; }
.dj-spot .avatar .av { width: 74px; height: 114px; }
.dj-spot .avatar .tag { position: absolute; top: -16px; }
.deck { position: relative; z-index: 2; width: 100%; height: 56px; border-radius: 12px 12px 4px 4px;
  background: linear-gradient(#2a1f4a, #150e2b); border: 1px solid #3d2f6b; display: flex; align-items: center; justify-content: space-around; padding: 0 12px;
  box-shadow: 0 -2px 0 var(--pink) inset, 0 10px 30px -10px #000, 0 0 calc(10px + var(--hype) * 40px) -8px var(--pink); }
.deck::after { content: "DJ"; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 9px; letter-spacing: 4px; color: var(--pink); text-shadow: 0 0 6px var(--pink); }
.tt { width: 40px; height: 40px; border-radius: 50%; background: repeating-radial-gradient(#111 0 2px, #1d1d1d 2px 4px); border: 2px solid #444; display: grid; place-items: center; }
.tt i { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); }
.stage.live .tt { animation: spin 1.8s linear infinite; }
.mixer { display: flex; gap: 6px; }
.mixer b { width: 6px; height: 26px; border-radius: 3px; background: #0a0716; position: relative; overflow: hidden; }
.mixer b::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 40%; background: linear-gradient(var(--yellow), var(--woot)); }
.stage.live .mixer b::after { animation: eq var(--beat) ease-in-out infinite alternate; }
.stage.live .mixer b:nth-child(2)::after { animation-delay: -.2s; } .stage.live .mixer b:nth-child(3)::after { animation-delay: -.35s; }

.floor { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, #ffffff07 0 1px, transparent 1px 60px),
    repeating-linear-gradient(0deg, #ffffff07 0 1px, transparent 1px 30px),
    radial-gradient(ellipse at 50% 0%, rgba(55,226,213, calc(.06 + var(--hype) * .2)), transparent 70%);
  transform: perspective(400px) rotateX(35deg); transform-origin: bottom;
  -webkit-mask-image: linear-gradient(to top, #000 30%, transparent); mask-image: linear-gradient(to top, #000 30%, transparent); }
.crowd { position: absolute; left: 3%; right: 3%; bottom: 0; height: 44%; z-index: 4; }

/* ---------- characters ---------- */
.dancer svg { overflow: visible; display: block; }
.chr g { transform-box: view-box; }
.chr .f { display: none; } .chr .fi { display: inline; }
.woot .chr .fi, .meh .chr .fi { display: none; } .woot .chr .fw, .meh .chr .fm { display: inline; }
.chr .rig { transform-origin: 10px 34px; } .chr .hd { transform-origin: 10px 19.5px; }
.chr .al { transform-origin: 5px 20.5px; } .chr .ar { transform-origin: 15px 20.5px; }
.chr .ll { transform-origin: 7.5px 27px; } .chr .lr { transform-origin: 12.5px 27px; }
.avatar { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; transition: left .6s, top .6s; }
.avatar .av { width: 62px; height: 96px; filter: drop-shadow(0 3px 2px #0007); }
.avatar .tag { margin-top: 1px; font-size: 10px; font-weight: 700; background: #0009; padding: 1px 6px; border-radius: 6px; white-space: nowrap; max-width: 96px; overflow: hidden; text-overflow: ellipsis; color: #ddd; }
.avatar.me .tag { color: var(--yellow); border: 1px solid #ffd23f55; }
.avatar.owner .tag { color: #ffe08a; }
.avatar.dj .tag { color: var(--pink); }
.avatar.woot .tag { background: #0b3a24cc; }
.avatar.meh .tag { background: #3a0b18cc; }
.avatar.meh .av { filter: saturate(.45) brightness(.8) drop-shadow(0 3px 2px #0007); }
/* idle: bob to the beat while a track plays */
.stage.live .dancer:not(.woot):not(.meh):not(.dj) .rig { animation: idle-rig 1s steps(1, end) infinite var(--ph, 0s); }
.stage.live .dancer:not(.woot):not(.meh):not(.dj) .hd { animation: idle-hd 1s steps(1, end) infinite var(--ph, 0s); }
@keyframes idle-rig { 0% { transform: none; } 50% { transform: translateY(.7px); } }
@keyframes idle-hd { 0%, 50% { transform: none; } 25%, 75% { transform: translateY(.5px); } }
/* meh: head down, arms limp, no dancing */
.meh .chr .hd { transform: translateY(1.2px) rotate(5deg); }
.meh .chr .al { transform: rotate(-6deg); } .meh .chr .ar { transform: rotate(6deg); }
.meh .chr .rig { transform: translateY(.6px); }
/* woot: 4 real dances, 4 frames per loop (1s = 2 beats), picked per user */
.woot .chr .rig, .woot .chr .hd, .woot .chr .al, .woot .chr .ar, .woot .chr .ll, .woot .chr .lr { animation-duration: 1s; animation-timing-function: steps(1, end); animation-iteration-count: infinite; animation-delay: var(--ph, 0s); }
.woot.m0 .chr .rig { animation-name: m0-rig; } .woot.m0 .chr .hd { animation-name: m0-hd; } .woot.m0 .chr .al { animation-name: m0-al; } .woot.m0 .chr .ar { animation-name: m0-ar; } .woot.m0 .chr .ll { animation-name: step-l; } .woot.m0 .chr .lr { animation-name: step-r; }
@keyframes m0-rig { 0%, 50% { transform: none; } 25%, 75% { transform: translateY(-1.2px); } }
@keyframes m0-hd { 0%, 50% { transform: none; } 25% { transform: rotate(8deg) translateY(.6px); } 75% { transform: rotate(-8deg) translateY(.6px); } }
@keyframes m0-al { 0%, 50% { transform: rotate(18deg); } 25% { transform: rotate(140deg); } 75% { transform: rotate(-12deg); } }
@keyframes m0-ar { 0%, 50% { transform: rotate(-18deg); } 25% { transform: rotate(12deg); } 75% { transform: rotate(-140deg); } }
@keyframes step-l { 0%, 25%, 50% { transform: none; } 75% { transform: translateY(-2px); } }
@keyframes step-r { 0%, 50%, 75% { transform: none; } 25% { transform: translateY(-2px); } }
.woot.m1 .chr .rig { animation-name: m1-rig; } .woot.m1 .chr .hd { animation-name: m1-hd; } .woot.m1 .chr .al { animation-name: m1-al; } .woot.m1 .chr .ar { animation-name: m1-ar; } .woot.m1 .chr .ll { animation-name: step-r; } .woot.m1 .chr .lr { animation-name: step-l; }
@keyframes m1-rig { 0% { transform: rotate(-5deg) translateX(-.6px); } 25%, 75% { transform: translateY(-1.4px); } 50% { transform: rotate(5deg) translateX(.6px); } }
@keyframes m1-hd { 0% { transform: rotate(-7deg); } 25%, 75% { transform: translateY(.6px); } 50% { transform: rotate(7deg); } }
@keyframes m1-al { 0% { transform: rotate(155deg); } 25%, 75% { transform: rotate(118deg); } 50% { transform: rotate(165deg); } }
@keyframes m1-ar { 0% { transform: rotate(-165deg); } 25%, 75% { transform: rotate(-118deg); } 50% { transform: rotate(-155deg); } }
.woot.m2 .chr .rig { animation-name: m2-rig; } .woot.m2 .chr .hd { animation-name: m2-hd; } .woot.m2 .chr .al { animation-name: m2-al; } .woot.m2 .chr .ar { animation-name: m2-ar; } .woot.m2 .chr .ll { animation-name: m2-ll; } .woot.m2 .chr .lr { animation-name: m2-lr; }
@keyframes m2-rig { 0%, 50% { transform: none; } 25% { transform: translate(-1px, -1px); } 75% { transform: translate(1px, -1px); } }
@keyframes m2-hd { 0%, 50% { transform: none; } 25%, 75% { transform: translateY(1.2px) rotate(-3deg); } }
@keyframes m2-al { 0%, 50% { transform: rotate(60deg); } 25%, 75% { transform: rotate(-25deg); } }
@keyframes m2-ar { 0%, 50% { transform: rotate(25deg); } 25%, 75% { transform: rotate(-60deg); } }
@keyframes m2-ll { 0%, 50%, 75% { transform: none; } 25% { transform: translate(-1px, -2px) rotate(10deg); } }
@keyframes m2-lr { 0%, 25%, 50% { transform: none; } 75% { transform: translate(1px, -2px) rotate(-10deg); } }
.woot.m3 .chr .rig { animation-name: m3-rig; } .woot.m3 .chr .hd { animation-name: m3-hd; } .woot.m3 .chr .al { animation-name: m3-al; } .woot.m3 .chr .ar { animation-name: m3-ar; } .woot.m3 .chr .ll { animation-name: step-l; } .woot.m3 .chr .lr { animation-name: step-r; }
@keyframes m3-rig { 0%, 50% { transform: none; } 25%, 75% { transform: translateY(-1px); } }
@keyframes m3-hd { 0%, 25% { transform: translateX(-1px); } 50%, 75% { transform: translateX(1px); } }
@keyframes m3-al { 0% { transform: rotate(90deg); } 25% { transform: rotate(90deg) translateY(1px); } 50%, 75% { transform: rotate(0deg); } }
@keyframes m3-ar { 0%, 25% { transform: rotate(0deg); } 50% { transform: rotate(-90deg); } 75% { transform: rotate(-90deg) translateY(1px); } }
/* DJ behind the booth: head nods, one hand scratches, the other cups the headphones */
.stage.live .dancer.playing .chr .hd { animation: dj-hd .5s steps(1, end) infinite var(--ph, 0s); }
.stage.live .dancer.playing .chr .ar { animation: dj-ar .5s steps(1, end) infinite var(--ph, 0s); }
.stage.live .dancer.playing .chr .al { animation: dj-al 4s steps(1, end) infinite; }
@keyframes dj-hd { 0% { transform: none; } 50% { transform: translateY(1px) rotate(4deg); } }
@keyframes dj-ar { 0% { transform: rotate(-35deg); } 50% { transform: rotate(-55deg) translateY(-.5px); } }
@keyframes dj-al { 0% { transform: rotate(20deg); } 50% { transform: rotate(150deg) translate(-1px, 2px); } 75% { transform: rotate(35deg); } }
.cloud { position: absolute; top: -6px; z-index: 2; font-size: 13px; animation: drift 2s ease-in-out infinite alternate; filter: grayscale(.2); }
@keyframes drift { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
.heart { position: absolute; top: 0; right: 2px; z-index: 2; font-size: 12px; color: var(--grab); text-shadow: 0 0 8px var(--grab); animation: beat var(--beat) ease-in-out infinite alternate; }
@keyframes beat { to { transform: scale(1.3); } }

/* ---------- side panel ---------- */
.side { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 12px 4px; cursor: pointer; color: var(--muted); font-weight: 700; font-size: 13px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--pink); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--panel2); font-size: 11px; color: var(--muted); }
.panel { display: none; flex: 1; flex-direction: column; min-height: 0; padding: 10px; }
.panel.active { display: flex; }
.panel-head { margin-bottom: 10px; }
.list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--panel2); border-radius: 10px; border: 1px solid transparent; }
.row.hl { border-color: var(--pink); background: #2a1240; }
.row .mini { width: 28px; height: 28px; flex: none; }
.row .mini svg { width: 100%; height: 100%; }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { color: var(--muted); font-size: 11px; }
.row .num { width: 22px; text-align: center; color: var(--muted); font-weight: 800; }
.row img { width: 64px; height: 36px; object-fit: cover; border-radius: 6px; flex: none; background: #000; }
.row .pts { color: var(--yellow); font-weight: 700; font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13px; }
.add-form, .chat-form { display: flex; gap: 6px; }
.add-form input, .chat-form input { flex: 1; }
.add-form input[type=search]::-webkit-search-cancel-button { filter: invert(1) hue-rotate(180deg); cursor: pointer; }

/* in-app YouTube search */
.search { display: flex; flex-direction: column; min-height: 0; max-height: 62%; margin-top: 8px; padding: 8px; background: #0e0a1d; border: 1px solid var(--line); border-radius: 12px; }
.search[hidden] { display: none; }
.side { min-width: 0; }
.search-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 0 2px 6px; }
.search-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-head .err { color: var(--meh); white-space: normal; }
.search-list { flex: 1 1 auto; }
.search-list .row { padding: 6px; }
.search-list .row img { width: 80px; height: 45px; }
.search-list .t2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-list .t1 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.search-list .acts { display: flex; flex-direction: column; gap: 4px; flex: none; }
.search-list .acts .btn { min-width: 64px; }
.search-list .thumb { position: relative; flex: none; display: block; line-height: 0; }
.search-list .thumb .dur { position: absolute; right: 3px; bottom: 3px; background: #000c; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 4px; line-height: 1.3; }
.search-list .btn.added { color: var(--woot); border-color: #39e58c55; }
.search-list .skel { height: 57px; border-radius: 10px; background: linear-gradient(90deg, var(--panel2) 0%, #2a2048 50%, var(--panel2) 100%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.search + .hint { margin-top: 8px; }

.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; margin-bottom: 8px; }
.msg { display: flex; gap: 8px; align-items: flex-start; padding: 4px 4px; border-radius: 8px; font-size: 13px; line-height: 1.35; }
.msg .mini { width: 22px; height: 22px; flex: none; margin-top: -2px; }
.msg .mini svg { width: 100%; height: 100%; }
.msg .body { min-width: 0; overflow-wrap: anywhere; }
.msg .who { font-weight: 800; color: var(--cyan); margin-right: 6px; }
.msg .when { color: #6c6390; font-size: 10px; margin-left: 4px; }
.msg.mention { background: #ff3cac1c; }
.msg.sys { color: var(--muted); font-style: italic; font-size: 12px; padding: 3px 6px; }
.msg.sys.play { color: var(--yellow); font-style: normal; font-weight: 600; background: #ffd23f0d; border-left: 2px solid var(--yellow); }
.msg.sys.grab { color: #d2b0ff; border-left: 2px solid var(--grab); }
.msg.sys.join { opacity: .75; }

/* ---------- bottom bar ---------- */
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 10px 16px; background: #0e0920; border-top: 1px solid var(--line); }
.np { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np-thumb { width: 64px; height: 36px; border-radius: 6px; object-fit: cover; }
.np-text { min-width: 0; flex: 1; }
.np-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-dj { color: var(--muted); font-size: 12px; margin: 2px 0 5px; }
.np-dj b { color: var(--pink); }
.progress { height: 4px; background: #241a40; border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--cyan)); transition: width .25s linear; }
.np-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.votes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; padding-bottom: 8px; }
.vote { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 800; display: flex; align-items: center; gap: 6px; transition: transform .08s, background .15s, box-shadow .15s; }
.vote:active { transform: scale(.95); }
.vote:disabled { opacity: .4; cursor: not-allowed; }
.vote b { font-size: 12px; background: #0006; padding: 1px 6px; border-radius: 6px; }
.vote.woot .vi { color: var(--woot); } .vote.meh .vi { color: var(--meh); } .vote.grab .vi { color: var(--grab); }
.vote.woot.on { background: #0f4a2c; border-color: var(--woot); box-shadow: 0 0 16px -4px var(--woot); }
.vote.meh.on { background: #4a0f1f; border-color: var(--meh); box-shadow: 0 0 16px -4px var(--meh); }
.vote.grab.on { background: #2f1352; border-color: var(--grab); box-shadow: 0 0 16px -4px var(--grab); }
.meter { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 2px; background: #241a40; display: flex; overflow: hidden; }
.meter-woot { background: var(--woot); width: 0; transition: width .4s; }
.meter-meh { background: var(--meh); width: 0; margin-left: auto; transition: width .4s; }
.actions { display: flex; gap: 8px; }

/* ---------- shop ---------- */
.modal { background: #05030bcc; backdrop-filter: blur(4px); z-index: 60; }
.shop-card { width: min(860px, 100%); max-height: 90dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: 0 30px 80px -20px #000; }
.shop-head { display: flex; align-items: center; gap: 12px; }
.shop-head h2 { margin: 0; flex: 1; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.skin { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.skin.equipped { border-color: var(--cyan); box-shadow: 0 0 20px -8px var(--cyan); }
.skin .stagebox { width: 100%; height: 110px; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 50% 80%, #2a1650, #0e0a1d 70%); }
.skin .stagebox svg { width: 62px; height: 96px; }
.skin.locked .stagebox svg { filter: brightness(.35) saturate(.2); }
.skin .nm { font-weight: 800; }
.skin .ds { color: var(--muted); font-size: 11px; min-height: 2.4em; }
.skin .price { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 800; color: var(--yellow); background: #0008; padding: 2px 7px; border-radius: 8px; }
.skin .price.free { color: var(--woot); }
.skin .btn { width: 100%; font-size: 13px; padding: 8px 6px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1e1636f2; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px -10px #000; animation: tin .25s ease-out; }
.toast.error { border-color: var(--meh); }
.toast.ok { border-color: var(--woot); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .vol input { width: 60px; }
  .top .logo .app-name { display: none; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; }
  main { grid-template-columns: minmax(0, 1fr); }
  .stage { height: 62vh; min-height: 380px; }
  .screen { width: 78%; }
  .booth { width: 70%; }
  .crowd { height: 36%; }
  .avatar .tag { font-size: 9px; max-width: 64px; }
  .side { border-left: 0; border-top: 1px solid var(--line); height: 60vh; }
  .bar { grid-template-columns: 1fr; gap: 10px; position: sticky; bottom: 0; z-index: 10; padding: 8px 10px; }
  .votes { justify-content: space-between; }
  .vote { flex: 1; justify-content: center; padding: 8px 6px; }
  .actions .btn { flex: 1; }
  .top { padding: 8px 10px; gap: 8px; }
  .top .logo { font-size: 17px; }
  .vol, .me #meName, .shop-btn span { display: none; }
  .np-time { display: none; }
  .deck::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .beam, .avatar .av, .disc, .tt, .haze { animation: none !important; }
}

/* ---------- environments ---------- */
.env-art { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.env-art svg, .env-thumb svg, .pay-preview.env svg { width: 100%; height: 100%; display: block; }
.env-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(#0000 55%, #0006); }
.stage:not(.env-club) .floor { opacity: .35; }
.stage.env-beach .beam, .stage.env-aurora .beam { opacity: calc(.03 + var(--hype) * .25); }
.env-svg .tw { animation: twinkle 2.4s ease-in-out infinite alternate; }
.env-svg .tile { animation: tile 1s steps(1, end) infinite; }
.env-svg .pulse { animation: spk .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.env-svg .wv { animation: wave 3s ease-in-out infinite alternate; }
.env-svg .bl { animation: bulb 1.2s steps(1, end) infinite; }
.env-svg .au { animation: aurora 9s ease-in-out infinite alternate; transform-origin: center; transform-box: fill-box; }
.env-svg .au2 { animation-duration: 13s; animation-direction: alternate-reverse; }
.env-svg .lamp { animation: lamp 4s ease-in-out infinite alternate; }
.env-svg .cg { animation: cglow 3s ease-in-out infinite alternate; }
.env-svg .neonsign { animation: neon 5s steps(1, end) infinite; }
@keyframes twinkle { from { opacity: .15; } to { opacity: 1; } }
@keyframes tile { 0% { opacity: .07; } 50% { opacity: .2; } }
@keyframes spk { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes wave { from { transform: translateX(-20px); opacity: .25; } to { transform: translateX(20px); opacity: .7; } }
@keyframes bulb { 0% { opacity: 1; } 50% { opacity: .45; } }
@keyframes aurora { from { transform: skewX(-6deg) translateX(-30px); opacity: .35; } to { transform: skewX(6deg) translateX(30px); opacity: .7; } }
@keyframes lamp { from { opacity: .06; } to { opacity: .13; } }
@keyframes cglow { from { opacity: .7; filter: brightness(.9); } to { opacity: 1; filter: brightness(1.3); } }
@keyframes neon { 0%, 47%, 53%, 100% { opacity: 1; } 50% { opacity: .35; } }
.env-box { background: var(--panel2); border-radius: 12px; padding: 10px; }
.env-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 8px; }
.env-head span { color: var(--cyan); font-weight: 700; }
.env-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.env-card { position: relative; background: #0e0a1d; border: 1px solid var(--line); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.env-card.on { border-color: var(--cyan); box-shadow: 0 0 14px -6px var(--cyan); }
.env-card.locked .env-thumb { filter: brightness(.45) saturate(.5); }
.env-card.premium::before { content: "PREMIUM"; position: absolute; top: 6px; left: 6px; z-index: 1; font-size: 8px; font-weight: 800; letter-spacing: 1px; background: linear-gradient(90deg, #ffd23f, #ff3cac); color: #1a0a1a; padding: 1px 4px; border-radius: 4px; }
.env-thumb { aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; }
.env-card .en { font-size: 10px; font-weight: 700; line-height: 1.2; min-height: 2.4em; }
.env-card .btn { width: 100%; padding: 3px 4px; font-size: 11px; }
.env-on { font-size: 10px; color: var(--cyan); font-weight: 800; }

/* ---------- rooms sidebar ---------- */
.rooms { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; background: #0f0a20; border-right: 1px solid var(--line); }
.rooms-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px; }
.rooms-head h2 { margin: 0; font-size: 14px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.create-room { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 8px; }
.create-room input { font-size: 13px; padding: 7px 10px; }
.cr-actions { display: flex; gap: 6px; justify-content: flex-end; }
.create-room .hint { margin: 0; }
.room-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 0 8px 10px; }
.room-item { display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 10px; background: var(--panel2); border: 1px solid transparent; cursor: pointer; }
.room-item:hover { border-color: var(--line); }
.room-item.here { border-color: var(--pink); background: #2a1240; cursor: default; }
.room-item .grow { flex: 1; min-width: 0; }
.ri-name { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-tag { font-size: 9px; font-weight: 800; color: var(--cyan); border: 1px solid #37e2d566; border-radius: 4px; padding: 0 4px; margin-left: 5px; vertical-align: 1px; }
.ri-sub { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.ri-users { font-size: 10px; color: var(--muted); }
.room-swatch { width: 8px; align-self: stretch; border-radius: 4px; flex: none; background: linear-gradient(#ff3cac, #37e2d5); }
.env-sw-warehouse { background: linear-gradient(#ffd27a, #3b1f1a); } .env-sw-neon { background: linear-gradient(#ff3cac, #3b0b4f); }
.env-sw-beach { background: linear-gradient(#ff9a4a, #e8b77a); } .env-sw-rooftop { background: linear-gradient(#ffd23f, #1d2a55); }
.env-sw-space { background: linear-gradient(#c04d8a, #0b0a2a); } .env-sw-aurora { background: linear-gradient(#39e58c, #b06cff); }
.env-sw-vapor { background: linear-gradient(#fff36b, #ff4fd8); } .env-sw-crystal { background: linear-gradient(#9ff5ee, #f0b3ff); }
.drawer-shade { display: none; }

/* ---------- users panel ---------- */
.room-card { background: linear-gradient(135deg, #2a1240, #161029); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.rc-name { font-weight: 800; font-size: 16px; }
.rc-desc { color: var(--muted); font-size: 12px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.rc-desc:empty { display: none; }
.rc-owner { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.rc-owner .mini { width: 24px; height: 24px; } .rc-owner .mini svg { width: 100%; height: 100%; }
.rc-online { color: var(--muted); font-size: 11px; }
.people-head { margin: 8px 2px 0; }
.people-list { display: flex; flex-direction: column; gap: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 3px; margin: 2px 0 1px; }
.rb { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: #0006; color: var(--muted); white-space: nowrap; }
.rb-owner { background: #3a2a06; color: var(--yellow); border: 1px solid #6b4e12; }
.rb-dj { background: #3a0d2c; color: #ff8fd6; border: 1px solid #ff3cac66; }
.rb-wl { background: #0d2f33; color: var(--cyan); }
.rb-woot { color: var(--woot); } .rb-meh { color: var(--meh); }
.owner-act { flex: none; }
.owner-zone { margin-top: 10px; text-align: center; }
.btn.danger { background: #4a0f1f; border-color: var(--meh); }

/* ---------- premium / PayPal ---------- */
.premium-title { margin: 18px 0 8px; font-size: 16px; display: flex; gap: 10px; align-items: baseline; }
.premium-title .hint { margin: 0; }
.skin.premium { border-color: #6b4e12; background: linear-gradient(160deg, #2b2108, var(--panel2) 50%); }
.skin .price.cash { color: #1a0a1a; background: linear-gradient(90deg, #ffd23f, #ff8fd6); }
.btn.pay { background: #ffc439; color: #111; border-color: #e0a800; }
.pay-card { width: min(440px, 100%); max-height: 92dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.pay-item { display: flex; gap: 14px; align-items: center; margin: 6px 0 14px; }
.pay-preview { width: 96px; height: 96px; flex: none; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 80%, #2a1650, #0e0a1d 70%); }
.pay-preview.skin .dancer svg { width: 56px; height: 86px; }
.pay-preview.env { width: 150px; height: 84px; }
.pay-name { font-weight: 800; font-size: 17px; } .pay-desc { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.pay-price { font-weight: 800; color: var(--yellow); font-size: 18px; }
.paypal-buttons { min-height: 50px; }

@media (max-width: 1100px) {
  main { grid-template-columns: 220px minmax(0, 1fr) 300px; }
  main.rooms-collapsed { grid-template-columns: 0 minmax(0, 1fr) 300px; }
}
@media (max-width: 820px) {
  main, main.rooms-collapsed { grid-template-columns: minmax(0, 1fr); }
  .rooms, main.rooms-collapsed .rooms { visibility: visible; position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 70; transform: translateX(-102%); transition: transform .25s; box-shadow: 10px 0 40px #000a; padding-top: env(safe-area-inset-top); }
  body.drawer-open .rooms { transform: none; }
  .drawer-shade { display: block; position: fixed; inset: 0; background: #0009; z-index: 65; }
  .drawer-shade[hidden] { display: none; }
  .room-title { padding-left: 8px; gap: 6px; }
  .room-name { max-width: 34vw; font-size: 13px; }
  .owner-chip #ownerName { display: none; }
  .avatar .av { width: 40px; height: 62px; }
  .dj-spot .avatar .av { width: 52px; height: 80px; }
  .dj-spot { height: 84px; margin-bottom: -28px; }
  .env-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .chr g, .env-svg * { animation: none !important; }
}

/* Picture-in-Picture / floating mini player */
.pip-hint { position: absolute; right: 10px; bottom: 10px; z-index: 3; border: 0; border-radius: 999px; padding: 8px 12px; font-weight: 700; cursor: pointer; background: rgba(0,0,0,.7); color: #fff; }
.screen.pip-float { position: fixed; z-index: 9999; width: min(42vw, 360px); aspect-ratio: 16/9; right: 16px; bottom: 88px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.55); cursor: grab; touch-action: none; }
.screen.pip-float:active { cursor: grabbing; }
.screen.pip-float .screen-empty { display: none; }
body.pip-on .screen-wrap .screen:not(.pip-float) { visibility: hidden; }
#pipBtn.active { color: var(--pink, #ff5fd2); }
