
@media (max-width: 576px) {
    :root {
        --space-xs: 0.2rem;
        --space-sm: 0.3rem;
        --space-md: 0.5rem;
        --space-lg: 0.7rem;
        --space-xl: 1rem;
        
        --text-xs: 0.6rem;
        --text-sm: 0.7rem;
        --text-base: 0.75rem;
        --text-lg: 0.8rem;
        --text-xl: 0.9rem;
        
        --tag-font-size: 0.5rem;
        --tag-padding: 1px 3px;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm);
    }
    
    .navbar-logo {
        position: static;
        transform: none;
        order: 1;
        margin-bottom: 0;
    }
    
    .logo-image {
        height: 32px;
        max-width: 140px;
    }
    
    .logo-placeholder {
        width: 120px;
        height: 35px;
        font-size: 0.7rem;
    }
    
    /* Header Controls Mobile */
    .navbar-right.container {
        order: 2;
        padding: var(--space-sm);
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
        flex-direction: column;
        width: 100%;
    }
    
    .current-time {
        font-size: 0.6rem;
        padding: var(--space-xs) var(--space-sm);
        align-self: center;
        white-space: nowrap;
    }
    
    .header-auth-buttons {
        width: 100%;
        justify-content: center;
        gap: var(--space-md);
    }
    
    .btn-auth-header {
        font-size: 0.6rem;
        padding: var(--space-xs) var(--space-sm);
        min-width: 60px;
        gap: 2px;
        letter-spacing: 0.5px;
    }
    
    .btn-auth-header i {
        font-size: 0.7em;
    }
    
    .main-content {
        padding: var(--space-md) 0 var(--space-lg);
    }
    
    .banner-container {
        margin-bottom: var(--space-lg);
    }
    
    .banner-placeholder {
        aspect-ratio: 2/1; 
        border-radius: var(--border-radius);
    }
    
    .banner-text {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .swiper-pagination {
        margin-top: var(--space-sm);
    }
    
    .swiper-pagination-bullet {
        width: 6px;
        height: 6px;
        margin: 0 2px;
    }
    
    .swiper-pagination-bullet-active {
        width: 16px;
        border-radius: 3px;
    }
    
    .provider-swiper {
        padding: var(--space-sm) 15px;
    }
    
    .provider-logo-placeholder {
        width: 40px;
        height: 40px;
        border-width: 1px;
    }
    
    .provider-name {
        font-size: 0.55rem;
        max-width: 40px;
        line-height: 1.1;
    }
    
    .swiper-button-next,
    .swiper-button-prev {
        width: 24px;
        height: 24px;
    }
    
    .swiper-button-next:after,
    .swiper-button-prev:after {
        font-size: 10px;
    }
    
    .section-header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
        margin-bottom: var(--space-lg);
    }
    
    .section-title {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .section-title::after {
        width: 40px;
        height: 2px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .header-controls {
        flex-direction: column;
        width: 100%;
        gap: var(--space-sm);
    }
    
    .search-container {
        min-width: 100%;
        order: 2;
    }
    
    .search-input {
        font-size: 0.7rem;
        padding: var(--space-sm) 2rem var(--space-sm) var(--space-sm);
    }
    
    .search-btn, .search-clear {
        font-size: 0.7rem;
        padding: var(--space-xs);
    }
    
    .search-results {
        max-height: 180px;
        font-size: 0.7rem;
    }
    
    .search-result-item {
        padding: var(--space-xs) var(--space-sm);
        gap: var(--space-xs);
    }
    
    .search-result-image {
        width: 24px;
        height: 24px;
    }
    
    .search-result-name {
        font-size: 0.65rem;
        margin-bottom: 1px;
    }
    
    .search-result-provider {
        font-size: 0.55rem;
    }
    
    .games-grid {
        margin-left: -1px;
        margin-right: -1px;
    }
    
    .games-grid > [class*="col-"] {
        padding-left: 1px;
        padding-right: 1px;
        margin-bottom: var(--space-sm);
        width: 33.333333% !important; /* Force 3 columns on mobile */
        flex: 0 0 auto;
    }
    
    .game-card {
        border-radius: 4px;
        border-width: 1px;
    }
    
    .game-card:hover {
        transform: translateY(-2px) scale(1.005);
    }
    
    .game-img-container {
        border-bottom-width: 1px;
    }
    
    .provider-tag, .online-players {
        font-size: 0.4rem !important;
        padding: 1px 2px !important;
        max-width: 48% !important;
        border-radius: 2px;
        border-width: 1px;
        line-height: 1;
        letter-spacing: 0;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        backdrop-filter: blur(2px);
    }
    
    .provider-tag {
        top: 1px;
        left: 1px;
        max-width: calc(48% - 2px);
    }
    
    .online-players {
        top: 1px;
        right: 1px;
        max-width: calc(48% - 2px);
    }
    
    .online-players i {
        font-size: 0.6em !important;
        margin-right: 1px;
    }
    
    .play-btn-hover {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .game-name-section {
        padding: 1px var(--space-xs) 1px;
    }
    
    .game-name {
        font-size: 0.55rem;
        line-height: 1.05;
        min-height: calc(0.55rem * 1.05 * 2);
        font-weight: 500;
        text-align: center;
    }
    
    .rtp-progress-container {
        height: 18px;
    }
    
    .progress-label, .progress-time {
        font-size: 0.5rem;
        font-weight: 500;
    }
    
    .progress-label {
        left: 2px;
    }
    
    .progress-time {
        right: 2px;
    }
    
    .game-info {
        padding: var(--space-xs);
        gap: var(--space-xs);
    }
    
    .pola-toggle-btn {
        font-size: 0.45rem !important;
        padding: 1px 4px !important;
        gap: 1px !important;
        letter-spacing: 0.2px;
        border-radius: 2px;
        font-weight: 500;
        margin-bottom: 1px;
    }
    
    .pola-toggle-btn i {
        font-size: 0.6em !important;
    }
    
    .pola-overlay {
        border-radius: 3px;
        border-width: 2px;
        left: -3px;
        right: -3px;
        margin-top: 3px;
        box-shadow: 
            0 12px 30px rgba(0, 0, 0, 0.95),
            0 0 0 1px rgba(255, 107, 53, 0.7),
            0 0 20px rgba(255, 107, 53, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(12px);
        outline: 1px solid rgba(255, 255, 255, 0.2);
        z-index: 1002; /* Even higher on mobile */
    }
    
    .game-card.pola-active {
        z-index: 1000; /* Higher z-index when pola is open */
    }
    
    .pola-overlay .pola-header {
        font-size: 0.6rem;
        padding: 2px 0;
        font-weight: 600;
        letter-spacing: 0.2px;
        background: linear-gradient(135deg, var(--primary-color), var(--text-color-main));
    }
    
    .pola-overlay .pola-patterns {
        padding: var(--space-xs);
        background: linear-gradient(135deg, var(--card-bg), rgba(26, 26, 26, 0.95));
    }
    
    .pola-pattern-row {
        margin-bottom: 1px;
        font-size: 0.5rem;
        min-height: 14px;
        padding: 1px 2px;
        border-radius: 1px;
    }
    
    .pattern-name {
        font-size: 0.5rem;
        font-weight: 500;
        margin-right: 2px;
    }
    
    .pattern-indicators {
        gap: 1px;
    }
    
    .indicator {
        width: 9px !important;
        height: 9px !important;
        font-size: 0.35rem !important;
        min-width: 9px;
        border-radius: 50%;
    }
    
    .footer-section {
        padding: var(--space-lg) 0 0;
        margin-top: var(--space-lg);
    }
    
    .footer-widget {
        margin-bottom: var(--space-lg);
        text-align: center;
    }
    
    .footer-title {
        font-size: 0.9rem;
        margin-bottom: var(--space-sm);
    }
    
    .footer-line {
        width: 50px;
        height: 2px;
        margin: 0 auto var(--space-sm);
    }
    
    .footer-text {
        font-size: 0.7rem;
        margin-bottom: var(--space-sm);
        line-height: 1.4;
    }
    
    .footer-links {
        font-size: 0.7rem;
    }
    
    .footer-links li {
        margin-bottom: var(--space-xs);
    }
    
    .footer-contact {
        font-size: 0.7rem;
    }
    
    .footer-contact li {
        margin-bottom: var(--space-xs);
        justify-content: center;
    }
    
    .footer-badges {
        justify-content: center;
        gap: var(--space-xs);
        margin-top: var(--space-sm);
    }
    
    .badge-item {
        font-size: 0.6rem;
        padding: var(--space-xs) var(--space-sm);
        border-radius: 12px;
        gap: 2px;
    }
    
    .footer-bottom {
        padding: var(--space-sm) 0;
        margin-top: var(--space-lg);
    }
    
    .footer-bottom p {
        font-size: 0.65rem;
        line-height: 1.3;
    }
    
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: var(--space-md);
        right: var(--space-md);
        font-size: 0.9rem;
    }
    
    .scroll-progress {
        height: 2px;
    }
    
    .loading-dots {
        gap: var(--space-xs);
        margin: var(--space-lg) auto;
    }
    
    .loading-dots .dot {
        width: 8px;
        height: 8px;
    }
    
    .load-more-btn {
        padding: var(--space-sm) var(--space-lg);
        font-size: 0.7rem;
        letter-spacing: 0.5px;
        border-radius: 4px;
        gap: var(--space-xs);
    }
    
    /* Modal Mobile */
    .modal-content {
        margin: var(--space-sm);
        border-radius: 6px;
    }
    
    .modal-title {
        font-size: 0.9rem;
    }
    
    .modal-body {
        padding: var(--space-md);
        font-size: 0.7rem;
    }
    
    .warning-icon {
        font-size: 2rem !important;
    }
    
    /* Alert Mobile */
    .alert {
        font-size: 0.7rem;
        padding: var(--space-sm);
        border-radius: 4px;
    }
    
    .alert .btn {
        font-size: 0.65rem;
        padding: var(--space-xs) var(--space-sm);
    }
}

@media (max-width: 400px) {
    :root {
        --space-xs: 0.1rem;
        --space-sm: 0.2rem;
        --space-md: 0.3rem;
        --space-lg: 0.5rem;
        --space-xl: 0.7rem;
        
        --text-xs: 0.5rem;
        --text-sm: 0.6rem;
        --text-base: 0.65rem;
        --text-lg: 0.7rem;
        --text-xl: 0.75rem;
    }
    
    .games-grid > [class*="col-"] {
        padding-left: 0.5px;
        padding-right: 0.5px;
        width: 33.333333% !important;
    }
    
    .provider-tag, .online-players {
        font-size: 0.35rem !important;
        padding: 0.5px 1px !important;
        max-width: 46% !important;
    }
    
    .game-name {
        font-size: 0.5rem;
        line-height: 1;
        min-height: calc(0.5rem * 1 * 2);
        padding: 1px 2px;
    }
    
    .pola-toggle-btn {
        font-size: 0.4rem !important;
        padding: 1px 2px !important;
        gap: 0.5px !important;
    }
    
    .pola-toggle-btn i {
        font-size: 0.5em !important;
    }
    
    .indicator {
        width: 7px !important;
        height: 7px !important;
        font-size: 0.3rem !important;
    }
    
    .pattern-name {
        font-size: 0.45rem;
    }
    
    .progress-label, .progress-time {
        font-size: 0.45rem;
    }
    
    .btn-auth-header {
        font-size: 0.5rem;
        min-width: 45px;
        padding: 1px 4px;
    }
    
    .current-time {
        font-size: 0.5rem;
        padding: 1px 4px;
    }
    
    .rtp-progress-container {
        height: 16px;
    }
    
    .play-btn-hover {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .navbar .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .navbar-logo {
        position: static;
        transform: none;
        order: 1;
        margin-bottom: 0;
    }
    
    .navbar-right.container {
        order: 2;
        width: auto;
        flex-direction: row !important; 
        gap: var(--space-sm);
        padding: var(--space-xs) var(--space-sm);
        margin-bottom: 0;
    }
    
    .header-auth-buttons {
        display: flex;
        gap: var(--space-xs);
        flex-direction: row;
    }
    
    .current-time {
        margin-right: var(--space-sm);
    }
}

@media (max-width: 576px) {
    
    .header-auth-buttons {
        flex-direction: row !important;
        gap: var(--space-xs) !important;
    }
    
    .current-time {
        flex-shrink: 1;
        font-size: 0.55rem;
        padding: 2px 4px;
    }
    
    .btn-auth-header {
        flex-shrink: 0;
        font-size: 0.55rem;
        padding: 2px 4px;
        min-width: 40px;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 576px) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    .game-card {
        will-change: transform;
    }
    
    .pola-overlay {
        will-change: opacity, transform;
    }
    
    .loading-dots .dot {
        will-change: transform;
    }
    
    /* Reduce motion for performance */
    @media (prefers-reduced-motion: reduce) {
        .game-card,
        .pola-overlay,
        .provider-logo-item,
        .search-result-item {
            transition: none !important;
            animation: none !important;
        }
        
        .loading-dots .dot {
            animation: none !important;
        }
    }
}