/* Mirza game animation keyframes and utility classes */

.mirza-letter-select {
    animation: mirzaLetterSelect 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mirzaLetterSelect {
    0%   { transform: translate(-50%, -50%) scale(1); }
    40%  {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.55), 0 8px 24px rgba(255, 200, 60, 0.4);
    }
    70%  { transform: translate(-50%, -50%) scale(0.96); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.mirza-shake-wrong {
    animation: mirzaShakeWrong 0.45s ease;
}

@keyframes mirzaShakeWrong {
    0%, 100% { transform: translateX(0); }
    15%      { transform: translateX(-10px); }
    30%      { transform: translateX(10px); }
    45%      { transform: translateX(-8px); }
    60%      { transform: translateX(8px); }
    75%      { transform: translateX(-4px); }
}

.mirza-pop-correct {
    animation: mirzaPopCorrect 0.55s cubic-bezier(0.2, 1.3, 0.4, 1);
}

@keyframes mirzaPopCorrect {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.12); border-color: #28a745; box-shadow: 0 0 24px rgba(40, 167, 69, 0.5); }
    70%  { transform: scale(0.98); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(40, 167, 69, 0); }
}

.mirza-spark {
    position: fixed;
    z-index: 10020;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    pointer-events: none;
    animation: mirzaSparkBurst 0.55s ease-out forwards;
}

@keyframes mirzaSparkBurst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--sx, 20px), var(--sy, -20px)) scale(0.2); }
}

.mirza-float-score {
    position: fixed;
    z-index: 10025;
    transform: translate(-50%, 0);
    font-weight: 900;
    font-size: 1.25rem;
    color: #c9a227;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7), 0 0 12px rgba(255, 200, 40, 0.45);
    pointer-events: none;
    animation: mirzaFloatScore 0.9s ease-out forwards;
}

@keyframes mirzaFloatScore {
    0%   { opacity: 0; transform: translate(-50%, 8px) scale(0.7); }
    20%  { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -48px) scale(1); }
}

.mirza-coin-pulse {
    animation: mirzaCoinPulse 0.55s ease-out;
}

@keyframes mirzaCoinPulse {
    0%   { transform: scale(1); box-shadow: none; }
    35%  { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(255, 200, 40, 0.35); }
    100% { transform: scale(1); box-shadow: none; }
}

.mirza-slot-fill {
    animation: mirzaSlotFill 0.35s ease both;
}

@keyframes mirzaSlotFill {
    0%   { transform: scale(0.6); background: #fff3c4; }
    60%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.mirza-fly-coin,
.mirza-fly-star {
    position: fixed;
    z-index: 9999;
    font-size: 1.4rem;
    pointer-events: none;
    animation: mirzaFlyParticle 0.7s ease-in forwards;
}

@keyframes mirzaFlyParticle {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--fly-dx, 0), var(--fly-dy, -80px)) scale(0.4); }
}

.mirza-level-complete {
    animation: mirzaLevelComplete 0.6s ease;
}

@keyframes mirzaLevelComplete {
    0%   { box-shadow: 0 20px 60px rgba(100, 70, 40, 0.15); }
    50%  { box-shadow: 0 0 40px rgba(255, 215, 0, 0.5), 0 20px 60px rgba(100, 70, 40, 0.2); }
    100% { box-shadow: 0 20px 60px rgba(100, 70, 40, 0.15); }
}

.mirza-confetti {
    position: fixed;
    z-index: 9998;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    animation: mirzaConfettiFall 1.2s ease-out forwards;
}

@keyframes mirzaConfettiFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(var(--confetti-dy, 100px)) rotate(var(--confetti-rotate, 360deg)); }
}

.mirza-connection-line {
    stroke: #ffd700;
    stroke-width: 7;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px rgba(255, 200, 40, 0.7));
}

.mirza-connection-animated {
    stroke-dasharray: 14 8;
    animation: mirzaGoldDash 0.55s linear infinite;
}

@keyframes mirzaGoldDash {
    to { stroke-dashoffset: -44; }
}

/* ===== Amirza-style praise banner (ئافەرین / دەستخۆش / سەرسوڕهێنەرە) ===== */
.mirza-afarin-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    overflow: visible;
    opacity: 1;
    transition: opacity 0.28s ease;
    background: radial-gradient(ellipse at center, rgba(26, 14, 10, 0.22) 0%, transparent 64%);
}

.mirza-afarin-overlay.is-small {
    background: radial-gradient(ellipse at center, rgba(26, 14, 10, 0.12) 0%, transparent 58%);
}

.mirza-afarin-banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    unicode-bidi: isolate;
    font-size: clamp(2.1rem, 8.5vw, 3.6rem);
    font-weight: 900;
    line-height: 1.45;
    text-align: center;
    padding: 0.45rem 1.1rem;
    max-width: min(92vw, 680px);
    color: #ffe566;
    letter-spacing: 0;
    overflow: visible;
    opacity: 1;
    transform: rotate(var(--praise-tilt, -1deg));
}

.mirza-afarin-banner.is-small {
    font-size: clamp(1.85rem, 7.5vw, 3rem);
}

.mirza-afarin-banner.is-long {
    font-size: clamp(1.55rem, 6.2vw, 2.45rem);
}

.mirza-afarin-phrase {
    display: inline-block;
    unicode-bidi: isolate;
    direction: rtl;
    white-space: nowrap;
    color: inherit;
    opacity: 1;
    -webkit-text-stroke: 0.028em #6a2208;
    paint-order: stroke fill;
    text-shadow:
        0 2px 0 #8a3a10,
        0 8px 18px rgba(0, 0, 0, 0.38),
        0 0 28px rgba(255, 196, 40, 0.45);
}

.mirza-afarin-overlay.is-in .mirza-afarin-phrase {
    animation: mirzaAfarinPhrase 0.45s cubic-bezier(0.22, 1.12, 0.32, 1);
}

.mirza-afarin-banner.is-long .mirza-afarin-phrase {
    white-space: normal;
}

.mirza-afarin-banner.tone-pink .mirza-afarin-phrase {
    -webkit-text-stroke-color: #6b1240;
    text-shadow:
        0 3px 0 #9a1a58,
        0 10px 22px rgba(0, 0, 0, 0.4),
        0 0 32px rgba(255, 90, 160, 0.55);
}

.mirza-afarin-banner.tone-gold .mirza-afarin-phrase {
    color: #ffe566;
}

.mirza-afarin-banner.tone-green .mirza-afarin-phrase {
    -webkit-text-stroke-color: #0b4a22;
    text-shadow:
        0 3px 0 #147a38,
        0 10px 22px rgba(0, 0, 0, 0.4),
        0 0 32px rgba(60, 220, 110, 0.5);
}

.mirza-afarin-banner.tone-orange .mirza-afarin-phrase {
    -webkit-text-stroke-color: #7a2e00;
    text-shadow:
        0 3px 0 #c45a10,
        0 10px 22px rgba(0, 0, 0, 0.4),
        0 0 32px rgba(255, 140, 40, 0.55);
}

.mirza-afarin-banner.tone-cyan .mirza-afarin-phrase {
    -webkit-text-stroke-color: #0a4a58;
    text-shadow:
        0 3px 0 #0e7a8a,
        0 10px 22px rgba(0, 0, 0, 0.4),
        0 0 32px rgba(70, 220, 240, 0.5);
}

.mirza-afarin-banner.tone-pink { color: #ff7eb6; }
.mirza-afarin-banner.tone-gold { color: #ffe566; }
.mirza-afarin-banner.tone-green { color: #7dff9a; }
.mirza-afarin-banner.tone-orange { color: #ffb347; }
.mirza-afarin-banner.tone-cyan { color: #7af0ff; }

.mirza-afarin-overlay.is-held .mirza-afarin-phrase {
    animation: none;
    opacity: 1;
    transform: none;
}

.mirza-afarin-overlay.is-out {
    opacity: 0;
}

@keyframes mirzaAfarinPhrase {
    0%   { transform: scale(0.86); }
    55%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.mirza-afarin-pulse {
    animation: mirzaAfarinPulse 0.7s ease;
}

@keyframes mirzaAfarinPulse {
    0%, 100% { filter: brightness(1); }
    40%      { filter: brightness(1.12); }
}

.mirza-flower-petal {
    position: fixed;
    top: -8vh;
    z-index: 10040;
    pointer-events: none;
    animation: mirzaPetalFall var(--petal-duration, 3s) linear forwards;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

@keyframes mirzaPetalFall {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    12% { opacity: 1; }
    100% {
        opacity: 0.15;
        transform: translate3d(var(--petal-drift, 40px), 110vh, 0) rotate(var(--petal-rotate, 540deg));
    }
}

@media (prefers-reduced-motion: reduce) {
    .mirza-afarin-phrase,
    .mirza-afarin-overlay.is-in .mirza-afarin-phrase {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .mirza-afarin-overlay.is-out {
        transition: none !important;
    }

    .mirza-afarin-pulse,
    .mirza-flower-petal {
        animation: none !important;
    }
}
