:root {
  --bg: #0d1117;
  --text: #f0f6fc;
  --text-dim: #5b636e;
  --text-sub: #8b949e;
  --voice: #22d3ee;
  --accent: #ffd166;
  --lyric-size: 52px;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 开始遮罩 ---------- */
.start {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.start-card { max-width: 440px; text-align: center; }
.start-icon {
  width: 72px; height: 72px;
  margin: 0 auto 28px;
  border-radius: 50%;
  background: var(--voice);
  animation: pulse 1.6s infinite;
}
.start-title { font-size: 30px; font-weight: 500; margin-bottom: 12px; }
.start-sub { font-size: 16px; color: var(--text-sub); line-height: 1.6; margin-bottom: 32px; }
.start-btn {
  font-size: 22px; font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border: none; border-radius: 999px;
  padding: 18px 48px;
  cursor: pointer;
}
.start-btn:active { transform: scale(.97); }
.start-hint { margin-top: 20px; font-size: 14px; color: var(--text-sub); min-height: 20px; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .5); }
  70% { box-shadow: 0 0 0 22px rgba(34, 211, 238, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}

/* ---------- 主界面 ---------- */
.app { display: none; position: fixed; inset: 0; flex-direction: column; }
.app.show { display: flex; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top) + 18px) 22px 10px;
}
.song-status { font-size: 13px; color: var(--text-sub); }
.song-title { font-size: 22px; font-weight: 500; margin-top: 2px; }
.song-artist { font-size: 14px; color: var(--text-sub); margin-top: 2px; }
.song-count { font-size: 13px; color: var(--accent); margin-top: 6px; font-variant-numeric: tabular-nums; }

.voice { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.voice-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-dim);
  transition: background .3s;
}
.voice.listening .voice-dot { background: var(--voice); animation: dot 1.4s infinite; }
.voice-label { font-size: 13px; color: var(--text-sub); }
.voice.listening .voice-label { color: var(--voice); }

@keyframes dot {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .6); }
  70% { box-shadow: 0 0 0 12px rgba(34, 211, 238, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}

/* ---------- 歌词舞台 ---------- */
.stage { flex: 1; position: relative; overflow: hidden; }
.lyrics {
  position: absolute; left: 0; right: 0; top: 0;
  padding: 0 22px;
  transition: transform .35s ease;
  will-change: transform;
}
.line {
  font-size: var(--lyric-size);
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-dim);
  opacity: .4;
  padding: 10px 0;
  text-align: center;
  transform-origin: center;
  transition: opacity .3s, color .3s, transform .3s;
}
.line.active {
  color: var(--accent);
  opacity: 1;
  font-weight: 500;
  transform: scale(1.05);
}

/* ---------- 进度条 ---------- */
.progress { height: 3px; background: rgba(255, 255, 255, .08); }
.progress-bar { height: 100%; width: 0; background: var(--voice); transition: width .2s linear; }

/* ---------- 底部栏 ---------- */
.bottombar { padding: 10px 22px calc(env(safe-area-inset-bottom) + 14px); }
.hint {
  font-size: 13px; color: var(--text-sub); text-align: center;
  background: rgba(255, 255, 255, .05);
  border-radius: 12px; padding: 10px; margin-bottom: 10px;
}
.controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.controls button {
  font-size: 15px; color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px; padding: 10px 14px;
  cursor: pointer;
}
.controls button:active { background: rgba(255, 255, 255, .14); }
.shuffle-btn {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.shuffle-btn:active { background: rgba(255, 209, 102, .18); }

/* ---------- 语音回显 ---------- */
.toast {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.9);
  background: rgba(20, 24, 32, .92);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text);
  font-size: 24px; font-weight: 500;
  padding: 16px 28px; border-radius: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- 降低动态效果偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .lyrics, .line, .toast, .progress-bar { transition: none; }
  .start-icon, .voice.listening .voice-dot { animation: none; }
}
