body {
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: sans-serif;
    color: #333;
}

#game-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 600px;
    border: 5px solid #a0522d; /* Sienna border for autumnal feel */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #fff;
}

#progress-bar-container {
    background-color: #fce8a6; /* Light yellow/cream */
    padding: 5px 10px;
    border-bottom: 2px solid #d45e00;
}

#level-status {
    font-size: 0.9em;
    font-weight: bold;
    color: #a0522d;
    margin-bottom: 3px;
}

#progress-bar-outer {
    height: 15px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
}

#progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: #4CAF50; /* Green progress */
    transition: width 0.5s ease-out;
}

header {
    background-color: #ffaa33; /* Autumn orange */
    padding: 10px;
    text-align: center;
    border-bottom: 3px solid #d45e00;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.5em;
    color: #6a0000; /* Deep red */
}

#score-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #6a0000;
}

#game-area {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
    background-image: url('autumn_forest_background.png');
    background-size: cover;
    background-position: center bottom;
    touch-action: none; /* Prevent scrolling on mobile */
}

/* Player and Basket */
#player {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px; /* Combined height estimate */
    display: flex;
    flex-direction: column;
    align-items: center;
}

#professor-bubbles-img {
    width: 80px;
    height: auto;
    transform: translateY(10px); /* Adjust placement relative to basket */
}

#basket-img {
    width: 100px;
    height: 50px;
    position: absolute;
    bottom: 0;
}

/* Falling Items */
.falling-item {
    position: absolute;
    width: 40px;
    height: 40px;
    pointer-events: none;
    transition: opacity 0.1s;
}

.falling-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* UI and Game Over */
#facts-container {
    padding: 10px;
    background-color: #ffe8b3;
    border-top: 3px solid #d45e00;
    text-align: center;
}

#facts-container h2 {
    margin: 0;
    color: #a0522d;
    font-size: 1.1em;
}

#current-fact {
    margin: 5px 0 0 0;
    font-style: italic;
    color: #444;
}

/* Modal Styling (used for both Level Up and Game Over) */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Darker background for focus */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    max-width: 90%;
}

#level-up-screen h2 {
    color: #4CAF50;
    font-size: 2.5em;
    margin-top: 0;
}

#professor-fact-message {
    font-size: 1.3em;
    margin: 15px 0;
    color: #a0522d;
    font-style: italic;
}

#next-level-button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: #ffaa33;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#next-level-button:hover {
    background-color: #d45e00;
}

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

#game-over-screen h2 {
    color: #a0522d;
    font-size: 3em;
}

#final-score {
    font-size: 1.5em;
    margin: 15px 0;
}

#play-again-button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#play-again-button:hover {
    background-color: #45a049;
}

.hidden {
    display: none !important;
}

/* Mobile Controls */
#joystick-container {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 120px;
    height: 120px;
    z-index: 50;
    /* Hide on desktop, show only on small screens if JS detects mobile input */
    display: none; 
}

@media (max-width: 600px) {
    #joystick-container {
        display: block;
    }
}

/* Squirrel Bonus */
.squirrel-bonus {
    position: absolute;
    top: 50%;
    height: 80px;
    width: 80px;
    transition: opacity 0.3s;
}

.squirrel-bonus img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}