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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  /* 启用 GPU 合成，减少主线程负担 */
  -webkit-font-smoothing: antialiased;
  transform: translateZ(0);
}

.bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  z-index: -1;
}

.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 播放器卡片 */
.player-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  /* 限定合成层，避免整页重绘 */
  contain: layout style;
}

/* 黑胶唱片 */
.vinyl {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a1a2e 30%, #0f0f1e 70%);
  border: 3px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s;
  will-change: transform;
  transform: translateZ(0);
}

.vinyl.playing {
  animation: spin 4s linear infinite;
  border-color: rgba(255,255,255,0.3);
}

.vinyl-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e94560, #f27121);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-label {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
}

@keyframes spin {
  from { transform: rotate(0deg) translateZ(0); }
  to { transform: rotate(360deg) translateZ(0); }
}

/* 信息 */
.info { text-align: center; }
.info h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; }
.info p { font-size: 0.9rem; opacity: 0.6; }

/* 进度条 */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-size: 0.8rem;
  opacity: 0.8;
}

#progress {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  outline: none;
  cursor: pointer;
}

#progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e94560;
}

/* 控制按钮 */
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.controls button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.controls button:hover { opacity: 1; }

.play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e94560, #f27121) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem !important;
  opacity: 1 !important;
}

/* 音量 */
.volume-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 0.9rem;
}

#volume {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  outline: none;
}

#volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e94560;
}

/* 播放列表 */
.playlist-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 20px;
  contain: layout style;
}

.playlist-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  opacity: 0.8;
}

/* 搜索框 */
.search-wrap {
  margin-bottom: 12px;
}

#search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

#search::placeholder { color: rgba(255,255,255,0.35); }

#search:focus {
  border-color: rgba(233,69,96,0.6);
  background: rgba(255,255,255,0.1);
}

#playlist {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  /* 移动端流畅滚动 */
  -webkit-overflow-scrolling: touch;
}

#playlist li {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.9rem;
}

#playlist li:hover {
  background: rgba(255,255,255,0.1);
}

#playlist li.active {
  background: rgba(233,69,96,0.3);
  color: #f27121;
}

#playlist li.hidden {
  display: none;
}

/* 无结果提示 */
.no-result {
  padding: 14px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.5;
}

/* 滚动条 */
#playlist::-webkit-scrollbar { width: 4px; }
#playlist::-webkit-scrollbar-track { background: transparent; }
#playlist::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

@media (max-width: 480px) {
  .app { padding: 20px 12px; }
  .vinyl { width: 140px; height: 140px; }
}

/* 弱设备降级：关闭模糊背景，避免严重卡顿 */
@media (prefers-reduced-motion: reduce) {
  .vinyl { animation: none !important; }
}

/* ===== 滚动歌词面板 ===== */
.lyric-panel {
  width: 100%;
  height: 110px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
  position: relative;
  /* 渐隐遮罩：上下淡出，视觉更精致 */
  mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
}

.lyric-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 44px 14px; /* 上下留白，让当前行居中 */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.9;
}

.lyric-scroll::-webkit-scrollbar { width: 0; }

.lyric-line {
  color: rgba(255,255,255,0.4);
  transition: color 0.3s, font-size 0.3s, transform 0.3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lyric-line.active {
  color: #fff;
  font-size: 1.02rem;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(233,69,96,0.5);
  transform: scale(1.02);
}

.lyric-tip {
  color: rgba(255,255,255,0.3);
  font-size: 0.85rem;
  padding: 40px 0;
  text-align: center;
}

/* 加载中提示（缓冲等待时显示） */
.info .load-status {
  font-size: 0.78rem;
  color: #f27121;
  margin-top: 4px;
  min-height: 1em;
  opacity: 0;
  transition: opacity 0.2s;
}

.info .load-status.show { opacity: 1; }
