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

:root {
  --app-height: 100vh;
  --bg-primary: #080a0f;
  --bg-secondary: #10141d;
  --bg-panel: rgba(18, 22, 32, 0.82);
  --bg-panel-strong: rgba(22, 27, 39, 0.94);
  --accent-1: #7c6cf2;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --text-primary: #f8fafc;
  --text-secondary: #b8c2d4;
  --text-muted: #6f7b8d;
  --glow-purple: rgba(124, 108, 242, 0.28);
  --glow-cyan: rgba(34, 211, 238, 0.22);
  --glow-pink: rgba(244, 114, 182, 0.22);
  --border-color: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --content-panel-radius: 18px;
  --body-background:
    radial-gradient(circle at 18% 8%, rgba(34, 211, 238, 0.1), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(124, 108, 242, 0.12), transparent 30%),
    linear-gradient(180deg, #080a0f 0%, #0d1118 52%, #080a0f 100%);
  --surface-header: rgba(13, 17, 24, 0.78);
  --surface-input: rgba(4, 7, 12, 0.6);
  --surface-soft: rgba(4, 7, 12, 0.38);
  --surface-subtle: rgba(255, 255, 255, 0.04);
  --surface-header-tint: rgba(4, 7, 12, 0.18);
  --surface-item-hover: rgba(255, 255, 255, 0.045);
  --panel-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  --header-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
  --button-shadow: 0 10px 24px rgba(2, 6, 23, 0.26);
  --progress-bg: rgba(148, 163, 184, 0.16);
  --volume-bg: rgba(148, 163, 184, 0.18);
  --input-border: rgba(148, 163, 184, 0.18);
  --logo-text: linear-gradient(135deg, #ffffff, #b7c7e8);
}

body[data-theme="light"] {
  --bg-primary: #edf3fb;
  --bg-secondary: #f8fbff;
  --bg-panel: rgba(255, 255, 255, 0.8);
  --bg-panel-strong: rgba(255, 255, 255, 0.94);
  --accent-1: #6366f1;
  --accent-2: #0891b2;
  --accent-3: #ec4899;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --glow-purple: rgba(99, 102, 241, 0.18);
  --glow-cyan: rgba(8, 145, 178, 0.18);
  --glow-pink: rgba(236, 72, 153, 0.16);
  --border-color: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --body-background:
    radial-gradient(circle at 16% 10%, rgba(34, 211, 238, 0.12), transparent 26%),
    radial-gradient(circle at 86% 18%, rgba(99, 102, 241, 0.1), transparent 28%),
    linear-gradient(180deg, #f7fbff 0%, #eef4fb 52%, #f5f9ff 100%);
  --surface-header: rgba(255, 255, 255, 0.78);
  --surface-input: rgba(255, 255, 255, 0.78);
  --surface-soft: rgba(255, 255, 255, 0.64);
  --surface-subtle: rgba(15, 23, 42, 0.03);
  --surface-header-tint: rgba(255, 255, 255, 0.36);
  --surface-item-hover: rgba(15, 23, 42, 0.04);
  --panel-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --header-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --button-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --progress-bg: rgba(148, 163, 184, 0.24);
  --volume-bg: rgba(148, 163, 184, 0.22);
  --input-border: rgba(148, 163, 184, 0.24);
  --logo-text: linear-gradient(135deg, #0f172a, #475569);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--body-background);
  color: var(--text-primary);
  min-height: var(--app-height);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Animated Background ===== */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 80%);
}
.bg-animation .orb {
  display: none;
}
.bg-animation .orb:nth-child(1) {
  width: 500px; height: 500px;
  background: var(--accent-1);
  top: -10%; left: -10%;
  animation-delay: 0s;
}
.bg-animation .orb:nth-child(2) {
  width: 400px; height: 400px;
  background: var(--accent-2);
  top: 60%; right: -10%;
  animation-delay: -7s;
}
.bg-animation .orb:nth-child(3) {
  width: 350px; height: 350px;
  background: var(--accent-3);
  bottom: -10%; left: 30%;
  animation-delay: -14s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(40px, -30px) scale(1.1); }
  50% { transform: translate(-20px, 20px) scale(0.9); }
  75% { transform: translate(-30px, -20px) scale(1.05); }
}

/* ===== Layout ===== */
.app {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-height: var(--app-height);
}

/* ===== Header ===== */
.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface-header);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--header-shadow);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  background: var(--logo-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  -webkit-text-fill-color: white;
  color: white;
  box-shadow: 0 8px 22px var(--glow-cyan);
}
.source-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-soft);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}
.source-tab {
  padding: 6px 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}
.source-tab:hover {
  color: var(--text-secondary);
}
.source-tab.active {
  background: var(--surface-header);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.source-tabs-drawer {
  display: none;
}
.source-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
  line-height: 1.4;
}
.source-badge.ai {
  background: rgba(124, 108, 242, 0.2);
  color: #a78bfa;
}
.source-badge.gequbao {
  background: rgba(34, 211, 238, 0.2);
  color: #22d3ee;
}
.source-badge.tonzhon {
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
}
.search-btn {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  color: white;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.search-btn:hover {
  box-shadow: 0 0 18px var(--glow-cyan);
  transform: translateY(-50%) scale(1.05);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.download-app-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--surface-input);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s;
  backdrop-filter: blur(10px);
}
.download-app-btn:hover {
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.1);
  color: var(--text-primary);
}
.download-app-btn .svg-icon {
  width: 16px;
  height: 16px;
}
.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--surface-input);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: var(--button-shadow);
}
.theme-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.26);
  background: rgba(34, 211, 238, 0.08);
}
.theme-btn .svg-icon {
  width: 18px;
  height: 18px;
}
.sort-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.25s;
  white-space: nowrap;
}
.sort-btn:hover,
.sort-btn.active {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.35);
  color: var(--text-primary);
}

/* ===== Main Content ===== */
.main-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  height: 100%;
  max-height: calc(100vh - 132px);
  overflow: hidden;
}
body[data-theme="light"] .main-content {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

/* ===== Player Section ===== */
.player-section {
  flex-shrink: 0;
}
.player-content {
  position: relative;
  display: flex;
  gap: 28px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(22, 27, 39, 0.92), rgba(13, 17, 24, 0.84)),
    radial-gradient(circle at 18% 12%, rgba(34, 211, 238, 0.12), transparent 34%);
  backdrop-filter: blur(18px);
  border-radius: var(--content-panel-radius);
  border: 1px solid var(--border-color);
  padding: 28px;
  overflow: hidden;
  box-shadow: var(--panel-shadow);
}
.player-content .now-playing-label,
.player-content .song-title,
.player-content .song-author,
.player-content .progress-section,
.player-content .controls-row {
  position: relative;
  z-index: 1;
}
.player-content::after {
  content: '';
  position: absolute;
  right: -10%;
  top: -12%;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.18), transparent 68%);
  pointer-events: none;
  filter: blur(4px);
}
body[data-theme="light"] .player-content {
  background: rgba(255, 255, 255, 0.96);
  border-color: transparent;
  box-shadow: none;
}
body[data-theme="light"] .player-content::before {
  background: none;
}
.player-content::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255,255,255,0.05), transparent 38%);
  pointer-events: none;
}

/* ===== Cover Art ===== */
.cover-wrapper {
  flex-shrink: 0;
  position: relative;
  --cover-edge-feather: 0.9px;
  --cover-spin-ring-width: 2px;
}
.cover-wrapper::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background:
    radial-gradient(circle at center,
      rgba(10, 10, 20, 0.95) 0 37.4%,
      rgba(240, 230, 255, 0.98) 39.2% 47.2%,
      rgba(10, 10, 20, 0.82) 49.2% 100%);
  box-shadow:
    0 0 0 0.8px rgba(255, 255, 255, 0.28),
    0 0 18px rgba(168, 85, 247, 0.45);
  -webkit-mask-image: radial-gradient(circle, #000 calc(100% - var(--cover-edge-feather)), transparent 100%);
  mask-image: radial-gradient(circle, #000 calc(100% - var(--cover-edge-feather)), transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  z-index: 2;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.cover-wrapper.playing::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.cover-art {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  transform-origin: center;
  transition: border-radius 0.45s, box-shadow 0.45s, transform 0.45s;
  will-change: transform;
  image-rendering: auto;
}
.cover-art.playing {
  border-radius: 50%;
  animation: coverRotate 18s linear infinite;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 18px 58px rgba(0, 0, 0, 0.42),
    0 0 28px var(--glow-cyan);
  -webkit-mask-image: radial-gradient(circle, #000 calc(100% - var(--cover-edge-feather)), transparent 100%);
  mask-image: radial-gradient(circle, #000 calc(100% - var(--cover-edge-feather)), transparent 100%);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
@keyframes coverRotate { to { transform: rotate(360deg); } }
.cover-spin {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: conic-gradient(from 0deg, var(--accent-2), var(--accent-1), var(--accent-3), var(--accent-2));
  box-shadow:
    inset 0 0 0 0.6px rgba(255, 255, 255, 0.24),
    0 0 0 0.6px rgba(255, 255, 255, 0.18);
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - (var(--cover-spin-ring-width) + 1.2px)),
    #fff calc(100% - (var(--cover-spin-ring-width) + 0.3px)),
    #fff calc(100% - 0.9px),
    transparent 100%
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - (var(--cover-spin-ring-width) + 1.2px)),
    #fff calc(100% - (var(--cover-spin-ring-width) + 0.3px)),
    #fff calc(100% - 0.9px),
    transparent 100%
  );
  animation: spin 10s linear infinite;
  opacity: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: opacity 0.5s;
  pointer-events: none;
}
.cover-spin.visible { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Player Info ===== */
.player-info {
  flex: 1;
  min-width: 0;
  position: relative;
}
.now-playing-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2.4px;
  color: var(--accent-2);
  margin-bottom: 8px;
  font-weight: 700;
}
.song-title {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: 0;
}
.song-author {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 22px;
}
.player-section {
  min-height: 0;
}
/* ===== Progress Bar ===== */
.progress-section {
  margin-bottom: 18px;
}
.progress-bar-bg {
  width: 100%;
  height: 5px;
  background: var(--progress-bg);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.2s;
  touch-action: none;
}
.progress-bar-bg:hover { height: 6px; }
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-1), var(--accent-3));
  border-radius: 2px;
  position: relative;
  transition: width 0.1s linear;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--glow-cyan);
  opacity: 0;
  transition: opacity 0.2s;
}
.progress-bar-bg:hover .progress-bar-fill::after { opacity: 1; }
.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== Controls ===== */
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.volume-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.mobile-playlist-fab {
  display: none;
}
.ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  backdrop-filter: blur(10px);
}
.ctrl-btn:hover {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.36);
  color: var(--text-primary);
}
.ctrl-btn.active {
  background: rgba(34, 211, 238, 0.14);
  border-color: rgba(34, 211, 238, 0.42);
  color: white;
}
body[data-theme="light"] .ctrl-btn.active {
  color: #0f172a;
}
.ctrl-btn.favorite-active {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.32);
  color: #fb7185;
}
.ctrl-btn.favorite-active .svg-icon {
  fill: currentColor;
}
.ctrl-btn.play-btn {
  width: 58px;
  height: 58px;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  border: none;
  color: white;
  box-shadow: 0 14px 34px rgba(34, 211, 238, 0.24);
  margin: 0 4px;
}
.ctrl-btn.play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 16px 40px rgba(34, 211, 238, 0.34);
}
#modeBtn,
#favoriteCurrentBtn,
#muteBtn {
  width: 34px;
  height: 34px;
}
.volume-popover {
  display: inline-flex;
  align-items: center;
}
.volume-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--volume-bg);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px var(--glow-cyan);
  cursor: pointer;
}

/* ===== Lyrics Panel ===== */
.lyrics-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  border-radius: var(--content-panel-radius);
  border: 1px solid var(--border-color);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  box-shadow: var(--panel-shadow);
  flex: 1 1 auto;
}
body[data-theme="light"] .lyrics-panel {
  background: rgba(255, 255, 255, 0.96);
  border-color: transparent;
  box-shadow: none;
}
.lyrics-panel h3 {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.lyrics-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 4px 8px 12px 0;
  mask-image: linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
}
.lyrics-scroll::-webkit-scrollbar { width: 4px; }
.lyrics-scroll::-webkit-scrollbar-track { background: transparent; }
.lyrics-scroll::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.24); border-radius: 2px; }
.lyric-line {
  padding: 8px 0;
  font-size: 15px;
  color: var(--text-muted);
  transition: color 0.35s, transform 0.35s, opacity 0.35s, font-size 0.35s;
  cursor: pointer;
  line-height: 1.6;
  opacity: 0.68;
}
.lyric-line::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-2);
  margin-right: 0;
  vertical-align: middle;
  transition: width 0.35s, margin-right 0.35s;
}
.lyric-line:hover {
  color: var(--text-secondary);
}
.lyric-line.active {
  color: white;
  font-size: 19px;
  font-weight: 700;
  transform: translateX(8px);
  opacity: 1;
  text-shadow: 0 0 18px var(--glow-cyan);
}
body[data-theme="light"] .lyric-line.active {
  color: #0f172a;
  text-shadow: 0 0 14px rgba(8, 145, 178, 0.16);
}
.lyric-line.active::before {
  width: 18px;
  margin-right: 8px;
}
body[data-theme="light"] .lyric-line.active::before {
  background: linear-gradient(90deg, var(--accent-2), var(--accent-1));
}
.lyric-line.passed {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* ===== Visualizer ===== */
.visualizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 60px;
  flex: 1;
  margin-left: 10px;
  min-width: 120px;
  opacity: 0.72;
}
.visualizer .bar {
  flex: 1;
  background: linear-gradient(to top, var(--accent-2), var(--accent-1));
  border-radius: 2px 2px 0 0;
  transition: height 0.08s ease;
  min-height: 3px;
  opacity: 0.8;
}

/* ===== Playlist Panel ===== */
.playlist-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 132px);
  position: sticky;
  top: 20px;
  box-shadow: var(--panel-shadow);
}
.playlist-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-header-tint);
}
.playlist-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.playlist-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--surface-subtle);
  color: var(--text-muted);
  transition: all 0.25s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}
.playlist-tab:hover {
  background: rgba(34, 211, 238, 0.08);
  color: var(--text-primary);
}
.playlist-tab.active {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.28);
  color: var(--accent-2);
}
.playlist-tab-count {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 4px;
}
.playlist-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.playlist-header h3,
.lyrics-panel h3 {
  display: flex;
  align-items: center;
  gap: 6px;
}
.playlist-header h3 {
  font-size: 15px;
  font-weight: 700;
}
.playlist-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 4px 10px;
  border-radius: 12px;
}
.playlist-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  min-height: 200px;
}
.playlist-scroll::-webkit-scrollbar { width: 5px; }
.playlist-scroll::-webkit-scrollbar-track { background: transparent; }
.playlist-scroll::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.24); border-radius: 3px; }

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.playlist-item:hover {
  background: var(--surface-item-hover);
}
.playlist-item.active {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.2);
}
.playlist-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent-2), var(--accent-1));
  border-radius: 0 3px 3px 0;
}
.playlist-item-cover {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
}
.playlist-item-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.playlist-item-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-author {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.playlist-item-chip {
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.08);
}
.playlist-item-dur {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.playlist-item-playing-indicator {
  display: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.playlist-item.active .playlist-item-playing-indicator { display: flex; }
.playlist-item.active .playlist-item-dur { display: none; }
.playing-bar {
  width: 3px;
  border-radius: 2px;
  background: var(--accent-2);
  animation: playingAnim 0.8s infinite ease-in-out alternate;
}
.playing-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.playing-bar:nth-child(2) { height: 16px; animation-delay: 0.2s; }
.playing-bar:nth-child(3) { height: 10px; animation-delay: 0.4s; }
@keyframes playingAnim {
  to { transform: scaleY(0.3); opacity: 0.4; }
}

/* ===== Load More Button ===== */
.load-more-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 8px 12px 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(148, 163, 184, 0.22);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
}
.load-more-btn:hover {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.32);
  color: var(--text-primary);
}
.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.load-more-btn.loading {
  pointer-events: none;
}

/* ===== Favorite Button ===== */
.playlist-item-fav {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  opacity: 0;
}
.playlist-item:hover .playlist-item-fav {
  opacity: 1;
}
.playlist-item-fav:hover {
  color: var(--accent-3);
  background: rgba(244, 114, 182, 0.13);
}
.playlist-item-fav.active {
  opacity: 1;
  color: var(--accent-3);
}

/* ===== SVG Icons ===== */
.svg-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-fill {
  fill: currentColor;
  stroke: currentColor;
}
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.search-btn .svg-icon {
  width: 16px;
  height: 16px;
}
.ctrl-btn .svg-icon {
  width: 18px;
  height: 18px;
}
.ctrl-btn.play-btn .svg-icon {
  width: 24px;
  height: 24px;
}
.playlist-item-fav .svg-icon {
  width: 16px;
  height: 16px;
}
.playlist-item-fav.active .svg-icon,
.playlist-tab.active .svg-icon {
  fill: currentColor;
}
.playlist-header h3 .svg-icon,
.lyrics-panel h3 .svg-icon {
  width: 17px;
  height: 17px;
}

/* ===== Loading & Empty States ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 16px;
  color: var(--text-muted);
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(168, 85, 247, 0.3);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state-icon { font-size: 48px; opacity: 0.5; }
.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.empty-state-action {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s;
}
.empty-state-action:hover {
  color: var(--text-primary);
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
}
.clear-btn {
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s;
}
.clear-btn:hover {
  background: rgba(236, 72, 153, 0.15);
  border-color: var(--accent-3);
  color: var(--accent-3);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-panel-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 10px 24px;
  color: var(--text-primary);
  font-size: 13px;
  z-index: 9999;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--panel-shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== Playlist Search & Sort & Toggle ===== */
.playlist-search {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
  margin-top: 4px;
  margin-bottom: 10px;
}
.playlist-search input {
  flex: 1;
  min-height: 40px;
  padding: 10px 42px 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: var(--surface-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}
.playlist-search input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}
.playlist-search input::placeholder {
  color: var(--text-muted);
}
.playlist-sort {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-soft);
  margin-top: 2px;
}
.playlist-sort .sort-btn {
  flex: 1;
  text-align: center;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.playlist-toggle-btn { display: none; }
.playlist-drawer-overlay { display: none; }
.playlist-header-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.playlist-panel:not(.playlist-mode) .playlist-search,
.playlist-panel:not(.playlist-mode) .playlist-sort,
.playlist-panel:not(.playlist-mode) .source-tabs-drawer {
  display: none;
}
.playlist-panel.collapsed .playlist-scroll,
.playlist-panel.collapsed .load-more-btn {
  display: none;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  body {
    min-height: var(--app-height);
    overflow: hidden;
  }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 12px 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
    min-height: var(--app-height);
    height: var(--app-height);
  }
  .header {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .logo {
    flex: 1 1 auto;
    min-width: 0;
  }
  .source-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .source-tabs-header {
    display: none;
  }
  .source-tabs-drawer {
    display: flex;
    width: 100%;
  }
  .source-tab {
    flex: 1;
    text-align: center;
  }
  .header-actions {
    margin-left: auto;
  }
  .download-app-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
  }
  .download-app-btn span {
    display: none;
  }
  .main-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    max-height: 100%;
    overflow: hidden;
    height: 100%;
    min-height: 0;
    padding-bottom: 0;
  }
  .player-content { flex-direction: column; text-align: center; gap: 18px; }
  .player-info {
    width: 100%;
    padding-top: 40px;
  }
  .player-content::after {
    right: 50%;
    top: 10px;
    width: 180px;
    height: 180px;
    transform: translateX(50%);
    opacity: 0.9;
  }
  .now-playing-label {
    letter-spacing: 2px;
    margin-bottom: 10px;
  }
  .song-title {
    font-size: 26px;
    line-height: 1.25;
  }
  .song-author {
    margin-bottom: 18px;
  }
  .cover-art { width: 150px; height: 150px; }
  .mobile-playlist-entry {
    display: none;
  }
  .mobile-playlist-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: absolute;
    top: 0;
    right: 0;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-subtle);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .mobile-playlist-fab .svg-icon {
    width: 15px;
    height: 15px;
  }

  /* ===== Playlist Fullscreen Sheet ===== */
  .playlist-drawer-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
  }
  .playlist-drawer-overlay.open {
    opacity: 1;
    pointer-events: all;
  }

  .playlist-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    max-height: var(--app-height);
    border-radius: 0;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .playlist-panel.dragging {
    transition: none;
  }
  .playlist-panel.open {
    transform: translateY(0);
  }
  .playlist-panel.open .playlist-toggle-btn .svg-icon {
    transform: rotate(180deg);
  }
  .playlist-panel.collapsed .playlist-scroll,
  .playlist-panel.collapsed .load-more-btn {
    display: none;
  }

  .playlist-header {
    position: relative;
    padding-top: max(18px, env(safe-area-inset-top));
    cursor: default;
  }
  .playlist-header-top {
    gap: 10px;
  }

  .playlist-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 70px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-input);
    color: var(--text-primary);
    box-shadow: var(--button-shadow);
    cursor: pointer;
    transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
    flex-shrink: 0;
  }
  .playlist-toggle-btn:hover {
    background: rgba(34, 211, 238, 0.16);
    border-color: rgba(34, 211, 238, 0.3);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--panel-shadow);
  }
  .playlist-toggle-btn .svg-icon {
    width: 15px;
    height: 15px;
    transition: transform 0.25s;
  }
  .playlist-toggle-text {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
  }

  /* Show search + sort in playlist */
  .playlist-search {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
    margin-top: 6px;
    margin-bottom: 10px;
  }
  .playlist-search input {
    flex: 1;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 30px;
    border: 1px solid var(--input-border);
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
  }
  .playlist-search input:focus {
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
  }
  .playlist-search input::placeholder { color: var(--text-muted); }

  .playlist-sort {
    display: flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-soft);
    margin-top: 2px;
  }
  .playlist-sort .sort-btn {
    flex: 1;
    text-align: center;
    padding: 7px 10px;
    font-size: 12px;
  }
  .playlist-panel:not(.playlist-mode) .playlist-search,
  .playlist-panel:not(.playlist-mode) .playlist-sort {
    display: none;
  }

  .lyrics-panel {
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    margin-bottom: 0;
  }
  .lyric-line {
    font-size: 14px;
    padding: 7px 0;
  }
  .lyric-line.active {
    font-size: 17px;
    transform: translateX(4px);
  }

  .controls-row { justify-content: center; gap: 8px; }
  .visualizer {
    flex-basis: 100%;
    max-width: 360px;
    margin: 6px auto 0;
  }
}

@media (max-width: 480px) {
  :root {
    --content-panel-radius: 16px;
  }
  body {
    background: var(--body-background);
  }
  .app {
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .main-content {
    gap: 8px;
  }
  .header {
    border-radius: 14px;
    padding: 12px;
  }
  .header-actions {
    gap: 8px;
  }
  .logo { font-size: 18px; }
  .logo-icon {
    width: 32px;
    height: 32px;
  }
  .sort-btn {
    padding: 9px 8px;
    font-size: 12px;
  }
  .player-section {
    padding: 0;
  }
  .player-content {
    gap: 14px;
    padding: 18px 14px;
  }
  .player-info {
    padding-top: 44px;
  }
  .song-title { font-size: 22px; }
  .song-author {
    margin-bottom: 16px;
  }
  .cover-art { width: 120px; height: 120px; }
  .progress-section {
    margin-bottom: 16px;
    padding: 0 2px;
  }
  .progress-bar-bg {
    height: 6px;
  }
  .progress-bar-bg::before {
    content: '';
    position: absolute;
    inset: -10px 0;
  }
  .progress-bar-fill::after {
    opacity: 1;
    width: 10px;
    height: 10px;
    right: -5px;
  }
  .time-row {
    font-size: 10px;
    margin-top: 8px;
    padding: 0 1px;
  }
  .controls-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    position: relative;
  }
  .ctrl-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(148, 163, 184, 0.18);
  }
  .ctrl-btn.play-btn {
    width: 52px;
    height: 52px;
    box-shadow: 0 14px 32px rgba(34, 211, 238, 0.28);
  }
  .volume-control {
    justify-self: center;
  }
  #muteBtn {
    width: 34px;
    height: 34px;
  }
  .volume-popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(8px);
    flex-direction: column;
    justify-content: center;
    width: 52px;
    height: 156px;
    padding: 14px 0;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.88);
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.3);
    backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 5;
  }
  .volume-control.open .volume-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
  .volume-slider {
    width: 120px;
    height: 6px;
    margin: 0;
    transform: rotate(-90deg);
    transform-origin: center;
  }
  .volume-slider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
  }
  .visualizer {
    order: 7;
    flex-basis: 100%;
    max-width: 100%;
    height: 36px;
    margin-top: 2px;
    opacity: 0.56;
  }
  .lyrics-panel {
    min-height: 0;
    height: 100%;
    padding: 14px;
  }
  .lyrics-panel h3 {
    font-size: 12px;
    letter-spacing: 1.4px;
    padding-bottom: 2px;
  }
  .lyric-line {
    font-size: 13px;
    padding: 6px 0;
    line-height: 1.5;
  }
  .lyric-line.active {
    font-size: 15px;
    transform: translateX(4px);
  }
  .lyric-line::before {
    display: none;
  }
  .lyric-line.active::before {
    display: none;
  }
  .playlist-panel {
    border-radius: 0;
  }
  .playlist-panel.collapsed .playlist-header {
    border-bottom: none;
  }
  .playlist-sort .sort-btn {
    padding: 6px 8px;
    font-size: 11px;
  }
  .playlist-header {
    padding: 12px;
  }
  .source-tabs-drawer {
    padding: 4px;
    border-radius: 18px;
  }
  .source-tabs-drawer .source-tab {
    padding: 8px 12px;
    font-size: 12px;
  }
  .playlist-tab { padding: 7px 6px; font-size: 11px; }
  .playlist-tab-count { display: none; }
  .playlist-scroll {
    min-height: 260px;
    padding: 6px 8px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .playlist-item {
    padding: 9px 8px;
  }
  .playlist-item-cover {
    width: 42px;
    height: 42px;
  }
  .playlist-item-fav {
    opacity: 1;
  }
  .mobile-playlist-fab {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

@media (max-width: 380px) {
  .controls-row {
    grid-template-columns: repeat(4, 30px) 14px 46px 14px repeat(2, 30px);
    gap: 8px 4px;
  }
  .ctrl-btn { width: 30px; height: 30px; }
  .ctrl-btn.play-btn { width: 46px; height: 46px; }
  .song-title { font-size: 20px; }
}
