html {
    height: 100%;
    overflow-y: scroll; /* Force vertical scrollbar */
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scroll on body if content is too wide */
    font-family: sans-serif;
    background-color: #f0f0f0; /* Background for any small slivers not covered by main */
}

*, *::before, *::after {
    box-sizing: border-box;
}

main {
    display: flex;
    height: 100%;
    width: 100%;
}

#main-content-area {
    display: flex;
    flex-grow: 1; /* Allow this area to grow and fill the main tag */
    height: 100%;
}

#game-container {
    flex-grow: 1; /* Game container takes up remaining space */
    height: 100%;
    background-color: #e0f2e0; /* Light green background for the game area */
    display: flex; /* To center canvas if it has fixed size, or ensure it fills */
    justify-content: center;
    align-items: flex-start; /* Changed from center to flex-start */
    border-right: 1px solid #ccc; /* Optional: a separator line */
    overflow: hidden; 
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* object-fit: contain; /* Ensure canvas content scales nicely if it has an intrinsic size */
}

#ui-container {
    width: 300px; /* Fixed width for UI, adjust as needed */
    height: 100%; /* Full height */
    padding: 20px;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1); /* Shadow on the left side */
    overflow-y: auto; /* Allow scrolling for UI content if it overflows */
    display: flex;
    flex-direction: column;
}

/* Visually hidden class for accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

#tree-controls {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between control groups */
}

#tree-controls div {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between label/input and button */
}

#tree-controls input[type="number"] {
    width: 4em; /* Adjusted width to roughly fit 4 digits */
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex-shrink: 0; /* Prevent input from shrinking if button text is long */
}

#tree-controls button,
#plant-tree-controls button {
    flex-grow: 1; /* Allow buttons to take available space in their flex container */
    display: block;
    width: 100%;
    padding: 5px 10px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

#tree-controls button:hover,
#plant-tree-controls button:hover {
    background-color: #4cae4c;
	
}
#plant-new-tree-button {
	margin-top:10px;
}

#turn-controls {
    margin-top: 15px; /* Add some space above the end turn button */
}

#end-turn-button {
    display: block;
    width: 100%;
    padding: 10px 15px; /* Slightly larger padding for emphasis */
    background-color: #f0ad4e; /* A distinct color, e.g., orange */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
}

#end-turn-button:hover {
    background-color: #ec971f; /* Darker shade on hover */
}

#end-turn-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}


#tree-controls button:disabled,
#plant-tree-controls button:disabled {
    
	background-color: #cccccc;
    cursor: not-allowed;
}

#score-display,
#game-stats {
    margin-top: 15px; /* Adjusted margin for better spacing */
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    text-align: left; /* Align text to the left for stats */
}

#score-display p,
#game-stats p {
    margin: 5px 0; /* Add some vertical margin between stat lines */
    font-size: 1em; /* Standardized font size */
}

#current-score {
    font-weight: bold;
}

/* Responsive adjustments */
/* Basic responsive adjustments: Stack UI below game on small screens */
@media (max-width: 768px) {
    #main-content-area {
        flex-direction: column;
    }

    #game-container {
        width: 100%;
        height: 70vh; /* Example: Game takes 70% of viewport height */
        border-right: none; /* Remove side border */
        border-bottom: 1px solid #ccc; /* Add bottom border as separator */
    }

    #ui-container {
        width: 100%;
        height: 30vh; /* Example: UI takes 30% of viewport height */
        box-shadow: none; /* Remove side shadow */
        border-top: 1px solid #ccc; /* Add top border for separation */
    }

    #tree-controls {
        flex-direction: row; /* Arrange controls horizontally */
        flex-wrap: wrap; /* Allow wrapping */
        justify-content: space-around; /* Distribute items */
    }

    #tree-controls div {
        flex-basis: 45%; /* Each control group takes about half the width */
        /* Adjust gap or margins as needed for spacing */
    }

    #tree-controls button,
    #plant-tree-controls button {
        width: auto; /* Allow button width to be determined by content or flex item rules */
    }
}