* {
  box-sizing: border-box;
  font-family: "Dela Gothic One", cursive;
}

html {
  user-select: none;
}

body {
  color: whitesmoke;
  min-height: 100vh;
  background-color: #330033;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 800 800'%3E%3Cg fill='none' stroke='%23404' stroke-width='1'%3E%3Cpath d='M769 229L1037 260.9M927 880L731 737 520 660 309 538 40 599 295 764 126.5 879.5 40 599-197 493 102 382-31 229 126.5 79.5-69-63'/%3E%3Cpath d='M-31 229L237 261 390 382 603 493 308.5 537.5 101.5 381.5M370 905L295 764'/%3E%3Cpath d='M520 660L578 842 731 737 840 599 603 493 520 660 295 764 309 538 390 382 539 269 769 229 577.5 41.5 370 105 295 -36 126.5 79.5 237 261 102 382 40 599 -69 737 127 880'/%3E%3Cpath d='M520-140L578.5 42.5 731-63M603 493L539 269 237 261 370 105M902 382L539 269M390 382L102 382'/%3E%3Cpath d='M-222 42L126.5 79.5 370 105 539 269 577.5 41.5 927 80 769 229 902 382 603 493 731 737M295-36L577.5 41.5M578 842L295 764M40-201L127 80M102 382L-261 269'/%3E%3C/g%3E%3Cg fill='%23505'%3E%3Ccircle cx='769' cy='229' r='5'/%3E%3Ccircle cx='539' cy='269' r='5'/%3E%3Ccircle cx='603' cy='493' r='5'/%3E%3Ccircle cx='731' cy='737' r='5'/%3E%3Ccircle cx='520' cy='660' r='5'/%3E%3Ccircle cx='309' cy='538' r='5'/%3E%3Ccircle cx='295' cy='764' r='5'/%3E%3Ccircle cx='40' cy='599' r='5'/%3E%3Ccircle cx='102' cy='382' r='5'/%3E%3Ccircle cx='127' cy='80' r='5'/%3E%3Ccircle cx='370' cy='105' r='5'/%3E%3Ccircle cx='578' cy='42' r='5'/%3E%3Ccircle cx='237' cy='261' r='5'/%3E%3Ccircle cx='390' cy='382' r='5'/%3E%3C/g%3E%3C/svg%3E");
}

.page-title {
  color: whitesmoke;
  text-align: center;
  font-weight: normal;
  font-size: 5rem;
  margin: 0 20px 20px 20px;
}

.game-info-container {
  grid-column: 1/-1;
  display: flex;
  justify-content: space-between;
}

.game-info {
  font-size: 2em;
}

.card {
  position: relative;
  height: 175px;
  width: 125px;
}

.card.matched .card-value {
  animation: dance 1s linear infinite 800ms;
}

@keyframes dance {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-20deg);
  }

  75% {
    transform: rotate(20deg);
  }
}

.overlay-text {
  display: none;
  user-select: none;
  text-align: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  justify-content: center;
  align-items: center;
  z-index: 100;
  color: yellow;
}

.overlay-text-small,
#start {
  cursor: pointer;
}

.overlay-text-small {
  font-size: 0.3em;
}

.overlay-text.visible {
  display: flex;
  flex-direction: column;
  animation: overlay-grow 500ms forwards;
}

@keyframes overlay-grow {
  from {
    background-color: rgba(0, 0, 0, 0);
    font-size: 0;
  }
  to {
    font-size: 10em;
    background-color: rgba(0, 0, 0, 0.8);
  }
}

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

.card.visible .card-front {
  transform: rotateY(0);
}

.card-face {
  position: absolute;
  height: inherit;
  background-color: whitesmoke;
  width: inherit;
  overflow: hidden;
  cursor: pointer;
  backface-visibility: hidden;
  border-radius: 12px;
  transition: transform 800ms ease-in-out;
}

.card-face img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  transition: transform 200ms ease-in-out;
}

.card-face img:hover {
  transform: scale(1.05);
}

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

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: scale-down;
}

.game-container {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 10px;
  margin: 20px;
  justify-content: center;
  perspective: 500px;
}

@media (max-width: 600px) {
  .game-container {
    grid-template-columns: repeat(2, auto);
  }

  .game-info-container {
    flex-direction: column;
    align-items: center;
  }
}
