/* 1. RESET & BASE STYLES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Press Start 2P', sans-serif; /* Retro pixel font imported in HTML */
    overflow: hidden;
}

/* 2. GAME CONTAINER & BACKGROUNDS */
#game-container {
    position: relative;
    width: 360px;
    height: 640px;
    background-size: cover;
    background-position: bottom center;
    overflow: hidden;
    /* Smoothly fades the background image when changing difficulties */
    transition: background-image 0.5s ease-in-out; 
}

/* Default background on the initial start screen */
#game-container {
    background-image: url('bg-normal.png');
}

/* Level-specific backgrounds switched via JavaScript classes */
#game-container.bg-normal {
    background-image: url('bg-normal.png');
}

#game-container.bg-hard {
    background-image: url('bg-hard.png');
}

#game-container.bg-nightmare {
    background-image: url('bg-nightmare.png');
}

#game-container.bg-hell {
    background-image: url('bg-hell.png');
}

/* 3. UI LAYERS & TYPOGRAPHY */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    padding: 20px;
}

/* Text styles with retro black outlines (stroke effect) */
h1 { 
    font-size: 32px; 
    text-shadow: 3px 3px 0 #000; 
}

h2 { 
    font-size: 20px; 
    text-shadow: 2px 2px 0 #000; 
}

p { 
    font-size: 11px; 
    text-shadow: 2px 2px 0 #000; 
    line-height: 1.6; 
}

/* Difficulty Selection Menu List */
.menu-list {
    list-style: none;
    font-size: 15px;
    line-height: 2.5;
    text-shadow: 2px 2px 0 #000;
}

/* 4. COLOR & UTILITY CLASSES */
.text-white { color: #ffffff; }
.text-normal { color: #00ff00; }    /* Lime Green */
.text-hard { color: #ffff00; }      /* Yellow */
.text-nightmare { color: #ffa500; } /* Orange */
.text-hell { color: #ff0000; }      /* Red */

/* Spacing utilities */
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

/* 5. HUD (IN-GAME SCORE) */
#ui-hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 5;
}

#score-display {
    color: #ffffff;
    font-size: 36px;
    text-shadow: 3px 3px 0 #000;
}

/* 6. UI STATE & ANIMATIONS */
/* Hides UI layers when they aren't supposed to be active */
.hidden {
    display: none !important;
}

/* Pulsing text animation for "Press SPACE" menus */
.pulse {
    animation: pulse-anim 1.5s infinite ease-in-out;
}

@keyframes pulse-anim {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

/* Smooth pop-in bouncing effect for the Difficulty and Game Over menus */
.pop-in {
    animation: pop-in-anim 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in-anim {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
