:root {
  --bg-top: #f3eeff;
  --bg-bottom: #fff5eb;
  --card: #ffffff;
  --primary: #7c6cf0;
  --primary-dark: #5b4dd6;
  --primary-soft: #ebe8ff;
  --accent: #ff9f5a;
  --accent-soft: #fff0e5;
  --text: #1f1d2b;
  --muted: #8b8798;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(124, 108, 240, 0.1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #e8e4f5;
  color: var(--text);
  min-height: 100vh;
}

.phone-frame {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(165deg, var(--bg-top) 0%, #fff 45%, var(--bg-bottom) 100%);
  position: relative;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  padding: 12px 12px 8px;
  gap: 8px;
  flex-shrink: 0;
}
.top-bar-center { flex: 1; min-width: 0; }
.top-bar-spacer { width: 40px; }
.step-text {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}
.btn-back {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,.75);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.progress-track {
  height: 5px;
  background: rgba(124, 108, 240, 0.15);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

.app-shell {
  flex: 1;
  padding: 8px 20px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: none;
  padding-bottom: 16px;
  animation: screenIn 0.4s cubic-bezier(.4,0,.2,1);
}
.screen.active { display: block; }
.screen.slide-out-left { animation: slideOutLeft 0.28s forwards; }
.screen.slide-in-right { animation: slideInRight 0.35s forwards; }

@keyframes screenIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutLeft {
  to { opacity: 0; transform: translateX(-24px); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

.intro-visual {
  position: relative;
  height: 140px;
  margin: 8px 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.intro-blob {
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(124,108,240,.25) 0%, transparent 70%);
  border-radius: 50%;
}
.intro-icon { font-size: 56px; position: relative; z-index: 1; }

.pill-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-soft), var(--primary-soft));
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 26px;
  line-height: 1.35;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.hero-sub {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 28px;
}

.feature-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feature-cards li {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow);
}
.fc-num {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.q-title {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0 8px;
  line-height: 1.35;
}
.q-hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 24px;
}
.q-body { min-height: 200px; }

.option-grid { display: flex; flex-direction: column; gap: 12px; }
.option-card {
  width: 100%;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}
.option-card:active { transform: scale(0.98); }
.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 8px 28px rgba(124, 108, 240, 0.2);
}

.gender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.gender-card {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.gender-card .g-emoji { font-size: 40px; display: block; margin-bottom: 10px; }
.gender-card .g-label { font-size: 16px; font-weight: 600; }
.gender-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* 滚轮选择器（身高体重） */
.wheel-picker-wrap {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
}
.wheel-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  position: relative;
  overflow: hidden;
}
.wheel-picker::before,
.wheel-picker::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 2;
}
.wheel-picker::before {
  top: 0;
  background: linear-gradient(180deg, var(--card) 0%, transparent 100%);
}
.wheel-picker::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--card) 0%, transparent 100%);
}
.wheel-highlight {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  height: 52px;
  background: var(--primary-soft);
  border-radius: 14px;
  z-index: 0;
  border: 1px solid rgba(124, 108, 240, 0.2);
}
.wheel-column {
  flex: 1;
  max-width: 120px;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  z-index: 1;
  -webkit-overflow-scrolling: touch;
}
.wheel-column::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--muted);
  scroll-snap-align: center;
  transition: color 0.15s, font-size 0.15s;
}
.wheel-item.active {
  color: var(--primary-dark);
  font-size: 28px;
}
.wheel-unit {
  font-size: 18px;
  color: var(--muted);
  margin-left: 4px;
  z-index: 1;
  font-weight: 600;
}
.wheel-tip {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

.analysis-loader {
  text-align: center;
  padding: 48px 16px;
}
.loader-ring {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-label { font-size: 16px; color: var(--text); font-weight: 500; }
.loader-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce 1.2s infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.analysis-done { text-align: center; padding-top: 24px; }
.done-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff;
  font-size: 32px;
  line-height: 64px;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.35);
}

.plan-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 50%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 20px;
  color: #fff;
  box-shadow: 0 16px 40px rgba(124, 108, 240, 0.35);
}
.plan-hero-kicker {
  font-size: 13px;
  opacity: 0.9;
  margin: 0 0 8px;
}
.plan-hero-title {
  font-size: 20px;
  line-height: 1.45;
  margin: 0;
  font-weight: 700;
}

.result-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.result-card h3 {
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--primary-dark);
}
.result-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.55;
}
.result-row strong {
  flex-shrink: 0;
  width: 88px;
  color: var(--text);
  font-weight: 600;
}
.result-row span { color: var(--muted); flex: 1; }
.stage-timeline { margin-top: 8px; }
.stage-item {
  position: relative;
  padding-left: 20px;
  margin-bottom: 16px;
}
.stage-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: -8px;
  width: 2px;
  background: var(--primary-soft);
}
.stage-item:last-child::before { display: none; }
.stage-dot {
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.stage-item strong { display: block; font-size: 14px; margin-bottom: 4px; }
.stage-item span { font-size: 13px; color: var(--muted); line-height: 1.5; }

.bottom-bar {
  flex-shrink: 0;
  padding: 12px 20px calc(16px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.92) 24%);
}
.bottom-inner { max-width: 100%; }
.btn-primary {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 17px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #9b8afb 100%);
  box-shadow: 0 12px 28px rgba(124, 108, 240, 0.4);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-sub {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin: 10px 0 0;
}
.btn-ghost {
  width: 100%;
  margin-top: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  padding: 8px;
}

.hidden { display: none !important; }