/* ============================================================
   styles.css — اپلیکیشن دستیار سلامت
   دیزاین سیستم: گرادیان سبز زمردی + شیشه‌ای (glassmorphism)
   موشن: ورود پله‌ای کارت‌ها، ریپل، موج آب، حلقه پیشرفت، کانفتی
   ============================================================ */

:root {
  --bg: #070d1a;
  --bg-soft: #0c1424;
  --bg-card: rgba(19, 28, 46, .72);
  --bg-card-solid: #131c2e;
  --bg-input: rgba(26, 36, 56, .85);
  --text: #eef2f8;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .28);

  --accent: #10b981;
  --accent-2: #34d399;
  --accent-deep: #059669;
  --grad-accent: linear-gradient(135deg, #34d399 0%, #10b981 45%, #059669 100%);
  --grad-accent-soft: linear-gradient(135deg, rgba(52, 211, 153, .16), rgba(5, 150, 105, .08));
  --grad-fire: linear-gradient(135deg, #fb923c, #ef4444);
  --grad-royal: linear-gradient(135deg, #818cf8, #6366f1);
  --grad-gold: linear-gradient(135deg, #fbbf24, #f59e0b);

  --bad: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --grid: rgba(148, 163, 184, .18);
  --glass-blur: blur(16px) saturate(1.3);

  --radius: 20px;
  --radius-sm: 14px;
  --shadow-lg: 0 12px 40px rgba(2, 6, 16, .5), 0 2px 8px rgba(2, 6, 16, .35);
  --shadow-accent: 0 8px 28px rgba(16, 185, 129, .3);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}
[data-theme="light"] {
  --bg: #eef2f7;
  --bg-soft: #e6ebf2;
  --bg-card: rgba(255, 255, 255, .78);
  --bg-card-solid: #ffffff;
  --bg-input: rgba(238, 242, 247, .95);
  --text: #101828;
  --muted: #5d6b82;
  --border: rgba(16, 24, 40, .09);
  --border-strong: rgba(16, 24, 40, .16);
  --grid: rgba(93, 107, 130, .18);
  --shadow-lg: 0 10px 32px rgba(16, 24, 40, .1), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-accent: 0 8px 24px rgba(16, 185, 129, .25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ---- پس‌زمینه زنده: هاله‌های گرادیانی آرام ---- */
body::before, body::after {
  content: '';
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  pointer-events: none;
}
body::before {
  width: 60vw; height: 60vw;
  top: -18vw; right: -14vw;
  background: radial-gradient(circle, rgba(16, 185, 129, .34), transparent 65%);
  animation: blobDrift 26s ease-in-out infinite alternate;
}
body::after {
  width: 55vw; height: 55vw;
  bottom: -20vw; left: -16vw;
  background: radial-gradient(circle, rgba(99, 102, 241, .26), transparent 65%);
  animation: blobDrift 34s ease-in-out infinite alternate-reverse;
}
[data-theme="light"] body::before { opacity: .35; }
[data-theme="light"] body::after { opacity: .3; }
@keyframes blobDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-6vw, 5vh) scale(1.12); }
}

body {
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  padding-bottom: 108px;
  transition: background .4s, color .4s;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------- نوار بالا ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; animation: riseIn .5s var(--ease-out) both; }
.brand .logo {
  font-size: 1.35rem;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--grad-accent);
  border-radius: 16px;
  box-shadow: var(--shadow-accent);
  animation: logoGlow 3.2s ease-in-out infinite;
}
@keyframes logoGlow {
  0%, 100% { box-shadow: 0 8px 28px rgba(16, 185, 129, .3); transform: scale(1); }
  50%      { box-shadow: 0 8px 36px rgba(16, 185, 129, .5); transform: scale(1.04); }
}
.brand h1 {
  font-size: 1.12rem; font-weight: 900;
  background: linear-gradient(90deg, var(--text), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline { font-size: .7rem; color: var(--muted); }

/* ---------------- نوار تب شناور ---------------- */
.tabbar {
  position: fixed; bottom: 14px; right: 12px; left: 12px; z-index: 60;
  display: flex;
  background: color-mix(in srgb, var(--bg-card-solid) 82%, transparent);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  padding: 7px;
  box-shadow: var(--shadow-lg);
}
.tabbar button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--muted);
  font-family: inherit; font-size: .66rem; cursor: pointer;
  padding: 7px 0 5px; border-radius: 20px;
  position: relative;
  transition: color .25s, transform .25s var(--ease-spring);
}
.tabbar button span { font-size: 1.3rem; line-height: 1; transition: transform .3s var(--ease-spring); }
.tabbar button:active span { transform: scale(.85); }
.tabbar button.active {
  color: #eafff5;
  font-weight: 700;
  background: var(--grad-accent);
  box-shadow: 0 6px 18px rgba(16, 185, 129, .4);
}
[data-theme="light"] .tabbar button.active { color: #fff; }
.tabbar button.active span { animation: tabBounce .45s var(--ease-spring); }
@keyframes tabBounce {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-7px) scale(1.18); }
  100% { transform: translateY(0) scale(1); }
}

/* ---------------- چیدمان ---------------- */
main { max-width: 560px; margin: 0 auto; padding: 18px 14px 10px; }
.tab-page { display: none; }
.tab-page.active { display: block; }
.tab-title {
  font-size: 1.08rem; font-weight: 900; margin: 8px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.tab-title::after {
  content: '';
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ---- ورود پله‌ای کارت‌ها هنگام تعویض تب ---- */
.tab-page.enter > * { animation: riseIn .5s var(--ease-out) both; }
.tab-page.enter > *:nth-child(1) { animation-delay: .02s; }
.tab-page.enter > *:nth-child(2) { animation-delay: .07s; }
.tab-page.enter > *:nth-child(3) { animation-delay: .12s; }
.tab-page.enter > *:nth-child(4) { animation-delay: .17s; }
.tab-page.enter > *:nth-child(5) { animation-delay: .22s; }
.tab-page.enter > *:nth-child(6) { animation-delay: .27s; }
.tab-page.enter > *:nth-child(7) { animation-delay: .32s; }
.tab-page.enter > *:nth-child(8) { animation-delay: .37s; }
.tab-page.enter > *:nth-child(n+9) { animation-delay: .42s; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------- کارت شیشه‌ای ---------------- */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, .35), transparent);
  opacity: .8;
}
.card h3 { font-size: .95rem; font-weight: 800; margin-bottom: 10px; }
.card-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-head-row h3 { margin-bottom: 0; }

.hint { font-size: .8rem; color: var(--muted); margin: 6px 0; }
.hint-inline { font-size: .74rem; color: var(--muted); }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-size: .85rem; padding: 10px 0; }
.linklike {
  color: var(--accent-2); font-size: .8rem; font-weight: 700; cursor: pointer;
  background: none; border: none; font-family: inherit;
  transition: transform .2s var(--ease-spring), filter .2s;
}
.linklike:hover { filter: brightness(1.15); }
.linklike:active { transform: scale(.95); }

/* ---------------- فرم ---------------- */
input, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  padding: 10px 13px;
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}
label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--muted); font-weight: 600; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.inline input { width: 80px; }
.row { display: flex; gap: 10px; margin: 10px 0; align-items: center; flex-wrap: wrap; }
.row.two > * { flex: 1; min-width: 0; }
.row.two input, .row.two select { width: 100%; }

.btn {
  position: relative; overflow: hidden;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform .15s var(--ease-spring), box-shadow .25s, filter .2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(.96); }
.btn.primary {
  background: var(--grad-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn.big { width: 100%; padding: 14px; font-size: 1rem; margin-top: 14px; letter-spacing: .2px; }
.btn.small { padding: 7px 13px; font-size: .78rem; border-radius: 11px; }
.btn.done-btn {
  background: var(--grad-accent-soft);
  color: var(--ok);
  border-color: rgba(52, 211, 153, .3);
  box-shadow: none;
}
/* افکت ریپل */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .5), transparent 70%);
  transform: scale(0);
  animation: rippleAnim .55s ease-out forwards;
  pointer-events: none;
  width: 180px; height: 180px;
  margin: -90px;
}
@keyframes rippleAnim { to { transform: scale(1); opacity: 0; } }

.icon-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 12px; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); font-size: 1rem;
  flex-shrink: 0;
  transition: transform .15s var(--ease-spring), background .2s;
}
.icon-btn:active { transform: scale(.9); background: var(--bg-input); }
.icon-btn.del { border: none; color: var(--bad); width: 30px; height: 30px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); border-radius: 20px;
  font-family: inherit; font-size: .75rem; font-weight: 600;
  padding: 7px 13px; cursor: pointer;
  transition: all .2s var(--ease-spring);
}
.chip:hover { border-color: var(--accent); color: var(--accent-2); }
.chip:active { transform: scale(.94); }

/* ---------------- آمار ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-bottom: 14px; }
.stat {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute; top: 0; right: 0; width: 100%; height: 3px;
  background: var(--grad-accent);
  opacity: 0;
  transition: opacity .3s;
}
.stat.ok::after, .stat.warn::after, .stat.bad::after { opacity: 1; }
.stat.ok::after { background: var(--grad-accent); }
.stat.warn::after { background: var(--grad-gold); }
.stat.bad::after { background: var(--grad-fire); }
.stat-label { font-size: .74rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.stat-value { font-size: 1.3rem; font-weight: 900; letter-spacing: -.2px; }
.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-value.bad { color: var(--bad); }
.stat-value.muted { color: var(--text); }
.stat-sub { font-size: .7rem; color: var(--muted); margin-top: 3px; }

.measure-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.measure {
  display: flex; justify-content: space-between;
  background: var(--bg-input); border-radius: 12px; padding: 9px 13px; font-size: .85rem;
  border: 1px solid var(--border);
  transition: transform .2s var(--ease-spring);
}
.measure:active { transform: scale(.98); }
.measure span { color: var(--muted); }
.measure b { color: var(--accent-2); }

/* ---------------- داشبورد ---------------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; padding: 4px 2px; }
.greet {
  font-size: 1.22rem; font-weight: 900;
  background: linear-gradient(90deg, var(--text) 30%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.date { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.mini-weight { text-align: left; font-size: 1.15rem; font-weight: 900; animation: riseIn .5s var(--ease-out) both; }
.mini-weight b {
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mini-weight .hint-inline { display: block; font-weight: 400; }

.water-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 10px 0; }
.water-row.small .glass { width: 40px; height: 40px; font-size: .95rem; border-radius: 12px; }
.glass {
  width: 46px; height: 46px; border-radius: 14px;
  border: 1.5px dashed var(--border-strong);
  background: var(--bg-input); cursor: pointer;
  font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s var(--ease-spring), border-color .2s, background .3s, box-shadow .3s;
  position: relative;
  overflow: hidden;
}
.glass:hover { border-color: var(--accent); }
.glass:active { transform: scale(.88); }
.glass.filled {
  background: var(--grad-accent-soft);
  border: 1.5px solid var(--accent);
  box-shadow: inset 0 0 14px rgba(16, 185, 129, .18), 0 4px 12px rgba(16, 185, 129, .18);
}
.glass.filled::after {
  content: '';
  position: absolute; bottom: -60%; left: -25%;
  width: 150%; height: 110%;
  background: rgba(52, 211, 153, .28);
  border-radius: 45%;
  animation: wave 2.6s linear infinite;
}
@keyframes wave {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.glass.filled span, .glass.filled { color: #d1fae5; }
.glass > * { position: relative; z-index: 1; }
.glass-pop { animation: popIn .4s var(--ease-spring) both !important; }
@keyframes popIn {
  0% { transform: scale(.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.water-meta { font-size: .82rem; color: var(--muted); margin: 4px 0 10px; font-weight: 600; }
.water-complete { color: var(--ok); font-weight: 800; }

.entry-list { display: flex; flex-direction: column; gap: 9px; }
.entry {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 11px 13px;
  transition: transform .2s var(--ease-spring), border-color .25s, opacity .3s;
}
.entry:active { transform: scale(.985); }
.entry .entry-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.entry b { font-size: .88rem; }
.entry-meta { font-size: .72rem; color: var(--muted); }
.entry-side { display: flex; align-items: center; gap: 8px; }
.entry-kcal { font-size: .8rem; color: var(--warn); font-weight: 800; white-space: nowrap; }
.entry.taken { opacity: .6; }
.entry.taken b { text-decoration: line-through; text-decoration-color: var(--ok); }
.entry.taken { border-color: rgba(52, 211, 153, .3); }
.med-time { width: 112px !important; padding: 5px 8px !important; font-size: .8rem !important; margin-top: 6px; }
.notif-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.today-session b { display: block; margin-bottom: 8px; color: var(--accent-2); font-size: .95rem; }
.ex-list { display: flex; flex-direction: column; gap: 8px; }
.ex-list.compact { margin: 8px 0; }
.ex {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 11px 13px;
  transition: transform .2s var(--ease-spring), border-color .2s;
}
.ex:hover { border-color: var(--border-strong); }
.ex:active { transform: scale(.985); }
.ex-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ex-head b { font-size: .88rem; }
.ex-detail {
  font-size: .8rem; font-weight: 800;
  color: var(--accent-2);
  background: var(--grad-accent-soft);
  padding: 2px 10px; border-radius: 10px; white-space: nowrap;
}
.ex-rest { font-size: .74rem; color: var(--muted); margin-top: 3px; }
.ex-tip { font-size: .74rem; color: var(--muted); margin-top: 5px; }
.day-note { font-size: .8rem; color: var(--muted); background: var(--bg-input); border-radius: 12px; padding: 9px 13px; margin-bottom: 9px; border: 1px solid var(--border); }
.rounds-note { font-size: .82rem; margin-bottom: 8px; color: var(--warn); font-weight: 700; }

.dash-kcal { display: flex; justify-content: space-around; text-align: center; margin-top: 6px; }
.dash-kcal-num { display: block; font-size: 1.35rem; font-weight: 900; }
.dash-kcal-num.ok { color: var(--ok); }
.dash-kcal-num.bad { color: var(--bad); }
.dash-kcal-num.muted { color: var(--muted); }

.tip-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.tip {
  background: var(--bg-input);
  border-right: 3px solid var(--accent);
  border-radius: 12px; padding: 10px 13px; font-size: .84rem;
  transition: transform .2s var(--ease-spring);
}
.tip:hover { transform: translateX(-3px); }
.tips-static { padding-right: 18px; font-size: .85rem; display: flex; flex-direction: column; gap: 6px; }

.disclaimer {
  font-size: .74rem; color: var(--muted); border-style: dashed;
  border: 1px dashed var(--border-strong);
  background: color-mix(in srgb, var(--warn) 5%, transparent);
}

/* ---------------- برنامه تمرینی ---------------- */
.plan-head { display: flex; flex-direction: column; gap: 10px; }
.plan-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  background: var(--grad-accent-soft);
  color: var(--accent-2);
  border: 1px solid rgba(52, 211, 153, .25);
  border-radius: 20px; font-size: .76rem; font-weight: 800; padding: 5px 13px;
}
.progression { font-size: .84rem; background: var(--bg-input); border-radius: 13px; padding: 11px 14px; border: 1px solid var(--border); }
.btn.small { align-self: flex-start; }

.day-card.today {
  border: 1.5px solid rgba(52, 211, 153, .5);
  animation: todayGlow 3s ease-in-out infinite;
}
@keyframes todayGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .0), var(--shadow-lg); }
  50%      { box-shadow: 0 0 26px 0 rgba(16, 185, 129, .16), var(--shadow-lg); }
}
.day-card.rest { opacity: .75; }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.day-head h3 { margin-bottom: 0; font-size: 1rem; }
.today-tag {
  font-size: .7rem; font-weight: 800;
  background: var(--grad-accent); color: #fff;
  border-radius: 12px; padding: 3px 11px; vertical-align: middle;
  animation: popIn .45s var(--ease-spring) both;
  box-shadow: 0 3px 10px rgba(16, 185, 129, .35);
}
.type-badge { font-size: .74rem; font-weight: 800; border-radius: 20px; padding: 5px 13px; white-space: nowrap; }
.t-strength, .t-mixed { background: rgba(129, 140, 248, .16); color: #a5b4fc; box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .25); }
.t-hiit { background: rgba(248, 113, 113, .14); color: #fca5a5; box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25); }
.t-liss { background: rgba(52, 211, 153, .14); color: var(--ok); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .25); }
.t-active { background: rgba(251, 191, 36, .14); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .25); }
.t-rest { background: var(--bg-input); color: var(--muted); }
[data-theme="light"] .t-strength, [data-theme="light"] .t-mixed { color: #4f46e5; }
[data-theme="light"] .t-hiit { color: #dc2626; }
[data-theme="light"] .t-liss { color: #059669; }
[data-theme="light"] .t-active { color: #b45309; }

.note-card ul { padding-right: 18px; font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.note-card b { display: block; margin-bottom: 6px; color: var(--text); }

/* ---------------- تغذیه ---------------- */
.kcal-hero { text-align: center; margin-bottom: 6px; }
.kcal-ring-wrap { position: relative; width: 150px; height: 150px; margin: 6px auto 10px; }
.kcal-ring-wrap svg { transform: rotate(-90deg); }
.kcal-ring-track { stroke: var(--bg-input); }
.kcal-ring-fill { stroke: url(#kcalGrad); transition: stroke-dashoffset .9s var(--ease-out); }
.kcal-ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.kcal-num { font-size: 1.6rem; font-weight: 900; line-height: 1.2; }
.kcal-num.over { color: var(--bad); }
.kcal-sub { font-size: .72rem; color: var(--muted); }
.kcal-bar { height: 10px; background: var(--bg-input); border-radius: 6px; margin: 12px 0 6px; overflow: hidden; position: relative; }
.kcal-fill { height: 100%; background: var(--grad-accent); border-radius: 6px; transition: width .9s var(--ease-out); position: relative; }
.kcal-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.kcal-left { font-size: .84rem; }
.kcal-protein { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.search-row { display: flex; gap: 8px; margin-top: 12px; }
.search-row input { flex: 1; }
.off-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.off-item {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 13px;
  color: var(--text); font-family: inherit; font-size: .8rem; cursor: pointer; text-align: right;
  transition: transform .18s var(--ease-spring), border-color .2s;
  animation: riseIn .4s var(--ease-out) both;
}
.off-item:hover { border-color: var(--accent); }
.off-item:active { transform: scale(.97); }
.off-item b { color: var(--warn); white-space: nowrap; }
.loading { color: var(--muted); font-size: .84rem; padding: 10px 0; }

/* ---------------- وزن ---------------- */
.legend { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.accent { background: var(--accent); box-shadow: 0 0 8px rgba(16, 185, 129, .6); }
.dot.goal { background: var(--warn); box-shadow: 0 0 8px rgba(245, 158, 11, .6); }

/* ---------------- پوشش و مودال ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 8, 16, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 20px 12px;
  overflow-y: auto;
}
.overlay.show { display: flex; }
.overlay.show .modal { animation: modalIn .45s var(--ease-spring) both; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(34px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 22px;
  width: 100%; max-width: 480px;
  margin-top: 3vh;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { font-size: 1.12rem; font-weight: 900; }
.modal label { margin-top: 10px; }

/* ---------------- توست ---------------- */
#toast {
  position: fixed; bottom: 104px; left: 50%;
  transform: translateX(-50%) translateY(24px) scale(.9);
  background: var(--bg-card-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 11px 20px; font-size: .84rem; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .35s var(--ease-spring);
  z-index: 200;
  max-width: 90vw;
  backdrop-filter: var(--glass-blur);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* ---------------- کانفتی ---------------- */
.confetti-wrap { position: fixed; inset: 0; pointer-events: none; z-index: 300; }
.confetti-piece {
  position: fixed;
  width: 9px; height: 9px;
  border-radius: 2.5px;
  animation: confettiFly 1s ease-out forwards;
  pointer-events: none;
}
@keyframes confettiFly {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.5); opacity: 0; }
}

/* ---------------- ریسپانسیو ---------------- */
@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .glass { width: 42px; height: 42px; }
  main { padding: 14px 10px 8px; }
  .tabbar { right: 8px; left: 8px; }
}
@media (min-width: 700px) {
  main { max-width: 640px; }
}

/* ---------------- کاهش حرکت (دسترسی‌پذیری) ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
