:root {
  /* Apple's neutral greys, with Amanda's emerald as the accent */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #047857;
  --accent-ink: #ffffff;
  --accent-glow: rgba(4, 120, 87, .35);
  --ring: #047857;
  --over: #c98a2b;      /* over goal: gentle amber, not alarm red */
  --danger: #b3261e;    /* errors and delete only */
  --warn: #a8661b;
  --radius: 20px;
  --shadow: none;           /* flat tiles on a grey page, like apple.com */
  color-scheme: light;
}
/* always dark (2026-11-06) */
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --muted: #98989d;
    --line: #38383a;
    --accent: #34d399;      /* lighter emerald so it reads on dark */
    --accent-ink: #06281c;
    --accent-glow: rgba(52, 211, 153, .35);
    --ring: #34d399;
    --over: #e2a650;
    --danger: #f0857a;
    --warn: #e0a84a;
    --shadow: none;
    color-scheme: dark;
  }


* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  /* Apple's own font (SF Pro) on iPhone, iPad and Mac; the device's system font elsewhere */
  font: 17px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); }
.warn { color: var(--warn); }

/* seasonal animation sits behind everything; the app's cards stay solid above it */
#season-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
/* a faint seasonal tint at the top of the screen, fading into the normal background */
body[data-season="autumn"] #season-bg { background: linear-gradient(180deg, #f6ecdf, var(--bg) 65%); }
body[data-season="winter"] #season-bg { background: linear-gradient(180deg, #dde8f2, var(--bg) 65%); }
body[data-season="spring"] #season-bg { background: linear-gradient(180deg, #f8e9f0, var(--bg) 65%); }
body[data-season="summer"] #season-bg { background: linear-gradient(180deg, #f7f0d9, var(--bg) 65%); }
/* always dark (2026-11-06) */
  body[data-season="autumn"] #season-bg { background: linear-gradient(180deg, #2a2117, var(--bg) 65%); }
  body[data-season="winter"] #season-bg { background: linear-gradient(180deg, #1a2733, var(--bg) 65%); }
  body[data-season="spring"] #season-bg { background: linear-gradient(180deg, #2a1d24, var(--bg) 65%); }
  body[data-season="summer"] #season-bg { background: linear-gradient(180deg, #29251a, var(--bg) 65%); }

.screen {
  position: relative; z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 96px);
}

/* buttons & inputs */
button { cursor: pointer; border: 0; background: none; }
.primary {
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: 12px 20px; font-weight: 600;
}
.primary:disabled { opacity: .45; cursor: default; }
.link { color: var(--accent); padding: 10px 4px; font-weight: 500; }
.danger.link { color: var(--danger); }
.wide { display: block; width: 100%; margin-top: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; font-size: 20px; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: .3; }
label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; /* prevents iOS zoom */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

/* auth */
#auth { display: grid; min-height: 100dvh; place-items: center; }
.auth-card { width: 100%; max-width: 360px; }
.auth-card h1 { font-size: 32px; line-height: 1.15; margin: 0; letter-spacing: -.02em; }
.auth-card .primary { width: 100%; margin-top: 16px; }


/* top bar */
.topbar { display: flex; align-items: center; gap: 4px; padding: 4px 0 8px; }
.day-title { flex: 1; font-size: 17px; font-weight: 600; padding: 8px; border-radius: 10px; }
.settings-btn { margin-left: 4px; }

/* summary ring */
.summary {
  position: relative; display: grid; justify-items: center;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px 16px;
}
/* the glass beside this week's and this month's tiles */
.summary-top { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; }
/* the glass: liquid rises to the share of today's goal eaten */
.glass-wrap { position: relative; width: 156px; height: 156px; flex: none; }
@media (min-width: 420px) { .glass-wrap { width: 172px; height: 172px; } }
.glass { width: 100%; height: 100%; display: block; --liquid: #10b981; --liquid-back: #6ee7b7; }
.glass.lvl-green { --liquid: #10b981; --liquid-back: #6ee7b7; }
.glass.lvl-amber { --liquid: #f59e0b; --liquid-back: #fcd34d; }
.glass.lvl-red   { --liquid: #ef4444; --liquid-back: #fca5a5; }
.glass-bg { fill: var(--surface-2); }
.glass-rim { fill: none; stroke: var(--line); stroke-width: 2; }
.liquid { transform: translateY(120px); transition: transform 1.4s cubic-bezier(.22, .9, .3, 1); }
.wave { transition: fill .8s ease; }
.wave-back { fill: var(--liquid-back); opacity: .6; animation: wave 6s linear infinite; }
.wave-front { fill: var(--liquid); opacity: .9; animation: wave 3.6s linear infinite reverse; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-60px); } }
.glass-label {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px;
  pointer-events: none;
}
.glass-label .big { text-shadow: 0 0 10px var(--surface), 0 0 2px var(--surface); }
.glass-caption {
  max-width: 118px; margin: 0 auto; font-size: 13px; line-height: 1.25; font-weight: 600; color: var(--muted);
  text-shadow: 0 0 8px var(--surface), 0 0 2px var(--surface);
}
.glass.filled-high ~ .glass-label .big, .glass.filled-high ~ .glass-label .glass-caption { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
@media (prefers-reduced-motion: reduce) {
  .wave-back, .wave-front { animation: none; }
  .liquid { transition: none; }
}
/* logging streak, under the greeting */
.greeting .streak {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; padding: 6px 12px;
  border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text);
  background: color-mix(in srgb, #f59e0b 15%, var(--surface));
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
}
/* "Bub man!" heads-up from 90% of the goal */
.goal-warning {
  margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; text-align: center; font-weight: 600;
  background: color-mix(in srgb, #f59e0b 16%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 45%, transparent);
  color: var(--text);
}
.big { font-size: 38px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.glass-label .big { font-size: 34px; }
.glass-label .glass-caption { max-width: 104px; font-size: 12px; }

/* week & month tiles: total, a bar against the goal, and how she's doing in words */
.periods { flex: 1; min-width: 0; max-width: 220px; display: grid; gap: 8px; }
.period {
  --fill: #10b981;
  padding: 8px 10px; border-radius: 12px; min-width: 0;
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
}
.period.lvl-amber { --fill: #f59e0b; }
.period.lvl-red   { --fill: #ef4444; }
.period-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.period-value { font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.period-sub, .period-status { font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period-sub { color: var(--muted); }
.period-status { display: flex; align-items: center; gap: 5px; margin-top: 1px; color: var(--text); }
.period .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fill); flex: none; }
.meter {
  position: relative; height: 6px; margin: 4px 0 3px; border-radius: 3px;
  background: color-mix(in srgb, var(--fill) 22%, var(--surface));
}
.meter-fill { display: block; height: 100%; border-radius: 3px; background: var(--fill); transition: width .6s ease; }
.meter-pace {
  position: absolute; top: -3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px;
  background: var(--text); opacity: .55; box-shadow: 0 0 0 1px var(--surface);
}
@media (prefers-reduced-motion: reduce) { .meter-fill { transition: none; } }
.summary-line { margin: 10px 0 0; color: var(--muted); }
.summary-line strong { color: var(--text); }

/* week bars */
.week { margin-top: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px 8px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; position: relative; }
.wbar { display: grid; justify-items: center; gap: 4px; padding: 4px 0; border-radius: 10px; }
.wbar.sel { background: var(--surface-2); }
.wval { font-size: 10px; color: var(--muted); height: 12px; }
.wtrack { position: relative; width: 14px; height: 64px; border-radius: 7px; background: var(--surface-2); display: flex; align-items: flex-end; overflow: hidden; }
.wbar.sel .wtrack { background: var(--line); }
.wfill { width: 100%; background: var(--accent); border-radius: 7px; transition: height .4s; }
.wday { font-size: 12px; color: var(--muted); }
.wbar.sel .wday { color: var(--text); font-weight: 600; }
.wbar.future { cursor: default; }
.wbar.future .wtrack { opacity: .5; }
.wbar.future .wday { opacity: .6; }

/* meals */
.meals { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.meal-row {
  display: flex; align-items: center;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.meal-card {
  display: flex; gap: 12px; align-items: center; text-align: left;
  flex: 1; min-width: 0; padding: 10px; border-radius: var(--radius);
}
.meal-del {
  flex: none; width: 44px; height: 44px; margin-right: 4px; border-radius: 12px;
  display: grid; place-items: center; color: var(--muted);
}
.meal-del:hover, .meal-del:focus-visible { color: var(--danger); background: var(--surface-2); }
.meal-del:disabled { opacity: .4; }
.meal-card img, .noimg { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.noimg { display: grid; place-items: center; background: var(--surface-2); font-size: 24px; }
.meal-body { min-width: 0; flex: 1; }
.meal-top { display: flex; justify-content: space-between; gap: 8px; }
.meal-label { font-weight: 600; }
.meal-kcal { font-weight: 600; white-space: nowrap; }
.meal-items { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.empty { text-align: center; padding: 24px 0; }

.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  padding: 16px 28px; font-size: 17px; box-shadow: 0 6px 20px var(--accent-glow);
}

/* sheets */
.sheet {
  border: 0; padding: 0; width: 100%; max-width: 560px;
  margin: auto auto 0; max-height: 92dvh;
  border-radius: 20px 20px 0 0; background: var(--bg); color: var(--text);
}
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
.sheet-inner { padding: 12px 16px calc(env(safe-area-inset-bottom) + 20px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; font-size: 20px; }

/* "Are you sure?" pop-up */
.confirm {
  border: 0; padding: 20px; width: min(340px, calc(100% - 32px)); margin: auto;
  border-radius: 20px; background: var(--surface); color: var(--text); text-align: center;
}
.confirm::backdrop { background: rgba(0, 0, 0, .45); }
.confirm h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.confirm p { margin: 0 0 18px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions button { padding: 12px; border-radius: 999px; font-weight: 600; }
.danger-btn { background: var(--danger); color: #fff; }

/* gym day deficit pop-up */
.deficit-emoji { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.confirm #deficit-msg { margin-bottom: 14px; }
.deficit-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.deficit-pick { padding: 12px 0; border-radius: 14px; font-weight: 700; font-size: 17px; background: var(--surface-2); color: var(--text); }
.deficit-pick[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
#deficit-input { text-align: center; background: var(--surface-2); }
/* live picture: normal day vs today, the gym-day bar shrinking as the deficit grows */
.deficit-visual { text-align: left; margin: 16px 0 2px; }
.dv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; }
.dv-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.dv-value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dv-cut-label { font-size: 13px; font-weight: 700; color: var(--warn); margin-right: 8px; letter-spacing: 0; }
.dv-bar { display: flex; height: 12px; margin-top: 5px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.dv-fill { display: block; height: 100%; }
.dv-normal { width: 100%; background: color-mix(in srgb, var(--accent) 40%, var(--surface-2)); border-radius: 6px; }
.dv-today { width: 100%; background: var(--accent); border-radius: 6px 0 0 6px; transition: width .35s cubic-bezier(.2, .8, .2, 1); }
.dv-cut { flex: 1; background: repeating-linear-gradient(135deg, color-mix(in srgb, #f59e0b 55%, transparent) 0 4px, transparent 4px 8px); }
@media (prefers-reduced-motion: reduce) { .dv-today { transition: none; } }
.confirm .deficit-note { margin: 10px 0 0; font-size: 13px; color: var(--warn); font-weight: 500; }
.confirm .dv-ref { margin: 10px 0 0; text-align: left; line-height: 1.35; }
/* one day's goal */
.change-goal { margin-top: 2px; padding: 12px 0; min-height: 44px; color: var(--accent); font-weight: 600; font-size: 14px; }
.boot-error { max-width: 360px; margin: 30vh auto 0; padding: 0 24px; text-align: center; }
.daygoal-stepper { display: flex; align-items: center; gap: 8px; }
.daygoal-stepper .daygoal-step { width: 48px; height: 48px; border-radius: 14px; font-size: 24px; }
.daygoal-stepper input { flex: 1; min-width: 0; text-align: center; font-size: 22px; font-weight: 700; background: var(--surface-2); }
.dv-cut-label.up { color: var(--accent); }
#daygoal-dialog .dv-normal { transition: width .35s cubic-bezier(.2, .8, .2, 1); }
#daygoal-dialog .link.wide { margin-top: 6px; }
.confirm .deficit-error { margin: 4px 0 14px; min-height: 1em; }
/* always dark (2026-11-06) */ .danger-btn { color: #2a0b08; } 

/* two clear ways in: take a photo now, or choose one taken earlier */
.photo-choices { display: grid; gap: 10px; margin-top: 8px; }
.photo-choice {
  display: flex; align-items: center; gap: 14px; margin: 0; cursor: pointer;
  padding: 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); color: var(--text);
}
.photo-choice.main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding: 22px 16px; }
.photo-choice:active { transform: scale(.99); }
.pc-icon { font-size: 30px; line-height: 1; }
.pc-text { display: grid; gap: 2px; text-align: left; }
.pc-text strong { font-size: 17px; }
.pc-text span { font-size: 14px; opacity: .8; }
.photo-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.item { background: var(--surface); border-radius: 14px; padding: 10px; margin-top: 8px; }
.item-name { border: 0; padding: 4px 2px; font-weight: 500; background: transparent; }
.item-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
/* grams: − [ 120 g ] +  — big enough to tap with a thumb */
.stepper { display: flex; align-items: center; gap: 4px; flex: 1.4; min-width: 0; }
.step {
  flex: none; width: 34px; height: 38px; border-radius: 10px; font-size: 20px; font-weight: 600; line-height: 1;
  background: var(--surface-2); color: var(--text);
}
.step:active { background: var(--accent); color: var(--accent-ink); }
.grams, .kcal { display: flex; align-items: center; gap: 3px; margin: 0; min-width: 0; color: var(--muted); font-size: 14px; }
.grams { flex: 1; }
.kcal { flex: 1; }
.grams input, .kcal input { padding: 8px 6px; text-align: right; min-width: 0; width: 100%; }
.stepper-none { flex: 1.4; padding-left: 4px; }
.item-row .item-del { flex: none; width: 34px; height: 34px; font-size: 16px; }
/* portion shortcuts relative to the original estimate */
.portions { display: flex; gap: 6px; margin-top: 6px; }
.portion {
  padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.portion[aria-pressed="true"] { background: var(--surface-2); color: var(--text); border-color: var(--surface-2); }
.item-meta { margin-top: 4px; padding-left: 2px; }
.review-total { display: flex; justify-content: space-between; padding: 14px 4px 0; font-size: 18px; border-top: 1px solid var(--line); margin-top: 8px; }

/* waiting screen: her photo with a scanning line, stage message, progress bar */
.busy { display: grid; justify-items: center; gap: 14px; padding: 8px 0 4px; }
.scan {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 320px;
  border-radius: var(--radius); overflow: hidden; background: var(--surface-2);
}
.scan img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.85); }
.scan::after {          /* soft shimmer across the photo */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.22) 50%, transparent 70%);
  background-size: 250% 100%; animation: shimmer 2.4s ease-in-out infinite;
}
.scan-line {
  position: absolute; left: 0; right: 0; height: 3px; top: 0;
  background: var(--accent); box-shadow: 0 0 14px 4px var(--accent-glow);
  animation: scan 2.2s ease-in-out infinite alternate;
}
@keyframes scan { from { top: 4%; } to { top: 94%; } }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.busy-msg { margin: 0; font-weight: 600; font-size: 17px; text-align: center; min-height: 1.4em; transition: opacity .25s; }
.busy-msg.fade { opacity: 0; }
.progress { width: 70%; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .5s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .scan::after, .scan-line { animation: none; }
  .scan-line { display: none; }
  .progress-bar, .busy-msg { transition: none; }
}

/* review header: photo thumbnail + meal type */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.review-head { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 4px; }
.review-head img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; }
.review-head-body { flex: 1; min-width: 0; }
.review-head-body p { margin: 6px 0 0; }
/* meal type: four equal chips, one selected */
.label-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 2px; }
.label-chips button {
  padding: 9px 0; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.label-chips button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.label-chips button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* "add a note" disclosure */
.note-box { margin-top: 10px; background: var(--surface); border-radius: 14px; padding: 10px 12px; }
.note-box summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 15px; list-style: none; }
.note-box summary::-webkit-details-marker { display: none; }
.note-box summary::before { content: "＋ "; }
.note-box[open] summary::before { content: "－ "; }
.note-box textarea { margin-top: 10px; }
.secondary {
  background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 11px 20px; font-weight: 600;
}
.credit { margin-top: 16px; font-size: 12px; line-height: 1.4; }
.credit a { color: inherit; }

/* chips: sauce picker in Settings and one-tap sauces on the review screen */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 7px 12px; font-size: 14px; line-height: 1.2;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-more { color: var(--accent); }
.sauce-bar { margin-top: 10px; }
.sauce-group { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.sauce-group-title { flex: none; width: 58px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sauce-group .chips { margin-top: 0; flex: 1; min-width: 0; }

/* "Log again" row: horizontally scrolling cards of her usual meals */
.relog { margin-top: 16px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 8px 2px; color: var(--muted); }
.relog-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.relog-row::-webkit-scrollbar { display: none; }
.relog-card {
  flex: none; width: 124px; scroll-snap-align: start; text-align: left;
  display: grid; gap: 4px; padding: 8px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
}
.relog-card img, .relog-card .noimg { width: 100%; height: 72px; border-radius: 10px; object-fit: cover; }
.relog-name { font-size: 14px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.relog-kcal { font-size: 13px; }
.relog-card:active { transform: scale(.97); }

/* first-launch welcome card: daily goal quick picks */
.welcome {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; border: 2px solid var(--accent);
}
.welcome h2 { margin: 0 0 4px; font-size: 19px; }
.welcome p { margin: 0 0 12px; }
.goal-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.goal-pick {
  padding: 12px 0; border-radius: 12px; font-weight: 700; font-size: 17px;
  background: var(--surface-2); color: var(--text);
}
.goal-pick::after { content: "calories"; display: block; font-weight: 500; font-size: 13px; color: var(--muted); }
.goal-pick:active, .goal-pick:focus-visible { background: var(--accent); color: var(--accent-ink); }
.goal-custom { display: flex; gap: 8px; margin: 10px 0 4px; }
.goal-custom input { flex: 1; }

/* gym (deficit) day toggle under the ring, and gym markers on the week chart */
.gym-toggle {
  margin-top: 10px; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.gym-toggle.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.gym-toggle:disabled { opacity: .6; }
.wgym { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wbar.gym .wgym { background: var(--accent); }
.field-hint { margin: 6px 2px 0; font-size: 13px; }

/* greeting and friendly empty state */
.greeting { padding: 4px 2px 12px; }
.greeting h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; line-height: 1.15; }
.greeting p { margin: 4px 0 0; }
.empty-card {
  text-align: center; padding: 22px 16px; border-radius: var(--radius);
  border: 2px dashed var(--line); background: transparent;
}
.empty-plate { font-size: 34px; line-height: 1; }
.empty-title { margin: 8px 0 4px; font-weight: 600; }
.empty-card p { margin-top: 0; }

/* test site only */
.env-tag {
  position: fixed; top: calc(env(safe-area-inset-top) + 6px); left: 50%; transform: translateX(-50%);
  z-index: 50; background: var(--over); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; padding: 3px 10px; border-radius: 999px; pointer-events: none;
}

/* message bar ("Saved", "Deleted · Undo"), just above the Add meal button */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 88px);
  transform: translate(-50%, 12px); opacity: 0; transition: opacity .2s, transform .2s;
  z-index: 40; display: flex; align-items: center; gap: 14px;
  width: max-content; max-width: calc(100% - 32px);
  padding: 11px 14px 11px 18px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: 15px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-action { color: var(--accent); font-weight: 700; padding: 4px 6px; filter: brightness(1.6); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------------------------------------------------------------- Apple-style look
   A large title, tiles that each show one key number, and Apple's neutral greys. */
.big, .hero-value, .period-value, .wval, .meal-kcal, .relog-kcal { font-variant-numeric: tabular-nums; }

/* large title */
.topbar { padding: 2px 0 0; }
.day-title { font-size: 15px; font-weight: 600; color: var(--muted); }
.greeting { padding: 2px 2px 14px; }
.greeting h1 { font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.greeting p { font-size: 15px; }

/* hero tile: the glass and the calories left */
.summary { padding: 18px; border-radius: 24px; justify-items: stretch; }
.summary-top { justify-content: flex-start; gap: 18px; }
.glass-wrap { width: 148px; height: 148px; }
@media (min-width: 420px) { .glass-wrap { width: 164px; height: 164px; } }
.hero-stats { min-width: 0; }
.glass.caption-covered ~ .glass-label .glass-caption { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.hero-label { font-size: 15px; font-weight: 600; color: var(--muted); }
.hero-value { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; margin: 2px 0 4px; }
.summary .summary-line { margin: 0; font-size: 14px; line-height: 1.35; color: var(--muted); }
.goal-warning { margin-top: 14px; }

/* key-metric tiles */
.tiles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.tile-wide { grid-column: 1 / -1; }
.period { padding: 14px; border-radius: 22px; background: var(--surface); }
.period-title { font-size: 13px; }
.period-value { font-size: 26px; letter-spacing: -.025em; line-height: 1.15; margin-top: 2px; }
.period-sub, .period-status { font-size: 13px; }
.meter { margin: 8px 0 6px; }

/* gym day: an iPhone-style switch tile */
.gym-toggle {
  margin: 0; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: 22px; border: 0; background: var(--surface); color: var(--text);
  font-size: 16px; font-weight: 400;
}
.gym-toggle.on { background: var(--surface); border: 0; color: var(--text); }
.gym-emoji { font-size: 28px; line-height: 1; }
.gym-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.gym-text strong { font-size: 16px; font-weight: 600; }
.gym-sub { font-size: 13px; color: var(--muted); }
.switch { flex: none; position: relative; width: 51px; height: 31px; border-radius: 16px; background: var(--line); transition: background .2s; }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 0 1px rgba(0, 0, 0, .2); transition: transform .2s;
}
.gym-toggle.on .switch { background: var(--accent); }
.gym-toggle.on .switch::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* week tile */
.week { padding: 14px 10px 10px; border-radius: 22px; }
.tile-title { margin: 0 6px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* section titles: Log again, Meals */
.relog { margin-top: 24px; }
.section-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text); margin: 0 0 10px 2px; }
.relog-card { border-radius: 18px; }
.relog-card img, .relog-card .noimg { border-radius: 12px; }

/* meals: one grouped tile with hairline dividers */
.meals { margin-top: 24px; display: block; }
.meal-list { background: var(--surface); border-radius: 22px; overflow: hidden; }
.meal-row { position: relative; background: none; border-radius: 0; }
.meal-row + .meal-row::before { content: ""; position: absolute; top: 0; left: 84px; right: 0; height: 1px; background: var(--line); transform: scaleY(.5); }
.meal-card { padding: 12px; }
.meal-card img, .noimg { width: 60px; height: 60px; }
.meal-label { font-size: 17px; }

/* welcome, empty state, Add meal */
.welcome { border: 0; border-radius: 24px; padding: 18px; }
.welcome h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.empty-card { border: 0; border-radius: 22px; background: var(--surface); }
.fab { padding: 15px 30px; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }

/* sheets: a grabber at the top, bigger titles, softer fields */
.sheet { border-radius: 24px 24px 0 0; }
@media (min-width: 600px) { .sheet { border-radius: 24px; } }
.sheet-inner::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
.sheet-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
input, select, textarea { border-color: transparent; }
.item, .note-box { border-radius: 18px; }
.photo-choice { border-radius: 20px; border-color: transparent; }

/* ---------------------------------------------------------------- Liquid Glass
   Apple's translucent glass, approximated for the web: a blur of what's behind,
   a tint, a bright rim where light catches the edge, and a soft shadow.
   Controls floating above the content (Add meal, top bar, messages, pop-ups) get
   full glass; the tiles are lightly frosted so the seasonal background drifts
   softly behind them. Falls back to solid where blur isn't supported or the
   phone is set to reduce transparency. */
:root {
  --glass-tint: rgba(255, 255, 255, .62);
  --glass-tile: rgba(255, 255, 255, .78);
  --glass-rim: rgba(255, 255, 255, .7);
  --glass-edge: rgba(0, 0, 0, .06);
  --glass-shine: linear-gradient(160deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 45%);
  --glass-blur: blur(22px) saturate(180%);
}
/* always dark (2026-11-06) */
  :root {
    --glass-tint: rgba(44, 44, 46, .55);
    --glass-tile: rgba(28, 28, 30, .66);
    --glass-rim: rgba(255, 255, 255, .16);
    --glass-edge: rgba(0, 0, 0, .4);
    --glass-shine: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 45%);
  }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* frosted tiles */
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card, .welcome, .empty-card {
    background: var(--glass-tile);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 0 0 .5px var(--glass-rim), 0 1px 2px var(--glass-edge);
  }

  /* top bar: clear at the top of the page, glass once content scrolls under it */
  .topbar {
    position: sticky; top: 0; z-index: 30;
    margin: 0 -16px; padding: 6px 16px;
    transition: background .25s, box-shadow .25s;
  }
  .topbar.scrolled {
    background: var(--glass-tint);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: 0 .5px 0 var(--glass-edge);
  }

  /* Add meal: a tinted glass pill */
  .fab {
    background: var(--glass-shine), color-mix(in srgb, var(--accent) 88%, transparent);
    text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 0 .5px rgba(255, 255, 255, .35),
                0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent), 0 2px 6px rgba(0, 0, 0, .12);
  }

  /* messages and pop-ups */
  .toast {
    background: var(--glass-shine), rgba(29, 29, 31, .72); color: #f5f5f7;
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .18), 0 10px 30px rgba(0, 0, 0, .25);
  }
  .confirm {
    background: var(--glass-shine), var(--glass-tint);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 0 0 .5px var(--glass-rim), 0 20px 50px rgba(0, 0, 0, .25);
  }
  .confirm::backdrop, .sheet::backdrop { background: rgba(0, 0, 0, .3); }
  .sheet {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 .5px 0 var(--glass-rim);
  }

  /* the gym switch knob catches the light too */
  .switch::after { background: linear-gradient(180deg, #fff, #f2f2f2); }
}
@media (prefers-reduced-transparency: reduce) {
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card, .welcome, .empty-card, .topbar.scrolled, .confirm, .sheet {
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card, .welcome, .empty-card, .confirm { background: var(--surface); }
  .topbar.scrolled, .sheet { background: var(--bg); }
  .fab { background: var(--accent); }
  .toast { background: var(--text); color: var(--bg); }
}

/* ---------------------------------------------------------------- Stronger Liquid Glass
   Glass only shows when there's colour behind it, so the page gets soft,
   slowly drifting blobs of seasonal colour (iPhone-wallpaper style), and the
   tiles become clearer glass with a glossy sheen, bright edges and depth. */
:root {
  --blob-1: #6ee7b7; --blob-2: #99f6e4; --blob-3: #a7f3d0;   /* emerald (no season) */
  --muted: #5f5f64;                                           /* a touch darker for text on glass */
  --glass-tile: rgba(255, 255, 255, .42);
  --glass-tint: rgba(255, 255, 255, .5);
  --glass-rim: rgba(255, 255, 255, .85);
  --glass-shine: linear-gradient(150deg, rgba(255, 255, 255, .7) 0%, rgba(255, 255, 255, .18) 32%, rgba(255, 255, 255, 0) 58%);
  --glass-depth: 0 10px 30px rgba(31, 41, 55, .10), 0 1px 3px rgba(31, 41, 55, .08);
  --glass-blur: blur(28px) saturate(200%);
}
body[data-season="autumn"] { --blob-1: #fcd34d; --blob-2: #fdba74; --blob-3: #6ee7b7; }
body[data-season="winter"] { --blob-1: #bfdbfe; --blob-2: #c7d2fe; --blob-3: #a7f3d0; }
body[data-season="spring"] { --blob-1: #fbcfe8; --blob-2: #ddd6fe; --blob-3: #a7f3d0; }
body[data-season="summer"] { --blob-1: #fde68a; --blob-2: #fed7aa; --blob-3: #99f6e4; }
/* always dark (2026-11-06) */
  :root {
    --blob-1: #065f46; --blob-2: #115e59; --blob-3: #064e3b;
    --muted: #a1a1a6;
    --glass-tile: rgba(36, 36, 40, .42);
    --glass-tint: rgba(36, 36, 40, .5);
    --glass-rim: rgba(255, 255, 255, .22);
    --glass-shine: linear-gradient(150deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .04) 32%, rgba(255, 255, 255, 0) 58%);
    --glass-depth: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .4);
  }
  body[data-season="autumn"] { --blob-1: #92400e; --blob-2: #9a3412; --blob-3: #065f46; }
  body[data-season="winter"] { --blob-1: #1e3a8a; --blob-2: #312e81; --blob-3: #064e3b; }
  body[data-season="spring"] { --blob-1: #831843; --blob-2: #4c1d95; --blob-3: #064e3b; }
  body[data-season="summer"] { --blob-1: #854d0e; --blob-2: #7c2d12; --blob-3: #134e4a; }


/* the colour behind the glass: three soft blobs drifting slowly */
body::before {
  content: ""; position: fixed; inset: -25%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(34% 30% at 18% 22%, var(--blob-1), transparent 70%),
    radial-gradient(38% 34% at 84% 38%, var(--blob-2), transparent 70%),
    radial-gradient(42% 36% at 38% 82%, var(--blob-3), transparent 70%);
  opacity: .85;
  animation: blobs 36s ease-in-out infinite alternate;
}
@keyframes blobs {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
  50%  { transform: translate(4%, -3%) rotate(8deg) scale(1.06); }
  100% { transform: translate(-3%, 4%) rotate(-6deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
/* the blobs replace the faint seasonal tint; leaves and snow still fall on top */
body[data-season] #season-bg { background: none; }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card, .welcome, .empty-card {
    background: var(--glass-shine), var(--glass-tile);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 1px 0 var(--glass-rim), inset 0 0 0 1px color-mix(in srgb, var(--glass-rim) 45%, transparent),
                inset 0 -1px 1px rgba(0, 0, 0, .04), var(--glass-depth);
  }
  .fab {
    background: var(--glass-shine), color-mix(in srgb, var(--accent) 72%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 0 0 1px rgba(255, 255, 255, .3),
                0 12px 34px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 6px rgba(0, 0, 0, .14);
  }
  .topbar.scrolled { background: var(--glass-shine), var(--glass-tint); }
  .confirm, .toast { box-shadow: inset 0 1px 0 var(--glass-rim), var(--glass-depth); }
}
@media (prefers-reduced-transparency: reduce) {
  body::before { display: none; }
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card, .welcome, .empty-card { background: var(--surface); box-shadow: none; }
  .fab { background: var(--accent); }
}

/* ---------------------------------------------------------------- Even stronger glass
   Clearer tiles and a lighter blur, so the falling leaves (or snow, petals,
   specks) show as soft shapes drifting behind the tiles across the whole page. */
:root {
  --glass-tile: rgba(255, 255, 255, .26);
  --glass-tint: rgba(255, 255, 255, .38);
  --glass-rim: rgba(255, 255, 255, .95);
  --glass-shine: linear-gradient(150deg, rgba(255, 255, 255, .78) 0%, rgba(255, 255, 255, .22) 30%, rgba(255, 255, 255, .04) 60%, rgba(255, 255, 255, .14) 100%);
  --glass-blur: blur(9px) saturate(190%);
}
/* always dark (2026-11-06) */
  :root {
    --glass-tile: rgba(30, 30, 34, .3);
    --glass-tint: rgba(30, 30, 34, .42);
    --glass-rim: rgba(255, 255, 255, .26);
    --glass-shine: linear-gradient(150deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .05) 30%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, .06) 100%);
  }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card, .welcome, .empty-card {
    /* a second, softer rim along the bottom edge, like light passing through */
    box-shadow: inset 0 1px 0 var(--glass-rim), inset 0 -1px 0 color-mix(in srgb, var(--glass-rim) 40%, transparent),
                inset 0 0 0 1px color-mix(in srgb, var(--glass-rim) 50%, transparent), var(--glass-depth);
  }
  .fab { background: var(--glass-shine), color-mix(in srgb, var(--accent) 66%, transparent); }
  /* text stays crisp over anything drifting behind it */
  .summary, .period, .gym-toggle, .week, .meal-list, .relog-card { text-shadow: 0 0 12px color-mix(in srgb, var(--surface) 70%, transparent); }
}

/* week graph: calories Monday to Sunday against her goal */
.wg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin: 0 6px 6px; }
.wg-head .tile-title { margin: 0; }
.wg-avg { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Graph | Bars switch, like an iPhone segmented control */
.seg { display: inline-flex; flex: none; padding: 2px; border-radius: 10px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.seg-btn { padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg-btn[aria-selected="true"] { background: color-mix(in srgb, var(--text) 20%, var(--surface)); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.wg-sel { fill: color-mix(in srgb, var(--text) 9%, transparent); }
.wg-gym { fill: var(--accent); }
.wg-wrap { position: relative; }
#week-graph { display: block; width: 100%; height: auto; overflow: visible; }
.wg-grid { stroke: var(--line); stroke-width: 1; }
.wg-ylab { fill: var(--muted); font-size: 10px; text-anchor: end; font-variant-numeric: tabular-nums; }
.wg-xlab { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.wg-xlab.sel { fill: var(--text); font-weight: 700; }
.wg-goal { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .85; }
.wg-goal-lab { fill: var(--muted); font-size: 10px; }
.wg-area { fill: var(--accent); opacity: .14; }
.wg-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.wg-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.wg-dot.over { fill: #f59e0b; }
.wg-hit { fill: transparent; cursor: pointer; }
#week-graph.draw-in .wg-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: wg-draw .9s ease-out forwards; }
#week-graph.draw-in .wg-area, #week-graph.draw-in .wg-dot { animation: wg-fade .9s ease-out both; }
@keyframes wg-draw { to { stroke-dashoffset: 0; } }
@keyframes wg-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #week-graph.draw-in .wg-line, #week-graph.draw-in .wg-area, #week-graph.draw-in .wg-dot { animation: none; stroke-dasharray: none; } }
.wg-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none; z-index: 2;
  display: grid; gap: 1px; padding: 7px 10px; border-radius: 12px; white-space: nowrap; text-align: center;
  font-size: 12px; color: var(--text); background: var(--surface-2); box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.wg-tip strong { font-size: 12px; }
