/*B"H*/
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    height: 100vh;
    width: 100vw;
    font-family: 'Arial Black', Gadget, sans-serif;
}

#game-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    /* Default to landscape aspect ratio for desktop */
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;

    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    border: 3px solid #FFF;
    background: #111;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

#joystick-area {
    position: absolute;
    bottom: 15px;
    left: 15px;
    width: 120px;
    height: 120px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: all;
}

#joystick-thumb {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#action-button-area {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 100px;
    height: 100px;
    pointer-events: all;
}

#action-button {
    width: 100%;
    height: 100%;
    background-color: rgba(176, 2, 2, 0.5);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    color: white;
    user-select: none;
}

@media (orientation: portrait) {
    #game-container {
        width: 100%;
        height: 100%;
        max-width: none;
        /* THE DEFINITIVE FIX: Use 'auto' to force the override. */
        aspect-ratio: auto;
    }

    #joystick-area {
        width: 45%;
        height: 150px;
        left: 2.5%;
        bottom: 20px;
        border-radius: 80px;
    }

    #action-button-area {
        width: 45%;
        height: 150px;
        right: 2.5%;
        bottom: 20px;
    }

    #action-button {
        font-size: 60px;
        border-radius: 80px;
    }
}


#action-button:active {
    background-color: rgba(255, 0, 0, 0.7);
    transform: scale(0.95);
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 100;
}

#game-over-screen {
    display: none;
}

#start-screen h1, #game-over-screen h1 {
    font-size: clamp(3rem, 10vw, 6rem);
    text-shadow: 3px 3px #c00;
    margin-bottom: 20px;
}

#start-screen p, #game-over-screen p {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin: 10px 20px;
}

#start-button, #restart-button {
    padding: 20px 40px;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    background: #c00;
    color: white;
    border: 2px solid white;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 30px;
    transition: transform 0.2s ease;
}

#start-button:hover, #restart-button:hover {
    transform: scale(1.05);
    background: #ff0000;
}