.gameContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: space-between;
}

.board {
  aspect-ratio: 1 / 1.2;
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  width: 68.359375%;
  /* Never let the board take more than half the visible viewport height
     (height = width * 1.2), so header + board + keyboard fit on a phone
     screen without scrolling. */
  width: min(68.359375%, 42dvh);
}

.boardRow {
  gap: 0.25rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.boardRowWrong {
  animation: Shake 600ms;
}

.boardRowCorrect {
  animation: Bounce 1000ms;
}

@keyframes Shake {
  10%,
  90% {
    transform: translateX(-1px);
  }

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

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

  40%,
  60% {
    transform: translateX(4px);
  }
}

@keyframes Bounce {
  0%,
  20% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-30px);
  }
  50% {
    transform: translateY(5px);
  }
  60% {
    transform: translateY(-15px);
  }
  80% {
    transform: translateY(2px);
  }
  100% {
    transform: translateY(0);
  }
}

.cell {
  width: 100%;
  border: 2px solid var(--cell-border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
}

.demoCell {
  width: 44px;
  height: 44px;
}

.activeCell {
  border-color: var(--active-cell-border-color);
  animation: Pop 0.1s;
}

@keyframes Pop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.correctCell {
  border: 1px solid transparent;
  background-color: var(--correct-color);
  color: var(--cell-text-color);
  animation: FlipIn 250ms ease-in, FlipOut 250ms ease-in;
}

.almostCorrectCell {
  border: 1px solid transparent;
  background-color: var(--almost-correct-color);
  color: var(--cell-text-color);
  animation: FlipIn 250ms ease-in, FlipOut 250ms ease-in;
}

.wrongCell {
  border: 1px solid transparent;
  background-color: var(--wrong-color);
  color: var(--cell-text-color);
  animation: FlipIn 250ms ease-in, FlipOut 250ms ease-in;
}

.cellText {
  font-size: 2.25rem;
  font-weight: bold;
  text-transform: uppercase;
}

@keyframes FlipIn {
  0% {
    transform: rotateX(0deg);
  }

  100% {
    transform: rotateX(-90deg);
  }
}

@keyframes FlipOut {
  0% {
    transform: rotateX(-90deg);
  }

  100% {
    transform: rotateX(0);
  }
}
