*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

html {
  box-sizing: border-box;
  font-size: 62.5%;
  line-height: 1.5;
}

body {
  font-family: "Amatic SC", cursive;
  background-image: linear-gradient(to right bottom, #393a59, #1e1e2f);
  background-size: cover;
  background-position: center;
  height: 100vh;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, auto);
  grid-template-rows: repeat(3, auto);
}

.game {
  background-color: #ededed;
  grid-column: 2 / span 1;
  grid-row: 2 / span 1;
  box-shadow: 0px 1rem 5rem;
  border-radius: 5px;
  width: 70vw;
  height: 45vw;
  align-self: center;
  justify-self: center;
}

#board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 3fr 0.5fr 0.8fr 2fr;
  justify-items: center;
  z-index: 10;
  font-size: 2.5rem;
  overflow: hidden;
}

#lifecount {
  grid-row: 1 / span 1;
  grid-column: 1 / span 1;
  justify-self: start;

  margin: 0.8rem;
}

#round {
  grid-row: 1 / span 1;
  grid-column: 2 / span 1;

  margin: 0.8rem;
}

#exit {
  grid-row: 1 / span 1;
  grid-column: 3 / span 1;
  justify-self: end;

  width: 2rem;
  height: 2rem;
  margin: 1rem;
  border: 2px solid #ccc;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.5s;
}

#exit::before {
  content: "";
  width: 1rem;
  height: 2px;
  background-color: #ccc;
  display: inline-block;
  transform: rotate(45deg);
  position: absolute;
  transition: all 0.5s;
}

#exit::after {
  content: "";
  width: 1rem;
  height: 2px;
  background-color: #ccc;
  display: inline-block;
  transform: rotate(-45deg);
  position: absolute;
  transition: all 0.5s;
}

#exit:hover::after {
  background-color: #393a59;
}
#exit:hover::before {
  background-color: #ef7064;
}
#exit:hover {
  transform: scale(1.2);
  border: none;
  box-shadow: -1.5px -1.5px 5px #ef7064, 1.5px 1.5px 5px #393a59;
}

#word {
  grid-row: 2 / span 1;
  grid-column: 1 / -1;
  align-self: end;

  font-size: 15rem;
}

#usedLetters {
  grid-row: 3 / span 1;
  grid-column: 2 / span 1;

  color: #ccc;
  font-size: 2.3rem;
}

/* INPUT DECORATION */
.form {
  grid-row: 4 / span 1;
  grid-column: 2 / span 1;
}

#input {
  border-radius: 3rem;
  padding: 0.8rem;
  outline: none;
  font-size: 1.2rem;
  transition: all 0.5s;
  border: 0.15rem solid #ccc;
}

#input:focus {
  transform: scale(1.1);
  border: none;
  box-shadow: -0.3rem -0.3rem 1.4rem #ef7064, 0.3rem 0.3rem 1.4rem #393a59;
}

#hint {
  grid-row: 5 / span 1;
  grid-column: 1 / -1;
  align-self: start;

  font-size: 2.2rem;
  background: #fff;
  padding: 1rem;
  width: 85%;
  height: 75%;
  text-align: justify;
  overflow: scroll;
  border-radius: 0.5rem;
}

/* CALL TO ACTION TEXT */
.start-game {
  cursor: pointer;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 5rem;
  color: #ededed;
  opacity: 0;
  text-shadow: 5px 5px 5px black;
  animation: flickering 5s 4.5s infinite;
}

/* SVG SETTINGS */
#container {
  cursor: pointer;
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
  width: 35vw;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#noose {
  transform-origin: 80% 20%;
  opacity: 0;
  animation: moveDown 0.15s 3s forwards, swinging 12s 4s ease-in-out infinite;
}

#gallows {
  animation: liftUp 2.7s ease-out forwards;
}

#crosses {
  animation: liftUp 3s ease-out forwards;
}

#background {
  animation: appear 3s ease forwards;
}

/* ANIMATION */
@keyframes appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes liftUp {
  from {
    transform: translateY(120rem);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes moveDown {
  from {
    transform: translateY(-30rem);
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes swinging {
  0% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(30deg);
  }
  20% {
    transform: rotate(-30deg);
  }
  30% {
    transform: rotate(30deg);
  }
  40% {
    transform: rotate(-30deg);
  }
  50% {
    transform: rotate(30deg);
  }
  60% {
    transform: rotate(-30deg);
  }
  70% {
    transform: rotate(30deg);
  }
  80% {
    transform: rotate(-30deg);
  }
  80% {
    transform: rotate(-30deg);
  }
  90% {
    transform: rotate(10deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes flickering {
  0%,
  12%,
  18.999%,
  23%,
  31.999%,
  37%,
  44.999%,
  46%,
  49.999%,
  51%,
  58.999%,
  61%,
  68.999%,
  71%,
  85.999%,
  96%,
  100% {
    opacity: 0.8;
  }
  19%,
  22.99%,
  32%,
  36.999%,
  45%,
  45.999%,
  50%,
  50.99%,
  59%,
  60.999%,
  69%,
  70.999%,
  86%,
  95.999% {
    opacity: 0.4;
  }
}

@media screen and (max-width: 1024px) {
  .game {
    width: 95vw;
    height: 95vh;
  }
}

@media screen and (max-width: 800px) {
  #word {
    font-size: 12rem;
  }
  #board {
    grid-template-rows: 1fr 2fr 0.5fr 0.8fr 2fr;
  }
}

@media screen and (max-width: 550px) {
  #word {
    font-size: 8rem;
  }
  #board {
    font-size: 2rem;
    grid-template-rows: 1fr 1fr 0.5fr 0.8fr 2fr;
  }
  #container {
    width: 70vw;
  }
  .start-game {
    font-size: 4rem;
  }
  #hint {
    height: 210px;
  }
}

@media screen and (max-width: 360px) {
  #word {
    font-size: 7rem;
  }
  #board {
    font-size: 1.5rem;
  }
  #hint {
    height: 170px;
  }
}
