/* ========== MOBILE RESPONSIVE ========== */

/* Enable smooth scrolling on mobile */
html {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto !important;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    overflow-y: auto !important;
    position: relative;
}

/* Ensure container is scrollable on mobile */
@media (max-width: 768px) {
    html, body {
        height: auto !important;
        min-height: 100vh;
        overflow-y: auto !important;
    }
    
    .container {
        padding: 10px;
        overflow-y: visible !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    /* Ensure junkpile page is scrollable */
    .junkpile-game {
        overflow: visible !important;
        height: auto !important;
        position: relative !important;
    }
    
    /* Fix viewport height issues */
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    html {
        height: -webkit-fill-available;
    }
}

/* Tablet and smaller */
@media (max-width: 1024px) {
    .nav-container {
        flex-wrap: wrap;
    }
    
    .nav-link {
        padding: 15px 20px;
        font-size: 1em;
    }
}

/* Mobile landscape and portrait */
@media (max-width: 768px) {
    /* Hamburger menu for mobile */
    .nav-container {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--oil-black);
        border-top: 3px solid var(--rust-orange);
        z-index: 150;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .nav-container.mobile-open {
        display: flex;
    }
    
    .nav-link {
        border-right: none;
        border-bottom: 1px solid var(--oil-black);
        text-align: center;
        padding: 18px 20px;
        width: 100%;
    }
    
    /* Make dropdowns work on mobile */
    .nav-dropdown {
        width: 100%;
    }
    
    .nav-dropdown > .nav-link {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(184, 92, 63, 0.3);
    }
    
    /* Dropdown adjustments */
    .dropdown-content {
        position: relative;
        box-shadow: none;
        border: none;
        border-top: 2px solid var(--rust-orange);
        display: none;
        width: 100%;
    }
    
    .dropdown-content a {
        padding: 15px 20px;
        background: var(--steel-gray);
        border-bottom: 1px solid var(--oil-black);
        -webkit-tap-highlight-color: rgba(184, 92, 63, 0.3);
    }
    
    .nav-dropdown.open .dropdown-content {
        display: block;
    }
    
    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 50%;
        right: 20px;
        transform: translateY(-50%);
        background: var(--rust-orange);
        border: none;
        color: #FFF;
        font-size: 1.5em;
        padding: 10px 15px;
        cursor: pointer;
        border-radius: 5px;
        z-index: 200;
        -webkit-tap-highlight-color: rgba(184, 92, 63, 0.5);
    }
    
    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:active {
        background: #D46B3E;
    }
}

/* Desktop - hide mobile toggle */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
    
    .nav-container {
        display: flex !important;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .nav-link {
        padding: 12px 15px;
        font-size: 0.9em;
        letter-spacing: 1px;
    }
}

/* CRITICAL: Force scrolling on mobile - override everything */
@media (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch !important;
    }
    
    html, body, .container, .page-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        position: relative !important;
        height: auto !important;
    }
    
    /* Specifically for junkpile page */
    .junkpile-game,
    .game-container,
    .game-hud,
    .game-info {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        position: relative !important;
    }
    
    .game-area {
        position: relative !important;
        overflow: hidden; /* Only the game area itself should hide overflow */
    }
}
