.game-root { min-height: 34rem; }

.typing-num,
.typing-tries {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.typing-num {
  min-width: 7.5ch;
  font-size: 1rem;
}

.typing-tries { min-width: 2ch; }

.typing-stage {
  display: flex;
  justify-content: center;
}

.typing-card {
  width: min(100%, 40rem);
  padding: 1.2rem 1.35rem 1.15rem;
  border: 2px solid #b8923a;
  border-radius: 16px;
  background: #fffdf7;
  color: #1d2433;
}

.typing-meter {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  justify-items: center;
  margin: 0 0 0.85rem;
}

.typing-meter b {
  display: block;
  min-width: 4ch;
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: center;
  color: #1d2433;
}

.typing-meter span {
  display: block;
  margin-top: 0.28rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: #6d6456;
}

.typing-passage-wrap {
  position: relative;
  border-radius: 8px;
}

.typing-passage-wrap:focus-within {
  box-shadow: inset 0 0 0 2px #b8923a;
}

.typing-passage {
  height: 13.5rem;
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2.4vw, 1.45rem);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.typing-ch { color: #8a8175; }

.typing-ch.is-ok { color: #1d2433; }

.typing-ch.is-bad {
  color: #a3302f;
  background: #f8e6e3;
  border-radius: 2px;
}

.typing-ch.is-next {
  color: #1d2433;
  box-shadow: inset 2px 0 0 #b8923a;
}

.typing-caret {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 1px;
  background: #b8923a;
  vertical-align: text-bottom;
}

.typing-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  line-height: 1.55;
}

.typing-input:focus { outline: none; }

.typing-input::selection { background: transparent; }

.typing-source {
  height: 1.5rem;
  margin: 0.55rem 0 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  line-height: 1.5rem;
  color: #6d6456;
}

.typing-note {
  height: 4.2em;
  margin: 0.35rem 0 0.85rem;
  line-height: 1.4;
  font-size: 0.95rem;
  color: #6d6456;
}

.typing-note.is-good { color: #8a6230; }

.typing-next {
  width: 100%;
  min-height: 3.25rem;
  font-size: 1.15rem;
  touch-action: manipulation;
}

.typing-next:active:not(:disabled) { transform: none; }

.typing-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 720px) {
  .typing-passage { height: 16.5rem; }
}

@media (max-width: 480px) {
  .typing-passage { height: 22rem; }
}
