* {
    -webkit-tap-highlight-color: transparent;
  }


body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #2e2e2e;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

h1 {
    color: #fff;
    font-family: 'Arial', sans-serif;
    font-size: 3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    text-align: center;
}

.container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 20px;
}

.game-board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px auto;
    padding: 20px;
    width: 100%;
    max-width: 1200px; /* Ajout d'une largeur maximale */
    box-sizing: border-box;
}

.card {
    flex: 0 1 calc(20% - 10px);
    max-width: 100px;
    min-width: 60px;
    height: 100px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    transform-origin: center;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card::before,
.card::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    backface-visibility: hidden;
    font-size: 2em;
}

.card::before {
    content: "?";
    background-color: #34495e;
    color: white;
}

.card::after {
    content: attr(data-symbol);
    background-color: #ecf0f1;
    color: #2c3e50;
    transform: rotateY(180deg);
}

.card.flipped {
    transform: rotateY(180deg);
}

.score-container {
    text-align: center;
    margin: 20px auto;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem 2rem;
    border-radius: 25px;
    max-width: 400px;
    width: auto;
    color: white;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-out;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-height: 1.5rem;
    height: auto;
    max-height: 4rem; 
    white-space: normal;
    overflow: hidden;
}

.score-item {
    color: white;
    padding: 5px;
}

.score-container span {
    margin: 0 10px;
}

#restart-btn {
    display: block;
    margin: 20px auto;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#restart-btn:hover {
    background: #4CAF50;
    transform: scale(1.05);
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}
  
.back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.popup-content {
    background: #1a1a1aea;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    margin: 20px;
    transform: translateY(0);
    animation: slideUp 0.4s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color:white;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

.form-group input {
    width: 40%;
    padding: 0.8rem 1rem;
    border: 2px solid #45a049;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.popup-content .form-group input {
    color: #1a1a1a;
}

.form-group input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #4fce56;
}

#startGame, #restartGame {
    background: #45a049;
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#startGame:hover, #restartGame:hover {
    background: #4fce56;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media screen and (max-width: 480px) {
    .card {
        flex: 0 1 calc(25% - 10px);
        max-width: 70px;
        min-width: 50px;
        height: 70px;
        font-size: 0.8em;
    }

    .card::before,
    .card::after {
        font-size: 1.5em;
    }

    .game-board {
        gap: 5px;
        padding: 10px;
    }

    .container {
        margin-top: 60px;
        padding: 0 10px;
    }
    .back-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        top: 10px;
        left: 10px;
    }
}