/* ── Reset & Tokens ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F7F5F0;
  --surface:     #FFFFFF;
  --surface-alt: #F0ECE3;
  --border:      #DDD8CE;
  --text:        #2C2820;
  --text-muted:  #7A756A;
  --text-faint:  #B5B0A6;
  --primary:     #5B7F5E;
  --primary-hover: #4A6B4D;
  --primary-light: #E8F0E8;
  --accent:      #8B6B4A;
  --accent-light: #F5EDE3;
  --error:       #A84040;
  --warning:     #B08030;
  --warning-bg:  #FFF8ED;
  --star:        #D4A020;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 2px 12px rgba(44,40,32,0.06);
  --shadow-lg:   0 8px 32px rgba(44,40,32,0.10);
  --font-display: 'Noto Serif SC', serif;
  --font-body:    'Noto Sans SC', sans-serif;
  --transition:   0.25s ease;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Progress bar ──────────────────────────────────────────────────────── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  z-index: 100;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0;
  transition: width 0.4s ease;
}

/* ── Steps ─────────────────────────────────────────────────────────────── */
.step {
  display: none;
  min-height: calc(100dvh - 60px);
  padding: 24px 16px 32px;
  animation: fadeIn 0.35s ease;
}

.step.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-content {
  width: 100%;
  max-width: 440px;
}

/* ── Welcome ───────────────────────────────────────────────────────────── */
.welcome-step {
  text-align: center;
  padding-top: 15vh;
}

.logo-area {
  margin-bottom: 20px;
}

.logo-svg {
  width: 72px;
  height: 72px;
  color: var(--primary);
}

.title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text);
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 28px;
}

.welcome-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 32px;
}

/* ── Step titles ───────────────────────────────────────────────────────── */
.step-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Fields ────────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 20px 0 8px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
  outline: none;
}

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

.textarea-field {
  resize: vertical;
  min-height: 72px;
}

/* ── Chip group ────────────────────────────────────────────────────────── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.chip.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  -webkit-tap-highlight-color: transparent;
}

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

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

.btn-primary:active {
  transform: scale(0.98);
}

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

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

.btn-secondary:hover {
  background: var(--surface-alt);
}

/* ── Result card ───────────────────────────────────────────────────────── */
.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 16px 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.result-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.herb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.herb-tag {
  display: inline-block;
  padding: 6px 14px;
  font-size: 14px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 16px;
  font-weight: 500;
}

.result-reason {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
  padding: 0 4px;
}

.result-effects {
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 2;
}

.effect-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 13px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  margin: 2px 4px;
}

.tips-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.tip-item {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
  padding-left: 4px;
}

.warning-box {
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

/* ── Star rating ───────────────────────────────────────────────────────── */
.star-rating {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 4px;
}

.star {
  font-size: 32px;
  color: var(--border);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 4px;
}

.star:hover,
.star.active {
  color: var(--star);
  transform: scale(1.15);
}

.star-label {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── Disclaimer ────────────────────────────────────────────────────────── */
.disclaimer {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.7;
  margin-top: 24px;
}

.result-disclaimer {
  text-align: center;
  margin: 12px 0 4px;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 20px 16px 24px;
  font-size: 12px;
}

.app-footer a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color var(--transition);
}

.app-footer a:hover {
  color: var(--primary);
}

/* ── Utilities ─────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .step {
    padding: 40px 24px 48px;
  }

  .welcome-step {
    padding-top: 18vh;
  }

  .step-content {
    max-width: 520px;
  }

  .title {
    font-size: 32px;
  }

  .result-name {
    font-size: 28px;
  }
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}
