/* Warm ivory surfaces, aubergine and paprika, with gold and leaf accents for food categories. */
:root {
  color-scheme: light;
  --bg: #fff6e8;
  --surface: #ffffff;
  --text: #2d202c;
  --muted: #635361;
  --border: #eadacc;
  --brand: #a83324;
  --brand-contrast: #ffffff;
  --indigo: #663961;
  --indigo-soft: #f2e3f0;
  --hero-a: #351c36;
  --ok: #2f7d46;
  --sun: #c98a06;
  --jollof: #d4501a;
  --leaf: #3a8a4a;
  --warn-bg: #fff6e0;
  --warn-border: #f0cf7a;
  --err: #b42318;
  --radius: 16px;
  --shadow: 0 12px 26px -20px rgba(78, 39, 66, 0.3);
  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #19131b;
    --surface: #261d29;
    --text: #fff4e8;
    --muted: #d7c1d3;
    --border: #443647;
    --brand: #f9ca68;
    --brand-contrast: #261a27;
    --indigo: #e5ace0;
    --indigo-soft: #493148;
    --hero-a: #351c36;
    --ok: #5fc27a;
    --sun: #fbbf24;
    --jollof: #ff987a;
    --leaf: #5fc27a;
    --warn-bg: #2b2411;
    --warn-border: #6b5a1f;
    --err: #f87171;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #19131b;
  --surface: #261d29;
  --text: #fff4e8;
  --muted: #d7c1d3;
  --border: #443647;
  --brand: #f9ca68;
  --brand-contrast: #261a27;
  --indigo: #e5ace0;
  --indigo-soft: #493148;
  --hero-a: #351c36;
  --ok: #5fc27a;
  --sun: #fbbf24;
  --jollof: #ff987a;
  --leaf: #5fc27a;
  --warn-bg: #2b2411;
  --warn-border: #6b5a1f;
  --err: #f87171;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-body);
}

.app {
  max-width: 720px; margin: 0 auto; padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
header h1 { margin: 8px 0 0; font-size: 1.6rem; }
header p { margin: 4px 0 20px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .full { grid-column: 1 / -1; }

label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }

input, select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.segmented { display: flex; gap: 8px; }
.segmented label {
  flex: 1; margin: 0; text-align: center; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  color: var(--text); background: var(--bg);
}
.segmented input { position: absolute; opacity: 0; width: 0; }
.segmented input:checked + span { font-weight: 600; }
.segmented label:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

button.primary {
  width: 100%; margin-top: 16px; padding: 12px;
  font: inherit; font-weight: 600; cursor: pointer;
  color: var(--brand-contrast); background: var(--brand);
  border: 0; border-radius: 8px;
}

.error { color: var(--err); margin: 12px 0 0; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.stat .value { font-size: 1.4rem; font-weight: 700; }
.stat .label { font-size: 0.8rem; color: var(--muted); margin: 0; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border);
}
.badge.healthy { color: var(--ok); border-color: var(--ok); }

.warning {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0 0; font-size: 0.9rem;
}
.disclaimer { font-size: 0.8rem; color: var(--muted); text-align: center; margin: 24px 0; }

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; padding: 10px 12px; font: inherit; cursor: pointer;
  color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent;
}
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--brand); }
[hidden] { display: none !important; }

/* Progress */
.badge.status-on_track { color: var(--ok); border-color: var(--ok); }
.badge.status-too_fast, .badge.status-wrong_direction, .badge.status-drifting { color: var(--err); border-color: var(--err); }
.card h2 .badge { margin-left: 6px; vertical-align: middle; }

.chart { width: 100%; height: auto; margin-top: 16px; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-band { fill: var(--ok); opacity: 0.12; }
.chart-target { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-line { stroke: var(--indigo); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; animation: draw 1.1s 0.2s ease both; }
.chart-point { fill: var(--indigo); stroke: var(--surface); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: pop 0.4s 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.chart-text { fill: var(--muted); font-size: 11px; }

.history { width: 100%; border-collapse: collapse; }
.history th, .history td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.history th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.history td:last-child { text-align: right; }
button.link {
  font: inherit; color: var(--err); background: none; border: 0; cursor: pointer;
  text-decoration: underline; padding: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.chart-figure { margin: 0; }
.chart-text { font-size: 12px; }

/* Meals */
.daypicker { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.daybtn {
  flex: 0 0 auto; padding: 8px 12px; font: inherit; font-size: 0.9rem; cursor: pointer;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
}
.daybtn.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); font-weight: 600; }
button.secondary {
  width: 100%; margin-top: 12px; padding: 10px; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--brand); background: transparent; border: 1px solid var(--brand); border-radius: 8px;
}
.card h2 .kcal { float: right; font-weight: 500; color: var(--muted); font-size: 0.95rem; }
.meal-name { margin: 0 0 8px; font-weight: 600; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.items li > span:last-child { white-space: nowrap; color: var(--muted); }
.portion { display: block; font-size: 0.8rem; color: var(--muted); }

.oilrow { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.oilrow > span { color: var(--muted); font-size: 0.9rem; margin-right: auto; }
.tag { margin-left: 6px; padding: 0 6px; font-size: 0.7rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; }

/* Workouts */
.card.today { border-color: var(--brand); }
.card h2 .badge { font-weight: 600; }
.portion.inline { display: inline; margin-left: 6px; }
.check { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; color: var(--text); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); }
.tab { font-size: 0.9rem; padding: 10px 4px; }

/* Shopping list */
details.shopping > summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; list-style: none; }
details.shopping > summary::-webkit-details-marker { display: none; }
details.shopping[open] > summary { margin-bottom: 8px; }
details.shopping h3 { margin: 16px 0 4px; font-family: var(--font-display); font-size: 0.95rem; color: var(--indigo); }
.shop-item { margin: 0; }
.items li .shop-item { flex: 1; }
.got { text-decoration: line-through; color: var(--muted); }


/* ---- Design layer ---- */
h1, h2, .stat .value { font-family: var(--font-display); }
.card { box-shadow: var(--shadow); }
.card h2 { letter-spacing: -0.01em; }
.card.feature { background: color-mix(in srgb, var(--indigo-soft) 55%, var(--surface)); }
.app {
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
}

/* Hero */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 160px; margin-bottom: 16px; padding: 20px 20px 58px;
  border-radius: 16px; color: #fff;
  background: var(--hero-a); border-bottom: 4px solid #ffc857;
}
.hero-pattern { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-art { position: absolute; right: 0; bottom: 0; height: 80px; width: auto; pointer-events: none; }
.hero h1 { margin: 0; font-size: 2.3rem; line-height: 1.02; letter-spacing: -0.03em; }
.hero p { margin: 8px 0 0; max-width: 16rem; color: rgba(255, 255, 255, 0.86); }
.steam path { opacity: 0.5; animation: steam 3.4s ease-in-out infinite; }
.steam .steam-b, .scene-steam .steam-b { animation-delay: 0.9s; }
.steam .steam-c, .scene-steam .steam-c { animation-delay: 1.8s; }
.scene-steam path { opacity: 0.5; animation: steam 3.4s ease-in-out infinite; }
@keyframes steam {
  0% { opacity: 0; transform: translateY(8px); }
  35% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* Bottom navigation */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.nav-inner { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); max-width: 720px; margin: 0 auto; }
.nav-pill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 20%; border-radius: 16px;
  background: color-mix(in srgb, var(--brand) 15%, var(--surface));
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 0.4s cubic-bezier(0.3, 1.15, 0.4, 1);
}
.tab {
  position: relative; z-index: 1; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; font-size: 0.75rem; font-weight: 500;
  color: var(--muted); background: none; border: 0; border-radius: 16px; cursor: pointer;
  transition: color 0.2s;
}
.tab.active { color: var(--brand); font-weight: 700; }
.tab .icon { transition: transform 0.3s cubic-bezier(0.3, 1.4, 0.5, 1); }
.tab.active .icon { transform: translateY(-1px) scale(1.12); }

/* Page transitions: slide in from the side you navigated towards */
.panels { overflow-x: clip; }
.panels > [role="tabpanel"] { animation: pageIn 0.42s cubic-bezier(0.22, 0.8, 0.24, 1) both; }
.panels[data-dir="back"] > [role="tabpanel"] { animation-name: pageInBack; }
@keyframes pageIn { from { opacity: 0; transform: translateX(28px); } }
@keyframes pageInBack { from { opacity: 0; transform: translateX(-28px); } }
.results { animation: fadeIn 0.45s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.meal-list > .card { animation: fadeIn 0.35s ease both; }

@keyframes draw {
  from { stroke-dasharray: 1; stroke-dashoffset: 1; }
  to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}
@keyframes pop { from { transform: scale(0); opacity: 0; } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes ringSeg { from { stroke-dasharray: 0 var(--c); } }
@keyframes markerIn { from { left: 0%; } }

/* Controls */
button.primary { transition: transform 0.15s, box-shadow 0.15s; }
button.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -10px var(--brand); }
button.primary:active { transform: translateY(1px); box-shadow: none; }
.daybtn, button.secondary, .segmented label { transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s; }
input, select { transition: border-color 0.15s, box-shadow 0.15s; }
input:focus-visible, select:focus-visible { border-color: var(--indigo); }

/* Icon chips */
.chip {
  --c: var(--indigo);
  display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 8px; vertical-align: -9px;
  border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent);
}
.chip.breakfast { --c: var(--sun); }
.chip.lunch, .chip.cardio { --c: var(--jollof); }
.chip.snack, .chip.mobility { --c: var(--leaf); }
.chip.dinner, .chip.strength { --c: var(--indigo); }

/* Diagrams */
.diagram { margin: 16px 0 0; }
.dg-text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.dg-text.strong { fill: var(--text); font-weight: 600; }

.bmi { position: relative; padding-top: 30px; }
.bmi-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; }
.bmi-zone { height: 100%; }
.z-under { background: var(--sun); }
.z-healthy { background: var(--ok); }
.z-over { background: var(--jollof); }
.z-obese { background: var(--err); }
.bmi-marker {
  position: absolute; top: 24px; bottom: -5px; left: var(--pos); width: 4px; margin-left: -2px;
  border-radius: 2px; background: var(--text);
  animation: markerIn 1s 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.bmi-marker span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  padding: 1px 8px; border-radius: 999px; background: var(--text); color: var(--surface);
  font: 700 0.8rem var(--font-display);
}
.bmi-labels { display: flex; margin-top: 12px; font-size: 0.75rem; color: var(--muted); }
.bmi-labels span { text-align: center; }

.wr { width: 100%; height: auto; display: block; }
.wr-axis { stroke: var(--border); stroke-width: 2; }
.wr-band { fill: color-mix(in srgb, var(--ok) 20%, transparent); stroke: var(--ok); stroke-width: 1.5; }
.wr-path { fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; animation: draw 0.9s 0.5s ease both; }
.wr-head { fill: var(--muted); animation: fadeIn 0.3s 1.35s both; }
.wr-target line { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 3 3; }
.wr-target circle { fill: var(--surface); stroke: var(--text); stroke-width: 2.5; }
.wr-now { stroke: var(--surface); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: pop 0.5s 0.15s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.wr-now.ok { fill: var(--ok); }
.wr-now.over { fill: var(--jollof); }
.wr-now.under { fill: var(--sun); }

.ebars { display: grid; gap: 14px; }
.ebar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.9rem; }
.ebar-head small { display: block; color: var(--muted); font-size: 0.75rem; }
.ebar-head strong { font-family: var(--font-display); white-space: nowrap; }
.ebar-track { height: 10px; margin-top: 6px; border-radius: 999px; background: var(--indigo-soft); overflow: hidden; }
.ebar-fill { display: block; height: 100%; border-radius: 999px; transform-origin: left; animation: growX 0.8s calc(0.15s + var(--i, 0) * 120ms) cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.t-indigo { background: var(--indigo); }
.t-sun { background: var(--sun); }
.t-brand { background: var(--brand); }

.ringrow { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.ring { width: 148px; height: 148px; flex: none; }
.pring { width: 92px; height: 92px; flex: none; }
.ring-track { fill: none; stroke: var(--indigo-soft); stroke-width: 14; }
.pring .ring-track { stroke-width: 10; }
.ring-seg { fill: none; stroke-width: 14; animation: ringSeg 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ring-seg.pr { stroke: var(--indigo); stroke-width: 10; stroke-linecap: round; }
.ring-num { fill: var(--text); font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.ring-num.sm { font-size: 20px; }
.ring-sub { fill: var(--muted); font-size: 10px; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 160px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.legend li strong { margin-left: auto; font-family: var(--font-display); }
.legend .icon { color: var(--muted); }
.legend.inline { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; min-width: 0; }
.legend.inline li { font-size: 0.8rem; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.k-cardio, .swatch.k-strength, .swatch.k-mobility { background: var(--c); }
.swatch.done { background: var(--text); opacity: 0.8; }

.k-cardio { --c: var(--jollof); }
.k-strength { --c: var(--indigo); }
.k-mobility { --c: var(--leaf); }
.weekbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 168px; padding-top: 18px; }
.wb { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wb-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.wb-bar {
  position: relative; width: min(100%, 28px); height: var(--h); min-height: 22px;
  border: 2px solid var(--c); border-radius: 8px 8px 4px 4px;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  transform-origin: bottom; animation: growY 0.7s calc(0.1s + var(--i, 0) * 70ms) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.wb-bar.done { background: var(--c); }
.wb-bar em { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.wb-rest { width: 6px; height: 6px; margin-bottom: 4px; border-radius: 50%; background: var(--border); }
.wb-label { text-align: center; font-size: 0.75rem; color: var(--muted); }
.wb.today .wb-label { color: var(--text); font-weight: 700; }
.wb.today .wb-label::after { content: ""; display: block; width: 14px; height: 3px; margin: 2px auto 0; border-radius: 2px; background: var(--brand); }

/* Empty states */
.empty { text-align: center; padding-block: 24px; }
.empty-art { width: min(220px, 70%); margin: 0 auto 8px; }
.empty-art svg { width: 100%; height: auto; display: block; }
.empty h2 { margin-bottom: 4px; }
.empty p { margin: 0 auto; max-width: 28rem; color: var(--muted); }
.needle { transform-box: view-box; transform-origin: 100px 62px; animation: sway 2.6s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-26deg); } to { transform: rotate(22deg); } }

.ring-card { display: flex; align-items: center; gap: 16px; }
.ring-card .stats { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.diagram ~ .stats { margin-top: 18px; }
.stats + .ebars { margin-top: 18px; }

.gap-note { margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; }

.ring-card { margin: 4px 0 16px; }
.ring-caption { display: grid; gap: 2px; margin: 0; }
.ring-caption strong { font-family: var(--font-display); font-size: 1.15rem; }
.ring-caption span { color: var(--muted); font-size: 0.9rem; }

.hero-art { right: 10px; }
.weekbars { height: 150px; }
@media (max-width: 480px) {
  .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

.beta-pill {
  display: inline-block; margin-bottom: 10px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
  color: #fff; background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Feedback */
textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; resize: vertical; min-height: 96px;
}
textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-color: var(--indigo); }
.fb-label { margin-top: 12px; }
.feedback button.secondary { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 0; }

/* Account */
.account h2 { display: flex; align-items: center; gap: 8px; }
.acct-intro { margin: 0 0 12px; }
.account button.secondary { margin-top: 12px; }
button.link-plain {
  display: block; width: 100%; margin-top: 12px; padding: 8px; font: inherit; font-size: 0.9rem;
  color: var(--indigo); background: none; border: 0; cursor: pointer; text-decoration: underline;
}
button.primary:disabled { opacity: 0.6; cursor: wait; }

.hero p { max-width: 12.5rem; }
.hero { min-height: 196px; }

[role="tabpanel"], #plan-results, #your-data { scroll-margin-top: 12px; }
.empty button { max-width: 100%; }

.daybtn.active { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }

.welcome { max-width: 520px; padding-bottom: 28px; }
.welcome-options p:last-child { margin-bottom: 0; }
.plan-greeting { padding: 4px 0 10px; }
.plan-greeting p { margin: 0; color: var(--muted); }

.setup-progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.setup-progress progress { flex: 1; min-width: 0; accent-color: var(--brand); }
.setup-card h2 { margin: 12px 0 16px; }
.profile-heading { border-top: 4px solid var(--sun); }
.profile-heading h2 { margin-bottom: 4px; font-size: 1.65rem; }
.profile-heading p { margin: 0; color: var(--muted); }
.profile-target { background: var(--hero-a); color: #fff; }
.profile-target p { margin: 4px 0 16px; color: #ffdb86; }
.profile-target strong { font-size: clamp(2rem, 9vw, 3.3rem); line-height: 1; }
.profile-target button { color: #ffdb86; background: transparent; border-color: currentColor; }
.profile-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; }
.profile-facts dt { color: var(--muted); font-size: .84rem; }
.profile-facts dd { margin: 3px 0 0; font-weight: 600; }
.profile-training { text-transform: capitalize; }

.today-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.account-deletion { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.account-deletion h3 { margin: 0 0 8px; }
.account-deletion label { margin-top: 10px; }
button.danger-button { color: var(--err); border: 1px solid currentColor; background: var(--surface); }
button.danger-button:disabled { opacity: .55; cursor: not-allowed; }

.meal-scan fieldset { min-width: 0; border: 1px solid var(--border); border-radius: 12px; margin: 12px 0; padding: 12px; }
.meal-scan legend { padding: 0 4px; font-weight: 700; }
.meal-scan input[type="file"] { width: 100%; max-width: 100%; }
.scan-estimate { background: var(--indigo-soft); border-radius: 12px; padding: 12px; }

.app-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.app-top h1 { margin: 0; font-size: 1.4rem; line-height: 1.15; }
button.app-top-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; min-height: 40px; width: auto; margin: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.plan-greeting h2, .meal-page-heading h2 { font-size: clamp(1.7rem, 6vw, 2.35rem); letter-spacing: -.035em; margin: 0 0 6px; }
.today-plan { border-top: 3px solid var(--brand); }
.today-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.today-heading span, .today-target dt, .today-metrics dt { color: var(--muted); font-size: .83rem; }
.today-target { margin: 8px 0 14px; }
.today-target dd { margin: 2px 0 0; font: 700 clamp(2.3rem, 10vw, 3.4rem)/1 var(--font-display); color: var(--brand); }
.today-target dd span { color: var(--muted); font: 500 1rem var(--font-body); }
.today-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); gap: 8px; margin: 0; }
.today-metrics div { background: var(--bg); border-radius: 10px; padding: 9px; }
.today-metrics dd { margin: 3px 0 0; font-weight: 700; font-size: 1.18rem; }
.today-plan button.primary, .meal-shortcuts button { display: flex; align-items: center; justify-content: center; gap: 7px; }
.meal-shortcuts { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; margin: 0 0 12px; }
.meal-shortcuts button { margin: 0; min-height: 44px; font-size: .88rem; }
.meal-scan summary, .plan-details summary { min-height: 24px; cursor: pointer; font-weight: 700; }
.meal-scan { border-color: color-mix(in srgb, var(--brand) 44%, var(--border)); }
.meal-scan > summary { color: var(--brand); }
.meal-scan[open] > summary, .plan-details[open] > summary { margin-bottom: 12px; }
.plan-details .results > .card:last-child { margin-bottom: 0; }
#today-plan, #manual-meals, #meal-shopping { scroll-margin-top: 12px; }

.protein-preference { display: grid; gap: 5px; margin: 12px 0 0; }
.protein-preference .hint { margin: 0; font-weight: 400; }

/* This shell is drawn before the application bundle, then hidden when React renders. */
#root:not(:empty) + .startup { display: none; }
.startup {
  display: grid; place-items: center; min-height: 100vh; min-height: 100dvh;
  padding: 24px; background: var(--bg);
}
.startup-card {
  width: min(100%, 300px); padding: 20px 20px 26px; text-align: center;
  background: #351f39; color: #fff4e8; border: 1px solid #654567; border-radius: 22px;
  box-shadow: 0 15px 36px -22px #28132c;
}
.startup-art { display: block; width: min(100%, 216px); margin: 0 auto; }
.startup-card h1 { margin: 0; font-size: 1.9rem; letter-spacing: -.035em; }
.startup-card p { margin: 5px 0 0; color: #e9d4e7; }
.startup-steam path, .startup-sparks circle { animation: startup-float 2s ease-in-out infinite; }
.startup-steam path:nth-child(2), .startup-sparks circle:nth-child(2) { animation-delay: .2s; }
.startup-steam path:nth-child(3), .startup-sparks circle:nth-child(3) { animation-delay: .4s; }
.startup-dumbbell { animation: tab-lift 2s .25s ease-in-out infinite; }
.startup-lid { animation: startup-lid 2s ease-in-out infinite; }
@keyframes startup-float {
  0%, 100% { transform: translateY(1px); opacity: .55; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes startup-lid {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.app-top-brand { display: flex; align-items: center; gap: 9px; }
.tab-illustration {
  display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 36px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand);
  border-radius: 9px;
}
.tab-illustration svg { max-width: 100%; max-height: 100%; }
.tab-illustration-workouts svg { animation: tab-lift .7s ease-out both; }
.tab-illustration-plan svg, .tab-illustration-profile svg { animation: tab-settle .55s ease-out both; }
.tab-illustration-meals .scene-steam path { animation-duration: 1.3s; animation-iteration-count: 2; }
.tab-illustration-progress .needle { animation-iteration-count: 1; }
@keyframes tab-lift { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-4px); } }
@keyframes tab-settle { 0% { transform: scale(.82); } 65% { transform: scale(1.08); } 100% { transform: scale(1); } }

.workout-preview { margin: 14px 0; }
.workout-preview summary { cursor: pointer; padding: 10px 0; font-weight: 700; }
.exercise-preview { border-top: 1px solid var(--border); }
.exercise-preview summary span:last-child { display: block; padding-inline-start: 17px; color: var(--muted); font-size: .88rem; font-weight: 400; }
.exercise-demo { margin: 0 0 12px; text-align: center; }
.exercise-demo canvas { display: block; width: min(100%, 250px); height: auto; margin: 0 auto 8px; border-radius: 14px; background: #e4efe5; }
.exercise-demo figcaption { font-weight: 600; }
.exercise-poses, .workout-controls, .workout-player-header { display: flex; align-items: center; gap: 8px; }
.exercise-poses { justify-content: center; margin-top: 8px; }
.exercise-poses button { width: auto; margin: 0; min-height: 44px; }
.exercise-poses button[aria-pressed="true"] { background: var(--brand); color: var(--brand-contrast); }
dialog.workout-player { position: fixed; width: min(540px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; margin: auto; color: var(--text); }
.workout-player::backdrop { background: rgb(0 0 0 / .65); }
.workout-player-header { justify-content: space-between; }
.workout-player-header button { min-height: 44px; }
.workout-player progress { width: 100%; accent-color: var(--brand); margin-bottom: 12px; }
.workout-timer { font-size: 2rem; font-weight: 750; font-variant-numeric: tabular-nums; margin: 8px 0; }
.workout-player [role="status"]:empty { display: none; }
.workout-controls button { margin: 8px 0 0; }


/* ChopFit site logo */
.brand-mark { display: inline-flex; flex: none; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 14px -8px rgba(40, 19, 44, .55); }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.app-top-brand { display: flex; align-items: center; gap: 10px; }
.hero-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.hero-brand h1 { margin: 0; }
.startup-brand { display: block; width: min(100%, 120px); margin: 0 auto 10px; border-radius: 26px; overflow: hidden; }


.exercise-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.exercise-description {
  margin: 0.5rem 0;
  line-height: 1.45;
}

.exercise-demo canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
}

#startup-retry {
  margin: 16px auto 0;
  padding: 10px 16px;
  border: 1px solid #f9ca68;
  border-radius: 10px;
  background: transparent;
  color: #f9ca68;
  font: inherit;
  cursor: pointer;
}
