/*
 * 用途：营养配的完整视觉样式。
 * 设计重点：大字号、高对比、大触控区、清晰分组；移动端优先，同时适配桌面和打印。
 */

:root {
  --bg: #f2f5f0;
  --surface: #ffffff;
  --surface-soft: #edf5ef;
  --surface-warm: #fffaf1;
  --text: #17251c;
  --muted: #4e5f53;
  --border: #d7e0d7;
  --border-strong: #aebdaf;
  --primary: #176b4d;
  --primary-dark: #0d4d36;
  --primary-light: #e2f2e8;
  --red: #b3261e;
  --red-bg: #fdecea;
  --red-border: #efb8b3;
  --yellow: #865000;
  --yellow-bg: #fff3d2;
  --yellow-border: #e7c77b;
  --green: #23683d;
  --green-bg: #e7f5eb;
  --green-border: #a9d7b6;
  --shadow: 0 14px 36px rgba(23, 52, 34, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(190, 224, 200, 0.45), transparent 30rem),
    linear-gradient(180deg, #f7f9f5 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.large-text {
  font-size: 21px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 4px solid rgba(23, 107, 77, 0.28);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.28;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 0;
  font-size: 1.75rem;
}

h2 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.65rem, 5vw, 2.35rem);
}

h3 {
  margin-bottom: 0.5rem;
  font-size: 1.24rem;
}

h4 {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

p {
  margin-bottom: 0.8rem;
}

small {
  font-size: 0.82em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: min(100%, 940px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 42px;
}

/* 顶部导航在滚动时保持可见，减少老年人寻找入口的成本。 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 25;
  margin: 0 -16px;
  padding: 12px 16px 10px;
  background: rgba(247, 249, 245, 0.94);
  border-bottom: 1px solid rgba(183, 198, 184, 0.7);
  backdrop-filter: blur(16px);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 908px;
  margin: 0 auto;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #20845d, #10583e);
  box-shadow: 0 8px 18px rgba(23, 107, 77, 0.24);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-block p {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-scale-button {
  flex: 0 0 auto;
  min-width: 74px;
  min-height: 48px;
  padding: 8px 12px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 908px;
  margin: 12px auto 0;
}

.tab-button {
  min-height: 50px;
  padding: 8px 6px;
  border: 2px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.tab-button:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.tab-button.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

main {
  padding-top: 18px;
}

.view {
  animation: view-in 180ms ease-out;
}

#view-scan {
  padding-bottom: 82px;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  margin: 4px 2px 18px;
}

.page-heading p {
  max-width: 46rem;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hero-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid #c3ddca;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(228, 245, 232, 0.97), rgba(255, 250, 239, 0.98)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero-card::after {
  position: absolute;
  right: -65px;
  bottom: -95px;
  width: 230px;
  height: 230px;
  border: 42px solid rgba(23, 107, 77, 0.06);
  border-radius: 50%;
  content: "";
}

.hero-card p {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  margin-bottom: 16px;
  color: #395246;
  font-size: 1.03rem;
}

.hero-chips,
.demo-scenarios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hero-chips {
  position: relative;
  z-index: 1;
}

.hero-chips span {
  padding: 6px 11px;
  border: 1px solid #b8d7c2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.panel {
  margin-bottom: 16px;
  padding: clamp(18px, 4.6vw, 26px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading h3,
.panel-heading p {
  margin-bottom: 0;
}

.step-label {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.muted-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.field-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

/* 上传区域和操作按钮。 */
.upload-drop {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  min-height: 156px;
  padding: 22px;
  border: 2px dashed #9dbca6;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #f7fbf8, #edf5ef);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.upload-drop:hover {
  border-color: var(--primary);
  background: #e8f4eb;
  transform: translateY(-1px);
}

.upload-drop strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1.05rem;
}

.upload-drop p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.upload-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 6px 14px rgba(23, 52, 34, 0.1);
  color: var(--primary);
  font-size: 2rem;
  font-weight: 500;
}

.image-preview {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 320px;
  border-radius: 13px;
  object-fit: cover;
}

.upload-drop.has-preview {
  grid-template-columns: 1fr;
}

.upload-drop.has-preview .upload-icon {
  display: none;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.button {
  min-height: 50px;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: 13px;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 7px 16px rgba(23, 107, 77, 0.18);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.button-secondary {
  border-color: #a9cbb7;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.button-secondary:hover:not(:disabled) {
  background: #d7ebdf;
}

.button-quiet {
  border-color: var(--border);
  background: #f8faf8;
  color: var(--text);
}

.button-danger {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.button.small {
  min-height: 42px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.status-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8faf8;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-loading {
  border-color: #a9c9b4;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.status-success {
  border-color: var(--green-border);
  background: var(--green-bg);
  color: var(--green);
}

.status-warning {
  border-color: var(--yellow-border);
  background: var(--yellow-bg);
  color: var(--yellow);
}

.status-error {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.demo-scenarios {
  margin-top: 13px;
  color: var(--muted);
  font-size: 0.84rem;
}

.demo-scenarios button {
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid #b8cabe;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.demo-scenarios button:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 可折叠的真实 API 设置。 */
.settings-details {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 13px;
}

.settings-details summary {
  min-height: 44px;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.settings-grid {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.settings-grid label:not(.switch-row) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}
.settings-grid input,
.settings-grid select,
.profile-form input,
.profile-form select,
.add-ingredient-box input,
.add-ingredient-box select,
.save-grid input,
.save-grid select,
.log-toolbar input {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.settings-grid input:hover,
.profile-form input:hover,
.profile-form select:hover,
.add-ingredient-box input:hover,
.add-ingredient-box select:hover,
.save-grid input:hover,
.save-grid select:hover {
  border-color: var(--primary);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.switch-row input {
  width: 24px !important;
  min-height: 24px !important;
  accent-color: var(--primary);
}

/* 未识别时的空状态。 */
.empty-result {
  padding: 36px 24px;
  text-align: center;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.72);
}

.empty-result-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 2rem;
}

.empty-result h3 {
  margin-bottom: 5px;
}

.empty-result p {
  max-width: 36rem;
  margin: 0 auto;
  color: var(--muted);
}

/* 本餐概览。 */
.result-overview {
  border-color: #b9d7c2;
}

.source-badge,
.engine-badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.77rem;
  font-weight: 800;
  white-space: nowrap;
}

.source-warning {
  margin: -5px 0 13px;
  padding: 10px 12px;
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius-sm);
  background: var(--yellow-bg);
  color: #694000;
  font-size: 0.86rem;
}

.meal-summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-primary,
.summary-metric {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafcfa;
}

.summary-primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #f0f8f2, #fbfdf9);
}

.summary-primary strong {
  display: block;
  margin: 2px 0;
  font-size: 1.18rem;
}

.summary-primary span:last-child,
.summary-metric > span,
.summary-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-metric strong {
  display: block;
  font-size: 1.17rem;
}

.summary-metric small {
  font-weight: 500;
}

.risk-text-red { color: var(--red); }
.risk-text-yellow { color: var(--yellow); }
.risk-text-green { color: var(--green); }

/* 食材编辑卡片。 */
.ingredient-list {
  display: grid;
  gap: 11px;
}

.ingredient-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 7px solid var(--green-border);
  border-radius: var(--radius-md);
  background: #fbfcfb;
}

.ingredient-item.risk-border-red { border-left-color: var(--red); background: #fffafa; }
.ingredient-item.risk-border-yellow { border-left-color: #d4a437; background: #fffdf7; }
.ingredient-item.risk-border-green { border-left-color: #62a978; }

.ingredient-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ingredient-heading strong {
  font-size: 1.03rem;
}

.food-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.confidence {
  display: inline-block;
  margin-left: 5px;
  color: #496d56;
}

.ingredient-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grams-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.grams-control button,
.delete-item-button {
  min-width: 46px;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.grams-control button:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.grams-control input {
  width: 90px;
  min-height: 46px;
  padding: 6px;
  border: 2px solid var(--border-strong);
  border-radius: 11px;
  background: #fff;
  text-align: center;
  font-weight: 700;
}

.delete-item-button {
  padding: 5px 10px;
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
  font-size: 0.82rem;
}

.ingredient-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 14px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.item-risk-reason {
  color: #42564a;
  font-weight: 700;
}

.add-ingredient-box {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(110px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.add-ingredient-box label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.add-ingredient-box .button {
  min-width: 84px;
}

/* 三色风险与原因说明。 */
.risk-summary {
  display: flex;
  gap: 14px;
  padding: 17px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 13px;
}

.risk-summary-red { border-color: var(--red-border); background: var(--red-bg); }
.risk-summary-yellow { border-color: var(--yellow-border); background: var(--yellow-bg); }
.risk-summary-green { border-color: var(--green-border); background: var(--green-bg); }

.risk-summary-icon {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  font-size: 1.55rem;
  font-weight: 900;
}

.risk-summary-red .risk-summary-icon { color: var(--red); }
.risk-summary-yellow .risk-summary-icon { color: var(--yellow); }
.risk-summary-green .risk-summary-icon { color: var(--green); }

.risk-summary-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.risk-summary h4 {
  margin: 1px 0 4px;
  font-size: 1.42rem;
}

.risk-summary p {
  margin-bottom: 6px;
}

.risk-scope {
  color: var(--muted);
  font-size: 0.8rem;
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.risk-red { border-color: var(--red-border); background: var(--red-bg); color: var(--red); }
.risk-yellow { border-color: var(--yellow-border); background: var(--yellow-bg); color: var(--yellow); }
.risk-green { border-color: var(--green-border); background: var(--green-bg); color: var(--green); }

.disease-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.disease-result {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
}

.disease-result.risk-summary-red { background: var(--red-bg); }
.disease-result.risk-summary-yellow { background: var(--yellow-bg); }
.disease-result.risk-summary-green { background: var(--green-bg); }

.disease-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 4px;
}

.disease-result p,
.disease-result small {
  margin: 0;
  color: #4b5b50;
  font-size: 0.8rem;
}

.issue-list {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.issue-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
}

.issue-row.issue-red { border-left: 5px solid var(--red); }
.issue-row.issue-yellow { border-left: 5px solid #d4a437; }

.issue-row strong {
  font-size: 0.9rem;
}

.issue-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* 营养总量。 */
.nutrient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.nutrient-tile {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(155deg, #fbfdfb, #f4f8f4);
}

.nutrient-tile > span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.nutrient-tile strong {
  display: block;
  margin: 1px 0;
  font-size: 1.12rem;
}

.nutrient-tile.is-over {
  border-color: var(--yellow-border);
  background: var(--yellow-bg);
}

.nutrient-target {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

/* 营养缺口和 AI 建议。 */
.gap-list {
  display: grid;
  gap: 12px;
}

.gap-row {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
}

.gap-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.86rem;
}

.gap-heading span {
  color: var(--muted);
}

.gap-bar {
  overflow: hidden;
  height: 11px;
  border-radius: 999px;
  background: #e3e9e3;
}

.gap-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.gap-low .gap-bar span { background: #b58118; }
.gap-high .gap-bar span { background: var(--red); }
.gap-good .gap-bar span { background: var(--green); }

.gap-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
}

.advice-block,
.positive-block {
  margin-top: 15px;
  padding: 15px;
  border-radius: var(--radius-md);
}

.advice-block {
  border: 1px solid #b8d7c2;
  background: #f1f8f3;
}

.positive-block {
  border: 1px solid var(--green-border);
  background: var(--green-bg);
}

.advice-block h4,
.positive-block h4 {
  margin-bottom: 8px;
}

.advice-list,
.positive-list,
.meal-log-issues {
  margin: 0;
  padding-left: 1.25rem;
}

.advice-list li,
.positive-list li,
.meal-log-issues li {
  margin-bottom: 7px;
}

.advice-list li::marker {
  color: var(--primary);
}

.positive-list li::marker {
  color: var(--green);
}

/* 保存日志。 */
.save-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.7fr);
  gap: 12px;
  align-items: end;
}

.save-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.save-grid .button {
  grid-column: 1 / -1;
}

/* 固定在识别结果页底部的强制免责声明。 */
.medical-disclaimer {
  position: fixed;
  z-index: 35;
  right: 16px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 16px;
  width: auto;
  margin: 0 auto;
  padding: 12px 16px;
  border: 1px solid #ebc37e;
  border-radius: 14px;
  background: rgba(255, 248, 228, 0.97);
  box-shadow: 0 9px 26px rgba(72, 49, 4, 0.16);
  color: #6d4500;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  backdrop-filter: blur(12px);
}

.inline-empty {
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: #fafcfa;
  text-align: center;
}

.inline-empty.compact {
  margin-top: 12px;
  padding: 14px;
  text-align: left;
}

.inline-empty p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.inline-empty.success {
  border-color: var(--green-border);
  background: var(--green-bg);
}

/* 每日日志。 */
.log-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.icon-button {
  min-height: 50px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.date-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.daily-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.daily-summary-head h3 {
  margin: 2px 0 0;
}

.daily-risk-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.daily-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.daily-metric {
  padding: 13px;
  border: 1px solid var(--border);
  border-left: 5px solid #94ad9c;
  border-radius: var(--radius-sm);
  background: #fbfcfb;
}

.daily-metric span,
.daily-metric > small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.daily-metric strong {
  display: block;
  margin: 2px 0;
  font-size: 1.15rem;
}

.daily-metric.metric-red { border-left-color: var(--red); background: var(--red-bg); }
.daily-metric.metric-yellow { border-left-color: #cf9a2b; background: var(--yellow-bg); }
.daily-metric.metric-green { border-left-color: var(--green); background: var(--green-bg); }

.meal-log-card {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfcfb;
}

.meal-log-card > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.meal-log-card > summary::-webkit-details-marker {
  display: none;
}

.meal-log-card[open] > summary {
  border-bottom: 1px solid var(--border);
  background: #f4f8f4;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.meal-type-pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 800;
}

.meal-log-title {
  flex: 1;
  min-width: 0;
}

.meal-log-title strong,
.meal-log-title small {
  display: block;
}

.meal-log-title small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-log-body {
  padding: 13px;
}

.meal-log-nutrients {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.meal-log-nutrients b {
  color: var(--text);
}

.meal-log-issues {
  margin-bottom: 13px;
  color: #5c4930;
  font-size: 0.82rem;
}

.history-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-dates button {
  display: grid;
  min-height: 48px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.history-dates button:hover,
.history-dates button.is-current {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.history-dates button small {
  color: var(--muted);
  font-size: 0.72rem;
}

/* 健康档案。 */
.profile-form {
  display: grid;
  gap: 6px;
}

.form-section {
  padding: 5px 0 19px;
  border-bottom: 1px solid var(--border);
}

.form-section h3 {
  margin-bottom: 8px;
}

.two-column-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.two-column-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-card {
  position: relative;
  display: block;
  min-height: 96px;
  padding: 13px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfcfb;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice-card:hover {
  border-color: #9fc5ad;
  transform: translateY(-1px);
}

.choice-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-card-body,
.disease-option-body {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.choice-card-body {
  display: grid;
  gap: 3px;
}

.choice-card strong {
  font-size: 0.98rem;
}

.choice-card small,
.disease-option small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.disease-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.disease-option {
  position: relative;
  display: block;
  min-height: 84px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfcfb;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.disease-option.is-selected {
  border-color: #c98178;
  background: #fff7f6;
}

.disease-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.disease-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #f0f4f0;
  color: var(--primary-dark);
  font-weight: 900;
}

.disease-option.is-selected .disease-icon {
  background: var(--red-bg);
  color: var(--red);
}

.disease-option-body > span:last-child {
  display: grid;
  gap: 2px;
}

.profile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 7px 0 16px;
}

.profile-actions .button {
  min-width: 190px;
}

.save-status {
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 700;
}

.danger-zone {
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  background: #fffafa;
}

.danger-zone p {
  color: var(--muted);
  font-size: 0.84rem;
}

.app-footer {
  max-width: 880px;
  margin: 24px auto 0;
  padding: 14px 8px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.app-footer p {
  margin-bottom: 4px;
}

.toast {
  position: fixed;
  z-index: 60;
  right: 16px;
  bottom: 86px;
  left: 16px;
  width: auto;
  margin: 0 auto;
  padding: 13px 16px;
  border: 1px solid #9ac5aa;
  border-radius: 13px;
  background: #123f2e;
  box-shadow: 0 12px 30px rgba(15, 46, 33, 0.25);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.toast-error {
  border-color: #d08b85;
  background: #7b201b;
}

.toast-warning {
  border-color: #d4ae5a;
  background: #6c4706;
}

.noscript-warning {
  margin: 20px;
  padding: 16px;
  border: 1px solid var(--red-border);
  background: var(--red-bg);
  color: var(--red);
  text-align: center;
}

/* 桌面端增加密度，但仍保留大按钮。 */
@media (min-width: 720px) {
  .action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .meal-summary-strip {
    grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  }

  .summary-primary {
    grid-column: auto;
  }

  .disease-result-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nutrient-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .daily-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .save-grid {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 0.7fr) auto;
  }

  .save-grid .button {
    grid-column: auto;
  }

  .goal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-inline: 12px;
  }

  .app-header {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .brand-block p {
    max-width: 180px;
  }

  .panel {
    padding: 17px;
    border-radius: 19px;
  }

  .add-ingredient-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .add-ingredient-box .button {
    grid-column: 1 / -1;
  }

  .disease-grid,
  .goal-grid {
    grid-template-columns: 1fr;
  }

  .ingredient-controls {
    align-items: center;
    flex-wrap: wrap;
  }

  .delete-item-button {
    margin-left: auto;
  }

  .ingredient-foot {
    display: grid;
  }

  .two-column-grid {
    grid-template-columns: 1fr;
  }

  .meal-log-card > summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .meal-log-title {
    flex-basis: calc(100% - 70px);
  }

  .meal-log-card > summary .risk-chip {
    margin-left: 0;
  }
}

/* 打印日志时只保留内容，生成适合医生或家属查看的简易报告。 */
@media print {
  @page {
    margin: 14mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .app-header,
  .view[data-view="scan"],
  .view[data-view="profile"],
  .app-footer,
  .toast,
  #printReportButton,
  .history-dates,
  .danger-zone {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .view[data-view="log"] {
    display: block !important;
  }

  .panel {
    break-inside: avoid;
    margin-bottom: 10mm;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .meal-log-card {
    break-inside: avoid;
    border-color: #999;
  }

  .meal-log-card > summary {
    cursor: default;
    list-style: none;
  }

  .meal-log-card:not([open]) .meal-log-body {
    display: block;
  }

  .button {
    display: none !important;
  }

  .risk-red { color: #a00000 !important; }
  .risk-yellow { color: #704000 !important; }
  .risk-green { color: #145c2c !important; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* DeepSeek AI 深度分析：免费本地规则与会员 AI 能力明确分层。 */
.ai-analysis-box {
  margin-top: 16px;
  padding: 16px;
  border: 2px solid #b9d7c2;
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(231, 245, 235, 0.92), rgba(255, 251, 240, 0.94)),
    #f8fbf8;
}

.ai-analysis-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.ai-analysis-heading h4 {
  margin: 1px 0 0;
}

.ai-kicker {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.quota-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid #a9cbb7;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.ai-analysis-box .button {
  width: 100%;
  margin-top: 9px;
}

.ai-result {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  background: #fff;
}

.ai-result-headline {
  margin-bottom: 6px;
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.ai-result-summary {
  color: #405447;
  font-size: 0.9rem;
}

.ai-result h5 {
  margin: 13px 0 6px;
  font-size: 0.88rem;
}

.ai-result ul {
  margin: 0;
  padding-left: 1.2rem;
}

.ai-result li {
  margin-bottom: 6px;
}

.ai-provider-note {
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

/* 账户与会员中心。 */
.account-panel {
  border-color: #b9d7c2;
}

.account-user-row,
.account-guest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.account-user-meta strong {
  display: block;
  font-size: 1.08rem;
}

.account-user-meta span {
  color: var(--muted);
  font-size: 0.8rem;
}

.account-quota-card {
  margin-bottom: 13px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fbf8;
}

.account-quota-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.account-quota-top strong {
  font-size: 1.08rem;
}

.quota-progress {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e1e9e2;
}

.quota-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 13px;
  padding: 4px;
  border-radius: 13px;
  background: #eef4ef;
}

.auth-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button.is-active {
  background: #fff;
  box-shadow: 0 4px 12px rgba(23, 52, 34, 0.08);
  color: var(--primary-dark);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
}

.auth-form .button {
  margin-top: 3px;
}

.auth-error,
.auth-notice {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.auth-error {
  border: 1px solid var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.auth-notice {
  border: 1px solid var(--green-border);
  background: var(--green-bg);
  color: var(--green);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.membership-plan-card {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfcfb;
}

.membership-plan-card.is-current {
  border-color: var(--primary);
  background: var(--primary-light);
}

.membership-plan-card h4 {
  margin-bottom: 2px;
}

.plan-price {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-dark);
  font-size: 1.35rem;
  font-weight: 900;
}

.plan-price small {
  font-size: 0.72rem;
  font-weight: 600;
}

.plan-features {
  margin: 8px 0 11px;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.plan-features li {
  margin-bottom: 4px;
}

.membership-plan-card .button {
  width: 100%;
  min-height: 44px;
  padding-inline: 8px;
  font-size: 0.82rem;
}

.account-logout-button {
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 520px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .account-user-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =========================================================
   卡通亲和风视觉层
   目标：更圆润、更有食物表情和贴纸感，同时保持大字号与医疗警示清晰。
   ========================================================= */
:root {
  --cartoon-outline: #24533c;
  --cartoon-shadow: rgba(36, 83, 60, 0.16);
  --cartoon-yellow: #ffd76e;
  --cartoon-yellow-dark: #d5a52e;
  --cartoon-blue: #dff1ff;
  --cartoon-peach: #ffe7d8;
  --cartoon-mint: #e0f5e5;
}

body {
  background:
    radial-gradient(circle at 8% 3%, rgba(255, 220, 126, 0.34), transparent 18rem),
    radial-gradient(circle at 92% 18%, rgba(157, 219, 178, 0.34), transparent 20rem),
    radial-gradient(circle at 20% 80%, rgba(177, 222, 255, 0.24), transparent 22rem),
    linear-gradient(180deg, #fbf9ef 0%, #f3f8ef 55%, #eef6f0 100%);
  background-attachment: fixed;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(36, 83, 60, 0.08) 1.3px, transparent 1.3px);
  background-size: 26px 26px;
  content: "";
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 72%);
}

.app-header {
  border-bottom: 2px solid rgba(36, 83, 60, 0.13);
  background: rgba(255, 252, 241, 0.94);
}

.brand-mark {
  border: 3px solid #174c38;
  border-radius: 19px;
  box-shadow: 0 5px 0 #bdd8c5, 0 10px 22px rgba(23, 107, 77, 0.2);
  transform: rotate(-3deg);
}

.brand-block p {
  color: #5c715f;
}

.text-scale-button {
  border-width: 3px;
  border-radius: 15px;
  box-shadow: 0 4px 0 #c4dbc8;
}

.tab-nav {
  gap: 9px;
}

.tab-button {
  border: 2px solid transparent;
  border-radius: 16px;
  font-size: 0.9rem;
}

.tab-button span {
  margin-right: 3px;
}

.tab-button.is-active {
  border-color: #174c38;
  box-shadow: 0 4px 0 #b7d1bd;
  transform: translateY(-1px);
}

.hero-card {
  overflow: visible;
  border: 3px solid var(--cartoon-outline);
  border-radius: 28px;
  background:
    radial-gradient(circle at 17% 20%, rgba(255, 255, 255, 0.9) 0 5px, transparent 6px),
    radial-gradient(circle at 87% 16%, rgba(255, 255, 255, 0.75) 0 7px, transparent 8px),
    linear-gradient(135deg, #fff1ad 0%, #e5f6d9 55%, #dff3e7 100%);
  background-size: 72px 72px, 98px 98px, auto;
  box-shadow: 0 8px 0 #bdd6c2, 0 18px 36px var(--cartoon-shadow);
}

.hero-card::after {
  right: 14px;
  bottom: 8px;
  width: 132px;
  height: 132px;
  border: 24px solid rgba(255, 255, 255, 0.34);
}

.hero-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(170px, 0.55fr);
  gap: 18px;
  align-items: center;
}

.hero-copy {
  min-width: 0;
}

.hero-card h2 {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  letter-spacing: -0.04em;
}

.hero-card p {
  color: #365443;
}

.eyebrow {
  border: 2px solid #7fad73;
  background: #f8ffe8;
  box-shadow: 0 3px 0 rgba(127, 173, 115, 0.26);
  transform: rotate(-1deg);
}

.hero-chips span {
  border: 2px solid rgba(36, 83, 60, 0.18);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 3px 0 rgba(36, 83, 60, 0.08);
  color: #244f3a;
}

.hero-mascot {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
}

.hero-mascot img {
  position: relative;
  z-index: 2;
  width: min(100%, 220px);
  filter: drop-shadow(0 9px 5px rgba(36, 83, 60, 0.16));
  animation: mascot-bob 3.4s ease-in-out infinite;
}

.mascot-bubble {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  padding: 6px 12px;
  border: 2px solid var(--cartoon-outline);
  border-radius: 15px 15px 15px 4px;
  background: #fff;
  color: var(--cartoon-outline);
  box-shadow: 0 4px 0 rgba(36, 83, 60, 0.13);
  font-size: 0.8rem;
  font-weight: 900;
  transform: rotate(2deg);
}

.mascot-sparkle {
  position: absolute;
  z-index: 1;
  color: #e4a821;
  font-size: 1.5rem;
  animation: sparkle-pop 2.4s ease-in-out infinite;
}

.sparkle-one { top: 42%; left: 3%; }
.sparkle-two { right: 3%; bottom: 15%; animation-delay: 0.8s; }

@keyframes mascot-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1deg); }
}

@keyframes sparkle-pop {
  0%, 100% { opacity: 0.45; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.12) rotate(12deg); }
}

.panel {
  border: 2px solid #cfdbcd;
  border-radius: 24px;
  box-shadow: 0 6px 0 rgba(36, 83, 60, 0.08), 0 15px 30px rgba(36, 83, 60, 0.07);
}

.step-label {
  margin-bottom: 6px;
  padding: 3px 9px;
  border: 1.5px solid #9ac6a7;
  border-radius: 999px;
  background: #e9f8e9;
  color: #245d3f;
  font-size: 0.73rem;
  transform: rotate(-1deg);
}

.button {
  border-width: 2px;
  border-radius: 15px;
  box-shadow: 0 5px 0 rgba(36, 83, 60, 0.18);
}

.button-primary {
  border-color: #174c38;
  box-shadow: 0 5px 0 #174c38;
}

.button-secondary {
  border-color: #d0a12f;
  background: #ffe49a;
  color: #60450c;
  box-shadow: 0 5px 0 #d0a12f;
}

.button-quiet {
  border-color: #a7bed0;
  background: var(--cartoon-blue);
  color: #294c65;
  box-shadow: 0 5px 0 #a7bed0;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(36, 83, 60, 0.2);
}

.upload-drop {
  border: 3px dashed #73a981;
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 217, 111, 0.24) 0 25px, transparent 26px),
    linear-gradient(145deg, #fbfff8, #edf8ea);
}

.upload-icon {
  border: 2px solid #bcd8c3;
  background: #fffdf4;
  font-size: 1.65rem;
  transform: rotate(-3deg);
}

.status-box {
  border-width: 2px;
  border-radius: 14px;
}

.empty-result {
  border: 3px dashed #9fc1a8;
  background: rgba(255, 255, 247, 0.88);
}

.empty-result-icon {
  border: 2px solid #bdd8c4;
  background: #fff5c8;
  box-shadow: 0 5px 0 #d8e8d9;
  font-size: 1.8rem;
  transform: rotate(-5deg);
}

.summary-primary,
.summary-metric,
.nutrient-tile,
.daily-metric,
.disease-result,
.ingredient-item,
.meal-log-card,
.membership-plan-card,
.choice-card,
.disease-option {
  border-radius: 17px;
}

.summary-primary {
  border: 2px solid #c6ddc9;
  background: linear-gradient(135deg, #eefbe8, #fff8df);
}

.summary-metric {
  box-shadow: 0 3px 0 rgba(36, 83, 60, 0.06);
}

.nutrient-tile {
  border-width: 2px;
  box-shadow: 0 3px 0 rgba(36, 83, 60, 0.07);
}

.nutrient-tile:nth-child(4n+1) { background: #eef9e7; }
.nutrient-tile:nth-child(4n+2) { background: #fff5d9; }
.nutrient-tile:nth-child(4n+3) { background: #e9f6ff; }
.nutrient-tile:nth-child(4n+4) { background: #ffede6; }

.meal-summary-strip .summary-metric:nth-child(2) { background: #fff6d9; }
.meal-summary-strip .summary-metric:nth-child(3) { background: #e9f7ff; }
.meal-summary-strip .summary-metric:nth-child(4) { background: #ffebe5; }

.advice-block {
  border: 2px solid #b8d7c2;
  background: #f0f9ec;
}

.medical-disclaimer {
  border: 2px solid #d5a52e;
  background: rgba(255, 247, 205, 0.98);
  box-shadow: 0 7px 0 rgba(213, 165, 46, 0.18), 0 13px 28px rgba(72, 49, 4, 0.12);
}

.account-panel {
  background:
    radial-gradient(circle at 93% 5%, rgba(255, 219, 112, 0.22) 0 45px, transparent 46px),
    var(--surface);
}

.plan-grid .membership-plan-card:nth-child(1) { background: #f2faed; }
.plan-grid .membership-plan-card:nth-child(2) { background: #fff8df; }

.auth-tabs {
  border: 2px solid #c8dbc9;
  background: #edf7ea;
}

.auth-tabs button.is-active {
  color: #174c38;
  box-shadow: 0 3px 0 #c2d9c6;
}

.settings-details summary {
  color: #285f43;
}

@media (min-width: 720px) {
  .hero-card {
    padding: 30px 32px;
  }
}

@media (max-width: 639px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .hero-mascot {
    width: 170px;
    min-height: 140px;
    margin: -4px 4px 0 auto;
  }

  .hero-mascot img {
    width: 160px;
  }

  .mascot-bubble {
    top: -5px;
    right: 0;
  }

  .tab-button span {
    display: block;
    margin: 0 0 1px;
    font-size: 1rem;
  }
}

/* 返回导航：主页面返回栈和结果页返回拍照。 */
.brand-row {
  gap: 8px;
}

.brand-block {
  flex: 1;
}

.back-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 68px;
  min-height: 48px;
  padding: 7px 10px;
  border: 2px solid var(--cartoon-outline);
  border-radius: 14px;
  background: #fff9db;
  box-shadow: 0 4px 0 #d8c06a;
  color: var(--cartoon-outline);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.back-button:hover {
  background: #fff2aa;
  transform: translateY(-1px);
}

.back-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d8c06a;
}

.back-arrow {
  font-size: 1.15rem;
  line-height: 1;
}

.result-back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  margin: 0 0 12px;
  padding: 6px 11px;
  border: 1.5px solid #a9c7b2;
  border-radius: 999px;
  background: #f4fbf1;
  color: #2a6547;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.result-back-button:hover {
  border-color: var(--primary);
  background: #e7f5e8;
}

@media (max-width: 420px) {
  .back-button {
    min-width: 46px;
    padding-inline: 8px;
  }

  .back-text {
    display: none;
  }

  .brand-block p {
    max-width: 105px;
  }
}

/* 最终颜色语义：紫色代表普通操作，黄色仅用于风险提醒。 */
.button-secondary {
  border-color: #9478c7;
  background: #eee7ff;
  color: #4d3475;
  box-shadow: 0 5px 0 #9478c7;
}

.button-secondary:hover:not(:disabled) {
  background: #e4d9ff;
}

.tab-button.is-active span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  vertical-align: middle;
}

/* 赞助商品牌位：使用品牌红、米黄和深青色，和主应用的绿色保持区分。 */
.sponsor-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
  padding: 16px;
  border: 2px solid #d33a32;
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 222, 152, 0.42), transparent 95px),
    linear-gradient(135deg, #fff9e9, #fff1d4);
  box-shadow: 0 5px 0 rgba(211, 58, 50, 0.14), 0 14px 28px rgba(90, 45, 20, 0.08);
}

.sponsor-logo {
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  border: 2px solid #e3c379;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 5px 12px rgba(112, 61, 21, 0.14);
}

.sponsor-kicker {
  display: inline-block;
  margin-bottom: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #d33a32;
  color: #fff8e8;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.sponsor-card h3 {
  margin-bottom: 3px;
  color: #7f2522;
  font-size: 1.12rem;
}

.sponsor-card p {
  margin: 0;
  color: #6c4b35;
  font-size: 0.84rem;
  font-weight: 700;
}

.footer-sponsor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px auto 10px;
  padding: 6px 11px 6px 7px;
  border: 1px solid #e1c37c;
  border-radius: 999px;
  background: #fff9e9;
  color: #68452f;
  font-size: 0.78rem;
}

.footer-sponsor img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.footer-sponsor strong {
  color: #8d2924;
}

@media (max-width: 420px) {
  .sponsor-card {
    align-items: flex-start;
    gap: 12px;
    padding: 13px;
  }

  .sponsor-logo {
    width: 76px;
    height: 76px;
  }
}

.sponsor-address {
  margin-top: 5px !important;
  color: #8d2924 !important;
  font-weight: 800;
}

.footer-sponsor-address {
  margin: 0 0 8px;
  color: #7c4e31;
  font-size: 0.76rem;
  font-weight: 700;
}

.parent-brand-label {
  display: inline-block;
  margin-right: 3px;
  padding: 1px 6px;
  border: 1px solid #b8d4bf;
  border-radius: 999px;
  background: #f4fbef;
  color: #245d3f;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}

/* =========================================================
   BoxApp 橙色品牌主题
   品牌交互统一使用橙色；绿色仅保留给“适宜食用”和正向状态。
   ========================================================= */
:root {
  --primary: #d75b1f;
  --primary-dark: #8f340d;
  --primary-light: #fff0e4;
  --text: #35241a;
  --muted: #6b5548;
  --border: #ead8c9;
  --border-strong: #d4b49d;
  --cartoon-outline: #6f2f10;
  --cartoon-shadow: rgba(111, 47, 16, 0.16);
}

body {
  background:
    radial-gradient(circle at 8% 3%, rgba(255, 184, 105, 0.34), transparent 19rem),
    radial-gradient(circle at 92% 18%, rgba(255, 220, 166, 0.38), transparent 21rem),
    radial-gradient(circle at 20% 80%, rgba(255, 201, 169, 0.25), transparent 22rem),
    linear-gradient(180deg, #fffaf2 0%, #fff5e9 55%, #fff8ef 100%);
}

body::before {
  background-image: radial-gradient(rgba(111, 47, 16, 0.075) 1.3px, transparent 1.3px);
}

.app-header {
  border-bottom-color: rgba(143, 52, 13, 0.16);
  background: rgba(255, 249, 240, 0.95);
}

.brand-mark {
  border-color: #6f2f10;
  background: linear-gradient(145deg, #f28c46, #c84813);
  box-shadow: 0 5px 0 #f1bc98, 0 10px 22px rgba(200, 72, 19, 0.22);
}

.brand-block p {
  color: #765b4c;
}

.parent-brand-label {
  border-color: #efb489;
  background: #fff4e9;
  color: #8f340d;
}

.text-scale-button {
  border-color: #d75b1f;
  color: #a53c0e;
  box-shadow: 0 4px 0 #f2bfa0;
}

.tab-button:hover {
  background: #fff0e4;
  color: #8f340d;
}

.tab-button.is-active {
  border-color: #6f2f10;
  background: #d75b1f;
  color: #fffaf4;
  box-shadow: 0 4px 0 #f0b58f;
}

.hero-card {
  border-color: #6f2f10;
  background:
    radial-gradient(circle at 17% 20%, rgba(255, 255, 255, 0.9) 0 5px, transparent 6px),
    radial-gradient(circle at 87% 16%, rgba(255, 255, 255, 0.75) 0 7px, transparent 8px),
    linear-gradient(135deg, #fff1c8 0%, #ffe5d3 55%, #fff1e3 100%);
  box-shadow: 0 8px 0 #f0c1a0, 0 18px 36px rgba(111, 47, 16, 0.14);
}

.hero-card p {
  color: #654536;
}

.eyebrow {
  border-color: #e6a373;
  background: #fff7e8;
  color: #7d3210;
}

.hero-chips span {
  border-color: rgba(143, 52, 13, 0.18);
  color: #6d341a;
}

.mascot-bubble {
  border-color: #6f2f10;
  color: #6f2f10;
}

.panel {
  border-color: #efd9c9;
  box-shadow: 0 6px 0 rgba(111, 47, 16, 0.07), 0 15px 30px rgba(111, 47, 16, 0.07);
}

.step-label {
  border-color: #edb890;
  background: #fff1e5;
  color: #8f340d;
}

.button-primary {
  border-color: #6f2f10;
  background: #d75b1f;
  color: #fffaf5;
  box-shadow: 0 5px 0 #8f340d;
}

.button-primary:hover:not(:disabled) {
  background: #c84c15;
}

.upload-drop {
  border-color: #d9915e;
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 210, 131, 0.32) 0 25px, transparent 26px),
    linear-gradient(145deg, #fffaf2, #fff0e0);
}

.upload-icon {
  border-color: #f0c4a7;
  background: #fffaf2;
}

.status-loading {
  border-color: #edb890;
  background: #fff0e4;
  color: #8f340d;
}

.empty-result {
  border-color: #e0ad8b;
  background: rgba(255, 250, 243, 0.9);
}

.empty-result-icon {
  border-color: #f0c4a7;
  background: #fff0d2;
  box-shadow: 0 5px 0 #f4ddcf;
}

.result-overview {
  border-color: #edb890;
}

.source-badge,
.engine-badge {
  background: #fff0e4;
  color: #8f340d;
}

.quota-badge {
  border-color: #edb890;
  color: #8f340d;
}

.summary-primary {
  border-color: #f0c7aa;
  background: linear-gradient(135deg, #fff2e7, #fff9e8);
}

.nutrient-tile:nth-child(4n+1) {
  background: #fff1e6;
}

.advice-block {
  border-color: #edb890;
  background: #fff7ed;
}

.ai-analysis-box {
  border-color: #edb890;
  background:
    linear-gradient(145deg, rgba(255, 239, 225, 0.96), rgba(255, 250, 234, 0.95)),
    #fffaf4;
}

.ai-kicker {
  color: #a33c0e;
}

.ai-result-headline {
  color: #8f340d;
}

.account-panel {
  background:
    radial-gradient(circle at 93% 5%, rgba(255, 202, 128, 0.25) 0 45px, transparent 46px),
    var(--surface);
}

.auth-tabs {
  border-color: #ead8c9;
  background: #fff2e7;
}

.auth-tabs button.is-active {
  color: #8f340d;
  box-shadow: 0 3px 0 #f0c5a8;
}

.account-quota-card {
  background: #fffaf4;
}

.quota-progress span {
  background: #d75b1f;
}

.plan-grid .membership-plan-card:nth-child(1) {
  background: #fff7ee;
}

.plan-grid .membership-plan-card:nth-child(2) {
  background: #fff0e3;
}

.choice-card.is-selected {
  border-color: #d75b1f;
  background: #fff0e4;
  box-shadow: inset 0 0 0 1px #d75b1f;
}

.disease-option.is-selected {
  border-color: #e09a73;
  background: #fff8f3;
}

.result-back-button {
  border-color: #edb890;
  background: #fff5eb;
  color: #8f340d;
}

.result-back-button:hover {
  border-color: #d75b1f;
  background: #fff0e4;
}

.back-button {
  border-color: #6f2f10;
  background: #fff3d9;
  box-shadow: 0 4px 0 #e3b46f;
  color: #6f2f10;
}

.footer-sponsor-address {
  color: #754834;
}

/* 风险状态继续使用红 / 黄 / 绿，不随品牌橙色改变。 */
.risk-green { border-color: var(--green-border); background: var(--green-bg); color: var(--green); }
.risk-yellow { border-color: var(--yellow-border); background: var(--yellow-bg); color: var(--yellow); }
.risk-red { border-color: var(--red-border); background: var(--red-bg); color: var(--red); }

.footer-legal {
  width: 100%;
  font-size: clamp(8px, 2.05vw, 11px);
  line-height: 1.45;
  white-space: nowrap;
  letter-spacing: -0.025em;
}

/* 首页四个能力标签：橙黄色贴纸底。 */
.hero-chips span {
  border-color: #e3a34d;
  background: linear-gradient(180deg, #fff0b8 0%, #ffd991 100%);
  box-shadow: 0 3px 0 rgba(199, 126, 33, 0.2);
  color: #71320e;
}

/* 页脚底部预留空间，避免说明文字贴近底部固定免责声明。 */
.app-footer {
  padding-bottom: 92px;
}

.footer-legal {
  margin-bottom: 12px;
}

/* 首页吉祥物使用千仓老碗陕西面品牌面碗。 */
.hero-mascot .sponsor-mascot-image {
  width: 190px;
  max-width: 90%;
  aspect-ratio: 1;
  border: 3px solid #6f2f10;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  filter: drop-shadow(0 9px 6px rgba(111, 47, 16, 0.18));
}

@media (max-width: 639px) {
  .hero-mascot .sponsor-mascot-image {
    width: 165px;
  }
}

/* 千仓老碗品牌标作为首页精灵：完整展示、轻微悬浮。 */
.hero-mascot {
  min-height: 235px;
  padding-top: 42px;
}

.hero-mascot .sponsor-mascot-image {
  width: 205px;
  max-width: 100%;
  aspect-ratio: 1;
  padding: 4px;
  border: 3px solid #6f2f10;
  border-radius: 50%;
  background: #fffaf2;
  object-fit: contain;
  box-shadow: 0 10px 20px rgba(111, 47, 16, 0.16);
  animation: mascot-bob 3.2s ease-in-out infinite;
}

.hero-mascot .mascot-bubble {
  top: 0;
  right: auto;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  white-space: nowrap;
}

@media (max-width: 639px) {
  .hero-mascot {
    width: 205px;
    min-height: 210px;
    padding-top: 38px;
  }

  .hero-mascot .sponsor-mascot-image {
    width: 175px;
  }
}

/* 应用内相机弹层。 */
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(53, 28, 14, 0.72);
  backdrop-filter: blur(8px);
}

.camera-dialog {
  width: min(100%, 640px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border: 3px solid #6f2f10;
  border-radius: 24px;
  background: #fffaf3;
  box-shadow: 0 18px 50px rgba(54, 28, 13, 0.3);
}

.camera-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.camera-close-button {
  min-width: 64px;
  min-height: 46px;
  border: 1px solid #d8b9a5;
  border-radius: 12px;
  background: #fff;
  color: #6b4531;
  font-weight: 800;
  cursor: pointer;
}

.camera-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 2px solid #6f2f10;
  border-radius: 18px;
  background: #27170e;
  object-fit: cover;
}

.camera-status {
  margin: 11px 0;
  padding: 9px 11px;
  border-radius: 11px;
  background: #fff0e4;
  color: #7b3b18;
  font-size: 0.84rem;
  font-weight: 700;
}

.camera-status.is-error {
  background: var(--red-bg);
  color: var(--red);
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 420px) {
  .camera-actions {
    grid-template-columns: 1fr;
  }
}

/* 快速记录与菜品确认。 */
.quick-meal-panel {
  border-color: #edb890;
  background:
    radial-gradient(circle at 95% 0%, rgba(255, 215, 120, 0.22), transparent 120px),
    #fffdf8;
}

.dish-search-field input {
  width: 100%;
  min-height: 54px;
  padding: 11px 15px;
  border: 2px solid #d9b69d;
  border-radius: 15px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
}

.dish-search-field input:focus {
  border-color: var(--primary);
  outline: 4px solid rgba(215, 91, 31, 0.15);
}

.dish-quick-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.dish-result-card {
  padding: 12px;
  border: 1.5px solid #ead7c8;
  border-radius: 15px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.dish-result-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 0 rgba(215, 91, 31, 0.12);
  transform: translateY(-1px);
}

.dish-result-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.96rem;
}

.dish-result-card small {
  color: var(--muted);
  font-size: 0.76rem;
}

.dish-result-kcal {
  display: block;
  margin-top: 7px;
  color: #8f340d;
  font-size: 0.82rem;
  font-weight: 800;
}

.quick-manual-button {
  min-height: 44px;
  margin-top: 12px;
  padding: 6px 4px;
  border: 0;
  border-bottom: 1px solid #d7b9a7;
  background: transparent;
  color: var(--primary-dark);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

/* 菜品确认弹层。 */
.dish-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(53, 28, 14, 0.72);
  backdrop-filter: blur(8px);
}

.dish-dialog {
  width: min(100%, 620px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border: 3px solid #6f2f10;
  border-radius: 24px;
  background: #fffaf3;
  box-shadow: 0 18px 50px rgba(54, 28, 13, 0.3);
}

.dish-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dish-ingredient-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.dish-ingredient-preview span {
  padding: 5px 9px;
  border: 1px solid #eed8c7;
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
}

.dish-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  border: 0;
}

.dish-choice-group legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.dish-choice-group label {
  position: relative;
  cursor: pointer;
}

.dish-choice-group input {
  position: absolute;
  opacity: 0;
}

.dish-choice-group span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 2px solid #e4d2c3;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
}

.dish-choice-group input:checked + span {
  border-color: var(--primary);
  background: #fff0e4;
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.dish-nutrition-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.dish-nutrition-preview div {
  padding: 9px;
  border-radius: 11px;
  background: #fff2e7;
  text-align: center;
}

.dish-nutrition-preview span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.dish-nutrition-preview strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
}

.dish-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 9px;
  margin-top: 14px;
}

@media (max-width: 420px) {
  .dish-quick-results {
    grid-template-columns: 1fr;
  }

  .dish-nutrition-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dish-confirm-actions {
    grid-template-columns: 1fr;
  }
}

.food-search-label {
  grid-column: 1 / -1;
}

/* 包装食品扫码：与快速记录区分开，使用更活泼的橙黄色卡片。 */
.barcode-panel {
  border: 2px solid #e6a271;
  background:
    radial-gradient(circle at 94% 0%, rgba(255, 193, 74, 0.28), transparent 150px),
    linear-gradient(145deg, #fffdf7, #fff4e8);
}

.barcode-engine-badge {
  border-color: #e9a65f;
  background: #fff0d4;
  color: #8f3c10;
}

.barcode-primary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.barcode-scan-button {
  font-size: 1.02rem;
}

.barcode-manual-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}

.barcode-manual-row label,
.barcode-amount-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.barcode-manual-row input,
.barcode-amount-row input {
  width: 100%;
  min-height: 50px;
  padding: 10px 13px;
  border: 2px solid #d9b69d;
  border-radius: 13px;
  background: #fff;
  color: var(--text);
}

.barcode-manual-row input:focus,
.barcode-amount-row input:focus {
  border-color: #d75b1f;
  outline: 4px solid rgba(215, 91, 31, 0.15);
}

.barcode-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.barcode-status.is-success {
  color: #23683d;
}

.barcode-status.is-warning {
  color: #865000;
}

.barcode-status.is-error {
  color: var(--red);
}

.barcode-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.barcode-example-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.barcode-example-button {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px dashed #d79a6b;
  border-radius: 999px;
  background: #fffaf1;
  color: #8f3c10;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.barcode-product-preview {
  margin-top: 15px;
  padding: 14px;
  border: 2px solid #e6b18b;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 7px 0 rgba(215, 91, 31, 0.07);
}

.barcode-product-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.barcode-product-heading h4 {
  margin: 5px 0 3px;
  font-size: 1.12rem;
}

.barcode-product-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.barcode-demo-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff0d4;
  color: #8f3c10;
  font-size: 0.68rem;
  font-weight: 800;
}

.barcode-nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.barcode-nutrition-grid div {
  padding: 8px 5px;
  border-radius: 11px;
  background: #fff4e8;
  text-align: center;
}

.barcode-nutrition-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.barcode-nutrition-grid strong {
  display: block;
  margin-top: 2px;
  font-size: 0.84rem;
}

.barcode-amount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 0.9fr;
  align-items: end;
  gap: 8px;
  margin-top: 13px;
}

.barcode-amount-unit {
  padding-bottom: 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.barcode-product-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

/* 扫码弹层。 */
.barcode-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(53, 28, 14, 0.78);
  backdrop-filter: blur(8px);
}

.barcode-dialog {
  width: min(100%, 620px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border: 3px solid #6f2f10;
  border-radius: 24px;
  background: #fffaf3;
  box-shadow: 0 18px 50px rgba(54, 28, 13, 0.3);
}

.barcode-reader {
  min-height: 250px;
  overflow: hidden;
  border: 3px dashed #d75b1f;
  border-radius: 18px;
  background: #20140d;
}

.barcode-reader video {
  width: 100% !important;
  border-radius: 14px;
}

.barcode-reader button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: #d75b1f;
  color: #fff;
  font-weight: 800;
}

.barcode-scan-status {
  margin: 12px 0 0;
  color: #5f4739;
  font-size: 0.86rem;
  font-weight: 700;
}

.barcode-scan-status.is-error {
  color: var(--red);
}

.barcode-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

@media (max-width: 520px) {
  .barcode-primary-actions,
  .barcode-modal-actions {
    grid-template-columns: 1fr;
  }

  .barcode-manual-row {
    grid-template-columns: 1fr;
  }

  .barcode-nutrition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .barcode-amount-row {
    grid-template-columns: 1fr auto;
  }

  .barcode-amount-row .button {
    grid-column: 1 / -1;
  }
}
