/* type — pure black monkeytype-style test (v6: acid accent + display face shared with the homepage) */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; src: url("/assets/fonts/Bricolage-wdth.woff2") format("woff2"); }
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: #000; }
body {
  background: #000; color: #d4d4d4;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: #d2ff3a; color: #000; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px;
}
.brand { font-weight: 700; font-size: 17px; color: #d4d4d4; text-decoration: none; }
.brand span { color: #d2ff3a; }
.lb-btn {
  font-size: 13px; color: #646669; border: 1px solid #1e1e1e;
  padding: 8px 18px; border-radius: 8px;
  transition: color .15s ease, border-color .15s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.lb-btn:hover { color: #d2ff3a; border-color: #d2ff3a; transform: scale(1.05); }
.lb-btn:active { transform: scale(.94); }

/* ---------- stage ---------- */
.stage {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  max-width: 1350px; width: 100%; margin: 0 auto; padding: 0 48px;
}
.hud { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.timer { font-size: 30px; font-weight: 700; color: #d2ff3a; font-variant-numeric: tabular-nums; }
.live-wpm { font-size: 30px; font-weight: 700; color: #3a3a3a; font-variant-numeric: tabular-nums; min-width: 2ch; }
.mode { font-size: 13px; color: #646669; }

/* ---------- words ---------- */
.words-wrap {
  position: relative; overflow: hidden;
  height: calc((28px * 1.6 + 14px) * 3);
  margin-bottom: 26px;
  user-select: none; -webkit-user-select: none;
}
.words-inner {
  position: relative;
  font-size: 28px; line-height: 1.6;
  transition: transform .25s ease;
}
.word { display: inline-block; margin: 0 14px 14px 0; white-space: nowrap; }
.letter { color: #565668; transition: color .06s; letter-spacing: .01em; }
.letter.correct { color: #d4d4d4; }
.letter.incorrect { color: #ca4754; }
.letter.extra { color: #7e2a33; }
.caret {
  position: absolute; top: 0; left: 0; width: 3px; border-radius: 2px;
  background: #d2ff3a; will-change: transform;
  /* smooth glide between letters */
  transition: transform .18s cubic-bezier(.25, .8, .35, 1);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
/* solid while actively typing — blink only resumes when idle */
.caret.typing { animation: none; opacity: 1; }
.words-inner.flash { animation: wordsIn .3s ease; }
@keyframes wordsIn { from { opacity: 0; } }

.icon-restart {
  align-self: center; font-size: 22px; color: #646669;
  transition: color .15s ease, transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.icon-restart:hover { color: #d2ff3a; transform: rotate(120deg) scale(1.15); }

/* ---------- result ---------- */
.result { text-align: center; padding: 30px 0; }
.result:not(.hidden) { animation: resultIn .45s cubic-bezier(.16, 1, .3, 1); }
@keyframes resultIn { from { opacity: 0; transform: translateY(14px); } }
.result-stats { display: flex; gap: 70px; justify-content: center; margin-bottom: 34px; }
.result-stats > div { display: flex; flex-direction: column; gap: 6px; }
.r-label { font-size: 13px; color: #646669; }
.r-val { font-size: 56px; font-weight: 700; color: #d2ff3a; font-variant-numeric: tabular-nums; }
.restart-btn {
  font-size: 14px; color: #d4d4d4; border: 1px solid #2a2a2a;
  padding: 12px 34px; border-radius: 10px;
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), border-color .15s ease, color .15s ease;
}
.restart-btn:hover { transform: scale(1.07); border-color: #d2ff3a; color: #d2ff3a; }
.restart-btn:active { transform: scale(.93); }
.hint { margin-top: 16px; font-size: 12px; color: #3a3a3a; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.prompt-box { text-align: center; }
.prompt-q { font-size: 22px; color: #d4d4d4; margin-bottom: 22px; }
.prompt-input {
  background: transparent; border: none; border-bottom: 2px solid #2a2a2a;
  color: #d2ff3a; font: inherit; font-size: 26px; text-align: center;
  padding: 8px 12px; width: min(340px, 80vw); outline: none;
  transition: border-color .2s ease;
}
.prompt-input:focus { border-color: #d2ff3a; }
.prompt-input::placeholder { color: #3a3a3a; }

.lb-box {
  width: min(480px, 92vw); max-height: 70vh; overflow-y: auto;
  background: #0a0a0a; border: 1px solid #1e1e1e; border-radius: 14px; padding: 24px;
}
.lb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.lb-head p { font-size: 16px; font-weight: 700; color: #d2ff3a; }
.lb-close { color: #646669; font-size: 16px; padding: 4px 8px; }
.lb-close:hover { color: #d4d4d4; }
.lb-row {
  display: grid; grid-template-columns: 34px 1fr auto auto; gap: 12px;
  padding: 10px 4px; font-size: 14px; border-bottom: 1px solid #141414;
  font-variant-numeric: tabular-nums;
}
.lb-row:last-child { border-bottom: none; }
.lb-rank { color: #3a3a3a; }
.lb-row.first .lb-rank { color: #d2ff3a; }
.lb-name { color: #d4d4d4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wpm { color: #d4d4d4; font-weight: 700; }
.lb-acc { color: #646669; }
.lb-empty { color: #3a3a3a; font-size: 14px; text-align: center; padding: 30px 0; }

/* ---------- hidden input ---------- */
.hidden-input {
  position: fixed; top: 0; left: 0; width: 10px; height: 10px;
  opacity: 0; border: none; outline: none; pointer-events: none;
}

@media (max-width: 640px) {
  .topbar { padding: 16px 20px; }
  .stage { padding: 0 20px; }
  .hud { gap: 10px; margin-bottom: 14px; }
  .timer { font-size: 24px; }
  .live-wpm { font-size: 24px; }
  .words-inner { font-size: 22px; }
  .words-wrap { height: calc((22px * 1.6 + 14px) * 3); }
  .word { margin: 0 10px 14px 0; }
  .result-stats { gap: 40px; }
  .r-val { font-size: 42px; }
}


/* ---------- page transition curtain (shared with the homepage) ---------- */
.curtain { position: fixed; inset: 0; z-index: 500; pointer-events: none; display: flex; }
.curtain i { flex: 1; background: #d2ff3a; transform: scaleY(0); transform-origin: bottom; will-change: transform; }
html.arrive .curtain i { transform: scaleY(1); }
html[data-motion="off"] .curtain { display: none; }
/* ---------- v6 display touches ---------- */
.brand { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -.05em; font-variation-settings: "wdth" 80; }
.r-val { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: 88px; letter-spacing: -.05em; font-variation-settings: "wdth" 80; line-height: 1; }
.prompt-q, .lb-head p { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 700; letter-spacing: -.02em; }
.prompt-q { font-size: 34px; }
.lb-btn { border-radius: 999px; }
.restart-btn { border-radius: 999px; }
.lb-box { border-radius: 20px; }
@media (max-width: 640px) { .r-val { font-size: 60px; } .prompt-q { font-size: 26px; } }
