:root {
  color-scheme: dark;
  --ink: #fff3f5;
  --muted: #ad8d94;
  --line: #3b2027;
  --panel: #160b0f;
  --panel-2: #241017;
  --acid: #d0193c;
  --cyan: #ff667e;
  --danger: #ff8a9d;
  --radius: 22px;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: #080305;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background-color: #261a1d; background-image: url("/assets/studio/panels.png"); background-position: center; background-size: cover; background-attachment: fixed; background-blend-mode: multiply; }
button, input, select { font: inherit; }
button { color: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.rail { position: relative; border-right: 2px solid #090708; padding: 30px 22px; display: flex; flex-direction: column; background: #100c0eeb; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.04em; font-size: 1.2rem; }
.brand i { color: var(--muted); font-weight: 500; font-style: normal; }
.brand-gif { width: 46px; height: 46px; object-fit: contain; border-radius: 15px 11px 16px 10px; transition: transform .22s ease; }
.brand:hover .brand-gif { transform: rotate(-5deg) scale(1.08); }
.eyebrow { font: 500 .75rem/1.4 ui-monospace, "Cascadia Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav { margin-top: 52px; display: grid; gap: 8px; }
.nav-item { width: 100%; display: flex; gap: 10px; align-items: center; padding: 12px 13px; border: 0; background: transparent; font-weight: 600; cursor: pointer; border-radius: 15px 11px 15px 9px; color: var(--muted); text-align: left; transition: transform .18s ease, color .18s ease, background .18s ease; }
.nav-item.active { background: #35121c; color: var(--ink); box-shadow: inset 3px 0 #d0193c; }
.nav-item:hover { color: var(--ink); background: #211016; transform: translateX(3px); }
.rail-note { border: 2px solid #090708; border-radius: 18px 12px 20px 10px; padding: 15px; color: var(--muted); font-size: .82rem; line-height: 1.5; background: #181214; }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--ink); margin-bottom: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #596057; }
.dot.live { background: var(--cyan); }

.main { padding: 34px clamp(20px, 4vw, 58px) 64px; max-width: 1500px; width: 100%; margin: 0 auto; background: #0c090ad9; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
h1 { margin: 5px 0 0; font-family: "Arial Black", "Trebuchet MS", sans-serif; font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 900; letter-spacing: -.045em; line-height: .98; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 2px solid #090708; background: #281a1f; padding: 11px 15px; border-radius: 14px 10px 14px 10px; cursor: pointer; font-weight: 700; transition: transform .16s ease, background .16s ease; }
.btn { text-decoration: none; text-align: center; }
.btn:hover { background: #38242b; transform: translateY(-2px); }
.btn.primary { background: #b71535; color: #fff; border-color: #090708; box-shadow: 3px 4px 0 #090708; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }

.grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 20px; }
.card { background: #181315f2; border: 2px solid #090708; border-radius: 24px 15px 22px 13px; padding: 22px; box-shadow: 6px 7px 0 #090708; transition: transform .18s ease, border-color .18s ease; }
.card:hover { transform: translateY(-2px); border-color: #5b2a36; }
.stack > .card:nth-child(even), .settings-grid > .card:nth-child(even) { border-radius: 18px 28px 16px 26px; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.card h2 { margin: 0; font-family: "Arial Black", "Trebuchet MS", sans-serif; font-size: 1.08rem; font-weight: 900; letter-spacing: -.02em; }
.subtle { color: var(--muted); font-size: .875rem; line-height: 1.5; margin: 5px 0 0; }
.badge { font: 500 .72rem ui-monospace, "Cascadia Mono", monospace; padding: 6px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); white-space: nowrap; }
.badge.live { color: var(--cyan); border-color: #ff667e55; background: #d0193c16; }

.preview { width: 100%; min-height: 0; aspect-ratio: 16 / 9; border: 2px solid #090708; border-radius: 18px 25px 16px 22px; background-color: #120d0f; background-image: linear-gradient(45deg,#21181b 25%,transparent 25%),linear-gradient(-45deg,#21181b 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#21181b 75%),linear-gradient(-45deg,transparent 75%,#21181b 75%); background-size: 24px 24px; background-position: 0 0,0 12px,12px -12px,-12px 0; overflow: hidden; }
.avatar { min-width: 150px; max-width: 240px; flex: 1; position: relative; display: grid; justify-items: center; align-content: end; transition: transform .14s ease, filter .14s ease, opacity .14s ease; filter: saturate(.78) brightness(.72); opacity: .82; }
.avatar.speaking { transform: translateY(-2.25cqh); filter: none; opacity: 1; }
.avatar-visual { width: 100%; height: 100%; display: grid; justify-items: center; align-items: end; transform: scale(var(--size, 1)); transform-origin: center bottom; }
.avatar-img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(3px 5px 0 #0008); }
.avatar-visual > .avatar-img { grid-area: 1 / 1; }
.avatar-visual > .avatar-img-idle, .avatar-visual > .avatar-img-talking { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.avatar-img-idle, .avatar-img-talking { transition: opacity .14s ease-in-out; will-change: opacity; }
.avatar-img-idle { opacity: 1; }
.avatar-img-talking { opacity: 0; }
.avatar.speaking .avatar-img-idle { opacity: 0; }
.avatar.speaking .avatar-img-talking { opacity: 1; }
.avatar.webcam { max-width: 360px; align-content: end; }
.webcam-img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: center; border-radius: 18px; border: 3px solid var(--accent, var(--acid)); background: #050203; filter: none; }
.avatar-fallback { width: 150px; height: 190px; display: grid; place-items: center; border-radius: 999px 999px 24px 24px; background: #2a151c; border: 2px dashed #723143; color: var(--muted); }
.avatar-name { position: absolute; left: 50%; bottom: .55cqh; z-index: 12; max-width: 90cqw; background: var(--name-bg, #090305); border: max(1px, .22cqh) solid var(--line); padding: 1.95cqh 1.7cqw; border-radius: 10cqh; font-size: 3.55cqh; line-height: 1.15; white-space: nowrap; transform: translate(calc(-50% + var(--name-x, 0cqw)), var(--name-y, 0cqh)) scale(var(--name-size, 1)); transform-origin: center; }
.avatar-name.no-background { background: transparent; border-color: transparent; }
.avatar.webcam .avatar-name { bottom: -10.7cqh; padding: 1.7cqh 1.85cqw; }
.avatar.speaking .avatar-name { border-color: var(--accent, var(--acid)); }
.avatar.speaking .avatar-name.no-background { border-color: transparent; }
.font-rounded, .font-rounded .avatar-name { font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif; }
.font-comic, .font-comic .avatar-name { font-family: "Comic Sans MS", "Segoe Print", cursive; }
.font-typewriter, .font-typewriter .avatar-name { font-family: "Courier New", ui-monospace, monospace; }
.font-classic, .font-classic .avatar-name { font-family: Georgia, "Times New Roman", serif; }
.font-bold, .font-bold .avatar-name { font-family: Impact, "Arial Black", sans-serif; letter-spacing: .035em; text-transform: uppercase; }
.preview.dark { background: #040203; background-image: none; }
.preview.checker { background-color: #100509; }
.placement-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 0 0 12px; }
.placement-toolbar span { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.placement-controls { display: grid; gap: 9px; margin: 0 0 14px; padding: 12px; border: 2px solid #090708; border-radius: 14px 10px 14px 10px; background: #10080b; }
.placement-controls strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placement-controls p { margin: 0; color: var(--muted); font-size: .82rem; }
.placement-control-row { display: grid; grid-template-columns: 90px auto minmax(150px, 1fr) 58px auto; gap: 10px; align-items: center; }
.placement-control-row input[type="range"] { width: 100%; accent-color: var(--acid); cursor: ew-resize; }
.placement-control-row output { color: var(--muted); font: 700 .78rem ui-monospace, "Cascadia Mono", monospace; text-align: right; }
.placement-name-position { display: grid; grid-template-columns: 90px minmax(180px, 320px); gap: 10px; align-items: center; }
.placement-name-position label { color: var(--muted); font-size: .82rem; }
.placement-snap { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; cursor: pointer; }
.placement-snap input { width: 18px; height: 18px; accent-color: var(--acid); }
.snap-guide { position: absolute; z-index: 19; pointer-events: none; background: #55e8ff; box-shadow: 0 0 8px #55e8ffaa; }
.snap-guide.vertical { top: 0; bottom: 0; width: 1px; transform: translateX(-.5px); }
.snap-guide.horizontal { left: 0; right: 0; height: 1px; transform: translateY(-.5px); }
.avatar-resize { display: none; }
.preview.placement-editing { outline: 2px dashed #d0193c; outline-offset: 4px; }
.preview.placement-editing .avatar { cursor: grab; touch-action: none; user-select: none; }
.preview.placement-editing .avatar-name { cursor: move; outline: 1px dashed #ff637d; outline-offset: 3px; }
.preview.placement-editing .avatar.placement-selected { outline: none; }
.preview.placement-editing .avatar.placement-selected .avatar-img,
.preview.placement-editing .avatar.placement-selected .avatar-fallback { outline: 3px solid #ff637d; outline-offset: 6px; }
.preview.placement-editing .avatar:focus { outline: 2px solid #ff637d; outline-offset: 4px; }
.preview.placement-editing .avatar.dragging { cursor: grabbing; }
.preview.placement-editing .avatar-resize { position: absolute; right: -18px; bottom: -18px; z-index: 20; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 3px solid #090708; border-radius: 50%; background: #d0193c; color: white; cursor: nwse-resize; font-size: 1.2rem; font-weight: 900; box-shadow: 3px 3px 0 #090708; }
.preview.custom-layout, .overlay-stage.custom-layout { position: relative; display: block; }
.preview.custom-layout .avatar, .overlay-stage.custom-layout .avatar { position: absolute; left: var(--x, 50%); top: var(--y, 50%); z-index: var(--layer, 0); margin: 0; transform: translate(-50%, -50%); transform-origin: center; }
.preview.custom-layout .avatar.speaking, .overlay-stage.custom-layout .avatar.speaking { transform: translate(-50%, calc(-50% - 2.25cqh)); }

.player-list { display: grid; gap: 10px; }
.player-row { border: 2px solid #090708; border-radius: 16px 11px 16px 11px; padding: 13px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; background: #1c1518; transition: transform .16s ease, background .16s ease; }
.player-row:hover { transform: translateX(3px); background: #25181d; }
.player-row:nth-child(even) { border-radius: 11px 16px 11px 16px; }
.player-meta { min-width: 0; }
.player-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-id { color: var(--muted); font: .72rem ui-monospace, "Cascadia Mono", monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 7px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn.talking { background: var(--acid); border-color: var(--acid); color: #0a0b08; }
.empty { border: 1px dashed #3b4038; border-radius: 13px; padding: 28px; text-align: center; color: var(--muted); }

.stack { display: grid; gap: 20px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: .875rem; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 13px 9px 13px 9px; background: #0d0608; color: var(--ink); padding: 11px 12px; outline: none; }
.input:focus { border-color: var(--acid); outline: 2px solid #f0526f; outline-offset: 2px; }
.input[type="color"] { display: block; min-height: 48px; padding: 4px; cursor: pointer; overflow: hidden; }
.input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.input[type="color"]::-moz-color-swatch { border: 0; border-radius: 7px; }
.copy-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.reset-link-button { width: 100%; margin-top: 14px; }
.mono { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: .75rem; }
.hint { color: var(--muted); font-size: .875rem; line-height: 1.55; margin: 10px 0 0; }
.divider { height: 1px; background: var(--line); margin: 2px 0; }
.game-strip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 15px; color: var(--muted); font-size: .78rem; }
.game-strip strong { color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 6px 9px; font-size: .72rem; }

.join-page { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; background-color: #261a1d; background-image: url("/assets/studio/panels.png"); background-position: center; background-size: cover; background-blend-mode: multiply; }
.join-card { position: relative; z-index: 1; width: min(660px, 100%); background: #181315f5; border: 2px solid #090708; border-radius: 30px 19px 32px 16px; padding: clamp(24px, 5vw, 44px); box-shadow: 7px 8px 0 #090708; }
.join-card .brand { margin-bottom: 52px; }
.join-card h1 { margin-bottom: 18px; }
.join-copy { color: var(--muted); line-height: 1.65; margin: 0 0 28px; }
.font-preview { display: block; min-height: 38px; padding: 8px 12px; border-left: 4px solid var(--acid); background: #10090b; color: #fff3f5; font-size: 1.05rem; }
.active-mic { text-align: center; }
.active-mic .brand { justify-content: center; }
.camera-preview { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; border: 1px solid #6d1d2e; background: #050203; }
.camera-picker { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 20px 13px 22px 14px; background: #0d0608; }
.camera-picker[hidden] { display: none; }
.camera-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.crop-controls { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #080305; }
.crop-controls[hidden] { display: none; }
.crop-heading, .crop-controls label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crop-controls label { color: var(--muted); font-size: .875rem; }
.crop-controls output { color: var(--ink); font-variant-numeric: tabular-nums; }
.crop-controls input[type="range"] { width: 100%; accent-color: var(--acid); }
.btn.compact { min-height: 32px; padding: 6px 10px; }
.animation-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .8fr); gap: 12px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #080305; }
.check-row { min-height: 44px; display: flex; align-items: center; gap: 10px; color: var(--ink); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--acid); }
.avatar.speaking.animation-bounce .avatar-img, .avatar.speaking.animation-bounce .avatar-fallback { animation: speaking-bounce .48s ease-in-out infinite alternate; }
.avatar.speaking.animation-pulse .avatar-img, .avatar.speaking.animation-pulse .avatar-fallback { animation: speaking-pulse .7s ease-in-out infinite alternate; }
.avatar.speaking.animation-shake .avatar-img, .avatar.speaking.animation-shake .avatar-fallback { animation: speaking-shake .16s linear infinite; }
.avatar.speaking.animation-glow .avatar-img, .avatar.speaking.animation-glow .avatar-fallback { animation: speaking-glow .75s ease-in-out infinite alternate; }
@keyframes speaking-bounce { from { transform: translateY(0); } to { transform: translateY(-5.05cqh); } }
@keyframes speaking-pulse { from { transform: scale(1); } to { transform: scale(1.055); } }
@keyframes speaking-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.5deg); } 75% { transform: rotate(1.5deg); } }
@keyframes speaking-glow { from { filter: drop-shadow(0 18px 28px #0008); } to { filter: drop-shadow(0 0 24px var(--accent)); } }
@media (prefers-reduced-motion: reduce) { .avatar.speaking .avatar-img, .avatar.speaking .avatar-fallback { animation: none !important; } .avatar-img-idle, .avatar-img-talking { transition: none; } }
.meter { width: 100%; height: 16px; background: #090b08; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: 34px 0 18px; }
.meter span { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--acid); transition: transform .06s linear; }
.mic-state { display: flex; justify-content: center; align-items: center; gap: 9px; margin-bottom: 34px; }

.welcome { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.welcome-copy { padding: clamp(36px, 8vw, 110px); display: flex; flex-direction: column; justify-content: center; }
.welcome-copy h1 { font-size: clamp(3.5rem, 9vw, 8rem); max-width: 900px; }
.welcome-copy p { max-width: 600px; color: var(--muted); font-size: 1.05rem; line-height: 1.7; }
.studio-desk { position: relative; width: min(620px, 100%); height: 260px; margin-top: 24px; overflow: hidden; }
.studio-desk img { position: absolute; display: block; object-fit: contain; }
.studio-desk-top { z-index: 3; left: 0; right: 0; bottom: 0; width: 100%; }
.studio-chair { z-index: 1; right: 12%; bottom: 18px; width: 150px; height: 220px; }
.studio-foxy { z-index: 4; right: 36%; bottom: 91px; width: 58px; }
.slash { color: var(--acid); }
.welcome-panel { background: #8f1230f2; color: #fff4f5; padding: clamp(30px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; border-left: 3px solid #090708; }
.welcome-panel .eyebrow { color: #ffd5dc; }
.welcome-panel h2 { font-size: clamp(2rem, 4vw, 4rem); letter-spacing: -.055em; margin: 12px 0 28px; }
.welcome-panel .input { background: #fff1f3; border-color: #ff92a4; color: #21060c; }
.welcome-panel .btn { background: #17060a; color: var(--ink); border-color: #3d0a15; margin-top: 12px; }
.steps { display: grid; gap: 14px; margin-top: 36px; }
.step { border-top: 1px solid #e04a64; padding-top: 13px; display: grid; grid-template-columns: 32px 1fr; gap: 10px; transition: transform .16s ease; }
.step:hover { transform: translateX(5px); }

.studio-shelf { position: relative; width: 204px; height: 220px; margin: auto auto 20px; }
.studio-shelf img { display: block; object-fit: contain; }
.studio-shelves { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.shelf-item { position: absolute; display: block; padding: 0; border: 0; background: transparent; cursor: pointer; transform-origin: center bottom; transition: transform .16s ease, filter .16s ease; }
.shelf-item img { width: 100%; height: 100%; }
.shelf-item:hover, .shelf-item:focus-visible { transform: translateY(-5px) rotate(-2deg) scale(1.08); filter: brightness(1.12); outline: 2px solid #ff637d; outline-offset: 3px; }
.shelf-item:active { transform: translateY(1px) scale(.96); }
.shelf-item.playing { animation: shelf-playing .34s ease-in-out infinite alternate; }
.shelf-monster { top: 58px; right: 34px; width: 30px; height: 46px; }
.shelf-foxy { top: 55px; left: 52px; width: 38px; height: 49px; }
.shelf-funko { left: 27px; bottom: 5px; width: 65px; height: 74px; }
.shelf-mimikyu { right: 24px; bottom: 47px; width: 58px; height: 40px; }
.join-studio-shelf { position: fixed; left: clamp(18px, 3vw, 48px); bottom: clamp(18px, 3vh, 42px); margin: 0; z-index: 2; }
@keyframes shelf-playing { from { transform: rotate(-3deg) scale(1.04); } to { transform: rotate(3deg) scale(1.1); } }

.overlay-page { width: 100vw; height: 100vh; overflow: hidden; background: transparent; }
.overlay-page { width: 100vw; height: 100vh; min-width: 0; overflow: hidden; background: transparent; background-image: none; }
.overlay-page #app { width: 100%; height: 100%; display: grid; place-items: center; }
.overlay-stage { width: min(100vw, 177.7778vh); height: min(100vh, 56.25vw); box-sizing: border-box; overflow: hidden; }
.preview, .overlay-stage { container-type: size; display: flex; justify-content: center; align-items: end; gap: 2cqw; padding: 2cqh 2cqw; }
.preview.custom-layout, .overlay-stage.custom-layout { display: block; }
.preview .avatar, .overlay-stage .avatar { flex: 0 1 22cqw; width: 22cqw; min-width: 0; max-width: 28cqw; height: 94cqh; }
.preview .avatar-img, .overlay-stage .avatar-img { max-height: 100%; }
.preview .avatar-fallback, .overlay-stage .avatar-fallback { width: 20cqw; height: 70cqh; }
.preview .avatar.webcam, .overlay-stage .avatar.webcam { width: 28cqw; height: auto; }
.preview .avatar.webcam .webcam-img, .overlay-stage .avatar.webcam .webcam-img { height: auto; max-height: 80.5cqh; }
.preview.stack, .overlay-stage.stack { flex-direction: column; align-items: start; justify-content: end; }
.preview.arc .avatar:nth-child(odd), .overlay-stage.arc .avatar:nth-child(odd) { transform: translateY(-3cqh); }
.preview.arc .avatar.speaking, .overlay-stage.arc .avatar.speaking { transform: translateY(-5.25cqh); }
.preview.custom-layout .avatar, .overlay-stage.custom-layout .avatar { width: 22cqw; height: 68cqh; max-width: 28cqw; }
.preview.custom-layout .avatar.webcam, .overlay-stage.custom-layout .avatar.webcam { width: 28cqw; height: auto; }
.preview.custom-layout.arc .avatar:nth-child(odd), .overlay-stage.custom-layout.arc .avatar:nth-child(odd) { transform: translate(-50%, -50%); }
.preview.custom-layout.arc .avatar.speaking:nth-child(odd), .overlay-stage.custom-layout.arc .avatar.speaking:nth-child(odd) { transform: translate(-50%, calc(-50% - 2.25cqh)); }

.toast { position: fixed; right: 24px; bottom: 24px; background: var(--ink); color: #10120e; padding: 11px 15px; border-radius: 10px; font-weight: 700; box-shadow: 0 15px 50px #0008; z-index: 20; }
.modal { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; padding: 20px; z-index: 30; }
.modal-card { width: min(520px, 100%); background: #181315; border: 2px solid #090708; border-radius: 28px 17px 26px 15px; padding: 24px; box-shadow: 7px 8px 0 #090708; }
.modal-card h2 { margin: 0 0 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.view-panel { display: none; }
.view-panel.active { display: block; animation: reveal .2s ease both; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.06em; }
.room-callout { display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; align-items: center; gap: 30px; padding: 30px; margin-bottom: 22px; border: 2px solid #090708; border-radius: 28px 17px 30px 15px; background: #35111c; box-shadow: 6px 7px 0 #090708; }
.room-callout > div { display: grid; }
.room-number { color: #ff5874; font-size: 4.6rem; font-weight: 800; letter-spacing: -.09em; line-height: .9; }
.room-callout p { color: #d5b6bc; max-width: 640px; line-height: 1.65; }
.room-list { margin-top: 20px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.discord-card { grid-column: 1 / -1; }
.connection-state { display: flex; align-items: center; gap: 10px; }
.discord-card .btn { justify-self: start; }
.discord-card .discord-btn { background: #5865f2; border-color: #7983f5; color: white; }
.discord-config-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.activity-artwork { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); background: var(--panel-2); }
.activity-artwork-icon { width: 88px; height: 88px; object-fit: contain; }
.activity-artwork p { margin: 4px 0 10px; }
.companion-panel { display: grid; gap: 16px; padding: 18px; border: 2px solid #090708; border-radius: 18px 12px 20px 11px; background: #10090b; }
.companion-panel h3 { margin: 4px 0 0; font-size: 1.15rem; }
.pairing-modal ol { margin: 0; padding-left: 22px; color: var(--muted); line-height: 1.65; }
.settings-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .7fr); background: #080305; }
.auth-crest { position: relative; overflow: hidden; min-height: 100vh; display: flex; flex-direction: column; justify-content: end; background: #080305; }
.auth-crest::after { content: ""; position: absolute; inset: 0; background: #08030566; pointer-events: none; }
.auth-banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.78) contrast(1.08) brightness(.72); }
.auth-banner-copy { position: relative; z-index: 1; padding: clamp(44px, 8vw, 120px); }
.auth-crest h1 { position: relative; z-index: 1; max-width: 700px; font-family: "Arial Black", "Trebuchet MS", sans-serif; font-size: clamp(4rem, 9vw, 8rem); font-weight: 900; }
.auth-crest p, .auth-crest .eyebrow { position: relative; z-index: 1; }
.auth-crest p { color: var(--muted); font-size: 1.05rem; }
.auth-panel { padding: clamp(34px, 6vw, 84px); display: flex; flex-direction: column; justify-content: center; gap: 70px; border-left: 1px solid var(--line); background: #10070a; }
.auth-panel h2 { margin: 8px 0; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.055em; }
.form-error { min-height: 1.4em; margin: 0; color: #ff8296; }

.tutorial-helper { position: fixed; right: 18px; bottom: 12px; z-index: 45; }
.tutorial-helper button { position: relative; display: block; width: 128px; padding: 0; border: 0; background: transparent; cursor: pointer; transform-origin: right bottom; transition: transform .24s cubic-bezier(.2, .8, .2, 1), filter .24s ease; animation: zeph-attention 60s ease-in-out infinite; }
.tutorial-helper button:hover, .tutorial-helper button:focus-visible { animation: none; transform: scale(1.09) rotate(-1deg); filter: brightness(1.08); }
.tutorial-helper img { display: block; width: 128px; height: 128px; object-fit: contain; }
.tutorial-balloon { position: absolute; right: 96px; bottom: 78px; width: max-content; max-width: 190px; padding: 9px 12px; border: 2px solid #090708; border-radius: 13px 13px 3px 13px; background: #fff3f5; color: #2a0710; font-size: .875rem; font-weight: 750; box-shadow: 3px 4px 0 #090708; }
.tutorial-prompt { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: #000c; backdrop-filter: blur(6px); }
.tutorial-prompt-card { width: min(580px, 100%); display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 24px; padding: 26px; border: 2px solid #090708; border-radius: 22px 16px 24px 14px; background: #181315; box-shadow: 7px 8px 0 #090708; }
.tutorial-prompt-card img { width: 180px; height: 180px; object-fit: contain; }
.tutorial-prompt-card h2 { margin: 7px 0; font-size: clamp(1.55rem, 4vw, 2.3rem); }
.tutorial-prompt-card p { margin: 0 0 20px; color: var(--muted); }
.tutorial-popover { position: fixed; z-index: 70; width: min(370px, calc(100vw - 24px)); padding: 16px; border: 2px solid #090708; border-radius: 18px 12px 20px 11px; background: #181315; box-shadow: 6px 7px 0 #090708; }
.tutorial-copy { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 12px; }
.tutorial-copy img { width: 72px; height: 72px; object-fit: contain; }
.tutorial-copy p { margin: 5px 0 0; color: #f0d9dd; font-size: .925rem; line-height: 1.5; }
.tutorial-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.tutorial-actions > div { display: flex; gap: 8px; }
.tutorial-highlight { position: relative; z-index: 55; outline: 3px solid #ff365b !important; outline-offset: 5px; border-radius: 10px; }

@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes zeph-attention {
  0%, 95%, 100% { transform: translateX(0) rotate(0); }
  96% { transform: translateX(-5px) rotate(-4deg); }
  97% { transform: translateX(5px) rotate(4deg); }
  98% { transform: translateX(-4px) rotate(-3deg); }
  99% { transform: translateX(3px) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-helper button { animation: none; transition: none; }
  .tutorial-helper button:hover, .tutorial-helper button:focus-visible { transform: scale(1.04); }
  .shelf-item.playing { animation: none; }
  .card, .player-row, .step, .brand-gif, .shelf-item { transition: none; }
  .preview.custom-layout .avatar.speaking, .overlay-stage.custom-layout .avatar.speaking { transform: translate(-50%, -50%); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .grid, .welcome { grid-template-columns: 1fr; }
  .join-page { place-items: center; }
  .join-studio-shelf { left: 10px; bottom: 10px; width: 204px; height: 220px; margin: 0; transform: scale(.72); transform-origin: left bottom; }
  .welcome-panel { min-height: 55vh; }
  .topbar { align-items: start; flex-direction: column; }
  .placement-size-controls { grid-template-columns: 1fr auto auto; }
  .placement-size-controls strong { grid-column: 1 / -1; }
  .placement-size-controls input[type="range"] { grid-column: 1 / -1; grid-row: 3; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-crest { min-height: 46vh; }
  .auth-banner-copy { padding: 34px; }
  .auth-panel { border-left: 0; border-top: 1px solid var(--line); }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .main { padding: 24px 14px 50px; }
  .card { padding: 14px; }
  .preview { min-height: 0; }
  .avatar { min-width: 100px; }
  .avatar-img { max-height: 200px; }
  .two-col { grid-template-columns: 1fr; }
  .animation-controls { grid-template-columns: 1fr; }
  .placement-control-row { grid-template-columns: 1fr auto 58px auto; }
  .placement-control-row > span { grid-column: 1 / -1; }
  .placement-name-position { grid-template-columns: 1fr; }
  .room-callout { grid-template-columns: 1fr; }
  .tutorial-helper { right: 6px; bottom: 6px; }
  .tutorial-helper button, .tutorial-helper img { width: 94px; height: 94px; }
  .tutorial-balloon { right: 70px; bottom: 58px; }
  .tutorial-prompt-card { grid-template-columns: 1fr; text-align: center; }
  .tutorial-prompt-card img { width: 120px; height: 120px; margin: 0 auto; }
  .tutorial-prompt-card .actions { justify-content: center; }
}
