/*
 * Zoey Made — the playable word search (LRN-007).
 *
 * Loads on `/learn/word-search/` and on the component showcase, because it arrives attached to the
 * `zoey-made/learn-wordsearch` block and nowhere else.
 *
 * ## The two declarations the layout turns on
 *
 *   .zoey-ws__row  { grid-template-columns: repeat(var(--zoey-ws-cols), minmax(0, 1fr)); }
 *   .zoey-ws__cell { aspect-ratio: 1; }
 *
 * Fractions, not fixed lengths, and squares. **The complete board fits the available width and the
 * cells are whatever that leaves** — D6, approved 2026-10-06 after two physical device reviews of a
 * scoped proof. There is no scrolling container and **no transform on the board, its rows or its
 * cells**, so a cell's hit box is its painted box at every width, after every rotation, at every text
 * size.
 *
 * Transforms do appear further down — the dialog's pop-in scales, the confetti translates and
 * rotates, the speech bubble's tail is a rotated square. None of them is a hit target, and the claim
 * above is about the board's geometry rather than about the file.
 *
 * ## What that costs, which D6 approved knowingly
 *
 * A cell is about **25px at 320px and 31px at 390px** in focus mode — well under the 44px the style
 * guide protects for a utility control and the 48px it asks of a new child-facing one. D6 approves
 * that as a **scoped exception for word-search grid cells only**. Every ordinary control on this
 * page — the hint, the focus and exit controls, `Clear selection`, `Play again`, `Back to Learn` —
 * keeps its established size, and the stylesheet never reaches for them.
 *
 * ## Type
 *
 * Sized from the board's own width with container query units, so it tracks the cells exactly rather
 * than following a breakpoint that guesses at them.
 *
 * ## Touch
 *
 * `touch-action: pinch-zoom` on the grid and on nothing else: one finger on the letters selects,
 * **two-finger zoom stays the browser's**, and everywhere off the board the page scrolls as it
 * always did.
 */

/*
 * `[hidden]` is a user-agent rule and any class rule that sets `display` beats it. Every box here
 * whose visibility a directive binds is named first, before it is given a layout — the same guard
 * `learn-flashcards.css` carries, and for the same reason it needed it.
 */
.zoey-ws__say[hidden],
.zoey-ws__bar[hidden],
.zoey-ws__howto[hidden],
.zoey-ws__done-chip[hidden],
.zoey-ws__no-script[hidden],
.zoey-ws .zoey-action[hidden] {
	display: none;
}

/*
 * `min-inline-size: 0` down the whole chain.
 *
 * A grid item's automatic minimum size is its min-content width. With fractional tracks that is now
 * the widest single letter rather than a 609px board, so the stakes are lower than they were — but
 * the chain is kept, because the word list still contains a twelve-letter word and the status row
 * still contains a sentence.
 */
.zoey-ws,
.zoey-ws__stage,
.zoey-ws__bar,
.zoey-ws__board,
.zoey-ws__say,
.zoey-ws__words {
	min-inline-size: 0;
}

.zoey-ws {
	/*
	 * The seam between letters, tightened first and hardest.
	 *
	 * The revision says reduce the space between letters before reducing the letters, and this is
	 * that: one pixel on a phone. It is still a seam — the cells carry their own rounded highlight,
	 * so the grid reads as letters rather than as a wall of type — and it buys 11px of board on a
	 * twelve-wide grid, which is most of a point of font size.
	 */
	--zoey-ws-gap: 1px;

	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--40, 1rem);
}

@media (min-width: 30rem) {
	.zoey-ws {
		--zoey-ws-gap: 2px;
	}
}

/* --- The stage ---------------------------------------------------------------------------- */

.zoey-ws__stage {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--30, 0.75rem);
	align-content: start;
}

/*
 * ## Focus mode
 *
 * **Not an overlay.** The first version made the stage `position: fixed` over the page, which meant
 * a box whose height had to be managed, content that had to be squeezed into it, and — on iOS — a
 * board sitting under Safari's toolbar.
 *
 * This takes the page instead. The site header, the footer, the page title and the page's own prose
 * are `display: none`; this component's own bar stands in for the header; and **the document scrolls
 * normally**, so the word list below the board is reached the way everything else on the web is. A
 * short screen is no longer a layout problem, because nothing is trying to fit one.
 *
 * `:has()` is what lets a block reach the chrome around it. It is the same idiom
 * `learn-flashcards-print.css` uses to take the header off a printed sheet, and the scoping is the
 * same: the selector needs a focused puzzle on the page to match anything at all.
 *
 * **`:not(:has(.zoey-ws))` on the last line is load-bearing.** The block's own wrapper sits between
 * `.entry-content` and the component, so `> :not(.zoey-ws)` matched *the wrapper* and hid the board
 * along with everything else — a 0×0 grid in focus mode, which is how the first full test run
 * reported twenty-one failures that were all one selector.
 */
body:has(.zoey-ws.is-focus) > .wp-site-blocks > header.wp-block-template-part,
body:has(.zoey-ws.is-focus) > .wp-site-blocks > footer.wp-block-template-part,
body:has(.zoey-ws.is-focus) .zoey-scallop-frame,
body:has(.zoey-ws.is-focus) .wp-block-post-title,
body:has(.zoey-ws.is-focus) .zoey-ws__intro,
body:has(.zoey-ws.is-focus) .entry-content > :not(.zoey-ws):not(:has(.zoey-ws)) {
	display: none;
}

/*
 * The page's own margins go with the chrome: in focus mode the width belongs to the board.
 *
 * The inline padding matters more than the block padding, and by a lot. On a 390px phone the page's
 * 20px gutters cost 40px of board — a whole column at this size, and about 1.5pt of type. What
 * replaces them is 4px a side, which is enough that the letters are not against the bezel and
 * little enough to be honest about the word *minimal*.
 */
/*
 * Named by what they are rather than by `main`, because the thing holding the content here is a
 * `wp-block-group` with 72px of top padding and 24px of margin, and `main` was never going to match
 * it. Measured: 160px of blank screen above the bar before this rule existed — a fifth of a phone,
 * spent on the space where a hidden page title used to be.
 */
/*
 * `!important`, and it is earned rather than lazy. The group's 72px of top padding is an **inline
 * style**, written by the block editor's spacing support, and no selector beats an inline style.
 * `learn-flashcards-print.css` needed the same escape for the same reason when it took the header
 * off a printed sheet.
 */
body:has(.zoey-ws.is-focus) .wp-site-blocks > .wp-block-group,
body:has(.zoey-ws.is-focus) .wp-site-blocks > main,
body:has(.zoey-ws.is-focus) .entry-content,
body:has(.zoey-ws.is-focus) .wp-block-post-content {
	margin-block: 0 !important;
	padding: 0 !important;
	max-inline-size: none;
}

/*
 * The block wrapper gives up all of its padding. The component gives up its **block** padding only,
 * and that difference is the whole of SPL-001's §2.0b amendment.
 *
 * This rule used to say `padding: 0` for both, which quietly beat the `padding-inline: 0.25rem` ten
 * lines below — one more element in the selector wins whatever the order — so the 4px that rule
 * asks for, and that its own comment explains, had never once applied. The component therefore sat
 * flush against both edges of the screen, and so did its keyboard target: measured at 390px, the
 * stage spanned 0 to 390 and its focus ring was drawn at -1 and 391. **A focus indicator you cannot
 * see on a touch device is a focus indicator that is not there.**
 *
 * The cost is 8px of a 390px screen, so the board goes to 382px. The gutter is the one this file
 * already specified; nothing new is introduced, and the whole board still fits.
 */
body:has(.zoey-ws.is-focus) .zoey-ws {
	margin-block: 0;
	padding-block: 0;
	max-inline-size: none;
}

body:has(.zoey-ws.is-focus) .zoey-learn-wordsearch-block {
	margin-block: 0;
	padding: 0;
	max-inline-size: none;
}

.zoey-ws.is-focus {
	padding-inline: 0.25rem;
	gap: var(--wp--preset--spacing--20, 0.5rem);
}

/* --- The bar ------------------------------------------------------------------------------ */

.zoey-ws__bar {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30, 0.75rem);
	align-items: center;
	justify-content: space-between;
}

/* Each member may be narrower than its contents, so the row wraps instead of running off the side. */
.zoey-ws__bar > * {
	min-inline-size: 0;
}

/*
 * **The control row is one line, and stays one line when its contents change.**
 *
 * `action.css` gives group members a `min(100%, 9rem)` floor below 48rem so that a pair of utilities
 * reads as a pair rather than as one long control and one short one. That is right on an ordinary
 * page and wrong here: completion swaps one hint control for two completed ones, and with the floor
 * the row went from one line to two — **moving the board 18px down the screen at the exact moment a
 * child is looking at it.** Measured, and then fixed here rather than tolerated in a test.
 *
 * Content-sized members keep *Play again* and *Back to Learn* on one line even at 320px, so the
 * swap costs nothing and nothing below it moves. The composing surface positioning what it composes,
 * which is what the component contract allows it to do.
 */
/*
 * The extra `.zoey-ws` is specificity, not decoration: `action.css`'s floor lives in a media query at
 * the same weight and loads after this file, so an equal-specificity rule here loses on order and
 * the controls kept stacking full-width. Measured on a capture, which is the only place it showed.
 */
.zoey-ws .zoey-ws__bar .zoey-action {
	flex: 0 1 auto;
	min-inline-size: 0;
	padding-inline: var(--wp--preset--spacing--30, 0.75rem);
}

.zoey-ws__progress {
	margin: 0;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/*
 * In focus mode the bar **is** the header, so it behaves like one: it stays at the top of the
 * screen, below the admin bar if there is one, and it is the only furniture between the child and
 * the puzzle.
 */
.zoey-ws.is-focus .zoey-ws__bar {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 5;
	/*
	 * Two rows, deliberately. On one row the progress, the disclosure and three controls fought for
	 * a 390px bar: *How to play* wrapped onto two lines and the controls stacked at different widths
	 * beside it. Wrapping puts the two pieces of text on the first line and the controls on the
	 * second, which is taller by one line and legible — and a bar a child can read is worth a row of
	 * letters more than a bar that fits.
	 */
	flex-wrap: wrap;
	gap: 0.25rem var(--wp--preset--spacing--20, 0.5rem);
	/*
	 * A little inline padding for the bar and **none for the board**. The board's margin is the
	 * scarce resource — every 8px of it is a third of a cell at 320px — so the breathing room goes
	 * where it costs nothing: around the controls, which have their own.
	 */
	padding: 0.375rem 0.25rem;
	background: var(--wp--preset--color--surface, #fff);
	border-block-end: 1px solid var(--wp--preset--color--border-soft, #e9e0ed);
}

.zoey-ws.is-focus .zoey-ws__progress {
	flex: 0 0 auto;
	font-size: var(--wp--preset--font-size--body-small, 0.875rem);
}

.zoey-ws.is-focus .zoey-ws__views {
	flex: 1 0 100%;
	justify-content: flex-start;
	gap: var(--wp--preset--spacing--20, 0.5rem);
}

.zoey-ws.is-focus /*
 * The extra `.zoey-ws` is specificity, not decoration: `action.css`'s floor lives in a media query at
 * the same weight and loads after this file, so an equal-specificity rule here loses on order and
 * the controls kept stacking full-width. Measured on a capture, which is the only place it showed.
 */
.zoey-ws .zoey-ws__bar .zoey-action {
	flex: 0 1 auto;
	min-inline-size: 0;
	padding-inline: var(--wp--preset--spacing--30, 0.75rem);
}

.zoey-ws.is-focus .zoey-ws__howto {
	flex: 0 1 auto;
	margin-inline-start: auto;
}

/*
 * The instructions, as a native disclosure.
 *
 * `docs/INTERACTIVITY.md`'s first rung: a reveal that works with no CSS and no JavaScript. It is the
 * one control on this page that needs neither, and in focus mode it is the only place the rules
 * live, because the page's own prose is gone.
 */
.zoey-ws__howto {
	flex: 0 1 auto;
	min-inline-size: 0;
	font-size: var(--wp--preset--font-size--body-small, 0.875rem);
}

.zoey-ws__howto > summary {
	display: inline-flex;
	align-items: center;
	min-block-size: 2.75rem;
	padding-inline: 0.25rem;
	font-weight: 700;
	cursor: pointer;
}

.zoey-ws__howto > p {
	margin: 0.25rem 0 0.5rem;
	color: var(--wp--preset--color--ink-soft, #695672);
}

/* --- The board ---------------------------------------------------------------------------- */

/*
 * No `overflow`, no `overscroll-behavior`, no scrollbar. The board is as wide as it is given and
 * every cell of it is on screen — which is the entire revision in one absence.
 *
 * `container-type: inline-size` is here so the letters can be sized from the board's own width.
 */
/*
 * A ceiling, because "fit the width" stops being a kindness on a desktop.
 *
 * Unbounded, a 1440px window gave 101px cells and a board the size of a dinner tray. 34rem is about
 * where a twelve-wide board stops reading as a puzzle and starts reading as a wall chart; above it
 * the board simply centres. The phone, which is what the revision is about, never reaches the cap.
 */
.zoey-ws__board {
	container-type: inline-size;
	/*
	 * An explicit `inline-size`, not `max-inline-size` plus `margin-inline: auto`.
	 *
	 * Auto margins on a grid item turn off its stretch and make it size to its contents — and this
	 * item is a size container, so its contents contribute nothing to its inline size. The board
	 * collapsed to its own 2px of padding, in both views, and the test that would have caught it
	 * was two minutes from being written. A single width is unambiguous.
	 */
	inline-size: min(100%, 34rem);
	margin-inline: auto;
	padding: 0;
	border: 0;
	background: none;
}

.zoey-ws__grid {
	position: relative;
	display: grid;
	gap: var(--zoey-ws-gap);
	inline-size: 100%;
	padding: var(--zoey-ws-gap);
	border-radius: 0.75rem;
	background: var(--wp--preset--color--surface-soft, #fffbef);
	/* One finger selects; two fingers still zoom. There is no other mode to be in. */
	touch-action: pinch-zoom;
}

.zoey-ws__row {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: repeat(var(--zoey-ws-cols, 12), minmax(0, 1fr));
	gap: var(--zoey-ws-gap);
}

/*
 * One letter.
 *
 * Square by `aspect-ratio`, sized by its grid track, and **not scaled**: the painted box is the
 * layout box, so pointer coordinates, the focus ring and the drawn highlights all agree with it
 * after a resize or a rotation without anything being recomputed.
 *
 * The type comes from the board's width: `100cqi / columns` is one column, and a little over half of
 * that is a letter that sits in its cell with room around it. `clamp()` holds it between a floor
 * that is already too small — it is there to be *reported*, not to be relied on — and a ceiling a
 * desktop has no use for exceeding.
 */
.zoey-ws__cell {
	display: grid;
	place-items: center;
	aspect-ratio: 1;
	inline-size: 100%;
	min-inline-size: 0;
	padding: 0;
	border: 0;
	border-radius: 0.25rem;
	background: transparent;
	font-family: inherit;
	font-size: clamp(0.5rem, calc(100cqi / var(--zoey-ws-cols, 12) * 0.56), 1.375rem);
	font-weight: 800;
	line-height: 1;
	color: var(--wp--preset--color--ink, #342f40);
	cursor: pointer;
}

/*
 * With no JavaScript the letters are not controls, and they should not look like broken ones.
 * `disabled` is how they stop being controls; this is how they stop announcing it visually.
 */
.zoey-ws__cell:disabled {
	opacity: 1;
	cursor: default;
}

.zoey-ws__cell.is-found {
	text-decoration: underline;
	text-decoration-thickness: 0.09em;
	text-underline-offset: 0.18em;
}

/*
 * The live path, carried by a class as well as by the drawn stroke.
 *
 * Two channels for one state, and the duplication is on purpose: a one-cell selection has no stroke
 * to draw, and a test that asks *"is the path the browser shows the same as the path the code
 * resolved?"* can ask the cells rather than measure an SVG.
 */
.zoey-ws__cell.is-selected {
	background: var(--wp--preset--color--zoey-pink-pale, #fdeaf1);
}

.zoey-ws__cell.is-anchor {
	box-shadow: inset 0 0 0 2px var(--wp--preset--color--ink, #342f40);
}

/*
 * The strokes.
 *
 * Drawn under the letters, from the cells' own measured centres, by the view module. `pointer-events:
 * none` is load-bearing rather than tidy: the overlay sits across the whole grid, and without it
 * every drag would hit the picture instead of the letters.
 */
.zoey-ws__overlay {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
}

.zoey-ws__strokes {
	display: block;
	overflow: visible;
}

/*
 * The found-word highlight: one soft rounded band behind the letters.
 *
 * **The transparency is on the group, not on the strokes.** Translucent strokes that cross paint
 * twice and the crossing comes out darker than either word — a third shape appearing exactly where
 * a child most needs to tell two words apart. One composite means a crossing is the same colour as a
 * single word.
 *
 * The colour is the palette's lavender rather than its pale preset, taken down by the group: a pale
 * preset already made translucent is barely there, and the band has to be visible under 800-weight
 * ink without competing with it. Measured against `ink` on `surface-soft`, the letters stay above
 * 7:1 on the band — the highlight is behind the reading, not in front of it.
 */
.zoey-ws__found-group {
	opacity: 0.42;
}

.zoey-ws__stroke {
	stroke: var(--wp--preset--color--zoey-lavender, #c9b6e4);
	stroke-linecap: round;
	fill: none;
}

/*
 * The live one is drawn outside the group and at full strength, because *being chosen right now* is
 * a different state from *having been found* and should not look like a pale version of it.
 */
.zoey-ws__stroke--live {
	stroke: var(--wp--preset--color--zoey-pink, #facbdd);
	opacity: 0.85;
}

/* --- The word list ------------------------------------------------------------------------ */

/*
 * Below the board, wrapping, in both views.
 *
 * The first version squeezed it onto one sideways-scrolling line to buy rows for a board that could
 * not fit. With the board fitting there is nothing to buy, and a list that wraps is a list a child
 * can read at a glance.
 */
.zoey-ws__words-title {
	margin: 0 0 0.5rem;
	font-size: var(--wp--preset--font-size--card-title, 1.125rem);
}

.zoey-ws.is-focus .zoey-ws__words-title {
	font-size: var(--wp--preset--font-size--body-small, 0.875rem);
}

.zoey-ws__word-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * `overflow-wrap: anywhere` so the longest supported word may break rather than push the page.
 *
 * At 200% text on a 320px screen, THUNDERSTORM is wider than the column it sits in — enough to
 * scroll the whole document sideways. Breaking a spelling word across two lines is not lovely, and
 * it is better than a page that slides when a child touches it. It only breaks when it must.
 */
.zoey-ws__word {
	display: flex;
	gap: 0.375rem;
	align-items: center;
	min-inline-size: 0;
	overflow-wrap: anywhere;
	font-weight: 700;
}

/*
 * Found, in three channels at once: the mark, the strike and the colour. *"Color alone is
 * insufficient"* — and a child scanning a list of ten words needs the answer from across the table,
 * not from a careful comparison of two purples.
 */
/*
 * The box, and the tick inside it.
 *
 * The tick is the shared `check` icon — the same glyph the rest of the site uses for *this is done*
 * — drawn into the box and revealed when the word is found. It is `aria-hidden`: a screen reader is
 * told about found through `aria-describedby`, and a second announcement inside the item would make
 * the word read as *"CLOUD Found"* in places a bare word belongs.
 */
.zoey-ws__word-mark {
	display: grid;
	place-items: center;
	flex: none;
	inline-size: 1.25rem;
	block-size: 1.25rem;
	border: 0.125rem solid var(--wp--preset--color--border-soft, #d6cddd);
	border-radius: 0.3125rem;
	background: var(--wp--preset--color--surface, #fff);
}

.zoey-ws__tick {
	inline-size: 0.875rem;
	block-size: 0.875rem;
	opacity: 0;
	stroke-width: 3.25;
}

.zoey-ws__word.is-found {
	color: var(--wp--preset--color--ink-soft, #695672);
	text-decoration: line-through;
}

.zoey-ws__word.is-found .zoey-ws__word-mark {
	border-color: var(--wp--preset--color--zoey-purple, #61458b);
	background: var(--wp--preset--color--zoey-lavender-pale, #e6dcf4);
}

.zoey-ws__word.is-found .zoey-ws__tick {
	opacity: 1;
	color: var(--wp--preset--color--zoey-purple, #61458b);
}

/* --- What just happened ------------------------------------------------------------------- */

/*
 * A reserved row, and it is load-bearing.
 *
 * The sentence and the undo share one line whose height is fixed whether either is showing. An
 * earlier version put *Clear selection* in the control bar, where it appeared the moment a first
 * letter was chosen — and the bar wrapped to a second line and pushed the board down about two rows,
 * under the finger that was still mid-drag. A row that cannot change height cannot do that.
 */
.zoey-ws__say {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0 var(--wp--preset--spacing--30, 0.75rem);
	align-items: center;
	min-block-size: 3.5rem;
}

/* On a phone the undo goes under the sentence instead of beside it, in a row that is still fixed. */
@media (max-width: 30rem) {
	.zoey-ws__say {
		grid-template-columns: minmax(0, 1fr);
		justify-items: start;
		gap: 0.375rem;
		min-block-size: 6rem;
	}
}

.zoey-ws__status {
	margin: 0;
	min-inline-size: 0;
	color: var(--wp--preset--color--ink-soft, #695672);
}

/* The undo never shrinks away from its own label, however long the sentence beside it is. */
.zoey-ws .zoey-ws__clear {
	flex: none;
}

/* --- The celebration ------------------------------------------------------------------------- */

/*
 * The dialog itself is the shared `zoey_made_dialog()`; `components/dialog.css` owns its shell. What
 * is here is the confetti, which lives **inside** the dialog so it is over the panel and under
 * nothing — a burst behind a modal backdrop would be a burst nobody sees.
 *
 * **Two bursts from opposite sides**, approved 2026-10-06 after the first version was reviewed and
 * found too subtle. Each piece carries its own angle, distance, size, spin and delay as custom
 * properties set by the view module, and the keyframes below turn those into an arc outward and
 * upward and then a fall.
 *
 * It reaches nothing: `pointer-events: none` keeps it off a finger, `aria-hidden` on the container
 * keeps it out of the accessibility tree, and `overflow: clip` means it cannot create a scrollbar or
 * cover a control outside the panel.
 */
.zoey-ws__confetti {
	position: absolute;
	inset: -70% -25% -30%;
	z-index: 1;
	overflow: clip;
	pointer-events: none;
}

.zoey-ws__confetto {
	position: absolute;
	inset-block-end: 38%;
	inset-inline-start: var(--zoey-ws-from, 50%);
	inline-size: var(--zoey-ws-size, 9px);
	block-size: var(--zoey-ws-tall, 12px);
	border-radius: 2px;
	background: var(--wp--preset--color--zoey-pink, #facbdd);
	opacity: 0;
	animation: zoey-ws-burst 1800ms cubic-bezier(0.18, 0.7, 0.35, 1) forwards;
	animation-delay: var(--zoey-ws-delay, 0ms);
}

/* Four palette colours, by position rather than a class per piece. */
.zoey-ws__confetto:nth-child(4n + 2) {
	background: var(--wp--preset--color--zoey-aqua, #9fe3dd);
}

.zoey-ws__confetto:nth-child(4n + 3) {
	background: var(--wp--preset--color--zoey-lavender, #c9b6e4);
}

.zoey-ws__confetto:nth-child(4n + 4) {
	background: var(--wp--preset--color--zoey-mint, #bfe9c6);
}

/*
 * Out and up, then down. The midpoint is the top of the arc, which is what makes it read as thrown
 * rather than dropped; the end is below where it started, which is what makes it read as fallen.
 * Nothing loops and nothing flashes — one pass, then gone.
 */
@keyframes zoey-ws-burst {
	0% {
		opacity: 0;
		transform: translate(0, 0) rotate(0deg) scale(0.6);
	}

	8% {
		opacity: 1;
	}

	45% {
		transform: translate(calc(var(--zoey-ws-dx, 0) * 0.55), var(--zoey-ws-rise, -60px)) rotate(calc(var(--zoey-ws-spin, 360deg) * 0.45)) scale(1);
	}

	85% {
		opacity: 1;
	}

	100% {
		opacity: 0;
		transform: translate(var(--zoey-ws-dx, 0), 320px) rotate(var(--zoey-ws-spin, 360deg)) scale(0.9);
	}
}

/* --- The completed state in the bar ---------------------------------------------------------- */

/*
 * *Completed*, beside the progress, in both views. It appears when the puzzle is finished and takes
 * the hint's place in the row — the contract asks for the completed controls to **replace** the
 * hint rather than leave a control that would do nothing.
 */
.zoey-ws__done-chip {
	margin: 0;
	padding: 0.125rem 0.625rem;
	border-radius: var(--wp--custom--radius--pill, 999px);
	background: var(--wp--preset--color--zoey-mint, #bfe9c6);
	font-size: var(--wp--preset--font-size--body-small, 0.875rem);
	font-weight: 800;
}

.zoey-ws__done-chip[hidden] {
	display: none;
}

/* --- The hint ------------------------------------------------------------------------------- */

/*
 * A hint points at **one cell** — the first letter of one unfound word — and never draws the word.
 * The contract is explicit that a hint does not mark a word found, and a highlight along the whole
 * run would have done exactly that in everything but the bookkeeping.
 */
.zoey-ws__cell.is-hint {
	box-shadow: inset 0 0 0 2px var(--wp--preset--color--zoey-purple, #61458b);
	background: var(--wp--preset--color--zoey-yellow, #ffe08a);
}

.zoey-ws__word.is-hinted {
	text-decoration: underline;
	text-decoration-thickness: 0.125rem;
	text-underline-offset: 0.2em;
}

/* --- Forced colours ----------------------------------------------------------------------- */

/*
 * In a forced-colours mode the palette is gone, so found and selected have to be shapes.
 *
 * The strokes are redrawn in the system's own highlight colours with `forced-color-adjust: none`,
 * which is the one place this stylesheet overrides the user's palette — and it overrides it with two
 * colours the user's own mode supplies, rather than with a colour of ours.
 */
@media (forced-colors: active) {
	.zoey-ws__cell.is-found,
	.zoey-ws__cell.is-selected {
		outline: 2px solid CanvasText;
		outline-offset: -2px;
	}

	.zoey-ws__cell.is-anchor {
		outline: 2px dashed Highlight;
	}

	.zoey-ws__stroke {
		forced-color-adjust: none;
		stroke: GrayText;
	}

	.zoey-ws__stroke--live {
		stroke: Highlight;
	}

	.zoey-ws__word.is-found .zoey-ws__word-mark {
		background: Highlight;
	}

	.zoey-ws__word.is-found .zoey-ws__tick {
		color: HighlightText;
	}

	/* The group's transparency is a palette effect, and there is no palette here. */
	.zoey-ws__found-group {
		opacity: 1;
	}

	.zoey-ws__confetto {
		background: CanvasText;
	}

	.zoey-ws__done-chip {
		border: 1px solid CanvasText;
	}
}

/* --- Reduced motion ----------------------------------------------------------------------- */

/*
 * There is no motion here to remove, and this block says so rather than leaving the question open.
 * Nothing in the proof animates: the highlight appears where the finger is, the stroke is drawn, the
 * view changes. The one thing that could have moved is a scroll this component asks for, and it does
 * not ask for any — with the board no longer inside a scroller, it cannot.
 */
/*
 * The one thing on this page that moves is the celebration, and this is where it stops.
 *
 * **The message, the actions and the announcement all stay** — `docs/INTERACTIVITY.md`: *"What
 * reduced motion removes is movement. The state change, the colour, the message and the announcement
 * all stay."* The view module also declines to create the pieces at all under this preference, so
 * this rule is the belt to that braces: a reader who changes the setting mid-game is covered by one,
 * and a stylesheet that forgot by the other.
 *
 * The selectors repeat the ones above rather than relying on a shorter path, because a reduced-motion
 * rule that quietly loses on specificity is worse than none — it reads as handled.
 */
@media (prefers-reduced-motion: reduce) {
	.zoey-ws__confetto {
		animation: none;
		display: none;
	}

	.zoey-ws__cell,
	.zoey-ws__stroke,
	.zoey-ws__stage {
		transition: none;
	}
}
