.game {
  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 90vh;
}

.defaultButton {
  text-decoration: none;
  padding: 0.5rem 2rem;
  background-color: rgb(var(--accent-color));
  border-radius: 6px;
  font-size: 1.25rem;
  box-shadow: var(--box-shadow);

  color: #fff;
  cursor: pointer;

  border: none;
  outline: none;

  display: block;
  position: relative;
  text-align: center;

  transition: all 0.2s, box-shadow 0.08s ease-in;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;

  margin: 1rem;
}

.defaultButton:hover {
  scale: 1.1;
}

/* Page Styles */
body {
  display: flex;
  justify-content: center;
  align-items: center;
}

main {
  padding: 1rem;
  text-align: center;
}

.game-title {
  color: rgb(var(--light-color));
}

.grid {
  border-collapse: collapse;
  margin-inline: auto;
  margin-block: 1.5rem;
}

.grid:empty {
  margin-block: 0rem;
}

/* Grid Shaking */
.grid.shake {
  animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}
/*  */

.grid td {
  border: 2px solid rgb(var(--light-color));
  color: rgb(var(--light-color));
}

.grid td {
  width: 100px;
  height: 100px;

  font-size: 3rem;

  cursor: pointer;
}

.grid td.active {
  animation: growing 0.5s ease-in-out 1 forwards;
}

@keyframes growing {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

.grid td:first-child {
  border-left: 0;
}

.grid td:last-child {
  border-right: 0;
}

.grid tr:first-child td {
  border-top: 0;
}

.grid tr:last-child td {
  border-bottom: 0;
}

#gameOverText {
  color: rgb(var(--light-color));
}

.newGame,
.playAgain {
  display: inline-block;
  margin-inline: auto;

  margin: 0.5rem;
}

.newGame {
  background-color: red;
}

.playAgain {
  background-color: green;
}

.gameOverContainer {
  display: none;
}

.gameOverContainer.active {
  display: block;
}

.grid td.won {
  color: rgb(var(--win-color));
  animation: heartbeat 2s ease-in-out infinite;
}

.grid td.lost {
  color: rgb(var(--lost-color));
  animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Game Menu */
.buttons {
  display: none;
}

.buttons.active {
  display: flex;
  margin-block: 0.5rem;
}

#easy {
  font-weight: bold;
  background-color: green;
}

#medium {
  font-weight: bold;
  background-color: orange;
}

#hard {
  font-weight: bold;
  background-color: red;
}

@media (max-width: 700px) {
  .buttons.active {
    flex-direction: column;
  }
}
