/* =========================================================================
 * styles.css — نظام التصميم البصري
 * الطابع: مزيج من Fitbod (خلفية شبه سوداء، بطاقات جريئة، أرقام كبيرة)
 *          و MacroFactor (حلقة سعرات، أشرطة ماكروز، عناصر تحكّم مقطّعة نظيفة).
 * متوافق مع Human Interface Guidelines لآبل، داكن افتراضياً مع دعم الوضع الفاتح.
 *
 * الفهرس:
 *   1. الرموز (Design Tokens) + الوضع الفاتح
 *   2. إعادة الضبط والأساسيات
 *   3. تخطيط الشاشة + شريط التطبيق العلوي
 *   4. البطاقات
 *   5. حلقة السعرات + أشرطة الماكروز
 *   6. القوائم والصفوف (وجبات / تمارين / تمرين واحد)
 *   7. الأزرار وعناصر التحكّم المقطّعة والشارات
 *   8. مجموعات التمارين (Sets)
 *   9. نماذج المصادقة
 *  10. شريط التنقّل السفلي
 *  11. النافذة المنبثقة السفلية + Toast
 *  12. الهياكل العظمية (Skeletons) + مساعدات
 * ========================================================================= */

/* ===== 1. الرموز ========================================================= */
:root {
  /* أسطح */
  --bg:        #0b0d12;
  --bg-elev:   #14171f;
  --bg-elev-2: #1b202b;
  --bg-input:  #1f2634;
  --line:      #272e3c;
  --line-soft: #1e242f;

  /* نصوص */
  --text:      #f5f7fb;
  --text-dim:  #9aa4b8;
  --text-mute: #626e85;

  /* الهوية */
  --accent:       #4c8dff;
  --accent-press: #3a78e6;
  --accent-soft:  rgba(76, 141, 255, 0.14);
  --on-accent:    #ffffff;

  /* دلالات */
  --green: #34d399;
  --amber: #fbbf24;
  --red:   #f87171;

  /* ماكروز */
  --carb:    #5aa9ff;
  --protein: #f472b6;
  --fat:     #fbbf24;

  /* أبعاد */
  --radius:    18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --pad:       16px;
  --tabbar-h:  60px;
  --shadow:    0 10px 34px rgba(0, 0, 0, 0.38);

  /* المناطق الآمنة في آيفون */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

/* الوضع الفاتح — إعادة تعيين الرموز فقط */
@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f4f6fa;
    --bg-elev:   #ffffff;
    --bg-elev-2: #eef1f6;
    --bg-input:  #eef1f6;
    --line:      #e2e6ee;
    --line-soft: #edf0f5;

    --text:      #10131a;
    --text-dim:  #5c6678;
    --text-mute: #8a94a6;

    --accent-soft: rgba(76, 141, 255, 0.12);
    --shadow: 0 10px 30px rgba(19, 30, 56, 0.10);

    color-scheme: light;
  }
}

/* ===== 2. إعادة الضبط =================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic",
               "Segoe UI", "Cairo", "Tajawal", system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-inline: var(--safe-left) var(--safe-right);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.02em; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* مؤشر الإقلاع */
.boot { display: grid; place-items: center; min-height: 100dvh; }
.boot__spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 3. تخطيط الشاشة + الشريط العلوي ================================= */
.screen {
  max-width: 640px;
  margin-inline: auto;
  padding: calc(var(--safe-top) + 14px) var(--pad) 28px;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.appbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.appbar__titles { min-width: 0; flex: 1; }
.appbar__eyebrow { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.appbar__title { font-size: clamp(22px, 6.5vw, 28px); font-weight: 800; margin-top: 2px; overflow-wrap: anywhere; }
.appbar__sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; overflow-wrap: anywhere; }
.appbar__action {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 18px;
}

.section-label {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  letter-spacing: .07em; text-transform: uppercase;
  margin: 22px 2px 10px;
}

/* ===== 4. البطاقات ==================================================== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 14px;
}
.card--tap { transition: transform .1s ease, background .15s ease; }
.card--tap:active { transform: scale(.985); background: var(--bg-elev-2); }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card__title { font-size: 13px; font-weight: 700; color: var(--text-dim); letter-spacing: .05em; text-transform: uppercase; }

.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 14px;
}
.stat__num { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__lbl { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.big-num { font-size: 42px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* ===== 5. حلقة السعرات + الماكروز ==================================== */
.calorie {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 18px;
  align-items: center;
}
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { stroke: var(--bg-elev-2); }
.ring__fill  { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.22,1,.36,1); }
.ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__num { font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring__lbl { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.macros { display: grid; gap: 13px; }
.macro { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; font-size: 13px; }
.macro__name { font-weight: 600; }
.macro__val { color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.macro__bar { grid-column: 1 / -1; height: 6px; margin-top: 4px; border-radius: 3px; background: var(--bg-elev-2); overflow: hidden; }
.macro__bar > i { display: block; height: 100%; border-radius: 3px; transition: width .6s ease; }
.macro--carb    .macro__bar > i { background: var(--carb); }
.macro--protein .macro__bar > i { background: var(--protein); }
.macro--fat     .macro__bar > i { background: var(--fat); }

/* ===== 6. القوائم والصفوف =========================================== */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line-soft);
  text-align: start; width: 100%;
}
.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: none; padding-bottom: 0; }
.row__ico {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--bg-elev-2); display: grid; place-items: center; font-size: 19px;
}
.row__body { flex: 1; min-width: 0; }
.row__name { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { display: block; font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.row__val { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; }
.row__val small { display: block; font-weight: 500; font-size: 11px; color: var(--text-mute); }
.row__chevron { color: var(--text-mute); font-size: 17px; flex: none; }
.row__chevron::after { content: "‹"; }
:root[dir="ltr"] .row__chevron::after { content: "›"; }

.card-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: start; }

.day-card { display: flex; align-items: center; gap: 14px; }
.day-card__date { display: flex; flex-direction: column; align-items: center; text-align: center; flex: none; width: 44px; }
.day-card__dow { display: block; font-size: 11px; color: var(--text-dim); }
.day-card__dnum { display: block; font-size: 19px; font-weight: 800; line-height: 1.1; }
.day-card__info { flex: 1; min-width: 0; }
.day-card__name { font-weight: 700; font-size: 15px; }
.day-card__meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ===== 7. أزرار + تحكّم مقطّع + شارات ============================== */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 15px;
  transition: transform .1s ease, background .15s ease;
}
.btn:active { transform: scale(.98); background: var(--accent-press); }
.btn:disabled { opacity: .5; }
.btn--ghost { background: var(--bg-elev-2); color: var(--text); }
.btn--outline { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn--sm { width: auto; padding: 9px 15px; font-size: 13px; border-radius: var(--radius-sm); }
.btn + .btn { margin-top: 10px; }

.segment {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 2px; padding: 3px; border-radius: var(--radius-sm);
  background: var(--bg-elev-2); border: 1px solid var(--line);
  margin-bottom: 16px;
}
.segment button {
  padding: 8px 6px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); transition: background .15s ease, color .15s ease;
}
.segment button[aria-selected="true"] { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.chip--done   { background: rgba(52,211,153,.16); color: var(--green); }
.chip--muted  { background: var(--bg-elev-2); color: var(--text-dim); }
.chip--warn   { background: rgba(251,191,36,.16); color: var(--amber); }

.offline-bar {
  position: sticky; top: 0; z-index: 15;
  padding: calc(var(--safe-top) + 6px) 12px 6px;
  background: var(--amber); color: #241a00;
  font-size: 12px; font-weight: 700; text-align: center;
}

.update-bar {
  position: fixed; inset-inline: 0; z-index: 50;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px; border: none;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700;
  animation: slideUp .25s ease;
}
.update-bar__cta { text-decoration: underline; }

/* ===== 8. مجموعات التمارين ========================================= */
.exercise { margin-bottom: 16px; }
.exercise:last-child { margin-bottom: 0; }
.exercise__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.exercise__name { font-weight: 700; font-size: 16px; }
.exercise__target { font-size: 12px; color: var(--text-dim); }
.set-grid {
  display: grid;
  grid-template-columns: 26px 1fr 1fr 46px;
  gap: 8px; align-items: center;
  border-radius: 12px; padding: 3px;
  transition: background .18s ease;
}
.set-grid + .set-grid { margin-top: 6px; }
.set-grid--head { padding-bottom: 2px; }
.set-grid--done { background: rgba(52, 211, 153, .10); }
.set-grid__head { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.set-idx { text-align: center; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.set-cell input {
  width: 100%; text-align: center; padding: 11px 2px;
  border-radius: var(--radius-sm); background: var(--bg-input);
  border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.set-cell input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.set-check {
  width: 46px; height: 42px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-input);
  display: grid; place-items: center; font-size: 16px; color: var(--text-mute);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.set-check[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #04231a; }
.set-check--pop { animation: setpop .3s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes setpop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }

/* ===== 9. المصادقة ================================================= */
.auth {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 400px; margin-inline: auto;
  padding: 40px 22px calc(40px + var(--safe-bottom));
}
.auth__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth__brand { font-size: 32px; font-weight: 900; letter-spacing: -0.03em; }
.auth__tag { color: var(--text-dim); margin: 8px 0 28px; }

/* زر تبديل اللغة */
.lang-toggle {
  flex: none;
  padding: 7px 13px; border-radius: 999px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  color: var(--text); font-size: 13px; font-weight: 600;
}
.lang-toggle:active { transform: scale(.97); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 14px; border-radius: var(--radius-md);
  background: var(--bg-elev); border: 1px solid var(--line);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth__error { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* حقول مشتركة (تُستخدم في نوافذ التغذية أيضاً) */
.field select {
  width: 100%; padding: 14px; border-radius: var(--radius-md);
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--text);
  appearance: none;
}
.field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field-label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.sheet-back { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.auth__switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-dim); }
.auth__switch button { color: var(--accent); font-weight: 700; }

/* ===== 10. شريط التنقّل السفلي ==================================== */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  /* خلفية معتمة + طبقة GPU: يمنع "قفز" الشريط أثناء التمرير على iOS standalone
     (backdrop-filter على عنصر fixed هو سبب المشكلة، فتُركت خلفية صلبة) */
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  transform: translateZ(0);
}
.tabbar__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-mute);
  transition: color .15s ease;
}
.tabbar__btn.is-active { color: var(--accent); }
.tabbar__ico { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: .75; transition: none; }
.tabbar__btn.is-active .tabbar__ico { filter: none; opacity: 1; }
.tabbar__lbl { font-size: 10px; font-weight: 600; }

/* ===== 11. النافذة المنبثقة + Toast ============================== */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fade .2s ease; }
.sheet__panel {
  position: relative; width: 100%; max-width: 640px; margin-inline: auto;
  background: var(--bg-elev); border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 8px var(--pad) calc(20px + var(--safe-bottom));
  max-height: 88dvh; overflow-y: auto;
  animation: slideUp .3s cubic-bezier(.22,1,.36,1);
}
.sheet__panel::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 6px auto 14px;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet__title { font-size: 19px; font-weight: 800; margin-bottom: 16px; }

.toast {
  position: fixed; inset-inline: 0; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  margin-inline: auto; width: max-content; max-width: 88%;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== 11b. المجسّم التفاعلي ================================== */
.anatomy { display: grid; gap: 10px; }
.anatomy .segment { margin-bottom: 2px; }
.bodymap {
  width: 100%; max-width: 270px; height: auto;
  margin-inline: auto; display: block;
}
.bodymap .base { fill: var(--bg-elev-2); }
.bodymap line { stroke: var(--line); stroke-width: 1.5; fill: none; }
.bodymap .muscle {
  fill: var(--bg-input); stroke: var(--line); stroke-width: 1;
  cursor: pointer; transition: fill .15s ease, stroke .15s ease;
}
.bodymap .muscle:hover { fill: color-mix(in srgb, var(--accent) 32%, var(--bg-input)); }
.bodymap .muscle.is-active { fill: var(--accent); stroke: var(--accent); }
.anatomy__hint { font-size: 12px; margin-top: 2px; }

/* ===== 11c. رسوم التمارين التوضيحية ========================== */
.ex-media {
  background: var(--bg-elev-2); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 10px; margin-bottom: 12px;
}
.ex-illus { width: 100%; max-width: 240px; height: auto; margin-inline: auto; display: block; }
.ex-illus .ex-l { stroke: var(--text); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ex-illus .ex-j { fill: var(--text); }
.ex-illus .ex-b { stroke: var(--text-mute); stroke-width: 3; }
.ex-illus .ex-w { fill: var(--accent); }
.ex-illus .ex-arrow { stroke: var(--accent); stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.ex-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-tips { margin: 0 0 16px; padding-inline-start: 22px; display: grid; gap: 9px; font-size: 14px; }
.ex-tips li { line-height: 1.55; }

/* ===== 12. الهياكل + مساعدات ==================================== */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--bg-elev) 30%, var(--bg-elev-2) 50%, var(--bg-elev) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.stack > * + * { margin-top: 10px; }
.muted { color: var(--text-dim); }
.center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--text-dim); padding: 40px 12px; font-size: 14px; }

/* بطاقة تذكير */
.nudge-card {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  border-color: color-mix(in srgb, var(--amber) 40%, var(--line));
  background: color-mix(in srgb, var(--amber) 8%, var(--bg-elev));
}
.nudge-card__text { flex: 1; font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.nudge-card__x { flex: none; color: var(--text-mute); font-size: 14px; padding: 4px 6px; }

/* الرسوم البيانية */
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-lbl { fill: var(--text-mute); font-size: 9px; }
.progress-stat { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.progress-stat .big-num { font-size: 32px; }

/* مصنّف الوجبات (Teachable) */
.vision-loader { display: grid; place-items: center; gap: 12px; padding: 30px 12px; text-align: center; }
.vision-loader .muted { font-size: 13px; }
.vision-count { font-size: 14px; margin-bottom: 10px; }
.vision-count b { font-size: 22px; font-variant-numeric: tabular-nums; }
.vision-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.vision-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.vision-thumb-wrap { position: relative; padding: 0; border: none; background: none; line-height: 0; }
.vision-thumb-x {
  position: absolute; top: -4px; inset-inline-end: -4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 10px;
  display: grid; place-items: center; line-height: 1;
}
.vision-form { margin-top: 12px; }
.vision-preview { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--radius-md); margin-bottom: 12px; }
.vision-result { font-size: 15px; margin-bottom: 12px; }
.vision-result b { color: var(--accent); }
.qty-step { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 14px; }
.qty-step button { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-elev-2); border: 1px solid var(--line); font-size: 20px; font-weight: 700; }
.qty-step span { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 80px; text-align: center; }
label.btn { position: relative; overflow: hidden; }

/* شاشة القفل (بصمة/وجه) */
.lockscreen {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  max-width: 340px; margin-inline: auto;
  padding: 32px 22px calc(32px + var(--safe-bottom));
}
.lockscreen__icon { font-size: 52px; }
.lockscreen__title { font-size: 22px; font-weight: 800; }
.lockscreen__hint { color: var(--text-dim); font-size: 14px; margin-bottom: 10px; }
.lockscreen .btn { width: 100%; }

/* بطاقة تثبيت التطبيق */
.install-card {
  margin-top: 20px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 14px;
  display: grid; gap: 10px;
}
.install-card__body { display: grid; gap: 3px; }
.install-card__body strong { font-size: 15px; }
.install-card__body span { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.install-card__actions { display: flex; gap: 8px; }
.install-card__actions .btn { flex: 1; }

/* ===== 13. لمسات تحفيزية ======================================= */
.motivate-banner {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius-md);
  padding: 12px 14px; margin-bottom: 14px;
  font-size: 13.5px; font-weight: 600; line-height: 1.5;
  animation: fade .3s ease;
}
.motivate-banner__spark { font-size: 18px; flex: none; animation: flicker 2.6s ease-in-out infinite; }
@keyframes flicker { 0%,100% { transform: scale(1) rotate(-4deg); } 50% { transform: scale(1.14) rotate(4deg); } }

/* شريط تقدّم التمرين */
.wk-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.wk-progress__bar { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-elev-2); overflow: hidden; }
.wk-progress__bar > i { display: block; height: 100%; border-radius: 4px; background: var(--green); transition: width .35s cubic-bezier(.22,1,.36,1); }
.wk-progress__label { font-size: 12px; font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

.btn--ready { animation: readypulse 1.6s ease-in-out infinite; }
@keyframes readypulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(76,141,255,.45); }
  50% { box-shadow: 0 0 0 8px rgba(76,141,255,0); }
}

/* كونفيتي */
.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confetti > i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation-name: conffall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes conffall {
  0% { transform: translateY(0) translateX(0) rotate(var(--rot)); opacity: 1; }
  100% { transform: translateY(105vh) translateX(var(--drift)) rotate(calc(var(--rot) + 540deg)); opacity: .9; }
}

/* نافذة الاحتفال */
.celebrate {
  position: fixed; inset: 0; z-index: 65;
  display: grid; place-items: center; padding: 24px;
  background: rgba(0,0,0,.6); animation: fade .2s ease;
}
.celebrate__card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 22px; padding: 28px 22px; max-width: 340px; width: 100%;
  text-align: center; box-shadow: var(--shadow);
  animation: pop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.celebrate__emoji { font-size: 44px; }
.celebrate__title { font-size: 20px; font-weight: 800; margin: 8px 0 10px; }
.celebrate__line { font-size: 14px; color: var(--text-dim); margin-bottom: 4px; }
.celebrate__line:last-of-type { color: var(--text); font-weight: 600; margin: 10px 0 18px; }
.celebrate .btn { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .confetti { display: none; }
}
