@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

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

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

.wrapper {
    height: 400px;
    width: 400px;
    padding: 25px;
    background: #f8f8f8;
    border-radius: 10px;
}

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

.cards {
    height: 100%;
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
}

.cards .card {
    cursor: pointer;
    position: relative;
    perspective: 800px;
    transform-style: preserve-3d;
    height: calc(100% / 4 - 10px);
    width: calc(100% / 4 - 10px);
}

.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 .view {
    width: 100%;
    height: 100%;
    user-select: none;
    pointer-events: none;
    position: absolute;
    background: #fff;
    border-radius: 7px;
    backface-visibility: hidden;
    transition: transform 0.25s linear;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.card .front-view span {
    color: #6563ff;
    font-size: 40px;
}

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

.card .back-view img {
    max-width: 45px;
}

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

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