: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;
}

.button {
  padding: 16px 24px;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  color: #333333;
  border: none;
  background-color: #ffbf20;
  border-radius: 10px;
  cursor: pointer;
  box-sizing: border-box;
}

.button:hover {
  background-color: #ffd97c;
}

.button:active {
  background-color: #ffd97c;
}

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

.progress-wrapper {
  display: flex;
  width: 460px;
  height: 16px;
  background-color: #ffffff;
  border-radius: 8px;
}

.progress {
  background-color: #00ca51;
  border-radius: 8px;
  transition: width var(--animation-duration);
}

.progress-description {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  color: #666;
  font-weight: 700;
}



.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;
}

.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;

  display: flex;
  align-items: center;
  justify-content: center;

  background-color: rgba(140, 174, 200, 0.8);
  overflow-y: hidden;
  overscroll-behavior: contain;
  pointer-events: auto;

  /* visibility: hidden; */
  /* opacity: 0; */
  animation: fadeIn calc(var(--animation-duration) + 0.1s) calc(2 * var(--animation-duration)) both;
}

@keyframes fadeIn {
  from {
    /* visibility: hidden; */
    opacity: 0;
  }

  to {
    /* visibility: visible; */
    opacity: 1;
  }
}

.modal-box {
  position: relative;
  width: 320px;
  min-height: 285px;
  max-height: calc(100vh - 60px);
  padding: 72px 40px 36px;
  background-color: rgb(255, 255, 255);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  box-sizing: border-box;
  text-align: center;
}

.modal-box::before {
  content: "";
  position: absolute;
  top: -75px;
  left: -30px;
  width: 376px;
  height: 130px;
  background-image: url("../img/ribbon-with-stars.svg");
  background-position: top center;
  background-repeat: no-repeat;
}

.modal-caption {
  margin: 0;
  margin-bottom: 12px;
  font-size: 24px;
  line-height: 32px;
}

.modal-description {
  margin: 0;
  margin-bottom: 32px;
  font-size: 16px;
  line-height: 22px;
}

.modal .button {
  width: 100%;
}
