:root {
  --bg0: #0a0612;
  --bg1: #160a24;
  --ink: #ece7f5;
  --dim: #8b7fa6;
  --edge: rgba(180,140,255,.16);
  --pink: #f0abfc;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 700px at 80% -10%, #2a0f3f 0%, transparent 55%),
    radial-gradient(900px 600px at 10% 110%, #170a2e 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  color: var(--ink);
  font-family: 'Bricolage Grotesque', sans-serif;
  min-height: 100vh;
}
.app-wrap { position: relative; max-width: 1100px; margin: 0 auto; padding: 18px 16px 40px; }

.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 60%, rgba(240,171,252,.4), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(150,220,255,.5), transparent),
    radial-gradient(1px 1px at 90% 20%, rgba(255,255,255,.35), transparent);
  background-size: 300px 300px, 400px 400px, 250px 250px, 350px 350px;
  animation: drift 60s linear infinite;
}
@keyframes drift { to { background-position: 300px 300px, -400px 400px, 250px -250px, -350px 350px; } }

.app-wrap > *:not(.stars) { position: relative; z-index: 1; }

/* Header */
.hdr { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.hdr-title-row { display: flex; align-items: baseline; gap: 12px; }
.title { font-weight: 900; font-size: clamp(34px, 7vw, 66px); letter-spacing: -.03em; margin: 0; line-height: .85;
  background: linear-gradient(90deg, #f0abfc, #67e8f9, #a3e635); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title.glow { filter: drop-shadow(0 0 18px rgba(240,171,252,.35)); animation: wobble 5s ease-in-out infinite; }
@keyframes wobble { 0%,100%{transform:rotate(-1deg)} 50%{transform:rotate(1deg)} }
.title-sub { font-family: 'Space Mono', monospace; font-size: clamp(11px,2vw,15px); letter-spacing: .35em; color: var(--dim); }

.hdr-meta { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.room-pill { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.04); border: 1px solid var(--edge); border-radius: 999px; padding: 5px 6px 5px 12px; }
.room-lbl { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--dim); letter-spacing: .2em; }
.room-input { background: transparent; border: none; color: var(--pink); font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px; width: 110px; outline: none; }
.copy-btn { background: linear-gradient(90deg,#a3e635,#67e8f9); border: none; color: #10061f; font-weight: 800; font-size: 12px; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: transform .12s; }
.copy-btn:active { transform: scale(.94); }
.online-pill { display: flex; align-items: center; gap: 7px; font-family: 'Space Mono', monospace; font-size: 12px; color: var(--dim); }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-on { background: #4ade80; box-shadow: 0 0 10px #4ade80; animation: pulse 1.6s infinite; }
.dot-off { background: #6b7280; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Layout */
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } }

/* Roster */
.roster { background: rgba(255,255,255,.03); border: 1px solid var(--edge); border-radius: 18px; padding: 14px; height: fit-content; }
.roster-h { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: .25em; color: var(--dim); margin-bottom: 12px; }
.me-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.name-input { flex: 1; background: rgba(0,0,0,.3); border: 1.5px solid; border-radius: 10px; color: var(--ink); font-family: 'Bricolage Grotesque'; font-weight: 700; padding: 6px 10px; outline: none; font-size: 14px; }
.you-tag { font-family: 'Space Mono', monospace; font-size: 10px; }
.jammer { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 14px; color: var(--ink); }
.jammer-dot { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.roster-tip { margin-top: 14px; font-size: 11px; color: var(--dim); line-height: 1.5; border-top: 1px solid var(--edge); padding-top: 10px; }

/* Stage */
.stage-col { display: flex; flex-direction: column; gap: 14px; }
.stage { position: relative; min-height: 200px; border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.35));
  border: 1px solid var(--edge); display: flex; align-items: center; justify-content: center; padding: 18px; }
.spotlight { position: absolute; inset: 0; background: radial-gradient(600px 300px at 50% -30%, rgba(240,171,252,.14), transparent 70%); pointer-events: none; }
.empty-stage { color: var(--dim); font-size: 15px; font-style: italic; }
.stage-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-end; }

.stage-blob { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.stage-blob .sb-glyph {
  width: 62px; height: 62px; border-radius: 46% 54% 55% 45% / 52% 48% 52% 48%;
  display: grid; place-items: center; font-size: 26px; color: #0a0612; font-weight: 900;
  background: radial-gradient(circle at 35% 30%, #fff8, var(--cc));
  box-shadow: 0 0 22px var(--cc), inset 0 -6px 12px rgba(0,0,0,.25);
  animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
.stage-blob .sb-name { font-size: 11px; font-weight: 700; color: var(--ink); letter-spacing: .04em; }
.stage-blob .sb-by { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 900; color: #10061f; font-family: 'Space Mono', monospace; border: 2px solid var(--bg0); }
@keyframes pop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }

.bob { animation: pop .35s cubic-bezier(.2,1.4,.4,1), bobbob .5s ease-in-out infinite; }
.stage-blob.bob .sb-glyph { animation: bobbob .5s ease-in-out infinite; }
@keyframes bobbob { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-8px); } }

/* Transport */
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--edge); border-radius: 16px; padding: 12px 16px; }
.play-btn { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 15px; padding: 10px 22px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(90deg,#f0abfc,#c084fc); color: #10061f; letter-spacing: .05em; transition: transform .12s, box-shadow .2s; box-shadow: 0 0 0 rgba(240,171,252,0); }
.play-btn:active { transform: scale(.95); }
.play-btn.is-playing { background: linear-gradient(90deg,#fb7185,#f97316); box-shadow: 0 0 24px rgba(251,113,133,.5); }
.bpm-block { display: flex; flex-direction: column; gap: 4px; }
.bpm-lbl { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--dim); letter-spacing: .1em; }
.bpm-slider { width: 130px; accent-color: #67e8f9; }
.transport-btns { display: flex; gap: 8px; margin-left: auto; }
.mini-btn { background: rgba(255,255,255,.06); border: 1px solid var(--edge); color: var(--ink); font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.mini-btn:hover { background: rgba(255,255,255,.12); }
.mini-btn.danger:hover { background: rgba(251,113,133,.25); }
.beat-dot { width: 12px; height: 12px; border-radius: 50%; transition: transform .08s, background .08s, box-shadow .08s; }

/* Tray */
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.char { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 6px; border-radius: 16px; cursor: pointer; border: 1px solid var(--edge); background: rgba(255,255,255,.03); transition: transform .12s, background .2s, box-shadow .2s; font-family: inherit; }
.char:active { transform: scale(.93); }
.char-glyph { width: 40px; height: 40px; border-radius: 44% 56% 52% 48% / 55% 45% 55% 45%; display: grid; place-items: center; font-size: 19px; font-weight: 900; color: #0a0612;
  background: radial-gradient(circle at 35% 30%, #fff9, var(--cc)); transition: box-shadow .2s, filter .2s; }
.char-name { font-size: 11px; font-weight: 700; color: var(--dim); }
.char-off .char-glyph { filter: grayscale(.7) brightness(.7); box-shadow: none; }
.char-off { opacity: .72; }
.char-on { background: rgba(255,255,255,.07); box-shadow: 0 0 0 1.5px var(--cc); }
.char-on .char-glyph { box-shadow: 0 0 18px var(--cc); }
.char-on .char-name { color: var(--ink); }
.char-by { position: absolute; top: 6px; right: 8px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 900; color: #10061f; font-family: 'Space Mono', monospace; }

/* Reference */
.ref { margin-top: 26px; }
.ref-toggle { background: none; border: none; color: var(--dim); font-family: 'Space Mono', monospace; font-size: 12px; cursor: pointer; letter-spacing: .05em; }
.ref-toggle:hover { color: var(--pink); }
.ref-embed { margin-top: 12px; display: flex; justify-content: center; }
.ref-embed iframe { border-radius: 14px; border: 1px solid var(--edge); }

/* Footer */
.ftr { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--edge); display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; font-size: 12px; color: var(--dim); }
.remix { color: var(--pink); text-decoration: none; font-weight: 700; }
.remix:hover { text-decoration: underline; }