/* ============================================================
   Nebula Music — 科技粒子 × 玻璃拟态音乐播放器
   ============================================================ */

:root {
  --bg-0: #05060f;
  --bg-1: #0a0e24;
  --cyan: #00d4ff;
  --violet: #7c5cff;
  --pink: #ff4d9d;
  --text-1: #eef2ff;
  --text-2: rgba(238, 242, 255, 0.62);
  --text-3: rgba(238, 242, 255, 0.38);
  --glass-bg: rgba(255, 255, 255, 0.055);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.16);
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-card: 0 18px 50px -18px rgba(0, 0, 0, 0.65);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --accent: var(--cyan);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(1000px 700px at -10% 30%, rgba(0, 212, 255, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 60%, #070919);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景粒子画布 ---------- */
#particle-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- 背景光晕 ---------- */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
  animation: glow-float 14s ease-in-out infinite alternate;
}
.bg-glow--1 {
  width: 420px; height: 420px;
  left: -120px; top: 12%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.55), transparent 70%);
}
.bg-glow--2 {
  width: 520px; height: 520px;
  right: -160px; top: 42%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.5), transparent 70%);
  animation-delay: -5s;
}
.bg-glow--3 {
  width: 360px; height: 360px;
  left: 32%; bottom: -140px;
  background: radial-gradient(circle, rgba(255, 77, 157, 0.34), transparent 70%);
  animation-delay: -9s;
}
@keyframes glow-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(40px, -30px, 0) scale(1.12); }
}

/* ---------- 玻璃拟态 ---------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow-card),
    inset 0 1px 0 var(--glass-highlight);
}

/* ---------- 主布局 ---------- */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 44px 24px 150px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}

/* ---------- 卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.music-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out), border-color 0.45s;
  animation: card-in 0.7s var(--ease-out) both;
}
.music-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow:
    0 26px 60px -18px rgba(0, 0, 0, 0.7),
    0 0 34px rgba(0, 212, 255, 0.18),
    inset 0 1px 0 var(--glass-highlight);
}
.music-card:active { transform: translateY(-4px) scale(0.985); }
@keyframes card-in {
  from { opacity: 0; transform: translateY(34px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 卡片顶部的扫描光条 */
.music-card::before {
  content: "";
  position: absolute;
  top: 0; left: -80%;
  width: 60%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.music-card:hover::before { opacity: 0.9; animation: scan 1.4s linear infinite; }
@keyframes scan {
  from { left: -80%; }
  to   { left: 120%; }
}

/* 播放中的卡片 */
.music-card.playing {
  border-color: var(--accent);
  box-shadow:
    0 26px 60px -18px rgba(0, 0, 0, 0.7),
    0 0 44px var(--accent-glow, rgba(0, 212, 255, 0.35)),
    inset 0 1px 0 var(--glass-highlight);
}
.music-card.playing::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1px solid var(--accent);
  opacity: 0;
  animation: card-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes card-pulse {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.045); opacity: 0; }
}

/* 封面 */
.cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  overflow: hidden;
  margin-bottom: 16px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 45%),
    var(--cover-a),
    var(--cover-b);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 12px 28px -12px rgba(0, 0, 0, 0.6);
  transition: transform 0.5s var(--ease-out);
}
.music-card:hover .cover { transform: scale(1.04) rotate(1deg); }
.cover::after {
  /* 网格纹路，强化科技感 */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.35;
}
.cover-note {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  transition: transform 0.8s var(--ease-out);
}
.cover-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 卡片信息 */
.card-info { display: flex; flex-direction: column; gap: 4px; }
.card-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-artist {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 卡片底部：时长 + 播放状态 */
.card-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-duration {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

/* 正在播放指示（卡片内均衡器） */
.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}
.eq i {
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  animation: eq-bounce 1s ease-in-out infinite;
}
.eq i:nth-child(2) { animation-delay: 0.15s; }
.eq i:nth-child(3) { animation-delay: 0.3s; }
.eq i:nth-child(4) { animation-delay: 0.45s; }
.eq.stopped i { animation-play-state: paused; height: 4px !important; }
@keyframes eq-bounce {
  0%, 100% { height: 4px; }
  50%      { height: 16px; }
}

/* ---------- 歌词面板 ---------- */
.lyrics-panel {
  position: sticky;
  top: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 190px);
  overflow: hidden;
  animation: card-in 0.7s var(--ease-out) 0.25s both;
}
.lyrics-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.lyrics-meta { flex: 1; min-width: 0; }
.lyrics-meta h3 {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lyrics-meta p {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lyrics-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 26px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.4) transparent;
}
.lyrics-scroll::-webkit-scrollbar { width: 5px; }
.lyrics-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.35);
  border-radius: 4px;
}
.lyrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  justify-content: center;
}
.lyric-line {
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
  text-align: center;
  transition: color 0.35s, transform 0.35s var(--ease-out), background 0.35s, opacity 0.35s;
  opacity: 0.55;
  transform: scale(0.97);
}
.lyric-line.active {
  color: #fff;
  opacity: 1;
  transform: scale(1.05);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.14), rgba(124, 92, 255, 0.14));
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.25);
  text-shadow: 0 0 18px rgba(0, 212, 255, 0.55);
}
.lyric-line.before { opacity: 0.28; transform: scale(0.95); }
.lyrics-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 30px 0;
}

/* ---------- 底部播放条 ---------- */
.player-bar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(1080px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  border-radius: 20px;
  animation: bar-in 0.8s var(--ease-out) 0.35s both;
}
@keyframes bar-in {
  from { opacity: 0; transform: translate(-50%, 40px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.player-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.player-cover {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--cover-a, #1e2a5a), var(--cover-b, #0b1030));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 20px -8px rgba(0, 0, 0, 0.7);
  transition: transform 0.6s var(--ease-out);
  overflow: hidden;
}
.player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.player-cover.spinning { animation: spin 6s linear infinite; }
.player-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.player-text strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-text span {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.control-buttons { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.icon-btn:hover {
  background: rgba(0, 212, 255, 0.16);
  border-color: rgba(0, 212, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px -6px rgba(0, 212, 255, 0.5);
}
.icon-btn:active { transform: scale(0.92); }

.play-btn {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border: none;
  box-shadow: 0 8px 26px -6px rgba(0, 180, 255, 0.55);
}
.play-btn:hover { background: linear-gradient(135deg, #33e0ff, #9377ff); box-shadow: 0 10px 30px -6px rgba(0, 180, 255, 0.7); }
.icon-pause { display: none; }
.player-bar.playing .icon-play { display: none; }
.player-bar.playing .icon-pause { display: block; }

/* 进度条 */
.progress {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.time {
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  min-width: 38px;
}
.time:first-child { text-align: right; }

/* range 统一样式 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--cyan) var(--fill, 0%), rgba(255, 255, 255, 0.14) var(--fill, 0%));
  outline: none;
  cursor: pointer;
  transition: height 0.2s;
}
input[type="range"]:hover { height: 6px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.8);
  transition: transform 0.2s var(--ease-out);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.3); }
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.8);
}
input[type="range"]::-moz-range-track { background: transparent; }

.player-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
.volume { display: flex; align-items: center; gap: 8px; }
.volume input { width: 90px; min-width: 90px; }

/* 静音按钮：图标切换 */
.btn-mute .icon-muted { display: none; }
.btn-mute.muted .icon-sound { display: none; }
.btn-mute.muted .icon-muted { display: block; }
.btn-mute.muted {
  color: var(--text-3);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

/* 歌词开关激活态 */
.lyrics-toggle.active {
  color: var(--cyan);
  border-color: rgba(0, 212, 255, 0.6);
  background: rgba(0, 212, 255, 0.14);
}

.lyrics-close { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .lyrics-panel {
    position: fixed;
    z-index: 30;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(30px);
    width: min(480px, calc(100% - 32px));
    max-height: 52vh;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out), visibility 0.4s;
  }
  .lyrics-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
  }
  .lyrics-close { display: inline-flex; }

  .player-bar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    bottom: 10px;
  }
  .player-main { order: -1; grid-column: 1 / -1; }
  .player-info { min-width: 0; }
  .player-extra { gap: 10px; }
}

@media (max-width: 560px) {
  .layout { padding: 20px 14px 170px; gap: 20px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .music-card { padding: 12px; }
  .cover { font-size: 40px; margin-bottom: 12px; }
  .card-title { font-size: 15px; }
  .volume { display: none; }
  .player-bar { padding: 10px 14px; border-radius: 18px; }
  .player-cover { width: 44px; height: 44px; font-size: 20px; }
}
