/* ═══════════════════════════════════════════════════════
   DESIGN SYSTEM — TOKENS
═══════════════════════════════════════════════════════ */
:root {
  /* Colours */
  /* Default theme: "Nebula" (deep indigo / electric violet) */
  --clr-bg:          #0c0a1a;
  --clr-surface:     #15122b;
  --clr-surface-2:   #1d1838;
  --clr-surface-3:   #271f4a;
  --clr-border:      rgba(255,255,255,0.07);
  --clr-border-2:    rgba(255,255,255,0.13);

  --clr-text:        #e7e3fb;
  --clr-text-muted:  #9a8fc8;
  --clr-text-dim:    #645a90;

  --clr-accent:      #8b5cf6;
  --clr-accent-2:    #a78bfa;
  --clr-accent-glow: rgba(139,92,246,0.28);

  --clr-interanet:   #5865f2;
  --clr-success:     #22c55e;
  --clr-warning:     #f59e0b;
  --clr-danger:      #ef4444;
  --clr-mod:         #f59e0b;

  /* Glass / overlay backgrounds — replaces hardcoded rgba values so
     every theme (and light mode) gets the right tinted glass effect.  */
  --clr-surface-glass: rgba(21,18,43,.92);   /* room-header, mod-panel   */
  --clr-bg-glass:      rgba(12,10,26,.88);   /* bg-overlay, skip-toast   */

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 28px; --sp-8: 32px;

  /* Typography */
  --text-xs:   11px; --text-sm: 12px; --text-base: 14px;
  --text-md:   15px; --text-lg: 17px; --text-xl:   22px;
  --text-2xl:  28px;

  /* Layout */
  --nav-w:    64px;
  --rpanel-w: 300px;
  --player-h: 72px;

  /* Radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms; --dur-base: 200ms; --dur-slow: 320ms;
}

/* ═══════════════════════════════════════════════════════
   THEMES — selectable from the room header's theme picker,
   applied as data-theme="..." on <html>. Each theme also
   supports a light/dark mode toggle via data-theme-mode="light"
   or data-theme-mode="dark" on <html>.
   "Midnight" is the default and reuses the base tokens above.
═══════════════════════════════════════════════════════ */

/* ── Crimson (dark default) ───────────────────────────── */
:root[data-theme="crimson"] {
  --clr-bg:          #160a0b;
  --clr-surface:     #1f1011;
  --clr-surface-2:   #2a1416;
  --clr-surface-3:   #35181b;
  --clr-border:      rgba(255,255,255,0.08);
  --clr-border-2:    rgba(255,255,255,0.14);
  --clr-text:        #f3e2e2;
  --clr-text-muted:  #b58a8a;
  --clr-text-dim:    #7a5656;
  --clr-accent:      #dc2626;
  --clr-accent-2:    #f87171;
  --clr-accent-glow: rgba(220,38,38,0.25);
  --clr-surface-glass: rgba(22,10,11,.92);
  --clr-bg-glass:      rgba(14,6,7,.88);
}

/* ── Sakura (light default) ───────────────────────────── */
:root[data-theme="sakura"] {
  --clr-bg:          #fff5f8;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #ffecf1;
  --clr-surface-3:   #ffdfea;
  --clr-border:      rgba(190,24,93,0.12);
  --clr-border-2:    rgba(190,24,93,0.2);
  --clr-text:        #4a1942;
  --clr-text-muted:  #9b6b86;
  --clr-text-dim:    #c79bb0;
  --clr-accent:      #ec4899;
  --clr-accent-2:    #db2777;
  --clr-accent-glow: rgba(236,72,153,0.18);
  --clr-surface-glass: rgba(255,245,248,.94);
  --clr-bg-glass:      rgba(255,245,248,.90);
}

/* ── Citrus (warm amber, light default) [key: daylight] ── */
:root[data-theme="daylight"] {
  --clr-bg:          #fdf8f0;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #faf0df;
  --clr-surface-3:   #f5e4c8;
  --clr-border:      rgba(180,110,20,0.12);
  --clr-border-2:    rgba(180,110,20,0.20);
  --clr-text:        #3a2a12;
  --clr-text-muted:  #8a6c3e;
  --clr-text-dim:    #b89a66;
  --clr-accent:      #ea8c0c;
  --clr-accent-2:    #c2710a;
  --clr-accent-glow: rgba(234,140,12,0.16);
  --clr-surface-glass: rgba(255,255,255,.94);
  --clr-bg-glass:      rgba(253,248,240,.90);
}

/* ── Lagoon (teal / emerald, dark default) [key: ocean] ── */
:root[data-theme="ocean"] {
  --clr-bg:          #07181a;
  --clr-surface:     #0c2426;
  --clr-surface-2:   #103033;
  --clr-surface-3:   #163e40;
  --clr-border:      rgba(255,255,255,0.07);
  --clr-border-2:    rgba(255,255,255,0.13);
  --clr-text:        #d9f5ef;
  --clr-text-muted:  #79b3aa;
  --clr-text-dim:    #4a7d75;
  --clr-accent:      #14b8a6;
  --clr-accent-2:    #2dd4bf;
  --clr-accent-glow: rgba(20,184,166,0.24);
  --clr-surface-glass: rgba(12,36,38,.92);
  --clr-bg-glass:      rgba(7,24,26,.88);
}

/* ── Slate (graphite / steel-blue, dark default) [key: forest] ── */
:root[data-theme="forest"] {
  --clr-bg:          #0e1116;
  --clr-surface:     #171b22;
  --clr-surface-2:   #1f242d;
  --clr-surface-3:   #2a313c;
  --clr-border:      rgba(255,255,255,0.07);
  --clr-border-2:    rgba(255,255,255,0.13);
  --clr-text:        #e6eaf2;
  --clr-text-muted:  #8b93a5;
  --clr-text-dim:    #59616f;
  --clr-accent:      #3b82f6;
  --clr-accent-2:    #60a5fa;
  --clr-accent-glow: rgba(59,130,246,0.24);
  --clr-surface-glass: rgba(23,27,34,.92);
  --clr-bg-glass:      rgba(14,17,22,.88);
}

/* ════════════════════════════════════════════════════════
   LIGHT MODE VARIANTS — data-theme-mode="light" on <html>
   These override the dark defaults for each theme.
═══════════════════════════════════════════════════════ */

/* Nebula Light (also the generic light fallback) [key: midnight] */
:root[data-theme-mode="light"],
:root[data-theme="midnight"][data-theme-mode="light"] {
  --clr-bg:          #f3f1fc;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #ebe7fb;
  --clr-surface-3:   #ddd6f6;
  --clr-border:      rgba(76,29,149,0.10);
  --clr-border-2:    rgba(76,29,149,0.18);
  --clr-text:        #1e1635;
  --clr-text-muted:  #5b4f86;
  --clr-text-dim:    #8b80b5;
  --clr-accent:      #7c3aed;
  --clr-accent-2:    #6d28d9;
  --clr-accent-glow: rgba(124,58,237,0.15);
  --clr-surface-glass: rgba(255,255,255,.94);
  --clr-bg-glass:      rgba(243,241,252,.90);
}

/* Crimson Light */
:root[data-theme="crimson"][data-theme-mode="light"] {
  --clr-bg:          #fef3f3;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #fde8e8;
  --clr-surface-3:   #fbd6d6;
  --clr-border:      rgba(180,0,0,0.10);
  --clr-border-2:    rgba(180,0,0,0.18);
  --clr-text:        #2d0808;
  --clr-text-muted:  #9a4a4a;
  --clr-text-dim:    #c07878;
  --clr-accent:      #dc2626;
  --clr-accent-2:    #b91c1c;
  --clr-accent-glow: rgba(220,38,38,0.14);
  --clr-surface-glass: rgba(255,255,255,.94);
  --clr-bg-glass:      rgba(254,243,243,.90);
}

/* Sakura Light */
:root[data-theme="sakura"][data-theme-mode="light"] {
  --clr-bg:          #fff0f5;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #ffe4ef;
  --clr-surface-3:   #ffd4e6;
  --clr-border:      rgba(190,24,93,0.13);
  --clr-border-2:    rgba(190,24,93,0.22);
  --clr-text:        #3d0f30;
  --clr-text-muted:  #9b4d72;
  --clr-text-dim:    #c98aaa;
  --clr-accent:      #db2777;
  --clr-accent-2:    #be185d;
  --clr-accent-glow: rgba(219,39,119,0.16);
  --clr-surface-glass: rgba(255,255,255,.95);
  --clr-bg-glass:      rgba(255,240,245,.92);
}

/* Sakura Dark */
:root[data-theme="sakura"][data-theme-mode="dark"] {
  --clr-bg:          #1a0814;
  --clr-surface:     #24101e;
  --clr-surface-2:   #2e162a;
  --clr-surface-3:   #3a1e34;
  --clr-border:      rgba(255,255,255,0.08);
  --clr-border-2:    rgba(255,255,255,0.14);
  --clr-text:        #f5d6e8;
  --clr-text-muted:  #c08aac;
  --clr-text-dim:    #8a5876;
  --clr-accent:      #ec4899;
  --clr-accent-2:    #f472b6;
  --clr-accent-glow: rgba(236,72,153,0.25);
  --clr-surface-glass: rgba(36,16,30,.92);
  --clr-bg-glass:      rgba(26,8,20,.88);
}

/* Citrus Dark [key: daylight] */
:root[data-theme="daylight"][data-theme-mode="dark"] {
  --clr-bg:          #16120a;
  --clr-surface:     #201a0f;
  --clr-surface-2:   #2a2214;
  --clr-surface-3:   #362c1a;
  --clr-border:      rgba(255,255,255,0.07);
  --clr-border-2:    rgba(255,255,255,0.13);
  --clr-text:        #f6ecd9;
  --clr-text-muted:  #bda47e;
  --clr-text-dim:    #806e50;
  --clr-accent:      #f59e0b;
  --clr-accent-2:    #fbbf24;
  --clr-accent-glow: rgba(245,158,11,0.25);
  --clr-surface-glass: rgba(32,26,15,.92);
  --clr-bg-glass:      rgba(22,18,10,.88);
}

/* Lagoon Light [key: ocean] */
:root[data-theme="ocean"][data-theme-mode="light"] {
  --clr-bg:          #eefaf7;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #dff5f0;
  --clr-surface-3:   #c8ece4;
  --clr-border:      rgba(13,148,136,0.12);
  --clr-border-2:    rgba(13,148,136,0.20);
  --clr-text:        #0c302b;
  --clr-text-muted:  #3d7d72;
  --clr-text-dim:    #6aaaa0;
  --clr-accent:      #0d9488;
  --clr-accent-2:    #0f766e;
  --clr-accent-glow: rgba(13,148,136,0.15);
  --clr-surface-glass: rgba(255,255,255,.94);
  --clr-bg-glass:      rgba(238,250,247,.90);
}

/* Slate Light [key: forest] */
:root[data-theme="forest"][data-theme-mode="light"] {
  --clr-bg:          #f5f7fa;
  --clr-surface:     #ffffff;
  --clr-surface-2:   #eceff4;
  --clr-surface-3:   #dfe4ec;
  --clr-border:      rgba(30,41,59,0.10);
  --clr-border-2:    rgba(30,41,59,0.17);
  --clr-text:        #1a2230;
  --clr-text-muted:  #566175;
  --clr-text-dim:    #8893a6;
  --clr-accent:      #2563eb;
  --clr-accent-2:    #1d4ed8;
  --clr-accent-glow: rgba(37,99,235,0.14);
  --clr-surface-glass: rgba(255,255,255,.94);
  --clr-bg-glass:      rgba(245,247,250,.90);
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-base);
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--clr-accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--clr-accent-glow); }

/* ═══════════════════════════════════════════════════════
   DESIGN SYSTEM — COMPONENTS
═══════════════════════════════════════════════════════ */

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md); font-size: var(--text-sm); font-weight: 500;
  transition: background var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--clr-accent); color: #fff; }
.btn-primary:hover { background: var(--clr-accent-2); }
.btn-secondary { background: var(--clr-surface-3); color: var(--clr-text); border: 1px solid var(--clr-border-2); }
.btn-secondary:hover { background: var(--clr-surface-2); border-color: var(--clr-accent); }
.btn-ghost     { background: transparent; color: var(--clr-text-muted); }
.btn-ghost:hover { background: var(--clr-surface-3); color: var(--clr-text); }
.btn-danger    { background: var(--clr-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger-hover:hover { color: var(--clr-danger); background: rgba(239,68,68,.1); }
.btn-interanet { background: var(--clr-interanet); color: #fff; }
.btn-interanet:hover { background: #4752c4; }
.btn-icon {
  padding: var(--sp-2); border-radius: var(--r-sm);
  width: 32px; height: 32px;
}
.btn-sm { padding: 5px var(--sp-3); font-size: var(--text-xs); }
.btn-full { width: 100%; justify-content: center; }

/* ── Inputs ───────────────────────────────────────────── */
.input {
  background: var(--clr-surface-3); border: 1px solid var(--clr-border);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-base); color: var(--clr-text);
  outline: none; transition: border-color var(--dur-fast);
}
.input:focus { border-color: var(--clr-accent); }
.input::placeholder { color: var(--clr-text-dim); }
.input--sm { padding: 5px var(--sp-2); font-size: var(--text-sm); }
.input--textarea { resize: vertical; min-height: 80px; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--r-lg); padding: var(--sp-4);
}

/* ── Form groups ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.form-label { font-size: var(--text-sm); font-weight: 500; color: var(--clr-text-muted); }

/* ── Radio groups ─────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.radio-option { display: flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; padding: var(--sp-2); border-radius: var(--r-sm); }
.radio-option:hover { background: var(--clr-surface-3); }
.radio-label { font-size: var(--text-sm); }

/* ── Toggle switch ────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-flex; width: 36px; height: 20px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--clr-surface-3); border-radius: var(--r-full); transition: background var(--dur-base); }
.toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--dur-base); }
.toggle-switch input:checked + .toggle-slider { background: var(--clr-accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Chips / filter pills ─────────────────────────────── */
.chip {
  padding: 4px var(--sp-3); border-radius: var(--r-full); font-size: var(--text-xs);
  font-weight: 500; background: var(--clr-surface-3); color: var(--clr-text-muted);
  border: 1px solid var(--clr-border); transition: all var(--dur-fast);
}
.chip:hover { border-color: var(--clr-accent); color: var(--clr-text); }
.chip--active { background: var(--clr-accent-glow); color: var(--clr-accent-2); border-color: var(--clr-accent); }

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px; border: 2px solid var(--clr-border);
  border-top-color: var(--clr-accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: calc(var(--player-h) + var(--sp-4)); right: var(--sp-4); z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; transition: right var(--dur-slow) var(--ease); }
/* When the room side panel (chat/queue/users/upload) is open, toasts should sit
   to the LEFT of it instead of floating on top of it. */
.app-shell.panel-open ~ .toast-container { right: calc(var(--rpanel-w) + var(--sp-4)); }
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--clr-surface-2); border: 1px solid var(--clr-border-2);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm); box-shadow: var(--shadow-md);
  animation: toast-in 0.2s var(--ease); pointer-events: auto;
  max-width: 320px;
}
.toast--success { border-left: 3px solid var(--clr-success); }
.toast--error   { border-left: 3px solid var(--clr-danger); }
.toast--info    { border-left: 3px solid var(--clr-accent); }
.toast--warning { border-left: 3px solid var(--clr-warning); }
@keyframes toast-in { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }

/* ── Modals ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.7); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fade-in var(--dur-base) var(--ease);
}
.modal-box {
  background: var(--clr-surface-2); border: 1px solid var(--clr-border-2);
  border-radius: var(--r-xl); padding: var(--sp-6);
  min-width: 340px; max-width: 480px; width: calc(100vw - 40px);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--dur-base) var(--ease);
}
.modal-box--sm { min-width: 280px; max-width: 380px; }
.modal-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--sp-3); }
.modal-body  { font-size: var(--text-base); color: var(--clr-text-muted); margin-bottom: var(--sp-5); line-height: 1.6; }
.modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-5); }
@keyframes fade-in  { from { opacity:0; } to { opacity:1; } }
@keyframes modal-in { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: scale(1) translateY(0); } }

/* ── Empty state ──────────────────────────────────────── */
.empty-state { color: var(--clr-text-dim); font-size: var(--text-sm); text-align: center; padding: var(--sp-6); }

/* ── Copy field ───────────────────────────────────────── */
.copy-field { display: flex; gap: var(--sp-2); }
.copy-field .input { flex: 1; }

/* ── Char count ───────────────────────────────────────── */
.char-count { font-size: var(--text-xs); color: var(--clr-text-dim); text-align: right; }

/* ── Section title ────────────────────────────────────── */
.section-title { font-size: var(--text-md); font-weight: 600; color: var(--clr-text); margin-bottom: var(--sp-4); }

/* ════════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: var(--clr-bg); overflow: hidden;
}
.login-bg-art { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.12; animation: orb-drift 8s ease-in-out infinite;
}
.login-orb--1 { width:400px; height:400px; background:#7c6af7; top:-100px; left:-100px; }
.login-orb--2 { width:300px; height:300px; background:#5865f2; bottom:0; right:100px; animation-delay:-3s; }
.login-orb--3 { width:250px; height:250px; background:#9d8fff; top:60%; left:50%; animation-delay:-5s; }
@keyframes orb-drift {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(20px,-20px) scale(1.05); }
}
.login-card {
  position: relative; z-index: 1;
  background: var(--clr-surface); border: 1px solid var(--clr-border-2);
  border-radius: var(--r-xl); padding: var(--sp-8);
  width: 360px; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.login-logo-icon { font-size: 28px; }
.login-logo-text { font-size: var(--text-xl); font-weight: 700; }
.login-logo-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  background: var(--clr-interanet); color: #fff;
  border-radius: var(--r-full); letter-spacing: .5px;
}
.login-tagline { font-size: var(--text-sm); color: var(--clr-text-muted); margin-bottom: var(--sp-6); }
.login-primary { margin-bottom: var(--sp-4); }
.login-primary .btn-interanet { width: 100%; justify-content: center; padding: 12px; font-size: var(--text-base); gap: var(--sp-3); }
.login-divider { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.login-divider::before, .login-divider::after { content:''; flex:1; height:1px; background: var(--clr-border); }
.login-divider span { font-size: var(--text-xs); color: var(--clr-text-dim); white-space: nowrap; }
.login-guest { margin-bottom: var(--sp-6); }
.login-value-props { display: flex; flex-direction: column; gap: var(--sp-3); border-top: 1px solid var(--clr-border); padding-top: var(--sp-5); }
.value-prop { display: flex; align-items: flex-start; gap: var(--sp-3); }
.value-prop-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.value-prop strong { font-size: var(--text-sm); display: block; }
.value-prop small { font-size: var(--text-xs); color: var(--clr-text-muted); }

/* ════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════ */
.app-shell {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  grid-template-areas:
    "nav  main"
    "nav  player";
  background: var(--clr-bg);
  overflow: hidden;
}
.app-shell.panel-open {
  grid-template-columns: var(--nav-w) 1fr var(--rpanel-w);
  grid-template-areas:
    "nav  main   rpanel"
    "nav  player player";
}
.bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity var(--dur-slow) var(--ease);
}
.bg-video.visible { opacity: 1; }
.bg-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: var(--clr-bg-glass); pointer-events: none;
}

/* ── LEFT NAV ─────────────────────────────────────────── */
.app-nav {
  grid-area: nav;
  position: relative; z-index: 10;
  display: flex; flex-direction: column;
  width: var(--nav-w);
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  padding: var(--sp-3) 0;
  overflow: hidden;
}
.nav-brand {
  font-size: 22px; text-align: center;
  padding: var(--sp-2) 0 var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: var(--sp-3);
}
.nav-items { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--sp-2); flex: 1; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--sp-2) var(--sp-2); border-radius: var(--r-md);
  font-size: 10px; color: var(--clr-text-muted); min-height: 52px;
  justify-content: center; transition: all var(--dur-fast) var(--ease);
  width: 100%;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--clr-surface-3); color: var(--clr-text); }
.nav-item.active { background: var(--clr-accent-glow); color: var(--clr-accent-2); }
.nav-item--room { color: var(--clr-accent-2); }
.nav-room-indicator {
  padding: var(--sp-2); border-top: 1px solid var(--clr-border);
  margin-top: auto; position: relative;
}
.nav-now-playing-dot {
  position: absolute; top: var(--sp-2); right: var(--sp-2);
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--clr-accent); animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
.nav-footer {
  padding: var(--sp-3) var(--sp-2) var(--sp-2);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  border-top: 1px solid var(--clr-border);
}
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--clr-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 700; cursor: pointer;
  flex-shrink: 0;
}
.nav-user-info { display: none; } /* hidden — tooltip or expand on hover for future */
.nav-username, .nav-user-type { display: none; }
.nav-logout { width: 32px; height: 32px; border-radius: var(--r-sm); }

/* ── MAIN AREA ────────────────────────────────────────── */
.app-main {
  grid-area: main;
  position: relative; z-index: 2;
  overflow-y: auto; overflow-x: hidden;
  background: var(--clr-bg);
}
.view {
  display: none; height: 100%;
  padding: var(--sp-6);
  animation: fade-in var(--dur-base) var(--ease);
}
.view--active { display: block; }
.view--room { padding: 0; flex-direction: column; overflow: hidden; }
.view--room.view--active { display: flex; }

.view-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.view-title { font-size: var(--text-2xl); font-weight: 700; }
.view-subtitle { font-size: var(--text-base); color: var(--clr-text-muted); margin-top: 4px; }

/* ── HOME VIEW ────────────────────────────────────────── */
.home-actions {
  display: flex; gap: var(--sp-3); flex-wrap: wrap;
  margin-bottom: var(--sp-8);
}
.home-cta { padding: 12px var(--sp-6); font-size: var(--text-base); }
.home-recent { margin-top: var(--sp-6); }

/* ── GUEST UPSELL ─────────────────────────────────────── */
.guest-upsell {
  background: linear-gradient(135deg, rgba(88,101,242,.12), rgba(124,106,247,.12));
  border: 1px solid rgba(88,101,242,.3); border-radius: var(--r-lg);
  padding: var(--sp-5); margin-bottom: var(--sp-6);
}
.guest-upsell-inner { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.guest-upsell-icon { font-size: 32px; flex-shrink: 0; }
.guest-upsell div { flex: 1; }
.guest-upsell strong { display: block; font-size: var(--text-md); margin-bottom: 4px; }
.guest-upsell p { font-size: var(--text-sm); color: var(--clr-text-muted); }

/* ── BROWSE CONTROLS ──────────────────────────────────── */
.browse-controls { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.search-box { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--clr-text-dim); pointer-events: none; }
.search-input { width: 100%; padding-left: 34px; }
.browse-filters { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.filter-chips { display: flex; gap: var(--sp-2); }
.sort-select { margin-left: auto; }

/* ── ROOM GRID ────────────────────────────────────────── */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-4);
  align-content: start;
}
.room-grid--compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }

.room-card {
  background: var(--clr-surface); border: 1px solid var(--clr-border);
  border-radius: var(--r-lg); padding: var(--sp-4);
  cursor: pointer; transition: all var(--dur-fast) var(--ease);
  display: flex; flex-direction: column; gap: var(--sp-3);
  position: relative; overflow: hidden;
}
.room-card:hover { border-color: var(--clr-accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.room-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--clr-accent), var(--clr-interanet));
  opacity: 0; transition: opacity var(--dur-fast);
}
.room-card:hover::before { opacity: 1; }

.room-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.room-card-name { font-size: var(--text-md); font-weight: 600; color: var(--clr-text); line-height: 1.3; }
.room-card-badges { display: flex; gap: var(--sp-1); flex-shrink: 0; }
.badge {
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  border-radius: var(--r-full); letter-spacing: .3px;
}
.badge--public  { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.badge--private { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.badge--playing { background: var(--clr-accent-glow); color: var(--clr-accent-2); border: 1px solid var(--clr-accent-glow); }
.badge--idle    { background: var(--clr-surface-3); color: var(--clr-text-dim); border: 1px solid var(--clr-border); }

.room-card-song { font-size: var(--text-sm); color: var(--clr-text-muted); display: flex; align-items: center; gap: var(--sp-2); min-height: 18px; }
.room-card-song-icon { color: var(--clr-accent); flex-shrink: 0; }
.room-card-song-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.room-card-meta { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--text-xs); color: var(--clr-text-dim); }
.room-card-listeners { display: flex; align-items: center; gap: 4px; }
.room-card-owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-card-time { margin-left: auto; flex-shrink: 0; }

.room-card-join {
  margin-top: var(--sp-2); padding: 8px; border-radius: var(--r-sm);
  background: var(--clr-accent); color: #fff;
  font-size: var(--text-sm); font-weight: 500; text-align: center;
  opacity: 0; transform: translateY(4px);
  transition: all var(--dur-fast) var(--ease);
}
.room-card:hover .room-card-join { opacity: 1; transform: translateY(0); }

/* Loading placeholder */
.loading-placeholder { grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-8); color: var(--clr-text-muted); font-size: var(--text-sm); }

/* ── ROOM VIEW (Now Playing) ──────────────────────────── */
.room-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-surface-glass); backdrop-filter: blur(8px);
  flex-shrink: 0;
  /* backdrop-filter makes this header its own stacking context with z-index:auto,
     which trapped the theme-picker dropdown BEHIND the later-in-DOM now-playing
     artwork. Lift the whole header above the content so the dropdown shows. */
  position: relative; z-index: 30;
}
.room-header-info { display: flex; align-items: center; gap: var(--sp-3); }
.room-name-badge {
  font-size: var(--text-md); font-weight: 600;
  padding: 4px 12px; border-radius: var(--r-full);
  background: var(--clr-surface-3); border: 1px solid var(--clr-border-2);
}
.room-listener-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--text-sm); color: var(--clr-text-muted);
}
.room-header-actions { display: flex; gap: var(--sp-2); }

/* ── THEME PICKER (room header) ───────────────────────── */
.theme-picker { position: relative; }
.theme-picker-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 168px; padding: var(--sp-2);
  background: var(--clr-surface-2); border: 1px solid var(--clr-border-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 2px;
}
.theme-swatch {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%; padding: 7px var(--sp-2); border-radius: var(--r-sm);
  background: transparent; color: var(--clr-text); font-size: var(--text-sm);
  text-align: left; transition: background var(--dur-fast) var(--ease);
}
.theme-swatch:hover     { background: var(--clr-surface-3); }
.theme-swatch--active   { background: var(--clr-accent-glow); color: var(--clr-accent-2); font-weight: 600; }
.theme-swatch-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.theme-swatch-dot--midnight  { background: linear-gradient(135deg, #15122b, #8b5cf6); }  /* Nebula */
.theme-swatch-dot--crimson   { background: linear-gradient(135deg, #1f1011, #dc2626); }
.theme-swatch-dot--sakura    { background: linear-gradient(135deg, #ffecf1, #ec4899); }
.theme-swatch-dot--daylight  { background: linear-gradient(135deg, #fff3e0, #ea8c0c); }  /* Citrus */
.theme-swatch-dot--ocean     { background: linear-gradient(135deg, #0c2426, #14b8a6); }  /* Lagoon */
.theme-swatch-dot--forest    { background: linear-gradient(135deg, #171b22, #3b82f6); }  /* Slate */

/* ── THEME PICKER ROWS (swatch + mode toggle) ─────────── */
.theme-swatch-row {
  display: flex; align-items: center; gap: 2px;
}
.theme-swatch-row .theme-swatch {
  flex: 1;
}
.theme-mode-toggle {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  background: transparent; color: var(--clr-text-muted);
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.theme-mode-toggle:hover {
  background: var(--clr-surface-3); color: var(--clr-text);
  border-color: var(--clr-border-2);
}
/* Show moon (dark) icon by default; swap to sun when mode=light */
.theme-mode-toggle .mode-icon-light { display: none; }
.theme-mode-toggle[data-mode="light"] .mode-icon-dark  { display: none; }
.theme-mode-toggle[data-mode="light"] .mode-icon-light { display: block; }
/* Active theme's toggle gets a subtle accent tint */
.theme-mode-toggle[data-active="true"] {
  color: var(--clr-accent-2);
  background: var(--clr-accent-glow);
  border-color: var(--clr-border-2);
}

.announcement-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  background: rgba(245,158,11,.1); border-bottom: 1px solid rgba(245,158,11,.2);
  font-size: var(--text-sm); color: var(--clr-warning);
  flex-shrink: 0;
}
.announcement-bar svg { flex-shrink: 0; }
.announcement-close { margin-left: auto; background: none; border: none; color: var(--clr-warning); font-size: 18px; cursor: pointer; line-height: 1; opacity: .7; }
.announcement-close:hover { opacity: 1; }

/* ── NOW PLAYING AREA ─────────────────────────────────── */
.now-playing-area {
  flex: 1; overflow-y: auto;
  display: flex; gap: var(--sp-6);
  align-items: center; justify-content: center;
  padding: var(--sp-6);
  min-height: 0;
}

.artwork-container { position: relative; flex-shrink: 0; }
.artwork-frame {
  width: 220px; height: 220px; border-radius: var(--r-xl);
  background: var(--clr-surface-3); border: 1px solid var(--clr-border-2);
  overflow: hidden; position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), var(--shadow-lg);
}
.artwork-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.artwork-img { width: 100%; height: 100%; object-fit: cover; }

.skip-toast {
  position: absolute; bottom: var(--sp-3); left: 50%; transform: translateX(-50%);
  background: var(--clr-bg-glass); backdrop-filter: blur(8px);
  border: 1px solid var(--clr-border-2); border-radius: var(--r-full);
  padding: 5px 12px; font-size: var(--text-xs); font-weight: 500;
  white-space: nowrap; display: flex; align-items: center; gap: 5px;
  color: var(--clr-text-muted);
}

.now-playing-info {
  flex: 1; min-width: 0; max-width: 360px;
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.track-title {
  font-size: var(--text-xl); font-weight: 700; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.track-artist { font-size: var(--text-base); color: var(--clr-text-muted); }
.track-uploader { font-size: var(--text-xs); color: var(--clr-text-dim); }

.waveform-wrapper { height: 60px; border-radius: var(--r-sm); overflow: hidden; }
.waveform { width: 100%; height: 100%; display: block; }

.vote-area { display: flex; align-items: center; gap: var(--sp-3); }
.vote-progress { font-size: var(--text-xs); color: var(--clr-text-muted); }

.skip-approval-panel {
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--r-md); padding: var(--sp-3);
}
.skip-approval-label { font-size: var(--text-sm); color: var(--clr-warning); display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.skip-approval-actions { display: flex; gap: var(--sp-2); }

.reaction-bar { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.reaction-btn {
  width: 36px; height: 36px; border-radius: var(--r-md); font-size: 18px;
  background: var(--clr-surface-3); border: 1px solid var(--clr-border);
  cursor: pointer; transition: all var(--dur-fast); display: flex; align-items: center; justify-content: center;
}
.reaction-btn:hover { background: var(--clr-surface-2); border-color: var(--clr-accent); transform: scale(1.15); }
.reaction-btn:active { transform: scale(0.9); }

/* ── MOD PANEL ────────────────────────────────────────── */
.mod-panel {
  flex-shrink: 0; border-top: 1px solid var(--clr-border);
  background: var(--clr-surface-glass); padding: var(--sp-3) var(--sp-5);
}
.mod-panel-header {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); font-weight: 600; color: var(--clr-mod);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: var(--sp-3);
}
.mod-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.mod-btn-toggle[aria-pressed="true"] {
  background: var(--clr-accent-glow); color: var(--clr-accent-2); border-color: var(--clr-accent);
}

/* ── SETTINGS ─────────────────────────────────────────── */
.settings-sections { display: flex; flex-direction: column; gap: var(--sp-6); max-width: 560px; }
.settings-section { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--r-lg); padding: var(--sp-5); }
.settings-section-title { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--sp-4); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--clr-border); }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) 0; border-bottom: 1px solid var(--clr-border); }
.settings-item:last-of-type { border-bottom: none; }
.settings-label { font-size: var(--text-sm); color: var(--clr-text-muted); }
.settings-value { font-size: var(--text-sm); font-weight: 500; }
.settings-controls { display: flex; align-items: center; gap: var(--sp-3); }

/* ── RIGHT PANEL ──────────────────────────────────────── */
.app-rpanel {
  grid-area: rpanel;
  position: relative; z-index: 3;
  display: flex; flex-direction: column;
  background: var(--clr-surface); border-left: 1px solid var(--clr-border);
  width: var(--rpanel-w);
  transition: width var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease);
}
.rpanel--hidden { display: none; }

.rpanel-tabs {
  display: flex; border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.rpanel-tab {
  flex: 1; padding: var(--sp-3) 0; font-size: var(--text-xs);
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--clr-text-dim); border-bottom: 2px solid transparent;
  transition: all var(--dur-fast);
}
.rpanel-tab:hover { color: var(--clr-text); }
.rpanel-tab--active { color: var(--clr-accent-2); border-bottom-color: var(--clr-accent); }

.rpanel-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
.rpanel-panel--active { display: flex; }

/* Chat */
.chat-messages {
  flex: 1 1 0; min-height: 0; overflow-y: auto; padding: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
  scroll-behavior: smooth;
}
.chat-msg { display: flex; flex-direction: column; gap: 2px; }
.chat-msg-header { display: flex; align-items: baseline; gap: var(--sp-2); }
.chat-msg-name { font-size: var(--text-xs); font-weight: 600; color: var(--clr-accent-2); }
.chat-msg-name.is-mod { color: var(--clr-mod); }
.chat-msg-name.is-owner { color: var(--clr-accent); }
.chat-msg-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 1px 5px; border-radius: var(--r-full);
  line-height: 1.4; flex-shrink: 0;
}
.chat-msg-tag--mod   { color: var(--clr-mod);   background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); }
.chat-msg-tag--owner { color: var(--clr-accent); background: var(--clr-accent-glow); border: 1px solid var(--clr-accent); }
/* Subtle bubble accent for owner/mod messages so they stand out at a glance */
.chat-msg--owner { border-left: 2px solid var(--clr-accent); padding-left: var(--sp-2); }
.chat-msg--mod   { border-left: 2px solid var(--clr-mod);    padding-left: var(--sp-2); }
.chat-msg-time { font-size: 10px; color: var(--clr-text-dim); }
.chat-msg-text { font-size: var(--text-sm); color: var(--clr-text); word-break: break-word; line-height: 1.4; }

.typing-indicator {
  padding: 4px var(--sp-3); min-height: 20px;
  font-size: var(--text-xs); color: var(--clr-text-dim); font-style: italic;
}
.chat-input-area { display: flex; gap: var(--sp-2); padding: var(--sp-3); border-top: 1px solid var(--clr-border); flex-shrink: 0; }
.chat-input { flex: 1; }

/* Queue */
.queue-list {
  flex: 1 1 0; min-height: 0; overflow-y: auto; padding: var(--sp-2);
  display: flex; flex-direction: column; gap: 2px;
}
.queue-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--dur-fast);
  font-size: var(--text-sm);
}
.queue-item:hover { background: var(--clr-surface-3); }
.queue-item--active { background: var(--clr-accent-glow); border-left: 2px solid var(--clr-accent); }
.queue-item-num { font-size: var(--text-xs); color: var(--clr-text-dim); min-width: 18px; text-align: right; }
.queue-item-icon { width: 28px; height: 28px; border-radius: var(--r-sm); object-fit: cover; background: var(--clr-surface-3); flex-shrink: 0; }
.queue-item-info { flex: 1; min-width: 0; }
.queue-item-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-by { font-size: var(--text-xs); color: var(--clr-text-dim); }
.queue-item-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--dur-fast); }
.queue-item:hover .queue-item-actions { opacity: 1; }

.pending-section { border-top: 1px solid var(--clr-border); flex-shrink: 0; }
.pending-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3); font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: var(--clr-text-muted);
}
.pending-count {
  background: var(--clr-warning); color: #000; border-radius: var(--r-full);
  font-size: 10px; padding: 1px 6px; font-weight: 700;
}
.pending-list { padding: 0 var(--sp-2) var(--sp-2); display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow-y: auto; }
.pending-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border-radius: var(--r-sm);
  font-size: var(--text-sm);
}
.pending-item:hover { background: var(--clr-surface-3); }
.pending-item-info { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-item-by { font-size: var(--text-xs); color: var(--clr-text-dim); }
.pending-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Users panel */
.users-list { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: var(--sp-2); display: flex; flex-direction: column; gap: 2px; }
.user-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  font-size: var(--text-sm);
}
.user-item-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--clr-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.user-item-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-item-name.is-mod { color: var(--clr-mod); font-weight: 600; }
.user-item-name.is-owner { color: var(--clr-accent); font-weight: 700; }
.user-item-badge { font-size: 10px; color: var(--clr-mod); }
/* Small text tag label next to a user's name in the Users tab */
.user-item-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 1px 6px; border-radius: var(--r-full);
  line-height: 1.4; flex-shrink: 0;
}
.user-item-tag--mod   { color: var(--clr-mod);   background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); }
.user-item-tag--owner { color: var(--clr-accent); background: var(--clr-accent-glow); border: 1px solid var(--clr-accent); }
.user-item-action { flex-shrink: 0; white-space: nowrap; }

/* Upload */
.upload-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-6) var(--sp-4);
  border: 2px dashed var(--clr-border); border-radius: var(--r-lg);
  margin: var(--sp-3); text-align: center; cursor: pointer;
  transition: all var(--dur-fast); min-height: 180px; flex-shrink: 0;
}
.upload-area.drag-over { border-color: var(--clr-accent); background: var(--clr-accent-glow); }
.upload-label { font-size: var(--text-sm); font-weight: 500; }
.upload-sub   { font-size: var(--text-xs); color: var(--clr-text-dim); }
.upload-browse-label { cursor: pointer; }
.upload-slots-info { font-size: var(--text-xs); color: var(--clr-text-dim); margin-top: var(--sp-2); }
.upload-queue { padding: 0 var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1 1 0; min-height: 0; overflow-y: auto; }
.upload-file-item {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); padding: var(--sp-2); border-radius: var(--r-sm);
  background: var(--clr-surface-3);
}
.upload-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-status { color: var(--clr-text-dim); flex-shrink: 0; }
.upload-progress-area { padding: var(--sp-3); }
.progress-bar-track { height: 4px; background: var(--clr-surface-3); border-radius: var(--r-full); overflow: hidden; margin-bottom: var(--sp-2); }
.progress-bar-fill { height: 100%; background: var(--clr-accent); border-radius: var(--r-full); width: 0; transition: width var(--dur-base); }
.upload-progress-label { font-size: var(--text-xs); color: var(--clr-text-muted); }

/* ── BOTTOM PLAYER BAR ────────────────────────────────── */
.bottom-player {
  grid-area: player;
  position: relative; z-index: 10;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: var(--clr-surface); border-top: 1px solid var(--clr-border);
  height: var(--player-h);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.player--hidden {
  opacity: 0; transform: translateY(100%); pointer-events: none;
}

/* Fixed width (not min-width) so a longer/shorter track title never shifts the
   prev/play/next controls that sit right after it. Title/artist ellipsize. */
.player-track-info { display: flex; align-items: center; gap: var(--sp-3); width: 220px; flex-shrink: 0; }
.player-artwork-thumb {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  background: var(--clr-surface-3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.player-artwork-thumb img { width: 100%; height: 100%; object-fit: cover; }
.player-meta { min-width: 0; }
.player-title { font-size: var(--text-sm); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.player-artist { font-size: var(--text-xs); color: var(--clr-text-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }

.player-controls { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.player-btn { width: 36px; height: 36px; border-radius: var(--r-sm); }
.player-btn--main {
  width: 42px; height: 42px; background: var(--clr-accent);
  border-radius: 50%; color: #fff;
}
.player-btn--main:hover { background: var(--clr-accent-2); }
.player-btn--main svg { display: block; }

.player-progress-area {
  flex: 1; display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
}
.player-time { font-size: var(--text-xs); color: var(--clr-text-dim); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.player-progress-track {
  flex: 1; height: 4px; border-radius: var(--r-full);
  background: var(--clr-surface-3); cursor: default; position: relative;
  /* Expand the clickable/touchable hit area well beyond the 4px visual bar */
  padding: 10px 0;
  margin: -10px 0;
  background-clip: content-box;
  box-sizing: content-box;
}
.player-progress-track.is-draggable { cursor: pointer; }
.player-progress-track.is-draggable:hover { height: 6px; }
.player-progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: var(--clr-accent); pointer-events: none;
}
.player-progress-thumb {
  position: absolute; top: 50%; transform: translate(-50%, -50%) scale(1);
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; pointer-events: none;
  opacity: 1; box-shadow: 0 0 0 2px rgba(0,0,0,.15);
  transition: transform var(--dur-fast);
}
.player-progress-track.is-draggable:hover .player-progress-thumb { transform: translate(-50%, -50%) scale(1.25); }

.player-extras { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.player-volume { display: flex; align-items: center; gap: var(--sp-2); }
.volume-slider {
  -webkit-appearance: none; width: 80px; height: 4px;
  border-radius: var(--r-full); background: var(--clr-surface-3);
  outline: none; cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--clr-accent); cursor: pointer;
}

/* ── REACTION DISPLAY ─────────────────────────────────── */
.reaction-display { position: fixed; bottom: calc(var(--player-h) + 20px); right: 360px; pointer-events: none; z-index: 9000; }
.reaction-bubble {
  position: absolute; font-size: 28px;
  animation: reaction-fly 2.5s ease-out forwards;
}
@keyframes reaction-fly {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-120px) scale(0.6); }
}

/* ── UTILITIES ────────────────────────────────────────── */
.hidden { display: none !important; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--clr-border-2); }

/* Focus ring */
:focus-visible { outline: 2px solid var(--clr-accent); outline-offset: 2px; }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --nav-w: 56px; --rpanel-w: 100%; --player-h: 60px; }
  .app-shell { grid-template-columns: var(--nav-w) 1fr; }
  .app-shell.panel-open { grid-template-columns: var(--nav-w) 1fr; }
  .app-rpanel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; width: 100%; max-width: 340px; transform: translateX(100%); transition: transform var(--dur-slow) var(--ease); }
  .app-rpanel.mobile-open { transform: translateX(0); }
  .now-playing-area { flex-direction: column; }
  .np-row { flex-direction: column; align-items: center; }
  .artwork-frame { width: 160px; height: 160px; }
  .player-extras { display: none; }
  /* Narrower (still fixed) track-info on phones so it doesn't overflow but the
     transport controls still keep a stable position. */
  .player-track-info { width: 128px; }
  .player-title, .player-artist { max-width: 80px; }
  .app-shell.panel-open ~ .toast-container { right: var(--sp-4); }
}

/* ── Persistent queue dropdown (under now-playing; works with side panel closed) ── */
/* Stack the artwork+info row, then the queue full-width beneath them. A definite
   width keeps now-playing-info's flex:1 predictable and makes the queue span the
   combined width of artwork + now-playing-info. */
.np-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 620px; min-width: 0; }
.np-row   { display: flex; gap: var(--sp-6); align-items: center; width: 100%; min-width: 0; }
.np-queue { width: 100%; border: 1px solid var(--clr-border); border-radius: 12px; background: var(--clr-surface-2); overflow: hidden; }
.np-queue-toggle {
    display: flex; align-items: center; gap: 9px; width: 100%;
    background: none; border: none; cursor: pointer; padding: 13px 15px;
    color: var(--clr-text); font: inherit; font-weight: 600; font-size: 14px;
}
.np-queue-toggle:hover { background: var(--clr-surface-3); }
.np-queue-toggle svg { color: var(--clr-text-muted); flex-shrink: 0; }
.np-queue-count {
    margin-left: auto; background: var(--clr-accent-glow); color: var(--clr-accent-2);
    border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; min-width: 22px; text-align: center;
}
.np-queue-caret { transition: transform .2s ease; margin-left: 4px; }
.np-queue-toggle[aria-expanded="true"] .np-queue-caret { transform: rotate(180deg); }
.np-queue-list { max-height: 300px; overflow-y: auto; padding: 4px 8px 8px; border-top: 1px solid var(--clr-border); }
.np-queue-list[hidden] { display: none; }

/* ── Locked playback controls (non-mod listeners) — clearly not interactive ── */
.player-btn--locked { opacity: .35; cursor: not-allowed; }
.player-btn--locked:hover { background: none; transform: none; }
.player-progress-track.is-locked { cursor: not-allowed; }
