:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-muted: #f8faf9;
  --text: #1c2826;
  --text-secondary: #4e615d;
  --text-muted: #748783;
  --primary: #0f766e;
  --primary-hover: #0d645d;
  --primary-soft: #e6f4f1;
  --primary-border: #99d5cc;
  --border: #dfe7e5;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --success: #047857;
  --success-bg: #ecfdf5;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(15, 38, 34, 0.05);
  --shadow-md: 0 8px 28px rgba(15, 38, 34, 0.08);
  --max-width: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

html.font-large {
  font-size: 118.75%;
}

html.font-xlarge {
  font-size: 137.5%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  padding: 4px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.progress-track {
  width: 100%;
  height: 3px;
  background: var(--border);
  display: none;
}

.progress-track.visible {
  display: block;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  transition: width 0.25s ease;
}

/* 主容器 */
.main-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px 56px;
  flex: 1;
}

/* 卡片与基础排版 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px 22px;
}

.card + .card {
  margin-top: 16px;
}

.hero-header {
  text-align: left;
  margin-bottom: 20px;
}

.hero-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
}

/* 首页双表选择卡片 */
.survey-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .survey-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.survey-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.survey-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.survey-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 12px;
}

.survey-card h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 800;
  color: var(--text);
}

.survey-meta {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 10px;
}

.survey-bullets {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.96rem;
  color: var(--text-secondary);
}

.survey-bullets li {
  position: relative;
  padding-left: 18px;
  line-height: 1.5;
}

.survey-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.hero-skip-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: #0d5c55;
  font-size: 0.9375rem;
  font-weight: 500;
}

.font-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.font-toggle-btn:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.home-note {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
  font-size: 13px;
}

.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

/* 封面知情同意 */
.cover-lead {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 12px 0 18px;
  white-space: pre-line;
}

.notice-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.notice-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text);
}

.notice-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.notice-list li + li {
  margin-top: 8px;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.consent-label.checked {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.consent-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* 答题页 */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.q-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.q-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.badge-action {
  background: #fef3c7;
  color: #92400e;
}

.badge-dim {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-unscored {
  background: #eef2f6;
  color: #475569;
}

.q-title {
  margin: 0 0 14px;
  font-size: 1.2rem;
  line-height: 1.55;
  font-weight: 700;
}

.q-safety-tip {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* 动手题配图容器 */
.illustration-box {
  background: #fafcfb;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
  text-align: center;
}

.illustration-caption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.illustration-box svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* 选项列表 */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.option-btn:hover {
  border-color: var(--primary-border);
  background: var(--surface-muted);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option-btn.skip-option {
  border-style: dashed;
  background: #fafafa;
  color: var(--text-secondary);
}

.option-btn.skip-option.selected {
  border-style: solid;
  border-color: #64748b;
  background: #f1f5f9;
  color: var(--text);
}

.option-key {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-top: 1px;
}

.option-btn.selected .option-key {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.option-btn.skip-option.selected .option-key {
  background: #475569;
  border-color: #475569;
  color: #ffffff;
}

.option-text {
  font-size: 1.02rem;
  line-height: 1.55;
}

/* 数字输入 / 可选填空 */
.input-group {
  margin-top: 8px;
}

.number-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  font-size: 17px;
  outline: none;
  transition: border-color 0.15s ease;
}

.number-input:focus {
  border-color: var(--primary);
}

.input-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.optional-pulse-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.optional-pulse-box label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.pulse-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-row .number-input {
  max-width: 160px;
  padding: 8px 12px;
  font-size: 15px;
}

/* 底部导航 */
.q-footer {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.q-footer .btn {
  min-width: 112px;
}

/* 结果页 */
.alert-card {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-border);
  color: #7f1d1d;
}

.alert-danger h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #78350f;
}

.alert-warning h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--warning);
}

.result-score-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.score-big {
  font-size: 34px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.score-sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.result-level-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.result-copy {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
  white-space: pre-line;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.meta-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* 维度条 */
.section-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
}

.dim-item + .dim-item {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eef2f1;
}

.dim-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.dim-score {
  color: var(--primary);
  font-size: 14px;
}

.dim-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e8efed;
  overflow: hidden;
  margin-bottom: 6px;
}

.dim-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.dim-bar-fill.warn {
  background: #d97706;
}

.dim-bar-fill.high {
  background: #dc2626;
}

.dim-advice {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* 血管年龄对比卡 */
.age-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.age-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.age-box.highlight {
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

.age-box-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.age-box-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}

.age-box.highlight .age-box-val {
  color: var(--primary);
}

.mini-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14.5px;
  color: var(--text-secondary);
}

.mini-list li + li {
  margin-top: 6px;
}

.next-step-box {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 14px;
}

.next-step-box strong {
  color: var(--primary);
}

.promo-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
  border: 1px solid #a7f3d0;
}

.disclaimer-card {
  background: var(--surface-muted);
  font-size: 13px;
  color: var(--text-secondary);
}

.disclaimer-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.result-actions .btn {
  flex: 1 1 160px;
}

/* 第一步：基本信息表单 */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.field-label .req {
  color: var(--danger);
  margin-left: 4px;
}

.field-error {
  font-size: 0.875rem;
  color: var(--danger);
  min-height: 1.2em;
}

.user-pill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.user-pill-info {
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 480px) {
  .card {
    padding: 18px 16px;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .q-title {
    font-size: 1.125rem;
  }
}
