@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Press+Start+2P&family=Roboto+Mono:wght@400;700&display=swap');

body {
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, #1f4037, #99f2c8);
    background: url('img/stage3.jpeg') no-repeat center center fixed;
    background-size: cover;
    color: #ffffff;
    text-align: center;
    margin: 0;
    display: flex;
    flex-direction: column;
    /* Removed justify-content: space-between to allow content to naturally fill space */
    /* Removed height: 100vh to prevent forced vertical stretching of body */
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Ajustez l'opacité si nécessaire */
    z-index: -1;
}

header {
    padding: 5px;
    background-color: #222831;
    color: #f9ed69;
    font-size: 1rem;
    text-transform: uppercase;
    font-family: 'Press Start 2P', cursive;
    text-shadow: 0 0 5px #f9ed69;
    /* Reduced margin-bottom to 10px from 20px to minimize spacing */
    margin-bottom: 70px;
}

main {
    /* Removed flex properties to prevent stretching and to allow footer to sit at the bottom */
    display: block;
    padding: 20px;
    margin-bottom: 140px; /* Added margin-bottom equal to footer height to avoid overlap */
}


#character-selection {
    background-color: #222831;
    border: 2px solid #00adb5;
    border-radius: 10px;
    padding: 20px;
    width: 80%;
    text-align: center;
    margin: 0 auto; /* Centering the section */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

#character-selection h2 {
    color: #f9ed69;
    margin-bottom: 20px;
    font-size: 1.2rem;
    text-shadow: 0 0 5px #f9ed69;
}

#selection-status {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #eeeeee;
    text-shadow: 0 0 5px #f9ed69;
}

.character-cards-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.character-card {
    background-color: rgba(0, 0, 0, 0.7); /* Fond transparent pour laisser voir le background */
    border: 2px solid #f9ed69; /* Couleur assortie au thème */
    border-radius: 15px;
    padding: 20px;
    width: 220px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}

.character-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(249, 237, 105, 0.8);
}

.character-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.character-card.selected {
    border-color: #f9ed69;
    box-shadow: 0 0 15px rgba(249, 237, 105, 0.5);
}

.character-card img {
    width: 100%;
    border-radius: 10px;
}

.character-name {
    margin-top: 15px;
    font-size: 1.4rem;
    color: #f9ed69;
    font-family: 'Press Start 2P', cursive;
    text-shadow: 0 0 10px rgba(249, 237, 105, 0.7);
}

.character-description {
    margin-top: 10px;
    font-size: 12px;
    color: #ffffff;
}

#start-game-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    background-color: #838383;
    color: #222831;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 10px rgba(249, 237, 105, 0.5);
}


#start-game-btn.enabled {
    cursor: pointer;
    background-color: #42fb1d;
    transform: translateY(-3px);
}

#start-game-btn:hover {
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(249, 237, 105, 0.8);
}

#game {
    display: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    animation: fadeIn 1s ease-in-out forwards;
}

#joueur1, #joueur2 {
    background-color: #222831;
    border: 2px solid #00adb5;
    border-radius: 10px;
    padding: 20px;
    width: 300px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
    transition: transform 0.3s, box-shadow 0.3s;
}

#joueur1:hover, #joueur2:hover {
    transform: scale(1.02);
    box-shadow: 0 0 25px rgba(0, 173, 181, 0.7);
}

#joueur1 img, #joueur2 img {
    width: 80%;
    border-radius: 10px;
    margin-bottom: 15px;
}

#classej1, #classej2 {
    margin-bottom: 10px;
    font-style: italic;
    color: #ffcc29;
    text-shadow: 0 0 5px #ffcc29;
    font-size: 0.9rem;
}

.vie {
    width: 80%;
    height: 20px;
    border: 2px solid #f9ed69;
    border-radius: 10px;
    margin-bottom: 10px;
}

.vie::-webkit-progress-bar {
    background-color: #222831;
    border-radius: 10px;
}

.vie::-webkit-progress-value {
    background: linear-gradient(90deg, #ff0000, #ffff00, #00ff00);
    border-radius: 10px;
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    width: 80%;
    margin: 10px 0;
}

.attack, .heal, .special-attack {
    background: #f9ed69;
    color: #222831;
    padding: 8px 15px;
    border: none;
    margin: 5px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 0 10px rgba(249, 237, 105, 0.5);
}

.attack, .heal {
    flex: 1;
    margin: 0 5px;
}

.special-attack {
    margin-top: 10px;
}

.attack:hover, .heal:hover, .special-attack:hover {
    background: #ffc93c;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(249, 237, 105, 0.7);
}

.special-attack {
    background-color: #e74c3c; /* Different color for special attacks */
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.7);
}

.special-attack:hover {
    background-color: #ffffff; /* Lighter color when hovering over the button */
    color: black;
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.7);
}

#vs {
    font-size: 3rem;
    color: #f9ed69;
    margin: 0 20px;
    text-shadow: 0 0 10px #f9ed69;
    transform: translateY(-10px);
    animation: vsBounce 2s infinite alternate ease-in-out;
}

/* Disable buttons */
.attack.disabled, .heal.disabled, .special-attack.disabled {
    filter: grayscale(100%);
    cursor: not-allowed;
    opacity: 0.5;
}

a {
    color: #f9ed69;
    text-decoration: none;
    font-weight: bold;
    text-shadow: 0 0 5px #f9ed69;
}

a:hover {
    color: #ff0000;
    text-shadow: 0 0 10px #ffc93c;
}

footer {
    padding: 5px;
    background-color: #222831;
    color: #f9ed69;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    text-shadow: 0 0 5px #f9ed69;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Animations */

@keyframes fadeIn {
    0% { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

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

/* Animation pour la secousse */
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
    animation: shake 0.5s;
}


/* Animation de guérison */

@keyframes heal {
    0% { box-shadow: 0 0 10px 10px rgba(0, 255, 0, 0.5); }
    100% { box-shadow: 0 0 0px 0px rgba(0, 255, 0, 0); }
}

@keyframes glowDamage {
    0% { box-shadow: 0 0 5px red; }
    50% { box-shadow: 0 0 20px red; }
    100% { box-shadow: 0 0 5px red; }
}

@keyframes glowHeal {
    0% { box-shadow: 0 0 5px green; }
    50% { box-shadow: 0 0 20px green; }
    100% { box-shadow: 0 0 5px green; }
}

@keyframes glowSpecial {
    0% { box-shadow: 0 0 5px yellow; }
    50% { box-shadow: 0 0 20px yellow; }
    100% { box-shadow: 0 0 5px yellow; }
}

.damage-effect {
    animation: glowDamage 0.8s ease-out;
}

.heal-effect {
    animation: glowHeal 0.8s ease-out;
}

.special-effect {
    animation: glowSpecial 0.8s ease-out;
}

.heal {
    animation: heal 1s;
}

/* Keyframe card shake */

@keyframes cardShake {
    0%, 100% { transform: translateX(0); }
    10%, 90% { transform: translateX(-10px); }
    20%, 80% { transform: translateX(10px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

.card-shake {
    animation: shake 0.5s ease-in-out;
}

/* Animation pour le halo vert des soins */
@keyframes healGlow {
    0% { box-shadow: 0 0 10px 5px rgba(0, 255, 0, 0.8); }
    50% { box-shadow: 0 0 20px 10px rgba(0, 255, 0, 0.8); }
    100% { box-shadow: 0 0 10px 5px rgba(0, 255, 0, 0.8); }
}

.heal-halo img {
    animation: healGlow 1s ease-in-out;
    border-radius: 50%; /* Rond autour du personnage */
}

/* Animation des dégâts/soins */
@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-30px); opacity: 0.8; }
    100% { transform: translateY(-60px); opacity: 0; }
}

.damage-effect-number {
    animation: floatUp 1s ease-in-out forwards;
    font-size: 2rem;
    font-weight: bold;
    color: red;
    text-shadow: 1px 1px 3px black;
    pointer-events: none;
}


/* Media queries */


@media only screen and (max-width: 768px) {
    /* Style global */
    * {
        box-sizing: border-box;
    }

    main {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: space-between;
        width: 100%;
    }

    /* Conteneur des cartes de personnages */
    .character-cards-container {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: hidden;
        align-items: flex-start;
        justify-content: space-between;
        width: 100%;
    }

    .character-card {
        width: 22%;
        padding: 5px;
        margin: 0 1%;
    }

    /* Images des cartes */
    .character-card img {
        width: 100%;
        height: auto;
    }

    /* Pendant le combat */
    #game {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    #joueur1, #joueur2 {
        width: 45%;
        padding: 10px;
        margin: 0;
    }

    /* Images des joueurs */
    #joueur1 img, #joueur2 img {
        width: 100%;
        height: auto;
    }

    #vs {
        width: 10%;
        font-size: 2rem;
        margin: 0;
    }

    /* Boutons d'action */
    .action-buttons {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        padding: 0;
        margin: 5px 0;
    }

    .attack, .heal, .special-attack {
        width: 32%;
        padding: 5px;
        font-size: 0.8rem;
        margin: 0;
    }
}