Add Connections-style word game with puzzle editor

Express + node:sqlite server, vanilla HTML/JS frontend. Daily puzzle by
assigned date, puzzle list, shuffle, one-away hint, shareable emoji
results, and a password-protected admin page to create and edit puzzles.
Answers are checked server-side and never sent before they are solved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aidan Dona 2026-10-08 16:56:34 -05:00
parent 0d3181ec99
commit 4a2309b589
18 changed files with 4286 additions and 0 deletions

19
public/admin.html Normal file
View file

@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>Admin | NT Connections</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header class="topbar">
<a class="brand" href="/">NT Connections</a>
<nav><a href="/puzzles">Puzzles</a><a href="/admin" aria-current="page">Admin</a></nav>
</header>
<main id="app"><div class="skeleton"></div></main>
<script src="/common.js"></script>
<script src="/admin.js"></script>
</body>
</html>

109
public/admin.js Normal file
View file

@ -0,0 +1,109 @@
const COLORS = ['yellow', 'green', 'blue', 'purple'];
const $app = document.getElementById('app');
let games = [];
const icon = (name) => el('i', { class: `ph-bold ph-${name}`, 'aria-hidden': 'true' });
const errorList = (errors) => el('ul', { class: 'errors', role: 'alert' }, errors.map((e) => el('li', {}, e)));
async function showList() {
const { ok, status, data } = await api('/api/admin/games');
if (status === 401) return showLogin();
if (!ok) return $app.replaceChildren(el('div', { class: 'empty' }, 'Could not load puzzles. Try refreshing.'));
games = data;
const items = games.length
? games.map((g) => el('li', {}, el('div', { class: 'item' },
el('div', {}, el('strong', {}, g.title), el('div', { class: 'meta' }, g.date ? fmtDate(g.date) : 'No date (list only)')),
el('div', { class: 'row-actions' },
el('a', { class: 'btn icon-btn', href: `/play/${g.id}`, 'aria-label': `Play ${g.title}` }, icon('arrow-right')),
el('button', { class: 'btn icon-btn', 'aria-label': `Edit ${g.title}`, onclick: () => showEditor(g) }, icon('pencil-simple')),
el('button', { class: 'btn icon-btn danger', 'aria-label': `Delete ${g.title}`, onclick: () => remove(g) }, icon('trash'))))))
: [el('li', { class: 'empty' }, 'No puzzles yet. Create your first one.')];
$app.replaceChildren(
el('h1', {}, 'Your puzzles'),
el('p', { class: 'sub' }, 'Dated puzzles appear on their day. Future ones stay hidden until then.'),
el('div', { class: 'actions', style: 'justify-content:flex-start;margin-bottom:20px' },
el('button', { class: 'btn primary', onclick: () => showEditor() }, icon('plus'), 'New puzzle'),
el('button', { class: 'btn', onclick: logout }, icon('sign-out'), 'Log out')),
el('ul', { class: 'list' }, items),
);
}
function showLogin(error) {
const input = el('input', { id: 'pw', type: 'password', autocomplete: 'current-password', required: true });
$app.replaceChildren(
el('h1', {}, 'Admin login'),
el('p', { class: 'sub' }, 'Only the puzzle editor needs this.'),
el('form', { onsubmit: async (e) => {
e.preventDefault();
const btn = e.submitter; btn.disabled = true;
const { ok, data } = await api('/api/login', { method: 'POST', body: { password: input.value } });
ok ? showList() : showLogin(data.error || 'Login failed.');
} },
el('div', { class: 'field' }, el('label', { for: 'pw' }, 'Password'), input,
error ? el('p', { class: 'help', style: 'color:var(--error)', role: 'alert' }, error) : null),
el('button', { class: 'btn primary', type: 'submit' }, 'Log in')),
);
input.focus();
}
function showEditor(game) {
const g = game || { title: '', date: '', groups: COLORS.map((color) => ({ name: '', color, words: ['', '', '', ''] })) };
const field = (id, label, input, help) =>
el('div', { class: 'field' }, el('label', { for: id }, label), input, help ? el('p', { class: 'help' }, help) : null);
const title = el('input', { id: 'title', value: g.title, maxlength: 100, required: true });
const date = el('input', { id: 'date', type: 'date', value: g.date || '' });
const errBox = el('div');
const groupEls = g.groups.map((grp, i) => {
const n = i + 1;
const name = el('input', { id: `g${n}-name`, value: grp.name, maxlength: 80, required: true });
const color = el('select', { id: `g${n}-color` }, COLORS.map((c) => el('option', { value: c, selected: c === grp.color }, c[0].toUpperCase() + c.slice(1))));
const words = grp.words.map((w, j) => el('input', { value: w, maxlength: 30, required: true, 'aria-label': `Group ${n} word ${j + 1}` }));
const box = el('fieldset', { class: 'group-edit' },
el('legend', { class: 'sr' }, `Group ${n}`),
el('div', { class: 'head' },
field(`g${n}-name`, el('span', {}, el('span', { class: `swatch ${grp.color}` }), `Group ${n} name`), name),
field(`g${n}-color`, 'Color', color)),
el('label', {}, 'Words'), el('div', { class: 'words' }, words));
color.addEventListener('change', () => { box.querySelector('.swatch').className = `swatch ${color.value}`; });
return { box, read: () => ({ name: name.value, color: color.value, words: words.map((w) => w.value) }) };
});
$app.replaceChildren(
el('a', { href: '/admin', class: 'btn', style: 'margin-bottom:20px', onclick: (e) => { e.preventDefault(); showList(); } }, icon('arrow-left'), 'Back'),
el('h1', {}, game ? 'Edit puzzle' : 'New puzzle'),
el('p', { class: 'sub' }, 'Yellow is the easiest group, purple the trickiest.'),
el('form', { novalidate: true, onsubmit: async (e) => {
e.preventDefault();
const btn = e.submitter; btn.disabled = true;
const body = { title: title.value, date: date.value || null, groups: groupEls.map((x) => x.read()) };
const { ok, data } = await api(game ? `/api/admin/games/${game.id}` : '/api/admin/games', { method: game ? 'PUT' : 'POST', body });
btn.disabled = false;
if (ok) { toast('Saved'); return showList(); }
if (data.error) return showLogin(data.error);
errBox.replaceChildren(errorList(data.errors || ['Could not save.']));
errBox.scrollIntoView({ block: 'center' });
} },
errBox,
field('title', 'Title', title),
field('date', 'Date', date, 'Optional. The puzzle becomes the daily puzzle on this date.'),
groupEls.map((x) => x.box),
el('div', { class: 'actions', style: 'justify-content:flex-start' }, el('button', { class: 'btn primary', type: 'submit' }, icon('check'), 'Save puzzle'))),
);
}
async function remove(g) {
if (!confirm(`Delete "${g.title}"? This cannot be undone.`)) return;
const { ok } = await api(`/api/admin/games/${g.id}`, { method: 'DELETE' });
toast(ok ? 'Deleted' : 'Delete failed');
showList();
}
async function logout() {
await api('/api/logout', { method: 'POST' });
showLogin();
}
showList();

31
public/common.js Normal file
View file

@ -0,0 +1,31 @@
// Small helpers shared by every page.
function el(tag, attrs = {}, ...kids) {
const n = document.createElement(tag);
for (const [k, v] of Object.entries(attrs)) {
if (k === 'class') n.className = v;
else if (k.startsWith('on')) n.addEventListener(k.slice(2), v);
else if (v !== false && v != null) n.setAttribute(k, v === true ? '' : v);
}
n.append(...kids.flat().filter((k) => k != null));
return n;
}
async function api(url, opts = {}) {
const res = await fetch(url, {
...opts,
headers: { 'Content-Type': 'application/json' },
body: opts.body ? JSON.stringify(opts.body) : undefined,
});
const data = await res.json().catch(() => ({}));
return { ok: res.ok, status: res.status, data };
}
function toast(msg) {
document.querySelector('.toast')?.remove();
const t = el('div', { class: 'toast', role: 'status' }, msg);
document.body.append(t);
setTimeout(() => t.remove(), 1800);
}
const fmtDate = (d) =>
d ? new Date(d + 'T00:00:00Z').toLocaleDateString(undefined, { timeZone: 'UTC', year: 'numeric', month: 'long', day: 'numeric' }) : '';

24
public/play.html Normal file
View file

@ -0,0 +1,24 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>NT Connections</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header class="topbar">
<a class="brand" href="/">NT Connections</a>
<nav><a href="/" id="nav-today">Today</a><a href="/puzzles">Puzzles</a></nav>
</header>
<main>
<h1 id="title">Loading puzzle</h1>
<p class="sub" id="sub">Create four groups of four.</p>
<div id="game" aria-live="polite">
<div class="board"><div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div></div>
</div>
</main>
<script src="/common.js"></script>
<script src="/play.js"></script>
</body>
</html>

139
public/play.js Normal file
View file

@ -0,0 +1,139 @@
const ORDER = ['yellow', 'green', 'blue', 'purple'];
const EMOJI = { yellow: '🟨', green: '🟩', blue: '🟦', purple: '🟪' };
const MAX_MISTAKES = 4;
const $game = document.getElementById('game');
const idMatch = location.pathname.match(/^\/play\/(\d+)/);
if (!idMatch) document.getElementById('nav-today').setAttribute('aria-current', 'page');
const state = { game: null, words: [], selected: new Set(), solved: [], mistakes: 0, guesses: [], tried: new Set(), done: false, won: false };
async function load() {
const { ok, data } = await api(idMatch ? `/api/games/${idMatch[1]}` : '/api/daily');
if (!ok) {
document.getElementById('title').textContent = idMatch ? 'Puzzle not found' : 'No puzzle today';
document.getElementById('sub').textContent = data.error || 'Something went wrong.';
$game.replaceChildren(el('div', { class: 'empty' }, 'Pick one from the ', el('a', { href: '/puzzles' }, 'puzzle list'), ' instead.'));
return;
}
state.game = data;
state.words = data.words;
document.getElementById('title').textContent = data.title;
document.title = `${data.title} | NT Connections`;
if (data.date) document.getElementById('sub').textContent = `${fmtDate(data.date)}. Create four groups of four.`;
render();
}
function render() {
const board = el('div', { class: 'board' },
state.solved.map((g) => el('div', { class: `solved ${g.color}` }, el('strong', {}, g.name), el('span', {}, g.words.join(', ')))),
state.words.length ? el('div', { class: 'row4' }, state.words.map((w) =>
el('button', { class: 'tile', 'aria-pressed': String(state.selected.has(w)), disabled: state.done, onclick: () => toggle(w) }, w))) : null,
);
const kids = [board];
if (state.done) {
kids.push(resultPanel());
} else {
kids.push(
el('div', { class: 'mistakes', 'aria-label': `${MAX_MISTAKES - state.mistakes} mistakes remaining` },
'Mistakes remaining:', [...Array(MAX_MISTAKES)].map((_, i) => el('i', { class: i < state.mistakes ? 'used' : '' }))),
el('div', { class: 'actions' },
el('button', { class: 'btn', onclick: shuffleWords }, el('i', { class: 'ph-bold ph-shuffle', 'aria-hidden': 'true' }), 'Shuffle'),
el('button', { class: 'btn', disabled: !state.selected.size, onclick: () => { state.selected.clear(); render(); } }, 'Deselect all'),
el('button', { class: 'btn primary', disabled: state.selected.size !== 4, onclick: submit }, 'Submit')),
);
}
// Re-rendering replaces the buttons, so put keyboard focus back on the same one.
const focused = $game.contains(document.activeElement) ? document.activeElement.textContent : null;
$game.replaceChildren(...kids);
if (focused) [...$game.querySelectorAll('button')].find((b) => b.textContent === focused && !b.disabled)?.focus();
}
function toggle(w) {
if (state.selected.has(w)) state.selected.delete(w);
else if (state.selected.size < 4) state.selected.add(w);
render();
}
function shuffleWords() {
const a = state.words;
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
render();
}
let busy = false;
async function submit() {
if (busy) return;
const words = [...state.selected];
const key = [...words].sort().join('|');
if (state.tried.has(key)) return toast('Already guessed!');
busy = true;
const { ok, data } = await api(`/api/games/${state.game.id}/guess`, { method: 'POST', body: { words } });
busy = false;
if (!ok) return toast(data.error || 'Could not check that guess.');
state.tried.add(key);
state.guesses.push(words);
if (data.result === 'correct') {
state.solved.push(data.group);
state.words = state.words.filter((w) => !data.group.words.includes(w));
state.selected.clear();
if (state.solved.length === 4) return finish(true);
return render();
}
state.mistakes++;
if (data.result === 'one-away') toast('One away...');
if (state.mistakes >= MAX_MISTAKES) return finish(false);
render();
const grid = $game.querySelector('.row4');
grid?.classList.add('shake');
}
async function finish(won) {
const { ok, data } = await api(`/api/games/${state.game.id}/reveal`, { method: 'POST' });
state.answers = ok ? data.groups : state.solved;
if (!won) {
const have = new Set(state.solved.map((g) => g.name));
state.solved.push(...state.answers.filter((g) => !have.has(g.name)).sort((a, b) => ORDER.indexOf(a.color) - ORDER.indexOf(b.color)));
state.words = [];
}
state.done = true;
state.won = won;
state.selected.clear();
render();
}
function shareGrid() {
const colorOf = (w) => state.answers.find((g) => g.words.includes(w))?.color;
return state.guesses.map((guess) => guess.map((w) => EMOJI[colorOf(w)] || '⬜').join('')).join('\n');
}
function resultPanel() {
const heading = !state.won ? 'Next time' : state.mistakes === 0 ? 'Perfect!' : 'Solved';
const grid = shareGrid();
const text = `NT Connections\n${state.game.title}\n${grid}\n${location.origin}/play/${state.game.id}`;
return el('div', { class: 'result' },
el('h2', {}, heading),
el('p', { class: 'sub' }, state.won ? `Finished with ${state.mistakes} mistake${state.mistakes === 1 ? '' : 's'}.` : 'Here are the groups.'),
el('pre', { 'aria-label': 'Your guesses' }, grid),
el('div', { class: 'actions' },
el('button', { class: 'btn primary', onclick: () => share(text) }, el('i', { class: 'ph-bold ph-copy', 'aria-hidden': 'true' }), 'Share results'),
el('a', { class: 'btn', href: '/puzzles' }, 'More puzzles')));
}
async function share(text) {
try {
await navigator.clipboard.writeText(text);
toast('Copied to clipboard');
} catch {
// Clipboard API needs HTTPS; the grid above is still selectable by hand.
toast('Copy failed. Select the grid to copy it.');
}
}
load();

33
public/puzzles.html Normal file
View file

@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Puzzles | NT Connections</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header class="topbar">
<a class="brand" href="/">NT Connections</a>
<nav><a href="/">Today</a><a href="/puzzles" aria-current="page">Puzzles</a></nav>
</header>
<main>
<h1>All puzzles</h1>
<p class="sub">Play today's, or catch up on ones you missed.</p>
<ul class="list" id="list">
<li class="skeleton"></li><li class="skeleton"></li><li class="skeleton"></li>
</ul>
</main>
<script src="/common.js"></script>
<script>
(async () => {
const $list = document.getElementById('list');
const { ok, data } = await api('/api/games');
if (!ok) return $list.replaceChildren(el('li', { class: 'empty' }, 'Could not load puzzles. Try refreshing.'));
if (!data.length) return $list.replaceChildren(el('li', { class: 'empty' }, 'No puzzles yet. Check back soon.'));
$list.replaceChildren(...data.map((g) =>
el('li', {}, el('a', { href: `/play/${g.id}` }, el('strong', {}, g.title), el('span', { class: 'meta' }, fmtDate(g.date))))));
})();
</script>
</body>
</html>

220
public/style.css Normal file
View file

@ -0,0 +1,220 @@
@import url('/vendor/font/400.css');
@import url('/vendor/font/600.css');
@import url('/vendor/font/700.css');
@import url('/vendor/icons/style.css');
/* Shape rule: buttons are full pill; tiles, panels and inputs are 10px. */
:root {
--bg: #f4f4f5;
--surface: #ffffff;
--tile: #e4e4e7;
--tile-hover: #d4d4d8;
--ink: #18181b;
--muted: #52525b;
--line: #d4d4d8;
--selected: #3f3f46;
--selected-ink: #fafafa;
--error: #b42318;
--yellow: #f0d36b;
--green: #a3c96f;
--blue: #a9c1ea;
--purple: #bd9ddb;
--on-group: #18181b;
--radius: 10px;
--ease: cubic-bezier(0.16, 1, 0.3, 1);
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #111113;
--surface: #1c1c1f;
--tile: #2a2a2e;
--tile-hover: #35353a;
--ink: #f4f4f5;
--muted: #a1a1aa;
--line: #3f3f46;
--selected: #e4e4e7;
--selected-ink: #18181b;
--error: #f97066;
--yellow: #e2c25a;
--green: #93ba60;
--blue: #93acd8;
--purple: #a988c9;
color-scheme: dark;
}
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100dvh;
background: var(--bg);
color: var(--ink);
font-family: 'Outfit', system-ui, sans-serif;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.topbar {
height: 64px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
border-bottom: 1px solid var(--line);
background: var(--surface);
}
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; text-decoration: none; }
.topbar nav { display: flex; gap: 20px; }
.topbar nav a { text-decoration: none; color: var(--muted); font-weight: 600; }
.topbar nav a:hover, .topbar nav a[aria-current='page'] { color: var(--ink); }
main { max-width: 640px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 24px; }
/* Buttons */
.btn {
font: inherit;
font-weight: 600;
display: inline-flex;
align-items: center;
gap: 8px;
white-space: nowrap;
padding: 10px 20px;
border-radius: 999px;
border: 1.5px solid var(--ink);
background: transparent;
color: var(--ink);
cursor: pointer;
text-decoration: none;
transition: transform 0.15s var(--ease), background 0.2s;
}
.btn:hover { background: var(--tile); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.danger { border-color: var(--error); color: var(--error); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
/* Board */
.board { display: grid; gap: 8px; margin-bottom: 20px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile {
font: inherit;
font-weight: 700;
font-size: clamp(0.7rem, 2.6vw, 1rem);
text-transform: uppercase;
min-height: 76px;
padding: 6px;
border: 0;
border-radius: var(--radius);
background: var(--tile);
color: var(--ink);
cursor: pointer;
overflow-wrap: anywhere;
line-height: 1.15;
transition: transform 0.15s var(--ease), background 0.15s, color 0.15s;
}
.tile:hover { background: var(--tile-hover); }
.tile:active { transform: scale(0.96); }
.tile[aria-pressed='true'] { background: var(--selected); color: var(--selected-ink); }
.tile:disabled { cursor: default; }
.solved {
border-radius: var(--radius);
min-height: 76px;
padding: 12px;
display: grid;
place-content: center;
text-align: center;
color: var(--on-group);
animation: pop 0.4s var(--ease);
}
.solved strong { text-transform: uppercase; letter-spacing: 0.02em; }
.solved span { text-transform: uppercase; font-size: 0.9rem; }
.yellow { background: var(--yellow); }
.green { background: var(--green); }
.blue { background: var(--blue); }
.purple { background: var(--purple); }
.mistakes { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 20px; color: var(--muted); }
.mistakes i { width: 12px; height: 12px; border-radius: 50%; background: var(--selected); transition: transform 0.3s var(--ease), opacity 0.3s; }
.mistakes i.used { transform: scale(0); opacity: 0; }
.shake { animation: shake 0.35s; }
.toast {
position: fixed;
left: 50%;
top: 84px;
transform: translateX(-50%);
background: var(--ink);
color: var(--bg);
padding: 8px 16px;
border-radius: var(--radius);
font-weight: 600;
animation: fade 1.8s forwards;
z-index: 10; /* only overlay on the page */
}
.result { text-align: center; margin-top: 8px; animation: pop 0.4s var(--ease); }
.result h2 { margin: 0 0 4px; letter-spacing: -0.02em; }
.result pre { font-family: inherit; font-size: 1.4rem; line-height: 1.25; margin: 12px 0 20px; }
/* Lists and forms */
.list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.list a, .list .item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 14px 16px;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--radius);
text-decoration: none;
transition: transform 0.15s var(--ease), border-color 0.2s;
}
.list a:hover { border-color: var(--ink); transform: translateY(-1px); }
.list .meta { color: var(--muted); font-size: 0.9rem; }
.empty, .skeleton { color: var(--muted); padding: 32px 16px; text-align: center; border: 1.5px dashed var(--line); border-radius: var(--radius); }
.skeleton { border-style: solid; background: var(--tile); color: transparent; min-height: 52px; padding: 0; animation: pulse 1.2s infinite alternate; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
label { font-weight: 600; font-size: 0.95rem; }
.help { color: var(--muted); font-size: 0.85rem; margin: 0; }
input, select {
font: inherit;
padding: 10px 12px;
border: 1.5px solid var(--line);
border-radius: var(--radius);
background: var(--surface);
color: var(--ink);
width: 100%;
}
input:focus, select:focus { border-color: var(--ink); outline: none; }
.group-edit { min-width: 0; padding: 16px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.group-edit .head { display: grid; grid-template-columns: 1fr 140px; gap: 10px; margin-bottom: 10px; }
.group-edit .words { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.group-edit .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.errors { color: var(--error); margin: 0 0 16px; padding-left: 20px; }
.row-actions { display: flex; gap: 8px; }
.icon-btn { padding: 8px 12px; }
@media (max-width: 767px) {
.group-edit .head, .group-edit .words { grid-template-columns: 1fr 1fr; }
.topbar nav { gap: 14px; }
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulse { to { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition: none !important; }
}