Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ Skillbook and Promptbook load JSON over `fetch`, so use a local server (opening

### Focus Games

Lightweight browser games for a quick break. No accounts, no ads, and scores stay in `localStorage` only. No sound effects in this first wave.
Lightweight browser games for a quick break. No accounts, no ads, and scores stay in `localStorage` only. No sound effects by default.

- **Games Hub** (`games/`) — landing page with links and short descriptions
- **Memory Match** (`games/memory/`) — flip cards, find pairs; best move count
- **Sequence Recall** (`games/sequence/`) — Simon-lite pads; best level reached
- **Number Slide** (`games/numbers/`) — 15-puzzle on a 4×4 board; best move count
- **Word Scramble** (`games/words/`) — unscramble a common word; best streak
- **Reaction Tap** (`games/reaction/`) — wait for gold, then tap; best average ms

### AI

Expand Down
36 changes: 36 additions & 0 deletions assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,42 @@ body[data-tool="collab"] .site-footer { display: none; }
}

@media (max-width: 420px) {

/* Reaction Tap */
.reaction-pad {
width: min(100%, 320px);
min-height: 220px;
border-radius: 18px;
border: 1px solid rgba(255, 195, 0, 0.35);
font-size: 1.35rem;
font-weight: 700;
letter-spacing: 0.02em;
cursor: pointer;
color: var(--color-text);
transition: background 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
}
.reaction-pad:disabled { cursor: default; }
.reaction-pad.is-idle {
background: linear-gradient(145deg, #1c2844, #121a2c);
}
.reaction-pad.is-wait {
background: linear-gradient(145deg, #3a1f24, #2a1218);
border-color: rgba(248, 113, 113, 0.45);
}
.reaction-pad.is-go {
background: linear-gradient(145deg, #c9a000, #ffc300);
color: #12161f;
border-color: #ffc300;
transform: scale(1.02);
}
.reaction-pad.is-early {
background: linear-gradient(145deg, #4a2030, #2a1218);
border-color: rgba(248, 113, 113, 0.7);
}
.reaction-pad:active:not(:disabled) {
transform: scale(0.98);
}

.memory-grid,
.slide-grid {
grid-template-columns: repeat(4, minmax(56px, 1fr));
Expand Down
3 changes: 2 additions & 1 deletion assets/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
{ id: "memory", path: "games/memory/", name: "Memory Match", blurb: "Flip cards and find matching pairs.", cat: "Focus Games" },
{ id: "sequence", path: "games/sequence/", name: "Sequence Recall", blurb: "Watch the taps, then repeat the pattern.", cat: "Focus Games" },
{ id: "numbers", path: "games/numbers/", name: "Number Slide", blurb: "Slide tiles to sort 1–15 on a 4×4 board.", cat: "Focus Games" },
{ id: "words", path: "games/words/", name: "Word Scramble", blurb: "Unscramble a common word, then try the next one.", cat: "Focus Games" }
{ id: "words", path: "games/words/", name: "Word Scramble", blurb: "Unscramble a common word, then try the next one.", cat: "Focus Games" },
{ id: "reaction", path: "games/reaction/", name: "Reaction Tap", blurb: "Wait for gold, then tap as fast as you can.", cat: "Focus Games" }
];

function rootPrefix() {
Expand Down
8 changes: 6 additions & 2 deletions games/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Focus Games | RMKR Toolkit</title>
<meta name="description" content="Simple browser focus games — memory, sequence, number slide, and word scramble. No accounts, works offline after load.">
<meta name="description" content="Simple browser focus games — memory, sequence, number slide, word scramble, and reaction tap. No accounts, works offline after load.">
<link rel="icon" type="image/svg+xml" href="../assets/favicon.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap" rel="stylesheet">
Expand All @@ -14,7 +14,7 @@
<body data-root="../" data-tool="games">
<main class="wrap page-main" id="main">
<h1 class="page-title">Focus Games</h1>
<p class="page-lead">Short, simple brain games that stay in your browser. Large tap targets, offline after first load, and best scores saved only in localStorage. No sound effects in this wave.</p>
<p class="page-lead">Short, simple brain games that stay in your browser. Large tap targets, offline after first load, and best scores saved only in localStorage. Sound stays off; scores stay local.</p>

<div class="hub-grid">
<a class="tool-card ai-card-accent" href="memory/">
Expand All @@ -33,6 +33,10 @@ <h3>Number Slide</h3>
<h3>Word Scramble</h3>
<p>Unscramble a common English word, then hit Next for another. Keep a streak going.</p>
</a>
<a class="tool-card ai-card-accent" href="reaction/">
<h3>Reaction Tap</h3>
<p>Wait for gold, then tap. Five rounds; best average time stays on this device.</p>
</a>
</div>

<h2 class="section-title">How it works</h2>
Expand Down
171 changes: 171 additions & 0 deletions games/reaction/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reaction Tap | RMKR Toolkit</title>
<meta name="description" content="Wait for the pad to turn gold, then tap. Best reaction time saved locally.">
<link rel="icon" type="image/svg+xml" href="../../assets/favicon.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../../assets/site.css">
<script src="../../assets/site.js" defer></script>
</head>
<body data-root="../../" data-tool="reaction">
<main class="wrap page-main" id="main">
<a class="game-back" href="../">← Focus Games</a>
<h1 class="page-title">Reaction Tap</h1>
<p class="page-lead">Wait for the pad to turn gold, then tap as fast as you can. Early taps count as a miss.</p>

<div class="game-hud">
<div class="game-hud-stats">
<span>Last: <strong id="last">—</strong></span>
<span>Best: <strong id="best">—</strong></span>
<span>Round: <strong id="round">0</strong>/5</span>
</div>
<div class="game-hud-actions">
<button type="button" class="btn btn-gold" id="startBtn">Start</button>
</div>
</div>
<p class="game-note" id="note" role="status">Press Start, then wait for gold.</p>
<div class="game-board-wrap">
<button type="button" class="reaction-pad is-idle" id="pad" aria-label="Reaction pad" disabled>Ready</button>
</div>
</main>
<script>
(function () {
var KEY = "rmkr-game-reaction-best";
var TOTAL = 5;
var state = "idle"; // idle | wait | go | done
var waitTimer = null;
var goAt = 0;
var round = 0;
var times = [];
var pad = document.getElementById("pad");
var startBtn = document.getElementById("startBtn");

function loadBest() {
try {
var v = parseInt(localStorage.getItem(KEY) || "", 10);
return Number.isFinite(v) && v > 0 ? v : null;
} catch (e) { return null; }
}
function saveBest(n) {
var cur = loadBest();
if (cur == null || n < cur) {
try { localStorage.setItem(KEY, String(n)); } catch (e) {}
return n;
}
return cur;
}
function setNote(msg, kind) {
var el = document.getElementById("note");
el.textContent = msg || "";
el.className = "game-note" + (kind ? " " + kind : "");
}
function renderBest() {
var b = loadBest();
document.getElementById("best").textContent = b == null ? "—" : b + " ms";
}
function setPad(cls, label, enabled) {
pad.className = "reaction-pad " + cls;
pad.textContent = label;
pad.disabled = !enabled;
}
function clearWait() {
if (waitTimer) {
clearTimeout(waitTimer);
waitTimer = null;
}
}
function avg(arr) {
if (!arr.length) return null;
var s = 0;
for (var i = 0; i < arr.length; i++) s += arr[i];
return Math.round(s / arr.length);
}
function armWait() {
state = "wait";
setPad("is-wait", "Wait…", true);
setNote("Don't tap yet — wait for gold.");
var delay = 1200 + Math.floor(Math.random() * 2800);
waitTimer = setTimeout(function () {
waitTimer = null;
state = "go";
goAt = performance.now();
setPad("is-go", "TAP!", true);
setNote("Go!");
}, delay);
}
function finishSet() {
state = "done";
clearWait();
var a = avg(times);
var best = a == null ? loadBest() : saveBest(a);
renderBest();
setPad("is-idle", "Done", false);
document.getElementById("last").textContent = a == null ? "—" : a + " ms avg";
setNote(
"Set complete. Average " + (a == null ? "—" : a + " ms") +
". Best average: " + (best == null ? "—" : best + " ms") + ".",
"ok"
);
startBtn.textContent = "Play again";
startBtn.disabled = false;
}
function startSet() {
clearWait();
round = 0;
times = [];
document.getElementById("round").textContent = "0";
document.getElementById("last").textContent = "—";
renderBest();
startBtn.disabled = true;
startBtn.textContent = "In progress";
document.getElementById("round").textContent = "0/" + TOTAL;
armWait();
}
function nextOrFinish() {
if (round >= TOTAL) {
finishSet();
return;
}
setTimeout(armWait, 650);
}
function onPad() {
if (state === "wait") {
clearWait();
state = "idle";
setPad("is-early", "Too soon", false);
setNote("Too early — that round is void. Stay ready.", "err");
setTimeout(function () {
if (round >= TOTAL) {
finishSet();
} else {
armWait();
}
}, 900);
return;
}
if (state !== "go") return;
var ms = Math.max(1, Math.round(performance.now() - goAt));
times.push(ms);
round += 1;
document.getElementById("round").textContent = String(round) + "/" + TOTAL;
document.getElementById("last").textContent = ms + " ms";
state = "idle";
setPad("is-idle", ms + " ms", false);
setNote("Nice — " + ms + " ms.");
if (round >= TOTAL) {
setTimeout(finishSet, 500);
} else {
nextOrFinish();
}
}
startBtn.addEventListener("click", startSet);
pad.addEventListener("click", onPad);
renderBest();
})();
</script>
</body>
</html>
Loading