/* Fun, kid-friendly, high-contrast look. Loaded after style.css and seo.css. */
:root {
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --content-wide: 1400px;
  --radius-tile: 18px;
}
:root, [data-theme='dark'] {
  --color-bg: #17123a;
  --color-surface: #221b52;
  --color-surface-2: #2a2263;
  --color-surface-offset: #2d2570;
  --color-surface-dynamic: #392f85;
  --color-divider: #342b78;
  --color-border: #4a3f9c;
  --color-text: #ffffff;
  --color-text-muted: #ddd8ff;
  --color-text-faint: #b3acec;
  --color-primary: #ffc72c;
  --color-primary-hover: #ffd75e;
  --color-primary-ink: #2b1d00;
  --shadow-sm: 0 2px 6px rgb(8 4 36 / .35);
  --shadow-md: 0 6px 18px rgb(8 4 36 / .45);
  --shadow-lg: 0 14px 34px rgb(8 4 36 / .55);
}
[data-theme='light'] {
  --color-bg: #f1eeff;
  --color-surface: #ffffff;
  --color-surface-2: #ffffff;
  --color-surface-offset: #ebe6ff;
  --color-surface-dynamic: #ddd6ff;
  --color-divider: #ddd6ff;
  --color-border: #cfc6ff;
  --color-text: #1b1445;
  --color-text-muted: #403770;
  --color-text-faint: #5d5490;
  --color-primary: #d95d00;
  --color-primary-hover: #b94d00;
  --color-primary-ink: #ffffff;
  --shadow-sm: 0 2px 6px rgb(60 40 160 / .12);
  --shadow-md: 0 6px 18px rgb(60 40 160 / .16);
  --shadow-lg: 0 14px 34px rgb(60 40 160 / .22);
}
@media (prefers-color-scheme: light) { :root:not([data-theme]) { color-scheme: light; } }

body { font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.65; background: radial-gradient(1200px 500px at 50% -120px, color-mix(in oklab, var(--color-primary) 10%, transparent), transparent 70%), var(--color-bg); }
h1, h2, h3, .brand-name { font-family: var(--font-display); letter-spacing: 0; }
.container--wide { max-width: var(--content-wide); }
.site-header .container { max-width: var(--content-wide); }

/* ---------- header + category bar ---------- */
.site-header { background: color-mix(in oklab, var(--color-bg) 92%, transparent); border-bottom: 0; box-shadow: 0 2px 0 var(--color-divider); }
.header-search { border-radius: var(--radius-full); height: 46px; padding-inline: var(--space-4); border-width: 2px; max-width: 560px; }
.header-search input { font-size: 1rem; color: var(--color-text); font-family: var(--font-body); font-weight: 600; }
.brand-name { font-weight: 700; font-size: 1.5rem; }
.cat-bar { border-top: 1px solid var(--color-divider); background: color-mix(in oklab, var(--color-surface) 70%, transparent); }
.cat-bar-inner { display: flex; gap: var(--space-2); overflow-x: auto; padding-block: var(--space-2); scrollbar-width: none; }
.cat-bar-inner::-webkit-scrollbar { display: none; }
.cat-pill { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 7px 14px; border-radius: var(--radius-full); font-weight: 800; font-size: .95rem; color: var(--color-text); background: var(--color-surface-offset); border: 2px solid transparent; white-space: nowrap; transition: transform 140ms, background 140ms; }
.cat-pill:hover { transform: translateY(-2px); background: var(--color-surface-dynamic); }
.cat-pill.is-active { background: var(--color-primary); color: var(--color-primary-ink); }
.btn { border-radius: var(--radius-full); font-family: var(--font-display); font-weight: 600; font-size: 1rem; padding: 10px 22px; }
.btn-primary { background: var(--color-primary); color: var(--color-primary-ink); }
.btn-ghost { color: var(--color-text); border: 2px solid var(--color-border); background: transparent; }

/* ---------- homepage ---------- */
.home-intro { padding-block: var(--space-5) var(--space-2); }
.home-intro h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); font-weight: 700; line-height: 1.15; }
.home-intro p { color: var(--color-text-muted); font-weight: 600; margin-top: 4px; max-width: 70ch; }
.shelf { margin-top: var(--space-6); }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
.shelf-head h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.75rem); font-weight: 600; }
.shelf-link { font-family: var(--font-display); font-weight: 500; color: var(--color-primary); white-space: nowrap; }
.shelf-link:hover { text-decoration: underline; }

/* ---------- tiles ---------- */
.tile-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: var(--space-3); }
.tile-grid > li { list-style: none; }
.tile { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-tile); overflow: hidden; background: var(--color-surface-offset); box-shadow: var(--shadow-sm); border: 3px solid transparent; transition: transform 160ms cubic-bezier(.2,.9,.3,1.3), box-shadow 160ms, border-color 160ms; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; color: #fff; font-family: var(--font-display); font-weight: 600; font-size: .95rem; line-height: 1.15; background: linear-gradient(to top, rgb(10 5 40 / .88), rgb(10 5 40 / 0)); text-shadow: 0 1px 2px rgb(0 0 0 / .5); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile:hover, .tile:focus-visible { transform: scale(1.05) rotate(-.6deg); border-color: var(--color-primary); box-shadow: var(--shadow-lg); z-index: 2; }
.tile-grid--mosaic { grid-template-columns: repeat(2, 1fr); grid-auto-flow: dense; }
.tile-grid--mosaic .tile-big { grid-column: span 2; grid-row: span 2; }
.tile-grid--mosaic .tile-big .tile { height: 100%; aspect-ratio: auto; }
.tile-grid--mosaic .tile-big .tile-title { font-size: 1.35rem; padding: 40px 16px 14px; }
@media (min-width: 640px)  { .tile-grid--mosaic { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px)  { .tile-grid--mosaic { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .tile-grid--mosaic { grid-template-columns: repeat(6, 1fr); } }
.tile-grid--shelf { grid-template-columns: repeat(2, 1fr); }
.tile-grid--shelf > li:nth-child(n+7) { display: none; }
@media (min-width: 640px)  { .tile-grid--shelf { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px)  { .tile-grid--shelf { grid-template-columns: repeat(4, 1fr); } .tile-grid--shelf > li:nth-child(n+5) { display: list-item; } .tile-grid--shelf > li:nth-child(n+9) { display: none; } }
@media (min-width: 1100px) { .tile-grid--shelf { grid-template-columns: repeat(6, 1fr); } .tile-grid--shelf > li:nth-child(n+9) { display: list-item; } .tile-grid--shelf > li:nth-child(n+13) { display: none; } }
.tile-grid--side { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
.tile-grid--side .tile-title { font-size: .85rem; padding: 18px 8px 6px; }

/* ---------- game page layout ---------- */
.game-page { padding-block: var(--space-4) var(--space-12); }
.breadcrumb { font-size: .95rem; font-weight: 700; }
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb [aria-current] { color: var(--color-text); }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; }
@media (min-width: 1040px) { .play-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-8); } }
.play-main { min-width: 0; }
.game-head { margin-block: var(--space-2) var(--space-4); }
.game-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem); font-weight: 700; line-height: 1.1; }
.chip { font-family: var(--font-body); font-weight: 800; font-size: .9rem; color: var(--color-text); background: var(--color-surface-offset); border: 2px solid var(--color-border); border-radius: var(--radius-full); padding: 4px 14px; }
a.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.player-frame { border-radius: 22px; border: 3px solid var(--color-border); box-shadow: var(--shadow-md); }
.play-cta { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; padding: 14px 40px; box-shadow: 0 6px 0 rgb(0 0 0 / .25), var(--shadow-lg); }
.play-poster:hover .play-cta { transform: translate(-50%, -52%) scale(1.04); }
.player-hint { color: var(--color-text-muted); font-size: .9rem; font-weight: 600; }

.panel { background: var(--color-surface); border: 2px solid var(--color-border); border-radius: 22px; padding: var(--space-6); box-shadow: var(--shadow-sm); }
.game-content { margin-top: var(--space-6); display: grid; gap: var(--space-4); }
.game-content section { margin: 0; }
.game-content h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: var(--space-3); padding-left: 14px; border-left: 6px solid var(--color-primary); line-height: 1.2; }
.game-content p, .game-content ul, .game-content ol, details p { color: var(--color-text); font-size: 1.0625rem; line-height: 1.75; max-width: none; }
.game-content p { margin-bottom: var(--space-3); }
.game-content p:last-child { margin-bottom: 0; }
.game-content .note { color: var(--color-text-muted); font-size: .95rem; }
.game-content a, .lead a, .home-about a { color: var(--color-primary); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
ul.ticks { list-style: none; padding: 0; }
ul.ticks li { position: relative; padding-left: 32px; margin-bottom: 10px; }
ul.ticks li::before { content: "✓"; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--color-primary); color: var(--color-primary-ink); font-weight: 900; font-size: .8rem; display: grid; place-items: center; }
ol.steps { list-style: none; padding: 0; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding-left: 44px; margin-bottom: 12px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--color-primary); color: var(--color-primary-ink); font-family: var(--font-display); font-weight: 700; display: grid; place-items: center; }
.controls > div, .info > div { background: var(--color-surface-offset); border: 0; border-radius: 14px; padding: var(--space-4); }
.controls dt, .info dt { color: var(--color-text-faint); font-weight: 800; }
.controls dd, .info dd { color: var(--color-text); font-size: 1rem; font-weight: 600; }
details { background: var(--color-surface-offset); border: 0; border-radius: 14px; padding: var(--space-3) var(--space-4); max-width: none; }
summary { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
details[open] summary { color: var(--color-primary); }

.play-side { display: grid; gap: var(--space-4); }
.side-card { background: var(--color-surface); border: 2px solid var(--color-border); border-radius: 22px; padding: var(--space-4); box-shadow: var(--shadow-sm); }
.side-card h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: var(--space-3); }
.side-card .info > div { padding: var(--space-3); }
.info a { color: var(--color-primary); font-weight: 800; }
.play-side .ad-unit { padding: 0; margin: 0; }
.side-card .see-all { margin-top: var(--space-4); } .side-card .see-all .btn { width: 100%; justify-content: center; margin-top: 0; }

.cat-head { margin-block: var(--space-3) var(--space-5); }
.cat-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 700; margin-bottom: var(--space-2); }
.lead { color: var(--color-text-muted); font-weight: 600; max-width: 75ch; }
.home-about { margin-top: var(--space-10); }
.home-about h2 { font-size: 1.5rem; margin-bottom: var(--space-3); }
.home-about p { color: var(--color-text); max-width: 80ch; margin-bottom: var(--space-3); }
.az-list a { color: var(--color-text); font-weight: 700; }
section[aria-labelledby^="l-"] h2 { font-family: var(--font-display); }
.site-footer { margin-top: var(--space-8); background: var(--color-surface); border-top: 3px solid var(--color-border); color: var(--color-text-muted); font-weight: 600; }
.footer-cats a, .footer-legal a { color: var(--color-text); }
.ad-unit { max-width: none; }
@media (max-width: 520px) { .play-cta { font-size: 1.2rem; padding: 10px 26px; } .panel { padding: var(--space-4); } }
@media (prefers-reduced-motion: reduce) { .tile, .cat-pill { transition: none; } .tile:hover { transform: none; } }
.game-content ol.steps, .game-content ul.ticks { max-width: none; }
@media (max-width: 760px) { .site-header { position: static; } .cat-bar-inner { padding-block: 6px; } }
@media (max-width: 639px) {
  .tile-grid--mosaic .tile-big { grid-row: span 1; }
  .tile-grid--mosaic .tile-big .tile { height: auto; aspect-ratio: 16 / 9; }
}
.game-content li, .side-card li { max-width: none; }

/* Portrait-friendly player for word / board games (set "frame": "tall" in data/games.json) */
.player-frame--tall { aspect-ratio: auto; height: clamp(560px, 82vh, 780px); }
@media (max-width: 639px) { .player-frame--tall { height: clamp(520px, 80vh, 700px); } }
.player-frame--tall .play-poster img { object-position: 50% 30%; }

/* Wordle game data panels and Wordle hub */
.freq { list-style: none; padding: 0; margin: var(--space-4) 0; display: grid; gap: 8px; }
.freq li { display: grid; grid-template-columns: 2ch 1fr 4ch; align-items: center; gap: 12px; font-weight: 700; }
.freq-l { font-family: 'Fredoka', sans-serif; letter-spacing: .04em; }
.freq-p { text-align: right; font-variant-numeric: tabular-nums; color: var(--color-text-muted, inherit); }
.freq .bar { height: 14px; border-radius: 999px; background: var(--color-surface-offset); overflow: hidden; display: block; }
.freq .bar i { display: block; height: 100%; border-radius: 999px; background: var(--color-primary); }
.starter-list { list-style: none; padding: 0; margin: var(--space-4) 0; display: flex; flex-wrap: wrap; gap: 8px; }
.starter-list li { font-family: 'Fredoka', sans-serif; font-weight: 700; letter-spacing: .14em; font-size: 1.1rem; padding: 6px 14px; border-radius: 10px; background: var(--color-primary); color: var(--color-primary-ink); }
.hub-feature { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-6); align-items: center; margin-bottom: var(--space-6); }
.hub-feature-img img { width: 100%; height: auto; border-radius: 16px; display: block; }
.hub-feature h2 { margin-top: 0; }
@media (max-width: 640px) { .hub-feature { grid-template-columns: 1fr; } .hub-feature-img { max-width: 220px; } }
