/* ============================================================
   歌唱合集 · 样式 v5
   风格：沿用站内 music-ball.css（毛玻璃 + 蓝色主调）
   暗色：html[data-theme='dark']
   结构：0 变量/图标  1 概览与工具栏  2 列表卡片  3 牌堆
         4 底部播放条  5 提示/杂项  6 暗色  7 窄屏/动效
   ============================================================ */

/* ============================================================
   0. 变量 & 图标
   ============================================================ */
.sd,
.sd-dock,
.sd-toast {
  --accent: #2563eb;
  --main-2: #60a5fa;
  --soft: rgba(37, 99, 235, 0.08);
  --soft-2: rgba(37, 99, 235, 0.14);
  --line: rgba(59, 130, 246, 0.18);
  --line-strong: rgba(59, 130, 246, 0.42);
  --text: #1f2937;
  --sub: #6b7280;
  --faint: #9ca3af;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-solid: rgba(255, 255, 255, 0.95);
  --dock-bg: rgba(255, 255, 255, 0.93);
  --wave-on: #2563eb;
  --wave-off: rgba(37, 99, 235, 0.2);
  --heart: #f43f5e;
  --btn-grad: linear-gradient(135deg, #60a5fa, #2563eb);
  --btn-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);

  /* 图标（mask 方式，颜色跟随 currentColor） */
  --i-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M8 5.2v13.6a1 1 0 0 0 1.52.85l11-6.8a1 1 0 0 0 0-1.7l-11-6.8A1 1 0 0 0 8 5.2z'/%3E%3C/svg%3E");
  --i-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='black'%3E%3Crect x='6' y='4.5' width='4' height='15' rx='1.3'/%3E%3Crect x='14' y='4.5' width='4' height='15' rx='1.3'/%3E%3C/g%3E%3C/svg%3E");
  --i-prev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='black'%3E%3Crect x='5' y='5' width='2.4' height='14' rx='1'/%3E%3Cpath d='M19.5 6.2v11.6a.9.9 0 0 1-1.4.74l-8.3-5.8a.9.9 0 0 1 0-1.48l8.3-5.8a.9.9 0 0 1 1.4.74z'/%3E%3C/g%3E%3C/svg%3E");
  --i-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='black'%3E%3Crect x='16.6' y='5' width='2.4' height='14' rx='1'/%3E%3Cpath d='M4.5 6.2v11.6a.9.9 0 0 0 1.4.74l8.3-5.8a.9.9 0 0 0 0-1.48L5.9 5.46a.9.9 0 0 0-1.4.74z'/%3E%3C/g%3E%3C/svg%3E");
  --i-heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' d='M12 20.2S4 15.4 4 9.6A4.4 4.4 0 0 1 12 7.3a4.4 4.4 0 0 1 8 2.3c0 5.8-8 10.6-8 10.6z'/%3E%3C/svg%3E");
  --i-heart-f: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='black' stroke-width='2' stroke-linejoin='round' d='M12 20.2S4 15.4 4 9.6A4.4 4.4 0 0 1 12 7.3a4.4 4.4 0 0 1 8 2.3c0 5.8-8 10.6-8 10.6z'/%3E%3C/svg%3E");
  --i-shuffle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7h3.2c1.9 0 3.1.9 4.1 2.4l3.4 5.2c1 1.5 2.2 2.4 4.1 2.4H21'/%3E%3Cpath d='M3 17h3.2c1.3 0 2.3-.4 3.1-1.2M13.6 8.6c.9-1 1.9-1.6 3.3-1.6H21'/%3E%3Cpath d='M18 4l3 3-3 3M18 14l3 3-3 3'/%3E%3C/g%3E%3C/svg%3E");
  --i-seq: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3l3 3-3 3'/%3E%3Cpath d='M4 11V10a4 4 0 0 1 4-4h12'/%3E%3Cpath d='M7 21l-3-3 3-3'/%3E%3Cpath d='M20 13v1a4 4 0 0 1-4 4H4'/%3E%3C/g%3E%3C/svg%3E");
  --i-one: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3l3 3-3 3'/%3E%3Cpath d='M4 11V10a4 4 0 0 1 4-4h12'/%3E%3Cpath d='M7 21l-3-3 3-3'/%3E%3Cpath d='M20 13v1a4 4 0 0 1-4 4H4'/%3E%3Cpath d='M11 10.6l1.6-1.1v5.4'/%3E%3C/g%3E%3C/svg%3E");
  --i-list: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M9 6h11M9 12h11M9 18h11'/%3E%3Cpath d='M4.2 6h.01M4.2 12h.01M4.2 18h.01' stroke-width='2.6'/%3E%3C/g%3E%3C/svg%3E");
  --i-stack: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Crect x='4' y='8' width='14' height='12' rx='2.5'/%3E%3Cpath d='M8 4.5h9.5A2.5 2.5 0 0 1 20 7v8'/%3E%3C/g%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/g%3E%3C/svg%3E");
  --i-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  --i-dl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7.5 10.5L12 15l4.5-4.5'/%3E%3Cpath d='M5 19.5h14'/%3E%3C/g%3E%3C/svg%3E");
  --i-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1'/%3E%3Cpath d='M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1'/%3E%3C/g%3E%3C/svg%3E");
  --i-more: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='black'%3E%3Ccircle cx='5.5' cy='12' r='1.9'/%3E%3Ccircle cx='12' cy='12' r='1.9'/%3E%3Ccircle cx='18.5' cy='12' r='1.9'/%3E%3C/g%3E%3C/svg%3E");
}

.sd-i {
  display: inline-block;
  flex: none;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.22em;
  background: currentColor;
  -webkit-mask-image: var(--i);
  mask-image: var(--i);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.i-play { --i: var(--i-play); }
.i-pause { --i: var(--i-pause); }
.i-prev { --i: var(--i-prev); }
.i-next { --i: var(--i-next); }
.i-heart { --i: var(--i-heart); }
.i-shuffle { --i: var(--i-shuffle); }
.i-seq { --i: var(--i-seq); }
.i-one { --i: var(--i-one); }
.i-list { --i: var(--i-list); }
.i-stack { --i: var(--i-stack); }
.i-search { --i: var(--i-search); }
.i-close { --i: var(--i-close); }
.i-dl { --i: var(--i-dl); }
.i-link { --i: var(--i-link); }
.i-more { --i: var(--i-more); }

/* 通用按钮重置：避免被主题的 button / a 样式带偏 */
.sd button,
.sd-dock button,
.sd-toast {
  box-sizing: border-box;
  margin: 0;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.sd button,
.sd-dock button {
  cursor: pointer;
  outline: none;
}

.sd button:focus-visible,
.sd-dock button:focus-visible,
.sd .sd-seek:focus-visible,
.sd-dock .sd-seek:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sd a.sd-act,
.sd a.sd-act:hover {
  border-bottom: 0 !important;
  text-decoration: none !important;
}

[hidden].sd-empty,
.sd [hidden] {
  display: none !important;
}

/* ============================================================
   1. 概览条 & 工具栏
   ============================================================ */
.song-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 14px 0 14px !important;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.12), rgba(37, 99, 235, 0.06));
  border: 1px solid rgba(59, 130, 246, 0.16);
}

.song-summary b {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.song-summary .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.35);
}

/* “继续听”：只在有上次进度时出现 */
.sd-resume {
  margin-left: auto !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.2s;
}

.sd-resume:hover {
  background: var(--soft-2);
}

.sd-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px !important;
}

.sd-search {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin: 0 !important;
  padding: 0 8px 0 13px;
  border-radius: 999px;
  color: var(--sub);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sd-search:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.sd-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--text) !important;
  font: inherit;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}

.sd-search input::placeholder {
  color: var(--faint);
}

.sd-search input::-webkit-search-cancel-button,
.sd-search input::-webkit-search-decoration {
  -webkit-appearance: none;
  display: none;
}

.sd-clear {
  flex: none;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  font-size: 14px;
  color: var(--sub);
  background: transparent;
}

.sd-clear:hover {
  background: var(--soft);
  color: var(--accent);
}

/* 分段开关：列表 / 牌堆 */
.sd-seg {
  flex: none;
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.sd-seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
  background: transparent;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.sd-seg button.is-on {
  color: var(--accent);
  background: var(--glass-solid);
  box-shadow: 0 1px 5px rgba(37, 99, 235, 0.2);
}

.sd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  margin: 0 0 12px !important;
}

.sd-chips {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 7px;
  padding: 3px;
  margin: -3px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.sd-chips::-webkit-scrollbar {
  display: none;
}

.sd-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--sub);
  background: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sd-chip em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.sd-chip:hover {
  background: var(--soft);
}

.sd-chip.is-on {
  color: var(--accent);
  background: var(--soft-2);
  border-color: var(--line-strong);
}

.sd-chip-fav.is-on {
  color: var(--heart);
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.38);
}

.sd-acts {
  flex: none;
  display: flex;
  gap: 8px;
}

.sd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent);
  background: var(--soft);
  transition: background 0.2s, transform 0.2s;
}

.sd-btn:hover {
  background: var(--soft-2);
}

.sd-btn:active {
  transform: scale(0.97);
}

.sd-btn-main {
  color: #fff;
  border-color: transparent;
  background: var(--btn-grad);
  box-shadow: var(--btn-shadow);
}

.sd-btn-main:hover {
  background: var(--btn-grad);
  filter: brightness(1.06);
}

.sd-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 10px !important;
  font-size: 12px;
  color: var(--sub);
}

.sd-status button {
  border: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sd-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px !important;
  padding: 34px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--sub);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
}

.sd-empty button {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--soft);
}

/* ============================================================
   2. 列表卡片
   ============================================================ */
.song-list {
  margin: 6px 0 0;
}

.song-card {
  position: relative;
  scroll-margin-top: 84px;
  margin: 0 0 14px !important;
  padding: 14px 18px 8px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  transition:
    transform 0.28s cubic-bezier(0.25, 1, 0.5, 1),
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background 0.28s ease;
  overflow: hidden;
}

.song-card[hidden] {
  display: none !important;
}

.song-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  height: 76%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  opacity: 0.5;
  transition: opacity 0.28s ease, height 0.28s ease, top 0.28s ease;
}

@media (hover: hover) {
  .song-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.14);
  }

  .song-card:hover::before {
    opacity: 1;
    top: 4%;
    height: 92%;
  }
}

/* 正在播的那张：左侧色条拉满，边框加深 */
.song-card.is-cur {
  border-color: var(--line-strong);
  background: var(--glass-solid);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.14);
}

.song-card.is-cur::before {
  opacity: 1;
  top: 0;
  height: 100%;
  border-radius: 0;
}

/* 通过 #song-N 链接进来时，闪一下提示位置 */
.song-card.is-target {
  animation: sd-target 1.6s ease-out 1;
}

.song-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px !important;
  flex-wrap: wrap;
}

.song-idx {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--soft);
  border: 1px solid var(--line-strong);
  user-select: none;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.song-idx::before {
  content: attr(data-n);
}

.song-card.is-cur .song-idx {
  color: #fff;
  background: var(--btn-grad);
  border-color: transparent;
}

/* 播放中：序号换成跳动的均衡器 */
.eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}

.eq i {
  display: block;
  width: 2.5px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 50% 100%;
  animation: sd-eq 0.9s ease-in-out infinite;
}

.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }

.song-card.is-playing .song-idx::before,
.stack-card.is-playing .stack-idx::before {
  content: none;
}

.song-card.is-playing .eq {
  display: inline-flex;
}

.song-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.song-by {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* 播放行：播放键 + 声纹进度 + 时间 */
.song-player {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 2px !important;
}

.sd-play {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 18px;
  color: #fff;
  background: var(--btn-grad);
  box-shadow: var(--btn-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.sd-play .sd-i {
  margin-left: 1px;
  vertical-align: 0;
}

.sd-play:hover {
  transform: scale(1.06);
}

.sd-play:active {
  transform: scale(0.95);
}

.song-card.is-playing .sd-play .sd-i,
.stack-card.is-playing .sd-play .sd-i {
  --i: var(--i-pause);
  margin-left: 0;
}

/* 缓冲中：播放键外圈转圈 */
.is-loading .sd-play::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--main-2);
  animation: sd-rot 0.8s linear infinite;
}

/* 声纹进度条（同时也是拖动条） */
@property --p {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}

.sd-seek {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  cursor: pointer;
  touch-action: pan-y;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  transition: --p 0.28s linear;
}

.sd-seek.is-scrub {
  transition: none;
}

.sd-wave {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--wave-on) 0,
    var(--wave-on) var(--p, 0%),
    var(--wave-off) var(--p, 0%),
    var(--wave-off) 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  transition: filter 0.2s;
}

/* 没有载入声纹时的兜底 */
.sd-wave:not([style]) {
  border-radius: 3px;
  background-size: 100% 4px;
  background-repeat: no-repeat;
  background-position: center;
}

.sd-seek:hover .sd-wave {
  filter: brightness(1.12) saturate(1.1);
}

.sd-head {
  position: absolute;
  top: 50%;
  left: var(--p, 0%);
  width: 2px;
  height: calc(100% + 4px);
  border-radius: 2px;
  background: var(--accent);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.is-cur .sd-seek .sd-head,
.sd-seek:hover .sd-head,
.sd-seek.is-scrub .sd-head {
  opacity: 0.9;
}

.sd-time {
  flex: none;
  min-width: 76px;
  text-align: right;
  font-size: 12px;
  line-height: 1.2;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.sd-time .t-cur {
  font-weight: 600;
  color: var(--text);
}

.sd-time .t-dur::before {
  content: " / ";
  opacity: 0.6;
}

.song-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 4px !important;
  font-size: 12px;
  color: var(--sub);
  line-height: 1.6;
}

.song-meta i {
  font-style: normal;
  opacity: 0.85;
}

.song-meta .sd-i {
  opacity: 1;
}

.song-acts {
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
}

.sd-act {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 16px;
  color: var(--sub) !important;
  background: transparent;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.sd-act .sd-i {
  vertical-align: 0;
}

.sd-act:hover {
  color: var(--accent) !important;
  background: var(--soft);
}

.sd-fav.is-on {
  color: var(--heart) !important;
}

.sd-fav.is-on .sd-i {
  --i: var(--i-heart-f);
}

.sd-fav.is-pop .sd-i {
  animation: sd-pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* ============================================================
   3. 牌堆
   ============================================================ */
.song-stack {
  margin: 0 0 10px;
  user-select: none;
  -webkit-user-select: none;
}

.song-stack[hidden] {
  display: none !important;
}

.stack-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}

.stack-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.stack-count b {
  color: var(--accent);
  font-size: 16px;
}

.stack-nav {
  display: inline-flex;
  gap: 4px;
}

.stack-nav .sd-act {
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--accent) !important;
}

/* 舞台：给右侧露出的牌留位置 */
.stack-stage {
  position: relative;
  height: 330px;
  margin: 0 0 0 8px;
  /* 竖向滚动交给浏览器，横向滑动交给 JS */
  touch-action: pan-y;
}

.stack-card {
  --h: 215;
  position: absolute;
  left: 0;
  top: 0;
  padding: 16px 18px 10px;
  box-sizing: border-box;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(
    155deg,
    hsl(var(--h) 100% 96% / 0.985),
    rgba(255, 255, 255, 0.975) 62%
  );
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  transform-origin: 50% 60%;
  will-change: transform, opacity;
  transition:
    transform 0.42s cubic-bezier(0.19, 1.4, 0.4, 1),
    opacity 0.34s ease,
    box-shadow 0.34s ease;
  cursor: grab;
  touch-action: pan-y;
}

.stack-card > * {
  transition: opacity 0.3s ease;
}

/* 叠在后面的牌只露出“封套”，内容淡出，避免文字透出来 */
.stack-card:not(.is-top) > * {
  opacity: 0;
}

.stack-card.rebound {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.stack-card.dragging {
  transition: none !important;
  cursor: grabbing;
  box-shadow: 0 18px 44px rgba(37, 99, 235, 0.24);
}

.stack-card.is-top {
  z-index: 10;
}

.stack-card.fly-out {
  transition:
    transform 0.42s cubic-bezier(0.4, 0, 1, 0.6),
    opacity 0.42s ease;
  opacity: 0 !important;
  pointer-events: none;
}

.stack-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

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

.stack-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-card .stack-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--soft);
  border: 1px solid var(--line-strong);
}

.stack-card .stack-idx::before {
  content: attr(data-n);
}

.stack-card.is-playing .eq {
  display: inline-flex;
}

.stack-card.is-cur .stack-idx {
  color: #fff;
  background: var(--btn-grad);
  border-color: transparent;
}

.stack-card .stack-by {
  display: inline-block;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.stack-card .stack-title {
  margin: 12px 0 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stack-card .song-player {
  margin: 14px 0 0 !important;
}

.stack-card .stack-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-strong);
  font-size: 12px;
  color: var(--sub);
}

.stack-card .stack-meta i {
  font-style: normal;
  opacity: 0.85;
}

.stack-hint {
  margin-top: 14px;
  font-size: 12px;
  text-align: center;
  color: var(--faint);
  letter-spacing: 0.02em;
}

/* ---------- 唱片：播放时转动 ---------- */
.sd-disc {
  --h: 215;
  position: relative;
  flex: none;
  display: block;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0b1220 0 5%, transparent 5.6%),
    radial-gradient(
      circle at 50% 50%,
      hsl(var(--h) 85% 64%) 0 22%,
      hsl(var(--h) 80% 44%) 22.5% 31%,
      transparent 31.6%
    ),
    conic-gradient(
      from 20deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.26) 11%,
      rgba(255, 255, 255, 0) 24%,
      rgba(255, 255, 255, 0) 50%,
      rgba(255, 255, 255, 0.2) 61%,
      rgba(255, 255, 255, 0) 74%
    ),
    repeating-radial-gradient(circle at 50% 50%, #1b2230 0 1.2px, #0f141d 1.2px 2.6px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.3);
  animation: sd-spin 4.2s linear infinite;
  animation-play-state: paused;
  cursor: pointer;
}

/* 标签上的小白点：让转动肉眼可见 */
.sd-disc::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  transform: translate(0, -19px);
}

.is-playing .sd-disc,
.sd-dock.is-playing .sd-disc {
  animation-play-state: running;
}

.sd-disc-s {
  width: 42px;
  height: 42px;
  cursor: inherit;
}

.sd-disc-s::after {
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  transform: translate(0, -9px);
}

/* ============================================================
   4. 底部播放条
   ============================================================ */
.sd-dock {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sd-bottom, 14px) + env(safe-area-inset-bottom, 0px));
  z-index: 99;
  box-sizing: border-box;
  width: min(620px, calc(100vw - 24px));
  padding: 12px 12px 10px;
  border-radius: 20px;
  background: var(--dock-bg);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  color: var(--text);
  transform: translate(-50%, 28px);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.15), opacity 0.25s ease;
}

.sd-dock[hidden] {
  display: none;
}

.sd-dock.is-show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* 贴在顶边的细进度线 */
.sd-seek-line {
  position: absolute;
  left: 20px;
  right: 20px;
  top: -8px;
  height: 18px;
}

.sd-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 3px;
  background: var(--wave-off);
  overflow: hidden;
  transition: height 0.15s, margin-top 0.15s;
}

.sd-line::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--main-2), var(--accent));
}

.sd-seek-line:hover .sd-line,
.sd-seek-line.is-scrub .sd-line {
  height: 5px;
  margin-top: -2.5px;
}

.sd-seek-line .sd-head {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.5);
}

.sd-seek-line:hover .sd-head,
.sd-seek-line.is-scrub .sd-head,
.sd-seek-line:focus-visible .sd-head {
  opacity: 1;
}

.sd-dock .is-cur .sd-head,
.sd-dock .sd-head {
  opacity: 0;
}

.sd-dock .sd-seek-line:hover .sd-head,
.sd-dock .sd-seek-line.is-scrub .sd-head,
.sd-dock .sd-seek-line:focus-visible .sd-head {
  opacity: 1;
}

.sd-dock-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sd-dock-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  text-align: left;
  color: inherit;
  background: none;
}

.sd-dock-txt {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}

.d-title,
.d-sub {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.d-sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

.sd-dock-ctrl,
.sd-dock-side {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.sd-ibtn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 18px;
  color: var(--text);
  background: transparent;
  transition: background 0.2s, transform 0.2s, color 0.2s;
}

.sd-ibtn .sd-i {
  vertical-align: 0;
}

.sd-ibtn:hover {
  background: var(--soft);
}

.sd-ibtn:active {
  transform: scale(0.92);
}

.sd-ibtn-play {
  width: 42px;
  height: 42px;
  margin: 0 2px;
  color: #fff;
  background: var(--btn-grad);
  box-shadow: var(--btn-shadow);
}

.sd-ibtn-play:hover {
  background: var(--btn-grad);
  filter: brightness(1.06);
}

.sd-dock.is-playing [data-act="toggle"] .sd-i {
  --i: var(--i-pause);
}

.sd-dock.is-loading .sd-ibtn-play {
  position: relative;
}

.sd-dock.is-loading .sd-ibtn-play::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--main-2);
  animation: sd-rot 0.8s linear infinite;
}

.sd-ibtn[aria-expanded="true"] {
  background: var(--soft-2);
  color: var(--accent);
}

.sd-ibtn.has-badge {
  position: relative;
}

.sd-ibtn.has-badge::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--dock-bg);
}

/* 设置浮层 */
.sd-pop {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 10px);
  width: min(330px, calc(100vw - 40px));
  box-sizing: border-box;
  padding: 14px 14px 10px;
  border-radius: 16px;
  background: var(--dock-bg);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  transform-origin: 100% 100%;
  animation: sd-pop-in 0.2s ease-out;
}

.sd-pop[hidden] {
  display: none;
}

.sd-pop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sd-pop-row > span {
  flex: none;
  width: 32px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
}

.sd-pop-opts {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sd-pop-opts button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  background: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sd-pop-opts button:hover {
  background: var(--soft);
}

.sd-pop-opts button.is-on {
  color: var(--accent);
  background: var(--soft-2);
  border-color: var(--line-strong);
}

.sd-pop-note {
  display: block;
  margin: -4px 0 8px 42px;
  font-size: 11px;
  color: var(--sub);
}

.sd-pop-note:empty {
  display: none;
}

.sd-pop-vol input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
}

.sd-pop-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  margin-top: 2px !important;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  background: transparent;
}

.sd-pop-stop:hover {
  color: var(--heart);
}

/* ============================================================
   5. 提示 / 杂项
   ============================================================ */
.sd-toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  max-width: 80vw;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: #fff;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.sd-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

html.sd-dock-on .sd-toast {
  bottom: calc(var(--sd-bottom, 14px) + 84px + env(safe-area-inset-bottom, 0px));
}

/* 窄屏时把主题右下角的悬浮按钮（Butterfly #rightside）抬高，避免被播放条盖住 */
@media screen and (max-width: 900px) {
  html.sd-dock-on #rightside {
    bottom: 96px !important;
  }
}

@keyframes sd-spin { to { transform: rotate(360deg); } }
@keyframes sd-rot { to { transform: rotate(360deg); } }
@keyframes sd-eq {
  0%, 100% { transform: scaleY(0.28); }
  50% { transform: scaleY(1); }
}
@keyframes sd-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
@keyframes sd-pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes sd-target {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55); }
  100% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); }
}

/* ============================================================
   6. 暗色
   ============================================================ */
html[data-theme='dark'] .sd,
html[data-theme='dark'] .sd-dock,
html[data-theme='dark'] .sd-toast {
  --accent: #93c5fd;
  --soft: rgba(96, 165, 250, 0.1);
  --soft-2: rgba(96, 165, 250, 0.18);
  --line: rgba(96, 165, 250, 0.2);
  --line-strong: rgba(96, 165, 250, 0.42);
  --text: #e5e7eb;
  --sub: #9ca3af;
  --faint: #6b7280;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-solid: rgba(255, 255, 255, 0.11);
  --dock-bg: rgba(30, 33, 41, 0.93);
  --wave-on: #60a5fa;
  --wave-off: rgba(147, 197, 253, 0.2);
  --heart: #fb7185;
}

html[data-theme='dark'] .song-card {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

html[data-theme='dark'] .song-card.is-cur {
  background: rgba(96, 165, 250, 0.09);
  box-shadow: 0 8px 26px rgba(37, 99, 235, 0.22);
}

html[data-theme='dark'] .song-summary {
  color: #d1d5db;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.14), rgba(37, 99, 235, 0.05));
  border-color: rgba(96, 165, 250, 0.2);
}

html[data-theme='dark'] .song-summary .dot {
  background: rgba(147, 197, 253, 0.4);
}

html[data-theme='dark'] .stack-card {
  background: linear-gradient(
    155deg,
    hsl(var(--h) 45% 21% / 0.985),
    rgba(34, 37, 46, 0.975) 66%
  );
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'] .sd-dock {
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
}

html[data-theme='dark'] .sd-seg button.is-on {
  box-shadow: none;
}

/* ============================================================
   7. 窄屏 / 减少动效
   ============================================================ */
@media screen and (max-width: 768px) {
  .sd-search input {
    font-size: 16px; /* iOS 小于 16px 会在聚焦时自动放大页面 */
  }

  .song-card {
    padding: 12px 14px 6px 14px;
    border-radius: 14px;
  }

  .song-title {
    font-size: 15px;
  }

  .song-by {
    margin-left: 0;
    font-size: 11px;
  }

  .song-head {
    gap: 8px;
  }

  .song-player {
    gap: 10px;
  }

  .sd-time {
    min-width: 70px;
    font-size: 11px;
  }

  .song-meta {
    gap: 4px 10px;
    font-size: 11px;
  }

  .sd-row {
    flex-wrap: wrap;
  }

  .sd-chips {
    flex: 1 1 100%;
  }

  .sd-acts {
    flex: 1 1 100%;
  }

  .sd-acts .sd-btn-main {
    flex: 1 1 auto;
  }

  .stack-stage {
    height: 320px;
    margin-left: 4px;
  }

  .stack-card {
    padding: 14px 14px 8px;
    border-radius: 18px;
  }

  .stack-card .stack-title {
    font-size: 19px;
    margin-top: 10px;
  }

  .sd-disc {
    width: 78px;
    height: 78px;
  }

  .sd-disc::after {
    transform: translate(0, -16px);
  }

  .sd-disc-s {
    width: 42px;
    height: 42px;
  }

  .sd-disc-s::after {
    transform: translate(0, -9px);
  }

  .song-summary .dot {
    display: none;
  }

  .song-summary .sd-resume {
    flex: 1 1 100%;
    justify-content: center;
    margin-left: 0 !important;
  }
}

@media (pointer: coarse) {
  .sd-act {
    width: 36px;
    height: 36px;
  }

  .sd-pop-vol {
    display: none;
  }
}

@media screen and (max-width: 560px) {
  .sd-dock {
    padding: 12px 10px 8px;
  }

  .sd-dock-side [data-act="mode"] {
    display: none;
  }
}

@media screen and (max-width: 380px) {
  .sd-dock .sd-disc-s {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .song-card,
  .song-card::before,
  .stack-card,
  .sd-dock,
  .sd-seek,
  .sd-wave {
    transition: none !important;
  }

  .song-card:hover {
    transform: none;
  }

  .sd-disc,
  .eq i,
  .song-card.is-target,
  .sd-pop {
    animation: none !important;
  }

  .eq i {
    transform: scaleY(0.7);
  }
}
