// Cap WPM to reasonable display & round wpmSpan.textContent = Math.floor(wpm);
.stats p margin: 0; font-weight: 500;
const elapsedSeconds = (Date.now() - startTime) / 1000; timeSpan.textContent = Math.floor(elapsedSeconds); words per minute
function updateStats() const text = textarea.value; const charCount = text.length; const wordUnits = calculateWordsFromChars(text); // Cap WPM to reasonable display & round wpmSpan
// Start timer on first keystroke if (charCount > 0 && startTime === null) startTime = Date.now(); .stats p margin: 0
textarea width: 100%; padding: 1rem; font-size: 1rem; font-family: monospace; border-radius: 12px; border: 1px solid #ccc; resize: vertical;