/* 云音乐库 · 样式
   布局：左侧导航栏 + 顶栏搜索 + 歌曲列表 + 底部播放条（网易云式三段）
   主题：浅色默认，蓝色单一强调色；html[data-theme="dark"] 切换深色。 */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --hover: rgba(0, 0, 0, 0.045);
  --line: rgba(0, 0, 0, 0.07);
  --text: #21252b;
  --muted: #868d98;
  --accent: #335eea;
  --accent-ink: #ffffff;
  --accent-soft: rgba(51, 94, 234, 0.09);
  --track: rgba(0, 0, 0, 0.12);
  --danger: #e5484d;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
  --radius: 12px;
}

html[data-theme="dark"] {
  --bg: #12141a;
  --panel: #1a1d25;
  --panel-2: #20242e;
  --hover: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eaf0;
  --muted: #8b91a3;
  --accent: #5b7ff0;
  --accent-soft: rgba(91, 127, 240, 0.14);
  --track: rgba(255, 255, 255, 0.14);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
}

::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(128, 134, 150, 0.3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 134, 150, 0.45); }
svg { display: block; }

/* ───────── 整体布局 ───────── */

.layout {
  display: flex;
  height: 100%;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ───────── 侧边栏 ───────── */

.sidebar {
  width: 208px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 12px 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }

.logo {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b8bf7, #335eea);
  color: #fff;
  display: grid; place-items: center;
}
.logo svg { width: 19px; height: 19px; }

.brand .name { font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }

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

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none; border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit; font-weight: 550;
  cursor: pointer;
  transition: background 0.12s;
}
.nav-item svg { width: 19px; height: 19px; color: var(--muted); }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.nav-item em {
  margin-left: auto;
  font-style: normal; font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active em { color: var(--accent); }

.side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
}

.btn-accent {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none; border-radius: 999px;
  padding: 10px 16px;
  font: inherit; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
}
.btn-accent svg { width: 17px; height: 17px; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-accent:active { transform: translateY(1px); }

.side-stat { font-size: 12px; color: var(--muted); text-align: center; }
.side-hint { font-size: 11px; color: var(--muted); text-align: center; opacity: 0.8; }

/* ───────── 顶栏 ───────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg);
}

.search {
  flex: 1;
  max-width: 320px;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text); font: inherit;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ───────── 通用图标按钮 ───────── */

.icon-btn {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  background: none; border: none; border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn.skip { color: var(--text); }

/* ───────── 歌曲列表 ───────── */

main {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 20px;
}
main.dragging { outline: 2px dashed var(--accent); outline-offset: -6px; }

.list-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: 6px 4px 12px;
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 2;
}
.list-head h1 {
  margin: 0;
  font-size: 19px; font-weight: 700;
}
.list-head #listMeta { color: var(--muted); font-size: 12.5px; }

.song-list {
  list-style: none;
  margin: 0; padding: 0 4px 8px;
}

.song {
  display: grid;
  grid-template-columns: 28px 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.song:hover { background: var(--hover); }
.song.playing { background: var(--accent-soft); }

.song .num {
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.song .art {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.9);
}
.song .art svg { width: 19px; height: 19px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }

.song .info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.song .title {
  font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song.playing .title { color: var(--accent); }
.song .meta { font-size: 12px; color: var(--muted); }

.song .dur {
  color: var(--muted); font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.song .acts { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.song:hover .acts, .song.playing .acts { opacity: 1; }
@media (hover: none) { .song .acts { opacity: 1; } }

/* 正在播放：跳动的小均衡条（暂停时通过 .paused 停住） */
.eq {
  width: 18px; height: 16px;
  display: flex; align-items: flex-end; justify-content: center; gap: 2px;
}
.eq span {
  width: 3px; height: 4px;
  border-radius: 2px;
  background: var(--accent);
  animation: eq 0.9s ease-in-out infinite;
}
.eq span:nth-child(2) { animation-delay: 0.25s; }
.eq span:nth-child(3) { animation-delay: 0.5s; }
.song.paused .eq span { animation-play-state: paused; }
@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

.no-match { padding: 28px 12px; color: var(--muted); text-align: center; }

.empty { text-align: center; padding: 90px 20px 40px; }
.empty-art {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--muted);
}
.empty-art svg { width: 34px; height: 34px; }
.empty-title { margin: 0 0 6px; font-weight: 650; font-size: 17px; }
.empty-sub { margin: 0; color: var(--muted); font-size: 13px; }

/* ───────── 上传面板 ───────── */

.upload-panel {
  position: fixed;
  left: 50%; bottom: 108px;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.upload-info {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; margin-bottom: 8px;
}
.upload-info span:first-child {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-info #uploadPct { color: var(--accent); font-variant-numeric: tabular-nums; }
.upload-track { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.upload-bar {
  height: 100%; width: 0;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.15s;
}

/* ───────── 播放条 ───────── */

.player {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(300px, 2.4fr) minmax(150px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 8px 20px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.np { display: flex; align-items: center; gap: 12px; min-width: 0; }

.np-art {
  width: 46px; height: 46px;
  flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.9);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.np-art svg { width: 21px; height: 21px; }

.np-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.np-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#npDownload { flex: none; }

.controls { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.ctrl-row { display: flex; align-items: center; gap: 10px; }

.play-btn {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.play-btn svg { width: 22px; height: 22px; }
.play-btn:hover { filter: brightness(1.1); }
.play-btn:active { transform: scale(0.94); }

.bar-row { display: flex; align-items: center; gap: 10px; width: 100%; }

.time {
  width: 42px; flex: none;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(128, 134, 150, 0.28);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.player .side { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); }
.player .side svg { width: 18px; height: 18px; flex: none; }
#volume { width: 88px; }

/* ───────── 提示 ───────── */

.toast {
  position: fixed;
  left: 50%; bottom: 110px;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 30;
  max-width: calc(100vw - 40px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); color: #fff; }

/* ───────── 响应式 ───────── */

@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .brand .name, .nav-item span, .nav-item em, .side-stat, .side-hint { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .btn-accent span { display: none; }
  .btn-accent { padding: 10px 0; }
  .side-bottom { align-items: center; }
  main { padding: 0 14px 16px; }
  .topbar { padding: 10px 14px; }
  .player { grid-template-columns: 1fr; gap: 6px; }
  .player .side { display: none; }
  .np { order: 1; }
  .controls { order: 2; width: 100%; }
}

@media (max-width: 640px) {
  .song { grid-template-columns: 22px 40px minmax(0, 1fr) auto; gap: 10px; }
  .song .dur { display: none; }
  .player { padding: 6px 12px 8px; }
  .np-art { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
