/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #f472b6;
  --accent: #22d3ee;
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-light: #252542;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-4: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

html, body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(244, 114, 182, 0.1) 0%, transparent 50%),
    var(--bg-dark);
}

#app {
  min-height: 100vh;
}

/* 页面切换 */
.page {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* ========== 首页样式 ========== */
#home-page .container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.logo-section {
  text-align: center;
  margin-bottom: 50px;
}

.logo {
  font-size: 72px;
  font-weight: 900;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 12px;
  text-shadow: 0 0 60px rgba(99, 102, 241, 0.5);
}

.logo-subtitle {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.logo-desc {
  font-size: 16px;
  color: var(--text-secondary);
}

.start-section {
  text-align: center;
  margin-bottom: 40px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 48px;
  font-size: 18px;
  font-weight: 700;
  color: white;
  background: var(--gradient-1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 50px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-arrow {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(5px);
}

.start-hint {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.features {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: 30px;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.feature-icon {
  font-size: 18px;
}

/* ========== 测试页样式 ========== */
.progress-bar {
  height: 4px;
  background: var(--bg-card-light);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.question-counter {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.question-counter #current-q {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-light);
}

.question-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 28px 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.question-text {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 28px;
  min-height: 60px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  width: 100%;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  color: var(--text-primary);
  background: var(--bg-card-light);
  border: 2px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.5;
}

.option-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: translateX(5px);
}

.option-btn:active {
  transform: translateX(2px);
}

.option-btn.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
}

/* ========== 结果页样式 ========== */
#result-page .container {
  padding: 20px;
}

.result-card {
  background: var(--bg-card);
  border-radius: 32px;
  padding: 32px 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 20px;
}

.result-header {
  text-align: center;
  margin-bottom: 32px;
}

.result-type {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 8px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.result-family {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-card-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.radar-section {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

#radar-chart {
  max-width: 100%;
}

.scores-list {
  margin-bottom: 24px;
}

.score-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.score-label {
  width: 70px;
  font-size: 13px;
  color: var(--text-secondary);
}

.score-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-card-light);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 12px;
}

.score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.score-value {
  width: 40px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.bonus-section, .hidden-section {
  background: var(--bg-card-light);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bonus-badge, .hidden-badge {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.bonus-title, .hidden-type {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hidden-type {
  background: var(--gradient-3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bonus-desc, .hidden-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.share-section {
  margin-bottom: 20px;
}

.share-text {
  background: var(--bg-card-light);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 16px;
  border-left: 3px solid var(--primary);
}

.share-buttons {
  display: flex;
  gap: 12px;
}

.btn-share {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card-light);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-share:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

.btn-share.primary {
  background: var(--gradient-1);
  color: white;
}

.btn-share.primary:hover {
  opacity: 0.9;
}

.btn-retry {
  width: 100%;
  padding: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 2px solid var(--bg-card-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-retry:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

/* ========== 详细解读样式 ========== */
.analysis-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.analysis-block {
  background: var(--bg-card-light);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.analysis-block.advice {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(244, 114, 182, 0.1) 100%);
  border-color: rgba(129, 140, 248, 0.3);
}

.analysis-block.hidden-analysis {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
  border-color: rgba(34, 211, 238, 0.3);
}

.analysis-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 12px;
}

.analysis-block.advice .analysis-title {
  color: var(--secondary);
}

.analysis-block.hidden-analysis .analysis-title {
  color: var(--accent);
}

.analysis-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.analysis-quote {
  text-align: center;
  padding: 20px;
  margin-top: 20px;
  font-size: 15px;
  font-style: italic;
  color: var(--text-secondary);
  border-left: 3px solid var(--primary);
  background: var(--bg-card-light);
  border-radius: 0 12px 12px 0;
}

/* ========== 恢复对话框样式 ========== */
.resume-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.resume-dialog-content {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.resume-dialog-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.resume-dialog-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.resume-dialog-buttons {
  display: flex;
  gap: 12px;
}

.resume-btn {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.resume-btn.primary {
  background: var(--gradient-1);
  color: white;
}

.resume-btn.secondary {
  background: var(--bg-card-light);
  color: var(--text-primary);
}

.resume-btn:hover {
  transform: translateY(-2px);
}

/* 动画 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* 响应式 */
@media (max-width: 375px) {
  .logo {
    font-size: 56px;
  }

  .logo-subtitle {
    font-size: 20px;
  }

  .question-text {
    font-size: 16px;
  }

  .option-btn {
    padding: 14px 16px;
    font-size: 14px;
  }

  .result-type {
    font-size: 24px;
  }
}

@media (min-width: 481px) {
  body {
    display: flex;
    justify-content: center;
    background:
      radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
      radial-gradient(ellipse at bottom right, rgba(244, 114, 182, 0.08) 0%, transparent 50%),
      var(--bg-dark);
  }

  #app {
    max-width: 480px;
    background: var(--bg-dark);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
  }

  .container {
    padding: 24px 28px;
  }
}
