/* Mobile WASD Controls */
#mobile-wasd-controls {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wasd-btn {
    width: 48px;
    height: 48px;
    font-size: 24px;
    border-radius: 12px;
    background: linear-gradient(90deg, #FFD700 0%, #fff700 100%);
    color: #222;
    border: 2px solid #FFD700;
    box-shadow: 0 0 8px #FFD700;
    font-family: 'Consolas', 'Courier New', monospace;
    margin: 0 4px;
    pointer-events: auto;
    z-index: 100000;
}
#mobile-wasd-controls {
    pointer-events: auto;
}
#cannon-controls {
    pointer-events: auto !important;
    z-index: 99999 !important;
}
#mainMenu button:not(#startButton):hover {
    background: #FFD700 !important;
    color: #222 !important;
    box-shadow: 0 0 16px 8px #FFD700, 0 0 32px 16px #FFD700 !important;
    border-color: #FFD700 !important;
    text-shadow: 0 0 16px #FFD700, 0 0 32px #FFD700, 0 0 8px #fff700 !important;
}
body {
    margin: 0;
    background: #000;
    color: #FFD700;
    font-family: 'Consolas', 'Courier New', monospace;
    overflow: hidden;
}


/* Clean, non-duplicated button styles */
#startButton {
    position: fixed;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    z-index: 10010;
    background: linear-gradient(90deg, #FFD700 0%, #fff700 100%);
    color: #222;
    border: 3px solid #FFD700;
    font-family: Arial, sans-serif;
    font-weight: bold;
    padding: 16px 30px;
    font-size: 32px;
    width: 520px;
    height: 90px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 15px;
    box-shadow: 0 0 15px #FFD700;
    outline: none;
    transition: all 0.3s;
}

#startButton:hover {
    background: #FFD700 !important;
    color: #FFD700 !important;
    box-shadow: 0 0 240px 120px #FFD700, 0 0 480px 240px #fff700 !important;
    text-shadow: 0 0 192px #FFD700, 0 0 384px #fff700 !important;
}

#startButton:active {
    background: #fff700 !important;
    color: #FFD700 !important;
    box-shadow: 0 0 480px 240px #FFD700, 0 0 960px 480px #fff700 !important;
    text-shadow: 0 0 384px #FFD700, 0 0 768px #fff700 !important;
}

#pauseMenu button, .input-row button {
    position: static;
    left: auto;
    transform: none;
    background: linear-gradient(90deg, #FFD700 0%, #fff700 100%);
    color: #222;
    border: 3px solid #FFD700;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 12px 24px;
    font-size: 18px;
    min-width: 100px;
    cursor: pointer;
    border-radius: 12px;
    text-shadow: none;
    box-shadow: none;
    outline: none;
    transition: all 0.3s;
    margin: 12px 0;
    display: block;
}

#pauseMenu button:hover, .input-row button:hover {
    background: #FFD700;
    color: #FFD700;
    box-shadow: 0 0 80px 40px #FFD700, 0 0 160px 80px #fff700;
    text-shadow: 0 0 64px #FFD700, 0 0 128px #fff700;
}

#pauseMenu button:active, .input-row button:active {
    background: #fff700;
    color: #FFD700;
    box-shadow: 0 0 160px 80px #FFD700, 0 0 320px 160px #fff700;
    text-shadow: 0 0 128px #FFD700, 0 0 256px #fff700;
}

/* Main Menu Button Styles */
#statsButton, #storageButton, #tradeButton, #missionsButton, #startButton, #deleteAccountButton {
    position: static;
    left: auto;
    transform: none;
    z-index: auto;
    background: linear-gradient(90deg, #FFD700 0%, #fff700 100%);
    color: #222;
    border: 3px solid #FFD700;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 16px 32px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 12px;
    text-shadow: none;
    box-shadow: none;
    outline: none;
    transition: all 0.3s;
    width: 280px;
    margin: 8px 0;
}

#statsButton {
    /* removed bottom for stacking */
}

#storageButton {
    /* removed bottom for stacking */
    /* same style as stats/storage */
    /* same style as stats/storage */
}

#deleteAccountButton {
    bottom: 20%;
    background: linear-gradient(90deg, #ff4444 0%, #ff6666 100%);
    color: #fff;
    border: 3px solid #ff4444;
    padding: 12px 24px;
    font-size: 16px;
    width: 200px;
}

#statsButton:hover, #storageButton:hover {
    background: #FFD700;
    color: #FFD700;
    box-shadow: 0 0 80px 40px #FFD700, 0 0 160px 80px #fff700;
    text-shadow: 0 0 64px #FFD700, 0 0 128px #fff700;
}

#deleteAccountButton:hover {
    background: #ff4444 !important;
    color: #fff !important;
    box-shadow: 0 0 80px 40px #ff4444, 0 0 160px 80px #ff6666 !important;
    text-shadow: 0 0 64px #ff4444, 0 0 128px #ff6666 !important;
}

#statsButton:active, #storageButton:active, #deleteAccountButton:active {
    background: #fff700;
    color: #FFD700;
    box-shadow: 0 0 160px 80px #FFD700, 0 0 320px 160px #fff700;
    text-shadow: 0 0 128px #FFD700, 0 0 256px #fff700;
}

#deleteAccountButton:active {
    background: #ff6666 !important;
    color: #fff !important;
    box-shadow: 0 0 160px 80px #ff4444, 0 0 320px 160px #ff6666 !important;
    text-shadow: 0 0 128px #ff4444, 0 0 256px #ff6666 !important;
}

#gameCanvas {
    display: none;
    width: 100%;
    height: 100vh;
}

#instructions {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 26, 0, 0.8);
    color: #FFD700;
    padding: 15px;
    border: 1px solid #FFD700;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10003;
    max-width: 300px;
    font-family: 'Consolas', 'Courier New', monospace;
    pointer-events: auto;
#closeInstructions {
    pointer-events: auto !important;
    z-index: 10004 !important;
}
}

#instructions.hidden {
    display: none;
}

#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#spectatorIndicator {
    display: none;
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 165, 0, 0.8);
    color: #000;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    z-index: 1000;
}

/* WaterWorld6 Pause Menu Styles */
#pauseMenu {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10002;
}

.container {
    padding: 24px;
    display: flex;
    flex-direction: row;
    gap: 24px;
    border: 2px solid #FFD700;
    border-radius: 12px;
    background: rgba(0, 26, 0, 0.95);
    box-shadow: 0 0 20px #FFD700;
}

.main-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.side-panel {
    flex: 1;
    background: linear-gradient(135deg, #FFD700 0%, #8e44ad 33%, #3498db 66%, #00ff99 100%);
    border-left: 2px solid #FFD700;
    padding: 16px;
    min-width: 260px;
    max-width: 340px;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 0 24px #FFD700 inset, 0 0 24px #8e44ad inset, 0 0 24px #3498db inset, 0 0 24px #00ff99 inset;
}

.status-bar {
    margin-bottom: 12px;
    font-size: 1.1em;
    background: linear-gradient(90deg, #FFD700 0%, #8e44ad 33%, #3498db 66%, #00ff99 100%);
    border: 1px solid #FFD700;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 0 16px #FFD700 inset, 0 0 16px #8e44ad inset, 0 0 16px #3498db inset, 0 0 16px #00ff99 inset;
}

#peerListDisplay {
    margin-bottom: 8px;
    font-size: 1em;
}

#chatMessages {
    background: #000;
    border: 1px solid #FFD700;
    height: 40vh;
    overflow-y: auto;
    padding: 10px;
    margin: 10px 0 0 0;
    font-size: 1em;
    white-space: pre-wrap;
    color: #FFD700;
    border-radius: 6px;
    box-shadow: 0 0 16px #FFD700 inset;
}

.input-row {
    display: flex;
    gap: 16px;
    margin: 24px 0 0 0;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.output-panel {
    background: #000;
    border: 1px solid #FFD700;
    color: #FFD700;
    font-size: 0.95em;
    padding: 10px;
    margin-top: 12px;
    border-radius: 6px;
    height: 22vh;
    overflow-y: auto;
    box-shadow: 0 0 16px #FFD700 inset;
}

.output-panel strong {
    color: #8e44ad;
}

.side-panel h3 {
    margin-top: 0;
    color: #8e44ad;
    font-size: 1.1em;
    letter-spacing: 1px;
    text-shadow: 0 0 8px #FFD700, 0 0 8px #8e44ad;
}

.side-panel ul {
    padding-left: 18px;
    margin: 0 0 10px 0;
}

.side-panel li {
    color: #00ff99;
    margin-bottom: 2px;
    font-size: 0.98em;
    text-shadow: 0 0 8px #FFD700, 0 0 8px #00ff99;
}

.side-panel .info-label {
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 8px #8e44ad, 0 0 8px #3498db, 0 0 8px #00ff99;
}

/* Mobile responsiveness for main menu */
@media (max-width: 768px) {
    #mainMenu {
        justify-content: center !important; /* Center the entire menu horizontally */
        align-items: center !important;
        padding-top: 20px !important; /* Add some top padding */
    }
    
    #mainMenu > div {
        display: flex !important;
        flex-direction: column !important; /* Stack buttons vertically */
        gap: 10px !important; /* Gap between buttons */
        padding-top: 0 !important; /* Remove inner padding since outer has it */
        max-height: calc(100vh - 40px) !important; /* Account for padding */
        overflow-y: auto !important; /* Enable scrolling */
        justify-content: flex-start !important; /* Align to top */
        align-items: center !important; /* Center buttons horizontally */
        width: 100% !important;
        max-width: 300px !important; /* Narrower for vertical stack */
    }
    
    #mainMenu button {
        padding: 12px 16px !important; /* Smaller padding for grid */
        font-size: 14px !important; /* Smaller font for mobile */
        min-width: auto !important; /* Remove min-width for grid */
        width: 100% !important; /* Full width in grid cell */
    }
}

/* Mobile responsiveness for trade screen */
@media (max-width: 768px) {
    #tradeScreen {
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: auto !important; /* Enable both vertical and horizontal scrolling */
    }

    #tradeScreen > div {
        flex-direction: column !important; /* Stack columns vertically */
        gap: 10px !important; /* Reduce gap for mobile */
        padding: 10px !important; /* Add minimal padding */
        max-height: none !important; /* Allow full height */
        justify-content: flex-start !important; /* Align to top */
    }

    /* Adjust column widths to full width on mobile */
    #tradeScreen > div > div {
        flex: 1 1 100% !important; /* Each column takes full width */
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Make inventory grids scrollable if needed */
    .inventory-grid {
        max-height: 300px !important; /* Limit height for scrolling */
        overflow: auto !important; /* Enable both horizontal and vertical scrolling */
        width: 100% !important;
        min-width: 0 !important; /* Allow shrinking below content width */
    }

    /* Adjust tab buttons for mobile */
    .traderTab {
        padding: 8px 12px !important;
        font-size: 14px !important;
        min-width: auto !important;
    }

    /* Adjust close button position */
    #closeTradeButton {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        z-index: 10 !important;
    }

    /* Adjust checkout button */
    #checkoutButton {
        width: 100% !important; /* Full width on mobile */
        margin-top: 10px !important;
    }

    /* Move controls hint box to TOP LEFT for trade screen only */
    #tradeScreen div[style*="position: absolute"][style*="top: 18px"] {
        left: 10px !important;
        top: 10px !important; /* Move to very top */
        transform: none !important;
        right: auto !important;
        max-width: 150px !important; /* Even smaller for top left */
        font-size: 9px !important; /* Smaller font */
        padding: 2px 4px !important; /* Minimal padding */
        z-index: 15 !important; /* Above other elements */
    }
}

/* Mobile responsiveness for storage screen */
@media (max-width: 768px) {
    #storageInterface {
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: auto !important; /* Enable both vertical and horizontal scrolling */
    }

    /* Stack storage tabs and content vertically */
    #storageInterface > div {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 10px !important;
        max-height: none !important;
        justify-content: flex-start !important;
    }

    /* Make tab buttons full width and stack */
    .storage-tab {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important;
        margin-bottom: 5px !important;
    }

    /* Adjust storage content areas */
    .storage-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Make inventory grids scrollable and fit mobile */
    .inventory-grid {
        max-height: 250px !important; /* Smaller height for mobile */
        overflow: auto !important; /* Enable both horizontal and vertical scrolling */
        width: 100% !important;
        min-width: 0 !important; /* Allow shrinking below content width */
    }

    /* Adjust close button position */
    #closeStorageButton {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        z-index: 10 !important;
        padding: 8px 12px !important;
        font-size: 14px !important;
    }

    /* Adjust storage UI elements for mobile */
    .storage-ui-element {
        width: 100% !important;
        max-width: 100% !important;
        margin: 5px 0 !important;
    }

    /* Make transfer buttons full width */
    .transfer-btn {
        width: 100% !important;
        margin: 5px 0 !important;
        padding: 10px !important;
    }

    /* Move controls hint box to left side on mobile to avoid close button overlap */
    div[style*="position: absolute"][style*="top: 18px"] {
        left: 10px !important;
        top: 65px !important; /* Lower it another tiny bit */
        transform: none !important;
        right: auto !important;
        max-width: 180px !important; /* Shrink it a tiny bit */
        font-size: 10px !important; /* Smaller font */
        padding: 3px 6px !important; /* Smaller padding */
    }
}
