:root {
  --animation-duration: 0.8s;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Nunito-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Nunito-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("../fonts/Nunito-Black.woff2") format("woff2");
}

body {
  margin: 0;
  font-family: "Nunito", sans-serif;
  font-size: 20px;
  line-height: 28px;
  color: #333333;
  background: url("../img/clouds.svg") no-repeat top 40px center,
    linear-gradient(180deg, #c2e5fe 0%, #ffffff 50%) no-repeat;
}

.container {
  width: 940px;
  margin: 0 auto;
}

.game {
  display: grid;
  grid-template-columns: 460px auto 1fr;
  align-items: center;
  gap: 40px 20px;
  padding-top: 40px;
  margin-bottom: 155px;
}

.steps {
  justify-self: end;
  padding: 8px 20px;
  font-weight: 900;
  font-size: 20px;
  line-height: 28px;
  color: #ffffff;
  background-color: #00ca51;
  border-radius: 22px;
}

.cards {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 220px);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;

  perspective: 1000px; /* Для анимации */
}

.card {
  display: grid;
  align-items: center;
  justify-items: center;
  width: 220px;
  height: 160px;
  background-color: #ffffff;
  border-radius: 10px;
  box-sizing: border-box;
  border: 1px solid #bad6eb;
  cursor: pointer;

  transition: transform var(--animation-duration);
  transform-style: preserve-3d;
}

.card img {
  grid-area: 1 / 1 / 2 / 2;
  border-radius: 5px;
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

/* Рубашка */

.card::after {
  grid-area: 1 / 1 / 2 / 2;
  content: "";
  width: 218px;
  height: 158px;
  background-image: url("../img/back-cats.svg");
  background-repeat: no-repeat;
  background-position: center;
  backface-visibility: hidden;
}

/* Финальная отметка */

.card::before {
  content: "";
  grid-area: 1 / 1 / 2 / 2;
  width: 204px;
  height: 144px;
  border-radius: 5px;
  background-color: rgba(140, 174, 200, 0.6);
  background-image: url("../img/check.svg");
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transition-property: opacity;
  z-index: 1;
}

.card:not(.card-show):not(.card-finished):hover {
  box-shadow: 0 6px 16px rgba(140, 174, 200, 0.6);
}

.card-show {
  transform: rotateY(180deg);
  cursor: default;
}

.card-finished {
  transform: rotateY(180deg);
  cursor: default;
}

.card-finished::before {
  opacity: 1;
  transition-delay: var(--animation-duration);
  transition-duration: var(--animation-duration);
  transition-timing-function: ease-in-out;
}
