:root {
  --grid-gap: 20px;
  --inner-margin: 20px;
  --typing-bar-font-size: 20px;
  --border-radius: 10px;
  --hue: 218;
  --accent-text: #fff;

  --bg: hsl(240, 11%, 7%);
  --fg: hsl(230, 9%, 13%);
  --btn: hsl(230, 5%, 20%);
  --text: hsl(0, 0%, 47%);
  --title-color: hsl(0, 0%, 100%);
  --text-high-contrast: hsl(0, 0%, 100%);
  --border: 1px solid hwb(0 18% 82%);
  --border-selected: 1px solid hsl(var(--hue), 80%, 43%);
  --accent: hsl(var(--hue), 92%, 41%);
  --highlight: hsl(0, 0%, 100%);
  --incorrect: hsl(0, 64%, 62%);
  --option-selected: var(--accent-text);
  --radial-gradient: radial-gradient(
    circle at 50% 50%,
    hsla(227, 10%, 17%, 0) 64%,
    hsla(227, 10%, 17%, 0) 64%,
    hsl(230, 9%, 13%) 92%
  );
  --linear-gradient: linear-gradient(
    0deg,
    rgba(30, 31, 36, 1) 2%,
    rgba(30, 31, 36, 0) 25%
  );
  --btn-border: #39393e;
  --btn-border-hover: hsl(var(--hue), 80%, 43%);
  --accent-btn-text: var(--accent-text);
  --blur: blur(1px);
  --dots-bg: radial-gradient(#3d3d3d 0.7px, var(--bg) 0.7px);

  .lightMode {
    --bg: hsl(240, 0%, 95.5%);
    --fg: rgba(255, 255, 255);
    --btn: hsl(225, 0%, 96.5%);
    --title-color: hsl(0, 0%, 10%);
    --text: hsl(0, 0%, 48%);
    --text-high-contrast: hsl(0, 0%, 50.5%);
    --border: 1px solid hsl(0, 0%, 94%);
    --border-selected: 1px solid hsl(var(--hue), 100%, 66%);
    --accent: hsl(var(--hue), 100%, 58%);
    --highlight: hsl(0, 0%, 0%);
    --incorrect: hsl(0, 64%, 62%);
    --option-selected: var(--accent-text);
    --radial-gradient: radial-gradient(
      circle at 52% 50%,
      hsla(230, 8.94%, 13.18%, 0) 63.87%,
      rgba(30, 31, 36, 0) 64%,
      hsl(0, 0%, 100%) 85%
    );
    --linear-gradient: linear-gradient(
      0deg,
      rgb(255, 255, 255) 2%,
      rgba(255, 255, 255, 0) 25%
    );
    --btn-border: hsl(0, 0%, 94%);
    --btn-border-hover: hsl(var(--hue), 80%, 43%);
    --accent-btn-text: var(--accent-text);
    --blur: blur(1px);
    --dots-bg: radial-gradient(#9d9d9d 0.7px, var(--bg) 0.7px);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: Roboto Mono;
  line-height: 1.6rem;
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

footer {
  margin-top: 40px;
}

.footer-wrapper {
  color: var(--text);
}

.credits {
  padding-left: 15px;
  padding-right: 15px;
  border-radius: 11px;
  text-align: center;
}

.credits > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-family: Roboto Mono;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 1px;
}

.logo {
  max-width: 30px;
  margin-bottom: 10px;
}

h1.title {
  margin: 0;
}

.title {
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 40px;
  line-height: normal;
  color: var(--title-color);
  margin: 0;
}

.subtitle {
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 500;
  font-style: normal;
  color: var(--text);
  font-size: 17px;
}

.bai-jamjuree-regular {
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.bai-jamjuree-medium {
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 500;
  font-style: normal;
}

#intro {
  text-align: center;
  text-wrap: balance;
}

#main {
  margin: 0 0.4rem;
  width: 95%;
  max-width: 45rem;
  margin-top: 30px;
}

#intro {
  background-color: var(--fg);
  padding: 20px 20px;
  border-radius: var(--border-radius);
  border: var(--border);
}

.input-section {
  background-color: var(--fg);
  padding: 20px 0;
  border-radius: var(--border-radius);
  border: var(--border);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
}

.option-bar {
  display: flex;
  gap: 8px;
}

.flex-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.color-picker,
.theme-toggle,
.option-bar > span {
  color: var(--text-high-contrast);
  background-color: var(--fg);
  border-radius: var(--border-radius);
  border: var(--border);
  padding: 3px 10px;
  transition: background-color 0.15s ease-out,
              border-color 0.15s ease-out,
              color 0.15s ease-out !important;
}

#dashboard > div.toolbar > div.option-bar > span.selected {
  transition: background-color 0.15s ease-out,
              border-color 0.15s ease-out,
              color 0.15s ease-out !important;
}

.emojis {
  font-size: 15px;
  cursor: pointer;
}

@media (hover: hover) {
  div.option-bar > span:hover,
  .theme-toggle:hover {
    cursor: pointer;
    background-color: var(--accent);
    color: #fff;
  }
}

#dashboard > div.toolbar > div.option-bar > span.selected {
  background-color: var(--accent);
  color: var(--option-selected);
  border: var(--border-selected);
}

.top-row {
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  overflow: scroll;
}

.middle-row {
  margin: 20px 0px;
}

.bottom-row {
  padding: 0 20px;
  display: flex;
  gap: 20px;
}

#input-field {
  width: 12px;
  border: none;
  font: inherit;
  padding: 0;
  font-size: var(--typing-bar-font-size);
  background-color: var(--fg);
  color: hsl(var(--hue), 100%, 64%);
  text-align: center;
  caret-color: var(--highlight);
  padding-bottom: 5px;
  outline: none;
}

.btn {
  width: 50%;
  font: inherit;
  padding: 0.2rem 1rem;
  border: 1px solid;
  border-color: var(--btn-border);
  border-radius: 0.2rem;
  font-size: 1rem;
  color: var(--text-high-contrast);
  cursor: pointer;
  background-color: var(--btn);
  transition: all 200ms ease-in-out;
}

@media (hover: hover) {
  .btn:hover {
    background-color: var(--accent);
    border-color: var(--btn-border-hover);
    color: var(--option-selected);
  }

  .startApp:hover {
    background-color: hsl(var(--hue), 100%, 63%);
  }
}

.startApp {
  transition: background-color 0.15s ease-out,
              color 0.15s ease-out !important;
  margin-top: 10px;
  width: 45%;
  border: none;
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 0.2rem;
  font-size: 1rem;
  color: var(--accent-btn-text);
  cursor: pointer;
  background-color: var(--accent);
}

.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
}

#dashboard {
  display: none;
}

.skeleton {
  background-color: var(--text);
  color: var(--text);
}

.display-text {
  transition: color 100ms ease-in-out;
  color: var(--text);
  font-size: 16px;
  height: auto;
  max-height: 115px;
}

.display-text > span {
  margin-right: 7px;
  transition: color 200ms ease-out;
  font-size: 16px;
}

.display-text > span.incorrect {
  color: rgb(220, 96, 96);
}

.highlight {
  color: var(--highlight) !important;
  text-decoration: none;
}

.slider-highlight {
  color: var(--highlight);
  text-decoration: none;
}

.correct {
  color: rgb(119, 119, 119);
}

.incorrect {
  color: rgb(220, 96, 96);
}

#typed-words > span.incorrect {
  font-size: var(--typing-bar-font-size);
  color: rgb(220, 96, 96);
  margin-left: 8px;
}

.mistake {
  color: rgb(220, 96, 96) !important;
  text-decoration: line-through !important;
}

#stats {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  grid-column-gap: var(--grid-gap);
  grid-row-gap: var(--grid-gap);
  margin-top: 20px;
}

.div1 {
  grid-area: 1 / 1 / 2 / 2;
}
.div2 {
  grid-area: 1 / 2 / 2 / 3;
}
.div3 {
  grid-area: 1 / 3 / 2 / 4;
}
.div4 {
  grid-area: 2 / 1 / 3 / 2;
}
.div5 {
  grid-area: 2 / 2 / 3 / 3;
}
.div6 {
  grid-area: 2 / 3 / 3 / 4;
}

.stat {
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  background-color: var(--fg);
  padding: 10px 20px;
  border-radius: var(--border-radius);
  text-align: left;
  border: var(--border);
}

.spark {
  color: red !important;
}

.glow {
  color: white !important;
}

@media (max-width: 767px) {
}

@media (max-width: 472px) {
  #main {
    width: 95%;
  }

  #stats {
    display: none;
    font-size: 14px;
    margin-top: 20px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    grid-column-gap: var(--grid-gap);
    grid-row-gap: var(--grid-gap);
  }

  .div1 {
    grid-area: 1 / 1 / 2 / 2;
  }
  .div2 {
    grid-area: 1 / 2 / 2 / 3;
  }
  .div3 {
    grid-area: 2 / 1 / 3 / 2;
  }
  .div4 {
    grid-area: 2 / 2 / 3 / 3;
  }
  .div5 {
    grid-area: 3 / 1 / 4 / 2;
  }
  .div6 {
    grid-area: 3 / 2 / 4 / 3;
  }
}

.form-container {
  width: calc(100% - --inner-margin);
}

.form-wrapper::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  pointer-events: none;
  background-image: var(--radial-gradient);
  width: 100%;
  height: 30px;
}

.form-wrapper {
  display: flex;
}

#typed-words {
  height: 100%;
  width: fit-content;
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  white-space: nowrap;
}

.input-bar-wrapper {
  float: right;
  text-align: right;
  display: flex;
  white-space: nowrap;
  border: 1px solid rgb(154, 111, 239);
}

#input-field {
  display: inline-block;
  padding-left: 8px;
  white-space: nowrap;
  width: fit-content;
  margin: 0;
}

.column-1 {
  display: flex;
  width: 50%;
  overflow: hidden;
  align-items: center;
  justify-content: flex-end;
}

.column-2 {
  color: rgb(119, 119, 119);
  text-decoration: none;
  border: 0px solid rgb(106, 170, 255);
  width: 50%;
  text-wrap: nowrap;
  overflow: hidden;
  height: 30px;
  font-size: var(--typing-bar-font-size);
}

.typpedWord {
  color: rgb(119, 119, 119);
  margin-left: 8px;
  font-size: var(--typing-bar-font-size);
}

.word-slider > span {
  margin-right: 10px;
}

.dots {
  background-color: var(--bg);
  opacity: 1;
  background-image: var(--dots-bg);
  background-size: 20px 20px;
}

.tippy-box[data-theme~="custom"] {
  background-color: var(--accent);
  color: var(--accent-text);
  border-radius: 4px;
  padding: 5px 8px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.15s ease-out,
              color 0.15s ease-out !important;
}

.tippy-box[data-theme~="custom"] .tippy-arrow {
  color: var(--accent);
  transition: color 0.15s ease-out !important;
}

.tippy-box[data-theme~="custom"] .tippy-arrow::before,
.tippy-box[data-theme~="custom"] .tippy-arrow::after {
  transition: all 0.02s ease-out !important;
}

.tippy-content {
  transition: color 0.15s ease-out !important;
  transition-duration: 0.15s !important;
}

.btn-pulse-mobile {
  background-color: var(--btn);
  animation-name: btnGlow;
  animation-duration: 1s;
  animation-iteration-count: once;
}

@keyframes btnGlow {
  0% {
    background-color: var(--btn);
  }

  50% {
    background-color: var(--accent);
    color: #fff;
  }

  100% {
    background-color: var(--btn);
  }
}

.pulse {
  background-color: var(--fg);
  animation-name: glow;
  animation-duration: 1s;
  animation-iteration-count: once;
}

@keyframes glow {
  0% {
    background-color: var(--fg);
  }

  50% {
    background-color: var(--accent);
    color: #fff;
  }

  100% {
    background-color: var(--fg);
  }
}

.color-range {
  position: relative;
  z-index: 2;
  appearance: none;
  border-radius: 0.5em;
  background-color: rgba(0, 0, 0, 0);
  height: 0.5em;
  width: 90%;
  display: block;
  outline: none;
  margin: 6px auto;
  transition: color 0.05s linear;
  background: linear-gradient(
    to right,
    red,
    yellow,
    lime,
    cyan,
    blue,
    magenta,
    red
  );
}

.color-range:focus {
  outline: none;
}

.color-range:active,
.color-range:hover:active {
  cursor: grabbing;
  cursor: -webkit-grabbing;
}

.color-range::-moz-range-track {
  appearance: none;
  opacity: 0;
  outline: none !important;
}

.color-range::-ms-track {
  outline: none !important;
  appearance: none;
  opacity: 0;
}

.color-range::-webkit-slider-thumb {
  height: 2em;
  width: 2em;
  border-radius: 2em;
  appearance: none;
  background: var(--fg);
  cursor: pointer;
  cursor: move;
  cursor: grab;
  cursor: -webkit-grab;
  border: 0.4em solid currentColor;
  transition: border 0.1s ease-in-out, box-shadow 0.2s ease-in-out,
    transform 0.1s ease-in-out;
  box-shadow: 0 0.4em 1em rgba(0, 0, 0, 0.15);
}

.color-range::-webkit-slider-thumb:active,
.color-range::-webkit-slider-thumb:hover:active {
  cursor: grabbing;
  cursor: -webkit-grabbing;
  transform: scale(0.975);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
  border: 1.5em solid currentColor;
}

.color-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}
