@font-face {
  font-family: "FS Tahoma 8px";
  src: url("fs-tahoma-8px.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #181818;
  --foreground: #ffffff;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  background: #2e2e2e;
  color: var(--foreground);
}

main {
  width: min(calc(100% - 2rem), 80rem);
  padding: 1.5rem;
}

.message {
  position: relative;
  top: -0.2rem;
  min-height: 1em;
  margin: 0 0 2rem;
  padding: 0.5rem 1rem;
  font-family: "FS Tahoma 8px", monospace;
  font-size: clamp(1.5rem, 6vw, 5rem);
  line-height: 1;
  text-align: center;
}

.alphabet {
  display: grid;
  grid-template-columns: repeat(13, 0.66em);
  column-gap: 0;
  row-gap: clamp(0.45rem, 1.5vw, 1.35rem);
  justify-content: center;
  margin: 0;
  position: relative;
  top: -0.6rem;
  font-family: "FS Tahoma 8px", monospace;
  font-size: clamp(2.5rem, 10vw, 9rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0;
  text-align: center;
}

.message-inset,
.alphabet-inset {
  position: relative;
  top: 0.6rem;
  left: 50%;
  width: min(calc(100% + 5rem), calc(100vw - 1rem));
  transform: translateX(calc(-50% - 0.25rem));
  background: var(--background);
  box-shadow: inset 6px 6px 0 #0f0f0f, inset -6px -6px 0 #4b4b4b;
}

.message-inset {
  top: 0;
}

.alphabet-inset {
  padding: 1.5rem 1rem;
}

.color-list {
  margin: 0;
  padding: 0.75rem 1rem;
  color: var(--foreground);
  font-family: "FS Tahoma 8px", monospace;
  font-size: 1.2rem;
  line-height: 1.2;
  text-align: left;
}

.color-list-inset {
  position: relative;
  left: calc((100% - min(calc(100% + 5rem), calc(100vw - 1rem))) / 2 - 0.25rem);
  width: max-content;
  max-width: calc(100vw - 1rem);
  margin-top: 1rem;
  background: var(--background);
  box-shadow: inset 6px 6px 0 #0f0f0f, inset -6px -6px 0 #4b4b4b;
}

.color-list-inset::before,
.color-list-inset::after {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #2e2e2e;
  content: "";
  pointer-events: none;
}

.color-list-inset::before {
  right: 0;
  top: 0;
}

.color-list-inset::after {
  bottom: 0;
  left: 0;
}

.message-inset::before,
.message-inset::after,
.alphabet-inset::before,
.alphabet-inset::after {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #2e2e2e;
  content: "";
  pointer-events: none;
}

.message-inset::before,
.alphabet-inset::before {
  right: 0;
  top: 0;
}

.message-inset::after,
.alphabet-inset::after {
  bottom: 0;
  left: 0;
}

.letter {
  position: relative;
  color: transparent;
  text-align: center;
}

.letter.visible {
  color: var(--foreground);
}

.glyph {
  display: inline-block;
  pointer-events: none;
}

.hitbox {
  display: block;
  position: relative;
  width: 0.66em;
  height: 0.6em;
  line-height: 0.6em;
  margin-left: auto;
  margin-right: auto;
}

.hitbox:hover .glyph {
  position: relative;
  top: -0.06em;
}

.alphabet:not(.ready) .hitbox {
  pointer-events: none;
}

.message .caret {
  position: relative;
  top: auto;
  left: auto;
  display: inline-block;
  margin-left: 0.06em;
  vertical-align: -0.08em;
  transform: none;
}

.letter > .caret {
  width: 0.06em;
  height: 0.66em;
  margin-left: 0.25em;
  top: calc(50% + 0.03em);
}

.letter > .caret.before-first {
  left: calc(50% - 0.42em);
  margin-left: 0;
}

.caret {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.08em;
  height: 0.7em;
  margin-left: 0.28em;
  transform: translateY(-50%);
  background: var(--foreground);
}

.caret.hidden {
  opacity: 0;
}

::selection {
  background: transparent;
}

::-moz-selection {
  background: transparent;
}

@media (max-width: 480px) {
  main {
    width: calc(100% - 1rem);
    padding: 0.75rem;
  }

  .alphabet {
    grid-template-columns: repeat(9, 0.66em);
    row-gap: 0.55rem;
    top: -0.2rem;
    font-size: clamp(2rem, 14vw, 4rem);
  }

  .message {
    top: -0.2rem;
    margin-bottom: 1.25rem;
    padding: 0.6rem 0.75rem;
    font-size: clamp(1.8rem, 10vw, 3rem);
  }

  .message-inset,
  .alphabet-inset {
    top: 0;
    width: calc(100% + 1rem);
  }

  .alphabet-inset {
    padding: 1rem 0.5rem;
  }

  .color-list {
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
  }

  .color-list-inset {
    left: -0.75rem;
    width: max-content;
  }
}
