/* Timelsa mascot + falling balls footer (index homepage) — vanilla CSS motion (no React bundle) */

#timelsa-footer-mascot {
    position: relative;
    z-index: 5;
    padding: 2.5rem 0 calc(5.5rem + env(safe-area-inset-bottom, 0px));
    margin-top: 2rem;
    overflow: visible;
}

.tamim-footer__inner {
    position: relative;
}

.tamim-footer__stage {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1.25rem);
    min-height: clamp(175px, 32vw, 250px);
    direction: ltr;
}

.tamim-footer__slot {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: clamp(72px, 18vw, 120px);
    padding-bottom: 0.25rem;
}

.tamim-footer__mascot {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2;
    filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.12));
}

.tamim-footer__mascot img {
    display: block;
    width: auto;
    height: clamp(152px, 27vw, 236px);
    max-width: min(236px, 48vw);
    object-fit: contain;
    object-position: bottom center;
    user-select: none;
    pointer-events: none;
}

.tamim-ball {
    --ball-size: clamp(52px, 14vw, 72px);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ball-size);
    height: var(--ball-size);
    border: 0;
    padding: 0;
    cursor: default;
    pointer-events: none;
    background: transparent;
    border-radius: 50%;
    flex-shrink: 0;
    transform: translate3d(0, -140vh, 0);
    opacity: 0;
    will-change: transform, opacity, width, height, border-radius, box-shadow;
    transition:
        width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        height 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        border-radius 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.45s ease,
        transform 0.45s ease,
        background 0.45s ease;
}

.tamim-footer--playing .tamim-ball {
    opacity: 1;
    pointer-events: none;
}

/* أثناء سقوط الكرات: السماح بالضغط على الأحمر لتخطي الحركة وفتح الجولة */
.tamim-footer--playing .tamim-ball--red {
    pointer-events: auto;
    cursor: pointer;
}

.tamim-footer--buttons .tamim-ball {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
    width: auto;
    min-width: min(100%, 12.5rem);
    height: auto;
    min-height: 48px;
    padding: 0.65rem 1.15rem;
    border-radius: 9999px;
    transform: translate3d(0, 0, 0) !important;
    animation: none !important;
}

.tamim-ball__sphere {
    position: absolute;
    inset: 0;
    margin: auto;
    width: var(--ball-size);
    height: var(--ball-size);
    border-radius: 50%;
    transition:
        opacity 0.45s ease,
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.45s ease,
        height 0.45s ease;
}

.tamim-ball--red .tamim-ball__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 200, 200, 0.15) 8%, transparent 42%),
        radial-gradient(circle at 70% 75%, rgba(0, 0, 0, 0.22) 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, #fb7185 0%, #e11d48 42%, #9f1239 100%);
    box-shadow:
        inset 0 -6px 14px rgba(0, 0, 0, 0.18),
        inset 0 8px 18px rgba(255, 255, 255, 0.35),
        0 14px 28px rgba(225, 29, 72, 0.35);
}

.tamim-ball--yellow .tamim-ball__sphere {
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 220, 0.2) 10%, transparent 42%),
        radial-gradient(circle at 70% 75%, rgba(0, 0, 0, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, #fde047 0%, #eab308 45%, #a16207 100%);
    box-shadow:
        inset 0 -6px 14px rgba(0, 0, 0, 0.14),
        inset 0 8px 18px rgba(255, 255, 255, 0.45),
        0 14px 28px rgba(234, 179, 8, 0.35);
}

.tamim-ball__label {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 0.25rem;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: clamp(0.78rem, 2.8vw, 0.95rem);
    line-height: 1.25;
    text-align: center;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.92);
    transition:
        opacity 0.4s ease 0.08s,
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.tamim-footer--buttons .tamim-ball__sphere {
    opacity: 0;
    transform: scale(0.2);
    width: 0;
    height: 0;
    pointer-events: none;
}

.tamim-footer--buttons .tamim-ball__label {
    opacity: 1;
    transform: scale(1);
    height: auto;
    min-height: 2.75rem;
}

.tamim-footer--buttons .tamim-ball--red {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 55%, #be123c 100%);
    box-shadow: 0 10px 26px rgba(225, 29, 72, 0.35);
}

.tamim-footer--buttons .tamim-ball--yellow {
    background: linear-gradient(135deg, #fde047 0%, #eab308 50%, #ca8a04 100%);
    box-shadow: 0 10px 26px rgba(234, 179, 8, 0.32);
}

.tamim-footer--buttons .tamim-ball--yellow .tamim-ball__label {
    color: #422006;
}

.tamim-footer--playing .tamim-ball--yellow {
    animation: tamimBallDropYellow 2s cubic-bezier(0.25, 0.85, 0.25, 1) 0.05s forwards;
}

.tamim-footer--playing .tamim-ball--red {
    animation: tamimBallDropRed 2s cubic-bezier(0.25, 0.85, 0.25, 1) forwards;
}

@keyframes tamimBallDropYellow {
    0% {
        opacity: 1;
        transform: translate3d(0, -130vh, 0) rotate(0deg);
    }
    58% {
        transform: translate3d(-10px, 10px, 0) rotate(520deg);
    }
    72% {
        transform: translate3d(6px, 0, 0) rotate(680deg);
    }
    84% {
        transform: translate3d(-4px, 2px, 0) rotate(760deg);
    }
    100% {
        opacity: 1;
        transform: translate3d(-6px, 0, 0) rotate(800deg);
    }
}

@keyframes tamimBallDropRed {
    0% {
        opacity: 1;
        transform: translate3d(0, -130vh, 0) rotate(0deg);
    }
    58% {
        transform: translate3d(10px, 10px, 0) rotate(-520deg);
    }
    72% {
        transform: translate3d(-6px, 0, 0) rotate(-680deg);
    }
    84% {
        transform: translate3d(4px, 2px, 0) rotate(-760deg);
    }
    100% {
        opacity: 1;
        transform: translate3d(6px, 0, 0) rotate(-800deg);
    }
}

.tamim-ball:focus-visible {
    outline: 3px solid rgba(0, 102, 204, 0.55);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .tamim-footer--playing .tamim-ball--yellow,
    .tamim-footer--playing .tamim-ball--red {
        animation: none;
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
}
