:root {
  color-scheme: light dark;
  --bg: #f7f5ef;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --text: #24251f;
  --muted: #66685f;
  --line: #deded4;
  --brand: #287c45;
  --brand-soft: #e4f2e8;
  --ok: #0ca30c;
  --watch: #875800;
  --watch-soft: #fff0c8;
  --unknown: #686963;
  --unknown-soft: #ecece8;
  --shadow: 0 10px 30px rgba(47, 54, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171814;
    --surface: #20221d;
    --surface-strong: #282a24;
    --text: #f1f1e9;
    --muted: #b9baaf;
    --line: #3b3e35;
    --brand: #7ed49a;
    --brand-soft: #213a2a;
    --ok: #7edb74;
    --watch: #ffd36a;
    --watch-soft: #493b18;
    --unknown: #c5c6bd;
    --unknown-soft: #353730;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "PingFang HK", "Noto Sans HK", sans-serif;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-underline-offset: 3px; }
.site-shell { width: min(100%, 560px); margin: 0 auto; padding: 0 18px calc(108px + env(safe-area-inset-bottom)); }
.site-header { padding: 22px 2px 12px; }
.site-header .brand { color: var(--text); font-size: 30px; font-weight: 850; text-decoration: none; letter-spacing: .04em; }
.site-header p { margin: 0; color: var(--brand); font-size: 17px; font-weight: 650; }
main { min-height: 58vh; }
h1, h2, h3 { line-height: 1.25; }
h1 { margin: 18px 0 8px; font-size: 28px; }
h2 { margin: 26px 0 12px; font-size: 22px; }
h3 { margin: 0 0 8px; font-size: 18px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.lead { font-size: 19px; }
.card {
  margin: 12px 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.menu-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.menu-row:last-child { border-bottom: 0; }
.dish-link { color: var(--text); font-weight: 750; text-decoration: none; }
.dish-link:hover { color: var(--brand); }
.icon { display: inline-block; width: 1.8em; }
.button, button {
  min-height: 46px;
  border: 1px solid var(--brand);
  border-radius: 13px;
  padding: 9px 15px;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) { .button, button { color: #102117; } }
.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.button.secondary, button.secondary { background: transparent; color: var(--brand); }
.button.small, button.small { min-height: 44px; padding: 6px 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.button-row > * { flex: 1 1 170px; }
.attention { border-left: 5px solid var(--watch); }
.status { display: inline-flex; gap: 6px; align-items: center; border-radius: 999px; padding: 3px 10px; font-weight: 800; font-size: 15px; }
.status-ok { color: var(--ok); background: var(--brand-soft); }
.status-watch { color: var(--watch); background: var(--watch-soft); }
.status-unknown { color: var(--unknown); background: var(--unknown-soft); }
.nutrition-line { color: var(--muted); font-weight: 650; }
.nutrition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nutrition-grid div { padding: 12px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--line); }
.nutrition-grid dt { color: var(--muted); }
.nutrition-grid dd { margin: 3px 0 0; font-weight: 800; }
.member-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.tabs button { min-height: 44px; padding: 7px; background: transparent; color: var(--muted); border-color: var(--line); }
.tabs button[aria-selected="true"] { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.tab-panel[hidden] { display: none; }
.ingredient-list, .steps { margin: 0; padding-left: 1.25em; }
.ingredient-list li, .steps li { padding: 6px 0; }
.ingredient-list li { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.swap-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.swap-option { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; padding: 9px 0; cursor: pointer; }
.swap-option input { width: 21px; height: 21px; margin: 3px 0 0; accent-color: var(--brand); }
.swap-note-group { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.fixed-note { color: var(--muted); font-size: 15px; }
.compare-table, .source-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.compare-table th, .compare-table td, .source-table th, .source-table td { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare-table th:not(:first-child), .compare-table td:not(:first-child) { text-align: right; }
.soup-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { border-radius: 999px; background: var(--brand-soft); color: var(--brand); padding: 3px 10px; font-size: 15px; font-weight: 700; }
.notice { background: var(--watch-soft); border-color: var(--watch); box-shadow: none; }
.family-form label:not(.check-label) { display: block; margin: 12px 0 5px; font-weight: 700; }
.family-form input[type="text"] { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: var(--surface-strong); color: var(--text); font-size: 17px; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.check-label { display: flex; align-items: center; gap: 7px; min-height: 44px; }
.check-label input { width: 21px; height: 21px; accent-color: var(--brand); }
details summary { min-height: 46px; display: flex; align-items: center; color: var(--brand); font-weight: 750; cursor: pointer; }
.site-footer { margin-top: 38px; padding: 22px 2px 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.site-footer p { margin: 8px 0; }
.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 560px);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.bottom-nav a { display: flex; min-height: 58px; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 700; }
.bottom-nav a[aria-current="page"] { color: var(--brand); }
.bottom-nav span { font-size: 20px; line-height: 1; }
.error { border-color: var(--watch); }

@media (max-width: 360px) {
  .site-shell { padding-inline: 14px; }
  .bottom-nav a { font-size: 15px; }
  .nutrition-grid { grid-template-columns: 1fr; }
}
