body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 20px;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background-color: #3498db;
}

h1 {
    font-size: 3vw; /* Taille flexible selon la largeur de l'écran */
    margin: -8px;
    margin-top: -15px;
}

p {
    font-size: 1.2rem;
    margin: 0;
}

/* Zone de jeu */
.corps{
    display: flex;
    align-content: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

#game-area {
    position: relative;
    width: 80%; /* Largeur flexible */
    max-width: 600px; /* Limite pour éviter une trop grande taille */
    height: 600px; /* Proportion carré */
    max-height: 600px;
    margin: 0 auto;
    border: 2px solid #ccc;
    overflow: hidden;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Cellules */
.character {
    position: absolute;
    width: 10%; /* Taille relative à la largeur de la zone */
    height: 10%;
    max-width: 60px; /* Limite pour éviter des cellules énormes */
    max-height: 60px;
    background-color: #f0f0f0;
    border: 2px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem; /* Texte lisible */
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s;
    overflow: hidden;
}

/* Support pour les images à l'intérieur des caractères */
.character img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
}

.character:hover {
    transform: scale(1.1);
}

.case-bleu {
    position: relative;
    margin-top: 100px;
    bottom: 8%;
    left: 5%;
    height: 200px;
    width: 200px;
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #3498db;
    color: white;
    border-radius: 50px;
    background: linear-gradient(145deg, #2f89c5, #38a3ea);
    box-shadow: 20px 20px 60px #2c81ba,-20px -20px 60px #3caffc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#textbutton{
    position: relative;
    top: 5%;
    padding: 10px 20px;
    background-color: white;
    color: #3498db;
    border-radius: 40px;
    height: 140px;
    width: 140px;
    text-align: center;
    align-content: center;
    font-size: 4rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.score {
    position: relative;
    margin-top: 100px;
    bottom: 8%;
    right: 5%;
    height: 200px;
    width: 200px;
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #3498db;
    color: white;
    border-radius: 50px;
    background: linear-gradient(145deg, #2f89c5, #38a3ea);
    box-shadow: 20px 20px 60px #2c81ba,-20px -20px 60px #3caffc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#score {
    position: relative;
    padding: 10px 20px;
    top: 5%;
    background-color: #ffffff;
    color: #3498db;
    border-radius: 40px;
    height: 140px;
    width: 140px;
    text-align: center;
    align-content: center;
    font-size: 4rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.correct {
    background-color: #8bc34a;
    border-color: #8bc34a;
    animation: pop 0.5s ease-in-out;
}

.wrong {
    background-color: #e57373;
    border-color: #e57373;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.footer {
    background-color: #ccc;
    margin: 0 auto;
    width: 604px;
    margin-top: 10px;
    border-radius: 5px;
    bottom: 0;
    padding: 10px;
}

#difficulty-slider {
    width: 200px;
}

#difficulty-value {
    margin: 10px;
    font-weight: bold;
    margin-left: 10px;
}

/* Game Over Overlay */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.message-box {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.message-box h2 {
    margin-bottom: 15px;
    color: #3498db;
}

.message-box p {
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.message-box .record {
    color: #e74c3c;
    font-weight: bold;
}

.message-box button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.message-box button:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

/* Media Queries */
@media (max-width: 992px) {
    .corps {
        flex-direction: column;
        align-items: center;
    }
    
    .case-bleu, .score {
        margin: 20px auto;
        position: static;
    }
    
    #game-area {
        width: 90%;
        height: 90vw; 
        max-height: 500px;
    }
    
    .footer {
        width: 90%;
        max-width: 604px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 8vw; /* Plus petit sur mobile */
    }

    p {
        font-size: 1rem; /* Réduire les tailles */
    }

    #game-area {
        width: 95%;
        height: 95vw; /* Garde un carré même sur petits écrans */
        max-height: 450px;
    }

    .character {
        width: 15%;
        height: 15%;
    }
    
    .case-bleu, .score {
        height: 150px;
        width: 150px;
    }
    
    #textbutton, #score {
        height: 80px;
        width: 80px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    body {
        margin: 10px;
    }
    
    h1 {
        font-size: 10vw;
    }

    p {
        font-size: 0.9rem;
    }

    #game-area {
        width: 95%;
        height: 95vw;
        margin: 10px auto;
    }

    .character {
        width: 18%;
        height: 18%;
    }
    
    .case-bleu, .score {
        height: 120px;
        width: 120px;
        padding: 5px 10px;
    }
    
    #textbutton, #score {
        height: 70px;
        width: 70px;
        font-size: 2rem;
        padding: 5px;
    }
    
    .footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 10px 5px;
    }
}
