@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;700;800;900;1000&display=swap');

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

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: rgb(108, 108, 250);
}

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

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

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

.cards .card {
    cursor: pointer;
    list-style: none;
    user-select: none;
    position: relative;
    perspective: 1000px;
    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);
    }
}

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

.card .front-view {
    border: 4px solid #fff;

    background-color: #e5e5f7;
    opacity: 0.8;
    background: linear-gradient(135deg, #444cf755 25%, transparent 25%) -10px 0/ 20px 20px, linear-gradient(225deg, #444cf7 25%, transparent 25%) -10px 0/ 20px 20px, linear-gradient(315deg, #444cf755 25%, transparent 25%) 0px 0/ 20px 20px, linear-gradient(45deg, #444cf7 25%, #e5e5f7 25%) 0px 0/ 20px 20px;

}

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

.card .front-view img {
    max-width: 30px;
}

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

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

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

@media screen and (max-width: 700px) {
    .cards{
      height: 350px;
      width: 350px;
    }
    .card .front-view img{
      width: 17px;
    }
    .card .back-view img{
      max-width: 40px;
    }
  }
  
  @media screen and (max-width: 530px) {
    .cards{
      height: 300px;
      width: 300px;
    }
    .card .front-view img{
      width: 15px;
    }
    .card .back-view img{
      max-width: 35px;
    }
  }