/* ===== 基础重置 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #5b7cfa;
  --primary-dark: #3d5ce5;
  --primary-light: #eef1ff;
  --youth: #34c759;
  --youth-bg: #e8f9ed;
  --adult: #5b7cfa;
  --adult-bg: #eef1ff;
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --bg: #f5f7fb;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(91, 124, 250, 0.08);
  --shadow-lg: 0 8px 32px rgba(91, 124, 250, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input {
  font-family: inherit;
  font-size: inherit;
}

/* ===== 页面容器 ===== */
.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ===== 首页 ===== */
.home-page {
  background: linear-gradient(165deg, #eef1ff 0%, #f5f7fb 40%, #f5f7fb 100%);
}

.home-header {
  text-align: center;
  padding: 48px 24px 32px;
}

.logo-icon {
  font-size: 56px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.home-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.subtitle {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.home-main {
  flex: 1;
  padding: 0 20px 24px;
}

.select-tip {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1.5px solid transparent;
}

.category-card:active {
  transform: scale(0.98);
}

.youth-card {
  border-color: rgba(52, 199, 89, 0.2);
}

.youth-card:hover {
  box-shadow: 0 8px 28px rgba(52, 199, 89, 0.15);
}

.adult-card {
  border-color: rgba(91, 124, 250, 0.2);
}

.adult-card:hover {
  box-shadow: var(--shadow-lg);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.youth-card .card-icon {
  background: var(--youth-bg);
}

.adult-card .card-icon {
  background: var(--adult-bg);
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 6px;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

.card-arrow {
  color: var(--text-secondary);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.home-footer {
  padding: 16px 24px calc(24px + var(--safe-bottom));
}

.disclaimer {
  font-size: 0.7rem;
  color: #9ca3af;
  text-align: center;
  line-height: 1.5;
}

/* ===== 通用页头 ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-header h1 {
  font-size: 1.05rem;
  font-weight: 600;
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg);
  border-radius: 10px;
  font-size: 1.2rem;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.header-placeholder {
  width: 36px;
  flex-shrink: 0;
}

/* ===== 信息填写页 ===== */
.info-main {
  flex: 1;
  padding: 24px 20px;
}

.type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 12px;
  background: var(--primary-light);
  color: var(--primary);
}

.type-badge.youth {
  background: var(--youth-bg);
  color: var(--youth);
}

.info-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 28px;
}

.info-form .form-group {
  margin-bottom: 22px;
}

.info-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.required {
  color: var(--danger);
}

.info-form input[type="text"],
.info-form input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  outline: none;
  transition: border-color 0.2s;
  font-size: 1rem;
  color: var(--text);
  -moz-appearance: textfield;
}

.info-form input[type="number"]::-webkit-inner-spin-button,
.info-form input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.info-form input:focus {
  border-color: var(--primary);
}

.gender-options {
  display: flex;
  gap: 10px;
}

.gender-option {
  flex: 1;
  cursor: pointer;
}

.gender-option input {
  display: none;
}

.gender-btn {
  display: block;
  text-align: center;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-weight: 500;
  transition: all 0.2s;
}

.gender-option input:checked + .gender-btn {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.error-msg {
  display: block;
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 6px;
  min-height: 1.1em;
}

.privacy-note {
  margin-bottom: 28px;
}

.checkbox-label {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  color: var(--text-secondary) !important;
  cursor: pointer;
  line-height: 1.5;
}

.checkbox-label input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* ===== 按钮 ===== */
.btn-primary {
  display: block;
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(91, 124, 250, 0.35);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 15px;
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.btn-secondary:active {
  background: var(--bg);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== 测评页 ===== */
.quiz-page {
  background: var(--bg);
}

.progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b9ffc);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.quiz-main {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
}

.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-num {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 28px;
  color: var(--text);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-size: 0.95rem;
  color: var(--text);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 500;
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-btn.selected .option-letter {
  background: var(--primary);
  color: #fff;
}

.quiz-footer {
  display: flex;
  gap: 12px;
  padding: 12px 20px calc(16px + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
}

.quiz-footer .btn-primary,
.quiz-footer .btn-secondary {
  flex: 1;
}

/* ===== 结果页 ===== */
.result-main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.result-user {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.result-user h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.user-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.user-info-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.user-info-item strong {
  color: var(--text);
  font-weight: 500;
}

.result-score-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.result-score-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.result-score-card.level-good::before { background: var(--success); }
.result-score-card.level-mild::before { background: #5ac8fa; }
.result-score-card.level-moderate::before { background: var(--warning); }
.result-score-card.level-severe::before { background: var(--danger); }

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 6px solid;
  position: relative;
}

.level-good .score-circle { border-color: var(--success); color: var(--success); }
.level-mild .score-circle { border-color: #5ac8fa; color: #0a84ff; }
.level-moderate .score-circle { border-color: var(--warning); color: var(--warning); }
.level-severe .score-circle { border-color: var(--danger); color: var(--danger); }

.score-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.score-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.level-tag {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.level-good .level-tag { background: #e8f9ed; color: var(--success); }
.level-mild .level-tag { background: #e5f4ff; color: #0a84ff; }
.level-moderate .level-tag { background: #fff4e5; color: var(--warning); }
.level-severe .level-tag { background: #ffebea; color: var(--danger); }

.level-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.result-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.result-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-section p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.dimension-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dimension-item {
  /* 维度项 */
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dimension-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.dimension-score {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dimension-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.dimension-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.suggestions-list {
  list-style: none;
  padding: 0;
}

.suggestions-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}

.suggestions-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: bold;
}

.result-disclaimer {
  background: #fff9e6;
  border: 1px solid #ffe58f;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.75rem;
  color: #8c6d1f;
  line-height: 1.6;
  margin-bottom: 8px;
}

.result-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state p {
  margin-bottom: 20px;
}

/* ===== 桌面端适配 ===== */
@media (min-width: 481px) {
  .page {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  }

  body {
    background: #e8ecf4;
  }
}
