/* General Body Style */
html, body {
    height: 100%; /* Ensure body can fill fullscreen height */
    margin: 0;
    padding: 0;
}

body {
    background-color: #08041b; /* Dark background */
    color: #fff; /* Default text color */
    display: flex; /* Use flex for potential vertical centering */
    flex-direction: column; /* Stack elements vertically */
    /* Bootstrap handles font-family, but can override here if needed */
    /* font-family: Arial, sans-serif; */
    }
    
    /* Ensure container takes up space */
    .container {
        flex-grow: 1; /* Allow container to grow */
        display: flex;
        flex-direction: column;
        align-items: center; /* Center all content horizontally */
}
/* Game Area Column */
.col-md-8.col-lg-6 {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items horizontally */
    max-width: 400px; /* Constrain width of the game area column */
    margin: 0 auto; /* Center the column itself */
    padding: 0 5px; /* Minimal padding */
    padding-right: 5px;
}

/* Center game area row if needed */
.row.justify-content-center {
    flex-grow: 1;
    display: flex;
    align-items: center; /* Vertically center the column in the row */
    width: 100%; /* Ensure row takes full width */
}

/* Game Title */
#game-title {
    font-size: 2.5rem; /* Larger title */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 100%;
}

/* Status Bar - Bootstrap handles most styling */
#status-bar {
    border-bottom: 2px solid #fff; /* Keep the bottom border */
    width: 100%; /* Fill the parent column (.col-md-8...) */
    max-width: 400px; /* Match parent column max-width */
    margin: 0 auto; /* Center horizontally */
}

#level, #score {
    font-size: 1.1rem; /* Slightly larger status text */
}

/* Game Canvas */
#gameCanvas {
    /* border is handled by Bootstrap class */
    background-image: url('images/urban-alley-image.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    max-width: 100%; /* Ensure canvas scales down */
    /* height: auto; */ /* Let's control height more explicitly */
    aspect-ratio: 400 / 500; /* Maintain 4:5 aspect ratio */
    width: 100%; /* Fill container width */
    max-width: 400px; /* Match parent column max-width */
    /* Let aspect-ratio handle height relative to width */
    /* max-height: calc(100vh - 250px); */
    display: block; /* Ensure it behaves as a block element */
    margin: 0 auto; /* Center horizontally */
}

/* Message Overlay */
#message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1.25rem;
    z-index: 100; /* Ensure it's above the canvas */
    text-align: center;
}

#message.hidden {
    display: none;
}

/* Control Buttons - Using Bootstrap classes primarily */
#control-buttons .btn {
    min-width: 100px; /* Ensure buttons have a minimum width */
    padding: 10px 15px;
    font-size: 1rem;
    margin: 5px; /* Add some space between buttons */
    /* Optional: Override Bootstrap gradients if specific look is desired */
    /* background: linear-gradient(to right, #ff6200, #ff0000); */
    /* border: none; */
    /* color: #fff; */
    /* text-transform: uppercase; */
    touch-action: manipulation; /* Better touch handling */
}

/* Keep active state if using custom gradients */
/* #control-buttons button:active {
    background: linear-gradient(to right, #e55a00, #e50000);
} */


/* Directional Control Container */
#joystick-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 20px auto;
    z-index: 110;
    touch-action: none; /* Prevent default touch actions like scroll/zoom */
}

/* Directional Control */
#directional-control {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

/* Center button */
.control-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 40%;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 2;
}

/* Direction arrows */
.direction-arrow {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    z-index: 3;
    cursor: pointer;
    user-select: none;
}

.up-arrow {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.right-arrow {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.down-arrow {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.left-arrow {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
}

/* Active state for arrows */
.direction-arrow.active {
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}

/* Ad Banner Placeholder */
#ad-banner-space {
    width: 100%;
    max-width: 728px; /* Desktop/Tablet banner size */
    min-height: 90px;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
}

.mobile-banner {
    display: none;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #game-title {
        font-size: 2rem;
    }

    #level, #score {
        font-size: 1rem;
    }

    #message {
        font-size: 1.1rem;
        padding: 10px 20px;
    }

    #control-buttons .btn {
        min-width: 80px;
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    #joystick-container {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 576px) {
    /* Mobile banner size */
    #ad-banner-space {
        max-width: 320px;
        min-height: 50px;
    }

    .desktop-banner {
        display: none;
    }

    .mobile-banner {
        display: block;
    }

     /* Adjust canvas size for smaller screens if needed */
     /* #gameCanvas {
         width: 320px;
         height: 400px;
     } */
}

/* Fullscreen Specific Styles */
:fullscreen {
    /* Override default browser fullscreen styles if necessary */
    background-color: #08041b; /* Ensure background covers */
}

/* Vendor prefixes for fullscreen */
:-webkit-full-screen { background-color: #08041b; }
:-moz-full-screen { background-color: #08041b; }
:-ms-fullscreen { background-color: #08041b; }

/* Style the container and game elements within fullscreen */
body:fullscreen .container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    padding: 5px; /* Small padding */
    display: flex;
    flex-direction: column;
    justify-content: space-around; /* Distribute space vertically */
    align-items: center; /* Center game horizontally */
}

body:fullscreen .row.justify-content-center {
    width: 100%;
    flex-grow: 0; /* Don't allow row to grow excessively */
    align-items: center;
}

body:fullscreen .col-md-8.col-lg-6 {
    width: 95%; /* Use most of the width */
    max-width: 600px; /* Limit max width even in fullscreen */
    height: 100%; /* Allow column to use full height */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center content vertically within column */
}

body:fullscreen #gameCanvas {
    max-width: 100%; /* Allow canvas to fill width */
    max-height: calc(100% - 180px); /* More precise height limit based on estimated controls */
    width: 100%; /* Fill column width */
    height: auto; /* Let aspect ratio determine height */
    object-fit: contain;
}

/* Ensure status bar matches canvas width in fullscreen */
body:fullscreen #status-bar {
   width: 100%; /* Match the canvas width within the column */
   max-width: 100%; /* Ensure it doesn't exceed canvas */
}

/* Adjust joystick size/position for fullscreen if needed */
/* body:fullscreen #joystick-container { ... } */