:root {
  --light: #d8dbe0;
  --dark: #28292c;

  --btn-primary: rgba(255, 53, 127);
  --stats-color: rgb(255, 207, 224);

  --light-bg: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
  --dark-bg: linear-gradient(to right, #434343 0%, black 100%);

  --light-letter-box-bg: aliceblue;
  --light-letter-box-filled-bg: rgb(194, 215, 233);
  --dark-letter-box-bg: rgb(13, 38, 60);
}

* {
  margin: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
  transition: background-color 100ms linear;
  transition: color 100ms linear;
}

body {
  background-image: var(--light-bg);
}

.body-dark {
  background-image: var(--dark-bg);
}

.grid {
  display: grid !important;
}

.container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  width: fit-content;
  height: fit-content;
  max-width: 40%;
  margin: 0 auto;
  display: none;
  gap: 1rem;
  place-content: center;
}

.word-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.button-container {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.flex {
  display: flex !important;
}

.btn-control {
  font-size: 1.1rem;
  font-family: "Roboto", sans-serif;
  display: block;
  aspect-ratio: 3.7;
  /* height: clamp(30px, 10vh, 30); */
  width: clamp(150px, 15vw, 180px);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--light);
  text-align: center;
  cursor: pointer;
  outline: none;
  border: none;
  background: var(--btn-primary);
  z-index: 1;
}

.btn-control:not(:disabled):hover {
  color: var(--btn-primary);
}

.btn-control::after {
  height: 100%;
  width: 0;
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  transition: all 300ms cubic-bezier(0.31, 0.97, 0.47, 1.32);
  background: white;
}

.btn-control:hover::after {
  width: 100%;
}

.btn-control:disabled:hover::after {
  width: 10%;
}

.btn-control:disabled {
  opacity: 0.5;
  cursor: auto;
}

.btn-control:focus {
  border: 2px solid white;
}

.letterbox_row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.letterbox {
  width: clamp(40px, 4vw, 80px);
  aspect-ratio: 1;
  background-color: var(--light-letter-box-bg);
  border: 1px solid rgb(169, 195, 218);
  display: grid;
  place-content: center;
  transition: all 500ms;
}

.letterbox-stats {
  background-color: var(--stats-color);
}

.letterbox-animate {
  animation-name: spin;
  animation-duration: 0.8s;
  animation-timing-function: ease-in-out;
}

@keyframes spin {
  0% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(0);
  }
  100% {
    transform: scaleY(1);
  }
}

.letterbox:not(:empty) {
  background-color: var(--light-letter-box-filled-bg);
}

.letterbox-dark {
  background-color: var(--dark-letter-box-bg);
}

.letterbox_matching {
  background-color: rgb(115, 232, 126) !important;
}

.letterbox_wrongpos {
  background-color: rgb(255, 211, 129) !important;
}

.letterbox_incorrect {
  background-color: rgb(167, 167, 167) !important;
}

.dark-letters {
  color: var(--dark);
}

.light-letters {
  color: var(--light);
}

.onscreen-keyboard {
  display: none;
  flex-direction: column;
  gap: 2px;
}

.keyboard_row {
  display: flex;
  justify-content: center;
  gap: 2px;
  width: fit-content;
  margin: 0 auto;
}

.letter {
  position: relative;
  margin: 1px;
  width: clamp(30px, 4vw, 50px);
  aspect-ratio: 1;
  border: 1px solid;
  border-color: var(--dark);
  display: grid;
  place-content: center;
  cursor: pointer;
  color: var(--dark);
  background-color: transparent;
}

.letter::after {
  margin: auto;
  height: 100%;
  aspect-ratio: 1;

  transform: scale(0);

  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  transition: all 300ms;
  background: var(--dark);
}

.letter:hover {
  color: var(--light);
}

.letter:hover::after {
  transform: scale(1);
}

.letter-dark {
  border-color: var(--light);
  color: var(--light);
}

.letter-dark:hover {
  color: var(--dark);
}

.letter-dark::after {
  background: var(--light);
}

.letter-dark-matching {
  color: var(--dark);
}

.toggles {
  display: flex;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  width: 100px;
  margin: 1rem;
}

label {
  position: absolute;
  width: 100%;
  height: 50px;
  background-color: transparent;
  border-radius: 25px;
  cursor: pointer;
  color: var(--dark);
}

input {
  position: absolute;
  display: none;
}

.slider {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 25px;
  transition: 0.3s;
  display: grid;
  align-items: center;
  padding: 0 12px;
  z-index: -1;
}

#dark:not(:checked) ~ #dark-slider {
  color: var(--light);
}

input:disabled ~ .slider {
  opacity: 0.3;
}

input:not(:checked) ~ .slider {
  justify-content: end;
}

input:checked ~ .slider {
  background-color: var(--light);
}

#stat-slider,
#hard-slider {
  background-color: var(--light);
}

/* link to beautiful dark theme slider */
/* https://codepen.io/alvarotrigo/pen/zYPydpB */
.slider::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 8px;
  width: 37px;
  height: 37px;
  border-radius: 50%;
  box-shadow: inset 10px 0px 0px 0px var(--light);
  background-color: var(--dark);
  transition: 0.3s;
}

#stat-slider::before,
#hard-slider::before {
  background-color: rgb(15 141 15);
  box-shadow: none;
}

#stats:checked ~ #stat-slider::before,
#hard:checked ~ #hard-slider::before {
  background-color: rgb(217 44 44);
}

input:checked ~ .slider::before {
  transform: translateX(47px);
  box-shadow: none;
}

#hint-button {
  display: none;
}

.hint-container {
  text-align: center;
  display: none;
}

.visible {
  display: block !important;
}

.modal {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: auto;
  background-color: #28292c;
  color: #d8dbe0;
  padding: 1rem;
  margin-top: 0;
  display: none;
}

.modal > p {
  margin-top: 10px;
}

.modal-error > h3 {
  color: rgb(255, 113, 113);
}

.modal-success > h3 {
  color: rgb(127, 226, 127);
}

.modal-warning > h3 {
  color: rgb(255, 208, 119);
}
.modal-dark {
  background-color: #d8dbe0;
  color: #28292c;
}
.modal-dark.modal-success > h3 {
  color: rgb(15 141 15);
}

.modal-dark.modal-error > h3 {
  color: rgb(217 44 44);
}
.modal-dark.modal-warning > h3 {
  color: rgb(255, 208, 119);
}

#statistics {
  text-align: center;
}

#statistics p {
  font-size: 1rem;
  margin-top: 10px;
}

.stat-number {
  font-size: 2rem;
}

#num-wins {
  color: rgb(15 141 15);
}

#num-losses {
  color: rgb(217 44 44);
}

#statistics table {
  margin-top: 1rem;
  text-align: center;
}

#statistics table thead {
  border-bottom: 1px solid #28292c;
}

#statistics table thead th {
  padding: 5px;
}

#statistics table tbody tr td {
  padding: 3px 0;
}

.timer-container p {
  text-align: center;
}
