/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Base */
  --bg:        #07070e;
  --bg2:       rgba(255,255,255,0.04);
  --bg3:       rgba(255,255,255,0.07);
  --bg4:       rgba(255,255,255,0.11);
  --border:    rgba(255,255,255,0.09);
  --accent:    #ff3a00;
  --accent2:   #ff7a00;
  --accent-glow: rgba(255, 58, 0, 0.3);
  --text:      #f2f2f8;
  --text2:     #9292aa;
  --text3:     #54546a;
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow:    0 8px 32px rgba(0,0,0,0.55);

  /* Liquid Glass system */
  --glass:         rgba(14, 14, 22, 0.62);
  --glass-surface: rgba(255,255,255,0.04);
  --glass-blur:    blur(22px);
  --glass-heavy:   blur(40px);
  --glass-border:  1px solid rgba(255,255,255,0.1);
  --glass-shine:   inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -1px 0 rgba(0,0,0,0.25);
  --glass-shadow:  0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
}

html {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}
body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
/* Atmospheric gradient background — all glass surfaces are lit by this */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 8% 90%, rgba(255,52,0,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 45% 40% at 88% 12%, rgba(100,60,220,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 110%, rgba(255,90,0,0.05) 0%, transparent 55%);
}

/* Views sit above the atmosphere */
.view { z-index: 1; background: rgba(7,7,14,0.88); }

/* ── Landscape lock ───────────────────────────────────────────────────────── */
.orientation-lock {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text2);
  font-size: 0.95rem;
}

/* ── Views ────────────────────────────────────────────────────────────────── */
.view { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; overflow-x: hidden; overflow-y: auto; padding-top: env(safe-area-inset-top); }
#view-landing { background: transparent; }
.view.active { display: flex; flex-direction: column; }
#view-now-playing { padding-top: 0; }

/* ── Landing ──────────────────────────────────────────────────────────────── */
.landing-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  gap: 1rem;
  background: transparent;
}

.app-version {
  font-size: 0.7rem;
  color: var(--text3);
  opacity: 0.5;
  letter-spacing: 0.05em;
  margin-top: auto;
  padding-top: 1rem;
}

.logo-mark {
  font-size: 4rem;
  color: var(--accent);
  filter: drop-shadow(0 0 24px var(--accent-glow));
  line-height: 1;
}

.logo-title {
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo-title span {
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
}

.logo-sub {
  color: var(--text2);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

/* Public events on landing */
.public-events-section {
  width: 100%;
  max-width: 560px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}
.public-events-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 0.75rem;
}
.public-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.public-event-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  box-shadow: var(--glass-shine), 0 4px 16px rgba(0,0,0,0.3);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.public-event-card:hover { border-color: rgba(255,58,0,0.35); box-shadow: var(--glass-shine), 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,58,0,0.15); }
.public-event-info { flex: 1; min-width: 0; }
.public-event-name { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.public-event-meta { font-size: 0.82rem; color: var(--text3); margin-top: 0.15rem; }
.public-event-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255,58,0,0.12);
  border: 1px solid rgba(255,58,0,0.3);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 2px 16px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 4px 24px var(--accent-glow); }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text2);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.btn-icon {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.6rem;
  width: 40px;
  height: 40px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,58,0,0.5); color: var(--accent); }

.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-full { width: 100%; }

.btn-back {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--text); }

.btn-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}
.btn-close:hover { color: var(--text); }

/* ── Card center (join / login) ───────────────────────────────────────────── */
#view-join, #view-admin-login, #view-create, #view-auth {
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(255,58,0,0.12) 0%, transparent 70%),
    var(--bg);
}

/* Join page two-column layout */
.join-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 820px;
}

.join-form-wrap {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
  box-shadow: var(--glass-shine), var(--glass-shadow);
}

.join-form-wrap h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Public events panel inside join view */
.join-layout .public-events-section {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0;
}

.join-layout .public-events-list {
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
}

.card-center {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--glass-shine), var(--glass-shadow);
}

.card-center h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .join-layout {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .join-form-wrap { max-width: none; }
  .join-layout .public-events-list { max-height: none; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"], input[type="password"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: max(1rem, 16px);
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.3);
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: rgba(255,58,0,0.6);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.3), 0 0 0 3px rgba(255,58,0,0.12);
}
input::placeholder { color: var(--text3); }

.error-msg {
  color: #ff6b6b;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ── Admin Dashboard ──────────────────────────────────────────────────────── */
#view-admin-dashboard {
  background: var(--bg);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.room-event-id {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text3);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.08em;
  vertical-align: middle;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .room-event-id { display: none; }
}

.logo-small {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-admin {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dashboard-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.dashboard-body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.dashboard-create {
  background: rgba(255,255,255,0.04);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--glass-shine);
}

.inline-form {
  display: flex;
  gap: 0.75rem;
}

.inline-form input { flex: 1; }

/* Toggle switch */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.toggle-input { display: none; }
.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--bg4);
  border-radius: 11px;
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--text3);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); background: #fff; }
.toggle-text { font-size: 0.88rem; color: var(--text2); }

.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-card {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--glass-shine), 0 4px 16px rgba(0,0,0,0.3);
}

.event-card-info { flex: 1; min-width: 0; }
.event-card-name { font-weight: 700; font-size: 1.05rem; }
.event-card-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-shadow: 0 0 20px var(--accent-glow);
}
.event-card-meta { font-size: 0.82rem; color: var(--text3); margin-top: 0.2rem; }

.badge-live {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255,58,0,0.12);
  border: 1px solid rgba(255,58,0,0.3);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.event-card-track {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg3);
  border-radius: 6px;
}
.event-card-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.event-card-track-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.event-card-track-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-card-track-channel {
  font-size: 0.75rem;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-card-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.badge-public {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4caf8a;
  background: rgba(76,175,138,0.12);
  border: 1px solid rgba(76,175,138,0.3);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.events-empty {
  color: var(--text3);
  text-align: center;
  padding: 2rem;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── Room ─────────────────────────────────────────────────────────────────── */
#view-room {
  background: var(--bg);
  overflow: hidden;
}

.room-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-top: 0.75rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0.75rem;
}

.room-header-left { flex: 1; min-width: 0; }
.room-header-center { display: flex; justify-content: center; }
.room-header-right { flex: 1; display: flex; justify-content: flex-end; gap: 0.5rem; }

.user-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text2);
  font-size: 0.85rem;
}
.user-count svg { width: 14px; height: 14px; }

/* view-room layout via .view.active — no separate display rule needed */
#audio-player { display: none; }

/* Music player: mobile — inline between header and queue */
.music-player {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  order: 0; /* before room-body */
}

.room-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  order: 1;
}

/* No-track placeholder lives inside room-body on mobile */
.no-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2.5rem 2rem;
  color: var(--text3);
}
.no-track-icon { font-size: 3rem; opacity: 0.3; }
.no-track p { font-size: 1rem; }
.no-track .hint { font-size: 0.85rem; }

/* Artwork */
.mp-artwork-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 320px;
  position: relative;
  background: var(--bg3);
  overflow: hidden;
  flex-shrink: 0;
}
.mp-artwork {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.audio-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.np-dl-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55);
  padding: 0.4rem 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.np-dl-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.np-dl-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.np-dl-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
  letter-spacing: 0.03em;
}
.np-dl-error {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(180,30,30,0.85);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: #fff;
}
.np-dl-error svg { flex-shrink: 0; margin-top: 1px; }
.np-dl-error span { font-size: 0.72rem; line-height: 1.35; word-break: break-word; }
.audio-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Body below artwork */
.mp-body {
  padding: 1.1rem 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Track info */
.mp-info { min-width: 0; }
.mp-title {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.mp-channel {
  font-size: 0.85rem;
  color: var(--text2);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress bar */
.mp-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.mp-time {
  font-size: 0.75rem;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  width: 36px;
  flex-shrink: 0;
}
.mp-time:last-child { text-align: right; }
.mp-bar-track {
  flex: 1;
  position: relative;
  height: 36px; /* tall tap target */
  display: flex;
  align-items: center;
}
.mp-bar-fill {
  position: absolute;
  inset: 0;
  margin: auto 0;
  height: 4px;
  border-radius: 2px;
  background: var(--bg4);
  pointer-events: none;
  overflow: hidden;
}
.mp-bar-fill::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s linear;
}
.np-bar-thumb {
  position: absolute;
  top: 50%;
  left: var(--progress, 0%);
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  transition: left 0.4s linear;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.mp-seek-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.mp-seek-input:disabled { cursor: default; }

/* Controls */
.mp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}
.mp-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mp-btn:active { transform: scale(0.9); }
.mp-btn svg { display: block; }
.mp-btn-sec {
  width: 44px;
  height: 44px;
  color: var(--text2);
}
.mp-btn-sec svg { width: 22px; height: 22px; }
.mp-btn-sec:hover { background: var(--bg3); }
.mp-btn-play {
  width: 64px;
  height: 64px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255,100,0,0.35);
}
.mp-btn-play svg { width: 28px; height: 28px; }
.mp-btn-play:hover { background: var(--accent2); }
.mp-spin { animation: spin 1s linear infinite; }

/* Admin row */
.mp-admin-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.mp-admin-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.toggle-inline {
  gap: 0.4rem;
  margin: 0;
}
.toggle-inline .toggle-text {
  font-size: 0.82rem;
}

/* ── Queue column ─────────────────────────────────────────────────────────── */
.queue-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.queue-header h3 { font-size: 0.95rem; font-weight: 700; }
.queue-count { font-size: 0.8rem; color: var(--text3); }

.queue-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
}

.queue-empty {
  text-align: center;
  color: var(--text3);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.queue-item:hover { background: var(--bg3); }

.queue-item-num {
  font-size: 0.78rem;
  color: var(--text3);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.queue-item-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg3);
  flex-shrink: 0;
}

.queue-item-info { flex: 1; min-width: 0; }
.queue-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item-meta { font-size: 0.77rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item-channel { font-size: 0.77rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.queue-item-del {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.queue-item-del:hover { background: rgba(255,58,0,0.15); color: var(--accent); }

/* Queue action buttons (ban, replay, remove) */
.queue-item-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}
.queue-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text3);
  transition: all 0.15s;
  line-height: 1;
}
.queue-action-btn.remove:hover   { background: rgba(255,58,0,0.15); color: var(--accent); }
.queue-action-btn.ban:hover      { background: rgba(255,58,0,0.15); color: var(--accent); }
.queue-action-btn.unban:hover    { background: rgba(76,175,138,0.15); color: #4caf8a; }
.queue-action-btn.replay:hover   { background: rgba(255,122,0,0.15); color: var(--accent2); }
.queue-action-btn.play-now:hover { background: rgba(255,122,0,0.2); color: var(--accent2); }

/* Drag handle */
.queue-drag-handle {
  cursor: grab;
  color: var(--text3);
  font-size: 1rem;
  padding: 0 0.2rem;
  opacity: 0.4;
  flex-shrink: 0;
}
.queue-drag-handle:active { cursor: grabbing; }
.draggable-item:hover .queue-drag-handle { opacity: 0.8; }

/* Drag-and-drop states */
.queue-item.dragging { opacity: 0.4; }
.queue-item.drag-over {
  border-top: 2px solid var(--accent2);
  margin-top: -2px;
}

/* History section */
.history-item { opacity: 0.65; }
.history-item:hover { opacity: 1; }
.queue-item.clickable { cursor: pointer; }
.queue-item.clickable:hover { background: var(--bg3); opacity: 1; }
.queue-item.banned { opacity: 0.45; }
/* ── Collapsible queue sections ───────────────────────────────────────────── */
.qs-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem 0.75rem 0.85rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.qs-header:hover { background: var(--bg3); }
.qs-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text2);
  flex: 1;
}
.qs-meta {
  font-size: 0.75rem;
  color: var(--text3);
}
.qs-chevron {
  width: 18px;
  height: 18px;
  color: var(--text3);
  flex-shrink: 0;
  transition: transform 0.2s;
  transform: rotate(-90deg); /* collapsed = pointing right */
}
.qs-chevron svg { width: 18px; height: 18px; display: block; }
.qs-chevron.open { transform: rotate(0deg); } /* open = pointing down */

.qs-body { padding: 0.35rem 0.5rem; }

/* Badge banned in search */
.badge-banned {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255,58,0,0.12);
  border: 1px solid rgba(255,58,0,0.3);
  border-radius: 5px;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-result-item.banned { opacity: 0.5; }

/* (seek bar now lives inside .mp-progress) */

/* Listeners panel (dropdown from header) */
.room-header-center { position: relative; }
.listeners-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 200px;
  max-width: 260px;
  z-index: 50;
}
.listeners-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}
.listeners-list { padding: 0.4rem; max-height: 240px; overflow-y: auto; overflow-x: hidden; }
.listeners-empty { padding: 0.8rem; text-align: center; font-size: 0.85rem; color: var(--text3); }
.listener-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
}
.listener-item:hover { background: var(--bg3); }
.listener-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.listener-name { font-size: 0.88rem; }

/* ── Panels (search / fallback) ───────────────────────────────────────────── */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: rgba(10, 10, 18, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid rgba(255,255,255,0.09);
  box-shadow: inset 1px 0 0 rgba(255,255,255,0.06), -12px 0 48px rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.panel-header h3 { font-size: 1rem; font-weight: 700; }

.panel-hint {
  font-size: 0.85rem;
  color: var(--text2);
  padding: 0.75rem 1.25rem 0;
}

.search-bar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.source-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}

.tab {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab:not(.active):hover { border-color: var(--text3); color: var(--text); }

.search-input-row {
  display: flex;
  gap: 0.5rem;
}
.search-input-row input { flex: 1; }

.search-results {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
}

.search-hint {
  text-align: center;
  color: var(--text3);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover { background: var(--bg3); }

.search-result-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg3);
  flex-shrink: 0;
}

.search-result-info { flex: 1; min-width: 0; }
.search-result-title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-channel { font-size: 0.78rem; color: var(--text2); }
.search-result-dur { font-size: 0.75rem; color: var(--text3); margin-top: 0.1rem; }

.search-result-add {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.search-result-add:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.search-load-more {
  display: block;
  width: calc(100% - 1.3rem);
  margin: 0.5rem 0.65rem 0.75rem;
  padding: 0.55rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.search-load-more:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.search-load-more:disabled { opacity: 0.5; cursor: default; }

.search-loading, .search-error {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}
.search-loading { color: var(--text3); }
.search-error { color: #ff6b6b; }

.fallback-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.fallback-list-header h4 { font-size: 0.88rem; font-weight: 600; color: var(--text2); }

/* ── Overlay bg ───────────────────────────────────────────────────────────── */
.overlay-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  align-items: center;
}

.toast {
  background: var(--bg4);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  max-width: min(360px, calc(100vw - 2rem));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
}
.toast.success { border-color: #22c55e; color: #86efac; }
.toast.error { border-color: #ef4444; color: #fca5a5; }
.toast.warning { border-color: #f59e0b; color: #fcd34d; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

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

/* ── Desktop: fixed bottom player bar ────────────────────────────────────── */
@media (min-width: 641px) {
  /* room-body takes full width; no side-by-side split */
  .room-body {
    flex-direction: column;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .no-track { display: none; } /* placeholder not needed on desktop */

  /* Fixed bottom bar */
  .music-player {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(82px + env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: center;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding: 0 max(1rem, env(safe-area-inset-right));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-bottom: env(safe-area-inset-bottom);
    gap: 0;
  }

  /* Small square thumbnail */
  .mp-artwork-wrap {
    width: 52px;
    height: 52px;
    aspect-ratio: unset;
    max-height: none;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 0.85rem;
  }

  /* Body becomes a flex row filling the bar */
  .mp-body {
    flex: 1;
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 0;
    min-width: 0;
  }

  /* Left: title + channel */
  .mp-info {
    flex: 0 0 200px;
    max-width: 200px;
    padding-right: 1rem;
  }
  .mp-title { font-size: 0.9rem; }
  .mp-channel { font-size: 0.78rem; }

  /* Center: controls, then progress to the right */
  .mp-controls {
    flex-shrink: 0;
    gap: 0.5rem;
    order: 2;
    padding: 0 1.25rem;
  }
  .mp-btn-play { width: 44px; height: 44px; box-shadow: none; }
  .mp-btn-play svg { width: 20px; height: 20px; }
  .mp-btn-sec { width: 36px; height: 36px; }
  .mp-btn-sec svg { width: 18px; height: 18px; }

  /* Right: timeline */
  .mp-progress {
    flex: 1;
    order: 3;
    padding-left: 1rem;
  }

  /* Admin row: right-most, compact */
  .mp-admin-row {
    order: 4;
    flex-shrink: 0;
    padding-top: 0;
    border-top: none;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    margin-left: 0.5rem;
    gap: 0.5rem;
  }
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .music-player {
    border-bottom: 1px solid var(--border);
  }

  .room-header-right .btn span { display: none; }

  /* ── Admin compact player on mobile ──────────────────────────────────────
     The full artwork + admin controls take ~570px, leaving zero room for
     the queue on small screens. Switch to the same horizontal bar layout
     used on desktop so the queue is always accessible.               ── */
  #view-room.room-admin .music-player {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.6rem 1rem;
    gap: 0;
  }

  #view-room.room-admin .mp-artwork-wrap {
    width: 48px;
    height: 48px;
    aspect-ratio: unset;
    max-height: none;
    border-radius: 6px;
    flex-shrink: 0;
    margin-right: 0.65rem;
  }

  #view-room.room-admin .mp-body {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    gap: 0;
    min-width: 0;
  }

  #view-room.room-admin .mp-info {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 110px;
    padding-right: 0.5rem;
  }
  #view-room.room-admin .mp-title  { font-size: 0.82rem; }
  #view-room.room-admin .mp-channel { font-size: 0.72rem; }

  #view-room.room-admin .mp-controls {
    flex-shrink: 0;
    order: 2;
    gap: 0.2rem;
    padding: 0 0.5rem;
  }
  #view-room.room-admin .mp-btn-play { width: 40px; height: 40px; box-shadow: none; }
  #view-room.room-admin .mp-btn-play svg { width: 18px; height: 18px; }
  #view-room.room-admin .mp-btn-sec  { width: 34px; height: 34px; }
  #view-room.room-admin .mp-btn-sec svg { width: 16px; height: 16px; }

  #view-room.room-admin .mp-progress {
    flex: 1;
    order: 3;
    padding-left: 0.4rem;
  }
  #view-room.room-admin .mp-time { font-size: 0.65rem; width: 28px; }

  /* Admin row wraps to a second line below the controls */
  #view-room.room-admin .mp-admin-row {
    width: 100%;
    order: 5;
    padding-top: 0.4rem;
    padding-left: 0;
    margin-left: 0;
    border-top: 1px solid var(--border);
    border-left: none;
    margin-top: 0.35rem;
    gap: 0.5rem;
  }
}

/* ── Auth tabs ────────────────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.auth-tabs .tab {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tabs .tab.active {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

/* ── Library ──────────────────────────────────────────────────────────────── */
.library-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}
.lib-section {}
.lib-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.lib-section-header h3 { font-size: 1rem; font-weight: 700; }
.lib-empty { color: var(--text3); font-size: 0.9rem; padding: 0.5rem 0; }

.playlists-grid {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.playlists-grid::-webkit-scrollbar { display: none; }
.playlist-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.playlist-card:hover { background: var(--bg3); }
.playlist-card-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.playlist-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-card-meta { font-size: 0.75rem; color: var(--text3); margin-top: 0.25rem; }

.my-events-list { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Playlist view ────────────────────────────────────────────────────────── */
.btn-back-inline {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text1);
  display: flex;
  align-items: center;
  padding: 0 0.25rem;
  margin-right: 0.25rem;
}
.btn-back-inline svg { width: 20px; height: 20px; }
.playlist-actions {
  display: flex;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

/* ── Personal player bar ──────────────────────────────────────────────────── */
.personal-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 18, 0.75);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 -8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  z-index: 100;
}
.ppb-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.ppb-info {
  flex: 1;
  min-width: 0;
}
.ppb-title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ppb-channel { font-size: 0.75rem; color: var(--text3); }
.ppb-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* ── Now Playing view ────────────────────────────────────────────────────── */
.np-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 0.5rem) 1rem 0.5rem;
  border-bottom: none;
  flex-shrink: 0;
}
.np-header-title { font-size: 0.75rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; }
.np-header-right { display: flex; align-items: center; gap: 0.25rem; }
.np-cast-btn {
  width: 36px; height: 36px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text3); opacity: 0.5;
  cursor: not-allowed;
  display: flex; align-items: center; justify-content: center;
}

.np-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.25rem calc(env(safe-area-inset-bottom) + 4.5rem);
  gap: 1.25rem;
}

.np-artwork-wrap {
  position: relative;
  width: calc(100% - 0rem);
  max-width: 400px;
  aspect-ratio: 1/1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
  flex-shrink: 0;
}
.np-artwork {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.np-info { text-align: left; width: 100%; }
.np-title {
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-artist { font-size: 0.9rem; color: var(--text2); margin-top: 0.2rem; }

.np-progress-wrap { width: 100%; }
.np-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  margin-top: 0.3rem;
}

.np-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.25rem 0;
}
.np-nav-btn {
  background: none; border: none; cursor: pointer;
  color: #fff; display: flex; align-items: center; justify-content: center;
  padding: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.np-nav-btn:active { opacity: 0.6; }
.np-queue-section { width: 100%; }
.np-play-btn { width: 72px; height: 72px; }
.np-play-btn svg { width: 30px; height: 30px; }

.np-queue { width: 100%; }
.np-queue-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); margin-bottom: 0.5rem; }
.np-queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.np-queue-item img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.np-queue-item > div { flex: 1; min-width: 0; overflow: hidden; }
.np-queue-item-title { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-queue-item-artist { font-size: 0.75rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Search result extra buttons ─────────────────────────────────────────── */
.search-result-btns { display: flex; gap: 0.4rem; flex-shrink: 0; }
.search-result-add.secondary {
  background: var(--bg3);
  color: var(--text1);
}
.search-result-add.secondary:hover { background: var(--bg4); }

/* ═══════════════════════════════════════════════════════════════════════════
   PERSONAL MUSIC — REDESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

/* -- Font variables -------------------------------------------------------- */
:root {
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}
body { font-family: var(--font-body); }

/* -- Library header -------------------------------------------------------- */
.lib-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  background: linear-gradient(to bottom, rgba(7,7,14,0.95) 60%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.lib-logo {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 800;
  line-height: 1;
}
.lib-header-actions { display: flex; align-items: center; gap: 0.25rem; }
.lib-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.lib-icon-btn:hover { background: var(--bg3); color: var(--text1); }
.lib-icon-btn svg { width: 20px; height: 20px; }

/* -- Greeting -------------------------------------------------------------- */
.lib-greeting {
  padding: 0.5rem 1.25rem 1.5rem;
}
.lib-greeting-time {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}
.lib-greeting-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* -- Section heading override (h2 replaces h3) ----------------------------- */
.lib-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* -- New button ------------------------------------------------------------ */
.lib-new-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
  transition: background 0.15s;
}
.lib-new-btn:hover { background: rgba(255,255,255,0.11); }
.lib-new-btn svg { width: 13px; height: 13px; }

/* -- Playlists grid (horizontal scroll) ----------------------------------- */
.playlists-grid {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.playlists-grid::-webkit-scrollbar { display: none; }

/* -- Playlist card --------------------------------------------------------- */
.playlist-card {
  flex: 0 0 auto;
  width: 145px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--glass-border);
  border-radius: 14px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--glass-shine), 0 4px 16px rgba(0,0,0,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
@media (min-width: 640px) { .playlist-card { width: 165px; } }
@media (min-width: 900px) { .playlist-card { width: 180px; } }
.playlist-card:hover { transform: translateY(-3px); box-shadow: var(--glass-shine), 0 12px 32px rgba(0,0,0,0.5); }
.playlist-card-art {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg4, #2a2a2a) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.playlist-card-art > svg {
  width: 40%;
  height: 40%;
  color: var(--text3);
  opacity: 0.5;
}
.playlist-card-play {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1;
}
.playlist-card-play svg { width: 16px; height: 16px; padding-left: 2px; }
.playlist-card:hover .playlist-card-play { opacity: 1; transform: translateY(0); }
/* Always show play button on touch devices (no hover available) */
@media (hover: none) {
  .playlist-card-play { opacity: 1; transform: translateY(0); }
}
.playlist-card-art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.playlist-card-body {
  padding: 0.65rem 0.75rem 0.75rem;
}
.playlist-card-name {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text1);
}
.playlist-card-meta {
  font-size: 0.72rem;
  color: var(--text3);
  margin-top: 0.2rem;
}

/* -- Playlist hero --------------------------------------------------------- */
#view-playlist {
  overflow-y: auto;
}
#view-playlist .library-body {
  flex: none;
  overflow: visible;
}
.pl-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem 2rem;
  background: linear-gradient(to bottom,
    rgba(255, 58, 0, 0.25) 0%,
    rgba(255, 58, 0, 0.05) 60%,
    transparent 100%
  );
  text-align: center;
  flex-shrink: 0;
}
.pl-back-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pl-back-btn:hover { background: rgba(255,255,255,0.15); }
.pl-back-btn svg { width: 20px; height: 20px; }

.pl-hero-art {
  width: min(180px, 55vw);
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}
.pl-hero-art svg {
  width: 45%;
  height: 45%;
  color: var(--text3);
  opacity: 0.4;
}
.pl-hero-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin-bottom: 0.4rem;
}
.pl-hero-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 1.5rem;
  word-break: break-word;
}
.pl-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
.pl-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255,58,0,0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pl-play-btn:hover { transform: scale(1.06); box-shadow: 0 6px 28px rgba(255,58,0,0.6); }
.pl-play-btn svg { width: 22px; height: 22px; padding-left: 2px; }
.pl-menu-btn {
  padding: 0.35rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
  transition: background 0.15s;
}
.pl-menu-btn:hover { background: rgba(255,255,255,0.1); }
.pl-menu-btn--danger { color: #ff6b6b; border-color: rgba(255,107,107,0.3); }
.pl-menu-btn--danger:hover { background: rgba(255,107,107,0.1); }

/* -- Now Playing: atmosphere mode ----------------------------------------- */
#view-now-playing {
  overflow: hidden;
}
.np-bg {
  position: fixed;
  inset: -60px;
  background-size: cover;
  background-position: center;
  filter: blur(60px) brightness(0.2) saturate(1.6);
  z-index: 0;
  transition: background-image 0.8s ease;
  pointer-events: none;
}
#view-now-playing .np-header,
#view-now-playing .np-body {
  position: relative;
  z-index: 1;
}
.np-header {
  border-bottom-color: rgba(255,255,255,0.06);
  background: transparent;
}
.np-close-btn,
.np-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.np-close-btn:hover,
.np-add-btn:hover { background: rgba(255,255,255,0.15); }
.np-close-btn svg,
.np-add-btn svg { width: 20px; height: 20px; }

.np-artwork-wrap {
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
  border-radius: 16px;
}
.np-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .np-title { font-size: 1.05rem; }
}
.np-title.is-long {
  text-overflow: ellipsis;
}
.np-title.is-long .np-title-inner {
  display: inline-block;
  animation: np-reveal 16s ease-in-out infinite;
  animation-delay: 2s;
}
@keyframes np-reveal {
  0%, 20%  { transform: translateX(0); }
  75%, 90% { transform: translateX(var(--marquee-offset, -60px)); }
  100%     { transform: translateX(0); }
}

/* -- Personal player bar with progress strip ------------------------------ */
.personal-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(8, 8, 16, 0.78);
  backdrop-filter: var(--glass-heavy);
  -webkit-backdrop-filter: var(--glass-heavy);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 -8px 32px rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
.ppb-progress-strip {
  height: 2px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.ppb-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 1s linear;
}
.ppb-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 1rem;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.ppb-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  visibility: visible;
}
.ppb-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.ppb-info { flex: 1; min-width: 0; overflow: hidden; }
.ppb-title {
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ppb-channel { font-size: 0.72rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ppb-controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.ppb-btn-cast {
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: not-allowed;
  color: var(--text3);
  opacity: 0.45;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ppb-btn-play {
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ppb-btn-play.ppb-dl-active,
.ppb-play-big.ppb-dl-active {
  animation: ppb-dl-pulse 1.8s ease-in-out infinite;
}
@keyframes ppb-dl-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* -- Like button ----------------------------------------------------------- */
.np-info-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.np-info-row .np-info { flex: 1; min-width: 0; }
.np-like-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.15s;
}
.np-like-btn:hover { color: var(--text1); transform: scale(1.1); }
.np-like-btn.liked { color: #1ed760; }
.np-like-btn.liked svg { fill: currentColor; stroke: currentColor; }
.np-like-btn svg { width: 22px; height: 22px; }

/* -- Shuffle / Repeat controls -------------------------------------------- */
.np-controls {
  gap: 0.75rem;
}
.np-ctrl-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.np-ctrl-btn:hover { color: var(--text1); }
.np-ctrl-btn.active { color: #1ed760; }
.np-ctrl-btn.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #1ed760;
}
.np-ctrl-btn svg { width: 18px; height: 18px; }
.np-repeat-one {
  position: absolute;
  font-size: 9px;
  font-weight: 700;
  top: 6px;
  right: 5px;
  line-height: 1;
  color: inherit;
}

/* -- Now playing queue handle & drawer ------------------------------------- */
.np-queue-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 1rem calc(env(safe-area-inset-bottom) + 0.6rem);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.np-queue-handle span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.np-queue-pill {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
}
.np-queue-backdrop {
  position: absolute;
  inset: 0;
  z-index: 19;
  background: rgba(0,0,0,0);
  pointer-events: none;
  transition: background 0.38s;
}
.np-queue-backdrop.open {
  background: rgba(0,0,0,0.45);
  pointer-events: auto;
}
.np-queue-drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100% - 56px);
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.np-queue-drawer.open {
  transform: translateY(0);
}
.np-queue-drawer-hd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.np-queue-drawer-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.np-queue-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem calc(env(safe-area-inset-bottom) + 1rem);
}

/* -- Liked Songs card ------------------------------------------------------ */
.liked-songs-card .playlist-card-art {
  background: linear-gradient(135deg, #450af5 0%, #c4efd9 100%);
}
.liked-songs-card .playlist-card-art > svg {
  color: #fff;
  opacity: 0.9;
}

/* -- Custom dialog --------------------------------------------------------- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.15s ease;
}
.dialog-overlay.hidden { display: none; }
.dialog-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem 1.5rem 1.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: dialogEnter 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dialogEnter {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.dialog-title {
  font-family: var(--font-display, sans-serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.dialog-message {
  font-size: 0.875rem;
  color: var(--text2);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.dialog-input {
  width: 100%;
  margin: 0.75rem 0 1.25rem;
  padding: 0.7rem 0.9rem;
  font-family: var(--font-body, sans-serif);
  font-size: 0.95rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text1);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.dialog-input:focus { border-color: var(--accent); }
.dialog-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}
.dialog-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  font-family: var(--font-body, sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: none;
}
.dialog-btn:active { transform: scale(0.97); }
.dialog-cancel {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
}
.dialog-cancel:hover { background: var(--bg4, #333); color: var(--text1); }
.dialog-confirm {
  background: var(--accent);
  color: #fff;
}
.dialog-confirm:hover { filter: brightness(1.1); }
.dialog-confirm[data-danger="true"] {
  background: #e63946;
}
.dialog-confirm[data-danger="true"]:hover { filter: brightness(1.1); }

/* -- Volume in player bar -------------------------------------------------- */
.ppb-volume {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 0.25rem;
}
@media (max-width: 480px) { .ppb-volume { display: none; } }
.ppb-vol-icon { width: 16px; height: 16px; color: var(--text3); flex-shrink: 0; }
.ppb-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.18);
  outline: none;
  cursor: pointer;
}
.ppb-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.ppb-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* -- Inline track add picker ----------------------------------------------- */
.search-result-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  position: relative;
}
.search-result-item:has(.track-add-picker:not(.hidden)) {
  position: relative;
  z-index: 20;
}
.srb-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.srb-play:hover { transform: scale(1.08); }
.srb-play svg { width: 14px; height: 14px; padding-left: 1px; }
.srb-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.srb-add:hover { background: var(--bg3); color: var(--text1); }
.srb-add svg { width: 14px; height: 14px; }

.track-add-wrap { position: relative; }
.track-add-picker {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 180px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
  animation: fadeScaleIn 0.12s ease;
}
@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tpa-loading { padding: 0.6rem 0.9rem; font-size: 0.82rem; color: var(--text3); }
.tpa-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.9rem;
  background: none;
  border: none;
  color: var(--text1);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.tpa-item:hover { background: rgba(255,255,255,0.06); }
.tpa-item svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text3); }
.tpa-new { color: var(--accent); border-top: 1px solid var(--border); }
.tpa-new svg { color: var(--accent); }

/* ── Desktop Sidebar ──────────────────────────────────────────────────────── */
.desktop-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  background: rgba(10, 10, 18, 0.72);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid rgba(255,255,255,0.08);
  box-shadow: 1px 0 0 rgba(255,255,255,0.04), inset -1px 0 0 rgba(0,0,0,0.2);
  z-index: 50;
  flex-direction: column;
  overflow: hidden;
}

.ds-header {
  padding: 1.1rem 1rem 0.75rem;
  flex-shrink: 0;
}
.ds-logo-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: opacity 0.15s;
}
.ds-logo-btn:hover { opacity: 0.8; }
.ds-logo-mark { color: var(--accent); font-size: 1.25rem; line-height: 1; }
.ds-logo-text { color: var(--text); }

.ds-nav {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.5rem;
  gap: 0.1rem;
  flex-shrink: 0;
}
.ds-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
  width: 100%;
}
.ds-nav-item:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.ds-nav-item.active { color: var(--text); background: rgba(255,255,255,0.06); }

.ds-library {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.ds-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem 0.4rem;
  flex-shrink: 0;
}
.ds-library-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text3);
}
.ds-library-add {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.ds-library-add:hover { background: var(--bg3); color: var(--text); }

.ds-playlist-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.15rem 0.5rem;
}
.ds-playlist-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text2);
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  overflow: hidden;
}
.ds-playlist-item:hover { background: var(--bg3); color: var(--text); }
.ds-playlist-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.ds-playlist-icon--empty {
  background: var(--bg4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
}
.ds-liked-icon {
  background: linear-gradient(135deg, #450af5 0%, #c4efd9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.ds-playlist-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.ds-footer {
  padding: 0.6rem 0.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ds-footer-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text3);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ds-footer-btn:hover { background: var(--bg3); color: var(--text); }

/* Mobile-only / desktop-only toggle classes */
.ppb-desktop-only { display: none; }
.ppb-mobile-only  { display: flex; }

/* ── Desktop layout (≥900px) ─────────────────────────────────────────────── */
@media (min-width: 900px) {
  body.ds-view .desktop-sidebar {
    display: flex;
    bottom: 0;
  }
  body.ds-view.ppb-visible .desktop-sidebar {
    bottom: calc(90px + env(safe-area-inset-bottom));
  }

  /* Queue panel */
  .desktop-queue-panel { display: none; }
  body.ds-view .desktop-queue-panel:not(.hidden) {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    bottom: 0;
    z-index: 50;
    background: rgba(10, 10, 18, 0.72);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-left: 1px solid rgba(255,255,255,0.08);
    box-shadow: -1px 0 0 rgba(255,255,255,0.04), inset 1px 0 0 rgba(0,0,0,0.2);
    overflow: hidden;
  }
  body.ds-view.ppb-visible .desktop-queue-panel:not(.hidden) {
    bottom: calc(90px + env(safe-area-inset-bottom));
  }

  .dqp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04);
    flex-shrink: 0;
    padding: 0.85rem 0.75rem 0.85rem 1rem;
  }
  .dqp-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text2);
  }
  .dqp-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    padding: 0.35rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    flex-shrink: 0;
  }
  .dqp-close:hover { color: var(--text); }
  .dqp-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .dqp-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text3);
    padding: 0.75rem 1rem 0.3rem;
  }
  .dqp-section-label--history { opacity: 0.6; }
  .dqp-drag-handle {
    color: var(--text3);
    cursor: grab;
    padding: 0 0.1rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
  }
  .dqp-queue-item:hover .dqp-drag-handle { opacity: 1; }
  .dqp-drag-handle:active { cursor: grabbing; }
  .dqp-track.dqp-dragging { opacity: 0.35; }
  .dqp-track.dqp-drag-over {
    border-top: 2px solid var(--accent);
    margin-top: -2px;
  }
  .dqp-track {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
    margin: 0 0.25rem;
  }
  .dqp-track:hover { background: var(--bg3); }
  /* History: muted appearance */
  .dqp-track--history { opacity: 0.45; }
  .dqp-track--history:hover { opacity: 0.7; background: var(--bg3); }
  /* Current track: highlighted */
  .dqp-track--current {
    cursor: default;
    background: var(--bg3);
    border-left: 3px solid var(--accent);
    padding-left: calc(1rem - 3px);
  }
  .dqp-track--current:hover { background: var(--bg3); }
  .dqp-track--current .dqp-track-title { color: var(--accent); font-weight: 600; }
  .dqp-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
  }
  .dqp-thumb--empty {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text3);
    flex-shrink: 0;
  }
  .dqp-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .dqp-track-title {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dqp-track-artist {
    font-size: 0.73rem;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.12rem;
  }
  .dqp-dur {
    font-size: 0.73rem;
    color: var(--text3);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }
  .dqp-empty {
    font-size: 0.82rem;
    color: var(--text3);
    padding: 0.5rem 1rem;
    font-style: italic;
  }

  body.ds-view #view-library,
  body.ds-view #view-playlist {
    left: 240px;
  }
  body.ds-view.dqp-open #view-library,
  body.ds-view.dqp-open #view-playlist {
    right: 320px;
  }

  body.ds-view #view-library .lib-header {
    display: none;
  }
  body.ds-view #view-library .library-body {
    padding-top: 1.5rem;
  }

  /* Desktop PPB: show extras, hide mobile controls */
  .ppb-desktop-only { display: flex !important; }
  .ppb-mobile-only  { display: none !important; }
  .personal-player-bar .ppb-progress-strip { display: none; }

  /* 3-column player bar grid */
  .ppb-main {
    display: grid;
    grid-template-columns: 1fr 1.6fr 1fr;
    align-items: center;
    height: 90px;
    padding: 0;
    gap: 0;
    box-sizing: border-box;
  }

  .ppb-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0 1.25rem;
    overflow: hidden;
  }

  .ppb-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .ppb-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0 0.5rem;
  }

  .ppb-center-btns {
    display: flex;
    align-items: center;
    gap: 0.85rem;
  }

  .ppb-ctrl-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    border-radius: 4px;
    transition: color 0.15s;
  }
  .ppb-ctrl-btn:hover { color: var(--text); }
  .ppb-ctrl-btn.active { color: #1ed760; }

  .ppb-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem;
    transition: color 0.15s;
  }
  .ppb-nav-btn:hover { color: var(--text); }

  .ppb-play-big {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--text);
    border: none;
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, filter 0.15s, background 0.2s;
  }
  .ppb-play-big:hover { filter: brightness(0.88); transform: scale(1.04); }
  .ppb-play-big.ppb-dl-active { background: var(--bg3); color: var(--text); }

  .ppb-timeline {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
  }

  .ppb-time {
    font-size: 0.68rem;
    color: var(--text3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    width: 30px;
  }
  .ppb-time-tot { text-align: right; }

  .ppb-timeline-bar {
    flex: 1;
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
  }
  .ppb-tl-bg {
    position: absolute;
    left: 0; right: 0;
    height: 3px;
    background: var(--bg4);
    border-radius: 2px;
    pointer-events: none;
  }
  .ppb-bar-fill-main {
    position: absolute;
    left: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    pointer-events: none;
    transition: width 0.4s linear;
  }
  .ppb-seek-input {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    z-index: 1;
  }
  .ppb-timeline-bar:hover .ppb-bar-fill-main { background: var(--accent2); }

  .ppb-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0 1.25rem;
  }

  /* Search panel becomes a full main-area content view */
  body.ds-view #search-panel {
    left: 240px !important;
    right: 0 !important;
    width: auto !important;
    bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    border-left: none !important;
    box-shadow: none !important;
    background: rgba(7,7,14,0.88) !important;
    transform: none !important;
    transition: none !important;
  }
  body.ds-view #search-panel .panel-header { display: none; }
  body.ds-view #search-panel .search-bar {
    padding: 1.75rem 2rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: transparent;
  }
  body.ds-view #search-panel .search-input-row input {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg2);
  }
  body.ds-view #search-panel .search-results {
    padding: 1rem 2rem;
    background: var(--bg);
  }
  body.ds-view #search-panel .search-result-item {
    padding: 0.7rem 0.5rem;
  }
  body.ds-view #search-panel .search-result-thumb {
    width: 64px;
    height: 48px;
  }
}

/* -- Playlist drag-to-reorder --------------------------------------------- */
.pl-track { cursor: pointer; }
.queue-drag-handle {
  cursor: grab;
  color: var(--text3);
  font-size: 1.1rem;
  padding: 0 0.25rem;
  user-select: none;
  flex-shrink: 0;
  touch-action: none;
}
.queue-drag-handle:active { cursor: grabbing; }
.pl-track.dragging { opacity: 0.4; }
.pl-track.drag-over { border-top: 2px solid var(--accent); }
.pl-local-icon { width: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.pl-local-icon--saved { color: #1ed760; }
.pl-local-icon--pending { color: var(--text3); opacity: 0.3; }
.pl-local-icon--pending::after { content: '–'; font-size: 0.65rem; }
