/* Daily-puzzle website design tokens, v0.2 "Pond" (28 Nov 2026). Rules: DESIGN.md.
   Three layers: primitive (raw values) -> semantic (what a value is for) -> context (ground or paper).
   Parts read semantic and context tokens only. Day, night and large print swap tokens; the layout never changes. */

/* ---------- 1. Primitive ---------- */
:root {
  /* water */
  --tide-900: #0b3a43; --tide-800: #124b56; --tide-700: #1c6370; --tide-500: #3d8a85; --tide-200: #bfe3df; --tide-100: #d2e4e2; --tide-50: #f0f7f6;
  /* moss */
  --moss-950: #0f251f; --moss-900: #16332c; --moss-700: #2c5245; --moss-600: #34693f; --moss-500: #4e8a5c; --moss-300: #bcd9b3; --moss-200: #cfe3c8; --moss-100: #c3d2c6; --moss-50: #e8eee6;
  /* paper and ink */
  --paper-day: #fbf8ef; --paper-day-soft: #f1ede0; --paper-day-rule: #ddd8c8;
  --paper-night: #d6cdb4; --paper-night-soft: #c9bfa4; --paper-night-rule: #ada388; /* dimmed 28 Nov: lit, not glaring */
  --ink-day: #10272b; --ink-night: #14251f; --ink-soft: #46585a; --ink-edge: #6b7c7d; --ink-soft-night: #34443f; --ink-edge-night: #52625c;
  /* ember: the one warm colour */
  --koi-400: #ff9466; --koi-700: #b8431b; --koi-950: #2a1206;
  --apricot-300: #ffb27a; --apricot-700: #8f4312; --apricot-950: #33190a;
  --red-700: #a8321f; --red-800: #8a2314;

  --size-14: .875rem; --size-16: 1rem; --size-17: 1.0625rem; --size-18: 1.125rem; --size-21: 1.3125rem;
  --size-24: 1.5rem; --size-28: 1.75rem; --size-36: 2.25rem; --size-60: 3.75rem;

  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem; --space-10: 2.5rem; --space-14: 3.5rem; --space-20: 5rem;

  --ms-fast: 120ms; --ms-base: 200ms; --ms-slow: 360ms; --ms-draw: 480ms; --ms-ring: 1400ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1); /* arrives fast, settles slowly, like something coming to rest on water */
}

/* ---------- 2. Semantic: day ("Tide") ---------- */
:root {
  color-scheme: light;
  --ground: var(--tide-700); --on-ground: var(--tide-50); --on-ground-soft: var(--tide-100); --ground-line: var(--tide-500);
  --pebble: var(--tide-800); --ground-deep: var(--tide-900);
  --paper: var(--paper-day); --paper-soft: var(--paper-day-soft); --paper-rule: var(--paper-day-rule);
  --ink: var(--ink-day); --ink-quiet: var(--ink-soft); --paper-edge: var(--ink-edge);
  --ember: var(--koi-400); --on-ember: var(--koi-950); --ember-edge: var(--koi-700);
  --found: var(--tide-200); --found-edge: var(--tide-500);
  --danger: var(--red-700);
  --sheet-shadow: 0 1px 0 rgb(0 0 0 / .08);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;

  --t-cap: var(--size-14); --t-ui: var(--size-16); --t-btn: var(--size-17); --t-body: var(--size-18); --t-lead: var(--size-21);
  --t-h3: var(--size-24); --t-h3b: var(--size-28); --t-h2: var(--size-36); --t-h1: var(--size-60);
  --glyph: .58; /* puzzle letter size as a share of its cell */

  --radius-pill: 999px; --radius-sheet: 24px; --radius-box: 12px;
  --radius-pebble: 40px 46px 42px 48px / 46px 40px 48px 42px; /* slightly uneven, like a stone */
  --line: 2px; --target: 3rem; --gutter: var(--space-5); --measure: 66ch;
}

/* night ("Moss"): follows the device unless the player chose day */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: var(--moss-900); --on-ground: var(--moss-50); --on-ground-soft: var(--moss-100); --ground-line: var(--moss-700);
    --pebble: var(--moss-950); --ground-deep: var(--moss-950);
    --paper: var(--paper-night); --paper-soft: var(--paper-night-soft); --paper-rule: var(--paper-night-rule);
    --ink: var(--ink-night); --ink-quiet: var(--ink-soft-night); --paper-edge: var(--ink-edge-night); --danger: var(--red-800);
    --ember: var(--apricot-300); --on-ember: var(--apricot-950); --ember-edge: var(--apricot-700);
    --found: var(--moss-300); --found-edge: var(--moss-600);
    --sheet-shadow: 0 16px 44px rgb(0 0 0 / .42);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: var(--moss-900); --on-ground: var(--moss-50); --on-ground-soft: var(--moss-100); --ground-line: var(--moss-700);
  --pebble: var(--moss-950); --ground-deep: var(--moss-950);
  --paper: var(--paper-night); --paper-soft: var(--paper-night-soft); --paper-rule: var(--paper-night-rule);
  --ink: var(--ink-night); --ink-quiet: var(--ink-soft-night); --paper-edge: var(--ink-edge-night); --danger: var(--red-800);
  --ember: var(--apricot-300); --on-ember: var(--apricot-950); --ember-edge: var(--apricot-700);
  --found: var(--moss-300); --found-edge: var(--moss-600);
  --sheet-shadow: 0 16px 44px rgb(0 0 0 / .42);
}

/* large print: text and puzzle letters grow, nothing else moves */
:root[data-size="large"] { --t-cap: var(--size-16); --t-ui: var(--size-18); --t-btn: 1.1875rem; --t-body: var(--size-21); --t-lead: var(--size-24); --glyph: .66; }
/* phones, upright or sideways: no text under 16px */
@media (max-width: 47.99rem), (max-height: 31.24rem) {
  :root { --t-cap: var(--size-16); --t-h1: 2.5rem; --t-h2: var(--size-28); --gutter: var(--space-4); }
  :root[data-size="large"] { --t-cap: var(--size-18); }
}
@media (min-width: 62rem) { :root { --radius-sheet: 32px; } }

/* ---------- 3. Context: what the nearest surface is ---------- */
/* on the ground (the page itself) */
:root { --bg: var(--ground); --fg: var(--on-ground); --fg-quiet: var(--on-ground-soft); --rule: var(--ground-line); --edge: var(--on-ground-soft); --btn-edge: var(--ember); --quiet-fill: var(--pebble); }
/* on paper: anything read at length, and every puzzle */
.paper { --bg: var(--paper); --fg: var(--ink); --fg-quiet: var(--ink-quiet); --rule: var(--paper-rule); --edge: var(--paper-edge); --btn-edge: var(--ember-edge); --quiet-fill: var(--paper-soft); }
@media (prefers-contrast: more) { :root, .paper { --fg-quiet: var(--fg); --rule: var(--edge); } }

/* Daily-puzzle website components, v0.2 "Pond". Plain CSS on tokens.css. Rules: DESIGN.md.
   Every part reads --bg, --fg, --fg-quiet, --rule, --edge from where it sits (the ground, or a .paper). */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; scrollbar-color: var(--ground-line) var(--ground-deep); }
body { margin: 0; background: var(--ground); color: var(--fg); font: 400 var(--t-ui)/1.5 var(--font-text); overflow-wrap: break-word; caret-color: var(--ember); }
::selection { background: var(--ember); color: var(--on-ember); }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .22em; transition: text-decoration-thickness var(--ms-fast); }
a:hover { text-decoration-thickness: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; } /* a press shows in the button's own shape (:active), never the browser's square */
:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
svg.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- type roles ---------- */
.display, .h2, .h3 { font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-weight: 600; letter-spacing: -.012em; text-wrap: balance; }
.display { font-size: var(--t-h1); line-height: 1.03; }
.display i { font-weight: 400; } /* the soft half of the home headline, and nowhere else */
.h2 { font-size: var(--t-h2); line-height: 1.08; }
.h3 { font-size: var(--t-h3b); line-height: 1.15; }
.h4 { font: 700 var(--t-lead)/1.25 var(--font-text); }
.lead { font-size: var(--t-lead); line-height: 1.45; max-width: 34ch; }
.body { font-size: var(--t-body); line-height: 1.6; max-width: var(--measure); }
.cap { font-size: var(--t-cap); color: var(--fg-quiet); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* paper: the lit sheet. Flat by day; by night it glows. */
.paper { background: var(--bg); color: var(--fg); border-radius: var(--radius-sheet); box-shadow: var(--sheet-shadow); }
.paper ::selection { background: var(--found); color: var(--ink); }
.sheet { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
@media (min-width: 48rem) { .sheet { padding: var(--space-8); } }

/* ---------- the name ---------- */
.wordmark { display: inline-flex; align-items: center; gap: .45em; min-height: 2.75rem; font: 600 var(--size-24)/1 var(--font-display); font-variation-settings: "SOFT" 100; letter-spacing: -.01em; text-decoration: none; }
.wordmark::before { content: ""; width: .62em; height: .5em; border-radius: var(--radius-pebble); background: var(--ember); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; min-height: var(--target); align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-2) var(--space-6); border: var(--line) solid var(--btn-edge); border-radius: var(--radius-pill); background: var(--ember); color: var(--on-ember); font: 700 var(--t-btn)/1.2 var(--font-text); text-decoration: none; transition: transform var(--ms-base) var(--ease-out), box-shadow var(--ms-base) var(--ease-out); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgb(0 0 0 / .22); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition-duration: var(--ms-fast); }
.btn svg.i { transition: transform var(--ms-base) var(--ease-out); }
.btn:hover svg.i.go { transform: translateX(3px); }
.btn-plain { border-color: var(--fg); background: transparent; color: var(--fg); }
.btn-danger { border-color: var(--danger); background: transparent; color: var(--danger); }
.btn[disabled], .btn[aria-disabled="true"] { border-color: var(--rule); background: var(--quiet-fill); color: var(--fg-quiet); box-shadow: none; transform: none; cursor: not-allowed; }
.btn-wide { width: 100%; }

/* puzzle toolbar button: icon with its word; pressed = filled */
.tool { display: inline-flex; min-height: var(--target); flex: none; align-items: center; justify-content: center; gap: var(--space-2); padding: 0 var(--space-4); border: var(--line) solid var(--edge); border-radius: var(--radius-pill); color: var(--fg); font: 600 var(--t-ui)/1.2 var(--font-text); transition: border-color var(--ms-base), background var(--ms-base), color var(--ms-base); }
/* hover only for a real pointer: after a touch, :hover stays on the last thing pressed */
@media (hover: hover) and (pointer: fine) { .tool:hover { border-color: var(--fg); background: var(--quiet-fill); } }
.tool:active { border-color: var(--fg); background: var(--quiet-fill); }
.tool svg.i { transition: transform var(--ms-fast); }
.tool:active svg.i { transform: scale(.86); }
.tool[aria-pressed="true"] { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.toolbar { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-1); margin: calc(-1 * var(--space-1)); scrollbar-width: thin; }

/* pebble tabs: which of today's puzzles the sheet shows */
.pebbles { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pebble { display: inline-flex; min-height: var(--target); align-items: center; gap: var(--space-2); padding: 0 var(--space-5); border-radius: var(--radius-pebble); background: var(--pebble); color: var(--on-ground); font: 600 var(--t-ui)/1.2 var(--font-text); text-decoration: none; transition: transform var(--ms-base) var(--ease-out), background var(--ms-base), color var(--ms-base); }
.pebble:hover { transform: translateY(-2px); }
.pebble:active { transform: scale(.96); }
.pebble[aria-selected="true"], .pebble[aria-current="true"] { background: var(--paper); color: var(--ink); }

/* ---------- difficulty and state: shape, never colour alone ---------- */
.bars { display: inline-flex; align-items: flex-end; gap: .16em; height: .9em; flex: none; }
.bars i { width: .3em; border: 1.5px solid currentColor; border-radius: 2px; }
.bars i:nth-child(1) { height: 42%; } .bars i:nth-child(2) { height: 71%; } .bars i:nth-child(3) { height: 100%; }
.bars[data-n="1"] i:nth-child(-n+1), .bars[data-n="2"] i:nth-child(-n+2), .bars[data-n="3"] i { background: currentColor; }
.level { display: inline-flex; align-items: center; gap: .4em; font-weight: 600; line-height: 1.2; }

.state { display: inline-flex; width: 1.125rem; height: 1.125rem; flex: none; align-items: center; justify-content: center; border: 2px solid currentColor; border-radius: 50%; }
.state[data-s="progress"] { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.state[data-s="done"] { background: currentColor; }
.state[data-s="later"] { border-style: dashed; } /* a day still to come */
.state svg { display: none; width: .75rem; height: .75rem; fill: none; stroke: var(--bg); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.state[data-s="done"] svg { display: block; }

.meter { height: 10px; border-radius: 10px; background: var(--rule); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 10px; background: var(--fg); transform-origin: left; transition: transform var(--ms-slow) var(--ease-out); }

/* ---------- word search grid (always on paper) ---------- */
.wsgrid { position: relative; container-type: inline-size; width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; }
.wsgrid svg.bands { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wsgrid line { stroke-linecap: round; }
.wsgrid line.edge { stroke-width: .76; stroke: var(--found-edge); }   /* the thin darker outline: a band is never fill alone */
.wsgrid line.fill { stroke-width: .66; stroke: var(--found); } /* a diagonal's neighbours are .71 of a cell away: wider than this and the band runs into their letters (owner, on a phone, 29 Nov) */
.wsgrid g.live line.edge { stroke: var(--ember-edge); }
.wsgrid g.live line.fill { stroke: var(--ember); }
.wsgrid .cells { position: absolute; inset: 0; display: grid; grid-template-rows: repeat(var(--n), 1fr); }
.wsgrid .r { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.wsgrid .c { position: relative; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink); font: 700 calc(100cqw / var(--n) * var(--glyph))/1 var(--font-text); transition: background var(--ms-fast); }
@media (hover: hover) and (pointer: fine) { .wsgrid .c:hover { background: var(--paper-soft); } }
.wsgrid .c.on, .wsgrid .c.live { background: none; }
.wsgrid .c:focus-visible { outline-color: var(--ink); outline-offset: -3px; z-index: 1; }

/* word chips: found = tint, outline and a line through */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { position: relative; display: inline-flex; min-height: 2.25rem; align-items: center; padding: 0 var(--space-3); border: 1.5px solid var(--edge); border-radius: var(--radius-pill); color: var(--fg); font: 600 var(--t-ui)/1 var(--font-text); letter-spacing: .03em; transition: background var(--ms-slow), border-color var(--ms-slow); }
.chip::after { content: ""; position: absolute; left: .6em; right: .6em; top: calc(50% - 1px); height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform var(--ms-slow) var(--ease-out); }
.chip.found { border-color: var(--found-edge); background: var(--found); color: var(--ink); }
.chip.found::after { transform: scaleX(1); }

/* ---------- letter boxes (scramble, missing vowels) ---------- */
.boxes { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.box { display: flex; width: var(--bx, 2.75rem); height: var(--bx, 2.75rem); flex: none; align-items: center; justify-content: center; border: var(--line) solid transparent; border-radius: var(--radius-box); font: 700 calc(var(--bx, 2.75rem) * .5)/1 var(--font-text); color: var(--ink); }
.box.given { background: var(--paper-soft); border-color: var(--paper-rule); }
.box.typed { border-color: var(--ink); }
.box.blank { border: var(--line) dashed var(--paper-edge); }
.box.now { border: 3px solid var(--ink); background: var(--found); }
.box.vowel { background: var(--found); border-color: var(--found-edge); }
.box.tile { border-color: var(--found-edge); background: var(--found); transition: transform var(--ms-base) var(--ease-out), box-shadow var(--ms-base) var(--ease-out); }
.box.tile:hover { transform: translateY(-3px); box-shadow: 0 5px 10px rgb(0 0 0 / .16); }
.box.tile:active { transform: scale(.94); box-shadow: none; }

/* ---------- switch ---------- */
.switch-row { display: flex; min-height: var(--target); align-items: center; justify-content: space-between; gap: var(--space-4); font-size: var(--t-body); cursor: pointer; }
.switch { position: relative; width: 3.5rem; height: 2rem; flex: none; border: var(--line) solid var(--fg); border-radius: 1rem; transition: background var(--ms-base); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--fg); transition: transform var(--ms-base) var(--ease-out), background var(--ms-base); }
input:checked + .switch { background: var(--fg); }
input:checked + .switch::after { background: var(--bg); transform: translateX(1.5rem); }
input:focus-visible + .switch { outline: 3px solid var(--fg); outline-offset: 3px; }

/* ---------- small parts ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-2); text-align: center; font-size: var(--t-cap); }
.week li { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.countdown { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--fg-quiet); }
.toast { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--target); padding: 0 var(--space-5); border-radius: var(--radius-pill); background: var(--fg); color: var(--bg); font-weight: 600; }
.ad { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 100%; border: var(--line) dashed var(--rule); border-radius: var(--radius-box); color: var(--fg-quiet); font-size: var(--t-cap); text-align: center; }
.sharetext { margin: 0; padding: var(--space-4); border-radius: var(--radius-box); background: var(--paper-soft); color: var(--ink); font: 400 var(--t-ui)/1.5 var(--font-text); white-space: pre-wrap; }
.saying { font: 700 var(--t-h3)/1.3 var(--font-text); letter-spacing: .1em; }
.rule { height: 1px; border: 0; margin: 0; background: var(--rule); }

/* ---------- the one load sequence: the sheet comes to rest on the water ---------- */
.ringbox { position: relative; }
[data-play] { overflow-x: clip; } /* the ring spreads wider than a phone */
.ring { position: absolute; inset: 8% 4%; border: 2px solid var(--on-ground); border-radius: 50%; opacity: 0; pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes land { from { opacity: 0; transform: translateY(34px) scale(.97); } }
@keyframes ring { 0% { opacity: .5; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes letter { from { opacity: 0; } }
@keyframes draw { from { stroke-dashoffset: 1; opacity: 0; } 12% { opacity: 1; } }
@keyframes strike { from { transform: scaleX(0); } }
[data-play] .in { animation: rise var(--ms-draw) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 80ms); }
[data-play] .land { animation: land 700ms var(--ease-out) both; animation-delay: 240ms; }
[data-play] .ring { animation: ring var(--ms-ring) var(--ease-out) both; animation-delay: 620ms; }
[data-play] .wsgrid .c { animation: letter 300ms ease-out both; animation-delay: calc(520ms + var(--d, 0) * 20ms); }
[data-play] .wsgrid line { stroke-dasharray: 1; animation: draw var(--ms-draw) var(--ease-out) both; animation-delay: calc(1150ms + var(--k, 0) * 300ms); }
[data-play] .chip.found::after { animation: strike var(--ms-slow) var(--ease-out) both; animation-delay: calc(1450ms + var(--k, 0) * 300ms); }

/* less motion: by the device, or the player's own switch in Settings */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
:root[data-motion="less"] *, :root[data-motion="less"] *::before, :root[data-motion="less"] *::after { animation: none !important; transition: none !important; }

/* The website's own page styles, on top of the design system (tokens.css, components.css, v0.2 "Pond"). */
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

.skip { position: absolute; left: var(--space-3); top: -5rem; z-index: 5; padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill); background: var(--paper); color: var(--ink); font-weight: 700; }
.skip:focus { top: var(--space-3); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-5); padding-block: var(--space-3); }
/* the alpha's label: on the home page under the headline, on the puzzle page in the footer, with a tag beside the site name that leads to it */
.top .early { display: inline-flex; align-items: center; min-height: 2.75rem; margin-right: auto; font-size: var(--t-ui); }
@media (max-width: 22.49rem) { .top .early { margin-left: calc(var(--space-2) - var(--space-5)); } .top:has(.early) .wordmark { font-size: 1.3125rem; } } /* 320 wide: the tag stays beside the name (the name a little smaller), so the grid is no lower */
.alpha { max-width: 34rem; font-size: var(--t-body); line-height: 1.45; text-wrap: pretty; }
.top nav, .foot nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.top nav a, .foot a, .days a { display: inline-flex; min-height: 2.75rem; align-items: center; }
main .wrap { display: flex; flex-direction: column; gap: var(--space-6); padding-block: var(--space-4) var(--space-14); }
.head { display: flex; flex-direction: column; gap: var(--space-2); }
.head .display { font-size: var(--t-h2); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); font-size: var(--t-body); }

/* the puzzle sheet. Wide: grid beside the tools, what happened and the list. Narrower (.play.peeks, set by play.js): a bar stays
   on screen with the next words to find, a count that opens the whole list over the grid, and what happened; then the grid, then the tools. */
.play { display: grid; gap: var(--space-4); padding: var(--space-2); margin-inline: calc(-1 * var(--space-2)); }
.play > *, .bar > * { min-width: 0; }
.tools { display: flex; flex-direction: column; gap: var(--space-3); order: 5; }
.tools .toolbar { flex-wrap: wrap; overflow: visible; } /* a narrow column gets two rows, never a cut-off button */
.bar { display: contents; } /* its parts lay out as the sheet's own, except in the phone bar below */
.status { order: 2; }
.wsframe { order: 3; }
.play .solved, .play .fact { order: 4; } /* under the grid, so solving never pushes the grid away */
.side { display: flex; flex-direction: column; gap: var(--space-3); order: 4; }
.peek { display: none; }
.status { min-height: 3em; font-size: var(--t-body); line-height: 1.5; }
.tally { display: flex; flex-direction: column; gap: var(--space-2); }
.tally p { font-size: var(--t-ui); color: var(--fg-quiet); }
.wsframe { position: relative; width: 100%; max-width: min(44rem, 82dvh); margin-inline: auto; }
.wsgrid { touch-action: none; }
.wsgrid .c { cursor: pointer; }
/* the first letter is a filled dot; keyboard focus stays an ink ring, so the two are never confused */
.wsgrid .c.anchor { background: var(--ember); box-shadow: inset 0 0 0 2px var(--ember-edge); color: var(--on-ember); }
.wsgrid g.miss line.edge { stroke: var(--paper-edge); }
.wsgrid g.miss line.fill { stroke: var(--paper-soft); }
.wsgrid g.miss { animation: miss 900ms ease-out both; }
@keyframes miss { 0%, 45% { opacity: 1; } 100% { opacity: 0; } }
@media (hover: hover) and (pointer: fine) { .wsgrid.done .c:hover { background: none; } }
.wsgrid.done .c { color: var(--ink-quiet); cursor: default; }
.wsgrid.done .c.msg { color: var(--ink); font-weight: 800; }
/* bigger letters: cells of about 34px or more (owner, 29 Nov: so a phone shows about ten columns). Only when that is wider
   than the screen does the grid sit in a box the player slides sideways; there a finger marks a word by pressing both ends.
   The box is as tall as the grid: up and down, only the page scrolls */
.wsframe.zoom { max-width: none; }
.wsbox.zoom .wsgrid { width: max(100%, calc(var(--n) * var(--cell, 2.125rem))); --glyph: .7; } /* play.js widens --cell a little so the box always ends on half a column */
.wsbox.slide { overflow-x: auto; border: var(--line) solid var(--paper-edge); border-radius: var(--radius-box); overscroll-behavior-x: contain; } /* sideways only: up and down, the page must still scroll */
.wsbox.slide .wsgrid { touch-action: pan-x pan-y; }
/* when the first letter has slid out of the box, a copy of it waits at the nearest edge and points the way back */
.pin { position: absolute; z-index: 2; display: flex; width: 2rem; height: 2rem; margin: -1rem 0 0 -1rem; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--ember); box-shadow: inset 0 0 0 2px var(--ember-edge), 0 2px 6px rgb(0 0 0 / .3); color: var(--on-ember); font: 700 1rem/1 var(--font-text); pointer-events: none; }
.pin::after { content: ""; position: absolute; left: 50%; top: 50%; width: .6rem; height: .6rem; margin: -.3rem; background: var(--ember-edge); transform: rotate(var(--a, 0rad)) translateX(1.2rem) rotate(45deg); }
.wsframe::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: var(--radius-box);
  box-shadow: inset 16px 0 14px -14px rgb(0 0 0 / calc(var(--fl, 0) * .5)), inset -16px 0 14px -14px rgb(0 0 0 / calc(var(--fr, 0) * .5)),
              inset 0 16px 14px -14px rgb(0 0 0 / calc(var(--ft, 0) * .5)), inset 0 -16px 14px -14px rgb(0 0 0 / calc(var(--fb, 0) * .5)); }
@media (max-width: 61.99rem) {
  .play { align-content: start; overflow: clip; } /* the bar is the sheet's full width: keep it inside the rounded corners (clip, not hidden, so it still sticks) */
  .play .fact { padding: var(--space-4); }
  .play .solved { gap: var(--space-2); padding: var(--space-4); } /* tight, so the saying is on screen under the grid */
  .play.peeks .bar { display: flex; flex-direction: column; gap: var(--space-2); order: 2; position: sticky; top: 0; z-index: 3;
    margin: 0 calc(-1 * var(--space-2)); padding: var(--space-2); background: var(--paper); }
  .play.peeks .peek { display: flex; align-items: center; gap: var(--space-2); }
  .play.peeks #next { flex: 1; min-width: 0; max-height: 2.25rem; overflow: hidden; margin: 0; padding: 0; list-style: none; } /* one row: a word that doesn't fit whole wraps out of sight */
  /* the count and "Close" share one place, so opening the list moves nothing; the arrow says it opens */
  .peek .tool { display: grid; grid-template-columns: auto auto; padding: 0 var(--space-3); }
  .peek .shut, .peek .open { grid-area: 1 / 1; text-align: center; }
  .peek .open, .list-open .peek .shut { visibility: hidden; }
  .list-open .peek .open { visibility: visible; }
  .peek .tool::after { content: ""; width: .45em; height: .45em; margin-top: -.25em; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .list-open .peek .tool::after { margin-top: .25em; transform: rotate(225deg); }
  .play.peeks .status { min-height: 3em; font-size: var(--t-ui); }
  .play.peeks .side { display: none; position: absolute; top: 100%; left: var(--space-2); right: var(--space-2); max-height: calc(100dvh - var(--bar-h, 8rem) - 1.5rem); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--paper-edge) transparent;
    padding: var(--space-4); border: var(--line) solid var(--paper-edge); border-radius: var(--radius-box); background: var(--paper); box-shadow: 0 14px 28px rgb(0 0 0 / .28); }
  .play.peeks.list-open .side { display: flex; }
  .play.peeks .side .chip.found { order: 1; } /* words still to find come first */
  .play.over .peek { display: none; } /* solved: nothing left to look for */
}
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-box); background: var(--paper-soft); }
.solved { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); border: var(--line) solid var(--found-edge); border-radius: var(--radius-box); background: var(--found); color: var(--ink); }
.solved:focus-visible { outline-color: var(--ink); }
/* a fact, shown once solved: its own box, so any fact can sit in it (sketch 31, owner, 29 Nov) */
.fact { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); border: var(--line) solid var(--paper-edge); border-radius: var(--radius-box); }
.fact .source { font-size: var(--t-ui); }
.how { max-width: 46rem; }
.how .body { max-width: 46ch; text-wrap: pretty; } /* ch is the zero's width, wider than most letters: about 70 a line */
.days { display: flex; flex-direction: column; }
/* a day: its state mark, then the title with the theme under it; level and word count stand apart (owner, 29 Nov) */
.days li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 var(--space-3); padding-block: var(--space-2); border-top: 1px solid var(--rule); }
.days li:first-child { border-top: 0; }
/* the title's first line sits at one height whether or not it wraps, and the mark is pinned beside that line */
.days a { grid-column: 2; justify-self: start; align-items: flex-start; padding-block: calc((2.75rem - 1.25em) / 2); font: 700 var(--t-lead)/1.25 var(--font-text); }
.days .state { align-self: start; margin-top: calc((2.75rem - 1.125rem) / 2); }
.days .theme, .days .meta { grid-column: 2; }
.days .meta { display: grid; grid-template-columns: 6.75rem 5.25rem; gap: 0 var(--space-4); margin-top: var(--space-1); } /* two columns of fixed width at every size, so the counts line up on a phone too */
/* room for both: level and word count sit beside the title, each in a column of its own fixed width, so they line up down the page */
@media (min-width: 40rem) {
  .days li { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--space-4); }
  .days .meta { grid-column: 3; grid-row: 1 / span 2; margin-top: 0; }
}
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) var(--space-5); padding-block: var(--space-6) var(--space-10); border-top: 1px solid var(--rule); }
@media (min-width: 48rem) { .play { padding: var(--space-6); margin-inline: 0; } }
/* How it works: its own page. The key sets each day mark beside its meaning; no line of words under 16px or over 34rem */
.primer { max-width: 44rem; gap: var(--space-3); }
.primer .body, .primer .key { max-width: 34rem; }
.primer .key { font-size: var(--t-body); line-height: 1.4; display: grid; gap: var(--space-3); margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.primer .key li { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: start; }
.primer .key .state { margin-top: calc((1.4em - 1.125rem) / 2); }
.primer h2 { margin-top: var(--space-5); }
.primer h2:first-child { margin-top: 0; }
.primer .body { text-wrap: pretty; }
#when { white-space: nowrap; }
@media (max-width: 47.99rem) { .top .wk, .top nav:not(:has(a:not(.wk))) { display: none; } } /* phone: the site name and the footer already go there */
/* tablet: before bigger letters turns itself on, the grid may use the sheet's side padding (play.js adds .full when that is enough) */
@media (min-width: 48rem) and (max-width: 61.99rem) {
  /* as big as the height left with the tools under it, but never so small a letter is under 24px */
  .wsframe { max-width: min(44rem, max(calc(var(--n) * 2.6rem), calc(100dvh - 28rem))); }
  .play.peeks .status { min-height: 1.5em; }
  .wsframe.full { width: auto; max-width: none; margin-inline: max(calc(-1 * var(--space-4)), calc(50% - 41dvh)); }
}
/* wide: a short head, then the grid from the top of the sheet, with the tools, what happened and the list beside it.
   The grid is as big as the height left on the first screen (--above is what sits over and under it), but never so small
   that a letter is under 20px */
@media (min-width: 62rem) {
  .head { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-5); }
  .head .lead { flex-basis: 100%; font-size: var(--t-body); }
  .play { --above: 14.5rem; --grid-w: min(44rem, max(calc(var(--n) * 2.2rem), calc(100dvh - var(--above))));
    grid-template-columns: minmax(0, var(--grid-w)) minmax(18rem, 1fr); grid-template-rows: auto auto auto auto 1fr;
    grid-template-areas: "grid solved" "grid fact" "grid tools" "grid status" "grid side"; align-items: start; gap: 0 var(--space-8); }
  .play.zoomed { grid-template-columns: minmax(0, 1fr) 18rem; }
  .play .solved { grid-area: solved; }
  .play .fact { grid-area: fact; }
  .tools { grid-area: tools; position: relative; }
  /* one row in the narrowest column, held to its right edge, which never moves: so Bigger letters stays under the pointer */
  .tools .tool { padding: 0 var(--space-3); }
  .tools .toolbar { justify-content: flex-end; }
  .confirm { position: absolute; z-index: 2; inset: 0 0 auto; min-height: 7.5rem; align-content: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: var(--line) solid var(--paper-edge); } /* over the tools and status, so the list never moves */
  .confirm p { flex-basis: 100%; font-size: var(--t-ui); line-height: 1.3; }
  .confirm .btn { padding-inline: var(--space-3); }
  .status { grid-area: status; }
  .wsframe { grid-area: grid; max-width: none; }
  .side { grid-area: side; }
  .play .solved, .play .fact, .tools, .status { margin-bottom: var(--space-4); }
}
/* print: the ground is white paper, so what is written on it turns to ink (a pale heading on white could not be read).
   :root twice, to outrank the night colours whichever way they were chosen */
@media print { .top, .foot, .toolbar, .how, .skip { display: none; }
  :root:root { --ground: #fff; --on-ground: var(--ink); --on-ground-soft: var(--ink-quiet); --ground-line: var(--paper-edge); --pebble: var(--paper-soft); --ground-deep: #fff; } }
