*{user-select: none;}
body{ margin: 0; overflow: hidden; background: black; font-family: "Roboto", sans-serif;}
canvas { display: block; background: transparent; cursor: url('../assets/cursor.png') 12 12, crosshair; } /* Curseur personnalisé */
#fps { position: absolute; color: white; top: 170px; left: 25px; user-select: none; }
img {user-select: none;}

#gameWrapper { position: fixed; inset: 0; overflow: hidden; }
#gameCanvas{ position: absolute; }

#playerStats
{
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: white;
    font-family: Arial, sans-serif;
    background: rgba(0, 0, 0, 0.7); /* Fond semi-transparent */
    padding: 10px;
    border-radius: 5px;
    user-select: none;
}

#playerStats h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

#playerStats p {
    margin: 5px 0;
    font-size: 14px;
}

#playerStats strong {
    color: gold; /* Couleur pour les labels */
}

#timeDisplay {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    user-select: none;
}

#timeDisplay p {
    font-size: 20px;
    font-family: Arial, sans-serif;
    color: white;
    margin: 0 0 5px 0;
    text-align: center;
}

#timeProgressContainer {
    width: 100%;
    height: 5px;
    border-radius: 10px;
    border: 1px solid rgb(40, 40, 40);
}

#timeProgressBar {
    height: 100%;
    background: linear-gradient(to right, #00ff00, #ff0000);
    border-radius: 10px;
}

#enemyBuffsDisplay {
    position: absolute;
    top: 250px;
    left: 10px;
    color: white;
    font-family: Arial, sans-serif;
    background: rgba(0, 0, 0, 0.7); /* Fond semi-transparent */
    padding: 10px;
    border-radius: 5px;
    user-select: none;
}

#enemyBuffsDisplay h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

#enemyBuffsDisplay p {
    margin: 5px 0;
    font-size: 14px;
}

#enemyHealthBuff, 
#enemyDamageBuff
{
    font-size: 25px;
}

#enemyBuffsDisplay strong {
    color: gold; /* Couleur pour les labels */
}


/* Score */
#scoreDisplay {
    position: absolute;
    top: 210px;
    left: 25px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-weight: bold;
    user-select: none;
}

/* Style pour le menu de pause */
#pauseMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
   /* background: rgba(0, 0, 0, 0.8); /* Fond semi-transparent */
    padding: 20px;
    border-radius: 10px;
    color: white;
    font-family: Arial, sans-serif;
    z-index: 1000; /* Assurer que le menu est au-dessus des autres éléments */
    display: none; /* Masqué par défaut */
}

#pauseMenu.visible {
    display: block; /* Afficher le menu de pause */
}

#pauseMenu button {
    display: block;
    width: 200px;
    margin: 10px auto;
    padding: 10px;
    font-size: 20px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#pauseMenu button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#pauseMenu button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Compteur de gold */
#goldCounter {
    position: absolute;
    top: 108px;
    left: 20px;
    display: flex;
    gap: 10px;
    color: white;
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-weight: bold;
    user-select: none;
}

#goldIcon {
    width: 30px;
    height: 30px;
}

/* Messages éphémères */
#ephemeralMessages {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Conteneur des messages éphémères (droite de l'écran) */
#ephemeralMessagesContainer {
    position: fixed;
    height: 300px;
    top: 150px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999; /* Assurer que les messages sont au-dessus des autres éléments */
    overflow: hidden;
}

/* Messages éphémères */
.ephemeral-message {
    color: gold;
    padding: 10px;
    font-family: Arial, sans-serif;
    font-size: 30px;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
    text-align: right;
    pointer-events: none; /* Empêcher les interactions avec les messages */
}

.ephemeral-message.fade-out {
    opacity: 0;
    transform: translateY(-20px); /* Animation de déplacement vers le haut */
}

#gameTimer
{
    position: absolute;
    top: 100px;
    left: 50%;
    color: white;
    font-size: 2em;
    z-index: 998;
    transform: translateX(-50%);
}

#timelineContainer {
    position: absolute;
    top: 5px;
    left: 10px;
    right: 10px;
    height: 30px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.4), rgba(40, 40, 40, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.1), inset 0 0 6px rgba(0, 255, 255, 0.15);
    backdrop-filter: blur(3px);
    z-index: 998;
}

#timelineCursor {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 5px;
    background: red;
    box-shadow:
        0 0 8px red,
        0 0 15px red,
        0 0 30px rgba(255, 0, 0, 0.6),
        0 0 60px rgba(255, 0, 0, 0.4);
    z-index: 999;
}

.event-marker
{
    position: absolute;
    bottom: -24px;
    width: 2px;
    background-color: white;
    opacity: 0.8;
}

.event-marker::after {
    content: attr(data-time);
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 15px;
    color: white;
    white-space: nowrap;
    padding: 2px 5px;
    border-radius: 3px;
    pointer-events: none;
}

.event-marker:nth-child(1 of .event-marker)::after {
    transform: translateX(0);
}
.event-marker:nth-last-child(1 of .event-marker)::after {
    transform: translateX(-100%);
}

.timeline-icon {
  image-rendering: pixelated;
  transition: transform 0.2s ease;
  transform: translateX(-50%);
}

.last-timeline-icon {
  transform: translate(-100%,-10%);
}

/* Style pour l'affichage du nombre de projectiles, llot et ennemis */
#countersContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    gap: 15px;
    align-items: center;
    color: white;
    font-family: Arial, sans-serif;
}

.counter {
    display: flex;
    align-items: center;
    gap: 5px;
}

.counter p {
    margin: 0;
    font-size: 14px;
}



/* Style pour la vidéo de fond */
#backgroundVideo {
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    transform: translate(-25%, -7%);
    object-fit: cover; /* Assure que la vidéo couvre tout l'écran */
    z-index: -1; /* Place la vidéo en arrière-plan */
    filter: blur(2px); /* Applique un effet de flou */
}


/* Style pour le logo du jeu */
#gameLogo {
    width: 30vw; /* Ajustez la largeur selon vos besoins */
    height: auto; /* Conserve les proportions de l'image */
    margin-bottom: 20px; /* Espacement entre le logo et les boutons */
    animation: float 3s ease-in-out infinite; /* Animation de flottement (optionnel) */

}

/* Animation de flottement */
@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

#audioPermissionMessage {
    position: fixed; /* Position fixe pour rester en haut à gauche */
    top: 20px; /* Distance depuis le haut */
    left: 20px; /* Distance depuis la gauche */
    color: white; /* Couleur du texte */
    font-family: Arial, sans-serif; /* Police du texte */
    font-size: 16px; /* Taille du texte */
    background: rgba(0, 0, 0, 0.7); /* Fond semi-transparent */
    padding: 10px; /* Espacement interne */
    border-radius: 5px; /* Coins arrondis */
    z-index: 1000; /* Assurer que le message est au-dessus des autres éléments */
    display: none; /* Masqué par défaut */
    align-items: center; /* Centrer verticalement */
    gap: 10px; /* Espace entre le texte et le bouton */
}

#audioPermissionMessage.visible {
    display: flex; /* Afficher le message en mode flex */
}

#closeAudioMessage {
    background: rgba(255, 255, 255, 0.1); /* Fond semi-transparent */
    border: 1px solid white; /* Bordure blanche */
    color: white; /* Texte blanc */
    padding: 5px 10px; /* Espacement interne */
    border-radius: 5px; /* Coins arrondis */
    cursor: pointer; /* Curseur pointer */
    font-size: 14px; /* Taille du texte */
    transition: background 0.3s ease; /* Transition fluide */
}

#closeAudioMessage:hover {
    background: rgba(255, 255, 255, 0.2); /* Fond plus clair au survol */
}

/* Style pour l'élément de superposition flou */
#blurOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Fond semi-transparent */
    backdrop-filter: blur(17px); /* Appliquer un flou */
    z-index: 999; /* S'assurer qu'il est au-dessus du canvas mais en dessous du menu */
    display: none; /* Masqué par défaut */
}

/* Afficher l'élément de superposition lorsque le jeu est en pause */
#blurOverlay.visible {
    display: block;
}

#flashOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 0, 0, 0.2); /* Rouge semi-transparent */
    pointer-events: none; /* Empêche l'élément d'interférer avec les clics */
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10000; /* Assurez-vous qu'il est au-dessus de tout */
    user-select: none;
}

#flashOverlay.visible {
    opacity: 1; /* Affiche le flash */
}

/* Style pour l'écran de chargement */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    font-size: 24px;
}

#loadingScreen p
{
    text-align: center;
    font-family: 'Arial', sans-serif;
    font-size: 1em;
    color: #ffffff;
    text-shadow: 0px 0px 50px #87cefd, 0 0 50px #70c6ff;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1.5s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* Styles pour la mini-carte 

    #miniMap_container {
        position: fixed;
        bottom: 200px;
        right: 20px;
        width: 100px;
        height: 100px;
        background-color: rgba(0, 0, 0, 1);
        border: 2px solid white;
        border-radius: 10px;
        display: none;
        justify-content: center;
        align-items: center;
        padding:20px;
        z-index: 998;
        user-select: none;
    }
    
    #miniMap {
        position: absolute;
        bottom: 50%;
        right: 50%;
        transform: translate(50%, 50%);
        width: 50px;
        height: 50px;
        background-color: rgba(0, 0, 0, 1);
        border-radius: 10px;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        z-index: 998;
        user-select: none;
    }

    #playerPosition {
        width: 10px;
        height: 10px;
        background-color: red;
        border-radius: 50%;
        position: absolute;
        transform: translate(-50%, -50%); 
        user-select: none;
    }

    #playerCoordinates {
        position: fixed;
        bottom: 142px; 
        right: 36px;
        text-align: center;
        color: white;
        font-family: Arial, sans-serif;
        font-size: 25px;
        display: none;
        user-select: none;
    }
/*****/

#gameOverScreen
{
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Arial', sans-serif;
    z-index: 1000;
    user-select: none;
}

.game-over-content
{
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 50%;
    height:85vh;
    transform: translate(50%, 10%);
    overflow: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.game-over-content h2 {
    margin: 0;
    font-size: 4em;
    user-select: none;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 1.2em;
    text-align: left;
}

.stats-table th, .stats-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ffffff24;
}

.stats-table th {
    background-color: #333;
    color: white;
}

.stats-table tr:last-child td {
    border-bottom: none;
}

#restartButton {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1em;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
}

#restartButton:hover {
    background-color: #cc0000;
}

.scoreTitre
{
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap:0 20px
}

.scoreTitre img
{
    width:25px;
}

#logContainer {
    position: fixed;
    right: 1vw;
    top: 1vh;
    width: 300px;
    height: 300px;
    color: white;
    font-size: 14px;
    z-index: 998;
    text-align: right;
    scrollbar-color: rgb(10, 10, 10) rgb(25, 25, 25);
    scrollbar-width: thin;
    overflow-y: hidden;
    user-select: none;
}

#logContainer img.log-dmg-icon{
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: -4px;
    margin-right: 4px;
}


#logMessages {
    display: flex;
    flex-direction: column; /* Les nouveaux messages apparaissent en haut */
}

.log-message {
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: right;
    gap:0 10px;
}

#teleportCooldownIndicator {
    position: fixed;
    bottom: 50%;
    right: 50%;
    width: 30px;
    height: 30px;
    transform: translate(70px, 70px);
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 1);
    /*display: flex;*/
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 10px;
    z-index: 100;
    overflow: hidden;
    box-shadow: inset 0 0 0 3px rgba(0, 200, 255, 0.3); /* Bordure bleue subtile */
}

#teleportCooldownIndicator .cooldown-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    box-shadow: 
         0 0 10px rgba(0, 200, 255, 0.8),
         0 0 20px rgba(0, 150, 255, 0.6);
    transition: height 0.1s linear;
    border-radius: 50%;
}

#teleportCooldownIndicator .cooldown-text {
    position: relative;
    z-index: 2;
    text-align: center;
    transform: translate(0%, 50%);
    text-shadow: 0 0 5px rgba(0, 200, 255, 0.8);
}

.voirGameOverScreen
{
    background: black;
    padding: 5px 30px;
   /* width: 58%;*/
    display: flex;
    align-items: center;
    justify-content: center;
    height: 55px;
    text-align: center;
    color: red;
    font-size: 2em;
    border: 2px solid red;
    border-radius: 10px;
    user-select: none;
    margin-bottom: 30px;
    justify-self: center;
    cursor: pointer;
    position: fixed;
    z-index: 1;
    top: 25%;
}

.voirGameOverScreen:hover
{
    color: rgb(144, 0, 0);
}

.seeGame
{
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1em;
    background-color: #00459f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
}

.seeGame:hover
{
    background-color: #2675dd;
}

#bossArrow {
  position: absolute;
  pointer-events: none;
  display: none;
}

#bossArrow.visible {
  display: block;
}

#bossArrow img {
  width: 120px;
  height: 120px;
  transform-origin: center center;
}

/* Overlay du décompte : aligné en haut-centre, au-dessus de tout */
#resumeCountdown {
    position: fixed;
    inset: 0;
    display: grid;
    align-items: start;            /* ← en haut */
    justify-items: center;         /* ← centré horizontalement */
    padding-top: clamp(48px, 14vh, 220px); /* ← décalage vers le haut */
    z-index: 10000;
    pointer-events: none;
}
#resumeCountdown.hidden { display: none; }

/* Un GROS chiffre, style néon/glass de tes menus, sans capsule */
#resumeCountdown .count {
    font-family: "Audiowide", system-ui, sans-serif;
    font-weight: 900;
    font-size: clamp(96px, 22vw, 320px);
    line-height: 1;
    color: #eaffff;                          /* texte clair */
    -webkit-text-stroke: 3px rgba(0,0,0,.35);/* lisibilité */
    text-shadow:
        0 2px 0 rgba(0,0,0,.6),
        0 0 28px rgba(0,234,255,.40),
        0 0 56px rgba(24,255,216,.28);
    filter: drop-shadow(0 0 10px rgba(0,234,255,.25));
}

/* Animation à chaque tick (3→2→1) */
#resumeCountdown .count.pop {
    animation: countPop 0.35s cubic-bezier(.2,.6,.2,1);
}
@keyframes countPop {
    0%   { transform: scale(1.25); opacity: .95; }
    80%  { transform: scale(1.00); opacity: 1;   }
    100% { transform: scale(1.00); opacity: 1;   }
}

.loading-overlay {
    position: relative; inset: 0; display: flex; align-items: center;justify-content: center;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); z-index: 9999;
}
.loading-box {
    padding: 18px 20px;
    border-radius: 16px; background: rgba(20,24,28,0.7);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35); color: #e8eef6; text-align: center;
}
.progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress .fill { height: 100%; width: 0%; background: linear-gradient(90deg,#58c3ff,#7bffb0); }
