/**
 * Science Word Search
 *
 * Everything is scoped under .wsg. The previous stylesheet styled bare
 * .control-btn, .nav-link and .controls, which applied to the whole site and
 * needed !important to win against the theme. Scoping removes both problems.
 *
 * Layout is entirely CSS: the grid sizes itself from --wsg-size and aspect-ratio,
 * so it works at any width and any grid size with no JavaScript and no resize
 * listener. That is what lets the daily run at 15x15 and a topic sheet at 16x16
 * off the same stylesheet, and it is why the print sheet can invert the whole
 * thing by overriding nine custom properties and nothing else.
 *
 * The board is a deep navy panel with a star wash, sitting inside the site's
 * white page. On this site that is not a departure: 33science's own identity is
 * navy and cyan with a coral accent and a .t33-stars twinkle layer, so the board
 * reads as the most concentrated version of the site rather than as a foreign
 * widget.
 */

.wsg {
	/*
	 * The t33 palette, mapped onto the engine's tokens. The token NAMES are
	 * positional, not descriptive - they are inherited from the original nature
	 * game, where the found-word colour really was leaf green. What matters is
	 * the role in the comment, not the word after --wsg-.
	 */
	--wsg-ink: #e8f1ff;        /* text and anything strong */
	--wsg-cream: #070b1a;      /* the board itself, deepest layer (t33-navy-1) */
	--wsg-mint: #16213f;       /* raised panels: chips, completion box (t33-navy-3) */
	--wsg-cell: #1b2a50;       /* a single grid cell */
	--wsg-cell-hover: #273a6b;
	--wsg-sky: #2bc8e8;        /* live selection (t33-cyan) */
	--wsg-leaf: #f67280;       /* a word that has been found (t33-coral) */
	--wsg-coral: #ffc857;      /* hints and bonus words - a third hue on purpose,
	                              so "selected", "found" and "hinted" are never
	                              told apart by brightness alone */

	/*
	 * 33science enqueues no webfont at all; the only explicit family anywhere in
	 * the child theme is Georgia in t33-single.css. So there is nothing useful to
	 * inherit, and a token of our own is the honest version - and makes a future
	 * theme font a one-line change rather than a search through this file.
	 */
	--wsg-title-font: var(--title-font, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif);
	--wsg-body-font: var(--body-font, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif);

	--wsg-ink-72: rgba(232, 241, 255, 0.72);
	--wsg-ink-55: rgba(232, 241, 255, 0.55);
	--wsg-ink-38: rgba(232, 241, 255, 0.38);
	--wsg-ink-18: rgba(232, 241, 255, 0.18);
	--wsg-ink-08: rgba(232, 241, 255, 0.08);

	/* t33-shadow-lift, deepened for a dark panel. Never black: the site's own
	   shadows are tinted navy and a black one reads as a hole. */
	--wsg-shadow: 0 18px 44px rgba(7, 11, 26, 0.32);

	/* Radii ladder. */
	--wsg-r-lg: 18px;
	--wsg-r: 14px;   /* --t33-radius */
	--wsg-r-sm: 9px;

	--wsg-size: 15;
	--wsg-font-scale: 1;
	/* Cell separation is a transparent border, not a grid gap: with gap the cells
	   no longer tile at exactly 100%/size and the capsule maths drifts. */
	--wsg-cell-gap: clamp(1px, 0.28cqi, 3px);
	--wsg-pad: clamp(3px, 0.8cqi, 8px);

	container-type: inline-size;
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 2rem;
	padding: clamp(14px, 3cqi, 26px);
	/*
	 * Two sparse star layers over a vertical wash. background-size differs per
	 * layer so the specks never line up into a visible tile edge, and both are
	 * transparent past their radius so the wash shows through.
	 */
	background-color: var(--wsg-cream);
	background-image:
		radial-gradient(1px 1px at 18% 24%, rgba(255, 255, 255, 0.55), transparent 100%),
		radial-gradient(1px 1px at 72% 61%, rgba(255, 255, 255, 0.42), transparent 100%),
		radial-gradient(1.4px 1.4px at 43% 82%, rgba(255, 255, 255, 0.5), transparent 100%),
		linear-gradient(168deg, #16213f 0%, #0d1530 58%, #070b1a 100%);
	background-size: 190px 190px, 230px 230px, 310px 310px, 100% 100%;
	border: 1px solid rgba(232, 241, 255, 0.1);
	border-radius: var(--wsg-r-lg);
	box-shadow: var(--wsg-shadow);
	font-family: var(--wsg-body-font);
	color: var(--wsg-ink);
}

.wsg *,
.wsg *::before,
.wsg *::after {
	box-sizing: inherit;
}

.wsg-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------- header --- */

.wsg-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.wsg .wsg-theme {
	margin: 0;
	padding: 0;
	font-family: var(--wsg-title-font);
	font-size: clamp(1.3rem, 3.4cqi, 1.9rem);
	line-height: 1.2;
	color: var(--wsg-ink);
}

.wsg .wsg-blurb {
	margin: 4px 0 0;
	font-size: 1.05rem;
	color: var(--wsg-ink-72);
}

.wsg-tools {
	display: flex;
	gap: 8px;
	margin-left: auto;
}

/* ----------------------------------------------------------------- stats --- */

.wsg .wsg-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

.wsg .wsg-stat {
	padding: 5px 12px;
	background: var(--wsg-mint);
	border-radius: 999px;
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--wsg-ink);
	font-variant-numeric: tabular-nums;
}

.wsg-stat-time {
	background: transparent;
	border: 1px solid var(--wsg-ink-18);
	color: var(--wsg-ink-72);
}

.wsg-stat-bonus {
	background: color-mix(in srgb, var(--wsg-coral) 18%, transparent);
}

.wsg-stat[hidden] {
	display: none;
}

/* --------------------------------------------------------------- buttons --- */

.wsg .wsg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	padding: 8px 16px;
	border: 2px solid var(--wsg-ink-18);
	border-radius: 999px;
	background: transparent;
	color: var(--wsg-ink);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.wsg .wsg-btn:hover:not(:disabled):not(.is-disabled) {
	background: var(--wsg-mint);
	border-color: var(--wsg-ink-38);
}

.wsg-btn:disabled,
.wsg-btn.is-disabled {
	color: var(--wsg-ink-38);
	border-color: var(--wsg-ink-08);
	cursor: not-allowed;
	pointer-events: none;
}

.wsg .wsg-btn-primary {
	background: var(--wsg-ink);
	border-color: var(--wsg-ink);
	color: var(--wsg-cream);
}

.wsg .wsg-btn-primary:hover:not(:disabled) {
	background: #ffffff;
	border-color: #ffffff;
	color: var(--wsg-cream);
}

.wsg-btn-icon {
	min-width: 40px;
	padding: 8px 10px;
}

.wsg-btn-hint {
	width: 100%;
	margin-top: 12px;
}

/* Sound button shows one glyph at a time. */
.wsg-btn[data-wsg-sound] .wsg-sound-off {
	display: none;
}

.wsg-btn[data-wsg-sound][aria-pressed="false"] .wsg-sound-on {
	display: none;
}

.wsg-btn[data-wsg-sound][aria-pressed="false"] .wsg-sound-off {
	display: inline;
}

.wsg-btn[data-wsg-font][aria-pressed="true"] {
	background: var(--wsg-mint);
	border-color: var(--wsg-ink-38);
}

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

.wsg-board {
	display: grid;
	grid-template-columns: 1fr;
	gap: 18px;
	align-items: start;
}

/*
 * The real constraint is how wide the container is, not the viewport. A viewport
 * media query was why the grid broke inside narrow containers on wide screens.
 */
@container (min-width: 40rem) {
	.wsg-board {
		grid-template-columns: minmax(0, 1fr) 14rem;
	}
}

.wsg-grid-wrap {
	min-width: 0;
}

.wsg-grid {
	position: relative;
	display: grid;
	grid-template-rows: repeat(var(--wsg-size), 1fr);
	gap: 0;
	width: 100%;
	max-width: calc(var(--wsg-size) * 46px);
	margin-inline: auto;
	padding: var(--wsg-pad);
	background: var(--wsg-ink-08);
	border-radius: var(--wsg-r);
	/* Without this the browser steals the drag to scroll the page. */
	touch-action: none;
	overscroll-behavior: contain;
}

.wsg-row {
	display: grid;
	grid-template-columns: repeat(var(--wsg-size), minmax(0, 1fr));
	gap: 0;
}

.wsg .wsg-cell {
	aspect-ratio: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	z-index: 1;
	padding: 0;
	border: var(--wsg-cell-gap) solid transparent;
	border-radius: var(--wsg-r-sm);
	background: var(--wsg-cell);
	/* Keeps the transparent border clear so the grid ground shows through as the
	   gap, and so a capsule underneath stays visible. */
	background-clip: padding-box;
	color: var(--wsg-ink);
	font-family: inherit;
	font-size: calc(clamp(0.6rem, 2.15cqi, 1.5rem) * var(--wsg-font-scale));
	font-weight: 700;
	line-height: 1;
	text-transform: uppercase;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	transition: background 0.15s, color 0.15s, transform 0.15s;
}

@media (hover: hover) {
	.wsg-cell:hover {
		background: var(--wsg-cell-hover);
	}
}

.wsg-cell.is-selected {
	background: var(--wsg-sky);
	color: #fff;
}

.wsg-cell.is-anchor {
	background: var(--wsg-sky);
	color: #fff;
	transform: scale(1.06);
}

.wsg-cell.is-found {
	/* The capsule behind carries the colour; the cell goes clear so it shows through. */
	background: transparent;
	color: var(--wsg-ink);
}

.wsg-cell.is-bonus {
	background: transparent;
	color: var(--wsg-ink);
}

.wsg-cell.is-hint {
	background: var(--wsg-coral);
	color: #fff;
	animation: wsg-pulse 0.9s ease-in-out infinite;
}

.wsg .wsg-cell:focus-visible {
	outline: 3px solid var(--wsg-sky);
	outline-offset: 2px;
	z-index: 3;
}

.wsg.is-complete .wsg-cell {
	cursor: default;
}

/* -------------------------------------------------------------- capsules --- */

/*
 * One capsule per found word, drawn over the grid.
 *
 * Geometry is entirely in percentages of the grid box, driven by custom
 * properties JS sets once per word. Measuring pixels instead would mean a
 * ResizeObserver and re-measuring on every reflow.
 */
.wsg-capsules {
	position: absolute;
	inset: var(--wsg-pad);
	pointer-events: none;
	z-index: 0;
}

.wsg-capsule {
	position: absolute;
	top: calc(var(--r) * 100% / var(--wsg-size));
	left: calc(var(--c) * 100% / var(--wsg-size));
	width: calc(var(--span) * 100% / var(--wsg-size));
	height: calc(100% / var(--wsg-size));
	transform-origin: var(--ox) 50%;
	transform: rotate(var(--deg));
	background: color-mix(in srgb, var(--wsg-leaf) 32%, transparent);
	border: 2px solid var(--wsg-leaf);
	border-radius: 999px;
	animation: wsg-capsule-in 0.35s ease;
}

.wsg-capsule.is-bonus {
	background: color-mix(in srgb, var(--wsg-coral) 26%, transparent);
	border-color: var(--wsg-coral);
}

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

.wsg-side {
	min-width: 0;
}

.wsg .wsg-list-title {
	margin: 0 0 10px;
	line-height: 1.3;
	font-family: var(--wsg-title-font);
	font-size: 1.15rem;
	color: var(--wsg-ink);
}

.wsg .wsg-wordlist {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@container (min-width: 40rem) {
	.wsg-wordlist {
		grid-template-columns: 1fr;
	}
}

.wsg .wsg-word {
	list-style: none;
	margin: 0;
	padding: 7px 12px;
	background: var(--wsg-mint);
	border-radius: 999px;
	font-size: calc(1rem * var(--wsg-font-scale));
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--wsg-ink);
	transition: background 0.25s, opacity 0.25s;
}

.wsg .wsg-word.is-found {
	background: var(--wsg-leaf);
	color: var(--wsg-cream);
	opacity: 0.85;
	animation: wsg-pop 0.4s ease;
}

.wsg-word.is-found .wsg-word-text {
	text-decoration: line-through;
}

.wsg .wsg-word a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ------------------------------------------------------------ completion --- */

.wsg-complete[hidden] {
	display: none;
}

.wsg-complete {
	margin-top: 18px;
	padding: 18px;
	background: var(--wsg-mint);
	border-left: 5px solid var(--wsg-leaf);
	border-radius: var(--wsg-r);
	animation: wsg-slide-in 0.4s ease;
}

.wsg .wsg-complete-title {
	margin: 0;
	font-family: var(--wsg-title-font);
	font-size: 1.45rem;
	color: var(--wsg-ink);
}

.wsg .wsg-result {
	margin: 6px 0 0;
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--wsg-ink-72);
	font-variant-numeric: tabular-nums;
}

.wsg-complete-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}

.wsg .wsg-countdown {
	margin: 12px 0 0;
	font-size: 0.9rem;
	color: var(--wsg-ink-55);
	font-variant-numeric: tabular-nums;
}

/* Reserved height so revealing the ad shifts nothing. */
.wsg-ad {
	min-height: 280px;
	margin-top: 16px;
}

.wsg-ad:empty {
	display: none;
}

.wsg-reads[hidden] {
	display: none;
}

.wsg-reads,
.wsg-archive {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--wsg-ink-18);
}

.wsg .wsg-reads-title {
	margin: 0 0 10px;
	line-height: 1.3;
	font-family: var(--wsg-title-font);
	font-size: 1.15rem;
	color: var(--wsg-ink);
}

.wsg .wsg-reads-list {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wsg .wsg-reads-list a {
	display: block;
	padding: 10px 14px;
	background: var(--wsg-cream);
	border: 1px solid var(--wsg-ink-08);
	border-radius: var(--wsg-r-sm);
	color: var(--wsg-ink);
	font-size: 0.9rem;
	font-weight: 700;
	text-decoration: none;
}

.wsg .wsg-reads-list a:hover {
	border-color: var(--wsg-leaf);
}

.wsg .wsg-archive-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wsg .wsg-archive-list a {
	display: inline-block;
	padding: 5px 12px;
	background: var(--wsg-cream);
	border: 1px solid var(--wsg-ink-08);
	border-radius: 999px;
	color: var(--wsg-ink-72);
	font-size: 0.8rem;
	font-weight: 700;
	text-decoration: none;
}

.wsg .wsg-archive-list a:hover {
	color: var(--wsg-ink);
	border-color: var(--wsg-ink-38);
}

/* ------------------------------------------------------------------- nav --- */

.wsg-nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-top: 18px;
}

/* ----------------------------------------------------------------- toast --- */

.wsg .wsg-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 9999;
	transform: translateX(-50%);
	padding: 12px 20px;
	background: var(--wsg-ink);
	border-radius: 999px;
	color: var(--wsg-cream);
	font-family: var(--wsg-body-font);
	font-size: 0.9rem;
	font-weight: 700;
	box-shadow: 0 12px 30px rgba(4, 9, 26, 0.5);
	animation: wsg-slide-in 0.25s ease;
}

.wsg-error {
	padding: 16px;
	background: var(--wsg-mint);
	border-radius: var(--wsg-r);
	color: var(--wsg-ink);
}

/* ------------------------------------------------- theme link overrides --- */

/*
 * ruki-child styles content links as
 *
 *   .t33-page-main .entry-content a { color: #0a7e9c; text-decoration: underline; }
 *
 * which is picked to sit on white paper and lands as mid-teal on a navy board.
 * The rules these replace on the previous site needed !important because that
 * site's Additional CSS used it; 33science's does not, so specificity is enough
 * and !important appears nowhere in this file. Putting body.wsg-page in front
 * takes these to (0,3,2) against the theme's (0,3,1).
 *
 * Re-aimed from the ContentBerg selectors the port arrived with. Left as they
 * were, they would have been four dead rules and the real link colour would
 * have bled straight through onto the board.
 */

body.wsg-page .wsg .wsg-reads-list a,
body.wsg-page .wsg .wsg-topics-list a,
body.wsg-page .wsg .wsg-dir-list a {
	color: var(--wsg-ink);
	text-decoration: none;
	border-bottom: 0;
	box-shadow: none;
}

body.wsg-page .wsg .wsg-archive-list a,
body.wsg-page .wsg .wsg-nav-link {
	color: var(--wsg-ink-72);
	text-decoration: none;
	border-bottom: 0;
	box-shadow: none;
}

body.wsg-page .wsg .wsg-archive-list a:hover,
body.wsg-page .wsg .wsg-nav-link:hover,
body.wsg-page .wsg .wsg-topics-list a:hover,
body.wsg-page .wsg .wsg-dir-list a:hover {
	color: var(--wsg-sky);
}

/*
 * Headings inside the board.
 *
 * ruki-child styles .t33-page-main .entry-content h1..h6 with
 * color: var(--t33-ink), which is #1b2233 -- chosen to sit on white paper. At
 * (0,3,1) it outranks .wsg-theme at (0,1,0), so the board's own headings were
 * rendering near-black on near-black navy: present in the DOM, readable by a
 * crawler, and invisible to a reader.
 *
 * This is the same collision the link rules above fix, one element type over. It
 * is worth stating plainly because it is the trap this whole stylesheet is
 * exposed to: any theme rule scoped to .entry-content reaches inside the board,
 * and the board is the one place on the page with an inverted palette.
 */
body.wsg-page .wsg h2,
body.wsg-page .wsg h3,
body.wsg-page .wsg h4 {
	color: var(--wsg-ink);
	font-family: var(--wsg-title-font);
}

body.wsg-page .wsg .wsg-blurb,
body.wsg-page .wsg p {
	color: var(--wsg-ink-72);
}

/* The theme's 2em heading margin is sized for an article column, not a toolbar. */
body.wsg-page .wsg h2,
body.wsg-page .wsg h3 {
	margin-top: 0;
}

body.wsg-page .wsg .wsg-reads-title,
body.wsg-page .wsg .wsg-list-title {
	margin-bottom: 0.6em;
}

body.wsg-page .wsg .wsg-word a {
	color: inherit;
	text-decoration: none;
	border-bottom: 0;
	box-shadow: none;
}

/* ------------------------------------------------------- the page column --- */

/*
 * ruki-child's page.php only adds .t33-page-wide when post_content contains
 * "museum-gallery", "custom-browse-grid" or "wp:table". A shortcode matches none
 * of them, so a 16x16 board would be squeezed into the 840px article column.
 *
 * Fixed from here rather than by editing the theme: a theme edit is a second
 * deploy surface with its own drift, and the board is built on container
 * queries, so widening its container is the entire fix. Nothing inside the board
 * needs to know it happened.
 */
body.wsg-page .t33-page-main {
	max-width: 1120px;
}

/*
 * The prose underneath stays at a readable measure. A 1120px paragraph is not a
 * paragraph anyone finishes, and the prose is the half of this page that has to
 * be read rather than played.
 */
body.wsg-page .t33-page-main .entry-content > *:not(.wsg):not(.wsg-directory) {
	max-width: 760px;
	margin-left: auto;
	margin-right: auto;
}

/* -------------------------------------------------------- ad containment --- */

/*
 * Insurance, not a fix. Mediavine places in-content units between top-level
 * children of the content container, and the shortcode emits exactly one, so
 * nothing should ever land inside the board. If the dashboard content selector
 * is ever widened, this is what keeps a unit from appearing under a dragging
 * finger. tools/mv-check.js asserts these stay unnecessary rather than becoming
 * load-bearing.
 *
 * grow-for-wp is active on this site and its floating UI is not covered by the
 * Mediavine prefixes, so it is named explicitly.
 */
.wsg [id^="mv-"],
.wsg [id^="mv_"],
.wsg [class*="mv-ad"],
.wsg [class*="mv-sticky"],
.wsg .adthrive,
.wsg #mv-grow-root,
.wsg [class*="grow-"] {
	display: none !important;
}

/* -------------------------------------------------------------- sheet bar --- */

.wsg-sheets {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 14px;
}

.wsg-sheets-label {
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wsg-ink-55);
}

.wsg-sheet {
	min-width: 2.4em;
	text-align: center;
}

.wsg-sheet.is-current {
	background: var(--wsg-sky);
	border-color: var(--wsg-sky);
	color: #06243a;
	font-weight: 700;
}

.wsg-sheet-key {
	margin-left: auto;
}

/* ------------------------------------------------------------ topic cards --- */

.wsg-topics {
	margin-top: 20px;
}

.wsg-topics-list,
.wsg-dir-list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: grid;
	gap: 10px;
}

@container (min-width: 34rem) {
	.wsg-topics-list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.wsg-topics-list a,
.wsg-dir-list a {
	display: block;
	height: 100%;
	padding: 12px 14px;
	background: var(--wsg-mint);
	border: 1px solid var(--wsg-ink-18);
	border-radius: var(--wsg-r);
	transition: border-color 0.18s ease, transform 0.18s ease;
}

.wsg-topics-list a:hover,
.wsg-dir-list a:hover {
	border-color: var(--wsg-sky);
	transform: translateY(-1px);
}

.wsg-topic-name,
.wsg-dir-name {
	display: block;
	font-family: var(--wsg-title-font);
	font-weight: 700;
	font-size: 1rem;
}

.wsg-topic-blurb,
.wsg-dir-blurb {
	display: block;
	margin-top: 4px;
	font-size: 0.86rem;
	line-height: 1.45;
	color: var(--wsg-ink-72);
}

.wsg-topic-foot {
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--wsg-ink-18);
}

/* --------------------------------------------------------------- directory --- */

/*
 * The hub directory is the only component that lives outside .wsg, so it carries
 * its own light-paper styling rather than inheriting the board's dark tokens.
 */
.wsg-directory {
	display: grid;
	gap: 26px;
	margin: 0 0 2rem;
}

@media (min-width: 720px) {
	.wsg-directory {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.wsg-dir-title {
	margin: 0 0 10px;
	font-family: var(--wsg-title-font);
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: #0a7e9c;
}

.wsg-directory .wsg-dir-list a {
	background: #fff;
	border: 1px solid #e3e7ef;
	box-shadow: 0 10px 30px rgba(7, 11, 26, 0.06);
}

body.wsg-page .wsg-directory .wsg-dir-list a {
	color: #1b2233;
	text-decoration: none;
}

.wsg-directory .wsg-dir-blurb {
	color: #5a6378;
}

body.wsg-page .wsg-directory .wsg-dir-list a:hover {
	color: #0a7e9c;
	border-color: #2bc8e8;
}

/* -------------------------------------------------------------- post promo --- */

.wsg-postpromo {
	display: block;
	margin: 2em 0 0;
}

.wsg-postpromo-link {
	display: block;
	padding: 16px 18px;
	background: #fff7f3;
	border: 1px solid #f3d9d3;
	border-left: 4px solid #f67280;
	border-radius: 14px;
}

.entry-content .wsg-postpromo-link {
	color: #1b2233;
	text-decoration: none;
}

.wsg-postpromo-kicker {
	display: block;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: #c0505f;
}

.wsg-postpromo-title {
	display: block;
	margin-top: 4px;
	font-weight: 700;
	font-size: 1.05rem;
}

.wsg-postpromo-text {
	display: block;
	margin-top: 3px;
	font-size: 0.9rem;
	line-height: 1.5;
	color: #5a6378;
}

/* -------------------------------------------------------------- answer key --- */

.wsg-cell.is-solution {
	/*
	 * A solid outline and a bold letter, not a tinted fill. This is the one
	 * component designed against the print sheet first: a colour fill disappears
	 * when "background graphics" is off, which is Chrome's print default, and an
	 * answer key that prints blank is worse than no answer key at all.
	 */
	border-color: var(--wsg-sky);
	box-shadow: inset 0 0 0 2px var(--wsg-sky);
	font-weight: 800;
	color: #fff;
}

.wsg-keyview .wsg-cell {
	cursor: default;
}

/*
 * No strikethrough on the key.
 *
 * The list reuses .is-found so it inherits the board's found-word styling, and
 * that styling strikes the word out -- which on a playable board means "you got
 * this one" and on an answer key reads as "crossed off" or "wrong". The print
 * sheet already suppressed it; the screen view should agree.
 */
.wsg-keylist .wsg-word-text {
	text-decoration: none;
}

.wsg-keylist .wsg-word-where {
	display: block;
	font-size: 0.78rem;
	color: var(--wsg-ink-55);
	font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- print mark --- */

/* Screen-hidden, print-visible. See css/word-search-game-print.css. */
.wsg-printmark {
	display: none;
}

/* ------------------------------------------------------------ animations --- */

@keyframes wsg-pop {
	0% { transform: scale(1); }
	50% { transform: scale(1.06); }
	100% { transform: scale(1); }
}

@keyframes wsg-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

@keyframes wsg-capsule-in {
	from { opacity: 0; transform: rotate(var(--deg)) scaleX(0.2); }
	to { opacity: 1; transform: rotate(var(--deg)) scaleX(1); }
}

@keyframes wsg-slide-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.wsg *,
	.wsg *::before,
	.wsg *::after,
	.wsg .wsg-toast {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}

/* ------------------------------------------------------- narrow screens --- */

/*
 * Reclaim horizontal space on a phone.
 *
 * A 16-column topic sheet at 360px was measured at 14.3px per cell, which is
 * below a usable drag target. The width was not going to the board: 48px of it
 * was the theme's page gutter and another ~28px the board's own padding, on a
 * viewport with 360px to spend.
 *
 * Taking those back gets the cell to roughly 20px without touching --wsg-size,
 * which is the alternative fix and a much worse one: dropping to a 14x14 grid
 * would mean regenerating all 84 topic sheets and cutting two words from every
 * printable. Layout is the right place to solve a layout problem.
 */
@media (max-width: 560px) {
	body.wsg-page .t33-page-main {
		padding-left: 8px;
		padding-right: 8px;
	}

	body.wsg-page .t33-page-main .entry-content > .wsg {
		/* The board goes full-bleed; the prose keeps its gutter. */
		margin-left: -8px;
		margin-right: -8px;
		border-radius: 0;
		border-left: 0;
		border-right: 0;
	}

	.wsg {
		padding: 10px 6px 16px;
	}

	.wsg-grid {
		max-width: none;
	}
}
