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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The home page lists one **Games Hub** card (`games/`). Individual games live on
- **Word Scramble** (`games/words/`) — unscramble a common word; best streak
- **Reaction Tap** (`games/reaction/`) — wait for gold, tap fast; best average ms
- **Tap Order** (`games/order/`) — tap 1–9 in order on a 3×3 grid; best time
- **Color Clash** (`games/colors/`) — Stroop-style: tap the ink color, not the word; best streak
- **Casual Quiz** (`games/quiz/`) — multiple-choice on India, Tamil Nadu, science, technology, and more, plus a General mix. Switch topic or level anytime. Marks stay in `localStorage`. Questions live only in `games/quiz/questions.json`.

#### How to add or change quiz questions
Expand Down
83 changes: 83 additions & 0 deletions assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,80 @@ body[data-tool="collab"] .site-footer { display: none; }
color: var(--color-text);
}


/* Color Clash */
.colors-stage {
display: flex;
flex-direction: column;
align-items: center;
gap: 1.1rem;
width: min(100%, 420px);
margin: 0 auto;
}
.colors-word {
margin: 0;
min-height: 3.2rem;
font-size: clamp(2rem, 8vw, 2.75rem);
font-weight: 900;
letter-spacing: 0.04em;
text-transform: uppercase;
text-align: center;
line-height: 1.15;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.colors-choices {
display: grid;
grid-template-columns: repeat(2, minmax(132px, 1fr));
gap: 0.65rem;
width: 100%;
}
.colors-choice {
display: flex;
align-items: center;
gap: 0.7rem;
min-height: 64px;
padding: 0.85rem 1rem;
border-radius: 14px;
border: 1px solid var(--color-line);
background: var(--color-card);
color: var(--color-text);
font-family: inherit;
font-size: 1.05rem;
font-weight: 800;
cursor: pointer;
text-align: left;
user-select: none;
-webkit-tap-highlight-color: transparent;
transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}
.colors-choice:hover:not(:disabled) {
border-color: rgba(255, 195, 0, 0.55);
}
.colors-choice:active:not(:disabled) {
transform: scale(0.98);
}
.colors-choice:disabled { cursor: default; }
.colors-swatch {
flex: 0 0 1.55rem;
width: 1.55rem;
height: 1.55rem;
border-radius: 999px;
border: 2px solid rgba(255, 255, 255, 0.18);
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.colors-label { line-height: 1.2; }
.colors-choice.is-correct {
border-color: rgba(74, 222, 128, 0.55);
background: rgba(74, 222, 128, 0.12);
color: var(--color-ok);
}
.colors-choice.is-miss {
border-color: rgba(248, 113, 113, 0.7);
background: rgba(248, 113, 113, 0.12);
color: var(--color-error);
}

@media (max-width: 420px) {
.memory-grid,
.slide-grid {
Expand Down Expand Up @@ -1007,4 +1081,13 @@ body[data-tool="collab"] .site-footer { display: none; }
}
.quiz-option { min-height: 56px; }
.quiz-actions .btn { flex: 1 1 calc(50% - 0.5rem); }
.colors-choices {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.colors-choice {
min-height: 60px;
padding: 0.75rem 0.85rem;
font-size: 0.98rem;
}

}
180 changes: 180 additions & 0 deletions games/colors/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Color Clash | RMKR Toolkit</title>
<meta name="description" content="Stroop-style focus: tap the ink color, not the word. Best streak 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="colors">
<main class="wrap page-main" id="main">
<a class="game-back" href="../">← Focus Games</a>
<h1 class="page-title">Color Clash</h1>
<p class="page-lead">A color word appears in a different ink. Tap the <strong>ink color</strong>, not what the word says. Keep a streak going.</p>

<div class="game-hud">
<div class="game-hud-stats">
<span>Streak: <strong id="streak">0</strong></span>
<span>Best: <strong id="best">—</strong></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 tap the ink color.</p>
<div class="game-board-wrap">
<div class="colors-stage" id="stage" aria-live="polite">
<p class="colors-word" id="word" hidden>—</p>
<div class="colors-choices" id="choices" aria-label="Ink color choices"></div>
</div>
</div>
</main>
<script>
(function () {
var KEY = "rmkr-game-colors-best";
var COLORS = [
{ id: "red", name: "Red", hex: "#f87171" },
{ id: "blue", name: "Blue", hex: "#60a5fa" },
{ id: "green", name: "Green", hex: "#4ade80" },
{ id: "gold", name: "Gold", hex: "#ffc300" },
{ id: "violet", name: "Violet", hex: "#c084fc" }
];
var streak = 0;
var busy = false;
var playing = false;
var inkId = null;
var wordEl = document.getElementById("word");
var choicesEl = document.getElementById("choices");
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 ? "—" : String(b);
}
function renderStreak() {
document.getElementById("streak").textContent = String(streak);
}
function shuffle(arr) {
for (var i = arr.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
return arr;
}
function pickClash() {
var wordColor = COLORS[Math.floor(Math.random() * COLORS.length)];
var inkColor;
do {
inkColor = COLORS[Math.floor(Math.random() * COLORS.length)];
} while (inkColor.id === wordColor.id);
var pool = COLORS.filter(function (c) { return c.id !== inkColor.id; });
shuffle(pool);
var choices = [inkColor].concat(pool.slice(0, 3));
shuffle(choices);
return { word: wordColor, ink: inkColor, choices: choices };
}
function clearChoices() {
choicesEl.innerHTML = "";
}
function nextRound() {
busy = false;
var round = pickClash();
inkId = round.ink.id;
wordEl.hidden = false;
wordEl.textContent = round.word.name.toUpperCase();
wordEl.style.color = round.ink.hex;
wordEl.setAttribute("aria-label", "Color word painted in " + round.ink.name);
clearChoices();
round.choices.forEach(function (c) {
var btn = document.createElement("button");
btn.type = "button";
btn.className = "colors-choice";
btn.setAttribute("data-id", c.id);
btn.setAttribute("aria-label", c.name);
btn.innerHTML = '<span class="colors-swatch" style="background:' + c.hex + '"></span><span class="colors-label">' + c.name + "</span>";
btn.addEventListener("click", onPick);
choicesEl.appendChild(btn);
});
setNote("Tap the ink color — ignore the word.");
}
function onPick(ev) {
if (!playing || busy) return;
var btn = ev.currentTarget;
var id = btn.getAttribute("data-id");
busy = true;
if (id === inkId) {
btn.classList.add("is-correct");
streak += 1;
renderStreak();
var best = saveBest(streak);
renderBest();
setNote("Correct. Streak " + streak + (best === streak ? " — new best!" : ".") , "ok");
setTimeout(function () {
if (playing) nextRound();
}, 420);
return;
}
btn.classList.add("is-miss");
var buttons = choicesEl.querySelectorAll(".colors-choice");
for (var i = 0; i < buttons.length; i++) {
if (buttons[i].getAttribute("data-id") === inkId) {
buttons[i].classList.add("is-correct");
}
buttons[i].disabled = true;
}
var ended = streak;
streak = 0;
renderStreak();
setNote(
ended > 0
? "Miss — ink was " + (COLORS.find(function (c) { return c.id === inkId; }) || {}).name + ". Streak reset from " + ended + "."
: "Miss — ink was " + (COLORS.find(function (c) { return c.id === inkId; }) || {}).name + ". Try again.",
"err"
);
startBtn.textContent = "Play again";
playing = false;
busy = false;
}
function startGame() {
playing = true;
streak = 0;
renderStreak();
renderBest();
startBtn.textContent = "Restart";
nextRound();
}
startBtn.addEventListener("click", startGame);
renderBest();
renderStreak();
clearChoices();
wordEl.hidden = true;
})();
</script>
</body>
</html>
6 changes: 5 additions & 1 deletion 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, word scramble, reaction tap, tap order, and a casual quiz. No accounts, works offline after load.">
<meta name="description" content="Simple browser focus games — memory, sequence, number slide, word scramble, reaction tap, tap order, color clash, and a casual quiz. 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 Down Expand Up @@ -41,6 +41,10 @@ <h3>Reaction Tap</h3>
<h3>Tap Order</h3>
<p>Numbers 1–9 are shuffled on a 3×3 grid. Tap them in order as fast as you can.</p>
</a>
<a class="tool-card ai-card-accent" href="colors/">
<h3>Color Clash</h3>
<p>A color word in the wrong ink. Tap the ink color, not the word. Best streak stays local.</p>
</a>
<a class="tool-card ai-card-accent" href="quiz/">
<h3>Casual Quiz</h3>
<p>Multiple-choice on India, Tamil Nadu, science, tech, and more. Switch topic or level anytime.</p>
Expand Down
Loading