/* General body styling for a clean, centered look */
body {
    background-color: #f7f7f7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Align content to the top */
    font-family: 'Courier New', Courier, monospace;
    color: #333;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    min-height: 100vh;
    /* Prevents pull-to-refresh and other touch-based browser actions */
    touch-action: manipulation;
}

h1 {
    margin-bottom: 10px;
    font-size: 1.8em;
    text-align: center;
}

/* Container for score and timer, now responsive */
#ui-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 800px; /* Set a max-width for large screens */
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
}

/* The main game canvas, now fully responsive */
#gameCanvas {
    background-color: #fff;
    border: 2px solid #333;
    width: 100%;
    max-width: 800px;
    display: block; /* Removes bottom margin/padding */
    /* This maintains the 800x300 aspect ratio as the canvas scales */
    aspect-ratio: 800 / 300;
    border-radius: 8px;
}

/* Game over screen styling */
#gameOverScreen {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(247, 247, 247, 0.95);
    padding: 20px;
    border: 2px solid #333;
    text-align: center;
    font-size: 1.2em;
    width: 90%; /* Use percentage for smaller screens */
    max-width: 400px; /* Cap the width on larger screens */
    border-radius: 15px;
}

#gameOverScreen h2 {
    margin-top: 0;
}

#houseCanvas {
    background-color: #e0f7fa;
    border: 1px solid #ccc;
    margin-top: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

/* Larger, more touch-friendly restart button */
#restartButton {
    padding: 12px 24px;
    font-size: 1em;
    cursor: pointer;
    border: 2px solid #333;
    background-color: #fff;
    margin-top: 10px;
    border-radius: 8px;
}

/* Media query for smaller screens to adjust font sizes */
@media (max-width: 600px) {
    h1 {
        font-size: 1.5em;
    }
    #ui-container {
        font-size: 1em;
    }
    #gameOverScreen {
        font-size: 1em;
    }
}