/* =========================================================
 * 流行音乐试听页 · 专用样式
 * 依赖 style.css 的设计变量（--primary / --card-bg 等）
 * ========================================================= */

/* ===== 头部 ===== */
.music-header {
  background: linear-gradient(135deg, #221e19 0%, #3a332a 60%, #57402f 100%);
  color: #fff;
  padding: 56px 20px 48px;
  text-align: center;
}
.music-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.music-header p {
  max-width: 640px;
  margin: 0 auto;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  opacity: 0.93;
}

.music-main {
  max-width: 1080px;
  margin: -28px auto 0;
  padding: 0 20px 60px;
}

/* ===== 播放器大卡片 ===== */
.player-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
  align-items: start;
}

.player-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #f1e9d7, #f7e8e4);
  box-shadow: 0 10px 26px rgba(34, 30, 25, 0.25);
}
.player-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
/* 播放中封面轻微呼吸缩放 */
.player-card.is-playing .player-cover { animation: coverBreath 6s ease-in-out infinite; }
@keyframes coverBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
/* 封面左上角「正在播放」光盘小标 */
.player-disc-holes {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 6px rgba(197, 58, 42, 0.85), 0 2px 8px rgba(0, 0, 0, 0.25);
}
.player-card.is-playing .player-disc-holes { display: block; animation: spin 5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-main { min-width: 0; display: flex; flex-direction: column; }
.player-tag {
  align-self: flex-start;
  font-size: 0.74rem;
  color: #c53a2a;
  background: #f7e8e4;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.player-title {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-artist { color: var(--text-soft); font-size: 0.95rem; margin-bottom: 2px; }
.player-desc { color: var(--text-soft); font-size: 0.86rem; margin-bottom: 14px; }

/* ===== 进度条 ===== */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 14px;
}
.time {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}
.time:last-child { text-align: right; }
.progress {
  position: relative;
  flex: 1;
  height: 18px;              /* 命中区域 */
  cursor: pointer;
  touch-action: none;        /* 拖动时不触发页面滚动 */
  display: flex;
  align-items: center;
  outline: none;
}
.progress::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}
.progress-fill {
  position: relative;
  height: 6px;
  width: 0%;
  border-radius: 3px;
  background: #c53a2a;
  z-index: 1;
}
.progress-knob {
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #c53a2a;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}
.progress:hover .progress-knob,
.progress:focus-visible .progress-knob,
.progress.is-seeking .progress-knob { transform: translateY(-50%) scale(1); }
.progress:focus-visible::before { box-shadow: 0 0 0 3px rgba(197, 58, 42, 0.25); }

/* ===== 控制按钮 ===== */
.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ctrl-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.ctrl-btn:hover { border-color: #c53a2a; color: #c53a2a; transform: translateY(-1px); }
.ctrl-btn svg { width: 20px; height: 20px; fill: currentColor; }
.ctrl-btn.ctrl-small { width: 36px; height: 36px; }
.ctrl-btn.ctrl-small svg { width: 17px; height: 17px; }

.play-main {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: #c53a2a;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(197, 58, 42, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}
.play-main:hover { transform: scale(1.06); box-shadow: 0 10px 24px rgba(197, 58, 42, 0.42); }
.play-main:active { transform: scale(0.97); }
.play-main svg { width: 26px; height: 26px; fill: currentColor; }

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 92px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c53a2a;
  border: none;
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c53a2a;
  border: none;
  cursor: pointer;
}

.player-tip { margin-top: 14px; font-size: 0.78rem; color: var(--text-soft); opacity: 0.85; }
.player-error {
  margin-top: 10px;
  font-size: 0.84rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
}

/* ===== 试听列表 ===== */
.playlist-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-top: 22px;
}
.playlist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.playlist-head h3 { font-size: 1.08rem; }
.playlist-count { font-size: 0.85rem; color: var(--text-soft); font-weight: 400; }
.playlist-note { font-size: 0.8rem; color: var(--text-soft); }
.song-loading { color: var(--text-soft); font-size: 0.92rem; padding: 18px 0; text-align: center; }

.song-list { display: flex; flex-direction: column; gap: 6px; }
.song-row {
  display: grid;
  grid-template-columns: 34px 48px 1fr auto 34px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.song-row:hover { background: #f7f1e4; border-color: #e5ddc8; }
.song-row.playing { background: #f7e8e4; border-color: #c53a2a; }

.song-index {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
/* 播放中的跳动均衡器（替换序号） */
.song-eq {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 2.5px;
  height: 16px;
}
.song-eq i {
  width: 3px;
  border-radius: 1.5px;
  background: #c53a2a;
  animation: eq 0.9s ease-in-out infinite;
}
.song-eq i:nth-child(1) { height: 60%; animation-delay: 0s; }
.song-eq i:nth-child(2) { height: 100%; animation-delay: 0.25s; }
.song-eq i:nth-child(3) { height: 45%; animation-delay: 0.5s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }
.song-row.playing .song-index { display: none; }
.song-row.playing.is-paused .song-eq i { animation-play-state: paused; }
.song-row.playing .song-eq { display: inline-flex; }

.song-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #efe9db;
  display: block;
}
.song-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.song-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-row.playing .song-title { color: #a32a1c; }
.song-sub {
  font-size: 0.78rem;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-duration {
  font-size: 0.8rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.song-state {
  text-align: center;
  font-size: 0.75rem;
  color: #c53a2a;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.song-row.playing .song-state { opacity: 1; }
.song-row.playing.is-paused .song-state { opacity: 0.6; }

.music-note {
  margin-top: 18px;
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: center;
}

/* ===== 移动端底部迷你播放条 ===== */
.mini-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 1200;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.mini-bar.is-visible { transform: translateY(0); }
.mini-progress {
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 2px;
  background: transparent;
}
.mini-progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: #c53a2a;
}
.mini-cover {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #efe9db;
  flex-shrink: 0;
}
.mini-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mini-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-artist {
  font-size: 0.74rem;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-play {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #c53a2a;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mini-play svg { width: 18px; height: 18px; fill: currentColor; }
.mini-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.mini-close:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }

/* 停止/关闭键：朱红描边高亮，与其它控制键区分，一眼可见 */
.ctrl-btn#stopBtn {
  border-color: #c53a2a;
  color: #c53a2a;
  background: rgba(197, 58, 42, 0.06);
}
.ctrl-btn#stopBtn:hover {
  background: #c53a2a;
  color: #fff;
  border-color: #c53a2a;
}

/* ===== 响应式 ===== */
@media (max-width: 760px) {
  .music-main { padding: 0 14px 96px; }   /* 底部给迷你条留空间 */
  /* 迷你播放条出现时，返回按钮上移避免遮挡 */
  .back-fab {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
  .player-card {
    grid-template-columns: 1fr;           /* 封面与信息上下堆叠 */
    gap: 18px;
    padding: 20px 16px;
  }
  .player-cover-wrap { max-width: 300px; margin: 0 auto; }
  .player-title, .player-artist, .player-desc { text-align: center; }
  .player-tag { align-self: center; }
  .controls-row { justify-content: center; }
  .volume-wrap { display: none; }         /* 移动端隐藏音量条（用系统音量） */
  .player-tip { display: none; }          /* 键盘提示只在桌面端展示 */
  .playlist-card { padding: 16px 12px; }
  .song-row {
    grid-template-columns: 30px 42px 1fr auto;
    gap: 10px;
    padding: 8px 8px;
  }
  .song-cover { width: 42px; height: 42px; }
  .song-state { display: none; }
}
