/* The Baloo 2 font, kept in the fonts folder (see fonts/README.txt) */
@font-face {
  font-family: "Baloo 2";
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/baloo2-latin.woff2) format("woff2");
}

:root {
  --bg: #fffaf0;
  --ink: #2b2b2b;
  --masthead-bg: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;          /* the real visible height on iPad Safari */
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: manipulation;          /* no double-tap zoom */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;         /* no pop-up menu on long press */
  -webkit-tap-highlight-color: transparent;
}

.corner-btn {
  /* The round Home and Share buttons, the same as Grandadio's (light blue, with a dark house or share picture) */
  position: fixed;
  top: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #9bc9e8;
  color: #1b1d3a;
  box-shadow: 0 4px 0 rgba(20,15,10,0.18), 0 6px 12px rgba(0,0,0,0.22);
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.corner-btn svg { width: 24px; height: 24px; }
.corner-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(20,15,10,0.18), 0 3px 6px rgba(0,0,0,0.2); }

.corner-btn[hidden] { display: none; }

.home-btn { left: 16px; }
.share-btn { right: 16px; }

/* ---------- Español (spanish.js) ---------- */
/* The switch at the bottom of the homepage: the US flag (English) or Puerto Rico's flag (Español).
   A white bubble slides behind the flag that's on; the other flag is faded. */
.lang-bar { flex: none; display: flex; justify-content: center; padding: 4px 0 12px; }
.lang-toggle {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 5px;
  border: none;
  border-radius: 999px;
  background: #d9ecf8;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
  cursor: pointer;
}
.lang-toggle .knob {
  position: absolute;
  top: 5px; left: 5px;
  width: 58px; height: 38px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.25s cubic-bezier(.3,1.5,.6,1);
}
.lang-toggle.es-on .knob { transform: translateX(66px); }   /* (a knob's width plus the gap) */
.lang-toggle .flag {
  position: relative;
  width: 58px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s, filter 0.2s;
}
.lang-toggle .flag svg { width: 42px; height: 28px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }
.lang-toggle .pr svg { width: 42px; }
.lang-toggle .pr, .lang-toggle.es-on .us { opacity: 0.4; filter: grayscale(0.6); }
.lang-toggle.es-on .pr { opacity: 1; filter: none; }


.masthead {
  text-align: center;
  padding: 2vh 0 0;
}

.masthead h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The logo: a bit over a third of the screen's height, so the tiles still fit below */
.masthead .logo {
  height: 38vh;
  max-height: 380px;
  max-width: 92vw;
  overflow: visible;           /* the letters may fly past the edges when they shake apart */
  cursor: pointer;
}


/* The arched words: Baloo 2, a soft, thick, friendly font (in fonts/), with a dark
   outline drawn behind each letter so even the yellow ones stand out */
.arch-text {
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-weight: 800;
  font-size: 68px;
  letter-spacing: 2px;
  stroke: #2b2b2b;
  stroke-width: 8px;
  stroke-linejoin: round;
  paint-order: stroke fill;
}

.activity-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 20px 48px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.activity-tile {
  scroll-snap-align: center;
  flex: 0 0 auto;
  width: 220px;
  height: 220px;
  border-radius: 28px;
  border: none;
  background: var(--tile-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.15);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

/* The Grandadio tile: Grandadio's night sky, its wordmark and swoosh, and no label.
   The letters, the swoosh, and their pop-in and bob animations are copied from Grandadio's homepage, with every
   size measured in "u" (one u = one rem on Grandadio), so it's an exact smaller copy: change --u to resize it. */
.grandadio-tile { background: radial-gradient(ellipse 120% 90% at 50% 20%, #262a52 0%, #1b1d3a 45%, #14152c 100%); }
/* Grandadio's night sky on the tile: a warm glow behind the wordmark, and little twinkling stars (as on grandad.io) */
.grandadio-tile { position: relative; overflow: hidden; }
.grandadio-tile::before {
  content: ""; position: absolute; inset: 8% -10% 18%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(242,166,90,0.32) 0%, rgba(242,166,90,0.09) 55%, transparent 75%);
}
.grandadio-tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.6; animation: gd-twinkle 5s ease-in-out infinite;
  background:
    radial-gradient(circle at 12% 14%, #fffcf2 0 1.2px, transparent 2px), radial-gradient(circle at 28% 32%, #fffcf2 0 1px, transparent 1.8px),
    radial-gradient(circle at 46% 10%, #fffcf2 0 1.4px, transparent 2.2px), radial-gradient(circle at 68% 22%, #fffcf2 0 1px, transparent 1.8px),
    radial-gradient(circle at 86% 12%, #fffcf2 0 1.3px, transparent 2px), radial-gradient(circle at 92% 40%, #fffcf2 0 1px, transparent 1.8px),
    radial-gradient(circle at 8% 52%, #fffcf2 0 1px, transparent 1.8px), radial-gradient(circle at 20% 82%, #fffcf2 0 1.2px, transparent 2px),
    radial-gradient(circle at 54% 88%, #fffcf2 0 1px, transparent 1.8px), radial-gradient(circle at 78% 78%, #fffcf2 0 1.4px, transparent 2.2px),
    radial-gradient(circle at 90% 92%, #fffcf2 0 1px, transparent 1.8px), radial-gradient(circle at 36% 62%, #fffcf2 0 0.9px, transparent 1.6px);
}
@keyframes gd-twinkle { 50% { opacity: 0.25; } }
.grandadio-tile .gd-mark { position: relative; z-index: 1; }
.gd-mark { --u: 10.5px; display: flex; flex-direction: column; align-items: center; }
.gd-letters {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding-top: calc(3.3 * var(--u));
}
.gd-mark .letter {
  display: inline-block;
  font-size: calc(var(--size) * var(--u));
  color: var(--hue);
  text-shadow: 0.06em 0.08em 0 rgba(58, 34, 20, 0.28);
  rotate: var(--tilt);
  translate: 0 calc(var(--base-y) * var(--u));
  animation: gd-bob 3.6s ease-in-out infinite;
  animation-delay: var(--pop-delay);
}
.gd-swoosh {
  display: block;
  width: calc(18.75 * var(--u));
  margin-top: calc(-1.65 * var(--u));
  transform-origin: 0% 50%;
  transform: translateX(calc(0.625 * var(--u))) rotate(-6deg);
}
.gd-swoosh svg { display: block; width: 100%; height: auto; overflow: visible; }
/* pressed: the letters pop in one after another, then the swoosh sweeps in (as on Grandadio) */
.gd-mark.play .letter {
  opacity: 0;
  animation: gd-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--pop-delay);
}
.gd-mark.play .gd-swoosh { opacity: 0; animation: gd-swoosh 0.55s ease-out 0.95s forwards; }
@keyframes gd-pop {
  0%   { opacity: 0; scale: 0.3; rotate: 0deg; translate: 0 calc((var(--base-y) + 1.875) * var(--u)); }
  60%  { opacity: 1; scale: 1.08; rotate: var(--tilt); translate: 0 calc((var(--base-y) - 0.25) * var(--u)); }
  100% { opacity: 1; scale: 1; rotate: var(--tilt); translate: 0 calc(var(--base-y) * var(--u)); }
}
@keyframes gd-bob { 50% { translate: 0 calc((var(--base-y) - 0.3125) * var(--u)); } }
@keyframes gd-swoosh {
  from { opacity: 0; transform: translateX(calc(0.625 * var(--u))) rotate(-6deg) scaleX(0.3); }
  to   { opacity: 1; transform: translateX(calc(0.625 * var(--u))) rotate(-6deg) scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .gd-mark .letter, .gd-mark.play .letter, .gd-mark.play .gd-swoosh { animation: none; opacity: 1; }
}

/* squish when pressed: down and a little wider, like a rubber toy (the same as the Sounds buttons) */
.activity-tile:active,
.activity-tile.pressed {
  transform: translateY(8px) scale(1.06, 0.9);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15);
}
/* and the picture wiggles (the "wiggle" animation is in the Sounds section) */
.activity-tile.wiggle .icon { display: inline-block; animation: wiggle 0.5s ease; }

.activity-tile .icon img {
  display: block;
  width: 1.15em;
  height: 1.15em;
  border-radius: 22%;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.85);
}

.activity-tile .icon {
  font-size: 4rem;
}
/* the car emoji faces left; turned around, it faces right, the way the vehicles drive in Wheels */
.face-right { display: inline-block; transform: scaleX(-1); }
.activity-tile .icon .wk-tile-mallet { display: block; width: 1.3em; height: 1.3em; margin: -0.08em 0; }   /* Whack's mallet, the size of an emoji icon */

.activity-tile .label {
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* A phone held sideways is too short for anything below the full-size tiles (they stay big for small fingers),
   so there the flag switch moves up to the top, beside Share. */
@media (orientation: landscape) and (max-height: 500px) {
  .lang-bar { position: fixed; top: 12px; right: 80px; padding: 0; z-index: 10; }
}

/* ---------- Activity pages ---------- */

.page-title {
  text-align: center;
  padding: 18px 0 0;
}

.page-title h1 {
  margin: 0;
  font-size: 2.4rem;
  color: var(--ink);
}

/* ---------- Sounds ---------- */

.sound-board {
  flex: 1;
  display: grid;
  grid-auto-flow: column;                       /* fill two rows, then keep going to the right... */
  grid-template-rows: repeat(2, var(--size));
  grid-auto-columns: var(--size);
  align-content: center;
  gap: 3vmin;
  padding: 2vmin 4vmin 4vmin;
  overflow-x: auto;                             /* ...and scroll side to side to see them all */
  overflow-y: hidden;
  touch-action: pan-x;
  scroll-snap-type: x proximity;
  scroll-padding: 0 4vmin;
  scrollbar-width: none;
  --size: min(20vw, 34vh);   /* the same size as before: 4 across fit on an iPad held sideways */
}
.sound-board::-webkit-scrollbar { display: none; }
.sound-board .sound-btn { scroll-snap-align: start; }

.sound-btn {
  width: var(--size);
  height: var(--size);
  border-radius: 32%;
  border: none;
  background: var(--btn-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  box-shadow: 0 10px 0 rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.sound-btn .icon { font-size: calc(var(--size) * 0.42); line-height: 1; }

.sound-btn .label {
  font-size: calc(var(--size) * 0.13);
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

/* squish down and get a little wider, like pressing a rubber toy */
.sound-btn.pressed {
  transform: translateY(8px) scale(1.06, 0.9);
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}

/* a little wiggle of the picture after each press */
.sound-btn.wiggle .icon { animation: wiggle 0.5s ease; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg) scale(1.15); }
  50% { transform: rotate(10deg) scale(1.1); }
  75% { transform: rotate(-5deg); }
}

/* ---------- Bubbles ---------- */

.bubbles-page {
  background: linear-gradient(180deg, #1f6fff 0%, #5ec1ff 100%);
  touch-action: none;          /* no scrolling or zooming while popping */
}

.bubbles-page .page-title {
  position: relative;
  z-index: 2;
  pointer-events: none;        /* taps go through the title to the bubbles */
}
.bubbles-page .page-title h1 { color: white; text-shadow: 0 3px 0 rgba(0,0,0,0.15); }

.bubble-sky {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* What every bubble looks like: a shiny highlight, a see-through tint, and a bright rim */
.big-bubble, .little-bubble {
  position: absolute;
  border: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 32% 28%,
    rgba(255,255,255,0.95) 0 7%, rgba(255,255,255,0.25) 8% 30%,
    var(--tint) 75%, rgba(255,255,255,0.8) 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.6), 0 0 24px var(--tint);
}

/* The big one sits in the middle; bubbles.js makes it grow by changing its scale */
.big-bubble {
  left: 50%;
  top: 55%;
  width: 80vmin;
  height: 80vmin;
}

.little-bubble {
  left: 0;
  top: 0;
  z-index: 2;                  /* in front of the big bubble */
}

.pop-ring {
  position: absolute;
  border-radius: 50%;
  border: 6px solid var(--tint);
  pointer-events: none;
  animation: pop-ring 0.45s ease-out forwards;
}
@keyframes pop-ring {
  from { transform: scale(0.6); opacity: 1; }
  to   { transform: scale(1.5); opacity: 0; }
}

/* ---------- Peekaboo ---------- */

.peek-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
}

/* One big window, as large as fits on an iPad held either way */
.peek-window {
  --size: min(62vh, 80vw);
  position: relative;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 10px solid white;
  border-radius: 40px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 10px 0 rgba(0,0,0,0.2);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.3s;
}
.peek-window.pressed {
  transform: translateY(6px) scale(0.98);
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

/* The animal: a bit small while hiding, full size when it peeks out */
.friend {
  position: absolute;
  inset: 10%;
  transform: scale(0.75);
  transition: transform 0.45s cubic-bezier(.3,1.5,.5,1);
}
.friend svg { width: 100%; height: 100%; display: block; }
.peek-window.open .friend { transform: scale(1); }
.peek-window.open .friend.wiggle svg { animation: peek-wiggle 0.9s ease-in-out 0.35s; }
@keyframes peek-wiggle {
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(7deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(3deg); }
}

/* The blanket: a bold patchwork quilt with a bumpy top edge. It drops down to show who is hiding. */
.blanket {
  position: absolute;
  inset: -2px;
  transition: transform 0.55s cubic-bezier(.5,0,.3,1);
  background:
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.4) 0 6px, transparent 7px) 0 0 / 50px 50px,
    repeating-conic-gradient(#ff2e4d 0 25%, #ffc400 0 50%) 0 0 / 100px 100px;
}
.blanket::before {                 /* the band along the top */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 16px;
  background: #2f80ff;
}
.blanket::after {                  /* the bumps along the top */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -18px;
  height: 36px;
  background: radial-gradient(circle at 18px 18px, #2f80ff 17px, transparent 18px) 0 0 / 36px 36px repeat-x;
}
.peek-window.open .blanket { transform: translateY(90%); }
/* A tall animal (the giraffe): its picture reaches far above the window, hidden until the blanket drops; then its
   neck shoots up out of the top of the window (clipped only at the bottom and sides, so the blanket stays inside) */
.peek-window.tall .friend { top: -30%; transform-origin: 50% 70%; }   /* (10% less half of 80%: the picture is 1.5 times as tall) */
.peek-window.tall.open { overflow: visible; clip-path: inset(-200% -40px 0 -40px round 0 0 40px 40px); }
.peek-window.tall.open .friend { animation: neck-up 0.7s cubic-bezier(.3,1.5,.5,1) 0.25s both; }
@keyframes neck-up { from { transform: translateY(45%) scale(0.9); } to { transform: none; } }

/* The skunk's stink: grey puffs and wavy lines around it, puffing up after the blanket drops (peekaboo.js) */
.stink-cloud { position: absolute; inset: 0; pointer-events: none; }
.stink-cloud .puff { position: absolute; width: 34%; opacity: 0; transform: scale(0.2); }
.stink-cloud .stink-line { position: absolute; width: 8%; opacity: 0; }
.peek-window.open .stink-cloud .puff { animation: stink-puff 2.6s ease-out both, stink-drift 3s ease-in-out 2.6s infinite alternate; }
.peek-window.open .stink-cloud .stink-line { animation: stink-wave 1.6s ease-in-out infinite; }
@keyframes stink-puff { 0% { opacity: 0; transform: scale(0.2); } 30% { opacity: 0.9; transform: scale(calc(var(--s) * 1.15)); } 100% { opacity: 0.85; transform: scale(var(--s)); } }
@keyframes stink-drift { from { transform: scale(var(--s)) translateY(0); } to { transform: scale(calc(var(--s) * 1.08)) translateY(-6%); } }
@keyframes stink-wave { 0% { opacity: 0; transform: translateY(20%); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40%); } }

/* The animal's name, in big letters */
.animal-word {
  min-height: 1.2em;               /* keeps its space, so nothing jumps when the word appears */
  font-size: min(5rem, 9vh);
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.25s, transform 0.35s cubic-bezier(.3,1.6,.5,1);
}
.animal-word.show { opacity: 1; transform: scale(1); }

@media (prefers-reduced-motion: reduce) {
  .friend, .blanket { transition: opacity 0.3s; }
  .peek-window.open .blanket { transform: none; opacity: 0; }
  .peek-window.open .friend.wiggle svg { animation: none; }
}

/* ---------- Choosing a picture (Color and Puzzle) ---------- */

.pick-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.pick-view[hidden] { display: none; }

.pick-list {
  flex: 1;
  overflow-y: auto;                /* scroll up and down through the pictures */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 8px 48px 40px;
}

.pick-group {
  margin: 22px 0 10px;
  font-size: 1.5rem;
  color: var(--ink);
}

.pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.pick-card {
  width: 196px;
  padding: 10px 10px 8px;
  border: none;
  border-radius: 24px;
  background: white;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pick-card:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.pick-card .art {
  width: 176px;
  height: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.pick-card .art img { width: 100%; height: 100%; object-fit: contain; }
.pick-card .label { font-size: 1.1rem; font-weight: 800; color: var(--ink); }

/* ---------- Color ---------- */

/* crayons | picture | tools, side by side for an iPad held sideways */
.studio {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  padding: 84px 16px 16px;
}
.studio[hidden] { display: none; }

.canvas-wrap { flex: 0 0 auto; }
.studio canvas {
  display: block;
  width: min(calc(100dvh - 110px), calc(100vw - 380px));
  height: auto;
  aspect-ratio: 1;
  border-radius: 18px;
  background: white;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  touch-action: none;              /* the finger colors; it doesn't scroll the page */
}

/* The crayon box: a column of crayons pointing at the picture, scrolling up and down */
.crayon-box {
  flex: 0 0 auto;
  width: 190px;
  height: calc(100dvh - 110px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: none;
}
.crayon-box::-webkit-scrollbar { display: none; }

.crayon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: 44px;
  width: 170px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transform: translateX(-14px);
  transition: transform 0.15s cubic-bezier(.3,1.6,.5,1);
}
/* the paper wrapper with the crayon's name, and two dark bands like a real crayon */
.crayon .wrapper {
  flex: 1;
  height: 34px;
  border-radius: 6px 3px 3px 6px;
  background:
    linear-gradient(90deg, transparent 10px, rgba(0,0,0,0.35) 10px 14px, transparent 14px calc(100% - 14px), rgba(0,0,0,0.35) calc(100% - 14px) calc(100% - 10px), transparent calc(100% - 10px)),
    linear-gradient(180deg, rgba(255,255,255,0.35), transparent 45%, rgba(0,0,0,0.15)),
    var(--c);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.crayon .name {
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
  white-space: nowrap;
  padding: 0 16px;
  text-overflow: ellipsis;
  overflow: hidden;
}
.crayon.light .name { color: #2b2b2b; }
/* the waxy pointed tip */
.crayon .tip {
  width: 30px;
  height: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,0.45), transparent 40%, rgba(0,0,0,0.2)), var(--c);
  clip-path: polygon(0 4%, 72% 34%, 100% 42%, 100% 58%, 72% 66%, 0 96%);
}
.crayon.light .wrapper, .crayon.light .tip { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
/* metallic crayons shine */
.crayon.metallic .wrapper, .crayon.metallic .tip {
  background: linear-gradient(135deg, rgba(255,255,255,0.7), transparent 35%, rgba(255,255,255,0.5) 55%, rgba(0,0,0,0.25)), var(--c);
}
/* the chosen crayon slides out toward the picture */
.crayon.chosen { transform: translateX(10px) scale(1.08); }
.crayon.chosen .wrapper { box-shadow: 0 0 0 3px white, 0 0 0 5px #2b2b2b; }

/* Undo, Clear, Keep, Pictures */
.tools {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tool-btn {
  width: 110px;
  height: 92px;
  border: none;
  border-radius: 24px;
  background: white;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.tool-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.tool-btn .icon { font-size: 2.2rem; line-height: 1; }
.tool-btn .label { font-size: 1rem; font-weight: 800; color: var(--ink); }

/* An iPad held upright: picture on top, crayons in a row underneath, tools beside them */
@media (orientation: portrait) {
  .studio { flex-direction: column; padding-top: 80px; }
  .studio canvas { width: min(calc(100vw - 32px), calc(100dvh - 330px)); }
  .crayon-box {
    order: 2;
    flex-direction: row;
    width: calc(100vw - 32px);
    height: 140px;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x;
  }
  .crayon { width: 44px; height: 130px; flex-direction: column-reverse; transform: translateY(14px); }
  .crayon .wrapper { width: 34px; flex: 1; border-radius: 3px 3px 6px 6px;
    background:
      linear-gradient(180deg, transparent 10px, rgba(0,0,0,0.35) 10px 14px, transparent 14px calc(100% - 14px), rgba(0,0,0,0.35) calc(100% - 14px) calc(100% - 10px), transparent calc(100% - 10px)),
      linear-gradient(90deg, rgba(255,255,255,0.35), transparent 45%, rgba(0,0,0,0.15)), var(--c); }
  .crayon .name { writing-mode: vertical-rl; transform: rotate(180deg); padding: 16px 0; }
  .crayon .tip { clip-path: polygon(4% 100%, 34% 28%, 42% 0, 58% 0, 66% 28%, 96% 100%); }
  .crayon.chosen { transform: translateY(-6px) scale(1.08); }
  .tools { order: 3; flex-direction: row; }
  .tool-btn { width: 96px; height: 76px; }
}

/* ---------- Draw ---------- */

.draw-paper { flex: 0 0 auto; }
.draw-paper canvas {
  display: block;
  width: min(calc(100vw - 380px), calc((100dvh - 110px) * 4 / 3));
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: white;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  touch-action: none;              /* the finger draws; it doesn't scroll the page */
  cursor: crosshair;
}
/* three crayon sizes, shown as dots of three sizes */
.size-card {
  width: 110px;
  padding: 8px 6px;
  border-radius: 24px;
  background: white;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.size-btn {
  width: 72px;
  height: 46px;
  border: none;
  border-radius: 999px;
  background: #f1ece2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.size-btn span { width: var(--d); height: var(--d); border-radius: 50%; background: #2b2b2b; }
.size-btn:active { transform: scale(0.9); }
.size-btn.chosen { background: #2f80ff; }
.size-btn.chosen span { background: white; }
.tool-btn.chosen { background: #2f80ff; }
.tool-btn.chosen .label { color: white; }
/* while the eraser is picked, the chosen crayon slides back into the box */
.crayon.chosen.resting { transform: translateX(-14px); }
.crayon.chosen.resting .wrapper { box-shadow: none; }
@media (orientation: portrait) {
  .draw-paper canvas { width: calc(100vw - 32px); }
  .size-card { flex-direction: row; width: auto; }
  .size-btn { width: 56px; }
  .crayon.chosen.resting { transform: translateY(14px); }
}

/* ---------- Collage ---------- */

/* the materials drawer: a scrolling column of samples, each with its name */
.materials {
  flex: 0 0 auto;
  width: 178px;
  height: calc(100dvh - 110px);
  overflow-y: auto;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 6px 12px;
  scrollbar-width: none;
}
.materials::-webkit-scrollbar { display: none; }
.mat-group { margin: 10px 0 0; font-size: 1.05rem; color: var(--ink); }
.mat {
  flex: 0 0 auto;
  border: none;
  border-radius: 14px;
  background: white;
  padding: 6px 6px 4px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.mat canvas { width: 150px; height: 70px; border-radius: 8px; display: block; }
.mat span { font-size: 0.85rem; font-weight: 800; color: var(--ink); }
.mat:active { transform: scale(0.95); }
.mat.chosen { box-shadow: 0 0 0 4px #2f80ff, 0 4px 0 rgba(0,0,0,0.14); }

.collage-board { flex: 0 0 auto; }
.collage-board canvas {
  display: block;
  width: min(calc(100vw - 400px), calc((100dvh - 110px) * 4 / 3));
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #fffdf9;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  touch-action: none;
}

.collage-tools { flex: 0 0 132px; display: flex; flex-direction: column; gap: 10px; }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-btn, .shape-btn {
  border: none;
  border-radius: 16px;
  background: white;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.mode-btn { height: 70px; }
.shape-btn { height: 58px; }
.mode-btn .icon { font-size: 1.7rem; line-height: 1; }
.shape-btn .icon { font-size: 1.35rem; line-height: 1.1; color: var(--ink); }
.mode-btn .label, .shape-btn .label { font-size: 0.78rem; font-weight: 800; color: var(--ink); }
.mode-btn:active, .shape-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.mode-btn.chosen, .shape-btn.chosen { background: #2f80ff; }
.mode-btn.chosen .label, .shape-btn.chosen .label, .shape-btn.chosen .icon { color: white; }
.shape-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.shape-grid[hidden] { display: none; }
.bottom-row { grid-template-columns: 1fr 1fr 1fr; margin-top: auto; }
.bottom-row .shape-btn .label { font-size: 0.7rem; }
.collage-hint { margin: 0; font-size: 0.85rem; font-weight: 700; line-height: 1.25; color: #6b6458; min-height: 3.2em; }

@media (orientation: portrait) {
  .materials { order: 2; flex-direction: row; width: calc(100vw - 32px); height: auto; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; align-items: center; }
  .mat-group { writing-mode: vertical-rl; transform: rotate(180deg); margin: 0; }
  .collage-board canvas { width: calc(100vw - 32px); }
  .collage-tools { order: 3; flex: none; flex-direction: row; flex-wrap: wrap; width: calc(100vw - 32px); align-items: flex-start; }
  .shape-grid { grid-template-columns: repeat(4, 64px); }
  .bottom-row { margin-top: 0; }
}

/* ---------- Paint ---------- */

.paper-wrap {
  position: relative;
  flex: 0 0 auto;
}
.paper-wrap canvas {
  display: block;
  width: min(calc(100vw - 380px), calc((100dvh - 110px) * 4 / 3));
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: white;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  touch-action: none;              /* fingers paint; they don't scroll the page */
}
/* a soft shine over the paper, so the paint looks wet */
.paper-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 25% 15%, rgba(255,255,255,0.28), transparent 70%),
    linear-gradient(160deg, rgba(255,255,255,0.12), transparent 40%);
}

/* the paint pots: two columns of big round blobs of paint, each with its name */
.pots {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 76px);
  gap: 10px 12px;
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  touch-action: pan-y;
  padding: 4px;
}
.pot {
  border: none;
  background: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.pot .blob {
  width: 68px;
  height: 68px;
  border-radius: 46% 54% 52% 48% / 55% 45% 55% 45%;   /* a little lumpy, like a blob of paint */
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.75) 0 10%, transparent 26%), var(--c);
  box-shadow: 0 5px 0 rgba(0,0,0,0.18);
  transition: transform 0.12s cubic-bezier(.3,1.6,.5,1);
}
.pot.light .blob { box-shadow: 0 5px 0 rgba(0,0,0,0.18), inset 0 0 0 2px rgba(0,0,0,0.15); }
.pot .label { font-size: 0.85rem; font-weight: 800; color: var(--ink); }
.pot:active .blob { transform: scale(0.9, 0.8); }
.pot.chosen .blob { transform: scale(1.12); box-shadow: 0 0 0 4px white, 0 0 0 7px #2b2b2b; }

@media (orientation: portrait) {
  .paper-wrap canvas { width: calc(100vw - 32px); }
  .pots {
    order: 2;
    grid-template-columns: none;
    grid-auto-flow: column;
    max-height: none;
    max-width: calc(100vw - 32px);
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x;
  }
}

/* ---------- Puzzle ---------- */

.pz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 40px;
  justify-content: center;
  margin: 4px 0 6px;
}
.pz-choice { display: flex; flex-wrap: wrap; gap: 10px; }
.pz-chip {
  padding: 14px 22px;
  border: none;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pz-chip:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.pz-chip.chosen { background: #2f80ff; color: white; }

/* Famous Paintings in the Puzzle chooser */
.pick-group.pz-famous { font-size: 2rem; margin-top: 34px; color: #a03cff; }
.painting-card .label { font-size: 0.95rem; line-height: 1.15; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pz-thanks { margin: 18px 0 0; font-size: 0.95rem; color: #6b6458; }
.pz-credit { margin: 0; font-size: 0.8rem; line-height: 1.25; color: #6b6458; text-align: center; }

/* a finished puzzle: a green check on its picture, and the biggest size done (like Grandadio) */
.pick-card .art { position: relative; }
.pz-done-mark {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: #00b050;
  box-shadow: 0 0 0 3px white, 0 3px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.pz-done-mark svg { width: 62%; height: 62%; }
.pz-done-size.pz-going { background: #ff7a00; color: white; }
.pick-group.pz-keep-going { color: #ff7a00; }
.pz-done-size {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(27,29,58,0.85);
  color: #9fe0a0;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

/* the "Edges first" on/off switch */
.pz-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 10px;
  border: none;
  border-radius: 999px;
  background: white;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pz-switch:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.pz-switch .track {
  position: relative;
  width: 76px;
  height: 42px;
  border-radius: 999px;
  background: #b8b8b8;
  transition: background 0.2s;
}
.pz-switch .knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: transform 0.2s cubic-bezier(.3,1.6,.5,1);
}
.pz-switch[aria-checked="true"] .track { background: #00c853; }
.pz-switch[aria-checked="true"] .knob { transform: translateX(34px); }

/* the board on the left, a single column of pieces on the right */
.pz-play {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
}
.pz-play[hidden] { display: none; }

/* the table: a little bigger than the finished puzzle, so pieces can be spread out and moved around */
.pz-board {
  position: relative;
  z-index: 1;                      /* (keeps the pieces below the video window) */
  flex: 0 0 auto;
  border-radius: 14px;
  background: radial-gradient(ellipse at 30% 20%, #f7e6c4, #e9cf9f);
  box-shadow: inset 0 0 0 4px #c99a5b, 0 8px 18px rgba(0,0,0,0.18);
  touch-action: none;
}
/* a small puzzle's board: just the picture, faintly, to build on */
.pz-board.small { background: white; box-shadow: inset 0 0 0 3px rgba(0,0,0,0.12), 0 6px 18px rgba(0,0,0,0.12); border-radius: 8px; }
.pz-ghost { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; opacity: 0.2; pointer-events: none; }
.pz-piece.pz-locked { cursor: default; }

.pz-peek {
  position: absolute;
  border-radius: 4px;
  z-index: 100000;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  cursor: pointer;
  animation: pz-peek-in 0.3s ease;
  transition: opacity 0.25s;
}
.pz-peek canvas { display: block; width: 100%; height: 100%; border-radius: 4px; }
.pz-peek.closing { opacity: 0; }
@keyframes pz-peek-in { from { opacity: 0; } }
/* the X in the corner: tap the picture anywhere to put it away */
.pz-peek-x {
  position: absolute; top: -14px; right: -14px; width: 40px; height: 40px; border-radius: 50%;
  background: white; color: #1b1d3a; box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; line-height: 1;
}

/* A piece is moved with "transform" (not left/top), which the iPad can slide smoothly without redrawing it.
   Its shadow is baked into the piece's own drawing (puzzle.js), because a CSS shadow filter would have to be
   redrawn on every move and makes dragging jerky. */
.pz-piece {
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
  cursor: grab;
  will-change: transform;
}
.pz-piece.pz-dragging { cursor: grabbing; }
.pz-piece.pz-settle { transition: transform 0.16s ease-out; }   /* gliding the last bit into place */
.pz-tray.pz-drop-here { background: rgba(0,200,83,0.25); box-shadow: inset 0 0 0 4px #00c853; }   /* let go here to put a piece back */

.pz-side {
  flex: 0 0 150px;
  height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pz-status {
  margin: 0;
  min-height: 3.6em;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
}
/* the tray: pieces in single file, scrolling up and down */
.pz-tray {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto;
  justify-content: center;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  border-radius: 20px;
  background: rgba(47,128,255,0.12);
  touch-action: none;          /* puzzle.js does the scrolling, so a piece can be picked up instead */
  scrollbar-width: none;
}
.pz-tray::-webkit-scrollbar { display: none; }
.pz-slot { position: relative; }
.pz-slot[hidden] { display: none; }
.pz-slot .pz-piece { left: 0; top: 0; }
.pz-btns { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pz-btns .tool-btn { width: 140px; height: 64px; flex-direction: row; gap: 8px; }
.pz-btns .tool-btn[hidden] { display: none; }

/* ---------- Pattycake ---------- */

.pc-stage {
  position: relative;
  flex: 0 0 auto;
  height: 50vh;
  --meet: 10vh;                    /* how far each hand moves to meet the other */
}

/* the two hands (drawn by pattycake.js) */
.hand {
  position: absolute;
  top: 2vh;
  width: 22vh;
  height: 37vh;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 2;
}
.hand svg { width: 100%; height: 100%; display: block; }
.hand.left { left: calc(50% - 30vh); }
.hand.right { left: calc(50% + 8vh); }
.hand.right svg { transform: scaleX(-1); }   /* the right hand is the left hand, flipped */

/* between moves, the hands bob gently (this moves the drawing inside, so it never fights the moves below) */
.hand svg { animation: pc-bob 1.8s ease-in-out infinite; }
.hand.right svg { animation-delay: -0.9s; }
@keyframes pc-bob { 50% { translate: 0 -1.2vh; } }

/* clap: the hands swing in, come forward toward you as they meet, and go back */
.hand.left.clap  { animation: pc-clap-l 0.34s ease-in-out; }
.hand.right.clap { animation: pc-clap-r 0.34s ease-in-out; }
@keyframes pc-clap-l { 45%, 55% { transform: translateX(var(--meet)) translateY(2vh) rotate(8deg) scale(1.18); } }
@keyframes pc-clap-r { 45%, 55% { transform: translateX(calc(-1 * var(--meet))) translateY(2vh) rotate(-8deg) scale(1.18); } }

/* roll: the hands go round and round each other, twice */
.hand.left.roll  { animation: pc-roll-l 1.3s linear; }
.hand.right.roll { animation: pc-roll-r 1.3s linear; }
@keyframes pc-roll-l {
  12.5% { transform: translate(9vh, -5vh) rotate(20deg); } 25% { transform: translate(11vh, 3vh) rotate(10deg); } 37.5% { transform: translate(8vh, 6vh); } 50% { transform: translate(3vh, 0); }
  62.5% { transform: translate(9vh, -5vh) rotate(20deg); } 75% { transform: translate(11vh, 3vh) rotate(10deg); } 87.5% { transform: translate(8vh, 6vh); }
}
@keyframes pc-roll-r {
  12.5% { transform: translate(-9vh, 5vh) rotate(-20deg); } 25% { transform: translate(-11vh, -3vh) rotate(-10deg); } 37.5% { transform: translate(-8vh, -6vh); } 50% { transform: translate(-3vh, 0); }
  62.5% { transform: translate(-9vh, 5vh) rotate(-20deg); } 75% { transform: translate(-11vh, -3vh) rotate(-10deg); } 87.5% { transform: translate(-8vh, -6vh); }
}

/* pat: both hands press down on the dough, three times */
.hand.left.pat  { animation: pc-pat-l 1s ease-in-out; }
.hand.right.pat { animation: pc-pat-r 1s ease-in-out; }
@keyframes pc-pat-l { 0%, 100% { transform: none; } 18%, 48%, 78% { transform: translate(7vh, 12vh) rotate(55deg) scale(0.95); } 33%, 63% { transform: translate(7vh, 3vh) rotate(45deg); } }
@keyframes pc-pat-r { 0%, 100% { transform: none; } 18%, 48%, 78% { transform: translate(-7vh, 12vh) rotate(-55deg) scale(0.95); } 33%, 63% { transform: translate(-7vh, 3vh) rotate(-45deg); } }

/* toss: swing down and back... then up and forward, throwing the dough into the pan */
.hand.left.toss  { animation: pc-toss-l 1s ease-in-out; }
.hand.right.toss { animation: pc-toss-r 1s ease-in-out; }
@keyframes pc-toss-l { 30% { transform: translate(6vh, 7vh) rotate(35deg); } 55% { transform: translate(9vh, -7vh) rotate(-15deg) scale(1.12); } }
@keyframes pc-toss-r { 30% { transform: translate(-6vh, 7vh) rotate(-35deg); } 55% { transform: translate(-9vh, -7vh) rotate(15deg) scale(1.12); } }

/* point: the right hand reaches in to mark the B */
.hand.right.point { animation: pc-point 0.9s ease-in-out; }
@keyframes pc-point { 30%, 70% { transform: translate(-9vh, 4vh) rotate(-25deg); } }

/* cheer: hands up and wiggling */
.hand.left.cheer  { animation: pc-cheer-l 1.2s ease-in-out; }
.hand.right.cheer { animation: pc-cheer-r 1.2s ease-in-out; }
@keyframes pc-cheer-l { 20%, 60% { transform: translate(-3vh, -5vh) rotate(-14deg); } 40%, 80% { transform: translate(-3vh, -5vh) rotate(6deg); } }
@keyframes pc-cheer-r { 20%, 60% { transform: translate(3vh, -5vh) rotate(14deg); } 40%, 80% { transform: translate(3vh, -5vh) rotate(-6deg); } }

/* the dough: hidden, then a ball, then patted flatter and flatter, pricked, thrown in the pan, and a cake */
.dough {
  position: absolute;
  left: 50%;
  top: 40vh;                       /* just below the hands, so it shows while they roll and pat it */
  width: 15vh;
  height: 15vh;
  margin: -7.5vh 0 0 -7.5vh;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6e2, #f3d9a8 60%, #e2bd7e);
  box-shadow: 0 0 0 4px #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.3);
  transition: transform 0.35s cubic-bezier(.3,1.6,.5,1), opacity 0.25s, border-radius 0.3s, background 0.6s, filter 0.6s;
  z-index: 1;
}
/* the little holes poked in the dough ("Prick it!"), popping in a few at a time */
.dough .pricks { position: relative; width: 70%; height: 70%; transform: scale(0.76, 1.4); }   /* (undoes the dough's squash, so the holes are round) */
.dough .pricks i {
  position: absolute; width: 1.6vh; height: 1.6vh; margin: -0.8vh 0 0 -0.8vh; border-radius: 50%;
  background: #b07a3a; box-shadow: inset 0 2px 0 rgba(0,0,0,0.25);
  opacity: 0; transform: scale(0); transition: transform 0.25s cubic-bezier(.3,1.8,.5,1), opacity 0.15s;
}
.dough .pricks i:nth-child(1) { left: 30%; top: 32%; }
.dough .pricks i:nth-child(2) { left: 50%; top: 24%; }
.dough .pricks i:nth-child(3) { left: 70%; top: 32%; }
.dough .pricks i:nth-child(4) { left: 40%; top: 55%; }
.dough .pricks i:nth-child(5) { left: 60%; top: 55%; }
.dough .pricks i:nth-child(6) { left: 32%; top: 76%; }
.dough .pricks i:nth-child(7) { left: 68%; top: 76%; }
.dough.pricked .pricks i { opacity: 1; transform: scale(1); }
.dough.pricked .pricks i:nth-child(n+4) { transition-delay: 0.33s; }
.dough.pricked .pricks i:nth-child(n+6) { transition-delay: 0.66s; }
.dough.cake .pricks { display: none; }
.dough.round { opacity: 1; transform: scale(1); animation: pc-spin 1.3s linear; }
@keyframes pc-spin { to { rotate: 720deg; } }
.dough.pat1 { opacity: 1; transform: scale(1.12, 0.86); }
.dough.pat2 { opacity: 1; transform: scale(1.22, 0.74); border-radius: 48%; }
.dough.pat3 { opacity: 1; transform: scale(1.32, 0.64); border-radius: 46%; }
/* thrown: up in an arc, spinning, and down into the pan, where it browns */
.dough.thrown { animation: pc-throw 0.9s ease-in forwards; filter: sepia(0.5) saturate(1.5); transition: filter 1.2s 0.9s; }
/* (way up high, spinning, getting bigger as if coming toward you... then down into the pan) */
.dough.thrown { animation-duration: 1.3s; }
@keyframes pc-throw {
  0%   { transform: scale(1.32, 0.64); }
  50%  { transform: translateY(-34vh) rotate(540deg) scale(1.6); }
  100% { transform: translateY(5vh) rotate(720deg) scale(1.4, 0.55); }
}

/* the big surprise when it lands: the pan jumps, a sunburst spins behind it, the scene shakes, the screen flashes */
.pan.jump { animation: pc-pan-jump 0.6s cubic-bezier(.3,1.6,.5,1); }
@keyframes pc-pan-jump { 30% { transform: translateY(-3vh) scale(1.25, 0.85); } 60% { transform: scale(0.95, 1.1); } }
.pc-burst {
  position: absolute;
  left: 50%;
  top: 44vh;
  width: 90vh;
  height: 90vh;
  margin: -45vh 0 0 -45vh;
  border-radius: 50%;
  background: repeating-conic-gradient(#ffc400 0 10deg, #ff7a00 10deg 20deg, #ff3ea5 20deg 30deg, #ffe44d 30deg 40deg);
  -webkit-mask: radial-gradient(circle, black 15%, transparent 68%);
  mask: radial-gradient(circle, black 15%, transparent 68%);
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s, transform 0.5s;
}
.pc-burst.on { opacity: 0.9; transform: scale(1); animation: pc-spin-burst 3s linear infinite; transition: opacity 0.15s, transform 0.35s cubic-bezier(.3,1.6,.5,1); }
@keyframes pc-spin-burst { to { rotate: 360deg; } }
.pc-stage.shake { animation: pc-shake 0.5s ease-out; }
@keyframes pc-shake { 15% { transform: translate(-14px, 6px) rotate(-1deg); } 30% { transform: translate(12px, -6px) rotate(1deg); } 45% { transform: translate(-8px, 4px); } 60% { transform: translate(6px, -2px); } 80% { transform: translate(-2px, 1px); } }
.pattycake-page.flash { animation: pc-flash 0.5s ease-out; }
@keyframes pc-flash { 10% { background: #fff6b0; } }
.dough.cake {
  opacity: 1;
  width: 22vh;
  height: 15vh;
  margin: -7.5vh 0 0 -11vh;
  border-radius: 18px 18px 10px 10px;
  background:
    radial-gradient(circle at 20% 22%, #fff 0 4%, transparent 5%),
    radial-gradient(circle at 60% 16%, #ffc400 0 4%, transparent 5%),
    radial-gradient(circle at 80% 28%, #2f80ff 0 4%, transparent 5%),
    linear-gradient(180deg, #ff8fc4 0 38%, #f8d9a8 38% 100%);
  transform: scale(1.15);
  animation: pc-pop 0.5s cubic-bezier(.3,1.6,.5,1);
}
/* a candle on top */
.dough.cake::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7vh;
  width: 1.6vh;
  height: 7vh;
  margin-left: -0.8vh;
  border-radius: 4px;
  background: repeating-linear-gradient(180deg, #2f80ff 0 1.2vh, white 1.2vh 2.4vh);
  box-shadow: 0 0 0 3px #2b2b2b;
}
.dough.cake::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -10.5vh;
  width: 2.4vh;
  height: 3.4vh;
  margin-left: -1.2vh;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff3b0, #ffc400 50%, #ff7a00);
  animation: pc-flicker 0.4s ease-in-out infinite alternate;
}
@keyframes pc-flicker { to { transform: scale(0.85, 1.1) rotate(4deg); } }
@keyframes pc-pop { from { transform: scale(0.3); } }

/* the pan: it slides in for "throw it in the pan" */
.pan {
  position: absolute;
  left: 50%;
  top: 44vh;
  width: 30vh;
  height: 7vh;
  margin-left: -15vh;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  background: linear-gradient(180deg, #5a5f6b, #2b2e36);
  box-shadow: 0 -1.2vh 0 0 #8a909c inset, 0 0 0 4px #2b2b2b;
  opacity: 0;
  transform: translateY(6vh);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(.3,1.6,.5,1);
  pointer-events: none;
}
.pan .handle {
  position: absolute;
  right: -11vh;
  top: 1vh;
  width: 12vh;
  height: 2.2vh;
  border-radius: 1.1vh;
  background: #c97b3a;
  box-shadow: 0 0 0 4px #2b2b2b;
}
.pan.show { opacity: 1; transform: none; }

/* the rhyme's words: gray until said, bright while being said */
.pc-rhyme {
  position: relative;
  z-index: 3;                      /* the words stay on top of the sunburst */
  text-align: center;
  font-weight: 800;
  font-size: min(2.1rem, 4.6vh);
  line-height: 1.35;
  color: #b3ada3;
  padding: 0 16px;
}
.pc-rhyme p { margin: 0; }
.pc-rhyme span { display: inline-block; padding: 0 0.15em; border-radius: 10px; transition: color 0.2s, transform 0.2s, background 0.2s; }
.pc-rhyme span.said { color: var(--ink); }
.pc-rhyme span.now { color: #ff2e4d; background: #fff1a8; transform: scale(1.12); }

.pc-play-row { display: flex; justify-content: center; padding: 12px 0 18px; }
.pc-play-row .big-btn { border: none; cursor: pointer; font-family: inherit; min-width: 220px; }
.pc-play-row .big-btn:disabled { background: #00c853; }

@media (prefers-reduced-motion: reduce) {
  .hand svg, .hand.clap, .hand.roll, .hand.pat, .hand.toss, .hand.point, .hand.cheer, .dough.round, .dough.thrown, .dough.cake,
  .pan.jump, .pc-burst.on, .pc-stage.shake, .pattycake-page.flash { animation: none; }
}

/* ---------- Storytime (adapted from Grandadio's Listen page) ---------- */

.storytime-page { overflow-y: auto; height: auto; min-height: 100dvh; }

/* the shelf on the left, Favorites on the right; one above the other when the iPad is upright */
.story-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 4vw;
  padding: 6px 32px 32px;
}
.story-left { flex: 1 1 560px; max-width: 640px; }
.story-right { flex: 0 1 380px; }
@media (orientation: portrait) {
  .story-layout { flex-direction: column; align-items: center; }
  .story-left, .story-right { width: 100%; max-width: 640px; flex: none; }
}

/* the shelf of covers: the middle book big, one each side smaller and grayer */
.carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 100 / 60;
  margin: 0 auto;
  touch-action: pan-y;
  overflow-x: clip;
}
.cover {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  aspect-ratio: 5 / 7;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  cursor: pointer;
  border: none;
  overflow: hidden;
  padding: 0.5rem 0.45rem 0.5rem 0.9rem;
  color: white;
  text-shadow: 0 2px 2px rgba(0,0,0,0.25);
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  border-radius: 6px 14px 14px 6px;
  box-shadow: inset 8px 0 0 rgba(0,0,0,0.18), inset 9px 0 0 rgba(255,255,255,0.3), 0 6px 0 rgba(0,0,0,0.18), 0 8px 16px rgba(0,0,0,0.2);
  transition: left .42s cubic-bezier(.3,.7,.2,1), width .42s cubic-bezier(.3,.7,.2,1), font-size .42s ease, opacity .35s ease, filter .42s ease;
}
.cover .t { font-weight: 800; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.cover .r { font-weight: 700; font-size: 0.7em; line-height: 1.2; opacity: 0.9; margin-top: 0.35em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cover.s0  { left: 29.5%; width: 41%; z-index: 3; font-size: 1.6rem; padding: 0.8rem 0.6rem 4.4rem 1.1rem; }
.cover.sm1 { left: 0;     width: 27%; z-index: 2; font-size: 1.05rem; filter: grayscale(0.7) brightness(0.85); opacity: 0.92; }
.cover.sp1 { left: 73%;   width: 27%; z-index: 2; font-size: 1.05rem; filter: grayscale(0.7) brightness(0.85); opacity: 0.92; }
.cover.sm2 { left: -32%;  width: 27%; z-index: 1; font-size: 1.05rem; opacity: 0; pointer-events: none; }
.cover.sp2 { left: 105%;  width: 27%; z-index: 1; font-size: 1.05rem; opacity: 0; pointer-events: none; }
.cover.sm1 .t, .cover.sp1 .t, .cover.sm2 .t, .cover.sp2 .t { -webkit-line-clamp: 5; }
.cover.s0 .r { -webkit-line-clamp: 6; font-size: 0.6em; }
/* the play button at the bottom middle of the middle book */
.cover.s0::after { content: ""; position: absolute; left: 50%; margin-left: -1.6rem; bottom: 0.9rem; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: rgba(0,0,0,0.55); }
.cover.s0::before { content: ""; position: absolute; left: 50%; margin-left: -0.35rem; bottom: 1.85rem; z-index: 1; border-left: 1.1rem solid white; border-top: 0.7rem solid transparent; border-bottom: 0.7rem solid transparent; }

/* Favorites: a stack of book spines */
.fav-label { text-align: center; color: var(--ink); font-weight: 800; font-size: 1rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0.4rem 0 0.5rem; }
.stack { display: flex; flex-direction: column; align-items: center; }
.spine {
  position: relative;
  width: 92%;
  height: 46px;
  margin: 0;
  padding: 0 2.2rem;
  border: none;
  border-radius: 3px;
  text-align: left;
  cursor: pointer;
  font-family: "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  background: var(--c);
  transform: translateX(var(--off));
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2), inset 0 2px 0 rgba(255,255,255,0.3);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.spine::before, .spine::after { content: ""; position: absolute; top: 0; bottom: 0; width: 3px; background: rgba(0,0,0,0.18); }
.spine::before { left: 5.5%; }
.spine::after { right: 5.5%; }
.spine:active { filter: brightness(0.92); }
.table-edge { width: 100%; height: 8px; border-radius: 4px; background: #c97b3a; }

/* "Jump to any story" and "Browse Storyline" */
.story-picker { margin: 1.2rem auto 0.9rem; max-width: 520px; }
.story-picker-label { display: block; font-weight: 800; font-size: 1.1rem; color: var(--ink); margin: 0 0 0.35rem 0.25rem; }
.story-select {
  width: 100%;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  background: #ffc400;
  border: none;
  border-radius: 18px;
  padding: 0.95rem 1.1rem;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
}
.browse-btn {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0.95rem 1.1rem;
  border: none;
  border-radius: 18px;
  background: #00c853;
  color: white;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
}
.browse-btn:active, .story-select:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }

/* the player: a big window over the page */
.reader { display: none; position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.75); align-items: center; justify-content: center; padding: 16px; }
.reader.open { display: flex; }
.reader-inner { width: 100%; max-width: 1100px; height: 94dvh; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: #1b1d3a; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.reader-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: #262a52; }
.reader-bar a { color: #9bc9e8; text-decoration: none; font-size: 1.5rem; padding: 4px 10px; }
.reader-close { background: #ff2e4d; color: white; border: none; border-radius: 50%; width: 52px; height: 52px; font-size: 2rem; line-height: 1; cursor: pointer; }
.reader-inner iframe { flex: 1; border: none; width: 100%; background: black; }

@media (prefers-reduced-motion: reduce) { .cover { transition: none; } }

/* the video window that floats over the puzzle table */
.pip {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 500;
  width: 340px;
  border-radius: 16px;
  overflow: hidden;
  background: #1b1d3a;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  color: white;
}
.pip[hidden] { display: none; }
.pip.big { width: 560px; }
.pip-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #262a52; cursor: move; touch-action: none; }
.pip-grip { font-size: 1.2rem; opacity: 0.7; }
.pip-title { flex: 1; font-weight: 800; }
.pip-bar button { width: 40px; height: 40px; border: none; border-radius: 50%; background: rgba(255,255,255,0.15); color: white; font-size: 1.3rem; cursor: pointer; }
.pip-bar #pip-close { background: #ff2e4d; }
.pip-choose { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.pip-choose label { font-weight: 800; font-size: 0.9rem; }
.pip-choose select, .pip-choose input { font: inherit; font-size: 1rem; padding: 10px; border-radius: 10px; border: none; min-width: 0; }
.pip-row { display: flex; gap: 6px; }
.pip-row input { flex: 1; }
.pip-row button { border: none; border-radius: 10px; padding: 0 16px; background: #00c853; color: white; font: inherit; font-weight: 800; cursor: pointer; }
.pip-error { margin: 0; color: #ffc6d0; font-size: 0.9rem; }
.pip iframe { display: none; width: 100%; aspect-ratio: 16 / 9; border: none; background: black; }
.pip.playing iframe { display: block; }
.pip.playing .pip-choose { display: none; }

/* A short message at the bottom of the screen (my-pictures.js) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 30px);
  padding: 12px 26px;
  border-radius: 999px;
  background: #2b2b2b;
  color: white;
  font-size: 1.2rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Sparkles and confetti (effects.js) ---------- */

.fx-dot, .fx-star {
  position: fixed;
  pointer-events: none;
  z-index: 80;
}
.fx-dot {
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  animation: fx-fly 0.6s ease-out forwards;
}
.fx-star {
  line-height: 1;
  transform: translate(-50%, -50%);
  animation: fx-fly 1.6s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes fx-fly {
  from { translate: 0 0; scale: 1; opacity: 1; }
  80%  { opacity: 1; }
  to   { translate: var(--dx) var(--dy); scale: 0.4; opacity: 0; }
}
/* confetti rain (Effects.confettiRain) */
.fx-rain {
  position: fixed;
  top: -30px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 85;
  animation: fx-rain 3s cubic-bezier(.3,.1,.6,1) forwards;
}
@keyframes fx-rain {
  to { transform: translate(var(--drift), 115vh) rotate(var(--spin)); }
}
@media (prefers-reduced-motion: reduce) {
  .fx-dot { animation-duration: 0.3s; }
}

/* ---------- Coming soon ---------- */

.coming-soon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.soon-icon {
  font-size: 9rem;
  animation: float 2.5s ease-in-out infinite;
  cursor: pointer;
}
@keyframes float {
  50% { transform: translateY(-18px) rotate(6deg); }
}

.coming-soon h1 { font-size: 2.6rem; margin: 12px 0 4px; }
.coming-soon p { font-size: 1.4rem; margin: 0 0 28px; }

.big-btn {
  display: inline-block;
  padding: 18px 44px;
  border-radius: 999px;
  background: #2f80ff;
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 0 rgba(0,0,0,0.2);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.big-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,0.2); }

/* Children who get dizzy from motion can turn it off in the iPad's settings */
@media (prefers-reduced-motion: reduce) {
  .soon-icon, .sound-btn.wiggle .icon, .activity-tile.wiggle .icon { animation: none; }
}

/* iPad landscape */
@media (min-width: 768px) {
  .activity-row { padding: 20px 80px; }
}

/* ---------- Butterfly Garden (the merge game) ---------- */
.merge-page { background: #e9fbd9; touch-action: none; }
.mg-garden {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 32px;
  padding: 16px 16px 16px 84px;               /* (room for the Home button on the left) */
}
/* the shelf: a column of everything in the chain, found ones bright, the rest faint */
.mg-shelf { display: flex; flex-direction: column; gap: 6px; flex: none; width: 130px; max-height: calc(100dvh - 32px); overflow: hidden; }
.mg-shelf-item {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 16px;
  background: var(--item-color); box-shadow: 0 3px 0 rgba(0,0,0,0.12);
  font-weight: 800; font-size: 14px; line-height: 1.1; color: #1b1d3a;
}
.mg-shelf-item svg { width: 44px; height: 44px; flex: none; }
.mg-shelf-item.mg-not-yet { background: rgba(255,255,255,0.6); box-shadow: none; color: #9aa7a0; }
.mg-shelf-item.mg-not-yet svg { filter: brightness(0) opacity(0.15); }
.mg-shelf-item.mg-new { animation: mg-pop 0.6s ease-out 0.9s both; }

/* the board: squares of garden soil */
.mg-board {
  display: grid; gap: 8px; padding: 10px; border-radius: 28px;
  background: #7ed957; box-shadow: 0 8px 0 #4caf32, 0 12px 24px rgba(0,0,0,0.18);
}
.mg-square {
  width: var(--size); height: var(--size); border-radius: 20px;
  background: #b9773a; box-shadow: inset 0 6px 0 rgba(0,0,0,0.12);
  position: relative;
}
.mg-item {
  position: absolute; inset: 6%; border-radius: 18px; z-index: 1;
  background: var(--item-color); box-shadow: 0 5px 0 rgba(0,0,0,0.18);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform 0.22s cubic-bezier(.3,1.4,.6,1);
  touch-action: none; cursor: grab;
}
.mg-item svg { width: 72%; height: 72%; pointer-events: none; }
.mg-word { font-weight: 800; font-size: calc(var(--size) * 0.12); color: #1b1d3a; line-height: 1; text-align: center; pointer-events: none; }
.mg-item.mg-lifted { transition: none; z-index: 10; box-shadow: 0 14px 18px rgba(0,0,0,0.25); cursor: grabbing; }
.mg-item.mg-picked { outline: 5px solid #2f80ff; outline-offset: 2px; animation: wiggle 0.5s ease-in-out; }
.mg-item.mg-merged { animation: mg-pop 0.5s ease-out; }
.mg-item.mg-hint { animation: mg-hint 0.9s ease-in-out 2; }
.mg-item.mg-float { animation: mg-float 2.4s ease-in both; pointer-events: none; }
@keyframes mg-pop {   /* pop up big, squish down wide, settle */
  0% { transform: scale(0.6); } 40% { transform: scale(1.25, 1.2); } 65% { transform: scale(1.1, 0.88); } 100% { transform: scale(1); }
}
@keyframes mg-hint { 20% { transform: rotate(-9deg); } 40% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); } }
@keyframes mg-float {
  0% { transform: none; opacity: 1; }
  30% { transform: translate(-12px, -20vh) rotate(-8deg); }
  60% { transform: translate(14px, -45vh) rotate(8deg); opacity: 0.8; }
  100% { transform: translate(-6px, -80vh) rotate(-4deg) scale(0.7); opacity: 0; }
}

/* the pouch: a big squishy button that drops a seed */
.mg-pouches { display: flex; flex-direction: column; gap: 16px; flex: none; }
.mg-pouch {
  width: 170px; height: 190px; border: none; border-radius: 32px; padding: 8px;
  background: #ffc400; box-shadow: 0 8px 0 #d99a00, 0 12px 20px rgba(0,0,0,0.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: inherit; font-weight: 800; font-size: 26px; color: #1b1d3a; cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.mg-pouch svg { width: 130px; height: 130px; }
.mg-pouch:active { transform: translateY(6px) scale(1.05, 0.94); box-shadow: 0 2px 0 #d99a00, 0 4px 8px rgba(0,0,0,0.2); }

/* a new thing's name, big in the middle of the screen for a moment */
.mg-big-word {
  position: fixed; left: 50%; top: 50%; z-index: 60; pointer-events: none;
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 40px 22px; border-radius: 36px; background: var(--item-color);
  box-shadow: 0 10px 0 rgba(0,0,0,0.15), 0 20px 40px rgba(0,0,0,0.25);
  font-weight: 900; font-size: 64px; color: #1b1d3a; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -50%) scale(0.4);
}
.mg-big-word svg { width: 200px; height: 200px; }
.mg-big-word.show { animation: mg-big 2.2s ease-out; }
@keyframes mg-big {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25%, 80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* butterflies flying across the screen (the golden butterfly party) */
.mg-flyer {
  position: fixed; left: 0; width: 90px; height: 90px; z-index: 55; pointer-events: none;
  animation: mg-fly 4s ease-in-out both;
}
.mg-flyer svg { width: 100%; height: 100%; animation: mg-flap 0.25s ease-in-out infinite alternate; }
.mg-flyer.mg-left { animation-name: mg-fly-back; }
@keyframes mg-fly {
  0% { transform: translate(-120px, 0) rotate(10deg); }
  25% { transform: translate(25vw, calc(var(--rise) * -0.6)) rotate(-8deg); }
  50% { transform: translate(50vw, var(--rise)) rotate(10deg); }
  75% { transform: translate(75vw, calc(var(--rise) * 0.3)) rotate(-8deg); }
  100% { transform: translate(calc(100vw + 120px), calc(var(--rise) * -1)) rotate(10deg); }
}
@keyframes mg-fly-back {
  0% { transform: translate(calc(100vw + 120px), 0) rotate(-10deg); }
  50% { transform: translate(50vw, var(--rise)) rotate(8deg); }
  100% { transform: translate(-120px, calc(var(--rise) * -1)) rotate(-10deg); }
}
@keyframes mg-flap { from { transform: scaleX(1); } to { transform: scaleX(0.35); } }

/* glitter: flakes and little stars that fly out, twinkle and drift down */
.mg-glitter {
  position: fixed; z-index: 58; pointer-events: none; border-radius: 1px; margin: -4px 0 0 -4px;
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation-name: mg-glitter, mg-twinkle; animation-timing-function: cubic-bezier(.2,.8,.4,1), ease-in-out;
  animation-fill-mode: forwards, none; animation-iteration-count: 1, infinite; animation-direction: normal, alternate;
}
.mg-glitter.mg-star { background: none; box-shadow: none; text-shadow: 0 0 8px #fff; line-height: 1; }
.mg-glitter.mg-rain { animation-name: mg-glitter-rain; animation-timing-function: linear; animation-iteration-count: 1; opacity: 0; }   /* (no twinkle: there are hundreds of these) */
@keyframes mg-glitter {
  0% { transform: translate(0, 0) rotate(0) scale(0.4); opacity: 1; }
  45% { transform: translate(var(--dx), var(--dy)) rotate(calc(var(--spin) * 0.5)) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + var(--fall))) rotate(var(--spin)) scale(0.6); opacity: 0; }
}
@keyframes mg-glitter-rain {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  50% { transform: translate(var(--drift), 55vh) rotate(calc(var(--spin) * 0.5)); opacity: 1; }
  100% { transform: translate(calc(var(--drift) * -0.5), 110vh) rotate(var(--spin)); opacity: 0.6; }
}
@keyframes mg-twinkle { from { filter: brightness(1); } to { filter: brightness(1.9) saturate(1.4); } }
.mg-ring-burst {
  position: fixed; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; z-index: 57; pointer-events: none;
  border: 6px solid #ffd700; box-shadow: 0 0 18px #fff3a0, inset 0 0 12px #fff;
  animation: mg-ring-burst 0.75s ease-out forwards;
}
@keyframes mg-ring-burst { from { transform: scale(0.3); opacity: 1; } to { transform: scale(var(--grow)); opacity: 0; } }
.mg-gold-flash {
  position: fixed; inset: 0; z-index: 54; pointer-events: none;
  background: radial-gradient(circle, rgba(255,240,150,0.85), rgba(255,196,0,0.35) 60%, rgba(255,196,0,0));
  animation: mg-gold-flash 1.4s ease-out forwards;
}
@keyframes mg-gold-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* start over: hold for 2 seconds while a ring fills in around the button */
.mg-start-over { right: 16px; }
.mg-start-over .mg-ring { position: absolute; inset: 0; width: 52px; height: 52px; transform: rotate(-90deg); pointer-events: none; }
.mg-ring circle { fill: none; stroke: #ff2e4d; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 145; stroke-dashoffset: 145; }
.mg-start-over.holding .mg-ring circle { stroke-dashoffset: 0; transition: stroke-dashoffset 2s linear; }

/* the iPad held upright: the board on top, the pouch and the shelf side by side underneath */
.merge-page.upright .mg-garden {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "board board" "pouch shelf";
  align-content: start; justify-items: center; padding: 84px 16px 16px; gap: 24px;
}
.merge-page.upright .mg-board { grid-area: board; }
.merge-page.upright .mg-pouches { grid-area: pouch; }
.merge-page.upright .mg-shelf { grid-area: shelf; flex-direction: row; flex-wrap: wrap; align-content: flex-start; width: auto; justify-self: stretch; }

/* ---------- Wheels (uses Collage's drawer, board and tool layout) ---------- */
.wh-go {
  height: 96px; border: none; border-radius: 24px; cursor: pointer;
  background: #00c853; box-shadow: 0 7px 0 #00933c, 0 10px 18px rgba(0,0,0,0.2);
  font: inherit; font-size: 2.4rem; font-weight: 900; color: white; text-shadow: 0 3px 0 rgba(0,0,0,0.2);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.wh-go:active { transform: translateY(5px) scale(1.04, 0.95); box-shadow: 0 2px 0 #00933c, 0 4px 8px rgba(0,0,0,0.2); }
/* The control panel: Go!, then two rows of four buttons, then a big New button at the bottom.
   (It's wider than Collage's, so the road leaves room for it: --tools.) */
.wheels-page { --tools: 224px; }
@media (orientation: landscape) {
  .wheels-page .collage-tools { flex: 0 0 var(--tools); }
  .wheels-page .collage-board canvas { width: min(calc(100vw - 268px - var(--tools)), calc((100dvh - 110px) * 4 / 3)); }
}
@media (orientation: portrait) {   /* upright: the panel goes under the road, in a row */
  .wh-controls { grid-template-columns: repeat(4, 64px); }
  .wh-new { width: 140px; height: 58px; }
}
.wh-controls { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.wh-controls .shape-btn .label { font-size: 0.7rem; }
.wh-new { height: 70px; flex-direction: row; gap: 10px; background: #ffc400; box-shadow: 0 5px 0 #d49c00; }
.wh-new .icon { font-size: 1.9rem; }
.wh-new .label { font-size: 1.4rem; font-weight: 900; }
/* On a phone, Wheels and Collage don't always fit on the screen: then the page scrolls,
   so every button (like New at the bottom) can still be reached. */
@media (max-width: 760px), (max-height: 500px) {
  body.wheels-page, body.collage-page { height: auto; min-height: 100dvh; overflow-y: auto; }
}
/* A phone held sideways: Wheels' buttons get smaller so they all fit beside the road. */
@media (orientation: landscape) and (max-height: 500px) {
  .wheels-page .wh-go { height: 52px; font-size: 1.6rem; }
  .wheels-page .collage-hint { display: none; }
  .wheels-page { --tools: 168px; }
  .wheels-page .shape-btn { height: 44px; min-width: 0; }
  .wheels-page .wh-controls .shape-btn .label { font-size: 0.55rem; }
  .wheels-page .wh-new { height: 50px; }
  .wheels-page .wh-new .label { font-size: 1.1rem; }
  .wheels-page .shape-btn .icon { font-size: 1.1rem; }
  .wheels-page .collage-tools { gap: 8px; }
}
.wh-go.going { animation: wh-go 0.5s ease-in-out infinite alternate; }
@keyframes wh-go { to { transform: scale(1.06); background: #2fe07a; } }
/* a puff of spray paint */
.wh-mist {
  position: fixed; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; z-index: 60; pointer-events: none;
  opacity: 0.8; animation: wh-mist 0.6s ease-out forwards;
}
@keyframes wh-mist { to { transform: translate(var(--dx), var(--dy)) scale(2.4); opacity: 0; } }
/* the drawers: tabs on top (4 across, 2 down), then the open drawer's parts */
.wh-drawer { flex: 0 0 auto; width: 178px; display: flex; flex-direction: column; gap: 6px; }
/* the building steps across the top of the screen (between Home and Share), with arrows between them */
.wh-tabs {
  position: fixed; top: 12px; left: 84px; right: 84px; z-index: 40;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.wh-tab {
  flex: 0 1 92px; min-width: 0; height: 60px; border: none; border-radius: 14px; padding: 2px 4px; cursor: pointer;
  background: white; box-shadow: 0 3px 0 rgba(0,0,0,0.14);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: transform 0.08s ease;
}
.wh-tab .icon { font-size: 1.5rem; line-height: 1; }
.wh-tab .word { font-size: 0.72rem; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wh-tab:active { transform: translateY(2px); }
.wh-tab.chosen { background: #2f80ff; }
.wh-tab.chosen .word { color: white; }
.wh-tab.next { animation: wh-next 1s ease-in-out infinite alternate; }   /* the next step to try glows */
.wh-arrow { flex: 0 0 auto; font-size: 1.2rem; font-weight: 900; color: #9aa0aa; }
@keyframes wh-next { to { box-shadow: 0 0 0 4px #ffc400, 0 3px 0 rgba(0,0,0,0.14); transform: scale(1.06); } }
.wh-drawer-name { margin: 2px 0 0; font-size: 1.05rem; color: var(--ink); }
.wh-drawer-sub { display: block; font-size: 0.8rem; font-weight: 700; color: #6b6f80; }   /* Rocket's Famous drawer: "Choose one, or build your own" */
.mat.own { background: #ffe680; }   /* its Build Your Own button */
.wh-drawer .materials { height: calc(100dvh - 110px - 34px); width: auto; }
/* the spray can that follows a painting finger */
.wh-can { position: fixed; width: 54px; height: 99px; z-index: 61; pointer-events: none; transform: rotate(-12deg); animation: wh-can-in 0.15s ease-out; }
.wh-can svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
.wh-can.away { opacity: 0; transform: rotate(-12deg) scale(0.6); transition: opacity 0.25s, transform 0.25s; }
@keyframes wh-can-in { from { transform: rotate(-12deg) scale(0.4); opacity: 0; } }
.wh-mist { width: 9px; height: 9px; margin: -4px 0 0 -4px; }

@media (orientation: portrait) {
  .wh-go { height: 64px; width: 140px; font-size: 1.8rem; }
  .wh-drawer { order: 2; width: calc(100vw - 32px); }
  .wh-tabs { gap: 2px; }
  .wh-tab { height: 54px; padding: 2px 1px; }
  .wh-tab .icon { font-size: 1.25rem; }
  .wh-tab .word { font-size: 0.6rem; }
  .wh-arrow { font-size: 0.9rem; }
  .wh-drawer .materials { height: auto; width: calc(100vw - 32px); }
}

/* Puzzle: the X that removes an unfinished puzzle (tap twice) */
.pick-card { position: relative; }
.pz-remove {
  position: absolute; top: -8px; right: -8px; z-index: 2; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: #6b6458; font-size: 1.5rem; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.pz-remove.sure { background: #ff2e4d; color: #fff; font-size: 0.85rem; }

/* Puzzle, playing: small buttons on the left (under Home), the table, and the pieces on the right; all full height.
   The table runs from the top of the screen to the bottom (LEFT and SIDE_EXTRA in puzzle.js match these widths; puzzle.js sets the tray as wide as one piece). */
.pz-play { gap: 10px; justify-content: flex-start; padding: 0 8px; }
.pz-left { flex: 0 0 60px; align-self: stretch; display: flex; flex-direction: column; gap: 10px; padding: 78px 0 10px; box-sizing: border-box; }
.pz-left .pz-btns .tool-btn { width: 60px; height: 56px; flex-direction: column; gap: 0; padding: 0; }
.pz-left .pz-btns .tool-btn .icon { font-size: 1.35rem; }
.pz-left .pz-btns .tool-btn .label { font-size: 0.66rem; }
.pz-left .pz-credit { margin-top: auto; font-size: 0.6rem; text-align: left; overflow-wrap: anywhere; }
.pz-side { flex: 0 0 112px; height: 100dvh; padding: 76px 0 8px; box-sizing: border-box; }   /* (the tray starts below the Back button) */
.pz-tray { padding: 8px 6px; border-radius: 16px; }
.pz-status {   /* a message bubble over the table, for a few seconds */
  position: fixed; top: 22px; left: 50%; transform: translate(-50%, -10px); z-index: 40; pointer-events: none;
  max-width: 60vw; min-height: 0; padding: 10px 22px; border-radius: 24px;
  background: rgba(255,255,255,0.95); box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  opacity: 0; transition: opacity 0.4s ease, transform 0.4s ease;
}
.pz-status.show { opacity: 1; transform: translate(-50%, 0); }
.pz-whole { position: absolute; z-index: 5000; pointer-events: none; opacity: 0; transition: opacity 1.6s ease; }   /* the finished picture, fading in over the pieces */
.pz-whole.show { opacity: 1; }

/* ---------- Whack ---------- */
.whack-page { background: linear-gradient(#7cd3ff 0, #bfe9ff 90px, #7ed957 90px, #5cc23c 100%); touch-action: none; }
.wk-sky { position: fixed; left: 0; right: 0; top: 0; height: 90px; pointer-events: none; }
.wk-sun { position: absolute; right: 90px; top: 14px; width: 60px; height: 60px; border-radius: 50%; background: #ffd84a; box-shadow: 0 0 30px #fff3a0; }
.wk-cloud { position: absolute; width: 110px; height: 34px; border-radius: 20px; background: white; opacity: 0.9; }
.wk-cloud::before, .wk-cloud::after { content: ""; position: absolute; background: white; border-radius: 50%; }
.wk-cloud::before { width: 50px; height: 50px; left: 18px; top: -24px; }
.wk-cloud::after { width: 40px; height: 40px; left: 56px; top: -16px; }
.wk-field { flex: 1; display: grid; justify-content: center; align-content: center; gap: 0 2vw; padding: 92px 16px 8px; }
.wk-hole { position: relative; width: var(--cell); height: var(--cell); }
.wk-pit { position: absolute; left: 6%; width: 88%; bottom: 8%; }
.wk-lip { position: absolute; left: 6%; width: 88%; bottom: 8%; pointer-events: none; z-index: 3; }
/* the animal hides below the hole's middle and pops up out of it */
.wk-window { position: absolute; left: 14%; width: 72%; bottom: 25%; height: 72%; overflow: hidden; z-index: 2; }
.wk-animal { position: absolute; inset: 0; transform: translateY(105%); transition: transform 0.28s cubic-bezier(.3,1.5,.6,1); }
.wk-animal svg { width: 100%; height: 100%; }
.wk-hole.up .wk-animal { transform: translateY(0); }
.wk-animal.bonked svg { animation: wk-bonk 0.5s ease-out; transform-origin: 50% 100%; }
@keyframes wk-bonk { 0% { transform: scale(1.1, 0.6); } 40% { transform: scale(0.9, 1.08); } 100% { transform: scale(1); } }
.wk-dizzy { position: absolute; left: 50%; top: 14%; width: 0; height: 0; z-index: 5; pointer-events: none; animation: wk-spin 0.8s linear; }
.wk-dizzy span { position: absolute; color: #ffc400; font-size: calc(var(--cell) * 0.09); text-shadow: 0 0 6px #fff; margin: -0.5em; }
.wk-dizzy span:nth-child(1) { transform: translate(0, -40px); } .wk-dizzy span:nth-child(2) { transform: translate(36px, 20px); } .wk-dizzy span:nth-child(3) { transform: translate(-36px, 20px); }
@keyframes wk-spin { from { transform: rotate(0); opacity: 1; } to { transform: rotate(360deg); opacity: 0; } }
/* the foam mallet: it swings down where the finger taps */
.wk-mallet { position: fixed; width: 120px; height: 140px; margin: -150px 0 0 -10px; z-index: 60; pointer-events: none; transform-origin: 50% 100%; animation: wk-swing 0.4s ease-out forwards; }
.wk-mallet svg { width: 100%; height: 100%; }
@keyframes wk-swing { 0% { transform: rotate(-55deg); } 35% { transform: rotate(18deg); } 60% { transform: rotate(8deg); opacity: 1; } 100% { transform: rotate(8deg); opacity: 0; } }
.wk-dirt { position: fixed; width: 10px; height: 10px; margin: -5px; border-radius: 50%; z-index: 59; pointer-events: none; animation: wk-dirt 0.55s ease-out forwards; }
@keyframes wk-dirt { 50% { transform: translate(calc(var(--dx) * 0.6), var(--up)); } 100% { transform: translate(var(--dx), 10px); opacity: 0; } }
/* celebrations */
.wk-confetti { position: fixed; width: 12px; height: 18px; margin: -9px 0 0 -6px; z-index: 58; pointer-events: none; animation: wk-confetti 1.5s ease-out forwards; }
@keyframes wk-confetti {
  30% { transform: translate(calc(var(--dx) * 0.5), var(--up)) rotate(calc(var(--spin) * 0.3)); }
  100% { transform: translate(var(--dx), 260px) rotate(var(--spin)); opacity: 0; }
}
.wk-glitter {
  position: fixed; width: 7px; height: 7px; margin: -3px; border-radius: 2px; z-index: 58; pointer-events: none; box-shadow: 0 0 6px #fff;
  animation-name: wk-glitter, wk-twinkle; animation-timing-function: cubic-bezier(.2,.8,.4,1), ease-in-out;
  animation-fill-mode: forwards, none; animation-iteration-count: 1, infinite; animation-direction: normal, alternate;
}
@keyframes wk-glitter { 45% { transform: translate(calc(var(--dx) * 0.6), var(--up)); } 100% { transform: translate(var(--dx), calc(var(--up) * 0.2 + 120px)); opacity: 0; } }
@keyframes wk-twinkle { to { filter: brightness(1.9); } }
/* the skunk's stink: grey-green clouds, wavy lines and a hazy screen */
.wk-stink {
  position: fixed; width: var(--size); height: var(--size); margin: calc(var(--size) / -2); border-radius: 50%; z-index: 58; pointer-events: none;
  background: radial-gradient(circle at 40% 40%, rgba(196,204,180,0.95), rgba(140,150,120,0.75) 60%, rgba(140,150,120,0));
  opacity: 0; animation: wk-stink 2.4s ease-out forwards;
}
@keyframes wk-stink { 15% { opacity: 1; } 100% { transform: translate(var(--dx), var(--up)) scale(2); opacity: 0; } }
.wk-stinkline { position: fixed; z-index: 59; pointer-events: none; font-size: 54px; font-weight: 900; color: #6f7a55; opacity: 0; animation: wk-stinkline 2s ease-out forwards; }
@keyframes wk-stinkline { 20% { opacity: 1; } 100% { transform: translateY(-140px) rotate(10deg); opacity: 0; } }
.wk-haze { position: fixed; inset: 0; z-index: 57; pointer-events: none; background: rgba(150,160,120,0.45); animation: wk-haze 2s ease-out forwards; }
@keyframes wk-haze { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Rocket (uses Wheels' layout: building steps on top, drawer, launch pad, tools) ---------- */
.rk-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (orientation: portrait) { .rk-controls { grid-template-columns: repeat(3, 64px); } }
.rk-controls .shape-btn .label { font-size: 0.78rem; }
/* Go!: the mission picker, over everything */
.rk-picker, .rk-mission-view { position: fixed; inset: 0; z-index: 70; background: #05061a; }
.rk-picker[hidden], .rk-mission-view[hidden], .rk-done[hidden] { display: none; }
.rk-picker {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh; padding: 70px 16px 24px;
  background: radial-gradient(ellipse at 50% 30%, #1d2560 0%, #05061a 70%); overflow-y: auto;
}
.rk-title { margin: 0; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 900; color: #ffd84a; text-align: center; text-shadow: 0 4px 0 rgba(0,0,0,0.35); }
.rk-missions { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.rk-mission {
  position: relative; width: 196px; border: none; border-radius: 28px; padding: 14px 14px 12px; cursor: pointer; background: #ffffff;
  display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 8px 0 rgba(0,0,0,0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.rk-mission:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.rk-pic { display: block; width: 168px; height: 121px; border-radius: 18px; overflow: hidden; background: #05061a; }
.rk-pic canvas { display: block; width: 100%; height: 100%; }
.rk-mission .label { font-size: 1.5rem; font-weight: 900; color: var(--ink); }
/* a far planet the rocket isn't big enough for yet: dimmed, with a lock (tapping it says to add boosters) */
.rk-lock { display: none; position: absolute; left: 10px; right: 10px; top: 54px; padding: 6px 4px; border-radius: 12px; background: rgba(27,29,58,0.85); color: #ffd84a; font-size: 0.85rem; font-weight: 800; }
.rk-mission.locked .rk-lock { display: block; }
.rk-mission.locked .rk-pic { opacity: 0.45; }
/* the mission, on the whole screen */
.rk-mission-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rk-close { position: absolute; top: 12px; left: 12px; z-index: 2; }
.rk-picker .rk-close { position: fixed; }
.rk-done {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh;
  background: rgba(5,6,26,0.55); animation: rk-done-in 0.5s ease-out;
}
@keyframes rk-done-in { from { opacity: 0; transform: scale(0.9); } }
.rk-done-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.rk-big {
  width: 200px; height: 150px; border: none; border-radius: 28px; cursor: pointer; background: #00c853; box-shadow: 0 8px 0 #00933c;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.rk-big.build { background: #ffc400; box-shadow: 0 8px 0 #d49c00; }
.rk-big .icon { font-size: 3.4rem; line-height: 1; }
.rk-big .label { font-size: 1.5rem; font-weight: 900; color: white; text-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.rk-big.build .label { color: var(--ink); text-shadow: none; }
.rk-big:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
/* a phone held sideways: smaller mission buttons, so all three fit across */
@media (max-height: 500px) {
  .rk-picker { gap: 10px; padding-top: 14px; }
  .rk-missions { gap: 10px; }
  .rk-mission { width: 132px; padding: 8px; border-radius: 20px; }
  .rk-pic { width: 116px; height: 84px; border-radius: 12px; }
  .rk-mission .label { font-size: 1.1rem; }
  .rk-lock { top: 30px; font-size: 0.7rem; }
  .rk-big { width: 160px; height: 110px; }
}

/* ---------- Engines (uses Wheels' layout while building; then the whole screen to play, with the controller) ---------- */
.en-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.en-play { position: fixed; inset: 0; z-index: 70; background: #7cc8ff; touch-action: none; }
.en-play[hidden] { display: none; }
.en-play.en-tilting { animation: en-in 0.35s ease-out; }
@keyframes en-in { from { opacity: 0.4; } }
.en-play canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.en-build { position: absolute; top: 12px; left: 12px; z-index: 2; }
.en-play-hint { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); margin: 0; max-width: 70vw; text-align: center;
  font-size: 1.3rem; font-weight: 800; color: #1b1d3a; text-shadow: 0 2px 0 rgba(255,255,255,0.7); pointer-events: none; }
/* the controller: big buttons along the bottom, for small hands */
.en-controller { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: stretch; gap: 14px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(27,29,58,0), rgba(27,29,58,0.35));
  transition: opacity 0.4s, transform 0.4s; }
.en-controller { flex-wrap: wrap; }
/* the engine picker: a row of engines above the controller, the one being driven lifted and ringed in yellow */
.en-engines { flex-basis: 100%; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.en-engines[hidden] { display: none; }
.en-pick { position: relative; border: none; border-radius: 16px; padding: 3px; background: #ffffff; cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease; }
.en-play .en-pick canvas { position: static; display: block; width: 96px; height: 45px; border-radius: 12px; }
.en-pick.on { box-shadow: 0 0 0 5px #ffd84a, 0 8px 0 rgba(0,0,0,0.3); transform: translateY(-4px); }
.en-pick.going::after { content: ""; position: absolute; top: 5px; right: 5px; width: 12px; height: 12px; border-radius: 50%; background: #00c853;
  box-shadow: 0 0 0 2px #ffffff; }
.en-play:not(.en-ready) .en-controller { opacity: 0; transform: translateY(40px); pointer-events: none; }
.en-ctl { border: none; border-radius: 26px; min-width: 112px; height: 104px; padding: 6px 10px; cursor: pointer; background: #ffffff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: 0 7px 0 rgba(0,0,0,0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s; font-family: inherit; align-self: center; }
.en-ctl:active { transform: translateY(5px) scale(1.04, 0.95); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.en-ctl .icon { font-size: 2.6rem; line-height: 1; }
.en-ctl .label { font-size: 1rem; font-weight: 900; color: #1b1d3a; }
.en-sw { min-width: 104px; background: #ffd84a; }
.en-coupler { background: #ff9ec7; margin-right: 12px; }
.en-whistle { background: #8fd3ff; margin-left: 12px; }   /* (balances the coupler on the other side) */
/* the throttle: a lever with five notches. Tap above the handle to push it up a notch, below to pull it down, or slide it. */
.en-throttle { --step: 30px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px; border-radius: 26px;
  background: #ffffff; box-shadow: 0 7px 0 rgba(0,0,0,0.3); touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
.en-word { font-size: 0.95rem; font-weight: 900; }
.en-up { color: #00933c; } .en-down { color: #c25e00; }
.en-slot { position: relative; width: 120px; height: calc(var(--step) * 5); border-radius: 18px;
  background: linear-gradient(#c9f5d9, #f2f4f7 40%, #f2f4f7 60%, #ffe0c2); }
.en-mark { position: absolute; left: 8px; top: calc(var(--step) * (2 - var(--n)) + var(--step) / 2); transform: translateY(-50%);
  font-size: 1.05rem; font-weight: 900; color: #5b5f6b; letter-spacing: -3px; }
.en-mark.stop { color: #d8262f; letter-spacing: 0; font-size: 0.85rem; }
.en-knob { position: absolute; right: 8px; width: 54px; height: calc(var(--step) - 4px); border-radius: 12px; background: #1b1d3a;
  top: calc(var(--step) * (2 - var(--pos, 0)) + 2px); transition: top 0.18s ease, background 0.15s; box-shadow: 0 3px 0 rgba(0,0,0,0.35); }
.en-knob::after { content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: #ffd84a; }
.en-throttle.fwd .en-knob { background: #00c853; } .en-throttle.rev .en-knob { background: #ff7a00; }
@media (max-height: 500px), (max-width: 760px) {   /* phones: smaller buttons */
  .en-controller { gap: 8px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .en-ctl { min-width: 70px; height: 70px; border-radius: 18px; }
  .en-play .en-pick canvas { width: 70px; height: 33px; }
  .en-sw { min-width: 66px; }
  .en-ctl .icon { font-size: 1.7rem; }
  .en-ctl .label { font-size: 0.68rem; }
  .en-throttle { --step: 19px; padding: 3px 8px; border-radius: 18px; gap: 0; }
  .en-word { font-size: 0.62rem; }
  .en-slot { width: 86px; border-radius: 12px; }
  .en-mark { font-size: 0.6rem; }
  .en-knob { width: 40px; border-radius: 8px; }
}
}

/* ---------- Worship Songs (the worship songs from Grandadio: big song cards, and a song playing on the whole screen) ---------- */
.worship-page { min-height: 100dvh; background: radial-gradient(ellipse at 50% 20%, #fff3d6 0%, #ffe3ef 60%, #e3ecff 100%); }
.ws-stage { max-width: 1100px; margin: 0 auto; padding: 84px 16px 40px; text-align: center; }
.ws-title { margin: 0 0 28px; font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 900; color: #a03cff; text-shadow: 0 4px 0 rgba(160,60,255,0.18); }
.ws-songs { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.ws-song { width: 240px; min-height: 200px; border: none; border-radius: 30px; padding: 18px 14px; cursor: pointer; background: var(--song-color);
  color: #ffffff; font-family: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.22); transition: transform 0.08s ease, box-shadow 0.08s ease; }
.ws-song:active { transform: translateY(6px) scale(1.04, 0.95); box-shadow: 0 2px 0 rgba(0,0,0,0.22); }
.ws-song .icon { font-size: 4rem; line-height: 1; }
.ws-song .name { font-size: 1.45rem; font-weight: 900; line-height: 1.1; text-shadow: 0 2px 0 rgba(0,0,0,0.2); }
.ws-song .by { font-size: 0.9rem; font-weight: 700; opacity: 0.92; }
.ws-player { position: fixed; inset: 0; z-index: 70; background: #05061a; }
.ws-player[hidden] { display: none; }
.ws-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.ws-close { position: absolute; top: 12px; left: 12px; z-index: 2; }
@media (max-height: 500px), (max-width: 600px) {   /* phones: smaller cards */
  .ws-stage { padding-top: 70px; }
  .ws-title { margin-bottom: 16px; }
  .ws-song { width: 170px; min-height: 140px; border-radius: 22px; }
  .ws-song .icon { font-size: 2.8rem; }
  .ws-song .name { font-size: 1.1rem; }
  .ws-song .by { font-size: 0.75rem; }
}

/* ---------- the family login, shared with Grandad.io (family.js) ---------- */
/* The button beside the language switch: "Family" for a grown-up to log in, or the playing child's
   picture and name in their color (a 2-second hold, while the ring fills, opens the grown-ups' menu). */
.lang-bar { gap: 14px; align-items: center; }
.fam-chip {
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 4px 16px 4px 6px;
  border: none; border-radius: 999px;
  background: #d9ecf8; color: #1b1d3a;
  font: 700 18px/1 "Baloo 2", system-ui, sans-serif;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15);
  cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform 0.1s;
}
.fam-chip:active { transform: scale(0.95); }
.fam-chip[data-state="out"] { padding-left: 14px; font-size: 16px; opacity: 0.85; }
.fam-chip.holding { box-shadow: 0 0 0 5px #ffc400; transition: box-shadow 2s linear; }
.fam-icon { font-size: 22px; }
.fam-pic { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.7); overflow: hidden; display: flex; }
.fam-pic svg { width: 100%; height: 100%; }
.fam-dialog {
  border: none; border-radius: 28px; padding: 24px 28px; max-width: min(560px, calc(100vw - 32px));
  background: #fffaf0; color: #1b1d3a; text-align: center;
  font: 18px/1.4 "Baloo 2", system-ui, sans-serif;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.fam-dialog::backdrop { background: rgba(20,20,60,0.45); }
.fam-dialog h2 { margin: 0 0 8px; font-size: 30px; }
.fam-note { margin: 0 0 14px; color: #5a5470; }
.fam-form { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.fam-field { font: inherit; padding: 12px 16px; border: 3px solid #9bc9e8; border-radius: 16px; }
.fam-btn {
  display: block; width: 100%; margin: 8px 0 0; padding: 12px 20px;
  border: none; border-radius: 18px; background: #2f80ff; color: white;
  font: 700 20px/1.2 "Baloo 2", system-ui, sans-serif; box-shadow: 0 4px 0 #1b5ec7; cursor: pointer;
}
.fam-btn:disabled { opacity: 0.6; }
.fam-soft { background: #e8e4f0; color: #1b1d3a; box-shadow: 0 4px 0 #c4bed4; }
.fam-error { color: #e8262f; margin: 4px 0 0; }
.fam-close { margin-top: 16px; background: none; border: none; color: #5a5470; font: inherit; text-decoration: underline; cursor: pointer; padding: 8px; }
.fam-who { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 8px; }
.fam-person {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 140px; padding: 14px 10px; border: none; border-radius: 24px; color: #1b1d3a;
  font: 700 22px/1.1 "Baloo 2", system-ui, sans-serif; box-shadow: 0 5px 0 rgba(0,0,0,0.18); cursor: pointer;
}
.fam-person:active { transform: scale(0.95); }
.fam-person .fam-pic { width: 90px; height: 90px; }

/* ---------- Christmas: the big gift on the homepage (christmas-dates.js) ---------- */
/* First in the tile row from Thanksgiving to Three Kings Day; its bow sticks up above the other tiles. */
.activity-row.has-gift { padding-top: 96px; padding-bottom: 40px; }
.xmas-gift {
  scroll-snap-align: center;
  flex: 0 0 auto; position: relative;
  width: 250px; height: 220px; margin-right: 8px;
  border-radius: 14px;
  /* red paper with a gold ribbon both ways, and a few white dots */
  background:
    linear-gradient(90deg, transparent 43%, #ffc400 43%, #ffc400 57%, transparent 57%),
    linear-gradient(transparent 50%, #ffc400 50%, #ffc400 62%, transparent 62%),
    radial-gradient(circle, rgba(255,255,255,0.35) 5px, transparent 6px) 0 0 / 38px 38px,
    #e8262f;
  box-shadow: 0 8px 0 rgba(0,0,0,0.18);
  display: flex; align-items: flex-end; justify-content: center;
  text-decoration: none; cursor: pointer;
  transition: transform 0.08s ease;
}
.xmas-gift.pressed { transform: scale(0.95); }
.xmas-gift .xg-box { position: absolute; inset: 0; }
.xmas-gift .xg-lid {   /* the lid: a little wider than the box */
  position: absolute; left: -10px; right: -10px; top: -6px; height: 52px; border-radius: 10px;
  background: linear-gradient(90deg, transparent 43%, #ffc400 43%, #ffc400 57%, transparent 57%), #ff3b45;
  box-shadow: 0 5px 0 rgba(0,0,0,0.15);
}
.xmas-gift .xg-bow { position: absolute; left: 50%; top: -84px; width: 160px; margin-left: -80px; color: #ffc400; transform-origin: 50% 100%; }
.xmas-gift .xg-bow svg { display: block; width: 100%; }
.xmas-gift .label {
  position: relative; margin-bottom: 14px;
  font: 800 32px/1 "Baloo 2", system-ui, sans-serif; color: #fff;
  -webkit-text-stroke: 7px #7a1016; paint-order: stroke fill;
}
.xmas-gift:not(.shake) .xg-bow { animation: xg-bow 2.6s ease-in-out infinite; }
@keyframes xg-bow { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(4deg) scale(1.04); } }
.xmas-gift.shake { animation: xg-shake 0.7s ease; }
@keyframes xg-shake {
  0%, 100% { transform: rotate(0); } 15% { transform: rotate(-7deg) translateY(-6px); } 30% { transform: rotate(6deg); }
  45% { transform: rotate(-5deg) translateY(-4px); } 60% { transform: rotate(4deg); } 80% { transform: rotate(-2deg); }
}
.xmas-gift.opening .xg-lid, .xmas-gift.opening .xg-bow { transition: transform 0.6s ease-in, opacity 0.6s; transform: translateY(-160px) rotate(-25deg); opacity: 0; }

/* ---------- Christmas Calendar (christmas.html + christmas.js + christmas-gifts.js) ---------- */
.xmas-page {
  min-height: 100vh; height: 100vh; margin: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, #2c3a8c 0%, #1b1d4f 55%, #12133a 100%);
  font-family: "Baloo 2", system-ui, sans-serif; color: #fff;
}
.xc-who { position: fixed; top: 16px; right: 16px; z-index: 50; cursor: default; }
.xc-who[hidden] { display: none; }
/* the star of Bethlehem and the sign under it */
.xc-top { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.xc-star { width: 96px; height: 96px; filter: drop-shadow(0 0 18px #ffd23f); animation: xc-star 3s ease-in-out infinite; }
@keyframes xc-star { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(4deg); } }
.xc-sign {
  margin-top: -8px; padding: 4px 22px; border-radius: 999px;
  background: #e8262f; border: 4px solid #ffc400; box-shadow: 0 4px 0 rgba(0,0,0,0.3);
  font-weight: 800; font-size: 26px; line-height: 1.2; display: flex; align-items: center; gap: 10px;
}
.xc-sign[hidden] { display: none; }
.xc-sign .xc-num { font-size: 36px; color: #ffc400; }
.xc-top.christmas .xc-sign { background: #00a65a; }
/* the calendar: 7 days across, the rows share the rest of the screen */
.xc-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(var(--rows, 5), 1fr);
  gap: 8px; padding: 10px 60px 16px;
}
.xc-wday { text-align: center; font-weight: 700; font-size: 16px; color: #9bc9e8; }
.xc-cell {
  position: relative; min-height: 0; padding: 0;
  border: none; border-radius: 14px;
  background: rgba(255,255,255,0.1); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: visible;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.xc-cell:active { transform: scale(0.96); }
.xc-day { position: absolute; top: 3px; left: 8px; z-index: 2; font-weight: 800; font-size: 17px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.5); }
.xc-cell.today { background: rgba(255,210,63,0.25); box-shadow: inset 0 0 0 3px #ffd23f, 0 0 18px rgba(255,210,63,0.7); }
.xc-cell.today:not(.opened) .xc-pkg { animation: xc-hop 1.6s ease-in-out infinite; }
@keyframes xc-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-8px) rotate(-3deg); } 90% { transform: translateY(0) rotate(2deg); } }
.xc-cell.shake .xc-pkg { animation: xg-shake 0.6s ease; }
/* a wrapped present: paper, ribbon both ways, a lid and a bow */
.xc-pkg {
  position: relative; width: 62%; height: 54%; margin-top: 14%; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 42%, var(--ribbon) 42%, var(--ribbon) 58%, transparent 58%),
    linear-gradient(transparent 44%, var(--ribbon) 44%, var(--ribbon) 58%, transparent 58%),
    var(--paper);
  box-shadow: 0 4px 0 rgba(0,0,0,0.25);
}
.xc-pkg.dots { background:
    linear-gradient(90deg, transparent 42%, var(--ribbon) 42%, var(--ribbon) 58%, transparent 58%),
    linear-gradient(transparent 44%, var(--ribbon) 44%, var(--ribbon) 58%, transparent 58%),
    radial-gradient(circle, rgba(255,255,255,0.55) 3px, transparent 4px) 0 0 / 16px 16px, var(--paper); }
.xc-pkg.stripes { background:
    linear-gradient(90deg, transparent 42%, var(--ribbon) 42%, var(--ribbon) 58%, transparent 58%),
    linear-gradient(transparent 44%, var(--ribbon) 44%, var(--ribbon) 58%, transparent 58%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.3) 0 6px, transparent 6px 14px), var(--paper); }
.xc-pkg.stars { background:
    linear-gradient(90deg, transparent 42%, var(--ribbon) 42%, var(--ribbon) 58%, transparent 58%),
    linear-gradient(transparent 44%, var(--ribbon) 44%, var(--ribbon) 58%, transparent 58%),
    radial-gradient(circle, #fff6c8 2px, transparent 3px) 0 0 / 12px 12px, radial-gradient(circle, rgba(255,255,255,0.4) 1.5px, transparent 2.5px) 6px 6px / 12px 12px, var(--paper); }
.xc-lid {
  position: absolute; left: -7%; right: -7%; top: -10%; height: 26%; border-radius: 5px;
  background: linear-gradient(90deg, transparent 42%, var(--ribbon) 42%, var(--ribbon) 58%, transparent 58%), var(--paper);
  filter: brightness(1.1); box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}
.xc-bow { position: absolute; left: 50%; bottom: 70%; width: 60%; transform: translateX(-50%); color: var(--ribbon); }
.xc-bow svg { display: block; width: 100%; }
.xc-pkg.opening .xc-lid { transition: transform 0.5s ease-in, opacity 0.5s; transform: translateY(-120%) rotate(-30deg); opacity: 0; }
.xc-pkg.opening { animation: xc-open 0.55s ease; }
@keyframes xc-open { 0% { transform: scale(1); } 40% { transform: scale(1.15, 0.85); } 100% { transform: scale(0.2); opacity: 0; } }
/* Christmas Day's present is gold and glows */
.xc-cell.s-nativity { background: rgba(255,196,0,0.18); box-shadow: inset 0 0 0 3px #ffc400, 0 0 22px rgba(255,196,0,0.6); }
.xc-cell.s-nativity .xc-pkg { width: 70%; height: 60%; box-shadow: 0 0 18px #ffd23f, 0 4px 0 rgba(0,0,0,0.25); }
/* inside an opened square */
.xc-inside { position: absolute; inset: 6px; display: flex; align-items: center; justify-content: center; animation: xc-pop 0.5s cubic-bezier(.3,1.6,.5,1); }
.xc-cell.opened { background: radial-gradient(circle, #fff 0%, #fff6d8 100%); box-shadow: inset 0 0 0 4px var(--paper); }
.xc-cell.opened .xc-day { color: var(--paper); text-shadow: none; -webkit-text-stroke: 0; filter: brightness(0.85); }
.xc-cell.opened.special .xc-day { color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.6); filter: none; }
.xc-icon { font-size: min(8.5vh, 8vw); line-height: 1; margin-top: 8px; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.2)); }
.xc-inside .xc-scene { width: 100%; height: 100%; border-radius: 10px; }
.xc-cell.opened.special .xc-inside { inset: 3px; }
@keyframes xc-pop { 0% { transform: scale(0.2); } 100% { transform: scale(1); } }
/* the present, big */
.xc-big {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10,10,40,0.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  opacity: 0; transition: opacity 0.25s;
}
.xc-big[hidden] { display: none; }
.xc-big.show { opacity: 1; }
.xc-big-card {
  border: none; padding: 0; cursor: pointer;
  width: min(54vh, 60vw); height: min(54vh, 60vw); border-radius: 36px;
  background: radial-gradient(circle, #fff 0%, #fff6c8 60%, #ffd23f 100%);
  box-shadow: 0 0 0 8px #ffc400, 0 0 60px rgba(255,210,63,0.8);
  display: flex; align-items: center; justify-content: center;
  transform: scale(0.3); transition: transform 0.45s cubic-bezier(.3,1.6,.5,1);
}
.xc-big.show .xc-big-card { transform: scale(1); }
.xc-big.scene .xc-big-card { width: min(84vw, 100vh); height: min(63vw, 75vh); background: #1b1d4f; overflow: hidden; }
.xc-big.s-nativity .xc-big-card { box-shadow: 0 0 0 8px #ffc400, 0 0 120px 30px rgba(255,210,63,0.9); }
.xc-big-card .xc-scene { width: 100%; height: 100%; display: block; }
.xc-big-card.wiggle .xc-big-icon { animation: wiggle 0.5s ease; }
.xc-big-icon { font-size: min(34vh, 38vw); line-height: 1; display: inline-block; }
.xc-big-word { font-weight: 800; font-size: 44px; color: #fff; -webkit-text-stroke: 8px #1b1d4f; paint-order: stroke fill; }
.xc-close {
  position: fixed; top: 16px; right: 16px; width: 56px; height: 56px; border-radius: 50%; border: none;
  background: #fff; color: #1b1d3a; font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,0.25); cursor: pointer;
}
/* things in the big pictures that move */
.xc-scene .tw { animation: xc-tw 1.8s ease-in-out infinite; }
@keyframes xc-tw { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
.xc-scene .glow { animation: xc-glow 2.4s ease-in-out infinite; }
@keyframes xc-glow { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.xc-scene .rays { animation: xc-rays 30s linear infinite; }
@keyframes xc-rays { to { transform: rotate(360deg); } }
.xc-scene .bob { animation: xc-bob 2.2s ease-in-out infinite; }
@keyframes xc-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.xc-scene .flick { animation: xc-flick 0.9s ease-in-out infinite; }
@keyframes xc-flick { 0%, 100% { opacity: 1; } 40% { opacity: 0.8; } 60% { opacity: 0.95; } }
.xc-scene .floaty { animation: xc-floaty 3s ease-in-out infinite; }
@keyframes xc-floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) {
  .xc-scene .tw, .xc-scene .glow, .xc-scene .rays, .xc-scene .bob, .xc-scene .flick, .xc-scene .floaty, .xc-star,
  .xc-cell.today:not(.opened) .xc-pkg, .xmas-gift .xg-bow { animation: none; }
}
.xc-cell.today.opened { box-shadow: inset 0 0 0 4px #ffd23f, 0 0 22px rgba(255,210,63,0.9); }
/* the tiny games (christmas-games.js): a wide picture to tap, the word and an Again button under it */
.xc-big.game .xc-big-card { cursor: pointer; touch-action: none; }
.xc-big-card .xc-game { width: 100%; height: 100%; display: block; }
.xc-big-row { display: flex; align-items: center; gap: 18px; }
.xc-again {
  border: none; border-radius: 999px; padding: 8px 22px; cursor: pointer;
  background: #ffc400; color: #1b1d3a; font: 800 26px/1.1 "Baloo 2", system-ui, sans-serif; box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}
.xc-again[hidden] { display: none; }
.xc-again:active { transform: scale(0.95); }
.xc-scene .fall { animation: xc-fall 6s linear infinite; }
@keyframes xc-fall { from { transform: translateY(0); } to { transform: translateY(320px); } }
@media (prefers-reduced-motion: reduce) { .xc-scene .fall { animation: none; } }

/* ---------- Circuits (uses Wheels' drawer, board and tool layout) ---------- */
/* Lights Off, where Go! is in Wheels: navy, and yellow while the room is dark */
.cx-dark { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.6rem; background: #24308f; box-shadow: 0 7px 0 #141c5e, 0 10px 18px rgba(0,0,0,0.2); }
.cx-dark .icon { font-size: 2rem; }
.cx-dark:active { box-shadow: 0 2px 0 #141c5e, 0 4px 8px rgba(0,0,0,0.2); }
.cx-dark.on { background: #ffc400; color: #1b1d3a; text-shadow: none; box-shadow: 0 7px 0 #d49c00, 0 10px 18px rgba(0,0,0,0.2); }
