/* Friendly Field Guide: one presentation layer shared by the app and score guide.
   Status colors remain distinct from the decorative brand palette. */
:root {
  --bg: #fff6e8;
  --ink: #163e32;
  --muted: #55665c;
  --line: #d9d9c6;
  --teal: #205644;
  --lime: #dfe9bd;
  --good: #24603f;
  --mixed: #80520d;
  --bad: #a1352c;
  --blue: #355a70;
  --paper: #fffcf5;
  --coral: #ef694e;
  --apricot: #f8ddbb;
  --pistachio: #e8edcf;
  --visual-paper: var(--paper);
  --visual-cream: var(--bg);
  --radius: 18px;
  --visual-radius: 22px;
  --visual-shadow: 0 6px 22px #163e3208;
  --shadow: var(--visual-shadow);
  --font-display: Fraunces, Georgia, serif;
  --font-body: Manrope, "Segoe UI", sans-serif;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(#8d795a0c 0.6px, transparent 0.6px);
  background-size: 6px 6px;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
}

.ambient { display: none; }
.app-shell { max-width: 940px; gap: 20px; }
.page-section { gap: 20px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--visual-shadow);
  padding: 24px;
}

h1, h2, h3, .capture-title, .summary-head h2, .top-title,
.trends-panel-title, .food-result-summary-card .food-description,
.restaurant-recommendation-card h3 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.topbar.card {
  padding: 12px 0 18px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.top-title { font-size: 1.95rem; }
.account-link {
  min-height: 44px;
  color: var(--ink);
  padding: 8px 0 8px 12px;
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
}
.account-link:hover, .account-link.is-active { text-decoration: underline; color: var(--ink); }
.page-nav { gap: 8px; overflow: visible; }
.page-nav .nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 20px;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  font-weight: 700;
}
#nav-analyze-btn::before, #nav-restaurant-btn::before, #nav-trends-btn::before {
  content: none;
}
.page-nav .nav-btn.is-active { background: #f9d9c6; border-color: #efcbb7; }
.field-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.field-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Each illustration occupies one square of a 3 x 2 transparent sprite. */
.field-art {
  display: block;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  background: url("/assets/field-guide-illustrations.png") no-repeat;
  background-size: 300% 200%;
  pointer-events: none;
}
.field-art-camera { background-position: 0 0; }
.field-art-menu { background-position: 50% 0; }
.field-art-package { background-position: 100% 0; }
.field-art-triggers { background-position: 0 100%; }
.field-art-favorites { background-position: 50% 100%; }
.field-art-patterns { background-position: 100% 100%; }

#page-analyze > .card:first-child {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 4px 0 0;
}
.analyze-form { container: capture / inline-size; gap: 12px; }
.capture-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 12px;
  align-items: center;
  margin: 0 0 8px;
}
.capture-title {
  max-width: none;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.08;
}
.capture-header .field-art { width: 100px; height: 100px; }
.capture-caption {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 33ch;
}
.photo-cta, .restaurant-find-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
  font-size: 1.15rem;
  font-weight: 800;
}
.photo-cta .field-icon { width: 28px; height: 28px; }
.photo-cta:hover, .restaurant-find-cta:hover { background: #205644; filter: none; }
.photo-secondary-cta, .ghost-btn {
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
.analyze-form > .photo-secondary-cta {
  min-height: 44px;
  background: transparent;
  border-color: transparent;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.photo-secondary-cta:hover { background: #f5eddc; }
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
textarea, select, #description-input, #menu-input, .auth-input {
  border-color: #b4bead;
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
}
input::placeholder, textarea::placeholder { color: #627063; opacity: 1; }
#description-input { min-height: 48px; max-height: none; height: calc(1.4em + 26px); padding: 12px; line-height: 1.4; }
@supports (field-sizing: content) {
  #description-input:placeholder-shown { field-sizing: content; height: auto; }
}
/* Leave room for a wrapped hint when the user's type is large relative to the field. */
@container capture (max-width: 15em) {
  #description-input:placeholder-shown { min-height: calc(2.8em + 26px); }
}
@container capture (max-width: 9em) {
  #description-input:placeholder-shown { min-height: calc(4.2em + 26px); }
}
.analyze-btn, .action-primary {
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  box-shadow: none;
  min-height: 48px;
  font-weight: 800;
}
.analyze-btn:disabled, .action-primary:disabled {
  background: #deddd4;
  color: #5b6259;
  opacity: 1;
  box-shadow: none;
}
.action-btn, .refresh-btn, .scope-btn { border-radius: 12px; box-shadow: none; }
.action-secondary, .refresh-btn, .scope-btn.is-active {
  border-color: #becb9e;
  background: var(--pistachio);
  color: var(--ink);
}
.action-tertiary, .scope-btn, .ghost-btn {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}
.status-text:empty { display: none; }
.status-text { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.preview-wrap { background: #ebe9dc; box-shadow: none; border-radius: 18px; }

.menu-mode-wrap, .package-mode-wrap {
  margin-top: 18px;
  background: #fbefdf;
  border: 1px solid #ecdbc4;
  border-radius: 16px;
}
.package-mode-wrap { background: #edf0db; border-color: #dce2c5; margin-top: 10px; }
.menu-mode-summary {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 42px 10px 8px;
  color: var(--ink);
  min-height: 82px;
}
.menu-mode-summary .field-art { width: 58px; height: 58px; }
.field-mode-copy { display: grid; gap: 4px; }
.field-mode-copy strong { font: 800 1.12rem/1.15 var(--font-display); }
.field-mode-copy small { color: var(--muted); font-size: 0.76rem; font-weight: 500; line-height: 1.4; }
.menu-mode-summary::after, .trends-panel-summary::after {
  background: #f9d9c6;
  color: var(--ink);
  box-shadow: none;
  width: 26px;
  height: 26px;
}
.package-mode-wrap .menu-mode-summary::after { background: #dae4bb; }
.menu-mode-wrap[open] .menu-mode-summary,
.package-mode-wrap[open] .menu-mode-summary { border-bottom: 1px solid var(--line); }
.package-mode-wrap[open] .menu-mode-summary::after { content: "-"; transform: translateY(-50%); }
.menu-form { padding: 16px; gap: 12px; }

#results-section { background: var(--paper); }
#results-section .results-header h2, #results-section .result-guidance { color: var(--ink); }
.results-header h2 { font-size: 1.5rem; }
.result-guidance { font-size: 0.9rem; font-weight: 500; line-height: 1.5; }
.food-result-summary-card {
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1fr);
  gap: 20px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.result-thumb-frame { min-height: 160px; background: var(--pistachio); border-radius: 16px; }
.result-food-thumb { min-height: 180px; max-height: 440px; }
.result-thumb-placeholder { color: var(--ink); text-shadow: none; }
.result-thumb-placeholder::before { font-size: 2.5rem; filter: none; }
.result-summary-main { gap: 12px; }
.food-result-summary-card .food-description { font-size: 1.65rem; line-height: 1.15; }
.visual-verdict-card, .visual-verdict-card.verdict-good,
.visual-verdict-card.verdict-mixed, .visual-verdict-card.verdict-bad {
  background: transparent;
  border: 0;
  border-left: 3px solid var(--verdict-accent);
  border-radius: 0;
  box-shadow: none;
  padding: 2px 0 2px 10px;
  display: block;
  order: 5;
}
.verdict-mark, .verdict-kicker { display: none; }
.verdict-title { color: var(--ink); font: 800 1rem/1.35 var(--font-body); letter-spacing: 0; }
.verdict-copy { color: var(--muted); font-size: 0.85rem; font-weight: 500; margin-top: 4px; }
.score-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.score-card.score-card-visual {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  min-height: 134px;
  padding: 14px;
  border: 1px solid #dae2bc;
  border-radius: 16px;
  background: var(--pistachio);
  box-shadow: none;
}
#apob-card { background: #fbe5c7; border-color: #efd7b4; }
.score-ring {
  width: auto;
  height: auto;
  min-height: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  display: block;
}
.score-card-visual .score-value {
  color: var(--ink);
  font: 800 clamp(2.5rem, 8vw, 3.2rem)/1 var(--font-display);
  letter-spacing: -0.05em;
  margin: 0;
}
.score-value::after {
  content: "/100";
  margin-left: 4px;
  color: var(--muted);
  font: 500 0.7rem var(--font-body);
  letter-spacing: 0;
}
.score-card-copy { gap: 4px; }
.score-card-visual .score-label {
  color: var(--ink);
  font: 800 1.06rem/1.2 var(--font-display);
  letter-spacing: -0.02em;
  text-transform: none;
}
.score-card-visual .score-band {
  width: fit-content;
  font: 800 0.72rem/1.3 var(--font-body);
  border-radius: 5px;
  padding: 2px 6px;
  letter-spacing: 0;
}
.score-card-visual .band-good { color: var(--good); background: #f7f9eb; }
.score-card-visual .band-mixed { color: var(--mixed); background: #fff5dc; }
.score-card-visual .band-bad { color: var(--bad); background: #ffede5; }
.score-scale-note { color: var(--muted); font-size: 0.72rem; text-align: center; margin: -3px 0 0; }
.reason-tags { gap: 7px; min-height: 0; }
.reason-tag { padding: 7px 9px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; box-shadow: none; line-height: 1.3; }
.reason-tag-icon { background: none; color: var(--tag-color); padding: 0; min-width: 20px; min-height: 20px; }
.reason-tag-icon .field-icon { width: 20px; height: 20px; }
.reason-tag-good { --tag-color: var(--good); }
.reason-tag-mixed { --tag-color: var(--mixed); }
.reason-tag-bad { --tag-color: var(--bad); }
.analysis-meta-row { gap: 6px; }
.analysis-meta-row .analysis-confidence-details { width: auto; max-width: 100%; }
.analysis-confidence-badge { border-color: var(--line); border-radius: 8px; min-height: 44px; }
.result-safety-note { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.eat-slider-action {
  background: var(--pistachio);
  border: 1px solid #becb9e;
  border-radius: 16px;
  color: var(--ink);
  box-shadow: none;
}
.eat-slider-title, .eat-portion-value { color: var(--ink); }
.eat-slider-action.is-locked { background: #e3e4dc; opacity: 1; }
.eat-slider-action.is-locked .eat-slider-notches .is-active { background: var(--good); }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.save-feedback {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}
.save-feedback:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.save-feedback:is([data-state="saved"], [data-state="remembered"]) {
  padding: 8px 12px;
  border-inline-start: 3px solid var(--good);
  background: var(--pistachio);
  font-weight: 700;
}
@media (prefers-reduced-motion: no-preference) {
  .save-feedback[data-state="saved"] { animation: save-confirm 180ms ease-out; }
  @keyframes save-confirm { from { background-color: #cddca9; } to { background-color: var(--pistachio); } }
}
.actions .eat-slider-action { grid-column: 1 / -1; }
.actions .action-btn { min-height: 44px; padding: 10px 6px; font-size: 0.82rem; }
.meal-suggestion, .low-score-actions, .food-chat-wrap, .detail-panel,
.improvement-builder, .package-details-block {
  background: #f9f3e6;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.detail-summary, .food-chat-title { color: var(--ink); font: 800 1.12rem/1.3 var(--font-display); }
.detail-summary::after, .food-chat-summary::after { background: var(--apricot); color: var(--ink); }
.discussion-section p, #reason-list li, .discussion-overview { font-weight: 500; line-height: 1.65; }
.food-chat-message-assistant { background: var(--paper); border-color: var(--line); }
.improvement-option-icon { background: var(--pistachio); }
.improvement-option, .menu-recommendation-item { border-color: var(--line); border-radius: 14px; }
.menu-recommendations { background: #f9f0e0; border-radius: 18px; }
.menu-recommendation-item:first-child { background: var(--pistachio); border-color: #becb9e; }
.menu-select-btn { background: var(--ink); color: var(--paper); }

.field-page-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.field-page-head .field-art { width: 76px; height: 76px; }
.summary-head h2, .restaurant-finder-card .summary-head h2 { font-size: clamp(2rem, 5vw, 2.7rem); max-width: none; }
.restaurant-finder-card { background: var(--paper); }
.restaurant-finder-copy { color: var(--muted); font-weight: 500; }
.restaurant-finder-form { background: #f5eddd; color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: none; }
.restaurant-finder-form .entry-meta, .restaurant-checkbox-row { color: var(--ink); }
.restaurant-find-cta { background: var(--ink); color: var(--paper); min-height: 60px; border-radius: 14px; }
.restaurant-recommendation-card { border: 1px solid var(--line); border-radius: 18px; box-shadow: none; background: var(--paper); }
.restaurant-entree-panel {
  background: var(--pistachio);
  border: 1px solid #cbd6ad;
  border-radius: 16px;
  min-height: 0;
  text-shadow: none;
}
.restaurant-entree-label, .restaurant-entree, .restaurant-entree-description { color: var(--ink); }
.restaurant-factor-chip, .entry-factor-chip { box-shadow: none; }
.restaurant-distance-pill { background: var(--ink); color: var(--paper); }
.restaurant-detail-wrap { border-radius: 14px; border-color: var(--line); }

.field-page-note { color: var(--muted); margin: 4px 0 16px; font-size: 0.9rem; }
.trends-accordion { gap: 10px; }
.trends-panel { background: #fcf1e2; border: 1px solid #e8dbc6; border-radius: 16px; box-shadow: none; }
.trends-panel:nth-child(even) { background: #f0f1df; border-color: #dbdfc5; }
.trends-panel[open] { background: var(--paper); box-shadow: none; }
.trends-panel-summary {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 3px;
  align-content: center;
  padding: 12px 44px 12px 10px;
  min-height: 92px;
}
.trends-panel-summary .field-art { grid-column: 1; grid-row: 1 / 3; align-self: center; width: 64px; height: 64px; }
.trends-panel-title { grid-column: 2; align-self: end; font-size: 1.2rem; }
.trends-panel-kicker { grid-column: 2; align-self: start; text-align: left; color: var(--muted); font-size: 0.77rem; font-weight: 500; line-height: 1.4; }
.trends-panel-body { border-top: 1px solid var(--line); padding: 16px; }
.weekly-visual-card, .summary-metric-card, .trend-tile {
  background: #f8f3e7;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: none;
}
.weekly-visual-card:first-child { background: var(--pistachio); }
.weekly-visual-value, .summary-metric-value { font-family: var(--font-display); color: var(--ink); }
.weekly-visual-label, .weekly-visual-detail { color: #405346; }
.weekly-coach-wrap, .direction-wrap, .trigger-foods-wrap, .sat-fat-budget-wrap,
.safe-favorites-wrap, .meal-patterns-wrap, .risk-frequency-wrap, .awards-wrap,
.summary-actions-panel, .food-mosaic-wrap, .weekly-focus-wrap {
  background: var(--paper);
  border-color: var(--line);
  border-radius: 14px;
}
.entry-item, .entry-item:first-child { background: #fcf7ed; border: 1px solid var(--line); border-radius: 16px; }
.entry-thumb-wrap { border-radius: 12px; }
.entry-food { font: 800 1.1rem/1.3 var(--font-display); color: var(--ink); }
.entry-meta, .entry-context { color: var(--muted); font-weight: 500; }
.entry-score-badges { padding: 5px; }
.score-badge-good { background: var(--pistachio); color: var(--good); }
.score-badge-mixed { background: #ffe7b9; color: var(--mixed); }
.score-badge-bad { background: #ffe3da; color: var(--bad); }
.food-mosaic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.food-mosaic-tile, .food-mosaic-tile.is-featured { grid-column: auto; grid-row: auto; aspect-ratio: 1; border-radius: 14px; }
.food-mosaic-overlay { background: #163e32e8; color: var(--paper); padding: 8px; }
.food-mosaic-overlay strong { font-size: 0.78rem; }
.food-mosaic-overlay span { color: #fff6e8; }

#page-account .card, #auth-section, #page-account .pwa-install-card { background: var(--paper); }
#account-content .auth-form, #password-form, .share-card, #account-gate, #auth-form {
  background: #fcf7ec;
  border-color: var(--line);
  border-radius: 16px;
  padding: 16px;
}
#account-content .notification-privacy-form { background: #f0f1df; }
.notification-choice { border-radius: 12px; border-color: var(--line); background: var(--paper); }
.notification-choice:has(input:checked) { background: var(--pistachio); border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.notification-choice small, .notification-safety-note, .pwa-install-note { color: var(--muted); }
.pwa-install-details summary { border-radius: 12px; }
.pwa-install-icon { border-radius: 16px; box-shadow: none; }

.package-ingredients-text { white-space: pre-line; }
.eat-portion-slider { margin-inline: 0; }
.eat-slider-notches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 0;
  margin-inline: 11px;
}
.eat-slider-notches span { justify-self: start; translate: -50% 0; padding-inline: 3px; }
#portion-keyboard-hint { display: none; margin: 8px 0 0; font-size: 0.82rem; }
.eat-portion-slider:focus-visible ~ #portion-keyboard-hint { display: block; }
#account-email, .entry-food, .food-description, .menu-recommendation-title,
.restaurant-recommendation-card h3 { overflow-wrap: anywhere; }
.migration-note { color: var(--muted); font-size: 0.875rem; }
.migration-note summary { cursor: pointer; padding-block: 8px; }
.migration-note p { margin: 4px 0 0; line-height: 1.5; }
.migration-note a { color: var(--ink); }

/* Equal navigation targets, with no elevated middle action. */
.pwa-bottom-nav-btn, .pwa-bottom-action {
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  padding: 7px 9px;
  transform: none;
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 700;
}
.pwa-bottom-nav-btn.is-active:not(.pwa-bottom-action), .pwa-bottom-action.is-active {
  background: #f9d9c6;
  border: 0;
  color: var(--ink);
}
.pwa-bottom-nav-btn svg, .pwa-bottom-action svg { width: 22px; height: 22px; }

/* The standalone score guide uses the same palette and reading surfaces. */
.wrap .card { background: var(--paper); }
.wrap .formula { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.wrap .band-card { background: #f6efdf; border-color: var(--line); border-radius: 14px; }
.wrap .card > :is(p, ul) { max-inline-size: 68ch; }
.wrap p, .wrap li { color: var(--ink); line-height: 1.7; }
.wrap .back-link { color: var(--ink); }

:where(button, a, summary, input, textarea, select):focus-visible {
  outline: 3px solid #8b3d25;
  outline-offset: 3px;
}
.visually-hidden-input:focus-visible + label { outline: 3px solid #8b3d25; outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .action-btn, .nav-btn, .photo-cta, .pwa-bottom-nav-btn { transition: background-color 140ms ease, transform 140ms ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 700px) {
  .app-shell { max-width: 500px; margin-top: 8px; gap: 16px; padding: 0 18px calc(12px + var(--safe-bottom)); }
  .page-section { gap: 16px; }
  .topbar.card { padding: 0 0 10px; gap: 4px 12px; }
  .top-title { font-size: 1.65rem; letter-spacing: -0.045em; }
  .page-nav { container: destinations / inline-size; display: grid; grid-template-columns: repeat(3, minmax(min-content, 1fr)); gap: 4px; }
  .page-nav .nav-btn { padding: 8px 6px; font-size: 0.82rem; gap: 6px; }
  .page-nav .field-icon { width: 18px; height: 18px; }
  .card { padding: 16px; border-radius: 18px; }
  #page-analyze > .card:first-child { padding: 0; }
  .capture-header { grid-template-columns: minmax(0, 1fr) 82px; gap: 4px; margin-bottom: 4px; }
  .capture-title { font-size: clamp(1.7rem, 7.8vw, 2.2rem); }
  .capture-header .field-art { width: 82px; height: 82px; }
  .capture-caption { font-size: 0.8rem; margin-top: 6px; max-width: 30ch; }
  .photo-cta { min-height: 58px; font-size: 1.1rem; }
  .analyze-form { gap: 8px; }
  .analyze-btn { min-height: 48px; }
  .field-mode-copy strong { font-size: 1.05rem; }
  .field-mode-copy small { font-size: 0.73rem; }
  .menu-mode-summary { min-height: 78px; }
  .food-result-summary-card { grid-template-columns: 1fr; gap: 14px; padding: 0; }
  .result-thumb-frame { min-height: 0; height: 180px; }
  .result-food-thumb { min-height: 0; max-height: none; width: 100%; height: 180px; }
  .food-result-summary-card .food-description { font-size: 1.6rem; }
  .score-card.score-card-visual { min-height: 134px; padding: 12px; }
  .score-ring { width: auto; height: auto; }
  .score-card-visual .score-value { font-size: 3rem; }
  .summary-head h2, .restaurant-finder-card .summary-head h2,
  #account-content h2, #account-gate h2, #auth-section h2 { font-size: 2rem; }
  .restaurant-visual-head { grid-template-columns: 1fr; gap: 8px; }
  .restaurant-recommendation-card h3 { font-size: 1.75rem; line-height: 1.15; }
  .restaurant-visual-head .restaurant-distance-pill { justify-self: start; box-shadow: none; }
  .trends-panel-title { font-size: 1.1rem; }
  .trends-panel-summary { grid-template-columns: 52px minmax(0, 1fr); column-gap: 8px; min-height: 84px; padding-left: 8px; padding-right: 38px; }
  .trends-panel-summary .field-art { width: 52px; height: 52px; }
  .trends-panel-summary::after { right: 9px; width: 23px; height: 23px; }
  .trends-panel-body { padding: 12px; }
  .food-mosaic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-main { grid-template-columns: 80px minmax(0, 1fr); gap: 12px; }
  .entry-score-badges { flex-wrap: wrap; gap: 3px; }
  .entry-food { font-size: 1rem; }
  .weekly-visual-dashboard { grid-template-columns: 1fr 1fr; }
  .weekly-visual-card, .summary-metric-card { min-height: 0; border-radius: 12px; padding: 12px; }
  body.pwa-standalone .topbar.card { padding-block: 0; border-bottom: 0; }
  /* Fixed tray only; the area outside its border belongs to the page. */
  .food-shell:has(.pwa-standalone) {
    --dock-lift: max(8px, var(--safe-bottom));
    --dock-clear: calc(var(--food-dock-height, 70px) + var(--dock-lift) + 8px);
    scroll-padding-bottom: var(--dock-clear);
  }
  body.pwa-standalone .pwa-bottom-nav {
    --l: max(8px, var(--safe-left));
    --r: max(8px, var(--safe-right));
    --available: calc(100% - var(--l) - var(--r));
    --label-min: max(196px, 12.25rem);
    --tray: min(max(410px, var(--label-min)), var(--available),
      max(var(--label-min), 100% - 2 * max(var(--l), var(--r))));
    position: fixed;
    z-index: 60;
    left: clamp(var(--l), (100% - var(--tray)) / 2, 100% - var(--r) - var(--tray));
    bottom: var(--dock-lift);
    width: var(--tray);
    container: food-dock / inline-size;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 4px 16px #163e3226;
  }
  .pwa-bottom-nav-btn { flex: 1 1 0; min-width: 44px; padding-inline: 2px; }
  .food-shell body.pwa-standalone .app-shell { margin-bottom: 0; padding-bottom: var(--dock-clear); }
  @container food-dock (width < 11.6rem) {
    .pwa-bottom-nav-btn span { display: none; } /* Explicit button names remain available. */
  }
}
@container destinations (max-width: 17em) {
  .nav-btn .field-icon { display: none; }
}
@media (max-width: 360px) {
  .app-shell { padding-inline: 12px; }
  .capture-header { grid-template-columns: minmax(0, 1fr) 64px; }
  .capture-header .field-art { width: 64px; height: 64px; }
  .trends-panel-summary { grid-template-columns: 42px minmax(0, 1fr); }
  .trends-panel-summary .field-art { width: 42px; height: 42px; }
  .trends-panel-title { font-size: 1rem; }
  .score-card-visual .score-value { font-size: 2.6rem; }
  .score-card-visual .score-label { font-size: 0.95rem; }
}

/* Keep the existing page measure; only the content that needs an inset moves. */
.food-shell { scroll-padding-block: var(--safe-top) max(8px, var(--safe-bottom)); }
.food-shell body { padding-inline: 0; padding-bottom: 0; }
.food-shell .app-shell {
  --shell-limit: 940px;
  --shell-gutter: 16px;
  --card-pad: 24px;
  --edge: calc(max(0px, (100vw - var(--shell-limit)) / 2) + var(--shell-gutter));
  --left: max(0px, var(--safe-left) - var(--edge));
  --right: max(0px, var(--safe-right) - var(--edge));
  margin-bottom: max(64px, var(--safe-bottom));
}
.food-shell .topbar.card { padding-left: var(--left); padding-right: var(--right); }
.food-shell :is(.page-section > .card, #auth-section):not(#page-analyze > .card:first-child) {
  padding-left: max(var(--card-pad), var(--left));
  padding-right: max(var(--card-pad), var(--right));
}
.food-shell .analyze-form > :is(label, textarea, button, .status-text) {
  margin-left: var(--left);
  margin-right: var(--right);
  max-width: calc(100% - var(--left) - var(--right));
}
.food-shell .capture-header { padding-left: var(--left); }
.food-shell .capture-header > div { padding-right: max(0px, var(--right) - 100px); }
.food-shell #page-analyze > .card:first-child > details {
  padding-left: var(--left);
  padding-right: var(--right);
}
@media (max-width: 700px) {
  .food-shell .app-shell {
    --shell-limit: 500px;
    --shell-gutter: 18px;
    --card-pad: 16px;
    margin-bottom: 28px;
    padding-bottom: max(12px, var(--safe-bottom));
  }
  .food-shell .capture-header > div { padding-right: max(0px, var(--right) - 82px); }
}
@media (max-width: 360px) {
  .food-shell .app-shell { --shell-gutter: 12px; }
  .food-shell .capture-header > div { padding-right: max(0px, var(--right) - 64px); }
}

/* Only a chosen menu dish can use the optional comparison. Resizes never rerender it. */
.menu-comparison { display: contents; }
.menu-layout-select { display: block; min-height: 44px; margin-top: 6px; padding: 8px 12px; }
#menu-layout-settings[hidden] { display: none; }
.menu-layout-help { margin-block: 8px 0; }
html[data-menu-layout="expanded"] #results-section[data-menu-selected] {
  container: chosen-menu / inline-size;
}
@media (min-height: 32rem) {
  /* A 16rem shortlist, 22rem of score detail, and a 1.25rem gap. */
  @container chosen-menu (min-width: 40rem) {
    .menu-comparison {
      display: grid;
      grid-template-columns: minmax(16rem, 0.85fr) minmax(22rem, 1.15fr);
      grid-template-areas: "list dish" "list warning";
      grid-template-rows: auto 1fr;
      gap: 8px 1.25rem;
      align-items: start;
    }
    .menu-comparison #menu-recommendations-block { grid-area: list; min-width: 0; margin: 0; }
    .menu-comparison .menu-recommendations-list { max-height: min(62vh, 30rem); overflow-y: auto; padding: 4px; }
    .menu-comparison .menu-recommendation-item { overflow-wrap: anywhere; }
    .menu-comparison .menu-recommendation-item:has(button:disabled) { border: 2px solid var(--ink); }
    #results-section .menu-comparison .menu-select-btn { min-height: 44px; }
    .menu-comparison #food-result-summary-card { grid-area: dish; grid-template-columns: minmax(0, 1fr); margin: 0; }
    .menu-comparison .result-thumb-frame:has(.result-food-thumb.hidden) { display: none; }
    .menu-comparison .result-safety-note { grid-area: warning; margin: 0; }
  }
}
