/* FADE deploy-32 — photorealistic lean avatar videos + posters (16 new, water/air flex = exercise fallback) */
:root {
  color-scheme: dark;
  --ink: #070807;
  --ink-2: #101411;
  --paper: #070807;
  --paper-2: #161c18;
  --surface: #161c18;
  --surface-2: #1d2420;
  --text: #f4f1e7;
  --lime: #b8ed61;
  --lime-2: #d6ff8a;
  --lime-soft: rgba(184,237,97,.16);
  --mint: #8fcaaf;
  --orange: #ef8a52;
  --blue: #77aebe;
  --purple: #9986b7;
  --red: #c75b50;
  --muted: #8b938c;
  --line: rgba(255,255,255,.10);
  --shadow: 0 22px 70px rgba(0,0,0,.35);
  --glow: 0 0 40px rgba(184,237,97,.28);
  --radius-lg: 22px;
  --radius-md: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.32,.72,.28,1);
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; overflow-x: clip; overscroll-behavior-x: none; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
/* Never let page content widen the layout viewport: on iOS the top-layer
   <dialog> auto-margin math resolves against the layout viewport, so any
   horizontal overflow shifts sheets sideways (the "ED SESSION" bug). */
.app { overflow-x: clip; max-width: 100%; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { transition: transform .2s var(--ease), opacity .2s var(--ease), background-color .22s var(--ease); }
button:active { scale: .97; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(184, 237, 97, .55); outline-offset: 3px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--text); }

.app { min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 30; height: 72px; padding: 0 max(24px, calc((100vw - 1160px) / 2)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(to bottom, rgba(7,8,7,.92), rgba(7,8,7,.55) 70%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 20px; font-weight: 900; letter-spacing: -.8px; }
.brand-eye { width: 35px; height: 27px; border: 3px solid var(--lime); border-radius: 55% 45% 55% 45%; transform: rotate(-8deg); display: grid; place-items: center; }
.brand-eye span { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); border: 2px solid var(--ink); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.status-button { height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(22,28,24,.75); color: var(--muted); font-size: 11px; font-weight: 750; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b98b41; box-shadow: 0 0 0 4px rgba(185,139,65,.12); }
.status-button.live .status-dot { background: var(--lime); box-shadow: 0 0 0 4px rgba(184,237,97,.18); }
.status-button.offline .status-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(199,91,80,.12); }
.avatar-button { width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--lime); color: var(--ink); font-size: 12px; font-weight: 900; }

main { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 120px; }
.view { display: none; animation: enter .24s var(--ease); }
.view.active { display: block; overflow-x: clip; } /* deploy-38: no page-level sideways panning on any tab */
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.welcome, .panel-head, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.kicker, .section-kicker { margin-bottom: 8px; color: var(--lime); font-size: 11px; line-height: 1; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.section-kicker { color: var(--muted); letter-spacing: .1em; }
h1 { margin-bottom: 11px; max-width: 800px; font: 800 clamp(42px, 6vw, 68px)/.92 ui-sans-serif, system-ui, sans-serif; letter-spacing: -.06em; }
h2 { margin-bottom: 0; font: 800 27px/1.1 ui-sans-serif, system-ui, sans-serif; letter-spacing: -.03em; }
h3 { margin-bottom: 6px; font-size: 16px; }

.dark-button, .outline-button, .text-button, .analyze-button { min-height: 45px; padding: 0 17px; border-radius: 13px; border: 0; font-weight: 850; }
.dark-button { background: var(--lime); color: var(--ink); box-shadow: var(--glow); }
.dark-button:hover { background: var(--lime-2); }
.outline-button { color: var(--text); background: transparent; border: 1px solid var(--line); }
.text-button { min-height: 38px; padding: 0 4px; color: var(--lime); background: transparent; }
.full-button { width: 100%; }

/* Camera-first Today + Scan */
.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .7fr);
  gap: 18px;
  margin-top: 28px;
  align-items: stretch;
  overflow: visible;
}
.camera-stage {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: min(72vh, 760px);
  width: 100%;
  border-radius: 36px;
  overflow: visible;
  isolation: isolate;
}
.camera-plate {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: #141a12;
  border: 1px solid rgba(184,237,97,.28);
  box-shadow: 0 30px 100px rgba(0,0,0,.4);
}
.camera-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.5), transparent 28%, transparent 50%, rgba(0,0,0,.82));
}
.scan-label, .fade-label {
  position: absolute;
  top: 18px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(7,8,7,.72);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.scan-label { left: 18px; }
.fade-label { right: 18px; }
.scan-label i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #ff4d4d;
  box-shadow: 0 0 10px #ff4d4d;
}
.focus-corners {
  position: absolute;
  inset: 18% 12% 38%;
  z-index: 3;
  pointer-events: none;
}
.focus-corners i {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: var(--lime);
  border-style: solid;
}
.focus-corners i:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; }
.focus-corners i:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; }
.focus-corners i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.focus-corners i:nth-child(4) { bottom: 0; right: 0; border-width: 0 3px 3px 0; }
.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 18%;
  height: 2px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  box-shadow: 0 0 18px var(--lime);
  opacity: 0;
}
.camera-stage.scanning .scan-line,
.camera-frame.scanning .scan-line {
  opacity: 1;
  animation: scan-sweep 1.2s ease-in-out infinite;
}
@keyframes scan-sweep {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(240px); }
}
.camera-copy {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 42%;
  z-index: 3;
  pointer-events: none;
  text-align: left;
}
.camera-copy small {
  color: var(--lime);
  font-weight: 900;
  letter-spacing: .12em;
  font-size: 11px;
}
.camera-copy strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
  letter-spacing: -.04em;
}
.camera-copy span {
  display: block;
  color: #d0d3ce;
  margin-top: 6px;
  font-size: 13px;
}
.stage-scoreboard {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 92px;
  z-index: 5;
  color: white;
  overflow: visible;
}
.kcal-block {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 8px 14px 10px 4px;
  overflow: visible;
  isolation: isolate;
}
.kcal-block strong {
  display: block;
  font: 800 clamp(42px, 8vw, 64px)/.85 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -.07em;
  background: linear-gradient(180deg, #fff 20%, #d6ff8a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 18px rgba(184,237,97,.35));
}
.kcal-block small {
  display: block;
  margin-top: 8px;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  -webkit-text-fill-color: rgba(255,255,255,.7);
}
.kcal-of {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  font-weight: 750;
}
.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  overflow: visible;
}
.macro-cell {
  position: relative;
  min-width: 0;
  padding: 11px 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
  overflow: visible;
  isolation: isolate;
}
.macro-cell strong, .macro-cell small { display: block; }
.macro-cell strong { font-size: 18px; letter-spacing: -.02em; }
.macro-cell small {
  margin-top: 3px;
  color: rgba(255,255,255,.47);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.macro-bar { display: block; height: 4px; margin-top: 8px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.macro-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--lime); transition: width .4s var(--ease); }
.macro-cell .macro-bar i.protein { background: var(--lime); }
.macro-cell .macro-bar i.carbs { background: var(--orange); }
.macro-cell .macro-bar i.fat { background: var(--blue); }
.macro-cell .macro-bar i.sugar { background: #e4c56a; }
.macro-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; }
.macro-dot.protein { background: var(--lime); }
.macro-dot.carbs { background: var(--orange); }
.macro-dot.fat { background: var(--blue); }
.macro-dot.sugar { background: #e4c56a; }

.macro-cell.goal-hit,
.kcal-block.goal-hit,
#calorieScore.goal-hit {
  z-index: 2;
}
.macro-cell.goal-hit {
  border-color: var(--lime);
  background: rgba(184,237,97,.18);
  box-shadow: 0 0 22px rgba(184,237,97,.45);
}
.macro-cell.goal-hit strong { color: var(--lime); }
.macro-cell.goal-hit small { color: #d6ff8a; }
.kcal-block.goal-hit small {
  color: var(--lime);
  -webkit-text-fill-color: var(--lime);
}
.kcal-block.goal-hit strong {
  filter: drop-shadow(0 0 22px rgba(184,237,97,.8)) drop-shadow(0 8px 18px rgba(184,237,97,.35));
}
#calorieScore.goal-hit { color: var(--lime); }

.macro-cell.goal-hit::before,
.kcal-block.goal-hit::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220%;
  height: 220%;
  translate: -50% -50%;
  z-index: -1;
  pointer-events: none;
  background: repeating-conic-gradient(
    from -8deg at 50% 50%,
    rgba(255, 214, 90, 0) 0deg 8deg,
    rgba(255, 214, 90, .75) 8deg 10deg,
    rgba(184, 237, 97, .55) 10deg 12.5deg,
    rgba(255, 214, 90, 0) 12.5deg 22deg
  );
  -webkit-mask-image: radial-gradient(circle at center, transparent 12%, #000 30%, #000 46%, transparent 70%);
  mask-image: radial-gradient(circle at center, transparent 12%, #000 30%, #000 46%, transparent 70%);
  filter: blur(.3px);
  animation: ray-spin 14s linear infinite;
}
.kcal-block.goal-hit::before {
  width: 280%;
  height: 320%;
}
@keyframes ray-spin {
  to { transform: rotate(360deg); }
}
@keyframes pop {
  0% { transform: scale(.72); opacity: .4; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.macro-cell.pop, .kcal-block.pop, #calorieScore.pop {
  animation: pop .55s cubic-bezier(.2,1.4,.3,1) both;
}

.shutter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: 68px;
  height: 68px;
  padding: 5px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: transparent;
  display: grid;
  place-items: center;
}
.shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 24px rgba(184,237,97,.55);
  transition: .2s;
}
.shutter:hover span { background: var(--lime); transform: scale(.92); }

.today-aside {
  padding: 28px 8px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.today-aside .section-kicker { color: var(--lime); }
.today-aside h2 { font-size: 32px; margin-bottom: 12px; }
.today-aside > p:not(.section-kicker):not(.plan-note) {
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
  margin: 0 0 18px;
}
.plan-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }

.scan-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 112px;
  gap: 20px;
  align-items: center;
  justify-content: center;
}
.scanner-stage .camera-stage {
  max-height: min(68vh, 720px);
}
.capture-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.capture-controls .shutter {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: 86px;
  height: 86px;
  border-width: 4px;
}
.gallery-button,
.demo-button,
.scale-button {
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  padding: 6px 4px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #121712;
  color: #fff;
  box-sizing: border-box;
  overflow: visible; /* never clip "Demo" / "Add pic" */
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.gallery-button svg,
.demo-button svg,
.scale-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: var(--lime);
  stroke: none;
}
.gallery-button span,
.demo-button span,
.scale-button span {
  display: block;
  width: 100%;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  color: #fff;
}
.demo-button { color: #fff; } /* was text-only 11px in 52px box → "De" */
.scale-button.active { border-color: var(--lime); background: var(--lime-soft); }
.scale-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #121712;
  font-size: 13px;
}
.scale-bar[hidden] { display: none; }
.scale-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.scale-dot.on { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.scale-status { color: var(--muted); }
.scale-weight { color: var(--text); font-size: 17px; }
.scale-bar .text-button { min-height: 0; padding: 6px 10px; font-size: 12px; }
.scale-manual { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-left: auto; }
.scale-manual input {
  width: 72px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c0f0c;
  color: var(--text);
  font-size: 16px;
}
.camera-hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0 0;
}
#mealPreview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.camera-empty {
  max-width: 390px;
  padding: 40px;
  text-align: center;
  position: relative;
  z-index: 2;
  color: var(--text);
  margin: auto;
}
.camera-frame {
  position: relative;
}

.trust-strip { margin: 18px 0 52px; padding: 17px 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-2); }
.trust-strip div { display: flex; align-items: center; gap: 11px; }
.trust-icon { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: rgba(184,237,97,.12); color: var(--lime); font-size: 11px; font-weight: 900; }
.trust-strip p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.trust-strip strong { display: block; color: var(--text); font-size: 12px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; }
.panel { padding: 25px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.meal-list { display: grid; gap: 10px; margin-top: 21px; }
.meal-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto auto; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.meal-row:last-child { border-bottom: 0; }
.meal-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--lime-soft); color: var(--lime); font-size: 17px; font-weight: 900; }
.meal-main { min-width: 0; }
.meal-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.meal-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.meal-macros { color: var(--muted); font-size: 11px; text-align: right; }
.meal-macros strong { display: block; color: var(--text); font: 800 17px/1 ui-sans-serif, system-ui, sans-serif; }
.delete-meal { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--paper); color: var(--muted); font-size: 17px; }
.empty-block { padding: 37px 12px 16px; text-align: center; }
.empty-block[hidden] { display: none; }
.empty-block p { max-width: 380px; margin: 0 auto 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.empty-plate { width: 64px; height: 64px; margin: 0 auto 17px; display: block; border: 10px solid var(--paper-2); border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); }
.training-card { background: var(--ink-2); }
.day-chip { padding: 6px 9px; border-radius: 8px; background: rgba(184,237,97,.14); color: var(--lime); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.next-routine { margin-top: 28px; }
.next-routine > span { display: block; color: var(--muted); font-size: 11px; }
.next-routine > strong { display: block; margin: 5px 0 17px; font: 800 30px/1 ui-sans-serif, system-ui, sans-serif; }
.exercise-preview { display: grid; gap: 8px; margin-bottom: 21px; }
.exercise-preview span { padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.08); font-size: 11px; }
.next-routine button { width: 100%; }
.medical-note { margin: 26px auto 0; max-width: 780px; color: var(--muted); font-size: 11px; text-align: center; line-height: 1.5; }

.page-head { margin-bottom: 34px; }
.page-head > p:last-child { max-width: 680px; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.page-head h1 { font-size: clamp(42px, 6vw, 62px); }
.scanner-stage { max-width: 850px; margin: 0 auto; }
.camera-plate { display: grid; place-items: center; }
.camera-empty p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.aperture { width: 86px; height: 86px; margin: 0 auto 24px; display: block; border: 10px solid var(--ink); border-radius: 50%; box-shadow: inset 0 0 0 12px var(--lime), inset 0 0 0 22px var(--ink); }
.analyze-button { width: 100%; min-height: 56px; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: var(--ink); background: var(--lime); font-size: 15px; }
/* P0: display:flex above overrides the UA [hidden] rule — Analyze must stay hidden on empty/demo Snap. */
.analyze-button[hidden] { display: none !important; }
/* Analyze CTA pinned ON the plate (visible after Add pic / shutter) */
.camera-plate .analyze-on-plate {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  z-index: 6;
  width: auto;
  margin: 0;
  min-height: 54px;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
}
@media (max-width: 640px) {
  /* Sit above the floating capture-controls row inside the full-bleed plate.
     deploy-73: the row is ~100px tall (80px shutter); 118px buried the CTA
     underneath the buttons. */
  .scan-view .camera-plate .analyze-on-plate {
    bottom: calc(196px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 16px;
    z-index: 7;
  }
  /* deploy-73: Snap never scrolls on the phone. */
  body.on-scan { overflow: hidden; }
  body.on-scan .scan-view { overflow: hidden; }
}
/* Snap demo plate: rights-clean photo fills the viewfinder by default. */
.demo-plate-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.demo-plate-tag {
  position: absolute; z-index: 3;
  left: 14px; bottom: 14px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: rgba(7, 8, 7, .62);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 6px 11px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.analyze-button svg { width: 20px; }
.scanner-explainer { margin: 56px auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.scanner-explainer article { padding: 20px; display: flex; gap: 13px; border-top: 1px solid var(--line); }
.scanner-explainer article > span { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--lime); font-size: 11px; font-weight: 900; }
.scanner-explainer p { color: var(--muted); font-size: 11px; line-height: 1.5; }

.training-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 30px; }
.training-summary article { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-2); }
.training-summary span, .training-summary small { display: block; color: var(--muted); font-size: 11px; }
.training-summary strong { display: inline-block; margin: 8px 5px 0 0; font: 800 35px/1 ui-sans-serif, system-ui, sans-serif; }
.routine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.routine-card { min-height: 320px; padding: 23px; padding-bottom: 28px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-sizing: border-box; max-width: 100%; }
.routine-card:nth-child(2) { background: #141a16; }
.routine-card:nth-child(3) { background: #1a1612; }
.routine-number { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--ink); color: var(--lime); font-size: 11px; font-weight: 900; }
.routine-card h2 { margin: 35px 0 9px; font-size: 29px; }
.routine-meta { color: var(--muted); font-size: 11px; }
.routine-exercises { margin: 20px 0; padding: 0; list-style: none; color: var(--muted); font-size: 11px; line-height: 1.9; }
/* old bottom-button rule removed — Start is now a circular button in the title row */

.progress-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 18px; }
.trend-panel { min-height: 330px; }
.trend-panel .panel-head > strong { font: 800 35px/1 ui-sans-serif, system-ui, sans-serif; }
.week-chart { height: 220px; margin-top: 28px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 11px; }
.day-bar { height: 100%; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 8px; }
.day-bar .bar { width: min(42px, 80%); min-height: 4px; border-radius: 9px 9px 3px 3px; background: var(--lime); border: 1px solid rgba(25,35,30,.1); }
.day-bar.over .bar { background: var(--orange); }
.day-bar.empty .bar { background: var(--paper-2); }
.day-bar span { color: var(--muted); font-size: 11px; font-weight: 750; }
.insight-card { color: white; background: var(--ink); border-color: var(--ink); }
.insight-card .section-kicker { color: var(--lime); }
.insight-card h2 { color: white; font-size: 29px; margin: 34px 0 14px; }
.insight-card > p:last-child { color: rgba(255,255,255,.57); font-size: 12px; line-height: 1.55; }
.insight-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--lime); color: var(--ink); font-size: 21px; font-weight: 900; }
.history-panel { grid-column: 1 / -1; }
.activity-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border: 0; }
.activity-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--paper); font-weight: 900; }
.activity-item p { margin: 0; font-size: 13px; }
.activity-item small { display: block; margin-top: 4px; color: var(--muted); }
.activity-item > strong { font: 800 16px/1 ui-sans-serif, system-ui, sans-serif; }

.day-total-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.day-total-row:last-child { border: 0; }
.day-total-row > div:first-child strong { display: block; font-size: 14px; }
.day-total-row > div:first-child span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.day-total-row.hit > div:first-child strong { color: var(--lime); }
.day-total-macros { text-align: right; }
.day-total-macros strong { display: block; font: 800 16px/1 ui-sans-serif, system-ui, sans-serif; }
.day-total-macros span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

.idea-summary { margin-bottom: 22px; padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: var(--radius-md); background: var(--ink); color: white; }
.idea-summary p { margin: 0; color: rgba(255,255,255,.56); font-size: 11px; }
.idea-summary strong { color: var(--lime); font: 800 21px/1 ui-sans-serif, system-ui, sans-serif; }
.idea-filters { margin-bottom: 17px; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.idea-filters::-webkit-scrollbar { display: none; }
.idea-filters button { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.idea-filters button.active { border-color: var(--lime); background: var(--lime); color: var(--ink); }
.recipe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.recipe-card { min-height: 330px; padding: 21px; display: flex; flex-direction: column; border-radius: 23px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; position: relative; }
.recipe-card:nth-child(3n + 1) { background: #141a16; }
.recipe-card:nth-child(3n + 2) { background: #1a1612; }
.recipe-visual { height: 105px; margin: -21px -21px 20px; display: flex; align-items: end; gap: 8px; padding: 18px 21px; background: var(--ink); overflow: hidden; position: relative; }
.recipe-visual.has-photo { height: 170px; background-position: center; background-size: cover; }
.recipe-visual.has-photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(13,21,17,.25), transparent 55%); }
.recipe-visual::after { content: ""; position: absolute; right: -28px; top: -35px; width: 120px; height: 120px; border-radius: 50%; border: 24px solid rgba(184,237,97,.12); }
.recipe-visual.has-photo::after { display: none; }
.ingredient-shape { width: 36px; height: 36px; border-radius: 50%; background: var(--lime); position: relative; z-index: 1; }
.ingredient-shape:nth-child(2) { width: 46px; height: 24px; border-radius: 14px; background: var(--orange); }
.ingredient-shape:nth-child(3) { width: 28px; height: 43px; border-radius: 10px; background: var(--surface); }
.recipe-tags { display: flex; gap: 5px; margin-bottom: 12px; }
.recipe-tags span { padding: 5px 7px; border-radius: 7px; background: rgba(255,255,255,.08); color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.recipe-card h2 { font-size: 25px; margin-bottom: 9px; }
.recipe-card > p { color: var(--muted); font-size: 11px; line-height: 1.45; }
.recipe-macros { margin-top: auto; padding-top: 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; border-top: 1px solid rgba(25,35,30,.11); }
.recipe-macros span { color: var(--muted); font-size: 11px; }
.recipe-macros strong { display: block; margin-top: 2px; color: var(--text); font-size: 13px; }

.bottom-nav { display: none; }
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); box-shadow: 0 35px 110px rgba(15,24,19,.3); }
dialog::backdrop { background: rgba(14,22,17,.58); backdrop-filter: blur(4px); }
.result-dialog, .workout-dialog, .goals-dialog, .correction-dialog, .premium-dialog { width: min(720px, calc(100% - 28px)); max-height: 90dvh; border-radius: 28px; }
.result-shell, .goals-dialog form, .correction-dialog form { padding: 26px; }
.dialog-head { margin-bottom: 23px; }
.dialog-head h2 { font-size: 29px; }
.close-button { width: 39px; height: 39px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--paper-2); color: var(--text); font-size: 24px; }
.estimate-warning { padding: 12px 14px; border-left: 3px solid var(--orange); background: rgba(239,138,82,.12); color: #efc2a4; font-size: 11px; line-height: 1.5; }
.estimate-warning span { margin-right: 7px; color: var(--orange); font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.meal-type-label { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 18px 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.meal-type-label select { height: 39px; padding: 0 32px 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--ink-2); color: var(--text); font-weight: 750; }
.recognized-list { display: grid; gap: 9px; max-height: 42dvh; overflow: auto; padding-right: 3px; }
.food-result { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: start; gap: 10px 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; }
.food-result.low-confidence { border-color: rgba(239,138,82,.55); background: rgba(239,138,82,.08); }
.food-result.mid-confidence { border-color: rgba(185,139,65,.45); background: rgba(185,139,65,.08); }
/* Pulse-highlight for the Adjust button jump-to-lowest-confidence. */
@keyframes pulseHighlight { 0%,100% { box-shadow: 0 0 0 0 rgba(239,138,82,.0); } 50% { box-shadow: 0 0 0 4px rgba(239,138,82,.45); } }
.food-result.pulse-highlight { animation: pulseHighlight 0.8s ease-in-out 3; }
.food-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--lime-soft); color: var(--lime); font-weight: 900; }
.food-copy { min-width: 0; }
.food-copy strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food-copy > span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.confidence-note { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
/* deploy-79: per-item macros so the estimated total is checkable at a glance. */
.food-item-macros { margin: 6px 0 0; color: var(--text); font-size: 12px; font-weight: 700; }
.low-confidence .confidence-note { color: #efc2a4; }
.mid-confidence .confidence-note { color: #e2c48a; }
.confidence { padding: 5px 7px; border-radius: 7px; background: rgba(184,237,97,.16); color: var(--lime); font-size: 11px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.low-confidence .confidence { color: var(--orange); background: rgba(239,138,82,.16); }
.mid-confidence .confidence { color: #e2c48a; background: rgba(185,139,65,.16); }
.food-portion { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portion-stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--ink-2); }
.portion-stepper button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--paper-2); color: var(--text); font-size: 16px; font-weight: 800; }
.portion-grams-label { position: relative; display: inline-flex; align-items: center; }
.portion-grams-label input { width: 64px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: center; font-weight: 800; font-size: 16px; }
.portion-grams-label span { position: absolute; right: 6px; color: var(--muted); font-size: 11px; pointer-events: none; }
.portion-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.portion-chip { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink-2); color: var(--muted); font-size: 11px; font-weight: 800; }
.portion-chip.active { border-color: rgba(184,237,97,.45); background: var(--lime-soft); color: var(--lime); }
.meal-review-hint { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.scale-tip { margin: 8px 0 0; padding: 9px 12px; border-radius: 10px; background: rgba(184,237,97,.08); border: 1px solid rgba(184,237,97,.22); color: var(--text); font-size: 11px; line-height: 1.5; font-weight: 600; }
.correct-food { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink-2); color: var(--lime); font-size: 11px; font-weight: 900; }
.remove-food { width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--paper); color: var(--muted); }
.result-total { margin-top: 17px; padding: 17px; display: flex; align-items: center; justify-content: space-between; border-radius: 15px; background: var(--ink); color: white; }
.result-total span { color: rgba(255,255,255,.53); font-size: 11px; }
.result-total strong { display: block; margin-top: 4px; font: 800 25px/1 ui-sans-serif, system-ui, sans-serif; }
.result-macros { display: flex; gap: 7px; flex-wrap: wrap; }
.result-macros span { padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,.08); color: white; font-weight: 750; }
.dialog-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.workout-estimate { margin-bottom: 14px; padding: 14px 16px; border-radius: 17px; background: var(--ink); color: white; }
.workout-estimate[hidden] { display: none; }
.workout-estimate .estimate-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.workout-estimate label { position: relative; display: grid; gap: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.65); }
.workout-estimate label span { position: absolute; right: 11px; bottom: 14px; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.workout-estimate input, .workout-estimate select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper-2); color: var(--text); font-size: 16px; }
.workout-estimate .form-note { margin: 8px 0 0; color: rgba(255,255,255,.45); font-size: 11px; }
.load-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.load-row label { position: relative; display: grid; gap: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.load-row label span { position: absolute; right: 11px; bottom: 14px; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.load-row input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper-2); color: var(--text); font-size: 16px; }
.workout-progress { margin-bottom: 14px; }
.workout-progress-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.workout-progress-bar span { display: block; height: 100%; background: var(--lime); border-radius: inherit; }
.workout-progress p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.workout-progress strong { color: var(--text); }
.current-exercise { margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--ink-2); }
.current-exercise > strong { display: block; margin: 4px 0 6px; font-size: 22px; letter-spacing: -.03em; }
.current-exercise > span { color: var(--muted); font-size: 12px; }
.set-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.set-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--muted); font-size: 11px; font-weight: 800; }
.set-chip input { width: 16px; height: 16px; accent-color: var(--lime); }
.set-chip.done { border-color: rgba(184,237,97,.45); background: var(--lime-soft); color: var(--lime); }
.workout-nav { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.rest-bar { margin-bottom: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 12px; background: rgba(184,237,97,.12); color: var(--lime); font-size: 12px; font-weight: 800; }
.rest-bar[hidden] { display: none; }
.exercise-list { display: grid; gap: 8px; max-height: 28dvh; overflow: auto; }
.exercise-row { width: 100%; text-align: left; padding: 12px; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; background: transparent; color: inherit; }
.exercise-row.active { border-color: rgba(184,237,97,.4); background: rgba(184,237,97,.08); }
.exercise-row.complete { opacity: .72; }
.exercise-row.partial .exercise-index { background: rgba(185,139,65,.25); color: #e2c48a; }
.exercise-row.complete .exercise-index { background: var(--lime-soft); color: var(--lime); }
.exercise-index { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--paper-2); color: var(--muted); font-size: 11px; font-weight: 900; }
.exercise-row strong { font-size: 13px; }
.exercise-row span { color: var(--muted); font-size: 11px; }
.workout-actions { margin-top: 16px; }
.discard-session { display: block; width: 100%; margin-top: 10px; text-align: center; color: var(--muted); }
.train-resume { margin-bottom: 16px; }
.resume-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 1px solid rgba(184,237,97,.35); border-radius: 16px; background: rgba(184,237,97,.08); }
.resume-card strong { display: block; margin: 4px 0; font-size: 18px; }
.resume-card span { color: var(--muted); font-size: 11px; }
.resume-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.recent-workouts-panel { margin-top: 18px; }
.train-honesty, .train-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
.recent-workout { padding: 12px 0; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); }
.recent-workout:last-child { border-bottom: 0; }
.recent-workout strong { font-size: 14px; }
.recent-workout span { color: var(--muted); font-size: 11px; }
.goal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.goal-fields label { position: relative; color: var(--muted); font-size: 11px; font-weight: 800; }
.goal-fields input { width: 100%; height: 48px; margin-top: 7px; padding: 0 58px 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--ink-2); color: var(--text); font-weight: 750; }
.goal-fields label.wide { grid-column: 1 / -1; }
.goal-fields label span { position: absolute; right: 11px; bottom: 16px; color: var(--muted); font-size: 11px; }
.goal-fields select { width: 100%; height: 48px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--ink-2); color: var(--text); font-weight: 750; }
.form-note { margin: 17px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.correction-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.correction-grid label { position: relative; color: var(--muted); font-size: 11px; font-weight: 800; }
.correction-grid label.wide { grid-column: 1 / -1; }
.correction-grid input { width: 100%; height: 48px; margin-top: 7px; padding: 0 55px 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--ink-2); color: var(--text); font-weight: 750; }
.correction-grid label.wide input { padding-right: 12px; }
.correction-grid label span { position: absolute; right: 11px; bottom: 16px; color: var(--muted); font-size: 11px; }
.learning-consent { margin-top: 17px; padding: 13px; display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; background: var(--lime-soft); color: var(--text); font-size: 11px; line-height: 1.45; }
.learning-consent input { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--ink); }
.status-dialog, .install-dialog { width: min(450px, calc(100% - 28px)); border-radius: 24px; }
.status-content, .install-dialog > div { padding: 24px; }
.service-list { display: grid; gap: 9px; margin-bottom: 17px; }
.service-row { padding: 12px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; }
.service-row span { color: var(--muted); font-size: 11px; }
.status-content > p, .install-dialog ol { color: var(--muted); font-size: 11px; line-height: 1.6; }
.install-dialog ol { padding-left: 20px; margin-bottom: 21px; }

.analyzing-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; color: white; background: rgba(7,8,7,.66); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.analyzing-overlay[hidden] { display: none; }
.analyzing-card { width: min(320px, 100%); padding: 28px 24px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; border: 1px solid rgba(184,237,97,.25); border-radius: 24px; background: #0d100d; box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 44px rgba(184,237,97,.12); animation: card-in .26s var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.analysis-orbit { width: 64px; height: 64px; margin-bottom: 18px; border: 2px solid rgba(255,255,255,.13); border-radius: 50%; position: relative; animation: rotate 1.2s linear infinite; }
.analysis-orbit span { position: absolute; inset: 15px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 22px rgba(184,237,97,.6); }
.analysis-orbit i { position: absolute; top: -4px; left: 27px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-2); }
@keyframes rotate { to { transform: rotate(360deg); } }
.analyzing-card h2 { color: white; font-size: 19px; margin: 0 0 6px; }
.analyzing-card p { margin: 0; color: rgba(255,255,255,.55); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 110; transform: translate(-50%, 18px); padding: 12px 16px; border-radius: 11px; background: var(--ink); color: white; font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 880px) {
  .today-grid, .content-grid, .progress-grid { grid-template-columns: 1fr; }
  .trust-strip, .scanner-explainer, .routine-grid, .recipe-grid { grid-template-columns: 1fr; }
  .trust-strip { gap: 10px; }
  .scan-layout { grid-template-columns: 1fr; }
  .capture-controls { flex-direction: row; justify-content: center; margin-top: 16px; }
  .capture-controls .shutter { width: 78px; height: 78px; }
  .history-panel { grid-column: auto; }
  .routine-card { min-height: 280px; }
}

@media (max-width: 640px) {
  .topbar { height: calc(62px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 15px 0; }
  .status-button { width: 35px; padding: 0; justify-content: center; }
  .status-button #statusLabel { display: none; }
  main { width: 100%; padding: 12px 16px calc(112px + var(--safe-bottom)); }
  h1 { font-size: 28px; letter-spacing: -1.2px; }
  #todayView .welcome { margin-bottom: 4px; }
  #todayView .welcome h1 { font-size: 24px; margin-bottom: 0; }
  #todayView .welcome .kicker { margin-bottom: 4px; }
  .welcome { align-items: flex-start; }
  .install-button { min-height: 40px; padding: 0 12px; font-size: 11px; }
  .page-head { margin-bottom: 20px; }
  .page-head > p:last-child { font-size: 14px; }
  .today-grid { margin-top: 8px; }
  .today-aside { display: none; }
  .camera-stage {
    aspect-ratio: 3 / 4;
    max-height: calc(100dvh - 196px);
    border-radius: 28px;
  }
  .kcal-block strong { font-size: 48px; }
  .stage-scoreboard { left: 12px; right: 12px; bottom: 84px; }
  .stage-scoreboard .macro-grid { grid-template-columns: repeat(4, 1fr); }
  .camera-copy { display: none; }
  .focus-corners { inset: 16% 10% 40%; }
  .trust-strip { margin: 16px 0 32px; padding: 14px; }
  .panel { padding: 20px; }
  .panel-head h2 { font-size: 23px; }
  .medical-note { padding: 0 12px; }
  .camera-empty { padding: 24px; }
  .training-summary { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .training-summary article { padding: 13px 10px; }
  .training-summary strong { font-size: 28px; }
  .training-summary small { font-size: 11px; }
  .week-chart { gap: 6px; }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(76px + var(--safe-bottom)); padding: 8px 8px var(--safe-bottom); display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; background: rgba(10,12,10,.88); border-top: 1px solid var(--line); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); }
  .bottom-nav button { border: 0; background: transparent; color: var(--muted); min-height: 56px; margin: 0; padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: .01em; border-radius: 16px; transition: background-color .22s var(--ease), color .22s var(--ease), scale .18s var(--ease); }
  .bottom-nav button.active { background: var(--lime-soft); color: var(--lime); }
  .bottom-nav button:not(.active):active { background: rgba(255,255,255,.06); }
  .bottom-nav svg { width: 23px; height: 23px; }
  /* deploy-21: Capacitor / WKWebView — hide nav with CSS :has (iOS 15.4+).
     JS body.sheet-open is belt-and-suspenders ONLY. Do NOT rely on JS alone. */
  body:has(dialog[open]) .bottom-nav,
  html:has(dialog[open]) .bottom-nav,
  body.sheet-open .bottom-nav,
  html.sheet-open .bottom-nav {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    height: 0 !important;
    overflow: hidden !important;
    z-index: -1 !important;
  }
  /* deploy-20: keep the workout sheet's action buttons clear of the home indicator. */
  .workout-actions { padding-bottom: calc(12px + var(--safe-bottom)); }
  .nav-camera { width: 52px; height: 52px; margin-top: -26px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--ink); border: 4px solid #0b0d0b; box-shadow: 0 10px 26px rgba(184,237,97,.35); }
  .nav-camera svg { width: 24px; height: 24px; }
  .scan-nav > span:last-child { margin-top: 2px; }
  .result-dialog::before, .workout-dialog::before, .goals-dialog::before, .correction-dialog::before, .premium-dialog::before, .log-workout-dialog::before, .onboarding-dialog::before {
    content: ""; display: block; width: 40px; height: 4px; margin: 10px auto 0; border-radius: 99px; background: rgba(255,255,255,.22); flex: none;
  }
  .result-dialog, .workout-dialog, .goals-dialog, .correction-dialog, .premium-dialog, .log-workout-dialog { width: 100%; max-height: 93dvh; margin: auto 0 0; border-radius: 25px 25px 0 0; }
  /* Sheet stability: never depend on UA dialog auto-margin centering.
     Explicit fixed anchoring keeps every sheet flush at 390px even when
     the layout viewport disagrees with the visual viewport (iOS). */
  dialog {
    position: fixed;
    left: 0; right: 0;
    margin: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .result-dialog, .workout-dialog, .goals-dialog, .correction-dialog,
  .premium-dialog, .log-workout-dialog, .onboarding-dialog, .profile-dialog,
  .recipe-dialog {
    top: auto; bottom: 0;
    max-height: 93dvh;
    border-radius: 25px 25px 0 0;
  }
  .status-dialog, .install-dialog {
    top: 50%; bottom: auto;
    transform: translateY(-50%);
    width: min(450px, calc(100% - 28px));
    margin: 0 auto;
    border-radius: 24px;
    max-height: 90dvh;
  }
  /* Grid/flex children must never force a track wider than the viewport. */
  .dialog-head > div, .load-row > label, .estimate-row > label,
  .macro-day, .day-bar, .streak-big > div, .macro-cell, .score-tile { min-width: 0; }
  .result-shell, .goals-dialog form, .correction-dialog form, .log-workout-dialog form { padding: 21px 17px calc(20px + var(--safe-bottom)); }
  .recognized-list { max-height: 47dvh; }
  .food-result { grid-template-columns: 38px minmax(0,1fr) auto; gap: 9px; }
  .food-icon { width: 38px; height: 38px; }
  .food-portion { grid-column: 1 / -1; }
  .workout-nav { grid-template-columns: 1fr; }
  .resume-card { flex-direction: column; align-items: stretch; }
  .goal-fields { grid-template-columns: 1fr; }
  .energy-grid { gap: 8px; }
  .energy-col { padding: 12px 10px; }
  .energy-col strong { font-size: 24px; }
  .steps-field input { width: 130px; }
  .correction-grid { grid-template-columns: 1fr; max-height: 55dvh; overflow: auto; padding: 2px; }
  .correction-grid label.wide { grid-column: auto; }
  .dialog-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 13px; }
  .goals-sticky { margin: 18px -17px calc(-20px - var(--safe-bottom)); padding: 12px 17px calc(12px + var(--safe-bottom)); }
  .toast { bottom: calc(84px + var(--safe-bottom)); width: max-content; max-width: calc(100% - 28px); text-align: center; }
}

@media (max-width: 390px) {
  .kcal-block strong { font-size: 40px; }
  .macro-cell { padding: 8px 6px; }
  .macro-cell strong { font-size: 13px; }
  .training-summary { grid-template-columns: 1fr; }
  .training-summary article { display: flex; align-items: baseline; gap: 6px; }
  .training-summary strong { margin-left: auto; }
}


/* Store compliance + premium + offline banner */
.scanner-offline-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 10px;
  padding: 10px 8px 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(199,91,80,.35);
  background: rgba(199,91,80,.12);
  color: #f4d6d2;
  font-size: 12px;
  line-height: 1.35;
}
.scanner-offline-banner[hidden] { display: none !important; }
.scanner-offline-banner strong { color: #fff; font-weight: 800; white-space: nowrap; }
.scanner-offline-banner .banner-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scanner-offline-banner .text-button { color: var(--lime); font-weight: 800; border: 0; background: transparent; cursor: pointer; flex: none; }
.banner-dismiss { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: #f4d6d2; font-size: 18px; line-height: 1; opacity: .8; }
.account-premium, .account-data-panel {
  margin: 0 0 18px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(22,28,24,.04);
}
.account-actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.account-actions-row .outline-button,
.account-actions-row .dark-button { flex: 1 1 140px; }
.tech-details { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.03); }
.tech-details summary { padding: 10px 12px; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 800; list-style: none; }
.tech-details summary::-webkit-details-marker { display: none; }
.tech-details summary::before { content: "+"; display: inline-block; margin-right: 8px; color: var(--lime); font-weight: 900; }
.tech-details[open] summary::before { content: "–"; }
.tech-details .form-note { margin: 0; padding: 0 12px 12px; }
.goals-sticky { position: sticky; bottom: 0; z-index: 2; margin: 18px -26px -26px; padding: 12px 26px calc(12px + var(--safe-bottom)); background: linear-gradient(to top, var(--surface) 78%, transparent); }
.goals-sticky .dark-button { min-height: 52px; font-size: 16px; }
.danger-button { border-color: rgba(199,91,80,.45) !important; color: #b14a3f !important; }
.legal-inline { margin: 14px 0 0; font-size: 11px; color: var(--muted); }
.legal-inline a { color: inherit; font-weight: 750; }
.medical-note a { color: inherit; font-weight: 750; }
.premium-dialog { width: min(520px, calc(100% - 28px)); border-radius: 28px; border: 0; padding: 0; }
.premium-perks { margin: 8px 0 0; padding-left: 1.2em; color: var(--muted); font-size: 13px; line-height: 1.55; }
.premium-perks li { margin: 6px 0; }
code { font-size: .92em; }

@media (max-width: 860px) {
  .scanner-offline-banner { margin: 0 12px 8px; }
  .premium-dialog { width: 100%; max-height: 93dvh; margin: auto 0 0; border-radius: 25px 25px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .macro-cell.goal-hit::before, .kcal-block.goal-hit::before {
    animation: none !important;
  }
}


/* First-run onboarding + train empty */
.onboarding-dialog {
  width: min(560px, calc(100% - 28px));
  max-width: calc(100vw - 28px);
  max-height: 92dvh;
  border: 0;
  border-radius: 28px;
  padding: 0;
  overflow-x: clip;
}
.onboarding-dialog .dialog-head > div { min-width: 0; }
.onboarding-dialog h2 { overflow-wrap: break-word; }
.onboarding-points li { overflow-wrap: break-word; }
.onboarding-dialog form {
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px calc(20px + var(--safe-bottom));
}
.onboarding-points {
  margin: 0 0 16px;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.onboarding-points li { margin: 8px 0; }
.onboarding-points strong { color: #fff; }
.onboarding-goals { margin-bottom: 8px; }
.onboarding-actions { margin-top: 14px; }
.train-empty {
  margin: 0 0 14px;
  padding: 22px 12px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(22,28,24,.03);
}
.train-empty[hidden] { display: none !important; }
.train-empty h3 { margin: 0 0 6px; font-size: 15px; }
.install-dialog ol { margin: 0 0 16px; padding-left: 1.2em; color: var(--muted); font-size: 13px; line-height: 1.55; }
.install-dialog li { margin: 6px 0; }

@media (max-width: 860px) {
  .onboarding-dialog {
    width: 100%;
    max-height: 94dvh;
    margin: auto 0 0;
    border-radius: 25px 25px 0 0;
  }
}

/* Energy balance */
.energy-panel { position: relative; overflow: hidden; margin-top: 26px; }
.energy-panel::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--lime), var(--orange)); }
.net-chip { padding: 7px 13px; border-radius: 999px; font-size: 12px; font-weight: 900; background: rgba(255,255,255,.06); color: var(--muted); white-space: nowrap; }
.net-chip.deficit { background: var(--lime-soft); color: var(--lime); box-shadow: var(--glow); }
.net-chip.surplus { background: rgba(239,138,82,.16); color: var(--orange); }
.energy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.energy-col { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.04); }
.energy-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.energy-col strong { display: block; font-size: clamp(27px, 4.5vw, 40px); font-weight: 900; letter-spacing: -1px; }
.energy-col small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.55; overflow-wrap: break-word; }
.energy-col.in strong { color: var(--lime); }
.energy-col.out strong { color: var(--orange); }
.energy-col.net strong.deficit { color: var(--lime); text-shadow: 0 0 26px rgba(184,237,97,.35); }
.energy-col.net strong.surplus { color: var(--orange); text-shadow: 0 0 26px rgba(239,138,82,.35); }
.steps-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.steps-field { color: var(--muted); font-size: 11px; font-weight: 800; }
.steps-field input { display: block; width: 150px; height: 45px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--ink-2); color: var(--text); font-weight: 750; }
.profile-nudge { margin: 14px 0 0; }
.text-button.linklike { display: inline; min-height: 0; padding: 0; }

/* About-you profile blocks */
.profile-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.profile-block .section-kicker { margin-bottom: 12px; }
.optional-tag { display: inline-block; margin-left: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.profile-block .account-actions-row { margin-top: 14px; }
#bmrNote, #onboardBmrNote { margin-top: 10px; }
.onboarding-profile { margin-top: 18px; }

/* Quick-log workout dialog */
.log-workout-dialog { width: min(480px, calc(100% - 28px)); border-radius: 24px; }
.log-workout-dialog form { padding: 24px; }

/* ---- Clarity + immersion pass ---- */

/* Scan step indicator: Snap → Analyzing → Review → Log */
.scan-steps {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 560px;
}
.scan-steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.scan-steps li span {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  font-size: 11px;
  font-weight: 900;
}
.scan-steps li.active {
  background: var(--lime-soft);
  border-color: rgba(184,237,97,.5);
  color: var(--lime);
}
.scan-steps li.active span { background: var(--lime); color: var(--ink); }
.scan-steps li.done { color: var(--text); }
.scan-steps li.done span { background: rgba(184,237,97,.25); color: var(--lime); }

/* Today coach line: human words under the title */
.today-coach {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.today-coach strong { color: var(--lime); font-weight: 900; }

/* Plain-English result headline */
.result-headline {
  margin: -8px 0 14px;
  font: 800 34px/1.05 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -.03em;
  color: var(--text);
}
.result-headline .hl-kcal { color: var(--lime); }
.result-headline .hl-protein { color: #fff; }
.result-headline .hl-sep { color: rgba(255,255,255,.4); font-weight: 700; }
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.result-actions .log-it-button {
  flex: 1 1 140px;
  min-height: 52px;
  font-size: 16px;
  letter-spacing: .01em;
}
.result-actions #adjustMealButton {
  flex: 0 0 auto;
  opacity: .92;
}
@media (max-width: 640px) {
  .result-headline { font-size: 30px; }
  .result-actions .log-it-button { flex: 1 1 100%; order: 3; }
  .result-actions #adjustMealButton { order: 1; }
  .result-actions #rescanButton { order: 2; }
}

/* Scan is the main verb: attention pulse on the orb until first meal */
.scan-nav.attention .nav-camera { position: relative; }
.scan-nav.attention .nav-camera::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--lime);
  animation: orb-ring 2.2s var(--ease) infinite;
  pointer-events: none;
}
@keyframes orb-ring {
  0% { transform: scale(.92); opacity: .9; }
  70% { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1.22); opacity: 0; }
}

/* Cinematic analyzing */
.analyzing-step-tag {
  margin: 0 0 10px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.analyzing-progress {
  width: 100%;
  height: 5px;
  margin-top: 18px;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
  overflow: hidden;
}
.analyzing-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lime), var(--lime-2));
  box-shadow: 0 0 14px rgba(184,237,97,.6);
}
.analyzing-overlay:not([hidden]) .analyzing-progress i {
  animation: analyze-fill 3.4s var(--ease) forwards;
}
@keyframes analyze-fill {
  0% { width: 4%; }
  55% { width: 68%; }
  100% { width: 94%; }
}
.analyzing-overlay:not([hidden]) .analyzing-card {
  animation: card-in .3s var(--ease), card-breathe 2.6s ease-in-out .3s infinite;
}
@keyframes card-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

/* Result sheet slides up */
.result-dialog[open] .result-shell { animation: sheet-up .32s var(--ease); }
@keyframes sheet-up {
  from { transform: translateY(56px); opacity: .5; }
  to { transform: none; opacity: 1; }
}
.result-dialog[open]::backdrop { animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Celebration on log */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7,8,7,.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.celebrate-overlay[hidden] { display: none; }
.celebrate-card {
  position: relative;
  text-align: center;
  padding: 34px 44px;
  animation: celebrate-pop .45s cubic-bezier(.2,1.4,.3,1) both;
}
.celebrate-check {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  box-shadow: 0 0 60px rgba(184,237,97,.55);
}
.celebrate-ring {
  position: absolute;
  left: 50%;
  top: 76px;
  width: 84px;
  height: 84px;
  margin-left: -42px;
  border-radius: 50%;
  border: 3px solid var(--lime);
  animation: celebrate-ring 1s var(--ease) both;
  pointer-events: none;
}
@keyframes celebrate-ring {
  from { transform: scale(.7); opacity: .9; }
  to { transform: scale(1.9); opacity: 0; }
}
@keyframes celebrate-pop {
  from { transform: scale(.62); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.celebrate-card h2 { color: #fff; font-size: 26px; margin-bottom: 6px; }
.celebrate-card p { margin: 0; color: var(--lime); font-size: 16px; font-weight: 800; }
/* Big goal-hit celebration: scaled-up card + confetti burst. */
.celebrate-card.mega { animation: celebrate-mega .6s cubic-bezier(.2,1.4,.3,1) both; }
.celebrate-card.mega h2 { font-size: 32px; }
.celebrate-card.mega .celebrate-check {
  width: 104px; height: 104px; font-size: 48px;
  box-shadow: 0 0 90px rgba(184,237,97,.75);
}
@keyframes celebrate-mega {
  0% { transform: scale(.55) rotate(-3deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(1.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.confetti {
  position: absolute;
  top: -6px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall 1.6s cubic-bezier(.3,.4,.6,1) both;
  z-index: 1;
}
@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(340px) rotate(540deg); opacity: 0; }
}

/* Full-bleed camera-first Scan on phone */
@media (max-width: 640px) {
  .scan-view .page-head { margin-bottom: 14px; }
  .scan-view .page-head > p:last-child { display: none; }
  .scan-view .scanner-stage { max-width: none; }
  .scan-view .camera-stage {
    margin: 0 -16px;
    border-radius: 0;
    aspect-ratio: auto;
    height: min(62dvh, 540px);
    max-height: none;
  }
  .scan-view .camera-plate { border-radius: 0; border-left: 0; border-right: 0; }
  .scan-steps { margin: 0 0 12px; }
  .scan-steps li { padding: 7px 6px; font-size: 11px; justify-content: center; }
  .scan-steps li span { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-nav.attention .nav-camera::after,
  .analyzing-overlay:not([hidden]) .analyzing-progress i,
  .analyzing-overlay:not([hidden]) .analyzing-card,
  .celebrate-ring,
  .confetti,
  .celebrate-card { animation: none !important; }
}

/* ============================================================
   FADE v2 — clarity + fun scoreboard + weekly plan
   ============================================================ */

/* ---------- Home scoreboard (kept: avatar, identity, streak chip, snap CTA) ---------- */
.home-identity { flex: 1; min-width: 0; }
.home-identity h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.home-avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  border: 2px solid var(--lime); background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden; padding: 0; cursor: pointer;
  font-size: 20px; font-weight: 800; color: var(--lime);
}
.home-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--lime-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 13px; color: var(--text);
}
.streak-chip b { font-variant-numeric: tabular-nums; }
.streak-chip i { font-style: normal; }

.meals-panel { margin-top: 4px; }

/* ---------- Home = TikTok stage (v3) ---------- */
.home-stage {
  position: relative;
  margin: 0 -24px;
  min-height: 56dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 0 0 28px 28px;
  padding: 18px 20px 22px;
  isolation: isolate;
}
.home-stage-bg {
  position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(120% 90% at 50% 0%, #1c2b1a 0%, #0b0e0b 55%, #070807 100%);
  background-size: cover; background-position: center;
}
.home-stage-bg::after {
  content: ""; position: absolute; inset: 0;
  /* deploy-25: blur(22px) turned the hero into mush — crisp photo + gradient shade instead */
  background: linear-gradient(to top, rgba(7,8,7,.94) 8%, rgba(7,8,7,.55) 45%, rgba(7,8,7,.18) 75%, rgba(7,8,7,.32) 100%);
}
.home-stage-top { display: flex; align-items: center; gap: 10px; margin-bottom: auto; padding-top: 0; flex-wrap: wrap; }
/* deploy-75: tighten the greeting block so it covers less of the avatar face. */
.home-stage-top .kicker { margin: 0 0 2px; font-size: 10px; }
.home-stage-top .home-identity h1 { font-size: 26px; }
.home-stage-top .home-identity h1 { color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.home-stage-top .kicker { color: rgba(255,255,255,.72); }
/* deploy-35: LIVE + demo flags ride in their own group — never overlapping */
.home-stage-flags { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.stage-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 6px;
  width: 100%;
  align-items: start;
}
.stage-num {
  display: flex;
  flex-direction: column;
  align-items: center;   /* label + number + kcal share one centered column */
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  text-align: center;
}
.stage-num > span {
  display: block;
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  opacity: .95;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.stage-num > strong {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0 2px;
  font-size: clamp(28px, 7.2vw, 44px); /* fits 4 digits + optional + without bleed */
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1;
  color: #fff;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  overflow: visible;
  text-shadow: 0 2px 20px rgba(0,0,0,.55);
  filter: drop-shadow(0 4px 18px rgba(0,0,0,.55));
}
.stage-num > small {
  display: block;
  width: 100%;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.62);
  text-align: center; /* kcal centered UNDER the big number */
  line-height: 1.1;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.stage-num.burn > strong { color: #ffb37a; }
.stage-num.eaten > strong { color: var(--lime); }
.stage-num.net > strong.surplus { color: #ff9d6b; }
.stage-num.net > strong.deficit { color: var(--lime); }
@media (max-width: 640px) {
  /* deploy-31: restored — clears the fixed right rail (original value) */
  .stage-numbers { padding-right: 78px; gap: 8px; }
  .stage-num > strong { font-size: clamp(26px, 6.6vw, 40px); }
}
@media (max-width: 380px) {
  .stage-num > strong { font-size: clamp(24px, 6.2vw, 34px); }
  .stage-numbers { gap: 6px; }
}
.stage-sub { font-size: 12px; color: rgba(255,255,255,.68); text-shadow: 0 1px 8px rgba(0,0,0,.5); margin: 2px 0 8px; }
.stage-coach { color: #fff; font-size: 15px; font-weight: 600; text-shadow: 0 1px 10px rgba(0,0,0,.5); margin: 0 0 12px; }
.stage-coach strong { color: var(--lime); }
.home-stage-cta { display: flex; align-items: center; gap: 12px; }
.home-stage-cta .streak-chip { background: rgba(184,237,97,.16); border-color: rgba(184,237,97,.35); color: #fff; flex: none; }
.snap-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 17px; padding: 16px;
}
.snap-cta svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.home-stage-cta .snap-cta { margin: 0; flex: 1; }
.stage-numbers.goal-hit .stage-num.eaten > strong { text-shadow: 0 0 26px rgba(184,237,97,.8); }
.medical-note { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 18px 2px 0; }
.medical-note a { color: var(--muted); }

/* ---------- Scan: staged overlay + TikTok chips ---------- */
.analysis-stages { list-style: none; margin: 16px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.analysis-stages li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.analysis-stages li i {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); display: grid; place-items: center;
  transition: border-color .3s, background .3s;
}
.analysis-stages li.active { color: var(--text); font-weight: 700; }
.analysis-stages li.active i { border-color: var(--lime); animation: stagePulse 1s ease-in-out infinite; }
.analysis-stages li.done { color: var(--lime); }
.analysis-stages li.done i { border-color: var(--lime); background: var(--lime); }
.analysis-step-live { font-size: 13px; color: var(--muted); margin: 8px 0 0; min-height: 18px; }
@keyframes stagePulse { 50% { box-shadow: 0 0 0 6px var(--lime-soft); } }

.result-photo-wrap { position: relative; border-radius: var(--radius-md); overflow: hidden; margin: 0 0 14px; background: #000; }
.result-photo-wrap img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.tiktok-chips { position: absolute; inset: 0; pointer-events: none; }
.tt-chip {
  position: absolute; padding: 8px 12px; border-radius: 999px;
  background: rgba(7,8,7,.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18); color: #fff; font-size: 13px; font-weight: 700;
  animation: chipPop .45s var(--ease) backwards;
}
.tt-chip.tt-kcal { left: 12px; bottom: 12px; font-size: 17px; background: rgba(184,237,97,.92); color: #0b0d0b; border: none; animation-delay: .05s; }
.tt-chip.tt-p { right: 12px; top: 12px; animation-delay: .15s; }
.tt-chip.tt-c { right: 12px; top: 56px; animation-delay: .25s; }
.tt-chip.tt-f { right: 12px; top: 100px; animation-delay: .35s; }
@keyframes chipPop { from { transform: scale(.6) translateY(8px); opacity: 0; } }

/* ---------- Train: aligned stats + suggestion ---------- */
.training-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.training-summary article {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center;
}
.stat-val strong { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-unit { display: flex; flex-direction: column; line-height: 1.25; }
.stat-unit span { font-size: 12px; font-weight: 700; }
.stat-unit small { font-size: 11px; color: var(--muted); }
.suggested-panel { margin-bottom: 14px; border-color: var(--lime); }
.suggested-card { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.suggested-card > div { min-width: 0; }
.suggested-card strong { display: block; font-size: 18px; margin: 4px 0 6px; }
.train-note { font-size: 13px; color: var(--muted); }
.train-honesty { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

/* ---------- Meals: weekly plan ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.week-nav strong { font-size: 14px; }
.plan-summary { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.plan-summary strong { color: var(--text); }
.prep-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); vertical-align: baseline; }
.week-plan { display: flex; flex-direction: column; gap: 10px; }
.plan-day {
  display: grid; grid-template-columns: 1fr; gap: 2px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; color: var(--text); width: 100%;
  transition: transform .15s var(--ease), border-color .15s;
}
.plan-day:active { transform: scale(.98); }
.plan-day.today { border-color: var(--lime); }
.plan-day-name { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.plan-day.today .plan-day-name { color: var(--lime); }
.plan-meal-name { font-size: 16px; }
.plan-meal-meta { font-size: 13px; color: var(--muted); }
.plan-view { font-size: 13px; color: var(--lime); font-weight: 700; margin-top: 6px; }
.recipe-detail-macros { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; font-size: 14px; }
.recipe-detail-macros strong { color: var(--lime); }
.recipe-ingredients, .recipe-steps { margin: 0 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }
.recipe-dialog h3 { font-size: 15px; margin: 0 0 8px; }

/* ---------- Progress: charts + streaks ---------- */
.streak-big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.streak-big > div { background: var(--surface-2); border-radius: 12px; padding: 16px 12px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.streak-big strong { font-size: 34px; font-variant-numeric: tabular-nums; color: var(--lime); }
.streak-big span { font-size: 12px; color: var(--muted); }
.day-bar .bar.stacked { display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; background: none; }
.day-bar .bar.stacked i { display: block; width: 100%; }
.seg-workout { background: var(--mint); }
.seg-steps { background: var(--lime); opacity: .55; }
.chart-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
/* Charts with no data yet: say so instead of rendering blank bars. */
.chart-empty { padding: 26px 12px 30px; text-align: center; }
.chart-empty h3 { margin: 0 0 6px; font-size: 15px; }
.chart-empty p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.macro-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.macro-day { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; position: relative; padding-bottom: 18px; }
.macro-day span { position: absolute; bottom: 0; font-size: 10px; color: var(--muted); }
.macro-col { width: 8px; border-radius: 3px; min-height: 2px; }
.macro-col.p { background: var(--lime); }
.macro-col.c { background: var(--orange); }
.macro-col.f { background: var(--blue); }
.macro-day.empty .macro-col { opacity: .25; }
.chart-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin: 8px 0 0; align-items: center; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; }
.chart-legend i.p { background: var(--lime); }
.chart-legend i.c { background: var(--orange); }
.chart-legend i.f { background: var(--blue); }

/* ---------- Profile sheet ---------- */
.profile-dialog { padding: 0; }
.profile-dialog form { display: flex; flex-direction: column; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px calc(18px + var(--safe-bottom)); }
.profile-identity-row { display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; }
.profile-photo {
  width: 64px; height: 64px; border-radius: 50%; flex: none; padding: 0; cursor: pointer;
  border: 2px solid var(--lime); background: var(--surface-2); color: var(--lime);
  font-size: 24px; font-weight: 800; display: grid; place-items: center; overflow: hidden;
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.profile-name-label { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.profile-block { border-top: 1px solid var(--line); padding: 14px 0; }
.burn-preview { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; background: var(--surface-2); border-radius: 12px; padding: 12px; }
.burn-preview > div { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 2px; }
.burn-preview span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.burn-preview strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.burn-preview .form-note { flex-basis: 100%; margin: 4px 0 0; }

/* ---------- deploy-72: fighter-card profile + no horizontal sheet drift ---------- */
.profile-dialog { overflow-x: hidden; }
.profile-dialog form { overflow-x: hidden; }
.partner-row { overscroll-behavior-x: contain; }
.fighter-hero {
  position: relative; border-radius: 18px; overflow: hidden; min-height: 300px;
  display: flex; align-items: flex-end; background: var(--surface-2); margin: 4px 0 14px;
}
.fighter-hero img, .fighter-hero video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center;
}
.fighter-hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.02) 35%, rgba(0,0,0,.74) 100%);
}
.fighter-photo-edit {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.fighter-stats { position: relative; z-index: 1; display: flex; gap: 22px; padding: 14px 16px; width: 100%; }
.fighter-stats > div { display: flex; flex-direction: column; gap: 2px; }
.fighter-stats strong { font-size: 27px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }
.fighter-stats span { font-size: 10px; color: rgba(255,255,255,.78); text-transform: uppercase; letter-spacing: .09em; }
.corner-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface-2); border-radius: 16px; padding: 12px; margin-top: 10px;
}
.corner-card img { width: 92px; height: 116px; object-fit: cover; object-position: top center; border-radius: 12px; flex: none; background: #111; }
.corner-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.corner-meta strong { font-size: 20px; }
.corner-meta > span { color: var(--muted); font-size: 13px; }
.corner-rename { display: flex; gap: 6px; margin-top: 8px; }
.corner-rename input { flex: 1; min-width: 0; }
.corner-change { flex: none; align-self: flex-start; }
.partner-picker-wrap { margin-top: 10px; }
.profile-details summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.profile-details summary::-webkit-details-marker { display: none; }
.profile-details summary::after {
  content: '+'; font-size: 22px; font-weight: 700; color: var(--lime); line-height: 1;
}
.profile-details[open] summary::after { content: '\2013'; }
.profile-details .section-kicker { margin: 0; }

/* ---------- Onboarding steps ---------- */
.onboard-dots { list-style: none; display: flex; gap: 6px; margin: 12px 0; padding: 0; }
.onboard-dots li { width: 26px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.14); }
.onboard-dots li.active { background: var(--lime); }
.onboard-step { display: none; }
.onboard-step.active { display: block; animation: stepIn .3s var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateX(14px); } }
.onboard-lead { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.onboarding-actions { display: flex; gap: 8px; }
.onboarding-actions .dark-button { flex: 1; }
.onboarding-goals { margin-bottom: 12px; }
/* deploy-35: resting burn, computed live, labeled as an estimate */
.onboard-bmr-live {
  margin: 14px 0 12px;
  padding: 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-2);
  text-align: center;
}
.onboard-bmr-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.onboard-bmr-label em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; }
.onboard-bmr-live strong { display: block; font-size: 42px; font-weight: 850; color: var(--lime); line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.onboard-bmr-unit { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------- Celebrations ---------- */
.celebrate-card h2 { font-size: 22px; }

@media (max-width: 380px) {
  .score-num { font-size: 24px; }
  .stat-val strong { font-size: 22px; }
}

/* ============================================================
   FADE v4 — TikTok-native redesign
   (dialog anchoring + overflow-x clip from v3 untouched)
   ============================================================ */

/* ---------- Home: LIVE-only stage ---------- */
#homeView .home-stage {
  margin: 0 -24px;
  min-height: calc(100dvh - 260px);
  border-radius: 0 0 28px 28px;
}
.home-stage {
  overflow: hidden; /* zoom must clip; do not remove */
}
.home-stage-bg {
  background-size: cover;
  background-position: center;
}
.home-stage-bg.flex-motion {
  animation: stageFlex 8s ease-in-out infinite alternate;
  will-change: transform;
  transform-origin: center center;
}
@keyframes stageFlex {
  0%   { transform: scale(1.06) translate(0%, 0%); }
  50%  { transform: scale(1.14) translate(-2%, 1.5%); }
  100% { transform: scale(1.10) translate(1.5%, -1%); }
}
@media (prefers-reduced-motion: reduce) {
  .home-stage-bg.flex-motion { animation: none; }
}
.live-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 77, 77, .16);
  border: 1px solid rgba(255, 77, 77, .55);
  color: #ff8d8d;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
}
.live-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d4d;
  box-shadow: 0 0 10px #ff4d4d;
  animation: liveBlink 1.6s ease-in-out infinite;
}
@keyframes liveBlink { 50% { opacity: .35; } }

/* TikTok right rail: macro + step chips pinned on the stage edge */
.stage-rail {
  position: absolute;
  right: 10px;
  top: 38%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 64px; /* same column width for P C F S Steps */
}
.rail-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;          /* clear gap: value sits BELOW ring, never overlapping */
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  text-align: center;
}
.rail-chip i {
  display: block;
  width: 100%;
  font-style: normal;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.88);
  text-align: center;
  text-shadow: 0 1px 8px rgba(0,0,0,.85);
  line-height: 1.1;
}
.rail-dot {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(7, 8, 7, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  /* keep letter/emoji INSIDE the ring only */
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.rail-dot.p { color: var(--lime); border-color: rgba(184, 237, 97, .55); }
.rail-dot.c { color: #ffb37a; border-color: rgba(255, 179, 122, .45); }
.rail-dot.f { color: #9fc3d4; border-color: rgba(159, 195, 212, .45); }
.rail-dot.su { color: #e8a0bf; border-color: rgba(232, 160, 191, .5); }
.rail-dot.st { font-size: 19px; }
.rail-chip b {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .65);
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 0;
  /* never absolute / never negative margin into the ring */
}

/* Pop line: one feel-good line at a time, pops when it changes */
.pop-line.pop-in { animation: popLine .5s cubic-bezier(.2, 1.4, .3, 1); }
@keyframes popLine {
  0% { transform: scale(.82) translateY(8px); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* ---------- Snap: full-bleed stage, controls on the photo ---------- */
.snap-live-chips {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  pointer-events: none;
}
.snap-live-chips[hidden] { display: none; }
.snap-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(7, 8, 7, .82);
  border: 1px solid rgba(184, 237, 97, .55);
  box-shadow: 0 8px 28px rgba(0,0,0,.45), 0 0 18px rgba(184,237,97,.25);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  animation: chipPop .4s var(--ease) backwards;
}
.snap-chip.stage-done {
  border-color: rgba(184,237,97,.85);
  background: rgba(20, 36, 14, .88);
}
.snap-stages-stack { display: flex; flex-direction: column; gap: 6px; }
.camera-frame.scanning .snap-live-chips { bottom: calc(130px + var(--safe-bottom)); }
.snap-chip .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: liveBlink 1.1s ease-in-out infinite;
}
/* Numbers-landed chip: the totals physically arrive on the plate. */
.snap-chip.numbers-landed {
  background: rgba(20, 28, 14, .88);
  border-color: var(--lime);
  box-shadow: 0 0 24px rgba(184, 237, 97, .35);
  font-size: 14px;
}
.snap-chip.numbers-landed.pop-in { animation: popLine .5s cubic-bezier(.2, 1.4, .3, 1); }

/* ---------- Train: demo video stage ---------- */
.demo-stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #0b0e0b;
  margin-bottom: 14px;
  isolation: isolate;
  border: 1px solid var(--line);
}
.demo-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.demo-stage-overlay {
  position: absolute;
  left: 14px;
  right: 118px;
  bottom: 12px;
  z-index: 2;
  color: #fff;
  min-width: 0;
}
.demo-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lime);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
.demo-stage-overlay h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-stage-overlay p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, .78);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
.demo-burn {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  text-align: right;
  color: #fff;
  background: rgba(7, 8, 7, .58);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  padding: 8px 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-width: 86px;
}
.demo-burn span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .62);
}
.demo-burn strong {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(184, 237, 97, .5);
}
.demo-burn small { font-size: 11px; color: rgba(255, 255, 255, .62); }
.demo-burn.tick strong { animation: burnTick .35s var(--ease); }
@keyframes burnTick {
  0% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* Routine cards: animated visual header per workout type */
/* routine-card overflow handled in main rule */
.routine-card h2 { margin-top: 22px; }
.routine-visual {
  height: 108px;
  margin: -23px -23px 16px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.routine-visual::before {
  content: "";
  position: absolute;
  inset: -45%;
  z-index: -1;
  animation: visualDrift 9s ease-in-out infinite alternate;
}
.rv-strength::before { background: radial-gradient(circle at 30% 40%, rgba(184, 237, 97, .34), transparent 55%), linear-gradient(135deg, #141a12, #0b0e0b); }
.rv-conditioning::before { background: radial-gradient(circle at 70% 30%, rgba(239, 138, 82, .4), transparent 55%), linear-gradient(135deg, #1a1410, #0b0e0b); }
.rv-hiit::before { background: radial-gradient(circle at 50% 60%, rgba(255, 214, 90, .32), transparent 55%), linear-gradient(135deg, #1a1610, #0b0e0b); }
.rv-mobility::before { background: radial-gradient(circle at 40% 60%, rgba(119, 174, 190, .36), transparent 55%), linear-gradient(135deg, #10161a, #0b0e0b); }
.rv-default::before { background: radial-gradient(circle at 50% 40%, rgba(184, 237, 97, .28), transparent 55%), linear-gradient(135deg, #131a14, #0b0e0b); }
@keyframes visualDrift {
  from { transform: translate3d(-4%, -3%, 0) rotate(-4deg) scale(1); }
  to { transform: translate3d(4%, 4%, 0) rotate(5deg) scale(1.12); }
}
.routine-visual > span {
  font-size: 44px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .5));
  animation: glyphBob 3.2s ease-in-out infinite;
}
@keyframes glyphBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* ---------- Meals: day-video stage + week strip ---------- */
.meal-stage {
  position: relative;
  min-height: 44dvh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  border-radius: 28px;
  border: 1px solid var(--line);
}
.meal-stage-bg { position: absolute; inset: 0; z-index: -2; }
.meal-stage-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.meal-stage-bg i {
  position: absolute;
  border-radius: 50%;
  opacity: .55;
  animation: blobFloat 11s ease-in-out infinite alternate;
}
.meal-stage-bg i:nth-child(2) { animation-duration: 14s; animation-delay: -4s; }
.meal-stage-bg i:nth-child(3) { animation-duration: 9s; animation-delay: -7s; }
@keyframes blobFloat {
  from { transform: translate3d(-7%, -5%, 0) scale(1); }
  to { transform: translate3d(7%, 7%, 0) scale(1.18); }
}
.meal-stage-overlay {
  width: 100%;
  padding: 20px 20px 22px;
  color: #fff;
  background: linear-gradient(to top, rgba(7, 8, 7, .9) 30%, transparent);
}
/* Daily macro goals pinned on top of the meal stage. */
/* deploy-16 meals: secondary plan summary + progress chip separators */
.plan-summary-secondary {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  opacity: .85;
}
.meal-stage-goals .goal-chip b.progress {
  font-variant-numeric: tabular-nums;
}
.meal-stage-goals .goal-chip .goal-sep {
  opacity: .55;
  font-weight: 700;
}
.meal-stage-goals {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.goal-chip {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: rgba(7, 8, 7, .72);
  border: 1px solid rgba(184, 237, 97, .45);
  padding: 7px 12px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.goal-chip b { color: var(--lime); font-weight: 900; }
.meal-stage-overlay .kicker { color: var(--lime); text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.meal-stage-overlay h2 {
  color: #fff;
  font-size: 30px;
  letter-spacing: -.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
}
.meal-stage-macros {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.meal-stage-macros span {
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(7, 8, 7, .62);
  border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.meal-stage-macros span.hot { background: rgba(184, 237, 97, .92); color: #0b0d0b; border: none; }
.week-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.week-day-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  min-width: 0;
}
.week-day-row:active { transform: scale(.99); }
.week-day-row.selected { border-color: var(--lime); background: rgba(184, 237, 97, .07); }
.week-day-row .wd-day { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.week-day-row.selected .wd-day { color: var(--lime); }
.week-day-row .wd-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.week-day-row .wd-kcal { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Progress: calm single column ---------- */
.progress-grid { grid-template-columns: 1fr; max-width: 720px; }
.trend-panel { order: -1; }

/* ---------- Phone: full-bleed stages, shutter on the photo ---------- */
@media (max-width: 640px) {
  #homeView .home-stage {
    margin: -12px -16px 0;
    border-radius: 0;
    /* deploy-30: fixed height (not min-height) + svh so Home never scrolls
       on iOS. svh = small viewport (browser chrome shown) = guaranteed
       visible area. overflow hidden clips rather than growing the page. */
    height: calc(100svh - 62px - 112px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 12px);
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(22px + var(--safe-bottom));
  }
  /* deploy-31: restored — clears the fixed right rail (original value) */
  .stage-numbers { padding-right: 76px; }
  /* deploy-31: the phone stage is now a fixed height (deploy-30 no-scroll),
     shorter than the grown stage the original top:38% assumed — sit the rail
     a touch lower so the top chip never clips at 390x844.
     deploy-75: 44% centered the P chip on the LIVE pill — drop the center to
     52% and compact the rail so the top clears the pill and the bottom still
     clears the CTA. */
  .stage-rail { top: 52%; gap: 10px; }
  .rail-chip { gap: 5px; }
  .scan-view .scan-layout { display: block; position: relative; }
  .scan-view .camera-stage {
    margin: 0 -16px;
    border-radius: 0;
    height: min(72dvh, 600px);
    max-height: none;
    aspect-ratio: auto;
  }
  .scan-view .camera-plate { border-radius: 0; border-left: 0; border-right: 0; }
  .scan-view .capture-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    z-index: 6;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    margin: 0;
  }
  .scan-view .capture-controls .shutter { width: 80px; height: 80px; }
  /* Demo tag + live chips float above the shutter row, clear of the tab bar. */
  .scan-view .demo-plate-tag { bottom: calc(120px + var(--safe-bottom)); }
  .scan-view .snap-live-chips { bottom: calc(120px + var(--safe-bottom)); }
  .meal-stage { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; min-height: 46dvh; }
  .demo-stage { aspect-ratio: 16 / 11; }
  .routine-visual { margin: -20px -20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-stage-bg.flex-motion,
  .routine-visual::before,
  .routine-visual > span,
  .meal-stage-bg i,
  .live-pill i,
  .snap-chip .pulse-dot { animation: none !important; }
}

/* ==========================================================================
   FADE v5 — true TikTok Reels feel (deploy-12)
   Full-bleed stages, demo hero default, floating chrome, unified Progress.
   v3 dialog anchoring / overflow fixes and v4 stage work are untouched below.
   ========================================================================== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.demo-tag {
  flex: none;
  font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255, 255, 255, .88);
  background: rgba(7, 8, 7, .55);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 6px 10px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.demo-tag[hidden] { display: none; }

/* ---------- Home: edge-to-edge Reel, demo hero default ---------- */
#homeView .home-stage {
  margin: -124px calc(min(-24px, (1120px - 100vw) / 2)) 0;
  min-height: calc(100dvh - 72px);
  border-radius: 0;
  padding-top: 96px;
}
.home-stage-bg { background-color: #0b0e0b; }
/* Legibility gradients only — no more full-photo blur. */
.home-stage-bg::after {
  background: linear-gradient(to top, rgba(7, 8, 7, .94) 4%, rgba(7, 8, 7, .5) 36%, transparent 60%, rgba(7, 8, 7, .38) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- Snap: floating step chips on the photo ---------- */
.scan-view .scan-steps.snap-step-float {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px; right: 12px;
  z-index: 8;
  margin: 0;
  gap: 4px;
  max-width: none;
}
.scan-view .scan-steps.snap-step-float li {
  padding: 6px 7px;
  font-size: 10px;
  gap: 5px;
  background: rgba(7, 8, 7, .58);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  overflow: hidden;
}
.scan-view .scan-steps.snap-step-float li span {
  width: 16px; height: 16px; font-size: 10px;
}
.scan-view .scan-steps.snap-step-float li:not(.active):not(.done) { opacity: .55; }

/* Snap empty state: viewfinder, not a black box */
.camera-empty {
  background: transparent;
  text-align: center;
  padding: 20px;
  max-width: 300px;
}
.camera-empty h2 {
  color: #fff; font-size: 20px; letter-spacing: -.01em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .7); margin: 0 0 6px;
}
.camera-empty p { color: rgba(255, 255, 255, .78); text-shadow: 0 1px 8px rgba(0, 0, 0, .7); }
.camera-empty .aperture {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border: 8px solid rgba(7, 8, 7, .6);
  box-shadow: inset 0 0 0 9px var(--lime), inset 0 0 0 17px rgba(7, 8, 7, .6);
}

/* ---------- Train: stage-first guided session ---------- */
/* deploy-21: early large demo-stage mins REMOVED — sizes live in workout-dialog block below */
.workout-dialog .demo-stage {
  /* intentionally no min-height:300px / 44dvh here */
  aspect-ratio: auto;
}
.demo-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}

/* ---------- Train page: full-bleed Reel stage ---------- */
.train-view { padding: 0; }
.train-stage {
  position: relative;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  border-radius: 0;
}
.train-stage-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -2;
}
/* deploy-28: full-bleed avatar exercise video hero on the Train stage.
   Same layer as the still; JS hides the still while the video is active. */
.train-stage-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -2;
}
.train-stage-video[hidden] { display: none; }
/* deploy-38: REMOVED the old prefers-reduced-motion display:none kill.
   Eric requires fluid avatar motion everywhere — the Train hero always plays
   when a clip exists, same as Home (deploy-35 intent). Leaving this rule in
   produced a black gap on the Train stage for anyone with Reduce Motion on:
   JS hides the still (video src exists) while CSS hid the video too. */
.train-stage-shade {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(5,7,5,.55) 0%, rgba(5,7,5,0) 30%, rgba(5,7,5,0) 55%, rgba(5,7,5,.78) 100%);
}
/* deploy-18: fixed stage slots — no reflow when suggest ↔ resume swap */
#trainStage.train-stage {
  position: relative;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}
.train-stage-top {
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.train-stage-top .kicker,
.train-stage-burn,
.train-stage-week { pointer-events: auto; }
.train-stage-top .kicker { color: var(--lime); margin: 0 0 4px; }
/* deploy-75: the burn pill rides ABOVE the kicker — avatar faces sit
   center-frame and the pill was landing on them. Top strip stays clear. */
.train-stage-burn { order: -1; }
.train-stage-burn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 2px 0 6px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(7, 8, 7, .55);
  border: 1px solid rgba(184, 237, 97, .4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.train-stage-burn > span {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
}
.train-stage-burn > strong {
  font-size: clamp(22px, 6vw, 30px); font-weight: 900; color: var(--lime);
  font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(184,237,97,.5);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.train-stage-burn > small {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.6);
  white-space: nowrap; /* NEVER clip "kcal" */
  justify-self: end;
}
.train-stage-week {
  margin: 0;
  min-height: 1.2em; /* reserve line so text swaps don't jump top chrome */
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.85);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
/* deploy-40: transparent burn math under the total — resting (est.) + workouts + steps */
.train-stage-burn-breakdown {
  margin: 2px 0 0;
  min-height: 1.1em;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.75);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
  pointer-events: auto;
}
/* Fixed bottom slot — overlay XOR resume share ONE absolute box (no reflow) */
.train-stage-overlay,
.train-stage-resume {
  position: absolute;
  left: 16px; right: 16px;
  bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  min-height: 168px; /* lock slot height so suggest↔resume does not jump */
  box-sizing: border-box;
}
.train-stage-overlay {
  color: #fff;
  padding-bottom: 8px;
}
.train-stage-overlay .section-kicker { color: var(--lime); text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.train-stage-overlay h2 {
  margin: 0 0 4px;
  font-size: clamp(26px, 7vw, 34px);
  letter-spacing: -.02em;
  text-shadow: 0 2px 16px rgba(0,0,0,.7);
}
.train-stage-meta {
  margin: 0 0 16px;
  min-height: 1.25em;
  font-size: 14px; color: rgba(255,255,255,.85);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
.train-stage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
  z-index: 4;
}
.train-stage-actions .dark-button,
.train-stage-actions .outline-button {
  min-width: 0;
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 900;
  padding: 0 18px;
}
.outline-button.on-photo {
  color: #fff; border-color: rgba(255,255,255,.4);
  background: rgba(7,8,7,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
/* deploy-18: resume shares the fixed bottom slot with overlay (rule above) — no separate position */
@media (max-width: 640px) {
  .train-stage-resume {
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }
}
/* Exclusive states: UA [hidden] must win over absolute/flex display rules */
.train-stage-overlay[hidden],
.train-stage-resume[hidden] {
  display: none !important;
}
.resume-card.on-photo {
  background: rgba(7,8,7,.62);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff;
}
/* Train picker bottom sheet */
.train-sheet-dialog { padding: 0; overflow-x: hidden; }
.train-sheet-dialog .result-shell {
  display: flex; flex-direction: column;
  max-height: 88dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  max-width: 100%; box-sizing: border-box;
}
.train-sheet-dialog .result-shell::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,.25); margin: 0 auto 12px;
}

/* ---------- Meals: stage-first ---------- */
@media (max-width: 640px) {
  #mealsView .page-head { display: none; }
  #mealsView .week-nav { margin: 2px 0 10px; }
  #mealsView .week-nav .outline-button { min-height: 40px; padding: 0 14px; }
  #mealsView .plan-summary { margin: 0 0 10px; }
  .meal-stage {
    margin: 0 -16px;
    border-radius: 0; border-left: 0; border-right: 0;
    min-height: 56dvh;
  }
  /* Week strip: horizontal chip rail, not a panel stack */
  .week-strip {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin: 12px -16px 0;
    padding: 2px 16px 8px;
    gap: 8px;
    scrollbar-width: none;
  }
  .week-strip::-webkit-scrollbar { display: none; }
  .week-day-row {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    min-width: 108px; max-width: 132px;
    padding: 10px 12px;
  }
  .week-day-row .wd-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---------- Progress: unified chart ---------- */
.progress-hero-panel { max-width: 720px; }
.streak-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin: 2px 0 14px;
  min-height: 40px; /* persistent chips — no collapse */
}
.unified-chart-wrap {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(255, 255, 255, .02);
  padding: 10px 6px 2px;
  min-height: 252px; /* 230 canvas + padding — no jump on toggle */
}
#unifiedChart { display: block; width: 100%; height: 230px; }
.series-toggle .chip-toggle.active {
  background: var(--lime-soft);
  border-color: rgba(184, 237, 97, .55);
  color: var(--lime);
}
.streak-stat { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.streak-stat strong { font-size: 30px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.streak-stat span { font-size: 12px; color: var(--muted); font-weight: 700; }
.series-toggle { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip-toggle {
  min-height: 40px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 800; cursor: pointer;
}
.chip-toggle.active { background: var(--lime-soft); border-color: rgba(184, 237, 97, .55); color: var(--lime); }
.unified-chart-wrap {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(255, 255, 255, .02);
  padding: 10px 6px 2px;
}
.unified-chart-wrap[hidden] { display: none; }
#unifiedChart { display: block; width: 100%; height: 230px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 2px 0; font-size: 11px; color: var(--muted); font-weight: 700; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; font-style: normal; }
.chart-legend .lg-eaten { background: var(--lime); }
.chart-legend .lg-burn { background: #ffb37a; }
.chart-legend .lg-steps { background: #5ec8d8; }
.chart-legend .lg-goal { background: transparent; border-top: 2px dashed rgba(255,255,255,.5); width: 16px; height: 0; border-radius: 0; vertical-align: middle; }
.demo-chip {
  flex: none; font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase;
  color: #0b0d0b; background: var(--lime); padding: 7px 12px; border-radius: 999px;
}
.demo-chip[hidden] { display: none; }
.demo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 4px; }
.demo-seed-button { min-height: 44px; }
#progressEmpty .outline-button { margin-top: 6px; min-height: 44px; }

/* ---------- Phone: full-bleed Reels ---------- */
@media (max-width: 640px) {
  #homeView .home-stage {
    margin: calc(-12px - 62px - env(safe-area-inset-top, 0px)) -16px calc(-112px - var(--safe-bottom));
    min-height: 100dvh;
    padding-top: calc(62px + env(safe-area-inset-top, 0px) + 14px);
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px) + 18px);
  }
  /* Snap: camera fills the Reel */
  .scan-view .camera-stage {
    margin: calc(-12px - 62px - env(safe-area-inset-top, 0px)) -16px 0;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }
  .scan-view .camera-plate { border-radius: 0; border: 0; box-shadow: none; }
  .scan-view .scanner-stage { position: relative; }
  /* scan-layout auto height ends exactly at the viewport bottom (negative
     top margin math), so 92px clears the fixed tab bar + safe area.
     deploy-18: equal Add pic / Demo / Scale stacks + centered shutter grid. */
  .scan-view .capture-controls {
    position: absolute;
    left: 0; right: 0;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    display: grid;
    /* deploy-76: 4 buttons in one row (Add pic, shutter, Demo, Scale).
       deploy-73's 3-column grid was for the Demo-less layout; Demo returned
       in deploy-74 and Scale was wrapping to a second row. */
    grid-template-columns: 64px 80px 64px 64px;
    align-items: center;
    justify-content: center;
    column-gap: 14px;
    padding: 0 16px;
    margin: 0;
    box-sizing: border-box;
  }
  .scan-view .capture-controls .shutter {
    width: 80px;
    height: 80px;
    justify-self: center;
  }
  .scan-view .camera-hint { display: none; }
  /* Analyze is now pinned INSIDE .camera-plate (.analyze-on-plate) — the old
     scanner-stage sibling rule is deleted. */
  .scan-view .scale-bar {
    position: absolute;
    top: calc(60px + env(safe-area-inset-top, 0px));
    left: 12px; right: 12px;
    z-index: 8;
    margin: 0;
  }
}

/* ================= FADE deploy-18 additions ================= */
/* LIVE pill pulse */
.live-pill {
  box-shadow: 0 0 0 0 rgba(255, 77, 77, .45);
  animation: livePillPulse 1.4s ease-out infinite;
}
@keyframes livePillPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 77, 77, .55); }
  70%  { box-shadow: 0 0 0 14px rgba(255, 77, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}
.live-pill i { animation: liveBlink 0.9s ease-in-out infinite; }

/* Punchier scoreboard + number pop */
.stage-num > span {
  font-size: 12px;
  letter-spacing: .14em;
  color: #fff;
  opacity: .95;
}
.stage-num > strong {
  /* deploy-18: no forced 48px — grid clamp above fits 4-digit ± nets without overlap */
  filter: drop-shadow(0 4px 18px rgba(0,0,0,.55));
}
.stage-num > strong.num-pop {
  animation: numPop .55s cubic-bezier(.2,1.5,.3,1);
}
@keyframes numPop {
  0%   { transform: scale(.72); opacity: .5; }
  55%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}
.stage-numbers.goal-hit .stage-num.eaten > strong {
  color: var(--lime);
  text-shadow: 0 0 28px rgba(184,237,97,.95), 0 2px 20px rgba(0,0,0,.55);
}
.stage-numbers.protein-hit .rail-dot.p,
.stage-rail.protein-hit .rail-dot.p {
  box-shadow: 0 0 22px rgba(184,237,97,.8);
  transform: none; /* was scale(1.08) — kills overlap */
}
/* deploy-18: clear fixed rail width on phone so stage-numbers don't slide under it */
/* deploy-31: restored — deploy-30 removed this and broke the rail's right-side clearance. */
@media (max-width: 640px) {
  .stage-numbers { padding-right: 78px; } /* clear the fixed rail width */
}

/* Floating feel-good chips on Home stage — deploy-35: in-flow tidy row under
   the top chrome (was absolutely positioned over the CTA and overlapping it) */
.home-float-chips {
  position: static;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding-right: 78px; /* clear the TikTok rail */
  pointer-events: none;
}
.home-float-chips .float-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(7,8,7,.62);
  border: 1px solid rgba(184,237,97,.4);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: floatBob 3.2s ease-in-out infinite;
}
.home-float-chips .float-chip:nth-child(2) { animation-delay: .6s; }
.home-float-chips .float-chip:nth-child(3) { animation-delay: 1.2s; }
@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .home-stage-bg.flex-motion,
  .live-pill,
  .home-float-chips .float-chip,
  .stage-num > strong.num-pop { animation: none !important; }
}

/* deploy-18: Capacitor/WebView zoom lock + Ken Burns clip */
/* Capacitor/WebView: prevent accidental pinch-zoom leaving UI overscaled */
html, body {
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
}
.app, .home-stage, .train-stage, .scan-view, .camera-plate {
  touch-action: pan-x pan-y;
}
/* Ken Burns must NEVER escape .home-stage (overflow:hidden already required) */
.home-stage { overflow: hidden !important; isolation: isolate; }
.home-stage-bg.flex-motion {
  /* softer motion so scale cannot feel like page zoom */
  animation: stageFlex 10s ease-in-out infinite alternate;
  will-change: transform;
  transform-origin: center center;
}
@keyframes stageFlex {
  0%   { transform: scale(1.06) translate(0%, 0%); }
  50%  { transform: scale(1.14) translate(-2%, 1.5%); }
  100% { transform: scale(1.10) translate(1.5%, -1%); }
}
/* deploy-18: iOS zooms when a focused input is <16px — lock quick-log + steps inputs at 16px */
.log-workout-dialog input[type="number"],
.workout-dialog input[type="number"],
.workout-estimate input[type="number"],
#quickWorkoutSteps {
  font-size: 16px;
}
/* deploy-18: soft-invalid field marker (never .focus() — that triggers the zoom) */
.field-invalid {
  border-color: #ff9d6b !important;
  box-shadow: 0 0 0 2px rgba(255, 157, 107, .45);
}

/* deploy-25: remove-photo control under the profile avatar */
.profile-photo-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.remove-photo-button { background: none; border: 0; padding: 2px 6px; font-size: 12px; font-weight: 700; color: #ff7a7a; cursor: pointer; }
.remove-photo-button[hidden] { display: none; }

/* deploy-26: living avatar, LOUDER. The deploy-25 drift (9s, 1.10→1.28) was too
   subtle to notice on a phone ("nothing is moving"). Now 7s, 1.08→1.35 with a
   bigger pan, so the user's pic unmistakably drifts and zooms. Glow pulse kept.
   prefers-reduced-motion still kills all avatar animation (now !important so it
   wins the cascade for certain). */
.avatar-button { overflow: hidden; }
.avatar-button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-avatar img,
.avatar-button img,
.profile-avatar img {
  animation: avatarDrift 7s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes avatarDrift {
  0%   { transform: scale(1.08) translate(0, 0); }
  100% { transform: scale(1.35) translate(-6%, 5%); }
}
.home-avatar,
.avatar-button {
  animation: avatarGlow 3.2s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,237,97,0); }
  50%      { box-shadow: 0 0 0 5px rgba(184,237,97,.22); }
}
@media (prefers-reduced-motion: reduce) {
  .home-avatar img, .avatar-button img, .profile-avatar img,
  .home-avatar, .avatar-button { animation: none !important; }
}

/* deploy-24: tighter Train hero + Ken Burns on the person's photo.
   The stage was 100dvh (full screen), pushing "Logged today" below the fold and
   leaving a big dark gap. Now 62dvh so today's log peeks above the fold.
   The person's photo gets the same slow stageFlex zoom/pan as Home ("automate the pic"). */
#trainStage.train-stage {
  height: 62dvh !important;
  max-height: 62dvh !important;
}
.train-stage-img {
  animation: stageFlex 12s ease-in-out infinite alternate;
  will-change: transform;
  transform-origin: center center;
}
#trainStage .train-stage-overlay,
#trainStage .train-stage-resume {
  bottom: 16px; /* was calc(118px + safe-area) for the old full-screen stage */
}
@media (prefers-reduced-motion: reduce) {
  .train-stage-img { animation: none; }
}

/* deploy-23: NUCLEAR — full-screen sheet + block flow (no flex collapse).
   deploy-22 REGRESSION FIX: these rules MUST only apply when the dialog is open.
   deploy-22 used `.workout-dialog { display: block !important; }`, which overrode the
   UA `dialog:not([open]) { display: none }` — the sheet rendered permanently with its
   initial empty HTML (black void) and close() could never dismiss it. Scoped to [open]. */
.workout-dialog[open] {
  position: fixed !important;
  inset: 0 0 0 0 !important; /* FULL SCREEN — covers nav even if hide fails */
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 9999 !important;
  background: #070807;
  display: block; /* UA default for dialog[open]; never !important — see below */
  overflow: hidden !important;
  padding: 0 !important;
}
/* deploy-23: hard guarantee — a closed workout dialog is NEVER rendered, no matter
   what any other rule (present or future) declares. */
.workout-dialog:not([open]) {
  display: none !important;
}
.workout-dialog > .result-shell {
  display: block !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  box-sizing: border-box;
}
.workout-dialog .dialog-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #070807;
}
.workout-dialog .demo-stage {
  height: 120px !important;
  max-height: 120px !important;
  min-height: 120px !important;
  aspect-ratio: auto !important;
  margin: 0 0 10px !important;
}
.workout-dialog .workout-scroll {
  display: block !important;
  min-height: auto !important;
  overflow: visible !important;
  flex: none !important;
}
.workout-dialog .workout-current,
.workout-dialog .workout-progress,
.workout-dialog .exercise-list {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #fff !important;
}
.workout-dialog .current-exercise {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0;
}
.workout-dialog .exercise-row {
  color: #fff;
}
.workout-dialog .workout-actions {
  position: sticky;
  bottom: 0;
  background: #070807;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  z-index: 2;
}
.workout-dialog .discard-session {
  display: block;
  margin: 8px 0 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

/* deploy-18: Today logged-workouts panel under the Train stage */
.today-workouts-panel { margin: 12px 16px 8px; }
.today-workout {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.today-workout strong { font-size: 15px; }
.today-workout span { font-size: 13px; opacity: 0.72; }
/* deploy-41: row layout with delete control + checkable subtotal footer */
.today-workout {
  display: flex;
  align-items: center;
  gap: 10px;
}
.today-workout-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.today-workout-delete {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  padding: 0 0 2px;
}
.today-workout-delete:active { background: rgba(255,255,255,0.14); }
.today-workout-subtotal { text-align: right; margin: 4px 2px 0; }
/* deploy-18: health import row (steps entry moved to Walk quick-log) */
.health-row { margin: 10px 0 0; }

/* deploy-21: file-scope belt — hide .bottom-nav whenever ANY dialog is open,
   even in desktop-width Capacitor WebViews outside the mobile media query. */
body:has(dialog[open]) .bottom-nav,
html:has(dialog[open]) .bottom-nav,
body.sheet-open .bottom-nav,
html.sheet-open .bottom-nav {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  z-index: -1 !important;
}
/* deploy-22: attribute backup — setNavHidden() drives this via inline style too */
.bottom-nav[data-fade-hidden="1"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
}

/* deploy-22: DEAD BUTTONS — Pause / Finish / × MUST receive taps */
.workout-dialog .close-button,
.workout-dialog .workout-actions,
.workout-dialog .workout-actions button,
.workout-dialog .discard-session {
  position: relative !important;
  z-index: 200 !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
}
.workout-dialog .workout-actions button {
  min-height: 48px !important;
}
.workout-dialog .demo-stage,
.workout-dialog .demo-burn,
.workout-dialog .demo-stage-overlay,
.workout-dialog .demo-stage img,
.workout-dialog .demo-stage canvas {
  pointer-events: none !important;
}

/* ============ deploy-27: training partners ============
   9 exercising mascots. Motion is transform/opacity only (GPU-friendly).
   prefers-reduced-motion kills ALL partner animation with !important so it
   always wins the cascade. */

/* ============ deploy-28: training-partner VIDEO hero ============
   The home background is a full-bleed looping <video> of the chosen partner
   (TikTok-reel feel). The old photo background (.home-stage-bg) is retired.
   prefers-reduced-motion: JS shows the PNG still instead of autoplaying. */

/* --- full-bleed hero video: the partner IS the home background --- */
.home-stage-bg { display: none !important; }
.home-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  background: #0b0e0b;
}
/* deploy-34: selfie "Me" living photo — slow Ken Burns drift so a still
   photo feels alive on Home/Train. object-fit: cover keeps it full-bleed. */
.living-photo {
  animation: livingPhoto 12s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes livingPhoto {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.12) translate(-1.5%, 1.5%); }
}
@media (prefers-reduced-motion: reduce) {
  .living-photo { animation: none; }
}
/* deploy-45: "Me" tile photo region + native picker input. The input sits
   directly over the photo (inset:0, opacity:0 — NEVER display:none/hidden)
   so the real finger tap natively opens the iOS picker; the synthetic
   .click() path iOS ignores is gone. The "Me" name button below selects
   the partner. */
.me-photo-region { position: relative; width: 100%; cursor: pointer; }
.me-hint { display: block; text-align: center; }
/* deploy-64: .me-photo-input removed — Me tile uses the shared #avatarInput. */
/* deploy-70: the whole Me tile selects the Me avatar on tap, so the name is a
   plain label; replacing the photo/video is an explicit small pill button. */
.me-name {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 100%;
  font: inherit; color: inherit;
}
.me-replace-button {
  margin-top: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  color: inherit; font: inherit; font-size: 12px; line-height: 1;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
/* deploy-34: "Me" tile camera affordance in the partner pickers. */
.me-camera {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px dashed var(--lime);
  color: var(--lime);
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}
/* deploy-44: pulsing "Uploading…" state on the Me tile so every tap gives
   feedback while the selfie uploads. */
.me-camera.me-uploading {
  animation: mePulse 1s ease-in-out infinite;
  border-style: solid;
}
@keyframes mePulse {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .me-camera.me-uploading { animation: none; opacity: 1; }
}
.home-stage-top, .home-float-chips, .stage-numbers,
.stage-sub, .stage-coach, .home-stage-cta {
  position: relative;
  z-index: 1;
}
/* deploy-31: .stage-rail is deliberately NOT in the list above. A deploy-28
   version of this rule forced position:relative on the rail, which killed its
   original absolute right-edge pinning ("TikTok right rail") and dropped it
   in-flow on the left edge. The rail keeps position:absolute; right:10px. */

/* deploy-28d: desktop home — the fixed right rail must never collide with
   the top chrome (avatar button) nor cover the scoreboard/CTA, at any
   viewport size. Phone (<=640px) is untouched: zero layout shift vs
   deploy-26 on 390x844. */
@media (min-width: 641px) {
  .stage-rail { top: max(34%, 200px); } /* rail top always clears the avatar row */
  .stage-numbers, .home-stage-cta { padding-right: 84px; } /* clear the 64px rail */
}

/* --- per-exercise motion (one class per partner) --- */
.partner-anim { will-change: transform; display: block; }
.pm-pushups  { animation: pmPushups 1.3s ease-in-out infinite; }
.pm-squats   { animation: pmSquats 1.7s ease-in-out infinite; }
.pm-yoga     { animation: pmYoga 6s ease-in-out infinite; }
.pm-curls    { animation: pmCurls 1.5s ease-in-out infinite; }
.pm-lunges   { animation: pmLunges 1.9s ease-in-out infinite; }
.pm-punches  { animation: pmPunches .9s ease-in-out infinite; }
.pm-swim     { animation: pmSwim 2.5s ease-in-out infinite; }
.pm-deadlift { animation: pmDeadlift 2.1s ease-in-out infinite; }
.pm-jacks    { animation: pmJacks 1.2s ease-in-out infinite; }

@keyframes pmPushups  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7%); } }
@keyframes pmSquats   { 0%,100% { transform: translateY(0) scale(1,1); } 50% { transform: translateY(9%) scale(1.04,.93); } }
@keyframes pmYoga     { 0%,100% { transform: translateX(0) rotate(-2deg); } 50% { transform: translateX(3%) rotate(2deg); } }
@keyframes pmCurls    { 0%,100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.07) rotate(-2deg); } }
@keyframes pmLunges   { 0%,100% { transform: translateX(-4%); } 50% { transform: translateX(4%); } }
@keyframes pmPunches  { 0%,100% { transform: translateX(0); } 30% { transform: translateX(4%); } 60% { transform: translateX(-2%); } }
@keyframes pmSwim     { 0%,100% { transform: translateX(-5%) rotate(-3deg); } 50% { transform: translateX(5%) rotate(3deg); } }
@keyframes pmDeadlift { 0%,100% { transform: translateY(0); } 40% { transform: translateY(6%); } 55% { transform: translateY(5%) translateX(1%); } 70% { transform: translateY(6%) translateX(-1%); } }
@keyframes pmJacks    { 0%,100% { transform: scale(1,1); } 50% { transform: scale(1.12,.88); } }

/* --- onboarding picker grid: big animated previews --- */
.partner-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.partner-option {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 16px;
  padding: 8px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.partner-option img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.partner-option small { font-size: 10px; font-weight: 600; color: var(--muted); }
.partner-option.selected {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px var(--lime);
}

/* --- profile dialog: compact horizontal partner row --- */
.partner-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px;
  -webkit-overflow-scrolling: touch;
}
/* deploy-29: user-uploaded hero video entry points (onboarding + profile).
   Quiet secondary buttons — the partner picker stays the primary choice. */
.custom-video-block { margin-top: 10px; display: grid; gap: 6px; justify-items: start; }
.custom-video-button {
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.custom-video-button:disabled { opacity: .55; cursor: wait; }
.custom-video-block .form-note { margin: 0; }
.partner-chip {
  flex: 0 0 62px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 5px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.partner-chip img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.partner-chip-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 0 1px;
}
.partner-chip.selected {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px var(--lime);
}
/* --- deploy-42: partner rename --- */
.partner-rename-block { margin-top: 10px; }
.partner-rename-label { font-size: 12px; font-weight: 700; color: var(--ink-dim); display: block; margin-bottom: 6px; }
.partner-rename-controls { display: flex; gap: 8px; align-items: center; }
.partner-rename-controls input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 9px 10px;
  font-size: 14px;
}
.partner-rename-controls input:disabled { opacity: .5; }
.rename-save-button {
  background: var(--lime);
  color: #10130a;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

/* --- reduced motion: partner animation OFF, always wins --- */
@media (prefers-reduced-motion: reduce) {
  .partner-anim,
  .partner-option img,
  .partner-chip img,
  .home-hero-video {
    animation: none !important;
  }
}

/* deploy-58: avatar file input must be RENDERED for iOS/WKWebView to honor
   programmatic .click() — display:none inputs are rejected. Visually invisible. */
#avatarInput {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Recent meals: 7-day photo history */
.recent-meals { margin-top: 24px; }
.recent-meals h3 { font-size: 15px; margin: 0 0 12px; }
.recent-meals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.recent-meal-card { border-radius: 12px; overflow: hidden; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; }
.recent-meal-photo { height: 80px; background: var(--bg-soft); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.recent-meal-photo img { width: 100%; height: 100%; object-fit: cover; }
.recent-meal-no-photo { font-size: 24px; opacity: 0.5; }
.recent-meal-info { padding: 8px; }
.recent-meal-info strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meal-info span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.recent-meals-empty { color: var(--muted); font-size: 13px; }

/* Avatar carousel: swipeable side-by-side cards */
.avatar-block { margin-top: 8px; }
.avatar-carousel { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 12px 4px 16px; margin: 0 -4px; }
.avatar-cards { display: flex; gap: 12px; padding: 0 16px; }
.avatar-card { flex: 0 0 210px; border-radius: 16px; overflow: hidden; background: var(--card); border: 2px solid var(--border); cursor: pointer; padding: 0; text-align: left; transition: border-color 0.2s, transform 0.2s; }
.avatar-card.selected { border-color: var(--lime); transform: scale(1.02); }
.avatar-card img { width: 100%; height: 230px; object-fit: cover; object-position: top center; display: block; }
.avatar-card-meta { padding: 10px 12px; }
.avatar-card-meta strong { display: block; font-size: 14px; }
.avatar-card-meta span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: capitalize; }
.avatar-upload-card { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 288px; border-style: dashed; flex-shrink: 0; }
.avatar-upload-plus { font-size: 48px; color: var(--lime); line-height: 1; margin-bottom: 8px; }
.avatar-name-box { margin-top: 16px; }
.avatar-name-box label { display: block; font-size: 15px; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.avatar-name-box input { width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid rgba(184, 237, 97, .5); background: rgba(255,255,255,.06); color: var(--text); font-size: 16px; font-weight: 600; box-sizing: border-box; transition: border-color 0.2s, box-shadow 0.2s; }
.avatar-name-box input:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(184, 237, 97, .2), 0 0 20px rgba(184, 237, 97, .15); background: rgba(255,255,255,.09); }
.avatar-name-box input::placeholder { color: rgba(255,255,255,.35); font-weight: 400; }

/* Workout plan sheet: lock layout to prevent jumping */
.train-sheet-dialog .result-shell { min-height: 80vh; }
#suggestedWorkout { min-height: 120px; }
#suggestedWorkout:empty::before { content: ''; display: block; height: 120px; border-radius: 12px; background: rgba(255,255,255,.04); }
.routine-grid { min-height: 200px; }
.routine-grid:empty::before { content: ''; display: block; height: 200px; border-radius: 12px; background: rgba(255,255,255,.04); grid-column: 1 / -1; }
#recentWorkouts { min-height: 80px; }
.training-summary { min-height: 70px; }

/* Routine card: circular Start button beside the title */
.routine-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 35px 0 9px; }
.routine-title-row h2 { margin: 0; }
.routine-start-btn { width: 64px; height: 64px; border-radius: 50%; background: var(--lime); color: var(--ink); border: 0; font-weight: 850; font-size: 13px; flex-shrink: 0; cursor: pointer; box-shadow: var(--glow); }
.routine-start-btn:active { transform: scale(0.95); }
