/**
 * ============================================
 * FICHIER CSS DU JEU SPACE INVADERS (CORRIGÉ)
 * ============================================
 */

/* PROTECTION DES STYLES */
#gameContainer,
#gameContainer * {
    font-family: 'Press Start 2P', cursive, monospace !important;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #000;
    display: flex;
    flex-direction: column; /* Empile le Header et le Jeu verticalement */
    justify-content: center; /* Centre verticalement */
    align-items: center;     /* Centre horizontalement */
    min-height: 100vh;
    overflow: hidden;
    color: white;
    margin: 0;
}

/* --- CONTENEUR DU JEU --- */
#gameContainer {
    position: relative;
    width: 800px;
    height: 600px;
    /* margin: auto permet au flexbox de centrer l'élément parfaitement */
    margin: auto; 
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.2);
    background: #000;
    transition: width 0.3s, height 0.3s;
    /* Petit décalage pour ne pas coller à la navbar si l'écran est petit */
    margin-top: 80px; 
}

/* En très grand écran (desktop), on peut centrer parfaitement */
@media (min-height: 800px) {
    #gameContainer {
        margin-top: auto; 
    }
}

/* MODE PLEIN ÉCRAN */
#gameContainer:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    border: none;
    box-shadow: none;
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    border: 3px solid #00ffff;
    background: linear-gradient(to bottom, #000 0%, #02020a 100%);
    display: block;
}

#gameContainer:fullscreen #gameCanvas {
    border: none;
}

/* --- UI --- */
#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #00ffff;
    font-size: 20px;
    text-shadow: 0 0 10px #00ffff;
    z-index: 10;
    pointer-events: none;
}

#ui div { margin-bottom: 10px; }

.heart-icon {
    color: #ff0000 !important;
    text-shadow: 0 0 10px #ff0000;
    margin-left: 5px;
    display: inline-block;
}

/* --- ÉCRANS --- */
#startScreen, #pauseScreen, #gameOver {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    text-align: center;
}

#startScreen { display: flex; }
#pauseScreen, #gameOver { display: none; }

.start-title, .pause-title {
    font-size: 40px;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    margin-bottom: 40px;
    width: 100%;
    text-align: center;
}

.pause-title, #gameOver div:first-child {
    color: #ff0000 !important;
    text-shadow: 0 0 20px #ff0000;
}

#gameOver div:first-child {
    font-size: 50px;
    margin-bottom: 30px;
}

/* --- BOUTONS MENU --- */
.start-btn, .pause-btn {
    font-size: 16px;
    padding: 15px 30px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    color: #00ffff;
    cursor: pointer;
    transition: all 0.3s;
    margin: 10px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    display: inline-block;
}

.start-btn:hover, .pause-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 30px #00ffff;
    transform: scale(1.05);
}

/* --- TEXTES --- */
.mode-question {
    color: #00ffff !important;
    font-size: 14px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #00ffff;
}

.mode-info {
    color: #00ffff !important;
    opacity: 0.8;
    font-size: 10px;
    margin-top: 15px;
    font-style: italic;
    text-shadow: 0 0 5px #00ffff;
}

.start-instructions, .pause-instructions {
    margin-top: 40px;
    width: 100%;
    text-align: center;
}

.start-instructions p, .pause-instructions p {
    font-size: 12px;
    color: #00ffff !important;
    text-shadow: 0 0 8px #00ffff;
    margin: 10px 0;
    line-height: 1.8;
    width: 100%;
    text-align: center;
}

#gameOver p {
    width: 100%;
    text-align: center;
    font-size: 18px;
    color: #00ffff !important;
    text-shadow: 0 0 10px #00ffff;
    margin: 15px 0;
}

/* --- BOUTONS FLOTTANTS --- */
.game-btn {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    text-decoration: none;
}

.game-btn.cyan-style {
    background: rgba(0, 255, 255, 0.2) !important;
    border: 2px solid #00ffff !important;
    color: #00ffff !important;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}
.cyan-style:hover {
    background: rgba(0, 255, 255, 0.4) !important;
    box-shadow: 0 0 25px #00ffff !important;
    transform: scale(1.1);
}

.game-btn.red-style {
    background: rgba(255, 0, 0, 0.2) !important;
    border: 2px solid #ff0000 !important;
    color: #ff0000 !important;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}
.red-style:hover {
    background: rgba(255, 0, 0, 0.4) !important;
    box-shadow: 0 0 25px #ff0000 !important;
    transform: scale(1.1);
}

/* --- PANNEAU DE RÉGLAGE --- */
/* On force la police sur le panneau et tous ses enfants */
#customPanel, #customPanel * {
    font-family: 'Press Start 2P', cursive !important;
}

/* SLIDER VOLUME */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin: 10px 0;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(0, 255, 255, 0.4);
    border-radius: 2px;
    box-shadow: 0 0 5px #00ffff;
}
input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #00ffff;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 0 15px #00ffff;
}

/* --- FOOTER --- */
footer {
    position: fixed;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 5;
    pointer-events: none;
}

footer p {
    color: #ffffff;
    font-size: 12px;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    margin: 0;
    font-family: 'Courier New', Courier, monospace !important; 
    font-weight: bold;
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    #gameContainer { width: 100vw; height: 100vh; margin: 0; box-shadow: none; border: none; }
    #mobileControls { display: block !important; position: fixed; bottom: 30px; right: 30px; z-index: 1000; }
    #shootBtn { width: 80px; height: 80px; border-radius: 50%; background: rgba(255, 255, 0, 0.2); border: 3px solid #ffff00; color: #ffff00; box-shadow: 0 0 15px #ffff00; }
    .start-title { font-size: 30px; }
}