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

:root {
  --bg:        #F5F2EB;
  --card:      #FDFAF5;
  --primary:   #3D4A2E;
  --primary-d: #2A3320;
  --accent:    #C8D5A0;
  --accent-d:  #9BAD6A;
  --text:      #2A3020;
  --muted:     #7A8A6A;
  --border:    #E0DAD0;
  --border-d:  #C8BFB0;
  --red:       #B94040;
  --red-bg:    #FDF0F0;
  --red-light: #F5DADA;
  --yellow:    #9A7020;
  --yellow-bg: #FDF6E8;
  --yellow-light: #F5E5B8;
  --green:     #2D6A4F;
  --green-bg:  #EDF5EF;
  --green-light: #C0DBC8;
  --shadow:    0 2px 16px rgba(61,74,46,0.07);
  --shadow-md: 0 4px 24px rgba(61,74,46,0.10);
  --radius:    16px;
  --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Noto Serif SC', 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.05em;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  display: block;
  margin-top: -2px;
}
.header-notice {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  letter-spacing: 0.02em;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #3D4A2E 0%, #4A5C36 60%, #5A6E42 100%);
  color: white;
  padding: 60px 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='400' height='400' xmlns='http://www.w3.org/2000/svg'%3E%3Cellipse cx='350' cy='50' rx='200' ry='200' fill='%23C8D5A0' fill-opacity='0.08'/%3E%3Cellipse cx='50' cy='350' rx='150' ry='150' fill='%23C8D5A0' fill-opacity='0.06'/%3E%3C/svg%3E") no-repeat center;
  background-size: cover;
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.hero-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  font-weight: 500;
}
.hero h1 {
  font-family: 'Noto Serif SC', 'Playfair Display', Georgia, serif;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.hero p {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  max-width: 440px;
  line-height: 1.7;
}
.hero-deco {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.15;
}

/* ── Main layout ── */
.app-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.app-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .app-grid { grid-template-columns: 1fr; }
}

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.card-header p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Disease selection ── */
.disease-body {
  padding: 16px 20px 20px;
}
.disease-category {
  margin-bottom: 18px;
}
.disease-category:last-child { margin-bottom: 0; }
.category-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.disease-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.disease-tag {
  cursor: pointer;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-d);
  background: white;
  color: var(--muted);
  transition: all 0.18s ease;
  user-select: none;
  line-height: 1.4;
}
.disease-tag:hover {
  border-color: var(--accent-d);
  color: var(--primary);
  background: var(--bg);
}
.disease-tag.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 500;
}

/* ── Constitution ── */
.constitution-body {
  padding: 16px 20px;
}
.constitution-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.const-option {
  cursor: pointer;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: all 0.18s;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: white;
}
.const-option:hover {
  border-color: var(--accent-d);
  background: var(--bg);
}
.const-option.selected {
  border-color: var(--primary);
  background: rgba(61,74,46,0.05);
}
.const-option input[type="radio"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-d);
  border-radius: 50%;
  margin-top: 2px;
  flex-shrink: 0;
  transition: all 0.18s;
  cursor: pointer;
}
.const-option.selected input[type="radio"] {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px white;
}
.const-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.const-desc {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.quiz-btn {
  width: 100%;
  background: transparent;
  border: 1.5px dashed var(--accent-d);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  letter-spacing: 0.02em;
}
.quiz-btn:hover {
  background: var(--accent);
  border-style: solid;
  border-color: var(--accent);
}
.quiz-btn::before { content: '🌿  '; }

/* ── Search ── */
.card-search { overflow: visible; }
.search-body {
  padding: 24px;
}
.search-wrap {
  position: relative;
}
.search-input-row {
  display: flex;
  gap: 10px;
}
.search-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border-d);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--primary); }
.search-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
  white-space: nowrap;
}
.search-btn:hover { background: var(--primary-d); }
.suggestions {
  display: none;
  margin-top: 6px;
  border: 1px solid var(--border-d);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  background: var(--card);
  max-height: 260px;
  overflow-y: auto;
}
.suggestions.open { display: block; }
.suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--bg); }
.suggestion-item .s-cat {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 2px 8px;
}
.search-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.search-hint span {
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  margin-right: 6px;
  font-size: 11px;
  transition: all 0.15s;
  display: inline-block;
  margin-bottom: 4px;
}
.search-hint span:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 52px 24px;
}
.empty-state .es-icon {
  font-size: 44px;
  opacity: 0.5;
  margin-bottom: 14px;
}
.empty-state h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Results ── */
.results-card { margin-top: 0; }
.result-top {
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}
.traffic-light {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.4s ease;
}
.traffic-light.green {
  background: var(--green-bg);
  box-shadow: 0 0 0 4px var(--green-light), 0 4px 20px rgba(45,106,79,0.20);
  color: var(--green);
}
.traffic-light.yellow {
  background: var(--yellow-bg);
  box-shadow: 0 0 0 4px var(--yellow-light), 0 4px 20px rgba(154,112,32,0.18);
  color: var(--yellow);
}
.traffic-light.red {
  background: var(--red-bg);
  box-shadow: 0 0 0 4px var(--red-light), 0 4px 20px rgba(185,64,64,0.18);
  color: var(--red);
}
.result-info { flex: 1; }
.result-food-name {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.result-food-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 20px;
}
.verdict-badge.green { background: var(--green-bg); color: var(--green); }
.verdict-badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.verdict-badge.red { background: var(--red-bg); color: var(--red); }

/* ── Indicators ── */
.indicators-section {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.indicators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.indicator-item {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: white;
  transition: all 0.18s;
}
.indicator-item.good {
  background: var(--green-bg);
  border-color: var(--green-light);
}
.indicator-item.caution {
  background: var(--yellow-bg);
  border-color: var(--yellow-light);
}
.indicator-item.avoid {
  background: var(--red-bg);
  border-color: var(--red-light);
}
.indicator-item.neutral {
  background: white;
  border-color: var(--border);
}
.ind-label {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.ind-value {
  font-size: 13px;
  font-weight: 600;
}
.indicator-item.good .ind-value { color: var(--green); }
.indicator-item.caution .ind-value { color: var(--yellow); }
.indicator-item.avoid .ind-value { color: var(--red); }
.indicator-item.neutral .ind-value { color: var(--text); }
.ind-status {
  font-size: 10px;
  margin-top: 2px;
}
.indicator-item.good .ind-status { color: var(--green); }
.indicator-item.caution .ind-status { color: var(--yellow); }
.indicator-item.avoid .ind-status { color: var(--red); }
.indicator-item.neutral .ind-status { color: var(--muted); }

/* ── Summary text ── */
.summary-section {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.summary-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  border-left: 3px solid var(--accent-d);
}

/* ── Disease notes ── */
.disease-notes-section {
  padding: 20px 28px 24px;
}
.disease-note {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
}
.disease-note:last-child { margin-bottom: 0; }
.note-disease-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-disease-name::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-d);
  flex-shrink: 0;
}
.note-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.coverage-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}
.coverage-badge.好 { background: var(--green-bg); color: var(--green); }
.coverage-badge.一般 { background: var(--yellow-bg); color: var(--yellow); }
.coverage-badge.有限 { background: var(--red-bg); color: var(--red); }

/* ── No disease selected hint ── */
.no-disease-hint {
  padding: 12px 28px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

/* ── Quiz Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(42,48,32,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
  position: relative;
}
.modal-header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 18px;
  color: var(--primary);
  font-weight: 600;
}
.modal-header p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-left: 16px;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.quiz-body { padding: 24px 28px 28px; }
.quiz-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}
.quiz-progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.quiz-progress-dot.active { background: var(--primary); }
.quiz-progress-dot.done { background: var(--accent-d); }
.quiz-question-num {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.quiz-question-text {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 17px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.5;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-option {
  cursor: pointer;
  border: 1.5px solid var(--border-d);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  transition: all 0.18s;
  background: white;
}
.quiz-option:hover {
  border-color: var(--accent-d);
  background: var(--bg);
  color: var(--primary);
}
.quiz-option.selected {
  border-color: var(--primary);
  background: rgba(61,74,46,0.06);
  color: var(--primary);
  font-weight: 500;
}
.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}
.quiz-back-btn {
  background: transparent;
  border: 1px solid var(--border-d);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.quiz-back-btn:hover { background: var(--bg); color: var(--text); }
.quiz-next-btn {
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: background 0.15s;
}
.quiz-next-btn:hover { background: var(--primary-d); }
.quiz-next-btn:disabled {
  background: var(--border-d);
  cursor: not-allowed;
}

/* Quiz result screen */
.quiz-result-screen {
  text-align: center;
  padding: 8px 0;
}
.quiz-result-icon { font-size: 52px; margin-bottom: 16px; }
.quiz-result-title {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}
.quiz-result-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 24px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.quiz-apply-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.quiz-apply-btn:hover { background: var(--primary-d); }
.quiz-retry-btn {
  background: transparent;
  border: 1px solid var(--border-d);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  margin-left: 10px;
  transition: all 0.15s;
}
.quiz-retry-btn:hover { background: var(--bg); }

/* ── Misc ── */
.processed-notice {
  margin: 0 28px 16px;
  padding: 10px 14px;
  background: #FFF8E8;
  border: 1px solid #F0D88A;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #8A6A00;
  line-height: 1.6;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-d); border-radius: 3px; }

/* Fade-in animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.results-card { animation: fadeUp 0.3s ease; }


/* ── Ingredient breakdown ── */
.breakdown-section { padding: 20px 28px; border-bottom: 1px solid var(--border); }
.breakdown-meal-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.6;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  margin-bottom: 7px;
  transition: background 0.15s;
}
.ingredient-item:last-child { margin-bottom: 0; }
.ingredient-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.ingredient-dot.green  { background: var(--green); }
.ingredient-dot.yellow { background: var(--yellow); }
.ingredient-dot.red    { background: var(--red); }
.ingredient-dot.neutral { background: var(--border-d); }
.ingredient-main { flex: 1; min-width: 0; }
.ingredient-name { font-size: 13px; font-weight: 500; color: var(--text); }
.ingredient-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.ingredient-pill {
  font-size: 10px;
  padding: 2px 9px;
  border-radius: 10px;
  flex-shrink: 0;
  margin-top: 1px;
  font-weight: 500;
}
.ingredient-pill.green  { background: var(--green-bg);  color: var(--green); }
.ingredient-pill.yellow { background: var(--yellow-bg); color: var(--yellow); }
.ingredient-pill.red    { background: var(--red-bg);    color: var(--red); }
.ingredient-pill.neutral { background: var(--bg); color: var(--muted); }
.ingredient-unmatched   { background: var(--bg); color: var(--muted); }

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

/* ── Loading ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── Auth zone ── */
.auth-zone {
  padding: 14px 18px;
}
.auth-login-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-prompt-text {
  font-size: 13px;
  color: var(--muted);
}
.wechat-login-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #07C160;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.wechat-login-btn:hover { background: #05a050; }
.wechat-login-btn:disabled { opacity: 0.6; cursor: default; }

.auth-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.auth-avatar {
  font-size: 16px;
}
.logout-btn {
  background: none;
  border: 1px solid var(--border-d);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--primary); }

/* ── Profile summary bar ── */
.profile-summary-bar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.profile-summary-text {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  line-height: 1.5;
  flex: 1;
}
.edit-profile-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.edit-profile-btn:hover { background: var(--bg); }

/* ── Save profile button ── */
.save-profile-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}
.save-profile-btn:hover { background: var(--primary-d); }
.save-profile-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Auth actions ── */
.auth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.my-logs-entry-btn {
  background: none;
  border: 1px solid var(--accent-d);
  color: var(--primary);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.my-logs-entry-btn:hover { background: var(--accent); }

/* ── 食后记 section ── */
.food-log-section {
  border-top: 1px solid var(--border);
  padding: 24px 28px 28px;
}
.fl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.fl-add-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.fl-add-btn:hover { background: var(--primary-d); }
.fl-login-hint { font-size: 12px; color: var(--muted); }

.fl-guest-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── Log form ── */
.fl-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}
.fl-form-row { margin-bottom: 14px; }
.fl-form-row:last-child { margin-bottom: 0; }
.fl-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.fl-date-input {
  border: 1px solid var(--border-d);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--card);
  outline: none;
}
.fl-date-input:focus { border-color: var(--primary); }
.fl-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.fl-tag {
  border: 1px solid var(--border-d);
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.fl-tag:hover { border-color: var(--primary); color: var(--primary); }
.fl-tag.selected { background: var(--primary); color: white; border-color: var(--primary); }
.fl-textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--border-d);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  resize: vertical;
  outline: none;
  line-height: 1.6;
}
.fl-textarea:focus { border-color: var(--primary); }
.fl-char-count { text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }
.fl-radio-group { display: flex; gap: 20px; }
.fl-radio { font-size: 13px; color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 5px; }
.fl-submit-btn {
  width: 100%;
  margin-top: 4px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.fl-submit-btn:hover { background: var(--primary-d); }
.fl-submit-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Log items ── */
.fl-sub-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.fl-mine-section { margin-bottom: 20px; }
.fl-empty-mine {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0 16px;
}
.fl-loading { font-size: 13px; color: var(--muted); padding: 16px 0; }
.fl-log-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card);
}
.fl-log-item.public { background: var(--bg); }
.fl-log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.fl-log-date { font-size: 12px; color: var(--muted); }
.fl-reaction-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  padding: 2px 8px;
}
.fl-reaction-badge.good    { background: var(--green-bg); color: var(--green); }
.fl-reaction-badge.neutral { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.fl-reaction-badge.caution { background: var(--yellow-bg); color: var(--yellow); }
.fl-reaction-badge.avoid   { background: var(--red-bg); color: var(--red); }
.fl-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.fl-delete-btn:hover { color: var(--red); background: var(--red-bg); }
.fl-log-content {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── 个人中心 My Logs Modal ── */
.modal-box-wide {
  max-width: 580px;
  width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.my-logs-search-bar {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.my-logs-search-input {
  flex: 1;
  border: 1px solid var(--border-d);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
}
.my-logs-search-input:focus { border-color: var(--primary); }
.my-logs-search-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}
.my-logs-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
}
.my-logs-food-group { margin-bottom: 20px; }
.my-logs-food-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.my-logs-food-name:hover { text-decoration: underline; }
.my-logs-count {
  font-size: 11px;
  font-weight: normal;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
}

/* ── Page Container ── */
.page {
  display: none;
  min-height: 100vh;
}
.page.active {
  display: block;
}

/* ── Welcome Page ── */
.welcome-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px 48px;
  text-align: center;
}
.welcome-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
}
.welcome-logo svg {
  width: 100%;
  height: 100%;
}
.welcome-title {
  font-family: 'Noto Serif SC', 'Playfair Display', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.welcome-slogan {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 28px;
  letter-spacing: 0.08em;
}
.welcome-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  max-width: 320px;
  margin-bottom: 36px;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
  margin-bottom: 48px;
}
.welcome-primary-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
}
.welcome-primary-btn:hover { background: var(--primary-d); }
.welcome-skip-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  transition: color 0.15s;
}
.welcome-skip-btn:hover { color: var(--text); }
.welcome-footer {
  font-size: 11px;
  color: var(--muted);
  position: absolute;
  bottom: 32px;
}

/* ── Profile Setup Page ── */
.profile-setup-wrap {
  padding: 40px 20px 48px;
  max-width: 600px;
  margin: 0 auto;
}
.profile-setup-title {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  margin-bottom: 8px;
}
.profile-setup-subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 32px;
}
.profile-setup-section {
  margin-bottom: 28px;
}
.profile-setup-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}
.profile-setup-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}
.profile-skip-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  transition: color 0.15s;
}
.profile-skip-btn:hover { color: var(--text); }

/* ── Main Page Content Padding ── */
#page-main .app-wrap {
  padding-bottom: 100px;
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 4px;
}
.bottom-nav-item:hover { background: var(--bg); }
.bottom-nav-item.active {
  background: var(--bg);
}
.bottom-nav-item.active .nav-label {
  color: var(--primary);
  font-weight: 500;
}
.nav-icon {
  font-size: 20px;
}
.nav-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ── Food Logs Page ── */
.logs-page-wrap {
  padding: 24px 20px 100px;
  max-width: 600px;
  margin: 0 auto;
}
.logs-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.logs-back-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.logs-back-btn:hover { background: var(--border); }
.logs-page-title {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
}
.logs-page-body {
  min-height: 50vh;
}
.logs-empty-state {
  text-align: center;
  padding: 48px 24px;
}
.logs-empty-state p {
  font-size: 14px;
  color: var(--muted);
}
.logs-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--card);
}
.logs-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.logs-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}
.logs-item-date {
  font-size: 12px;
  color: var(--muted);
}
.logs-item-reaction {
  font-size: 12px;
  margin-bottom: 8px;
}
.logs-item-reaction.good { color: var(--green); }
.logs-item-reaction.neutral { color: var(--muted); }
.logs-item-reaction.caution { color: var(--yellow); }
.logs-item-reaction.avoid { color: var(--red); }
.logs-item-action {
  background: transparent;
  border: 1px solid var(--border-d);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.logs-item-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

