/* ============ الأنِيس — طبقة الحركة (على طابع «موشن خام») ============
   ١) نابض واحد لكل ما يهبط في الموقع: تجاوز ١٠٪ ثم استقرار سريع (zeta 0.59, omega 14.5).
   ٢) العناوين والأرقام «تهبط» كالكلمة المنطوقة: تكبير ١٤٪ و١٢px ثم expo.out في 0.45ث.
   ٣) الخروج حركة واحدة حاسمة: 0.2ث power4.in، ثلث مدة الدخول.
   ٤) الدخول متتابع للظاهر فقط، ولا يتجاوز تأخيره 0.4ث حتى لا يبطئ التصفح.
   ٥) الضغط: انكماش 0.85 لإطارين وحلقة تخرج من موضعه.
   ٦) شيء واحد فقط «يتنفس» في الحالة الساكنة (لهب السلسلة). */
:root {
  --e-land: cubic-bezier(0.34, 1.56, 0.64, 1);
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);           /* expo.out */
  --e-exit: cubic-bezier(0.895, 0.03, 0.685, 0.22); /* power4.in */
  --e-push: cubic-bezier(0.33, 1, 0.68, 1);          /* power2.out */
  --e-spring: var(--e-land);
  --e-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --t-press: 90ms; --t-small: 220ms; --t-enter: 850ms; --t-exit: 200ms;
}
@supports (animation-timing-function: linear(0, 1)) {
  :root { --e-land: linear(0, 0.042, 0.147, 0.287, 0.441, 0.592, 0.729, 0.846, 0.939, 1.009, 1.057, 1.085, 1.099, 1.1, 1.093, 1.081, 1.066, 1.051, 1.036, 1.023, 1.012, 1.003, 0.997, 0.993, 0.991, 0.99, 0.99, 0.991, 0.992, 0.994, 0.995, 0.997, 0.998, 0.999, 1); }
}

/* الصفحة: تظهر بخفوت سريع، والبطاقات تصعد متتابعة */
.view { animation: viewIn 0.28s var(--e-soft) both; }
@keyframes viewIn { from { opacity: 0; } }
/* البطاقة تهبط بوزن: النابض على الموضع والحجم، والظهور في ٤ إطارات */
.st { animation: stLand var(--t-enter) var(--e-land) both, stFade 0.14s linear both; }
@keyframes stLand { from { transform: translateY(26px) scale(0.94); } }
@keyframes stFade { from { opacity: 0; } }
@keyframes stIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
/* العنوان والرقم يهبطان كالكلمة المنطوقة */
.land { animation: landW 0.45s var(--e-out) both, stFade 0.07s linear both; transform-origin: center; }
b.land, span.land { display: inline-block; }
@keyframes landW { from { transform: translateY(12px) scale(1.14); } }
/* خروج حاسم */
.leave { animation: leaveX var(--t-exit) var(--e-exit) forwards; pointer-events: none; }
@keyframes leaveX { to { opacity: 0; transform: translateX(calc(var(--dir, -1) * 34px)); } }
/* دفعة كاميرا بطيئة على نقش البطاقات الداكنة */
.home-hero::before, .trk-hero::before { animation: push 2.3s var(--e-push) both; transform-origin: 85% 15%; }
@keyframes push { from { transform: scale(1); } to { transform: scale(1.06); } }

/* حبر ينتشر من موضع الضغط */
.ink { position: absolute; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%) scale(0); background: radial-gradient(circle, rgba(240, 207, 133, 0.55), rgba(240, 207, 133, 0) 70%); animation: ink 0.55s var(--e-out) forwards; }
@keyframes ink { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.btn, .bottom-nav a, .seg button, .trk-tabs a, .tpl, .wk-chip { position: relative; overflow: hidden; isolation: isolate; }

/* اهتزاز الخطأ: قصير وواضح */
.shake { animation: shake 0.42s var(--e-soft); }
@keyframes shake { 15%, 55% { transform: translateX(-6px); } 35%, 75% { transform: translateX(6px); } 90% { transform: translateX(-2px); } }

/* التنقل السفلي: حبة نشطة تنبثق */
.bottom-nav a.on { animation: pillIn 0.38s var(--e-spring); }
@keyframes pillIn { from { transform: scale(0.8); } }
.bottom-nav a:active { transform: scale(0.94); transition: transform var(--t-press); }

/* الإشعار: انزلاق بنابض */
#toast { transition: transform 0.38s var(--e-spring), opacity 0.2s !important; }

/* النوافذ */
.modal { animation: stLand 0.7s var(--e-land) both, stFade 0.12s linear both; }
.modal-back { animation: fade 0.2s both; }
.modal-back.closing { animation: fadeOut var(--t-exit) var(--e-exit) forwards; }
.modal-back.closing .modal { animation: modalOut var(--t-exit) var(--e-exit) forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(40px) scale(0.97); } }

/* بطاقات تميل قليلاً عند المرور (أجهزة المؤشر فقط) */
@media (hover: hover) {
  .room-card, .mini, .cat-tile, .trk-home { transition: transform 0.25s var(--e-out), box-shadow 0.25s; }
  .room-card:hover, .mini:hover, .cat-tile:hover, .trk-home:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
}

/* شرارات ذهبية عند الإنجاز */
.burst { position: fixed; z-index: 90; pointer-events: none; width: 0; height: 0; }
.burst i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--c); animation: spark 0.62s var(--e-out) forwards; transform: rotate(var(--a)) translateY(0); }
.burst i:nth-child(even) { width: 4px; height: 9px; border-radius: 3px; }
@keyframes spark { 70% { opacity: 1; } to { transform: rotate(var(--a)) translateY(calc(var(--d) * -1)); opacity: 0; } }

.trk-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.trk-confetti i { position: absolute; top: -14px; left: var(--x); width: 8px; height: 13px; border-radius: 2px; animation: conf var(--t) var(--dl) cubic-bezier(0.25, 0.6, 0.5, 1) forwards; }
@keyframes conf { to { transform: translateY(105vh) rotate(var(--r)); opacity: 0.85; } }

/* حلقة تخرج من خانة الإنجاز */
.just > .hchk::after, .just .hchk::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--green); animation: ringOut 0.55s var(--e-out) forwards; pointer-events: none; }
@keyframes ringOut { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.75); opacity: 0; } }
.hchk { position: relative; }
.hchk:active, .btn:active, .fav:active, .stars button:active { transform: scale(0.85); transition-duration: 60ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .ink, .burst, .trk-confetti { display: none; }
}
