@font-face {
  font-family: "font";
  src: url("fonts/greatvibes-regular-webfont.woff") format("woff"),
    url("fonts/greatvibes-regular-webfont.woff2") format("woff2");
}

@font-face {
  font-family: "font1";
  src: url("fonts/Cantate-Beveled.woff");
  font-weight: normal;
  font-style: normal;
}

div {
  font-family: "font";
}

#game-over-text,
#start,
#victory-text {
  font-family: "font1";
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100vh;
  cursor: url(images/cursor2.png), auto;
  font-family: "font1";
  background: url(images/back2.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.page-title {
  color: #ca002a;
  font-family: "font";
  font-weight: bold;
  text-align: center;
  font-size: 5em;
  margin-top: 0em;
}

.game-info-container {
  grid-column: 1 / -1;
  display: flex;
  padding: 0;
  margin: 0;
  justify-content: space-around;
}

.game-info {
  color: #ffbb89;
  font-size: 2.5em;
  padding: 0em;
}

.game-container {
  margin: 50px auto;
  display: grid;
  grid-template-columns: repeat(8, auto);
  grid-gap: 10px;
  justify-content: center;
  perspective: 600px;
}

.card {
  position: relative;
  cursor: url("images/cursor2.png"), auto;
  height: 175px;
  width: 125px;
}

.card-face {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border-width: 1px;
  border-style: solid;
  overflow: hidden;
  transition: transform 500ms ease-in-out;
  backface-visibility: hidden;
}

.card.visible .card-back {
  transform: rotateY(-180deg);
}

.card.visible .card-front {
  transform: rotateY(0);
}

.card.matched .card-front .card-value {
  animation: dance 1s linear infinite 500ms;
}

.card-back {
  transform: rotateY(0);
}

.back {
  align-self: flex-start;
  transition: transform 100ms ease-in-out;
  transform: translateY(-10px);
}

.card-back:hover .back {
  transform: translateY(0);
}

.card-value {
  position: relative;
  transition: transform 100ms ease-in-out;
  transform: scale(0.9);
}

.card-front:hover .card-value {
  transform: scale(1);
}

.card-front {
  transform: rotateY(180deg);
}

.overlay-text {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: none;
  position: fixed;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: #d4af37;
  font-family: "font1";
  transition: background-color 500ms, font-size 500ms;
  text-align: center;
}

.overlay-text-small {
  font-size: 0.3em;
}

.overlay-text.visible {
  display: flex;
  animation: overlay-grow 500ms forwards;
}

@keyframes dance {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-30deg);
  }
  75% {
    transform: rotate(30deg);
  }
}

@keyframes overlay-grow {
  from {
    background-color: rgba(0, 0, 0, 0);
    font-size: 0;
  }
  to {
    background-color: rgba(0, 0, 0, 0.9);
    font-size: 10em;
  }
}

@media (max-width: 650px) {
  .game-container {
    grid-template-columns: repeat(2, auto);
  }
  .game-info-container {
    flex-direction: column;
    align-items: center;
  }
  .card {
    height: 200px;
    width: 160px;
    margin-left: auto;
    margin-right: auto;
  }
  body {
    overflow: visible;
  }
  #game-over-text {
    font-size: 110px !important;
  }
  #victory-text {
    font-size: 60px !important;
  }
}

@media (min-width: 650px) {
  .game-container {
    grid-template-columns: repeat(4, auto);
  }
  .card {
    height: 190px;
    width: 145px;
  }
  body {
    overflow: visible;
  }
}

@media (min-width: 1180px) {
  .game-container {
    grid-template-columns: repeat(8, auto);
  }
}

.back {
  width: 100%;
  height: 110%;
  display: flex;
  justify-content: center;
  size: 110%;
}

.card-front,
.card-back {
  border: 0px;
}

#name {
  color: #ca002a;
  font-family: "font";
  font-weight: bold;
  text-align: center;
  font-size: 5em;
  margin: 0;
  padding: 0;
}
