:root {
  --correct: #41d241;
  --absent: #E8E8E8;
  --present: #f7e545;
  --pink: #FF99B1;
  --lightPink: #FFC1D0;
  --darkPink: #F98DA7;
  --red: #d22a52;
}

#gameboard {
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-inline: auto;
}

#gameboard .modal {
  box-shadow: 0 0 20px #b3b3b3;
  background-color: white;
  width: 100%;
  max-width: 400px;
  flex-direction: column;
  padding: 2em 1em;
  border-radius: 8px;
  justify-content: center;
  align-items: center;
  position: absolute;
  gap: 10px;
  display: none;
  z-index: 11;
  max-height: 85%;
  top: 5%;
}

#gameboard .modal .modal--end__close-button {
  background: none;
  border: none;
  color: white;
  font-weight: 700;
  font-size: 1.8em;
  width: 40px;
  height: 40px;
  aspect-ratio: 1;
  border-radius: 100vw;
  line-height: 0;
  transition: box-shadow 0.25s;
  cursor: pointer;
  position: absolute;
  top: 15px;
  right: 15px;
}

#gameboard .modal .modal--end__close-button:hover {
  box-shadow: 0 0 18px 0px #191919;
}

#gameboard .modal p {
  text-align: center;
  margin: 0;
}

#gameboard .modal .modal__title {
  font-weight: 600;
  font-size: 1.3em;
  margin-bottom: 0.5em;
}

#gameboard .modal.show {
  display: flex;
}

#gameboard .modal.show~.words-container,
#gameboard .modal.show~.keyboard {
  filter: opacity(0.5) grayscale(0.5);
  user-select: none;
  pointer-events: none;
}

#gameboard .modal .modal__button {
  background: #3cb93c;
  color: white;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  border: none;
  justify-content: center;
  padding: 0.8em 1.8em;
  font-size: 1.2em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

#gameboard .modal .modal__button:hover {
  background: #44af3a;
}

#gameboard .modal--end .win,
#gameboard .modal--end .lose {
  display: none;
}

#gameboard .modal--end .modal__title {
  margin-bottom: 2em;
}

#gameboard .modal--end .modal__button {
  margin-top: 2em;
}

#gameboard .modal--end.modal--end-lose .win {
  display: none;
}

#gameboard .modal--end.modal--end-lose .lose {
  display: block;
}

#gameboard .modal--end.modal--end-win .win {
  display: block;
}

#gameboard .modal--end.modal--end-win .lose {
  display: none;
}

#gameboard .wrongAnswer {
  width: 100%;
  max-width: 350px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  padding: 1em;
  background: #ff4b4bc2;
  position: absolute;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  backdrop-filter: blur(10px);
}

#gameboard .words-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

#gameboard .words-container .word.active .word__letter {
  border: 3px solid var(--red);
}

#gameboard .word {
  display: flex;
  gap: 5px;
  width: 100%;
  justify-content: center;
}

#gameboard .word .word__letter {
  border: 2px solid var(--pink);
  aspect-ratio: 1;
  max-width: 60px;
  width: 100%;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 1.5em;
  text-transform: uppercase;
  transition: background 0.25s 0s, border 0.2s;
  box-sizing: border-box;
}

#gameboard .keyboard {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  width: 100%;
}

#gameboard .keyboard .keyboard__row {
  display: flex;
  gap: 5px;
  justify-content: center;
  width: 100%;
}

#gameboard .keyboard .keyboard__row button {
  border-radius: 4px;
  background: var(--pink);
  color: white;
  border: none;
  transition: background 0.2s;
  cursor: pointer;
  font-size: 1.1em;
  width: 100%;
  height: 50px;
  padding: 0 0.5em;
  line-height: 0;
  text-transform: uppercase;
  -webkit-tap-highlight-color: #353b4a;
}

#gameboard .keyboard .keyboard__row button[data-key="Backspace"] {
  min-width: 40px;
}

#gameboard .keyboard .keyboard__row button:hover {
  background: var(--darkPink);
}

#gameboard .keyboard .keyboard__row.double-letters button {
  font-size: 0.8em;
  font-weight: 700;
}

#gameboard .word__letter--absent,
#gameboard .btn--absent {
  background: var(--absent) !important;
  border-color: transparent;
  transition: background 0.25s 0.5s !important;
}

#gameboard .word__letter--present,
#gameboard .btn--present {
  background: var(--present) !important;
  border-color: transparent;
  transition: background 0.25s 0.5s !important;
}

#gameboard .word__letter--correct,
#gameboard .btn--correct {
  background: var(--correct) !important;
  border-color: transparent;
  transition: background 0.25s 0.5s !important;
}

.shake-horizontal {
  -webkit-animation: shake-horizontal 0.8s cubic-bezier(0.455, 0.03, 0.515, 0.955) both;
  animation: shake-horizontal 0.8s cubic-bezier(0.455, 0.03, 0.515, 0.955) both;
}

@-webkit-keyframes shake-horizontal {

  0%,
  100% {
    -webkit-transform: translateX(0);
    transform: translateX(0);
  }

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

  20%,
  40%,
  60% {
    -webkit-transform: translateX(10px);
    transform: translateX(10px);
  }

  80% {
    -webkit-transform: translateX(8px);
    transform: translateX(8px);
  }

  90% {
    -webkit-transform: translateX(-8px);
    transform: translateX(-8px);
  }
}

@keyframes shake-horizontal {

  0%,
  100% {
    -webkit-transform: translateX(0);
    transform: translateX(0);
  }

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

  20%,
  40%,
  60% {
    -webkit-transform: translateX(10px);
    transform: translateX(10px);
  }

  80% {
    -webkit-transform: translateX(8px);
    transform: translateX(8px);
  }

  90% {
    -webkit-transform: translateX(-8px);
    transform: translateX(-8px);
  }
}

.rotate-hor-center {
  -webkit-animation: rotate-hor-center 1s cubic-bezier(0.455, 0.03, 0.515, 0.955) both;
  animation: rotate-hor-center 1s cubic-bezier(0.455, 0.03, 0.515, 0.955) both;
}

@-webkit-keyframes rotate-hor-center {
  0% {
    -webkit-transform: rotateX(0);
    transform: rotateX(0);
  }

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

@keyframes rotate-hor-center {
  0% {
    -webkit-transform: rotateX(0);
    transform: rotateX(0);
  }

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

.jello-horizontal {
  -webkit-animation: jello-horizontal 0.9s both;
  animation: jello-horizontal 0.9s both;
}

@-webkit-keyframes jello-horizontal {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  30% {
    -webkit-transform: scale3d(1.25, 0.75, 1);
    transform: scale3d(1.25, 0.75, 1);
  }

  40% {
    -webkit-transform: scale3d(0.75, 1.25, 1);
    transform: scale3d(0.75, 1.25, 1);
  }

  50% {
    -webkit-transform: scale3d(1.15, 0.85, 1);
    transform: scale3d(1.15, 0.85, 1);
  }

  65% {
    -webkit-transform: scale3d(0.95, 1.05, 1);
    transform: scale3d(0.95, 1.05, 1);
  }

  75% {
    -webkit-transform: scale3d(1.05, 0.95, 1);
    transform: scale3d(1.05, 0.95, 1);
  }

  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}

@keyframes jello-horizontal {
  0% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  30% {
    -webkit-transform: scale3d(1.25, 0.75, 1);
    transform: scale3d(1.25, 0.75, 1);
  }

  40% {
    -webkit-transform: scale3d(0.75, 1.25, 1);
    transform: scale3d(0.75, 1.25, 1);
  }

  50% {
    -webkit-transform: scale3d(1.15, 0.85, 1);
    transform: scale3d(1.15, 0.85, 1);
  }

  65% {
    -webkit-transform: scale3d(0.95, 1.05, 1);
    transform: scale3d(0.95, 1.05, 1);
  }

  75% {
    -webkit-transform: scale3d(1.05, 0.95, 1);
    transform: scale3d(1.05, 0.95, 1);
  }

  100% {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}

@media (max-width: 360px) {
  #gameboard .keyboard .keyboard__row button {
    padding: 0 0.3em;
  }
}