h1 {
  margin-top: 32px;
  margin-bottom: 8px;
  font-size: 2rem;
}

.lede {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 28px;
  max-width: 60ch;
}

.tool {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.tool-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tool-bar label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.tool-bar select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

.tool-bar__stats {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.live-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.live-stat__label {
  font-size: 0.75rem;
  color: var(--muted);
}

.live-stat__value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.btn:hover { border-color: var(--muted); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover { opacity: 0.92; }

.typing-area {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: text;
}

.words {
  height: 8.4em;
  overflow: hidden;
  padding: 20px 24px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 1.3rem;
  line-height: 2.1em;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.word {
  display: inline-block;
  margin-right: 0.55em;
}

.word--current {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}

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

.word--incorrect {
  color: #c0392b;
  text-decoration: underline wavy #c0392b;
}

.char--correct { color: var(--ink); }
.char--incorrect { color: #c0392b; text-decoration: underline; }
.char--extra { color: #c0392b; opacity: 0.7; }

.focus-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 248, 250, 0.9);
  border-radius: 8px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.focus-overlay[hidden] {
  display: none;
}

.hidden-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.results {
  text-align: center;
}

.results h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
}

.results .stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.results .stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 10px;
}

.results .stat--highlight {
  background: var(--accent);
  border-color: var(--accent);
}

.results .stat--highlight .stat__label,
.results .stat--highlight .stat__value {
  color: var(--accent-ink);
}

.results .stat__label {
  font-size: 0.8rem;
  color: var(--muted);
}

.results .stat__value {
  font-size: 1.6rem;
  font-weight: 700;
}

.faq { margin-top: 48px; max-width: 70ch; }

.faq h2 { font-size: 1.3rem; margin-top: 32px; }

details {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

details summary {
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 640px) {
  .tool-bar__stats { margin-left: 0; }
  .words { font-size: 1.05rem; height: 10.5em; }
  .results .stats { grid-template-columns: repeat(2, 1fr); }
}
