/* ---------- Tokens ----------
   Soft colored-pencil palettes around the kitty in the frog hood: light paper,
   a two-color gingham, pastel buttons with dark lettering and a light menu.
   Blue is the site's own; green and pink are picked in Settings (kept in
   localStorage as froggy-theme) and set as data-theme on <html>. */

:root {
  /* blue: pond water and sky */
  --paper: #f2f8fd;
  --paper-deep: #e0eef8;
  --plate: #fbfdff;
  --card: #ffffff;
  --ink: #2a3f55;
  --ink-soft: #5b6f83;
  --line: rgba(42, 63, 85, .13);
  --shade: 42, 63, 85;           /* shadows, as r, g, b */

  --peach: #9fd0f0;              /* decoration */
  --peach-text: #3f86c4;         /* large accent type */
  --rust: #3a7bb5;               /* small accent text and outlines */
  --sage: #dcf2cf;               /* bands */
  --pink: #ffd3dd;
  --butter: #fff0a6;

  --btn: #9ccdf1;                /* pastel buttons, START */
  --btn-top: #bbdcf6;
  --btn-edge: #649fcd;
  --btn-ink: #1d3550;

  --menu: #d9eaf8;               /* the menu and the phone tab bar */
  --menu-ink: #2a3f55;
  --menu-soft: #5b6f83;
  --menu-hover: rgba(42, 63, 85, .07);
  --menu-current: rgba(255, 255, 255, .7);

  --ging-bg: #f8fcff;
  --ging-a: rgba(140, 195, 240, .32);
  --ging-b: rgba(255, 232, 140, .45);
  --ging-bg-soft: #f6fbff;
  --ging-a-soft: rgba(140, 195, 240, .17);
  --ging-b-soft: rgba(255, 232, 140, .26);
  --scrim: rgba(25, 40, 60, .35);
  --glow: rgba(159, 208, 240, .55);

  --font-display: "Sniglet", "Nunito", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --radius: 18px;
  --panel-radius: clamp(22px, 3.5vw, 40px);
  --shadow-sm: 0 1px 2px rgba(var(--shade), .06), 0 6px 16px -8px rgba(var(--shade), .18);
  --shadow-lg: 0 2px 4px rgba(var(--shade), .06), 0 24px 48px -20px rgba(var(--shade), .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.3, 1.5, .5, 1);
  color-scheme: light;
}

/* green: lily pads and sunshine */
:root[data-theme="green"] {
  --paper: #f6fbef;  --paper-deep: #e6f3d8;  --plate: #fcfef9;
  --ink: #2b4434;  --ink-soft: #5d7563;  --line: rgba(43, 68, 52, .13);  --shade: 43, 68, 52;
  --peach: #a8dc8f;  --peach-text: #4c9a5c;  --rust: #3f8a50;  --sage: #d7eefa;
  --btn: #9dd8a8;  --btn-top: #b9e6c1;  --btn-edge: #66b076;  --btn-ink: #1f3a28;
  --menu: #ddf0d0;  --menu-ink: #2b4434;  --menu-soft: #5d7563;  --menu-hover: rgba(43, 68, 52, .07);
  --ging-bg: #fbfff4;  --ging-a: rgba(160, 215, 130, .34);  --ging-b: rgba(255, 232, 140, .45);
  --ging-bg-soft: #f9fdf3;  --ging-a-soft: rgba(160, 215, 130, .18);  --ging-b-soft: rgba(255, 232, 140, .26);
  --scrim: rgba(30, 50, 35, .35);  --glow: rgba(168, 220, 143, .5);
}

/* pink: strawberry milk and mint */
:root[data-theme="pink"] {
  --paper: #fdf4f7;  --paper-deep: #f7e1e9;  --plate: #fffbfc;
  --ink: #4a2e3a;  --ink-soft: #7a5b67;  --line: rgba(74, 46, 58, .13);  --shade: 74, 46, 58;
  --peach: #f4a9c0;  --peach-text: #c25479;  --rust: #b24f6e;  --sage: #d6f0d4;  --pink: #ffc9d8;
  --btn: #f6aac2;  --btn-top: #f9c6d6;  --btn-edge: #d67c9b;  --btn-ink: #4a1f30;
  --menu: #fbdfe8;  --menu-ink: #4a2e3a;  --menu-soft: #7a5b67;  --menu-hover: rgba(74, 46, 58, .07);
  --ging-bg: #fffafc;  --ging-a: rgba(245, 165, 192, .3);  --ging-b: rgba(175, 222, 175, .32);
  --ging-bg-soft: #fffafc;  --ging-a-soft: rgba(245, 165, 192, .16);  --ging-b-soft: rgba(175, 222, 175, .18);
  --scrim: rgba(60, 30, 42, .35);  --glow: rgba(244, 169, 192, .55);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--pink); color: var(--ink); }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.12;
  text-wrap: balance;
}
h2 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
svg { flex: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

.hand {
  display: inline-block;
  margin: 0;
  font: 700 1.6rem/1 var(--font-hand);
  color: var(--rust);
  rotate: -2deg;
}

.icon { width: 1.15em; height: 1.15em; }

.skip {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}
.skip:focus { top: 12px; }

/* a pink-and-butter gingham, woven from two sets of see-through stripes */
.gingham {
  background-color: var(--ging-bg);
  background-image:
    linear-gradient(90deg, var(--ging-a) 50%, transparent 0),
    linear-gradient(var(--ging-b) 50%, transparent 0);
  background-size: 30px 30px;
}

.plate {
  border-radius: var(--radius);
  background: var(--plate);
  box-shadow: var(--shadow-sm);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  padding: .85em 1.45em;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 700 .98rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgba(var(--shade), .5); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { border-color: var(--btn-edge); background: var(--btn); color: var(--btn-ink); }
.btn-small { padding: .6em 1.1em; font-size: .92rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.header-row {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 28px);
  height: 72px;
}

.logo {
  display: inline-flex;
  align-items: flex-end;
  gap: .4rem;
  color: var(--peach-text);
  font: 400 clamp(1.35rem, 3.4vw, 1.75rem)/1 var(--font-display);
  text-decoration: none;
  white-space: nowrap;
}
.logo-mark { width: 30px; height: 30px; margin-bottom: .04em; transform-origin: 50% 100%; }
.logo:hover .logo-mark { animation: sway .9s var(--ease); }
@keyframes sway { 30% { rotate: -9deg; } 65% { rotate: 6deg; } }

.nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); margin-left: auto; }
.nav a:not(.btn) {
  position: relative;
  color: var(--ink-soft);
  font-weight: 700;
  text-decoration: none;
}
.nav a:not(.btn):hover { color: var(--rust); }
.nav a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: var(--peach);
  scale: 0 1;
  transform-origin: left;
  transition: scale .3s var(--ease);
}
.nav a:not(.btn):hover::after { scale: 1 1; }

@media (max-width: 900px) { .nav a:not(.btn) { display: none; } }
@media (max-width: 520px) { .nav .btn { display: none; } }
/* sign in, unlock or account: on every screen */
.nav .club-btn { display: inline-flex; flex-shrink: 0; gap: .45em; }
.club-btn .icon { width: 1.1em; height: 1.1em; }
/* on a phone, just the little person */
@media (max-width: 520px) {
  .nav .club-btn { width: 40px; height: 40px; padding: 0; }
  .club-btn .club-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------- Hero ---------- */

.hero { padding-block: clamp(10px, 2vw, 22px) clamp(36px, 5vw, 64px); }

.hero-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: clamp(560px, 76vh, 740px);
  padding: clamp(18px, 4vw, 56px);
  border-radius: var(--panel-radius);
}

/* the plate in the middle, with START on it */
.hero-text {
  position: relative;
  z-index: 2;
  width: min(100%, 620px);
  padding: clamp(28px, 4.5vw, 52px) clamp(22px, 4vw, 52px) clamp(40px, 5vw, 60px);
  text-align: center;
}
.hero-kicker { margin-bottom: .9rem; }

.hero h1 { font-size: clamp(2.3rem, 4.8vw, 3.9rem); }
.hero h1 .name {
  position: relative;
  z-index: 0;
  color: var(--peach-text);
  white-space: nowrap;
}
.name-underline {
  position: absolute;
  z-index: -1;
  left: -3%;
  bottom: -.02em;
  width: 106%;
  height: .28em;
  overflow: visible;
}
.name-underline path {
  fill: none;
  stroke: var(--pink);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
  animation: draw 1s .45s var(--ease) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.lede {
  max-width: 34ch;
  margin: 1.1rem auto 2.1rem;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.5vw, 1.22rem);
}

/* START: big and crisp, with a pastel rainbow ring turning around it and the
   same rainbow glowing behind, breathing gently, and a shine running across
   now and then, so it's the first thing a child sees */
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.start {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  border-radius: 999px;
  color: var(--btn-ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  animation: breathe 2.4s ease-in-out infinite;
}
.start::before,
.start::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  background: conic-gradient(from var(--spin), #f2899a, #fbb36b, #fbe29a, #a7d17f, #8fcdea, #a98bdf, #f2899a);
  animation: spin 4s linear infinite;
}
.start::before { z-index: -1; }
.start::after { z-index: -2; filter: blur(18px); animation: spin 4s linear infinite, glow 2.4s ease-in-out infinite; }
.start-face {
  position: relative;
  display: flex;
  align-items: center;
  gap: .42em;
  overflow: hidden;
  padding: .3em 1em .32em .55em;
  border-radius: 999px;
  background: linear-gradient(var(--btn-top), var(--btn));
  font: 400 clamp(2.2rem, 5.4vw, 3.5rem)/1 var(--font-display);
  letter-spacing: .06em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), inset 0 -3px 0 var(--btn-edge);
  transition: transform .2s var(--spring);
}
.start-play {
  display: grid;
  place-items: center;
  width: .86em;
  height: .86em;
  border-radius: 50%;
  background: #fff;
}
.start-play::before {
  content: "";
  margin-left: .07em;
  border-left: .3em solid var(--btn-edge);
  border-top: .19em solid transparent;
  border-bottom: .19em solid transparent;
}
.start-face::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg);
  animation: shine 3.6s ease-in-out infinite;
}
.start:hover .start-face { transform: translateY(-2px); }
.start:active .start-face { transform: scale(.96); }
.start:focus-visible { outline: none; }
.start:focus-visible .start-face { outline: 4px solid var(--ink); outline-offset: 10px; }

.start-spark { position: absolute; fill: #ffd54f; pointer-events: none; animation: twinkle 1.6s ease-in-out infinite; }
.start-spark.s1 { width: 28px; height: 28px; top: -26px; right: -18px; }
.start-spark.s2 { width: 20px; height: 20px; bottom: -18px; left: -22px; fill: #f2899a; animation-delay: -.6s; }
.start-spark.s3 { width: 15px; height: 15px; top: -22px; left: 22%; fill: #8fcdea; animation-delay: -1.1s; }

@keyframes breathe { 50% { scale: 1.04; } }
@keyframes spin { to { --spin: 360deg; } }
@keyframes glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes shine { 0%, 55% { left: -70%; } 85%, 100% { left: 130%; } }

/* colored-in pages taped on around the plate, one in each corner */
.hero-art { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.card {
  position: absolute;
  width: clamp(170px, 21vw, 270px);
  margin: 0;
  padding: 10px 10px 40px;
  border-radius: 5px;
  background: var(--card);
  box-shadow: 0 2px 4px rgba(var(--shade), .1), 0 22px 40px -16px rgba(var(--shade), .45);
  text-decoration: none;
  pointer-events: auto;
  transition: transform .5s var(--spring);
  animation: bob 7s ease-in-out infinite;
}
.card::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 1;
  width: 84px;
  height: 25px;
  translate: -50% 0;
  rotate: -5deg;
  background: color-mix(in srgb, var(--butter) 80%, transparent);
  box-shadow: 0 1px 2px rgba(var(--shade), .08);
}
.card-1 { left: 2.5%; top: 6%; rotate: -8deg; animation-delay: -1s; }
.card-2 { right: 2.5%; top: 5%; rotate: 7deg; animation-delay: -3.5s; }
.card-3 { left: 3.5%; bottom: 6%; rotate: 5deg; animation-delay: -5.5s; }
.card-4 { right: 3.5%; bottom: 7%; rotate: -5deg; animation-delay: -2.2s; }
.card-2::before { background: color-mix(in srgb, var(--sage) 90%, transparent); rotate: 4deg; }
.card-3::before { background: color-mix(in srgb, var(--pink) 85%, transparent); rotate: 3deg; }
.card-4::before { background: color-mix(in srgb, var(--butter) 80%, transparent); }
.card:hover { transform: translateY(-6px) scale(1.04); }
/* each page starts as a blank coloring page; then a crayon runs across it and
   the colors come in behind it, one page after another, over and over */
.card-pic { position: relative; display: block; overflow: hidden; border-radius: 3px; }
.card-pic img { width: 100%; aspect-ratio: 4 / 3; background: #fff; }
.card-color {
  position: absolute;
  inset: 0;
  -webkit-mask: linear-gradient(100deg, #000 40%, transparent 60%) 0 0 / 250% 100% no-repeat;
  mask: linear-gradient(100deg, #000 40%, transparent 60%) 0 0 / 250% 100% no-repeat;
  animation: color-in 9s ease-in-out both infinite;
  animation-delay: var(--at);
}
.card-crayon {
  position: absolute;
  left: 125%;
  top: 40%;
  width: 34px;
  height: 42px;
  opacity: 0;
  filter: drop-shadow(0 2px 2px rgba(var(--shade), .3));
  animation: crayon-across 9s ease-in-out both infinite, scribble .32s ease-in-out infinite alternate;
  animation-delay: var(--at), 0s;
}
.card-1 { --at: .5s; }
.card-2 { --at: 2.7s; }
.card-4 { --at: 4.9s; }
.card-3 { --at: 7.1s; }
@keyframes color-in {
  0%, 12% { -webkit-mask-position: 100% 0; mask-position: 100% 0; opacity: 1; }
  34%, 86% { -webkit-mask-position: 0 0; mask-position: 0 0; opacity: 1; }
  96% { -webkit-mask-position: 0 0; mask-position: 0 0; opacity: 0; }
  100% { -webkit-mask-position: 100% 0; mask-position: 100% 0; opacity: 0; }
}
@keyframes crayon-across {
  0%, 12% { left: -25%; opacity: 0; }
  14%, 31% { opacity: 1; }
  34%, 100% { left: 105%; opacity: 0; }
}
@keyframes scribble { from { translate: 0 -28px; rotate: -8deg; } to { translate: 0 28px; rotate: 8deg; } }
.card-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  color: var(--ink);
  font: 700 1.45rem/1 var(--font-hand);
  text-align: center;
  rotate: -2deg;
}

@keyframes bob { 50% { translate: 0 -8px; } }

.doodle { position: absolute; fill: var(--peach); pointer-events: none; animation: twinkle 4.5s ease-in-out infinite; }
.hero-panel .d1 { width: 26px; height: 26px; top: 22px; left: 31%; }
.hero-panel .d2 { width: 18px; height: 18px; bottom: 24px; left: 64%; fill: #f2899a; animation-delay: -2s; }
@keyframes twinkle { 50% { scale: .7; rotate: 45deg; } }

/* narrower screens: the plate on top, two of the pages in a row under it */
@media (max-width: 900px) {
  .hero-panel { display: flex; flex-direction: column; align-items: center; min-height: 0; }
  .hero-art { position: relative; inset: auto; display: flex; justify-content: center; gap: 4%; width: 100%; margin-top: 26px; }
  .card { position: relative; inset: auto; width: min(44%, 240px); }
  .card-3, .card-4 { display: none; }
  .hero-panel .d1 { display: none; }
}

/* ---------- Why us ----------
   Laid out the way porkbun.com opens: the big claim, a line of what's inside,
   the star ratings, then the selling points in a row of cards. */

.why { padding-block: clamp(8px, 2vw, 24px) clamp(48px, 7vw, 96px); }
.why h2 { max-width: 20ch; font-size: clamp(2.1rem, 5vw, 3.6rem); }
.why-sub {
  max-width: 52ch;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.08rem, 1.6vw, 1.3rem);
}
.why-sub b { color: var(--ink); font-weight: 800; }

.rating-row { display: flex; flex-wrap: wrap; gap: 22px clamp(36px, 6vw, 72px); margin-top: clamp(26px, 3.5vw, 40px); }
.rating {
  --star: clamp(20px, 5.6vw, 26px);
  --gap: calc(var(--star) * .12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  margin: 0;
}
.rating p { margin: 0; }
.rating .score { font: 800 clamp(1.15rem, 2vw, 1.45rem)/1 var(--font-body); }
.rating .who { font: 400 1.25rem/1 var(--font-display); color: color-mix(in srgb, var(--colour) 60%, var(--ink)); }
.rating .from { font-size: .85rem; color: var(--ink-soft); }

.stars { position: relative; display: block; line-height: 0; }
.stars-back, .stars-front { display: flex; gap: var(--gap); }
.stars-back { color: var(--line); }
/* only as wide as the score: whole stars, then part of the next one */
.stars-front {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  width: calc(var(--whole) * (var(--star) + var(--gap)) + var(--part) * var(--star));
  color: var(--colour);
}
.stars svg { width: var(--star); height: var(--star); }
.stars path { fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }

.points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 2vw, 24px);
  margin: clamp(40px, 6vw, 72px) 0 0;
  padding: 0;
  list-style: none;
}
.point {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: clamp(22px, 2.6vw, 30px);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.point p { margin: 0; color: var(--ink-soft); }
.point-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: .4rem;
  border-radius: 50%;
  background: var(--butter);
  color: var(--rust);
  fill: var(--rust);
}
.point:nth-child(3n + 2) .point-icon { background: var(--pink); }
.point:nth-child(3n) .point-icon { background: var(--sage); }
.point-icon svg { width: 28px; height: 28px; }

@media (max-width: 900px) { .points { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .points { grid-template-columns: 1fr; } }

/* ---------- Ticker ---------- */

.ticker-wrap { overflow-x: clip; padding-block: 14px; }

.ticker {
  margin-inline: -24px;
  padding: 14px 0;
  overflow: hidden;
  background: var(--sage);
  color: var(--ink);
  rotate: -1deg;
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: marquee 44s linear infinite;
  font: 400 clamp(1.2rem, 2.2vw, 1.65rem)/1.1 var(--font-display);
}
.ticker-track span { display: flex; align-items: center; gap: 1.5rem; padding-right: 1.5rem; white-space: nowrap; }
.ticker-track svg { width: .65em; height: .65em; fill: var(--peach); }
.ticker-track svg:nth-of-type(2n) { fill: #f2899a; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */

.section { padding-block: clamp(64px, 9vw, 120px); }
.section + .section { padding-top: 0; }

.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .45rem;
  margin-bottom: clamp(26px, 4vw, 48px);
}

/* ---------- The pictures ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }

.chip {
  padding: .6em 1.1em;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--plate);
  color: var(--ink-soft);
  font: 700 .93rem/1 var(--font-body);
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--peach); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: clamp(16px, 2.2vw, 28px);
}

.pic { position: relative; }
.pic[hidden] { display: none; }
.pic-link {
  display: block;
  padding: 10px 10px 0;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.pic:nth-child(3n + 1) .pic-link { rotate: -.6deg; }
.pic:nth-child(3n + 2) .pic-link { rotate: .5deg; }
.pic-link:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: var(--shadow-lg); }
.pic-sheet {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  /* a faint edge, like a sheet of paper */
  box-shadow: inset 0 0 0 1px var(--line);
}
.pic-sheet img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* the drawing lies over what's been colored, its white letting the color through */
.pic-lines { mix-blend-mode: multiply; }
.pic-paint[hidden] { display: none; }
.pic-name {
  display: flex;
  align-items: center;
  gap: .5em;
  padding: .7rem .3rem .8rem;
  font: 400 1.3rem/1.1 var(--font-display);
}
.pic-name .started {
  margin-left: auto;
  color: var(--rust);
  font: 700 1.2rem/1 var(--font-hand);
}

/* a members' picture, for someone who isn't one: a faded preview and a padlock */
.locked .pic-link { width: 100%; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.locked .pic-lines { opacity: .55; }
.pic-lock {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--butter);
  color: var(--rust);
  box-shadow: var(--shadow-sm);
  transition: transform .4s var(--spring);
}
.pic-lock svg { width: 22px; height: 22px; }
.locked .pic-link:hover .pic-lock { transform: rotate(-12deg) scale(1.08); }

/* make your own, from a photo: first in the grid */
.pic-make {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 230px;
  padding: 20px;
  border: 2.5px dashed var(--peach);
  border-radius: 14px;
  background: color-mix(in srgb, var(--plate) 70%, transparent);
  color: var(--ink);
  cursor: pointer;
  transition: transform .4s var(--ease), background-color .3s, border-color .3s;
}
.pic-make:hover { transform: translateY(-4px) rotate(.6deg); background: var(--plate); border-color: var(--rust); }
.pic-make-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--pink);
  color: var(--rust);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--pink) 35%, transparent);
}
.pic-make-icon svg { width: 38px; height: 38px; }
.pic-make-name { font: 400 1.45rem/1.1 var(--font-display); }
.pic-remove {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 252, .92);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.pic-remove:hover { color: var(--ink); background: #fff; }
.pic-remove svg { width: 16px; height: 16px; }

/* the photo maker */
.maker-sheet {
  position: relative;
  margin: 0 auto 1.1rem;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  rotate: -1deg;
}
.maker-sheet canvas { display: block; width: 100%; max-height: 46dvh; object-fit: contain; aspect-ratio: 4 / 3; }
.maker-wait {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  margin: 0;
  background: rgba(255, 255, 255, .75);
  rotate: 0deg;
  font-size: 1.8rem;
}
.maker-sheet.working .maker-wait { display: grid; }
.maker-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto 1.3rem;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: .92rem;
}
.maker-detail span { white-space: nowrap; }
.maker-detail input { flex: 1; min-width: 0; accent-color: var(--rust); }
.maker-note { margin: 1rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

.noscript { padding: 24px; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; }

/* ---------- For grown-ups ---------- */

.grown-ups-card {
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: clamp(20px, 4vw, 56px);
  padding: clamp(28px, 5vw, 64px);
}
.grown-ups-card h2 { margin-top: .55rem; }
.notes { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: 1.08rem; }
.notes li { position: relative; padding-left: 30px; }
.notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .38em;
  width: 16px;
  height: 16px;
  background: var(--peach);
  clip-path: path("M8 0C8.7 4.8 11.2 7.3 16 8 11.2 8.7 8.7 11.2 8 16 7.3 11.2 4.8 8.7 0 8 4.8 7.3 7.3 4.8 8 0Z");
}
.notes li:nth-child(2n)::before { background: #f2899a; }
.notes b { color: var(--ink); }

@media (max-width: 760px) { .grown-ups-card { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */

.site-footer { padding-block: 0 40px; color: var(--ink-soft); font-size: .93rem; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-row p { margin: 0; }
.logo-small { font-size: 1.3rem; }
.made { margin: 28px auto 0; text-align: center; font-size: .8rem; opacity: .7; }
.made a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
.made a:hover { color: var(--rust); text-decoration-color: currentColor; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .name-underline path { stroke-dashoffset: 0; }
  .card-crayon { display: none; }
}

/* ==================== The coloring page ==================== */

/* Laid out like chess.com: the menu down the left, the page filling the
   middle as soon as the site opens, ready to color, and a panel on the right
   with the pictures to pick from. Below that first screen, how it works and
   the note for grown-ups, for whoever scrolls on. */

.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
/* while coloring, one screen and nothing to scroll, so a stray swipe can't carry the page away */
html:has(body.playing), body.playing { overflow: hidden; overscroll-behavior: none; }
.home[hidden], .board[hidden] { display: none; }

/* the menu: chocolate, with little colored drawings for icons */
.side {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100vh;
  height: 100dvh;
  padding: 14px 10px 16px;
  overflow-y: auto;
  background: var(--menu);
  color: var(--menu-ink);
}
.side-title { margin: 0; font-size: inherit; }
.side-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
  color: var(--menu-ink);
  font: 400 1.18rem/1.05 var(--font-display);
  text-decoration: none;
}
.side-logo .logo-mark { width: 42px; height: 42px; flex: none; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: 800 1.02rem/1.1 var(--font-body);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s;
}
.side-item:hover { background: var(--menu-hover); }
.side-item[aria-current] { background: var(--menu-current); box-shadow: var(--shadow-sm); }
.side-ico { flex: none; width: 32px; height: 32px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .3)); transition: transform .3s var(--spring); }
.side-item:hover .side-ico { transform: rotate(-8deg) scale(1.1); }
.side-club { margin-top: auto; }
.side-promise {
  margin: auto 4px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--menu-current);
  color: var(--menu-soft);
  font-size: .82rem;
  line-height: 1.45;
}
.side-promise b { color: var(--menu-ink); }
.side-made { margin: 10px 4px 0; color: var(--menu-soft); font-size: .74rem; text-align: center; }
.side-made a { color: inherit; text-underline-offset: 3px; }
.side-made a:hover { color: var(--menu-ink); }
.side :focus-visible { outline-color: #ffd54f; }

/* the first screen: the page, and the pictures beside it */
.main { min-width: 0; }
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(270px, 22vw, 330px);
  gap: 12px;
  height: 100vh;
  height: 100dvh;
  padding-right: 14px;
  background-color: var(--ging-bg-soft);
  background-image:
    linear-gradient(90deg, var(--ging-a-soft) 50%, transparent 0),
    linear-gradient(var(--ging-b-soft) 50%, transparent 0);
  background-size: 34px 34px;
}

.studio {
  --c: #1e63c8;          /* the color in hand */
  --swatch: clamp(24px, min(4.4vh, 2.6vw), 40px);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "stage kit" "next kit";
  padding-left: 10px;
  min-width: 0;
  min-height: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

.studio-top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 6px 2px 20px;
}
.studio-title {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(1.3rem, 2.3vw, 2rem);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.studio-title .hand { margin-right: .1em; font-size: .9em; }
.history { display: flex; gap: 10px; margin-left: auto; }
.finish-top { display: none; }

/* the panel on the right: what to color next, and the big button to finish */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--plate);
  box-shadow: var(--shadow-lg);
}
.panel.flash { animation: flash .9s var(--ease); }
@keyframes flash { 30% { box-shadow: 0 0 0 6px var(--pink), var(--shadow-lg); } }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 16px 18px 8px; }
.panel-head h2 { font-size: 1.75rem; }
.panel .panel-close { display: none; }
.panel .picker { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.panel .filters { gap: 6px; margin: 0; padding: 4px 16px 10px; }
.panel .chip { padding: .5em .85em; font-size: .82rem; }
.panel .grid {
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 4px 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.panel .pic-link { padding: 6px 6px 0; border-radius: 10px; rotate: 0deg; }
.panel .pic:nth-child(n) .pic-link { rotate: 0deg; }
.panel .pic-link:hover { transform: translateY(-2px); }
.panel .pic.current .pic-link { box-shadow: 0 0 0 3px var(--rust), var(--shadow-sm); }
.panel .pic-name { padding: .4rem .2rem .5rem; font-size: .98rem; }
.panel .pic-name .started { font-size: .95rem; }
.panel .pic-remove { top: 10px; right: 10px; width: 26px; height: 26px; }
.panel .pic-remove svg { width: 13px; height: 13px; }
.panel .pic-make {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon name" "icon hand";
  justify-items: start;
  align-items: center;
  gap: 0 14px;
  min-height: 76px;
  padding: 12px 14px;
  text-align: left;
}
.panel .pic-make-icon { grid-area: icon; width: 48px; height: 48px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--pink) 35%, transparent); }
.panel .pic-make-icon svg { width: 26px; height: 26px; }
.panel .pic-make-name { grid-area: name; font-size: 1.2rem; }
.panel .pic-make .hand { grid-area: hand; font-size: 1.15rem; }
.panel-foot { padding: 12px 14px 16px; border-top: 1px solid var(--line); }

/* ---------- Settings: the colors to color in ---------- */

.settings-card h2 { margin: .3rem 0 1.2rem; }
.set-label { margin: 0 0 .7rem; font: 800 .82rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.theme-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 8px 10px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font: 400 1rem/1.1 var(--font-display);
  cursor: pointer;
  transition: transform .25s var(--spring), border-color .2s;
}
.theme-pick:hover { transform: translateY(-3px); }
.theme-pick[aria-checked="true"] { border-color: var(--rust); box-shadow: 0 0 0 3px var(--glow); }
/* each one shows its own colors whatever the page is in: the menu down the
   side, the gingham, and a button */
.theme-swatch {
  position: relative;
  display: block;
  height: 84px;
  overflow: hidden;
  border-radius: 10px;
  background:
    linear-gradient(90deg, var(--ga) 50%, transparent 0) 0 0 / 18px 18px,
    linear-gradient(var(--gb) 50%, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.theme-swatch::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 22%; background: var(--mn); }
.theme-swatch::after {
  content: "";
  position: absolute;
  right: 12%;
  bottom: 18%;
  width: 48%;
  height: 24%;
  border-radius: 999px;
  background: var(--bt);
  box-shadow: inset 0 -3px 0 var(--ed);
}
.theme-pick[aria-checked="true"]::after {
  content: "";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rust) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  box-shadow: 0 0 0 3px var(--plate);
}

/* a chunky button, like chess.com's big green Play */
/* the note for grown-ups, in its pop-up */
.info .notes { margin: 1rem 0 0; text-align: left; }
.info-made { margin: 1.4rem 0 0; color: var(--ink-soft); font-size: .82rem; opacity: .8; }
.info-made a { color: inherit; text-underline-offset: 3px; }

.chunky {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  width: 100%;
  padding: .62em 1em .68em;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(var(--btn-top), var(--btn));
  color: var(--btn-ink);
  font: 400 1.55rem/1 var(--font-display);
  box-shadow: 0 5px 0 var(--btn-edge), 0 12px 20px -8px rgba(var(--shade), .5);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.chunky:hover { filter: brightness(1.07); }
.chunky:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-edge); }
.chunky .icon { width: .9em; height: .9em; }

.tabbar { display: none; }
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.scrim[hidden] { display: none; }

.round {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 0 4px rgba(255, 255, 252, .6), var(--shadow-sm);
  cursor: pointer;
  transition: transform .2s var(--spring), opacity .2s;
}
.round svg { width: 24px; height: 24px; }
.round:hover:not(:disabled) { transform: scale(1.07); }
.round:active:not(:disabled) { transform: scale(.94); }
.round:disabled { opacity: .4; cursor: default; }

.finish { padding: .8em 1.4em; font-size: 1.05rem; box-shadow: 0 0 0 4px rgba(255, 255, 252, .6); }

/* the page, as big as fits, at the drawing's 4:3 */
.stage {
  grid-area: stage;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 8px;
  container-type: size;
}
.page {
  position: relative;
  width: min(100cqw, 100cqh * 4 / 3);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(var(--shade), .08), 0 20px 50px -18px rgba(var(--shade), .4);
  isolation: isolate;
  touch-action: none;
  cursor: crosshair;
}
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.page canvas:last-of-type { pointer-events: none; }
.page.brush { cursor: none; }
.page.loading canvas { visibility: hidden; }

/* where a mouse is about to paint, as big as the brush */
.ring {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  border: 2px solid rgba(var(--shade), .6);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .8), inset 0 0 0 1.5px rgba(255, 255, 255, .8);
  pointer-events: none;
}
.ring[hidden] { display: none; }

.page-wait {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  rotate: 0deg;
  font-size: 2rem;
}
.page.loading .page-wait { display: grid; }

/* the brush size: a tapering track with a dot of the color, as big as the brush */
.size {
  --v: .4;
  grid-area: size;
  position: relative;
  justify-self: center;
  align-self: center;
  width: 56px;
  height: min(300px, 56%);
  cursor: pointer;
  touch-action: none;
  /* on the whole slider, since the track's own outline would be clipped off with it */
  filter: drop-shadow(0 0 1px rgba(var(--shade), .45)) drop-shadow(0 2px 3px rgba(var(--shade), .18));
}
.size-track {
  position: absolute;
  inset: 0 6px;
  border-radius: 28px;
  background: var(--card);
  clip-path: polygon(0 0, 100% 0, 64% 100%, 36% 100%);
}
.size-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--paper-deep), transparent);
  opacity: .5;
}
.size-knob {
  --d: calc(16px + var(--v) * 26px);
  position: absolute;
  left: 50%;
  top: calc(21px + (1 - var(--v)) * (100% - 42px));
  width: var(--d);
  height: var(--d);
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px #fff, 0 2px 6px 2px rgba(var(--shade), .3);
  pointer-events: none;
}
.size:focus-visible { outline: none; }
.size:focus-visible .size-knob { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--rust); }

/* the colors: a row under the page */
.colors {
  grid-area: colors;
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px 0;
}
.swatch {
  position: relative;
  width: var(--swatch);
  height: var(--swatch);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--s);
  box-shadow: inset 0 0 0 1px rgba(var(--shade), .18), 0 2px 4px rgba(var(--shade), .18);
  cursor: pointer;
  transition: transform .25s var(--spring), box-shadow .2s;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked="true"] {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--s), 0 4px 10px rgba(var(--shade), .3);
}
.swatch[data-light][aria-checked="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink-soft), 0 4px 10px rgba(var(--shade), .3); }
/* any color at all, from a wheel */
.wheel {
  --s: #fff;
  background: conic-gradient(#e53935, #fb8c00, #fdd835, #7cb342, #4fc3f7, #1e63c8, #8e44ad, #f48fb1, #e53935);
  overflow: hidden;
}
.wheel::after {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: var(--s);
  box-shadow: 0 0 0 2px #fff;
}
.wheel[aria-checked="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink-soft), 0 4px 10px rgba(var(--shade), .3); }
.wheel input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* the tools stand along the bottom; the one in hand comes up */
.tools {
  grid-area: tools;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(0px, 1.2vw, 14px);
  height: 112px;
  overflow: hidden;
  padding: 0 12px;
}
.tool {
  position: relative;
  flex: none;
  width: 58px;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tool svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  overflow: visible;
  transform: translateY(54px);
  transition: transform .35s var(--spring);
  filter: drop-shadow(0 3px 2px rgba(var(--shade), .22));
}
.tool:hover svg { transform: translateY(44px); }
.tool[aria-checked="true"] svg { transform: translateY(8px); }
.tool:focus-visible { outline: none; }
.tool:focus-visible svg { filter: drop-shadow(0 0 0 var(--rust)) drop-shadow(0 0 3px var(--rust)); }

/* what to color next, in a row under the page */
.next {
  grid-area: next;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 10px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.next::-webkit-scrollbar { display: none; }
/* fading out at the end, so a cut-off picture reads as more to scroll to */
.next { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.next-label { flex: none; margin-right: 2px; font-size: 1.35rem; }
.next-pic {
  position: relative;
  flex: none;
  width: clamp(78px, 7.5vw, 112px);
  padding: 4px 4px 0;
  border: 0;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform .3s var(--spring), box-shadow .3s;
}
.next-pic:hover { transform: translateY(-3px) rotate(-1.5deg); box-shadow: var(--shadow-lg); }
.next-pic img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.next-pic.locked img { opacity: .55; }
.next-pic span { display: block; padding: 3px 2px 5px; overflow: hidden; font: 400 .82rem/1.1 var(--font-display); white-space: nowrap; text-overflow: ellipsis; }
.next-lock {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  translate: -50% -80%;
  border-radius: 50%;
  background: var(--butter);
  color: var(--rust);
  box-shadow: var(--shadow-sm);
}
.next-lock svg { width: 15px; height: 15px; }

/* the colors and tools, in a tray to the right of the page */
@media (min-width: 641px) {
  .kit {
    --th: 38px;            /* how thick a tool is, lying down */
    grid-area: kit;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 4px 12px 2px;
    padding: 14px 10px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 252, .72);
    box-shadow: var(--shadow-sm);
  }
  .kit .colors {
    display: grid;
    grid-template-columns: repeat(4, var(--swatch));
    justify-content: center;
    gap: 9px;
    padding: 4px;
  }
  /* the brush size, lying across the tray between the colors and the tools */
  .kit .size { width: 100%; height: 40px; margin: -4px 0; }
  .kit .size-track { inset: 6px 0; clip-path: polygon(0 36%, 100% 0, 100% 100%, 0 64%); }
  .kit .size-track::after { background: linear-gradient(90deg, transparent, var(--paper-deep)); }
  .kit .size-knob { left: calc(21px + var(--v) * (100% - 42px)); top: 50%; }
  .kit .tools {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    height: auto;
    padding: 0;
    overflow: visible;
  }
  .kit .tool { width: 100%; height: var(--th); }
  /* each tool drawn standing up, then laid down with its tip to the left;
     the shorter bucket moves along so all the handles line up on the right */
  .kit .tool svg {
    --push: 22px;
    width: var(--th);
    transform-origin: 0 0;
    transform: translate(calc(var(--push) + var(--extra, 0px)), var(--th)) rotate(-90deg);
    filter: drop-shadow(0 0 1.5px rgba(var(--shade), .3));
  }
  .kit .tool[data-tool="bucket"] svg { --extra: calc(var(--th) * 40 / 60); }
  .kit .tool:hover svg { --push: 12px; transform: translate(calc(var(--push) + var(--extra, 0px)), var(--th)) rotate(-90deg); }
  .kit .tool[aria-checked="true"] svg { --push: -10px; transform: translate(calc(var(--push) + var(--extra, 0px)), var(--th)) rotate(-90deg); }
  .kit .tool:focus-visible svg { filter: drop-shadow(0 0 3px var(--rust)); }
}

/* short screens (phones on their side): a smaller tray */
@media (min-width: 641px) and (max-height: 600px) {
  .studio { --swatch: 22px; }
  .kit { --th: 24px; gap: 8px; margin-bottom: 6px; padding: 8px 8px; }
  .kit .colors { grid-template-columns: repeat(6, var(--swatch)); gap: 5px; padding: 2px; }
  .kit .tools { gap: 1px; }
  .studio-top { padding-top: 6px; }
  .next { display: none; }
  .round { width: 38px; height: 38px; }
  .round svg { width: 19px; height: 19px; }
  .kit .size { height: 30px; margin: -2px 0; }
  .kit .size-knob { --d: calc(12px + var(--v) * 16px); }
}

/* narrower computers: the menu shows just its icons */
@media (max-width: 1240px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .side { align-items: center; padding-inline: 8px; }
  .side .side-label { display: none; }
  /* just icons: the crayon logo would read as a menu item, so Home's house comes first */
  .side-logo { display: none; }
  .side-nav { margin-top: 6px; }
  .side-item { justify-content: center; width: 56px; padding: 10px; }
}

/* below very wide screens the page gets the room: the pictures slide in over it
   when asked for, and the row under the page suggests what's next */
@media (max-width: 1599px) {
  .board { grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  .panel {
    position: fixed;
    z-index: 45;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 90vw);
    margin: 0;
    border-radius: 18px 0 0 18px;
    transform: translateX(105%);
    transition: transform .35s var(--ease);
  }
  .panel.open { transform: none; }
  .panel .panel-close { display: grid; width: 42px; height: 42px; }
  .panel-foot { display: none; }
  .finish-top { display: inline-flex; }
}

/* phones: the menu is a bar along the bottom, like the chess.com app */
@media (max-width: 640px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .board { height: calc(100dvh - 62px - env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: flex;
    height: calc(62px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--menu);
  }
  .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: var(--menu-ink);
    font: 800 .72rem/1 var(--font-body);
    cursor: pointer;
  }
  .tab svg { width: 28px; height: 28px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .3)); }
  .tab span { white-space: nowrap; letter-spacing: -.01em; }
  @media (max-width: 400px) { .tab { font-size: .64rem; } .tab svg { width: 26px; height: 26px; } }
  .tab[aria-current] { background: var(--menu-current); }
  .panel { width: 100vw; border-radius: 0; }
  .kit { display: contents; }
  .studio {
    --swatch: 34px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
    grid-template-areas: "top" "stage" "next" "size" "colors" "tools";
  }
  .studio-top { padding: 10px 12px 2px; }
  .studio-title .hand { display: none; }
  .round { width: 42px; height: 42px; }
  .round svg { width: 21px; height: 21px; }
  .history { gap: 6px; }
  .finish { padding: .65em 1em; font-size: .95rem; }
  .size { width: min(280px, 70%); height: 40px; margin-top: 2px; }
  .size-track { inset: 6px 0; clip-path: polygon(0 36%, 100% 0, 100% 100%, 0 64%); }
  .size-track::after { background: linear-gradient(90deg, transparent, var(--paper-deep)); }
  .size-knob { left: calc(21px + var(--v) * (100% - 42px)); top: 50%; }
  .colors { flex-wrap: nowrap; justify-content: flex-start; max-width: 100%; overflow-x: auto; padding: 8px 12px; }
  .swatch { flex: none; }
  .tools { height: 90px; gap: 0; }
  .tool { width: 42px; }
  .tool svg { transform: translateY(44px); }
  .tool:hover svg { transform: translateY(38px); }
  .tool[aria-checked="true"] svg { transform: translateY(8px); }
}

/* ---------- Done ---------- */

.done {
  width: min(100vw - 24px, 640px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.done::backdrop {
  background: rgba(var(--shade), .45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.done[open] { animation: pop .45s var(--spring); }
@keyframes pop { from { opacity: 0; scale: .9; } }
.done-card {
  position: relative;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: clamp(22px, 4vw, 36px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.done-card h2 { margin: .4rem 0 1.2rem; font-size: clamp(1.8rem, 4.5vw, 2.5rem); }
.done-pic {
  width: 100%;
  max-height: 52dvh;
  object-fit: contain;
  margin: 0 auto 1.4rem;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  rotate: -1deg;
}
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.done-close { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; }
.done-close svg { width: 20px; height: 20px; }
/* the members' dialog (members.js), dressed like the Done one */
.club { width: min(100vw - 24px, 480px); }
.club-card h2 { margin: .3rem 0 .8rem; font-size: clamp(1.6rem, 4.5vw, 2.1rem); }
.club-card p { margin: 0 0 1rem; line-height: 1.5; }
.club-pic {
  width: min(60%, 220px);
  margin: 0 auto 1rem;
  padding: 6px;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  rotate: -2deg;
}
.club-pic[hidden] { display: none; }
.club-perks { margin: 0 auto 1rem; padding: 0; list-style: none; text-align: left; width: fit-content; }
.club-perks li { position: relative; padding: .25rem 0 .25rem 1.7rem; }
.club-perks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .5rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--sage) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8' fill='none' stroke='%23411e06' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}
.club-card .club-price { margin-bottom: 1.2rem; color: var(--rust); font: 400 1.5rem/1 var(--font-display); }
.club-form { display: grid; gap: .6rem; margin-bottom: 1rem; }
.club-form label { line-height: 1.4; }
.club-row { display: flex; gap: 8px; justify-content: center; }
.club-row input {
  flex: 1;
  min-width: 0;
  max-width: 280px;
  padding: .75em 1em;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: 600 1rem/1.2 var(--font-body);
}
.club-row input:focus { border-color: var(--peach); outline: none; box-shadow: 0 0 0 3px var(--glow); }
#club-a { max-width: 110px; text-align: center; font-size: 1.2rem; }
#club-code { max-width: 170px; text-align: center; font-size: 1.3rem; letter-spacing: .25em; }
.club-go { min-width: 12em; margin-bottom: 1rem; font-size: 1.08rem; }
.club-card .club-fine { margin: 0; color: var(--ink-soft); font-size: .88rem; }
.club-card .club-error { margin: 1rem 0 0; color: #b3261e; font-weight: 700; }
.club-card .club-error[hidden] { display: none; }
.club-card section[hidden] { display: none; }
.club.busy .club-card { cursor: progress; }
.club .btn:disabled { opacity: .55; transform: none; box-shadow: none; cursor: progress; }

/* a button that reads like a link, inside a sentence */
.link-btn { padding: 0; border: 0; background: none; color: var(--rust); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100dvh; pointer-events: none; }

