html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrolling */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

body {
    display: flex; /* Re-establish as flex container */
    flex-direction: column; /* Stack game and UI vertically */
    justify-content: flex-start; /* Align content to the top */
    align-items: center;
    background-color: #f0f0f0;
    font-family: sans-serif;
    height: 100dvh; /* Use dynamic viewport height for iOS Safari */
}

#game-container {
    width: 100%; /* Take full width */
    flex-grow: 1; /* Allow game container to grow and fill available space */
    max-width: 400px; /* Optional: Limit max width on larger screens to maintain aspect ratio */
    border: 2px solid #333;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    overflow: hidden; /* Ensure Phaser canvas doesn't overflow its container */
    display: flex; /* Use flex to center Phaser canvas if smaller than container */
    justify-content: center;
    align-items: center;
    margin: 0 auto; /* Center horizontally */
}

#ui-container {
    width: 100%;
    max-width: 400px; /* Match game container max-width */
    padding: 10px;
    background-color: #fff;
    border: 2px solid #333;
    border-top: none;
    flex-shrink: 0; /* Prevent UI container from shrinking */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

#money-display {
    text-align: right;
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: bold;
}

#stats-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-bar-container {
    width: 70%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #4caf50;
    width: 100%;
    transition: width 0.3s ease-in-out;
}

#actions-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap; 
    gap: 10px; 
}

button {
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f8f8f8;
    transition: background-color 0.2s ease;
    flex: 1 1 auto; 
    min-width: 100px; 
}

button:hover {
    background-color: #e7e7e7;
}

button:active {
    background-color: #d0d0d0;
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    background-color: #e0e0e0;
}
