@media screen and (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none; /* Mobile menu handles this */
    }
    
    .game-detail-container {
        grid-template-columns: 1fr;
        display: block; /* Ensure it stacks correctly */
    }
    
    .game-sidebar {
        order: 2;
        width: 100%;
        margin-top: 30px;
    }
    
    .game-main-content {
        order: 1;
        width: 100%;
    }

    .banner-container {
        height: 400px;
    }
}

@media screen and (max-width: 768px) {
    .main-header .container {
        padding: 10px 15px;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        width: 100% !important;
        max-width: 100% !important;
    }

    .logo-area {
        flex: 0 1 auto;
        display: flex;
        align-items: center;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 2;
        margin-left: auto;
    }

    .search-area {
        order: 3;
        width: 100%;
        margin: 10px 0 0 0 !important;
    }

    .search-box {
        width: 100%;
        display: flex;
        box-shadow: 2px 2px 0 var(--shadow-color);
        border-radius: 20px;
        overflow: hidden;
    }

    .search-box input {
        flex: 1;
        width: 100% !important;
        border: 1px solid var(--primary-blue);
        font-size: 0.9rem;
        padding: 10px 15px;
    }

    .suggestions-box {
        position: fixed;
        top: 115px;
        left: 15px;
        right: 15px;
        width: auto;
        border-radius: 10px;
        z-index: 1002;
    }

    /* Game Detail specific fixes - Vertical Stack for Bot & User */
    .game-detail-container {
        display: block;
    }

    .info-tabs {
        box-shadow: none;
        background: transparent;
    }

    .info-tabs .tab-headers {
        display: none; /* Hide tabs on mobile to force vertical scroll */
    }

    .tab-content {
        display: block !important;
        padding: 25px 0;
        border-bottom: 1px solid #eee;
        background: #fff;
        margin-bottom: 20px;
        border-radius: 10px;
        box-shadow: 3px 3px 0 var(--shadow-color);
        padding: 20px;
    }

    .tab-content h3 {
        color: var(--primary-blue);
        margin-bottom: 15px;
        font-size: 1.2rem;
    }

    .game-sidebar-info {
        padding: 20px;
        margin-top: 0;
    }

    .meta-item {
        flex-direction: row;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px dashed #eee;
    }

    .meta-value {
        text-align: right;
        padding-left: 10px;
    }

    /* Restore global mobile fixes accidentally removed in previous step */
    .main-nav {
        position: fixed;
        top: 110px; 
        left: -100%;
        width: 80%;
        height: calc(100vh - 110px);
        background: #fff;
        z-index: 999;
        transition: 0.4s;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
        padding: 40px 20px;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 30px;
    }
    
    .nav-links li a {
        font-size: 1.2rem;
    }

    .has-dropdown .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        display: none;
        box-shadow: none;
        border-top: none;
        padding: 10px 0 10px 20px;
        transform: none;
        background: transparent;
        width: 100%;
        min-width: 0;
    }

    .has-dropdown.active .dropdown-menu {
        display: block;
    }

    .has-dropdown > a::after {
        content: ' ▼';
        font-size: 0.8rem;
        transition: 0.3s;
    }

    .has-dropdown.active > a::after {
        content: ' ▲';
    }

    .banner-container {
        display: block;
        height: 380px;
        margin: 0 15px;
    }
    
    .banner-item {
        flex-direction: column;
    }
    
    .banner-img {
        height: 200px;
    }

    .mobile-top-actions {
        display: block !important;
        margin-bottom: 20px;
        width: 100%;
    }

    .mobile-only-btn {
        display: block !important;
        background: var(--primary-green);
        text-align: center;
        box-shadow: 4px 4px 0 var(--dark-gray);
        font-size: 1.1rem;
        padding: 15px;
        text-decoration: none;
        color: #fff;
        border-radius: 10px;
        font-weight: 800;
        cursor: pointer;
    }

    .game-actions .play-external {
        display: none !important; /* Hide the smaller one on mobile if we have the big top one */
    }

    .banner-img {
        width: 100%;
        flex: none;
        border-radius: 10px 10px 0 0;
        box-shadow: 3px 3px 0 var(--dark-gray);
    }
    
    .banner-content {
        flex: none;
        padding: 20px 15px;
        text-align: center;
        background: #fff;
        border-radius: 0 0 10px 10px;
        box-shadow: 3px 3px 0 var(--dark-gray);
        margin-top: -5px;
    }
    
    .banner-content h2 {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .banner-content p {
        display: none;
    }

    .btn-play {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
    
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
        padding: 0 20px;
    }
    
    .footer-links h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-about {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .filter-bar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 15px;
    }

    .filter-group {
        justify-content: space-between;
    }

    .category-header h1 {
        font-size: 2rem;
    }

    .game-player-section {
        border-radius: 0;
        margin: 0 -15px;
    }

    .game-controls-bar {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .game-sidebar {
        margin-top: 30px;
    }
}

@media screen and (max-width: 480px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .brand-name {
        font-size: 1rem;
    }

    .pixel-box {
        width: 25px;
        height: 25px;
    }
}
