:root {
  --bg: #f4efe3;
  --bg-deep: #efe4d0;
  --ink: #10221d;
  --muted: #5d6c64;
  --card: rgba(255, 252, 245, 0.88);
  --line: rgba(16, 34, 29, 0.12);
  --accent: #2c7a4b;
  --accent-2: #f0a43c;
  --accent-3: #d6efe2;
  --shadow: 0 20px 60px rgba(30, 44, 38, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff7d6 0%, transparent 34%),
    radial-gradient(circle at bottom right, #c8edd8 0%, transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

button { font: inherit; }
button:focus-visible, input:focus-visible, .upload-button:focus-within {
  outline: 3px solid rgba(44, 122, 75, .34);
  outline-offset: 3px;
}
button:disabled { cursor: wait; opacity: .62; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bg-orb {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.55;
  pointer-events: none;
}
.bg-orb-a { width: 220px; height: 220px; left: -60px; top: 120px; background: #f8cf79; }
.bg-orb-b { width: 260px; height: 260px; right: -100px; top: 340px; background: #9bd2b0; }

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 20px 16px 92px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.hero {
  padding: 22px;
  margin-bottom: 18px;
}

.hero-top, .section-head, .split, .expand-row, .list-item, .feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 18px;
  background: linear-gradient(145deg, #1b5c38, #3fa86a);
  position: relative; overflow: hidden;
}
.brand-mark span {
  position: absolute; inset: 8px 14px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.95) 0 3px, transparent 3px 8px);
  border-radius: 8px;
}
.brand-mark i {
  position: absolute; width: 18px; height: 18px; left: 17px; top: 16px;
  border-radius: 50%; background: #fff4c8;
  box-shadow: 11px 11px 0 0 #f0a43c;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .72rem;
  color: var(--accent);
  font-weight: 800;
}
h1, h2, h3, strong { font-family: "Fraunces", Georgia, serif; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: .96; max-width: 11ch; }
h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.05; }
h3 { margin: 0; font-size: 1.3rem; }
.hero-copy, .muted, .detail-list small, .recipe-card span, .feed-item span, .list-item small {
  color: var(--muted);
}
.hero-copy { font-size: 1.02rem; line-height: 1.6; max-width: 58ch; }

.avatar, .button, .nav-item, .choice, .scan-button, .sheet-close, .expand-row {
  border: 0; cursor: pointer;
}
.avatar {
  width: 48px; height: 48px; border-radius: 16px;
  background: #132721; color: #fff; font-weight: 800;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }
.button {
  padding: 14px 16px; border-radius: 18px; font-weight: 800; letter-spacing: .02em;
}
.primary { background: var(--ink); color: #fff; }
.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.quiet { background: transparent; color: var(--muted); border: 1px solid transparent; }
.mini-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: .8rem;
  font-weight: 700;
}

.scan-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px; border-radius: 22px; background: linear-gradient(135deg, #eff9f0, #fff7df);
  border: 1px solid rgba(44, 122, 75, .14);
}
.scan-label { margin: 0 0 2px; color: var(--muted); font-size: .84rem; }
.scan-button {
  min-width: 84px; min-height: 84px; border-radius: 26px; background: var(--accent); color: #fff;
  font-weight: 900; letter-spacing: .08em; box-shadow: 0 20px 30px rgba(44, 122, 75, .24);
}

.content { display: grid; gap: 18px; }
.tab-panel { display: none; animation: fadeUp .28s ease; }
.tab-panel.active { display: grid; gap: 18px; }

.split { padding: 22px; }
.pill {
  padding: 8px 12px; border-radius: 999px; background: var(--accent-3); color: #174a30; font-weight: 700;
}
.live { background: #fff1c9; }

.stat-grid, .choice-grid, .recipe-cards, .community-feed, .list-stack {
  display: grid; gap: 12px;
}
.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat, .recipe-card, .feed-item, .list-item, .result-card {
  padding: 16px; border-radius: 20px; background: rgba(255,255,255,.7); border: 1px solid var(--line);
}
.result-card { display: grid; gap: 14px; margin-top: 14px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result-foldouts { display: grid; gap: 10px; }
.result-foldout {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.68);
}
.result-foldout summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 13px 50px 13px 15px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.result-foldout summary::-webkit-details-marker { display: none; }
.result-foldout summary::after {
  content: "+";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-3);
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}
.result-foldout[open] summary::after { content: "−"; }
.result-foldout summary strong {
  display: block;
  font-family: "Inter", system-ui, sans-serif;
  font-size: .94rem;
}
.result-foldout summary small { display: block; margin-top: 3px; color: var(--muted); }
.result-foldout[open] summary { border-bottom: 1px solid var(--line); }
.foldout-body { padding: 15px; }
.info-grid { display: grid; gap: 10px; }
.info-grid > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--line);
}
.info-grid > div span { color: var(--muted); }
.info-grid > div strong { max-width: 60%; text-align: right; font-family: "Inter", system-ui, sans-serif; }
.info-grid p { margin: 2px 0 0; line-height: 1.55; color: var(--muted); }
.full-ingredient-list { display: grid; }
.ingredient-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.ingredient-row:last-child { border-bottom: 0; }
.ingredient-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #edf2ed;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
}
.ingredient-name { min-width: 0; overflow-wrap: anywhere; }
.ingredient-rating {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf2ed;
  color: #405047;
  font-family: "Inter", system-ui, sans-serif;
  font-size: .72rem;
  white-space: nowrap;
}
.ingredient-rating.excellent { background: #d6efe2; color: #174a30; }
.ingredient-rating.good { background: #e8f1dc; color: #38551d; }
.ingredient-rating.moderate, .ingredient-rating.compare { background: #fff1c9; color: #78540b; }
.ingredient-rating.poor { background: #ffe0d4; color: #8a351b; }
.stat span, .stat small { display: block; color: var(--muted); }
.stat strong { display: block; font-size: 1.8rem; margin: 8px 0 2px; }

.score-ring {
  position: relative; width: 120px; height: 120px; flex: 0 0 auto;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track, .ring-value { fill: none; stroke-width: 10; }
.ring-track { stroke: rgba(16,34,29,.08); }
.ring-value {
  stroke: var(--accent); stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 59;
}
.score-copy {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.score-copy strong { font-size: 2rem; line-height: 1; }
.score-copy span { font-size: .68rem; letter-spacing: .18em; color: var(--muted); font-weight: 800; }

.stacked { padding: 0; overflow: hidden; }
.expand-row {
  width: 100%; padding: 18px 20px; background: transparent; text-align: left;
}
.expand-row strong, .detail-list strong { font-family: "Inter", system-ui, sans-serif; }
.expand-row small { display: block; color: var(--muted); margin-top: 4px; }
.chev { white-space: nowrap; color: var(--accent); font-weight: 800; }
.detail { padding: 0 20px 20px; }
.detail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.detail-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding-bottom: 8px; border-bottom: 1px dashed rgba(16,34,29,.12);
}
.detail-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-line, .result-head, .add-row, .action-row, .compare-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.action-row, .add-row { flex-wrap: wrap; }
.add-row input {
  flex: 1 1 220px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.scanner-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
}
.scanner-heading, .camera-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.scanner-heading h3 { font-size: 1.45rem; }
.camera-badge {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: #edf2ed;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}
.camera-badge[data-state="scanning"] { background: #d6efe2; color: #174a30; }
.camera-badge[data-state="error"] { background: #fff0d9; color: #844f0a; }
.camera-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-top: 16px;
  border-radius: 22px;
  background: #09120f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.camera-stage video { width: 100%; height: 100%; object-fit: cover; }
.scan-target {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(82%, 420px);
  height: 34%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(4, 12, 9, .28);
}
.scan-target::before, .scan-target::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: #f0a43c;
  box-shadow: 0 0 14px rgba(240,164,60,.9);
}
.scan-target::before { top: 50%; animation: scanLine 1.8s ease-in-out infinite alternate; }
.scan-target::after { top: 50%; opacity: .18; }
.camera-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 14px; }
.upload-button { display: inline-flex; align-items: center; cursor: pointer; }
.camera-status { min-height: 1.4em; margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.manual-lookup { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.scanner-panel label {
  display: block;
  font-weight: 800;
  margin-bottom: 10px;
}
.result-head { align-items: flex-start; }
.result-score {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-family: "Fraunces", Georgia, serif; font-size: 1.4rem;
}
.compare-grid { align-items: stretch; }
.compare-card {
  flex: 1 1 0;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.compare-good { background: #eff9f0; }
.compare-card span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.compare-card strong { font-size: 1.9rem; }

.scan-card, .content .card { padding: 22px; }
.choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
.choice {
  display: grid; gap: 6px; padding: 18px; border-radius: 22px; text-align: left;
  background: linear-gradient(180deg, #fff, #f4faef); border: 1px solid var(--line);
}
.choice strong { font-size: 1.1rem; }
.choice em { font-style: normal; color: var(--accent); font-weight: 800; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 8px; padding: 10px 12px 14px; background: rgba(247,241,227,.88);
  border-top: 1px solid rgba(16,34,29,.08);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.nav-item {
  min-height: 56px; border-radius: 18px; background: transparent; color: var(--muted); font-weight: 700;
}
.nav-item.active { background: #fff; color: var(--ink); box-shadow: 0 10px 22px rgba(20,32,28,.09); }
.nav-core {
  background: var(--ink); color: #fff; transform: translateY(-10px); box-shadow: 0 16px 26px rgba(16,34,29,.25);
}

.sheet {
  position: fixed; inset: 0; display: none; z-index: 40;
}
.sheet.open { display: block; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(8, 14, 12, .38);
}
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 640px); background: #fffdf7; border-radius: 28px 28px 0 0;
  padding: 22px; box-shadow: 0 -20px 60px rgba(10,20,18,.2);
}
.sheet-close {
  position: absolute; right: 18px; top: 18px; width: 42px; height: 42px; border-radius: 14px;
  background: #f2f0e7; color: var(--ink);
}

.sheet.open { display: block; }
.sheet-panel .scanner-panel { margin-top: 8px; margin-bottom: 10px; }
.sheet-panel .choice-grid { margin-top: 10px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scanLine { from { transform: translateY(-42px); } to { transform: translateY(42px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 760px) {
  .stat-grid, .choice-grid { grid-template-columns: 1fr; }
  .split { flex-direction: column; align-items: flex-start; }
  .hero-top { align-items: flex-start; }
  .compare-grid { flex-direction: column; }
  .camera-actions .button, .camera-actions .upload-button { flex: 1 1 calc(50% - 8px); justify-content: center; text-align: center; }
  .result-actions .button { flex: 1 1 calc(50% - 6px); }
  .ingredient-row { grid-template-columns: 26px minmax(0, 1fr); }
  .ingredient-rating { grid-column: 2; justify-self: start; }
  .info-grid > div { display: grid; gap: 4px; }
  .info-grid > div strong { max-width: none; text-align: left; }
}

/* Viewport-locked SPA shell */
html, body { width: 100%; height: 100%; overflow: hidden; }
[hidden] { display: none !important; }
body { min-height: 100dvh; overscroll-behavior: none; }

.shell {
  width: min(980px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: 12px 14px calc(82px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.app-header {
  flex: 0 0 76px;
  padding: 12px 16px;
  border-radius: 22px;
}
.app-header .hero-top { height: 100%; }
.app-header .brand-mark { width: 46px; height: 46px; border-radius: 15px; }
.app-header .brand-mark span { inset: 7px 12px; }
.app-header .brand-mark i { left: 14px; top: 14px; }
.app-header h1 { max-width: none; font-size: 1.75rem; line-height: .9; }
.app-header .eyebrow { margin-bottom: 3px; font-size: .6rem; }
.app-context { margin: 4px 0 0; color: var(--muted); font-size: .77rem; }
.app-header .avatar { width: 44px; height: 44px; border-radius: 14px; }

.content { flex: 1 1 auto; min-height: 0; display: block; overflow: hidden; }
.tab-panel { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.tab-panel.active { display: grid; gap: 10px; height: 100%; min-height: 0; }
.tab-panel[data-tab-panel="dashboard"].active { grid-template-rows: auto minmax(0, 1fr) auto; }
.tab-panel:not([data-tab-panel="dashboard"]) > .card { height: 100%; min-height: 0; }
.content .card { padding: 16px; border-radius: 22px; box-shadow: 0 12px 34px rgba(30, 44, 38, .1); }
.tab-panel:not([data-tab-panel="dashboard"]) > .card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.section-head { flex: 0 0 auto; }
.section-head h2 { font-size: clamp(1.2rem, 3vw, 1.65rem); }
.section-head .pill { font-size: .74rem; padding: 7px 9px; }

.stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { min-width: 0; padding: 11px; border-radius: 16px; }
.stat span, .stat small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: .76rem; }
.stat small { font-size: .68rem; }
.stat strong { margin: 4px 0 0; font-size: 1.4rem; }

.tab-panel[data-tab-panel="dashboard"] .split { min-height: 0; padding: 15px; overflow: hidden; }
.tab-panel[data-tab-panel="dashboard"] .split > div:first-child { min-width: 0; }
.tab-panel[data-tab-panel="dashboard"] .split .muted {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tab-panel[data-tab-panel="dashboard"] .score-ring { width: 100px; height: 100px; }
.tab-panel[data-tab-panel="dashboard"] .stacked { padding: 0; }
.expand-row { min-height: 68px; padding: 13px 16px; }

.list-stack, .community-feed {
  flex: 1 1 auto;
  min-height: 0;
  margin: 12px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tab-panel[data-tab-panel="list"] .add-row { flex: 0 0 auto; }
.community-feed { align-content: start; }

.scan-card > .eyebrow, .scan-card > h2 { flex: 0 0 auto; }
.scan-card .choice-grid { flex: 0 0 auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.scan-card .choice { padding: 11px 13px; border-radius: 17px; }
.scan-card .choice span { font-size: .82rem; }
.scan-card .choice em { font-size: .72rem; }
.scan-card > .scanner-panel {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.scanner-heading h3 { font-size: 1.25rem; }
.camera-actions { margin-top: 10px; }
.camera-actions .button, .upload-button { padding: 11px 13px; border-radius: 15px; }
.camera-status { margin-top: 7px; }
.manual-lookup { margin-top: 11px; padding-top: 11px; }
.manual-lookup label { margin-bottom: 7px; font-size: .84rem; }
.manual-lookup .add-row { flex-wrap: nowrap; }
.manual-lookup .add-row input { min-height: 44px; min-width: 0; }
.manual-lookup .button { flex: 0 0 auto; }
#scan-hint { margin: 8px 0 0; font-size: .8rem; }

.recipe-cards { flex: 1 1 auto; min-height: 0; align-content: center; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.recipe-card { cursor: pointer; text-align: left; }

.bottom-nav {
  left: 50%;
  right: auto;
  bottom: 0;
  width: min(980px, 100%);
  min-height: 72px;
  transform: translateX(-50%);
  padding: 8px 10px calc(9px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
}
.nav-item { min-height: 50px; font-size: .78rem; }
.nav-core { transform: translateY(-7px); }

.app-modal {
  position: fixed !important;
  inset: 50% auto auto 50% !important;
  z-index: 60;
  width: min(590px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 56px));
  margin: 0 !important;
  padding: 20px !important;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 13px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(16,34,29,.14);
  border-radius: 24px !important;
  background: #fffdf7 !important;
  box-shadow: 0 0 0 100vmax rgba(7,15,12,.5), 0 28px 80px rgba(8,20,15,.32) !important;
  animation: modalIn .22s ease both;
}
.app-modal .modal-close, .modal-close {
  position: sticky;
  top: 0;
  z-index: 2;
  justify-self: end;
  width: 40px;
  height: 40px;
  margin-bottom: -38px;
  border: 0;
  border-radius: 13px;
  background: #edf0e9;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.app-modal .result-head { padding-right: 48px; }
.app-modal.detail-list, .app-modal .detail-list { margin-top: 6px; }
.app-modal .result-foldouts { min-height: 0; }
.app-modal .ingredient-foldout[open] .foldout-body { max-height: 40dvh; overflow-y: auto; }
body.camera-open .tab-panel.active .scanner-panel {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 65;
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 34px);
  margin: 0;
  padding: 18px;
  transform: translate(-50%, -50%);
  overflow-y: auto;
  border-radius: 24px;
  background: #fffdf7;
  box-shadow: 0 0 0 100vmax rgba(7,15,12,.58), 0 28px 80px rgba(8,20,15,.35);
}
body.camera-open .camera-stage { flex: 0 0 auto; max-height: 56dvh; }

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 760px) {
  .shell { padding: 9px 9px calc(76px + env(safe-area-inset-bottom)); gap: 8px; }
  .app-header { flex-basis: 68px; padding: 9px 12px; border-radius: 18px; }
  .app-header .brand-mark { width: 42px; height: 42px; }
  .app-header h1 { font-size: 1.55rem; }
  .app-header .avatar { width: 40px; height: 40px; }
  .content .card { padding: 13px; border-radius: 19px; }
  .tab-panel.active { gap: 7px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 9px; }
  .stat { padding: 8px; }
  .stat span { font-size: .62rem; }
  .stat small { display: none; }
  .stat strong { font-size: 1.15rem; }
  .split { flex-direction: row; align-items: center; }
  .tab-panel[data-tab-panel="dashboard"] .score-ring { width: 84px; height: 84px; }
  .score-copy strong { font-size: 1.6rem; }
  .score-copy span { font-size: .54rem; }
  .expand-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70vw; }
  .recipe-cards { grid-template-columns: 1fr; align-content: center; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-modal { width: calc(100vw - 18px); max-height: calc(100dvh - 24px); padding: 17px !important; border-radius: 21px !important; }
  .app-modal .ingredient-foldout[open] .foldout-body { max-height: 36dvh; }
  .bottom-nav { min-height: 67px; padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); }
  .nav-item { min-height: 46px; font-size: .72rem; }
}

@media (max-height: 690px) {
  .app-header { flex-basis: 58px; }
  .app-header .brand-mark { width: 38px; height: 38px; }
  .app-header .app-context { display: none; }
  .app-header .eyebrow { display: none; }
  .scan-card .choice span { display: none; }
  .camera-status { display: none; }
  .tab-panel[data-tab-panel="dashboard"] .score-ring { width: 72px; height: 72px; }
}
