@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap");

:root {
  --bg-color: white;
  --typewriterSpeed: 3s;
  --typewriterCharacters: 7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Roboto Mono", monospace;
}

body {
  background-color: white;
}

.name {
  font-family: monospace;
  min-height: 25vh;
  display: grid;
  place-content: center;
  text-align: center;
}

.name h1 {
  font-size: 34px;
}

.name span {
  width: max-content;
  position: relative;
  overflow: hidden;
}

.name span::before,
.name span::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.name span::before {
  background: var(--bg-color);
  animation: typewriter var(--typewriterSpeed)
    steps(var(--typewriterCharacters)) 0.5s forwards;
}

.name span::after {
  width: 0.125em;
  background: black;
  animation: typewriter var(--typewriterSpeed)
      steps(var(--typewriterCharacters)) 0.5s forwards,
    blink 450ms steps(var(--typewriterCharacters)) infinite;
}

@keyframes typewriter {
  to {
    left: 100%;
  }
}

@keyframes blink {
  to {
    background: transparent;
  }
}

.cursor {
  border-left: 0.11em solid black;
}

.done {
  color: black;
}

.wrong {
  color: white;
  background-color: red;
}

.typing {
  top: 40vh;
  left: 25%;
  position: absolute;
  border: 0.1em solid black;
  border-radius: 13px;
  height: 215px;
  width: 50%;
}

#typing {
  text-align: justify;
  margin: 20px;
  color: grey;
  position: absolute;
}

#typing span {
  word-spacing: 2px;
  font-size: 22px;
}

#WPM {
  top: 25vh;
  text-align: center;
  font-size: 30px;
}

#fail {
  text-align: center;
  font-size: 22px;
}

.restart {
  display: flex;
  align-items: center;
  justify-content: center;
}

#restart {
  top: 70vh;
  position: absolute;
  border: none;
  color: gray;
  padding: 15px 30px;
  cursor: pointer;
  font-size: 20px;
  border-radius: 20px;
  margin-top: 40px;
}

#restart:hover {
  color: black;
}

#restart:active {
  background-color: rgb(230, 227, 227);
}

footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  margin-bottom: 10px;
  text-align: center;
}

.credits span {
  font-size: 11px;
  color: grey;
}

.credits img {
  height: 20px;
  filter: invert(0.5);
}
