*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f6ef7;
  --primary-dark: #3a56d4;
  --accent: #ff6b6b;
  --bg: #f0f4ff;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(79, 110, 247, 0.12);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.page {
  display: none;
  min-height: 100vh;
  padding: 24px 20px 40px;
  animation: fadeIn 0.3s ease;
}

.page.active { display: flex; flex-direction: column; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 首页 */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 0;
}

.hero-badge {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.3;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.hero-subtitle {
  font-size: 20px;
  font-weight: 700;
  color: #7c3aed;
  margin-bottom: 16px;
}

.hero-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.disclaimer-red {
  color: #e53e3e;
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
}

.result-disclaimer {
  text-align: center;
  margin-bottom: 12px;
}

.participant-count {
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.participant-count strong {
  color: #7c3aed;
  font-size: 18px;
}

.quiz-auto-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 24px;
}

.result-mbti { margin: 10px 0; }

.mbti-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
}

.result-school-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
  background: var(--bg);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.result-identity {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: #faf5ff;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  white-space: pre-line;
  border-left: 4px solid #7c3aed;
}

/* 按钮 */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 140px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 110, 247, 0.35);
}

.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--card);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-primary:disabled, .btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 答题 */
.quiz-header {
  margin-bottom: 28px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 20%;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
}

.question-container {
  flex: 1;
}

.question-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 24px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option-btn.selected {
  border-color: var(--primary);
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}

.number-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s;
}

.number-input:focus { border-color: var(--primary); }

.quiz-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

/* 结果 */
.result-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.result-header { text-align: center; margin-bottom: 20px; }

.result-label {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.result-school {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  margin: 8px 0 4px;
}

.result-location {
  font-size: 14px;
  color: var(--text-muted);
}

.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.badge {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}

.badge.gold { background: #fef3c7; color: #d97706; }
.badge.red { background: #fee2e2; color: #dc2626; }

.result-score-box {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.score-item {
  flex: 1;
  background: var(--bg);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.score-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.score-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.result-reason {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.result-alternatives {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.alt-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.alt-item {
  font-size: 14px;
  padding: 6px 0;
  color: var(--text);
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.share-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* 分享预览 */
.share-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.share-preview img {
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 加载 */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }
