/* Sucha Nutrition — cream, ink and kesri, taken from the poster */
:root {
  --bg: #F4ECE4;
  --card: #FFFCF8;
  --input: #EFE5DA;
  --text: #1E1A16;
  --muted: #7A6E62;
  --dim: #A99C8F;
  --border: #E7DBCE;
  --kesri: #EE7D1A;
  --kesri-dark: #C4600A;
  --kesri-soft: #FCE7D2;
  --gold: #C9A27C;
  --good: #2E8F55;
  --good-soft: #E3F2E8;
  --protein: #3B6FD8;
  --carbs: #DE9B12;
  --fat: #D64545;
  --fat-soft: #FBE6E4;
  --shadow: 0 1px 2px rgba(60,40,20,.05), 0 4px 14px rgba(60,40,20,.05);
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-full: 9999px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.16,1,.3,1);
  --serif: 'Cinzel', Georgia, serif;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; background: var(--bg); color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
img { display: block; }

/* ── Splash ── */
.splash { position: fixed; inset: 0; z-index: 1000; background: #F3E9E0; display: flex; align-items: center; justify-content: center; transition: opacity .45s ease; }
.splash img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
@media (min-aspect-ratio: 3/4) { .splash img { width: auto; max-width: 100%; height: 100%; object-fit: contain; } }
.splash-load { position: absolute; left: 50%; bottom: calc(26px + var(--safe-bottom)); transform: translateX(-50%); width: 220px; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 16px 11px; border-radius: 16px; background: rgba(20,14,8,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; }
.splash-pct { font-family: var(--serif); font-size: 1.5rem; font-weight: 800; line-height: 1; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.splash-bar { width: 100%; height: 5px; border-radius: 5px; background: rgba(255,255,255,.25); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 0; background: var(--kesri); border-radius: 5px; }
.splash-msg { font-size: .72rem; font-weight: 600; letter-spacing: .4px; opacity: .85; }
.splash.hide { opacity: 0; pointer-events: none; }

/* ── Shell ── */
.app { display: flex; flex-direction: column; height: 100%; max-width: 480px; margin: 0 auto; position: relative; overflow: hidden; background: var(--bg); }
@media (min-width: 481px) { .app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); } }
.status-bar-spacer { height: var(--safe-top); flex-shrink: 0; background: var(--bg); }

.header { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: var(--bg); border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { width: 26px; height: 30px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1; text-align: left; }
.brand-text b { font-family: var(--serif); font-weight: 800; font-size: 1.15rem; letter-spacing: .5px; }
.brand-text small { font-size: .52rem; font-weight: 600; letter-spacing: 3.2px; color: var(--muted); margin-top: 2px; }
.rank-chip { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-full); font-size: .78rem; font-weight: 700; }
.rank-chip-xp { color: var(--kesri-dark); font-weight: 700; }

.main-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 18px 24px; -webkit-overflow-scrolling: touch; }
.main-content::-webkit-scrollbar { display: none; }
.view { display: flex; flex-direction: column; gap: 14px; }

/* ── Tab bar ── */
.tabbar { flex-shrink: 0; display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: end; padding: 6px 8px calc(6px + var(--safe-bottom)); background: var(--card); border-top: 1px solid var(--border); z-index: 30; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; color: var(--dim); font-size: .66rem; font-weight: 600; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--kesri); }
.tab-scan { justify-self: center; width: 58px; height: 58px; margin-top: -24px; border-radius: 50%; background: var(--kesri); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(238,125,26,.4); border: 4px solid var(--card); transition: transform .15s var(--ease); }
.tab-scan svg { width: 24px; height: 24px; }
.tab-scan:active { transform: scale(.92); }

/* ── Common ── */
.card, .form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.kicker { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.muted { color: var(--muted); font-size: .9rem; }
.muted-sm { color: var(--muted); font-size: .76rem; }
.section-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.link-btn { font-size: .8rem; font-weight: 700; color: var(--kesri-dark); }
.badge { font-size: .7rem; font-weight: 700; color: var(--muted); background: var(--input); padding: 3px 9px; border-radius: var(--r-full); }
.hello h2 { font-family: var(--serif); font-size: 1.55rem; font-weight: 700; letter-spacing: -.2px; line-height: 1.2; margin-top: 2px; }
.chardi { text-align: center; font-family: var(--serif); font-size: .72rem; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); padding: 6px 0 4px; }

.bar { height: 8px; background: var(--input); border-radius: var(--r-full); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: var(--r-full); transition: width .9s var(--ease); }
.kesri-fill { background: var(--kesri); }
.ink-fill { background: var(--text); }
.protein-fill { background: var(--protein); }
.carbs-fill { background: var(--carbs); }
.fat-fill { background: var(--fat); }
.bar-meta { font-size: .72rem; color: var(--muted); }

.pill-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: var(--r-full); font-size: .86rem; font-weight: 700; white-space: nowrap; transition: transform .15s var(--ease), opacity .15s; }
.pill-btn svg { width: 16px; height: 16px; }
.pill-btn:active { transform: scale(.96); }
.pill-btn:disabled { opacity: .45; }
.pill-primary { background: var(--text); color: #fff; }
.pill-kesri { background: var(--kesri); color: #fff; }
.pill-ghost { background: var(--card); border: 1px solid var(--border); }
.pill-danger { background: var(--fat-soft); color: var(--fat); }
.pill-sm { height: 30px; padding: 0 12px; font-size: .76rem; }
.pill-btn.center { align-self: center; }
.pill-btn.block { width: 100%; height: 46px; font-size: .92rem; }
.row-center { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.icon-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--input); color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.sm { width: 30px; height: 30px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 7px 12px; background: var(--input); border-radius: var(--r-full); font-size: .78rem; font-weight: 600; color: var(--text); transition: background .15s; }
.chip:active, .chip.on { background: var(--text); color: #fff; }

/* ── Home: journey ── */
.journey-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.journey-top { display: flex; gap: 14px; align-items: center; }
.journey-mascot { width: 84px; height: 108px; object-fit: cover; object-position: top; border-radius: var(--r-md); background: #EEE9E4; flex-shrink: 0; }
.journey-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.rank-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 800; line-height: 1.05; }
.rank-tag { font-size: .78rem; color: var(--muted); margin-top: -3px; }
.path-ends { display: flex; justify-content: space-between; font-family: var(--serif); font-size: .7rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.path-track { position: relative; height: 6px; border-radius: 6px; background: linear-gradient(90deg, #E2D4C6, #E2D4C6); }
.path-track i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--kesri)); transition: width .9s var(--ease); }
.path-track b { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--kesri); border: 3px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: left .9s var(--ease); }
.journey-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.journey-stats > div { display: flex; flex-direction: column; padding: 10px; background: var(--input); border-radius: var(--r-md); }
.journey-stats strong { font-size: 1.15rem; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; }
.journey-stats span { font-size: .68rem; color: var(--muted); }
.weight-goal { display: flex; flex-direction: column; gap: 6px; }
.weight-goal-head { display: flex; justify-content: space-between; font-size: .74rem; font-weight: 600; }
.weight-goal-head span:last-child { color: var(--muted); font-weight: 500; }

.scan-hero { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--text); color: #fff; border-radius: var(--r-lg); text-align: left; transition: transform .15s var(--ease); }
.scan-hero:active { transform: scale(.985); }
.scan-hero-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--kesri); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.scan-hero-icon svg { width: 23px; height: 23px; }
.scan-hero-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.scan-hero-text strong { font-size: 1rem; }
.scan-hero-text small { font-size: .78rem; opacity: .7; }
.scan-hero > svg { width: 18px; height: 18px; opacity: .6; }

.quick-ask { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-full); box-shadow: var(--shadow); }
.quick-ask img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; flex-shrink: 0; }
.quick-ask input { flex: 1; min-width: 0; height: 36px; border: none; outline: none; background: transparent; font-size: .9rem; color: var(--text); }
.quick-ask input::placeholder { color: var(--dim); }
.quick-ask button { width: 36px; height: 36px; border-radius: 50%; background: var(--text); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-ask button svg { width: 17px; height: 17px; }

.today-train { display: flex; align-items: center; gap: 12px; }
.tt-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--kesri-soft); color: var(--kesri-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tt-icon svg { width: 22px; height: 22px; }
.tt-icon.done { background: var(--good-soft); color: var(--good); }
.tt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tt-text strong { font-size: .95rem; }
.tt-text span { font-size: .76rem; color: var(--muted); }

.fuel-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.home-ring, .calorie-ring { position: relative; flex-shrink: 0; }
.home-ring { width: 108px; height: 108px; }
.calorie-ring { width: 150px; height: 150px; }
.home-ring svg, .calorie-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--input); stroke-width: 10; }
.ring-fill { fill: none; stroke: var(--kesri); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.1s var(--ease), stroke .3s; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 1.5rem; font-weight: 800; letter-spacing: -.6px; line-height: 1; }
.cal-number { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.ring-label { font-size: .64rem; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }
.fuel-stats { flex: 1; display: grid; gap: 8px; }
.fuel-stats > div { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.fuel-stats > div:last-child { border: none; padding: 0; }
.fuel-stats span { font-size: .78rem; color: var(--muted); }
.fuel-stats strong { font-size: 1rem; }
.macro-rows { display: flex; flex-direction: column; gap: 10px; }
.hm { display: grid; grid-template-columns: 54px 1fr 84px; align-items: center; gap: 10px; }
.hm-l { font-size: .78rem; font-weight: 600; }
.hm-v { font-size: .72rem; color: var(--muted); text-align: right; }
.hm-track { height: 7px; background: var(--input); border-radius: var(--r-full); overflow: hidden; }
.hm-track i { display: block; height: 100%; width: 0; border-radius: var(--r-full); transition: width .8s var(--ease); }

.meal-list { display: flex; flex-direction: column; gap: 8px; }
.meal-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); text-align: left; width: 100%; }
.meal-thumb { width: 46px; height: 46px; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: var(--input); }
.meal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.meal-details { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meal-details strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-meta { font-size: .72rem; color: var(--muted); }
.cal-badge { font-size: .74rem; font-weight: 700; color: var(--kesri-dark); background: var(--kesri-soft); padding: 4px 9px; border-radius: var(--r-full); white-space: nowrap; }
.cal-badge.junk { color: var(--fat); background: var(--fat-soft); }
.del-btn { width: 30px; height: 30px; border-radius: 50%; color: var(--dim); display: flex; align-items: center; justify-content: center; }
.del-btn svg { width: 15px; height: 15px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; text-align: center; color: var(--dim); font-size: .86rem; }
.empty-state svg { width: 30px; height: 30px; opacity: .6; }

.recent-grid { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.recent-grid::-webkit-scrollbar { display: none; }
.recent-thumb { flex: 0 0 66px; height: 66px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: var(--input); }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Train ── */
.train-head { display: flex; flex-direction: column; gap: 10px; }
.train-head h2 { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.plan-msg { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem; color: var(--muted); }
.plan-msg img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; flex-shrink: 0; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-pill { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); font-size: .68rem; font-weight: 700; color: var(--muted); }
.day-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.day-pill.train .dot { background: var(--kesri); }
.day-pill.done .dot { background: var(--good); }
.day-pill.today { border-color: var(--text); color: var(--text); }
.day-pill.sel { background: var(--text); color: #fff; border-color: var(--text); }
.day-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.day-title h3 { font-size: 1.1rem; font-weight: 800; }
.ex-list { display: flex; flex-direction: column; }
.ex { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.ex:last-child { border-bottom: none; }
.ex-check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: transparent; margin-top: 1px; transition: .15s; }
.ex-check svg { width: 16px; height: 16px; }
.ex.on .ex-check { background: var(--good); border-color: var(--good); color: #fff; }
.ex.on .ex-name { text-decoration: line-through; color: var(--muted); }
.ex-body { flex: 1; min-width: 0; }
.ex-name { font-size: .92rem; font-weight: 700; }
.ex-dose { font-size: .78rem; color: var(--kesri-dark); font-weight: 600; }
.ex-cue { font-size: .76rem; color: var(--muted); }
.weight-log { display: flex; gap: 8px; margin-top: 10px; }
.weight-log input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; background: var(--input); border: 1.5px solid transparent; border-radius: var(--r-sm); outline: none; font-size: .9rem; }
.weight-log input:focus { border-color: var(--text); background: var(--card); }
.rebuild textarea { width: 100%; min-height: 64px; padding: 10px 12px; background: var(--input); border: 1.5px solid transparent; border-radius: var(--r-sm); outline: none; resize: vertical; font-size: .88rem; margin: 8px 0 10px; }
.rebuild textarea:focus { border-color: var(--text); background: var(--card); }
.empty-plan { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px 16px; }
.empty-plan img { width: 120px; height: 150px; object-fit: cover; object-position: top; border-radius: var(--r-md); }

/* ── Coach ── */
.view-coach { min-height: 100%; }
.coach-head { display: flex; align-items: center; gap: 12px; }
.coach-head img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; border: 2px solid var(--kesri); }
.coach-head div { flex: 1; display: flex; flex-direction: column; }
.coach-head strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 800; }
.coach-head span { font-size: .78rem; color: var(--muted); }
.coach-thread { flex: 1; padding: 4px 0; }
.coach-dock { position: sticky; bottom: -24px; margin: 0 -18px -24px; padding: 10px 18px 14px; background: linear-gradient(transparent, var(--bg) 18%); display: flex; flex-direction: column; gap: 10px; }

.chat-head { margin-bottom: 12px; }
.chat-head strong { display: block; font-size: .95rem; }
.chat-head span { font-size: .78rem; color: var(--muted); }
.chat-thread { display: flex; flex-direction: column; gap: 8px; }
#chatThread:not(:empty) { margin-bottom: 12px; }
#chatThread + .chips { margin-bottom: 12px; }
.bubble { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: .88rem; line-height: 1.45; white-space: pre-wrap; user-select: text; }
.bubble.user { align-self: flex-end; background: var(--text); color: #fff; border-bottom-right-radius: 5px; }
.bubble.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
#chatThread .bubble.ai { background: var(--input); border: none; }
.bubble.typing { color: var(--dim); }
.bubble.error { background: var(--fat-soft); color: var(--fat); border: none; }
.bubble.update { background: var(--good-soft); color: var(--good); font-weight: 600; font-size: .8rem; border: none; }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; background: var(--input); border: 1.5px solid transparent; border-radius: var(--r-md); color: var(--text); font-size: .9rem; outline: none; }
.coach-dock .ask-form input { background: var(--card); border-color: var(--border); }
.ask-form input:focus { border-color: var(--text); background: var(--card); }
.ask-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--r-md); background: var(--text); color: #fff; display: flex; align-items: center; justify-content: center; }
.ask-btn svg { width: 18px; height: 18px; }
.ask-btn:disabled { opacity: .4; }

/* ── Me ── */
.form-card { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 10px; }
.field label { font-size: .72rem; font-weight: 600; color: var(--muted); }
.field input, .field select { height: 42px; padding: 0 12px; background: var(--input); border: 1.5px solid transparent; border-radius: var(--r-sm); color: var(--text); font-size: .92rem; outline: none; width: 100%; appearance: none; -webkit-appearance: none; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A99C8F' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.field input:focus, .field select:focus { border-color: var(--text); background-color: var(--card); }
.target-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--kesri-soft); border-radius: var(--r-md); font-size: .78rem; color: var(--kesri-dark); }
.target-card strong { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.target-card small { color: var(--muted); font-size: .76rem; }
.me-actions { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.row-btn { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; font-weight: 600; text-align: left; }
.row-btn:last-child { border-bottom: none; }
.row-btn span { flex: 1; }
.row-btn svg { width: 18px; height: 18px; color: var(--muted); }
.row-btn.danger, .row-btn.danger svg { color: var(--fat); }

/* ── Scan flow ── */
.back-btn { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; font-size: .84rem; font-weight: 700; color: var(--muted); margin: -4px 0 -4px -6px; }
.back-btn svg { width: 18px; height: 18px; }
.preview-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.preview-image-wrap { position: relative; aspect-ratio: 4/3; background: #000; overflow: hidden; }
.preview-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.analyzing-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.15); }
.scan-laser { position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, #FFA24A, transparent); box-shadow: 0 0 14px #FF9A3C, 0 0 30px #FF9A3C; animation: laser 2s ease-in-out infinite; }
@keyframes laser { 0%,100% { top: 8%; } 50% { top: 92%; } }
.scan-reticle { position: absolute; inset: 14%; }
.reticle-corner { position: absolute; width: 26px; height: 26px; border: 3px solid #fff; border-radius: 4px; }
.reticle-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.reticle-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.reticle-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.reticle-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; }
.preview-status { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.status-spinner { width: 22px; height: 22px; flex-shrink: 0; border: 2.5px solid var(--border); border-top-color: var(--kesri); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-texts { display: flex; flex-direction: column; }
.status-texts strong { font-size: .92rem; }
.status-texts span { font-size: .78rem; color: var(--muted); }

.result-image-card { aspect-ratio: 16/10; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: var(--input); }
.result-image-card img { width: 100%; height: 100%; object-fit: cover; }
.junk-banner { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--fat-soft); border: 1px solid #F3C9C4; border-radius: var(--r-lg); }
.junk-banner img { width: 52px; height: 60px; object-fit: cover; object-position: top; border-radius: 10px; flex-shrink: 0; }
.junk-banner strong { font-family: var(--serif); color: var(--fat); font-size: .95rem; letter-spacing: .5px; }
.junk-banner p { font-size: .84rem; color: #7B2A22; }
.dietary-tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dietary-tags-row:empty { display: none; }
.diet-tag { padding: 4px 11px; background: var(--kesri-soft); color: var(--kesri-dark); border-radius: var(--r-full); font-size: .73rem; font-weight: 600; }
.meal-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.portion-val { font-size: .8rem; font-weight: 700; color: var(--kesri-dark); }
.portion-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; background: var(--input); border-radius: var(--r-md); }
.portion-chip { padding: 9px 2px; border-radius: 10px; font-size: .78rem; font-weight: 700; color: var(--muted); transition: .2s var(--ease); }
.portion-chip.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(60,40,20,.15); }
.calorie-display { display: flex; justify-content: center; margin-bottom: 16px; }
.macro-bar-track { display: flex; height: 8px; border-radius: var(--r-full); overflow: hidden; background: var(--input); gap: 2px; }
.bar-segment { height: 100%; width: 0; transition: width .8s var(--ease); }
.macro-bar-legend { display: flex; justify-content: space-between; margin: 8px 0 14px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--muted); }
.legend-item .dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-item strong { color: var(--text); }
.macros-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.macro-pill { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: var(--r-md); text-align: center; }
.macro-pill.protein { background: #E8EFFC; color: var(--protein); }
.macro-pill.carbs { background: #FCF1DA; color: #B57E08; }
.macro-pill.fat { background: var(--fat-soft); color: var(--fat); }
.macro-label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.macro-value { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1.25; }
.macro-cals { font-size: .68rem; color: var(--muted); }
.secondary-grid { display: flex; align-items: center; justify-content: space-around; padding-top: 14px; border-top: 1px solid var(--border); }
.micro-stat { display: flex; flex-direction: column; align-items: center; }
.micro-label { font-size: .68rem; color: var(--dim); }
.micro-val { font-size: .95rem; }
.micro-divider { width: 1px; height: 28px; background: var(--border); }
.insight-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.insight-stats > div { display: flex; flex-direction: column; padding: 10px; background: var(--input); border-radius: var(--r-md); }
.insight-stats strong { font-size: 1.15rem; font-weight: 800; }
.insight-stats span { font-size: .68rem; color: var(--muted); line-height: 1.25; }
.insight-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.insight-list:empty { display: none; }
.insight-list li { position: relative; padding-left: 16px; font-size: .86rem; line-height: 1.4; }
.insight-list li::before { content: ''; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.insight-list li.good::before { background: var(--good); }
.insight-list li.watch::before { background: var(--kesri); }
.improve-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.improve-item:first-child { padding-top: 0; }
.improve-item:last-child { border-bottom: none; padding-bottom: 0; }
.improve-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.improve-text { display: flex; flex-direction: column; min-width: 0; }
.improve-text strong { font-size: .9rem; }
.improve-text span { font-size: .78rem; color: var(--muted); }
.recipe { margin-top: 12px; padding: 14px; background: var(--input); border-radius: var(--r-md); font-size: .84rem; user-select: text; }
.recipe h4 { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 10px 0 4px; }
.recipe h4:first-of-type { margin-top: 0; }
.recipe ul, .recipe ol { padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.recipe-time { float: right; font-size: .72rem; font-weight: 600; color: var(--muted); }
.recipe-result { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--kesri-dark); font-weight: 600; font-size: .8rem; }
.recipe-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.recipe-error { color: var(--fat); }
.items-list { display: flex; flex-direction: column; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.item-row:first-child { padding-top: 0; }
.item-row:last-child { border-bottom: none; padding-bottom: 0; }
.item-info { min-width: 0; }
.item-name { font-size: .9rem; font-weight: 700; }
.item-portion { font-size: .76rem; color: var(--muted); }
.item-macros-mini { display: flex; gap: 10px; margin-top: 2px; font-size: .7rem; color: var(--dim); font-weight: 600; }
.mini-macro.p span { color: var(--protein); }
.mini-macro.c span { color: #B57E08; }
.mini-macro.f span { color: var(--fat); }
.item-cals { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.tip-card { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--kesri-soft); border-radius: var(--r-lg); }
.tip-card img { width: 48px; height: 56px; object-fit: cover; object-position: top; border-radius: 10px; flex-shrink: 0; }
.tip-card strong { font-size: .8rem; color: var(--kesri-dark); }
.tip-card p { font-size: .86rem; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding-bottom: 6px; }
.error-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 26px 20px; }
.error-card img { width: 96px; height: 120px; object-fit: cover; object-position: top; border-radius: var(--r-md); margin-bottom: 4px; }
.error-card h3 { font-family: var(--serif); font-size: 1.15rem; }
.error-card .row-center { margin-top: 8px; }

/* ── Drawers ── */
.drawer { position: absolute; inset: 0; background: var(--bg); z-index: 50; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .32s var(--ease); padding: calc(14px + var(--safe-top)) 18px calc(18px + var(--safe-bottom)); }
.drawer.open { transform: none; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; }
.drawer-header h2 { font-family: var(--serif); font-size: 1.35rem; }
.drawer-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.drawer-body::-webkit-scrollbar { display: none; }
.drawer-body > .pill-btn { align-self: center; }
.daily-stat-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.daily-stat-big { font-size: 2rem; font-weight: 800; letter-spacing: -1px; }
.daily-pct { width: 56px; height: 56px; border-radius: 50%; background: var(--kesri-soft); color: var(--kesri-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; }

/* ── Onboarding ── */
.onboard { position: fixed; inset: 0; z-index: 500; background: var(--bg); display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; }
.ob-top { display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--safe-top)) 18px 8px; }
.ob-back { width: 34px; height: 34px; border-radius: 50%; background: var(--input); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ob-back svg { width: 18px; height: 18px; }
.ob-back.invisible { visibility: hidden; }
.ob-progress { flex: 1; height: 6px; background: var(--input); border-radius: 6px; overflow: hidden; }
.ob-progress i { display: block; height: 100%; width: 0; background: var(--kesri); border-radius: 6px; transition: width .4s var(--ease); }
.ob-body { flex: 1; overflow-y: auto; padding: 10px 22px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; animation: obIn .35s var(--ease); }
@keyframes obIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ob-logo { width: 200px; align-self: center; }
.ob-hero { width: 100%; max-height: 300px; object-fit: cover; object-position: top; border-radius: var(--r-lg); background: #EEE9E4; }
.ob-hero.sm { max-height: 200px; width: 160px; align-self: center; }
.ob-body h1 { font-family: var(--serif); font-size: 1.75rem; font-weight: 800; line-height: 1.15; }
.ob-body h1 em { font-style: normal; color: var(--kesri); }
.ob-body p.lead { color: var(--muted); font-size: .95rem; }
.ob-count { font-size: .74rem; font-weight: 700; color: var(--kesri-dark); text-transform: uppercase; letter-spacing: .8px; }
.ob-q { font-size: 1.25rem; font-weight: 800; line-height: 1.3; }
.ob-options { display: flex; flex-direction: column; gap: 9px; }
.ob-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: var(--card); border: 1.5px solid var(--border); border-radius: var(--r-md); text-align: left; font-size: .94rem; font-weight: 600; transition: transform .12s var(--ease), border-color .15s; }
.ob-opt:active { transform: scale(.985); }
.ob-opt.on { border-color: var(--text); background: var(--text); color: #fff; }
.ob-opt img { width: 54px; height: 64px; object-fit: cover; object-position: top; border-radius: 10px; flex-shrink: 0; }
.ob-opt .opt-text { display: flex; flex-direction: column; }
.ob-opt .opt-text small { font-size: .78rem; font-weight: 500; opacity: .7; }
.ob-spacer { flex: 1; }
.ob-cta { width: 100%; height: 50px; border-radius: var(--r-full); background: var(--text); color: #fff; font-size: .98rem; font-weight: 700; transition: transform .15s var(--ease), opacity .15s; }
.ob-cta.kesri { background: var(--kesri); }
.ob-cta:disabled { opacity: .35; }
.ob-cta:active { transform: scale(.98); }
.ob-skip { align-self: center; font-size: .86rem; font-weight: 600; color: var(--muted); padding: 6px; }
.ob-meter { display: flex; flex-direction: column; gap: 8px; }
.ob-meter .big { font-family: var(--serif); font-size: 3rem; font-weight: 800; line-height: 1; color: var(--kesri); }
.ob-meter .bar { height: 12px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 56px; height: 40px; border-radius: var(--r-sm); background: var(--card); border: 1.5px solid var(--border); font-size: .86rem; font-weight: 700; }
.seg button.on { background: var(--text); color: #fff; border-color: var(--text); }
.ob-label { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: -8px; }
.ob-err { color: var(--fat); font-size: .82rem; font-weight: 600; }
.plan-preview { display: flex; flex-direction: column; gap: 6px; }
.plan-preview div { display: flex; justify-content: space-between; padding: 9px 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: .86rem; }
.plan-preview div span:first-child { font-weight: 700; }
.plan-preview div span:last-child { color: var(--muted); }
.plan-preview div.rest span:last-child { color: var(--dim); }
.ob-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding-top: 10px; }

/* ── Video popup ── */
.video-pop { position: fixed; inset: 0; z-index: 800; background: rgba(20,14,8,.75); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.video-card { width: 100%; max-width: 320px; background: var(--card); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; animation: pop .35s var(--ease); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.video-wrap { position: relative; width: 100%; aspect-ratio: 480/800; max-height: 56vh; border-radius: var(--r-md); overflow: hidden; background: #000; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.sound-btn { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-full); background: rgba(0,0,0,.7); color: #fff; font-size: .8rem; font-weight: 700; }
.sound-btn svg { width: 16px; height: 16px; }
.video-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 800; color: var(--fat); letter-spacing: 1px; }
.video-roast { font-size: .9rem; color: var(--muted); }
.video-roast:empty { display: none; }
.video-card .pill-btn { width: 100%; height: 44px; }

/* ── AKAAL burst ── */
.akaal { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(244,236,228,.94); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; text-align: center; padding: 24px; }
.akaal.show { opacity: 1; visibility: visible; }
.akaal img { width: 170px; height: 210px; object-fit: cover; object-position: top; border-radius: var(--r-lg); transform: scale(.8); transition: transform .5s var(--ease); }
.akaal.show img { transform: scale(1); }
.akaal strong { font-family: var(--serif); font-size: 2.6rem; font-weight: 800; color: var(--kesri); letter-spacing: 1px; transform: scale(.6); transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
.akaal.show strong { transform: scale(1); }
.akaal span { font-size: .95rem; font-weight: 600; color: var(--text); max-width: 280px; }

/* ── Modal & toast ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30,20,10,.45); z-index: 600; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal-card { width: 100%; max-width: 360px; background: var(--card); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 50px rgba(30,20,10,.25); }
.modal-header { display: flex; align-items: center; gap: 12px; }
.modal-header img { width: 40px; height: 40px; border-radius: 10px; }
.modal-header h3 { flex: 1; font-size: 1rem; font-weight: 800; line-height: 1.25; }
.install-steps { display: flex; flex-direction: column; gap: 12px; }
.install-step { display: flex; gap: 12px; }
.step-num { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; background: var(--kesri); color: #fff; font-size: .78rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step-text { display: flex; flex-direction: column; }
.step-text strong { font-size: .88rem; }
.step-text span { font-size: .78rem; color: var(--muted); }
.toast-pill { position: fixed; bottom: calc(96px + var(--safe-bottom)); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff; padding: 10px 18px; border-radius: var(--r-full); display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 600; box-shadow: 0 10px 25px rgba(30,20,10,.25); z-index: 950; opacity: 0; visibility: hidden; pointer-events: none; transition: transform .25s var(--ease), opacity .25s; max-width: calc(100% - 32px); }
.toast-pill svg { width: 16px; height: 16px; color: var(--kesri); flex-shrink: 0; }
.toast-pill.show { transform: translateX(-50%); opacity: 1; visibility: visible; }

.bubble.ai.shame { background: var(--fat-soft); border-color: #F3C9C4; color: #7B2A22; }
.bubble.ai.praise { background: var(--kesri-soft); border-color: #F6D2AE; }
