/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green-dark: #2C5F2D;
  --green: #3A7D44;
  --green-light: #E8F5E9;
  --gold: #C8A96E;
  --gold-light: #F5F0EB;
  --gold-dark: #A68A4E;
  --text: #333;
  --text-light: #666;
  --text-muted: #999;
  --white: #fff;
  --border: #E0D5C7;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--gold-light);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--white);
  position: relative;
  overflow: hidden;
}

/* ===== Pages ===== */
.page {
  display: none;
  padding: 16px;
  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); }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: white;
  box-shadow: 0 4px 14px rgba(44,95,45,0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(44,95,45,0.4);
}

.btn-primary:disabled {
  background: #ccc;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--green-dark);
  border: 2px solid var(--green-dark);
}

.btn-outline:hover {
  background: var(--green-light);
}

.btn-outline:disabled {
  border-color: #ccc;
  color: #ccc;
  cursor: not-allowed;
}

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 17px;
}

.btn-full {
  margin-top: 16px;
}

.btn-back {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--green-dark);
  cursor: pointer;
  padding: 4px 8px;
}

.btn-text {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--green);
  cursor: pointer;
  padding: 4px 8px;
}

/* ===== Page Nav ===== */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

/* ===== HOME ===== */
.home-header {
  text-align: center;
  padding: 30px 0 20px;
}

.logo-icon {
  font-size: 52px;
  margin-bottom: 8px;
}

.brand-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: 2px;
}

.brand-slogan {
  font-size: 14px;
  color: var(--gold-dark);
  margin-top: 6px;
  letter-spacing: 1px;
}

.home-hero {
  background: linear-gradient(135deg, var(--green-dark), #1B4F1D);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin: 12px 0 20px;
  color: white;
}

.hero-badge {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 18px;
  opacity: 0.9;
}

.hero-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hero-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.step-text {
  font-size: 13px;
}

.step-arrow {
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 16px;
}

.home-features {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.feature-card {
  flex: 1;
  background: var(--gold-light);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.feature-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.5;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.home-footer {
  text-align: center;
  padding: 10px;
}

.ip-badge {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

/* ===== Progress ===== */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #E8E0D5;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 13px;
  color: var(--text-light);
  min-width: 36px;
  text-align: right;
}

/* ===== Quiz ===== */
.quiz-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.quiz-num {
  font-size: 12px;
  color: var(--gold-dark);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.quiz-question {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.5;
}

.quiz-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.quiz-option:hover {
  border-color: var(--gold);
  background: #FEFAF3;
}

.quiz-option.selected {
  border-color: var(--green);
  background: var(--green-light);
}

.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-light);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.quiz-option.selected .quiz-option-letter {
  background: var(--green);
  color: white;
}

.quiz-option-text {
  flex: 1;
}

.quiz-option-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.quiz-option-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.quiz-actions {
  display: flex;
  gap: 12px;
}

.quiz-actions .btn {
  flex: 1;
}

/* ===== Constitution Result ===== */
.result-hero {
  text-align: center;
  padding: 24px 0 16px;
}

.result-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.result-type-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 4px;
}

.result-formula {
  font-size: 15px;
  color: var(--gold-dark);
  font-weight: 600;
}

.result-card {
  background: var(--gold-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.result-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.result-herbs {
  font-size: 15px;
  color: var(--green-dark);
  font-weight: 500;
  line-height: 1.6;
}

.result-desc {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
}

.score-detail {
  margin: 12px 0 16px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.score-name {
  font-size: 14px;
  color: var(--text);
}

.score-bar-wrap {
  flex: 1;
  margin: 0 12px;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.score-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 24px;
  text-align: right;
}

/* ===== Body Measure ===== */
.body-section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-group input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  background: linear-gradient(90deg, var(--green-light), var(--green));
  border-radius: 3px;
  outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.slider-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--green-dark);
  min-width: 70px;
  text-align: right;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.sleep-options {
  display: flex;
  gap: 12px;
}

.sleep-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.sleep-option:hover {
  border-color: var(--gold);
}

.sleep-option.selected {
  border-color: var(--green);
  background: var(--green-light);
}

.sleep-icon {
  font-size: 32px;
}

.sleep-option span {
  font-size: 14px;
  font-weight: 500;
}

.body-recommend {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  color: white;
}

.rec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.rec-item + .rec-item {
  border-top: 1px solid rgba(255,255,255,0.2);
  margin-top: 8px;
  padding-top: 16px;
}

.rec-label {
  font-size: 14px;
  opacity: 0.9;
}

.rec-value {
  font-size: 20px;
  font-weight: 700;
}

/* ===== Plan Card ===== */
.plan-card {
  background: white;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 12px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.plan-header {
  text-align: center;
  padding-bottom: 12px;
}

.plan-logo {
  font-size: 36px;
  margin-bottom: 4px;
}

.plan-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: 2px;
}

.plan-subtitle {
  font-size: 13px;
  color: var(--gold-dark);
  letter-spacing: 4px;
  margin-top: 2px;
}

.plan-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 12px 0;
}

.plan-section {
  padding: 4px 0;
}

.plan-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 10px;
}

.plan-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.plan-row-highlight {
  background: var(--green-light);
  border-radius: 4px;
  padding: 8px 8px;
  margin: 4px -4px;
}

.plan-label {
  color: var(--text-light);
}

.plan-value {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.plan-herbs {
  color: var(--green-dark);
}

.plan-season {
  color: var(--gold-dark);
  font-size: 13px;
}

.plan-code {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 16px;
  color: var(--green-dark);
  background: var(--green-light);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.plan-footer {
  text-align: center;
  padding-top: 8px;
}

.plan-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.plan-advisor {
  font-size: 13px;
  color: var(--text-light);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.result-actions .btn-text {
  margin-top: 4px;
  color: var(--text-muted);
}

/* ===== History ===== */
.history-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.history-constitution {
  font-size: 15px;
  font-weight: 600;
  color: var(--green-dark);
}

.history-date {
  font-size: 12px;
  color: var(--text-muted);
}

.history-detail {
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  gap: 12px;
}

.history-empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.history-empty p {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0,0,0,0.78);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 14px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
