/* ============================================================
   أثر — Athar | نظام التصميم "الفخامة الهادئة"
   ملف الأنماط الرئيسي — (! MOD Dev)
   إصدار: Auth Modal RTL Fix + Header State Hardening — 2025
   ============================================================ */

/* ------------------------------------------------------------
   ١. المتغيرات الأساسية
   ------------------------------------------------------------ */
:root {
  --sand: #F4F2EC;
  --sand-2: #EDEAE1;
  --sand-3: #E3DED1;
  --cream: #FBF9F5;
  --olive: #2A3B2C;
  --olive-2: #35492F;
  --olive-3: #1E2C20;
  --olive-soft: #5A6E5B;
  --copper: #C17753;
  --copper-2: #B86B42;
  --copper-3: #D89A78;
  --gold: #C9A227;
  --gold-soft: #E5CD6F;
  --silver: #9AA5AE;
  --silver-soft: #D3DAE0;

  --copper-a10: rgba(193,119,83,.10);
  --copper-a22: rgba(193,119,83,.22);
  --copper-a40: rgba(193,119,83,.40);

  --sh-soft: 0 1px 2px rgba(42,59,44,.04), 0 8px 22px -10px rgba(42,59,44,.16);
  --sh-card: 0 1px 1px rgba(42,59,44,.03), 0 10px 26px -12px rgba(42,59,44,.18), 0 30px 60px -40px rgba(42,59,44,.28);
  --sh-lift: 0 2px 4px rgba(42,59,44,.04), 0 20px 40px -16px rgba(42,59,44,.22), 0 40px 80px -30px rgba(193,119,83,.45);
  --sh-inset: inset 0 1px 0 rgba(255,255,255,.72);
  --sh-inset-dark: inset 0 1px 0 rgba(255,255,255,.10);

  --ease: cubic-bezier(.22,.68,.32,1);
  --ease-out: cubic-bezier(.16,1,.30,1);
  --ease-soft: cubic-bezier(.4,0,.2,1);
  --ease-back: cubic-bezier(.34,1.56,.64,1);

  --r-lg: 28px;
  --r-md: 22px;
  --r-sm: 14px;
  --r-pill: 999px;

  --page-max: 1240px;
  --gut: clamp(16px, 4vw, 40px);
  --header-h: 96px;
}

/* ------------------------------------------------------------
   ٢. إعادة الضبط الأساسي
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 130px;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  font-family: "Almarai", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.75;
  color: var(--olive);
  background: var(--sand);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(193,119,83,.10), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(42,59,44,.09), transparent 60%);
}

body.is-locked { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { font-weight: 800; line-height: 1.35; letter-spacing: -.01em; text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--copper-a40); color: var(--olive-3); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; border-radius: 6px; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--sand-2); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--copper), var(--copper-2));
  border-radius: var(--r-pill);
  border: 3px solid var(--sand-2);
}
::-webkit-scrollbar-thumb:hover { background: var(--copper-2); }

/* ------------------------------------------------------------
   ٢.١ فرض دلالات [hidden] عالمياً
   ------------------------------------------------------------
   المشكلة:
     قاعدة المتصفح الافتراضية  `[hidden] { display: none }`
     تخسر أمام أي قاعدة مؤلّف تضبط display على العنصر نفسه
     (مثل `.auth-user { display: inline-flex }`)، لأن قواعد
     المؤلّف تتقدّم على قواعد وكيل المستخدم دائماً — حتى لو
     كانت محدّداتها أضعف.

   الحل:
     قاعدة واحدة بـ !important تُعيد للـ hidden سلطته الكاملة.
     هذا الاستخدام الوحيد المبرّر لـ !important: تجاوز قاعدة
     من أصل UA لضمان أن أي مكوّن مستقبلي لا يستطيع — بالخطأ —
     إعادة إدخال تسرّب العناصر المخفية عبر إضافة display.

   الأمان مع flex/grid:
     `display: none` يُزيل العنصر من تدفّق التخطيط كلياً؛
     لا يشارك في flex ولا grid، ولا يُنتج فجوة أو صفاً وهمياً.
     أي حاوية flex/grid تُبقي أبناءها المرئيين فقط — وهذا
     بالضبط السلوك المطلوب لدلالة hidden.
   ------------------------------------------------------------ */
[hidden] { display: none !important; }

/* ------------------------------------------------------------
   ٣. الزخارف الخلفية
   ------------------------------------------------------------ */
.bg-decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  will-change: transform;
}

.orb-1 {
  width: 46vmax; height: 46vmax;
  top: -18vmax; inset-inline-end: -14vmax;
  background: radial-gradient(circle at 35% 35%, rgba(193,119,83,.34), transparent 68%);
  animation: floatA 26s var(--ease-soft) infinite alternate;
}
.orb-2 {
  width: 40vmax; height: 40vmax;
  bottom: -16vmax; inset-inline-start: -12vmax;
  background: radial-gradient(circle at 60% 40%, rgba(42,59,44,.26), transparent 68%);
  animation: floatB 32s var(--ease-soft) infinite alternate;
}
.orb-3 {
  width: 26vmax; height: 26vmax;
  top: 42%; inset-inline-start: 46%;
  background: radial-gradient(circle at 50% 50%, rgba(216,154,120,.22), transparent 70%);
  animation: floatC 38s var(--ease-soft) infinite alternate;
}

@keyframes floatA {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(-6vmax,5vmax,0) scale(1.14); }
}
@keyframes floatB {
  from { transform: translate3d(0,0,0) scale(1.08); }
  to   { transform: translate3d(7vmax,-4vmax,0) scale(1); }
}
@keyframes floatC {
  from { transform: translate3d(-50%,-50%,0) scale(1); }
  to   { transform: translate3d(-42%,-56%,0) scale(1.22); }
}

.grid-veil {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(42,59,44,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(42,59,44,.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(120% 90% at 50% 20%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 20%, #000 0%, transparent 78%);
  opacity: .7;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 2;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 8s steps(6) infinite;
}
@keyframes grainShift {
  0%{transform:translate(0,0)} 20%{transform:translate(-4%,3%)}
  40%{transform:translate(3%,-4%)} 60%{transform:translate(-2%,-3%)}
  80%{transform:translate(4%,2%)} 100%{transform:translate(0,0)}
}

/* ------------------------------------------------------------
   ٤. شريط انقطاع الاتصال
   ------------------------------------------------------------ */
.offline-banner {
  position: fixed;
  top: calc(var(--header-h) + 6px);
  inset-inline: 12px;
  z-index: 500;
  max-width: 520px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  font-size: .82rem;
  font-weight: 700;
  color: #8A2E1B;
  background: linear-gradient(160deg, rgba(255,245,235,.96), rgba(252,240,230,.92));
  border: 1px solid rgba(193,119,83,.40);
  box-shadow: 0 12px 30px -10px rgba(140,76,44,.35);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: bannerIn .4s var(--ease-back) both;
}
.offline-banner svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--copper-2); }

@keyframes bannerIn { from{opacity:0;transform:translateY(-10px) scale(.96)} to{opacity:1;transform:translateY(0) scale(1)} }

/* ------------------------------------------------------------
   ٥. الترويسة
   ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: clamp(10px,1.6vw,18px) var(--gut);
}

.header-inner {
  position: relative;
  max-width: var(--page-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px,2vw,28px);
  padding: 9px clamp(12px,1.6vw,20px);
  border-radius: var(--r-pill);
  background: rgba(247,245,239,.60);
  border: 1px solid rgba(255,255,255,.70);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(42,59,44,.04), 0 14px 40px -18px rgba(42,59,44,.28);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  transition: background .5s var(--ease), box-shadow .5s var(--ease), border-color .5s var(--ease);
}

.site-header.is-scrolled .header-inner {
  background: rgba(247,245,239,.82);
  border-color: rgba(255,255,255,.85);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(42,59,44,.05), 0 20px 50px -22px rgba(42,59,44,.34);
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-logo-wrap {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(42px,5vw,54px);
  height: clamp(42px,5vw,54px);
  border-radius: 16px;
  background: linear-gradient(150deg, var(--olive-2), var(--olive-3));
  box-shadow: var(--sh-inset-dark), 0 8px 22px -10px rgba(42,59,44,.65), 0 0 0 1px rgba(193,119,83,.28);
  overflow: hidden;
  transition: transform .6s var(--ease-back), box-shadow .6s var(--ease);
}

.brand-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 40%, rgba(216,154,120,.55) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: logoSheen 6.5s var(--ease-soft) infinite;
  pointer-events: none;
}
@keyframes logoSheen { 0%,62%{transform:translateX(-120%)} 78%,100%{transform:translateX(120%)} }

.brand:hover .brand-logo-wrap { transform: rotate(-3deg) scale(1.06); }
.brand-logo { width: 78%; height: 78%; object-fit: contain; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.brand-title {
  font-size: clamp(.98rem,1.9vw,1.22rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--olive);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title em { font-style: normal; color: var(--copper); margin-inline: 2px; }
.brand-title span { font-weight: 400; color: var(--olive-soft); }

.brand-tag {
  display: none;
  font-size: .72rem;
  font-weight: 400;
  color: var(--olive-soft);
  opacity: .85;
}
@media (min-width: 640px) { .brand-tag { display: block; } }

.tabs {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: var(--r-pill);
  background: rgba(42,59,44,.055);
  box-shadow: inset 0 1px 3px rgba(42,59,44,.07);
}

.tab-glider {
  position: absolute;
  top: 5px; bottom: 5px; left: 0;
  width: 0;
  z-index: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--copper-3) 0%, var(--copper) 48%, var(--copper-2) 100%);
  box-shadow: var(--sh-inset), 0 6px 18px -6px rgba(193,119,83,.85), 0 0 0 1px rgba(193,119,83,.30);
  transition: transform .62s var(--ease), width .62s var(--ease);
  will-change: transform, width;
}

.tab {
  position: relative;
  z-index: 1;
  border-radius: var(--r-pill);
  padding: 9px 18px;
  color: var(--olive-soft);
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: color .45s var(--ease), transform .45s var(--ease);
}
.tab-inner { display: inline-flex; align-items: center; gap: 8px; }
.tab svg { width: 17px; height: 17px; flex: 0 0 auto; transition: transform .5s var(--ease-back); }
.tab:hover { color: var(--olive); }
.tab:hover svg { transform: scale(1.14) rotate(-4deg); }
.tab.is-active { color: #FFF7F1; }
.tab.is-active svg { transform: scale(1.06); }

.auth-slot { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

.auth-btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 18px; border-radius: var(--r-pill);
  font-size: .84rem; font-weight: 800; letter-spacing: .01em;
  color: #FFF7F1; white-space: nowrap;
  background: linear-gradient(135deg, var(--copper-3) 0%, var(--copper) 46%, var(--copper-2) 100%);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(140,76,44,.30), 0 10px 24px -10px rgba(193,119,83,.80);
  transition: transform .42s var(--ease), box-shadow .42s var(--ease), filter .42s var(--ease);
}
.auth-btn svg { width: 16px; height: 16px; flex: 0 0 auto; transition: transform .5s var(--ease-back); }
@media (hover: hover) {
  .auth-btn:hover { transform: translateY(-2px); filter: brightness(1.06) saturate(1.05); }
  .auth-btn:hover svg { transform: translateX(-4px) rotate(-4deg); }
}

.auth-user {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 14px;
  border-radius: var(--r-pill);
  background: linear-gradient(160deg, rgba(255,255,255,.82), rgba(244,242,236,.68));
  border: 1px solid rgba(255,255,255,.80);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(42,59,44,.05), 0 10px 26px -14px rgba(42,59,44,.28);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  animation: authUserIn .55s var(--ease-back) both;
  min-width: 0;
}
@keyframes authUserIn { from{opacity:0;transform:translateY(-4px) scale(.94)} to{opacity:1;transform:translateY(0) scale(1)} }

.auth-avatar {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: .82rem; font-weight: 800; color: #FFF7F1;
  background: linear-gradient(145deg, var(--olive-2), var(--olive-3));
  box-shadow: var(--sh-inset-dark), 0 4px 12px -4px rgba(42,59,44,.60), 0 0 0 1px rgba(193,119,83,.28);
}
.auth-identity { display: flex; flex-direction: column; gap: 0; min-width: 0; line-height: 1.2; }
.auth-email {
  font-size: .76rem; font-weight: 700; color: var(--olive);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  unicode-bidi: plaintext;
}
.auth-role { font-size: .62rem; font-weight: 400; color: var(--olive-soft); opacity: .85; }
.auth-role.is-admin { color: var(--copper-2); font-weight: 800; }
.auth-role.is-admin::after { content: " ✦"; color: var(--copper); font-size: .9em; }
.auth-logout {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: var(--olive-soft);
  background: rgba(42,59,44,.05);
  border: 1px solid rgba(42,59,44,.08);
  box-shadow: var(--sh-inset);
  transition: color .35s var(--ease), background .35s var(--ease), transform .45s var(--ease-back);
}
.auth-logout svg { width: 14px; height: 14px; }
@media (hover: hover) {
  .auth-logout:hover { color: #FFF7F1; background: linear-gradient(135deg, var(--copper-3), var(--copper-2)); transform: rotate(-8deg) scale(1.08); }
}

/* ------------------------------------------------------------
   ٦. شريط الإحالة
   ------------------------------------------------------------ */
.referral-banner {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  inset-inline: var(--gut);
  z-index: 95;
  max-width: calc(var(--page-max) - var(--gut) * 2);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px 11px 18px;
  border-radius: var(--r-pill);
  background: linear-gradient(160deg, rgba(252,250,246,.92), rgba(244,242,236,.80));
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(42,59,44,.06), 0 16px 40px -14px rgba(42,59,44,.35), 0 0 0 1px rgba(193,119,83,.22);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  animation: bannerIn .55s var(--ease-back) both;
}
.referral-banner.is-leaving { animation: bannerOut .35s var(--ease) forwards; }
@keyframes bannerOut { to { opacity: 0; transform: translateY(-8px) scale(.96); } }

.ref-icon {
  display: grid; place-items: center;
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3), var(--copper-2));
  box-shadow: 0 6px 14px -6px rgba(193,119,83,.9);
}
.ref-icon svg { width: 14px; height: 14px; }
.ref-text {
  flex: 1 1 auto; min-width: 0;
  font-size: .84rem; color: var(--olive-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ref-name { font-weight: 800; color: var(--copper-2); }
.ref-dismiss {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  color: var(--olive-soft);
  background: rgba(42,59,44,.05);
  transition: color .3s var(--ease), background .3s var(--ease), transform .4s var(--ease-back);
}
.ref-dismiss svg { width: 12px; height: 12px; }
@media (hover: hover) {
  .ref-dismiss:hover { color: #FFF7F1; background: linear-gradient(135deg, var(--copper-3), var(--copper-2)); transform: rotate(90deg) scale(1.06); }
}

/* ------------------------------------------------------------
   ٧. اللوحات
   ------------------------------------------------------------ */
main { position: relative; z-index: 3; }

.panel {
  display: none;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: clamp(28px,5vw,56px) var(--gut) clamp(60px,9vw,110px);
}
.panel.is-active { display: block; }

.panel-head { max-width: 680px; margin-bottom: clamp(28px,4vw,48px); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 16px; margin-bottom: 20px;
  border-radius: var(--r-pill);
  font-size: .76rem; font-weight: 700; letter-spacing: .06em;
  color: var(--copper-2);
  background: var(--copper-a10);
  border: 1px solid var(--copper-a22);
  box-shadow: var(--sh-inset);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 4px rgba(193,119,83,.18);
  animation: pulseDot 2.6s var(--ease-soft) infinite;
}
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 0 4px rgba(193,119,83,.18); }
  50%     { box-shadow: 0 0 0 8px rgba(193,119,83,.04); }
}

.panel-title {
  font-size: clamp(1.7rem,4.6vw,2.9rem);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -.022em;
  background: linear-gradient(178deg, var(--olive) 30%, var(--olive-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--olive);
}

.panel-lead {
  margin-top: 14px;
  font-size: clamp(.94rem,1.9vw,1.06rem);
  line-height: 1.9;
  color: var(--olive-soft);
  max-width: 56ch;
}

/* ------------------------------------------------------------
   ٨. صف الإحصاءات
   ------------------------------------------------------------ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px,1.8vw,18px);
  margin-bottom: clamp(28px,4vw,48px);
}

.stat {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: clamp(16px,2.6vw,24px) 12px;
  border-radius: var(--r-md);
  text-align: center;
  background: linear-gradient(160deg, rgba(255,255,255,.88), rgba(255,255,255,.56));
  border: 1px solid rgba(255,255,255,.80);
  box-shadow: var(--sh-soft), var(--sh-inset);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: transform .55s var(--ease), box-shadow .55s var(--ease);
}
.stat::after {
  content: "";
  position: absolute;
  inset-inline: 22%; bottom: 0; height: 2px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, transparent, var(--copper), transparent);
  opacity: .55;
}
@media (hover: hover) { .stat:hover { transform: translateY(-4px); box-shadow: var(--sh-lift), var(--sh-inset); } }

.stat-num {
  font-size: clamp(1.5rem,4.4vw,2.1rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--copper-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-label { font-size: clamp(.7rem,1.6vw,.8rem); color: var(--olive-soft); }

/* ------------------------------------------------------------
   ٩. شبكة البطاقات + بطاقة الآية
   ------------------------------------------------------------ */
.deeds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(16px,2.4vw,26px);
}

.verse-card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 16px;
  padding: clamp(24px,3.4vw,32px) clamp(22px,3vw,30px) clamp(22px,2.8vw,26px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(158deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,.72) 48%, rgba(244,242,236,.86) 100%);
  border: 1px solid rgba(255,255,255,.84);
  box-shadow: var(--sh-card), var(--sh-inset);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  transition: transform .58s var(--ease), box-shadow .58s var(--ease), border-color .58s var(--ease);
}
.verse-card::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  background: radial-gradient(130% 90% at 92% 0%, rgba(193,119,83,.18), transparent 58%),
              radial-gradient(90% 70% at 0% 100%, rgba(42,59,44,.08), transparent 60%);
  opacity: 0; transition: opacity .65s var(--ease);
  pointer-events: none;
}
.card-sheen {
  position: absolute; inset: 0; z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(108deg, transparent 34%, rgba(255,255,255,.78) 50%, transparent 66%);
  transform: translateX(-140%);
}
@media (hover: hover) {
  .verse-card:hover { transform: translateY(-6px); border-color: rgba(193,119,83,.40); box-shadow: var(--sh-lift), var(--sh-inset); }
  .verse-card:hover::before { opacity: 1; }
  .verse-card:hover .card-sheen { animation: sheenSweep 1.15s var(--ease-out) forwards; }
}
@keyframes sheenSweep { 0%{transform:translateX(-140%);opacity:0} 26%{opacity:.85} 100%{transform:translateX(140%);opacity:0} }

.verse-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.verse-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px 6px 11px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 800; letter-spacing: .02em;
  color: var(--copper-2);
  background: var(--copper-a10);
  border: 1px solid var(--copper-a22);
  box-shadow: var(--sh-inset);
}
.verse-badge svg { width: 14px; height: 14px; }
.verse-badge-hadith { color: var(--olive-2); background: rgba(42,59,44,.08); border-color: rgba(42,59,44,.18); }

.card-points {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 500;
  color: var(--copper-2);
  background: linear-gradient(135deg, rgba(216,154,120,.18), rgba(193,119,83,.10));
  border: 1px solid rgba(193,119,83,.28);
  box-shadow: var(--sh-inset);
}
.card-points-icon { display: grid; place-items: center; width: 14px; height: 14px; color: var(--copper-2); }
.card-points-icon svg { width: 100%; height: 100%; }
.card-points b { font-size: .96rem; font-weight: 800; color: var(--copper-2); font-variant-numeric: tabular-nums; }

.verse-text {
  position: relative;
  margin: 0;
  padding-inline-start: 20px;
  font-size: clamp(1.02rem,2.4vw,1.22rem);
  line-height: 2.1;
  font-weight: 700;
  color: var(--olive);
  text-align: right;
}
.verse-text::before {
  content: "";
  position: absolute;
  inset-inline-start: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: var(--r-pill);
  background: linear-gradient(to bottom, var(--copper-3), var(--copper-2));
  box-shadow: 0 0 12px rgba(193,119,83,.45);
}

.verse-ref {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .82rem; font-weight: 700;
  color: var(--olive-soft);
  font-style: normal;
  align-self: flex-start;
}
.verse-ref::before {
  content: "";
  width: 14px; height: 1px;
  background: var(--copper);
  border-radius: var(--r-pill);
  opacity: .75;
}

.verse-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

.btn-verse {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--r-pill);
  font-size: .86rem; font-weight: 800; letter-spacing: .01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .38s var(--ease), box-shadow .38s var(--ease), filter .38s var(--ease), background .38s var(--ease), color .38s var(--ease);
}
.btn-verse svg { width: 16px; height: 16px; flex: 0 0 auto; }

.btn-verse-share {
  color: var(--copper-2);
  background: rgba(255,255,255,.72);
  border: 1.5px solid rgba(193,119,83,.45);
  box-shadow: var(--sh-inset), 0 4px 14px -10px rgba(193,119,83,.55);
}
.btn-verse-share:hover {
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3), var(--copper-2));
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -12px rgba(193,119,83,.95);
}

.btn-verse-complete {
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3) 0%, var(--copper) 46%, var(--copper-2) 100%);
  border: 1.5px solid transparent;
  box-shadow: var(--sh-inset), 0 1px 2px rgba(140,76,44,.30), 0 10px 24px -10px rgba(193,119,83,.80);
}
.btn-verse-complete:hover {
  transform: translateY(-2px);
  filter: brightness(1.06) saturate(1.05);
  box-shadow: var(--sh-inset), 0 18px 36px -12px rgba(193,119,83,.95);
}
.btn-verse-complete:active { transform: translateY(1px) scale(.985); }

.btn-verse-complete.is-cooldown {
  cursor: default;
  color: var(--olive-soft);
  background: linear-gradient(160deg, rgba(240,238,230,.92), rgba(230,226,215,.85));
  border-color: rgba(42,59,44,.10);
  box-shadow: inset 0 1px 3px rgba(42,59,44,.08);
}
.btn-verse-complete.is-cooldown:hover { transform: none; filter: none; box-shadow: inset 0 1px 3px rgba(42,59,44,.08); }

.verse-cooldown {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: linear-gradient(160deg, rgba(255,248,240,.85), rgba(252,244,234,.65));
  border: 1px dashed rgba(193,119,83,.35);
  animation: cooldownIn .4s var(--ease-out) both;
}
@keyframes cooldownIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }

.cooldown-icon { display: grid; place-items: center; width: 20px; height: 20px; color: var(--copper-2); }
.cooldown-icon svg { width: 100%; height: 100%; }
.cooldown-label { font-size: .74rem; font-weight: 600; color: var(--olive-soft); }
.cooldown-timer {
  font-variant-numeric: tabular-nums;
  font-family: "Almarai", ui-monospace, monospace;
  font-weight: 800;
  font-size: .92rem;
  letter-spacing: .04em;
  color: var(--copper-2);
  direction: ltr;
}

.ripple {
  position: absolute;
  z-index: 3;
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
  background: radial-gradient(circle, rgba(255,255,255,.70), rgba(255,255,255,.05) 70%);
  animation: rippleOut .72s var(--ease-out) forwards;
}
@keyframes rippleOut { 0%{transform:scale(0);opacity:.85} 100%{transform:scale(2.8);opacity:0} }

/* ------------------------------------------------------------
   ١٠. حالات الفراغ
   ------------------------------------------------------------ */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: clamp(36px,6vw,64px) clamp(24px,4vw,40px);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255,255,255,.84), rgba(244,242,236,.58));
  border: 1px dashed rgba(42,59,44,.18);
  box-shadow: var(--sh-inset);
}
.empty-state-icon {
  display: grid; place-items: center;
  width: 68px; height: 68px;
  border-radius: 50%;
  color: var(--copper-2);
  background: linear-gradient(150deg, rgba(193,119,83,.18), rgba(193,119,83,.05));
  border: 1px solid rgba(193,119,83,.26);
  box-shadow: var(--sh-inset), 0 12px 26px -14px rgba(193,119,83,.55);
}
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state-title { font-size: clamp(1rem,2.4vw,1.15rem); font-weight: 800; color: var(--olive); }
.empty-state-text { font-size: clamp(.84rem,1.9vw,.92rem); line-height: 1.85; color: var(--olive-soft); max-width: 46ch; }
.empty-state-cta {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  font-size: .84rem; font-weight: 800;
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3), var(--copper-2));
  box-shadow: var(--sh-inset), 0 10px 22px -10px rgba(193,119,83,.85);
  transition: transform .4s var(--ease), filter .4s var(--ease), box-shadow .4s var(--ease);
}
@media (hover: hover) {
  .empty-state-cta:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: var(--sh-inset), 0 16px 32px -12px rgba(193,119,83,.95); }
}

/* ------------------------------------------------------------
   ١١. لوحة بوابات الصدقة
   ------------------------------------------------------------ */
.sadaqah-empty {
  position: relative;
  max-width: 620px;
  margin: clamp(12px,3vw,30px) auto clamp(40px,6vw,80px);
  padding: clamp(40px,7vw,72px) clamp(28px,5vw,56px);
  text-align: center;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(255,255,255,.62) 48%, rgba(244,242,236,.80));
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: var(--sh-card), var(--sh-inset), 0 0 0 1px rgba(193,119,83,.10);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  overflow: hidden;
}
.sadaqah-empty::before {
  content: "";
  position: absolute;
  inset-inline: 20%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(193,119,83,.70), transparent);
  box-shadow: 0 0 22px rgba(193,119,83,.55);
  pointer-events: none;
}
.sadaqah-icon-wrap {
  display: inline-grid; place-items: center;
  width: clamp(76px,12vw,100px); height: clamp(76px,12vw,100px);
  margin-bottom: 24px;
  border-radius: 30px;
  color: var(--copper-2);
  background: linear-gradient(150deg, rgba(193,119,83,.20), rgba(193,119,83,.06));
  border: 1px solid rgba(193,119,83,.26);
  box-shadow: var(--sh-inset), 0 20px 44px -20px rgba(193,119,83,.60);
  animation: sadaqahFloat 5.5s var(--ease-soft) infinite;
}
.sadaqah-icon-wrap svg { width: 42%; height: 42%; }
@keyframes sadaqahFloat { 0%,100%{transform:translateY(0) rotate(0)} 50%{transform:translateY(-8px) rotate(-2deg)} }

.sadaqah-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 18px; padding: 7px 18px;
  border-radius: var(--r-pill);
  font-size: .74rem; font-weight: 800;
  color: var(--copper-2);
  background: var(--copper-a10);
  border: 1px solid var(--copper-a22);
}
.sadaqah-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--copper);
  animation: pulseDot 2.4s var(--ease-soft) infinite;
}
.sadaqah-title { margin-bottom: 16px; font-size: clamp(1.12rem,3vw,1.48rem); font-weight: 800; line-height: 1.85; color: var(--olive); }
.sadaqah-note { max-width: 46ch; margin-inline: auto; font-size: clamp(.86rem,1.9vw,.96rem); line-height: 1.95; color: var(--olive-soft); }
.sadaqah-dots { display: inline-flex; gap: 8px; margin-top: 28px; }
.sadaqah-dots i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--copper); opacity: .35; animation: dotPulse 1.6s var(--ease-soft) infinite; }
.sadaqah-dots i:nth-child(2) { animation-delay: .18s; }
.sadaqah-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes dotPulse { 0%,100%{opacity:.25;transform:scale(.9)} 50%{opacity:.95;transform:scale(1.15)} }

/* ------------------------------------------------------------
   ١٢. عدّاد النقاط الحي
   ------------------------------------------------------------ */
.tree-stats {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(16px,3vw,32px);
  margin-bottom: clamp(16px,2.5vw,24px);
  padding: clamp(18px,2.6vw,26px) clamp(20px,3vw,32px);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(255,255,255,.90), rgba(255,255,255,.62) 45%, rgba(244,242,236,.75));
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(42,59,44,.05), 0 18px 44px -18px rgba(42,59,44,.28);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  overflow: hidden;
}
.tree-stats::before {
  content: '';
  position: absolute;
  inset-inline: 22%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(193,119,83,.70), transparent);
  box-shadow: 0 0 18px rgba(193,119,83,.55);
}
.tree-stat-primary { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tree-stat-label { font-size: .74rem; font-weight: 700; letter-spacing: .06em; color: var(--olive-soft); opacity: .9; }
.tree-stat-value {
  font-size: clamp(2rem,5.5vw,3rem);
  font-weight: 800;
  line-height: 1;
  color: var(--copper-2);
  font-variant-numeric: tabular-nums;
}
.tree-stat-breakdown { display: flex; gap: clamp(8px,1.5vw,14px); flex-wrap: wrap; justify-content: flex-end; }
.tree-stat-chip {
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 20px;
  border-radius: var(--r-sm);
  background: rgba(42,59,44,.045);
  border: 1px solid rgba(42,59,44,.08);
  box-shadow: var(--sh-inset);
  min-width: 110px;
}
.tree-stat-chip-label { font-size: .66rem; font-weight: 700; color: var(--olive-soft); opacity: .85; }
.tree-stat-chip-value { font-size: 1.18rem; font-weight: 800; color: var(--olive); font-variant-numeric: tabular-nums; }
.tree-stat-chip.is-referral .tree-stat-chip-value { color: var(--copper-2); }

/* ------------------------------------------------------------
   ١٣. حاوية شجرة الأثر
   ------------------------------------------------------------ */
.tree-stage {
  position: relative;
  min-height: clamp(560px,72vh,780px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background:
    radial-gradient(80% 65% at 50% 0%, rgba(193,119,83,.22), transparent 62%),
    radial-gradient(60% 55% at 50% 100%, rgba(193,119,83,.08), transparent 72%),
    linear-gradient(168deg, #2D3D2F 0%, var(--olive) 40%, var(--olive-3) 100%);
  border: 1px solid rgba(193,119,83,.26);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    0 40px 90px -40px rgba(42,59,44,.85),
    0 0 0 1px rgba(42,59,44,.12);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tree-stage.is-panning { cursor: grabbing; }

.tree-stage::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 58% at 50% 30%, rgba(193,119,83,.10), transparent 72%),
    radial-gradient(120% 85% at 50% 45%, transparent 40%, rgba(12,20,14,.55) 100%);
}
.tree-stage::after {
  content: "";
  position: absolute;
  inset-inline: 18%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,154,120,.85), transparent);
  box-shadow: 0 0 18px rgba(193,119,83,.75);
  pointer-events: none;
}

.impact-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: -webkit-optimize-contrast;
}

.tree-reset {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: rgba(240,230,212,.85);
  background: rgba(20,30,22,.55);
  border: 1px solid rgba(216,154,120,.35);
  box-shadow: 0 8px 22px -10px rgba(0,0,0,.55);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.94);
  transition: opacity .35s var(--ease), transform .45s var(--ease-back), visibility 0s linear .35s;
}
.tree-stage[data-zoomed="true"] .tree-reset,
.tree-stage[data-panned="true"] .tree-reset {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity .35s var(--ease), transform .45s var(--ease-back), visibility 0s linear 0s;
}
.tree-reset svg { width: 18px; height: 18px; }
@media (hover: hover) {
  .tree-reset:hover { color: #FFF7F1; background: rgba(193,119,83,.55); border-color: rgba(216,154,120,.75); }
}

.tree-legend {
  position: absolute;
  inset-inline: 0; bottom: clamp(14px,3vw,24px);
  z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: clamp(14px,3vw,30px);
  padding-inline: 16px;
  pointer-events: none;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: clamp(.68rem,1.5vw,.78rem);
  color: rgba(238,232,216,.78);
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot-root { background: #F0E6D4; box-shadow: 0 0 0 4px rgba(240,230,212,.18), 0 0 14px rgba(240,230,212,.85); }
.dot-branch { background: var(--copper-3); box-shadow: 0 0 0 4px rgba(216,154,120,.18), 0 0 14px rgba(216,154,120,.85); }
.dot-leaf { background: var(--copper); box-shadow: 0 0 0 4px rgba(193,119,83,.20), 0 0 14px rgba(193,119,83,.95); }

/* ------------------------------------------------------------
   ١٤. بطاقة معلومات العقدة
   ------------------------------------------------------------ */
.node-popover {
  position: fixed;
  top: 0; left: 0;
  z-index: 9999;
  width: max-content;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 16px 18px;
  border-radius: 20px;
  color: var(--olive);
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-align: start;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(216,154,120,.14), transparent 62%),
    linear-gradient(158deg, rgba(252,250,246,.97), rgba(246,243,236,.92) 45%, rgba(238,234,224,.95));
  border: 1px solid rgba(255,255,255,.90);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.92),
    inset 0 -1px 0 rgba(193,119,83,.08),
    0 2px 6px rgba(15,25,18,.15),
    0 22px 46px -14px rgba(15,25,18,.48),
    0 0 0 1px rgba(193,119,83,.22);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  opacity: 0;
  transform: translateY(6px) scale(.95);
  transition: opacity .28s var(--ease), transform .42s var(--ease-back);
  pointer-events: none;
}
.node-popover.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.node-popover::before {
  content: '';
  position: absolute;
  inset-inline: 26%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,154,120,.95), transparent);
  box-shadow: 0 0 14px rgba(193,119,83,.65);
}

.node-popover-arrow {
  position: absolute;
  width: 14px; height: 14px;
  background: rgba(248,246,240,.98);
  border: 1px solid rgba(255,255,255,.90);
  transform: rotate(45deg);
  box-shadow: 0 4px 12px -4px rgba(15,25,18,.28), 0 0 0 1px rgba(193,119,83,.16);
}
.node-popover[data-placement="above"] .node-popover-arrow { border-top: 0; border-left: 0; }
.node-popover[data-placement="below"] .node-popover-arrow { border-bottom: 0; border-right: 0; }

.node-popover-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.node-popover-avatar {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  font-size: 1.15rem; font-weight: 800; color: #FFF7F1;
  background: linear-gradient(145deg, #D89A78, #B86B42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 8px 18px -8px rgba(193,119,83,.85), 0 0 0 1px rgba(193,119,83,.35);
}
.node-popover[data-type="root"] .node-popover-avatar {
  background: linear-gradient(145deg, #F2DDB8, #B86B42);
}
.node-popover[data-type="indirect"] .node-popover-avatar {
  background: linear-gradient(145deg, #B5AC95, #6E6555);
  font-size: 1.30rem;
}
.node-popover-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.node-popover-title {
  font-size: .98rem; font-weight: 800; color: var(--olive);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.node-popover-subtitle {
  font-size: .70rem; font-weight: 700;
  color: var(--copper-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.node-popover[data-type="indirect"] .node-popover-subtitle { color: #6E6B60; }

.node-popover-body { display: flex; flex-direction: column; gap: 6px; }
.node-popover-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(42,59,44,.035);
  border: 1px solid rgba(42,59,44,.06);
}
.node-popover-row-icon { display: grid; place-items: center; color: var(--copper-2); }
.node-popover-row-icon svg { width: 14px; height: 14px; }
.node-popover-row-label { font-size: .72rem; font-weight: 500; color: var(--olive-soft); white-space: nowrap; }
.node-popover-row-value {
  font-size: .78rem; font-weight: 800; color: var(--olive);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 150px;
}

/* ------------------------------------------------------------
   ١٥. لوحة الشرف
   ------------------------------------------------------------ */
.board { display: flex; flex-direction: column; gap: clamp(10px,1.6vw,14px); }

.board-row {
  position: relative; isolation: isolate;
  display: flex; align-items: center;
  gap: clamp(12px,2vw,20px);
  padding: clamp(15px,2.2vw,20px) clamp(16px,2.4vw,26px);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255,255,255,.86), rgba(255,255,255,.52));
  border: 1px solid rgba(255,255,255,.80);
  box-shadow: var(--sh-soft), var(--sh-inset);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .5s var(--ease);
}
@media (hover: hover) {
  .board-row:hover { transform: translateY(-4px); box-shadow: var(--sh-card), var(--sh-inset); border-color: rgba(193,119,83,.30); }
}

.rank-num {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: clamp(34px,5vw,42px); height: clamp(34px,5vw,42px);
  border-radius: 13px;
  font-size: clamp(.88rem,2vw,1rem); font-weight: 800;
  color: var(--olive-soft);
  background: rgba(42,59,44,.055);
  border: 1px solid rgba(42,59,44,.07);
  box-shadow: var(--sh-inset);
  font-variant-numeric: tabular-nums;
}

.board-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.board-name { font-size: clamp(.94rem,2vw,1.05rem); font-weight: 800; color: var(--olive); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-sub { font-size: clamp(.7rem,1.6vw,.78rem); color: var(--olive-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-score {
  flex: 0 0 auto;
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 7px 15px;
  border-radius: var(--r-pill);
  background: rgba(42,59,44,.055);
  border: 1px solid rgba(42,59,44,.08);
  box-shadow: var(--sh-inset);
}
.board-score b { font-size: clamp(.94rem,2.2vw,1.08rem); font-weight: 800; color: var(--olive); font-variant-numeric: tabular-nums; }
.board-score i { font-style: normal; font-size: .68rem; color: var(--olive-soft); }

.medal {
  flex: 0 0 auto;
  display: none; place-items: center;
  width: clamp(38px,5.4vw,48px); height: clamp(38px,5.4vw,48px);
  border-radius: 15px;
  box-shadow: var(--sh-inset);
  transition: transform .55s var(--ease-back);
}
.medal svg { width: 22px; height: 22px; }

.rank-1, .rank-2, .rank-3 { animation: floatRow 6.5s var(--ease-soft) infinite; }
.rank-2 { animation-delay: -2.1s; }
.rank-3 { animation-delay: -4.2s; }
@keyframes floatRow { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }

.rank-1 .medal {
  display: grid;
  color: #FFF6DC;
  background: linear-gradient(145deg, var(--gold-soft), var(--gold) 70%);
  box-shadow: var(--sh-inset), 0 10px 24px -10px rgba(201,162,39,.90), 0 0 0 1px rgba(201,162,39,.40);
}
.rank-2 .medal {
  display: grid;
  color: #F6F9FB;
  background: linear-gradient(145deg, var(--silver-soft), var(--silver) 70%);
  box-shadow: var(--sh-inset), 0 10px 24px -10px rgba(154,165,174,.85), 0 0 0 1px rgba(154,165,174,.40);
}
.rank-3 .medal {
  display: grid;
  color: #FFF2E8;
  background: linear-gradient(145deg, var(--copper-3), var(--copper-2) 70%);
  box-shadow: var(--sh-inset), 0 10px 24px -10px rgba(193,119,83,.90), 0 0 0 1px rgba(193,119,83,.42);
}

.rank-1 { border-color: rgba(201,162,39,.38); box-shadow: 0 0 0 1px rgba(201,162,39,.20), 0 14px 40px -18px rgba(201,162,39,.55), var(--sh-inset); }
.rank-2 { border-color: rgba(154,165,174,.38); box-shadow: 0 0 0 1px rgba(154,165,174,.18), 0 14px 40px -18px rgba(154,165,174,.55), var(--sh-inset); }
.rank-3 { border-color: rgba(193,119,83,.42); box-shadow: 0 0 0 1px rgba(193,119,83,.22), 0 14px 40px -18px rgba(193,119,83,.60), var(--sh-inset); }

@media (hover: hover) {
  .rank-1:hover, .rank-2:hover, .rank-3:hover { animation-play-state: paused; transform: translateY(-6px) scale(1.008); }
}

.board-row.is-skeleton {
  pointer-events: none;
  opacity: .55;
  background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(255,255,255,.82) 40%, rgba(255,255,255,.55) 80%);
  background-size: 240% 100%;
  animation: boardShimmer 1.6s linear infinite;
}
@keyframes boardShimmer { from{background-position:120% 0} to{background-position:-120% 0} }

/* ------------------------------------------------------------
   ١٦. التذييل
   ------------------------------------------------------------ */
.site-footer {
  position: relative; z-index: 3;
  margin-top: clamp(20px,5vw,60px);
  padding: clamp(38px,6vw,64px) var(--gut) clamp(34px,5vw,54px);
  border-top: 1px solid rgba(42,59,44,.09);
  background: linear-gradient(to bottom, transparent, rgba(42,59,44,.035));
}
.footer-inner {
  max-width: var(--page-max);
  margin-inline: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; text-align: center;
}
.footer-ayah {
  max-width: 60ch;
  font-size: clamp(.9rem,2.1vw,1.1rem);
  line-height: 2.1;
  color: var(--olive-2);
}
.footer-ayah::before, .footer-ayah::after {
  content: "❖";
  color: var(--copper);
  opacity: .55;
  font-size: .7em;
  margin-inline: 10px;
}
.footer-note { font-size: .76rem; color: var(--olive-soft); opacity: .8; }

.footer-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
  margin-top: 4px;
}

.about-trigger, .admin-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--olive-soft);
  background: rgba(42,59,44,.04);
  border: 1px solid rgba(42,59,44,.07);
  transition: all .45s var(--ease);
}
.about-trigger svg, .admin-trigger svg { width: 14px; height: 14px; transition: transform .6s var(--ease-back); }
.about-trigger { opacity: .85; }
.admin-trigger { opacity: .45; }
@media (hover: hover) {
  .about-trigger:hover, .admin-trigger:hover {
    opacity: 1; color: var(--copper-2);
    background: var(--copper-a10); border-color: var(--copper-a22);
    transform: translateY(-2px);
  }
  .about-trigger:hover svg { transform: rotate(-8deg) scale(1.08); }
  .admin-trigger:hover svg { transform: rotate(90deg) scale(1.08); }
}

/* ------------------------------------------------------------
   ١٦.١ أيقونات التواصل الاجتماعي
   ------------------------------------------------------------ */
.footer-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.social-link {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  color: var(--olive-2);
  background: linear-gradient(160deg, rgba(255,255,255,.78), rgba(244,242,236,.55));
  border: 1px solid rgba(42,59,44,.10);
  box-shadow: var(--sh-inset), 0 4px 12px -8px rgba(42,59,44,.28);
  transition:
    color .42s var(--ease),
    background .42s var(--ease),
    border-color .42s var(--ease),
    box-shadow .42s var(--ease),
    transform .5s var(--ease-back);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.social-link svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  transition: transform .55s var(--ease-back);
}

.social-link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--copper-3), var(--copper-2));
  opacity: 0;
  transition: opacity .42s var(--ease);
  pointer-events: none;
}

@media (hover: hover) {
  .social-link:hover {
    color: #FFF7F1;
    border-color: rgba(193,119,83,.45);
    transform: translateY(-3px) scale(1.06);
    box-shadow:
      var(--sh-inset),
      0 12px 26px -10px rgba(193,119,83,.75),
      0 0 0 1px rgba(193,119,83,.30);
  }
  .social-link:hover::before { opacity: 1; }
  .social-link:hover svg { transform: scale(1.08); }

  .social-link-instagram:hover svg { transform: scale(1.08) rotate(-6deg); }
  .social-link-tiktok:hover   svg { transform: scale(1.08) translateY(-1px); }
}

.social-link:active {
  transform: translateY(1px) scale(.98);
  transition-duration: .12s;
}

@media (hover: none) and (pointer: coarse) {
  .social-link:hover {
    color: var(--olive-2);
    background: linear-gradient(160deg, rgba(255,255,255,.78), rgba(244,242,236,.55));
    border-color: rgba(42,59,44,.10);
    transform: none;
    box-shadow: var(--sh-inset), 0 4px 12px -8px rgba(42,59,44,.28);
  }
  .social-link:hover::before { opacity: 0; }
  .social-link:hover svg { transform: none; }
}

/* ------------------------------------------------------------
   ١٧. النوافذ المنبثقة العامة
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: clamp(16px,4vw,32px);
  opacity: 0; visibility: hidden;
  transition: opacity .45s var(--ease), visibility 0s linear .45s;
}
.modal-overlay.is-open {
  opacity: 1; visibility: visible;
  transition: opacity .45s var(--ease), visibility 0s linear 0s;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(30,44,32,.48);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  cursor: pointer;
}

.modal {
  position: relative; z-index: 1;
  width: min(560px, 100%);
  max-height: min(88dvh, 780px);
  overflow-y: auto;
  padding: clamp(24px,3.4vw,34px);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg,
    rgba(252,250,246,.92) 0%,
    rgba(244,242,236,.84) 55%,
    rgba(237,234,225,.90) 100%);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow:
    var(--sh-inset),
    0 2px 6px rgba(42,59,44,.10),
    0 40px 90px -30px rgba(30,44,32,.70),
    0 0 0 1px rgba(193,119,83,.18);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  transform: translateY(28px) scale(.94);
  opacity: 0;
  transition: transform .62s var(--ease-back), opacity .5s var(--ease);
  overscroll-behavior: contain;
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); opacity: 1; }

.modal-head {
  position: relative;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(42,59,44,.10);
}
.modal-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  color: var(--copper-2);
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 4px rgba(193,119,83,.18);
  animation: pulseDot 2.2s var(--ease-soft) infinite;
}
.modal-title {
  font-size: clamp(1.25rem,3.4vw,1.6rem);
  font-weight: 800; color: var(--olive); letter-spacing: -.018em;
}
.modal-close {
  position: absolute;
  top: -4px; inset-inline-end: 0;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--olive-soft);
  background: rgba(42,59,44,.05);
  border: 1px solid rgba(42,59,44,.08);
  box-shadow: var(--sh-inset);
  transition: color .4s var(--ease), background .4s var(--ease), transform .5s var(--ease-back);
}
.modal-close svg { width: 17px; height: 17px; }
@media (hover: hover) {
  .modal-close:hover { color: #FFF7F1; background: linear-gradient(135deg, var(--copper-3), var(--copper-2)); transform: rotate(90deg) scale(1.08); }
}

/* ------------------------------------------------------------
   ١٨. نافذة "عن أثر"
   ------------------------------------------------------------ */
.about-modal { width: min(640px, 100%); }

.about-body { display: flex; flex-direction: column; gap: 22px; }

.about-hero {
  position: relative;
  padding: 28px 26px 24px;
  border-radius: var(--r-md);
  text-align: center;
  background: linear-gradient(160deg, rgba(216,154,120,.14), rgba(193,119,83,.06));
  border: 1px solid rgba(193,119,83,.24);
  box-shadow: var(--sh-inset);
  overflow: hidden;
}
.about-hero::before {
  content: "";
  position: absolute;
  inset-inline: 26%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,154,120,.85), transparent);
  box-shadow: 0 0 16px rgba(193,119,83,.55);
}
.about-hero-ornament {
  display: block;
  color: var(--copper);
  font-size: 1rem;
  opacity: .7;
  margin-bottom: 12px;
  letter-spacing: 6px;
}
.about-hero-quote {
  font-size: clamp(.94rem, 2.2vw, 1.06rem);
  font-weight: 700;
  line-height: 2.05;
  color: var(--olive-2);
  margin-bottom: 12px;
}
.about-hero-source {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--copper-2);
  opacity: .85;
}

.about-section {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  align-items: flex-start;
  animation: aboutSectionIn .55s var(--ease-out) both;
}
.about-section:nth-of-type(1) { animation-delay: .1s; }
.about-section:nth-of-type(2) { animation-delay: .18s; }
.about-section:nth-of-type(3) { animation-delay: .26s; }
.about-section:nth-of-type(4) { animation-delay: .34s; }

@keyframes aboutSectionIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.about-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 16px;
  color: var(--copper-2);
  background: linear-gradient(150deg, rgba(193,119,83,.18), rgba(193,119,83,.05));
  border: 1px solid rgba(193,119,83,.26);
  box-shadow: var(--sh-inset);
  flex: 0 0 auto;
}
.about-icon svg { width: 24px; height: 24px; }

.about-section h4 {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--olive);
  letter-spacing: -.012em;
  margin-bottom: 6px;
}
.about-section p {
  font-size: .88rem;
  line-height: 1.9;
  color: var(--olive-soft);
}

.about-closing {
  position: relative;
  padding: 22px 24px 20px;
  border-radius: var(--r-md);
  text-align: center;
  background: linear-gradient(160deg, rgba(255,255,255,.74), rgba(252,246,240,.62));
  border: 1px dashed rgba(193,119,83,.34);
  box-shadow: var(--sh-inset);
  animation: aboutSectionIn .55s var(--ease-out) .4s both;
}
.about-closing-ornament {
  display: block;
  color: var(--copper);
  font-size: 1rem;
  margin-bottom: 8px;
  opacity: .85;
}
.about-closing p {
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.95;
  color: var(--olive-2);
}
.about-signature {
  display: inline-block;
  margin-top: 10px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--copper-2);
  opacity: .85;
}

/* ------------------------------------------------------------
   ١٩. الحقول
   ------------------------------------------------------------ */
.modal-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 700; color: var(--olive-2); }
.field-label-icon { width: 14px; height: 14px; color: var(--copper-2); flex: 0 0 auto; }

.field-input {
  width: 100%;
  padding: 13px 17px;
  border-radius: var(--r-sm);
  font-size: .92rem;
  color: var(--olive);
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(42,59,44,.12);
  box-shadow: inset 0 2px 6px rgba(42,59,44,.06), inset 0 1px 0 rgba(255,255,255,.8);
  transition: border-color .4s var(--ease), box-shadow .4s var(--ease), background .4s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.field-input::placeholder { color: rgba(90,110,91,.55); font-size: .88rem; }
.field-input:focus {
  outline: none;
  background: rgba(255,255,255,.92);
  border-color: rgba(193,119,83,.55);
  box-shadow: inset 0 1px 3px rgba(42,59,44,.04), 0 0 0 4px rgba(193,119,83,.14);
}

.field-area { min-height: 104px; resize: vertical; line-height: 1.8; font-family: inherit; }
.field-area-lg { min-height: 148px; line-height: 2; font-size: 1rem; }
.field-hint { font-size: .7rem; color: var(--olive-soft); opacity: .85; margin-top: -4px; padding-inline-start: 4px; }

.field-select-wrap { position: relative; }
.field-select { appearance: none; -webkit-appearance: none; padding-inline-end: 44px; cursor: pointer; }
.field-select-arrow {
  position: absolute;
  top: 50%; inset-inline-end: 16px;
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 18px; height: 18px;
  color: var(--copper-2);
  pointer-events: none;
  transition: transform .4s var(--ease);
}
.field-select-arrow svg { width: 16px; height: 16px; }
.field-select:focus + .field-select-arrow { transform: translateY(-50%) rotate(180deg); }

.field-points-wrap { position: relative; display: flex; align-items: center; }
.field-points-input {
  padding-inline-end: 76px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--copper-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.field-points-suffix {
  position: absolute;
  inset-inline-end: 18px;
  top: 50%; transform: translateY(-50%);
  font-size: .78rem; font-weight: 700;
  color: var(--copper-2);
  opacity: .75;
  pointer-events: none;
}

/* ------------------------------------------------------------
   ٢٠. الأزرار
   ------------------------------------------------------------ */
.modal-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

.btn-ghost {
  flex: 0 0 auto;
  padding: 14px 24px;
  border-radius: var(--r-pill);
  font-size: .88rem; font-weight: 700;
  color: var(--olive-soft);
  background: rgba(42,59,44,.05);
  border: 1px solid rgba(42,59,44,.10);
  transition: color .4s var(--ease), background .4s var(--ease), transform .4s var(--ease);
}
@media (hover: hover) {
  .btn-ghost:hover { color: var(--olive); background: rgba(42,59,44,.10); transform: translateY(-1px); }
}

.btn-primary {
  position: relative; overflow: hidden; isolation: isolate;
  flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px;
  padding: 14px 22px;
  border-radius: var(--r-pill);
  font-size: .9rem; font-weight: 800;
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3) 0%, var(--copper) 46%, var(--copper-2) 100%);
  box-shadow: var(--sh-inset), 0 1px 2px rgba(140,76,44,.30), 0 10px 24px -10px rgba(193,119,83,.85);
  transition: transform .42s var(--ease), box-shadow .42s var(--ease), filter .42s var(--ease);
}
.btn-primary .btn-arrow { width: 17px; height: 17px; transition: transform .45s var(--ease); }
@media (hover: hover) {
  .btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06) saturate(1.05); box-shadow: var(--sh-inset), 0 18px 36px -12px rgba(193,119,83,.95); }
  .btn-primary:hover .btn-arrow { transform: translateX(-5px); }
}
.btn-primary:active { transform: translateY(1px) scale(.986); }

/* ------------------------------------------------------------
   ٢١. نافذة المصادقة — Auth Modal
   ------------------------------------------------------------ */
.auth-modal { width: min(460px, 100%); }

/* --- المفتاح المُجزّأ: تسجيل الدخول / إنشاء حساب --- */
.auth-segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  margin-bottom: 22px;
  border-radius: var(--r-pill);
  background: rgba(42,59,44,.055);
  box-shadow: inset 0 1px 3px rgba(42,59,44,.07);
  isolation: isolate;
}

/*
  المنزلق (Glider) في سياق RTL:
  - نستخدم inset-inline-start (يُترجم إلى right: 5px في RTL)
    ليبدأ المنزلق فوق الزر الأول «تسجيل الدخول» (الأيمن).
  - JS يُحرّكه بـ translateX(-100%) إلى الزر الثاني
    «إنشاء حساب» (الأيسر)، وهو ما يعمل بشكل صحيح في الإحداثيات
    الفيزيائية لـ CSS transforms.
  - العرض calc(50% - 5px) دقيق رياضياً:
      عرض الحاوية = W
      عرض الخلية = (W - 10) / 2
      الحشوة الداخلية 5px على كل جانب
      ⇒ المنزلق يحتاج عرضاً = W/2 - 5 = calc(50% - 5px)
*/
.auth-seg-glider {
  position: absolute;
  top: 5px;
  bottom: 5px;
  inset-inline-start: 5px;
  width: calc(50% - 5px);
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--copper-3) 0%, var(--copper) 48%, var(--copper-2) 100%);
  box-shadow: var(--sh-inset), 0 6px 18px -6px rgba(193,119,83,.85), 0 0 0 1px rgba(193,119,83,.30);
  transition: transform .55s var(--ease);
  will-change: transform;
  pointer-events: none;
  z-index: 0;
}

.auth-seg {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: var(--r-pill);
  font-size: .84rem;
  font-weight: 800;
  color: var(--olive-soft);
  white-space: nowrap;
  transition: color .42s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.auth-seg.is-active { color: #FFF7F1; }
@media (hover: hover) { .auth-seg:not(.is-active):hover { color: var(--olive); } }

.auth-username-field { animation: usernameFieldIn .42s var(--ease-out) both; }
@keyframes usernameFieldIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }

.auth-feedback {
  display: none;
  padding: 11px 15px;
  border-radius: var(--r-sm);
  font-size: .82rem; font-weight: 700;
  line-height: 1.5;
}
.auth-feedback.is-visible { display: block; animation: authFbIn .4s var(--ease-out) both; }
.auth-feedback.is-error { color: #8A2E1B; background: rgba(193,119,83,.14); border: 1px solid rgba(193,119,83,.34); }
.auth-feedback.is-success { color: var(--olive-2); background: rgba(42,59,44,.10); border: 1px solid rgba(42,59,44,.20); }
@keyframes authFbIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }

.auth-spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,247,241,.35);
  border-top-color: #FFF7F1;
  animation: authSpin .7s linear infinite;
  flex: 0 0 auto;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.btn-primary.is-loading .btn-arrow { display: none; }
.auth-legal { margin-top: 4px; font-size: .68rem; line-height: 1.7; color: var(--olive-soft); opacity: .78; text-align: center; }

/* ------------------------------------------------------------
   ٢٢. نافذة الإدارة
   ------------------------------------------------------------ */
.admin-modal { width: min(820px, 100%); max-height: min(92dvh, 900px); }

.admin-segmented {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px; padding: 5px;
  margin-bottom: 22px;
  border-radius: var(--r-pill);
  background: rgba(42,59,44,.055);
  box-shadow: inset 0 1px 3px rgba(42,59,44,.07);
}
.admin-seg-glider {
  position: absolute;
  top: 5px; bottom: 5px; left: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--copper-3) 0%, var(--copper) 48%, var(--copper-2) 100%);
  box-shadow: var(--sh-inset), 0 6px 18px -6px rgba(193,119,83,.85), 0 0 0 1px rgba(193,119,83,.30);
  transition: transform .5s var(--ease), width .5s var(--ease);
  will-change: transform, width;
  pointer-events: none;
}
.admin-seg {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-pill);
  font-size: .82rem; font-weight: 800;
  color: var(--olive-soft);
  transition: color .42s var(--ease);
  white-space: nowrap;
}
.admin-seg svg { width: 15px; height: 15px; flex: 0 0 auto; }
.admin-seg.is-active { color: #FFF7F1; }
@media (hover: hover) { .admin-seg:not(.is-active):hover { color: var(--olive); } }

.admin-edit-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  margin-bottom: 18px;
  border-radius: var(--r-sm);
  font-size: .82rem; font-weight: 700;
  color: var(--copper-2);
  background: rgba(193,119,83,.12);
  border: 1px solid rgba(193,119,83,.30);
}
.admin-edit-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 4px rgba(193,119,83,.22);
  animation: pulseDot 2.2s var(--ease-soft) infinite;
  flex: 0 0 auto;
}
.admin-edit-cancel {
  margin-inline-start: auto;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 800;
  color: var(--copper-2);
  background: rgba(255,255,255,.60);
  border: 1px solid rgba(193,119,83,.30);
  transition: background .35s var(--ease), transform .35s var(--ease-back);
}
@media (hover: hover) { .admin-edit-cancel:hover { background: rgba(255,255,255,.95); transform: translateY(-1px); } }

.admin-form-title { margin-bottom: 4px; font-size: 1.05rem; font-weight: 800; color: var(--olive); }
.admin-manage-view { display: flex; flex-direction: column; gap: 14px; }
.admin-manage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(42,59,44,.10);
}
.admin-manage-title { display: inline-flex; align-items: baseline; gap: 8px; font-size: .82rem; font-weight: 700; color: var(--olive-soft); }
.admin-manage-count { font-size: 1.15rem; font-weight: 800; color: var(--copper-2); font-variant-numeric: tabular-nums; }
.admin-refresh {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: .76rem; font-weight: 700;
  color: var(--olive-soft);
  background: rgba(42,59,44,.05);
  border: 1px solid rgba(42,59,44,.08);
  transition: color .35s var(--ease), background .35s var(--ease);
}
.admin-refresh svg { width: 13px; height: 13px; transition: transform .5s var(--ease-back); }
.admin-refresh.is-loading svg { animation: adminSpin 1s linear infinite; }
@keyframes adminSpin { to { transform: rotate(360deg); } }
@media (hover: hover) { .admin-refresh:hover { color: var(--copper-2); background: var(--copper-a10); } .admin-refresh:hover svg { transform: rotate(60deg); } }

.admin-archive-note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: .76rem; line-height: 1.7;
  color: var(--olive-soft);
  background: rgba(193,119,83,.06);
  border: 1px dashed rgba(193,119,83,.25);
}
.admin-archive-note svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--copper-2); margin-top: 2px; }

.admin-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: min(52dvh,520px);
  overflow-y: auto;
  padding-inline-end: 4px;
  margin-inline-end: -4px;
  overscroll-behavior: contain;
}

.admin-item {
  position: relative;
  display: grid; grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: linear-gradient(160deg, rgba(255,255,255,.82), rgba(244,242,236,.58));
  border: 1px solid rgba(42,59,44,.08);
  box-shadow: var(--sh-inset);
  animation: adminItemIn .4s var(--ease-out) both;
}
@keyframes adminItemIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
@media (hover: hover) { .admin-item:hover { border-color: rgba(193,119,83,.28); box-shadow: 0 0 0 1px rgba(193,119,83,.12), var(--sh-soft); } }
.admin-item.is-archived { background: linear-gradient(160deg, rgba(240,236,225,.7), rgba(230,226,215,.5)); border-style: dashed; }
.admin-item.is-confirming { border-color: rgba(193,119,83,.50); background: linear-gradient(160deg, rgba(255,248,240,.95), rgba(252,244,234,.78)); }

.admin-item-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.admin-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-item-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-pill); font-size: .66rem; font-weight: 800; }
.admin-item-badge.is-ayah { color: var(--copper-2); background: var(--copper-a10); border: 1px solid var(--copper-a22); }
.admin-item-badge.is-hadith { color: var(--olive-2); background: rgba(42,59,44,.08); border: 1px solid rgba(42,59,44,.18); }
.admin-item-badge.is-archived { color: #6E6B60; background: rgba(140,130,110,.12); border: 1px solid rgba(140,130,110,.28); }
.admin-item-ref { font-size: .82rem; font-weight: 800; color: var(--olive); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-item-points { margin-inline-start: auto; font-size: .68rem; font-weight: 800; color: var(--copper-2); }
.admin-item-content { font-size: .78rem; line-height: 1.7; color: var(--olive-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.admin-item-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.admin-actions-default, .admin-actions-confirm { display: inline-flex; align-items: center; gap: 6px; }
.admin-actions-confirm { display: none; }
.admin-item.is-confirming .admin-actions-default { display: none; }
.admin-item.is-confirming .admin-actions-confirm { display: inline-flex; }

.admin-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 800;
  transition: color .3s var(--ease), background .3s var(--ease), transform .35s var(--ease-back);
}
.admin-action svg { width: 12px; height: 12px; }
.admin-action-edit { color: var(--olive-2); background: rgba(42,59,44,.06); border: 1px solid rgba(42,59,44,.12); }
.admin-action-restore { color: #2E6B3E; background: rgba(60,140,80,.08); border: 1px solid rgba(60,140,80,.22); }
.admin-action-delete { color: #8A2E1B; background: var(--copper-a10); border: 1px solid rgba(193,119,83,.26); }
.admin-action-confirm { color: #FFF7F1; background: linear-gradient(135deg, var(--copper-3), var(--copper-2)); border: 1px solid rgba(193,119,83,.50); }
.admin-action-cancel { color: var(--olive-soft); background: rgba(42,59,44,.05); border: 1px solid rgba(42,59,44,.10); }
@media (hover: hover) {
  .admin-action-edit:hover { color: var(--copper-2); background: var(--copper-a10); transform: translateY(-1px); }
  .admin-action-restore:hover { background: rgba(60,140,80,.16); transform: translateY(-1px); }
  .admin-action-delete:hover { background: rgba(193,119,83,.20); transform: translateY(-1px); }
  .admin-action-confirm:hover { transform: translateY(-1px); }
  .admin-action-cancel:hover { background: rgba(42,59,44,.10); }
}
.admin-action:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.admin-item.is-skeleton {
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(255,255,255,.85) 40%, rgba(255,255,255,.55) 80%);
  background-size: 240% 100%;
  animation: adminShimmer 1.6s linear infinite;
}
@keyframes adminShimmer { from{background-position:120% 0} to{background-position:-120% 0} }
.admin-skel-line { height: 10px; border-radius: 6px; background: rgba(42,59,44,.07); }
.admin-skel-line.w40 { width: 40%; }
.admin-skel-line.w70 { width: 70%; }
.admin-skel-line.w90 { width: 90%; }
.admin-empty { padding: 40px 24px; text-align: center; border-radius: var(--r-md); background: linear-gradient(160deg, rgba(255,255,255,.80), rgba(244,242,236,.55)); border: 1px dashed rgba(42,59,44,.16); }
.admin-empty strong { display: block; margin-bottom: 6px; font-size: 1rem; font-weight: 800; color: var(--olive); }
.admin-empty span { font-size: .82rem; color: var(--olive-soft); }

/* ------------------------------------------------------------
   ٢٣. نافذة المشاركة
   ------------------------------------------------------------ */
.share-modal { width: min(520px, 100%); }

.share-preview {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: var(--r-sm);
  background: linear-gradient(160deg, rgba(255,255,255,.78), rgba(252,248,242,.60));
  border: 1px solid rgba(255,255,255,.80);
  box-shadow: var(--sh-inset);
}
.share-preview-ref { font-size: .78rem; font-weight: 800; color: var(--copper-2); }
.share-preview-text {
  font-size: .84rem; font-weight: 500; line-height: 1.7;
  color: var(--olive-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }

.share-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  font-size: .84rem; font-weight: 800;
  color: var(--olive);
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(248,245,238,.72));
  border: 1px solid rgba(255,255,255,.86);
  box-shadow: var(--sh-inset), 0 6px 16px -10px rgba(42,59,44,.35);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  text-align: start;
}
.share-btn-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  color: #FFF7F1;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 4px 12px -4px rgba(0,0,0,.30);
}
.share-btn-icon svg { width: 18px; height: 18px; }
.share-btn-label { flex: 1 1 auto; min-width: 0; }

.share-btn-whatsapp .share-btn-icon { background: linear-gradient(145deg, #34D07D, #1E9C5A); }
.share-btn-x .share-btn-icon { background: linear-gradient(145deg, #2E2E2E, #0A0A0A); }
.share-btn-telegram .share-btn-icon { background: linear-gradient(145deg, #2EB1E6, #1B85B6); }
.share-btn-copy .share-btn-icon { background: linear-gradient(145deg, var(--copper-3), var(--copper-2)); }

@media (hover: hover) {
  .share-btn:hover { transform: translateY(-2px); box-shadow: var(--sh-inset), 0 14px 30px -12px rgba(42,59,44,.45); }
}
.share-btn:active { transform: translateY(1px) scale(.99); }

.share-url {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(42,59,44,.045);
  border: 1px solid rgba(42,59,44,.08);
  box-shadow: var(--sh-inset);
}
.share-url input {
  flex: 1 1 auto; min-width: 0;
  padding: 6px 0;
  background: transparent;
  border: 0;
  font-size: .78rem; font-weight: 600;
  color: var(--olive-soft);
  text-overflow: ellipsis;
}
.share-url input:focus { outline: none; }
.share-url-copy {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3), var(--copper-2));
  box-shadow: var(--sh-inset), 0 6px 14px -6px rgba(193,119,83,.85);
  transition: transform .35s var(--ease-back), filter .35s var(--ease);
}
.share-url-copy svg { width: 15px; height: 15px; }
@media (hover: hover) { .share-url-copy:hover { transform: scale(1.08); filter: brightness(1.06); } }

/* ------------------------------------------------------------
   ٢٤. نافذة إتمام القراءة
   ------------------------------------------------------------ */
.deed-view-overlay {
  position: fixed; inset: 0; z-index: 600;
  display: grid; place-items: center;
  padding: clamp(16px,3vw,40px);
  opacity: 0; visibility: hidden;
  transition: opacity .55s var(--ease), visibility 0s linear .55s;
}
.deed-view-overlay.is-open {
  opacity: 1; visibility: visible;
  transition: opacity .55s var(--ease), visibility 0s linear 0s;
}
.deed-view-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, rgba(42,59,44,.72), rgba(15,25,18,.94));
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  cursor: pointer;
}
.deed-view-card {
  position: relative; z-index: 1;
  width: min(720px, 100%);
  max-height: min(90dvh, 860px);
  overflow-y: auto;
  padding: clamp(30px,4.5vw,56px) clamp(24px,4vw,50px);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(252,250,246,.97), rgba(244,242,236,.92) 55%, rgba(237,234,225,.95));
  border: 1px solid rgba(255,255,255,.90);
  box-shadow:
    var(--sh-inset),
    0 2px 6px rgba(42,59,44,.12),
    0 50px 110px -30px rgba(15,25,18,.85),
    0 0 0 1px rgba(193,119,83,.25);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  transform: translateY(34px) scale(.94);
  opacity: 0;
  transition: transform .72s var(--ease-back), opacity .55s var(--ease);
  overscroll-behavior: contain;
}
.deed-view-overlay.is-open .deed-view-card { transform: translateY(0) scale(1); opacity: 1; }
.deed-view-card::before {
  content: '';
  position: absolute;
  inset-inline: 18%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,154,120,.95), transparent);
  box-shadow: 0 0 26px rgba(193,119,83,.80);
}

.deed-view-ref-chip {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 26px;
  padding: 9px 20px 9px 16px;
  border-radius: var(--r-pill);
  font-size: .80rem;
  color: var(--olive-soft);
  background: var(--copper-a10);
  border: 1px solid rgba(193,119,83,.26);
}
.deed-view-ref-chip strong { font-weight: 800; color: var(--copper-2); }
.deed-view-chip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 4px rgba(193,119,83,.22);
  animation: pulseDot 2.4s var(--ease-soft) infinite;
}

.deed-view-type-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 28px;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  font-size: .74rem; font-weight: 800;
  color: var(--copper-2);
  background: var(--copper-a10);
  border: 1px solid var(--copper-a22);
}
.deed-view-type-badge.is-hadith { color: var(--olive-2); background: rgba(42,59,44,.08); border-color: rgba(42,59,44,.20); }

.deed-view-text {
  position: relative;
  margin: 0 0 24px;
  padding-inline-start: 28px;
  font-size: clamp(1.15rem,2.8vw,1.45rem);
  font-weight: 700;
  line-height: 2.15;
  color: var(--olive);
}
.deed-view-text::before {
  content: '';
  position: absolute;
  inset-inline-start: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: var(--r-pill);
  background: linear-gradient(to bottom, var(--copper-3), var(--copper-2));
  box-shadow: 0 0 14px rgba(193,119,83,.55);
}

.deed-view-ref {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 34px;
  font-size: .94rem; font-weight: 700;
  color: var(--olive-soft);
}
.deed-view-ref::before {
  content: '';
  width: 22px; height: 1px;
  background: var(--copper);
  opacity: .75;
  border-radius: var(--r-pill);
}

.deed-view-points {
  display: inline-flex; align-items: baseline; gap: 8px;
  margin-bottom: 36px;
  padding: 14px 28px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, rgba(216,154,120,.24), rgba(193,119,83,.14));
  border: 1px solid rgba(193,119,83,.32);
  box-shadow: var(--sh-inset), 0 8px 22px -10px rgba(193,119,83,.75);
}
.deed-view-points .points-value { font-size: 1.65rem; font-weight: 800; color: var(--copper-2); line-height: 1; font-variant-numeric: tabular-nums; }
.deed-view-points .points-label { font-size: .84rem; font-weight: 700; color: var(--copper-2); opacity: .85; }

.deed-view-actions { display: flex; flex-direction: column; gap: 12px; }
.deed-view-actions .btn-primary { width: 100%; padding: 17px 26px; font-size: .96rem; justify-content: center; }
.deed-view-actions .btn-ghost { width: 100%; padding: 14px 24px; font-size: .88rem; text-align: center; }

#deedViewComplete:disabled,
#deedViewComplete.is-cooldown {
  cursor: not-allowed;
  color: rgba(240,235,225,.75);
  background: linear-gradient(135deg, #6B6B60, #4E4E45);
  border-color: rgba(255,255,255,.10);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.28);
  filter: none;
  transform: none;
  opacity: .85;
}
#deedViewComplete:disabled:hover { transform: none; filter: none; }
#deedViewComplete:disabled .btn-arrow,
#deedViewComplete.is-cooldown .btn-arrow { display: none; }

.deed-view-spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,247,241,.35);
  border-top-color: #FFF7F1;
  animation: authSpin .7s linear infinite;
  display: inline-block;
  flex: 0 0 auto;
}

.deed-view-share-btn {
  margin-top: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 13px 22px;
  border-radius: var(--r-pill);
  font-size: .86rem; font-weight: 800;
  color: var(--copper-2);
  background: linear-gradient(160deg, rgba(255,255,255,.72), rgba(252,246,240,.55));
  border: 1.5px solid rgba(193,119,83,.34);
  box-shadow: var(--sh-inset), 0 8px 22px -12px rgba(193,119,83,.55);
  transition: transform .4s var(--ease), filter .4s var(--ease), box-shadow .4s var(--ease);
}
.deed-view-share-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
@media (hover: hover) {
  .deed-view-share-btn:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: var(--sh-inset), 0 14px 28px -12px rgba(193,119,83,.85); }
}
.deed-view-share-btn:active { transform: translateY(1px) scale(.99); }

.deed-view-footer-note { margin-top: 22px; font-size: .72rem; line-height: 1.7; color: var(--olive-soft); opacity: .72; text-align: center; }

/* ------------------------------------------------------------
   ٢٥. التنبيه السريع
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  z-index: 300;
  bottom: clamp(22px,4vw,42px);
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100vw - 40px);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px 14px 18px;
  border-radius: var(--r-pill);
  font-size: .9rem; font-weight: 700;
  color: var(--olive);
  background: rgba(252,250,246,.82);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow:
    var(--sh-inset),
    0 1px 2px rgba(42,59,44,.06),
    0 22px 50px -18px rgba(42,59,44,.42),
    0 0 0 1px rgba(193,119,83,.18);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  opacity: 0;
  transform: translateY(26px) scale(.94);
  pointer-events: none;
  transition: opacity .5s var(--ease), transform .62s var(--ease-back);
}
.toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #FFF7F1;
  background: linear-gradient(135deg, var(--copper-3), var(--copper-2));
  box-shadow: 0 6px 16px -6px rgba(193,119,83,.9);
}
.toast-icon svg { width: 15px; height: 15px; }
.toast.is-visible .toast-icon svg { animation: toastCheck .55s var(--ease-back) both; }
@keyframes toastCheck {
  0%{transform:scale(0) rotate(-30deg);opacity:0}
  60%{transform:scale(1.22) rotate(6deg);opacity:1}
  100%{transform:scale(1) rotate(0);opacity:1}
}

/* ------------------------------------------------------------
   ٢٦. أنيميشن الظهور المتدرّج
   ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(30px) scale(.982);
  transition: opacity .85s var(--ease-out), transform 1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 72ms);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* ============================================================
   ٢٧. الاستجابة للأحجام المختلفة — Mobile-First Overhaul
   ============================================================ */

@media (hover: none) and (pointer: coarse) {
  .verse-card:hover,
  .stat:hover,
  .board-row:hover,
  .rank-1:hover,
  .rank-2:hover,
  .rank-3:hover,
  .admin-item:hover,
  .share-btn:hover,
  .empty-state-cta:hover,
  .auth-btn:hover,
  .btn-primary:hover,
  .btn-verse-share:hover,
  .btn-verse-complete:hover {
    transform: none;
    box-shadow: inherit;
    filter: none;
  }
  .verse-card:hover .card-sheen { animation: none; }
  .verse-card:hover::before { opacity: 0; }
  .brand:hover .brand-logo-wrap { transform: none; }
  .tab:hover svg { transform: none; }
  .auth-logout:hover { transform: none; }
  .ref-dismiss:hover { transform: none; }
  .modal-close:hover { transform: none; }
  .admin-refresh:hover svg { transform: none; }
  .about-trigger:hover svg, .admin-trigger:hover svg { transform: none; }

  .tab,
  .auth-btn,
  .auth-logout,
  .btn-verse,
  .btn-primary,
  .btn-ghost,
  .modal-close,
  .admin-action,
  .admin-seg,
  .share-btn,
  .share-url-copy,
  .tree-reset,
  .ref-dismiss,
  .auth-seg {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

@media (max-width: 1024px) {
  :root {
    --header-h: 100px;
  }

  .header-inner {
    gap: clamp(8px, 1.5vw, 16px);
    padding: 8px clamp(10px, 1.4vw, 16px);
  }

  .tabs {
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    gap: 3px;
  }
  .tabs::-webkit-scrollbar { display: none; }

  .tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: .82rem;
    scroll-snap-align: start;
    min-height: 40px;
  }
  .tab svg { width: 15px; height: 15px; }
  .tab-inner { gap: 7px; }

  .brand-title { font-size: 1.02rem; }
  .brand-title span,
  .brand-title em { display: none; }

  .deeds-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 18px;
  }

  .tree-stage { min-height: clamp(540px, 68vh, 720px); }
  .stats-row { gap: 12px; }
  .stat { padding: 18px 10px; }
  .stat-num { font-size: clamp(1.35rem, 3.8vw, 1.75rem); }
  .panel { padding-left: clamp(16px, 3vw, 32px); padding-right: clamp(16px, 3vw, 32px); }
}

@media (max-width: 980px) {
  .brand-title span { display: none; }
  .brand-title em { display: none; }
  .brand-title { font-size: 1rem; }
}

@media (max-width: 819px) {
  :root {
    --header-h: 128px;
    --gut: clamp(14px, 4vw, 24px);
    --r-lg: 24px;
    --r-md: 18px;
    --r-sm: 12px;
  }

  .site-header { padding: 8px 10px; }

  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand auth"
      "tabs  tabs";
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
    padding: 10px 12px;
    border-radius: 24px;
  }

  .brand {
    grid-area: brand;
    justify-content: flex-start;
    min-width: 0;
    gap: 10px;
  }
  .brand-logo-wrap {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }
  .brand-title {
    font-size: .96rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-title span,
  .brand-title em { display: none; }
  .brand-tag { display: none; }

  .tabs {
    grid-area: tabs;
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    gap: 4px;
    padding: 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
  }
  .tabs::-webkit-scrollbar { display: none; }

  .tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    font-size: .82rem;
    scroll-snap-align: start;
  }
  .tab-inner { gap: 6px; }
  .tab svg { width: 15px; height: 15px; }

  .auth-slot {
    grid-area: auth;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .auth-btn {
    padding: 10px 12px;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
  }
  .auth-btn-text { display: none; }

  .auth-user {
    padding: 4px 6px 4px 4px;
    gap: 6px;
  }
  .auth-avatar {
    width: 30px;
    height: 30px;
    font-size: .78rem;
  }
  .auth-identity { display: none; }
  .auth-logout {
    width: 36px;
    height: 36px;
  }
  .auth-logout svg { width: 15px; height: 15px; }

  .offline-banner {
    top: calc(var(--header-h) + 4px);
    inset-inline: 10px;
    font-size: .78rem;
    padding: 10px 14px;
  }

  .referral-banner {
    top: calc(var(--header-h) + 6px);
    inset-inline: 10px;
    padding: 10px 12px;
    border-radius: 18px;
    flex-wrap: wrap;
  }
  .ref-text {
    font-size: .78rem;
    white-space: normal;
    line-height: 1.5;
  }
  .ref-dismiss {
    width: 36px;
    height: 36px;
  }
  .ref-dismiss svg { width: 13px; height: 13px; }

  .panel {
    padding: clamp(22px, 5vw, 34px) var(--gut) clamp(48px, 8vw, 80px);
  }
  .panel-head { margin-bottom: clamp(22px, 4vw, 32px); }
  .panel-title { font-size: clamp(1.5rem, 5.5vw, 2rem); line-height: 1.3; }
  .panel-lead { font-size: clamp(.88rem, 3vw, .98rem); line-height: 1.85; }
  .eyebrow { padding: 6px 14px; font-size: .72rem; margin-bottom: 16px; }

  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 24px;
  }
  .stat {
    padding: 14px 8px;
    border-radius: var(--r-sm);
    gap: 2px;
  }
  .stat-num { font-size: 1.3rem; }
  .stat-label { font-size: .66rem; line-height: 1.4; }

  .deeds-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .verse-card {
    padding: 22px 20px 20px;
    border-radius: var(--r-md);
    gap: 14px;
  }
  .verse-head { gap: 8px; }
  .verse-text {
    font-size: 1.02rem;
    line-height: 2;
    padding-inline-start: 18px;
  }
  .verse-ref { font-size: .78rem; }
  .verse-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .btn-verse {
    min-height: 48px;
    padding: 12px 12px;
    font-size: .82rem;
  }

  .empty-state { padding: 32px 20px; }
  .empty-state-icon { width: 58px; height: 58px; }
  .empty-state-icon svg { width: 26px; height: 26px; }
  .empty-state-title { font-size: 1rem; }
  .empty-state-text { font-size: .85rem; }
  .empty-state-cta {
    min-height: 44px;
    padding: 12px 22px;
    font-size: .82rem;
  }

  .sadaqah-empty {
    padding: 36px 22px;
    border-radius: var(--r-md);
  }
  .sadaqah-title { font-size: 1.1rem; }
  .sadaqah-note { font-size: .86rem; }

  .tree-stats {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px 16px;
  }
  .tree-stat-breakdown {
    justify-content: stretch;
    width: 100%;
    gap: 8px;
  }
  .tree-stat-chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 12px;
  }
  .tree-stat-value { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .tree-stat-chip-value { font-size: 1.05rem; }

  .tree-stage {
    min-height: clamp(440px, 68vh, 600px);
    border-radius: var(--r-md);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: contain;
  }
  .tree-reset {
    width: 48px;
    height: 48px;
    top: 12px;
    inset-inline-end: 12px;
  }
  .tree-reset svg { width: 20px; height: 20px; }
  .tree-legend {
    gap: 10px;
    padding-inline: 12px;
    bottom: 12px;
  }
  .legend-item { font-size: .68rem; gap: 6px; }
  .legend-dot { width: 8px; height: 8px; }

  .board { gap: 10px; }
  .board-row {
    padding: 14px 14px;
    gap: 10px;
    border-radius: var(--r-md);
  }
  .rank-num {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: .86rem;
  }
  .board-name { font-size: .94rem; }
  .board-sub { font-size: .7rem; }
  .board-score { padding: 6px 12px; }
  .board-score b { font-size: .98rem; }
  .medal {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }
  .medal svg { width: 20px; height: 20px; }

  .site-footer { padding: 32px var(--gut) 30px; }
  .footer-ayah { font-size: .92rem; line-height: 2; }
  .footer-actions { gap: 8px; }
  .about-trigger, .admin-trigger {
    padding: 10px 16px;
    min-height: 44px;
    font-size: .76rem;
  }
  .about-trigger svg, .admin-trigger svg { width: 15px; height: 15px; }

  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-height: min(92dvh, 100%);
    padding: 22px 18px 20px;
    border-radius: 22px;
  }
  .modal-head {
    padding-bottom: 16px;
    margin-bottom: 18px;
  }
  .modal-title { font-size: clamp(1.15rem, 4.5vw, 1.4rem); }
  .modal-close {
    width: 44px;
    height: 44px;
    top: -6px;
  }
  .modal-close svg { width: 19px; height: 19px; }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }
  .btn-ghost, .btn-primary {
    width: 100%;
    min-height: 48px;
    padding: 14px 20px;
    font-size: .9rem;
    justify-content: center;
  }

  .field-input {
    padding: 13px 16px;
    font-size: 16px;
    border-radius: 12px;
    line-height: 1.5;
  }
  .field-input::placeholder { font-size: 15px; }
  .field-area { min-height: 100px; }
  .field-area-lg { min-height: 140px; font-size: 16px; }
  .field-label { font-size: .82rem; }

  .auth-modal { width: 100%; }
  .auth-segmented {
    padding: 4px;
    margin-bottom: 18px;
  }
  .auth-seg {
    padding: 12px 10px;
    font-size: .84rem;
    min-height: 44px;
  }
  .auth-legal { font-size: .72rem; }

  .admin-modal {
    width: 100%;
    max-height: min(94dvh, 100%);
  }
  .admin-segmented {
    grid-template-columns: repeat(3, 1fr);
    padding: 4px;
    gap: 3px;
    margin-bottom: 18px;
  }
  .admin-seg {
    padding: 12px 8px;
    font-size: .74rem;
    min-height: 48px;
    gap: 6px;
  }
  .admin-seg svg { width: 15px; height: 15px; }
  .admin-item {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 14px;
  }
  .admin-item-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin-action {
    padding: 10px 14px;
    min-height: 40px;
    font-size: .74rem;
    gap: 6px;
  }
  .admin-action svg { width: 13px; height: 13px; }
  .admin-list { max-height: min(58dvh, 480px); }
  .admin-manage-head { flex-wrap: wrap; gap: 10px; }
  .admin-edit-banner { flex-wrap: wrap; gap: 8px; }

  .share-grid { grid-template-columns: 1fr; gap: 10px; }
  .share-btn {
    padding: 14px 16px;
    min-height: 58px;
  }
  .share-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  .share-btn-icon svg { width: 19px; height: 19px; }
  .share-url { padding: 6px 6px 6px 12px; }
  .share-url-copy { width: 40px; height: 40px; }
  .share-url-copy svg { width: 17px; height: 17px; }

  .deed-view-overlay { padding: 12px; align-items: flex-end; }
  .deed-view-card {
    padding: 26px 20px 24px;
    border-radius: 22px;
    max-height: min(94dvh, 100%);
  }
  .deed-view-text {
    font-size: 1.1rem;
    line-height: 2.05;
    padding-inline-start: 22px;
  }
  .deed-view-ref { font-size: .86rem; margin-bottom: 24px; }
  .deed-view-points {
    padding: 12px 22px;
    margin-bottom: 26px;
  }
  .deed-view-points .points-value { font-size: 1.4rem; }
  .deed-view-actions .btn-primary { padding: 16px 24px; font-size: .94rem; }
  .deed-view-actions .btn-ghost { padding: 14px 20px; font-size: .86rem; }
  .deed-view-share-btn { padding: 14px 20px; font-size: .84rem; }

  .node-popover {
    min-width: 200px;
    max-width: calc(100vw - 24px);
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 13px;
  }
  .node-popover-avatar {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    border-radius: 12px;
  }
  .node-popover[data-type="indirect"] .node-popover-avatar { font-size: 1.15rem; }
  .node-popover-title { font-size: .92rem; }
  .node-popover-subtitle { font-size: .66rem; }
  .node-popover-row { padding: 8px 10px; gap: 8px; }
  .node-popover-row-value { max-width: 120px; font-size: .74rem; }
  .node-popover-row-label { font-size: .68rem; }

  .toast {
    bottom: 20px;
    padding: 12px 18px 12px 14px;
    font-size: .84rem;
    max-width: calc(100vw - 24px);
    gap: 10px;
  }
  .toast-icon { width: 26px; height: 26px; }
  .toast-icon svg { width: 14px; height: 14px; }

  .about-modal { width: 100%; }
  .about-hero { padding: 22px 18px 20px; }
  .about-hero-quote { font-size: .94rem; line-height: 1.95; }
  .about-section {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }
  .about-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }
  .about-icon svg { width: 20px; height: 20px; }
  .about-section h4 { font-size: .98rem; }
  .about-section p { font-size: .85rem; line-height: 1.85; }
  .about-closing { padding: 20px 18px 18px; }
  .about-closing p { font-size: .86rem; }

  .panel, main, .deeds-grid, .board, .admin-list {
    overflow-x: clip;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .deeds-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  }
  .verse-actions { grid-template-columns: 1fr 1fr; }
  .tree-stage { min-height: clamp(420px, 62vh, 560px); }
}

@media (max-width: 639px) {
  .stats-row { gap: 6px; }
  .stat { padding: 12px 6px; }
  .stat-num { font-size: 1.15rem; }
  .stat-label { font-size: .62rem; }

  .verse-text { font-size: .98rem; line-height: 1.95; }
  .verse-ref { font-size: .74rem; }
  .verse-badge { font-size: .68rem; padding: 5px 11px 5px 9px; }
  .card-points { padding: 5px 11px; font-size: .68rem; }
  .card-points b { font-size: .86rem; }

  .share-grid { grid-template-columns: 1fr; }

  .admin-seg span { display: none; }
  .admin-seg svg { width: 17px; height: 17px; }
  .admin-seg { min-height: 46px; }

  .deed-view-card { padding: 24px 18px 22px; }
  .deed-view-text { font-size: 1.02rem; line-height: 2; }
  .deed-view-points { padding: 12px 20px; }
  .deed-view-points .points-value { font-size: 1.3rem; }
}

@media (max-width: 519px) {
  :root { --header-h: 122px; }

  .site-header { padding: 6px 8px; }
  .header-inner {
    padding: 8px 10px;
    border-radius: 20px;
    column-gap: 8px;
    row-gap: 6px;
  }
  .brand-logo-wrap {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .brand-title { font-size: .84rem; }

  .tab {
    padding: 9px 13px;
    font-size: .76rem;
    min-height: 42px;
  }
  .tab-inner { gap: 5px; }
  .tab svg { width: 14px; height: 14px; }

  .auth-btn { padding: 10px 10px; min-width: 42px; min-height: 42px; }
  .auth-avatar { width: 28px; height: 28px; font-size: .74rem; }
  .auth-logout { width: 32px; height: 32px; }
  .auth-logout svg { width: 14px; height: 14px; }

  .verse-actions { grid-template-columns: 1fr; }

  .board-row { gap: 8px; padding: 12px 12px; }
  .rank-num { width: 32px; height: 32px; font-size: .8rem; border-radius: 11px; }
  .board-score i { display: none; }
  .board-score { padding: 5px 10px; }
  .medal { width: 34px; height: 34px; border-radius: 12px; }
  .medal svg { width: 18px; height: 18px; }
  .board-name { font-size: .88rem; }
  .board-sub { font-size: .66rem; }

  .deed-view-card { padding: 22px 16px 20px; }
  .deed-view-text { font-size: .98rem; padding-inline-start: 18px; }
  .deed-view-ref { font-size: .8rem; margin-bottom: 20px; }
  .deed-view-points { padding: 11px 18px; margin-bottom: 22px; }
  .deed-view-points .points-value { font-size: 1.25rem; }
  .deed-view-points .points-label { font-size: .78rem; }

  .tree-stats { padding: 16px 14px; }
  .tree-stat-value { font-size: 1.7rem; }
  .tree-stat-chip { padding: 9px 10px; }
  .tree-stat-chip-value { font-size: 1rem; }
  .tree-stat-chip-label { font-size: .62rem; }

  .tree-stage { min-height: 420px; }
  .tree-legend { gap: 8px; }
  .legend-item { font-size: .64rem; gap: 5px; }

  .share-preview { padding: 12px 14px; }
  .share-preview-ref { font-size: .74rem; }
  .share-preview-text { font-size: .78rem; }

  .modal { padding: 20px 16px 18px; border-radius: 20px; }
  .modal-title { font-size: 1.12rem; }
  .modal-close { width: 40px; height: 40px; }

  .auth-seg { font-size: .8rem; padding: 11px 8px; }

  .about-hero { padding: 20px 16px 18px; }
  .about-hero-quote { font-size: .86rem; }
  .about-section { grid-template-columns: 40px 1fr; gap: 10px; }
  .about-icon { width: 40px; height: 40px; border-radius: 12px; }
  .about-icon svg { width: 18px; height: 18px; }
  .about-section h4 { font-size: .92rem; }
  .about-section p { font-size: .82rem; }

  .footer-ayah { font-size: .86rem; line-height: 1.95; }
  .footer-note { font-size: .72rem; }

  .footer-socials { gap: 8px; margin-top: 4px; }
  .social-link { width: 42px; height: 42px; min-width: 42px; min-height: 42px; }
  .social-link svg { width: 18px; height: 18px; }

  .admin-action span { font-size: .72rem; }
  .admin-action { padding: 9px 12px; min-height: 38px; }
}

@media (max-width: 399px) {
  :root {
    --header-h: 116px;
    --gut: 12px;
  }

  .site-header { padding: 6px 8px; }
  .header-inner {
    padding: 8px 10px;
    border-radius: 20px;
    column-gap: 8px;
    row-gap: 6px;
  }
  .brand-logo-wrap {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  .brand-title { font-size: .78rem; }
  .brand { gap: 8px; }

  .tab {
    padding: 8px 11px;
    font-size: .72rem;
    min-height: 40px;
  }
  .tab-inner { gap: 4px; }
  .tab svg { width: 13px; height: 13px; }

  .auth-btn { min-width: 40px; min-height: 40px; padding: 8px; }
  .auth-avatar { width: 26px; height: 26px; font-size: .72rem; }
  .auth-logout { width: 30px; height: 30px; }
  .auth-logout svg { width: 13px; height: 13px; }

  .panel { padding-top: 18px; }
  .panel-title { font-size: 1.32rem; line-height: 1.3; }
  .panel-lead { font-size: .84rem; }
  .eyebrow { font-size: .68rem; padding: 5px 12px; margin-bottom: 14px; }

  .stat-num { font-size: 1.05rem; }
  .stat-label { font-size: .58rem; }

  .verse-card { padding: 18px 16px 16px; gap: 12px; }
  .verse-text { font-size: .94rem; line-height: 1.95; padding-inline-start: 14px; }
  .verse-text::before { width: 2.5px; }
  .verse-ref { font-size: .72rem; }
  .btn-verse { font-size: .78rem; padding: 11px 10px; gap: 6px; }
  .btn-verse svg { width: 15px; height: 15px; }

  .modal { padding: 18px 14px 16px; border-radius: 18px; }
  .modal-title { font-size: 1.08rem; }
  .modal-close { width: 38px; height: 38px; top: -4px; }
  .modal-close svg { width: 17px; height: 17px; }
  .modal-head { padding-bottom: 14px; margin-bottom: 16px; }

  .auth-seg { font-size: .76rem; padding: 10px 8px; }

  .tree-stage { min-height: 380px; }
  .tree-reset { width: 44px; height: 44px; top: 10px; inset-inline-end: 10px; }
  .tree-reset svg { width: 18px; height: 18px; }

  .share-btn { padding: 12px 14px; min-height: 54px; font-size: .8rem; }
  .share-btn-icon { width: 32px; height: 32px; border-radius: 10px; }
  .share-btn-icon svg { width: 17px; height: 17px; }
  .share-url { padding: 5px 5px 5px 10px; }
  .share-url-copy { width: 36px; height: 36px; }

  .deed-view-card { padding: 20px 16px; border-radius: 18px; }
  .deed-view-text { font-size: .94rem; padding-inline-start: 16px; line-height: 1.95; }
  .deed-view-text::before { width: 2.5px; }
  .deed-view-points { padding: 10px 16px; margin-bottom: 20px; }
  .deed-view-points .points-value { font-size: 1.18rem; }
  .deed-view-points .points-label { font-size: .74rem; }

  .toast { font-size: .8rem; padding: 11px 16px 11px 12px; bottom: 16px; }
  .toast-icon { width: 24px; height: 24px; }
  .toast-icon svg { width: 13px; height: 13px; }

  .node-popover {
    min-width: 180px;
    padding: 12px 14px;
    border-radius: 14px;
  }
  .node-popover-avatar { width: 36px; height: 36px; font-size: .92rem; border-radius: 11px; }
  .node-popover-title { font-size: .86rem; }
  .node-popover-subtitle { font-size: .62rem; }
  .node-popover-row { padding: 7px 9px; gap: 7px; }
  .node-popover-row-value { max-width: 100px; font-size: .7rem; }

  .board-row { padding: 11px 11px; gap: 8px; }
  .rank-num { width: 30px; height: 30px; font-size: .76rem; border-radius: 10px; }
  .medal { width: 30px; height: 30px; border-radius: 10px; }
  .medal svg { width: 16px; height: 16px; }
  .board-name { font-size: .84rem; }
  .board-score { padding: 4px 9px; }
  .board-score b { font-size: .9rem; }

  .admin-seg { padding: 10px 6px; min-height: 42px; }
  .admin-seg svg { width: 16px; height: 16px; }

  .about-hero { padding: 18px 14px 16px; }
  .about-hero-quote { font-size: .82rem; }
  .about-section p { font-size: .78rem; }
  .about-closing { padding: 16px 14px; }

  .social-link { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  .social-link svg { width: 17px; height: 17px; }
  .footer-socials { gap: 7px; }
}

@media (max-width: 359px) {
  :root { --header-h: 112px; }

  .brand-logo-wrap { width: 34px; height: 34px; }
  .brand-title { font-size: .74rem; }
  .brand { gap: 7px; }

  .tab { padding: 7px 10px; font-size: .68rem; min-height: 38px; }
  .tab svg { width: 12px; height: 12px; }

  .stats-row { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stats-row .stat:last-child { grid-column: span 2; }

  .panel-title { font-size: 1.18rem; }
  .panel-lead { font-size: .8rem; }

  .modal { padding: 16px 12px 14px; border-radius: 16px; }
  .btn-primary, .btn-ghost { font-size: .82rem; padding: 13px 14px; }

  .deed-view-card { padding: 18px 14px; }
  .deed-view-text { font-size: .9rem; }
  .deed-view-points { padding: 9px 14px; }
  .deed-view-points .points-value { font-size: 1.1rem; }

  .verse-card { padding: 16px 14px 14px; }
  .verse-text { font-size: .9rem; }
  .btn-verse { font-size: .74rem; padding: 10px 8px; }

  .tree-stage { min-height: 360px; }
  .tree-legend { gap: 6px; }
  .legend-item { font-size: .6rem; gap: 4px; }
  .legend-dot { width: 7px; height: 7px; }

  .board-row { padding: 10px 10px; }
  .board-sub { display: none; }
  .medal { width: 28px; height: 28px; }
  .medal svg { width: 14px; height: 14px; }
  .rank-num { width: 28px; height: 28px; font-size: .74rem; }
}

@media (orientation: landscape) and (max-height: 500px) {
  :root { --header-h: 92px; }

  .site-header { padding: 5px 10px; }
  .header-inner {
    padding: 8px 12px;
    border-radius: 20px;
    column-gap: 10px;
    row-gap: 6px;
  }

  .brand-logo-wrap { width: 36px; height: 36px; }
  .brand-title { font-size: .8rem; }

  .tab { min-height: 36px; padding: 7px 12px; font-size: .74rem; }

  .modal-overlay { padding: 8px; align-items: center; }
  .modal {
    max-height: 94dvh;
    padding: 18px 20px;
    border-radius: 18px;
  }
  .modal-head { padding-bottom: 12px; margin-bottom: 14px; }
  .modal-title { font-size: 1.1rem; }

  .tree-stage { min-height: 320px; }
  .tree-stats { padding: 12px 16px; gap: 12px; }
  .tree-stat-value { font-size: 1.6rem; }

  .deed-view-overlay { padding: 8px; }
  .deed-view-card { max-height: 94dvh; padding: 20px 22px; }
  .deed-view-text { font-size: .98rem; line-height: 1.9; margin-bottom: 16px; }
  .deed-view-points { margin-bottom: 18px; padding: 10px 18px; }
  .deed-view-ref { margin-bottom: 20px; }

  .admin-modal { max-height: 94dvh; }
  .admin-list { max-height: 40dvh; }
  .admin-archive-note { display: none; }

  .panel { padding-top: 18px; padding-bottom: 32px; }
  .panel-head { margin-bottom: 18px; }
}

@supports (padding: max(0px)) {
  .site-header {
    padding-inline-start: max(10px, env(safe-area-inset-left));
    padding-inline-end:   max(10px, env(safe-area-inset-right));
  }

  @media (max-width: 819px) {
    .header-inner {
      padding-inline-start: max(12px, env(safe-area-inset-left));
      padding-inline-end:   max(12px, env(safe-area-inset-right));
    }
  }

  .site-footer {
    padding-bottom: max(30px, env(safe-area-inset-bottom));
  }

  .toast {
    margin-bottom: env(safe-area-inset-bottom);
  }

  @media (max-width: 819px) {
    .modal-overlay,
    .deed-view-overlay {
      padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
  }
}

@media (max-width: 819px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  body {
    overscroll-behavior-x: none;
  }
  main, .panel, .deeds-grid, .board, .admin-list {
    overflow-x: clip;
    max-width: 100%;
  }
  img, svg, canvas {
    max-width: 100%;
  }
}

/* ------------------------------------------------------------
   ٢٨. تقليل الحركة
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .orb, .grain, .brand-logo-wrap::after { animation: none !important; }
  .rank-1, .rank-2, .rank-3 { animation: none !important; }
  .sadaqah-icon-wrap, .sadaqah-dots i { animation: none !important; }
  .about-section, .about-closing { animation: none !important; }
  .tabs { scroll-behavior: auto; }
  .social-link { transition: none !important; }
}