Files
tiennm99 629b513c91 feat(games): move /wordle and /loldle to the web games and add /loldledaily
/wordle and /loldle now send the wordle and loldle BotFather games in an
unlimited mode: each player gets their own word or champion, saved after
every guess, with a New game button. Cards the bot did not record as
unlimited, including the daily cards, play the daily puzzle. The helper
commands keep working on the player's round.

/loldledaily mirrors /wordledaily: one champion per day at 07:00 ICT,
subscribe and unsubscribe, the morning recap and the live group results.

The daily and unlimited machinery is shared in util/guessgame, the old
in-chat wordle module is removed, and a one-time startup migration carries
each player's stats and unfinished round over without changing old data.
2026-10-10 09:29:48 +07:00

257 lines
7.5 KiB
CSS

:root {
--bg: #ffffff;
--surface: #ffffff;
--text: #1a1a1b;
--muted: #6b6f76;
--border: #d3d6da;
--tile-border: #878a8c;
--key: #d3d6da;
--key-text: #1a1a1b;
--correct: #6aaa64;
--present: #c9b458;
--absent: #787c7e;
--mark-text: #ffffff;
--accent: #2481cc;
--accent-text: #ffffff;
--overlay: rgba(0, 0, 0, .5);
--radius: 12px;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #121213;
--surface: #1e1f20;
--text: #f8f8f8;
--muted: #9aa0a6;
--border: #3a3a3c;
--tile-border: #565758;
--key: #818384;
--key-text: #f8f8f8;
--correct: #538d4e;
--present: #b59f3b;
--absent: #3a3a3c;
--accent: #5aa7e6;
--accent-text: #0e1621;
--overlay: rgba(0, 0, 0, .65);
}
}
/* Colour-blind-safe palette, toggled from the header. */
body.contrast {
--correct: #f5793a;
--present: #85c0f9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
background: var(--bg);
color: var(--text);
font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
-webkit-text-size-adjust: 100%;
touch-action: manipulation;
}
/* The page fills the viewport exactly: the board takes the height the
header and keyboard leave, so Enter never falls below the fold. */
.app {
max-width: 500px;
margin: 0 auto;
padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
height: 100%;
display: flex;
flex-direction: column;
gap: 8px;
}
.top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 0 8px 6px;
border-bottom: 1px solid var(--border);
}
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 4px; text-align: center; }
h3 { font-size: .9rem; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.title p { margin: 0; font-size: .85rem; }
.muted { color: var(--muted); }
.lead { margin-top: 0; font-size: 1.05rem; }
.top-actions { display: flex; gap: 4px; }
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px;
}
button {
font: inherit;
border-radius: 8px;
border: 1px solid var(--border);
background: var(--surface);
color: var(--text);
padding: 10px 16px;
min-height: 44px;
cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.icon { min-width: 40px; min-height: 40px; padding: 4px 8px; font-size: 1.15rem; line-height: 1; }
button.icon[aria-pressed="true"] { background: var(--key); }
button.new-top { min-height: 40px; padding: 4px 10px; font-size: .85rem; }
button.new-top.confirm { border-color: var(--absent); background: var(--key); }
#screen-game { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.board-wrap { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* app.js sets the width (and --tile) from the space .board-wrap has. */
.board {
display: grid;
grid-template-rows: repeat(6, 1fr);
gap: 5px;
width: min(330px, 100%);
}
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.row.shake { animation: shake .4s; }
.tile {
aspect-ratio: 1 / 1;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid var(--border);
font-size: calc(var(--tile, 62px) * .5);
font-weight: 700;
text-transform: uppercase;
user-select: none;
}
.tile.filled { border-color: var(--tile-border); animation: pop .1s; }
.tile.correct { --mark: var(--correct); }
.tile.present { --mark: var(--present); }
.tile.absent { --mark: var(--absent); }
.tile.correct, .tile.present, .tile.absent { border-color: transparent; color: var(--mark-text); background: var(--mark); }
/* The colour lands at the half-turn, so each tile reveals its mark in turn. */
.tile.flip { animation: reveal .5s ease both; }
.keyboard { flex: none; display: flex; flex-direction: column; gap: 8px; user-select: none; }
.krow { display: flex; gap: 6px; justify-content: center; }
.key {
flex: 1;
max-width: 44px;
min-height: 56px;
padding: 0;
border: 0;
border-radius: 4px;
background: var(--key);
color: var(--key-text);
font-weight: 700;
font-size: 1rem;
text-transform: uppercase;
}
.key.wide { flex: 1.5; max-width: 68px; font-size: .78rem; }
.key.correct { background: var(--correct); color: var(--mark-text); }
.key.present { background: var(--present); color: var(--mark-text); }
.key.absent { background: var(--absent); color: var(--mark-text); }
.krow .spacer { flex: .5; max-width: 22px; }
.toast {
position: fixed;
left: 50%;
top: 72px;
transform: translateX(-50%);
max-width: calc(100% - 32px);
margin: 0;
padding: 10px 16px;
border-radius: 6px;
background: var(--text);
color: var(--bg);
font-weight: 600;
text-align: center;
z-index: 20;
}
.overlay {
position: fixed;
inset: 0;
background: var(--overlay);
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
z-index: 10;
}
.modal {
position: relative;
width: min(420px, 100%);
max-height: 100%;
overflow-y: auto;
background: var(--surface);
color: var(--text);
border-radius: var(--radius);
padding: 20px 16px 16px;
}
.modal .close { position: absolute; top: 8px; right: 8px; border: 0; }
.answer { text-align: center; margin: 4px 0 0; font-size: 1.1rem; letter-spacing: .12em; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.stats strong { display: block; font-size: 1.8rem; font-weight: 600; }
.stats span { font-size: .75rem; color: var(--muted); }
.dist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dist li { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.dist .n { width: 1em; text-align: right; }
.dist .bar {
min-width: 8%;
padding: 2px 6px;
background: var(--absent);
color: var(--mark-text);
text-align: right;
font-weight: 700;
}
.dist li.today .bar { background: var(--correct); }
.next { text-align: center; margin: 16px 0 8px; }
.next strong { font-variant-numeric: tabular-nums; }
#next-btn { display: block; margin: 0 auto 8px; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hint { text-align: center; font-size: .85rem; margin: 12px 0 0; }
.offscreen { position: fixed; top: -1000px; left: 0; opacity: 0; }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
@media (max-height: 640px) {
.key { min-height: 48px; }
.keyboard { gap: 6px; }
.top { padding-bottom: 4px; }
h1 { font-size: 1.15rem; }
}
@keyframes pop { 50% { transform: scale(1.1); } }
@keyframes reveal {
0% { transform: rotateX(0); background: transparent; border-color: var(--tile-border); color: var(--text); }
49% { transform: rotateX(88deg); background: transparent; border-color: var(--tile-border); color: var(--text); }
50% { transform: rotateX(90deg); background: var(--mark); border-color: transparent; color: var(--mark-text); }
100% { transform: rotateX(0); background: var(--mark); border-color: transparent; color: var(--mark-text); }
}
@keyframes shake {
20%, 60% { transform: translateX(-5px); }
40%, 80% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
.tile.flip, .tile.filled, .row.shake { animation: none; }
}