/* pro-motion.css — حركة النمط المطوّر (إضافة لا تعديل · لا تلمس قواعد الكلاسيكي)
   مبدأ: transform + opacity فقط · مدد 0.25–0.9s · احترام prefers-reduced-motion
   ملاحظة: كل قاعدة هنا تحت body.pro أو .pfx — لا تصنيف عام يمسّ النمط الأول. */

:root {
  --pfx-ease-out: cubic-bezier(.16, 1, .3, 1);
  --pfx-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ── طبقة المؤثرات ────────────────────────────────────────────────────── */
.pro-fx {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
}

.pfx { position: absolute; }

/* فلاش الشاشة */
.pfx-flash {
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(var(--fx-rgb), .34), rgba(var(--fx-rgb), 0) 68%);
  animation: pfxFlash .68s ease-out forwards;
}
.pfx-flash.is-bad { background: radial-gradient(circle at 50% 45%, rgba(var(--fx-rgb), .3), rgba(var(--fx-rgb), 0) 70%); }
@keyframes pfxFlash {
  0% { opacity: 0; transform: scale(.94); }
  22% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

/* شريط اللحظة (بانر) */
.pfx-banner {
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-ar, inherit);
  font-size: 20px;
  font-weight: 800;
  color: #0F172A;
  background: #FFFFFF;
  border: 2px solid rgba(15, 23, 42, .12);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
  white-space: nowrap;
  animation: pfxBanner 1.25s var(--pfx-spring) forwards;
}
.pfx-banner.is-ok { color: #14532D; border-color: #1E8449; box-shadow: 0 16px 34px rgba(30, 132, 73, .3); }
.pfx-banner.is-bad { color: #7F1D1D; border-color: #C0392B; box-shadow: 0 16px 34px rgba(192, 57, 43, .3); }
.pfx-banner.is-action { color: #1E1B4B; border-color: rgba(var(--fx-rgb, 76, 29, 149), .8); box-shadow: 0 16px 34px rgba(var(--fx-rgb, 76, 29, 149), .32); }
.pfx-banner.is-nope { color: #475569; border-color: #94A3B8; }
.pfx-banner-icon { font-size: 22px; line-height: 1; }

@keyframes pfxBanner {
  0% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.72); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.06); }
  30% { transform: translateX(-50%) translateY(0) scale(1); }
  78% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.94); }
}

/* شرر الإجابة الصحيحة */
.pfx-spark {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgb(var(--fx-rgb));
  box-shadow: 0 0 10px rgba(var(--fx-rgb), .8);
  animation: pfxSpark var(--d, .7s) var(--pfx-ease-out) forwards;
}
@keyframes pfxSpark {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}

/* حلقة الصدمة */
.pfx-ring {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 3px solid rgba(var(--ring-rgb), .85);
  animation: pfxRing .62s var(--pfx-ease-out) forwards;
}
.pfx-ring.is-big { border-width: 4px; animation-duration: .8s; }
@keyframes pfxRing {
  0% { opacity: .9; transform: scale(.2); }
  100% { opacity: 0; transform: scale(9); }
}

/* +عملات · أرقام طائرة */
.pfx-delta {
  transform: translate(-50%, 0);
  padding: 6px 16px;
  border-radius: 999px;
  background: #FEF3C7;
  border: 2px solid #B45309;
  color: #7C2D12;
  font-weight: 800;
  font-size: 18px;
  white-space: nowrap;
  animation: pfxDelta 1.4s var(--pfx-ease-out) forwards;
}
.pfx-delta.is-group { background: #EDE9FE; border-color: #6D28D9; color: #4C1D95; font-size: 16px; }
@keyframes pfxDelta {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(.7); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  40% { transform: translate(-50%, -6px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -64px) scale(.96); }
}

/* ختم (✕ · ⛔ · ×٢) */
.pfx-stamp {
  transform: translate(-50%, -50%);
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  color: #0F172A;
  text-shadow: 0 6px 18px rgba(15, 23, 42, .28);
  animation: pfxStamp .9s var(--pfx-spring) forwards;
}
.pfx-stamp.is-bad { color: #C0392B; font-size: 54px; }
.pfx-stamp.is-mult { color: #B45309; font-size: 34px; }
@keyframes pfxStamp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.4) rotate(-14deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.9) rotate(-8deg); }
}

/* شبح يطير من صندوق إلى آخر (نقل) */
.pfx-ghost {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  border: 2px dashed rgb(var(--fx-rgb));
  font-size: 20px;
  opacity: .95;
  animation: pfxGhost .9s var(--pfx-ease-out) forwards;
}
@keyframes pfxGhost {
  0% { transform: translate(var(--x0), var(--y0)) scale(1); opacity: .95; }
  55% { transform: translate(calc((var(--x0) + var(--x1)) / 2), calc(var(--y0) - 70px)) scale(.9) rotate(6deg); opacity: 1; }
  100% { transform: translate(var(--x1), var(--y1)) scale(.55); opacity: 0; }
}

/* ── الصندوق: ظهور · نقر · صبغ ─────────────────────────────────────────── */
body.pro .grid .box {
  overflow: hidden;
  transition: transform .16s var(--pfx-ease-out), box-shadow .2s ease;
}

body.pro .grid .box.pro-in {
  animation: proIn .5s var(--pfx-spring) backwards;
  animation-delay: calc(var(--i, 0) * 26ms);
}
@keyframes proIn {
  0% { opacity: 0; transform: scale(.72) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

body.pro .grid .box.pro-tapping { animation: proTap .5s var(--pfx-spring); }
@keyframes proTap {
  0% { transform: scale(1); }
  35% { transform: scale(.9) rotate(-1.2deg); }
  70% { transform: scale(1.06) rotate(.8deg); }
  100% { transform: scale(1); }
}

.pro-liquid {
  position: absolute;
  inset: 0;
  z-index: 0;
  transform-origin: bottom center;
  transform: scaleY(0);
  background:
    linear-gradient(to top, rgba(var(--team-rgb), .92), rgba(var(--team-rgb), .55) 62%, rgba(255, 255, 255, .18));
  animation: proLiquid .62s var(--pfx-ease-out) forwards;
}
.pro-liquid::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 16px;
  background: rgba(255, 255, 255, .55);
  filter: blur(4px);
  animation: proWave .62s ease-out forwards;
}
.pro-liquid.is-done { opacity: 0; transition: opacity .5s ease; }
@keyframes proLiquid {
  0% { transform: scaleY(0) scaleX(1.06); opacity: .95; }
  62% { transform: scaleY(1.04) scaleX(.99); opacity: .95; }
  100% { transform: scaleY(1) scaleX(1); opacity: .95; }
}
@keyframes proWave {
  0% { transform: translateY(-6px) scaleX(.8); opacity: 0; }
  40% { opacity: .9; }
  100% { transform: translateY(-2px) scaleX(1.05); opacity: 0; }
}

body.pro .grid .box.pro-coloring { animation: proColorBounce .7s var(--pfx-spring); }
@keyframes proColorBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.14); }
  60% { transform: scale(.97); }
  100% { transform: scale(1); }
}

/* عناصر الصندوق فوق السائل */
body.pro .grid .box > * { position: relative; z-index: 1; }

/* اهتزاز الخيار الخاطئ */
.pro-wobble { animation: proWobble .55s ease-in-out; }
@keyframes proWobble {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px) rotate(-1deg); }
  35% { transform: translateX(7px) rotate(1deg); }
  55% { transform: translateX(-5px); }
  75% { transform: translateX(4px); }
}

/* اهتزاز الشاشة (حجب · استيلاء) */
body.pro.pro-shake .game-root,
body.pro.pro-shake .ch-pro-bar { animation: proShake .58s ease-in-out; }
@keyframes proShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(calc(-6px * var(--shake, 1)), 2px, 0) rotate(calc(-.25deg * var(--shake, 1))); }
  40% { transform: translate3d(calc(5px * var(--shake, 1)), -2px, 0) rotate(calc(.25deg * var(--shake, 1))); }
  60% { transform: translate3d(calc(-4px * var(--shake, 1)), 1px, 0); }
  80% { transform: translate3d(calc(3px * var(--shake, 1)), -1px, 0); }
}

/* شريحة الفريق المجمّد */
.ch-pro-chip.pro-frozen { animation: proFreeze 1.5s ease-out; }
.ch-pro-chip.pro-frozen::after {
  content: '❄';
  position: absolute;
  inset-inline-end: 8px;
  top: -8px;
  font-size: 20px;
}
.ch-pro-chip { position: relative; }
@keyframes proFreeze {
  0% { box-shadow: 0 0 0 0 rgba(14, 116, 144, .65); filter: none; }
  25% { box-shadow: 0 0 0 6px rgba(14, 116, 144, .4); filter: saturate(.5) brightness(1.12) hue-rotate(150deg); }
  70% { box-shadow: 0 0 0 3px rgba(14, 116, 144, .2); }
  100% { box-shadow: 0 0 0 0 rgba(14, 116, 144, 0); filter: none; }
}

/* مجازفة: هالة ذهبية على الصندوق */
body.pro .grid .box.pro-wager-armed { animation: proWager .8s ease-in-out 2; }
@keyframes proWager {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 83, 9, 0); }
  50% { box-shadow: 0 0 0 6px rgba(180, 83, 9, .45); }
}

/* ── مناطق الترابط: رسم الحدود + وسم المجموعة ──────────────────────────── */
.pro-regions path.pro-fresh {
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: regionDraw .95s var(--pfx-ease-out) forwards;
}
@keyframes regionDraw {
  to { stroke-dashoffset: 0; }
}

.pro-region-tag {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--tag-color, #0F172A);
  box-shadow: 0 6px 14px rgba(15, 23, 42, .28);
  opacity: 1;
  animation: none;                 /* الوسم يبقى ظاهراً؛ الحركة للمولود الجديد فقط */
  pointer-events: none;
}
.pro-region-tag.pro-fresh { animation: tagPop .5s var(--pfx-spring, cubic-bezier(.34, 1.56, .64, 1)); }
@keyframes tagPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── احترام تقليل الحركة ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body.pro .grid .box.pro-in,
  body.pro .grid .box.pro-tapping,
  body.pro .grid .box.pro-coloring,
  .pro-liquid,
  .pro-wobble,
  body.pro.pro-shake .game-root,
  body.pro.pro-shake .ch-pro-bar,
  .pro-regions path.pro-fresh,
  .pro-region-tag { animation: none !important; }
}

/* نقر الخيار */
body.pro .choice.pro-tapping { animation: proTap .42s var(--pfx-spring); }


/* حذف إجابتين: الخيار المحذوف يتلاشى كدخان */
body.pro .choice.pro-removed { animation: proRemoved .55s ease-out forwards; }
@keyframes proRemoved {
  0% { opacity: 1; transform: scale(1); filter: blur(0); }
  45% { opacity: .5; transform: scale(1.04) rotate(-1deg); filter: blur(1px); }
  100% { opacity: .18; transform: scale(.94) translateY(6px); filter: blur(2px); }
}

/* ── أنبوب الترابط: الحالة الأساسية مرئية دائماً؛ الحركة نبض إضافي فقط ────── */
body.pro .pro-tube { opacity: .95; animation: proTubePulse 2.6s ease-in-out infinite; }
body.pro .pro-tube rect { opacity: 1; }
@keyframes proTubePulse { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body.pro .pro-tube { animation: none; opacity: .95; } }
