/* Layout: one column on phones, the drawing is always the largest thing on screen.
   Ink outlines on controls echo the thick lines of a coloring book. */
:root {
  --bg: #ffffff; --soft: #eef2ff; --ink: #17152b; --muted: #5d5a73;
  --berry: #6a3fe0; --on-berry: #ffffff; --sun: #ffcf3f; --on-sun: #17152b;
  --mint: #1f9e76; --coral: #e5483b; --rule: #17152b;
  --paper: #ffffff; --art: #111111;
  --display: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", Nunito, Quicksand, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px; --bw: 2.5px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15131f; --soft: #221f33; --ink: #f4f2fb; --muted: #aba7c0;
    --berry: #a98cff; --on-berry: #15131f; --sun: #ffcf3f; --on-sun: #17152b;
    --mint: #58d3aa; --coral: #ff8377; --rule: #f4f2fb; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15131f; --soft: #221f33; --ink: #f4f2fb; --muted: #aba7c0;
  --berry: #a98cff; --on-berry: #15131f; --sun: #ffcf3f; --on-sun: #17152b;
  --mint: #58d3aa; --coral: #ff8377; --rule: #f4f2fb; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.0625rem/1.6 var(--text); }
img, svg { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--berry); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.85rem, 5.2vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 3.4vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap { max-width: 1080px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.stack { display: grid; gap: 1.1rem; }
.stack > * { min-width: 0; }
.section { padding-block: 2rem; }
.band { background: var(--soft); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.prose { display: grid; gap: .9rem; max-width: 65ch; align-content: start; }
.prose ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* header */
.top { border-bottom: var(--bw) solid var(--rule); background: var(--bg); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .65rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font: 800 1.3rem/1 var(--display); color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; padding-block: .25rem; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a[aria-current] { border-bottom-color: var(--sun); }

.crumbs { font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .35rem; }
.crumbs a { color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: 700 1rem/1.1 var(--display); color: var(--on-sun); background: var(--sun);
  border: var(--bw) solid var(--rule); border-radius: 999px; padding: .7rem 1.1rem; text-decoration: none; cursor: pointer; box-shadow: 3px 3px 0 var(--rule); min-height: 44px; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--rule); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--rule); }
.btn.plain { background: var(--bg); color: var(--ink); }
.btn.quiet { background: var(--bg); color: var(--ink); box-shadow: none; padding: .5rem .8rem; font-size: .9rem; }
.btn.quiet:hover, .btn.quiet:active { transform: none; box-shadow: none; background: var(--soft); }
.btn svg { width: 18px; height: 18px; flex: none; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.1rem .9rem; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.4rem 1.1rem; } }
.card { display: grid; gap: .45rem; color: var(--ink); text-decoration: none; align-content: start; }
.card img { border: var(--bw) solid var(--rule); border-radius: var(--r); background: var(--paper); width: 100%; aspect-ratio: 3 / 4; }
.card:hover img { box-shadow: 4px 4px 0 var(--berry); transform: translate(-2px, -2px); }
.card b { font-family: var(--display); line-height: 1.2; }
.card small { color: var(--muted); }
.shelf { display: grid; gap: 1rem; }
.shelf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }

/* hero */
.hero { display: grid; gap: 1.5rem; align-items: center; padding-block: 1.6rem 2.2rem; }
@media (min-width: 860px) { .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; } }

/* the coloring app */
.app { display: grid; gap: .7rem; }
.app > * { min-width: 0; }
/* Pictures are portrait 3:4. The stage shrinks on short screens so the whole picture and the colors fit at once. */
.stage-wrap { position: relative; justify-self: center; width: 100%;
  width: min(100%, max(260px, calc((100vh - 210px) * .75)));
  width: min(100%, max(260px, calc((100svh - 210px) * .75))); }
.stage { border: var(--bw) solid var(--rule); border-radius: var(--r); background: var(--paper); overflow: auto; aspect-ratio: 3 / 4; box-shadow: 5px 5px 0 var(--rule);
  overscroll-behavior: contain; touch-action: pan-x pan-y; }
.stage svg { display: block; width: 100%; height: auto; max-width: none; touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.zoom { position: absolute; top: 10px; right: 10px; display: grid; gap: 8px; }
.zoom button { width: 44px; height: 44px; border-radius: 50%; border: var(--bw) solid var(--rule); background: var(--bg); color: var(--ink); font: 800 1.5rem/1 var(--display);
  cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 2px 2px 0 var(--rule); opacity: .92; }
.zoom button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.dock { display: grid; gap: .35rem; }
.dock-row { display: flex; gap: .5rem; align-items: center; min-width: 0; }
.undo { flex: none; width: 44px; height: 44px; border-radius: 50%; border: var(--bw) solid var(--rule); background: var(--bg); color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0; }
.undo svg { width: 20px; height: 20px; }
.undo:active { background: var(--soft); }
/* On phones and tablets the colors stay at the bottom of the screen while the picture is in view. */
@media (max-width: 859px) {
  .dock { position: sticky; bottom: 0; z-index: 3; background: var(--bg); border-top: var(--bw) solid var(--rule);
    margin-inline: -16px; padding: .45rem 16px calc(.35rem + env(safe-area-inset-bottom, 0px)); }
  .dock .status { white-space: nowrap; overflow: hidden; }
}
.art .rg { fill: #fff; stroke: var(--art); stroke-width: var(--sw, 5); stroke-linejoin: round; stroke-linecap: round; }
.art .ln { fill: none; stroke: var(--art); stroke-width: var(--sw, 5); stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.art .ln .k { fill: var(--art); }
.art .o { pointer-events: none; }
.art .r { cursor: pointer; }
.art .nums { display: none; pointer-events: none; font: 600 12px var(--text); text-anchor: middle; fill: #333; }
.art.show-nums .nums { display: block; }
.art .nums text.done { display: none; }
.art .r.nope { animation: nope .3s; }
@keyframes nope { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.modes { display: inline-grid; grid-auto-flow: column; border: var(--bw) solid var(--rule); border-radius: 999px; overflow: hidden; justify-self: start; }
.modes button { font: 700 .95rem/1 var(--display); padding: .6rem .95rem; border: 0; background: var(--bg); color: var(--ink); cursor: pointer; min-height: 42px; }
.modes button[aria-pressed="true"] { background: var(--berry); color: var(--on-berry); }
.swatches { display: flex; gap: .5rem; overflow-x: auto; padding: 6px 4px 8px; scrollbar-width: thin; flex: 1; min-width: 0; overscroll-behavior-x: contain; }
@media (min-width: 860px) { .swatches { flex-wrap: wrap; overflow: visible; } }
.sw { flex: none; width: 44px; height: 44px; border-radius: 50%; border: var(--bw) solid var(--rule); cursor: pointer; padding: 0; font: 800 1rem/1 var(--display); position: relative; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--berry); transform: scale(1.06); }
.sw.complete::after { content: ""; position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--mint); border: 2px solid var(--bg); }
.sw.pulse { animation: pulse .5s 2; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.sw.custom { background: conic-gradient(#f44, #fc3, #3c6, #39f, #a5f, #f44); overflow: hidden; }
.sw.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.status { display: flex; align-items: center; gap: .7rem; font-size: .9rem; color: var(--muted); min-height: 1.6rem; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; border: 1.5px solid var(--rule); max-width: 220px; }
.bar i { display: block; height: 100%; width: 0; background: var(--mint); transition: width .25s; }
.cheer { font: 800 1.05rem/1.2 var(--display); color: var(--mint); }
.picked { font-weight: 600; color: var(--ink); }

/* detail page */
.detail { display: grid; gap: 1.6rem; }
@media (min-width: 860px) { .detail { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2.2rem; align-items: start; } }
.print-box { display: grid; gap: .9rem; }
.print-box figure { margin: 0; display: grid; gap: .5rem; }
.print-box img { border: var(--bw) solid var(--rule); border-radius: var(--r); background: var(--paper); width: 100%; max-width: 360px; }
figcaption { font-size: .9rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
/* boxes inside the coloring app: the share panel and the color-by-number how-to (shown only in that mode) */
.share-panel, .guide { border: var(--bw) solid var(--rule); border-radius: var(--r); background: var(--soft); padding: .9rem 1rem; display: grid; gap: .6rem; }
.share-panel p { font-size: .95rem; }
.guide h2 { font-size: 1.2rem; }
.versions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-weight: 700; }
.versions a, .versions .on { padding: .35rem .9rem; border: var(--bw) solid var(--rule); border-radius: 999px; text-decoration: none; color: var(--ink); min-height: 36px; display: inline-flex; align-items: center; }
.versions .on { background: var(--berry); color: var(--on-berry); }
.answer summary { cursor: pointer; font-weight: 700; color: var(--berry); padding: .4rem 0; }
.answer[open] summary { margin-bottom: .5rem; }
.name-field { display: grid; gap: .3rem; }
.name-field label { font-weight: 700; }
.name-field input { font: 1.05rem/1.2 var(--text); padding: .6rem .8rem; border: var(--bw) solid var(--rule); border-radius: 10px; background: var(--bg); color: var(--ink); max-width: 320px; min-height: 44px; }
.share-blank { display: grid; gap: .4rem; }
.share-it { min-height: 36px; padding: .35rem .9rem; font-size: .9rem; box-shadow: 2px 2px 0 var(--rule); }
.steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .45rem; max-width: 65ch; }
.key { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .45rem .8rem; }
.key li { display: flex; align-items: center; gap: .5rem; }
.key i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--rule); flex: none; display: grid; place-items: center; font: 800 .8rem/1 var(--display); font-style: normal; }
.pair { display: grid; gap: 1.2rem; }
@media (min-width: 620px) { .pair { grid-template-columns: 1fr 1fr; } }
.ad { min-height: 280px; display: grid; place-items: center; }

.foot { border-top: var(--bw) solid var(--rule); margin-top: 2rem; }
.foot .wrap { padding-block: 1.6rem 2.2rem; display: grid; gap: .8rem; }
.foot nav { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.foot a { color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Printing a coloring page: color.js builds .print-sheet (title, the picture as colored so far, site line)
   and only that is printed, on one sheet of A4 or US Letter. */
.print-sheet { display: none; }
@media print {
  @page { margin: 12mm; }
  .top, .foot, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  .detail, .hero { display: block; }
  body.has-sheet > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; text-align: center; }
  .print-sheet h1 { font-size: 18pt; margin: 0 0 5mm; color: #000; }
  .print-sheet svg { display: block; width: 157.5mm; height: 210mm; max-width: 100%; margin: 0 auto; }
  .print-sheet p { font: 9pt/1.4 var(--text); color: #555; margin-top: 4mm; }
  .art .nums { display: none !important; }
}

/* ---------- home page: find first, then reasons to stay ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-find { display: inline-flex; align-items: center; gap: .3rem; }
.nav-find::before { content: ""; width: 14px; height: 14px; border: 2.5px solid currentColor; border-radius: 50%; box-shadow: 4px 4px 0 -2px currentColor; margin-right: 2px; }
.find { background:
  radial-gradient(circle at 8% 20%, color-mix(in srgb, var(--sun) 35%, transparent) 0 70px, transparent 71px),
  radial-gradient(circle at 92% 75%, color-mix(in srgb, var(--berry) 22%, transparent) 0 90px, transparent 91px),
  var(--soft); padding-block: 2.2rem 2.4rem; border-bottom: var(--bw) solid var(--rule); }
.find h1 { max-width: 22ch; }
.search { display: flex; gap: .6rem; max-width: 640px; }
.search input { flex: 1; min-width: 0; font: 600 1.15rem/1.2 var(--text); padding: .85rem 1.1rem; min-height: 54px; border: var(--bw) solid var(--rule);
  border-radius: 999px; background: var(--bg); color: var(--ink); box-shadow: 4px 4px 0 var(--rule); }
.search input:focus { outline: none; box-shadow: 4px 4px 0 var(--berry); border-color: var(--berry); }
.search .btn { border-radius: 999px; padding-inline: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.chip { --tip: var(--berry); position: relative; display: inline-flex; align-items: center; gap: .45rem; font: 700 .98rem/1 var(--display); color: var(--ink);
  background: var(--bg); border: var(--bw) solid var(--rule); border-radius: 6px 999px 999px 6px; padding: .55rem .95rem .55rem 1.5rem; min-height: 42px; cursor: pointer; }
.chip::before { content: ""; position: absolute; left: -2px; top: 50%; width: 14px; height: 70%; transform: translateY(-50%); background: var(--tip);
  border-radius: 2px 0 0 2px; clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.chip span { font: 600 .8rem/1 var(--text); color: var(--muted); }
.chip:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--rule); }
.chip[aria-pressed="true"] { background: var(--tip); color: #17152b; }
.chip[aria-pressed="true"] span { color: #17152b; }
.chip.dice { padding-left: .95rem; border-radius: 999px; background: var(--sun); color: var(--on-sun); }
.chip.dice::before { display: none; }
.results-info { font-size: 1rem; }
.find .grid:not([hidden]) { padding-top: .4rem; }
#results-more { justify-self: start; }

.season { padding-block: 2.2rem; }
.season-head { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.season-head > div { flex: 1; min-width: 200px; }
.sticker { display: grid; place-items: center; text-align: center; width: 92px; height: 92px; border-radius: 50%; background: var(--coral); color: #fff;
  border: var(--bw) solid var(--rule); font: 700 .78rem/1.1 var(--display); transform: rotate(-8deg); box-shadow: 3px 3px 0 var(--rule); padding: .4rem; }
.sticker b { display: block; font-size: 1.9rem; line-height: 1; }

.today { position: relative; background: var(--soft); margin-top: 1rem; }
.wave { position: absolute; top: -39px; left: 0; width: 100%; height: 40px; fill: var(--soft); }
.today-grid { display: grid; gap: 1.6rem; align-items: center; }
@media (min-width: 860px) { .today-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; } }
.kicker { font: 800 .9rem/1 var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--berry); }

.levels { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.level { --lv: var(--sun); display: grid; gap: .3rem; padding: 1.1rem 1.2rem; border: var(--bw) solid var(--rule); border-radius: var(--r); color: var(--ink);
  text-decoration: none; background: linear-gradient(135deg, color-mix(in srgb, var(--lv) 55%, var(--bg)) 0 38%, var(--bg) 38%); box-shadow: 4px 4px 0 var(--rule); }
.level b { font: 800 1.4rem/1.1 var(--display); }
.level small { color: var(--muted); font-weight: 600; }
.level:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--rule); }

.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.tile { display: grid; gap: .35rem; color: var(--ink); text-decoration: none; }
.fan { position: relative; display: block; aspect-ratio: 4 / 3; }
.fan img { position: absolute; bottom: 0; width: 46%; aspect-ratio: 3 / 4; object-fit: cover; border: var(--bw) solid var(--rule); border-radius: 10px; background: var(--paper);
  transition: transform .2s; }
.fan img:nth-child(1) { left: 27%; z-index: 3; }
.fan img:nth-child(2) { left: 6%; transform: rotate(-9deg); z-index: 2; }
.fan img:nth-child(3) { left: 48%; transform: rotate(9deg); z-index: 1; }
.tile:hover .fan img:nth-child(2) { transform: rotate(-14deg) translateX(-6px); }
.tile:hover .fan img:nth-child(3) { transform: rotate(14deg) translateX(6px); }
.tile b { font: 800 1.1rem/1.2 var(--display); }
.tile small { color: var(--muted); }

.how { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: how; }
.how li { counter-increment: how; display: grid; gap: .25rem; padding: 1rem 1.1rem 1rem 3.6rem; position: relative; border: var(--bw) dashed var(--rule); border-radius: var(--r); }
.how li::before { content: counter(how); position: absolute; left: 1rem; top: 1rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--berry); color: var(--on-berry); font: 800 1rem/1 var(--display); }
.how b { font: 800 1.1rem/1.2 var(--display); }
.how span { color: var(--muted); font-size: .95rem; }

.card { position: relative; }
.meter { position: absolute; top: 8px; right: 8px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--mint) var(--pct), var(--bg) 0); border: var(--bw) solid var(--rule); }
.meter span { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font: 800 .7rem/1 var(--display); font-style: normal; color: var(--ink); }
@media (max-width: 560px) { .search .btn { padding-inline: 1rem; } .sticker { width: 76px; height: 76px; } .sticker b { font-size: 1.5rem; } }
