body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #2e7d32;
}
#menu, #victoryMenu {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 10px;
}

#menu h1, #victoryMenu h1 {
    font-size: 2em;
    margin-bottom: 20px;
}
#startButton, #restartButton {
    font-size: 1.2em;
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #4caf50;
    color: white;
}
.game-container {
    position: relative;
    width: 60vw; /* Prend maintenant 60% de la largeur de l'écran */
    height: 60vh; /* Prend maintenant 60% de la hauteur de l'écran */
    max-width: 1000px; /* Limite la taille maximale pour grands écrans */
    max-height: 800px; /* Limite la hauteur maximale pour grands écrans */
}
#victoryMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: explode 0.5s ease forwards, shine 1.5s infinite;
}
.game-container {
    display: none; /* Masquer le jeu initialement */
    position: relative;
    width: 60vw;
    height: 60vh;
    max-width: 1000px;
    max-height: 800px;
}
canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.card {
    position: absolute;
    perspective: 1000px;
    opacity: 0; /* Commence invisible pour chaque carte */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 5%; /* Arrondir légèrement les coins */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Ombre pour un effet de profondeur */
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Times New Roman', Times, serif;
    border-radius: 5%;
    box-sizing: border-box;
}

.card-back {
    background-image: url('back_card.jpg');
    background-size: 100% 100%; /* Forcer l'image à couvrir toute la carte */
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5%;
    box-sizing: border-box;
}

.card-front {
    background-color: white;
    color: black;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.5em;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

.card-front .card-value {
    font-size: 1em;
    font-weight: bold;
}

.card-front .card-suit {
    font-size: 1.5em;
}

.card-front.red {
    color: red;
}

/* Styles responsive pour les petits écrans */
@media (max-width: 600px) {
    .game-container {
        width: 90vw;
        height: 90vh;
    }
    
    .card-front .card-value,
    .card-front .card-suit {
        font-size: 0.8em;
    }
}
@keyframes dropCard {
    0% {
        transform: translateY(-50px) rotate(-10deg);
        opacity: 0;
    }
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}
@keyframes shuffleCard {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(calc(-50px + 100px * var(--random-x)), calc(-50px + 100px * var(--random-y))) rotate(calc(-15deg + 30deg * var(--random-rotation)));
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}
@keyframes distributeCard {
    0% {
        transform: translate(-50%, -50%);
    }
    100% {
        transform: translate(0, 0);
    }
}
@keyframes drawCard {
    0% {
        transform: translate(-50%, -50%) scale(0.8) rotate(-15deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}
@keyframes explode {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes shine {
    0% { text-shadow: 0 0 5px #fff, 0 0 10px #ff4, 0 0 20px #ff4, 0 0 30px #ff4; }
    50% { text-shadow: 0 0 10px #fff, 0 0 20px #ff4, 0 0 40px #ff4, 0 0 50px #ff4; }
    100% { text-shadow: 0 0 5px #fff, 0 0 10px #ff4, 0 0 20px #ff4, 0 0 30px #ff4; }
}
#victoryMenu h1 {
    font-size: 6em;
    color: #ffeb3b;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

#victoryMenu p {
    font-size: 1.5em;
    color: #fff;
    margin: 10px 0 20px;
}
.hidden {
    display: none;
}