/* ============================================================================
   春雷音乐 — 视觉系统
   ----------------------------------------------------------------------------
   设计语言:暗色底 + 琥珀金强调色,编辑型排版。
   灵感来自 Linear / Apple Music / Spotify 的克制感,叠加一点宋体的书卷气。
   ========================================================================== */

/* ── 设计令牌 ────────────────────────────────────────────────────────────── */
/* 默认:暗色底 + 琥珀金(春雷原版) */
:root,
[data-theme="dark"] {
  /* 表面 */
  --bg-0: #0a0a0c;
  --bg-1: #131316;
  --bg-2: #1a1a1e;
  --bg-3: #232329;
  --bg-4: #2d2d34;

  /* 边框 */
  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* 文字 */
  --text-0: #f5f1ea;   /* primary 暖白 */
  --text-1: #b8b3a8;   /* secondary */
  --text-2: #8f8a81;   /* tertiary(对 bg-0..bg-3 均 ≥4.5:1) */
  --text-3: #6c6862;   /* dim(仅用于已唱歌词/装饰,不承载正文) */

  /* 强调色(春雷 — 琥珀金) */
  --accent:        #e8b340;
  --accent-hover:  #f0c258;
  --accent-press:  #d09e2a;
  --accent-soft:   rgba(232, 179, 64, 0.12);
  --accent-glow:   rgba(232, 179, 64, 0.35);
  /* 强调色当"文字"用时的取值(某些主题下原始 accent 太浅,单独给一个) */
  --accent-text:   #e8b340;
  /* 强调色实心块上的文字/图标色 */
  --on-accent:     #0a0a0c;

  /* 玻璃表面(顶栏 / 底栏)—— 半透明,必须跟着主题走,否则浅色主题下会留两条黑边 */
  --glass-top: rgba(10, 10, 12, 0.85);
  --glass-bar: rgba(19, 19, 22, 0.92);
  --cover-ph: linear-gradient(135deg, #2a2a30, #1a1a1e);
  --cover-ph-fg: linear-gradient(135deg, rgba(232, 179, 64, 0.18), rgba(232, 179, 64, 0.04));
}

/* 主题:星光白(iPhone 浅色) */
[data-theme="light"] {
  --bg-0: #fafafa;
  --bg-1: #f2f2f7;
  --bg-2: #ebebef;
  --bg-3: #e2e2e7;
  --bg-4: #d8d8de;
  --border:        rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text-0: #1c1c1e;
  --text-1: #3a3a3c;
  --text-2: #646469;
  --text-3: #848488;
  --accent:        #ff9500;
  --accent-hover:  #ffaa33;
  --accent-press:  #cc7700;
  --accent-soft:   rgba(255, 149, 0, 0.14);
  --accent-glow:   rgba(255, 149, 0, 0.30);
  /* 原始 #ff9500 作正文只有 2.1:1,这里给文字用加深版 */
  --accent-text:   #945600;
  --on-accent:     #0a0a0c;
  --glass-top: rgba(250, 250, 250, 0.85);
  --glass-bar: rgba(242, 242, 247, 0.92);
  --cover-ph: linear-gradient(135deg, #e6e6ea, #dcdce2);
  --cover-ph-fg: linear-gradient(135deg, rgba(255, 149, 0, 0.16), rgba(255, 149, 0, 0.03));
}

/* 主题:翠绿(iPhone 绿色) */
[data-theme="forest"] {
  --bg-0: #0e1a14;
  --bg-1: #14221b;
  --bg-2: #1b2c24;
  --bg-3: #23362c;
  --bg-4: #2c4135;
  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-0: #eaf3ed;
  --text-1: #b6c8bd;
  --text-2: #8a9e91;
  --text-3: #63736c;
  --accent:        #30d158;
  --accent-hover:  #5fdc7a;
  --accent-press:  #25a943;
  --accent-soft:   rgba(48, 209, 88, 0.14);
  --accent-glow:   rgba(48, 209, 88, 0.35);
  --accent-text:   #30d158;
  --on-accent:     #0a0a0c;
  --glass-top: rgba(14, 26, 20, 0.85);
  --glass-bar: rgba(20, 34, 27, 0.92);
  --cover-ph: linear-gradient(135deg, #1e332a, #16261e);
  --cover-ph-fg: linear-gradient(135deg, rgba(48, 209, 88, 0.16), rgba(48, 209, 88, 0.03));
}

/* 主题:樱粉(iPhone 粉色) */
[data-theme="sakura"] {
  --bg-0: #1d1118;
  --bg-1: #281620;
  --bg-2: #341c29;
  --bg-3: #412434;
  --bg-4: #4e2c40;
  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-0: #fcecf2;
  --text-1: #d6bcc8;
  --text-2: #aa8b9a;
  --text-3: #7b6872;
  --accent:        #ff375f;
  --accent-hover:  #ff5c7d;
  --accent-press:  #d92b50;
  --accent-soft:   rgba(255, 55, 95, 0.14);
  --accent-glow:   rgba(255, 55, 95, 0.35);
  --accent-text:   #ff5779;
  --on-accent:     #0a0a0c;
  --glass-top: rgba(29, 17, 24, 0.85);
  --glass-bar: rgba(40, 22, 32, 0.92);
  --cover-ph: linear-gradient(135deg, #43293a, #2e1c28);
  --cover-ph-fg: linear-gradient(135deg, rgba(255, 55, 95, 0.16), rgba(255, 55, 95, 0.03));
}

/* 主题:宝蓝(iPhone 蓝色) */
[data-theme="ocean"] {
  --bg-0: #061121;
  --bg-1: #0c1a32;
  --bg-2: #12243f;
  --bg-3: #192e4d;
  --bg-4: #21395d;
  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-0: #e7eef8;
  --text-1: #b0bdd2;
  --text-2: #8995b3;
  --text-3: #646d84;
  --accent:        #5ac8fa;
  --accent-hover:  #84d4ff;
  --accent-press:  #46a5d4;
  --accent-soft:   rgba(90, 200, 250, 0.16);
  --accent-glow:   rgba(90, 200, 250, 0.35);
  --accent-text:   #5ac8fa;
  --on-accent:     #0a0a0c;
  --glass-top: rgba(6, 17, 33, 0.85);
  --glass-bar: rgba(12, 26, 50, 0.92);
  --cover-ph: linear-gradient(135deg, #1b3350, #12243f);
  --cover-ph-fg: linear-gradient(135deg, rgba(90, 200, 250, 0.16), rgba(90, 200, 250, 0.03));
}

/* 主题:紫罗兰(iPhone 紫色) */
[data-theme="violet"] {
  --bg-0: #14091e;
  --bg-1: #1d1130;
  --bg-2: #281942;
  --bg-3: #342254;
  --bg-4: #412c69;
  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-0: #f1ecf8;
  --text-1: #c8bcd6;
  --text-2: #a393b8;
  --text-3: #726682;
  --accent:        #bf5af2;
  --accent-hover:  #d07cff;
  --accent-press:  #9d40d3;
  --accent-soft:   rgba(191, 90, 242, 0.16);
  --accent-glow:   rgba(191, 90, 242, 0.35);
  --accent-text:   #c66cf3;
  --on-accent:     #0a0a0c;
  --glass-top: rgba(20, 9, 30, 0.85);
  --glass-bar: rgba(29, 17, 48, 0.92);
  --cover-ph: linear-gradient(135deg, #382a52, #241a3c);
  --cover-ph-fg: linear-gradient(135deg, rgba(191, 90, 242, 0.16), rgba(191, 90, 242, 0.03));
}

:root {
  /* 功能色 */
  --danger: #e85d5d;

  /* 排版 */
  --font-ui:      "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* 节奏 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 32px var(--accent-glow);

  /* 缓动 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* 尺寸 */
  --header-h: 64px;
  --player-h: 88px;
  --sidebar-w: 280px;
  /* 顶栏内边距 —— 悬浮的主题按钮要跟它对齐,所以提成令牌 */
  --header-pad: 24px;
  /* 主题按钮是 fixed 定位、不占布局宽度,但视觉上占着顶栏右侧。
     给顶栏预留这么宽,窄屏时搜索框就会自动缩短而不是钻到按钮底下去。 */
  --theme-btn-reserve: 52px;   /* 按钮 36 + 与内容间距 16 */
}

/* ── 基础 ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr var(--player-h);
  grid-template-areas:
    "header header"
    "side   main"
    "player player";
  height: 100vh;
  height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

::selection { background: var(--accent-soft); color: var(--text-0); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* ── 工具类 ─────────────────────────────────────────────────────────────── */
.muted { color: var(--text-2); font-size: 0.875rem; }
.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--accent-text);
  text-transform: uppercase;
  margin: 0 0 12px;
}
.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 16px;
  color: var(--text-0);
}
.display-sub {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0 0 8px;
  color: var(--text-1);
}
.lede {
  font-size: 1.05rem;
  color: var(--text-1);
  margin: 0;
  max-width: 56ch;
}

/* ── 图标按钮 ───────────────────────────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-1);
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text-0); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn--small { width: 32px; height: 32px; }
.icon-btn--small svg { width: 16px; height: 16px; }
.icon-btn--ghost { color: var(--text-2); }
.icon-btn--ghost:hover { color: var(--text-0); }
/* 播放模式按钮:图标 + 文字标签(单曲/列表/随机) */
.mode-btn {
  width: auto;
  padding: 0 12px;
  border-radius: 999px;
  gap: 6px;
}
.mode-btn-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.mode-btn:hover .mode-btn-label { color: var(--text-0); }
.icon-btn[aria-pressed="true"] {
  color: var(--accent-text);
  background: var(--accent-soft);
}
.icon-btn--primary {
  width: 44px; height: 44px;
  background: var(--text-0);
  color: var(--bg-0);
}
.icon-btn--primary:hover {
  background: var(--accent);
  color: var(--bg-0);
  transform: scale(1.04);
  box-shadow: var(--shadow-glow);
}
.icon-btn--primary svg { width: 22px; height: 22px; }
.icon-btn--menu { display: none; }

/* ── 顶栏 ───────────────────────────────────────────────────────────────── */
.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 16px;
  /* 右侧多留出主题按钮的位置 —— 搜索框再宽也不会滑到按钮下面 */
  padding: 0 calc(var(--header-pad) + var(--theme-btn-reserve)) 0 var(--header-pad);
  border-bottom: 1px solid var(--border);
  background: var(--glass-top);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 10;
  position: relative;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  user-select: none;
}
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: var(--text-0);
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent-text);
}
.search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.2s, background 0.2s;
}
/* 聚焦时不要凸显边框。
   注意:光靠 :focus-visible 区分不了 —— Chrome 里鼠标点进文本框同样匹配
   :focus-visible,所以"鼠标聚焦"是由 JS 给 .search 加 .is-mouse-focus 标记的
   (见 player.js)。键盘 Tab 进来仍保留琥珀色描边,别把无障碍提示一起弄丢。 */
.search:focus-within {
  border-color: var(--accent);
  background: var(--bg-3);
}
.search.is-mouse-focus:focus-within {
  border-color: var(--border);
  background: var(--bg-2);
}
.search svg { width: 16px; height: 16px; color: var(--text-2); flex-shrink: 0; }
.search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 0.9rem;
  color: var(--text-0);
  min-width: 0;
}
.search input::placeholder { color: var(--text-2); }
.search input::-webkit-search-cancel-button { display: none; }
/* 搜索框里的 outline 收掉:它跟上面 .search 的边框描边会叠成两层框。
   键盘聚焦的提示改由 .search:focus-within 的边框承担(鼠标聚焦时按 JS 标记压掉)。 */
.search input:focus-visible { outline: none; }

/* ── 侧栏 ───────────────────────────────────────────────────────────────── */
.sidebar {
  grid-area: side;
  border-right: 1px solid var(--border);
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 20px 12px;
  flex-shrink: 0;
}
.sidebar-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-1);
  letter-spacing: 0.02em;
}
.sidebar-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.icon-btn--small.spinning svg {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.album-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 24px;
}
.album-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.album-nav-item:hover { background: var(--bg-2); }
.album-nav-item.is-active {
  background: var(--bg-3);
}
.album-nav-item.is-active .album-nav-title { color: var(--accent-text); }
.album-nav-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  background: var(--cover-ph);
}
.album-nav-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.album-nav-thumb-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--accent-text);
  background: var(--cover-ph-fg);
}
.album-nav-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.album-nav-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}
.album-nav-meta {
  font-size: 0.75rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ── 主区 ───────────────────────────────────────────────────────────────── */
.main {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
.view {
  padding: 48px clamp(24px, 5vw, 56px) 64px;
  max-width: 1280px;
  margin: 0 auto;
  animation: view-in 0.4s var(--ease-out);
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 首页 ───────────────────────────────────────────────────────────────── */
.view-hero {
  padding: 24px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

/* ── 最近新增(横向精选轨)──────────────────────────────────────────────── */
.rail { margin-bottom: 48px; }
.rail-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--text-1);
  letter-spacing: 0.02em;
  margin: 0 0 20px;
}
.rail-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(180px, 22vw, 240px);
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* 卡片自带 8px 内边距 + 负外边距,这里补回视觉对齐 */
  padding: 8px 4px 16px;
  margin: -8px -4px -16px;
  scrollbar-width: thin;
}
.rail-track .album-card { scroll-snap-align: start; }
/* 右缘渐隐:提示"还能往右滑",否则第 5 张被硬切像布局出错 */
.rail { position: relative; }
.rail::after {
  content: "";
  position: absolute;
  top: 28px; bottom: 40px; right: 0;
  width: 56px;
  pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg-0));
}
/* 横向滚动条收细一点,别喧宾夺主 */
.rail-track::-webkit-scrollbar { height: 6px; }
.rail-track::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
.rail-track::-webkit-scrollbar-track { background: transparent; }

/* ── 专辑网格 ───────────────────────────────────────────────────────────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
}
.album-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: var(--r-md);
  padding: 8px;
  margin: -8px;
  transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.album-card:hover { background: var(--bg-2); }
.album-card:active { transform: scale(0.99); }
.album-card-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--cover-ph);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.album-card:hover .album-card-art {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.album-card-art img {
  width: 100%; height: 100%; object-fit: cover;
}
.album-card-art-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 4rem;
  color: var(--accent-text);
  background: var(--cover-ph-fg);
}
.album-card-play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0.85;
  transform: translateY(0);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), background 0.2s, box-shadow 0.2s;
}
.album-card-play svg { width: 22px; height: 22px; }
.album-card:hover .album-card-play {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.album-card-play:hover { background: var(--accent-hover); transform: scale(1.08); }
.album-card:active .album-card-play { transform: scale(0.95); }
.album-card-text {
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.album-card-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-card-meta {
  font-size: 0.8rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ── 专辑详情 ───────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
  font-size: 0.85rem;
  margin-bottom: 24px;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}
.back-link:hover { color: var(--text-0); background: var(--bg-2); }
.back-link svg { width: 16px; height: 16px; }

.album-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}
.album-detail-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--cover-ph);
  box-shadow: var(--shadow-lg);
}
.album-detail-art img { width: 100%; height: 100%; object-fit: cover; }
.album-detail-art-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 6rem;
  color: var(--accent-text);
  background: var(--cover-ph-fg);
}
.album-detail-info { min-width: 0; }
.album-detail-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 8px;
}
.album-detail-meta {
  color: var(--text-2);
  font-size: 0.9rem;
  margin: 0 0 24px;
  font-variant-numeric: tabular-nums;
}
.album-detail-meta span + span::before {
  content: "·";
  margin: 0 8px;
  color: var(--text-3);
}
.album-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s var(--ease-out);
}
.btn svg { width: 16px; height: 16px; }
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}
.btn--ghost {
  background: var(--bg-3);
  color: var(--text-0);
}
.btn--ghost:hover { background: var(--bg-4); }

/* 曲目表 */
.track-list { list-style: none; padding: 0; margin: 0; }
.track-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.track-row:hover { background: var(--bg-2); }
.track-row.is-playing { background: var(--bg-2); }
/* 刷新后刚刚被改动的曲目:短暂高亮,提示"歌词/歌曲有变动" */
.track-row.is-fresh {
  animation: track-row-fresh 2.6s ease-out 1;
}
@keyframes track-row-fresh {
  0%   { background: color-mix(in srgb, var(--accent) 22%, transparent); }
  60%  { background: color-mix(in srgb, var(--accent) 10%, transparent); }
  100% { background: transparent; }
}
.track-row.is-playing .track-num { color: var(--accent-text); }
.track-row.is-playing .track-num .num { display: none; }
.track-num {
  display: flex; align-items: center; justify-content: center;
  width: 24px;
  font-size: 0.85rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.track-num .bars {
  display: none;
  width: 14px; height: 14px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
}
.track-num .bars i {
  width: 2px; background: var(--accent); border-radius: 1px;
  animation: bar-pulse 1.2s ease-in-out infinite;
  animation-play-state: paused;
}
/* 跳动条只在真的出声时才跳:暂停后停帧,省电(也让"在播"这个信号更准确)。
   只切 play-state(不用 animation 简写),免得把上面的 animation-delay 重置掉。 */
body.is-audio-playing .track-row.is-playing .track-num .bars i {
  animation-play-state: running;
}
.track-num .bars i:nth-child(1) { animation-delay: 0s;   height: 40%; }
.track-num .bars i:nth-child(2) { animation-delay: 0.2s; height: 100%; }
.track-num .bars i:nth-child(3) { animation-delay: 0.4s; height: 60%; }
.track-num .bars i:nth-child(4) { animation-delay: 0.1s; height: 80%; }
@keyframes bar-pulse {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}
.track-row.is-playing .track-num .bars { display: flex; }
.track-row.is-playing .track-num .num  { display: none; }

.track-info { min-width: 0; }
.track-title {
  font-size: 0.95rem;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-row.is-playing .track-title { color: var(--accent-text); }
.track-sub {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* 播放次数:跟在 LRC 徽章后面,弱化处理,别跟歌名抢视线。
   用 --text-2(AA 合规)而不是 --text-3(仅 3.3:1)—— 这是要读的数字。 */
.track-plays {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 0.95em;
}
.track-plays::before {
  content: "·";
  margin-right: 6px;
  color: var(--text-3);
  opacity: 0.7;
}
.track-sub-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 500;
  letter-spacing: 0.05em;
}
/* 刷新后刚刚被改动的曲目:绿色脉冲一下,提示"歌词/歌曲有变动" */
.track-sub-badge--fresh {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent-text);
  animation: track-fresh-pulse 2.4s ease-out 1;
}
@keyframes track-fresh-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); transform: scale(1); }
  40%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); transform: scale(1.18); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); transform: scale(1); }
}
.track-dur {
  font-size: 0.85rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.track-num .play-hover {
  display: none;
  width: 18px; height: 18px;
  color: var(--text-0);
}
.track-row:hover:not(.is-playing) .track-num .num { display: none; }
.track-row:hover:not(.is-playing) .track-num .play-hover { display: block; }

/* ── 播放器 ─────────────────────────────────────────────────────────────── */
.player {
  grid-area: player;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  border-top: 1px solid var(--border);
  background: var(--glass-bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 5;
}
.player-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.player-art {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cover-ph);
}
.player-art img { width: 100%; height: 100%; object-fit: cover; }
.player-art-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  color: var(--accent-text);
  background: var(--cover-ph-fg);
}
.player-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-album {
  font-size: 0.75rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.player-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.player-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 600px;
}
.time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}
.time:last-child { text-align: right; }

.progress {
  flex: 1;
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-3);
  cursor: pointer;
  transition: height 0.15s var(--ease-out);
}
.progress:hover { height: 6px; }
.progress-buffered {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--bg-4);
  border-radius: 2px;
  width: 0;
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 0.1s linear;
}
.progress-thumb {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-0);
  transform: translate(-50%, -50%);
  left: 0;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.progress:hover .progress-thumb { opacity: 1; }
.progress:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.player-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.volume {
  width: 100px;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s var(--ease-out);
}
.volume:hover { height: 6px; }
.volume-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--text-1);
  border-radius: 2px;
  width: 100%;
  transition: background 0.15s;
}
.volume:hover .volume-fill { background: var(--accent); }
.volume:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ── 歌词抽屉(右侧弹出) ──────────────────────────────────────────────── */
.lyrics-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 94vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  transform: translateX(103%);
  visibility: hidden;
  transition: transform 0.4s var(--ease-out), visibility 0s linear 0.4s;
}
.lyrics-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.4s var(--ease-out), visibility 0s linear 0s;
}
.lyrics-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  flex-shrink: 0;
}
.lyrics-panel-meta { min-width: 0; }
.lyrics-panel-song {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lyrics-panel-album {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lyrics-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.lyrics-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}
.lyrics-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 16px 24px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* 渐隐区域从 60px 收到 20px,大幅缩小蒙版的重绘面积 */
  mask-image: linear-gradient(to bottom, transparent 0, black 20px, black calc(100% - 20px), transparent 100%);
}
.lyrics-line {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.65;
  /* 未唱的行用 text-2 —— 之前是 text-3(2.5:1),基本读不出来 */
  color: var(--text-2);
  padding: 2px 12px;
  /* 去掉 font-size(每次切换都会引发整列重排,是最耗电的那个);时长从 0.4s 减到 0.18s */
  transition: color 0.18s var(--ease-out), opacity 0.18s var(--ease-out);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.lyrics-line:hover { color: var(--text-1); }
.lyrics-line.is-current {
  color: var(--accent-text);
  font-weight: 500;
  /* 用 transform: scale 替代字号变化——只走合成层、不触发布局 */
  transform: scale(1.04);
}
/* 已唱过的行退到最弱:弱化靠 text-3 + 略降不透明度,而不是压到看不清 */
.lyrics-line.is-past {
  color: var(--text-3);
  opacity: 0.75;
}
.lyrics-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  color: var(--text-2);
  font-family: var(--font-display);
  gap: 12px;
  padding: 40px;
  text-align: center;
}
.lyrics-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}
.lyrics-foot {
  padding: 12px 16px;
  font-size: 0.75rem;
  text-align: center;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* ── 背景幕布 ───────────────────────────────────────────────────────────── */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── 空状态 ─────────────────────────────────────────────────────────────── */
.view-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
.empty-state { padding: 40px; }

/* ── 焦点 / 可访问性 ────────────────────────────────────────────────────── */
button:focus-visible,
[role="slider"]:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 错误提示 ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 24px);
  transform: translate(-50%, 16px);
  padding: 12px 20px;
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  max-width: 80vw;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast::before {
  content: "⚠";
  margin-right: 8px;
  color: var(--danger);
}

/* ── 响应式 ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  body.app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "player";
  }
  .icon-btn--menu { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: var(--header-h); bottom: var(--player-h); left: 0;
    width: 86vw; max-width: 320px;
    z-index: 18;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-out);
  }
  .sidebar.is-open { transform: translateX(0); }
  .album-detail { grid-template-columns: 1fr; gap: 24px; }
  .album-detail-art { max-width: 240px; margin: 0 auto; }
  .search { max-width: none; }
  .view { padding: 32px 20px 48px; }
  .rail-track { grid-auto-columns: clamp(150px, 34vw, 200px); gap: 14px; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
}

@media (max-width: 640px) {
  :root { --player-h: 72px; --header-pad: 12px; }
  /* 右侧同样要留出主题按钮的位置(见主规则里的说明) */
  .app-header {
    padding: 0 calc(var(--header-pad) + var(--theme-btn-reserve)) 0 var(--header-pad);
    gap: 8px;
  }
  .brand-sub { display: none; }
  .player {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 0 12px;
  }
  .player-right { display: none; }
  .player-art { width: 44px; height: 44px; }
  .player-title { font-size: 0.85rem; }
  .player-album { font-size: 0.7rem; }
  .time { font-size: 0.65rem; min-width: 32px; }
  .icon-btn--primary { width: 40px; height: 40px; }
  .icon-btn--primary svg { width: 18px; height: 18px; }
  /* 触屏无 hover,隐藏 hover 三角;整行点击播放 */
  .track-num .play-hover { display: none !important; }
}

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

/* ── 主题切换器 ──────────────────────────────────────────────────────────── */
.theme-picker {
  position: fixed;
  /* 回到顶栏右上角。
     注意 z-index 是 11 而不是原来的 50:歌词面板是 30,按钮层级低于它,
     所以歌词弹出时按钮会藏到面板后面,不会压住面板右上角的关闭键
     (位置挪来挪去都没用,根治那次遮挡的是层级)。
     11 同时也低于移动端抽屉 18 与歌词遮罩 25,抽屉/歌词打开时一并收起。 */
  top: calc((var(--header-h) - 36px) / 2);
  right: var(--header-pad);
  z-index: 11;
}
.theme-picker-toggle {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  width: 36px;
  height: 36px;
}
.theme-picker-toggle:hover { background: var(--bg-3); }
.theme-swatches {
  position: absolute;
  /* 按钮在顶栏右上角,色板往下弹 */
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
.theme-picker.is-open .theme-swatches {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-1);
  background: linear-gradient(135deg, var(--sw) 50%, var(--sw-acc) 50%);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active {
  border-color: var(--text-0);
  transform: scale(1.18);
}
