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:
parent
0d3181ec99
commit
4a2309b589
18 changed files with 4286 additions and 0 deletions
220
public/style.css
Normal file
220
public/style.css
Normal 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; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue