/* The one stylesheet for every Puzzling game. Change it here and all eight change.
   Rules it carries (see the house standards):
   - white ground, neutral charcoal ink, one blue accent for the next action
   - green and amber only where something happened; wrong is neutral; no red
   - raised = tappable, flat = read-only; exactly one filled accent button per screen
   - no dashed borders anywhere
   - light and dark */

:root {
  --bg: #ffffff; --surface: #f7f7f9; --ink: #1c1c1e; --muted: #6b6b70; --line: #e4e4e8;
  --accent: #2a6fcf; --accent-ink: #ffffff; --accent-edge: #1c519c; --accent-soft: #e8f0fc; --accent-pulse: #cfe0fa;
  --now: var(--accent);
  --good: #1f8a4c; --good-soft: #e6f6ec;
  --part: #b4730a; --part-soft: #fbf1df;
  --btn: #f1f1f4; --btn-line: #d6d6dc;
  --display: "Bricolage Grotesque", "Trebuchet MS", ui-sans-serif, sans-serif;
  --body: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 16px; --radius-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --surface: #1c1c1f; --ink: #f2f2f4; --muted: #9d9da4; --line: #2e2e33;
    --accent: #7fb0f0; --accent-ink: #121214; --accent-edge: #5a8ed0; --accent-soft: #1f2d40; --accent-pulse: #2b4466;
    --good: #5fcf8a; --good-soft: #1b2f24; --part: #e8b04b; --part-soft: #332a18;
    --btn: #27272b; --btn-line: #3d3d43; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121214; --surface: #1c1c1f; --ink: #f2f2f4; --muted: #9d9da4; --line: #2e2e33;
  --accent: #7fb0f0; --accent-ink: #121214; --accent-edge: #5a8ed0; --accent-soft: #1f2d40; --accent-pulse: #2b4466;
  --good: #5fcf8a; --good-soft: #1b2f24; --part: #e8b04b; --part-soft: #332a18;
  --btn: #27272b; --btn-line: #3d3d43; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; padding-inline: 16px; padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)); -webkit-tap-highlight-color: transparent; }
button, .tile, .key { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.app, .stack { display: flex; flex-direction: column; }
.app { max-width: 440px; margin-inline: auto; gap: 12px; }
.stack { gap: 10px; }

/* ---- header: the game's name, the How to play button, and the line that says which puzzle this is ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
h1 { font-family: var(--display); font-weight: 800; font-size: 1.5rem; margin: 0; letter-spacing: -0.02em; }
/* How to play: a labelled pill, so a first-time player knows what it does. The ? stays for those who look for it. */
.howto { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 5px 16px 5px 6px; border-radius: 999px; border: 1.5px solid var(--btn-line); background: var(--surface); color: var(--ink); font-family: var(--body); font-weight: 800; font-size: 0.95rem; white-space: nowrap; cursor: pointer; box-shadow: 0 1.5px 0 var(--btn-line); }
.howto .qmark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--display); font-weight: 800; font-size: 1.05rem; line-height: 1; }
.howto:hover { border-color: var(--muted); }
.daily { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 14px; font-size: 0.88rem; color: var(--muted); min-height: 1.4em; }
.daily > span { white-space: nowrap; }
.daily b { color: var(--ink); font-weight: 800; }
.links { display: flex; gap: 14px; flex: none; margin-left: auto; }
.daily a { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; padding: 6px 0; }
.daily a:hover, .daily a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* ---- progress: "Puzzle 1 of 5", then the pips. full = all points, half = some, hollow = none, accent = this one. ---- */
.progress { display: flex; align-items: center; gap: 10px; }
.progress .count { flex: none; font-size: 0.82rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress .pips { flex: 1; }
.pips { display: flex; gap: 6px; }
.pip { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.pip.now { background: var(--now); }
.pip.full { background: var(--good); }
.pip.half { background: linear-gradient(90deg, var(--part) 50%, var(--line) 50%); }
.pip.zero { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }

/* ---- the instruction line: what to find, then what to do. Ink, not grey, because it is read. ---- */
.instr { margin: 0; padding: 8px 14px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-weight: 600; font-size: 0.92rem; line-height: 1.35; text-align: center; text-wrap: balance; }
.instr::before { content: "Instructions"; display: block; font-family: var(--body); font-size: 0.92rem; font-weight: 800; color: var(--accent); margin-bottom: 1px; }
.instr:empty { display: none; }
/* When the instruction appears or changes, the block pulses once to draw the eye, then settles. */
.instr.pulse { animation: instrPulse 0.7s ease-out 0.3s 1 both; }
@keyframes instrPulse {
  0% { box-shadow: 0 0 0 0 transparent; background: var(--accent-soft); }
  35% { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-pulse); }
  100% { box-shadow: 0 0 0 0 transparent; background: var(--accent-soft); }
}
.lead { margin: 0; color: var(--muted); }
#shell .lead, #shell .note { text-align: center; text-wrap: balance; }
.note { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* ---- labels. Every part of a puzzle says what it is in a small grey label ("Clue 1", "The letters",
   "Your answer"), then shows the thing. Clues are sentences, so they are set in the reading face;
   the bold display face is kept for the puzzle's own letters and words. ---- */
.lbl, .clue span { display: block; font-family: var(--body); font-size: 0.82rem; font-weight: 700; color: var(--muted); text-align: center; }
.group { display: flex; flex-direction: column; gap: 6px; }
.clues { display: flex; flex-direction: column; gap: 10px; }
.clue { margin: 0; display: flex; flex-direction: column; gap: 1px; text-align: center; text-wrap: balance; }
.clue b { font-family: var(--body); font-weight: 700; font-size: 1.15rem; line-height: 1.3; }
.clue b.w { font-family: var(--display); font-weight: 800; letter-spacing: 0.06em; }

/* ---- tiles and words. Flat when read-only; raised (button.tile) when tappable. ---- */
.tiles { display: flex; flex-direction: column; gap: 8px; }
.tiles.stack { gap: 6px; }
.tiles.stack .tile { padding: 10px 14px; font-size: 1.2rem; text-align: center; }
.tiles.wrap { flex-direction: row; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tiles.wrap .tile { flex: 1 1 auto; padding: 10px 14px; font-size: 1.15rem; text-align: center; }
.tiles.row { flex-direction: row; gap: 6px; justify-content: center; }
.tile { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 13px 16px; font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: 0.04em; text-transform: uppercase; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.tile .link { color: var(--accent); }
.tiles.solved .tile, .tile.solved { border-color: var(--good); background: var(--good-soft); }
.tiles.missed .tile, .tile.missed { background: var(--surface); color: var(--muted); }
.tiles.missed .tile .link { color: var(--ink); }
.tiles.row .tile { flex: 1; max-width: 58px; aspect-ratio: 1; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 1.55rem; letter-spacing: 0; }
button.tile { cursor: pointer; background: var(--btn); border-color: var(--btn-line); box-shadow: 0 1.5px 0 var(--btn-line); font-family: var(--display); }
button.tile:disabled { cursor: default; color: var(--muted); box-shadow: none; }
button.tile:not(:disabled):active { transform: translateY(1.5px); box-shadow: none; }
button.tile.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 1.5px 0 var(--accent-edge); }
button.tile.hinted { border-color: var(--part); background: var(--part-soft); }
.words { display: flex; flex-direction: column; gap: 8px; }
.words.wrap { flex-direction: row; flex-wrap: wrap; gap: 6px; justify-content: center; }
.words.wrap .word { flex: 1 1 auto; padding: 10px 14px; font-size: 1.15rem; text-align: center; }
.word { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 13px 16px; font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; }

/* ---- typing. The answer box carries the accent border: this is where you act. ---- */
form { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.entry { display: flex; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 1px; }
.field .q { font-weight: 700; font-size: 1.15rem; line-height: 1.3; text-align: center; text-wrap: balance; margin-bottom: 6px; }
.field .lbl + input { margin-top: 5px; }
.field + .field { margin-top: 8px; }
input[type="text"] { width: 100%; min-width: 0; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 12px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.entry input[type="text"] { flex: 1; }
input[type="text"]::placeholder { color: var(--muted); font-family: var(--body); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 1rem; }
input[type="text"]:focus-visible { outline: none; border-color: var(--accent); }
input[type="text"].wrong { border-color: var(--muted); }
input[type="text"]:disabled { border-color: var(--good); background: var(--good-soft); }
.hint { margin: 0; text-align: center; font-family: var(--mono); font-weight: 700; letter-spacing: 0.14em; color: var(--part); font-size: 1.05rem; }

/* ---- buttons: filled and raised, so a control never reads as a label. One accent-filled button per screen. ---- */
button, .btn { font-family: var(--body); font-weight: 800; font-size: 0.95rem; border-radius: var(--radius); min-height: 48px; padding: 10px 16px; border: 1px solid var(--btn-line); background: var(--btn); color: var(--ink); box-shadow: 0 1.5px 0 var(--btn-line); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none; }
button:not(:disabled):active, .btn:active { transform: translateY(1.5px); box-shadow: none; }
button:disabled { cursor: default; opacity: 0.45; box-shadow: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-edge); }
.quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); min-height: 40px; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.quiet:hover { color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > button, .row > .btn { flex: 1; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { font-weight: 600; min-height: 48px; }
button.confirm { border-color: var(--part); background: var(--part-soft); color: var(--part); }
.opt.wrong { background: var(--surface); border-color: var(--line); color: var(--muted); box-shadow: none; }
.opt.wrong::before { content: "\2715"; font-size: 0.75rem; }
/* The letter keys sit in the same places as on a phone keyboard. */
.keys { display: flex; flex-direction: column; gap: 5px; }
.keyrow { display: flex; gap: 4px; justify-content: center; }
.keyrow .key { flex: 1 1 0; max-width: 40px; }
.key { min-height: 44px; padding: 0; font-family: var(--display); font-weight: 800; font-size: 1rem; border-radius: var(--radius-sm); min-width: 0; }

/* ---- the status line: what happened, in the state colour, with an icon so colour is never alone ---- */
.status { margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; min-height: 2.3em; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.92rem; border: 1px solid transparent; }
.status:empty { padding: 0; min-height: 1.4em; }
.status::before { content: ""; display: none; width: 18px; height: 18px; border-radius: 50%; flex: none; place-items: center; font-size: 0.65rem; line-height: 1; color: var(--bg); }
.status.good { background: var(--good-soft); color: var(--good); }
.status.good::before { content: "\2713"; display: grid; background: var(--good); }
.status.bad { background: var(--surface); border-color: var(--line); color: var(--ink); }
.status.bad::before { content: "\2715"; display: grid; background: var(--muted); }
.status.part { background: var(--part-soft); color: var(--part); }
.status.note { background: var(--surface); color: var(--muted); }
.status.part::before { content: "\2713"; display: grid; background: var(--part); }

/* ---- the clock ---- */
.clock { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 5px; }
.bar.low span { background: var(--part); }
.secs { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }

/* ---- the ladder of solved words ---- */
.rungs { margin: 0; font-family: var(--mono); font-weight: 700; font-size: 0.9rem; color: var(--muted); letter-spacing: 0.06em; text-align: center; }
.rungs b { color: var(--good); }
.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
/* Each answer on its own line, with its clue underneath. */
.ladder li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 9px 14px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); }
.ladder .w { font-family: var(--display); font-weight: 800; font-size: 1.1rem; letter-spacing: 0.06em; overflow-wrap: anywhere; min-width: 0; }
.ladder .d { color: var(--muted); font-size: 0.88rem; line-height: 1.3; min-width: 0; }
.ladder li.got { border-color: var(--good); background: var(--good-soft); }
.ladder li.miss .w { color: var(--muted); }

/* ---- results ---- */
.big { text-align: center; font-family: var(--display); font-weight: 800; font-size: 3.2rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.big small { font-size: 1.1rem; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.recap { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.recap li { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 0.82rem; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recap li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.recap li span:last-child { color: var(--muted); white-space: nowrap; }

/* ---- the start card for timed games, and the past-puzzles list ---- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.card .toggle { text-align: left; }
.card small { font-family: var(--body); font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.card b { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 0.95rem; cursor: pointer; }
.toggle small { color: var(--muted); font-weight: 500; font-size: 0.82rem; display: block; font-family: var(--body); text-transform: none; letter-spacing: 0; }
.toggle input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 14px; background: var(--btn-line); position: relative; cursor: pointer; transition: background 0.15s; }
.toggle input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::before { transform: translateX(18px); }
.toggle input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h2 { font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin: 6px 0 0; letter-spacing: -0.01em; }
.days { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.days a { display: grid; grid-template-columns: 5.2em 1fr auto; gap: 10px; align-items: baseline; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.days a:hover, .days a:focus-visible { background: var(--surface); outline: none; }
.days .n { font-family: var(--mono); font-weight: 700; font-size: 0.88rem; }
.days .d { color: var(--muted); font-size: 0.92rem; }
.days .s { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.days .s.done { color: var(--good); font-weight: 700; }
.days a.today .n { color: var(--accent); }

/* ---- How to play ---- */
dialog.help { max-width: 420px; width: calc(100% - 32px); max-height: 90dvh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); padding: 16px; margin: auto; font-size: 0.95rem; }
dialog.help::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog.help h2 { margin: 0 0 10px; font-size: 1.3rem; }
dialog.help .goal { font-weight: 700; margin: 0 0 10px; }
dialog.help ul { margin: 0 0 12px; padding-left: 1.1rem; }
dialog.help li { margin-bottom: 4px; }
dialog.help .example { background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; font-size: 0.95rem; }
dialog.help .example b { font-family: var(--display); letter-spacing: 0.04em; }
dialog.help h3 { font-family: var(--display); font-size: 1rem; margin: 16px 0 8px; }
dialog.help .settings { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
dialog.help .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
dialog.help .foot a { color: var(--muted); font-size: 0.9rem; }
dialog.help .ver { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

/* ---- home page ---- */
.games { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.games a { display: block; background: var(--surface); border-radius: var(--radius); padding: 13px 16px; color: inherit; text-decoration: none; }
.games a:hover, .games a:focus-visible { background: var(--accent-soft); outline: none; }
.games a { display: grid !important; grid-template-columns: 48px 1fr; column-gap: 14px; align-items: start; }
.games .appicon { grid-row: span 3; width: 48px; height: 48px; border-radius: 11px; }
.games a > :not(.appicon) { grid-column: 2; }
.games h2 { margin: 0 0 4px; font-size: 1.2rem; }
.games p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.games .skills { display: block; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--accent); font-weight: 700; }

@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.shake { animation: shake 0.3s; }
@media (prefers-reduced-motion: reduce) { .shake, .instr.pulse, .tile.flip, .celebrate *, .reveal * { animation: none !important; } .toggle input, .toggle input::before { transition: none; } }

/* Short screens (older or smaller phones): a notch tighter everywhere, so a puzzle fits without scrolling. */
@media (max-height: 720px) {
  body { padding-block: calc(8px + env(safe-area-inset-top, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)); line-height: 1.38; }
  .app { gap: 8px; }
  .stack { gap: 8px; }
  h1 { font-size: 1.35rem; }
  .howto { min-height: 40px; font-size: 0.9rem; padding: 4px 14px 4px 5px; }
  .howto .qmark { width: 27px; height: 27px; font-size: 0.95rem; }
  .daily { font-size: 0.84rem; }
  .instr { font-size: 0.88rem; padding: 6px 12px 8px; }
  .instr::before { margin-bottom: 0; font-size: 0.95rem; }
  .clue b, .field .q { font-size: 1.08rem; }
  .clues { gap: 8px; }
  .tiles.row .tile { max-width: 52px; font-size: 1.4rem; }
  .tile, .word { padding: 10px 14px; }
  .tiles.wrap .tile, .words.wrap .word { padding: 8px 12px; font-size: 1.05rem; }
  .tiles.stack { gap: 5px; }
  .tiles.stack .tile { padding: 8px 12px; font-size: 1.1rem; }
  button, .btn { min-height: 44px; }
  .opt { min-height: 44px; }
  .key { min-height: 40px; }
  .keys { gap: 4px; }
  .keyrow { gap: 3px; }
  .status { min-height: 2em; padding: 6px 12px; font-size: 0.9rem; }
  .ladder li { padding: 7px 12px 8px; }
  .recap li { padding: 7px 0; }
  .card { padding: 14px; }
}

/* ---- first-visit welcome card (replaces the pop-up) ---- */
.welcome { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 10px 14px 12px; text-align: center; }
.welcome > b { display: block; color: var(--accent); font-weight: 800; font-size: 0.92rem; margin-bottom: 2px; }
/* While the fuller first-visit block shows, the short instruction line waits, so there is one blue block. */
.first-visit .instr { display: none; }
.welcome p { margin: 0; font-weight: 600; font-size: 0.95rem; text-wrap: balance; }
.welcome .example { background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 8px 0 0; font-size: 0.9rem; }
.welcome .example b { font-family: var(--display); letter-spacing: 0.04em; }
button.link { background: none; border: 0; box-shadow: none; min-height: 0; padding: 8px 4px 0; color: var(--accent); font-weight: 700; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; }
button.link:active { transform: none; }

/* ---- the correct-answer moment: tiles and answer rows flip to green one after another, then the tick pops ---- */
@keyframes flipGood { 0% { transform: rotateX(0); } 45% { transform: rotateX(90deg); } 55% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes pop { 0% { transform: scale(0.5); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.celebrate .tiles .tile, .celebrate .tiles.solved .tile, .celebrate .ladder li.got, .celebrate .words .word { animation: flipGood 0.45s ease both; }
.celebrate .tiles .tile:nth-child(2), .celebrate .ladder li:nth-child(2), .celebrate .words .word:nth-child(2) { animation-delay: 0.07s; }
.celebrate .tiles .tile:nth-child(3), .celebrate .ladder li:nth-child(3), .celebrate .words .word:nth-child(3) { animation-delay: 0.14s; }
.celebrate .tiles .tile:nth-child(4), .celebrate .ladder li:nth-child(4) { animation-delay: 0.21s; }
.celebrate .tiles .tile:nth-child(5) { animation-delay: 0.28s; }
.celebrate .tiles .tile:nth-child(6) { animation-delay: 0.35s; }
.celebrate .status.good { animation: pop 0.35s 0.4s ease both; }
/* A correct move: the tile that changed flips once, green at the turn, then settles. */
@keyframes flipMove { 0% { transform: rotateX(0); } 40%, 50% { transform: rotateX(90deg); background: var(--good-soft); border-color: var(--good); } 80% { transform: rotateX(0); background: var(--good-soft); border-color: var(--good); } 100% { transform: rotateX(0); } }
.tiles .tile.flip { animation: flipMove 0.6s ease; }
.tiles .tile.flip:nth-child(2) { animation-delay: 0.05s; } .tiles .tile.flip:nth-child(3) { animation-delay: 0.1s; } .tiles .tile.flip:nth-child(4) { animation-delay: 0.15s; } .tiles .tile.flip:nth-child(5) { animation-delay: 0.2s; }

/* ---- the score reveal on results: pips pop in one by one, the score counts up, then the words appear ---- */
.reveal .pip.full, .reveal .pip.half, .reveal .pip.zero { animation: pop 0.3s ease both; }
.reveal .lead { animation: pop 0.35s var(--after, 1.2s) ease both; }
.reveal .streakRow { animation: pop 0.35s calc(var(--after, 1.2s) + 0.15s) ease both; }
.reveal .status { animation: pop 0.35s calc(var(--after, 1.2s) + 0.3s) ease both; }

/* ---- streaks ---- */
.streakRow { margin: 0; text-align: center; }
.streak { display: inline-flex; align-items: center; gap: 6px; background: var(--part-soft); color: var(--part); font-weight: 800; border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; }
.streak::before { content: ""; width: 10px; height: 14px; background: currentColor; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; clip-path: polygon(50% 0, 100% 55%, 85% 100%, 15% 100%, 0 55%); }

/* ---- home page: today's state on each card ---- */
.games .state { display: block; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 0.85rem; font-weight: 700; }
.games .state.done { color: var(--good); }
.games .state.done::before { content: "\2713\00a0"; }
.games .state.todo { color: var(--accent); }
