@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/atkinson-400.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/atkinson-700.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/bricolage.woff2") format("woff2"); }
/* Layout idea: the board is the page. Quiet paper around it, one column on a phone,
   board left and reference panel right on a wide screen. Colour never works alone:
   every patch also has a letter and a heavy outline. */
/* Colours: four palettes, the same ones as oddlywired.com, each in light and dark.
   theme.js stamps data-theme and data-mode on <html> before the page paints.
   Page colours change with the palette. Patch colours change with light or dark only,
   so the board stays as easy to read in every palette.
   In dark mode the patches are mid-tones with dark ink on them, not dark tints:
   every patch clears 4.5:1 against the page.
   Some pairs look alike (green, teal and stone in light mode), so app.js (colourPatches) picks
   which colour each patch gets, keeping look-alikes away from each other. */
:root {
  color-scheme: light;
  --display: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Atkinson Hyperlegible", Verdana, "Segoe UI", sans-serif;
  --chip: #E6D9C3;
  /* Ocean & Violet, light (the default) */
  --paper: #F2F4F7; --surface: #F9FAFB; --ink: #2E333B; --ink-soft: #525A65;
  --line: rgba(46, 51, 59, 0.3); --accent: #2A6A94; --on-accent: #FFFFFF; --warm: #6B4FA0;
  /* Light mode, every palette */
  --clash: #A3341F;
  --g0: #BFD3C1; --g1: #B9D3E6; --g2: #D2C3E3; --g3: #E6C3A5;
  --g4: #EBDD9A; --g5: #EDBFC4; --g6: #A9D6D0; --g7: #D5D0C6;
  --on-tint: var(--ink); --edge: var(--ink); --grid: var(--line);
  --flag: #A3341F; --on-flag: #FFFDF9; --target: var(--warm); --target-ring: var(--surface);
}
:root[data-theme="sage"] {
  --paper: #F5F5F5; --surface: #FAFAF7; --ink: #333333; --ink-soft: #5C5C5C;
  --line: rgba(51, 51, 51, 0.3); --accent: #4F6C5C; --on-accent: #FFFFFF; --warm: #80613D;
}
:root[data-theme="pine"] {
  --paper: #F7F4EC; --surface: #FBF9F3; --ink: #333333; --ink-soft: #5C5B54;
  --line: rgba(51, 51, 51, 0.3); --accent: #5F694F; --on-accent: #FFFFFF; --warm: #7F6137;
}
:root[data-theme="amethyst"] {
  --paper: #F6F4F5; --surface: #FAF8F9; --ink: #333333; --ink-soft: #5C5559;
  --line: rgba(51, 51, 51, 0.3); --accent: #795A6D; --on-accent: #FFFFFF; --warm: #6A4A2E;
}
:root[data-mode="dark"] {
  color-scheme: dark;
  /* Ocean & Violet, dark */
  --paper: #161C26; --surface: #1F2733; --ink: #E3E8EF; --ink-soft: #BEC6D1;
  --line: rgba(227, 232, 239, 0.32); --accent: #8CBCDD; --on-accent: #161C26; --warm: #B9A3E3;
  /* Dark mode, every palette */
  --clash: #FFB4A0;
  --g0: #579B6F; --g1: #84ADDB; --g2: #9F86D4; --g3: #C4784A;
  --g4: #C6B35C; --g5: #D07490; --g6: #5EB4BE; --g7: #B8B1A6;
  --on-tint: #0E120F; --edge: #0B0E0C; --grid: rgba(11, 14, 12, 0.4);
  --flag: #6B1208; --on-flag: #FFF1EC; --target: #0E120F; --target-ring: #FFF6E8;
}
/* If the script has not run, follow the device. */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    color-scheme: dark;
    /* Ocean & Violet, dark */
    --paper: #161C26; --surface: #1F2733; --ink: #E3E8EF; --ink-soft: #BEC6D1;
    --line: rgba(227, 232, 239, 0.32); --accent: #8CBCDD; --on-accent: #161C26; --warm: #B9A3E3;
    /* Dark mode, every palette */
    --clash: #FFB4A0;
    --g0: #579B6F; --g1: #84ADDB; --g2: #9F86D4; --g3: #C4784A;
    --g4: #C6B35C; --g5: #D07490; --g6: #5EB4BE; --g7: #B8B1A6;
    --on-tint: #0E120F; --edge: #0B0E0C; --grid: rgba(11, 14, 12, 0.4);
    --flag: #6B1208; --on-flag: #FFF1EC; --target: #0E120F; --target-ring: #FFF6E8;
  }
}
:root[data-theme="sage"][data-mode="dark"] {
  --paper: #1F231F; --surface: #292E29; --ink: #E8E6E1; --ink-soft: #C6C4BE;
  --line: rgba(232, 230, 225, 0.32); --accent: #8FB4A0; --on-accent: #1F231F; --warm: #C9A97E;
}
:root[data-theme="pine"][data-mode="dark"] {
  --paper: #22241C; --surface: #2B2E24; --ink: #E8E6DD; --ink-soft: #C8C6BA;
  --line: rgba(232, 230, 221, 0.32); --accent: #A9B58E; --on-accent: #22241C; --warm: #CBAA74;
}
:root[data-theme="amethyst"][data-mode="dark"] {
  --paper: #232027; --surface: #2C2831; --ink: #E6E4EA; --ink-soft: #C6C2CA;
  --line: rgba(230, 228, 234, 0.32); --accent: #C0A0B2; --on-accent: #232027; --warm: #D2A77F;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.55;
}
.wrap { max-width: 62rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; display: grid; gap: 1.25rem; }
header { display: grid; gap: 0.25rem; }
.eyebrow { margin: 0; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warm); }
h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(2.1rem, 9vw, 3.25rem); line-height: 1; letter-spacing: -0.02em; text-wrap: balance; }
.lede { margin: 0.35rem 0 0; max-width: 38rem; color: var(--ink-soft); }
h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.1875rem; }
.layout { display: grid; gap: 1.5rem; align-items: start; }
.play, .side { display: grid; gap: 1rem; min-width: 0; }

/* Board */
/* Row and column numbers are off unless chosen in Options; the board then uses the space. */
.frame { display: grid; grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: 0 auto; }
.frame:not(.nums) .colnums, .frame:not(.nums) .rownums { visibility: hidden; }
.frame.nums { grid-template-columns: 1.25rem minmax(0, 1fr); grid-template-rows: 1.25rem auto; }
.colnums, .rownums { display: grid; color: var(--ink-soft); font-size: 0.75rem; font-variant-numeric: tabular-nums; text-align: center; }
.colnums { grid-column: 2; grid-template-columns: repeat(var(--n), 1fr); }
.rownums { grid-row: 2; grid-template-rows: repeat(var(--n), 1fr); align-items: center; }
.board {
  grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  border: 3px solid var(--edge); border-radius: 0.75rem; overflow: hidden;
  container-type: inline-size; --u: calc(100cqw / var(--n));
}
.board.solved { border-color: var(--accent); }
.rowline { display: contents; }
.cell {
  position: relative; aspect-ratio: 1; display: grid; place-items: center;
  background: var(--tint); color: var(--on-tint);
  border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: pinch-zoom;
}
.cell.er { border-right: 3px solid var(--edge); }
.cell.eb { border-bottom: 3px solid var(--edge); }
.cell.lastc { border-right: 0; }
.cell.lastr { border-bottom: 0; }
.cell:focus { outline: none; }
.cell:focus-visible { outline: 4px solid var(--ink); outline-offset: -4px; box-shadow: inset 0 0 0 6px var(--surface); z-index: 2; }
.cell svg { display: block; fill: currentColor; }
.label { position: absolute; top: 7%; left: 9%; font-weight: 700; font-size: max(0.6875rem, calc(var(--u) * 0.2)); line-height: 1; pointer-events: none; }
.label svg { width: 100%; height: auto; }
.token {
  width: 76%; aspect-ratio: 1; display: grid; place-items: center;
  background: var(--chip); border: 2px solid var(--edge); border-radius: 30%;
}
.token svg { width: 82%; height: auto; }
.cross { width: 34%; }
.cross svg { width: 100%; height: auto; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; opacity: 0.8; }
/* Dots must be easy to spot on a phone: a fifth of the cell, in solid ink. */
.dot { width: 20%; min-width: 7px; aspect-ratio: 1; border-radius: 50%; background: currentColor; opacity: 0.75; }
:root[data-mode="dark"] .dot { opacity: 0.85; }
.cell.clash .token { border: 3px dashed var(--flag); }
.badge {
  position: absolute; top: 5%; right: 5%; width: calc(var(--u) * 0.3); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; background: var(--flag); color: var(--on-flag);
  font-weight: 700; font-size: calc(var(--u) * 0.2); line-height: 1;
}
.cell.h-show::after, .cell.h-target::after { content: ""; position: absolute; inset: 4px; border-radius: 0.5rem; pointer-events: none; }
.cell.h-show::after { border: 3px dotted var(--on-tint); }
.cell.h-target::after { border: 4px solid var(--target); box-shadow: 0 0 0 2px var(--target-ring); }

/* Controls */
button, select { font: inherit; color: inherit; }
.btn {
  min-height: 2.75rem; padding: 0.5rem 0.9rem; border-radius: 0.625rem;
  border: 2px solid var(--ink); background: var(--surface); cursor: pointer; font-weight: 700;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn:focus-visible, select:focus-visible, summary:focus-visible, input:focus-visible + span {
  outline: 3px solid var(--ink); outline-offset: 3px;
}
.tools { display: grid; gap: 0.75rem; }
.toolpick { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.toolpick legend { padding: 0; margin-bottom: 0.35rem; font-weight: 700; }
.toolpick label { display: block; cursor: pointer; }
.toolpick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toolpick span {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 3rem;
  padding: 0.5rem; border: 2px solid var(--ink); border-radius: 0.625rem; background: var(--surface); font-weight: 700;
}
.toolpick span svg { width: 1.6rem; height: 1.6rem; fill: currentColor; }
.toolpick span svg.x { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.toolpick input:checked + span { background: var(--ink); color: var(--paper); }
.toolpick input:checked + span::before { content: "\2713"; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.row .btn { flex: 1 1 auto; }
.status { background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.85rem 1rem; display: grid; gap: 0.5rem; }
.status p { margin: 0; }
#progress { color: var(--ink-soft); }
.state { display: inline-flex; align-items: center; gap: 0.5rem; justify-self: start; padding: 0.3rem 0.8rem 0.3rem 0.4rem; border: 2px solid var(--ink-soft); border-radius: 999px; font-weight: 700; }
.stateicon { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; border: 2px dotted var(--ink-soft); font-size: 0.95rem; line-height: 1; }
.state[data-state="solved"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.state[data-state="solved"] .stateicon { border: 2px solid var(--on-accent); }
.state[data-state="error"] { border-color: var(--clash); }
.state[data-state="error"] .stateicon { border: 0; background: var(--clash); color: var(--paper); }
.optgroup { border: 0; margin: 0.4rem 0; padding: 0; min-width: 0; }
.optgroup legend { padding: 0; font-weight: 700; }
.cell.clash .cross { color: var(--flag); }
#msg:empty { display: none; }
.status .btn { justify-self: start; }

.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; align-items: end; }
.setup label { display: grid; gap: 0.25rem; font-weight: 700; }
.setup select { min-height: 2.75rem; padding: 0.4rem 0.6rem; border: 2px solid var(--ink); border-radius: 0.625rem; background: var(--surface); }
.setup .btn { grid-column: 1 / -1; }
.key { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.5rem; }
.key li { display: flex; align-items: center; gap: 0.55rem; }
.swatch { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 0.5rem; border: 2px solid var(--edge); display: grid; place-items: center; background: var(--tint); color: var(--on-tint); }
.swatch svg { width: 1.6rem; height: 1.6rem; padding: 1px; border-radius: 30%; background: var(--surface); }
.key small { display: block; font-size: 0.8125rem; color: var(--ink-soft); }
.key .name { font-weight: 700; line-height: 1.2; }
details { border-top: 1px solid var(--line); padding-top: 0.75rem; }
summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1.1875rem; border-radius: 0.25rem; }
details > :not(summary) { max-width: 36rem; }
details ol, details ul { padding-left: 1.25rem; margin: 0.6rem 0; }
details li + li { margin-top: 0.35rem; }
details p { margin: 0.6rem 0; }
.opt { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.4rem 0; cursor: pointer; }
.opt input { flex: none; width: 1.35rem; height: 1.35rem; margin: 0.15rem 0 0; accent-color: var(--accent); }
kbd { font: inherit; font-weight: 700; padding: 0 0.3rem; border: 1px solid var(--line); border-radius: 0.3rem; background: var(--surface); }
.note { color: var(--ink-soft); font-size: 0.9375rem; margin: 0; }
.swatch { font-weight: 700; }
.pick { border: 0; margin: 0; padding: 0; min-width: 0; }
.pick legend { padding: 0; margin-bottom: 0.35rem; font-weight: 700; }
.pickrow { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pickrow label { cursor: pointer; }
.pickrow input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pickrow label > span { position: relative; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 30%; border: 2px solid var(--ink-soft); background: var(--chip); }
.pickrow svg { width: 1.9rem; height: 1.9rem; }
.pickrow input:checked + span { border: 3px solid var(--ink); }
.pickrow input:checked + span::after { content: "\2713"; position: absolute; right: -0.3rem; bottom: -0.3rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font-size: 0.7rem; font-weight: 700; line-height: 1; }
.beta { margin: 0; padding: 0.6rem 0.9rem; border: 2px solid var(--warm); border-radius: 0.75rem; background: var(--surface); font-size: 0.9375rem; }
.beta a, .foot a, details a { color: inherit; text-decoration: underline; }
.foot { border-top: 1px solid var(--line); padding-top: 1rem; color: var(--ink-soft); font-size: 0.9375rem; }
.foot p { margin: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Puzzle list ---------- */
.levelbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.5rem; }
.levelbar p { margin: 0; text-align: center; font-family: var(--display); font-weight: 700; font-size: 1.125rem; text-wrap: balance; }
.btn.round { min-width: 2.75rem; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 1.5rem; line-height: 1; }
.tier { margin: 0.9rem 0 0.4rem; font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--ink-soft); }
.levels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(3.1rem, 1fr)); gap: 0.45rem; }
.lv {
  position: relative; width: 100%; aspect-ratio: 1; display: grid; place-content: center; gap: 0.1rem;
  font: inherit; font-weight: 700; font-size: 1.125rem; line-height: 1; color: var(--on-tint);
  border: 2px solid var(--edge); border-radius: 0.7rem; cursor: pointer; background: var(--g1);
}
.lv small { font-size: 0.6875rem; font-weight: 400; }
.lv.t-gentle { background: var(--g0); }
.lv.t-steady { background: var(--g4); }
.lv.t-tricky { background: var(--g5); }
.lv[aria-current] { outline: 3px solid var(--ink); outline-offset: 2px; }
.lv:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.lv .tick {
  position: absolute; top: -0.35rem; right: -0.35rem; width: 1.2rem; height: 1.2rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--paper); font-size: 0.7rem;
}
/* Progress: a meter per tier and your animal on every solved puzzle. */
.levelsub { margin: -0.5rem 0 0; text-align: center; color: var(--ink-soft); font-size: 0.9375rem; text-wrap: balance; }
.tierhead { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0.15rem 0.75rem; margin: 1rem 0 0.5rem; }
.tierhead .tier { margin: 0; }
.tiercount { justify-self: end; color: var(--ink-soft); font-size: 0.9375rem; font-weight: 700; }
.meter { grid-column: 1 / -1; height: 0.7rem; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.tierhead.full .tiercount { color: var(--ink); }
#levels > .tierhead:first-child { margin-top: 0.4rem; }
.lv .tick { width: 1.5rem; height: 1.5rem; top: -0.45rem; right: -0.45rem; background: var(--chip); border: 1.5px solid var(--edge); }
.lv .tick svg { width: 85%; height: auto; }
.lv.done { box-shadow: inset 0 0 0 2px var(--surface); }
/* ---------- Page top ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: grid; gap: 0.1rem; }
h1 { font-size: clamp(1.9rem, 7.5vw, 2.75rem); }
.betapill {
  display: inline-block; margin-left: 0.4rem; padding: 0 0.5rem; border: 1.5px solid currentColor; border-radius: 999px;
  font-size: 0.6875rem; letter-spacing: 0.04em; color: inherit; text-decoration: none; vertical-align: 1px;
}
.iconbtn {
  flex: none; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; padding: 0;
  border: 2px solid var(--line); border-radius: 0.9rem; background: var(--surface); color: var(--ink);
  font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.iconbtn svg { width: 1.45rem; height: 1.45rem; }
.iconbtn[disabled] { opacity: 0.35; cursor: default; }
.iconbtn:focus-visible, .tool:focus-visible, .quiet:focus-visible, .betapill:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* The three rules, always in view. Icons repeat what the words say. */
.rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; }
.rules li {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; padding: 0.3rem 0.35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0.85rem;
  font-size: 0.75rem; font-weight: 700; line-height: 1.2; text-align: center; text-wrap: balance;
}
.rules svg { flex: none; width: 1.25rem; height: 1.25rem; color: var(--accent); }

/* ---------- Puzzle heading and progress ---------- */
.levelbar { grid-template-columns: auto minmax(0, 1fr) auto; }
.levelhead { text-align: center; }
#levelName { margin: 0; font-size: 1.375rem; line-height: 1.25; }
.lvname { font-family: var(--display); font-weight: 800; }
.pill {
  display: inline-block; vertical-align: 3px; padding: 0.05rem 0.55rem; border-radius: 999px; white-space: nowrap;
  font-family: var(--body); font-size: 0.75rem; font-weight: 700; background: var(--g0); color: var(--on-tint);
}
.pill.t-steady { background: var(--g4); }
.pill.t-tricky { background: var(--g5); }
.levelbar .levelsub { margin: 0.1rem 0 0; font-family: var(--body); font-weight: 400; font-size: 0.8125rem; line-height: 1.3; color: var(--ink-soft); }
.placed { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.35rem 0.75rem; }
#progress { margin: 0; font-weight: 700; font-size: 0.9375rem; color: var(--ink); }
.slots { display: flex; gap: 0.3rem; }
.slot { width: 1.6rem; height: 1.6rem; border-radius: 0.5rem; border: 2px dashed var(--line); display: grid; place-items: center; }
.slot.on { border: 2px solid var(--line); background: var(--surface); }
.slot svg { width: 1.25rem; height: 1.25rem; }

/* ---------- Rounded patches (the default look; Options can switch to the flat board) ----------
   app.js draws each patch as one smooth shape on a dark tray (patchShapes). The dark gaps
   do the job of the heavy outlines, and the letters stay, so colour never works alone. */
.bed { display: none; }
:root { --tray: #2B313A; --seam: rgba(30, 34, 40, 0.18); }
:root[data-mode="dark"] { --tray: #0A0D12; --seam: rgba(0, 0, 0, 0.28); }
:root:not([data-look="plain"]) .frame { margin: 0.35rem; }
:root:not([data-look="plain"]) .bed { display: block; position: relative; grid-column: 2; grid-row: 2; }
:root:not([data-look="plain"]) .bed svg {
  position: absolute; left: calc(-4.5% / var(--n)); top: calc(-4.5% / var(--n));
  width: calc(100% + 9% / var(--n)); height: calc(100% + 9% / var(--n)); overflow: visible;
}
.bed .tray { fill: var(--tray); }
.bed .seams { fill: none; stroke: var(--seam); stroke-width: 3; stroke-linecap: round; }
:root:not([data-look="plain"]) .frame:has(.board.solved) .tray { stroke: var(--accent); stroke-width: 8; }
:root:not([data-look="plain"]) .board { border: 0; border-radius: 0; overflow: visible; }
:root:not([data-look="plain"]) .cell { background: transparent; border: 0; }
:root:not([data-look="plain"]) .token { width: 84%; border: 0; border-radius: 0; background: none; }
:root:not([data-look="plain"]) .token svg { width: 90%; }
:root:not([data-look="plain"]) .cell.clash .token { outline: 3px dashed var(--flag); border-radius: 30%; }
:root:not([data-look="plain"]) .label { top: 13%; left: 15%; }
:root:not([data-look="plain"]) .cell.h-show::after, :root:not([data-look="plain"]) .cell.h-target::after { inset: 9%; border-radius: 22%; }
.label { z-index: 2; }
/* A small pop when an animal is placed, and a happy hop when the puzzle is solved. Off when motion is reduced. */
@keyframes pop { 0% { transform: scale(0.55); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14%); } }
.token.pop { animation: pop 260ms ease-out; }
.board.cheer .token { animation: hop 520ms ease-in-out 2; }
@media (prefers-reduced-motion: reduce) { .token.pop, .board.cheer .token { animation: none !important; } }
.reduce-motion .token.pop, .reduce-motion .board.cheer .token { animation: none !important; }

/* ---------- Message and toolbar ---------- */
.status { border-radius: 1rem; padding: 0.7rem 0.9rem; gap: 0.4rem; }
.statusacts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.statusacts .btn { border-radius: 0.9rem; }
.quiet {
  margin-left: auto; min-height: 2.75rem; padding: 0 0.25rem; border: 0; background: none; cursor: pointer;
  color: var(--ink-soft); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.toolbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.4rem; }
.toolbar .toolpick { grid-column: span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; min-width: 0; }
.tool { min-width: 0; }
.tool, .toolbar .toolpick span {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  min-height: 3.6rem; padding: 0.35rem 0.15rem; border: 2px solid var(--line); border-radius: 1rem;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 0.8125rem; line-height: 1.1; cursor: pointer;
}
.tool svg, .toolbar .toolpick span svg { width: 1.5rem; height: 1.5rem; }
.toolbar .toolpick span svg.x { width: 1.25rem; height: 1.5rem; }
.toolbar .toolpick b { font-weight: 700; }
.toolbar .toolpick i { font-style: normal; }
.tool[disabled] { opacity: 0.4; cursor: default; }
.toolbar .toolpick input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.toolbar .toolpick input:checked + span::before {
  content: "\2713"; position: absolute; top: 0.2rem; right: 0.4rem; font-size: 0.75rem; line-height: 1;
}

/* ---------- Phones ---------- */
@media (max-width: 40rem) {
  .wrap { padding: 0 0.75rem 2.5rem; gap: 0.6rem; }
  h1 { font-size: 1.75rem; }
  .eyebrow { font-size: 0.75rem; }
  #levelName { font-size: 1.2rem; }
  .frame.nums { grid-template-rows: 1rem auto; }
}
@media (min-width: 40.01rem) {
  .rules li { flex-direction: row; gap: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; text-align: left; justify-content: flex-start; }
}

/* ---------- One screen ----------
   The play column is exactly as tall as the window: title, rules, puzzle name, board,
   message and toolbar. The board takes whatever height is left and stays square, so
   nothing needed for play is ever below the fold, at any window size. */
.wrap { padding-top: 0; }
.play {
  display: flex; flex-direction: column; gap: 0.5rem;
  height: 100vh; height: 100dvh; min-height: 29rem; max-height: 56rem; box-sizing: border-box;
  padding: 0.6rem 0 calc(0.5rem + env(safe-area-inset-bottom));
}
.stage { flex: 1 1 0; min-width: 0; min-height: 0; container-type: size; display: grid; place-items: start center; }
.stage .frame, :root:not([data-look="plain"]) .stage .frame { margin: 0; width: calc(min(100cqw, 100cqh) - 0.7rem); margin-top: 0.35rem; }
.status { border: 0; background: none; padding: 0; gap: 0.25rem; min-height: 3.5rem; align-content: start; }
.placed { justify-content: flex-start; }
.placed .slots { margin-left: auto; }
.slot { width: 1.4rem; height: 1.4rem; border-radius: 0.45rem; }
.slot svg { width: 1.1rem; height: 1.1rem; }
.state { padding: 0.05rem 0.6rem 0.05rem 0.2rem; gap: 0.3rem; font-size: 0.8125rem; border-width: 1.5px; }
.state[data-state="progress"] { display: none; }
.stateicon { width: 1.1rem; height: 1.1rem; font-size: 0.75rem; }
.said { display: flex; align-items: center; gap: 0.6rem; }
#msg { flex: 1 1 auto; margin: 0; font-size: 0.9375rem; line-height: 1.35; text-wrap: pretty; }
.said .btn { flex: none; min-height: 2.6rem; padding: 0.3rem 0.8rem; border-radius: 0.9rem; font-size: 0.9375rem; }
.toolbar { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; }
.toolbar .toolpick { gap: 0.3rem; }
.tool, .toolbar .toolpick span { min-height: 3.3rem; font-size: 0.75rem; border-radius: 0.9rem; }
@media (max-width: 22rem) { .tool, .toolbar .toolpick span { font-size: 0.6875rem; } }
/* Short windows give the space to the board: first the rule icons go, then the rule chips
   and the sub-line (the rules are also under How to play). */
@media (max-height: 44rem) {
  .rules svg { display: none; }
  .rules li { padding-block: 0.25rem; }
}
@media (max-height: 37.5rem) {
  .rules, .levelbar .levelsub { display: none; }
  .play { gap: 0.4rem; padding-top: 0.4rem; }
  .tool, .toolbar .toolpick span { min-height: 3rem; }
}
.placed { flex-wrap: nowrap; }
#progress { white-space: nowrap; }
.placed .slots { flex: 0 1 auto; min-width: 0; }
.slot { flex: 0 1 1.4rem; width: auto; height: auto; min-width: 0.85rem; aspect-ratio: 1; }
.slot svg { width: 80%; height: auto; }
@media (min-width: 56rem) { h1 { font-size: 2.2rem; } }

/* Tagline under the title */
.tagline { margin: 0.15rem 0 0; font-size: 0.95rem; color: var(--muted, inherit); }
@media (max-height: 37.5rem) { .tagline { display: none; } }
@media (max-width: 22rem) { #progress { font-size: 0.8125rem; } .slot { min-width: 0.7rem; } .placed { gap: 0.35rem 0.4rem; } .placed .slots { gap: 0.2rem; } }

/* ---------- Hint rings on the rounded board ----------
   A patch is drawn a little inside its cells, so a ring set evenly inside the cell looked off-centre
   wherever the cell sits on the edge of its patch. Each ring now keeps the same distance from the
   visible edge on all four sides, and the patch letter stays readable on top of it. */
:root:not([data-look="plain"]) .cell { --it: 0%; --ir: 0%; --ib: 0%; --il: 0%; }
:root:not([data-look="plain"]) .cell.xt { --it: 4.5%; }
:root:not([data-look="plain"]) .cell.xr { --ir: 4.5%; }
:root:not([data-look="plain"]) .cell.xb { --ib: 4.5%; }
:root:not([data-look="plain"]) .cell.xl { --il: 4.5%; }
:root:not([data-look="plain"]) .cell.h-show::after, :root:not([data-look="plain"]) .cell.h-target::after {
  inset: calc(8% + var(--it)) calc(8% + var(--ir)) calc(8% + var(--ib)) calc(8% + var(--il)); border-radius: 20%;
}
:root:not([data-look="plain"]) .cell.h-show::after { border-width: 3px; }
:root:not([data-look="plain"]) .cell.h-target::after { border-width: 4px; }
/* The letter sits on a small tab of its patch colour, so a ring, a piece or a cross never hides it. */
:root:not([data-look="plain"]) .label {
  z-index: 3; background: var(--tint); border-radius: 0.3em; padding: 0.08em 0.14em; margin: -0.08em -0.14em;
}

/* ---------- Play feel: the tap cycle, maybes, and Oddkin's faces ---------- */
.toolbar .toolpick .t-tools { display: none; }
.toolbar.three { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.toolbar.three .toolpick { grid-column: span 3; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toolbar.three .toolpick .t-tools { display: block; }
.toolbar.three .toolpick .t-cycle { display: none; }
.toolbar .toolpick .duo { display: flex; align-items: center; gap: 0.1rem; }
.toolbar .toolpick .duo svg.x { width: 0.85rem; }
.toolbar .toolpick .qm { display: grid; place-items: center; height: 1.5rem; font-size: 1.35rem; font-weight: 700; line-height: 1; }
@media (max-width: 24rem) { .toolbar.three { gap: 0.2rem; } .toolbar.three .tool, .toolbar.three .toolpick span { font-size: 0.625rem; } .toolbar.three .toolpick { gap: 0.2rem; } }

/* A maybe is a faint piece with a question mark on it, so it never reads as placed. */
.token.maybe { position: relative; }
.token.maybe > svg { opacity: 0.5; }
.token .q {
  position: absolute; right: -4%; bottom: -4%; width: 44%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--ink); border: 2px solid var(--ink);
  font-weight: 700; font-size: calc(var(--u) * 0.26); line-height: 1;
}
.dot.ring { background: none; border: 2px solid currentColor; opacity: 0.75; }

/* Oddkin's faces. Each is a plain drawing that works without movement; the movement is extra. */
.ok { overflow: visible; }
.ok-wide, .ok-shut, .ok-oh { display: none; }
.ok-open { opacity: 0; }
/* Each eye is drawn around its own centre, so the blink needs no transform box. */
.ok-eye { transform-origin: 0 0; }
.cell.clash .ok-eyes, .cell.clash .ok-smile { display: none; }
.cell.clash .ok-wide, .cell.clash .ok-oh { display: block; }
.board.solved .ok-smile { display: none; }
.board.solved .ok-open { opacity: 1; }
.board.rest .ok-eyes, .board.rest .ok-open { display: none; }
.board.rest .ok-shut, .board.rest .ok-smile { display: block; }

@keyframes ok-blink { 0%, 93%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(0.08); } }
@keyframes ok-wink { 0%, 100% { transform: scaleY(1); } 25%, 70% { transform: scaleY(0.08); } }
@keyframes ok-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 60% { transform: rotate(6deg); } }
@keyframes ok-grin { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ok-wave { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(0.3px, -5.5px); } }
.ok-eye { animation: ok-blink 5.6s linear infinite; animation-delay: var(--d, 0s); }
.token.wink .ok-r { animation: ok-wink 800ms ease-in-out; }
.token.wink .ok { animation: ok-wiggle 800ms ease-in-out; }
.token.pop .ok-open { animation: ok-grin 900ms ease-out; }
.board.cheer .token { animation: hop 520ms ease-in-out 3; animation-delay: var(--h, 0ms); }
.board.cheer .ok-wave { animation: ok-wave 520ms ease-in-out 3; animation-delay: var(--h, 0ms); }
.board.still .ok *, .board.still .ok, .board.still .token { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .ok *, .ok, .board.cheer .token { animation: none !important; } }
.reduce-motion .ok *, .reduce-motion .ok { animation: none !important; }

/* Two choices beside the message, for the time check. */
.said { flex-wrap: wrap; }
.said #msg { flex: 1 1 12rem; }
.toolbar .toolpick input:checked + span::before { top: 0.12rem; right: 0.25rem; font-size: 0.6875rem; }
.toolbar .toolpick span svg:not(.x) { width: 1.35rem; height: 1.35rem; margin-top: 0.15rem; }

/* ---------- A calm screen ----------
   One quiet bar, the board, and a few buttons. Everything else lives further down the page.
   Nothing here has an outline of its own: buttons and cards are plain shapes on the paper.
   The space under the board (the dock) keeps one height whatever is said in it, so the board never moves or changes size.
   A message that asks something takes the place of the buttons until it is answered or closed.
   The screen is as tall as the window with the browser's bars showing, so it does not shift as those bars come and go. */
:root { --card: #FFFFFF; --lift: 0 1px 2px rgba(22, 28, 38, 0.06), 0 6px 18px rgba(22, 28, 38, 0.08); }
:root[data-mode="dark"] { --card: var(--surface); --lift: none; }
@media (prefers-color-scheme: dark) { :root:not([data-mode]) { --card: var(--surface); --lift: none; } }
.wrap { max-width: 48rem; }
.layout { display: block; }
.play {
  max-width: 46rem; margin: 0 auto; gap: 0.6rem; touch-action: manipulation;
  height: 100vh; height: 100svh; min-height: 28rem; max-height: 66rem;
  padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom));
}
.side { max-width: 36rem; margin: 2.5rem auto 0; }

/* The bar: the puzzle list, the name of the puzzle, and Options. */
.top { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; align-items: center; gap: 0.5rem; }
.title { display: grid; text-align: center; }
.title h1 { font-family: var(--body); font-weight: 700; font-size: 0.75rem; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; color: var(--warm); }
#levelName { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.375rem; line-height: 1.15; }
.iconbtn { border: 0; border-radius: 50%; background: var(--card); box-shadow: var(--lift); }

/* The three rules, for a first visit only. Once a puzzle is solved they step aside; they stay under How to play. */
body:not(.newcomer) .rules { display: none; }
.rules { gap: 0.2rem; padding: 0.3rem; background: var(--card); border-radius: 1rem; box-shadow: var(--lift); }
.rules li { background: none; border: 0; }

/* The board, with a small tab above it: one slot for each patch, filled once that patch has its piece. */
.stage { place-items: center; }
.deck { width: min(100cqw, 100cqh - 2.5rem); display: grid; justify-items: center; gap: 0.4rem; }
.stage .frame, :root:not([data-look="plain"]) .stage .frame { width: calc(100% - 0.6rem); margin: 0; }
.tab { max-width: 100%; height: 2.1rem; display: flex; align-items: center; padding: 0 0.55rem; background: var(--card); border-radius: 999px; box-shadow: var(--lift); }
.tab .slots { display: flex; gap: 0.3rem; margin: 0; }
.tab .slot, .tab .slot.on { flex: none; width: 1.35rem; height: 1.35rem; min-width: 0; display: grid; place-items: center; border: 0; border-radius: 32%; background: var(--tint); }
.tab .slot svg { width: 88%; height: auto; }
/* A hint can outline a row or a column. The outline is drawn over the board, so nothing moves. */
.bands { grid-column: 2; grid-row: 2; position: relative; z-index: 4; pointer-events: none; }
.band { position: absolute; box-sizing: border-box; border: 3px solid var(--target); border-radius: 0.9rem; box-shadow: 0 0 0 2px var(--target-ring), inset 0 0 0 2px var(--target-ring); }

/* The dock: a quiet line of words, then the buttons. */
.dock { position: relative; flex: none; width: 100%; max-width: 36rem; align-self: center; height: 8.2rem; display: flex; flex-direction: column; gap: 0.3rem; }
.said { flex: 1 1 0; min-height: 0; flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 0.4rem; text-align: center; }
.said #msg { flex: none; max-width: 30rem; font-size: 0.9375rem; line-height: 1.3; text-wrap: balance; }
#msg:empty { display: block; }
#msg .s { display: inline-block; max-width: 100%; text-wrap: balance; }
#msg.soft { color: var(--ink-soft); }
.acts { display: none; }
/* The sheet sits on the dock and is the same size. Only if the words cannot fit (a very small screen, or very large text) does it grow upwards. */
.dock.sheet .said {
  position: absolute; left: 0; right: 0; bottom: 0; min-height: 100%; box-sizing: border-box; z-index: 3; align-items: stretch; justify-content: space-between;
  padding: 0.6rem 0.8rem; background: var(--card); border-radius: 1.25rem; box-shadow: var(--lift); text-align: left;
}
.dock.sheet .said #msg { max-width: none; }
.dock.sheet .acts { display: flex; align-items: center; gap: 0.5rem; }
.dock.sheet .toolbar { visibility: hidden; }
.acts .btn { flex: none; min-height: 2.6rem; padding: 0.3rem 0.95rem; border-radius: 999px; font-size: 0.9375rem; }
.acts .btn.plain { margin-left: auto; padding-inline: 0.4rem; border-color: transparent; background: none; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }

.toolbar { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 4.9rem)); justify-content: center; gap: clamp(0.35rem, 3vw, 0.9rem); }
.toolbar.three { grid-template-columns: repeat(6, minmax(0, 4.9rem)); gap: clamp(0.25rem, 1.6vw, 0.6rem); }
.toolbar .toolpick { display: none; }
.toolbar.three .toolpick { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: inherit; min-width: 0; }
.toolbar .toolpick label, .toolbar > .tool, .toolbar > .more { min-width: 0; }
.tool, .toolbar .toolpick span {
  height: 3.9rem; min-height: 0; padding: 0.3rem 0.15rem; border: 0; border-radius: 1.3rem;
  background: var(--card); box-shadow: var(--lift); font-size: 0.75rem;
}
.tool .qm, .menuitem .qm { display: grid; place-items: center; height: 1.5rem; font-style: normal; font-size: 1.35rem; font-weight: 700; line-height: 1; }
.menuitem .qm { flex: none; width: 1.4rem; }
.tool[aria-pressed="true"], .more[open] summary { background: var(--ink); color: var(--paper); }
.tool[aria-pressed="true"]::before { content: "\2713"; position: absolute; top: 0.3rem; right: 0.5rem; font-size: 0.6875rem; line-height: 1; }
.more { position: relative; min-width: 0; border: 0; padding: 0; }
.more summary { list-style: none; width: 100%; box-sizing: border-box; }
.more summary::-webkit-details-marker { display: none; }
.moremenu {
  position: absolute; right: 0; bottom: calc(100% + 0.5rem); z-index: 5; display: grid; gap: 0.2rem; width: max-content; min-width: 12.5rem; max-width: calc(100vw - 1.5rem); max-height: min(72vh, 22rem); overflow: auto;
  padding: 0.4rem; background: var(--card); border-radius: 1.1rem; box-shadow: 0 2px 6px rgba(22, 28, 38, 0.1), 0 10px 30px rgba(22, 28, 38, 0.18);
}
:root[data-mode="dark"] .moremenu { border: 1px solid var(--line); }
.menuitem {
  display: flex; align-items: center; gap: 0.6rem; min-height: 2.9rem; padding: 0.3rem 0.8rem; border: 0; border-radius: 0.8rem;
  background: none; color: var(--ink); font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.menuitem svg { flex: none; width: 1.4rem; height: 1.4rem; }
.menuitem:hover { background: var(--paper); }
.menuitem[hidden] { display: none; }
.menuitem[disabled] { opacity: 0.4; cursor: default; }
.menuitem:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Narrow screens give the words one more line. Short screens give the height to the board. */
@media (max-width: 24.3rem) { .dock { height: 9.4rem; } }
@media (max-width: 18rem) { .play { min-height: 31rem; } .dock { height: 12.5rem; } .dock.sheet .acts { flex-wrap: wrap; } }
@media (max-height: 40rem) { .rules { display: none; } }
@media (max-height: 34rem) {
  .tab { display: none; }
  .deck { width: min(100cqw, 100cqh); }
  .play { gap: 0.4rem; padding-top: 0.4rem; }
}

/* ---------- A wide, short window (a phone held sideways) ----------
   The board takes the full height on the left. The bar sits on the right, with the words and the buttons below it.
   There is height to spare on that side, so a message may grow upwards and its buttons may wrap. */
@media (min-aspect-ratio: 3/2) and (max-height: 38rem) and (min-width: 30rem) {
  .wrap { max-width: none; }
  .play {
    max-width: none; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
    column-gap: 1rem; row-gap: 0.4rem; min-height: 0; max-height: none;
    padding: 0.4rem max(0rem, env(safe-area-inset-right)) calc(0.4rem + env(safe-area-inset-bottom)) max(0rem, env(safe-area-inset-left));
  }
  .play .stage { grid-column: 1; grid-row: 1 / -1; width: min(100vh - 0.8rem, 58vw, 100vw - 17.5rem); width: min(100svh - 0.8rem, 58vw, 100vw - 17.5rem); height: 100%; }
  .play .top { grid-column: 2; grid-row: 1; }
  .play .dock { grid-column: 2; grid-row: 2; align-self: stretch; height: auto; min-height: 0; max-width: 26rem; width: 100%; justify-self: center; }
  .play .rules, .tab { display: none; }
  .deck { width: min(100cqw, 100cqh); }
  #levelName { font-size: 1.125rem; }
  .dock.sheet .said { min-height: min(100%, 9rem); }
  .dock.sheet .acts { flex-wrap: wrap; }
  .dock.sheet .acts .btn { flex: 0 1 auto; }
  .toolbar, .toolbar.three { grid-template-columns: repeat(auto-fit, minmax(3.4rem, 1fr)); gap: 0.4rem; }
}

/* A tablet or a large window: larger buttons and words to go with the larger board. */
@media (min-width: 48rem) and (min-height: 48rem) {
  .dock { height: 9.2rem; }
  .toolbar { grid-template-columns: repeat(4, minmax(0, 5.8rem)); }
  .toolbar.three { grid-template-columns: repeat(6, minmax(0, 5.8rem)); }
  .tool, .toolbar .toolpick span { height: 4.7rem; font-size: 0.875rem; border-radius: 1.5rem; }
  .tool svg, .toolbar .toolpick span svg:not(.x) { width: 1.75rem; height: 1.75rem; }
  .said #msg { font-size: 1.0625rem; }
  .acts .btn { font-size: 1rem; }
}

/* ---------- Below the board ---------- */
.levels { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (min-width: 34rem) { .levels { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.note, .foot p, details p, details li { text-wrap: pretty; }

/* ---------- Pictures for the rules ----------
   Each rule has a small picture of a three by three board: the piece, and dots on the cells it rules out.
   The words stay beside each picture, so nothing depends on the picture alone. */
.ke { fill: var(--edge); }
.kt { fill: var(--g6); }
.kb { fill: var(--g4); }
.kd { fill: var(--on-tint); opacity: 0.75; }
.rules li { gap: 0.3rem; padding: 0.3rem 0.2rem; }
.rules svg { display: block; width: 3rem; height: 3rem; color: var(--on-tint); }
.rulekey { list-style: none; margin: 0.6rem 0; padding: 0; display: grid; gap: 0.6rem; }
.rulekey li { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.rulekey svg { flex: none; width: 3.25rem; height: 3.25rem; color: var(--on-tint); }

/* ---------- Drag to cross off ----------
   A finger dragged across the board crosses cells off, so the board itself does not scroll the page; two fingers still zoom.
   On a screen too short to show the whole play area, the board scrolls the page as before and cells are crossed off one tap at a time. */
@media (max-height: 28rem) { .cell { touch-action: manipulation; } }

/* ---------- Solved: a speech bubble and a little confetti ----------
   The solved words sit in a bubble under the board, with a tail that points up at the piece in the bottom row.
   The confetti bursts from the centre of the board. */
.dock.cheer .said { justify-content: flex-start; align-items: center; gap: 0.5rem; padding: 0; background: none; box-shadow: none; }
.dock.cheer .said #msg {
  position: relative; align-self: stretch; box-sizing: border-box; max-width: none; padding: 0.5rem 0.9rem 0.55rem;
  border-radius: 1.1rem; background: var(--card); box-shadow: var(--lift); text-align: center; font-size: 0.875rem; color: var(--ink-soft);
}
.dock.cheer #msg::before {
  content: ""; position: absolute; top: -0.42rem; left: clamp(1.5rem, var(--tail, 50%), calc(100% - 1.5rem)); width: 0.9rem; height: 0.9rem; margin-left: -0.45rem;
  border-radius: 0.15rem 0 0 0; background: var(--card); transform: rotate(45deg);
}
.dock.cheer #msg .s:nth-child(-n+2) { font-family: var(--display); font-weight: 700; font-size: 1.0625rem; line-height: 1.25; color: var(--ink); }
@media (max-width: 24.3rem) {
  /* On a narrow screen "Solved." shares a line with the words after it, so the longest message still fits under the board. */
  .dock.cheer .said { gap: 0.4rem; }
  .dock.cheer .said #msg { padding: 0.4rem 0.7rem 0.45rem; text-wrap: balance; }
  .dock.cheer #msg .s:nth-child(-n+2) { display: inline; font-size: 1rem; }
  .dock.cheer #msg .s:nth-child(2)::after { content: "\A"; white-space: pre; }
}
.dock.cheer .acts { justify-content: center; }
.dock.cheer .acts .btn.primary { min-height: 2.75rem; padding-inline: 1.6rem; font-size: 1rem; }
:root[data-mode="dark"] .dock.cheer .said #msg { box-shadow: inset 0 0 0 1.5px var(--line); }
:root[data-mode="dark"] .dock.cheer #msg::before { box-shadow: inset 1.5px 1.5px 0 0 var(--line); }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) .dock.cheer .said #msg { box-shadow: inset 0 0 0 1.5px var(--line); }
  :root:not([data-mode]) .dock.cheer #msg::before { box-shadow: inset 1.5px 1.5px 0 0 var(--line); }
}
@media (min-aspect-ratio: 3/2) and (max-height: 38rem) and (min-width: 30rem) {
  /* Beside the board, the bubble has nothing above it to point at. */
  .dock.cheer #msg::before { display: none; }
  .dock.cheer .said { justify-content: center; }
}
.confetti { grid-column: 2; grid-row: 2; position: relative; z-index: 5; pointer-events: none; overflow: hidden; container-type: size; border-radius: 1rem; }
.confetti i {
  --s: clamp(0.34rem, 1.9cqw, 0.8rem);
  position: absolute; top: 50%; left: 50%; width: var(--s); height: calc(var(--s) * 1.6); margin: calc(var(--s) * -0.8) 0 0 calc(var(--s) * -0.5); border-radius: 0.08rem; background: var(--c);
  box-shadow: 0 0 0 1px rgba(22, 28, 38, 0.2); opacity: 0; animation: confetti var(--t) cubic-bezier(0.16, 0.6, 0.4, 1) var(--d) 1 both;
}
.confetti i.dot { height: var(--s); margin-top: calc(var(--s) * -0.5); border-radius: 50%; }
/* Out from the centre, quick at first. Each piece fades over the last part of its flight, while it is still moving. */
@keyframes confetti {
  0% { opacity: 0; transform: translate(0, 0) scale(0.3) rotate(0deg); }
  6%, 45% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.9) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
.reduce-motion .confetti { display: none; }
