@font-face {
  font-family: "WordsFont";
  src: url("../font/poetsen_one/PoetsenOne-Regular.ttf");
}

/* ----------------------------------------------------------------- GENERICS */

:root {
  --roundness: 0.25rem;
  --font: sans serif;
  --bg-color: #1a2122;
  --text-color: #e4dbcd;
  --accent-color: #ffbf00;
  --sub-color: #5e5445;
  --error-color: #df5454;
  --error-extra-color: #714242;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--sub-color) transparent;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-color);
  font-family: var(--font);
  color: var(--text-color);
}

html {
  overflow-y: scroll;
}

::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--sub-color);
  transition: 0.25s;
  border-radius: 2px !important;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.hidden {
  display: none !important;
}

.no-cursor {
  cursor: none;
}

.blurred {
  filter: blur(3px);
}

/* ------------------------------------------------------------------- LAYOUT */

#page {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  max-width: 800px;
  min-width: 500px;
  min-height: 100vh;
  margin: 0 auto;
}

#bottom-panels {
  position: fixed;
  bottom: 0;
  width: 100%;
  min-width: 500px;
  height: 5rem;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.4s;
}

#bottom-panels.focus {
  opacity: 0;
}

/* --------------------------------------------------------------- ANIMATIONS */

@keyframes close-bottom-panel {
  0% {
    margin-top: 0;
  }
  100% {
    margin-top: 5rem;
  }
}

@keyframes open-bottom-panel {
  0% {
    margin-top: 5rem;
  }
  100% {
    margin-top: 0;
  }
}

/* ------------------------------------------------------------ BOTTOM PANELS */

.bottom-panel {
  position: absolute;
  width: 100%;
  height: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--sub-color);
}

.bottom-panel.closing {
  animation: close-bottom-panel 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.bottom-panel.opening {
  animation: open-bottom-panel 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.bottom-panel.opened {
  top: 0;
}

.bottom-panel.closed {
  display: none;
  top: 5em;
}

.bottom-panel .items-wrapper {
  display: flex;
  flex-direction: row;
  gap: 4px;
}

.bottom-panel .item {
  line-height: 1.5rem;
}

.bottom-panel .item:not(:last-child) {
  margin-right: 0.5em;
}

key {
  display: inline-block;
  margin-right: 0.3rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.8rem;
  line-height: 0.8rem;
  color: var(--bg-color);
  background-color: var(--sub-color);
  border-radius: 2px;
  transition: 0.3s;
}

button:focus key,
button:hover key {
  background-color: var(--text-color);
}

#test-config .group {
  display: flex;
  flex-direction: row;
}

#test-config .group::before {
  content: "[";
  transition: color 0.25s;
}

#test-config .group::after {
  content: "]";
  transition: color 0.25s;
}

#test-config .group:hover::before,
#test-config .group:hover::after {
  color: var(--accent-color);
}

#result-buttons .text-button:not(:last-child) {
  margin-right: 3rem;
}

.bottom-panel .selector {
  display: flex;
  flex-direction: row;
}

.selector-input {
  width: 3rem;
  color: var(--sub-color);
  background-color: transparent;
  border-top: none;
  border-right: none;
  border-bottom: 1px solid var(--sub-color);
  border-left: none;
  outline: none;
}

.selector-input::selection,
.selector-input:focus {
  color: var(--text-color);
  border-bottom-color: var(--accent-color);
}

/* ------------------------------------------------------------------ RESULTS */

#result {
  display: flex;
  flex-direction: column;
  color: var(--text-color);
}

#result .group {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}

#result .value {
  color: var(--accent-color);
}

#result .main .value {
  font-size: 5rem;
}

/* -------------------------------------------------------------------- CARET */

#caret {
  position: absolute;
  top: 2.5rem;
  height: 2rem;
  width: 0.2rem;
  background: var(--accent-color);
  border-radius: var(--roundness);
  transform-origin: top left;
  transition: left 0.125s;
}

#caret.flashing {
  animation-name: caretFlash;
  animation-iteration-count: infinite;
  animation-duration: 1s;
}

@keyframes caretFlash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

#wordsInput {
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  display: block;
}

#wordsWrapper {
  position: relative;
  height: 6.9rem;
  padding: 0 0.5rem;
  overflow: hidden;
}

#words {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  align-content: flex-start;
  font-family: WordsFont, serif;
  user-select: none;
  transition: margin-top 0.3s, filter 0.3s;
}

#words .filler {
  width: 100%;
  height: 2.3rem;
}

#words .word {
  display: flex;
  margin: 0 1rem 0 0;
  line-height: 2.3rem;
  color: var(--sub-color);
  font-size: 1.5rem;
}

.word.extra-characters:after {
  content: "*";
  width: 0;
  margin-top: 0rem;
  font-size: 1rem;
  color: var(--error-color);
}

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

.word letter.incorrect {
  color: var(--error-color);
  position:relative;
}

/* ------------------------------------------------------------------ BUTTONS */

.bottom-panel button {
  color: var(--sub-color);
  background-color: var(--bg-color);
  border: none;
  cursor: pointer;
  outline: none;
  transition: 0.3s;
}

.bottom-panel button:hover,
.bottom-panel button:focus,
.bottom-panel button.active {
  color: var(--accent-color);
}

#test-config button:hover,
#test-config button:focus {
  color: var(--text-color);
}

.button {
  color: var(--text-color);
  cursor: pointer;
  transition: 0.25s;
  padding: 0.4rem;
  border-radius: var(--roundness);
  background: rgba(0, 0, 0, 0.1);
  text-align: center;
  -webkit-user-select: none;
  align-content: center;
  height: min-content;
  height: -moz-min-content;
  line-height: 1rem;
}

.button.active {
  background: var(--accent-color);
  color: var(--bg-color);
}

.button:hover,
.button:focus {
  color: var(--bg-color);
  background: var(--accent-color);
  outline: none;
}

.text-button {
  margin-right: 0.25rem;
  color: var(--sub-color);
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: 0.25s;
}

.text-button:hover,
.text-button:focus,
.text-button.active {
  color: var(--accent-color);
}

.text-button:hover key {
  background-color: var(--accent-color);
}
