:root {
  --primary-color: #233448;
  --secondary-color: #98acc0;
  --accent-color: #5884bf;
  --background-color: #edf2f8;
  --text-color: #beb4aa;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: sans-serif;
}

body {
  color: var(--text-color);
  background-color: var(--secondary-color);
}

header {
  background-color: var(--primary-color);
  height: 10vh;
}

main {
  height: 90vh;
}

.container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  color: var(--text-color);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.main-container {
  display: flex;
  flex-direction: column;
}

.title {
  text-transform: uppercase;
  padding: 1rem;
}

.utilites {
  user-select: none;
  display: flex;
  justify-content: space-between;
  margin: 3rem auto 0;
  justify-items: center;
  align-items: center;
  width: 80%;
  font-size: 2rem;
  padding: 1rem;
  color: var(--primary-color);
}

.hide {
  opacity: 0;
}

.count-word-info {
  display: flex;
  align-items: start;
}

.restart {
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  background-color: inherit;
  border: none;
  border-radius: 1rem;
  transition: 0.2s ease;
  will-change: transform;
  img {
    width: 100%;
    height: 100%;
  }
}

.restart:hover {
  transform: scale(1.1);
}

.restart:active {
  transform: scale(0.9);
}

@keyframes rotateBtn {
  0% {
    transform: scale(1.1) rotate(0deg);
  }
  100% {
    transform: scale(1.1) rotate(360deg);
  }
}

.settings-container {
  user-select: none;
  margin: 3rem 2rem 0;

  .settings {
    display: flex;

    gap: 2rem;
    transition: 0.2s ease;
  }
}

.not-choosed {
  position: relative;
  opacity: 0.4;
}

.quantity-mode {
  display: flex;
}

.reverse {
  flex-direction: row-reverse;
}

.mode-choose {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  .choose {
    position: relative;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    width: auto;
    padding: 0 1rem;
    height: 2rem;
    cursor: pointer;
    transition: 0.2s ease;
    opacity: 0.4;
  }

  input {
    display: none;
  }

  input:checked + .choose {
    opacity: 1;
  }
}

.toggle {
  position: relative;
  background-color: var(--primary-color);
  width: 4rem;
  height: 2rem;
  border-radius: 1rem;

  input {
    display: none;
  }

  .button {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    cursor: pointer;
  }

  .button::before {
    position: absolute;
    content: "";
    margin: 0.25rem;
    border-radius: 1rem;
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--accent-color);
    transition: 0.2s ease;
  }

  input:checked + .button::before {
    transform: translateX(2rem);
  }

  .mode {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    img {
      width: 18px;
      height: 18px;
    }
  }

  .mode.left {
    left: 0.6rem;
  }

  .mode.right {
    right: 0.6rem;
  }
}

.text-input-container {
  user-select: none;
  border-radius: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 9rem;
  overflow: hidden;
  gap: 1rem;
  margin: 3rem 2rem 0;

  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );

  .text-filed {
    display: flex;
    padding: 0.2rem 1rem;
    flex-wrap: wrap;
    color: var(--primary-color);
    border-radius: 1rem;

    .word {
      font-size: 1.4rem;
      display: flex;
      gap: 0.1rem;
      height: 1.4rem;
      margin: 0.6rem 0;
      scroll-margin: 20px;
    }

    .letter {
      position: relative;
    }

    .letter.correct {
      color: var(--accent-color);
    }

    .letter.incorrect {
      color: red;
      animation: incorrect 0.2s;
    }

    .current::before {
      position: absolute;
      content: "";
      top: 50%;
      left: -0.2rem;
      opacity: 0.6;
      transform: translate(0, -50%);
      height: 100%;
      background-color: var(--primary-color);
      width: 0.2rem;
      animation: slop 1s ease infinite;
      animation-delay: 1s;
      border-radius: 1rem;
    }

    .space {
      position: relative;
      width: 1rem;
      height: inherit;
      border-radius: 0.2rem;
      margin: 0.6rem 0;
      scroll-margin: 20px;
    }

    .space.incorrect {
      background-color: rgb(171, 132, 132);
      animation: incorrect 0.2s;
    }
  }
}

@keyframes slop {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0;
  }
}

@keyframes incorrect {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  50% {
    transform: translateX(0);
  }
  75% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
  }
}

.keyboard {
  margin: 3rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 10rem;
}

.row {
  display: flex;
  width: 100%;
  height: 3rem;
  align-items: end;
  justify-content: space-between;
  gap: 0.3rem;
}

.button-key {
  cursor: pointer;
  background-color: var(--primary-color);
  user-select: none;
  padding: 1.2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 0.3rem solid var(--accent-color);
  height: 3rem;
  transition: 0.1s ease-in;
  box-shadow: 5px 5px 0.1rem 0.01rem rgb(78, 78, 78) inset,
    -5px -5px 0.1rem 0.01rem black inset;
}

.button-key.space {
  width: 24rem;
}

.button-key.square {
  width: 3rem;
}

.row-3 .button-key.rect {
  width: auto;
  padding: 0 3.5rem;
}

.button-key.press {
  height: 2.8rem;
  border-bottom: 0.1rem solid var(--accent-color);
}

.row-4 {
  justify-content: center;
  align-items: end;
}

@media (max-width: 1200px) {
  .utilite {
    margin: 2rem auto 0;
    font-size: 1.5rem;
  }

  .text-input-container {
    margin: 2rem 2rem 0;
  }

  .keyboard {
    margin: 2rem 1rem 0;
    padding: 1rem;
    gap: 0.5rem;
  }

  .row {
    height: 2.5rem;
    width: 80%;
  }

  .button-key {
    font-size: 0.8rem;
    height: 2.5rem;
  }

  .button-key.space {
    width: 16rem;
  }

  .button-key.square {
    width: 2.5rem;
  }

  .row-3 .button-key.rect {
    width: auto;
    padding: 0 2.5rem;
  }

  .button-key.press {
    height: 2.3rem;
  }
}

@media (max-width: 992px) {
  .settings {
    flex-wrap: wrap;
  }

  .utilite {
    margin: 1.5rem auto 0;
    font-size: 1.3rem;
  }

  .row {
    height: 2.2rem;
  }

  .keyboard {
    gap: 0.3rem;
  }

  .button-key {
    font-size: 0.6rem;
    height: 2.2rem;
    padding: 0.4rem;
    border-bottom: 0.2rem solid var(--accent-color);
  }

  .button-key.square {
    width: 2.2rem;
  }

  .button-key.space {
    width: 16rem;
    font-size: 0.6rem;
  }

  .button-key.press {
    height: 2.1rem;
  }

  .row-3 .button-key.rect {
    width: auto;
    padding: 0 1.5rem;
  }

  .button-key.rect {
    padding: 0 0.5rem;
  }
}

@media (max-width: 768px) {
  .utilite {
    margin: 1rem auto 0;
    padding: 0.5rem;
    font-size: 1.5rem;
  }

  .text-input-container {
    margin: 1rem 2rem 0;
  }

  .keyboard {
    padding: 1rem;
  }

  .row {
    gap: 0.2rem;
    width: 100%;
  }

  .button-key.space {
    width: 10rem;
  }

  .button-key {
    font-size: 0.4rem;
    padding: 0.5rem;
  }
}
