:root {
  color-scheme: light;
  --ink: #173b3a;
  --muted: #6a7c7a;
  --line: #dce8e5;
  --paper: #f7fbfa;
  --card: #ffffff;
  --teal: #0f766e;
  --teal-deep: #0b5f59;
  --mint: #dff4ee;
  --gold: #b7791f;
  --danger: #a33a32;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 760px); margin: 0 auto; padding: 28px 18px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 8vw, 42px); line-height: 1.04; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.2; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--muted); font-size: 18px; }
.hero-panel { margin: 28px 0 32px; padding: 22px; min-height: 132px; border-radius: 8px; background: var(--teal); color: #fff; display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }
.hero-copy { display: flex; align-items: center; gap: 8px; max-width: 170px; font-size: 13px; line-height: 1.45; color: #ccebe5; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #a7f3d0; }
.metric-preview { text-align: right; }
.metric-preview span, .metric-preview small { display: block; color: #ccebe5; font-size: 12px; }
.metric-preview strong { display: block; margin: 4px 0; font-size: 34px; line-height: 1; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.section-heading.compact { align-items: center; }
.data-chip, .confidence, .muted-label { color: var(--muted); font-size: 12px; }
.data-chip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: #edf7f3; }
section { margin-top: 28px; }
.capture-card { position: relative; display: block; min-height: 200px; border: 1px dashed #8dbdb3; border-radius: 8px; background: #eef8f5; overflow: hidden; }
.capture-card input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.capture-visual { min-height: 200px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--teal-deep); }
.capture-visual strong { font-size: 18px; }
.capture-visual span { color: var(--muted); font-size: 13px; }
.camera-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: white; font-size: 32px; }
.capture-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.capture-action { width: auto; display: inline-block; text-align: center; }
.preview-wrap { position: relative; margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.preview-wrap img { width: 100%; max-height: 250px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.hidden { display: none !important; }
.food-picker { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; }
.picker-backdrop { position: absolute; inset: 0; background: rgba(16, 37, 35, .46); }
.picker-panel { position: relative; width: min(100%, 760px); max-height: min(78vh, 620px); overflow: auto; margin: 0 auto; padding: 20px 18px 26px; border-radius: 14px 14px 0 0; background: var(--card); box-shadow: 0 -12px 40px rgba(23, 59, 58, .18); }
.picker-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.picker-close { flex: 0 0 auto; font-size: 24px; line-height: 1; }
.picker-search-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.picker-search { width: 100%; padding: 13px 14px; border: 1px solid #8dbdb3; border-radius: 8px; outline: 0; color: var(--ink); background: #fbfefd; }
.picker-search:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.picker-results { display: grid; gap: 8px; margin-top: 14px; }
.picker-result { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-align: left; }
.picker-result:active { background: var(--mint); }
.picker-result strong, .picker-result small { display: block; }
.picker-result small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.picker-arrow { color: var(--teal); font-size: 24px; }
.picker-empty { margin: 8px 2px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: var(--teal); font-weight: 700; }
.food-list { display: grid; gap: 10px; }
.food-row { display: grid; grid-template-columns: minmax(0, 1fr) 164px 34px; gap: 10px; align-items: center; padding: 13px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.food-info { min-width: 0; }
.food-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.food-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.food-match-label { display: block; margin-top: 8px; color: var(--gold); font-size: 11px; font-weight: 700; }
.food-match { display: block; width: 100%; margin-top: 5px; padding: 7px 8px; border: 1px solid #e5c98c; border-radius: 6px; color: var(--ink); background: #fffaf0; font-size: 12px; }
.food-amount { display: grid; gap: 5px; min-width: 0; }
.food-portion { width: 100%; min-width: 0; padding: 6px 5px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #fbfefd; font-size: 11px; }
.food-weight-wrap { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.food-weight { width: 100%; min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 6px; text-align: right; color: var(--ink); background: #fbfefd; }
.remove-button { width: 30px; height: 30px; border: 0; background: transparent; color: #9aa9a6; font-size: 22px; }
.helper-text { margin: 10px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.result-card { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.result-status { margin-bottom: 15px; color: var(--muted); font-size: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result-grid > div { padding: 12px 8px; border-radius: 6px; background: #f3f8f6; text-align: center; }
.result-grid span, .result-grid small { display: block; color: var(--muted); font-size: 11px; }
.result-grid strong { display: inline-block; margin: 8px 2px 2px; font-size: 22px; }
.total-cell { background: var(--mint) !important; }
.total-cell strong { color: var(--teal-deep); }
.level-row { display: flex; justify-content: space-between; align-items: center; margin: 15px 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.level { padding: 5px 10px; border-radius: 999px; font-size: 12px; }
.level.neutral { color: var(--muted); background: #edf1f0; }
.level.low { color: #226c4d; background: #dff4e8; }
.level.mid { color: #8c5b1c; background: #fff1d6; }
.level.high { color: #9b3e35; background: #fce4df; }
.primary-button, .secondary-button { border-radius: 6px; padding: 11px 15px; font-weight: 700; }
.primary-button { width: 100%; border: 0; background: var(--teal); color: #fff; }
.primary-button:active { background: var(--teal-deep); }
.secondary-button { border: 1px solid var(--line); background: var(--card); color: var(--teal-deep); white-space: nowrap; }
.notice { display: flex; gap: 10px; margin-top: 12px; padding: 12px; border-radius: 6px; background: #fff9eb; color: #806129; }
.notice-icon { flex: 0 0 auto; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #d9a441; color: white; font-size: 12px; font-weight: 800; }
.notice p { margin: 0; font-size: 12px; line-height: 1.5; }
.history-list { display: grid; gap: 8px; }
.history-item { display: flex; justify-content: space-between; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.history-item span { color: var(--muted); }
.source-links { display: grid; gap: 8px; margin-top: 12px; }
.source-links a { display: block; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--teal-deep); font-size: 13px; line-height: 1.4; text-decoration: none; }
.source-links a:active { background: var(--mint); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 10px 14px; border-radius: 6px; background: #163d3a; color: white; font-size: 13px; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 430px) { .app-shell { padding: 23px 14px 40px; } .hero-panel { align-items: center; } .food-row { grid-template-columns: minmax(0, 1fr) 142px 30px; gap: 7px; } .preview-wrap { grid-template-columns: 1fr; } .secondary-button { width: 100%; } .picker-panel { padding-left: 14px; padding-right: 14px; } }
