* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #ffe3b8;
  overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  font-family: system-ui, sans-serif;
}
button { font: inherit; border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; }
svg { display: block; }

#stage { position: fixed; inset: 0; overflow: hidden; }
#wall { position: absolute; inset: 0 0 26% 0; background: linear-gradient(#ffe9c9, #ffd9a6); }
#window {
  position: absolute; top: max(9%, calc(env(safe-area-inset-top) + 56px)); left: 8%; width: 26vmin; height: 30vmin;
  background: linear-gradient(#bfe6ff, #e3f5ff); border: 1.6vmin solid #fff; border-radius: 2vmin;
  box-shadow: inset 0 0 0 0.6vmin #fff, 0 0.6vmin 0 rgba(0,0,0,.06);
}
#window::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1.2vmin; margin-left: -.6vmin; background: #fff; }
#floor { position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: linear-gradient(#d9a46b, #c98f57); }
#rug { position: absolute; left: 50%; top: 20%; width: 92vmin; height: 26vmin; margin-left: -46vmin; border-radius: 50%; background: #9fd8b8; box-shadow: inset 0 0 0 2vmin #84c7a1; }

#tobyWrap {
  position: absolute; left: 50%; bottom: calc(14% + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  height: min(70dvh, 120vw); aspect-ratio: 400 / 540;
}
#toby { width: 100%; height: 100%; overflow: visible; }
#toby [data-zone] { cursor: pointer; }

/* transform origins in viewBox coordinates */
#toby * { transform-box: view-box; }
#all { transform-origin: 200px 530px; animation: breathe 3.2s ease-in-out infinite; }
#head { transform-origin: 200px 300px; transition: transform .3s; }
#earL { transform-origin: 140px 150px; transition: transform .25s; }
#earR { transform-origin: 260px 150px; transition: transform .25s; }
#tail { transform-origin: 284px 500px; animation: tailIdle 4s ease-in-out infinite; }
#eyesOpen { transform-origin: 200px 188px; }
#pupils { transition: transform .15s ease-out; }
#mouthOpen { transform-origin: 200px 250px; transform: scale(1, 0); }
#eyesHappy, #eyesSquint { display: none; }

@keyframes breathe { 50% { transform: scale(1.012, .99); } }
@keyframes tailIdle { 50% { transform: rotate(-6deg); } }

#toby.blink #eyesOpen { transform: scaleY(.08); }

#toby.listening #earL { transform: rotate(-10deg) translateY(-6px); }
#toby.listening #earR { transform: rotate(10deg) translateY(-6px); }
#toby.listening #head { transform: rotate(-5deg); }

#toby.happy #eyesOpen, #toby.squint #eyesOpen { display: none; }
#toby.happy #eyesHappy { display: inline; }
#toby.squint #eyesSquint { display: inline; }

#toby.poke #head { animation: poke .55s ease-out; }
@keyframes poke { 15% { transform: scale(1.1, .84); } 45% { transform: scale(.94, 1.08); } 70% { transform: scale(1.03, .97); } }

#toby.tickle #all { animation: wiggle .16s linear 6; }
@keyframes wiggle { 25% { transform: rotate(4deg); } 75% { transform: rotate(-4deg); } }

#toby.pet #head { transform: rotate(7deg); }
#toby.pet #all { animation: sway 1.4s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(2deg) scale(1.01); } }

#toby.swish #tail { animation: swish .5s ease-in-out 2; }
@keyframes swish { 30% { transform: rotate(-26deg); } 70% { transform: rotate(14deg); } }

#toby.hop #all { animation: hop .6s cubic-bezier(.3,.7,.4,1); }
@keyframes hop { 20% { transform: scale(1.06, .9); } 50% { transform: translateY(-70px) scale(.96, 1.05); } 80% { transform: scale(1.05, .93); } }

#toby.eat #head { animation: chomp .3s ease-in-out infinite; } /* chews until the munching sound ends */
@keyframes chomp { 50% { transform: scale(1.04, .96) translateY(4px); } }

#toby.dance #all { animation: dance .5s ease-in-out 6; transform-origin: 200px 530px; }
#toby.dance #tail { animation: swish .5s ease-in-out 6; }
@keyframes dance { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-10deg) translateY(-44px) scale(1.03); } 50% { transform: rotate(0) scale(1.04, .95); } 75% { transform: rotate(10deg) translateY(-44px) scale(1.03); } }

#toby.catch #all { animation: hop .6s cubic-bezier(.3,.7,.4,1); }

/* particles */
#particles { position: absolute; inset: 0; pointer-events: none; }
.p { position: absolute; width: 9vmin; height: 9vmin; max-width: 52px; max-height: 52px; animation: floatUp 1.3s ease-out forwards; will-change: transform, opacity; }
@keyframes floatUp { from { transform: translate(-50%, -50%) scale(.4); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% - 22vmin)) scale(1.1); opacity: 0; } }
.flyer { position: absolute; width: 18vmin; height: 18vmin; pointer-events: none; transition: transform .55s cubic-bezier(.4,0,.6,1), opacity .2s .5s; }

/* toolbar */
#toolbar {
  position: absolute; left: 0; right: 0; bottom: calc(2.5% + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 6vmin; pointer-events: none;
}
.tool {
  pointer-events: auto; width: min(20vmin, 104px); height: min(20vmin, 104px); border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #fff 0, #fffaf3 35%, #f3e2cc 85%, #e8cfb0 100%);
  box-shadow: inset 0 -6px 12px rgba(160, 100, 50, .16), inset 0 5px 9px rgba(255, 255, 255, .9), 0 6px 0 #e3c6a4, 0 12px 20px rgba(110, 60, 20, .2);
  display: grid; place-items: center;
  transition: transform .12s;
}
.tool svg { width: 66%; height: 66%; }
.tool:active { transform: scale(.9) translateY(3px); }

/* ---------- tablets (iPad and the like) ----------
   Bigger buttons to suit the bigger screen and a toddler's whole hand, and held sideways the toy buttons go down the
   right edge (as on a phone held sideways), so the pet stands tall in the middle with nothing over its feet. */
@media (min-width: 700px) and (min-height: 700px) {
  .tool { width: min(20vmin, 128px); height: min(20vmin, 128px); }
  #toolbar { gap: min(6vmin, 56px); bottom: calc(3% + env(safe-area-inset-bottom)); }
}
@media (orientation: landscape) and (min-height: 521px) {
  #tobyWrap { height: min(80dvh, 76vw); bottom: calc(6dvh + env(safe-area-inset-bottom)); }
  #toolbar {
    left: auto; right: calc(env(safe-area-inset-right) + 3vmin); top: 0; bottom: 0;
    flex-direction: column; justify-content: center; gap: 4vmin;
  }
}


/* start overlay */
#start {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255, 227, 184, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
#start.hidden { display: none; }
#startBtn {
  width: min(42vmin, 220px); height: min(42vmin, 220px); border-radius: 50%; background: #ff8f6b;
  box-shadow: 0 10px 0 #d9653f, 0 0 0 10px rgba(255,255,255,.6); display: grid; place-items: center;
  animation: pulse 1.6s ease-in-out infinite;
}
#startBtn svg { width: 62%; height: 62%; }
@keyframes pulse { 50% { transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
  #all, #tail, #startBtn { animation: none; }
}

/* instant squish under the finger */
#toby.press-head #head { transform: scale(1.04, .95); transition: transform .08s; }
#toby.press-belly #all { transform: scale(1.02, .97); }

#toby.yawn #head { transform: rotate(-4deg) translateY(4px); transition: transform .5s; }
#toby.yawn #mouthOpen { transform: scale(1.05, 1.2) !important; transition: transform .4s; }
#toby.yawn #mouthClosed { opacity: 0 !important; }
#toby.ring #bell { animation: ring .12s linear 5; transform-origin: 200px 336px; }
@keyframes ring { 25% { transform: rotate(18deg); } 75% { transform: rotate(-18deg); } }

#toby.poof { transition: transform .2s ease-in, opacity .2s; transform: scale(.6); opacity: 0; }
#toby.arrive { animation: arrive .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes arrive { from { transform: scale(.4); opacity: 0; } }

#jaw { transform-box: view-box; }

/* dog: floppy ears and a waggy tail */
#toby[data-animal="dog"] #earL { transform-origin: 112px 110px; }
#toby[data-animal="dog"] #earR { transform-origin: 288px 110px; }
#toby[data-animal="dog"].listening #earL { transform: rotate(14deg) translateY(-8px); }
#toby[data-animal="dog"].listening #earR { transform: rotate(-14deg) translateY(-8px); }
#toby[data-animal="dog"] #tail { transform-origin: 280px 498px; animation: wag .45s ease-in-out infinite; }
#toby[data-animal="dog"].happy #tail { animation-duration: .2s; }
#toby[data-animal="dog"] #mouthOpen { transform-origin: 200px 260px; }
@keyframes wag { 50% { transform: rotate(-12deg); } }


/* feed button shows a fish or a bone (or a banana) */
.tool .icon-bone, .tool .icon-banana, .tool .icon-bread, .tool .icon-apple, .tool .icon-carrot, .tool .icon-strawberry, .tool .icon-melon, .tool .icon-sugarcane, .tool .icon-drumstick, .tool .icon-leaves, .tool .icon-sardine { display: none; }
body[data-animal="bear"] .tool .icon-fish { display: none; }
body[data-animal="bear"] .tool .icon-strawberry { display: block; }
body[data-animal="parrot"] .tool .icon-fish { display: none; }
body[data-animal="parrot"] .tool .icon-melon { display: block; }
body[data-animal="pig"] .tool .icon-fish { display: none; }
body[data-animal="pig"] .tool .icon-apple { display: block; }
body[data-animal="bunny"] .tool .icon-fish { display: none; }
body[data-animal="bunny"] .tool .icon-carrot { display: block; }
body[data-animal="lion"] .tool .icon-fish { display: none; }
body[data-animal="giraffe"] .tool .icon-fish { display: none; }
body[data-animal="giraffe"] .tool .icon-leaves { display: block; }
body[data-animal="lion"] .tool .icon-drumstick { display: block; }
body[data-animal="penguin"] .tool .icon-fish { display: none; }
body[data-animal="penguin"] .tool .icon-sardine { display: block; }
body[data-animal="elephant"] .tool .icon-fish { display: none; }
body[data-animal="elephant"] .tool .icon-sugarcane { display: block; }
body[data-animal="duck"] .tool .icon-fish { display: none; }
body[data-animal="duck"] .tool .icon-bread { display: block; }
body[data-animal="dog"] .tool .icon-fish { display: none; }
body[data-animal="dog"] .tool .icon-bone { display: block; }
body[data-animal="monkey"] .tool .icon-fish { display: none; }
body[data-animal="monkey"] .tool .icon-banana { display: block; }

@media (orientation: landscape) and (max-height: 520px) {
  #tobyWrap { height: 92dvh; bottom: 2dvh; }
  #toolbar { left: auto; right: calc(env(safe-area-inset-right) + 16px); top: 0; bottom: 0; flex-direction: column; justify-content: center; gap: 4vmin; }
  .tool { width: 22vmin; height: 22vmin; }
}

/* monkey: round ears that wiggle when listening */
#toby[data-animal="monkey"] #earL { transform-origin: 110px 196px; }
#toby[data-animal="monkey"] #earR { transform-origin: 290px 196px; }
#toby[data-animal="monkey"].listening #earL { transform: rotate(-12deg) scale(1.12); }
#toby[data-animal="monkey"].listening #earR { transform: rotate(12deg) scale(1.12); }
#toby[data-animal="monkey"] #tail { transform-origin: 285px 500px; }
#toby[data-animal="monkey"] #mouthOpen { transform-origin: 200px 260px; }

/* ears twitch while listening, and flick now and then */
#toby.listening #earL { animation: twitchL 1.1s ease-in-out infinite; }
#toby.listening #earR { animation: twitchR 1.3s ease-in-out .2s infinite; }
@keyframes twitchL { 0%, 60%, 100% { translate: 0 0; rotate: 0deg; } 70% { rotate: -7deg; } 80% { rotate: 3deg; } }
@keyframes twitchR { 0%, 60%, 100% { translate: 0 0; rotate: 0deg; } 70% { rotate: 7deg; } 80% { rotate: -3deg; } }
#toby.flickL #earL { animation: twitchL .5s ease-in-out; }
#toby.flickR #earR { animation: twitchR .5s ease-in-out; }
.p svg { width: 100%; height: 100%; }

/* nap time */
#toby.sleep #eyesOpen, #toby.sleep #eyesSquint { display: none; }
#toby.sleep #eyesHappy { display: inline; transform: scaleY(-1); transform-origin: 200px 178px; }
#toby.sleep #head { transform: rotate(6deg) translateY(10px); transition: transform 1.2s ease-in-out; }
#toby.sleep #all { animation: snooze 3.4s ease-in-out infinite; }
#toby.sleep #tail { animation: none; }
@keyframes snooze { 50% { transform: scale(1.025, .98); } }


/* Toby in 3D: the picture covers the whole stage (so he can hop and swish freely) but lets touches through. */
#toby.toby3d { position: relative; }
.toby3d-canvas { position: absolute; display: block; pointer-events: none; }
/* His room is part of the 3D picture, so the drawn one steps aside (its wall colour stays behind while 3D loads). */
body[data-look="3d"] #wall { inset: 0; background: #f5e6d1; }
body[data-look="3d"][data-animal="dog"] #wall { background: #bfe3f7; } /* Buddy's backyard: sky blue while it loads */
body[data-look="3d"][data-animal="monkey"] #wall { background: #d4ebd6; } /* Momo's jungle: misty green while it loads */
body[data-look="3d"][data-animal="duck"] #wall { background: #bfe3f7; } /* Daisy's farmyard: sky blue while it loads */
body[data-look="3d"][data-animal="pig"] #wall { background: #f9cf9e; } /* Pip's pigsty: apricot evening sky while it loads */
body[data-look="3d"][data-animal="bunny"] #wall { background: #cdeaf6; } /* Clover's meadow: spring sky while it loads */
body[data-look="3d"][data-animal="giraffe"] #wall { background: #d6cdea; } /* Gigi's zoo garden: soft lilac dawn sky while it loads */
body[data-look="3d"][data-animal="lion"] #wall { background: #f3dca0; } /* Leo's savanna: golden afternoon while it loads */
body[data-look="3d"][data-animal="penguin"] #wall { background: #cfe6f5; } /* Snowy's icy shore: pale polar sky while it loads */
body[data-look="3d"][data-animal="bear"] #wall { background: #d3e4f2; } /* the bear cub's snowy pine wood: pale sky and snow while it loads */
body[data-look="3d"][data-animal="parrot"] #wall { background: #bfeaf2; } /* Mango's beach cove: tropical sky while it loads */
body[data-look="3d"][data-animal="elephant"] #wall { background: #f4c9c4; } /* Ellie's waterfall pool: pink sunset sky while it loads */
body[data-look="3d"] #window, body[data-look="3d"] #floor { display: none; }
body[data-look="3d"] #start { background: rgba(246, 236, 220, .55); }
/* ...and the buttons show his toys in 3D (pictures added by app.js) instead of the drawn icons. */
.tool .i3d { display: none; width: 90%; height: 90%; object-fit: contain; pointer-events: none; -webkit-user-select: none; user-select: none; }
body[data-look="3d"] .tool svg.has3d { display: none !important; } /* only set once its picture has loaded */
body[data-look="3d"] .tool .i3d.ready:not([data-pet]),
body[data-look="3d"][data-animal="cat"] .tool .i3d.ready[data-pet="cat"],
body[data-look="3d"][data-animal="dog"] .tool .i3d.ready[data-pet="dog"],
body[data-look="3d"][data-animal="monkey"] .tool .i3d.ready[data-pet="monkey"],
body[data-look="3d"][data-animal="duck"] .tool .i3d.ready[data-pet="duck"],
body[data-look="3d"][data-animal="pig"] .tool .i3d.ready[data-pet="pig"],
body[data-look="3d"][data-animal="bunny"] .tool .i3d.ready[data-pet="bunny"],
body[data-look="3d"][data-animal="giraffe"] .tool .i3d.ready[data-pet="giraffe"],
body[data-look="3d"][data-animal="lion"] .tool .i3d.ready[data-pet="lion"],
body[data-look="3d"][data-animal="penguin"] .tool .i3d.ready[data-pet="penguin"] { display: block; } /* add a line for each new 3D pet */
body[data-look="3d"][data-animal="bear"] .tool .i3d.ready[data-pet="bear"],
body[data-look="3d"][data-animal="parrot"] .tool .i3d.ready[data-pet="parrot"],
body[data-look="3d"][data-animal="elephant"] .tool .i3d.ready[data-pet="elephant"] { display: block; } /* add a line for each new 3D pet */

/* duck: wings flap when listening, little tail waggles */
#toby[data-animal="duck"] #earL { transform-origin: 136px 360px; }
#toby[data-animal="duck"] #earR { transform-origin: 264px 360px; }
#toby[data-animal="duck"].listening #earL { transform: rotate(14deg); }
#toby[data-animal="duck"].listening #earR { transform: rotate(-14deg); }
#toby[data-animal="duck"].happy #earL, #toby[data-animal="duck"].dance #earL { animation: flapL .25s ease-in-out infinite; }
#toby[data-animal="duck"].happy #earR, #toby[data-animal="duck"].dance #earR { animation: flapR .25s ease-in-out infinite; }
@keyframes flapL { 50% { rotate: 22deg; } }
@keyframes flapR { 50% { rotate: -22deg; } }
#toby[data-animal="duck"] #tail { transform-origin: 300px 480px; }
#toby[data-animal="duck"] #mouthOpen { transform-origin: 200px 240px; }

/* bunny: long ears that perk up when listening and droop when sleepy, a fluffy tail that wiggles */
#toby[data-animal="bunny"] #earL { transform-origin: 164px 116px; }
#toby[data-animal="bunny"] #earR { transform-origin: 236px 116px; }
#toby[data-animal="bunny"].listening #earL { transform: rotate(-8deg) translateY(-6px); }
#toby[data-animal="bunny"].listening #earR { transform: rotate(8deg) translateY(-6px); }
#toby[data-animal="bunny"].sleep #earL { transform: rotate(-40deg); transition: transform 1.2s; }
#toby[data-animal="bunny"].sleep #earR { transform: rotate(40deg); transition: transform 1.2s; }
#toby[data-animal="bunny"] #tail { transform-origin: 306px 482px; }
#toby[data-animal="bunny"].happy #tail { animation: wag .25s ease-in-out infinite; }
#toby[data-animal="bunny"] #mouthOpen { transform-origin: 200px 258px; }

/* penguin: little flippers flap when listening or happy */
#toby[data-animal="penguin"] #earL { transform-origin: 130px 330px; }
#toby[data-animal="penguin"] #earR { transform-origin: 270px 330px; }
#toby[data-animal="penguin"].listening #earL { transform: rotate(16deg); }
#toby[data-animal="penguin"].listening #earR { transform: rotate(-16deg); }
#toby[data-animal="penguin"].happy #earL, #toby[data-animal="penguin"].dance #earL { animation: flapL .25s ease-in-out infinite; }
#toby[data-animal="penguin"].happy #earR, #toby[data-animal="penguin"].dance #earR { animation: flapR .25s ease-in-out infinite; }
#toby[data-animal="penguin"] #mouthOpen { transform-origin: 200px 240px; }

/* lion: round ears that perk up when listening, a long tail with a dark tuft that swishes */
#toby[data-animal="lion"] #earL { transform-origin: 128px 120px; }
#toby[data-animal="lion"] #earR { transform-origin: 272px 120px; }
#toby[data-animal="lion"].listening #earL { transform: rotate(-8deg) translateY(-4px); }
#toby[data-animal="lion"].listening #earR { transform: rotate(8deg) translateY(-4px); }
#toby[data-animal="lion"] #tail { transform-origin: 290px 500px; }
#toby[data-animal="lion"].happy #tail { animation: wag .4s ease-in-out infinite; }
#toby[data-animal="lion"] #mouthOpen { transform-origin: 200px 262px; }
/* parrot: wings flap when listening or happy, long tail feathers swish */
#toby[data-animal="parrot"] #earL { transform-origin: 140px 330px; }
#toby[data-animal="parrot"] #earR { transform-origin: 260px 330px; }
#toby[data-animal="parrot"].listening #earL { transform: rotate(14deg); }
#toby[data-animal="parrot"].listening #earR { transform: rotate(-14deg); }
#toby[data-animal="parrot"].happy #earL, #toby[data-animal="parrot"].dance #earL { animation: flapL .25s ease-in-out infinite; }
#toby[data-animal="parrot"].happy #earR, #toby[data-animal="parrot"].dance #earR { animation: flapR .25s ease-in-out infinite; }
#toby[data-animal="parrot"] #tail { transform-origin: 230px 470px; }
#toby[data-animal="parrot"] #mouthOpen { transform-origin: 200px 236px; }

/* ---------- changing pets: a clay button at the top right, and a gallery of every pet when it is held ---------- */
/* Clay, like the pets: soft light from the top left, a rounded rim underneath and a soft shadow on the ground. */
.clay-btn {
  background: radial-gradient(circle at 34% 26%, #fff 0, #fff8ee 28%, #f4dfc6 78%, #e9cbaa 100%);
  box-shadow: inset 0 -5px 9px rgba(160, 100, 50, .2), inset 0 4px 7px rgba(255, 255, 255, .9),
    0 5px 0 #e0bf9b, 0 11px 18px rgba(110, 60, 20, .24);
  border-radius: 50%; display: grid; place-items: center;
}
#animalToggle {
  position: absolute; z-index: 3;
  top: calc(env(safe-area-inset-top) + 14px); right: calc(env(safe-area-inset-right) + 14px);
  width: 72px; height: 72px; transition: transform .15s;
}
#animalToggle img { width: 92%; height: 92%; margin-top: -10%; -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 58%, transparent 70%); mask-image: radial-gradient(circle at 50% 42%, #000 58%, transparent 70%); pointer-events: none; filter: drop-shadow(0 2px 2px rgba(90, 50, 20, .25)); }
#animalToggle:active, #animalToggle.holding { transform: scale(.92) translateY(2px); }
/* the ring that fills while the button is held, then the gallery opens */
.hold-ring { position: absolute; inset: -7px; width: calc(100% + 14px); height: calc(100% + 14px); pointer-events: none; transform: rotate(-90deg); overflow: visible; }
.hold-ring circle { fill: none; stroke: #ff9f6b; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; opacity: 0; transition: stroke-dashoffset .1s, opacity .1s; }
#animalToggle.holding .hold-ring circle { stroke-dashoffset: 0; opacity: 1; transition: stroke-dashoffset .55s linear, opacity .1s; }

#gallery {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; touch-action: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); /* (app.js keeps the tiles inside it) */
}
#gallery[hidden] { display: none; }
/* the backdrop: the pet's own room, blurred and warmed, with a few soft clay bubbles floating in it */
.gal-bg {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(ellipse 85% 70% at 50% 45%, rgba(255, 246, 232, .82), rgba(250, 218, 182, .9));
  backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15);
  opacity: 0; transition: opacity .25s;
}
.gal-bg i {
  position: absolute; border-radius: 50%; width: var(--s); height: var(--s); left: var(--x); top: var(--y);
  background: radial-gradient(circle at 34% 28%, #fff 0, var(--c) 45%, var(--d) 100%);
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, .08), 0 14px 24px rgba(120, 70, 30, .16);
  opacity: .75; animation: drift 7s ease-in-out infinite alternate; animation-delay: var(--t);
}
.gal-bg i:nth-child(1) { --s: 22vmin; --x: -6vmin; --y: 8%;  --c: #ffd3b0; --d: #f2a982; --t: -1s; }
.gal-bg i:nth-child(2) { --s: 12vmin; --x: 82%;   --y: 4%;  --c: #cfe9b4; --d: #9cca7c; --t: -3s; }
.gal-bg i:nth-child(3) { --s: 8vmin;  --x: 70%;   --y: 88%; --c: #d9cdf8; --d: #a995e0; --t: -2s; }
.gal-bg i:nth-child(4) { --s: 26vmin; --x: 78%;   --y: 70%; --c: #c6e6fa; --d: #88bfe4; --t: -5s; }
.gal-bg i:nth-child(5) { --s: 9vmin;  --x: 6%;    --y: 80%; --c: #fff0b0; --d: #f2cf62; --t: -4s; }
.gal-bg i:nth-child(6) { --s: 6vmin;  --x: 44%;   --y: 3%;  --c: #ffd3b0; --d: #f2a982; --t: -6s; }
.gal-bg i:nth-child(7) { --s: 7vmin;  --x: 30%;   --y: 93%; --c: #cfe9b4; --d: #9cca7c; --t: -2.5s; }
@keyframes drift { to { transform: translate(2vmin, -3vmin) scale(1.06); } }

.gal-grid { /* every pet on one screen: app.js picks how many to a row (--cols) and how big (--tile) to suit the screen */
  --tile: min(28vw, 18dvh, 240px); --cols: 3; --gx: .1; --gy: .2;
  position: relative; display: flex; flex-wrap: wrap; justify-content: center; /* a short last row sits in the middle */
  width: calc(var(--cols) * var(--tile) + (var(--cols) - 1) * var(--tile) * var(--gx));
  gap: calc(var(--tile) * var(--gy)) calc(var(--tile) * var(--gx));
  padding-top: calc(var(--tile) * .18);
}
.gal-pet { flex: none; }
/* each pet stands on a puffy clay tile in the colours of its own setting */
.gal-pet {
  --c: #ffd8b4; --d: #eca877; --e: #d98f5c;
  position: relative; width: var(--tile); height: var(--tile); border-radius: 30%;
  background:
    radial-gradient(70% 55% at 30% 18%, rgba(255, 255, 255, .8), rgba(255, 255, 255, 0) 70%),
    radial-gradient(130% 110% at 50% 10%, var(--c) 45%, var(--d) 100%);
  box-shadow: inset 0 -12px 22px rgba(0, 0, 0, .1), inset 0 10px 16px rgba(255, 255, 255, .7),
    0 calc(var(--tile) * .05) 0 var(--e), 0 calc(var(--tile) * .1) calc(var(--tile) * .12) rgba(110, 60, 20, .28);
  transform: scale(.3) translateY(40%); opacity: 0;
  transition: transform .45s cubic-bezier(.3, 1.55, .5, 1), opacity .2s;
  transition-delay: calc(var(--i) * 60ms);
}
.gal-pet[data-pet="dog"] { --c: #d3ecb4; --d: #9ccd78; --e: #7fb25c; }
.gal-pet[data-pet="monkey"] { --c: #e4dafc; --d: #b4a1e8; --e: #9682d0; }
.gal-pet[data-pet="duck"] { --c: #cdeafb; --d: #8cc3ea; --e: #6ea8d2; }
.gal-pet[data-pet="pig"] { --c: #fbe3b8; --d: #f0bd72; --e: #d99e52; }
.gal-pet[data-pet="bunny"] { --c: #fbd9e4; --d: #eda7bf; --e: #d98aa6; }
.gal-pet[data-pet="giraffe"] { --c: #fde3d3; --d: #f2b79a; --e: #dc9677; }
.gal-pet[data-pet="lion"] { --c: #fbe7b0; --d: #ecc566; --e: #d4a643; }
.gal-pet[data-pet="penguin"] { --c: #d6ecfa; --d: #93c6e6; --e: #6aa6cf; }
.gal-pet[data-pet="bear"] { --c: #fbe6c4; --d: #f2c27a; --e: #d9a250; }
.gal-pet[data-pet="parrot"] { --c: #c8f0ee; --d: #7fd3cf; --e: #55b5b2; }
.gal-pet[data-pet="elephant"] { --c: #c9efe6; --d: #86d1c0; --e: #62b5a3; }
/* a soft sunken spot where the pet stands, and the pet itself standing up out of the tile */
.gal-floor {
  position: absolute; left: 16%; right: 16%; bottom: 9%; height: 16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(80, 40, 10, .3), rgba(80, 40, 10, .12) 60%, rgba(80, 40, 10, 0));
}
.gal-who {
  position: absolute; left: 50%; bottom: 4%; width: 112%; height: 112%; margin-left: -56%; pointer-events: none;
  transform-origin: 50% 92%; animation: galBreathe 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.7s);
}
/* the 3D pictures have more room round the pet than the drawn ones: stand them as tall */
.gal-who.is3d { width: 128%; height: 128%; margin-left: -64%; bottom: 0; }
/* a 3D pet in its own setting: the picture sits in the tile like a deep window in a clay frame */
.gal-scene { display: none; }
.gal-pet.in-scene .gal-scene {
  display: block; position: absolute; inset: 7%; width: 86%; height: 86%; border-radius: 26%; object-fit: cover; pointer-events: none;
}
.gal-pet.in-scene::after {
  content: ""; position: absolute; inset: 7%; border-radius: 26%; pointer-events: none;
  box-shadow: inset 0 6px 12px rgba(60, 30, 10, .3), inset 0 -3px 6px rgba(255, 255, 255, .35);
}
.gal-pet.in-scene .gal-who, .gal-pet.in-scene .gal-floor { display: none; }
@keyframes galBreathe { 50% { transform: scale(1.025, .985); } }
.gal-pet:active { transform: scale(.94) translateY(3%) !important; transition-duration: .1s; transition-delay: 0s; }
.gal-pet.picked .gal-who, .gal-pet.picked .gal-scene { animation: galHop .45s cubic-bezier(.3, .7, .4, 1); }
@keyframes galHop { 20% { transform: scale(1.08, .9); } 50% { transform: translateY(-14%) scale(.96, 1.05); } 80% { transform: scale(1.05, .94); } }

.gal-close { position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: calc(env(safe-area-inset-right) + 14px); width: 60px; height: 60px; transform: scale(0); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1) .15s; }
.gal-close svg { width: 46%; height: 46%; }

#gallery.open .gal-bg { opacity: 1; }
#gallery.open .gal-pet { transform: none; opacity: 1; }
#gallery.open .gal-close { transform: none; }
#gallery.closing .gal-pet { transition: transform .22s ease-in, opacity .22s; transition-delay: 0s; transform: scale(.6); opacity: 0; }
#gallery.closing .gal-pet.picked { transform: scale(1.12); }
#gallery.closing .gal-close { transform: scale(0); transition-delay: 0s; }

@media (min-width: 700px) and (min-height: 700px) {
  #animalToggle { top: calc(env(safe-area-inset-top) + 20px); right: calc(env(safe-area-inset-right) + 20px); width: 92px; height: 92px; }
  .gal-close { top: calc(env(safe-area-inset-top) + 20px); right: calc(env(safe-area-inset-right) + 20px); width: 76px; height: 76px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* on a phone held sideways the toy buttons are down the right edge, so the pet button sits just left of them */
  #animalToggle { right: calc(env(safe-area-inset-right) + 32px + 22vmin); width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .gal-bg i, .gal-who { animation: none; }
}

/* ---------- the grown-up parts: welcome, the grown-ups' button, the gate, the grown-ups' corner ---------- */
/* Same clay and warm cream as the pets' buttons. These are the only screens with words: they are for the parent. */
:root {
  --gu-ink: #4a2f1c; --gu-soft: #8a6a52; --gu-cream: #fff8ee; --gu-line: #f0dcc4;
  --gu-coral: #ff8f6b; --gu-coral-dark: #d9653f; --gu-green: #5fb85a;
  --gu-font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, sans-serif;
}

/* the grown-ups' button: smaller and quieter than the toddler's buttons, top left */
#grownBtn {
  position: absolute; z-index: 3;
  top: calc(env(safe-area-inset-top) + 18px); left: calc(env(safe-area-inset-left) + 16px);
  width: 52px; height: 52px; opacity: .82; transition: transform .15s, opacity .15s;
}
#grownBtn .gear { width: 62%; height: 62%; }
#grownBtn:active, #grownBtn.holding { transform: scale(.92) translateY(2px); opacity: 1; }
#grownBtn.holding .hold-ring circle { stroke-dashoffset: 0; opacity: 1; transition: stroke-dashoffset 1.5s linear, opacity .1s; }
#grownBtn.holding .gear { animation: gearTurn 1.5s linear; }
@keyframes gearTurn { to { transform: rotate(120deg); } }
.mic-off-dot {
  position: absolute; right: -5px; bottom: -5px; width: 24px; height: 24px; border-radius: 50%;
  background: #b98b62; box-shadow: 0 0 0 2.5px #fff8ee; display: none; place-items: center;
}
.mic-off-dot svg { width: 16px; height: 16px; }
#grownBtn.mic-off .mic-off-dot { display: grid; }
#grownHint {
  position: absolute; z-index: 4; pointer-events: none;
  top: calc(env(safe-area-inset-top) + 28px); left: calc(env(safe-area-inset-left) + 80px);
  padding: 8px 14px; border-radius: 14px; background: rgba(74, 47, 28, .86); color: #fff;
  font: 650 14.5px/1.2 var(--gu-font); white-space: nowrap;
  opacity: 0; transform: translateX(-6px); transition: opacity .2s, transform .2s;
}
#grownHint::before { content: ""; position: absolute; left: -6px; top: 50%; margin-top: -6px; border: 6px solid transparent; border-left: 0; border-right-color: rgba(74, 47, 28, .86); }
#grownHint.show { opacity: 1; transform: none; }

/* a grown-up screen: the play blurred behind, a cream card in front */
.sheet {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top) + 16px) calc(env(safe-area-inset-right) + 16px) calc(env(safe-area-inset-bottom) + 16px) calc(env(safe-area-inset-left) + 16px);
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  color: var(--gu-ink); font-family: var(--gu-font);
  -webkit-user-select: none; user-select: none;
}
.sheet[hidden] { display: none; }
.sheet-bg {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 90% 75% at 50% 45%, rgba(255, 246, 232, .78), rgba(250, 218, 182, .9));
  backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  opacity: 0; transition: opacity .25s;
}
.sheet.open .sheet-bg { opacity: 1; }
.card, .corner-panel {
  position: relative; width: 100%; max-width: 430px; border-radius: 30px;
  background: linear-gradient(#fffdf9, var(--gu-cream));
  box-shadow: 0 2px 0 #fff inset, 0 7px 0 #ecd3b6, 0 22px 50px rgba(110, 60, 20, .22);
  opacity: 0; transform: translateY(18px) scale(.97); transition: opacity .25s, transform .3s cubic-bezier(.2, .9, .3, 1.15);
}
.sheet.open .card, .sheet.open .corner-panel { opacity: 1; transform: none; }
.sheet h1, .sheet h2 { margin: 0; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
.sheet p { margin: 0; text-wrap: pretty; }
.sheet b { font-weight: 700; }

.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px;
  border-radius: 22px; background: var(--gu-coral); color: #fff; font: 800 19px/1.2 var(--gu-font);
  box-shadow: 0 5px 0 var(--gu-coral-dark), 0 10px 18px rgba(217, 101, 63, .3);
  transition: transform .1s, box-shadow .1s;
}
.big-btn svg { width: 24px; height: 24px; flex: none; }
.big-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gu-coral-dark), 0 4px 10px rgba(217, 101, 63, .3); }
.text-btn { min-height: 48px; padding: 0 22px; border-radius: 16px; color: var(--gu-soft); font: 700 17px/1 var(--gu-font); }
.text-btn:active { background: rgba(185, 139, 98, .12); }
.sheet button:focus-visible { outline: 3px solid #5aa9e6; outline-offset: 3px; }

/* welcome */
.welcome-card { padding: 26px 24px 18px; text-align: center; display: grid; }
.w-ask, .w-later { display: grid; gap: 16px; justify-items: center; }
.w-ask[hidden], .w-later[hidden] { display: none; }
.welcome-card h1 { font-size: 26px; line-height: 1.15; }
.welcome-card p { font-size: 17px; line-height: 1.45; color: var(--gu-soft); }
.welcome-card .w-how { color: var(--gu-ink); }
.w-pets { position: relative; display: flex; justify-content: center; align-items: flex-end; height: 112px; margin: -4px 0 -2px; }
.w-pets img {
  width: 92px; height: 92px; object-fit: contain; margin: 0 -10px; border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #fff 0, #fff8ee 30%, #f4dfc6 80%, #e9cbaa 100%);
  box-shadow: inset 0 -4px 8px rgba(160, 100, 50, .18), 0 4px 0 #e6c7a3, 0 9px 14px rgba(110, 60, 20, .16);
  animation: faceBob 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * -.85s);
}
.w-pets img:nth-of-type(2) { width: 112px; height: 112px; z-index: 1; }
@keyframes faceBob { 50% { transform: translateY(-5px) rotate(-2deg); } }
/* a little microphone on the middle pet, with a soft pulse */
.w-mic {
  position: absolute; z-index: 2; left: calc(50% + 36px); bottom: 4px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--gu-coral); box-shadow: 0 0 0 3px #fffaf3, 0 3px 0 3px #ecd3b6; display: grid; place-items: center;
}
.w-mic svg { width: 22px; height: 22px; }
.w-mic::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--gu-coral); animation: micPulse 1.8s ease-out infinite; }
@keyframes micPulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }
.welcome-card.later .w-pets img { animation-duration: 3.4s; }
.promises { list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 10px; width: 100%; text-align: left; border-radius: 20px; background: #fdf0df; }
.promises li { display: flex; align-items: center; gap: 12px; font-size: 16.5px; font-weight: 650; line-height: 1.25; }
.tick { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--gu-green); position: relative; box-shadow: 0 2px 0 #43913f; }
.tick::after { content: ""; position: absolute; left: 9px; top: 5px; width: 6px; height: 11px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.welcome-card .fine { font-size: 15px; margin-top: -6px; }
.mini-gear { display: inline-block; width: 26px; height: 26px; vertical-align: -7px; margin: 0 2px; border-radius: 50%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M27.5 6h9l1.6 7.1a19 19 0 0 1 4.6 2.7l6.9-2.3 4.5 7.8-5.4 4.9a19 19 0 0 1 0 5.4l5.4 4.9-4.5 7.8-6.9-2.3a19 19 0 0 1-4.6 2.7L36.5 58h-9l-1.6-7.1a19 19 0 0 1-4.6-2.7l-6.9 2.3-4.5-7.8 5.4-4.9a19 19 0 0 1 0-5.4L9.9 27.5l4.5-7.8 6.9 2.3a19 19 0 0 1 4.6-2.7Z' fill='%23d9b28c' stroke='%23b98b62' stroke-width='3' stroke-linejoin='round'/%3E%3Ccircle cx='32' cy='32' r='8.5' fill='%23fff8ee' stroke='%23b98b62' stroke-width='3'/%3E%3C/svg%3E") center / 66% no-repeat,
    radial-gradient(circle at 34% 26%, #fff 0, #fff8ee 28%, #f4dfc6 78%, #e9cbaa 100%);
  box-shadow: 0 2px 0 #e0bf9b; }

/* the gate */
.gate-card { max-width: 360px; padding: 26px 22px 22px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.gate-card h2 { font-size: 24px; }
.gate-sub { font-size: 16px; color: var(--gu-soft); }
.sheet-close {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; color: var(--gu-soft);
  display: grid; place-items: center; background: #f6e6d2;
}
.sheet-close svg { width: 20px; height: 20px; }
.gate-q { display: flex; align-items: center; gap: 12px; margin: 14px 0 16px; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gate-ans { display: flex; gap: 6px; }
.gate-ans i {
  font-style: normal; width: 44px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: #fdf0df; box-shadow: inset 0 0 0 2.5px var(--gu-line);
}
.gate-ans i.next { box-shadow: inset 0 0 0 3px var(--gu-coral); }
#gate.right .gate-ans i { background: #e4f4df; box-shadow: inset 0 0 0 3px var(--gu-green); color: #357a32; }
#gate.shake .gate-q { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.keypad button {
  height: 60px; border-radius: 18px; font: 750 26px/1 var(--gu-font); color: var(--gu-ink); display: grid; place-items: center;
  background: radial-gradient(circle at 34% 20%, #fff 0, #fffaf3 40%, #f5e5d1 100%);
  box-shadow: inset 0 -3px 6px rgba(160, 100, 50, .12), 0 4px 0 #e8cfb0; transition: transform .08s, box-shadow .08s;
}
.keypad button:active { transform: translateY(3px); box-shadow: inset 0 -3px 6px rgba(160, 100, 50, .12), 0 1px 0 #e8cfb0; }
.keypad button svg { width: 28px; height: 28px; }

/* the grown-ups' corner */
#corner { place-items: stretch center; padding-bottom: 0; overflow: hidden; }
.corner-panel {
  max-width: 560px; display: flex; flex-direction: column; min-height: 0; height: 100%;
  border-radius: 30px 30px 0 0; box-shadow: 0 2px 0 #fff inset, 0 -4px 40px rgba(110, 60, 20, .18);
  transform: translateY(40px);
}
.corner-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 12px 24px; border-bottom: 1.5px solid var(--gu-line); }
.corner-head h2 { font-size: 24px; }
.done-btn { min-height: 46px; padding: 0 20px; border-radius: 16px; background: var(--gu-coral); color: #fff; font: 800 17px/1 var(--gu-font); box-shadow: 0 4px 0 var(--gu-coral-dark); }
.done-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gu-coral-dark); }
.corner-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  padding: 6px 16px calc(env(safe-area-inset-bottom) + 24px);
}
.corner-scroll h3 { margin: 20px 8px 8px; font-size: 14px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--gu-soft); }
.group { border-radius: 22px; background: #fff; box-shadow: 0 0 0 1.5px var(--gu-line), 0 3px 0 #f1dfc9; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 16px; text-align: left; color: inherit;
  list-style: none; cursor: pointer;
}
.group > * + * { border-top: 1.5px solid #f6ead9; }
.row::-webkit-details-marker { display: none; }
button.row:active, summary.row:active { background: #fdf3e6; }
.row-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.row-title { font-size: 17.5px; font-weight: 700; line-height: 1.25; }
.row-sub { font-size: 14.5px; color: var(--gu-soft); line-height: 1.3; }
.row.soon { cursor: default; }
.row.soon .row-title, .row.soon .row-icon { opacity: .55; }
.row.soon .chev { display: none; }
.chev { flex: none; width: 10px; height: 10px; border: solid #c9a789; border-width: 0 3px 3px 0; transform: rotate(-45deg); margin-right: 4px; transition: transform .2s; }
details[open] > summary .chev { transform: rotate(45deg); }
.chev.out { transform: rotate(-90deg); width: 12px; height: 12px; border-width: 3px 3px 0 0; }
.more { padding: 2px 18px 18px 66px; font-size: 16px; line-height: 1.5; color: #5d4330; }
.more p + p, .more p + ul, .more p + ol, .more ul + .link-btn { margin-top: 10px; }
.more ul, .more ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.link-btn { margin-top: 12px; min-height: 44px; padding: 0 16px; border-radius: 14px; background: #fdf0df; color: var(--gu-ink); font: 700 15.5px/1.2 var(--gu-font); }
.link-btn.soon { color: var(--gu-soft); cursor: default; }
.mic-help { padding: 12px 18px 16px 66px; font-size: 15.5px; line-height: 1.45; background: #fff6ec; color: #5d4330; }

/* the switches */
.switch { flex: none; position: relative; width: 62px; height: 36px; border-radius: 18px; background: #e7d3bd; transition: background .2s; box-shadow: inset 0 2px 4px rgba(120, 70, 30, .18); }
.switch i { position: absolute; left: 3px; top: 3px; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(90, 50, 20, .3); transition: transform .22s cubic-bezier(.3, 1.4, .5, 1); }
.switch[aria-checked="true"] { background: var(--gu-green); }
.switch[aria-checked="true"] i { transform: translateX(26px); }

/* row icons: little clay tiles */
.row-icon { flex: none; width: 36px; height: 36px; border-radius: 11px; background: #ffe2cf center / 22px no-repeat; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .06); }
.ic-sound { background-color: #ffe0d2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%23e8734f'/%3E%3Cpath d='M16 9a4 4 0 0 1 0 6M18.5 6.5a7.5 7.5 0 0 1 0 11' fill='none' stroke='%23e8734f' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ic-mic { background-color: #dcefd8; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='8.5' y='2.5' width='7' height='12' rx='3.5' fill='%234f9e4a'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5v3.5M8.5 21h7' fill='none' stroke='%234f9e4a' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ic-lock { background-color: #dfe8f7; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='10.5' width='14' height='10' rx='3' fill='%234f7fc8'/%3E%3Cpath d='M8 10.5V8a4 4 0 0 1 8 0v2.5' fill='none' stroke='%234f7fc8' stroke-width='2.2'/%3E%3C/svg%3E"); }
.ic-wave { background-color: #fff0c9; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 12a7 7 0 1 1-2.05-4.95' fill='none' stroke='%23e0a82a' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M18.5 3.5v4.5H14' fill='none' stroke='%23e0a82a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-shield { background-color: #dcefd8; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10v-6z' fill='%234f9e4a'/%3E%3Cpath d='M8.5 12l2.5 2.5 4.5-5' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-help { background-color: #e9e1f8; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-6l-5 4v-4a3 3 0 0 1-2-3z' fill='%238567cf'/%3E%3Ccircle cx='8.5' cy='10' r='1.3' fill='%23fff'/%3E%3Ccircle cx='12' cy='10' r='1.3' fill='%23fff'/%3E%3Ccircle cx='15.5' cy='10' r='1.3' fill='%23fff'/%3E%3C/svg%3E"); }
.ic-heart { background-color: #ffe0e4; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20s-8-4.7-8-10.5A4.5 4.5 0 0 1 12 6.6a4.5 4.5 0 0 1 8 2.9C20 15.3 12 20 12 20z' fill='%23e05a6f'/%3E%3C/svg%3E"); }
.ic-star { background-color: #fff0c9; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3-4.6-4.4 6.3-.9z' fill='%23e8a91f' stroke='%23e8a91f' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.corner-foot { margin: 26px 0 4px; text-align: center; font-size: 14px; line-height: 1.6; color: var(--gu-soft); }

/* short landscape phones: the cards scroll, and the welcome pictures shrink */
@media (max-height: 560px) {
  .sheet { place-items: start center; }
  .w-pets { height: 84px; } .w-pets img { width: 70px; height: 70px; } .w-pets img:nth-of-type(2) { width: 84px; height: 84px; }
  .keypad button { height: 48px; }
  .gate-q { margin: 6px 0 10px; }
}
/* iPad and bigger: a touch larger, and the corner floats as a card */
@media (min-width: 700px) and (min-height: 700px) {
  .card { max-width: 480px; }
  .welcome-card { padding: 34px 34px 22px; }
  .welcome-card h1 { font-size: 30px; }
  #corner { place-items: center; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
  .corner-panel { height: min(86vh, 860px); border-radius: 30px; box-shadow: 0 2px 0 #fff inset, 0 7px 0 #ecd3b6, 0 22px 50px rgba(110, 60, 20, .22); }
}
@media (prefers-reduced-motion: reduce) {
  .w-pets img, .w-mic::after, #grownBtn.holding .gear { animation: none; }
  .card, .corner-panel { transition: opacity .2s; transform: none; }
}
/* landscape phones: the welcome and the gate sit side by side, so they fit without scrolling */
@media (orientation: landscape) and (max-height: 560px) {
  .sheet { place-items: center; }
  .welcome-card { max-width: 700px; padding: 18px 22px; }
  .w-ask, .w-later { grid-template-columns: 1fr 1fr; column-gap: 26px; row-gap: 10px; align-items: center; }
  .w-ask > *, .w-later > * { grid-column: 2; }
  .w-ask > .w-pets, .w-ask > h1, .w-ask > p:not(.fine), .w-later > .w-pets, .w-later > h1 { grid-column: 1; }
  .w-ask > .w-pets { grid-row: 1 / 3; align-self: end; } .w-ask > h1 { grid-row: 3; } .w-ask > p:not(.fine) { grid-row: 4 / 6; align-self: start; }
  .w-ask > .promises { grid-row: 1 / 3; } .w-ask > .big-btn { grid-row: 3; } .w-ask > .fine { grid-row: 4; margin: 0; } .w-ask > .text-btn { grid-row: 5; }
  .w-later > .w-pets { grid-row: 1; align-self: end; } .w-later > h1 { grid-row: 2 / 4; align-self: start; }
  .welcome-card h1 { font-size: 23px; }
  .welcome-card p { font-size: 15.5px; }
  .gate-card { max-width: 600px; grid-template-columns: 1fr 1.15fr; column-gap: 22px; padding: 18px 22px; align-items: center; }
  .gate-card > * { grid-column: 1; }
  .gate-card > .keypad { grid-column: 2; grid-row: 1 / 5; }
  .gate-card > .sheet-close { grid-column: auto; top: 8px; right: auto; left: 8px; }
  .keypad button { height: 50px; }
  .sheet-close { width: 40px; height: 40px; }
}

/* giraffe: little ears flick when listening, a thin tail with a dark tuft that swishes */
#toby[data-animal="giraffe"] #earL { transform-origin: 160px 104px; }
#toby[data-animal="giraffe"] #earR { transform-origin: 240px 104px; }
#toby[data-animal="giraffe"].listening #earL { transform: rotate(-10deg); }
#toby[data-animal="giraffe"].listening #earR { transform: rotate(10deg); }
#toby[data-animal="giraffe"] #tail { transform-origin: 284px 430px; }
#toby[data-animal="giraffe"].happy #tail { animation: wag .4s ease-in-out infinite; }
#toby[data-animal="giraffe"] #mouthOpen { transform-origin: 200px 196px; }
