/* ColoringOnly — single stylesheet, no framework. Mobile-first. */

/* Self-hosted (was Google Fonts, which blocked rendering): Nunito variable, latin + latin-ext. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500 900; font-display: swap; src: url("../fonts/nunito-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500 900; font-display: swap; src: url("../fonts/nunito-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #1d1b29;
  --muted: #5f5b73;
  --line: #ebe5dd;
  --paper: #fffaf5;
  --card: #fff;
  --brand: #ff6b3d;
  --brand-ink: #c43d12;      /* brand color dark enough for text on white */
  --brand-soft: #fff0e9;
  --violet: #6d4aff;
  --violet-soft: #f0ecff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 41, .06), 0 4px 14px rgba(29, 27, 41, .06);
  --shadow-lg: 0 10px 30px rgba(29, 27, 41, .14);
  --display: "Nunito", ui-rounded, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--body); overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); font-weight: 900; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 800; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }
.center { text-align: center; }
.center .search { margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.section { margin: 40px auto; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 70ch; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
/* On phones the header scrolls away with the page: the screen is too short to keep it. */
@media (max-width: 900px) { .site-header { position: relative; } }
.header-bar { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 900 1.35rem/1 var(--display); letter-spacing: -.02em; flex: none; }
.logo b { color: var(--brand); font-weight: 900; }
.logo:hover { color: var(--ink); }
.logo img { display: block; }

.search { position: relative; display: flex; align-items: center; flex: 1; max-width: 560px; background: #f5f2ee; border: 2px solid transparent; border-radius: 999px; padding: 0 6px 0 14px; transition: border-color .15s, background .15s; }
.search:focus-within { background: #fff; border-color: var(--violet); }
.search > svg { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 10px; font-size: 1rem; outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-lg { max-width: 640px; padding: 6px 6px 6px 18px; background: #fff; border-color: var(--line); box-shadow: var(--shadow); }
.search-lg input { font-size: 1.08rem; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 50; }
.suggest a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.suggest a small { color: var(--muted); white-space: nowrap; }
.suggest a:hover, .suggest [aria-selected="true"] a { background: var(--violet-soft); }

.lang-switch { position: relative; margin-left: auto; }
/* Pill like the search box: globe + code + chevron, so it reads as a menu. */
.lang-switch summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px 0 11px; border: 2px solid transparent; border-radius: 999px; background: #f5f2ee; color: var(--ink); font: 800 14px/1 var(--display); letter-spacing: .02em; transition: background .15s, border-color .15s; user-select: none; }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lang-switch .globe { color: var(--violet); }
.lang-switch .chev { width: 14px; height: 14px; color: var(--muted); transition: transform .2s; }
.lang-switch summary:hover { background: #eee9e2; }
.lang-switch[open] summary { background: #fff; border-color: var(--violet); }
.lang-switch[open] .chev { transform: rotate(180deg); }
.lang-switch summary:focus-visible { outline: none; border-color: var(--violet); }
.lang-switch ul { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 200px; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: lang-in .14s ease-out; }
@keyframes lang-in { from { opacity: 0; transform: translateY(-4px); } }
.lang-switch a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.lang-switch abbr { display: inline-grid; place-items: center; width: 30px; height: 22px; border-radius: 6px; background: #f5f2ee; color: var(--muted); font: 800 11px/1 var(--display); letter-spacing: .04em; text-decoration: none; }
.lang-switch a:hover { background: var(--violet-soft); }
.lang-switch a:hover abbr { background: #fff; color: var(--violet); }
.lang-switch a[aria-current] { background: var(--brand-soft); color: var(--brand-ink); }
.lang-switch a[aria-current] abbr { background: var(--brand); color: var(--ink); }
.lang-switch .check { width: 16px; height: 16px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-toggle { display: none; width: 44px; height: 44px; border: 0; background: none; border-radius: 10px; cursor: pointer; padding: 11px 10px; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 2.5px; border-radius: 2px; background: var(--ink); transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

.site-nav { border-top: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; gap: 4px; height: 46px; }
.nav-link { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 999px; border: 0; background: none; font-weight: 600; font-size: .95rem; color: var(--ink); text-decoration: none; cursor: pointer; }
.nav-link:hover, .nav-item.is-open > .nav-link { background: var(--brand-soft); color: var(--brand-ink); }
.nav-item { position: relative; }
.mega { display: none; position: absolute; top: calc(100% + 6px); left: 0; width: min(640px, 90vw); padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); grid-template-columns: repeat(3, 1fr); gap: 2px; }
.nav-item.is-open .mega { display: grid; }
@media (hover: hover) and (min-width: 901px) { .nav-item.has-menu:hover .mega { display: grid; } }
.mega.mega-small { width: min(300px, 90vw); grid-template-columns: 1fr; }
.mega a { padding: 8px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.mega a:hover, .mega a[aria-current] { background: var(--brand-soft); color: var(--brand-ink); }
.mega .mega-all { grid-column: 1 / -1; font-weight: 700; color: var(--brand-ink); border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 6px; padding-top: 10px; }

@media (max-width: 900px) {
  .header-bar { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .header-bar .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav-toggle { display: flex; }
  .site-nav { display: none; max-height: calc(100vh - 120px); overflow-y: auto; }
  .site-nav.is-open { display: block; }
  .nav-inner { flex-direction: column; align-items: stretch; height: auto; padding-top: 8px; padding-bottom: 12px; }
  .nav-link { width: 100%; justify-content: space-between; border-radius: 10px; padding: 12px; }
  .mega { position: static; width: auto; box-shadow: none; border: 0; padding: 0 0 8px 8px; grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Buttons & chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .1s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--ink); }   /* dark text: white on this orange is only 2.8:1 */
.btn-primary:hover { background: #f25a2a; border-color: #f25a2a; color: var(--ink); }
.btn-accent { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn-accent:hover { background: #5a37f0; border-color: #5a37f0; color: #fff; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-ink); }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand-ink); text-decoration: underline; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; }
.chips > span { color: var(--muted); font-size: .9rem; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 600; }
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip small { opacity: .65; }
/* Home "Popular:" row: one line, smaller chips (app.js hides the ones that don't fit). */
.chips-line { flex-wrap: nowrap; gap: 6px; overflow: hidden; }
.chips-line > * { flex: none; }
.chips-line .chip { padding: 5px 10px; font-size: .85rem; }
.chips-line .chip[hidden] { display: none; }

/* ---------- Hero ---------- */
.hero { background:
    radial-gradient(circle at 12% 20%, #ffe3d6 0 120px, transparent 121px),
    radial-gradient(circle at 92% 12%, #e5deff 0 90px, transparent 91px),
    radial-gradient(circle at 80% 95%, #fff1c2 0 110px, transparent 111px),
    linear-gradient(#fff, var(--paper));
  border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 56px; }
.hero h1 { max-width: 18ch; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero-points li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--muted); }
.hero-points b { display: block; font: 800 1.1rem var(--display); color: var(--ink); }
.hero-points li:nth-child(1) b { color: var(--brand-ink); }
.hero-points li:nth-child(2) b { color: #1b7f4b; }
.hero-points li:nth-child(3) b { color: var(--violet); }
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding-top: 32px; padding-bottom: 32px; gap: 24px; }
  .hero-points { grid-template-columns: repeat(3, 1fr); }
  .hero-points li { padding: 12px; font-size: .9rem; }
}
@media (max-width: 600px) { .hero-points { grid-template-columns: 1fr; } }

/* ---------- Section heads, page heads ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.more { font-weight: 700; text-decoration: none; white-space: nowrap; }
.page-head { padding-top: 24px; }
.page-head h1 { margin-bottom: .3em; }
.page-head h1 small { font-size: .5em; color: var(--muted); font-weight: 700; }
.page-head .search { margin-top: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .92rem; margin: 0 0 12px; }
.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 12px; padding: 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 8px; opacity: .5; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand-ink); text-decoration: underline; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.card { display: flex; flex-direction: column; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--ink); }
.card-img { position: relative; display: block; aspect-ratio: 4 / 5; background: #fff; border-bottom: 1px solid var(--line); }
/* Absolutely positioned so tall images can't stretch the 4:5 box (aspect-ratio grows to fit content otherwise). */
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.card-title { display: block; padding: 10px 12px 12px; font-weight: 700; font-size: .95rem; line-height: 1.3; color: var(--ink); text-decoration: none; }
.badge { position: absolute; right: 8px; bottom: 8px; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .75rem; font-weight: 700; }
.img-card figcaption { display: flex; align-items: flex-start; justify-content: space-between; }
.img-card .card-title { flex: 1; padding-right: 4px; }
.img-card .card-title:hover { color: var(--brand-ink); }
.img-card .quick { display: flex; padding: 6px 6px 0 0; }
@media (max-width: 600px) { .img-card figcaption { flex-direction: column; } .img-card .quick { padding: 0 6px 6px; } }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
@media (max-width: 600px) { .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.cat-tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; padding: 14px; border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); transition: transform .15s; isolation: isolate; }
.cat-tile:hover { transform: translateY(-3px); color: var(--ink); }
.cat-tile img { position: absolute; right: -14px; top: -8px; width: 58%; height: auto; transform: rotate(8deg); border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .12); z-index: -1; transition: transform .2s; }
.cat-tile:hover img { transform: rotate(4deg) scale(1.04); }
.cat-name { font: 800 1.12rem/1.2 var(--display); max-width: 60%; }
.cat-count { font-size: .82rem; color: rgba(29, 27, 41, .7); font-weight: 600; }
.tone-0 { background: #ffe3d6; } .tone-1 { background: #e5deff; } .tone-2 { background: #fff1c2; }
.tone-3 { background: #d6f5e3; } .tone-4 { background: #d9efff; } .tone-5 { background: #ffdcea; }

.card-square .card-img { aspect-ratio: 1 / 1; }
.card-square .card-img img { object-fit: cover; padding: 0; }

/* ---------- Games ---------- */
.game-frame { position: relative; aspect-ratio: 16 / 10; max-height: 80vh; background: #1d1b29; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.game-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.game-about { margin-top: 24px; }
@media (max-width: 600px) { .game-frame { aspect-ratio: 3 / 4; } }

/* ---------- Pagination ---------- */
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 32px; }
.pager-num, .pager-step { min-width: 42px; height: 42px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; }
.pager a:hover { border-color: var(--brand); color: var(--brand-ink); }
.pager-num[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager-gap { color: var(--muted); padding: 0 4px; }

/* ---------- Prose ---------- */
.prose { max-width: 75ch; color: #36334a; }
.prose.columns { max-width: none; columns: 2 320px; column-gap: 40px; }
.prose.columns p { margin-top: 0; break-inside: avoid; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose img { border-radius: 10px; margin: 16px 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 16px 0; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line) !important; padding: 10px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose iframe { max-width: 100%; }
/* WordPress image lists in article text ("Top 5 …", Pokemon by generation): tiles, as on the old site. */
.prose ul.cnt-list { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.prose ul.cnt-list li { margin: 0; padding: 10px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; line-height: 1.3; }
.prose ul.cnt-list img { display: block; width: auto !important; max-width: 100%; height: 120px !important; object-fit: contain; margin: 0 auto 8px; border-radius: 6px; }
.prose ul.cnt-list .titl { font-size: .9rem; font-weight: 600; }
.prose ul.cnt-list a { text-decoration: none; }
.prose li > ul.cnt-list { margin-left: -1.3em; }
.grid-head > :first-child { margin-top: 0; }
.learning-filter { display: grid; gap: 14px; padding: 16px 18px; margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.learning-filter fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.learning-filter legend { font-weight: 700; margin-bottom: 6px; }
.learning-filter summary { font-weight: 700; cursor: pointer; }
.learning-filter .topic-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin-top: 10px; }
.learning-filter label { display: inline-flex; align-items: center; gap: 6px; }
.learning-filter .filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.prose ul.list-nav { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.prose ul.list-nav .list-nav-title { font-weight: 700; }
.lead-prose { font-size: 1.05rem; }
.lead-prose p { margin: 0 0 12px; }
.article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 36px); max-width: 860px; }
.prose-block .prose { color: var(--muted); }
/* About page: "As Featured on" logos and the team cards */
.prose .about-cards, .prose .team-cards { display: grid; gap: 16px; margin: 16px 0; }
.prose .about-cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.prose .team-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.prose .about-card, .prose .team-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.prose .about-card img { display: block; height: 70px; width: auto; max-width: 100%; object-fit: contain; margin: 0 auto 12px; border-radius: 6px; }
.prose .about-card p { margin: 0; font-size: .95rem; }
.prose .team-card { text-align: center; }
.prose .team-card img { display: block; width: 120px; height: 120px; object-fit: cover; border-radius: 50%; margin: 0 auto 10px; background: var(--bg, #f4f3fa); }
.prose .team-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.prose .team-card p { margin: 0 0 8px; font-size: .92rem; text-align: left; }
.prose .team-card .team-links { text-align: center; margin: 0; font-weight: 600; }
.prose blockquote { margin: 16px 0; padding: 4px 18px; border-left: 4px solid var(--line); font-style: italic; }

/* ---------- Image page ---------- */
.sheet-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.sheet { position: relative; background: #fff; border-radius: 6px; padding: clamp(10px, 2vw, 24px); box-shadow: 0 1px 0 var(--line), 0 18px 40px -12px rgba(29, 27, 41, .25); }
/* Full width + the width/height attributes reserve the box before the image loads (width: auto
   collapsed it and shifted the panel below by 0.4 CLS); contain keeps tall sheets inside 78vh. */
.sheet img { margin: 0 auto; width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
.sheet-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-size: 1.8rem; line-height: 1; opacity: .85; }
.sheet-nav:hover { opacity: 1; color: var(--brand-ink); }
.sheet-nav.prev { left: 8px; } .sheet-nav.next { right: 8px; }
.sheet-panel { position: sticky; top: 130px; }
.sheet-panel h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); }
.sheet-panel > p { color: var(--muted); }
.actions { display: grid; gap: 10px; margin: 20px 0; }
.actions .btn { width: 100%; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .92rem; color: var(--muted); }
.share a { font-weight: 600; }
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .9rem; }
.prevnext a { text-decoration: none; font-weight: 600; max-width: 48%; }
.prevnext a[rel="next"] { text-align: right; margin-left: auto; }
@media (max-width: 900px) {
  .sheet-layout { grid-template-columns: 1fr; }
  .sheet-panel { position: static; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .btn-accent { grid-column: 1 / -1; order: -1; }
}

/* ---------- Blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.blog-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; }
.blog-card:hover { transform: translateY(-3px); color: var(--ink); }
.blog-card img { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: #f5f2ee; }
.blog-card-body { padding: 14px 16px 18px; }
.blog-card-title { display: block; font: 800 1.08rem/1.3 var(--display); }
.blog-card-text { display: block; margin-top: 6px; color: var(--muted); font-size: .92rem; }
.blog-hero { width: 100%; border-radius: var(--radius); margin-bottom: 24px; aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; max-width: 560px; }
.form label { display: grid; gap: 6px; font-weight: 700; }
.form input, .form textarea { font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--violet); }
.form [aria-invalid="true"] { border-color: #d92d20; }
.form .optional { font-weight: 400; color: var(--muted); }
.field-error { color: #b42318; font-weight: 600; font-size: .9rem; }
.form button { justify-self: start; }
.hp { position: absolute; left: -9999px; }
.notice { padding: 14px 18px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.notice.success { background: #d6f5e3; color: #0f5132; }
.notice.error { background: #fde4e1; color: #912018; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; background: #1d1b29; color: #cfcbe0; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 32px; padding-top: 48px; padding-bottom: 32px; }
.footer-grid h2 { font-size: 1rem; color: #fff; margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: #cfcbe0; text-decoration: none; }
.footer-grid a:hover { color: #fff; text-decoration: underline; }
.site-footer .logo { color: #fff; margin-bottom: 12px; }
.site-footer .logo:hover { color: #fff; }
.footer-brand p { max-width: 36ch; margin: 0; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 18px; padding-bottom: 24px; font-size: .88rem; color: #9d98b3; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 200; box-shadow: var(--shadow-lg); }

/* ---------- Online colorer ---------- */
.colorer { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto 1fr auto; background: #f3efe9; }
.colorer[hidden] { display: none; }
.colorer-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.colorer-bar .spacer { flex: 1; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 2px solid transparent; border-radius: 10px; background: #f5f2ee; cursor: pointer; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.tool:hover { background: #ece7e1; }
.tool[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--violet); color: #3d22c9; }
.tool:disabled { opacity: .4; cursor: default; }
.tool-size { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); padding: 0 6px; }
.tool-size input { width: 90px; accent-color: var(--violet); }
.colorer-stage { position: relative; overflow: hidden; display: grid; place-items: center; padding: 12px; touch-action: none; }
.colorer-canvas { position: relative; background: #fff; box-shadow: var(--shadow-lg); }
.colorer-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.colorer-canvas canvas.lines { mix-blend-mode: multiply; pointer-events: none; }
.colorer-canvas.is-fill { cursor: crosshair; }
.palette { display: flex; gap: 6px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--line); overflow-x: auto; align-items: center; }
.swatch { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.08); }
.swatch-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch-custom input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; }
.colorer-loading { color: var(--muted); font-weight: 600; }
@media (max-width: 600px) { .tool .label { display: none; } .swatch { width: 30px; height: 30px; } }

/* Print button (app.js printImage): only the image, sized in page units so it fits one A4/Letter page on phones too */
.print-sheet { display: none; }
@media print {
  @page { size: auto; margin: 10mm; }
  html.is-printing, html.is-printing body { background: #fff !important; color-scheme: light; margin: 0; padding: 0; }
  html.is-printing body > :not(.print-sheet) { display: none !important; }
  html.is-printing .print-sheet { display: flex; justify-content: center; align-items: flex-start; break-inside: avoid; page-break-inside: avoid; }
  html.is-printing .print-sheet img { display: block; width: auto; height: auto; max-width: 100%; max-height: 255mm; object-fit: contain; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Ads (App\Support\Ads; the AdVerge wrapper fills the slots, and draws the sticky bars itself) ---------- */
.ad { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin: 18px auto; text-align: center; }
/* Space reserved for the common creative heights, so the page doesn't jump when an ad fills (CLS). */
.ad--top { margin: 12px auto 0; min-height: 90px; }
.ad--row { min-height: 90px; }
@media (max-width: 767px) { .ad--top { min-height: 100px; } .ad--row { min-height: 280px; } }
.grid > .ad--row { grid-column: 1 / -1; margin: 4px 0; }
.ad--panel { margin: 18px 0 0; }
@media (max-width: 900px) { .ad--panel { display: none; } }
/* Side rails beside the 1240px content, only where the window leaves room for them (160px from 1600px, 300px from 1900px). */
.ad-rails { display: none; }
@media (min-width: 1600px) {
  .ad-rails { display: block; }
  .ad--rail-left, .ad--rail-right { position: fixed; top: 140px; width: calc((100vw - var(--wrap)) / 2 - 24px); max-width: 300px; margin: 0; overflow: hidden; z-index: 5; }
  .ad--rail-left { left: 12px; }
  .ad--rail-right { right: 12px; }
}
