/* fx.css — تأثيرات وجماليات المنصة (حركة فقط، من غير تغيير أي لون أو خط).
 * للإلغاء: امسح سطر fx.css و fx.js من الصفحات، أو شغّل revert-fx.sh. */

/* 1) موجة الضغط على الأزرار */
.fx-rip { position: relative; overflow: hidden; }
.fx-rip > i.fx-wave { position: absolute; border-radius: 50%; background: rgba(255,255,255,.38); transform: scale(0); animation: fx-ripple .65s ease-out forwards; pointer-events: none; }
@keyframes fx-ripple { to { transform: scale(1); opacity: 0; } }

/* 2) دخول العناصر متتابع */
.fx-in { animation: fx-rise .6s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--fx-i, 0) * 70ms); }
@keyframes fx-rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }

/* 3) ميل البطاقات */
.fx-tilt { transition: transform .18s ease-out; will-change: transform; }

/* 4) حلقة متوهجة دوّارة: المركز الأول + الباقة المميزة */
@property --fx-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes fx-spin { to { --fx-ang: 360deg; } }
.pd-1 .pd-av, .tier.popular { position: relative; }
.pd-1 .pd-av::before, .tier.popular::after {
  content: ""; position: absolute; pointer-events: none;
  background: conic-gradient(from var(--fx-ang), #6366f1, #ec4899, #f59e0b, #10b981, #6366f1);
  animation: fx-spin 4s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.pd-1 .pd-av::before { inset: -6px; border-radius: 50%; padding: 3px; }
.tier.popular::after { inset: -2px; border-radius: 18px; padding: 2px; }

/* 5) إشعار: خط عدّاد ينزل */
#customToast { overflow: hidden; }
#customToast.show::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: #10b981; transform-origin: right; animation: fx-drain 3s linear forwards; }
@keyframes fx-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* 6) شعلة الاستريك */
.fx-flame { display: inline-block; transform-origin: 50% 90%; animation: fx-flick 1.3s ease-in-out infinite; filter: drop-shadow(0 0 4px rgba(249,115,22,.7)); }
@keyframes fx-flick { 0%,100% { transform: scale(1) rotate(-3deg); } 35% { transform: scale(1.14,1.2) rotate(4deg); } 65% { transform: scale(.96,1.04) rotate(-4deg); } }

/* 7) نبضة عند اختيار إجابة */
.fx-pulse { animation: fx-okpulse .6s ease; }
@keyframes fx-okpulse { 0% { box-shadow: 0 0 0 0 rgba(99,102,241,.55); transform: scale(.985); } 100% { box-shadow: 0 0 0 12px rgba(99,102,241,0); transform: none; } }

/* 8) هيكل تحميل لامع (لوحة المتصدرين) */
.fx-sk { display: grid; gap: 10px; padding: 8px 4px; }
.fx-sk .l { height: 54px; border-radius: 12px; background: linear-gradient(100deg, rgba(148,163,184,.14) 30%, rgba(148,163,184,.28) 50%, rgba(148,163,184,.14) 70%); background-size: 220% 100%; animation: fx-shimmer 1.2s linear infinite; }
@keyframes fx-shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }

/* 9) كونفيتي + إشعار المستوى */
#fx-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 99999; }
.fx-lvl { position: fixed; top: max(18px, env(safe-area-inset-top, 0px)); left: 50%; transform: translate(-50%, -140%); z-index: 100000; padding: 12px 22px; border-radius: 14px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #6366f1, #ec4899); box-shadow: 0 12px 30px rgba(0,0,0,.35); transition: transform .55s cubic-bezier(.2,1.3,.4,1); white-space: nowrap; }
.fx-lvl.in { transform: translate(-50%, 0); }

/* 10) خلفية حية هادئة (الدخول والترحيب) */
#fx-ambient { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: .65; }

@media (prefers-reduced-motion: reduce) {
  .fx-in, .fx-flame, .fx-pulse, .fx-sk .l, .pd-1 .pd-av::before, .tier.popular::after, #customToast.show::after { animation: none !important; }
  .fx-tilt { transition: none; }
}
