/* Large Print Puzzles (largeprintpuzzles.co.uk)
   The look: a bright puzzle pad. Squared paper, pencil yellow, biro blue, chunky ink outlines.
   The whole site is large print: the base size is 20px and everything scales with the A+ button. */

@font-face { font-family: "Bowlby"; src: url("/fonts/BowlbyOne-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Hyper"; src: url("/fonts/HyperlegiblePlainZero-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hyper"; src: url("/fonts/HyperlegiblePlainZero-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Hyper"; src: url("/fonts/HyperlegiblePlainZero-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --zoom: 1;
  --paper: #ffffff;
  --grid: #dfe8f8;
  --ink: #14213d;
  --yellow: #ffc400;
  --yellow-soft: #fff1b8;
  --blue: #1e4fd6;
  --pink: #ff5c8a;
  --green: #0f9d58;
  --wash: #f2f6fd;
  --line: 3px;
  --radius: 20px;
  --shadow: 0 7px 0 var(--ink);
  --measure: 38rem;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #0d1530;
  --grid: #1a2752;
  --ink: #f4f7ff;
  --yellow: #ffcf33;
  --yellow-soft: #3a3410;
  --blue: #8fb0ff;
  --pink: #ff86a8;
  --green: #4fd69a;
  --wash: #15204a;
  --shadow: 0 7px 0 #000;
  color-scheme: dark;
}

@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(125% * var(--zoom)); scroll-behavior: smooth; scroll-padding-top: 6rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Hyper", "Atkinson Hyperlegible", Verdana, sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1.5px, transparent 1.5px), linear-gradient(90deg, var(--grid) 1.5px, transparent 1.5px);
  background-size: 2rem 2rem;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration-thickness: 0.12em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.22em; }
:focus-visible { outline: 4px solid var(--pink); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: "Bowlby", "Arial Black", sans-serif; font-weight: 400; line-height: 1.08; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.wrap { width: min(72rem, 100% - 2.5rem); margin-inline: auto; }
.lede { font-size: 1.15rem; max-width: var(--measure); }
.skip { position: absolute; left: -999rem; top: 0; background: var(--ink); color: var(--paper); padding: 0.8rem 1.2rem; z-index: 50; font-weight: 700; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- the pencil line that grows as you scroll */
.pencil-progress { position: fixed; inset: 0 0 auto 0; height: 7px; background: var(--blue); transform-origin: 0 50%; transform: scaleX(0); z-index: 40; }
@supports (animation-timeline: scroll()) {
  .pencil-progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* ---------- top bar */
.top { position: sticky; top: 0; z-index: 30; background: var(--yellow); border-bottom: var(--line) solid var(--ink); color: #14213d; }
[data-theme="dark"] .top { color: #14213d; }
.top-row { display: flex; align-items: center; gap: 1rem; padding-block: 0.55rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: #14213d; font-family: "Bowlby", sans-serif; font-size: 1.25rem; white-space: nowrap; view-transition-name: brand; }
.brand-tiles { display: inline-flex; gap: 3px; }
.brand-tiles i { font-style: normal; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; background: #fff; border: 2.5px solid #14213d; border-radius: 7px; font-size: 1.15rem; }
.brand:hover .brand-tiles i { animation: hop 0.5s ease both; }
.brand:hover .brand-tiles i:nth-child(2) { animation-delay: 0.07s; }
.brand:hover .brand-tiles i:nth-child(3) { animation-delay: 0.14s; }
@keyframes hop { 40% { transform: translateY(-7px) rotate(-6deg); } }
.nav { display: flex; gap: 0.15rem; margin-left: auto; flex-wrap: wrap; }
.nav a { position: relative; color: #14213d; text-decoration: none; font-weight: 700; padding: 0.45rem 0.7rem; border-radius: 999px; }
.nav a::after { content: ""; position: absolute; inset: 0.1rem -0.1rem; border: 3px solid #1e4fd6; border-radius: 50% / 60%; transform: rotate(-3deg); clip-path: inset(0 100% 0 0); transition: clip-path 0.35s ease; pointer-events: none; }
.nav a:hover::after, .nav a:focus-visible::after, .nav a[aria-current]::after { clip-path: inset(0 0 0 0); }
.tools { display: flex; gap: 0.35rem; }
.tool { font: inherit; font-weight: 700; display: grid; grid-auto-flow: column; place-items: center; min-width: 2.6rem; height: 2.6rem; padding: 0 0.5rem; background: #fff; color: #14213d; border: 2.5px solid #14213d; border-radius: 12px; cursor: pointer; }
.tool-big { font-size: 1.2rem; }
.tool:hover { background: #14213d; color: #fff; }
[data-theme="light"] .moon, [data-theme="dark"] .sun { display: none; }
.menu-button { display: none; font: inherit; font-weight: 700; margin-left: auto; padding: 0.45rem 0.9rem; background: #fff; color: #14213d; border: 2.5px solid #14213d; border-radius: 12px; }
.concept-note { margin: 0; padding: 0.4rem 1rem; text-align: center; background: var(--ink); color: var(--paper); font-size: 0.85rem; }

/* ---------- buttons: chunky, with a hard shadow that presses down */
.button { display: inline-block; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; padding: 0.7rem 1.25rem; color: #14213d; background: var(--yellow); border: var(--line) solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink); transition: transform 0.08s ease, box-shadow 0.08s ease; }
[data-theme="dark"] .button { border-color: #000; box-shadow: 0 5px 0 #000; }
.button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.button-quiet { background: var(--paper); color: var(--ink); }
[data-theme="dark"] .button-quiet { background: #223069; color: #fff; }
.button-large { font-size: 1.15rem; padding: 0.9rem 1.5rem; }
.button-small { padding: 0.45rem 0.9rem; font-size: 0.95rem; box-shadow: 0 4px 0 var(--ink); }
.button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.4rem 0 0; }
.pill { flex: none; font-weight: 700; text-decoration: none; padding: 0.3rem 0.9rem; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); }
.pill:hover { background: var(--ink); color: var(--paper); }
.status { display: inline-block; font-weight: 700; padding: 0.7rem 1.1rem; border: var(--line) dashed var(--ink); border-radius: 14px; background: var(--wash); }

/* ---------- headings get one sweep of highlighter when the page arrives */
.swipe > span { background: linear-gradient(var(--yellow), var(--yellow)) no-repeat 0 82% / 0% 44%; -webkit-box-decoration-break: clone; box-decoration-break: clone; animation: swipe 0.7s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; padding-inline: 0.08em; }
.swipe-2 > span { animation-delay: 0.45s; }
.swipe-3 > span { animation-delay: 0.75s; }
@keyframes swipe { to { background-size: 100% 44%; } }
[data-theme="dark"] .swipe > span { background-image: linear-gradient(#5b4a00, #5b4a00); }

/* ---------- breadcrumbs and page heads */
.crumbs { padding-top: 1.2rem; font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.crumbs .here { font-weight: 700; }
.page-head { padding-block: 1.6rem 1.4rem; }
.finder { display: grid; gap: 0.3rem; margin-top: 1.4rem; max-width: 26rem; font-weight: 700; }
.finder input { font: inherit; padding: 0.7rem 1rem; border: var(--line) solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink); }

/* ---------- lists of puzzles, set like the contents page of a puzzle book */
.contents { list-style: none; margin: 0; padding: 0; }
.contents-row { display: flex; align-items: center; gap: 0.8rem; border-bottom: 2px solid var(--grid); }
.contents-link { flex: 1; display: flex; align-items: baseline; gap: 0.7rem; padding: 0.85rem 0.6rem; color: var(--ink); text-decoration: none; border-radius: 12px; background: linear-gradient(var(--yellow-soft), var(--yellow-soft)) no-repeat 0 0 / 0% 100%; transition: background-size 0.3s ease; min-width: 0; }
.contents-link:hover, .contents-link:focus-visible { background-size: 100% 100%; }
.contents-title { font-weight: 700; font-size: 1.1rem; }
.contents-dots { flex: 1; min-width: 1.5rem; border-bottom: 3px dotted currentColor; opacity: 0.35; transform: translateY(-0.3em); }
.contents-meta { white-space: nowrap; font-size: 0.95rem; }
.hub-body { padding-bottom: 3rem; }
.hub-section { margin-bottom: 2.6rem; }
.hub-section h2 a { color: inherit; }
.more { padding-block: 2rem 3.5rem; }

/* ---------- the home page */
.hero { padding-block: 2.6rem 3.2rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 3rem; align-items: center; }
.hero-title { font-size: clamp(2.1rem, 3.9vw, 3.7rem); line-height: 1.06; margin-bottom: 0.5em; }
.hero-title .swipe { display: block; white-space: nowrap; }
.hero-game { background: var(--paper); border: var(--line) solid var(--ink); border-radius: 28px; box-shadow: 12px 12px 0 var(--blue); padding: 1.3rem; transform: rotate(1.2deg); }
[data-theme="dark"] .hero-game { border-color: #000; }

.ticker { border-block: var(--line) solid var(--ink); background: var(--ink); color: var(--paper); overflow: hidden; }
.ticker-run { display: flex; width: max-content; animation: ticker 60s linear infinite; }
.ticker:hover .ticker-run { animation-play-state: paused; }
.ticker span { font-family: "Bowlby", sans-serif; letter-spacing: 0.5em; padding: 0.6rem 0 0.6rem 0.5em; opacity: 0.45; white-space: nowrap; }
.ticker .hit { opacity: 1; color: #14213d; background: var(--yellow); border-radius: 999px; margin-inline: 0.5rem; padding-inline: 1.1em 0.6em; }
@keyframes ticker { to { transform: translateX(-50%); } }

.doors-section { padding-block: 3.5rem 2rem; }
.doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.4rem; }
.door { display: flex; flex-direction: column; color: #14213d; text-decoration: none; padding: 1.1rem 1.1rem 1.3rem; border: var(--line) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease; }
[data-theme="dark"] .door { border-color: #000; }
.door:hover, .door:focus-visible { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 13px 0 var(--ink); }
.door h3 { margin: 1rem 0 0.3rem; font-size: 1.45rem; }
.door p { margin: 0; }
.door-ws { background: var(--yellow); }
.door-quiz { background: #8fd0ff; }
.door-rebus { background: #ffb3c8; }
.door-tracks { background: #9be7c0; }
.door-art { height: 9.5rem; background: #fff; border: 2.5px solid #14213d; border-radius: 14px; display: grid; place-items: center; overflow: hidden; position: relative; }
.mini-grid { grid-template-columns: repeat(6, 1fr); padding: 0.5rem 0.7rem; font-weight: 700; font-size: 1.25rem; place-items: center; }
.mini-ring { position: absolute; left: 34%; top: 9%; width: 62%; height: 23%; border: 4px solid #1e4fd6; border-radius: 999px; clip-path: inset(0 100% 0 0); transition: clip-path 0.5s ease; }
.door:hover .mini-ring, .door:focus-visible .mini-ring { clip-path: inset(0 0 0 0); }
.flip { perspective: 700px; padding: 0.6rem; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1); transform-style: preserve-3d; }
.flip-front, .flip-back { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; text-align: center; backface-visibility: hidden; font-size: 0.9rem; line-height: 1.3; font-weight: 700; }
.flip-back { transform: rotateY(180deg); font-family: "Bowlby", sans-serif; font-size: 1.35rem; color: #1e4fd6; }
.door:hover .flip-inner, .door:focus-visible .flip-inner { transform: rotateY(180deg); }
.rebus-art { grid-template-rows: auto auto auto; align-content: center; gap: 0.25rem; font-family: "Bowlby", sans-serif; font-size: 1.7rem; line-height: 1; }
.rebus-rule { width: 6.5rem; height: 5px; background: #14213d; border-radius: 3px; }
.door:hover .rebus-head, .door:focus-visible .rebus-head { animation: tumble 0.7s ease both; }
@keyframes tumble { 50% { transform: translateY(-0.5rem) rotate(-14deg); } }
.mini-track { width: 100%; height: 100%; }
.mini-track .rail { fill: none; stroke: #14213d; stroke-width: 15; stroke-linecap: butt; }
.mini-track .sleepers { fill: none; stroke: #fff; stroke-width: 9; stroke-dasharray: 3 9; }
.mini-track path { stroke-dasharray: 420; stroke-dashoffset: 0; }
.door:hover .mini-track .rail, .door:focus-visible .mini-track .rail { animation: lay 1.1s ease both; }
@keyframes lay { from { stroke-dashoffset: 420; } to { stroke-dashoffset: 0; } }

.stats { background: var(--blue); color: #fff; border-block: var(--line) solid var(--ink); margin-block: 3rem; }
[data-theme="dark"] .stats { background: #1c3aa0; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding-block: 1.8rem; }
.stats-row p { margin: 0; display: grid; }
.stats-row b { font-family: "Bowlby", sans-serif; font-weight: 400; font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1; color: #ffd43b; }

.shelf-section { padding-block: 1rem 3rem; }
.shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6rem; align-items: end; padding: 1.5rem 1.2rem 0; border-bottom: 14px solid var(--ink); border-radius: 0 0 6px 6px; perspective: 1200px; }
.shelf-book { display: grid; gap: 0.5rem; text-decoration: none; color: var(--ink); font-weight: 700; text-align: center; transform-origin: 50% 100%; margin-bottom: -2px; }
.shelf-book img, .book-cover img { display: block; border: 2.5px solid var(--ink); border-radius: 6px 10px 10px 6px; box-shadow: 8px 8px 0 rgba(20, 33, 61, 0.22); background: #fff; }
.shelf-book span { order: -1; }
.tilt { transition: transform 0.18s ease; transform-style: preserve-3d; will-change: transform; }
.fresh { padding-block: 1rem 3.5rem; }
.promise { background: var(--yellow); color: #14213d; border-top: var(--line) solid var(--ink); }
.promise-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; padding-block: 2.6rem; }
.promise h2 { font-size: 1.4rem; }
.promise p { margin: 0; }

/* ---------- the play area shared by every puzzle */
.play { padding-block: 0.5rem 2.5rem; }
.done-note { margin: 1.2rem 0 0; padding: 0.9rem 1.2rem; font-weight: 700; font-size: 1.15rem; background: var(--green); color: #fff; border: var(--line) solid var(--ink); border-radius: 14px; width: fit-content; animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.done-note a { color: inherit; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }

/* word search */
.ws { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 2rem; align-items: start; }
.ws-board-wrap { position: relative; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--radius); padding: 0.7rem; box-shadow: var(--shadow); touch-action: none; }
.ws-board { display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); user-select: none; -webkit-user-select: none; }
.ws-cell { aspect-ratio: 1; display: grid; place-items: center; font: inherit; font-weight: 700; font-size: clamp(1rem, 3.1vw, 1.55rem); color: var(--ink); background: none; border: 0; border-radius: 50%; padding: 0; cursor: pointer; position: relative; z-index: 2; }
.ws-cell:hover { background: var(--yellow-soft); }
.ws-cell.is-start { background: var(--yellow); color: #14213d; }
.ws-cell.is-path { background: var(--yellow-soft); }
.ws-rings { position: absolute; inset: 0.7rem; width: calc(100% - 1.4rem); height: calc(100% - 1.4rem); pointer-events: none; z-index: 1; overflow: visible; }
.ws-rings line { stroke-linecap: round; opacity: 0.55; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.45s ease forwards; }
[data-theme="dark"] .ws-rings line { opacity: 0.5; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ws-count { font-size: 1.05rem; margin-bottom: 0.6rem; }
.ws-words { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: 0.15rem; font-weight: 700; }
.ws-words li { padding: 0.15rem 0.5rem; border-radius: 8px; transition: background 0.3s ease; }
.ws-words li.is-found { text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: var(--pink); opacity: 0.65; }
.ws-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.8rem; }
.ws-help { font-size: 0.9rem; margin: 0; }
.ws-hero { grid-template-columns: 1fr; gap: 0.9rem; }
.ws-hero .ws-board-wrap { box-shadow: none; }
.ws-hero .ws-words { grid-template-columns: repeat(4, auto); justify-content: start; gap: 0.2rem 0.4rem; margin: 0; font-size: 0.9rem; }
.ws-hero .ws-count { font-size: 0.95rem; margin: 0 0 0.4rem; }

/* quiz */
.quiz { list-style: none; margin: 0; padding: 0; counter-reset: q; display: grid; gap: 1rem; max-width: 46rem; }
.quiz-item { counter-increment: q; position: relative; padding: 1.1rem 1.2rem 1.2rem 4.2rem; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--radius); }
[data-theme="dark"] .quiz-item { border-color: #000; }
.quiz-item::before { content: counter(q); position: absolute; left: 1rem; top: 1rem; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; font-family: "Bowlby", sans-serif; background: var(--yellow); color: #14213d; border: 2.5px solid var(--ink); border-radius: 50%; }
.quiz-q { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.7rem; }
.quiz-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.quiz-options span { padding: 0.2rem 0.8rem; border: 2px solid var(--ink); border-radius: 999px; }
.quiz-a { padding: 0.8rem 1rem; margin-bottom: 0.8rem; background: var(--yellow-soft); border-radius: 12px; animation: reveal 0.35s ease both; }
.quiz-a p { margin: 0 0 0.4rem; font-size: 1.15rem; }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } }
.got-it { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.95rem; cursor: pointer; }
.got-it input { width: 1.4rem; height: 1.4rem; accent-color: var(--green); }
.quiz-foot { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; margin-top: 1.4rem; }
.quiz-score { font-size: 1.2rem; margin: 0; }
.quiz-score b { font-family: "Bowlby", sans-serif; font-weight: 400; font-size: 1.6rem; color: var(--blue); }
.over-to-you { max-width: 46rem; margin-top: 2rem; padding: 1.2rem 1.4rem; background: var(--yellow); color: #14213d; border: var(--line) solid var(--ink); border-radius: var(--radius); transform: rotate(-0.6deg); }
.over-to-you h2 { font-size: 1.3rem; }
.over-to-you p { margin: 0; font-size: 1.15rem; }

/* word pictures */
.rebus { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; counter-reset: r; }
.rebus-item { counter-increment: r; position: relative; display: grid; gap: 0.8rem; align-content: start; padding: 1rem; background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
[data-theme="dark"] .rebus-item { border-color: #000; }
.rebus-item::before { content: counter(r); position: absolute; left: 0.8rem; top: 0.8rem; z-index: 2; width: 2.3rem; height: 2.3rem; display: grid; place-items: center; font-family: "Bowlby", sans-serif; background: var(--ink); color: var(--paper); border-radius: 10px; }
.rebus-box { margin: 0; background: #fff; border-radius: 12px; overflow: hidden; }
.rebus-box img { display: block; width: 100%; }
.rebus-answer { padding: 0.7rem 0.9rem; background: var(--yellow-soft); border-radius: 12px; animation: reveal 0.35s ease both; }
.rebus-answer p { margin: 0; }
.rebus-word { font-family: "Bowlby", sans-serif; font-size: 1.3rem; }

/* train tracks */
.tt { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 2rem; align-items: start; }
.tt-board-wrap { background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--radius); padding: 0.6rem; box-shadow: var(--shadow); max-width: 40rem; }
.tt-board { display: block; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.tt-board text { font-family: "Hyper", sans-serif; font-weight: 700; fill: var(--ink); }
.tt-board .clue.is-right { fill: var(--green); }
.tt-board .clue.is-over { fill: var(--pink); }
.tt-board .cell { fill: transparent; stroke: var(--ink); stroke-width: 0.02; stroke-opacity: 0.35; cursor: pointer; }
.tt-board .cell:hover { fill: var(--yellow-soft); }
.tt-board .frame { fill: none; stroke: var(--ink); stroke-width: 0.06; }
.tt-board .rail { fill: none; stroke: var(--ink); stroke-width: 0.42; }
.tt-board .gap { fill: none; stroke: var(--paper); stroke-width: 0.22; }
.tt-board .ties { fill: none; stroke: var(--ink); stroke-width: 0.56; stroke-dasharray: 0.07 0.15; }
.tt-board .given .rail, .tt-board .given .ties { stroke: var(--blue); }
.tt-board .cross { stroke: var(--pink); stroke-width: 0.09; stroke-linecap: round; }
.tt-status { font-weight: 700; font-size: 1.05rem; }
.tt-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

/* matching game */
.match { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 1.5rem; max-width: 50rem; }
.match ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.match-chip { width: 100%; text-align: left; font: inherit; font-weight: 700; padding: 0.7rem 1rem; background: var(--paper); color: var(--ink); border: var(--line) solid var(--ink); border-radius: 14px; cursor: pointer; }
.match-chip.is-picked { background: var(--yellow); color: #14213d; }
.match-chip.is-done { background: var(--green); color: #fff; cursor: default; }
.match-chip.is-wrong { animation: shake 0.35s ease; background: var(--pink); }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.glossary { margin: 0 0 1.6rem; }
.glossary div { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: 0.5rem 0; border-bottom: 2px solid var(--grid); }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; }

/* ---------- books */
.book-panel { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; align-items: center; margin-block: 1rem 3rem; padding: 1.6rem; background: var(--wash); border: var(--line) solid var(--ink); border-radius: 28px; }
[data-theme="dark"] .book-panel { border-color: #000; }
.book-lead { font-weight: 700; margin-bottom: 0.4rem; }
.book-title { margin-bottom: 0.1em; }
.book-sub { font-weight: 700; font-size: 1.1rem; }
.book-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin: 1.2rem 0 0; }
.book-hero { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 3rem; align-items: center; padding-block: 2rem 3rem; }
.book-hero-cover { perspective: 1200px; display: grid; place-items: center; }
.kind { display: inline-block; font-weight: 700; padding: 0.15rem 0.8rem; background: var(--ink); color: var(--paper); border-radius: 999px; margin-bottom: 0.8rem; }
.ticks { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: 0.5rem; }
.ticks li { padding-left: 2.2rem; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 0.2rem; top: 0.25rem; width: 1.1rem; height: 0.6rem; border-left: 5px solid var(--green); border-bottom: 5px solid var(--green); transform: rotate(-45deg); }
.book-facts { font-size: 0.95rem; }
.look-inside { padding-block: 1rem 3rem; }
.pages-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; }
.pages-row figure { margin: 0; }
.pages-row img { display: block; border: 2.5px solid var(--ink); border-radius: 8px; background: #fff; box-shadow: 6px 6px 0 rgba(20, 33, 61, 0.2); }
.pages-row figcaption { font-size: 0.9rem; margin-top: 0.5rem; }
.book-list { display: grid; gap: 2rem; padding-bottom: 3.5rem; }
.book-row { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; align-items: center; padding: 1.6rem; background: var(--paper); border: var(--line) solid var(--ink); border-radius: 28px; box-shadow: var(--shadow); }
[data-theme="dark"] .book-row { border-color: #000; }
.book-row h2 a { color: inherit; text-decoration: none; }

/* ---------- reading pages */
.prose { max-width: 46rem; padding-block: 1rem 2rem; }
.wrap.prose { margin-inline: auto; width: min(46rem, 100% - 2.5rem); }
.puzzle-page .wrap.prose, .puzzle-page .prose { margin-inline: max(1.25rem, calc((100% - 72rem) / 2)) auto; }
.article { padding-top: 1.6rem; }
.article h2 { margin-top: 1.8em; }
.prose li { margin-bottom: 0.5em; }
.did-you-know { padding: 0.9rem 1.1rem; background: var(--yellow-soft); border-left: 8px solid var(--yellow); border-radius: 0 12px 12px 0; }
.nothing-found { font-weight: 700; padding: 1rem; }

/* ---------- foot */
.foot { background: var(--ink); color: var(--paper); margin-top: 0; padding-block: 3rem 1.5rem; }
[data-theme="dark"] .foot { background: #060b1c; color: #f4f7ff; }
.foot a { color: inherit; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.foot h2 { font-size: 1.1rem; color: var(--yellow); }
[data-theme="dark"] .foot h2, [data-theme="dark"] .foot-name { color: #ffcf33; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.foot-name { font-family: "Bowlby", sans-serif; font-size: 1.5rem; color: var(--yellow); margin-bottom: 0.4rem; }
.foot-small { font-size: 0.85rem; margin-top: 2.5rem; opacity: 0.85; }

/* ---------- celebration: scraps of coloured paper */
.scrap { position: fixed; top: -2rem; width: 0.9rem; height: 0.9rem; z-index: 60; pointer-events: none; animation: fall var(--t, 2.4s) cubic-bezier(0.2, 0.6, 0.4, 1) forwards; }
@keyframes fall { to { transform: translate(var(--dx, 0), 110vh) rotate(var(--spin, 540deg)); } }

/* ---------- smaller screens */
@media (max-width: 62rem) {
  .hero-grid, .ws, .tt, .book-hero { grid-template-columns: 1fr; }
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .hero-game { transform: none; }
  .hero-title .swipe { white-space: normal; }
  .menu-button { display: block; }
  .nav { display: none; order: 5; width: 100%; margin: 0; flex-direction: column; }
  .nav.is-open { display: flex; }
  .top-row { flex-wrap: wrap; }
  .tools { margin-left: auto; order: 2; }
  .menu-button { margin-left: 0; order: 3; }
}
@media (max-width: 40rem) {
  html { font-size: calc(112.5% * var(--zoom)); }
  .doors, .promise-grid, .stats-row, .rebus, .match, .pages-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .book-panel, .book-row { grid-template-columns: 1fr; }
  .book-panel .book-cover, .book-row .book-cover { max-width: 12rem; }
  .contents-meta { display: none; }
  .glossary div { grid-template-columns: 1fr; gap: 0; }
  .brand-rest { display: none; }
  .ws-hero .ws-words { grid-template-columns: repeat(2, auto); }
}

/* ---------- calm for those who ask for it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; transition-duration: 0.001s !important; }
  .ticker-run { animation: none; }
  html { scroll-behavior: auto; }
  @view-transition { navigation: none; }
}

/* ---------- printing a page straight from the browser */
@media print {
  .top, .foot, .tools, .actions, .crumbs, .ticker, .pencil-progress, .concept-note, .more, .book-panel, button { display: none !important; }
  body { background: #fff; color: #000; }
  .ws-board-wrap, .quiz-item, .rebus-item { box-shadow: none; }
}
