/* --- MARSHALL - what are you nosing around in here for? KRAPMAN's comin' to get ya! --- */
body {
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    min-height: 100vh;
    background-color: #222;
    font-family: sans-serif;
    color: #fff;
    margin: 0;
    overflow: hidden; /* Prevent scrollbars if scaling slightly overflows */
}

#game-container {
    position: relative;
    /* Keep the BASE dimensions for aspect ratio calculation and internal logic */
    width: 600px;
    height: 500px;
    border: 3px solid #555;
    background-color: #333;
    overflow: hidden;
    /* Scaling will be applied via JavaScript */
    transform-origin: center center; /* Scale from the center */
    /* Add transition for smoother resizing (optional) */
    /* transition: transform 0.1s linear; */
}

/* --- Splash Screen --- */
#splash-screen {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 11; /* Highest index - appears first */
    box-sizing: border-box;
    padding: 20px;
}

#splash-image {
    max-width: 85%;
    max-height: 70%;
    object-fit: contain;
    margin-bottom: 25px;
}

#splash-music-button {
    padding: 8px 15px;
    font-size: 1.0em;
    cursor: pointer;
    background-color: #444;
    border: 1px solid #666;
    border-radius: 5px;
    color: #eee;
    font-weight: normal;
    margin-bottom: 15px;
    transition: background-color 0.2s ease;
}
#splash-music-button:hover { background-color: #555; }
#splash-music-button.playing { background-color: #2a2a4a; border-color: #888; }

#splash-play-button {
    padding: 12px 25px;
    font-size: 1.4em;
    cursor: pointer;
    background-color: #00cc66;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    transition: background-color 0.2s ease;
}
#splash-play-button:hover { background-color: #00e673; }

/* --- Start Screen --- */
/* Make sure overlays scale visually with the container */
#start-screen, #game-over-screen {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex; /* Or none initially based on JS */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10; /* Below splash, above game */
    box-sizing: border-box;
}
/* Ensure splash is visible first by JS hiding others */
#start-screen { display: none;} /* Hide initially */
#game-over-screen { display: none;} /* Hide initially */


#start-screen h1, #game-over-screen h1 {
    font-size: 2.5em; /* Increased base size slightly */
    color: #ff9900;
    margin-top: 0;
    margin-bottom: 10px;
}

#start-screen .instructions {
    background-color: #444;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    max-width: 90%;
    font-size: 0.9em;
}
#start-screen .instructions ul { list-style: none; padding: 0; margin: 4px 0; }
#start-screen .instructions li { margin-bottom: 3px; }
#start-screen .instructions p { margin: 6px 0; font-weight: bold; }

.mode-selection-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}
.difficulty-selection, .two-player-start {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #3a3a3a;
    padding: 8px 12px;
    border-radius: 6px;
}
.difficulty-selection label { font-weight: bold; font-size: 0.95em; }
#difficulty-select { padding: 4px; border-radius: 4px; border: 1px solid #666; background-color: #eee; color: #333; font-size: 0.9em; }
.mode-button, #restart-button { padding: 8px 15px; font-size: 1.1em; cursor: pointer; background-color: #ff9900; border: none; border-radius: 5px; color: #333; font-weight: bold; }
.mode-button:hover, #restart-button:hover { background-color: #ffbf00; }

#game-over-screen #final-time, #game-over-screen #final-score {
    font-size: 1.1em;
    color: #eee;
    margin: 5px 0 10px 0;
}
#game-over-screen #restart-button { margin-top: 10px; }

/* --- Game Area --- */
#game-area {
    position: relative; width: 100%; height: 100%;
    background: linear-gradient(45deg, #2a2a4a, #4a2a4a); /* Default background */
    overflow: hidden;
}

/* --- In-Game Displays --- */
#timer-display { position: absolute; top: 5px; left: 10px; color: #fff; font-size: 1em; background-color: rgba(0, 0, 0, 0.4); padding: 3px 8px; border-radius: 4px; z-index: 7; }
#score-display-container { position: absolute; top: 5px; right: 10px; color: #fff; font-size: 1em; background-color: rgba(0, 0, 0, 0.4); padding: 3px 8px; border-radius: 4px; z-index: 7; }
.score-item { margin-left: 10px; }
.score-item:first-child { margin-left: 0; }

.player { position: absolute; width: 30px; height: 30px; font-size: 28px; text-align: center; line-height: 30px; user-select: none; z-index: 3; }
#poo { } #toilet { }
.wall { position: absolute; background-color: #777; background-image: linear-gradient(45deg, #888 25%, transparent 25%), linear-gradient(-45deg, #888 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #888 75%), linear-gradient(-45deg, transparent 75%, #888 75%); background-size: 10px 10px; border: 1px solid #555; box-shadow: inset 0 0 5px rgba(0,0,0,0.5); z-index: 1; }
.item { position: absolute; width: 25px; height: 25px; font-size: 23px; text-align: center; line-height: 25px; z-index: 2; }

/* --- Effects --- */
#effect-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; display: none; justify-content: center; align-items: center; font-size: 150px; background-color: transparent; }
#effect-overlay.big-poo { display: flex; background-color: rgba(139, 69, 19, 0.3); }
.water-drop { position: absolute; top: -30px; font-size: 24px; color: #60c7ff; pointer-events: none; z-index: 6; animation-name: waterfall-animation; animation-timing-function: linear; animation-fill-mode: forwards; opacity: 0.9; }
@keyframes waterfall-animation { 0% { transform: translateY(0); opacity: 0.9; } 90% { opacity: 0.7; } 100% { transform: translateY(calc(500px + 30px)); opacity: 0; } } /* Adjust 500px if game height changes */

/* --- Level Up Overlay --- */
#level-up-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; justify-content: center; align-items: center; font-size: clamp(50px, 12vw, 100px); font-weight: bold; color: #ffcc00; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7); background-color: rgba(0, 0, 0, 0.4); z-index: 8; pointer-events: none; opacity: 0; transition: opacity 0.4s ease-in-out; }
#level-up-overlay.visible { display: flex; opacity: 1; }