:root {
  color-scheme: light;
  font: 16px/1.55 "Segoe UI", system-ui, sans-serif;
  scroll-behavior: smooth;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  --bg: #f1f4ec;
  --surface: #fff;
  --panel: #e1ebd8;
  --ink: #183328;
  --muted: #4b6253;
  --line: #ccd8c8;
  --head: #143629;
  --accent: #186145;
  --accent-ink: #fff;
  --display: "Segoe UI", system-ui, sans-serif;
  --round: 14px;
  margin: 0;
  min-width: 0;
  color: var(--ink);
  background: var(--bg);
}
body.wordgames {
  --bg: #fff8ee; --surface: #fffdf8; --panel: #f2e5fa; --ink: #37213c;
  --muted: #614c64; --line: #e1cde4; --head: #3c214a; --accent: #733983;
  --display: Georgia, serif; --round: 5px;
}
body.quiz {
  color-scheme: dark;
  --bg: #1d132d; --surface: #281b3e; --panel: #352252; --ink: #fff4ff;
  --muted: #dfcde8; --line: #533e68; --head: #29154b; --accent: #ebcfff; --accent-ink: #28143b;
  --display: "Segoe UI", system-ui, sans-serif; --round: 22px;
}
body.mathplay {
  --bg: #eef8f8; --surface: #fff; --panel: #d9eeef; --ink: #113c42;
  --muted: #426167; --line: #c7dfe0; --head: #114b52; --accent: #0d626d; --round: 20px;
}
body.play {
  color-scheme: dark;
  --bg: #1c1516; --surface: #2b1e1f; --panel: #3c2625; --ink: #fff2ec;
  --muted: #efcfc5; --line: #5a3d3a; --head: #311c1c; --accent: #ffa680; --accent-ink: #2d160d;
  --display: "Segoe UI", system-ui, sans-serif; --round: 12px;
}
a { color: var(--accent); text-underline-offset: .23em; }
a:hover { text-decoration-thickness: .16em; }
button { font: inherit; cursor: pointer; color: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.site-head :focus-visible, .site-foot :focus-visible { outline-color: #f5d7ff; }
img { max-width: 100%; display: block; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; letter-spacing: -.035em; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.25rem, 6vw, 4.85rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); }
.skip {
  position: absolute; inset: .8rem auto auto .8rem; z-index: 3; transform: translateY(-180%);
  padding: .6rem .9rem; background: var(--surface); color: var(--ink);
}
.skip:focus { transform: none; }
.site-head, .site-foot { color: #fff8f6; background: var(--head); }
.head-inner, .foot-inner {
  max-width: 1320px; width: min(100% - 3rem, 1320px); margin-inline: auto;
  min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.logo { flex: 0 0 auto; display: inline-flex; align-items: center; max-width: 100%; }
.logo img { width: clamp(172px, 19vw, 241px); height: auto; }
.category-nav { display: flex; align-items: center; gap: clamp(.15rem, .6vw, .6rem); }
.category-nav a {
  color: inherit; white-space: nowrap; padding: .6rem clamp(.34rem, .72vw, .78rem);
  border-radius: 6px; text-decoration: none; font-size: .92rem; font-weight: 650;
}
.category-nav a:hover, .category-nav a[aria-current] { background: #ffffff26; }
.quiet, .button {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: .58rem .95rem; border-radius: max(6px, calc(var(--round) / 2));
  border: 1px solid var(--line); text-decoration: none; font-size: .94rem; font-weight: 700;
}
.quiet { background: var(--surface); color: var(--ink); }
.quiet:hover { border-color: var(--accent); }
.button { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.button:hover { filter: brightness(.93); }
.menu-open { display: none; white-space: nowrap; }
.menu-open span { margin-inline-end: .45rem; }
dialog {
  width: min(100% - 2rem, 440px); max-height: calc(100dvh - 2rem); margin: auto; padding: 1rem;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--round);
}
dialog::backdrop { background: #150c1cca; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.dialog-head h2 { font-size: 1.4rem; }
.dialog-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.dialog-nav a {
  display: grid; place-items: center; min-height: 45px; padding: .5rem;
  border-radius: 8px; text-decoration: none; background: var(--panel); font-weight: 700;
}
.dialog-nav a:hover, .dialog-nav a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.wrap { width: min(100% - 3rem, 1320px); margin-inline: auto; min-height: 60vh; padding-block: 2rem 4.5rem; }
.foot-inner { padding-block: 2.15rem; align-items: flex-start; }
.foot-inner p { margin-top: .85rem; overflow-wrap: anywhere; }
.foot-inner nav { display: flex; flex-wrap: wrap; gap: .65rem 1.4rem; }
.foot-inner a { color: inherit; }
.eyebrow { font-size: .875rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.intro { min-width: 0; display: grid; align-content: center; gap: .75rem; }
.intro > p:last-child { max-width: 42ch; font-size: clamp(1rem, 2vw, 1.18rem); color: var(--muted); }
.lead, .discover { display: grid; gap: clamp(.9rem, 2vw, 1.5rem); align-items: stretch; }
.lead > *, .discover > * { min-width: 0; }
.discover { align-items: start; margin-block: 1.75rem; }
.puzzle .lead {
  grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr); padding: clamp(.9rem, 2.45vw, 2.1rem);
  border-radius: 28px; border: 1px solid var(--line); background: var(--panel);
  background-image: radial-gradient(#4c7e5a34 1px, transparent 1px); background-size: 19px 19px;
}
.puzzle .lead .intro { padding: clamp(.3rem, 2vw, 1.5rem); }
.puzzle .lead h1 { font-size: clamp(2.4rem, 4.7vw, 4.25rem); }
.puzzle .discover { grid-template-columns: minmax(15rem, .65fr) minmax(0, 1.35fr); }
.puzzle .discover > :last-child { grid-column: 1/-1; }
.wordgames .lead { grid-template-columns: minmax(0, 1.65fr) minmax(15rem, .75fr); }
.wordgames .lead .intro {
  grid-column: 1/-1; border-block: 1px solid var(--line); padding: 1.6rem .25rem; justify-items: center; text-align: center;
}
.wordgames .lead .intro > p:last-child, .quiz .lead .intro > p:last-child { max-width: 59ch; }
.wordgames .discover { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz .lead {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, .75fr); padding: clamp(1rem, 2.5vw, 2rem);
  border: 1px solid var(--line); border-radius: 30px;
  background: radial-gradient(ellipse at top, #653585, transparent 70%), var(--surface);
}
.quiz .lead .intro { grid-column: 1/-1; padding: 1rem; text-align: center; justify-items: center; }
.quiz .discover { grid-template-columns: 1.12fr .88fr; }
.mathplay .lead { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.mathplay .lead .intro {
  padding: clamp(1rem, 3.4vw, 3rem); border-radius: var(--round);
  background: repeating-linear-gradient(0deg, transparent 0 31px, #45808122 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, #45808122 31px 32px), var(--panel);
}
.mathplay .lead .featured { grid-column: 2; grid-row: 1 / 3; }
.mathplay .discover { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.play .lead { grid-template-columns: minmax(0, 1fr); }
.play .lead .intro {
  padding: 1rem 0 .2rem; grid-template-columns: auto 1fr; align-items: end; gap: .3rem 2rem;
}
.play .lead .eyebrow { grid-column: 1/-1; }
.play .lead .intro > p:last-child { padding-bottom: .25rem; }
.play .discover { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, 1fr); }
.rotation {
  height: 100%; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--round);
}
.slides { flex: 1; display: grid; }
.slide {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center; gap: clamp(.85rem, 2vw, 1.75rem); padding: clamp(.75rem, 1.7vw, 1.45rem);
  animation: appear .35s ease-out;
}
@keyframes appear { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.slide-art { min-width: 0; display: block; }
.slide-art img { width: 100%; height: auto; aspect-ratio: 4/3; object-fit: cover; border-radius: calc(var(--round) * .75); }
.slide-copy { min-width: 0; display: grid; justify-items: start; align-content: center; gap: .66rem; }
.slide-copy p { color: var(--muted); }
.rotation-controls { display: flex; gap: .65rem; padding: .75rem; align-items: center; border-top: 1px solid var(--line); }
.feature-choices { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr)); gap: .45rem; }
.feature-choices button {
  min-width: 0; display: flex; align-items: center; gap: .38rem; min-height: 48px; padding: .3rem;
  border: 1px solid transparent; border-radius: 7px; background: var(--bg);
  font-size: .82rem; line-height: 1.16; font-weight: 680; text-align: start; overflow-wrap: anywhere;
}
.feature-choices button:hover, .feature-choices button[aria-pressed="true"] { border-color: var(--accent); background: var(--panel); }
.feature-choices img { flex: 0 0 30px; width: 30px; height: 30px; object-fit: cover; border-radius: 5px; }
.feature-fallback { display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin: 1rem; }
.mathplay .slide { grid-template-columns: minmax(0, 1fr); place-content: center; }
.mathplay .slide-art img { max-height: 315px; }
.mathplay .slide-copy { padding: .1rem .35rem .75rem; }
.wordgames .slide { grid-template-columns: minmax(0, 1.07fr) minmax(0, .93fr); }
.wordgames .slide-copy h2 { font-size: clamp(1.7rem, 3.3vw, 2.7rem); }
.quiz .slide-art img { aspect-ratio: 1; }
.play .slide { position: relative; grid-template-columns: minmax(0, 1.32fr) minmax(0, .68fr); background: linear-gradient(115deg, #60382d, var(--surface)); border-radius: var(--round) var(--round) 0 0; }
.play .slide-art img { aspect-ratio: 16/8; }
.play .slide-copy h2 { font-size: clamp(1.6rem, 4vw, 3rem); }
.shelf { min-width: 0; }
.curated-shelf {
  height: 100%; padding: clamp(.75rem, 2vw, 1.3rem); border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--round);
}
.discover .curated-shelf { height: auto; }
.wordgames .curated-shelf { border-top: 4px solid var(--accent); }
.quiz .quick-list .curated-shelf { background: #2c1b43; }
.mathplay .quick-list .curated-shelf { border-inline-start: 5px solid var(--accent); }
.play .curated-shelf { background: linear-gradient(135deg, var(--panel), var(--surface)); }
.section-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: .35rem .9rem; margin-bottom: .9rem; }
.section-top p { margin-top: .45rem; color: var(--muted); }
.collection-link { font-weight: 700; font-size: .92rem; }
.cards { display: grid; gap: .7rem; min-width: 0; }
.cards.tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); }
.discover .cards.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.puzzle .discover .cards.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.discover .tiles .card img { aspect-ratio: 16/10; }
.category .cards.tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.cards.list { grid-template-columns: 1fr; }
.category-feature .cards.list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.spotlight { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.spotlight .card:first-child { grid-column: 1/-1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); }
.cards.spotlight .card:first-child img { max-height: 150px; }
.cards.spotlight .card:first-child strong { font-family: var(--display); font-size: clamp(1rem, 2vw, 1.4rem); }
.card {
  min-width: 0; display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: calc(var(--round) * .7); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card img { width: 100%; height: auto; aspect-ratio: 4/3; object-fit: cover; border-radius: calc(var(--round) * .7 - 1px) calc(var(--round) * .7 - 1px) 0 0; }
.card-body { padding: .63rem .7rem; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: .25rem; overflow-wrap: anywhere; line-height: 1.3; }
.card-body span { color: var(--muted); font-size: .87rem; }
.list .card { flex-direction: row; align-items: center; }
.list img { width: 68px; height: 56px; flex: 0 0 68px; border-radius: calc(var(--round) * .7 - 1px) 0 0 calc(var(--round) * .7 - 1px); }
.guide {
  padding: clamp(1rem, 3vw, 2rem); margin-block: 1.75rem; border-radius: var(--round);
  background: var(--panel); border-inline-start: 5px solid var(--accent);
}
.guide p { margin-top: .6rem; max-width: 78ch; }
.collections { display: grid; gap: 1.5rem; }
.category-shelf { border-top: 1px solid var(--line); padding-top: 1.15rem; }
.category-shelf .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.category-shelf .card img { aspect-ratio: 5/3; }
.crumb { margin-bottom: 1.1rem; font-size: .92rem; color: var(--muted); }
.crumb ol { display: flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; row-gap: .2rem; padding: 0; margin: 0; list-style: none; }
.crumb li:not(:first-child)::before { content: "/"; margin-inline-end: .6rem; }
.catalog-intro { background: var(--panel); padding: clamp(1rem, 4vw, 2.3rem); border-radius: var(--round); }
.category-feature { margin-block: 1.25rem; }
.game-intro {
  display: grid; grid-template-columns: minmax(0, 232px) minmax(0, 1fr); align-items: center;
  gap: clamp(1rem, 3.5vw, 2.6rem); padding: clamp(.85rem, 2.5vw, 2rem);
  background: var(--panel); border-radius: var(--round); border: 1px solid var(--line);
}
.game-intro > img { width: 100%; max-width: 232px; height: auto; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--round); }
.game-copy { min-width: 0; display: grid; align-content: center; justify-items: start; gap: .65rem; }
.game-copy h1 { font-size: clamp(1.9rem, 5.4vw, 3.55rem); }
.game-copy > p:not(.eyebrow) { max-width: 68ch; }
.game-guide {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem;
  margin-block: 1.25rem; align-items: stretch;
}
.game-guide section { padding: clamp(.85rem, 2.2vw, 1.4rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--round); }
.game-guide h2 { font-size: clamp(1.22rem, 2vw, 1.55rem); }
.game-guide p { margin-top: .65rem; color: var(--muted); }
.game-guide .game-reason { border-top: 4px solid var(--accent); }
.player-heading { display: grid; gap: .5rem; margin-bottom: 1rem; }
.player-heading h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); }
.play-stage {
  display: flex; flex-direction: column; min-width: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--round); overflow: hidden;
}
.fullscreen-button { align-self: flex-end; margin: .55rem .65rem; }
.play-stage iframe { display: block; width: 100%; height: clamp(420px, 76vh, 800px); border: 0; }
.play-stage:is(:fullscreen, .is-expanded) {
  width: 100%; height: 100%; border: 0; border-radius: 0;
}
.play-stage:is(:fullscreen, .is-expanded) iframe { flex: 1; min-height: 0; }
.play-stage.is-expanded { position: fixed; inset: 0; z-index: 10; height: 100dvh; }
body:has(.play-stage.is-expanded) { overflow: hidden; }
.prose {
  max-width: 840px; margin-inline: auto; padding: clamp(1rem, 4vw, 2.7rem); overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--round); line-height: 1.7;
}
.prose h1 { font-size: clamp(2.1rem, 6vw, 3.25rem); }
.prose h2 { margin-block: 1.6rem .5rem; font-size: clamp(1.3rem, 3vw, 1.8rem); }
.prose .guide h2 { margin-top: 0; }
.prose p, .prose ul, .prose dl { margin-block: .65rem; }
.prose dt { font-weight: 750; margin-top: .65rem; }
.prose dd { margin-inline-start: 0; }
.prose li + li { margin-top: .45rem; }
.wrap:has(> .ad-placement:first-child) { display: flow-root; padding-block-start: 0; }
.ad-placement { display: flex; justify-content: center; margin-block: 50px; text-align: center; }
@media (681px <= width <= 1100px) {
  .play .discover { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play .discover > :last-child { grid-column: 1/-1; }
  .play .discover .cards.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .head-inner, .foot-inner, .wrap { width: min(100% - 2rem, 1320px); }
  .category-nav { display: none; }
  .menu-open[data-ready] { display: inline-flex; }
  .head-inner:has(.menu-open:not([data-ready])) { flex-wrap: wrap; padding-block: .7rem; justify-content: center; }
  .head-inner:has(.menu-open:not([data-ready])) .category-nav { display: flex; flex-wrap: wrap; justify-content: center; }
  .puzzle .lead, .quiz .lead { grid-template-columns: 1fr; }
  .puzzle .lead .intro { padding: .2rem; }
  .quiz .quick-list .cards, .mathplay .quick-list .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-reason { grid-column: 1/-1; }
}
@media (max-width: 680px) {
  .wrap { padding-block: 1rem 2.5rem; }
  .head-inner { min-height: 61px; gap: .5rem; }
  .logo img { width: clamp(142px, 46vw, 191px); }
  .menu-open { padding-inline: .53rem; font-size: .86rem; }
  .foot-inner { display: grid; align-items: start; gap: 1.2rem; }
  .lead, .discover, .category-feature .cards.list, .game-guide { gap: .8rem; }
  .home .lead, .home .discover, .play .lead .intro { grid-template-columns: minmax(0, 1fr); }
  .home .lead .featured { grid-column: auto; grid-row: auto; }
  .mathplay .lead .quick-list { grid-row: 3; }
  .wordgames .lead .intro { padding-block: 1.1rem; }
  .quiz .lead .intro { padding: .4rem .15rem; }
  .lead h1 { font-size: clamp(2.15rem, 10vw, 3.5rem); }
  .puzzle .lead h1 { font-size: clamp(2.15rem, 10vw, 3.5rem); }
  .discover { margin-block: 1.1rem; }
  .slide, .wordgames .slide, .play .slide { grid-template-columns: minmax(0, 1fr); }
  .slide-art img, .mathplay .slide-art img, .quiz .slide-art img, .play .slide-art img { aspect-ratio: 16/9; max-height: 235px; }
  .slide-copy p { font-size: .94rem; }
  .rotation-controls { flex-wrap: wrap; align-items: stretch; }
  .feature-choices { flex: 1 0 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rotation-toggle { min-height: 39px; padding-block: .35rem; }
  .cards.tiles, .category .cards.tiles, .category-shelf .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .puzzle .discover .cards.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-feature .cards.list, .game-guide { grid-template-columns: minmax(0, 1fr); }
  .category-shelf .card img { aspect-ratio: 4/3; }
  .cards.spotlight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quiz .quick-list .cards, .mathplay .quick-list .cards { grid-template-columns: 1fr; }
  .game-intro { grid-template-columns: minmax(0, 1fr); }
  .game-intro > img { width: min(52vw, 175px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
