/* ==========================================================================
   NebulaPlayer — 沉浸式电影级音乐播放器
   设计语言：深空底色 · 单一强调色(青 #22d3ee) · 克制动效 · 无卡片堆叠
   ========================================================================== */

:root {
  --bg: #050814;
  --bg-2: #0a0f24;
  --surface: rgba(15, 22, 46, 0.55);
  --surface-strong: rgba(18, 26, 54, 0.82);
  --border: rgba(148, 163, 184, 0.14);
  --text: #e6edf7;
  --text-dim: #8b96b3;
  --text-faint: #5c6a8c;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-ui);
  --header-h: 68px;
  --controls-h: 132px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(34, 211, 238, 0.3);
}

/* ---------- 可视化背景 ---------- */
#visualizer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ==========================================================================
   顶部导航
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: linear-gradient(180deg, rgba(5, 8, 20, 0.82), rgba(5, 8, 20, 0));
  animation: fadeDown 0.7s var(--ease) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.55));
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-accent {
  color: var(--accent);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- 按钮体系 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 10px 18px;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease),
    border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), color 0.18s var(--ease);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 8px 28px rgba(34, 211, 238, 0.18);
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #03121a;
  font-weight: 700;
  box-shadow: 0 8px 26px rgba(34, 211, 238, 0.35);
}

.btn--primary:hover {
  box-shadow: 0 10px 34px rgba(34, 211, 238, 0.5);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
}

.btn--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

.btn--icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.btn--icon.on {
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
}

.btn--play {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #03121a;
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.14), 0 14px 40px rgba(34, 211, 238, 0.45);
}

.btn--play svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.btn--play.playing {
  animation: pulseGlow 2.4s ease-in-out infinite;
}

.btn--circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
}

.btn--circle svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.btn--speed {
  min-width: 52px;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   中央舞台
   ========================================================================== */
.stage {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-h) + 20px) 24px calc(var(--controls-h) + 28px);
  text-align: center;
}

/* 唱片 */
.disc {
  position: relative;
  width: min(340px, 54vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 40%),
    conic-gradient(from 0deg, #10162e, #1a2342, #10162e, #1c2548, #10162e);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(34, 211, 238, 0.16),
    inset 0 0 0 2px rgba(148, 163, 184, 0.12);
  overflow: hidden;
  animation: fadeUp 0.9s var(--ease) both 0.1s;
  transition: box-shadow 0.4s var(--ease);
}

.disc::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px);
}

.disc-cover {
  position: absolute;
  inset: 15%;
  width: 70%;
  height: 70%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.disc:not(.disc--plain) .disc-cover {
  opacity: 1;
}

.disc--plain::after {
  content: "";
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  z-index: 1;
  background:
    radial-gradient(circle at 35% 32%, rgba(34, 211, 238, 0.35), transparent 45%),
    radial-gradient(circle at 70% 70%, rgba(167, 139, 250, 0.4), transparent 50%),
    linear-gradient(135deg, #0b1130, #141b45);
  box-shadow: inset 0 0 40px rgba(34, 211, 238, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.disc--plain::before {
  content: "♪";
  position: absolute;
  inset: 15%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: rgba(230, 237, 247, 0.55);
}

.disc-hole {
  position: absolute;
  inset: 45%;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, #0a0f22 55%, #1a2342 100%);
  z-index: 3;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9);
}

.disc.spin {
  animation: spin 22s linear infinite;
}

.disc.spin.paused {
  animation-play-state: paused;
}

/* 元信息 */
.meta {
  margin-top: 40px;
  max-width: 640px;
  animation: fadeUp 0.9s var(--ease) both 0.22s;
}

.meta-title {
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-artist {
  margin-top: 10px;
  font-size: clamp(15px, 2vw, 18px);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.meta-album {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
}

.empty-hint {
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  animation: fadeUp 0.9s var(--ease) both 0.34s;
}

.empty-hint.hidden {
  display: none;
}

/* ==========================================================================
   面板（歌词 / 播放列表）
   ========================================================================== */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(380px, 92vw);
  background: var(--surface-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.45s var(--ease);
}

.panel.show {
  transform: translateX(0);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* 歌词 */
.lyrics-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 26px 20px 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 211, 238, 0.3) transparent;
}

.lyric-line {
  font-size: 17px;
  line-height: 1.9;
  color: var(--text-faint);
  transition: color 0.35s var(--ease), transform 0.35s var(--ease), opacity 0.35s var(--ease);
  opacity: 0.5;
}

.lyric-line.active {
  color: var(--text);
  font-weight: 700;
  font-size: 19px;
  opacity: 1;
  transform: translateX(6px);
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.45);
}

.lyrics-empty {
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1.8;
}

/* 播放列表 */
.playlist {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 12px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 211, 238, 0.3) transparent;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.track-item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.track-item.active {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.14), transparent 70%);
}

.track-no {
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  width: 24px;
}

.track-item.active .track-no {
  color: var(--accent);
  font-weight: 700;
}

.track-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.track-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-sub {
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-del {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.track-del:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}

/* ==========================================================================
   底部控制栏
   ========================================================================== */
.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 14px 28px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(5, 8, 20, 0.88), rgba(5, 8, 20, 0));
  animation: fadeUp 0.9s var(--ease) both 0.3s;
}

.controls-row {
  display: flex;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
}

.controls-row--seek {
  gap: 14px;
  margin-bottom: 16px;
}

.time {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: center;
}

.seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), rgba(148, 163, 184, 0.22) var(--fill, 0%));
  outline: none;
  cursor: pointer;
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.7);
  transition: transform 0.15s var(--ease);
}

.seek::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.7);
}

.controls-row--main {
  justify-content: space-between;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ctrl-group--center {
  gap: 18px;
}

.volume {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--vfill, 80%), rgba(148, 163, 184, 0.22) var(--vfill, 80%));
  outline: none;
  cursor: pointer;
}

.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

.volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

/* ==========================================================================
   拖放遮罩
   ========================================================================== */
.dropzone {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.dropzone.show {
  opacity: 1;
  pointer-events: auto;
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 80px;
  border: 2px dashed rgba(34, 211, 238, 0.55);
  border-radius: 24px;
  background: rgba(10, 15, 36, 0.6);
  animation: dropPulse 1.6s ease-in-out infinite;
}

.dropzone-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-icon svg {
  width: 38px;
  height: 38px;
  fill: var(--accent);
}

.dropzone-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.dropzone-sub {
  font-size: 13px;
  color: var(--text-dim);
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--controls-h) + 24px);
  z-index: 60;
  transform: translate(-50%, 16px);
  background: rgba(20, 28, 58, 0.92);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

/* ==========================================================================
   动画
   ========================================================================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.14), 0 14px 40px rgba(34, 211, 238, 0.45);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(34, 211, 238, 0.08), 0 14px 48px rgba(34, 211, 238, 0.6);
  }
}

@keyframes dropPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.015);
  }
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 720px) {
  :root {
    --controls-h: 148px;
  }

  .topbar {
    padding: 0 16px;
  }

  .brand-name {
    font-size: 18px;
  }

  .actions .btn--ghost {
    display: none;
  }

  .stage {
    padding: calc(var(--header-h) + 8px) 16px calc(var(--controls-h) + 16px);
  }

  .disc {
    width: min(250px, 62vw);
  }

  .meta {
    margin-top: 28px;
  }

  .controls {
    padding: 10px 14px 16px;
  }

  .ctrl-group--left {
    display: none;
  }

  .volume {
    width: 60px;
  }
}

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