:root {
  --bg-dark: #0f0c29;
  --bg-mid: #302b63;
  --bg-light: #24243e;
  --accent: #ff4b2b;
  --accent-hover: #ff416c;
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
}

/* 动态渐变背景 */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(45deg, var(--bg-dark), var(--bg-mid), var(--bg-light));
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  z-index: -1;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* 全局 BGM 控制按钮 */
.bgm-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.3s;
}

.bgm-toggle.playing {
  animation: spin 4s linear infinite;
  color: var(--accent);
  border-color: var(--accent);
}

.bgm-toggle:active {
  transform: scale(0.9);
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 40px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(20px);
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* 毛玻璃面板 */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 30px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* --- 首页 --- */
#home-screen {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.vinyl-container {
  width: 220px;
  height: 220px;
  margin-bottom: 40px;
  position: relative;
}

/* 涟漪动画 (Ripple) */
.ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(255, 75, 43, 0.6);
  animation: rippleAnim 3s infinite ease-out;
  pointer-events: none;
  z-index: 0;
}
.ripple-1 { animation-delay: 0s; }
.ripple-2 { animation-delay: 1s; }
.ripple-3 { animation-delay: 2s; }

@keyframes rippleAnim {
  0% { width: 100%; height: 100%; opacity: 0.8; }
  100% { width: 200%; height: 200%; opacity: 0; }
}

/* 漂浮的音符 */
.floating-note {
  position: absolute;
  color: rgba(255,255,255,0.4);
  font-size: 20px;
  animation: floatUp 3s linear forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 0; }
  20% { opacity: 1; transform: translateY(-30px) rotate(15deg) scale(1); }
  80% { opacity: 1; transform: translateY(-100px) rotate(-15deg) scale(1); }
  100% { transform: translateY(-150px) rotate(0deg) scale(1.2); opacity: 0; }
}

.vinyl-record {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #111, #333, #111);
  border-radius: 50%;
  border: 6px solid #444;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8), inset 0 0 15px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spin 10s linear infinite;
  position: relative;
  z-index: 2;
}

.vinyl-record::before {
  content: '';
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}
.vinyl-record::after {
  content: '';
  position: absolute;
  width: 75%;
  height: 75%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}

.vinyl-center {
  width: 70px;
  height: 70px;
  background: linear-gradient(45deg, var(--accent), var(--accent-hover));
  border-radius: 50%;
  border: 3px solid #222;
  position: relative;
}

.vinyl-center::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #111;
  border-radius: 50%;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.main-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 16px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.subtitle {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 50px;
}

/* 按钮样式 */
.btn-primary {
  background: linear-gradient(45deg, var(--accent), var(--accent-hover));
  color: white;
  border: none;
  padding: 16px 40px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 75, 43, 0.4);
  transition: all 0.3s ease;
  width: 100%;
  max-width: 300px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary:active {
  transform: scale(0.95);
}

.glow-effect {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 75, 43, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(255, 75, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 75, 43, 0); }
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 10px;
  text-decoration: underline;
  transition: color 0.3s;
}

.btn-text:hover {
  color: var(--text-main);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 14px 30px;
  border-radius: 25px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

/* --- 测试页 --- */
#quiz-screen {
  justify-content: center;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-bottom: 40px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

#question-number {
  font-size: 64px;
  font-weight: 900;
  color: rgba(255,255,255,0.05);
  position: absolute;
  top: -15px;
  right: 20px;
}

#question-text {
  font-size: 22px;
  line-height: 1.5;
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
}

.option-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 18px 20px;
  color: white;
  font-size: 16px;
  text-align: left;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.4;
  width: 100%;
}

.option-btn:hover, .option-btn:active {
  background: rgba(255,255,255,0.15);
  transform: translateX(5px);
  border-color: var(--accent);
}

/* --- 结果页 --- */
#result-screen {
  align-items: center;
}

.result-header {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 15px;
  font-weight: normal;
  letter-spacing: 1px;
}

.player-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 35px 20px;
  margin-bottom: 25px;
  background: rgba(255,255,255,0.08);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
}

.cover-art-large {
  width: 240px;
  height: 240px;
  border-radius: 15px;
  margin-bottom: 25px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
  background: #222;
}

#result-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 10s linear;
}
#result-cover-img.playing {
  transform: scale(1.1);
}

.equalizer {
  position: absolute;
  bottom: 15px;
  right: 15px;
  display: flex;
  gap: 4px;
  height: 30px;
  align-items: flex-end;
  background: rgba(0,0,0,0.5);
  padding: 5px 8px;
  border-radius: 8px;
}

.equalizer span {
  display: block;
  width: 5px;
  background: white;
  border-radius: 3px;
  animation: eq 1s ease-in-out infinite alternate;
}
.equalizer span:nth-child(1) { animation-delay: 0.1s; height: 15px; }
.equalizer span:nth-child(2) { animation-delay: 0.3s; height: 25px; }
.equalizer span:nth-child(3) { animation-delay: 0.0s; height: 20px; }
.equalizer span:nth-child(4) { animation-delay: 0.4s; height: 10px; }

@keyframes eq {
  0% { height: 6px; }
  100% { height: 25px; }
}

.equalizer.paused span {
  animation-play-state: paused;
  height: 6px !important;
}

#result-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(to right, #fff, #ddd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.traits-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 15px;
}

.trait-tag {
  background: rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
}

#result-desc {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 25px;
  padding: 0 10px;
}

/* --- 自定义播放器 UI --- */
.custom-audio-player {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.track-meta {
  width: 100%;
  text-align: left;
  margin-bottom: 15px;
}

.track-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 14px;
  color: var(--text-muted);
}

.progress-container {
  width: 100%;
  margin-bottom: 20px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: -3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.2s;
}

.progress-bar-bg:hover .progress-bar-fill::after {
  opacity: 1;
}

.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.play-circle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(255, 75, 43, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.play-circle-btn:active {
  transform: scale(0.95);
  box-shadow: 0 5px 10px rgba(255, 75, 43, 0.4);
}

/* 详情解析卡片 */
.result-details {
  width: 100%;
  padding: 25px 20px;
  margin-bottom: 25px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  text-align: left;
}

.detail-section {
  margin-bottom: 20px;
}
.detail-section:last-child {
  margin-bottom: 0;
}

.detail-title {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
  opacity: 0.9;
}

.quote-text {
  font-style: italic;
  color: #eee;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

.row-layout {
  display: flex;
  gap: 15px;
}

.detail-box {
  flex: 1;
  background: rgba(0,0,0,0.2);
  padding: 15px;
  border-radius: 12px;
}

.highlight-text {
  font-weight: 600;
  color: #fff;
}

.action-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- 全部结果页 --- */
#all-results-screen {
  padding-bottom: 50px;
  display: block;
}

.btn-icon-top {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 5px;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 30px;
  font-size: 14px;
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.album-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
}

.album-card-header {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.album-details {
  width: 100%;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.album-cover-small {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  background-size: cover !important;
  background-position: center !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.album-info {
  flex: 1;
}

.album-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 6px;
}

.album-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.album-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}
.album-play-btn.playing {
  background: var(--accent);
  border-color: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
