/**
 * Mobile Scroll Optimization
 * Fixes black screen issues during scrolling
 */

@media (max-width: 768px) {
    /* Remove all heavy GPU operations */
    * {
        /* Disable will-change to prevent GPU memory issues */
        will-change: auto !important;
        /* Remove 3D transforms */
        transform-style: flat !important;
        /* Disable perspective */
        perspective: none !important;
    }
    
    /* Disable smooth scrolling that causes rendering delays */
    html {
        scroll-behavior: auto !important;
    }
    
    /* Optimize body for scrolling */
    body {
        /* Remove backdrop filters that cause rendering issues */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        /* Simple background */
        background: #000 !important;
        /* Prevent overscroll effects */
        overscroll-behavior: contain;
        /* Standard overflow */
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    /* Simplify mobile navbar rendering */
    #mobileNavbarMain {
        /* Remove heavy effects */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: 0 -1px 3px rgba(0,0,0,0.3) !important;
        /* Solid background instead of gradient */
        background: #1a1a1a !important;
        /* Remove transforms */
        transform: none !important;
        -webkit-transform: none !important;
        /* Disable will-change */
        will-change: auto !important;
        /* Remove contain property that might cause issues */
        contain: none !important;
    }
    
    /* Disable all animations during scroll */
    body.is-scrolling * {
        animation-play-state: paused !important;
        transition: none !important;
    }
    
    /* Remove filters and effects from all elements */
    body * {
        filter: none !important;
        -webkit-filter: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    /* Optimize images */
    img {
        /* Remove any transforms */
        transform: none !important;
        -webkit-transform: none !important;
        /* Disable will-change */
        will-change: auto !important;
        /* Standard rendering */
        image-rendering: auto !important;
    }
    
    /* Disable heavy animations */
    .ticker-track,
    .winners-track,
    .jackpot-ticker-track,
    [class*="animate"] {
        animation: none !important;
        transform: none !important;
        -webkit-transform: none !important;
    }
    
    /* Optimize main content */
    .main-content,
    #content {
        transform: none !important;
        -webkit-transform: none !important;
        will-change: auto !important;
    }
    
    /* Remove blur effects */
    .blur,
    [class*="blur"] {
        filter: none !important;
        -webkit-filter: none !important;
    }
    
    /* Disable parallax effects */
    [data-parallax],
    .parallax {
        transform: none !important;
        -webkit-transform: none !important;
    }
}

/* iOS specific optimizations */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        /* Disable momentum scrolling that can cause black screens */
        * {
            -webkit-overflow-scrolling: auto !important;
        }
        
        /* Use simple scrolling */
        body {
            -webkit-overflow-scrolling: auto !important;
            overflow-y: scroll !important;
        }
        
        /* Disable all transforms */
        * {
            -webkit-transform: none !important;
            transform: none !important;
        }
    }
}

/* Android specific optimizations */
@media (max-width: 768px) {
    /* Disable font boosting */
    * {
        max-height: 999999px;
        -webkit-text-size-adjust: 100%;
    }
    
    /* Force hardware acceleration OFF for problem elements */
    .main-content,
    #content,
    body > div {
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
        backface-visibility: visible !important;
        -webkit-backface-visibility: visible !important;
    }
}