* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f4f6f8;
  color: #17212d;
  font: 1rem / 1.5 system-ui, sans-serif;
}

main { max-width: 58rem; padding: 2rem 1rem 3rem; margin: auto; }
section, form { margin-block: 1rem; }
fieldset { border: 1px solid #596675; border-radius: .4rem; }
button, select, textarea { font: inherit; }
button { margin-block: .5rem; padding: .3rem .7rem; }
label { display: inline-block; margin: .25rem .75rem .25rem 0; }
textarea { display: block; width: 100%; margin-block: .25rem; }
:focus-visible { outline: 3px solid #1756a0; outline-offset: 2px; }

.passage {
  padding: 1rem;
  background: white;
  border: 1px solid #596675;
  border-radius: .4rem;
  font: 1.12rem / 1.8 ui-monospace, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: calc(4lh + 2rem + 2px);
  overflow: auto;
  overflow-anchor: none;
}

.passage .matched { color: #284a40; }
.typing-progress { margin-block: .35rem; }
.typing-progress label { margin: 0; font-size: .875rem; }
.typing-progress output { margin-left: .4rem; font-size: .875rem; font-variant-numeric: tabular-nums; }
.typing-progress progress {
  --fill: #258548;
  display: block;
  appearance: none;
  width: 100%;
  height: 3px;
  margin-top: .1rem;
  border: 0;
  border-radius: 2px;
  background: #dbe2e8;
  color: var(--fill);
  accent-color: var(--fill);
  overflow: hidden;
}
.typing-progress--opponent progress { --fill: #ba3030; }
.typing-progress progress::-webkit-progress-bar { background: #dbe2e8; }
.typing-progress progress::-webkit-progress-value { background: var(--fill); }
.typing-progress progress::-moz-progress-bar { background: var(--fill); }
.typing-field { position: relative; margin-block: .25rem; }
.typing-field textarea { margin: 0; }
.typing-countdown {
  position: absolute;
  inset: 0;
  place-items: center;
  padding: .5rem;
  background: #153659;
  color: #fff;
  border-radius: .25rem;
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.typing-countdown:not([hidden]) { display: grid; }
.passage .omitted { text-decoration: line-through; color: #922d21; }
.passage .mismatch { text-decoration: underline wavy; color: #922d21; }
.passage .active { background: #dceaff; outline: 1px solid #1756a0; }
.metrics { display: flex; flex-wrap: wrap; gap: 1rem; }
.metrics div { min-width: 8rem; }
.metrics dd { margin: 0; font-variant-numeric: tabular-nums; }
.error { color: #922d21; }
.leaderboard-table { overflow-x: auto; }
.leaderboard-table table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td {
  padding: .4rem .6rem;
  border-bottom: 1px solid #dbe2e8;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.pace-text {
  padding: 0.8rem;
  border: 1px solid #596675;
  border-radius: .4rem;
  font: 1.1rem / 1.8 ui-monospace, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pace-current { outline: 2px solid #17212d; }
.pace-tooltip {
  position: fixed;
  z-index: 2;
  padding: .25rem .5rem;
  border-radius: .3rem;
  background: #17212d;
  color: white;
  pointer-events: none;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
