CyberMax-tools commited on
Commit
287d257
·
verified ·
1 Parent(s): 59784bc

Deploy latchkite to the hub

Browse files
.gitattributes CHANGED
@@ -986,3 +986,4 @@ brand/game-assets-bundle/image-1-shot.png filter=lfs diff=lfs merge=lfs -text
986
  brand/game-assets-bundle/image-2-inside.png filter=lfs diff=lfs merge=lfs -text
987
  brand/game-assets-bundle/image-3-output.png filter=lfs diff=lfs merge=lfs -text
988
  brand/game-assets-bundle/image-4-savings.png filter=lfs diff=lfs merge=lfs -text
 
 
986
  brand/game-assets-bundle/image-2-inside.png filter=lfs diff=lfs merge=lfs -text
987
  brand/game-assets-bundle/image-3-output.png filter=lfs diff=lfs merge=lfs -text
988
  brand/game-assets-bundle/image-4-savings.png filter=lfs diff=lfs merge=lfs -text
989
+ latchkite/shot-phone.png filter=lfs diff=lfs merge=lfs -text
latchkite/cmx.js ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CyberMax Fun kit: shared browser helpers for the CyberMax games (copied into each game's web/ folder by
2
+ // scripts/games/sync_kit.py, so every game stays self-contained and sellable on its own).
3
+ // Counter beacon (game + event + channel only: no cookies, no IDs, nothing personal), daily seed, share, PWA install.
4
+ // (c) 2026 CyberMax. All rights reserved.
5
+
6
+ export const SITE = 'https://cybermaxtools.com';
7
+ export const API = 'https://toys.cybermaxtools.com';
8
+ export const EPOCH = Date.UTC(2026, 9, 2); // 2 Oct 2026 = puzzle #1 for every CyberMax daily game
9
+
10
+ /** Today's date in the player's own time zone as YYYY-MM-DD (everyone gets a new puzzle at their local midnight). */
11
+ export function today(d = new Date()) {
12
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
13
+ }
14
+ /** Puzzle number for a YYYY-MM-DD date (#1 = 2026-10-02). */
15
+ export function dayNumber(iso) {
16
+ const [y, m, d] = iso.split('-').map(Number);
17
+ return Math.round((Date.UTC(y, m - 1, d) - EPOCH) / 864e5) + 1;
18
+ }
19
+ export function dateOf(n) {
20
+ const t = new Date(EPOCH + (n - 1) * 864e5);
21
+ return t.toISOString().slice(0, 10);
22
+ }
23
+
24
+ /** 32-bit string hash (FNV-1a) and a small fast PRNG (mulberry32): the same seed gives the same game everywhere. */
25
+ export function hash(str) {
26
+ let h = 0x811c9dc5;
27
+ for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 0x01000193); }
28
+ return h >>> 0;
29
+ }
30
+ export function rng(seed) {
31
+ let a = typeof seed === 'string' ? hash(seed) : seed >>> 0;
32
+ return function () {
33
+ a = (a + 0x6d2b79f5) >>> 0;
34
+ let t = a;
35
+ t = Math.imul(t ^ (t >>> 15), t | 1);
36
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
37
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
38
+ };
39
+ }
40
+
41
+ /** Count one event (play, win, share, install, pro, cta). Never breaks the page; skipped on localhost and in tests. */
42
+ export function count(game, ev, ch = '') {
43
+ try {
44
+ if (typeof location === 'undefined' || /^(localhost|127\.0\.0\.1)$/.test(location.hostname) || navigator.webdriver) return;
45
+ const u = `${API}/e?t=${encodeURIComponent(game)}&a=${encodeURIComponent(ev)}&c=${encodeURIComponent(String(ch).toLowerCase().replace(/[^a-z0-9-]/g, '').slice(0, 40))}`;
46
+ if (navigator.sendBeacon && navigator.sendBeacon(u)) return;
47
+ fetch(u, { method: 'POST', keepalive: true, mode: 'no-cors' }).catch(() => {});
48
+ } catch { /* never break the game */ }
49
+ }
50
+
51
+ export function store(key, val) {
52
+ try {
53
+ if (val === undefined) return JSON.parse(localStorage.getItem(key) || 'null');
54
+ localStorage.setItem(key, JSON.stringify(val));
55
+ } catch { /* private mode */ }
56
+ return val;
57
+ }
58
+
59
+ export function toast(msg, ms = 2400) {
60
+ let t = document.getElementById('toast');
61
+ if (!t) { t = document.createElement('div'); t.id = 'toast'; t.setAttribute('role', 'status'); document.body.appendChild(t); }
62
+ t.textContent = msg;
63
+ t.classList.add('on');
64
+ clearTimeout(t._h);
65
+ t._h = setTimeout(() => t.classList.remove('on'), ms);
66
+ }
67
+
68
+ /** The link people share: the canonical game page with UTM tags the site view counter reads. */
69
+ export function shareLink(path, channel, game) {
70
+ const u = new URL(SITE + path);
71
+ u.searchParams.set('utm_source', channel);
72
+ u.searchParams.set('utm_medium', 'share');
73
+ u.searchParams.set('utm_campaign', `game-${game}`);
74
+ return u.toString();
75
+ }
76
+
77
+ /**
78
+ * Share a result: native share sheet on phones (text + optional PNG card), else copy to clipboard.
79
+ * text = Wordle-style text block; path = the game's path on the CyberMax site; blob = optional PNG card.
80
+ */
81
+ export async function share(game, text, path, blob, filename) {
82
+ const url = shareLink(path, 'share', game);
83
+ const full = `${text}\n${url}`;
84
+ if (navigator.share) {
85
+ try {
86
+ const file = blob ? new File([blob], filename || `${game}.png`, { type: 'image/png' }) : null;
87
+ const data = file && navigator.canShare && navigator.canShare({ files: [file] }) ? { files: [file], text: full } : { text: full };
88
+ await navigator.share(data);
89
+ count(game, 'share', 'native');
90
+ return 'shared';
91
+ } catch (e) {
92
+ if (e && e.name === 'AbortError') return 'cancelled';
93
+ }
94
+ }
95
+ try { await navigator.clipboard.writeText(full); toast('Result copied. Paste it anywhere.'); } catch { prompt('Copy your result:', full); }
96
+ count(game, 'share', 'copy');
97
+ return 'copied';
98
+ }
99
+
100
+ export function intents(game, text, path) {
101
+ const u = (ch) => shareLink(path, ch, game);
102
+ return {
103
+ x: `https://x.com/intent/post?text=${encodeURIComponent(text)}&url=${encodeURIComponent(u('x'))}`,
104
+ bsky: `https://bsky.app/intent/compose?text=${encodeURIComponent(`${text}\n${u('bsky')}`)}`,
105
+ whatsapp: `https://wa.me/?text=${encodeURIComponent(`${text}\n${u('whatsapp')}`)}`,
106
+ };
107
+ }
108
+
109
+ export function download(blob, filename) {
110
+ const a = document.createElement('a');
111
+ a.href = URL.createObjectURL(blob);
112
+ a.download = filename;
113
+ document.body.appendChild(a);
114
+ a.click();
115
+ setTimeout(() => { URL.revokeObjectURL(a.href); a.remove(); }, 1500);
116
+ }
117
+
118
+ /**
119
+ * Installable app: registers the service worker (offline play) and shows an "Add to Home Screen" button.
120
+ * Chrome/Edge/Android: the real install prompt. iPhone/iPad Safari: a short Share → Add to Home Screen hint.
121
+ * The button only appears after the first finished round (offer(): never on first load) and never once installed.
122
+ */
123
+ export function pwa(game, btn) {
124
+ if ('serviceWorker' in navigator && (location.protocol === 'https:' || location.hostname === 'localhost')) {
125
+ navigator.serviceWorker.register('sw.js').catch(() => {});
126
+ }
127
+ const standalone = matchMedia('(display-mode: standalone)').matches || navigator.standalone;
128
+ if (standalone) { count(game, 'play', 'app'); return { offer() {} }; }
129
+ let deferred = null;
130
+ let wanted = false;
131
+ const ios = /iphone|ipad|ipod/i.test(navigator.userAgent) && !/crios|fxios/i.test(navigator.userAgent);
132
+ window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); deferred = e; if (wanted && btn) btn.hidden = false; });
133
+ window.addEventListener('appinstalled', () => { count(game, 'install', 'prompt'); if (btn) btn.hidden = true; });
134
+ if (btn) {
135
+ btn.addEventListener('click', async () => {
136
+ if (deferred) {
137
+ deferred.prompt();
138
+ const r = await deferred.userChoice.catch(() => null);
139
+ if (r && r.outcome === 'accepted') btn.hidden = true;
140
+ deferred = null;
141
+ } else if (ios) {
142
+ toast('Tap the Share button, then "Add to Home Screen".', 5000);
143
+ count(game, 'install', 'ios-hint');
144
+ }
145
+ });
146
+ }
147
+ return {
148
+ offer() {
149
+ wanted = true;
150
+ if (btn && (deferred || ios) && !store(`cmx-install-no:${game}`)) btn.hidden = false;
151
+ },
152
+ };
153
+ }
154
+
155
+ /** Rounded rectangle path for canvas cards. */
156
+ export function rr(ctx, x, y, w, h, r) {
157
+ ctx.beginPath();
158
+ ctx.moveTo(x + r, y);
159
+ ctx.arcTo(x + w, y, x + w, y + h, r);
160
+ ctx.arcTo(x + w, y + h, x, y + h, r);
161
+ ctx.arcTo(x, y + h, x, y, r);
162
+ ctx.arcTo(x, y, x + w, y, r);
163
+ ctx.closePath();
164
+ }
165
+
166
+ export const canvasBlob = (canvas) => new Promise((res) => canvas.toBlob(res, 'image/png'));
167
+
168
+ /** Theme toggle shared by every page (light/dark, remembered). */
169
+ export function themeToggle(btn) {
170
+ if (!btn) return;
171
+ btn.addEventListener('click', () => {
172
+ const r = document.documentElement;
173
+ const c = r.dataset.theme || (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
174
+ const n = c === 'dark' ? 'light' : 'dark';
175
+ r.dataset.theme = n;
176
+ store('cm-theme-v', n);
177
+ try { localStorage.setItem('cm-theme', n); } catch { /* private mode */ }
178
+ });
179
+ }
latchkite/core.js ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Latchkite core: deterministic simulation (no DOM). Your kite whirls round a peg on its line; one tap lets go and it
2
+ // flies straight along its swing. Reach the next peg's catch ring and the line latches on. Same pegs for everyone each
3
+ // UTC day (seed = the date). Fixed 60 Hz ticks, so a run is the same on every device. (c) 2026 CyberMax.
4
+
5
+ export const HZ = 60;
6
+ export const W = 100; // world width in units; y grows upward
7
+ export const FRAY = HZ * 3; // a line frays and snaps after 3 s on one peg: no camping
8
+ export const FLY_MAX = HZ * 2; // a kite that flies 2 s without a catch is lost
9
+ const TAU = Math.PI * 2;
10
+
11
+ export function rng(seed) {
12
+ let h = 0x811c9dc5;
13
+ for (let i = 0; i < seed.length; i++) { h ^= seed.charCodeAt(i); h = Math.imul(h, 0x01000193); }
14
+ let a = h >>> 0;
15
+ return () => {
16
+ a = (a + 0x6d2b79f5) >>> 0;
17
+ let t = a;
18
+ t = Math.imul(t ^ (t >>> 15), t | 1);
19
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
20
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
21
+ };
22
+ }
23
+
24
+ /** Catch-ring radius of peg i: generous early, tighter later (never below 4.6 units). */
25
+ export const catchR = (i) => Math.max(4.6, 8 - i * 0.12);
26
+ /** Spin speed in radians per second after `score` catches. */
27
+ export const spin = (score) => Math.min(4.6, 2.5 + score * 0.07);
28
+ /** Flight speed in units per second. */
29
+ export const flySpeed = (score) => Math.min(70, 42 + score * 0.9);
30
+
31
+ /** The peg course for a seed: peg 0 sits at the bottom middle, each next peg higher, left or right. */
32
+ export function course(seed, n = 400) {
33
+ const r = rng(`latchkite:${seed}`);
34
+ const pegs = [{ x: 50, y: 0 }];
35
+ for (let i = 1; i < n; i++) {
36
+ const p = pegs[i - 1];
37
+ const gap = 20 + r() * 7 + Math.min(i, 40) * 0.22;
38
+ let dx = (12 + r() * 24) * (r() < 0.5 ? -1 : 1);
39
+ if (p.x + dx < 14 || p.x + dx > 86) dx = -dx;
40
+ pegs.push({ x: Math.max(14, Math.min(86, p.x + dx)), y: p.y + gap, r: catchR(i) });
41
+ }
42
+ pegs[0].r = catchR(0);
43
+ return pegs;
44
+ }
45
+
46
+ /** A run: step(tap) once per tick; returns 'latch', 'dead' or ''. */
47
+ export function makeSim(seed) {
48
+ const pegs = course(seed);
49
+ const r0 = rng(`latchkite-dir:${seed}`)();
50
+ const s = {
51
+ pegs, peg: 0, a: -Math.PI / 2, len: 10, dir: r0 < 0.5 ? 1 : -1, score: 0, t: 0, held: 0,
52
+ flying: false, fx: 0, fy: 0, vx: 0, vy: 0, flown: 0, dead: false, why: '',
53
+ get x() { return this.flying ? this.fx : this.pegs[this.peg].x + Math.cos(this.a) * this.len; },
54
+ get y() { return this.flying ? this.fy : this.pegs[this.peg].y + Math.sin(this.a) * this.len; },
55
+ step(tap) {
56
+ if (this.dead) return 'dead';
57
+ this.t++;
58
+ if (!this.flying) {
59
+ this.a = (this.a + this.dir * spin(this.score) / HZ) % TAU;
60
+ if (++this.held >= FRAY) { this.dead = true; this.why = 'fray'; this.flying = true; this.fx = this.x; this.fy = this.y; return 'dead'; }
61
+ if (tap) {
62
+ const p = this.pegs[this.peg];
63
+ this.fx = p.x + Math.cos(this.a) * this.len; this.fy = p.y + Math.sin(this.a) * this.len;
64
+ const v = flySpeed(this.score);
65
+ this.vx = -Math.sin(this.a) * this.dir * v; this.vy = Math.cos(this.a) * this.dir * v;
66
+ this.flying = true; this.flown = 0;
67
+ }
68
+ return '';
69
+ }
70
+ this.fx += this.vx / HZ; this.fy += this.vy / HZ; this.flown++;
71
+ for (let j = this.peg + 1; j <= this.peg + 3 && j < this.pegs.length; j++) {
72
+ const q = this.pegs[j], dx = this.fx - q.x, dy = this.fy - q.y, d = Math.hypot(dx, dy);
73
+ if (d <= q.r) {
74
+ this.score += j - this.peg; // skipping a peg counts double
75
+ this.peg = j; this.flying = false; this.held = 0;
76
+ this.len = Math.max(5, Math.min(11, d < 5 ? 8 : d));
77
+ this.a = Math.atan2(dy, dx);
78
+ this.dir = dx * this.vy - dy * this.vx >= 0 ? 1 : -1; // keep turning the way the kite was moving
79
+ return 'latch';
80
+ }
81
+ }
82
+ const low = this.pegs[this.peg].y - 30;
83
+ if (this.flown >= FLY_MAX || this.fx < -6 || this.fx > W + 6 || this.fy < low) { this.dead = true; this.why = 'lost'; return 'dead'; }
84
+ return '';
85
+ },
86
+ };
87
+ return s;
88
+ }
89
+
90
+ /** 10-block bar for share text: one block per 3 catches. */
91
+ export function bar(n) {
92
+ const full = Math.min(10, Math.floor(n / 3));
93
+ return '🟦'.repeat(full) + '⬜'.repeat(10 - full);
94
+ }
latchkite/fun.css ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CyberMax Fun kit: shared look for CyberMax games (copied into each game). Mobile first, light + dark. (c) 2026 CyberMax. */
2
+ :root{--bg:#F6F3EC;--card:#fff;--ink:#11141B;--muted:#565C6B;--line:#E2DCD0;--chip:#ECE6DA;--acc:#FF6A3D;--acc-ink:#11141B;--ok:#0B7F5E;--bad:#C2361B;--shadow:0 1px 2px rgba(17,20,27,.06),0 10px 30px rgba(17,20,27,.08);color-scheme:light}
3
+ @media (prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0F1218;--card:#181C25;--ink:#EDEAE3;--muted:#A6ACB9;--line:#2A303C;--chip:#222734;--ok:#2FD3A0;--bad:#FF7A5C;--shadow:0 1px 2px rgba(0,0,0,.3),0 10px 30px rgba(0,0,0,.3);color-scheme:dark}}
4
+ :root[data-theme=dark]{--bg:#0F1218;--card:#181C25;--ink:#EDEAE3;--muted:#A6ACB9;--line:#2A303C;--chip:#222734;--ok:#2FD3A0;--bad:#FF7A5C;--shadow:0 1px 2px rgba(0,0,0,.3),0 10px 30px rgba(0,0,0,.3);color-scheme:dark}
5
+ *{box-sizing:border-box}[hidden]{display:none!important}html{-webkit-text-size-adjust:100%}
6
+ body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;overflow-x:hidden}
7
+ a{color:inherit}img,canvas{max-width:100%}
8
+ .wrap{max-width:760px;margin:0 auto;padding:0 16px}
9
+ .top{display:flex;align-items:center;gap:6px;padding:12px 0}
10
+ .top .brand{display:flex;align-items:center;gap:8px;font-weight:800;text-decoration:none;font-size:18px;margin-right:auto}.top .brand svg{width:28px;height:28px}
11
+ .top nav a,.top .icon{color:var(--muted);text-decoration:none;padding:8px 10px;border-radius:10px;font-size:15px;background:none;border:0;font-family:inherit;cursor:pointer;min-height:40px}
12
+ .top nav a:hover,.top .icon:hover{color:var(--ink);background:var(--chip)}
13
+ .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:10px 18px;border-radius:12px;border:0;background:var(--acc);color:var(--acc-ink);font:inherit;font-weight:800;font-size:16px;cursor:pointer;text-decoration:none;touch-action:manipulation}
14
+ .btn:hover{filter:brightness(1.06)}.btn.ghost{background:transparent;color:var(--ink);border:1.5px solid var(--line)}.btn.sm{min-height:40px;padding:6px 14px;font-size:15px}
15
+ .btn.pass{background:linear-gradient(135deg,#FFB547,#FF6A3D);color:#11141B}
16
+ .row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
17
+ .chips{display:flex;gap:6px;flex-wrap:wrap}
18
+ .chip{border:1.5px solid var(--line);background:var(--card);color:var(--ink);border-radius:999px;padding:6px 12px;font:inherit;font-size:14px;font-weight:700;cursor:pointer;min-height:36px}
19
+ .chip[aria-pressed=true]{background:var(--ink);color:var(--bg);border-color:var(--ink)}.chip .lock{opacity:.7;font-size:12px}
20
+ .panel{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:16px;box-shadow:var(--shadow)}
21
+ .muted{color:var(--muted)}.small{font-size:14px}
22
+ h1{font-size:clamp(26px,6vw,40px);line-height:1.08;letter-spacing:-.02em;margin:0 0 6px;text-wrap:balance}
23
+ h2{font-size:21px;letter-spacing:-.01em;margin:30px 0 8px}
24
+ .seo h3{font-size:17px;margin:18px 0 4px}.seo p,.seo li{color:var(--muted)}
25
+ .more{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;margin:12px 0}
26
+ .more a{display:block;padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--card);text-decoration:none}.more a b{display:block}.more a span{color:var(--muted);font-size:14px}
27
+ footer{color:var(--muted);font-size:14px;padding:26px 0 40px;border-top:1px solid var(--line);margin-top:36px}
28
+ #toast{position:fixed;left:50%;bottom:22px;transform:translate(-50%,40px);opacity:0;background:var(--ink);color:var(--bg);padding:12px 16px;border-radius:12px;font-weight:700;transition:.25s;z-index:99;max-width:calc(100% - 32px);text-align:center;pointer-events:none}
29
+ #toast.on{transform:translate(-50%,0);opacity:1}
30
+ .nudge{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;border:1.5px dashed var(--line);border-radius:14px;padding:10px 12px;margin-top:12px;font-size:15px}
31
+ html.cmx-pro .nudge{display:none}
32
+ .pro-badge{display:none;font-size:12px;font-weight:800;background:linear-gradient(135deg,#FFB547,#FF6A3D);color:#11141B;border-radius:999px;padding:2px 8px;vertical-align:middle}
33
+ html.cmx-pro .pro-badge{display:inline-block}
34
+ dialog.funpass{border:0;padding:0;border-radius:20px;max-width:min(520px,calc(100% - 24px));width:100%;background:var(--card);color:var(--ink);box-shadow:0 20px 60px rgba(0,0,0,.35)}
35
+ dialog.funpass::backdrop{background:rgba(10,12,18,.55)}
36
+ .fp{padding:22px 20px 18px;position:relative}.fp h2{margin:2px 0 10px;font-size:24px}
37
+ .fp-x{position:absolute;right:10px;top:8px;border:0;background:none;color:var(--muted);font-size:28px;cursor:pointer;width:44px;height:44px}
38
+ .fp-kick{margin:0;color:var(--acc);font-weight:800;font-size:13px;letter-spacing:.06em;text-transform:uppercase}
39
+ .fp-perks{margin:0 0 14px;padding-left:20px}.fp-perks li{margin:2px 0}
40
+ .fp-plans{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
41
+ .fp-plan{position:relative;display:flex;flex-direction:column;gap:2px;padding:14px 10px 12px;border:1.5px solid var(--line);border-radius:14px;text-decoration:none;text-align:center;background:var(--bg)}
42
+ .fp-plan:hover{border-color:var(--acc)}.fp-plan.best{border-color:var(--acc);box-shadow:0 0 0 2px var(--acc) inset}
43
+ .fp-plan i{position:absolute;top:-10px;left:50%;transform:translateX(-50%);background:var(--acc);color:#11141B;font-style:normal;font-size:11px;font-weight:800;padding:2px 8px;border-radius:999px;white-space:nowrap}
44
+ .fp-plan b{font-size:14px}.fp-price{font-size:22px;font-weight:900}.fp-price small{font-size:12px;font-weight:600;color:var(--muted)}.fp-note{font-size:12px;color:var(--muted)}
45
+ .fp-small{font-size:13px;color:var(--muted);margin:10px 0 4px}
46
+ .fp-code{display:block;user-select:all;word-break:break-all;background:var(--chip);padding:8px;border-radius:8px;font-size:12px}
47
+ .fp details{margin-top:6px;font-size:14px}.fp-form{display:flex;gap:6px;margin-top:8px}.fp-form input{flex:1;min-width:0;font:inherit;font-size:14px;padding:8px 10px;border-radius:10px;border:1.5px solid var(--line);background:var(--bg);color:var(--ink)}
48
+ @media (max-width:420px){.fp-plans{grid-template-columns:1fr}.fp-plan{flex-direction:row;align-items:center;justify-content:space-between;text-align:left;padding:12px}.fp-plan i{left:auto;right:10px;transform:none}}
49
+ @media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
50
+ @media (max-width:560px){.chips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -16px;padding:2px 16px 4px}.chips::-webkit-scrollbar{display:none}.chip{flex:0 0 auto}}
51
+ @media (min-width:760px){dialog.funpass{max-width:720px}.fp-perks{columns:2;column-gap:28px}}
52
+ .fp-after{margin:14px 0 0;padding:12px 14px;border:1px solid var(--line, rgba(127,127,127,.35));border-radius:14px;text-align:left}.fp-after p{margin:0 0 8px}.fp-after .fp-row{display:flex;gap:8px;flex-wrap:wrap}
latchkite/funpass.js ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CyberMax Fun Pass: ONE optional supporter pass for every CyberMax game (copied into each game's web/ folder).
2
+ // Free games stay free. The pass removes the supporter nudges and unlocks extra packs, the full archive and themes.
3
+ // Monthly $2.99 · Yearly $19 · Lifetime $29.99 once (Stripe Payment Links, pack revenue/packs/stripe/fun-pass).
4
+ // Buy: counted redirect https://data.cybermaxtools.com/buy/st-fun-pass-<plan>?s=game-<id> -> Stripe checkout.
5
+ // After checkout Stripe sends the buyer to data.cybermaxtools.com/unlock/fun-pass?session_id=..., which checks
6
+ // the Checkout Session (and, for a subscription, that it is still active) and returns to /games/ with #cmx-pro=<code>.
7
+ // Every game on the same site reads the same browser key, so one pass covers them all. The code on the receipt page
8
+ // unlocks any other device or browser. No account, no cookies, nothing personal stored. (c) 2026 CyberMax.
9
+ import { count, store, toast } from './cmx.js';
10
+
11
+ const DATA = 'https://data.cybermaxtools.com';
12
+ const KEY = 'cmx-pro:fun-pass';
13
+ const SID = /^(cs_(live|test)_[A-Za-z0-9]{10,200}|[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})$/i; // Stripe order code or Gumroad licence key
14
+ const RECHECK = 3 * 864e5; // subscriptions are re-checked every 3 days; a cancelled pass turns off by itself
15
+ export const PLANS = [
16
+ { id: 'monthly', label: 'Monthly', price: '$2.99', per: '/month', note: 'Cancel any time' },
17
+ { id: 'yearly', label: 'Yearly', price: '$19', per: '/year', note: 'Save 47%', best: true },
18
+ { id: 'unlock', label: 'Lifetime', price: '$29.99', per: ' once', note: 'Pay once, keep forever' },
19
+ ];
20
+ export const COMMON_PERKS = ['No supporter nudges, ever', 'Extra puzzle packs in every game', 'The full archive of past dailies', 'Custom colour themes'];
21
+
22
+ let state = store(KEY);
23
+ const listeners = [];
24
+ let cfg = { game: 'games', name: 'CyberMax games', perks: [] };
25
+
26
+ export const isPro = () => !!(state && state.code);
27
+ export function onChange(fn) { listeners.push(fn); fn(isPro()); }
28
+ function emit() {
29
+ document.documentElement.classList.toggle('cmx-pro', isPro());
30
+ listeners.forEach((fn) => { try { fn(isPro()); } catch { /* game hook */ } });
31
+ }
32
+
33
+ async function check(code) {
34
+ try {
35
+ const r = await fetch(`${DATA}/unlock/fun-pass?json=1&session_id=${encodeURIComponent(code)}`);
36
+ const j = await r.json();
37
+ return j && typeof j.pro === 'boolean' ? j.pro : null;
38
+ } catch { return null; }
39
+ }
40
+
41
+ export async function unlock(code) {
42
+ const ok = await check(code);
43
+ if (ok) {
44
+ state = store(KEY, { code, at: new Date().toISOString(), checked: Date.now() });
45
+ count(cfg.game, 'pro', 'unlocked');
46
+ toast('Fun Pass is on. Thank you for supporting CyberMax games!', 3500);
47
+ emit();
48
+ render();
49
+ } else if (ok === false) toast('That code is not an active Fun Pass.', 3500);
50
+ else toast('Could not reach the pass check. Try again in a minute.', 3500);
51
+ return ok;
52
+ }
53
+
54
+ async function recheck() {
55
+ if (!isPro() || Date.now() - (state.checked || 0) < RECHECK) return;
56
+ const ok = await check(state.code);
57
+ if (ok === false) { state = null; try { localStorage.removeItem(KEY); } catch { /* */ } emit(); render(); toast('Your Fun Pass has ended. Everything free is still here.', 4000); }
58
+ else if (ok) state = store(KEY, { ...state, checked: Date.now() });
59
+ }
60
+
61
+ const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
62
+ const buyUrl = (plan) => `${DATA}/buy/st-fun-pass-${plan}?s=game-${cfg.game}`;
63
+
64
+ function dialog() {
65
+ let d = document.getElementById('funpass');
66
+ if (!d) {
67
+ d = document.createElement('dialog');
68
+ d.id = 'funpass';
69
+ d.className = 'funpass';
70
+ document.body.appendChild(d);
71
+ d.addEventListener('click', (e) => { if (e.target === d || e.target.closest('[data-close]')) d.close(); });
72
+ }
73
+ return d;
74
+ }
75
+
76
+ function render() {
77
+ const d = dialog();
78
+ const perks = [...(cfg.perks || []), ...COMMON_PERKS.filter((p) => !(cfg.perks || []).some((q) => q.split(' ')[0] === p.split(' ')[0]))].slice(0, 6);
79
+ if (isPro()) {
80
+ d.innerHTML = `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">CyberMax Fun Pass</p><h2>You're a supporter. Thank you!</h2>
81
+ <p>The pass is on in this browser for every CyberMax game: ${perks.map(esc).join(' · ')}.</p>
82
+ <p class="fp-small">Your code (paste it on another device to turn the pass on there):</p><code class="fp-code">${esc(state.code)}</code>
83
+ <p class="fp-small">Manage or cancel a subscription any time from the link in your Stripe receipt email.</p></div>`;
84
+ return;
85
+ }
86
+ d.innerHTML = `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">CyberMax Fun Pass</p>
87
+ <h2>One pass. Every game. More to play.</h2>
88
+ <ul class="fp-perks">${perks.map((p) => `<li>${esc(p)}</li>`).join('')}</ul>
89
+ <div class="fp-plans">${PLANS.map((p) => `<a class="fp-plan${p.best ? ' best' : ''}" href="${buyUrl(p.id)}" rel="nofollow" data-plan="${p.id}">${p.best ? '<i>Best value</i>' : ''}<b>${p.label}</b><span class="fp-price">${p.price}<small>${p.per}</small></span><span class="fp-note">${p.note}</span></a>`).join('')}</div>
90
+ <p class="fp-small">Secure Stripe checkout. Works in every CyberMax game. The free daily games stay free for everyone.</p>
91
+ <details><summary>Already have a pass?</summary><form class="fp-form"><input aria-label="Pass code" autocomplete="off" placeholder="Receipt code (cs_live_…) or Gumroad licence key"><button class="btn sm" type="submit">Turn on</button></form></details></div>`;
92
+ d.querySelector('.fp-form').addEventListener('submit', (e) => {
93
+ e.preventDefault();
94
+ const c = e.target.querySelector('input').value.trim();
95
+ if (SID.test(c)) unlock(c); else toast('Paste the code from your receipt page (cs_live_…) or your Gumroad licence key.', 3500);
96
+ });
97
+ d.querySelectorAll('[data-plan]').forEach((a) => a.addEventListener('click', () => count(cfg.game, 'cta', `pass-${a.dataset.plan}`)));
98
+ }
99
+
100
+ /** Open the pass sheet; `from` names the button that opened it (counted as cta). */
101
+ export function open(from = 'button') {
102
+ render();
103
+ const d = dialog();
104
+ if (d.showModal) d.showModal(); else d.setAttribute('open', '');
105
+ count(cfg.game, 'cta', `pass-open-${from}`);
106
+ }
107
+
108
+ /** After a finished round (the value moment): one small inline card under the result, never a pop-up. Shows the
109
+ * pass price, the honest trust line and an optional "email me" weekly reminder (double opt-in).
110
+ * `host` is the result panel; the card is added once and removed for pass holders. */
111
+ export function afterWin(host, from = 'win') {
112
+ if (!host) return;
113
+ if (isPro()) { host.querySelector('.fp-after')?.remove(); return; }
114
+ let el = host.querySelector('.fp-after');
115
+ if (!el) { el = document.createElement('div'); el.className = 'fp-after'; host.appendChild(el); }
116
+ const best = PLANS.find((p) => p.best) || PLANS[0];
117
+ el.innerHTML = `<p><b>Want more today?</b> ${esc(cfg.extra || 'The Fun Pass unlocks extra packs, the full archive and themes in every CyberMax game.')}</p>
118
+ <p class="fp-row"><a class="btn sm" href="${buyUrl(best.id)}-after" rel="nofollow" data-after>Get the Fun Pass: ${esc(best.price)}${esc(best.per)}</a> <button class="btn sm ghost" type="button" data-plans>See all plans</button></p>
119
+ <p class="fp-small">Secure Stripe checkout · the pass turns on as soon as you pay · cancel any time from your receipt email · 14-day promise: if it doesn't work as described, we fix it or refund you (<a href="https://cybermaxtools.com/terms#payments" target="_blank" rel="noopener">terms</a>). Today's free game stays free.</p>
120
+ <div class="fp-cap"></div>`;
121
+ el.querySelector('[data-after]').addEventListener('click', () => { count(cfg.game, 'cta', `pass-${best.id}-after`); kit((K) => K.event('upgrade-click', cfg.game)); });
122
+ el.querySelector('[data-plans]').addEventListener('click', () => open(`after-${from}`));
123
+ kit((K) => {
124
+ K.event('result', cfg.game); K.event('upgrade-view', cfg.game);
125
+ K.capture(el.querySelector('.fp-cap'), { list: `weekly-${cfg.game}`, src: `game-${cfg.game}`, label: cfg.remind || 'Email me a weekly reminder with new puzzles (free)', button: 'Remind me' });
126
+ });
127
+ }
128
+
129
+ // Convert kit (funnel beacons + email capture) from the CyberMax site; optional, the game works without it.
130
+ let kitQ = null;
131
+ function kit(fn) {
132
+ if (window.CMXConvert) return fn(window.CMXConvert);
133
+ if (kitQ) return kitQ.push(fn);
134
+ kitQ = [fn];
135
+ const sc = document.createElement('script');
136
+ sc.src = 'https://cybermaxtools.com/store/convert.js'; sc.async = true;
137
+ sc.onload = () => kitQ.splice(0).forEach((f) => { try { f(window.CMXConvert); } catch { /* optional */ } });
138
+ document.head.appendChild(sc);
139
+ }
140
+
141
+ /** Call once per page: game id, display name and the game's own Pro perks (listed first). */
142
+ export function init(options) {
143
+ cfg = { ...cfg, ...options };
144
+ const m = /[#&]cmx-pro=([^&]+)/.exec(location.hash || '');
145
+ if (m && SID.test(decodeURIComponent(m[1]))) {
146
+ history.replaceState(null, '', location.pathname + location.search);
147
+ unlock(decodeURIComponent(m[1]));
148
+ } else recheck();
149
+ emit();
150
+ }
latchkite/game.js ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Latchkite: game screen (fixed-tick loop, canvas, sound, daily/practice/archive, share, Fun Pass, Skin Pack). (c) 2026 CyberMax.
2
+ import { makeSim, bar, HZ, FRAY, spin } from './core.js';
3
+ import { dayNumber, dateOf, count, store, toast, share, intents, download, canvasBlob, pwa, themeToggle } from './cmx.js';
4
+ import * as skins from './skins.js';
5
+ import * as pass from './funpass.js';
6
+
7
+ const GAME = 'latchkite';
8
+ const PATH = '/games/latchkite/';
9
+ const GUMROAD = 'https://cybermax1.gumroad.com/l/cybermax-latchkite-skins';
10
+ const $ = (id) => document.getElementById(id);
11
+ const cv = $('c');
12
+ const g = cv.getContext('2d');
13
+ // tier: free | pass (CyberMax Fun Pass) | pack (Latchkite Skin Pack, one-time)
14
+ const SKINS = {
15
+ dawn: { name: 'Dawn', tier: 'free', top: '#1B2350', bot: '#E9806B', peg: '#FFF4E0', ring: 'rgba(255,244,224,.28)', line: '#FFF4E0', k1: '#FFCF4A', k2: '#FF5E5B', trail: 'rgba(255,207,74,.55)', text: '#FFFFFF' },
16
+ dusk: { name: 'Dusk', tier: 'pass', top: '#0D0B26', bot: '#5B2A86', peg: '#E8E1FF', ring: 'rgba(232,225,255,.25)', line: '#E8E1FF', k1: '#7CF5FF', k2: '#B26BFF', trail: 'rgba(124,245,255,.5)', text: '#FFFFFF' },
17
+ meadow: { name: 'Meadow', tier: 'pass', top: '#7FD3FF', bot: '#E7F7C9', peg: '#2E4A1F', ring: 'rgba(46,74,31,.25)', line: '#2E4A1F', k1: '#FF6A3D', k2: '#2E86DE', trail: 'rgba(255,106,61,.45)', text: '#11141B' },
18
+ koi: { name: 'Koi', tier: 'pack', top: '#0F3B4C', bot: '#2E8C8C', peg: '#FDF6EC', ring: 'rgba(253,246,236,.25)', line: '#FDF6EC', k1: '#FF7B2E', k2: '#FFFFFF', trail: 'rgba(255,123,46,.5)', text: '#FFFFFF', tail: 'fins' },
19
+ aurora: { name: 'Aurora', tier: 'pack', top: '#020814', bot: '#0E4D3C', peg: '#C9FFE9', ring: 'rgba(116,255,196,.28)', line: '#9FFFD8', k1: '#74FFC4', k2: '#8A7CFF', trail: 'rgba(116,255,196,.6)', text: '#E8FFF6', tail: 'ribbon' },
20
+ ember: { name: 'Ember', tier: 'pack', top: '#1A0500', bot: '#7A1E00', peg: '#FFD9A8', ring: 'rgba(255,170,80,.3)', line: '#FFB067', k1: '#FFD23F', k2: '#FF3D00', trail: 'rgba(255,90,0,.65)', text: '#FFF1E0', tail: 'sparks' },
21
+ paper: { name: 'Paper', tier: 'pack', top: '#F4EFE6', bot: '#E6DCCB', peg: '#2B2B2B', ring: 'rgba(43,43,43,.2)', line: '#2B2B2B', k1: '#D7263D', k2: '#F4EFE6', trail: 'rgba(43,43,43,.25)', text: '#2B2B2B', tail: 'bows' },
22
+ neon: { name: 'Neon', tier: 'pack', top: '#07001A', bot: '#1F0B3A', peg: '#FF2E97', ring: 'rgba(255,46,151,.35)', line: '#00F0FF', k1: '#00F0FF', k2: '#FF2E97', trail: 'rgba(0,240,255,.6)', text: '#FFFFFF', tail: 'ribbon' },
23
+ gold: { name: 'Gold', tier: 'pack', top: '#14110A', bot: '#3D3218', peg: '#FFE7A3', ring: 'rgba(255,215,0,.3)', line: '#FFE7A3', k1: '#FFD700', k2: '#B8860B', trail: 'rgba(255,215,0,.55)', text: '#FFF6D6', tail: 'sparks' },
24
+ };
25
+ const PACK = Object.values(SKINS).filter((s) => s.tier === 'pack');
26
+ const todayIso = new Date().toISOString().slice(0, 10); // UTC day: the same course for everyone on Earth
27
+ const todayNum = dayNumber(todayIso);
28
+
29
+ skins.capture({ game: GAME, name: 'Latchkite', skins: PACK.length, price: '$1.99', gumroad: GUMROAD, preview: PACK.map((s) => s.k1),
30
+ perks: [`${PACK.length} kites with their own sky, line and tail: ${PACK.map((s) => s.name).join(', ')}`, 'Every skin also on your share card'] });
31
+ pass.init({ game: GAME, name: 'Latchkite', perks: ['Every past daily course in the archive', 'Dusk and Meadow skies'] });
32
+ const canUse = (s) => s.tier === 'free' || (s.tier === 'pass' && pass.isPro()) || (s.tier === 'pack' && skins.owned());
33
+ let skin = SKINS[store('latchkite:skin')] && canUse(SKINS[store('latchkite:skin')]) ? store('latchkite:skin') : 'dawn';
34
+ let muted = !!store('latchkite:mute');
35
+ let mode = { kind: 'daily', date: todayIso };
36
+ let sim, state = 'ready', pending = false, acc = 0, last = 0, deadAt = 0, flash = 0, shake = 0, lastScore = 0, camY = -40, pop = 0;
37
+ let trail = [];
38
+ const install = pwa(GAME, $('install'));
39
+ themeToggle($('theme'));
40
+
41
+ // ------------------------------------------------------------------ sound (WebAudio blips, no files)
42
+ let ac;
43
+ function blip(f, d = 0.06, type = 'sine', vol = 0.08) {
44
+ if (muted) return;
45
+ try {
46
+ ac = ac || new (window.AudioContext || window.webkitAudioContext)();
47
+ const o = ac.createOscillator(), v = ac.createGain();
48
+ o.type = type; o.frequency.setValueAtTime(f, ac.currentTime);
49
+ o.frequency.exponentialRampToValueAtTime(f * (type === 'sawtooth' ? 0.3 : 1.6), ac.currentTime + d);
50
+ v.gain.setValueAtTime(vol, ac.currentTime); v.gain.exponentialRampToValueAtTime(0.0001, ac.currentTime + d);
51
+ o.connect(v); v.connect(ac.destination); o.start(); o.stop(ac.currentTime + d + 0.02);
52
+ } catch { /* no audio */ }
53
+ }
54
+ $('mute').textContent = muted ? '🔇' : '🔊';
55
+ $('mute').onclick = () => { muted = !muted; store('latchkite:mute', muted); $('mute').textContent = muted ? '🔇' : '🔊'; };
56
+
57
+ // ------------------------------------------------------------------ modes + stats
58
+ const seedOf = (m) => (m.kind === 'practice' ? m.seed : m.date);
59
+ const dayKey = (m) => `latchkite:day:${m.date}`;
60
+ const dayStats = (m) => store(dayKey(m)) || { best: 0, tries: 0 };
61
+ function renderModes() {
62
+ const el = $('modes'); el.innerHTML = '';
63
+ const items = [
64
+ { t: `Daily #${todayNum}`, on: mode.kind === 'daily' && mode.date === todayIso, go: () => setMode({ kind: 'daily', date: todayIso }) },
65
+ { t: 'Practice', on: mode.kind === 'practice', go: () => setMode({ kind: 'practice', seed: `p${Date.now()}` }) },
66
+ { t: 'Archive', on: mode.kind === 'daily' && mode.date !== todayIso, lock: !pass.isPro(), go: archive },
67
+ ];
68
+ for (const it of items) {
69
+ const b = document.createElement('button');
70
+ b.className = 'chip'; b.type = 'button'; b.setAttribute('aria-pressed', String(it.on));
71
+ b.innerHTML = `${it.t}${it.lock ? ' <span class="lock">🔒</span>' : ''}`;
72
+ b.onclick = it.go; el.appendChild(b);
73
+ }
74
+ }
75
+ function archive() {
76
+ if (!pass.isPro()) { pass.open('archive'); return; }
77
+ const n = todayNum - 1;
78
+ if (n < 1) { toast('The archive fills up day by day; the first archived course arrives tomorrow.', 4000); return; }
79
+ const k = Number(prompt(`Play a past daily course: enter a number from 1 to ${n}`, String(n)));
80
+ if (k >= 1 && k <= n) setMode({ kind: 'daily', date: dateOf(k) });
81
+ }
82
+ function setMode(m) {
83
+ mode = m;
84
+ $('num').textContent = m.kind === 'practice' ? 'practice' : `#${dayNumber(m.date)}`;
85
+ $('over').hidden = true;
86
+ renderModes(); reset(); hud();
87
+ }
88
+ function hud() {
89
+ const s = mode.kind === 'daily' ? dayStats(mode) : { best: store('latchkite:practice-best') || 0, tries: 0 };
90
+ $('best').textContent = s.best; $('tries').textContent = s.tries || 0;
91
+ }
92
+
93
+ // ------------------------------------------------------------------ loop
94
+ function reset() { sim = makeSim(seedOf(mode)); state = 'ready'; pending = false; acc = 0; trail = []; flash = 0; shake = 0; camY = -40; }
95
+ function start() {
96
+ if (mode.kind === 'practice') mode.seed = `p${Date.now()}`;
97
+ reset(); state = 'run'; last = performance.now();
98
+ count(GAME, 'play', mode.kind === 'daily' ? (mode.date === todayIso ? 'daily' : 'archive') : 'practice');
99
+ $('over').hidden = true;
100
+ }
101
+ function input() {
102
+ if (state === 'ready') { start(); return; }
103
+ if (state === 'run') { pending = true; return; }
104
+ if (state === 'dead' && performance.now() - deadAt > 300) start();
105
+ }
106
+ function die() {
107
+ state = 'dead'; deadAt = performance.now(); flash = 1; shake = 12; lastScore = sim.score;
108
+ blip(150, 0.32, 'sawtooth', 0.11);
109
+ if (navigator.vibrate) try { navigator.vibrate([30, 40, 30]); } catch { /* */ }
110
+ let newBest = false;
111
+ if (mode.kind === 'daily') {
112
+ const s = dayStats(mode); s.tries = (s.tries || 0) + 1;
113
+ if (sim.score > (s.best || 0)) { s.best = sim.score; newBest = true; }
114
+ store(dayKey(mode), s);
115
+ } else if (sim.score > (store('latchkite:practice-best') || 0)) { store('latchkite:practice-best', sim.score); newBest = true; }
116
+ hud(); showOver(newBest);
117
+ if (sim.score >= 5) install.offer();
118
+ }
119
+ function frame(now) {
120
+ requestAnimationFrame(frame);
121
+ if (state === 'run') {
122
+ acc += Math.min(0.25, (now - last) / 1000); last = now;
123
+ let n = 0;
124
+ while (acc >= 1 / HZ && n++ < 8) {
125
+ acc -= 1 / HZ;
126
+ const tap = pending && !sim.flying; pending = false;
127
+ if (tap) blip(620, 0.05, 'triangle');
128
+ const ev = sim.step(tap);
129
+ if (ev === 'latch') { blip(700 + Math.min(sim.score, 40) * 22, 0.07, 'sine', 0.07); pop = 1; }
130
+ if (sim.dead) { die(); break; }
131
+ }
132
+ } else last = now;
133
+ draw(now);
134
+ }
135
+
136
+ // ------------------------------------------------------------------ drawing (world units -> canvas: 7.2 px a unit)
137
+ const TAU = Math.PI * 2;
138
+ const K = 7.2;
139
+ function kite(x, y, ang, S, size = 1, ctx = g) {
140
+ ctx.save(); ctx.translate(x, y); ctx.rotate(ang); ctx.scale(size, size);
141
+ ctx.fillStyle = S.k1; ctx.beginPath(); ctx.moveTo(0, -26); ctx.lineTo(17, 0); ctx.lineTo(0, 30); ctx.lineTo(-17, 0); ctx.closePath(); ctx.fill();
142
+ ctx.fillStyle = S.k2; ctx.beginPath(); ctx.moveTo(0, -26); ctx.lineTo(17, 0); ctx.lineTo(0, 0); ctx.closePath(); ctx.fill();
143
+ ctx.beginPath(); ctx.moveTo(0, 30); ctx.lineTo(-17, 0); ctx.lineTo(0, 0); ctx.closePath(); ctx.fill();
144
+ ctx.strokeStyle = 'rgba(0,0,0,.25)'; ctx.lineWidth = 2; ctx.beginPath(); ctx.moveTo(0, -26); ctx.lineTo(0, 30); ctx.moveTo(-17, 0); ctx.lineTo(17, 0); ctx.stroke();
145
+ ctx.restore();
146
+ }
147
+ function sky(ctx, w, h, S) {
148
+ const gr = ctx.createLinearGradient(0, 0, 0, h); gr.addColorStop(0, S.top); gr.addColorStop(1, S.bot);
149
+ ctx.fillStyle = gr; ctx.fillRect(-20, -20, w + 40, h + 40);
150
+ }
151
+ function draw(now) {
152
+ const S = SKINS[skin], Wc = cv.width, Hc = cv.height;
153
+ const p = sim.pegs[sim.peg];
154
+ const target = (sim.flying ? Math.min(p.y, sim.y) : p.y) - 40;
155
+ camY += (target - camY) * 0.12;
156
+ const sx = (x) => x * K, sy = (y) => Hc - (y - camY) * K;
157
+ g.save();
158
+ if (shake > 0) { g.translate((Math.random() - 0.5) * shake, (Math.random() - 0.5) * shake); shake *= 0.85; if (shake < 0.5) shake = 0; }
159
+ sky(g, Wc, Hc, S);
160
+ // parallax clouds
161
+ g.fillStyle = 'rgba(255,255,255,.07)';
162
+ for (let i = 0; i < 6; i++) { const cy = ((i * 211 - camY * 2.2) % (Hc + 200) + Hc + 200) % (Hc + 200) - 100; g.beginPath(); g.ellipse((i * 137) % Wc, Hc - cy, 90, 26, 0, 0, TAU); g.fill(); }
163
+ // pegs + catch rings
164
+ for (let j = Math.max(0, sim.peg - 1); j < sim.pegs.length; j++) {
165
+ const q = sim.pegs[j]; const y = sy(q.y);
166
+ if (y < -60) break;
167
+ if (y > Hc + 60) continue;
168
+ if (j > sim.peg) { g.strokeStyle = S.ring; g.lineWidth = 3; g.setLineDash([8, 8]); g.beginPath(); g.arc(sx(q.x), y, q.r * K, 0, TAU); g.stroke(); g.setLineDash([]); }
169
+ g.fillStyle = S.peg; g.beginPath(); g.arc(sx(q.x), y, j === sim.peg ? 9 : 7, 0, TAU); g.fill();
170
+ }
171
+ // line, fray warning
172
+ const kx = sx(sim.x), ky = sy(sim.y);
173
+ if (!sim.flying) {
174
+ const fr = state === 'run' ? sim.held / FRAY : 0;
175
+ g.strokeStyle = fr > 0.6 && Math.floor(now / 90) % 2 ? '#FF4D4D' : S.line; g.lineWidth = 3;
176
+ g.beginPath(); g.moveTo(sx(p.x), sy(p.y)); g.lineTo(kx, ky); g.stroke();
177
+ if (state === 'run') { g.strokeStyle = fr > 0.6 ? '#FF4D4D' : S.line; g.globalAlpha = 0.6; g.lineWidth = 4; g.beginPath(); g.arc(sx(p.x), sy(p.y), 16, -Math.PI / 2, -Math.PI / 2 + TAU * (1 - fr)); g.stroke(); g.globalAlpha = 1; }
178
+ }
179
+ // trail
180
+ trail.push([sim.x, sim.y]); if (trail.length > 16) trail.shift();
181
+ for (let i = 0; i < trail.length; i++) {
182
+ const [x, y] = trail[i]; const a = i / trail.length;
183
+ g.fillStyle = S.trail; g.globalAlpha = a * 0.8;
184
+ const r = S.tail === 'sparks' ? 3 + (i % 3) * 2 : S.tail === 'bows' ? (i % 4 === 0 ? 7 : 2) : 4 + a * 7;
185
+ g.beginPath(); g.arc(sx(x) + (S.tail === 'ribbon' ? Math.sin(now / 90 + i) * 6 : 0), sy(y), r, 0, TAU); g.fill();
186
+ }
187
+ g.globalAlpha = 1;
188
+ const ang = sim.flying ? Math.atan2(sim.vx, sim.vy) : Math.PI / 2 - sim.a; // nose along the flight, or outward on the line
189
+ if (state !== 'dead' || (now - deadAt) % 280 < 140) kite(kx, ky, ang, S, 1 + pop * 0.35);
190
+ pop *= 0.86;
191
+ // text
192
+ g.fillStyle = S.text; g.textAlign = 'center'; g.textBaseline = 'middle';
193
+ if (state === 'ready') {
194
+ g.font = '900 64px system-ui, sans-serif'; g.fillText('TAP', Wc / 2, Hc * 0.3);
195
+ g.font = '700 26px system-ui, sans-serif'; g.globalAlpha = 0.85; g.fillText('to let go · fly into the next ring', Wc / 2, Hc * 0.3 + 52); g.globalAlpha = 1;
196
+ } else {
197
+ g.font = '900 110px system-ui, sans-serif'; g.globalAlpha = 0.9; g.fillText(String(sim.score), Wc / 2, 110); g.globalAlpha = 1;
198
+ if (state === 'dead') { g.font = '800 28px system-ui, sans-serif'; g.fillText(sim.why === 'fray' ? 'the line frayed · tap to retry' : 'lost in the wind · tap to retry', Wc / 2, 185); }
199
+ }
200
+ if (flash > 0) { g.fillStyle = `rgba(255,77,77,${flash * 0.3})`; g.fillRect(0, 0, Wc, Hc); flash *= 0.88; if (flash < 0.02) flash = 0; }
201
+ g.restore();
202
+ }
203
+
204
+ // ------------------------------------------------------------------ results, share, card
205
+ function shareText() {
206
+ const head = mode.kind === 'practice' ? 'Latchkite practice 🪁' : `Latchkite #${dayNumber(mode.date)} 🪁`;
207
+ const best = mode.kind === 'daily' ? dayStats(mode).best : lastScore;
208
+ return `${head} ${best} catches${mode.kind === 'daily' ? ` (${dayStats(mode).tries} tries)` : ''}\n${bar(best)}\nCan you fly further?`;
209
+ }
210
+ function showOver(newBest) {
211
+ const s = mode.kind === 'daily' ? dayStats(mode) : null;
212
+ $('over-title').textContent = newBest && lastScore > 0 ? `New best: ${lastScore}!` : `${lastScore} catch${lastScore === 1 ? '' : 'es'}`;
213
+ $('over-line').textContent = s ? `Today's best ${s.best} after ${s.tries} tries. Tap the game to fly again.` : 'Practice course. Tap the game to fly again.';
214
+ const it = intents(GAME, shareText(), PATH);
215
+ $('sx').href = it.x; $('sb').href = it.bsky; $('sw').href = it.whatsapp;
216
+ $('over').hidden = false;
217
+ pass.afterWin($('over'), 'over');
218
+ }
219
+ function card() {
220
+ const S = SKINS[skin], c = document.createElement('canvas');
221
+ c.width = 1080; c.height = 1350;
222
+ const x = c.getContext('2d');
223
+ sky(x, 1080, 1350, S);
224
+ x.fillStyle = S.peg;
225
+ [[300, 1040], [700, 820], [420, 560]].forEach(([a, b]) => { x.beginPath(); x.arc(a, b, 14, 0, TAU); x.fill(); });
226
+ x.strokeStyle = S.ring; x.lineWidth = 5; x.setLineDash([12, 12]); x.beginPath(); x.arc(420, 560, 70, 0, TAU); x.stroke(); x.setLineDash([]);
227
+ x.strokeStyle = S.line; x.lineWidth = 5; x.beginPath(); x.moveTo(700, 820); x.lineTo(610, 700); x.stroke();
228
+ x.fillStyle = S.trail; for (let i = 0; i < 10; i++) { x.globalAlpha = i / 12; x.beginPath(); x.arc(780 - i * 10, 930 - i * 12, 6 + i, 0, TAU); x.fill(); } x.globalAlpha = 1;
229
+ kite(610, 690, -0.6, S, 2.6, x);
230
+ const best = mode.kind === 'daily' ? dayStats(mode).best : lastScore;
231
+ x.fillStyle = S.text; x.textAlign = 'center';
232
+ x.font = '900 230px system-ui, sans-serif'; x.fillText(String(best), 540, 420);
233
+ x.font = '700 46px system-ui, sans-serif'; x.fillText('catches in a row', 540, 485);
234
+ x.textAlign = 'left'; x.font = '900 66px system-ui, sans-serif'; x.fillText('LATCHKITE', 80, 130);
235
+ x.globalAlpha = 0.85; x.font = '700 40px system-ui, sans-serif';
236
+ x.fillText(mode.kind === 'daily' ? `Daily course #${dayNumber(mode.date)} · ${mode.date}` : 'Practice course', 80, 190);
237
+ x.globalAlpha = 1; x.font = '800 48px system-ui, sans-serif'; x.fillText('Can you fly further?', 80, 1190);
238
+ x.globalAlpha = 0.75; x.font = '600 32px system-ui, sans-serif'; x.fillText('Play free: cybermaxtools.com/games/latchkite', 80, 1290);
239
+ return c;
240
+ }
241
+ $('share').onclick = async () => share(GAME, shareText(), PATH, await canvasBlob(card()), `latchkite-${mode.date || 'practice'}.png`);
242
+ ['sx', 'sb', 'sw'].forEach((id) => $(id).addEventListener('click', () => count(GAME, 'share', { sx: 'x', sb: 'bsky', sw: 'whatsapp' }[id])));
243
+ $('card').onclick = async () => { download(await canvasBlob(card()), `latchkite-${mode.date || 'practice'}.png`); count(GAME, 'share', 'png'); };
244
+
245
+ // ------------------------------------------------------------------ input, skins, start
246
+ cv.addEventListener('pointerdown', (e) => { e.preventDefault(); input(); });
247
+ cv.addEventListener('keydown', (e) => { if (e.key === ' ' || e.key === 'Enter' || e.key === 'ArrowUp') { e.preventDefault(); input(); } });
248
+ document.addEventListener('keydown', (e) => { if (e.key === ' ' && document.activeElement === document.body) { e.preventDefault(); input(); } });
249
+ $('pass-btn').onclick = () => pass.open('header');
250
+ $('skins-btn').onclick = () => skins.open('header');
251
+ document.addEventListener('click', (e) => {
252
+ const b = e.target.closest('[data-pass]'); if (b) pass.open(b.dataset.pass);
253
+ const k = e.target.closest('[data-skins]'); if (k) skins.open(k.dataset.skins);
254
+ });
255
+ document.addEventListener('visibilitychange', () => { if (document.hidden && state === 'run') last = performance.now(); });
256
+ function renderSkins() {
257
+ const el = $('skins'); el.innerHTML = '';
258
+ for (const [id, s] of Object.entries(SKINS)) {
259
+ const b = document.createElement('button');
260
+ const lock = !canUse(s);
261
+ b.type = 'button'; b.title = `${s.name}${s.tier === 'pass' ? ' (Fun Pass)' : s.tier === 'pack' ? ' (Skin Pack)' : ''}`; b.setAttribute('aria-label', b.title);
262
+ b.style.background = `linear-gradient(135deg, ${s.top} 50%, ${s.k1} 50%)`;
263
+ b.setAttribute('aria-pressed', String(id === skin));
264
+ if (lock) b.classList.add('locked');
265
+ b.onclick = () => {
266
+ if (lock) { if (s.tier === 'pass') pass.open('theme'); else skins.open('dot'); return; }
267
+ skin = id; store('latchkite:skin', id); renderSkins();
268
+ };
269
+ el.appendChild(b);
270
+ }
271
+ $('skins-btn').textContent = skins.owned() ? '🪁 Skins' : '🪁 Skin Pack $1.99';
272
+ }
273
+ const refresh = () => { if (!canUse(SKINS[skin])) { skin = 'dawn'; store('latchkite:skin', 'dawn'); } renderSkins(); renderModes(); };
274
+ pass.onChange(refresh);
275
+ skins.onChange(refresh);
276
+
277
+ // Screenshot helper for scripts/games/render_assets.mjs (a mid-run frame; no effect on normal play).
278
+ window.__cmxShot = async (stage = 1) => {
279
+ start();
280
+ const s = makeSim(todayIso);
281
+ const peek = () => { const c = makeSim(todayIso); Object.assign(c, { peg: s.peg, a: s.a, len: s.len, dir: s.dir, score: s.score, held: 0 }); c.step(true); for (let i = 0; i < 120; i++) { const e = c.step(false); if (e) return e === 'latch'; } return false; };
282
+ while (s.score < 6 && !s.dead) s.step(!s.flying && s.held > 6 && peek());
283
+ for (let i = 0; i < 25; i++) s.step(false);
284
+ sim = s; camY = s.pegs[s.peg].y - 40; state = 'shot';
285
+ if (stage === 2) die();
286
+ };
287
+ window.__cmx = { spin };
288
+ // Demo recorder helper (scripts/studio/demo_video.mjs): plays real taps (pointer events) at catchable moments for n
289
+ // catches, then stops tapping so the round ends on its own. Cosmetic games only; there is no leaderboard to game.
290
+ window.__cmxDemo = (n = 8) => {
291
+ const fits = () => { const c = makeSim('demo'); Object.assign(c, { pegs: sim.pegs, peg: sim.peg, a: sim.a, len: sim.len, dir: sim.dir, score: sim.score, held: 0 }); c.step(true); for (let i = 0; i < HZ * 2; i++) { const e = c.step(false); if (e) return e === 'latch' && c.peg === sim.peg + 1; } return false; };
292
+ const tap = () => cv.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, cancelable: true }));
293
+ if (state !== 'run') tap();
294
+ const iv = setInterval(() => { if (state === 'dead') { clearInterval(iv); return; } if (state === 'run' && sim.score < n && !sim.flying && !pending && sim.held > 8 && fits()) tap(); }, 4);
295
+ };
296
+
297
+ setMode(mode);
298
+ requestAnimationFrame(frame);
latchkite/icon-192.png ADDED
latchkite/icon-512.png ADDED
latchkite/icon-maskable.png ADDED
latchkite/icon.svg ADDED
latchkite/index.html ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
3
+ <title>Latchkite: one-tap kite swing game with a daily course | CyberMax</title>
4
+ <meta name="description" content="Latchkite is a free one-tap arcade game: your kite whirls round a peg, tap to let go and fly into the next catch ring. Same course for everyone each day, rounds of seconds and a shareable score. Works offline, installs on your phone.">
5
+ <link rel="canonical" href="https://cybermaxtools.com/games/latchkite/">
6
+ <meta property="og:type" content="website"><meta property="og:site_name" content="CyberMax">
7
+ <meta property="og:title" content="Latchkite: let go at the right moment">
8
+ <meta property="og:description" content="One tap lets your kite fly. Catch the next peg or lose it to the wind. Everyone gets the same course today. Can you fly further?">
9
+ <meta property="og:url" content="https://cybermaxtools.com/games/latchkite/">
10
+ <meta property="og:image" content="https://cybermaxtools.com/games/latchkite/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630">
11
+ <meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://cybermaxtools.com/games/latchkite/og.png">
12
+ <meta name="theme-color" content="#1B2350">
13
+ <link rel="manifest" href="manifest.webmanifest">
14
+ <link rel="icon" href="icon.svg" type="image/svg+xml"><link rel="apple-touch-icon" href="icon-192.png">
15
+ <meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-title" content="Latchkite">
16
+ <link rel="stylesheet" href="fun.css"><link rel="stylesheet" href="style.css">
17
+ <script>try{var t=localStorage.getItem('cm-theme');if(t)document.documentElement.dataset.theme=t}catch(e){}</script>
18
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"VideoGame","name":"Latchkite","url":"https://cybermaxtools.com/games/latchkite/","image":"https://cybermaxtools.com/games/latchkite/og.png","description":"A free one-tap arcade game: let go of your whirling kite at the right moment to catch the next peg. Same course for everyone each day.","genre":["Arcade","Casual","Hyper-casual"],"gamePlatform":["Web browser","Android","iOS"],"applicationCategory":"Game","operatingSystem":"Any","playMode":"SinglePlayer","publisher":{"@type":"Organization","name":"CyberMax","url":"https://cybermaxtools.com/"},"offers":[{"@type":"Offer","price":"0","priceCurrency":"USD","description":"Free to play"},{"@type":"Offer","price":"1.99","priceCurrency":"USD","description":"Latchkite Skin Pack (6 kites, one-time)"},{"@type":"Offer","price":"2.99","priceCurrency":"USD","description":"CyberMax Fun Pass, monthly"}]}</script>
19
+ </head><body>
20
+ <div class="wrap">
21
+ <header class="top"><a class="brand" href="https://cybermaxtools.com/games/"><svg viewBox="0 0 512 512" aria-hidden="true"><clipPath id="lg"><rect width="512" height="512" rx="116"/></clipPath><g clip-path="url(#lg)"><rect width="512" height="512" fill="#FF6A3D"/><path d="M512 250V512H250Z" fill="#D9481F"/></g><g transform="translate(86 86) scale(3.4)"><path d="M66 27 A27 27 0 1 0 66 73" fill="none" stroke="#11141B" stroke-width="17" stroke-linecap="round"/><rect x="66" y="41" width="20" height="18" rx="4" fill="#11141B"/></g></svg>CyberMax</a>
22
+ <nav><a href="https://cybermaxtools.com/games/">Games</a></nav><button class="icon" id="mute" type="button" aria-label="Sound on or off">🔊</button><button class="icon" id="theme" type="button" aria-label="Switch light or dark">◐</button></header>
23
+ <main>
24
+ <section class="game">
25
+ <div class="headline"><h1>Latchkite <span id="num" class="num"></span> <span class="pro-badge">PASS</span></h1>
26
+ <p class="muted tag">Tap to let go. Fly into the next ring. Same course for everyone today.</p></div>
27
+ <div class="chips" id="modes" role="group" aria-label="Mode"></div>
28
+ <div class="stage"><canvas id="c" width="720" height="960" aria-label="Latchkite game. Tap, click or press Space to let go of the kite." tabindex="0"></canvas></div>
29
+ <div class="row under"><span class="muted small">Today's best <b id="best">0</b> · tries <b id="tries">0</b></span><button class="btn ghost sm" id="install" type="button" hidden>📲 Add to Home Screen</button><button class="btn ghost sm" id="skins-btn" type="button">🪁 Skin Pack $1.99</button><button class="btn pass sm" id="pass-btn" type="button">✨ Fun Pass</button></div>
30
+ <section class="panel over" id="over" hidden aria-live="polite">
31
+ <h2 id="over-title"></h2>
32
+ <p id="over-line" class="muted"></p>
33
+ <div class="row"><button class="btn" id="share" type="button">Share score</button><a class="btn ghost sm" id="sx" target="_blank" rel="noopener">X</a><a class="btn ghost sm" id="sb" target="_blank" rel="noopener">Bluesky</a><a class="btn ghost sm" id="sw" target="_blank" rel="noopener">WhatsApp</a><button class="btn ghost sm" id="card" type="button">Save card</button></div>
34
+ <div class="nudge"><span>New look? The <b>Skin Pack</b> adds 6 kites with their own skies and tails, $1.99 once.</span><button class="btn ghost sm" data-skins="over" type="button">See the skins</button></div>
35
+ </section>
36
+ <div class="row skins" id="skins" aria-label="Kite skin"></div>
37
+ </section>
38
+
39
+ <section class="seo">
40
+ <h2>How to play Latchkite</h2>
41
+ <p>Your kite whirls round a peg on its line. <b>Tap anywhere (or press Space) to let go.</b> The kite flies straight along its swing; if it passes through the dashed catch ring of the next peg, the line latches on and it whirls round that peg. Miss and the wind takes it. Hold on too long and the line frays (watch the ring round the peg). Each catch is a point, skipping a peg counts double, and the spin gets faster as you climb.</p>
42
+ <h3>One course a day</h3>
43
+ <p>Everyone gets the same pegs each UTC day, so scores are directly comparable. Play as many tries as you like; your best counts. Share your score card and dare friends to beat it. Practice gives a fresh random course every try.</p>
44
+ <h3>Free, with optional extras</h3>
45
+ <p>Latchkite is free to play, including the daily course and unlimited practice. The <b>Latchkite Skin Pack</b> ($1.99 once) adds 6 kites (Koi, Aurora, Ember, Paper, Neon, Gold), each with its own sky, line and tail; skins are cosmetic only. The <b>CyberMax Fun Pass</b> ($2.99/month, $19/year or $29.99 for life) unlocks every past daily course and the Dusk and Meadow skies, in every CyberMax game.</p>
46
+ <h3>FAQ</h3>
47
+ <p><b>Is it fair?</b> The game runs on fixed 60 Hz ticks, so the same tap timing gives the same flight on every phone, and every course is checked by a bot that must clear 40 catches. <b>Does it work offline?</b> Yes, after the first visit; install it from your browser menu or the Add to Home Screen button. <b>Do skins change the game?</b> No, they only change how it looks.</p>
48
+ <h2>More free games from CyberMax</h2>
49
+ <div class="more"><a href="https://cybermaxtools.com/games/whirlane/"><b>Whirlane</b><span>One-tap orbit dodger with a daily leaderboard</span></a><a href="https://cybermaxtools.com/games/brimbloom/"><b>Brimbloom</b><span>Stop the bloom inside the ring</span></a><a href="https://cybermaxtools.com/games/pathmoor/"><b>Pathmoor</b><span>Daily path puzzle: light every stone</span></a></div>
50
+ </section>
51
+ </main>
52
+ <footer>© 2026 CyberMax · <a href="https://cybermaxtools.com/games/">Games</a> · <a href="https://cybermaxtools.com/toys/">Toys</a> · <a href="https://cybermaxtools.com/store/">Store</a> · <a href="https://cybermaxtools.com/privacy">Privacy</a> · <a href="https://cybermaxtools.com/terms">Terms</a></footer>
53
+ </div>
54
+ <script type="module" src="game.js"></script>
55
+ </body></html>
latchkite/manifest.webmanifest ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Latchkite: One-tap kite swing: let go, catch the next peg",
3
+ "short_name": "Latchkite",
4
+ "description": "One-tap kite swing: let go, catch the next peg. Free daily game by CyberMax, works offline.",
5
+ "id": "index.html",
6
+ "start_url": "index.html?utm_source=pwa-hf",
7
+ "scope": "./",
8
+ "display": "standalone",
9
+ "orientation": "portrait",
10
+ "background_color": "#1B2350",
11
+ "theme_color": "#1B2350",
12
+ "categories": [
13
+ "games",
14
+ "entertainment"
15
+ ],
16
+ "icons": [
17
+ {
18
+ "src": "icon-192.png",
19
+ "sizes": "192x192",
20
+ "type": "image/png"
21
+ },
22
+ {
23
+ "src": "icon-512.png",
24
+ "sizes": "512x512",
25
+ "type": "image/png"
26
+ },
27
+ {
28
+ "src": "icon-maskable.png",
29
+ "sizes": "512x512",
30
+ "type": "image/png",
31
+ "purpose": "maskable"
32
+ },
33
+ {
34
+ "src": "icon.svg",
35
+ "sizes": "any",
36
+ "type": "image/svg+xml"
37
+ }
38
+ ],
39
+ "screenshots": [
40
+ {
41
+ "src": "shot-phone.png",
42
+ "sizes": "780x1688",
43
+ "type": "image/png",
44
+ "form_factor": "narrow"
45
+ }
46
+ ]
47
+ }
latchkite/og.png ADDED
latchkite/shot-phone.png ADDED

Git LFS Details

  • SHA256: 1b02dc79108f67fc1df2d58d49d9cb45a2100ffdb3fca1c905544dea2556f912
  • Pointer size: 131 Bytes
  • Size of remote file: 143 kB
latchkite/skins.js ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CyberMax game Skin Pack: a one-time cosmetic unlock for ONE game (separate from the Fun Pass, which covers every
2
+ // game's archive + themes). Buy: counted redirect data.cybermaxtools.com/buy/st-<game>-skins-pack?s=game-<game>
3
+ // -> Stripe Payment Link; or the Gumroad listing (licence key). After checkout data.cybermaxtools.com/unlock/<game>-skins
4
+ // checks the order (or the Gumroad licence key) and returns to the game with ?unlock=skins#cmx-pro=<code>.
5
+ // capture() must run BEFORE funpass.init() so the Fun Pass never mistakes a skin-pack code for a pass code.
6
+ // Cosmetic only: skins never change the game, scores or the daily course. (c) 2026 CyberMax.
7
+ import { count, store, toast } from './cmx.js';
8
+
9
+ const DATA = 'https://data.cybermaxtools.com';
10
+ const CODE = /^(cs_(live|test)_[A-Za-z0-9]{10,200}|[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})$/i;
11
+ let cfg = { game: '', name: '', price: '$1.99', gumroad: '', skins: 0 };
12
+ let state = null;
13
+ const subs = [];
14
+ const key = () => `cmx-skins:${cfg.game}`;
15
+
16
+ export const owned = () => !!(state && state.code);
17
+ export function onChange(fn) { subs.push(fn); }
18
+ const emit = () => subs.forEach((f) => { try { f(owned()); } catch { /* game hook */ } });
19
+
20
+ async function check(code) {
21
+ try {
22
+ const r = await fetch(`${DATA}/unlock/${cfg.game}-skins?json=1&session_id=${encodeURIComponent(code)}`);
23
+ const j = await r.json();
24
+ return j && typeof j.pro === 'boolean' ? j.pro : null;
25
+ } catch { return null; }
26
+ }
27
+ export async function unlock(code) {
28
+ const ok = await check(code);
29
+ if (ok) {
30
+ state = store(key(), { code, at: new Date().toISOString() });
31
+ count(cfg.game, 'pro', 'skins-unlocked');
32
+ toast(`${cfg.name} Skin Pack is on. Enjoy the new looks!`, 3500);
33
+ emit(); render();
34
+ } else if (ok === false) toast('That code is not a Skin Pack order for this game.', 3500);
35
+ else toast('Could not reach the unlock check. Try again in a minute.', 3500);
36
+ return ok;
37
+ }
38
+
39
+ /** Call first: game id, display name, skin count, Gumroad URL. Reads ?unlock=skins#cmx-pro=<code> after checkout. */
40
+ export function capture(options) {
41
+ cfg = { ...cfg, ...options };
42
+ state = store(key());
43
+ const q = new URLSearchParams(location.search);
44
+ const m = /[#&]cmx-pro=([^&]+)/.exec(location.hash || '');
45
+ if (q.get('unlock') === 'skins' && m) {
46
+ const code = decodeURIComponent(m[1]);
47
+ q.delete('unlock');
48
+ history.replaceState(null, '', location.pathname + (q.toString() ? `?${q}` : ''));
49
+ if (CODE.test(code)) unlock(code);
50
+ }
51
+ }
52
+
53
+ const buyUrl = (from) => `${DATA}/buy/st-${cfg.game}-skins-pack?s=game-${cfg.game}${from ? `-${from}` : ''}`;
54
+ function dialog() {
55
+ let d = document.getElementById('skinpack');
56
+ if (!d) {
57
+ d = document.createElement('dialog'); d.id = 'skinpack'; d.className = 'funpass';
58
+ document.body.appendChild(d);
59
+ d.addEventListener('click', (e) => { if (e.target === d || e.target.closest('[data-close]')) d.close(); });
60
+ }
61
+ return d;
62
+ }
63
+ function render() {
64
+ const d = dialog();
65
+ const prev = (cfg.preview || []).map((s) => `<span class="sp-dot" style="background:${s}"></span>`).join('');
66
+ if (owned()) {
67
+ d.innerHTML = `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">${cfg.name} Skin Pack</p><h2>All ${cfg.skins} skins are yours. Thank you!</h2>
68
+ <p>Pick one from the colour dots under the game.</p><p class="fp-small">Your code (paste it on another device):</p><code class="fp-code">${state.code}</code></div>`;
69
+ return;
70
+ }
71
+ d.innerHTML = `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">${cfg.name} Skin Pack</p>
72
+ <h2>${cfg.skins} extra looks, ${cfg.price} once</h2><p class="sp-row">${prev}</p>
73
+ <ul class="fp-perks">${(cfg.perks || []).map((p) => `<li>${p}</li>`).join('')}<li>Cosmetic only: same course, same scores for everyone</li><li>Pay once, keep forever, on any device with your code</li></ul>
74
+ <p class="fp-row"><a class="btn pass" href="${buyUrl('')}" rel="nofollow" data-buy>Get the Skin Pack: ${cfg.price}</a>${cfg.gumroad ? ` <a class="btn ghost sm" href="${cfg.gumroad}" rel="nofollow noopener" target="_blank" data-gum>or on Gumroad</a>` : ''}</p>
75
+ <p class="fp-small">Secure Stripe checkout · the skins turn on as soon as you pay · 14-day promise: if it doesn't work as described, we fix it or refund you (<a href="https://cybermaxtools.com/terms#payments" target="_blank" rel="noopener">terms</a>). The <b>Fun Pass</b> is a separate pass for every game's archive and themes.</p>
76
+ <details><summary>Already bought it?</summary><form class="fp-form"><input aria-label="Order code" autocomplete="off" placeholder="Receipt code (cs_live_…) or Gumroad licence key"><button class="btn sm" type="submit">Turn on</button></form></details></div>`;
77
+ d.querySelector('.fp-form').addEventListener('submit', (e) => {
78
+ e.preventDefault();
79
+ const c = e.target.querySelector('input').value.trim();
80
+ if (CODE.test(c)) unlock(c); else toast('Paste the code from your receipt page (cs_live_…) or your Gumroad licence key.', 3500);
81
+ });
82
+ d.querySelector('[data-buy]').addEventListener('click', () => count(cfg.game, 'cta', 'skins-buy'));
83
+ d.querySelector('[data-gum]')?.addEventListener('click', () => count(cfg.game, 'cta', 'skins-gumroad'));
84
+ }
85
+ export function open(from = 'button') {
86
+ render();
87
+ const d = dialog();
88
+ if (d.showModal) d.showModal(); else d.setAttribute('open', '');
89
+ count(cfg.game, 'cta', `skins-open-${from}`);
90
+ }
latchkite/style.css ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Latchkite layout. Game colours live in game.js (SKINS). (c) 2026 CyberMax. */
2
+ .headline h1 .num{color:var(--muted);font-weight:700;font-size:.62em}
3
+ .tag{margin:0 0 12px}
4
+ .stage{display:flex;justify-content:center;margin-top:12px}
5
+ #c{width:100%;max-width:min(480px,calc((100vh - 200px) * .75));min-width:260px;aspect-ratio:3/4;border-radius:24px;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;cursor:pointer;box-shadow:var(--shadow)}
6
+ .under{justify-content:center;margin:12px 0}
7
+ .over{margin:12px 0}.over h2{margin:0 0 4px}
8
+ .skins{justify-content:center;margin:8px 0}
9
+ .skins button{width:36px;height:36px;border-radius:50%;border:3px solid var(--line);cursor:pointer;position:relative}
10
+ .skins button[aria-pressed=true]{border-color:var(--ink)}
11
+ .skins button.locked::after{content:"🔒";position:absolute;right:-6px;bottom:-6px;font-size:12px}
12
+ .sp-row{display:flex;gap:6px;margin:0 0 10px}.sp-dot{width:26px;height:26px;border-radius:50%;display:inline-block;border:2px solid var(--line)}
13
+ .fp-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
latchkite/sw.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CyberMax game service worker: the game works offline after the first visit. Cache-first for the game's own files,
2
+ // network-first for the page itself (so updates arrive), never caches API calls or other sites. (c) 2026 CyberMax.
3
+ const GAME = 'latchkite';
4
+ const CACHE = `cmx-${GAME}-53d699118f`;
5
+ const FILES = ["index.html", "cmx.js", "core.js", "fun.css", "funpass.js", "game.js", "icon-192.png", "icon-512.png", "icon-maskable.png", "icon.svg", "index.html", "manifest.webmanifest", "skins.js", "style.css"];
6
+
7
+ self.addEventListener('install', (e) => {
8
+ e.waitUntil(caches.open(CACHE).then((c) => c.addAll(FILES)).then(() => self.skipWaiting()));
9
+ });
10
+ self.addEventListener('activate', (e) => {
11
+ e.waitUntil(caches.keys().then((keys) => Promise.all(keys.filter((k) => k.startsWith(`cmx-${GAME}-`) && k !== CACHE).map((k) => caches.delete(k)))).then(() => self.clients.claim()));
12
+ });
13
+ self.addEventListener('fetch', (e) => {
14
+ const u = new URL(e.request.url);
15
+ if (e.request.method !== 'GET' || u.origin !== location.origin || !u.pathname.startsWith(new URL(self.registration.scope).pathname)) return;
16
+ if (e.request.mode === 'navigate') {
17
+ e.respondWith(fetch(e.request).then((r) => { const c = r.clone(); caches.open(CACHE).then((x) => x.put(u.pathname, c)); return r; })
18
+ .catch(() => caches.match(u.pathname).then((r) => r || caches.match('index.html'))));
19
+ return;
20
+ }
21
+ e.respondWith(caches.match(e.request, { ignoreSearch: true }).then((r) => r || fetch(e.request).then((res) => {
22
+ if (res.ok) { const c = res.clone(); caches.open(CACHE).then((x) => x.put(e.request, c)); }
23
+ return res;
24
+ })));
25
+ });