No backend, no build step -- static HTML/CSS/JS, themed identically to flit/wisp (same CSS vars, same "> " title prefix, same dark/mono/green aesthetic). Snippets are real, shipped code pulled from six repos in this family (flit, wisp, keep, stash, delve-term, goonk) rather than generic pangrams. Stats: WPM = (correct chars / 5) / minutes elapsed, timing from first keystroke not page load. Accuracy = correct keystrokes / total keystrokes tracked at the keydown level (comparing the pressed key against the exact next expected character before it's inserted), so backspaced-over mistakes still count against it rather than only diffing the final text. Keys/sec updates live via a 200ms tick. Tabs in source are rendered as two spaces so players never need to press Tab -- sidesteps a browser default-Tab-moves-focus fight entirely rather than fighting it with preventDefault. Verified via simulated typing sessions (puppeteer), not just static review -- both an artificially fast pass (confirms the math is internally consistent: 308 correct/310 total keystrokes -> 99%, matches displayed) and a realistic ~60wpm-paced pass (confirms no unit-conversion bug that only a slow, deliberate typist would hit tests-at-lightspeed wouldn't surface). That process caught two real bugs before they'd have hit a real player: 1. A stray `tabindex="0"` on the code display let the browser's native click-to-focus behavior steal focus away from the hidden textarea before our own focus() call ran -- typing silently did nothing. Fixed by removing the tabindex and switching to a mousedown+preventDefault handler instead of click. 2. The help modal's CSS set `display: flex` unconditionally, which (author CSS always beats the UA stylesheet) overrode the `hidden` attribute's default `display: none` -- the modal was invisibly covering the entire viewport and intercepting every click, at all times, whether or not it had been opened. Fixed with an explicit `.modal-overlay:not([hidden])` rule. Also verified the actual Docker image builds and serves correctly (nginx, no build stage needed since there's nothing to compile). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
285 lines
6.8 KiB
CSS
285 lines
6.8 KiB
CSS
:root {
|
|
--bg: #080808;
|
|
--bg-alt: #0e0e0e;
|
|
--text: #c8c8c8;
|
|
--muted: #555;
|
|
--heading: #f0f0f0;
|
|
--accent: #00e87a;
|
|
--accent-dim: rgba(0, 232, 122, 0.12);
|
|
--accent-border:rgba(0, 232, 122, 0.25);
|
|
--border: rgba(255, 255, 255, 0.07);
|
|
--shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.6);
|
|
--error: #ff6b6b;
|
|
--error-dim: rgba(255, 107, 107, 0.14);
|
|
|
|
--mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
|
|
--sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
|
|
font: 16px/1.6 var(--sans);
|
|
color: var(--text);
|
|
background: var(--bg);
|
|
color-scheme: dark;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
}
|
|
|
|
*, *::before, *::after { box-sizing: border-box; }
|
|
|
|
body { margin: 0; }
|
|
|
|
#app {
|
|
width: 640px;
|
|
max-width: 100%;
|
|
margin: 0 auto;
|
|
padding: 32px 16px 64px;
|
|
}
|
|
|
|
h1, h2, h3 { font-family: var(--mono); color: var(--heading); line-height: 1.15; margin: 0 0 0.5em; }
|
|
p { margin: 0; }
|
|
|
|
/* ── Header ─────────────────────────────────────────────────────────── */
|
|
|
|
.header-row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
margin-bottom: 8px;
|
|
position: relative;
|
|
}
|
|
|
|
.header-row h1 {
|
|
font-size: 32px;
|
|
font-weight: 700;
|
|
letter-spacing: -0.5px;
|
|
text-align: center;
|
|
margin: 0;
|
|
}
|
|
|
|
.header-row h1::before {
|
|
content: '> ';
|
|
color: var(--muted);
|
|
font-weight: 400;
|
|
}
|
|
|
|
.header-row .help-btn {
|
|
position: absolute;
|
|
right: 0;
|
|
}
|
|
|
|
.help-btn {
|
|
font-family: var(--mono);
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
width: 22px;
|
|
height: 22px;
|
|
line-height: 20px;
|
|
border-radius: 50%;
|
|
border: 1px solid var(--border);
|
|
background: transparent;
|
|
color: var(--muted);
|
|
cursor: pointer;
|
|
padding: 0;
|
|
}
|
|
|
|
.help-btn:hover {
|
|
border-color: var(--accent-border);
|
|
color: var(--accent);
|
|
}
|
|
|
|
.hint {
|
|
font-family: var(--mono);
|
|
font-size: 12px;
|
|
color: var(--muted);
|
|
text-align: center;
|
|
margin-bottom: 32px;
|
|
}
|
|
|
|
/* ── Card ───────────────────────────────────────────────────────────── */
|
|
|
|
.card {
|
|
border: 1px solid var(--border);
|
|
border-radius: 10px;
|
|
padding: 24px;
|
|
background: var(--bg-alt);
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.source-line {
|
|
font-family: var(--mono);
|
|
font-size: 12px;
|
|
color: var(--muted);
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.source-line .accent { color: var(--accent); }
|
|
|
|
.code-display {
|
|
font-family: var(--mono);
|
|
font-size: 15px;
|
|
line-height: 1.7;
|
|
color: var(--muted);
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
margin: 0;
|
|
padding: 16px;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border);
|
|
background: var(--bg);
|
|
cursor: text;
|
|
outline: none;
|
|
min-height: 3em;
|
|
}
|
|
|
|
.code-display:focus {
|
|
border-color: var(--accent-border);
|
|
}
|
|
|
|
.code-display .char-correct { color: var(--text); }
|
|
.code-display .char-incorrect { color: var(--error); background: var(--error-dim); border-radius: 2px; }
|
|
.code-display .char-pending { color: var(--muted); }
|
|
.code-display .char-cursor {
|
|
border-left: 2px solid var(--accent);
|
|
animation: blink 1s step-end infinite;
|
|
}
|
|
@keyframes blink { 50% { border-color: transparent; } }
|
|
|
|
/* Real input, visually hidden but focusable/typeable — a hidden input is
|
|
more reliable across mobile keyboards and IME composition than trying
|
|
to capture raw keydown events on a div. */
|
|
.sr-input {
|
|
position: absolute;
|
|
opacity: 0;
|
|
width: 1px;
|
|
height: 1px;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* ── Stats ──────────────────────────────────────────────────────────── */
|
|
|
|
.stat-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-top: 20px;
|
|
padding-top: 16px;
|
|
border-top: 1px solid var(--border);
|
|
}
|
|
|
|
.stat {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 2px;
|
|
}
|
|
|
|
.stat-value {
|
|
font-family: var(--mono);
|
|
font-size: 20px;
|
|
font-weight: 700;
|
|
color: var(--heading);
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.stat-label {
|
|
font-family: var(--mono);
|
|
font-size: 10px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.08em;
|
|
color: var(--muted);
|
|
}
|
|
|
|
/* ── Actions / buttons ──────────────────────────────────────────────── */
|
|
|
|
.actions {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.btn {
|
|
font-family: var(--mono);
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
padding: 10px 16px;
|
|
border-radius: 6px;
|
|
border: 1px solid var(--border);
|
|
background: transparent;
|
|
color: var(--text);
|
|
cursor: pointer;
|
|
transition: all 0.15s;
|
|
letter-spacing: 0.01em;
|
|
}
|
|
|
|
.btn:hover { border-color: var(--accent-border); color: var(--heading); }
|
|
.btn:active { transform: scale(0.98); }
|
|
|
|
.btn-primary {
|
|
background: var(--accent);
|
|
border-color: var(--accent);
|
|
color: #000;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.btn-primary:hover { background: #00ff88; border-color: #00ff88; color: #000; }
|
|
|
|
/* ── Result banner ──────────────────────────────────────────────────── */
|
|
|
|
.result-banner {
|
|
text-align: center;
|
|
font-family: var(--mono);
|
|
font-size: 13px;
|
|
color: var(--accent);
|
|
margin-top: 14px;
|
|
}
|
|
|
|
/* ── Help modal ─────────────────────────────────────────────────────── */
|
|
|
|
.modal-overlay {
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0,0,0,0.88);
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 100;
|
|
padding: 16px;
|
|
backdrop-filter: blur(4px);
|
|
}
|
|
|
|
/* Author CSS always wins over the UA stylesheet's [hidden]{display:none},
|
|
so an unconditional `display: flex` above would keep this covering the
|
|
whole viewport (and intercepting every click) even while `hidden` is
|
|
set. Only apply flex layout when it isn't hidden. */
|
|
.modal-overlay:not([hidden]) {
|
|
display: flex;
|
|
}
|
|
|
|
.modal-card {
|
|
background: var(--bg-alt);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
width: 100%;
|
|
max-width: 420px;
|
|
max-height: 80vh;
|
|
overflow-y: auto;
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.modal-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 14px;
|
|
font-family: var(--mono);
|
|
font-size: 13px;
|
|
color: var(--heading);
|
|
}
|
|
|
|
.modal-card ul {
|
|
padding-left: 1.2em;
|
|
margin: 0;
|
|
}
|
|
|
|
.modal-card li { margin-bottom: 0.8em; font-size: 14px; line-height: 1.5; }
|
|
.modal-card li:last-child { margin-bottom: 0; }
|