/* Aevo app styles. Every value is a token from tokens.css. Logical properties so Arabic mirrors itself. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--color-background); color: var(--color-text-primary); font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--leading-normal); min-height: 100vh; }
[lang="bn"], [lang="hi"], [lang="ar"] { line-height: var(--leading-script); }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: var(--leading-tight); text-wrap: balance; }
h1 { font-size: var(--text-xl); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--color-action-text); }
.num { font-feature-settings: var(--font-numeric-features); }
.muted { color: var(--color-text-muted); }
.sm { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }

/* Layout */
.shell { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; }
.page { width: 100%; max-width: 30rem; margin-inline: auto; padding: calc(var(--space-roomy) + env(safe-area-inset-top, 0px)) var(--space-comfortable) calc(var(--size-tabbar) + var(--space-airy)); display: grid; gap: var(--space-comfortable); align-content: start; }
.page.flow { padding-bottom: var(--space-roomy); }
.stack { display: grid; gap: var(--space-comfortable); }
.row { display: flex; gap: var(--space-snug); align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
@media (min-width: 62rem) {
  .shell.has-tabs { grid-template-columns: 15rem 1fr; grid-template-rows: 1fr; }
  .page { max-width: 44rem; padding-bottom: var(--space-spacious); }
}

/* Cards, buttons, fields */
.card { background: var(--color-surface); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-comfortable); box-shadow: var(--shadow-card), inset 0 1px 0 rgb(255 255 255 / 0.08); min-width: 0; display: grid; gap: var(--space-cosy); }
.btn { position: relative; isolation: isolate; min-height: var(--size-control); padding: 0 var(--space-roomy); border-radius: var(--radius-full); border: 0; font-weight: var(--weight-bold); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-snug); transition: transform var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard); text-decoration: none; overflow: hidden; }
/* Glossy finish: a soft highlight across the top of every button, glass or solid. */
.btn.primary::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(to bottom, rgb(255 255 255 / 0.22), rgb(255 255 255 / 0) 55%); pointer-events: none; z-index: 1; }
.btn.soft::before, .btn.ghost::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(to bottom, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0) 60%); pointer-events: none; z-index: 1; }
/* A thin light sweeps across every button every few seconds, like light catching glass. */
/* A bright point of light orbits the edge of the main call-to-action only, not every button on the page. */
@property --btn-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--btn-angle), transparent 0deg, transparent 300deg, rgb(255 255 255 / 0.95) 335deg, rgb(255 255 255 / 0.95) 345deg, transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: btn-ring-spin 3.2s linear infinite;
}
@keyframes btn-ring-spin { to { --btn-angle: 360deg; } }
@media (prefers-reduced-motion: reduce) { .btn.primary::after { animation: none; } }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--color-action); color: var(--color-text-on-action); box-shadow: var(--shadow-press), 0 0 0 0 rgb(34 197 94 / 0.5); animation: btn-pulse 2.6s ease-in-out infinite; }
@keyframes btn-pulse { 0%, 100% { box-shadow: var(--shadow-press), 0 0 0 0 rgb(34 197 94 / 0.45); } 50% { box-shadow: var(--shadow-press), 0 0 16px 2px rgb(34 197 94 / 0.45); } }
@media (prefers-reduced-motion: reduce) { .btn.primary { animation: none; } }
.btn.primary:hover { background: var(--color-action-hover); }
.btn.soft { background: var(--color-action-soft); color: var(--color-action-text); }
.btn.ghost { background: var(--color-surface-raised); color: var(--color-action-text); border: var(--border-width) solid var(--color-border); }
.btn[data-act="menu"] { min-width: 2.75rem; }
.btn.danger { background: var(--color-error-soft); color: var(--color-error); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .chip:focus-visible, .tab:focus-visible, .opt:focus-visible, button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.field { display: grid; gap: var(--space-hair); }
.field > span { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
.field input, .field select { min-height: var(--size-control); border-radius: var(--radius-sm); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface-sunken); color: var(--color-text-primary); padding: 0 var(--space-comfortable); font: inherit; width: 100%; }
.field small { color: var(--color-text-muted); font-size: var(--text-xs); }
.field .err { color: var(--color-error); font-size: var(--text-sm); }
.opts { display: grid; gap: var(--space-snug); }
.opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* An odd one out left alone on its own row (e.g. "Other" after Male/Female) stretches full width instead of sitting half-empty. */
.opts.two > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.opt { min-height: var(--size-control); border-radius: var(--radius-md); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text-primary); padding: var(--space-cosy) var(--space-comfortable); cursor: pointer; text-align: start; font-weight: var(--weight-semibold); display: grid; gap: var(--space-hair); }
.opt small { font-weight: var(--weight-regular); color: var(--color-text-secondary); }
.opt[aria-pressed="true"] { border-color: var(--color-action); background: var(--color-action-soft); color: var(--color-action-text); outline: 2px solid var(--color-action); }
.chip { border: var(--border-width) solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-full); padding: var(--space-hair) var(--space-cosy); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; min-height: var(--size-tap); display: inline-flex; align-items: center; }
.chip[aria-pressed="true"] { background: var(--color-action); color: var(--color-text-on-action); border-color: var(--color-action); }
.tag { display: inline-flex; align-items: center; font-size: var(--text-xs); font-weight: var(--weight-bold); padding: var(--space-hair) var(--space-cosy); border-radius: var(--radius-full); background: var(--color-surface-sunken); color: var(--color-text-secondary); }
.tag.sun { background: var(--color-accent-soft); color: var(--color-accent-text); }
.tag.flame { background: var(--color-flame-soft); color: var(--color-flame-text); }
.tag.over { background: var(--color-over-soft); color: var(--color-over); }
.tag.ok { background: var(--color-success-soft); color: var(--color-success); }
.tag.warn { background: var(--color-warning-soft); color: var(--color-warning); }
.notice { border-radius: var(--radius-md); padding: var(--space-comfortable); background: var(--color-warning-soft); color: var(--color-warning); font-size: var(--text-sm); display: grid; gap: var(--space-hair); }
.notice.info { background: var(--color-info-soft); color: var(--color-info); }
.notice.err { background: var(--color-error-soft); color: var(--color-error); }
.notice b { font-weight: var(--weight-bold); }
.progress { height: 0.5rem; background: var(--color-surface-sunken); border-radius: var(--radius-full); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--gradient-sun); border-radius: var(--radius-full); }
.progress.action i { background: var(--color-action); }

/* Landing */
.landing { background: var(--hero-bg); color: var(--hero-text); }
.landing .page { max-width: 34rem; min-height: 100vh; align-content: center; padding-bottom: 12vh; padding-bottom: var(--space-roomy); gap: var(--space-roomy); }
.landing h1 { font-size: var(--text-3xl); font-weight: var(--weight-heavy); }
.landing p { color: var(--hero-text-muted); }
.landing .btn.soft { background: rgb(255 255 255 / 0.14); color: var(--hero-text); }
.landing .field > span { color: var(--hero-text-muted); }
.landing .field input { background: rgb(255 255 255 / 0.1); border-color: rgb(255 255 255 / 0.4); color: var(--hero-text); }
.landing .field input::placeholder { color: var(--hero-text-muted); }
.landing .res { background: var(--color-surface); color: var(--color-text-primary); border-radius: var(--radius-md); padding: var(--space-snug); display: grid; gap: var(--space-hair); }
.landing a { color: var(--hero-text); }
.brand { font-family: var(--font-display); font-weight: var(--weight-heavy); font-size: var(--text-xl); letter-spacing: 0.02em; }

/* Today hero + sun gauge */
.hero { background: var(--hero-bg); color: var(--hero-text); border: 1px solid rgb(255 255 255 / 0.1); border-radius: var(--radius-lg); padding: var(--space-roomy) var(--space-comfortable) var(--space-comfortable); display: grid; gap: var(--space-cosy); justify-items: center; overflow: hidden; box-shadow: 0 20px 50px rgb(0 0 0 / 0.4), inset 0 1px 0 rgb(255 255 255 / 0.15); }
.gauge { position: relative; width: 100%; max-width: var(--size-gauge); aspect-ratio: 320 / 188; }
.gauge svg { width: 100%; height: 100%; display: block; overflow: visible; }
.gauge .track { fill: none; stroke: var(--hero-track); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 0.01 11; }
.gauge .fill { fill: none; stroke: url(#sunStroke); stroke-width: 14; stroke-linecap: round; }
.gauge .sun { fill: var(--color-accent); }
.gauge .readout { position: absolute; inset-inline: 0; bottom: 4%; text-align: center; }
.gauge .readout b { display: block; font-family: var(--font-display); font-size: var(--text-display); line-height: var(--leading-tight); font-weight: var(--weight-bold); font-feature-settings: var(--font-numeric-features); white-space: nowrap; }
.gauge .readout span { color: var(--hero-text-muted); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; text-align: center; gap: var(--space-snug); }
.facts b { display: block; font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold); font-feature-settings: var(--font-numeric-features); }
.facts span { color: var(--hero-text-muted); font-size: var(--text-xs); }
.water { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-cosy); align-items: center; width: 100%; background: rgb(255 255 255 / 0.1); border-radius: var(--radius-full); padding: var(--space-snug) var(--space-comfortable); font-size: var(--text-sm); }
.water .bar { height: 0.5rem; background: var(--hero-track); border-radius: var(--radius-full); overflow: hidden; }
.water .bar i { display: block; height: 100%; background: var(--gradient-sun); border-radius: var(--radius-full); }
.water-actions { display: flex; gap: var(--space-snug); width: 100%; }
.water-actions button { flex: 1; min-height: var(--size-tap); border-radius: var(--radius-full); border: 0; background: rgb(255 255 255 / 0.16); color: var(--hero-text); font-weight: var(--weight-bold); cursor: pointer; padding: 0 var(--space-hair); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.water-actions button:active { transform: scale(0.97); }
/* "+ Glass 250 ml" is too long for a third of the row at any font size that still reads easily,
   so the label and the amount sit on their own lines instead of wrapping mid-number. */
.water-actions button.two-line { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.2; padding-block: var(--space-hair); white-space: normal; }
.water-actions button.two-line .l { font-size: var(--text-sm); }
.water-actions button.two-line .n { font-size: var(--text-xs); font-weight: var(--weight-regular); opacity: 0.85; }
.greet small { color: var(--color-text-muted); font-size: var(--text-sm); display: block; }

/* Sun path */
.path { display: grid; grid-template-columns: repeat(5, 1fr); position: relative; text-align: center; font-size: var(--text-xs); color: var(--color-text-muted); }
.path::before { content: ""; position: absolute; inset-inline: 10%; top: 0.7rem; border-top: 3px dotted var(--color-border-strong); }
.path button { position: relative; display: grid; gap: var(--space-hair); justify-items: center; min-width: 0; background: none; border: 0; cursor: pointer; padding: 0; }
.path i { width: 1.5rem; height: 1.5rem; border-radius: var(--radius-full); background: var(--color-surface); border: 3px solid var(--color-border-strong); display: block; }
.path .done i { background: var(--color-accent); border-color: var(--color-accent); }
.path b { color: var(--color-text-primary); font-weight: var(--weight-semibold); font-size: var(--text-xs); }

/* Macros */
.macro { display: grid; grid-template-columns: 2.25rem 1fr auto; gap: var(--space-cosy); align-items: center; }
.macro .k { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-full); display: grid; place-items: center; font-weight: var(--weight-heavy); font-size: var(--text-sm); color: var(--color-background); }
.macro .k { position: relative; overflow: hidden; }
.macro .k:has(.macro-ico) { border-radius: 0.6rem; }
.macro .k .macro-ico { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.macro-ico.inline { width: 1.1rem; height: 1.1rem; border-radius: 0.3rem; vertical-align: -0.2em; margin-inline-end: 0.25rem; }
.macro .bar { height: 0.75rem; background: var(--color-surface-sunken); border-radius: var(--radius-full); overflow: hidden; }
.macro .bar i { display: block; height: 100%; border-radius: var(--radius-full); }
.macro .n { font-size: var(--text-sm); font-weight: var(--weight-semibold); text-align: end; white-space: nowrap; font-feature-settings: var(--font-numeric-features); }
.macro .l { display: block; font-size: var(--text-xs); color: var(--color-text-muted); font-weight: var(--weight-medium); margin-bottom: var(--space-hair); }

/* Levels */
.level { border-radius: var(--radius-md); padding: var(--space-comfortable); display: grid; grid-template-columns: 4rem 1fr; gap: var(--space-comfortable); align-items: center; cursor: pointer; border: 3px solid transparent; text-align: start; width: 100%; }
.level h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.level p { font-size: var(--text-sm); margin-top: var(--space-hair); }
.level .stats { display: flex; gap: var(--space-snug); flex-wrap: wrap; margin-top: var(--space-snug); }
.level .stats span { border-radius: var(--radius-full); padding: var(--space-hair) var(--space-cosy); font-size: var(--text-xs); font-weight: var(--weight-bold); background: rgb(255 255 255 / 0.55); }
.level.dawn { background: var(--level-dawn-bg); color: var(--level-dawn-ink); }
.level.noon { background: var(--level-noon-bg); color: var(--level-noon-ink); }
.level.dusk { background: var(--level-dusk-bg); color: var(--level-dusk-ink); }
.level.dusk .stats span { background: rgb(255 255 255 / 0.18); }
.level[aria-pressed="true"] { border-color: var(--color-text-primary); }
.level:disabled { opacity: 0.5; cursor: not-allowed; }
.level svg { width: 4rem; height: 4rem; }

/* Tab bar */
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; min-height: var(--size-tabbar); margin: 0 var(--space-snug) calc(var(--space-snug) + env(safe-area-inset-bottom, 0px)); background: rgb(255 255 255 / 0.07); backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%); border: var(--border-width) solid rgb(255 255 255 / 0.14); border-radius: var(--radius-full); text-align: center; box-shadow: 0 8px 32px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.12); padding: 0 var(--space-snug); }
.tab { background: none; border: 0; cursor: pointer; min-height: var(--size-tap); min-width: 0; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-muted); display: grid; gap: var(--space-hair); justify-items: center; align-content: center; text-decoration: none; overflow-wrap: anywhere; }
.tab svg { width: 1.5rem; height: 1.5rem; }
.tab[aria-current="page"] { color: var(--color-action-text); }
.tab[aria-current="page"] svg { filter: drop-shadow(0 0 6px var(--color-action)); }

.add-fab, .add-side { border: 0; background: var(--gradient-action); color: var(--color-text-on-action); cursor: pointer; font-weight: var(--weight-bold); box-shadow: var(--shadow-press); }
.add-fab { position: fixed; inset-inline-end: var(--space-comfortable); bottom: calc(var(--size-tabbar) + var(--space-roomy) + env(safe-area-inset-bottom, 0px)); z-index: 21; width: 3.75rem; height: 3.75rem; border-radius: var(--radius-full); font-size: var(--text-2xl); display: grid; place-items: center; }
.add-fab:active, .add-side:active { transform: scale(0.96); }
.add-side { display: none; }

/* Sheet */
.scrim { position: fixed; inset: 0; background: var(--color-overlay); z-index: 40; display: grid; align-items: end; justify-items: center; }
.sheet { width: 100%; max-width: 34rem; max-height: 92vh; overflow: auto; background: var(--color-surface-raised); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-sheet); padding: var(--space-comfortable) var(--space-comfortable) calc(var(--space-roomy) + env(safe-area-inset-bottom, 0px)); display: grid; gap: var(--space-comfortable); animation: rise var(--duration-default) var(--ease-standard); }
@keyframes rise { from { transform: translateY(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 3rem; height: 0.3rem; border-radius: var(--radius-full); background: var(--color-border-strong); margin: 0 auto; }
@media (min-width: 62rem) { .scrim { align-items: center; } .sheet { border-radius: var(--radius-lg); } }

/* Food rows */
.food { display: grid; grid-template-columns: 1fr auto; gap: var(--space-cosy); align-items: center; padding: var(--space-cosy) 0; border-bottom: var(--border-width) solid var(--color-border); cursor: pointer; background: none; border-inline: 0; border-top: 0; width: 100%; text-align: start; }
.food:last-child { border-bottom: 0; }
.food.has-img { grid-template-columns: 3rem 1fr auto; }
.thumb.ph svg { display: block; }
.food .thumb { width: 3rem; height: 3rem; border-radius: var(--radius-sm); object-fit: cover; background: var(--color-surface-sunken); display: block; }
.plate { margin: 0; padding: var(--space-cosy); display: grid; gap: var(--space-tight); }
.plate img { width: 100%; height: auto; border-radius: var(--radius-sm); display: block; }
.ex-box { --ar: 1; width: 100%; max-width: calc(16rem * var(--ar)); margin: 0 auto var(--space-cosy); }
.ex-anim { display: block; position: relative; width: 100%; height: 0; padding: 0 0 calc(100% / var(--ar)); border: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface-sunken); cursor: pointer; }
.ex-anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ex-anim .a { animation: ex-a var(--duration-loop) ease-in-out infinite; }
.ex-anim .b { opacity: 0; animation: ex-b var(--duration-loop) ease-in-out infinite; }
.ex-anim.paused img { animation-play-state: paused; }
@keyframes ex-a { 0%, 35% { opacity: 1; } 50%, 85% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ex-b { 0%, 35% { opacity: 0; } 50%, 85% { opacity: 1; } 100% { opacity: 0; } }
.food-photo { display: block; width: 100%; max-width: 12rem; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); margin: 0 auto var(--space-cosy); background: var(--color-surface-sunken); }
.food-photo.ex-static { display: none; }
@media (prefers-reduced-motion: reduce) { .ex-box { display: none; } .food-photo.ex-static { display: block; } }
/* The name/serving block is a grid item next to a fixed-width thumb and the kcal figure: without its own
   min-width it would rather overflow the row than wrap a long, unbroken food name. */
.food > div { min-width: 0; }
.food b { font-weight: var(--weight-semibold); display: block; overflow-wrap: anywhere; }
.food span { color: var(--color-text-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.food em { font-style: normal; font-weight: var(--weight-bold); font-size: var(--text-sm); white-space: nowrap; font-feature-settings: var(--font-numeric-features); }
.stepper { display: flex; align-items: center; justify-content: center; gap: var(--space-comfortable); }
.stepper button { width: var(--size-control); height: var(--size-control); border-radius: var(--radius-full); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface); font-size: var(--text-xl); cursor: pointer; }
.stepper b { font-family: var(--font-display); font-size: var(--text-2xl); min-width: 4rem; text-align: center; font-feature-settings: var(--font-numeric-features); }

/* Training */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-hair); }
.week button { border: var(--border-width) solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-sm); padding: var(--space-snug) 0; display: grid; gap: var(--space-hair); justify-items: center; cursor: pointer; min-width: 0; font-size: var(--text-xs); color: var(--color-text-muted); }
.week button b { color: var(--color-text-primary); font-weight: var(--weight-bold); }
.week button[aria-pressed="true"] { border-color: var(--color-action); background: var(--color-action-soft); }
.week .dot { width: 0.5rem; height: 0.5rem; border-radius: var(--radius-full); background: var(--color-border-strong); }
.week .dot.train { background: var(--color-action); }
.week .dot.done { background: var(--color-accent); }
.week .dot.active { background: var(--color-success); }
.ex { display: grid; grid-template-columns: 1fr auto; gap: var(--space-cosy); padding: var(--space-cosy) 0; border-bottom: var(--border-width) solid var(--color-border); align-items: center; background: none; border-inline: 0; border-top: 0; width: 100%; text-align: start; cursor: pointer; }
.ex:last-child { border-bottom: 0; }
.rest-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-tight); }
.ex.has-img { grid-template-columns: 3rem 1fr auto; }
.ex .thumb { width: 3rem; height: 3rem; border-radius: var(--radius-sm); object-fit: cover; background: var(--color-surface-sunken); display: block; }
.thumb.ph { display: grid; place-items: center; color: var(--color-text-muted); }
.ex b { display: block; font-weight: var(--weight-semibold); }
.ex span { color: var(--color-text-muted); font-size: var(--text-sm); }
.ex em { font-style: normal; font-weight: var(--weight-bold); font-size: var(--text-sm); color: var(--color-action-text); background: var(--color-action-soft); padding: var(--space-hair) var(--space-cosy); border-radius: var(--radius-full); white-space: nowrap; font-feature-settings: var(--font-numeric-features); }
.setrow { display: grid; grid-template-columns: 2rem 1fr 1fr 3rem; gap: var(--space-snug); align-items: center; }
.setrow .n { font-weight: var(--weight-bold); color: var(--color-text-muted); text-align: center; }
.setrow input { min-height: var(--size-tap); border-radius: var(--radius-sm); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface-sunken); color: var(--color-text-primary); padding: 0 var(--space-cosy); font: inherit; width: 100%; min-width: 0; font-feature-settings: var(--font-numeric-features); }
.setrow .ok { width: 3rem; height: var(--size-tap); border-radius: var(--radius-sm); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface); cursor: pointer; font-weight: var(--weight-bold); }
.setrow .ok[aria-pressed="true"] { background: var(--color-success); color: var(--color-background); border-color: var(--color-success); }
.timer { position: sticky; top: var(--space-snug); z-index: 10; background: var(--hero-bg); color: var(--hero-text); border-radius: var(--radius-full); padding: var(--space-cosy) var(--space-roomy); display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); font-weight: var(--weight-bold); }
.steps { margin: 0; padding-inline-start: var(--space-roomy); display: grid; gap: var(--space-snug); }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.ch-line { fill: none; stroke: var(--color-action); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--color-action); }
.ch-grid { stroke: var(--color-chart-grid); stroke-width: 1; }
.ch-goal { stroke: var(--color-accent); stroke-width: 2; stroke-dasharray: 5 5; }
.ch-txt { fill: var(--color-text-muted); font-size: 10px; font-family: var(--font-sans); }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-snug); align-items: end; height: 7rem; }
.bars .c { display: grid; grid-template-rows: 1fr auto; height: 100%; justify-items: center; gap: var(--space-hair); min-width: 0; }
.bars .c .t { width: 100%; max-width: 1.75rem; background: var(--color-surface-sunken); border-radius: var(--radius-sm); display: flex; align-items: flex-end; overflow: hidden; }
.bars .c .t i { display: block; width: 100%; background: var(--color-action); border-radius: var(--radius-sm); }
.bars .c small { font-size: var(--text-xs); color: var(--color-text-muted); }

/* Toast */
#toast { position: fixed; inset-inline: var(--space-comfortable); bottom: calc(var(--size-tabbar) + var(--space-roomy)); z-index: 60; background: var(--color-text-primary); color: var(--color-background); padding: var(--space-cosy) var(--space-comfortable); border-radius: var(--radius-full); text-align: center; font-weight: var(--weight-semibold); max-width: 28rem; margin-inline: auto; box-shadow: var(--shadow-press); }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* Desktop: the nav sits on the left even though it comes last in the markup. */
@media (min-width: 62rem) { .tabbar { order: -1; } }
.shell.landing { background: var(--hero-bg); }

/* Desktop sidebar. Placed last so it overrides the phone tab bar above. */
@media (min-width: 62rem) {
  .tabbar { position: sticky; inset: 0 auto auto 0; top: 0; align-self: start; height: 100vh; margin: 0; grid-template-columns: 1fr; grid-auto-rows: max-content; align-content: start; border-radius: 0; border-width: 0 1px 0 0; padding: var(--space-roomy) var(--space-comfortable); box-shadow: none; gap: var(--space-snug); text-align: start; order: -1; }
  .tabbar .tab { grid-auto-flow: column; justify-content: start; justify-items: start; font-size: var(--text-base); padding: var(--space-cosy); border-radius: var(--radius-full); }
  .tabbar .tab[aria-current="page"] { background: var(--color-action-soft); }
  .add-fab { display: none; }
  .add-side { display: flex; align-items: center; justify-content: center; gap: var(--space-snug); min-height: var(--size-control); border-radius: var(--radius-full); font-size: var(--text-base); margin-bottom: var(--space-snug); }
  #toast { bottom: var(--space-roomy); }
}

/* Right-to-left: the sun travels right to left, and number-with-unit stays in reading order. */
[dir="rtl"] .gauge svg { transform: scaleX(-1); }
[dir="rtl"] .facts b, [dir="rtl"] .macro .n, [dir="rtl"] .water .num, [dir="rtl"] .readout b, [dir="rtl"] .food em, [dir="rtl"] .ex em, [dir="rtl"] .num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
[dir="rtl"] .facts b { display: block; }
[dir="rtl"] .readout b { display: block; }

/* Month calendar on Progress */
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-hair); text-align: center; }
.cal { aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--radius-full); font-size: var(--text-sm); font-feature-settings: var(--font-numeric-features); color: var(--color-text-secondary); }
.cal.ate { background: var(--color-accent); color: var(--color-text-on-accent); font-weight: var(--weight-bold); }
.cal.trained { outline: 3px solid var(--color-action); outline-offset: -3px; }
.cal.today { font-weight: var(--weight-heavy); text-decoration: underline; }

/* Photo journal */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-snug); }
.gallery button { padding: 0; border: 3px solid transparent; border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-sunken); cursor: pointer; position: relative; display: block; }
.gallery button[aria-pressed="true"] { border-color: var(--color-action); }
.gallery img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.gallery span { position: absolute; inset-inline: 0; bottom: 0; padding: var(--space-hair) var(--space-snug); background: var(--color-overlay); color: var(--hero-text); font-size: var(--text-xs); text-align: start; }
.gallery > p { grid-column: 1 / -1; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-snug); }
.compare figure { margin: 0; }
.compare img { width: 100%; border-radius: var(--radius-md); aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.compare figcaption { text-align: center; font-size: var(--text-sm); padding-top: var(--space-hair); }

/* Loading skeleton, offline banner */
.skeleton { background: var(--color-surface-sunken); border-radius: var(--radius-md); animation: skel 1.2s var(--ease-standard) infinite alternate; }
@keyframes skel { from { opacity: 0.55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
#offline { position: sticky; top: 0; z-index: 70; background: var(--color-warning-soft); color: var(--color-text-primary); border-bottom: var(--border-width) solid var(--color-warning); padding: var(--space-snug) var(--space-comfortable); text-align: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
select { max-width: 100%; }

/* ---------- Motion ---------- */
/* Page entrance runs only when the route changes (the shell gets .enter), so tapping a button never replays it.
   Transform and opacity only. Reduced motion zeroes every duration through the tokens. */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes draw { from { stroke-dasharray: 0 100; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.shell.enter > main > *, .shell.enter > main > form > * { animation: rise var(--duration-slow) var(--ease-standard) both; animation-delay: calc(var(--i, 0) * 50ms); }
.shell.enter .gauge .fill { animation: draw var(--duration-draw) var(--ease-standard) both; animation-delay: 120ms; }
.shell.enter .gauge .sun, .shell.enter .gauge circle { animation: fade var(--duration-draw) var(--ease-standard) both; animation-delay: 160ms; }
.shell.enter .water .bar i, .shell.enter .macro .bar i { transform-origin: left; animation: grow-x var(--duration-draw) var(--ease-standard) both; animation-delay: 200ms; }
[dir="rtl"] .shell.enter .water .bar i, [dir="rtl"] .shell.enter .macro .bar i { transform-origin: right; }
.shell.enter .bars .t i { transform-origin: bottom; animation: grow-y var(--duration-draw) var(--ease-standard) both; animation-delay: 200ms; }
.shell.enter .path .done i { animation: pop var(--duration-slow) var(--ease-standard) both; animation-delay: 300ms; }
.shell.enter .chart .ch-line { stroke-dasharray: 1; stroke-dashoffset: 0; }

.scrim { animation: fade var(--duration-default) var(--ease-standard) both; }
.sheet { animation: sheet-up var(--duration-slow) var(--ease-standard) both; }
#toast:not([hidden]) { animation: toast-in var(--duration-default) var(--ease-standard) both; }

.btn, .chip, .opt, .tab, .food, .path button, .week button { transition: transform var(--duration-fast) var(--ease-standard), background-color var(--duration-default) var(--ease-standard), border-color var(--duration-default) var(--ease-standard), color var(--duration-default) var(--ease-standard); }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled), .chip:active, .opt:active, .food:active, .path button:active, .week button:active { transform: scale(0.97); }
.tab[aria-current="page"] svg { animation: pop var(--duration-slow) var(--ease-standard) both; }
.setrow .ok[aria-pressed="true"] { animation: pop var(--duration-default) var(--ease-standard) both; }
.tag.flame { animation: breathe 2.4s ease-in-out infinite; }
.opt[aria-pressed="true"], .chip[aria-pressed="true"] { animation: pop var(--duration-default) var(--ease-standard) both; }
.card { transition: border-color var(--duration-default) var(--ease-standard); }
.skeleton { animation-duration: 1.2s; }
@media (prefers-reduced-motion: reduce) {
  .tag.flame, .skeleton { animation: none; }
  .shell.enter *, .scrim, .sheet, #toast { animation-duration: 0ms !important; animation-delay: 0ms !important; }
}
.toast-undo { background: none; border: 0; color: var(--color-background); font: inherit; font-weight: var(--weight-heavy); text-decoration: underline; cursor: pointer; min-height: var(--size-tap); padding: 0 var(--space-snug); }
main > *:focus { outline: none; }

/* Side drawer for the three-dot menu, and no visible scrollbars (content still scrolls). */
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-in-rtl { from { transform: translateX(-100%); } to { transform: none; } }
.scrim.drawer { align-items: stretch; justify-items: end; }
[dir="rtl"] .scrim.drawer { justify-items: start; }
.sheet.drawer { width: min(24rem, 90vw); max-width: none; height: 100%; max-height: none; border-radius: var(--radius-lg) 0 0 var(--radius-lg); align-content: start; padding-top: calc(var(--space-comfortable) + env(safe-area-inset-top, 0px)); animation: drawer-in var(--duration-slow) var(--ease-standard) both; }
[dir="rtl"] .sheet.drawer { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; animation-name: drawer-in-rtl; }
.sheet.drawer .grab { display: none; }
@media (min-width: 62rem) { .scrim.drawer { align-items: stretch; } .sheet.drawer { border-radius: var(--radius-lg) 0 0 var(--radius-lg); } [dir="rtl"] .sheet.drawer { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; } }
html, .sheet, .scrim { scrollbar-width: none; }
html::-webkit-scrollbar, .sheet::-webkit-scrollbar, .scrim::-webkit-scrollbar { display: none; }
.facts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.facts.four b { font-size: var(--text-base); }

/* Folding menu sections (fewer choices at once) and the Ask Aevo chat. */
.menu-sec { border: var(--border-width) solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.menu-sec > summary { min-height: 3rem; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-comfortable); font-weight: var(--weight-semibold); cursor: pointer; list-style: none; }
.menu-sec > summary::-webkit-details-marker { display: none; }
.menu-sec > summary::after { content: '▾'; transition: transform var(--duration-fast) var(--ease-standard); color: var(--color-text-muted); }
.menu-sec[open] > summary::after { transform: rotate(180deg); }
.menu-sec > .stack { padding: 0 var(--space-comfortable) var(--space-comfortable); }
.assistant .chat { display: grid; gap: var(--space-comfortable); max-height: 45vh; overflow-y: auto; padding-block: var(--space-snug); }
.assistant .msg { max-width: 88%; padding: var(--space-cosy) var(--space-comfortable); border-radius: var(--radius-lg); overflow-wrap: anywhere; }
.assistant .msg p { margin: 0; line-height: var(--leading-relaxed, 1.55); }
.assistant .msg.user { justify-self: end; background: linear-gradient(135deg, var(--color-action-soft), rgb(255 255 255 / 0.04)); box-shadow: 0 0 20px rgb(34 197 94 / 0.15); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgb(255 255 255 / 0.08); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs, 4px) var(--radius-lg); }
/* The bot's reply reads as flowing text beside its avatar, not a boxed bubble, which is what made two
   symmetric boxes on both sides feel flat and dated; only the user's own messages stay as a pill. */
.assistant .msg.bot { justify-self: start; max-width: 100%; padding: 0; background: none; }
.msg-row { display: flex; align-items: flex-start; gap: var(--space-cosy); }
.msg-avatar { flex: none; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; margin-top: 0.1rem; border-radius: var(--radius-full); background: linear-gradient(145deg, var(--color-action), #15803d); color: #04140a; box-shadow: 0 0 12px rgb(34 197 94 / 0.5); }
.msg-avatar svg { width: 0.95rem; height: 0.95rem; }
.assistant .msg-img { display: block; max-width: 10rem; border-radius: var(--radius-sm); margin-bottom: var(--space-snug); }
/* The tap target for a message's Edit/Delete menu: reset to look like plain bubble text, not a button. */
.assistant .msg-tap { all: unset; display: block; width: 100%; cursor: pointer; }
.assistant .msg-tap:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.assistant .chat-form { display: flex; gap: var(--space-snug); }
.assistant .chat-form input[type="text"] { flex: 1; min-width: 0; min-height: var(--size-control); border-radius: var(--radius-sm); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface-sunken); color: var(--color-text-primary); padding: 0 var(--space-cosy); font: inherit; }
.assistant .chat-form input[type="text"]:focus-visible { outline: 2px solid var(--color-action); outline-offset: 2px; }
.assistant .mic[aria-pressed="true"] { background: var(--color-action); color: var(--color-background); }
@media (prefers-reduced-motion: reduce) { .menu-sec > summary::after { transition: none; } }
.assistant .greet { margin: 0; font-size: var(--text-lg, 1.125rem); }

/* The glowing ring that sits above Kai's greeting on a fresh chat: a slow-spinning conic ring plus a
   pulsing core, the same visual language as the primary-button ring (--btn-angle) but its own property
   so the two animate independently. */
@property --orb-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.kai-orb { position: relative; width: 5.5rem; height: 5.5rem; margin: 0 auto var(--space-cosy); display: grid; place-items: center; }
.kai-orb-ring { position: absolute; inset: 0; border-radius: var(--radius-full); background: conic-gradient(from var(--orb-angle), transparent 0deg, rgb(74 222 128 / 0.05) 90deg, rgb(74 222 128 / 0.9) 170deg, #ffffff 180deg, rgb(74 222 128 / 0.9) 190deg, rgb(74 222 128 / 0.05) 270deg, transparent 360deg); animation: orb-spin 5s linear infinite; filter: blur(0.5px); }
.kai-orb-ring::after { content: ""; position: absolute; inset: 3px; border-radius: inherit; background: var(--color-background); }
.kai-orb-core { position: relative; z-index: 1; display: grid; place-items: center; width: 3.1rem; height: 3.1rem; border-radius: var(--radius-full); background: radial-gradient(circle at 35% 30%, #4ade80, #15803d 70%); color: #04140a; box-shadow: 0 0 24px rgb(34 197 94 / 0.6), 0 0 60px rgb(34 197 94 / 0.25); animation: orb-pulse 2.6s ease-in-out infinite; }
.kai-orb-core svg { width: 1.4rem; height: 1.4rem; }
@keyframes orb-spin { to { --orb-angle: 360deg; } }
@keyframes orb-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 24px rgb(34 197 94 / 0.6), 0 0 60px rgb(34 197 94 / 0.25); } 50% { transform: scale(1.06); box-shadow: 0 0 32px rgb(34 197 94 / 0.75), 0 0 80px rgb(34 197 94 / 0.35); } }
@media (prefers-reduced-motion: reduce) { .kai-orb-ring, .kai-orb-core { animation: none; } }

/* Ask Kai: entry buttons on Today, and a chat laid out like other AI chat apps (one typing bar, buttons inside it). */
.ask-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-snug); }
.ask-row .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-snug); }
.chat-head .row.nowrap { flex-wrap: nowrap; }
.icon-btn { display: inline-grid; place-items: center; min-width: 2.75rem; min-height: 2.75rem; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--color-text-primary); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--color-surface-sunken); }
.icon-btn:disabled { opacity: 0.45; cursor: default; }
.composer { display: flex; align-items: center; gap: var(--space-snug); padding: var(--space-hair); padding-inline-start: var(--space-snug); border: 1px solid rgb(255 255 255 / 0.1); border-radius: var(--radius-xl, 1.5rem); background: rgb(255 255 255 / 0.06); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); box-shadow: 0 12px 32px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.08); transition: border-color var(--duration-fast, 0.15s) var(--ease-standard, ease); }
.composer:focus-within { border-color: rgb(74 222 128 / 0.5); outline: none; box-shadow: 0 12px 32px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.08), 0 0 0 3px rgb(34 197 94 / 0.18); }
.composer input[type="text"] { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--color-text-primary); font: inherit; min-height: 2.75rem; padding: 0 var(--space-hair); }
.composer .mic[aria-pressed="true"] { background: var(--color-action); color: var(--color-background); }
.composer .send { background: linear-gradient(145deg, var(--color-action), #15803d); color: #04140a; box-shadow: 0 0 14px rgb(34 197 94 / 0.45); }
.composer .send:hover:not(:disabled) { filter: brightness(1.08); }
.composer .send:disabled { background: var(--color-surface-sunken); color: var(--color-text-muted); box-shadow: none; }
.popover { display: grid; gap: var(--space-snug); padding: var(--space-cosy); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-raised, 0 8px 24px rgb(0 0 0 / 0.35)); }
.popover .btn { justify-content: flex-start; display: inline-flex; align-items: center; gap: var(--space-snug); }
.assistant .composer { position: sticky; bottom: var(--space-cosy); z-index: 2; box-shadow: 0 6px 20px rgb(0 0 0 / 0.3); }
.assistant .chat { max-height: 38vh; }

/* Today: the Kai card. You: tappable profile row, goal bar, badges. Native pickers follow the theme. */
.kai-card { display: grid; gap: var(--space-cosy); padding: var(--space-comfortable); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--color-action-soft), var(--color-surface)); }
.kai-top { display: flex; align-items: center; gap: var(--space-cosy); }
.kai-top > div { display: grid; }
.kai-avatar { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--radius-full); background: var(--color-action); color: var(--color-background); flex: none; box-shadow: 0 0 18px rgb(34 197 94 / 0.55); }
.kai-desc { margin: 0; }
.kai-card .ask-row .btn { min-height: 3rem; }
.profile-row { display: flex; align-items: center; gap: var(--space-cosy); width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.profile-row .grow { flex: 1; min-width: 0; }
.profile-edit { color: var(--color-action-text); white-space: nowrap; }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-snug); }
.badge { display: grid; justify-items: center; gap: var(--space-hair); padding: var(--space-snug); border-radius: var(--radius-md); background: var(--color-surface-sunken); text-align: center; opacity: 0.5; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; outline: 1px solid var(--color-accent); }
.badge-ico { font-size: 1.6rem; line-height: 1.2; }
.links { display: grid; gap: var(--space-snug); }
.links .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-snug); }
select { accent-color: var(--color-action); }
select option { background: var(--color-surface); color: var(--color-text-primary); }
.ask-row .btn { white-space: nowrap; padding-inline: var(--space-snug); font-size: var(--text-sm); }

/* Ask Kai as a full-screen page: header, scrolling messages, typing bar at the bottom; history of chats. */
.scrim.full { align-items: stretch; justify-items: center; background: var(--color-background); }
.sheet.full { width: min(100%, 48rem); max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; box-shadow: none; }
.sheet.full .grab { display: none; }
/* The message Edit/Delete menu borrows the chat's full-height sheet but is only a couple of buttons:
   stick it to the bottom like a normal action sheet instead of leaving it stranded at the top. */
.sheet.full.msg-menu-mode { justify-content: flex-end; padding: var(--space-comfortable) var(--space-comfortable) calc(var(--space-comfortable) + env(safe-area-inset-bottom, 0px)); gap: var(--space-comfortable); }
.sheet.full.msg-menu-mode .grab { display: block; }
.chat-screen { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; }
.chat-head { position: relative; display: flex; align-items: center; gap: var(--space-cosy); padding: var(--space-cosy) var(--space-comfortable); padding-top: max(var(--space-cosy), env(safe-area-inset-top, 0px)); background: rgb(5 5 7 / 0.7); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%); z-index: 2; }
.chat-head::after { content: ""; position: absolute; inset-inline: 0; bottom: -1.25rem; height: 1.25rem; background: linear-gradient(to bottom, rgb(5 5 7 / 0.5), transparent); pointer-events: none; }
.chat-head .grow { flex: 1; min-width: 0; display: grid; }
.chat-head h2 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-comfortable); display: grid; gap: var(--space-comfortable); align-content: start; }
.chat-foot { position: relative; display: grid; gap: var(--space-snug); padding: 0 var(--space-comfortable) var(--space-cosy); padding-bottom: max(var(--space-cosy), env(safe-area-inset-bottom, 0px)); background: transparent; }
.chat-foot::before { content: ""; position: absolute; inset-inline: 0; top: -2rem; height: 2rem; background: linear-gradient(to top, var(--color-background), transparent); pointer-events: none; }
.chat-screen .popover { margin: var(--space-snug) var(--space-comfortable) 0; }
.chat-foot .popover { margin: 0; }
.chat-screen .chat { max-height: none; overflow: visible; padding: 0; }
.chat-screen .composer { position: static; box-shadow: none; }
.to-latest { position: absolute; inset-inline-end: var(--space-comfortable); bottom: 8rem; z-index: 3; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid rgb(255 255 255 / 0.12); border-radius: var(--radius-full); background: rgb(255 255 255 / 0.08); backdrop-filter: blur(16px); color: var(--color-text-primary); box-shadow: 0 6px 18px rgb(0 0 0 / 0.35); cursor: pointer; }
.to-latest[hidden] { display: none; }
.hist-row { display: flex; align-items: center; gap: var(--space-snug); border-bottom: var(--border-width) solid var(--color-border); }
.hist-open { flex: 1; min-width: 0; display: grid; gap: 2px; padding: var(--space-cosy) 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.hist-open b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .cost { display: inline-block; margin-inline-start: var(--space-snug); padding: 0 var(--space-snug); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--weight-semibold); background: var(--color-surface-sunken); color: var(--color-text-muted); }
.opt .cost.c1 { background: var(--color-success-soft, rgb(40 160 90 / 0.18)); color: var(--color-success, #4ade80); }

/* You: daily targets tiles, BMI scale, week bars. */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-snug); }
.tile { display: grid; gap: 2px; justify-items: center; padding: var(--space-cosy) var(--space-snug); border-radius: var(--radius-md); background: var(--color-surface-sunken); text-align: center; }
.tile b { font-size: var(--text-lg); font-feature-settings: var(--font-numeric-features); }
.bmi-bar { position: relative; height: 0.75rem; border-radius: var(--radius-full); background: linear-gradient(90deg, #60a5fa 0%, #60a5fa 20%, #4ade80 20%, #4ade80 50%, #fbbf24 50%, #fbbf24 73%, #f87171 73%, #f87171 100%); }
.bmi-bar i { position: absolute; top: -4px; width: 4px; height: 1.25rem; margin-inline-start: -2px; border-radius: 2px; background: var(--color-text-primary); box-shadow: 0 0 0 2px var(--color-surface); }
.bmi-scale { display: flex; justify-content: space-between; padding-top: var(--space-snug); font-feature-settings: var(--font-numeric-features); }
.weekbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-snug); align-items: end; height: 7rem; }
.wb { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: var(--space-hair); height: 100%; }
.wb i { align-self: end; width: 100%; max-width: 1.75rem; min-height: 4px; border-radius: var(--radius-sm); background: var(--color-surface-sunken); }
.wb i.ok { background: var(--color-action); }
.wb i.over { background: var(--color-warning, #fbbf24); }

/* The + button steps aside when it would cover a button in the page. */
.add-fab { transition: opacity var(--duration-fast, 150ms), transform var(--duration-fast, 150ms); }
.add-fab.away { opacity: 0; pointer-events: none; transform: scale(0.8); }
@media (max-width: 600px) { .add-fab { width: 3rem; height: 3rem; font-size: var(--text-xl); } }

/* Headings: Bricolage Grotesque at its heaviest, slightly tight, with its large-size shapes. */
h1, h2 { font-weight: var(--weight-heavy); letter-spacing: -0.015em; font-variation-settings: "opsz" 72; }
h3 { font-weight: var(--weight-bold); letter-spacing: -0.01em; }
:lang(bn) h1, :lang(bn) h2, :lang(bn) h3, :lang(hi) h1, :lang(hi) h2, :lang(hi) h3 { letter-spacing: 0; font-variation-settings: normal; }

/* Rest-day buttons and other number chips: a comfortable tap size. */
.chip[data-act="set-rest-days"] { min-width: 2.75rem; min-height: 2.75rem; }

/* The sun by day and the moon at night: on the gauge and travelling along the meal path. */
.gauge.night .sun { fill: #e6ebff; }
.path { padding-top: 1.6rem; }
.path::before { top: 2.3rem; }
.path .sky { position: absolute; top: 0; transform: translateX(-50%); color: #ffc83d; transition: inset-inline-start var(--duration-slow) var(--ease-standard); pointer-events: none; }
.path .sky.night { color: #cfd8ff; }

.gauge .eaten-dot { fill: #fff; stroke: var(--color-sun-start); stroke-width: 2; }

/* The language button is a <summary>: hide the browser's little triangle. */
.lang-pop > summary { list-style: none; }
.lang-pop > summary::-webkit-details-marker { display: none; }
.lang-pop > summary::marker { content: ''; }

.landing .proof { color: var(--hero-text-muted); margin: 0; }

/* Day, month, year: tap-to-pick buttons, styled like the other fields instead of the phone's own select list */
.dmy { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: var(--space-snug); }
.dmy-btn { min-width: 0; width: 100%; min-height: var(--size-control); border-radius: var(--radius-sm); border: var(--border-width) solid var(--color-border-strong); background: var(--color-surface-sunken); color: var(--color-text-primary); padding: 0 var(--space-comfortable); font: inherit; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmy-btn.empty { color: var(--color-text-muted); }
.dmy-list { max-height: 60vh; overflow-y: auto; }

/* Quick-reply buttons under a Kai message, and the typing bubble */
.chat .qr { display: flex; flex-wrap: wrap; gap: var(--space-snug); margin-top: var(--space-cosy); }
/* Glow hierarchy: the greeting orb (strongest, shown once) > the avatar beside every bot message
   (a steady small glow) > this typing pill (the same hue, animated, but the quietest of the three so
   it reads as "still thinking" rather than competing with the orb or the avatar). */
.msg.typing { display: flex; align-items: center; gap: var(--space-cosy); width: fit-content; padding: var(--space-snug) var(--space-cosy); background: rgb(255 255 255 / 0.05); border: 1px solid rgb(74 222 128 / 0.18); border-radius: var(--radius-lg); animation: typing-glow 2.2s ease-in-out infinite; }
.msg .dots { display: inline-flex; gap: 4px; }
.msg .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--color-action, currentColor); opacity: .35; animation: dotbounce 1s infinite ease-in-out; }
.msg .dots i:nth-child(2) { animation-delay: .15s; } .msg .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dotbounce { 0%, 80%, 100% { opacity: .25; transform: translateY(0); filter: drop-shadow(0 0 0 transparent); } 40% { opacity: 1; transform: translateY(-3px); filter: drop-shadow(0 0 4px rgb(34 197 94 / 0.8)); } }
@keyframes typing-glow { 0%, 100% { box-shadow: 0 0 0 rgb(34 197 94 / 0); } 50% { box-shadow: 0 0 14px rgb(34 197 94 / 0.2); } }
@media (prefers-reduced-motion: reduce) { .msg.typing { animation: none; } }
@media (prefers-reduced-motion: reduce) { .msg .dots i { animation: none; opacity: .6; } }

/* Between phone and desktop widths the page is a centred column, so the bottom bar and the + button follow it. */
@media (min-width: 34rem) and (max-width: 61.99rem) {
  .tabbar { inset-inline: 0; margin-inline: auto; width: min(30rem, calc(100% - 2 * var(--space-snug))); }
  .add-fab { inset-inline-end: calc(50% - 15rem + var(--space-comfortable)); }
}

/* Language button and menu */
.lang-pop { position: relative; }
.lang-pop > summary { display: inline-flex; align-items: center; gap: var(--space-snug); min-height: 2.75rem; padding: 0 var(--space-comfortable); border-radius: var(--radius-full); cursor: pointer; font-weight: var(--weight-semibold); font-size: var(--text-sm); line-height: 1; color: var(--color-text-primary); background: var(--color-surface); border: var(--border-width) solid var(--color-border-strong); user-select: none; }
.lang-pop > summary svg { width: 1.15rem; height: 1.15rem; flex: none; display: block; }
.lang-pop > summary span { display: block; line-height: 1; }
.lang-pop[open] > summary { border-color: var(--color-action); }
.landing .lang-pop > summary { color: var(--hero-text); background: rgb(255 255 255 / 0.14); border-color: transparent; }
.lang-list { position: absolute; inset-inline-end: 0; top: calc(100% + var(--space-snug)); z-index: 40; min-width: 12rem; display: grid; gap: 2px; padding: var(--space-snug); background: var(--color-background); color: var(--color-text-primary); border: var(--border-width) solid var(--color-border-strong); border-radius: var(--radius-md); box-shadow: 0 12px 32px rgb(0 0 0 / 0.35); }
.lang-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-comfortable); min-height: 2.75rem; padding: 0 var(--space-comfortable); border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; font-size: var(--text-base); text-align: start; cursor: pointer; }
.lang-item:hover, .lang-item:focus-visible { background: var(--color-surface-sunken); }
.lang-item[aria-pressed="true"] { background: var(--color-action-soft); color: var(--color-action-text); font-weight: var(--weight-bold); }
.lang-item[aria-pressed="true"]::after { content: "\2713"; }
/* The page animation gives each block its own layer; lift the block that holds the language menu so the menu opens over the text below. */
.row:has(.lang-pop) { position: relative; z-index: 30; }

/* Making your plan: a sun that fills a ring, and four steps that tick off one by one */
.making { text-align: center; padding-top: 14vh; justify-items: center; }
.make-sun { width: 9rem; height: 9rem; }
.make-sun svg { width: 100%; height: 100%; overflow: visible; }
.make-sun .ring-track { fill: none; stroke: var(--color-border); stroke-width: 6; }
.make-sun .ring { fill: none; stroke: url(#none); stroke: var(--color-sun-start); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transform: rotate(-90deg); transform-origin: 60px 60px; animation: ringfill 2.6s var(--ease-standard) forwards; }
.make-sun .core { fill: var(--color-sun-start); animation: corepulse 1.2s ease-in-out infinite; transform-origin: 60px 60px; }
.make-sun .rays path { stroke: var(--color-sun-start); stroke-width: 4; stroke-linecap: round; opacity: .8; }
.make-sun .rays { animation: spin 8s linear infinite; transform-origin: 60px 60px; }
.make-steps { list-style: none; margin: var(--space-comfortable) 0 0; padding: 0; display: grid; gap: var(--space-cosy); text-align: start; }
.make-steps li { display: flex; align-items: center; gap: var(--space-cosy); opacity: 0; transform: translateY(6px); animation: stepin .5s var(--ease-standard) forwards; animation-delay: var(--d); }
.make-steps i { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--color-action); color: var(--color-text-on-action); display: grid; place-items: center; font-style: normal; font-size: .8rem; }
@keyframes ringfill { to { stroke-dashoffset: 0; } }
@keyframes corepulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes stepin { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .make-sun .rays, .make-sun .core { animation: none; } .make-sun .ring { animation-duration: .01s; } .make-steps li { animation-duration: .01s; animation-delay: 0s; } }

/* A planned meal inside a meal card */
.planned { display: grid; gap: var(--space-snug); padding: var(--space-cosy); border-radius: var(--radius-sm); background: var(--color-surface-sunken); }
.planned p { margin: 0; }

/* On a wider page the + button sits just outside the column, not on top of the cards. */
@media (min-width: 40rem) and (max-width: 61.99rem) { .add-fab { inset-inline-end: calc(50% - 15rem - 4.25rem); } }

.add-fab.scrolling { opacity: 0; transform: scale(0.85); pointer-events: none; }

/* A row of equal choices, like the rest days: one pill, even segments */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: var(--border-width) solid var(--color-border-strong); border-radius: var(--radius-full); background: var(--color-surface-sunken); padding: 3px; }
.seg button { min-height: 2.75rem; border: 0; border-radius: var(--radius-full); background: none; color: var(--color-text-primary); font: inherit; font-weight: var(--weight-semibold); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard); }
.seg button[aria-pressed="true"] { background: var(--color-action); color: var(--color-text-on-action); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.seg button:focus-visible { outline: 2px solid var(--color-action); outline-offset: 2px; }

/* The calories a session burns, up front on the workout page */
.card.burn { display: flex; align-items: center; gap: var(--space-comfortable); }
.card.burn .burn-n { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-heavy); color: var(--color-action-text); white-space: nowrap; }
.card.burn > div { display: grid; gap: 2px; min-width: 0; }
.timer[hidden] { display: none; }

.or { display: flex; align-items: center; gap: var(--space-cosy); color: var(--color-text-muted); font-size: var(--text-sm); }
.or::before, .or::after { content: ''; flex: 1; border-top: var(--border-width) solid var(--color-border); }

.burn-inline { display: flex; align-items: center; gap: var(--space-comfortable); padding: var(--space-cosy) var(--space-comfortable); border-radius: var(--radius-sm); background: var(--color-surface-sunken); }
.burn-inline .burn-n { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-heavy); color: var(--color-action-text); white-space: nowrap; }

/* Continue with Google / Facebook: a plain white button with the brand mark, so it is recognised at a glance */
.btn.social { display: flex; align-items: center; justify-content: center; gap: var(--space-cosy); background: #ffffff; color: #1f1f1f; border: var(--border-width) solid #dadce0; font-weight: var(--weight-semibold); }
.btn.social:hover { background: #f6f7fb; }
.btn.social svg { flex: none; }

/* The landing page's three ways in: a direct Android APK, iPhone's Add to Home Screen, or just the
   website. One stacked column of equal-weight cards reads better here than three squeezed buttons,
   since each needs its own sublabel (file size, platform, "no install"). */
.get-app { display: grid; gap: var(--space-snug); margin-block: var(--space-cosy); }
.dl-btn { display: flex; align-items: center; gap: var(--space-cosy); justify-content: flex-start; text-align: start; padding: var(--space-cosy) var(--space-comfortable); min-height: 3.75rem; }
.dl-btn svg { flex: none; width: 1.6rem; height: 1.6rem; }
.dl-btn span { display: grid; gap: 0.1rem; }
.dl-btn b { font-size: var(--text-md, 1rem); }
.dl-btn small { font-weight: var(--weight-regular); opacity: 0.75; }

/* Falls back to the visual viewport height (set by JS) where the browser does not shrink the layout viewport for the keyboard. */
.sheet.full { height: var(--vvh, 100dvh); }

/* Admin dashboard: small stat tiles in a wrapping row, and a plain list of people below them. */
.astats { display: flex; flex-wrap: wrap; gap: var(--space-snug); }
.astat { display: grid; gap: 2px; padding: var(--space-cosy); border-radius: var(--radius-md); background: var(--color-surface-sunken); min-width: 6rem; flex: 1; }
.astat b { font-size: var(--text-lg); }
.plist { display: grid; gap: var(--space-snug); }
.prow { display: grid; gap: 2px; padding: var(--space-snug) 0; border-bottom: var(--border-width) solid var(--color-border); }
.prow:last-child { border-bottom: 0; }
