:root {
  color-scheme: var(--color-scheme);
  font-family: Manrope, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  --ink: #2f4257;
  --muted: #91a3ba;
  --color-scheme: light;
  --page-bg: #f0f2f4;
  --surface: #fafafb;
  --hero-border: white;
  --macro-bg: #f3f3f3;
  --raised: #f0f5f9;
  --surface-border: white;
  --panel-shadow: #0000000f;
  --macro-shadow: #00000014;
  --inset-glow: white;
  --plus-bg: #f0f5f9;
  --nav-bg: #ffffffb3;
  --nav-offset: 0px;
  --accent-shadow: inset -3px -3px 5px #a930ff, 0 6px 15px #664ac280, 0 2px 2px #fff3;
  --texture-opacity: .22;
  --focus: #7550c9;
  --dialog-bg: white;
  --field-bg: #f8fafc;
  --field-border: #dfe6ef;
  --field-label: #60748d;
  --toast-bg: #2f4257;
  --toast-ink: white;
  --water-ink: #2f4257;
  --water-goal-ink: #547395;
  --water-glass-glow: #fff3;
  --water-background: linear-gradient(180deg, #ced9e8 0%, #f2f8ff 28.982%, #e0ebf8 66.159%, #8cb5e1 100%);
  --water-border: #b8dcff;
  --water-inner-shadow: #8cb5e1e6;
  --water-glass-opacity: 1;
  --water-shine-opacity: 1;
  --water-plus-bg: #dcf3ff;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --hero-height: 284px;
  --hero-gap: 32px;
  --meal-height: 81px;
  --section-gap: 16px;
  --nav-bottom: max(18px, env(safe-area-inset-bottom));
  --nav-height: 66px;
}
:root[data-theme="dark"] {
  --color-scheme: dark;
  --ink: #f2f2f2;
  --muted: #b5b5b5;
  --page-bg: #121212;
  --surface: #1c1c1c;
  --hero-border: #1c1c1c;
  --macro-bg: #1c1c1c;
  --raised: #2b2b2b;
  --surface-border: #262626;
  --panel-shadow: #0000001c;
  --macro-shadow: #00000024;
  --inset-glow: #ffffff0a;
  --plus-bg: #262626;
  --nav-bg: #242424b3;
  --accent-shadow: inset -3px -3px 5px #a930ff, 0 6px 15px #1d1555b3, 0 2px 2px #14121b33;
  --texture-opacity: 1;
  --focus: #c4a7f5;
  --dialog-bg: #1c1c1c;
  --field-bg: #2b2b2b;
  --field-border: #424242;
  --field-label: #b5b5b5;
  --toast-bg: #2b2b2b;
  --toast-ink: #f2f2f2;
  --water-ink: #f2f2f2;
  --water-goal-ink: #bdcbe0;
  --water-background: linear-gradient(180deg, #272b33 0%, #1c2027 28.982%, #202934 66.159%, #29374b 100%);
  --water-border: #3c4b5f;
  --water-inner-shadow: #101820b3;
  --water-glass-glow: #9bc7ed14;
  --water-glass-opacity: .28;
  --water-shine-opacity: .16;
  --water-plus-bg: #2b3442;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
/* Every new theme opens from the chosen tile, above the previous palette. */
:root[data-theme-transition="snapshot"]::view-transition { pointer-events: none; }
:root[data-theme-transition="snapshot"]::view-transition-group(root) { z-index: 1; animation: none; }
:root[data-theme-transition="snapshot"]::view-transition-old(root),
:root[data-theme-transition="snapshot"]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root[data-theme-transition="snapshot"]::view-transition-old(root) { z-index: 1; }
:root[data-theme-transition="snapshot"]::view-transition-new(root) { z-index: 2; }
:root[data-theme-transition="snapshot"]::view-transition-new(root) { animation: theme-circle-open 520ms cubic-bezier(.4, 0, .2, 1) both; }
/* Capture the triggering tile separately, above the circular page mask. */
:root[data-theme-transition="snapshot"][data-theme-reveal-control="system"] #settings-content [data-theme-choice="system"],
:root[data-theme-transition="snapshot"][data-theme-reveal-control="light"] #settings-content [data-theme-choice="light"],
:root[data-theme-transition="snapshot"][data-theme-reveal-control="dark"] #settings-content [data-theme-choice="dark"] { view-transition-name: theme-control; }
:root[data-theme-transition="snapshot"]::view-transition-group(theme-control) { z-index: 2; animation: none; }
:root[data-theme-transition="snapshot"]::view-transition-old(theme-control),
:root[data-theme-transition="snapshot"]::view-transition-new(theme-control) { animation: none; mix-blend-mode: normal; }
:root[data-theme-transition="snapshot"]::view-transition-old(theme-control) { z-index: 1; }
:root[data-theme-transition="snapshot"]::view-transition-new(theme-control) { z-index: 2; animation: theme-control-fade 180ms ease-out both; }
@keyframes theme-control-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes theme-circle-open {
  from { clip-path: circle(0px at var(--theme-reveal-x) var(--theme-reveal-y)); }
  to { clip-path: circle(var(--theme-reveal-radius) at var(--theme-reveal-x) var(--theme-reveal-y)); }
}
/* Browsers without snapshots can still interpolate the interface palette. */
:root[data-theme-transition="colors"],
:root[data-theme-transition="colors"] *,
:root[data-theme-transition="colors"] *::before,
:root[data-theme-transition="colors"] *::after {
  transition-property: background-color, color, border-color, box-shadow, fill, stroke;
  transition-duration: 380ms;
  transition-timing-function: ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  :root::view-transition-old(root), :root::view-transition-new(root),
  :root::view-transition-old(theme-control), :root::view-transition-new(theme-control) { animation: none !important; }
}
button, input { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active:not([aria-disabled]) { filter: brightness(.96); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button[aria-disabled] { cursor: default; }
button:disabled { cursor: wait; }
img { display: block; max-width: none; }
p, h1, h2 { margin: 0; }
.app { max-width: 460px; min-height: 100svh; margin: auto; padding: max(20px, env(safe-area-inset-top)) 16px calc(var(--nav-bottom) + var(--nav-offset) + var(--nav-height) + 8px); position: relative; }
.summary { background: var(--surface); border-radius: 36px; box-shadow: 0 5px 10px var(--panel-shadow); overflow: hidden; }
.hero { height: var(--hero-height); border: 4px solid var(--hero-border); border-radius: 36px; position: relative; isolation: isolate; overflow: hidden; }
.gradient { position: absolute; inset: -4px; overflow: hidden; z-index: -1; background: #7047c8; }
.hero-art { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(var(--gradient-scale, 1)); transform-origin: center; }
.opening-art { display: none; position: absolute; }
.texture { position: absolute; inset: 0; background: url('./media/texture.png') repeat; background-size: 74px; mix-blend-mode: soft-light; opacity: var(--texture-opacity); pointer-events: none; }
.hero-copy { position: absolute; left: 20px; right: 20px; top: 20px; display: flex; flex-direction: column; gap: var(--hero-gap); }
.greeting { display: flex; justify-content: space-between; align-items: flex-start; gap: 4px; }
.greeting-copy { display: flex; flex-direction: column; gap: 11px; min-width: 0; color: white; }
/* Keep ellipsis clipping clear of accents/descenders without moving the trimmed layout. */
.greeting h1 { font: 600 26px/28px Onest, sans-serif; text-box-trim: trim-both; text-box-edge: cap alphabetic; padding-block: .25em; margin-block: -.25em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.greeting p { font: 500 12px/normal Onest, sans-serif; opacity: .8; }
.avatar { position: relative; flex: 0 0 72px; width: 72px; height: 72px; border-radius: 60px; background: transparent; padding: 0; }
.avatar img { position: absolute; left: calc(50% + .4px); top: calc(50% + .14px - 29.143px); transform: translateX(-50%); }
.calories { display: flex; align-items: flex-end; gap: 2px; color: white; white-space: nowrap; font-weight: 800; }
.calories > strong { font-size: 58px; line-height: normal; letter-spacing: -2.32px; text-shadow: 0 5px 10px var(--panel-shadow); }
.calories > span { font-size: 20px; letter-spacing: -.8px; opacity: .6; }
.calories.large-goal > span { font-size: 17px; }
.calories > strong, .calories > span { text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.macros { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 81px; display: flex; justify-content: space-between; align-items: center; background: var(--macro-bg); box-shadow: inset 0 0 15px 5px var(--inset-glow), 0 1px 4px var(--macro-shadow); border-radius: 24px; padding: 14px 27px; }
.macro { display: flex; flex: 0 0 44px; flex-direction: column; align-items: center; gap: 8px; }
.macro-separator { flex: 0 0 1px; }
.macro-label { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.macro-icon { height: 24px; width: 24px; display: grid; place-items: center; }
.macro-label > span:last-child { font-size: 10px; line-height: 29px; color: var(--muted); font-weight: 500; letter-spacing: -.4px; text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.macro strong { font-size: 16px; line-height: 29px; letter-spacing: -.64px; font-weight: 800; text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 6px 16px 12px; list-style: none; }
.day { min-width: 0; height: 70px; border-radius: 30px; background: var(--raised); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 600; }
.day > span { font-size: 12px; color: var(--muted); }
.day > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.day strong { font-size: 14px; font-weight: 600; }
.day > span, .day strong { text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.day.selected, .navigation .active { background: radial-gradient(ellipse at 24% 8%, #ffffff88, transparent 76%), linear-gradient(172deg, #c861e0, #936cff); box-shadow: var(--accent-shadow); color: white; position: relative; isolation: isolate; }
.day.selected > span { color: white; }
.day.selected::before, .navigation .active::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: url('./media/grain.png'); background-size: 74px; opacity: .2; z-index: -1; pointer-events: none; }
.meal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, var(--meal-height)); gap: 8px; margin-top: var(--section-gap); }
.meal { position: relative; border: 1px solid var(--surface-border); border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 8px var(--inset-glow); min-width: 0; }
.meal-label { position: absolute; top: 13px; left: 13px; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.meal-icon { display: grid; place-items: center; height: 20px; width: 20px; }
.flipped { transform: scaleY(-1); }
.meal-bottom { position: absolute; bottom: 7px; left: 13px; right: 7px; display: flex; justify-content: space-between; align-items: center; gap: 2px; white-space: nowrap; }
.meal-bottom > span { display: flex; align-items: flex-end; gap: 4px; }
.meal strong { font-size: 18px; letter-spacing: -.72px; font-weight: 700; }
.meal small { color: var(--muted); font-size: 12px; letter-spacing: -.48px; font-weight: 500; }
.meal strong, .meal small { text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.plus { width: 26px; height: 26px; padding: 2px; background: var(--plus-bg); border-radius: 28px; display: grid; place-items: center; position: relative; flex: 0 0 26px; }
.plus::before { content: ''; position: absolute; inset: -9px; border-radius: inherit; }
.breakfast { grid-area: 1 / 1; --delay: .30s; }
.lunch { grid-area: 2 / 1; --delay: .39s; }
.dinner { grid-area: 3 / 1; --delay: .47s; }
.snack { grid-area: 3 / 2; --delay: .51s; }
.water { grid-area: 1 / 2 / 3 / 3; position: relative; overflow: hidden; border: 1px solid var(--water-border); border-radius: 22px; isolation: isolate; background: var(--water-background); --delay: .35s; }
.water::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 20px var(--water-inner-shadow), inset 0 0 10px var(--water-glass-glow); pointer-events: none; }
.liquid-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.water-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
/* One continuous rim follows both vessel dimensions without stretching its stroke or corners. */
.glass-rim { position: absolute; inset: 10.7% 4px 2px; border: 4px solid #eef8ff85; border-top: 0; border-radius: 0 0 16px 16px; filter: blur(2px); opacity: var(--water-glass-opacity); }
.glass-shine { position: absolute; left: 11px; top: 7px; bottom: 9px; width: 16px; border-radius: 11px; filter: blur(4px); background: linear-gradient(#ffffff14, #f5f8ffb8 27%, #e0ecffa6 82%, #b5d8ff1a); }
.glass-top-shine { position: absolute; top: -5px; left: 6px; right: 6px; height: 23px; border-radius: 11px; background: #d7f7ff99; filter: blur(8px); }
.glass-shine, .glass-top-shine { opacity: var(--water-shine-opacity); }
.water-grain { position: absolute; inset: 0; background: url('./media/grain.png'); background-size: 74px; mix-blend-mode: overlay; opacity: .2; }
.water-wave { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; background: transparent; padding: 0; }
.water-wave:focus-visible { outline-offset: -4px; }
.water-total { position: absolute; top: 13px; left: 13px; right: 5px; display: flex; align-items: flex-end; gap: 2px; white-space: nowrap; pointer-events: none; }
.water-total strong { color: var(--water-ink); font-size: 24px; letter-spacing: -.96px; font-weight: 800; }
.water-total > span { font-size: 13px; letter-spacing: -.52px; font-weight: 800; color: var(--water-goal-ink); opacity: .6; }
.water-total strong, .water-total > span { text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.water-add { position: absolute; bottom: 6px; right: 8px; display: flex; align-items: center; gap: 6px; color: var(--water-goal-ink); font-size: 12px; pointer-events: none; transition: color .5s; }
.water-add > span { display: flex; gap: 2px; align-items: baseline; font-weight: 500; }
.water-add strong, .water-unit { line-height: 29px; text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.water-add strong { font-size: 18px; letter-spacing: -.72px; font-weight: 700; }
.water-unit { letter-spacing: -.48px; }
.water-add .plus { pointer-events: auto; background: var(--water-plus-bg); }
.water.water-deep .water-add { color: white; text-shadow: 0 1px 3px #25538d55; }
.navigation { position: fixed; bottom: calc(var(--nav-bottom) + var(--nav-offset)); left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 12px; padding: 8px; border-radius: 70px; background: var(--nav-bg); box-shadow: 0 5px 10px var(--panel-shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); width: max-content; --delay: .57s; }
.navigation button { border-radius: 40px; background: var(--raised); height: 50px; min-width: 50px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 14px; }
.navigation .active { font-size: 14px; font-weight: 600; }
.navigation .active > span { line-height: 29px; text-box-trim: trim-both; text-box-edge: cap alphabetic; }
.preview-mode { --nav-bottom: 34px; }
.preview-mode .app { padding-top: 44px; }
.booting { overflow: hidden; }
.booting .reveal { opacity: 0; translate: 0 18px; }
.ready .reveal { animation: reveal .8s var(--ease) both; animation-delay: var(--delay, 0s); }
.greeting-title { --delay: 0s; }
.greeting-date { --delay: .08s; }
.avatar { --delay: .12s; }
.calories { --delay: .18s; }
.macros { --delay: .26s; }
.days { --delay: .23s; }
@keyframes reveal { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
body[data-layout="compact"] { --meal-height: 73px; --section-gap: 12px; }
body[data-layout="short"] { --meal-height: 73px; --section-gap: 12px; --hero-height: 266px; --hero-gap: 20px; }
body[data-layout="short"] .days { padding-bottom: 11px; }
body[data-layout="wide-water"] { --meal-height: 85px; }
body[data-layout="wide-water"] .meal-grid { grid-template-rows: 85px 85px 146px; }
body[data-layout="wide-water"] .breakfast { grid-area: 1 / 1; }
body[data-layout="wide-water"] .lunch { grid-area: 1 / 2; }
body[data-layout="wide-water"] .dinner { grid-area: 2 / 1; }
body[data-layout="wide-water"] .snack { grid-area: 2 / 2; }
body[data-layout="wide-water"] .water { grid-area: 3 / 1 / 4 / 3; }
dialog { border: 0; border-radius: 28px; padding: 24px; width: calc(100% - 32px); max-width: 420px; max-height: 85svh; overflow: auto; color: var(--ink); background: var(--dialog-bg); box-shadow: 0 20px 80px #34274c33; }
dialog::backdrop { background: #2030454d; backdrop-filter: blur(7px); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.sheet-header h2 { font: 600 24px/1.2 Onest, sans-serif; }
.close { border-radius: 50%; background: var(--raised); width: 36px; height: 36px; font-size: 26px; flex-shrink: 0; }
form, .settings-actions { display: grid; gap: 14px; }
.settings-actions { margin-top: 20px; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--field-label); }
input { width: 100%; min-width: 0; border: 1px solid var(--field-border); border-radius: 12px; background: var(--field-bg); padding: 12px; font-size: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.primary { border-radius: 14px; background: linear-gradient(130deg, #c061df, #855af1); padding: 13px; color: white; font-weight: 700; }
.secondary { border-radius: 12px; background: var(--raised); padding: 12px; }
.hint { font-size: 13px; color: var(--field-label); line-height: 1.5; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--nav-bottom) + var(--nav-offset) + 82px); transform: translate(-50%, 10px); width: max-content; max-width: calc(100vw - 32px); border-radius: 14px; padding: 12px 18px; background: var(--toast-bg); color: var(--toast-ink); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: 0; z-index: 40; padding: 40px; background: var(--page-bg); }
@media (max-width: 360px) {
  /* Keep the fitted home screen still when a swipe reaches the page edge. */
  :root { overscroll-behavior-y: none; }
}
@media (max-width: 359px) {
  :root { --nav-height: 62px; }
  .hero-copy { left: 14px; right: 14px; }
  .greeting h1 { font-size: 23px; line-height: 26px; }
  .avatar { flex-basis: 58px; width: 58px; }
  .avatar img { scale: .85; }
  .calories > strong { font-size: 49px; }
  .calories > span { font-size: 17px; }
  .calories.large-goal > span { font-size: 14px; }
  .days { padding-left: 10px; padding-right: 10px; }
  .meal-label, .meal-bottom { left: 9px; }
  .meal-label { font-size: 13px; gap: 4px; }
  .water-total { left: 9px; }
  .water-total strong { color: var(--water-ink); font-size: 21px; }
  .water-total > span { font-size: 11px; }
  .navigation { gap: 7px; }
  .navigation button { padding: 12px; min-width: 46px; height: 46px; }
}
@supports not (text-box-trim: trim-both) {
  .greeting h1 { line-height: 24px; }
  .hero-copy { gap: 18px; }
  .macro-label > span:last-child { line-height: 12px; }
  .macro strong { line-height: 18px; }
  .macro { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Size-specific differences are present in the supplied dark frames. */
:root[data-theme="dark"] .day { height: 69px; }
:root[data-theme="dark"] .days { padding-bottom: 13px; }
:root[data-theme="dark"] body[data-layout="short"] .days { padding-bottom: 12px; }
:root[data-theme="dark"] .water-total strong { text-shadow: 0 5px 10px #0000001c; }
:root[data-theme="dark"] .water-total > span { opacity: .85; }
:root[data-theme="dark"] .water-add { color: white; }
:root[data-theme="dark"] body[data-layout="wide-water"] { --nav-offset: 10px; }
:root[data-theme="dark"] body[data-layout="wide-water"] .water-add { right: 16px; }
