@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap");

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: "Ubuntu", sans-serif;
}

p {
    font-size: 20px;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #673ab7;
}

.wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px;
    background: #f8f8f8;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.cards,
.card,
.view,
.details,
p {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cards {
    display: flex;
    flex-wrap: wrap;
    width: 340px;
    justify-content: center;
}

.card {
    cursor: pointer;
    position: relative;
    perspective: 1000px;
    transform-style: preserve-3d;
    height: 75px;
    width: 75px;
    margin: 5px;
}

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

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(13px);
    }
    40% {
        transform: translateX(-13px);
    }
    60% {
        transform: translateX(-8px);
    }
    80% {
        transform: translateX(8px);
    }
}

.cards,
.card {
    user-select: none;
    position: relative;
    background: #fff;
    border-radius: 7px;
    backface-visibility: hidden;
    transition: transform 0.25s linear;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.view {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 7px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s linear;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.view i {
    font-size: 30px;
    user-select: none;
}

.card .back-view i {
    font-size: 40px;
}

.card .back-view {
    transform: rotateY(-180deg);
}

.card.flip .front-view {
    transform: rotateY(180deg);
}

.card.flip .back-view {
    transform: rotateY(0);
}

.details {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px; /* espace entre les éléments */
    margin-top: 20px;
    background: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.details p {
    font-size: 18px;
    margin: 0;
    border-right: 1px solid #ccc;
    padding-right: 15px;
}

.details p:last-of-type {
    border-right: none;
}

.details p span {
    margin-left: 8px;
}

.details p b {
    font-weight: 500;
}

.details button {
    margin-left: 10px;
    font-size: 14px;
    color: #673ab7;
    border-radius: 5px;
    padding: 5px 12px;
    background: #fff;
    border: 2px solid #673ab7;
    transition: 0.3s ease;
}

.details button:hover {
    color: #fff;
    background: #673ab7;
}

::selection {
    color: #fff;
    background: #673ab7;
}

@media screen and (max-width: 700px) {
    .cards {
        height: 350px;
        width: 350px;
    }

    .card .front-view i {
        font-size: 35px;
    }

    .card .back-view i {
        font-size: 35px;
    }
}

@media screen and (max-width: 530px) {
    .cards {
        height: 300px;
        width: 300px;
    }

    .card .back-view i {
        font-size: 30px;
    }

    .details {
        margin-top: 10px;
        padding: 0 15px;
        height: 50px;
    }

    .details p {
        height: 15px;
        font-size: 17px;
        padding-right: 13px;
    }

    .details button {
        font-size: 13px;
        padding: 5px 10px;
        border: none;
        color: #fff;
        background: #673ab7;
    }
}

.game-message {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    background-color: #4caf50; /* vert par défaut pour la victoire */
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: none;
    text-align: center;
}

.game-message.lose {
    background-color: #f44336; /* rouge si défaite */
}

.game-message.show {
    display: block;
}
