/* Room layouts. Portrait: tray along the bottom. Landscape: tray on the right. */
.room-layout { display: flex; flex-direction: column; gap: 16px; }

/* Top bar: kid button on the left; the right end is kept free for the lock. */
.bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--touch-gap);
  height: var(--bar);
  padding-right: calc(56px + var(--touch-gap));
}

/* ── Splash ─────────────────────────────────────────── */
.splash { position: relative; height: 100%; display: grid; place-items: center; }
.splash-start {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: #FEF3C7;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .1);
  animation: pulse 1.6s ease-in-out infinite;
}
.splash-start img { width: 76%; height: 76%; }
.splash-bricks { position: absolute; inset: 0; pointer-events: none; }
.deco { position: absolute; width: 18vmin; height: 11vmin; border-radius: 2vmin; opacity: .9; }
.deco::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 12%;
  height: 12%;
  border-radius: 99px;
  background: rgba(255, 255, 255, .35);
}
.deco-red { left: 4%; top: 10%; background: var(--red); transform: rotate(-8deg); }
.deco-yellow { right: 6%; top: 18%; background: var(--yellow); transform: rotate(6deg); }
.deco-blue { left: 8%; bottom: 12%; background: var(--blue); transform: rotate(5deg); }
.deco-green { right: 4%; bottom: 8%; background: var(--green); transform: rotate(-6deg); }

/* ── Home ───────────────────────────────────────────── */
.games {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: var(--touch-gap);
}
.game {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 28px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
  overflow: hidden;
}
.game:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.game-build { background: #FEF3C7; }
.game-peekaboo { background: #DBEAFE; }
.game-train { background: #DCFCE7; }
.game-feed { background: #FFE4E6; }
.game-sound { background: #EDE9FE; }
.game-tower { background: #FFEDD5; }
/* Zoo banner: top row, full width; its right end stays free for the lock. Golden frame, grass along the bottom. */
.game-zoo {
  grid-column: 1 / -1;
  margin-right: calc(56px + var(--touch-gap));
  align-items: end;
  padding-bottom: 14px;
  background: #FFF8E7;
  box-shadow: inset 0 0 0 6px var(--yellow), inset 0 -20px 0 var(--green), 0 6px 0 rgba(0, 0, 0, .08);
}
.game-zoo:active { box-shadow: inset 0 0 0 6px var(--yellow), inset 0 -20px 0 var(--green), 0 3px 0 rgba(0, 0, 0, .08); }
.game-zoo .game-art { width: min(92%, 640px); max-height: 80%; }
.game-art { width: min(80%, 380px); max-height: 82%; height: auto; }
.game-art-drop { animation: drop 2.4s ease-in-out infinite; }
.game-art-peek { animation: peek 3s ease-in-out infinite; }
.game-art-chug { animation: chug 1.2s ease-in-out infinite; }
.game-art-munch { transform-origin: 70px 117px; animation: munch 1.6s ease-in-out infinite; }
.game-art-wave { animation: wave 1.6s ease-in-out infinite; }
.game-art-hop { animation: drop 2s ease-in-out infinite reverse; }
.game-art-bob { animation: bob 2.2s ease-in-out infinite; }
.game-art-late { animation-delay: -1.1s; }

/* Home worlds. Chooser: two big picture cards, stacked in portrait, side by side in landscape.
   No bar here, so the cards start below the lock (lock bottom + --touch-gap). */
.worlds {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 560px);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  justify-content: center;
  gap: var(--touch-gap);
  padding-top: calc((var(--bar) + 56px) / 2 + var(--touch-gap));
}
.world-card {
  min-width: 128px;
  min-height: 128px;
  display: grid;
  place-items: center;
  border-radius: 32px;
  overflow: hidden;
}
.world-card:active { transform: translateY(3px); }
.world-animals { background: #DCFCE7; box-shadow: inset 0 0 0 6px var(--yellow), 0 6px 0 rgba(0, 0, 0, .08); }
.world-produce { background: #FFEDD5; box-shadow: inset 0 0 0 6px var(--orange), 0 6px 0 rgba(0, 0, 0, .08); }
.world-art { width: min(86%, 440px); max-height: 86%; height: auto; }
.world-art-bob { animation: bob 2.2s ease-in-out infinite; }
.world-art-late { animation-delay: -1.1s; }
.world-art-split { transform-box: fill-box; animation: split 2.4s ease-in-out infinite; }
.world-art-late.world-art-split { animation-name: split-right; }

/* A world bar holds the lock corner, so the banners no longer need to leave it free. */
.room-home .bar ~ .games .game-zoo, .room-home .bar ~ .games .game-basket { margin-right: 0; }

/* Produce world: basket banner on top, then slice, harvest, market (2 + 1 portrait, 3 landscape). */
.games-produce { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.games-produce .game-market { grid-column: 1 / -1; }
.game-basket {
  grid-column: 1 / -1;
  align-items: end;
  padding-bottom: 14px;
  background: #FFF8E7;
  box-shadow: inset 0 0 0 6px var(--orange), inset 0 -20px 0 var(--green), 0 6px 0 rgba(0, 0, 0, .08);
}
.game-basket:active { box-shadow: inset 0 0 0 6px var(--orange), inset 0 -20px 0 var(--green), 0 3px 0 rgba(0, 0, 0, .08); }
.game-basket .game-art { width: min(92%, 640px); max-height: 80%; }
.game-slice { background: #FFEDD5; }
.game-harvest { background: #DCFCE7; }
.game-market { background: #DBEAFE; }
.game-art-split { animation: split 2.4s ease-in-out infinite; }
.game-art-late.game-art-split { animation-name: split-right; animation-delay: 0s; }
.game-art-chop { transform-box: fill-box; transform-origin: 50% 50%; animation: chop 2.4s ease-in-out infinite; }
.game-art-pull { animation: bob 1.8s ease-in-out infinite; }

/* Guest play: locked cards rest under warm parchment with a crayon padlock in the corner.
   Still tappable: a tap opens the parent sign-up screen. */
.game, .icon-btn.is-locked { position: relative; }
.game.is-locked { box-shadow: inset 0 0 0 4px rgba(146, 64, 14, .18), 0 6px 0 rgba(0, 0, 0, .06); }
.game.is-locked .game-art { opacity: .45; filter: saturate(.35) sepia(.25); animation: none; }
.game.is-locked .game-art * { animation: none; }
.game.is-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 248, 231, .35);
  pointer-events: none;
}
.game-lock {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: clamp(44px, 9vmin, 64px);
  height: clamp(44px, 9vmin, 64px);
  transform: rotate(8deg);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .12));
  pointer-events: none;
}
.game-lock svg { display: block; width: 100%; height: 100%; }
.icon-btn.is-locked > svg:first-child { opacity: .5; }
.icon-btn .game-lock { top: -8px; right: -8px; width: 32px; height: 32px; }

/* Guest banner under the world chooser: a parent-facing note that opens sign-up. */
.guest-banner {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(100%, 720px);
  min-height: 72px;
  margin-top: var(--touch-gap);
  padding: 8px 24px 8px 12px;
  border: 3px dashed #15803D;
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  background: #F0FDF4;
  color: #14532D;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 5px 0 rgba(21, 128, 61, .18);
}
.guest-banner:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(21, 128, 61, .18); }
.guest-banner-art { flex: none; width: 48px; height: 48px; }

/* ── Build ──────────────────────────────────────────── */
.play {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--touch-gap);
}
.board-wrap { container-type: size; min-width: 0; min-height: 0; display: grid; place-items: center; }
.board { position: relative; width: min(100cqw, 100cqh); aspect-ratio: 1; }
.board > img { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .3s ease; }
.silhouette { filter: brightness(0) opacity(.12); }
.art { opacity: 0; }
.board.is-complete .art { opacity: 1; animation: hop .6s ease-out 2; }
.board.is-complete .silhouette, .board.is-complete .slot { opacity: 0; }

.slot {
  position: absolute;
  border: 3px dashed var(--c);
  border-radius: 8px;
  background: rgba(255, 255, 255, .5);
  background: color-mix(in srgb, var(--c) 20%, transparent);
  transition: opacity .3s ease, transform .18s ease;
}
.slot.is-placed {
  border-color: transparent;
  background: var(--c);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12);
}
.slot.is-placed::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 8%;
  height: 10%;
  min-height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .35);
}
.slot.is-hint { border-style: solid; transform: scale(1.04); }
.slot.is-glow { border-style: solid; animation: glow 1.2s ease-in-out infinite; }

.tray {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: var(--touch-gap);
  --brick: clamp(var(--brick-min), 13vmin, var(--brick-max));
}
.piece {
  position: relative;
  width: var(--brick);
  height: var(--brick);
  color: var(--c);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12));
}
.piece svg { width: 100%; height: 100%; pointer-events: none; }
.piece.is-lifted { z-index: 5; scale: 1.06; filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .22)); }

@media (orientation: landscape) {
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .games-produce { grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .games-produce .game-market { grid-column: auto; }
  .worlds {
    grid-template-columns: repeat(2, minmax(0, 560px));
    grid-template-rows: minmax(0, 560px);
    align-content: center;
  }
  .play { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; }
  .tray {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(var(--rows, 1), var(--brick));
    grid-auto-columns: var(--brick);
  }
}

/* ── Peekaboo ───────────────────────────────────────── */
.field { flex: 1; min-height: 0; display: grid; place-items: center; }
.cells {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--touch-gap);
  width: calc(var(--cols, 2) * var(--cell, 160px) + (var(--cols, 2) - 1) * var(--touch-gap));
}
.cell {
  position: relative;
  width: var(--cell, 160px);
  height: var(--cell, 160px);
  border-radius: 24px;
  background: #FFF7E6;
}
.cover { position: absolute; inset: 0; color: var(--c); transition: opacity .2s ease, transform .2s ease; }
.cover-brick, .crack { position: absolute; inset: 0; width: 100%; height: 100%; }
.crack { opacity: 0; }
.crack path { fill: none; stroke: #1F2937; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.cell.is-cracked .crack { opacity: 1; }
.cell.is-cracked .cover { animation: shake .12s linear 1; }
.cell.is-broken .cover { opacity: 0; transform: scale(1.15); }
.peek {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  opacity: 0;
  transform: scale(.4) translateY(20%);
  transition: opacity .2s ease, transform .26s cubic-bezier(.3, 1.5, .6, 1);
}
.cell.is-broken .peek { opacity: 1; transform: none; }
.shards { position: absolute; inset: 0; pointer-events: none; }
.shards i {
  position: absolute;
  left: 44%;
  top: 44%;
  width: 12%;
  height: 12%;
  border-radius: 3px;
  background: var(--c);
  opacity: 0;
}
.cell.is-cracked.is-broken .shards i { animation: shard .4s ease-out 1 forwards; }
.shards i:nth-child(1) { --dx: -120%; --dy: -140%; }
.shards i:nth-child(2) { --dx: 140%; --dy: -110%; }
.shards i:nth-child(3) { --dx: -130%; --dy: 130%; }
.shards i:nth-child(4) { --dx: 120%; --dy: 150%; }

/* ── Train, Feed, Tower share .play and .tray ───────── */
.track, .diner-wrap, .site { min-width: 0; min-height: 0; }
.piece.is-glow { animation: shine 1.2s ease-in-out infinite; }

/* ── Train ──────────────────────────────────────────── */
.track { display: grid; place-items: center; overflow: hidden; }
.train {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), var(--car, 96px));
  gap: var(--touch-gap) 8px;
}
.car { position: relative; width: var(--car, 96px); height: var(--car, 96px); }
.engine-art { width: 100%; height: 100%; }
.wagon::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 44%;
  bottom: 18%;
  border: 3px dashed var(--c);
  border-radius: 10px;
  background: rgba(255, 255, 255, .5);
  background: color-mix(in srgb, var(--c) 20%, transparent);
}
.wagon::after {
  content: "";
  position: absolute;
  left: 16%;
  bottom: 0;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: calc(var(--car, 96px) * .46) 0 0 var(--ink);
}
.cargo { position: absolute; left: 14%; right: 14%; top: 2%; height: 50%; color: var(--c); opacity: 0; }
.cargo svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .12)); }
.wagon.is-filled::before { border-style: solid; border-color: transparent; background: var(--c); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .12); }
.wagon.is-filled .cargo { opacity: 1; }
.wagon.is-hint::before { border-style: solid; }
.wagon.is-glow::before { border-style: solid; animation: glow 1.2s ease-in-out infinite; }
.rider { position: absolute; left: -6%; bottom: 40%; width: 112%; height: auto; opacity: 0; transition: opacity .3s ease; }
.train.is-full .rider { opacity: 1; }
.train.is-leaving { animation: depart 1.6s ease-in 1 forwards; }

/* ── Feed ───────────────────────────────────────────── */
.diner-wrap { container-type: size; display: grid; place-items: center; }
.diner { position: relative; width: min(100cqw, 100cqh, 520px); aspect-ratio: 1; }
.diner-art { width: 100%; height: 100%; transform-origin: 50% 90%; }
.diner.is-full .diner-art { animation: hop .6s ease-out 2; }
.bite { position: absolute; left: 35%; top: 35%; width: 30%; height: 30%; pointer-events: none; }
.bubble {
  position: absolute;
  left: -2%;
  top: -6%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  color: var(--want, var(--yellow));
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
}
.bubble::after {
  content: "";
  position: absolute;
  right: -6%;
  bottom: -8%;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
}
.bubble svg { width: 62%; height: 62%; }

/* ── Sound ──────────────────────────────────────────── */
.quiz {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--goal, 140px) minmax(0, 1fr);
  gap: var(--touch-gap);
}
.room-sound .board:not(.is-muted) .silhouette { visibility: hidden; }
.room-sound .board.is-muted .silhouette { filter: brightness(0) opacity(.3); }
.choices {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--touch-gap);
}
.choice {
  flex: none;
  width: var(--card, 160px);
  height: var(--card, 160px);
  padding: 8%;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
}
.choice img { width: 100%; height: 100%; }
.choice.is-right { box-shadow: 0 0 0 6px var(--green); }
.choice.is-glow { animation: glow 1.2s ease-in-out infinite; }

/* ── Tower ──────────────────────────────────────────── */
.site { display: flex; align-items: flex-end; justify-content: center; gap: var(--touch-gap); }
.tower { display: flex; flex-direction: column; align-items: center; }
.climber, .waiter { flex: none; width: calc(var(--block-h, 48px) * 1.6); height: calc(var(--block-h, 48px) * 1.6); }
.climber { opacity: 0; }
.waiter { width: calc(var(--block-h, 48px) * 2.4); height: calc(var(--block-h, 48px) * 2.4); }
.tower.is-done .climber { opacity: 1; animation: hop .6s ease-out 2; }
.waiter { transition: opacity .3s ease; }
.tower.is-done + .waiter { opacity: 0; }
.stack { display: flex; flex-direction: column-reverse; align-items: center; }
.block, .spot { flex: none; width: var(--block-w, 120px); height: var(--block-h, 48px); border-radius: 8px; }
.block { position: relative; background: var(--c); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12); }
.block::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 10%;
  height: 12%;
  min-height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .35);
}
.spot { border: 3px dashed var(--ink-soft); background: rgba(31, 41, 55, .06); }
.spot.is-hint { border-style: solid; }
.spot.is-glow { border-style: solid; animation: glow 1.2s ease-in-out infinite; }
.plate { width: calc(var(--block-w, 120px) * 1.4); height: 12px; border-radius: 6px; background: var(--green); }

@media (orientation: landscape) {
  .quiz { grid-template-rows: none; grid-template-columns: var(--goal, 200px) minmax(0, 1fr); }
  .choices { flex-direction: row; }
}

/* ── Celebration ────────────────────────────────────── */
.celebrate { position: relative; height: 100%; display: grid; place-items: center; }
.hero { width: min(70vmin, 520px); height: auto; animation: hop .6s ease-in-out 3; }
.confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  left: var(--x);
  top: -8%;
  width: 22px;
  height: 14px;
  border-radius: 3px;
  background: var(--c);
  opacity: 0;
  animation: fall var(--ms, 1.5s) var(--delay, 0ms) ease-in 1 forwards;
}
/* Inset leaves room for the 1.06× pulse inside the 24 px edge band. */
.next {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: var(--brick-min);
  height: var(--brick-min);
  background: var(--green);
  color: var(--paper);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ── Zoo ────────────────────────────────────────────── */
/* Zoo bar buttons meet the brick minimum (96 phone / 128 tablet); the lock re-centres with it.
   Home has no bar: the same value keeps the lock inside the corner the zoo banner leaves free. */
.app[data-room="home"], .app[data-room="zoo"] { --bar: var(--brick-min); }
/* Yard: fixed grid, never scrolls. Phone: pages of 10 pens, portrait 3 × 4, landscape 5 × 2.
   Tablet: all 20 pens at once, portrait 4 × 5, landscape 5 × 4. 16 px gap = TUNING.targetGapPx. */
.room-zoo[data-view="care"] .yard, .room-zoo[data-view="yard"] .care { display: none; }
/* Page controls: dots are not targets, so they sit 8 px from the buttons; home and arrow stay ≥ 24 px apart. */
.room-zoo .bar { gap: 8px; }
.room-zoo .bar > * { flex: none; }
.yard-dots { display: flex; gap: 6px; margin-left: auto; }
.yard-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); opacity: .2; }
.yard-dots i.is-on { background: var(--orange); opacity: 1; }
.yard-nav.is-back svg { transform: scaleX(-1); }
.room-zoo[data-view="care"] .yard-dots, .room-zoo[data-view="care"] .yard-nav { display: none; }
@media not all and (min-width: 600px) and (min-height: 600px) {
  .pen.is-away { display: none; }
}
@media (min-width: 600px) and (min-height: 600px) {
  .yard-dots, .yard-nav { display: none; }
}
.yard {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(var(--brick-min), 1fr));
  grid-auto-rows: minmax(var(--brick-min), 1fr);
  gap: 16px;
}
.pen {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  /* One fixed track so the art's 100% height means the pen, not the art's own width (wide landscape pens). */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 10%;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: inset 0 -10px 0 #D6A86E, 0 4px 0 rgba(0, 0, 0, .08);
}
.pen img { width: 100%; height: 100%; max-width: 220px; max-height: 220px; object-fit: contain; }
.pen:not(.is-met) { background: #F5F0E6; }
.pen:not(.is-met) img { filter: brightness(0) opacity(.15); }
.pen:active { transform: translateY(3px); box-shadow: inset 0 -10px 0 #D6A86E, 0 1px 0 rgba(0, 0, 0, .08); }
@media (min-width: 600px) and (min-height: 600px) and (orientation: portrait) {
  .yard { grid-template-columns: repeat(4, 1fr); }
}
.pen.is-arriving { z-index: 1; box-shadow: inset 0 -10px 0 #D6A86E, 0 0 0 6px var(--yellow); }

/* Care: the animal grows in place; feed tray under it, three round care buttons below. */
.care {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-areas: "stage" "foods" "cares";
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 16px;
}
.zoo-stage { grid-area: stage; position: relative; container-type: size; min-width: 0; min-height: 0; display: grid; place-items: center; }
.pet {
  position: relative;
  width: min(100cqw, 100cqh, 520px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 32px;
  background: #FEF3C7;
}
.pet > .animal-art { position: absolute; inset: 6%; width: 88%; height: 88%; transform-origin: 50% 90%; transition: filter .3s ease; }
.pet:active { transform: scale(.98); }
.blanket { position: absolute; left: 4%; right: 4%; bottom: 0; width: 92%; height: 52%; transform: translateY(105%); transition: transform .45s ease-out; }
.pet-zzz { position: absolute; right: 6%; top: 6%; width: 22%; height: auto; opacity: 0; transition: opacity .3s ease; }
.pet-zzz path { fill: none; stroke: var(--purple); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.pet.is-sleeping { background: #E0E7FF; }
.pet.is-sleeping > .animal-art { filter: saturate(.7) brightness(.85); }
.pet.is-sleeping .blanket { transform: none; }
.pet.is-sleeping .pet-zzz { opacity: 1; animation: float 3.2s ease-in-out infinite; }

.bubbles { position: absolute; inset: 0; pointer-events: none; }
.soap {
  position: absolute;
  left: calc(var(--bx) * (100% - var(--brick-min)));
  top: calc(var(--by) * (100% - var(--brick-min)));
  width: var(--brick-min);
  height: var(--brick-min);
  border: 4px solid #93C5FD;
  border-radius: 50%;
  background: rgba(219, 234, 254, .7);
  pointer-events: auto;
}
.soap::before {
  content: "";
  position: absolute;
  left: 22%;
  top: 18%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: var(--paper);
}
.soap:active { transform: scale(.94); }
.soap.is-popping, .food.is-flying { pointer-events: none; }

.fx { position: absolute; inset: 0; pointer-events: none; }
.heart-fly { position: absolute; left: 50%; top: 22%; width: clamp(40px, 12vmin, 72px); transform: translate(-50%, 0); }
.heart-fly svg { width: 100%; height: auto; }

.foods {
  grid-area: foods;
  min-height: var(--brick-min);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--touch-gap);
}
.food { position: relative; z-index: 2; width: var(--brick-min); height: var(--brick-min); color: var(--c); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12)); }
.food svg { width: 100%; height: 100%; pointer-events: none; }
.food:active { transform: translateY(3px); }

.cares { grid-area: cares; display: flex; justify-content: center; gap: var(--touch-gap); }
.care-btn {
  display: grid;
  place-items: center;
  width: var(--brick-min);
  height: var(--brick-min);
  border-radius: 50%;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .12);
}
.care-btn svg { width: 64%; height: 64%; }
.care-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.care-btn[aria-pressed="true"] { box-shadow: 0 0 0 6px var(--yellow), 0 6px 0 rgba(0, 0, 0, .12); }
.care-feed { background: #FFEDD5; }
.care-wash { background: #DBEAFE; }
.care-sleep { background: #2E1065; }

@media (orientation: landscape) {
  .yard { grid-template-columns: repeat(5, minmax(var(--brick-min), 1fr)); }
  .care {
    grid-template-areas: "stage foods" "stage cares";
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .foods { align-self: end; min-width: calc(3 * var(--brick-min) + 2 * var(--touch-gap)); }
}

/* Celebration: zoo gate bottom-left, mirrors .next. */
.celebrate .zoo {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: var(--brick-min);
  height: var(--brick-min);
  background: #FEF3C7;
  animation: pulse 1.6s ease-in-out infinite;
}

/* ── Fruit & vegetable world ────────────────────────── */
/* Slice, harvest, market and basket share the bar (home, basket, next) and the brick minimum.
   Every target is ≥ --brick-min and ≥ --touch-gap from its neighbours; nothing scrolls. */
.room-home, .room-slice, .room-harvest, .room-market, .room-basket { gap: var(--touch-gap); }

/* Slice: a warm wooden board; the produce (or its two halves) above, the tools below. */
.slice-stage { flex: 1; min-height: 0; display: grid; }
.cutting-board {
  position: relative;
  width: min(100%, 1120px);
  justify-self: center;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--touch-gap);
  padding: 16px;
  border-radius: 32px;
  background: var(--wood);
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, .12), 0 6px 0 rgba(0, 0, 0, .08);
}
/* Hanging hole: the board reads as wood without any text. */
.cutting-board::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 20px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12);
}
.slice-area {
  container-type: size;
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--touch-gap);
}
.slice-whole {
  position: relative;
  width: min(100cqw, 100cqh, 420px);
  min-width: var(--brick-min);
  aspect-ratio: 1;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .12));
}
.slice-whole img { width: 100%; height: 100%; pointer-events: none; }
/* Dashed seam where the knife goes: across for a horizontal cut, top to bottom for a vertical one. */
.cut-seam {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 0;
  border-top: 6px dashed rgba(146, 64, 14, .6);
  transform: translateY(-50%);
  pointer-events: none;
  animation: seam 1.6s ease-in-out infinite;
}
.cutting-board[data-axis="vertical"] .cut-seam {
  left: 50%;
  right: auto;
  top: 6%;
  bottom: 6%;
  height: auto;
  width: 0;
  border-top: 0;
  border-left: 6px dashed rgba(146, 64, 14, .6);
  transform: translateX(-50%);
}
.slice-half {
  flex: none;
  width: min(calc((100cqw - var(--touch-gap)) / 2), 100cqh, 320px);
  min-width: 128px;
  min-height: 128px;
  aspect-ratio: 1;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .12));
}
.slice-half img { width: 100%; height: 100%; pointer-events: none; }
/* Copy of a half on its way into the basket button (removed when it lands). */
.slice-ghost { position: fixed; z-index: 10; object-fit: contain; pointer-events: none; }
.slice-half.is-lifted, .wood-knife.is-lifted { z-index: 5; filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .22)); }
.slice-tools {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--touch-gap);
}
.wood-knife {
  display: grid;
  place-items: center;
  width: calc(var(--brick-min) * 1.6);
  height: var(--brick-min);
  border-radius: 999px;
  background: #FFF8E7;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .12);
  touch-action: none;
}
.wood-knife svg { width: 86%; height: 86%; pointer-events: none; }
.wood-knife:not(.is-lifted) svg { animation: chop 2.4s ease-in-out infinite; }
.slice-join { background: #DCFCE7; color: var(--green); }
.slice-collect { background: #FEF3C7; }

/* Harvest: tree branch on top, bush in the middle, soil at the bottom; the wicker basket waits
   below (portrait) or to the right (landscape). Up to three items share a tier. */
.harvest-field {
  --item: clamp(var(--brick-min), 16vmin, 150px);
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(calc(var(--item) + 12px), 1fr)) auto;
  gap: 12px;
}
.harvest-tier {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: var(--touch-gap);
  border-radius: 28px;
}
.tier-branch { background: var(--leaf); box-shadow: inset 0 -10px 0 #86EFAC; border-radius: 56px 56px 28px 28px; }
.tier-branch::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 14%;
  height: 10px;
  border-radius: 5px;
  background: var(--wood-dark);
  opacity: .55;
}
.tier-plant { background: #DCFCE7; box-shadow: inset 0 -10px 0 var(--leaf); }
.tier-ground { background: var(--soil); box-shadow: inset 0 10px 0 #854D0E; }
.tier-ground::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 22%;
  border-top: 4px dashed rgba(255, 255, 255, .18);
}
.harvest-item {
  position: relative;
  z-index: 1;
  flex: none;
  width: var(--item);
  height: var(--item);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12));
}
.harvest-item img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.harvest-item[data-zone="branch"] img { transform-origin: 50% 0; animation: sway 3s ease-in-out infinite; }
/* Root vegetables and ground fruit sit half in a soil mound until pulled. */
.harvest-item[data-zone="ground"]::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -4%;
  height: 32%;
  border-radius: 50% 50% 14px 14px;
  background: #854D0E;
  pointer-events: none;
}
.harvest-item.is-lifted { z-index: 5; filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .22)); }
.harvest-item.is-lifted::after, .harvest-item.is-picked::after { display: none; }
.harvest-item.is-picked { z-index: 6; pointer-events: none; }
.harvest-item.is-gone { visibility: hidden; }
.harvest-basket {
  position: relative;
  justify-self: center;
  width: min(100%, calc(var(--item) * 2.4));
  height: var(--item);
  transform-origin: 50% 100%;
}
.harvest-basket-art { width: 100%; height: 100%; }
.harvest-basket.is-hint { filter: drop-shadow(0 0 12px rgba(250, 204, 21, .95)); }
.harvest-load {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 6%;
  height: 46%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  pointer-events: none;
}
.harvest-mini { width: 32%; max-width: 64px; height: 100%; object-fit: contain; }

/* Market: tap and muddy produce, then a clean white plate. Three mud spots sit on a square
   (top-left, top-right, bottom-centre): with the brick minimum they stay ≥ --touch-gap apart. */
.market-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: var(--touch-gap);
}
.market-stage[data-stage="washed"], .market-stage[data-stage="served"] { grid-template-rows: minmax(0, 1fr) auto; }
.water-tap {
  justify-self: start;
  display: grid;
  place-items: center;
  width: calc(var(--brick-min) * 1.25);
  height: calc(var(--brick-min) * 1.25);
  border-radius: 28px;
  background: #DBEAFE;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
}
.water-tap:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.tap-art { width: 84%; height: 84%; }
.tap-drops { animation: drop 1.6s ease-in-out infinite; }
.market-wash-wrap { container-type: size; width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; place-items: center; }
.market-wash {
  position: relative;
  width: min(100cqw, 100cqh, 480px);
  aspect-ratio: 1;
  border-radius: 32px;
  background: #E0F2FE;
  box-shadow: inset 0 -12px 0 #BAE6FD;
}
.market-produce { position: absolute; inset: 10%; }
.market-produce img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .12)); }
/* Mud dims the colours; each rinsed spot brings them back. */
.market-produce.is-dirty img { filter: sepia(.55) saturate(.7) brightness(.82); transition: filter .3s ease; }
.market-wash[data-clean="1"] .market-produce img { filter: sepia(.35) saturate(.82) brightness(.9); }
.market-wash[data-clean="2"] .market-produce img { filter: sepia(.15) saturate(.92) brightness(.96); }
.market-produce.is-lifted { z-index: 5; }
.market-produce.is-lifted img { filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .22)); }
.mud-spot {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--brick-min);
  height: var(--brick-min);
  border-radius: 50%;
  transition: opacity .25s ease;
}
.spot-a { left: 6%; top: 6%; }
.spot-b { right: 6%; top: 6%; }
.spot-c { left: calc(50% - var(--brick-min) / 2); bottom: 6%; }
.mud-blob {
  width: 64%;
  height: 56%;
  border-radius: 46% 54% 50% 50% / 55% 45% 55% 45%;
  background: #92400E;
  opacity: .85;
  box-shadow: 14px -10px 0 -6px #A16207, -12px 8px 0 -8px #A16207;
  pointer-events: none;
}
.mud-spot.is-clean { opacity: 0; pointer-events: none; }
.market-shine {
  position: absolute;
  right: 4%;
  top: 2%;
  width: 18%;
  aspect-ratio: 1;
  background: var(--paper);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  pointer-events: none;
  animation: twinkle 1.6s ease-in-out infinite;
}
.market-plate {
  display: grid;
  place-items: center;
  width: min(100%, 420px);
  height: calc(var(--brick-min) * 1.3);
  border-radius: 999px;
}
.market-plate .plate-art { width: 100%; height: 100%; pointer-events: none; }
.market-plate.is-hint { filter: drop-shadow(0 0 12px rgba(250, 204, 21, .95)); }
.market-plate:active { transform: translateY(3px); }
.market-served { position: relative; width: min(100%, 520px); aspect-ratio: 200 / 130; }
.market-served .plate-art { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
.served-whole { position: absolute; left: 29%; bottom: 24%; width: 42%; height: auto; }
.served-half { position: absolute; bottom: 8%; width: 28%; height: auto; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12)); }
.served-half-left { left: 6%; }
.served-half-right { right: 6%; }
.market-next { background: var(--green); color: var(--paper); animation: pulse 1.6s ease-in-out infinite; }

/* Basket: fixed grid of 12 slots, never scrolls (3 × 4 portrait, 4 × 3 landscape), --touch-gap apart. */
.room-basket[data-view="detail"] .basket-grid, .room-basket[data-view="grid"] .basket-detail { display: none; }
.basket-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(var(--brick-min), 1fr));
  grid-template-rows: repeat(4, minmax(var(--brick-min), 1fr));
  gap: var(--touch-gap);
}
.basket-slot {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 10%;
  border-radius: 20px;
  background: #FFF7E6;
  box-shadow: inset 0 -10px 0 var(--wicker), 0 4px 0 rgba(0, 0, 0, .08);
}
.basket-slot img { width: 100%; height: 100%; max-width: 200px; max-height: 200px; object-fit: contain; }
.basket-slot:not(.is-collected) { background: #F5F0E6; box-shadow: inset 0 -10px 0 #E7D9BF, 0 4px 0 rgba(0, 0, 0, .08); }
.basket-slot:active { transform: translateY(3px); }

/* Detail: whole produce grows in place, both cut halves beside it, two care buttons below. */
/* .cares (shared with the zoo) sits in a named area, so the detail grid names both areas. */
.basket-detail {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-areas: "stage" "cares";
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--touch-gap);
}
.detail-stage {
  grid-area: stage;
  container-type: size;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr);
  place-items: center;
  gap: var(--touch-gap);
}
.detail-whole {
  width: min(100cqw, 52cqh, 360px);
  aspect-ratio: 1;
  padding: 6%;
  border-radius: 32px;
  background: #FFF7E6;
  box-shadow: inset 0 -10px 0 var(--wicker);
}
.detail-whole img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.detail-halves { display: flex; align-items: center; justify-content: center; gap: var(--touch-gap); }
.detail-half {
  width: min(calc((100cqw - var(--touch-gap)) / 2), 38cqh, 260px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12));
}
.care-slice { background: #FFEDD5; }
.care-market { background: #DBEAFE; }

@media (orientation: landscape) {
  .cutting-board { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; }
  .slice-tools { flex-direction: column; padding-right: 24px; }
  .harvest-field { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: repeat(3, minmax(calc(var(--item) + 12px), 1fr)); }
  .harvest-basket { grid-column: 2; grid-row: 1 / -1; align-self: end; width: calc(var(--item) * 2); height: calc(var(--item) * 1.4); }
  .market-stage { grid-template-rows: minmax(0, 1fr); grid-template-columns: auto minmax(0, 1fr); }
  .market-stage[data-stage="washed"], .market-stage[data-stage="served"] { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; }
  .water-tap { justify-self: center; }
  .market-plate { width: calc(var(--brick-min) * 2.6); height: calc(var(--brick-min) * 1.6); }
  .basket-grid { grid-template-columns: repeat(4, minmax(var(--brick-min), 1fr)); grid-template-rows: repeat(3, minmax(var(--brick-min), 1fr)); }
  .detail-stage { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .detail-whole { width: min(45cqw, 90cqh, 380px); }
  .detail-half { width: min(calc((55cqw - var(--touch-gap)) / 2), 70cqh, 260px); }
}

/* ── Rest ───────────────────────────────────────────── */
/* Wind-down sky: moon, five stars and the sleeping animal are soft touch targets (≥ --brick-min)
   that only glow; nothing leads out. The sky fills the whole room so its tint has no frame. */
.app[data-room="rest"] { background: var(--night); }
.room-rest { background: var(--night); }
.night { position: absolute; inset: 0; display: grid; place-items: center; background: var(--night); transition: background-color 1.2s ease; }
.night[data-sky="1"] { background: #1E1B4B; }
.night[data-sky="2"] { background: #172554; }
.moon { position: absolute; left: var(--edge-left); top: var(--edge-top); width: var(--brick); height: var(--brick); border-radius: 50%; }
.moon svg { width: 100%; height: 100%; overflow: visible; transition: filter .6s ease; }
.moon-halo { fill: var(--yellow); opacity: .12; transition: opacity .6s ease; }
.moon-body { fill: var(--yellow); }
.moon-face { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.moon-cheek { fill: var(--orange); opacity: .5; }
.moon.is-glowing .moon-halo { opacity: .35; }
.moon.is-glowing svg { filter: drop-shadow(0 0 14px rgba(250, 204, 21, .7)); }
/* Each star is a --brick-min target centred on its spot; the right-hand star stays ≥ 28 px below the lock. */
.star {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--brick-min);
  height: var(--brick-min);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.star svg {
  width: 38%;
  height: 38%;
  fill: #F8FAFC;
  stroke: #F8FAFC;
  stroke-width: 2;
  stroke-linejoin: round;
  animation: twinkle 2.4s ease-in-out infinite;
  transition: transform .5s ease, fill .5s ease, stroke .5s ease, filter .5s ease;
}
.star.is-glowing svg { fill: var(--yellow); stroke: var(--yellow); opacity: 1; transform: scale(1.4); animation: none; filter: drop-shadow(0 0 10px rgba(250, 204, 21, .9)); }
.star-1 { left: 51%; top: 10.7%; }
.star-2 { left: 81.5%; top: max(23.7%, calc(var(--edge-top) + var(--bar) / 2 + 56px + var(--brick-min) / 2)); }
.star-3 { left: 20%; top: 25%; }
.star-4 { left: 21.5%; top: 80.6%; }
.star-5 { left: 77%; top: 75.8%; }
.star-2 svg { animation-delay: .6s; }
.star-3 svg { animation-delay: 1.2s; }
.star-4 svg { animation-delay: 1.8s; }
.star-5 svg { animation-delay: 2.1s; }
.sleeper { position: relative; width: min(56vmin, 420px); border-radius: var(--round); }
.sleeper .animal-art { width: 100%; height: auto; filter: saturate(.7) brightness(.82); transform-origin: 50% 90%; animation: breathe 3.2s ease-in-out infinite; }
.blanket { position: absolute; left: 4%; bottom: -2%; width: 92%; height: 34%; transform-origin: 50% 100%; }
.sleeper.is-tucked .blanket { animation: tuck 1.8s ease-in-out 1; }
.sleeper.is-soothed .animal-art { animation-duration: 4.8s; }
.zzz { position: absolute; right: -14%; top: -22%; width: 34%; height: auto; animation: float 3.2s ease-in-out infinite; }
.zzz path { fill: none; stroke: #E2E8F0; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.zzz .sleep-heart { fill: var(--red); stroke: none; opacity: 0; transition: opacity .4s ease; }
.sleeper.is-soothed .zzz { animation-duration: 2.4s; }
.sleeper.is-soothed .sleep-heart { opacity: 1; }
/* Silent wind-down: touches still answer, with a smaller, dimmer light. */
.night.is-hushed .star.is-glowing svg { transform: scale(1.2); filter: drop-shadow(0 0 6px rgba(250, 204, 21, .6)); }
.night.is-hushed .moon.is-glowing .moon-halo { opacity: .22; }
@media (orientation: landscape) {
  .star-1 { left: 27.3%; top: 20.5%; }
  .star-2 { left: 87.7%; top: max(51.3%, calc(var(--edge-top) + var(--bar) / 2 + 56px + var(--brick-min) / 2)); }
  .star-3 { left: 13%; top: 74.4%; }
  .star-4 { left: 71.1%; top: 20.5%; }
  .star-5 { left: 83%; top: 79.5%; }
  .sleeper { width: min(44vmin, 360px); }
}

/* Time cue dusk: the room floor warms in plain colours at ≤ 5 / 2 / 1 minutes (bricks keep their colours). */
.app[data-dusk] .room:not(.room-rest):not(.room-parent):not(.room-splash) { transition: background-color 2s ease; }
.app[data-dusk="1"] .room:not(.room-rest):not(.room-parent):not(.room-splash) { background: #FFF4DE; }
.app[data-dusk="2"] .room:not(.room-rest):not(.room-parent):not(.room-splash) { background: #FFE6C4; }
.app[data-dusk="3"] .room:not(.room-rest):not(.room-parent):not(.room-splash) { background: #FFD9B0; }

/* ── Parent Panel & gate (adults) ───────────────────── */
.room-parent { display: grid; place-items: center; background: #F3F4F6; }
.panel { width: min(100%, 640px); display: grid; gap: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.panel-title { margin: 0; font-size: 22px; line-height: 1.3; }
.panel-group { display: grid; gap: 16px; justify-items: start; }
.panel-group h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.panel-note { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.seg { display: flex; flex-wrap: wrap; gap: 16px; }

.gate-card { display: grid; gap: 20px; width: min(100%, 420px); justify-items: center; text-align: center; }
.gate-copy { display: grid; gap: 12px; justify-items: center; }
.gate-title { margin: 0; font-size: 20px; line-height: 1.3; }
.gate-prompt { margin: 0; font-size: 17px; }
.gate-code { display: block; margin-top: 4px; font-size: 32px; line-height: 1.3; letter-spacing: .04em; }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 16px; }
.key { width: 64px; height: 64px; padding: 0; font-size: 24px; }
.key[data-digit="0"] { grid-column: 2; }
@media (orientation: landscape) and (max-height: 520px) {
  .gate-card { width: auto; grid-template-columns: auto auto; align-items: center; gap: 32px; text-align: left; }
  .keypad { grid-template-columns: repeat(3, 56px); }
  .key { width: 56px; height: 56px; min-height: 56px; }
}

/* Last minute before Rest: the animals get sleepy (no visible clock). */
.app.is-sleepy .board, .app.is-sleepy .game-art, .app.is-sleepy .cell.is-broken .peek { animation: yawn 4s ease-in-out infinite; }

/* Reduced motion: no movement; hints stay as a still glow. */
@media (prefers-reduced-motion: reduce) {
  .splash-start, .game-art-drop, .game-art-peek, .game-art-chug, .game-art-munch, .game-art-wave, .game-art-hop, .game-art-bob,
  .board.is-complete .art, .cell.is-cracked .cover, .cell.is-cracked.is-broken .shards i, .hero, .confetti i, .next,
  .sleeper .animal-art, .zzz, .train.is-leaving, .diner.is-full .diner-art, .tower.is-done .climber, .celebrate .zoo,
  .app.is-sleepy .board, .app.is-sleepy .game-art, .app.is-sleepy .cell.is-broken .peek,
  .world-art-bob, .world-art-split, .game-art-split, .game-art-chop, .game-art-pull { animation: none !important; }
  .slot, .peek, .cover { transition-property: opacity !important; }
  .slot.is-hint { transform: none; }
  .slot.is-glow, .wagon.is-glow::before, .spot.is-glow, .choice.is-glow { animation: none !important; box-shadow: 0 0 0 10px rgba(250, 204, 21, .55); }
  .piece.is-glow { animation: none !important; filter: drop-shadow(0 0 10px rgba(250, 204, 21, .95)); }
  /* Zoo: state changes stay (blanket, zzz, colours), with no movement or fades. */
  .room-zoo, .room-zoo * { animation: none !important; transition: none !important; }
  /* Rest: glow, sky and blanket states switch at once; the tucked blanket stays visibly raised. */
  .room-rest, .room-rest * { animation: none !important; transition: none !important; }
  .sleeper.is-tucked .blanket { transform: translateY(-6%); }
  .app[data-dusk] .room { transition: none !important; }
}

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes drop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes peek { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-4px); } }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-8%) scale(1.04, .97); } }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
  50% { box-shadow: 0 0 0 10px rgba(250, 204, 21, .55); }
}
@keyframes shake { 0%, 100% { transform: rotate(0); } 33% { transform: rotate(-3deg); } 66% { transform: rotate(3deg); } }
@keyframes shard { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(90deg); } }
@keyframes fall {
  0% { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(110vh) rotate(calc(var(--spin, 1) * 540deg)); }
}
@keyframes twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.97); } }
@keyframes float { 0%, 100% { transform: translateY(0); opacity: .7; } 50% { transform: translateY(-10%); opacity: 1; } }
@keyframes tuck { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-10%) scaleY(1.04); } 70% { transform: translateY(2%); } }
@keyframes yawn { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.03, .96); } }
@keyframes split { 0%, 30%, 100% { transform: translateX(0); } 50%, 80% { transform: translateX(-5px); } }
@keyframes split-right { 0%, 30%, 100% { transform: translateX(0); } 50%, 80% { transform: translateX(5px); } }
@keyframes chop { 0%, 60%, 100% { transform: translateY(0) rotate(0); } 72% { transform: translateY(6px) rotate(-6deg); } 84% { transform: translateY(0) rotate(0); } }
@keyframes seam { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes chug { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes munch { 0%, 60%, 100% { transform: scaleY(1); } 70%, 90% { transform: scaleY(.4); } 80% { transform: scaleY(1); } }
@keyframes wave { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes depart { 0% { transform: translateX(0); } 100% { transform: translateX(-130vw); } }
@keyframes shine {
  0%, 100% { filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .12)); }
  50% { filter: drop-shadow(0 0 12px rgba(250, 204, 21, .95)); }
}
