/* ========================================
   圆音 · 本地音乐库
   ======================================== */

:root {
  --bg: #0e1018;
  --bg-2: #161a26;
  --bg-3: #1f2433;
  --bg-4: #2a3043;
  --border: rgba(255, 255, 255, 0.06);
  --border-2: rgba(255, 255, 255, 0.1);
  --text: #f0f2f8;
  --text-2: #a8b0c4;
  --text-3: #6c7388;
  --accent: #ff4d6d;
  --accent-2: #ff8a5b;
  --primary: #6c8cff;
  --primary-2: #b388ff;
  --grad-warm: linear-gradient(135deg, #ff4d6d 0%, #ff8a5b 100%);
  --grad-cool: linear-gradient(135deg, #6c8cff 0%, #b388ff 100%);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ========================================
   Mobile Top Bar
   ======================================== */
.m-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(14, 16, 24, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 40;
}
.m-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-icon-btn:active { background: var(--bg-3); }
.m-import { background: var(--grad-warm); color: white; }
.m-import:active { transform: scale(0.95); }
.m-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
}
.m-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grad-warm);
}
.m-close { display: none; }

/* ========================================
   Sidebar (desktop) / Drawer (mobile)
   ======================================== */
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  width: 260px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(255, 77, 109, 0.4);
}
.brand-disc {
  width: 14px;
  height: 14px;
  background: var(--bg-2);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.15);
}
.brand-text { flex: 1; }
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 2px;
  margin-top: 2px;
}

.side-section {
  padding: 20px 16px 12px;
}
.side-section.side-playlists {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 4px;
}
.side-label {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 0 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.add-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}
.add-btn:hover {
  background: var(--bg-3);
  color: var(--text);
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  transition: all 0.15s;
  user-select: none;
}
.side-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.side-item.active {
  background: var(--bg-3);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.side-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  color: var(--text-3);
}
.side-item.active .side-icon { color: var(--accent); }

.side-playlist-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
}
.pl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-2);
  transition: all 0.15s;
}
.pl-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.pl-item.active {
  background: var(--bg-3);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--primary);
}
.pl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pl-count { font-size: 11px; color: var(--text-3); }
.pl-del {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pl-item:hover .pl-del { display: flex; }
.pl-del:hover { background: var(--accent); color: white; }
.pl-item.drag-over {
  background: var(--primary);
  color: white;
  outline: 2px dashed rgba(255,255,255,0.4);
  outline-offset: -2px;
}

.storage-card {
  margin: 12px 16px 16px;
  padding: 14px;
  background: var(--bg-3);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.storage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.storage-title {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 1px;
}
.storage-meta {
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.storage-bar {
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
.storage-used {
  height: 100%;
  width: 0%;
  background: var(--grad-cool);
  transition: width 0.4s ease;
}

/* ========================================
   Main
   ======================================== */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 0 36px 32px;
  scroll-behavior: smooth;
  min-width: 0;
}

/* Hero */
.hero {
  position: relative;
  margin: 0 -36px 28px;
  padding: 32px 36px 28px;
  background: linear-gradient(135deg, #1a1d2e 0%, #232539 50%, #1d2236 100%);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 400px at 80% 50%, rgba(255, 77, 109, 0.12), transparent 70%),
    radial-gradient(600px 300px at 20% 100%, rgba(108, 140, 255, 0.12), transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
}
.hero-disc-wrap { flex-shrink: 0; }
.hero-disc {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--grad-warm);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 40px rgba(255, 77, 109, 0.3),
    0 0 0 4px rgba(255, 255, 255, 0.05);
  transition: background 0.5s;
}
.hero-disc.spinning { animation: spin 12s linear infinite; }
.hero-disc-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.hero-disc-ring.r1 { inset: 14px; }
.hero-disc-ring.r2 { inset: 30px; border-color: rgba(255,255,255,0.18); }
.hero-disc-ring.r3 { inset: 48px; border-color: rgba(255,255,255,0.25); }
.hero-disc-center {
  width: 22px;
  height: 22px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-2);
  z-index: 2;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08);
}

.hero-info { flex: 1; min-width: 0; }
.hero-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.hero-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, #b8c0d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 20px;
  max-width: 500px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  border: none;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--grad-warm);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 77, 109, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 77, 109, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover {
  background: var(--bg-3);
  border-color: var(--text-3);
}
.btn-icon { font-size: 16px; line-height: 1; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar-left h2 {
  font-size: 18px;
  font-weight: 600;
  display: inline-block;
}
.toolbar-count {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
}
.toolbar-right { display: flex; gap: 10px; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text-3);
  pointer-events: none;
}
.search-box input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px 9px 34px;
  color: var(--text);
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: all 0.15s;
  font-family: inherit;
}
.search-box input:focus {
  border-color: var(--primary);
  background: var(--bg-3);
  width: 260px;
}

/* List head (desktop only) */
.list-head {
  display: grid;
  grid-template-columns: 36px 1fr 80px 80px 70px 140px;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.lh-act { text-align: right; }

/* Song list */
.song-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.song-row {
  display: grid;
  grid-template-columns: 36px 1fr 80px 80px 70px 140px;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.song-row:hover {
  background: var(--bg-2);
}
.song-row.playing {
  background: rgba(108, 140, 255, 0.06);
}
.song-row.playing .sr-idx,
.song-row.playing .sr-title { color: var(--primary); }
.song-row.dragging { opacity: 0.4; }

.sr-idx {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.song-row:hover .sr-idx { display: none; }
.sr-play {
  display: none;
  text-align: center;
  color: var(--text);
  font-size: 14px;
}
.song-row:hover .sr-play { display: block; }
.song-row.playing .sr-idx { display: none; }
.song-row.playing .sr-play { display: block; color: var(--primary); }

.sr-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sr-disc {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sr-disc::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--bg);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
}
.sr-disc-letter {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  z-index: 1;
  top: 4px;
}
.sr-disc.spinning { animation: spin 8s linear infinite; }

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

.sr-meta { min-width: 0; flex: 1; }
.sr-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  cursor: text;
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: -4px;
  transition: background 0.15s;
  outline: none;
  user-select: text;
}
.sr-name:hover {
  background: var(--bg-3);
}
.sr-name.editing {
  background: var(--bg);
  border: 1px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.15);
  white-space: normal;
  cursor: text;
}
.sr-name[contenteditable=true]:focus {
  outline: none;
}
.sr-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.sr-tag {
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--bg-3);
  font-size: 10px;
}
.sr-tag.tag-like { background: rgba(255, 77, 109, 0.15); color: var(--accent); }
.sr-tag.tag-fav { background: rgba(255, 138, 91, 0.15); color: var(--accent-2); }
.sr-tag-time {
  background: var(--bg-3);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.sr-format {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fmt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}
.fmt-audio .fmt-dot { background: var(--primary); }
.fmt-video .fmt-dot { background: var(--accent); }

.sr-size {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.sr-time {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.sr-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}
.song-row:hover .sr-actions,
.song-row.playing .sr-actions {
  opacity: 1;
}
.sr-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 13px;
}
.sr-btn:hover { background: var(--bg-3); color: var(--text); }
.sr-btn.active { color: var(--accent); }
.sr-btn.danger:hover { background: var(--accent); color: white; }

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty p { margin-bottom: 20px; font-size: 14px; }

/* ========================================
   Player Bar
   ======================================== */
.player-bar {
  background: rgba(22, 26, 38, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-2);
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  flex-shrink: 0;
  z-index: 50;
  padding-bottom: var(--safe-bottom);
}

.pb-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.pb-disc {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--grad-warm);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: background 0.5s;
}
.pb-disc.spinning { animation: spin 10s linear infinite; }
.pb-disc-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
}
.pb-disc-ring.r1 { inset: 6px; }
.pb-disc-ring.r2 { inset: 16px; border-color: rgba(255,255,255,0.2); }
.pb-disc-ring.r3 { inset: 26px; border-color: rgba(255,255,255,0.25); }
.pb-disc-center {
  width: 14px;
  height: 14px;
  background: var(--bg-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  color: var(--text-2);
  z-index: 2;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.12);
}

.pb-info { min-width: 0; flex: 1; }
.pb-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.pb-sub {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pb-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.pb-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ctrl {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s;
  font-family: inherit;
}
.ctrl:hover { color: var(--text); background: var(--bg-3); }
.ctrl:active { transform: scale(0.92); }
.ctrl { width: 32px; height: 32px; font-size: 16px; }
.ctrl-main {
  width: 40px;
  height: 40px;
  background: var(--text);
  color: var(--bg);
}
.ctrl-main:hover {
  background: white;
  color: var(--bg);
}
.ctrl-icon { font-size: 15px; }
.ctrl-icon.active { color: var(--accent); }
.hidden { display: none !important; }

.pb-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.pb-time {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: center;
}
.progress {
  flex: 1;
  height: 12px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.progress-bg {
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: var(--bg-3);
  border-radius: 2px;
  transition: height 0.1s;
}
.progress-fill {
  position: absolute;
  left: 0;
  height: 3px;
  background: var(--grad-cool);
  border-radius: 2px;
  width: 0%;
  transition: height 0.1s;
}
.progress-thumb {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  left: 0%;
  transform: translateX(-50%) scale(0);
  transition: transform 0.1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.progress:hover .progress-thumb { transform: translateX(-50%) scale(1); }
.progress:hover .progress-bg,
.progress:hover .progress-fill { height: 5px; }

.pb-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.pb-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  color: var(--text-3);
}
.pb-volume input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 3px;
  background: var(--bg-3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.pb-volume input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.pb-volume input[type=range]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ========================================
   Modal
   ======================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.modal.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
}
.modal-content {
  position: relative;
  background: var(--bg-2);
  border-radius: 14px;
  padding: 24px;
  max-width: 760px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: pop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.modal-small { max-width: 400px; }
@keyframes pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-content video {
  width: 100%;
  max-height: 65vh;
  border-radius: 10px;
  background: black;
}
.modal-title {
  font-size: 14px;
  color: var(--text);
  padding: 4px 4px 0;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  line-height: 1;
}
.modal-close:hover { background: rgba(0,0,0,0.8); }
.modal-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal-tip {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 16px;
}
#playlistNameInput {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  margin-bottom: 18px;
  transition: border-color 0.15s;
}
#playlistNameInput:focus { border-color: var(--primary); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(120px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 34, 48, 0.95);
  border: 1px solid var(--border-2);
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toastIn 0.2s ease;
  white-space: nowrap;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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

/* ========================================
   Desktop Layout (>= 901px)
   ======================================== */
@media (min-width: 901px) {
  .m-topbar { display: none !important; }
  .sidebar-mask { display: none !important; }
  body {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 1fr 96px;
    grid-template-areas:
      "side main"
      "player player";
  }
  .sidebar {
    grid-area: side;
  }
  .m-close { display: none !important; }
}

/* ========================================
   Mobile Layout (<= 900px)
   ======================================== */
@media (max-width: 900px) {
  body {
    display: flex;
    flex-direction: column;
  }
  .m-topbar { display: flex; }
  .main {
    padding: 0 16px 24px;
  }
  .hero {
    margin: 0 -16px 20px;
    padding: 20px 16px;
  }
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    text-align: left;
  }
  .hero-disc {
    width: 96px;
    height: 96px;
    box-shadow:
      0 6px 24px rgba(255, 77, 109, 0.3),
      0 0 0 3px rgba(255, 255, 255, 0.05);
  }
  .hero-disc-ring.r1 { inset: 10px; }
  .hero-disc-ring.r2 { inset: 22px; }
  .hero-disc-ring.r3 { inset: 34px; }
  .hero-disc-center { width: 16px; height: 16px; font-size: 8px; }
  .hero-title { font-size: 22px; }
  .hero-desc { font-size: 13px; margin-bottom: 14px; }
  .hero-actions .btn { padding: 9px 18px; font-size: 12.5px; }

  /* 侧边栏变抽屉 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .m-close { display: flex; }

  /* Toolbar 简化 */
  .toolbar { margin-bottom: 12px; gap: 8px; }
  .toolbar-left h2 { font-size: 16px; }
  .toolbar-count { font-size: 11px; }
  .search-box input {
    width: 140px;
    padding: 8px 12px 8px 32px;
    font-size: 12.5px;
  }
  .search-box input:focus { width: 160px; }

  /* 隐藏桌面列表头 */
  .list-head { display: none; }

  /* 列表项：移动端 2 列布局 [disc+title | right] */
  .song-list { gap: 4px; }
  .song-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "disc meta actions"
      "disc meta actions";
    gap: 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-2);
  }
  .song-row:hover { background: var(--bg-3); }
  .song-row.playing { background: rgba(108, 140, 255, 0.1); }

  .sr-idx, .sr-play, .lh-act {
    display: none !important;
  }
  .sr-disc {
    grid-area: disc;
    width: 48px;
    height: 48px;
  }
  .sr-title {
    grid-area: meta;
    align-items: center;
    gap: 10px;
  }
  .sr-actions {
    grid-area: actions;
    opacity: 1;       /* 移动端常显 */
    flex-direction: column;
    gap: 2px;
  }
  .sr-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-3);
  }
  .sr-btn.active { background: rgba(255, 77, 109, 0.2); }

  /* 移动端列表只显示标题+小标签 */
  .sr-format, .sr-size, .lh-format, .lh-size { display: none !important; }
  .lh-time, .lh-title { display: none !important; }

  .sr-name {
    font-size: 14px;
    margin-bottom: 4px;
  }
  .sr-tags { font-size: 10.5px; }
  .sr-tag { font-size: 9.5px; padding: 1px 5px; }

  .sr-time {
    display: none;       /* 移动端时长放副标题 */
  }

  /* 在 sr-tags 里追加时长显示 */
  .sr-tags::after {
    content: attr(data-time);
    font-size: 10.5px;
    color: var(--text-3);
    margin-left: auto;
  }

  /* 播放器：移动端紧凑版 */
  .player-bar {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "disc info actions"
      "progress progress progress";
    gap: 10px 12px;
    padding: 10px 14px;
    padding-bottom: calc(10px + var(--safe-bottom));
  }
  .pb-left {
    grid-area: disc / disc / info / info;
    display: contents;
  }
  .pb-disc {
    grid-area: disc;
    width: 44px;
    height: 44px;
  }
  .pb-disc-ring.r1 { inset: 4px; }
  .pb-disc-ring.r2 { inset: 11px; }
  .pb-disc-ring.r3 { inset: 18px; }
  .pb-disc-center { width: 10px; height: 10px; font-size: 6px; }
  .pb-info {
    grid-area: info;
    align-self: center;
  }
  .pb-title { font-size: 13px; }
  .pb-sub { font-size: 10.5px; }

  .pb-center {
    grid-area: actions;
    max-width: none;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }
  .pb-progress {
    grid-area: progress;
    max-width: none;
    gap: 8px;
  }
  .pb-progress .pb-time { font-size: 10.5px; min-width: 30px; }
  .pb-right {
    display: none;   /* 移动端喜欢/收藏/音量放在行内 sr-actions */
  }

  .pb-controls { gap: 4px; }
  .ctrl { width: 28px; height: 28px; }
  .ctrl-main { width: 36px; height: 36px; }
  .ctrl-main svg { width: 18px; height: 18px; }
}

/* 超小屏 (< 380px) */
@media (max-width: 380px) {
  .hero-title { font-size: 19px; }
  .sr-disc { width: 42px; height: 42px; }
  .sr-actions .sr-btn { width: 28px; height: 28px; font-size: 12px; }
  .pb-disc { width: 40px; height: 40px; }
}