/* --- File: ./app/static/css/game.css --- */
/* Alle Stile für das Rat Invaders Easter Egg Spiel */

/* Font-Face Regel für die Pixel-Schriftart */
@font-face {
    font-family: 'Press Start 2P';
    src: url('../fonts/Press_Start_2P/PressStart2P-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Keyframes */
@keyframes slideInFromLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInFromRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes flicker { 0% { opacity: 0.95; } 50% { opacity: 0.85; } 100% { opacity: 0.95; } }
@keyframes countdownPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.8; } }
@keyframes fadeOutStartOverlay { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }
@keyframes nextWavePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }


/* Hauptcontainer für das Spiel */
#rat-invaders-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--game-overlay-bg, rgba(0, 0, 0, 0.95));
    display: none; /* Standardmäßig versteckt */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: var(--game-text-color, #fff);
    font-family: 'Press Start 2P', Courier, monospace;
    overflow: hidden;
}

/* Wave Indicator */
#wave-indicator {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: var(--game-accent-color2, #ffff00);
    text-shadow: 1px 1px #000;
    z-index: 2003;
    pointer-events: none;
}


/* Wrapper für Canvas, Overlay und Titel */
#game-canvas-wrapper {
    position: relative;
    max-width: 95vw;
    max-height: 80vh;
    aspect-ratio: 4 / 3;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color, #555);
    overflow: hidden;
}

/* Container für den animierten Titel */
#game-title-container {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    text-align: center;
    z-index: 2001;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 1em;
}

/* Styling für die Titel-Teile */
#game-title-rat,
#game-title-invaders {
    font-size: 3rem;
    color: var(--game-accent-color1, #0f0);
    text-shadow: 2px 2px #ff00ff, 4px 4px #00ffff; /* Retro Schatten bleibt */
    opacity: 0;
    white-space: nowrap;
    animation:
        slideInFromLeft 0.8s 1.2s ease-out forwards,
        fadeOut 0.5s 5s ease-in forwards;
}
#game-title-invaders {
    animation-name: slideInFromRight, fadeOut;
    animation-duration: 0.8s, 0.5s;
    animation-delay: 1.4s, 5.2s;
    animation-timing-function: ease-out, ease-in;
    animation-fill-mode: forwards, forwards;
}


/* Das Canvas-Element */
#rat-invaders-canvas {
    background-color: #000; /* Canvas bleibt schwarz */
    max-width: 100%;
    max-height: 100%;
    position: relative;
    z-index: 2000;
    display: block;
}

/* CRT-Overlay */
#crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2002;
    background: linear-gradient( to bottom, rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50% );
    background-size: 100% 4px;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
    border-radius: 50px / 30px;
    animation: flicker 0.15s infinite;
}

/* Overlay für Countdown und Steuerung */
#game-start-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--game-overlay-bg, rgba(0, 0, 0, 0.6));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2001;
    color: var(--game-text-color, #fff);
    font-family: 'Press Start 2P', Courier, monospace;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.5s ease-out;
}
#game-start-overlay.hidden { opacity: 0; pointer-events: none; }

/* Countdown-Zahl */
#countdown-display {
    font-size: 6rem;
    font-weight: bold;
    color: var(--game-accent-color2, #ffcc00);
    text-shadow: 3px 3px var(--game-accent-color3, #ff0000);
    margin-bottom: 1rem;
    animation: countdownPulse 1s ease-in-out infinite;
}

/* Steuerungshinweise */
#controls-info {
    font-size: 1.2rem;
    color: var(--text-color, #eee); /* Verwendung der Haupttextfarbe */
    margin-top: 1rem;
}

/* Game Over Overlay */
#game-over-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--game-overlay-bg, rgba(0, 0, 0, 0.7));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2001;
    color: var(--game-text-color, #fff);
    font-family: 'Press Start 2P', Courier, monospace;
    text-align: center;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.3s ease-in;
}
#game-over-overlay.hidden { opacity: 0; pointer-events: none; display: none; }

/* Texte im Game Over Overlay */
#game-over-message {
    font-size: 30px;
    font-weight: bold;
    color: var(--game-accent-color3, #FF0000);
    margin-bottom: 20px;
}
#game-over-score,
#game-over-highscore {
    font-size: 20px;
    color: var(--game-text-color, #FFFFFF);
    margin-bottom: 10px;
}
#game-over-restart,
#game-over-close {
    font-size: 16px;
    color: var(--game-accent-color1, #00FF00);
    margin-top: 10px;
}
#game-over-close { margin-top: 5px; }

/* Overlay für "Nächste Welle" */
#next-wave-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--game-overlay-bg, rgba(0, 0, 0, 0.6));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2001;
    color: var(--game-text-color, #fff);
    font-family: 'Press Start 2P', Courier, monospace;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}
#next-wave-overlay.hidden { opacity: 0; display: none; }

/* Countdown für nächste Welle */
#next-wave-countdown {
    font-size: 2.5rem;
    color: var(--game-accent-color2, #ffff00);
    text-shadow: 2px 2px #ff8c00; /* Orange Schatten bleibt */
    animation: nextWavePulse 1s ease-in-out infinite;
}


/* Schließen-Button */
#rat-invaders-close-btn {
    position: absolute;
    top: 0.9375rem;
    right: 0.9375rem;
    padding: 0.5rem 0.9375rem;
    background-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--border-color);
    border-radius: 0.3125rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    z-index: 2005;
    transition: background-color 0.2s, color 0.2s;
}
#rat-invaders-close-btn:hover {
    background-color: var(--btn-secondary-hover-bg);
}

/* Score und Highscore Anzeige */
#rat-invaders-score,
#rat-invaders-highscore {
    position: absolute;
    width: 45%;
    bottom: 5%;
    font-size: 1rem;
    color: var(--game-accent-color1, #0f0);
    text-shadow: 1px 1px #000; /* Schwarzer Schatten bleibt für Lesbarkeit */
    z-index: 2003;
    pointer-events: none;
}
#rat-invaders-score { left: 5%; text-align: left; }
#rat-invaders-highscore { right: 5%; text-align: right; }
