/* =========================================================
   사내 DJ 봇 — Dark Glassmorphism Design System
   ========================================================= */

/* ── Registered Custom Properties (enables CSS transitions) ── */
@property --ambient-r { syntax: "<number>"; inherits: true; initial-value: 187; }
@property --ambient-g { syntax: "<number>"; inherits: true; initial-value: 38; }
@property --ambient-b { syntax: "<number>"; inherits: true; initial-value: 73; }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* ── Background Layers (Light) ── */
  --bg-base:        #F0F2F5;
  --bg-primary:     #E8EBF0;
  --bg-elevated:    #FFFFFF;
  --bg-glass:       rgba(255, 255, 255, 0.25);
  --bg-glass-hover: rgba(255, 255, 255, 0.35);

  /* ── Accent: Viva Magenta ── */
  --accent:         #BB2649;
  --accent-light:   #D44B6E;
  --accent-dim:     rgba(187, 38, 73, 0.10);
  --accent-glow:    rgba(187, 38, 73, 0.20);

  /* ── Secondary: Cyan Teal ── */
  --secondary:      #2DD4BF;
  --secondary-light:#5EEAD4;
  --secondary-dim:  rgba(45, 212, 191, 0.12);

  /* ── Text (Dark on Light) ── */
  --text-primary:   #1A1A2E;
  --text-secondary: #64748B;
  --text-tertiary:  #94A3B8;

  /* ── Border ── */
  --border:         rgba(255, 255, 255, 0.2);
  --border-glass:   rgba(255, 255, 255, 0.3);

  /* ── Status ── */
  --success:        #22c55e;
  --error:          #ef4444;

  /* ── Liquid Glass ── */
  --glass-blur:     24px;
  --glass-bg:       rgba(255, 255, 255, 0.20);
  --glass-border:   rgba(255, 255, 255, 0.25);
  --glass-shadow:   none;
  --glass-highlight: inset 0 0.5px 0 rgba(255, 255, 255, 0.4);

  /* ── Ambient Color (dynamic — overridden by JS) ── */
  --ambient-r: 187;
  --ambient-g: 38;
  --ambient-b: 73;

  /* ── Current Song ── */
  --current-bg:     rgba(187, 38, 73, 0.08);
  --current-border: rgba(187, 38, 73, 0.20);

  /* ── Surfaces (light-specific) ── */
  --surface-input:  rgba(255, 255, 255, 0.15);
  --surface-hover:  rgba(255, 255, 255, 0.15);
  --surface-track:  rgba(255, 255, 255, 0.3);
  --shadow-soft:    rgba(0, 0, 0, 0.08);
  --shadow-medium:  rgba(0, 0, 0, 0.10);
  --shadow-overlay: rgba(0, 0, 0, 0.20);

  /* ── Layout tokens ── */
  --header-h:        48px;
  --bottom-bar-h:    72px;
  --side-panel-w:    380px;
  --tab-h:           40px;
  --radius-sm:       12px;
  --radius-md:       16px;
  --radius-lg:       24px;
  --transition-fast: 150ms ease;
  --transition-med:  250ms ease;
}

/* ── Dark Mode ─────────────────────────────────────────── */

[data-theme="dark"] {
  --bg-base:        #0A0A0F;
  --bg-primary:     #12121A;
  --bg-elevated:    #1A1A26;
  --bg-glass:       rgba(20, 20, 30, 0.60);
  --bg-glass-hover: rgba(20, 20, 30, 0.70);

  --text-primary:   #EDEDF0;
  --text-secondary: #8E8E9A;
  --text-tertiary:  #5A5A6A;

  --border:         rgba(255, 255, 255, 0.10);
  --border-glass:   rgba(255, 255, 255, 0.14);

  --glass-bg:       rgba(20, 20, 30, 0.65);
  --glass-border:   rgba(255, 255, 255, 0.10);
  --glass-highlight: inset 0 0.5px 0 rgba(255, 255, 255, 0.12);

  --current-bg:     rgba(187, 38, 73, 0.15);
  --current-border: rgba(187, 38, 73, 0.30);

  --surface-input:  rgba(255, 255, 255, 0.08);
  --surface-hover:  rgba(255, 255, 255, 0.10);
  --surface-track:  rgba(255, 255, 255, 0.15);
  --shadow-soft:    rgba(0, 0, 0, 0.4);
  --shadow-medium:  rgba(0, 0, 0, 0.5);
  --shadow-overlay: rgba(0, 0, 0, 0.65);
  --modal-bg:       rgba(20, 20, 30, 0.88);
}

[data-theme="dark"] .app::before {
  background:
    radial-gradient(ellipse at 10% 40%, rgba(187, 38, 73, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 20%, rgba(45, 212, 191, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(187, 38, 73, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 60%, rgba(45, 212, 191, 0.04) 0%, transparent 45%);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic',
               -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Phosphor Icon Sizes ────────────────────────────── */

i[class*="ph-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  font-size: 18px;
  line-height: 1;
}

i.icon-sm { font-size: 14px; }
i.icon-xs { font-size: 12px; }
i.icon-lg { font-size: 22px; }

/* ── App Shell (CSS Grid 3-row) ──────────────────────── */

.app {
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--bottom-bar-h);
  grid-template-areas:
    "header"
    "main"
    "bottombar";
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
}

/* Ambient gradient orbs — colors bleed through glass panels (driven by --ambient-r/g/b) */
.app::before {
  content: '';
  position: fixed;
  inset: -40px;
  background:
    radial-gradient(ellipse at 10% 40%, rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 20%, rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 60%, rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.08) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
  animation: ambient-drift 20s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(12px, -8px) scale(1.02); }
  50%  { transform: translate(-8px, 6px) scale(0.98); }
  75%  { transform: translate(6px, 10px) scale(1.01); }
  100% { transform: translate(-10px, -6px) scale(1); }
}

.app > * {
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────── */

header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-bottom: 1px solid rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.10);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  z-index: 100;
  transition: border-color 1.5s ease;
}

.header-left h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left h1 i[class*="ph-"] {
  color: var(--accent);
  animation: spin 4s linear infinite;
  font-size: 22px;
}

.header-center {
  position: relative;
}

.playlist-toggle {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              color var(--transition-fast);
  font-family: inherit;
}

.playlist-toggle:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass);
  color: var(--text-primary);
}

.dropdown-arrow {
  transition: transform var(--transition-fast);
  display: flex;
}

.playlist-dropdown-wrapper.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* ── Playlist Dropdown ───────────────────────────────── */

.playlist-dropdown {
  position: fixed;
  top: calc(var(--header-h) + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.97);
  width: 360px;
  max-height: 320px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px var(--shadow-medium), var(--glass-highlight);
  overflow: hidden;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.2s ease;
}

.playlist-dropdown-wrapper.open .playlist-dropdown,
.playlist-dropdown.open {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.playlist-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.playlist-dropdown-header span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.playlist-refresh {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.playlist-refresh:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.playlist-refresh:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.playlist-dropdown .playlist-list {
  overflow-y: auto;
  max-height: 260px;
  padding: 6px;
}

.playlist-dropdown .playlist-list[hidden] {
  display: none;
}

/* ── Main Content (2-column grid) ────────────────────── */

.main-content {
  grid-area: main;
  display: grid;
  grid-template-columns: 1fr var(--side-panel-w);
  overflow: hidden;
}

/* ── Video Panel ─────────────────────────────────────── */

.video-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 12px;
  background: var(--bg-primary);
  overflow: hidden;
  gap: 8px;
}

.player-container {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 60px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.30),
    0 0 120px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.15);
  animation: backlight-pulse 4s ease-in-out infinite alternate;
}

@keyframes backlight-pulse {
  0%   {
    box-shadow:
      0 0 50px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.25),
      0 0 100px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.12);
  }
  100% {
    box-shadow:
      0 0 70px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.38),
      0 0 140px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.18);
  }
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
  .player-container {
    height: 0;
    padding-top: 56.25%; /* 9/16 */
  }
}

.player-container > #player,
.player-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-lg);
  background: #000;
  display: block;
}

/* For padding-top fallback: absolutely position content inside */
@supports not (aspect-ratio: 16 / 9) {
  .player-container > #player,
  .player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
  }
}

/* ── Loading Overlay ─────────────────────────────────── */

.player-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #000;
  border-radius: var(--radius-lg);
  transition: opacity 0.4s ease;
}

.player-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.player-loading-anim {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

.player-loading-title {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Tap-to-Play Overlay ─────────────────────────────── */

.player-tap-overlay {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--shadow-overlay);
  border-radius: var(--radius-lg);
}

.player-tap-overlay[hidden] {
  display: none;
}

.tap-to-play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 24px;
  transition: transform 0.2s ease;
}

.tap-to-play-btn:hover,
.tap-to-play-btn:active {
  transform: scale(1.1);
}

.tap-to-play-btn svg {
  width: 48px;
  height: 48px;
  color: var(--accent-light);
}

.tap-to-play-btn span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}


/* ── Side Panel & Tabs ───────────────────────────────── */

.side-panel {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-left: 1px solid var(--border);
  box-shadow: var(--glass-highlight);
  overflow: hidden;
}

.tab-bar {
  display: flex;
  height: var(--tab-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast),
              background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.tab-btn.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.tab-count {
  font-size: 0.7rem;
  background: var(--accent-dim);
  color: var(--accent-light);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.tab-count:empty {
  display: none;
}

.tab-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 12px;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 150ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Search Input Group (modal) ──────────────────────── */

.search-input-group {
  display: flex;
  gap: 6px;
}

/* ── Search Results (compact) ────────────────────────── */

.search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.search-results[hidden] {
  display: none;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.search-item:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(187, 38, 73, 0.3);
  box-shadow: 0 0 12px rgba(187, 38, 73, 0.1);
}

.search-thumb {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #000;
}

.search-info {
  flex: 1;
  min-width: 0;
}

.search-title {
  font-size: 0.83rem;
  color: var(--text-primary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-channel {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* ── Queue List (Spotify-style) ──────────────────────── */

#queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#queue-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

#queue-list li:hover {
  background: var(--surface-input);
}

#queue-list li.current {
  background: var(--current-bg);
}

/* ── Index number (plain text, no circle) ── */

.queue-index {
  flex-shrink: 0;
  width: 20px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

#queue-list li.current .queue-index {
  color: var(--accent-light);
}

/* ── Playing indicator ── */

.queue-star {
  color: var(--accent-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: -16px;
  width: 20px;
  justify-content: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes eq-bar {
  0%, 100% { height: 3px; }
  50% { height: 12px; }
}

.queue-star span {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 14px;
}

.queue-star span i {
  display: block;
  width: 2.5px;
  background: var(--accent-light);
  border-radius: 1px;
  animation: eq-bar 0.8s ease infinite;
}

.queue-star span i:nth-child(1) { animation-delay: 0s; height: 8px; }
.queue-star span i:nth-child(2) { animation-delay: 0.2s; height: 12px; }
.queue-star span i:nth-child(3) { animation-delay: 0.4s; height: 6px; }

/* ── Text area (2-line stack) ── */

.queue-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}

.queue-title {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

#queue-list li.current .queue-title {
  color: var(--accent-light);
  font-weight: 500;
}

.queue-added-by {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

/* ── Remove button (hover reveal) ── */

.queue-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  opacity: 0;
}

#queue-list li:hover .queue-remove {
  opacity: 0.6;
}

#queue-list li:hover .queue-remove:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.queue-remove:disabled {
  opacity: 0.3 !important;
  cursor: not-allowed;
}

.empty-queue {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  text-align: center;
  padding: 40px 0;
}


/* ── Request Panel ───────────────────────────────────── */

#request-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.request-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.request-item:hover {
  background: var(--bg-glass-hover);
}

.request-title {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-by {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.request-pending {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-input);
}

.request-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.request-approve,
.request-reject {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}

.request-approve {
  color: var(--success, #22c55e);
}

.request-approve:hover {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
}

.request-reject {
  color: var(--error, #ef4444);
}

.request-reject:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
}

#request-empty {
  text-align: center;
  padding: 32px 0;
}

/* ── Lyrics Panel ────────────────────────────────────── */

.lyrics-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  min-height: 100%;
}

.lyrics-placeholder {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 0;
}

.lyrics-loading {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lyrics-loading svg {
  animation: spin 1.5s linear infinite;
}

.lyrics-loading-anim {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.modal-search-anim {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  vertical-align: middle;
  object-fit: cover;
  margin-right: 4px;
}

.playlist-loading-anim {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.lyrics-line {
  width: 100%;
  padding: 6px 12px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: center;
  border-radius: 6px;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

.lyrics-line:hover {
  background: var(--bg-glass-hover);
}

.lyrics-line.active {
  color: var(--accent-light);
  font-weight: 600;
  font-size: 1rem;
  transform: scale(1.02);
  background: var(--accent-dim);
}

.lyrics-instrumental {
  color: var(--text-secondary);
  font-size: 0.92rem;
  text-align: center;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lyrics-instrumental .instrumental-icon {
  font-size: 2rem;
}

.lyrics-plain {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.8;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 8px 0;
}

/* ── Lyrics Search Results ──────────────────────────── */

.lyrics-search-result {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.lyrics-search-result:hover {
  background: var(--bg-glass-hover);
}

.lyrics-search-result:active {
  background: var(--accent-dim);
}

.lyrics-result-title {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 2px;
}

.lyrics-result-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lyrics-result-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.lyrics-result-badge.synced {
  color: var(--accent-light);
  background: var(--accent-dim);
  border: 1px solid rgba(187, 38, 73, 0.3);
}

.lyrics-result-badge.plain {
  color: var(--text-tertiary);
  background: var(--bg-glass);
  border: 1px solid var(--border);
}

.lyrics-result-badge.instrumental {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

#panel-lyrics {
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

#panel-lyrics.active {
  display: flex;
}

.lyrics-search-bar {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#lyrics-search-input {
  flex: 1;
  padding: 7px 11px;
  background: var(--surface-input);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

#lyrics-search-input::placeholder { color: var(--text-tertiary); }

#lyrics-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

#lyrics-search-btn {
  padding: 7px 12px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#lyrics-search-btn:hover { background: var(--accent-light); }

.lyrics-back-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  align-self: flex-start;
}

.lyrics-back-btn:hover {
  color: var(--accent-light);
  border-color: var(--accent);
}

#panel-lyrics .lyrics-container {
  flex: 1;
  overflow: auto;
  min-height: 0;
  scroll-behavior: smooth;
}

@media (max-width: 768px) {
  .lyrics-line {
    font-size: 0.85rem;
    padding: 8px 10px;
  }
  .lyrics-line.active {
    font-size: 0.92rem;
  }
}

/* ── Lyrics Overlay (floating below video) ───────────── */

.lyrics-overlay {
  width: 100%;
  max-width: 960px;
  flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  border-radius: var(--radius-md);
  padding: 8px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 62px;
}

.lyrics-overlay[hidden] {
  display: none;
}

.lyrics-overlay-line {
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: color var(--transition-fast);
}

.lyrics-overlay-adj {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  min-height: 1.2em;
}

.lyrics-overlay-curr {
  color: var(--accent-light);
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.5em;
}

@media (max-width: 768px) {
  .lyrics-overlay {
    padding: 6px 12px;
    min-height: 46px;
    gap: 2px;
  }
  .lyrics-overlay-adj {
    display: none;
  }
  .lyrics-overlay-curr {
    font-size: 0.88rem;
  }
}

/* ── Bottom Bar ──────────────────────────────────────── */

.bottom-bar {
  grid-area: bottombar;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-top: 1px solid rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.15);
  box-shadow:
    0 -4px 30px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.10),
    var(--glass-highlight);
  z-index: 50;
  transition: border-color 1.5s ease, box-shadow 1.5s ease;
}

.bottom-now-playing {
  flex: 0 1 200px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bottom-groove-anim {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: cover;
}

#now-playing-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

#now-playing-title .marquee-inner {
  display: inline-block;
  white-space: nowrap;
}

#now-playing-title.marquee .marquee-inner {
  animation: marquee-scroll var(--marquee-duration, 10s) linear infinite;
  padding-right: 3em;
}

#now-playing-title.marquee:hover .marquee-inner {
  animation-play-state: paused;
}

@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.bottom-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bottom-controls button {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              transform 0.1s, box-shadow var(--transition-fast);
}

.bottom-controls button:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass);
}

.bottom-controls button:active {
  transform: scale(0.93);
}

.bottom-controls button.btn-main {
  width: 36px;
  height: 36px;
  background: rgb(var(--ambient-r), var(--ambient-g), var(--ambient-b));
  border: none;
  color: #fff;
  box-shadow: 0 0 20px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.35);
  transition: background 1.5s ease, box-shadow 1.5s ease, transform 0.1s;
}

.bottom-controls button#btn-random.active {
  background: rgba(187, 38, 73, 0.15);
  border-color: var(--accent);
  color: var(--accent-light);
}

.bottom-controls button.btn-main:hover {
  background: rgb(var(--ambient-r), var(--ambient-g), var(--ambient-b));
  filter: brightness(1.15);
  box-shadow: 0 0 28px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.4),
              0 0 8px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.25);
}

.bottom-controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bottom-progress {
  flex: 1 1 0;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#current-time, #total-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--surface-track);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: height 0.15s;
}

.progress-track:hover {
  height: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg,
    rgb(var(--ambient-r), var(--ambient-g), var(--ambient-b)),
    rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.7));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s linear, background 1.5s ease;
  box-shadow: 0 0 8px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.4);
}

.progress-track:hover .progress-fill {
  box-shadow: 0 0 12px rgba(var(--ambient-r), var(--ambient-g), var(--ambient-b), 0.5),
              0 0 4px rgb(var(--ambient-r), var(--ambient-g), var(--ambient-b));
}

.bottom-volume {
  flex: 0 0 130px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-icon {
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.volume-icon:hover {
  color: var(--text-primary);
}

/* Custom range slider for volume */
#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  background: var(--surface-track);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  transition: box-shadow 0.15s;
}

#volume-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 8px var(--accent-glow);
}

#volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  border: none;
}

/* ── Playlist Items (reused in dropdown) ─────────────── */

.playlist-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.playlist-item:hover {
  background: var(--bg-glass-hover);
}

.playlist-item.active {
  background: var(--current-bg);
  border-color: var(--current-border);
}

.playlist-title {
  flex: 1;
  font-size: 0.83rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent-light);
}

.playlist-select {
  flex-shrink: 0;
  padding: 4px 10px;
  background: var(--bg-glass-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              color var(--transition-fast);
}

.playlist-select:hover {
  background: var(--accent-dim);
  border-color: rgba(187, 38, 73, 0.3);
  color: var(--accent-light);
}

.playlist-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.playlist-empty {
  color: var(--text-tertiary);
  font-size: 0.83rem;
  text-align: center;
  padding: 20px 0;
}

.playlist-default-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  flex-shrink: 0;
}

.playlist-delete-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.playlist-delete-btn:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}
.playlist-delete-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.playlist-create {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.playlist-create-input {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.83rem;
  outline: none;
  transition: border-color 0.15s;
}
.playlist-create-input:focus {
  border-color: var(--accent);
}
.playlist-create-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.playlist-create-btn:hover {
  opacity: 0.85;
}
.playlist-create-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Theme Toggle ────────────────────────────────────── */

.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: 16px;
}

.btn-theme-toggle:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

/* ── User Count Badge ────────────────────────────────── */

.user-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.player-interaction-blocker {
  position: absolute;
  inset: 0;
  z-index: 5; /* Below loading overlay (10) and tap overlay (11) */
  cursor: default;
}

.player-interaction-blocker[hidden] {
  display: none;
}

.master-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.15);
  border: 1px solid var(--accent);
  white-space: nowrap;
}

.master-badge[hidden] {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Chat Panel ──────────────────────────────────────── */

.chat-panel {
  display: none;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.chat-panel.active {
  display: flex;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 2px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 90%;
  align-self: flex-start;
}

.chat-msg-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-nickname {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 500;
  padding: 0 4px;
}

.chat-msg-mine .chat-nickname {
  color: var(--accent-light);
  opacity: 0.7;
}

.chat-dj-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.15);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 3px;
  margin-right: 3px;
  vertical-align: middle;
  line-height: 1.4;
}

.chat-text {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-msg-mine .chat-text {
  background: var(--accent-dim);
  border-color: rgba(187, 38, 73, 0.25);
  color: var(--text-primary);
}

.chat-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  padding: 0 4px;
}

.chat-system {
  align-self: center;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  padding: 2px 10px;
  background: var(--bg-glass);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 2px 0;
  text-align: center;
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 7px 10px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#chat-input::placeholder { color: var(--text-tertiary); }

#chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.chat-form button {
  padding: 7px 10px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  flex-shrink: 0;
}

.chat-form button:hover {
  background: var(--accent-light);
  box-shadow: 0 0 12px var(--accent-glow);
}

.chat-form button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Unread indicator on chat tab */
.tab-btn.has-unread::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: middle;
  box-shadow: 0 0 6px var(--accent-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ── Connection Status Badge ─────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge.connected {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-badge.connected .status-dot {
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* ── Toast Notifications ─────────────────────────────── */

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-glass);
  opacity: 1;
  transition: opacity 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px var(--shadow-soft), var(--glass-highlight);
}

.toast-error   { border-color: rgba(239, 68, 68, 0.3); color: var(--error); }
.toast-success { border-color: rgba(34, 197, 94, 0.3); color: var(--success); }

/* ── Scrollbar Styling ───────────────────────────────── */

.tab-panel::-webkit-scrollbar {
  width: 6px;
}

.tab-panel::-webkit-scrollbar-track {
  background: transparent;
}

.tab-panel::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 3px;
}

.tab-panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.playlist-dropdown .playlist-list::-webkit-scrollbar { width: 6px; }
.playlist-dropdown .playlist-list::-webkit-scrollbar-track { background: transparent; }
.playlist-dropdown .playlist-list::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 3px; }

/* ── Responsive — Tablet & Mobile ────────────────────── */

@media (max-width: 768px) {
  :root {
    --header-h: 40px;
    --bottom-bar-h: 56px;
    --side-panel-w: 100%;
  }

  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: hidden;
  }

  .video-panel {
    padding: 8px 8px 6px;
    gap: 6px;
    max-height: 35vh;
  }

  .player-container {
    max-width: 100%;
  }

  .side-panel {
    border-left: none;
    border-top: 1px solid var(--glass-border);
    overflow: hidden;
  }

  .header-left h1 { font-size: 0.95rem; }

  .playlist-toggle { font-size: 0.78rem; padding: 3px 8px; }

  .playlist-dropdown {
    width: calc(100vw - 32px);
    left: 50%;
    transform: translateX(-50%) translateY(8px) scale(0.97);
  }

  .playlist-dropdown-wrapper.open .playlist-dropdown,
  .playlist-dropdown.open {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  .bottom-bar {
    gap: 10px;
    padding: 0 12px;
  }

  .bottom-now-playing {
    flex: 0 1 120px;
  }

  #now-playing-title { font-size: 0.78rem; }

  .bottom-controls button {
    width: 32px;
    height: 32px;
  }

  .bottom-controls button.btn-main {
    width: 32px;
    height: 32px;
  }

  .bottom-controls { gap: 4px; }

  .bottom-volume {
    flex: 0 0 30px;
  }

  #volume-slider {
    display: none;
  }

  .queue-added-by { display: none; }
  .queue-remove { opacity: 1; }
}

@media (max-width: 480px) {
  .bottom-now-playing { display: none; }
  .bottom-progress { min-width: 80px; }
}

/* ── Panel Header (playlist tab) ─────────────────────── */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-header-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.panel-header-actions[hidden] {
  display: none;
}

/* ── Header Text Button ──────────────────────────────── */

.btn-header-text {
  padding: 4px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

.btn-header-text:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.btn-header-text:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-header-text--danger {
  color: var(--error);
}

.btn-header-text--danger:hover:not(:disabled) {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* ── Select Mode Queue Items ─────────────────────────── */

#queue-list li.selected {
  background: rgba(187, 38, 73, 0.1);
}

.queue-checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: transparent;
  border: 1.5px solid var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.queue-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}


/* ── Add Song Modal ───────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--shadow-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 150ms ease;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--modal-bg, rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px var(--shadow-medium), var(--glass-highlight);
  overflow: hidden;
}

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

.modal-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 3px; }

.modal-search-form {
  margin-bottom: 8px;
}

.search-engine-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.engine-btn {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.engine-btn:hover {
  background: var(--bg-glass-hover);
}

.engine-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.engine-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

#modal-search-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
}

#modal-search-input::placeholder { color: var(--text-tertiary); }

#modal-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

#modal-search-btn {
  padding: 8px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background var(--transition-fast), box-shadow var(--transition-fast),
              transform 0.1s;
  font-family: inherit;
  flex-shrink: 0;
}

#modal-search-btn:hover {
  background: var(--accent-light);
  box-shadow: 0 0 16px var(--accent-glow);
}

#modal-search-btn:active { transform: scale(0.96); }

#modal-search-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

#modal-search-status {
  font-size: 0.8rem;
  margin-top: 4px;
  min-height: 1em;
}

#modal-search-status.status-success { color: var(--success); }
#modal-search-status.status-error   { color: var(--error); }

/* ── Queue Title Tooltip ────────────────────────────────── */
.tt {
  position: fixed;
  z-index: 9999;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.4;
  max-width: 320px;
  word-break: break-word;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 24px var(--shadow-soft), var(--glass-highlight);
  white-space: normal;
}
.tt.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Arrow — outer border */
.tt::before {
  content: '';
  position: absolute;
  left: var(--tt-arrow, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
  pointer-events: none;
}
/* Arrow — inner fill */
.tt::after {
  content: '';
  position: absolute;
  left: var(--tt-arrow, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
  pointer-events: none;
}
/* Tooltip above element: arrow points down */
.tt:not(.below)::before { top: 100%; border-top-color: var(--border); }
.tt:not(.below)::after  { top: calc(100% - 1px); border-top-color: rgba(255,255,255,0.6); }
/* Tooltip below element: arrow points up */
.tt.below::before { bottom: 100%; border-bottom-color: var(--border); }
.tt.below::after  { bottom: calc(100% - 1px); border-bottom-color: rgba(255,255,255,0.6); }
