* {
    box-sizing: border-box;
    touch-action: manipulation;
}
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex; /* Ensure full height flexbox centering */
    justify-content: center;
    align-items: center;
    background-color: #000;
    overflow: hidden;
}
body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    color: #fff;
}
#game-container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
#game-area {
    background: url('../images/space-background_v7.webp') repeat-y;
    background-size: cover;
    animation: spaceScroll 20s linear infinite;
    flex-grow: 1;
    width: 100%; /* Ensure it fills the container */
    position: relative;
    overflow: hidden;
    border: 2px solid #fff;
}
@keyframes spaceScroll {
    from { background-position: 0 0; }
    to { background-position: 0 100%; }
}
.cosmic-invader, #powerup {
    position: absolute;
    font-size: 8vmin;
    user-select: none;
}
#laser {
    position: absolute;
    background-color: #ff0000;
    width: 2px;
    height: 0;
    transform-origin: top center;
    display: none;
}
#game-stats {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    font-size: 3vmin;
}
.menu-btn {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 10px 20px;
    font-size: 4vmin;
    cursor: pointer;
    border-radius: 5px;
    animation: buttonBounce 0.5s infinite;
}

@keyframes buttonBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
#start-btn {
    position: absolute;
    top: 50%;
    left: 34%;
    transform: translate(-50%, -50%);
    z-index: 10;
    padding: 10px 20px; /* Add some padding to make sure the button has enough clickable area */
    font-size: 4vmin; /* Ensure the text size looks good */
    background-color: #4CAF50;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}
#game-controls {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}
#pause-btn, #quit-btn {
    display: none;
}
#instructions {
    display: none;
    position: absolute;
    top: 26%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    z-index: 1000;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    font-size: 3vmin;
}
#instructions-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}
.explosion {
    position: absolute;
    pointer-events: none;
    font-size: 12vmin;
}
.cosmic-invader {
    font-size: 8vmin;
    opacity: 0;
    animation: invaderAppear 1s forwards;
}

@keyframes invaderAppear {
    0% {
        transform: scale(0.5) rotate(-30deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.explosion {
    font-size: 12vmin;
    animation: explode 0.7s forwards;
}

@keyframes explode {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(3);
    }
}
#powerup {
    animation: float 1.5s ease-in-out infinite, glow 2s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

@keyframes glow {
    0% { text-shadow: 0 0 5px #fff; }
    100% { text-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00; }
}