:root {
  --sky-top: #9fdcff;
  --sky-bottom: #e4f6ff;
  --grass: #7fd36b;
  --grass-dark: #5fb84d;
  --sun: #ffd84d;
  --zk: #b9a7ff;          /* one light body color */
  --zk-line: #4a3f7a;
  --zk-cheek: #ff9fc0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--sky-bottom);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* fixed + inset: follows the visible viewport, so browser toolbars never hide the bottom corners */
.room {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ---------- Rooms (scenes) ----------
   Each room is a .scene block in index.html; only the active one is shown.
   Decorations are aria-hidden, animate transform/opacity only, and stop under reduced motion. */
.room { transition: background .4s; }
.room--garden { background: linear-gradient(var(--sky-top), var(--sky-bottom) 65%); }
.room--beach  { background: linear-gradient(#7fd0ff, #d9f1ff 45%, #fff1d6 62%); }
.scene { position: absolute; inset: 0; pointer-events: none; animation: scene-in .5s ease-out; }
@keyframes scene-in { from { opacity: 0; } }

.deco { position: absolute; display: block; }

/* Sun with slowly turning rays */
.sun {
  position: absolute;
  top: 6vmin;
  left: 6vmin;
  width: 18vmin;
  height: 18vmin;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 3vmin rgba(255, 216, 77, .3);
}
.sun::before {
  content: "";
  position: absolute;
  inset: -7vmin;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 216, 77, .35) 0 10deg, transparent 10deg 30deg);
  animation: spin 40s linear infinite;
  z-index: -1;
}
.sun--low { top: auto; bottom: 42%; left: auto; right: 14vmin; width: 22vmin; height: 22vmin; }
@keyframes spin { to { transform: rotate(1turn); } }

/* Clouds drift a little and come back */
.cloud {
  position: absolute;
  width: 26vmin;
  height: 8vmin;
  border-radius: 8vmin;
  background: #fff;
  opacity: .9;
  animation: drift 18s ease-in-out infinite alternate;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}
.cloud::before { width: 12vmin; height: 12vmin; top: -6vmin; left: 5vmin; }
.cloud::after  { width: 9vmin;  height: 9vmin;  top: -4vmin; left: 13vmin; }
.cloud--1 { top: 12vmin; right: 10vmin; }
.cloud--2 { top: 26vmin; right: 48vmin; transform: scale(.7); animation-duration: 24s; }
.cloud--3 { top: 4vmin; right: 60vmin; transform: scale(.5); animation-duration: 30s; opacity: .7; }
@keyframes drift { to { translate: -8vmin 0; } }

/* Garden ground: far hill, tree, fence, grass, bushes, flowers, butterfly */
.hill {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: 24%;
  height: 22%;
  border-radius: 50% 50% 0 0;
  background: #a6e08f;
}
.tree { position: absolute; left: -4vmin; bottom: 27%; width: 30vmin; height: 40vmin; }
.tree::before {   /* trunk */
  content: "";
  position: absolute;
  left: 12vmin;
  bottom: 0;
  width: 6vmin;
  height: 16vmin;
  border-radius: 2vmin;
  background: #9b6a43;
}
.tree-top {
  position: absolute;
  left: 0;
  bottom: 12vmin;
  width: 30vmin;
  height: 26vmin;
  border-radius: 50%;
  background: #5fb84d;
  box-shadow: inset -3vmin -3vmin 0 rgba(0, 0, 0, .08);
  transform-origin: 50% 100%;
  animation: sway 6s ease-in-out infinite;
}
.tree-top::before, .tree-top::after {   /* apples */
  content: "";
  position: absolute;
  width: 3.5vmin;
  height: 3.5vmin;
  border-radius: 50%;
  background: #ef4b4b;
}
.tree-top::before { left: 8vmin; top: 9vmin; }
.tree-top::after  { left: 18vmin; top: 14vmin; }
.fence {
  position: absolute;
  right: 0;
  bottom: 31%;
  width: 34vmin;
  height: 7vmin;
  background:
    linear-gradient(#f4e3c3, #f4e3c3) 0 30% / 100% 1.2vmin no-repeat,
    linear-gradient(#f4e3c3, #f4e3c3) 0 75% / 100% 1.2vmin no-repeat,
    repeating-linear-gradient(90deg, #fff4dd 0 2.4vmin, transparent 2.4vmin 6vmin);
}

.grass {
  position: absolute;
  inset: auto 0 0 0;
  height: 32%;
  background: var(--grass);
  border-top: 1.5vmin solid var(--grass-dark);
  border-radius: 50% 50% 0 0 / 6vmin 6vmin 0 0;
}
.bush {
  position: absolute;
  top: -5vmin;
  width: 16vmin;
  height: 9vmin;
  border-radius: 9vmin 9vmin 0 0;
  background: #4eaa3c;
}
.bush::before {
  content: "";
  position: absolute;
  left: 8vmin;
  top: -3vmin;
  width: 11vmin;
  height: 11vmin;
  border-radius: 50%;
  background: inherit;
}
.bush--1 { left: 22%; }
.bush--2 { right: 4%; transform: scale(.8); }

.flower {
  position: absolute;
  width: 5vmin;
  height: 5vmin;
  border-radius: 50%;
  background: #ffe066;
  --petal: #ff7aa8;
  box-shadow:
    0 -4vmin 0 -.5vmin var(--petal),
    0  4vmin 0 -.5vmin var(--petal),
    4vmin 0 0 -.5vmin var(--petal),
   -4vmin 0 0 -.5vmin var(--petal);
  animation: sway 4s ease-in-out infinite;
}
.flower--1 { top: 30%; left: 12%; }
.flower--2 { top: 55%; right: 10%; --petal: #b9a7ff; animation-delay: -1s; }
.flower--3 { top: 65%; left: 35%; scale: .75; animation-delay: -2s; }
.flower--4 { top: 40%; right: 30%; scale: .6; --petal: #ff9f5a; animation-delay: -3s; }
.flower--5 { top: 75%; left: 8%; scale: .65; --petal: #6ec6ff; }
@keyframes sway {
  0%, 100% { rotate: -6deg; }
  50%      { rotate: 6deg; }
}

.butterfly { width: 9vmin; top: 38%; left: 10%; animation: flutter 14s ease-in-out infinite; }
@keyframes flutter {
  0%   { translate: 0 0; rotate: -8deg; }
  25%  { translate: 30vw -8vh; rotate: 10deg; }
  50%  { translate: 60vw 2vh; rotate: -6deg; }
  75%  { translate: 25vw 6vh; rotate: 8deg; }
  100% { translate: 0 0; rotate: -8deg; }
}

/* Beach: sea with moving waves, boat, gulls, sand, palm, crab, shell */
.sea {
  position: absolute;
  inset: auto 0 26% 0;
  height: 20%;
  background: linear-gradient(#3fb3e6, #7fd6f5);
  overflow: hidden;
}
.wave {
  position: absolute;
  left: 0;
  width: 200%;
  height: 4vmin;
  background: radial-gradient(circle at 3vmin -1vmin, transparent 3.2vmin, rgba(255, 255, 255, .55) 3.4vmin) 0 0 / 6vmin 4vmin repeat-x;
  animation: waves 6s linear infinite;
}
.wave--1 { top: 25%; }
.wave--2 { top: 62%; opacity: .6; animation-duration: 9s; animation-direction: reverse; }
@keyframes waves { to { translate: -6vmin 0; } }

.boat-deco { width: 14vmin; right: 18%; bottom: 36%; animation: bob 3s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { translate: 0 0; rotate: -4deg; }
  50%      { translate: 0 -1.2vmin; rotate: 4deg; }
}

.gull {
  position: absolute;
  width: 6vmin;
  height: 3vmin;
  animation: glide 22s linear infinite;
}
.gull::before, .gull::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3vmin;
  height: 3vmin;
  border-top: .7vmin solid #4a3f7a;
  border-radius: 50% 50% 0 0;
}
.gull::before { left: 0; }
.gull::after  { left: 2.6vmin; }
.gull--1 { top: 30%; right: -10vmin; }
.gull--2 { top: 36%; right: -20vmin; scale: .7; animation-delay: -9s; }
@keyframes glide { to { translate: calc(-100vw - 30vmin) -6vh; } }

.sand {
  position: absolute;
  inset: auto 0 0 0;
  height: 28%;
  background:
    radial-gradient(circle, rgba(201, 150, 80, .35) 0 .5vmin, transparent .6vmin) 0 0 / 7vmin 6vmin,
    #f5d69a;
  border-top: 1.5vmin solid #ffe9bd;
  border-radius: 40% 60% 0 0 / 5vmin 5vmin 0 0;
}
.crab { width: 10vmin; left: 12%; top: 40%; animation: scuttle 9s ease-in-out infinite; }
@keyframes scuttle {
  0%, 100% { translate: 0 0; }
  45%, 55% { translate: 22vw 0; }
}
.shell { width: 8vmin; right: 10%; top: 62%; rotate: -15deg; }

.palm { position: absolute; left: 2vmin; bottom: 22%; width: 34vmin; height: 52vmin; }
.palm::before {   /* trunk */
  content: "";
  position: absolute;
  left: 10vmin;
  bottom: 0;
  width: 5vmin;
  height: 40vmin;
  border-radius: 3vmin;
  background: repeating-linear-gradient(#b07a46 0 3vmin, #9a6638 3vmin 4vmin);
  transform: rotate(8deg);
  transform-origin: 50% 100%;
}
.palm-crown {
  position: absolute;
  left: 13vmin;
  top: 6vmin;
  animation: sway 5s ease-in-out infinite;
  transform-origin: 0 0;
}
.palm-leaf {
  position: absolute;
  left: 0;
  top: 0;
  width: 18vmin;
  height: 5vmin;
  border-radius: 0 100% 0 100%;
  background: #3f9b3a;
  transform-origin: 0 50%;
}
.palm-leaf:nth-child(1) { rotate: -160deg; }
.palm-leaf:nth-child(2) { rotate: -120deg; }
.palm-leaf:nth-child(3) { rotate: -60deg; }
.palm-leaf:nth-child(4) { rotate: -20deg; }
.palm-leaf:nth-child(5) { rotate: 20deg; width: 14vmin; }
.palm-leaf:nth-child(6) { rotate: 160deg; width: 14vmin; }

/* Beach huts instead of wooden doors */
.room--beach .door-frame { fill: #2f86b4; }
.room--beach .door-leaf  { fill: #fdfdfd; }
.room--beach .door.is-locked .door-leaf { fill: #9fcbe0; }

@media (prefers-reduced-motion: reduce) {
  .scene *, .scene *::before, .scene *::after { animation: none !important; }
}

/* ---------- Zakzak ---------- */
.zakzak {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  width: min(60vw, 46vh);
  min-width: 96px;
  min-height: 96px;
  border: 0;
  background: none;
  cursor: pointer;
  outline: none;
}
.zakzak svg { display: block; width: 100%; height: auto; overflow: visible; }

.zk-fill, .zk-leg, .zk-horn { fill: var(--zk); stroke: var(--zk-line); stroke-width: 4; stroke-linejoin: round; }
.zk-cheek { fill: var(--zk-cheek); opacity: .7; }
.zk-eye-white { fill: #fff; stroke: var(--zk-line); stroke-width: 3; }
.zk-pupil { fill: var(--zk-line); }
.zk-shine { fill: #fff; }
.zk-mouth { fill: none; stroke: var(--zk-line); stroke-width: 4; stroke-linecap: round; }

/* Blink: squash the eye vertically around its own center */
.zk-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: zk-blink 4s infinite;
}
@keyframes zk-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(.08); }
}

/* Gentle idle breathing */
.zk-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: zk-breathe 3s ease-in-out infinite;
}
@keyframes zk-breathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.02, .98); }
}

@media (prefers-reduced-motion: reduce) {
  .zk-body { animation: none; }
}

/* ---------- Expressions (idle / right / wrong) ---------- */
.zk-happy-eye, .zk-brow { fill: none; stroke: var(--zk-line); stroke-width: 5; stroke-linecap: round; }
.zk-mouth--right, .zk-mouth--wrong { fill: var(--zk-line); }

.zk-happy-eye, .zk-brow,
.zk-mouth--right, .zk-mouth--wrong { display: none; }

.zakzak svg { transform-origin: 50% 100%; }
.zk-pupil, .zk-shine { transition: transform .15s; }

/* right: happy eyes, open smile, jump */
.zakzak.is-right .zk-eye,
.zakzak.is-right .zk-mouth--idle { display: none; }
.zakzak.is-right .zk-happy-eye,
.zakzak.is-right .zk-mouth--right { display: inline; }
.zakzak.is-right svg { animation: zk-jump .9s ease-out; }

@keyframes zk-jump {
  0%   { transform: translateY(0) scale(1, 1); }
  15%  { transform: translateY(0) scale(1.08, .9); }
  40%  { transform: translateY(-22%) scale(.95, 1.06); }
  60%  { transform: translateY(-22%) scale(.95, 1.06); }
  80%  { transform: translateY(0) scale(1.06, .94); }
  100% { transform: translateY(0) scale(1, 1); }
}

/* wrong: head tilt, raised brow, small "o", pupils look up */
.zakzak.is-wrong .zk-mouth--idle { display: none; }
.zakzak.is-wrong .zk-brow,
.zakzak.is-wrong .zk-mouth--wrong { display: inline; }
.zakzak.is-wrong .zk-pupil,
.zakzak.is-wrong .zk-shine { transform: translate(-3px, -7px); }
.zakzak.is-wrong svg { animation: zk-tilt 1.2s ease-in-out; }

@keyframes zk-tilt {
  0%        { transform: rotate(0); }
  20%, 75%  { transform: rotate(-12deg); }
  100%      { transform: rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .zakzak.is-right svg, .zakzak.is-wrong svg { animation-duration: .01s; }
}

/* ---------- Speech bubble (parents/review only) ---------- */
.bubble {
  position: absolute;
  top: calc(4vmin + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(80vw, 420px);
  padding: 10px 16px;
  border-radius: 18px;
  background: #fff;
  color: var(--zk-line);
  font: 600 clamp(15px, 4vmin, 20px)/1.4 system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 2px 0 rgba(74, 63, 122, .15);
  z-index: 2;
}

/* ---------- Friend (owl): flies in for doubts and corrections ---------- */
.friend {
  position: absolute;
  top: calc(9% + env(safe-area-inset-top, 0px));
  left: calc(3vw + env(safe-area-inset-left, 0px));
  width: clamp(72px, 17vmin, 120px);
  z-index: 2;
  pointer-events: none;
  transform: translate(-160%, -60%) rotate(-12deg);
  transition: transform .45s cubic-bezier(.3, 1.3, .6, 1);
}
.friend.is-in { transform: none; }
.friend svg { display: block; width: 100%; height: auto; overflow: visible; }
.friend.is-in .fr-body { animation: fr-hover 1.6s ease-in-out .45s infinite; }
.friend .fr-wing { transform-box: fill-box; transform-origin: 50% 15%; }
.friend.is-flying .fr-wing--l { animation: fr-flap-l .16s ease-in-out infinite alternate; }
.friend.is-flying .fr-wing--r { animation: fr-flap-r .16s ease-in-out infinite alternate; }
.friend .fr-eye { transform-box: fill-box; transform-origin: center; animation: zk-blink 5s infinite 1s; }
.fr-fill, .fr-wing { fill: #b07a4f; stroke: #5a3a22; stroke-width: 3; stroke-linejoin: round; }
.fr-belly { fill: #f3dfc3; }
.fr-dots { fill: none; stroke: #c99a6c; stroke-width: 2.5; stroke-linecap: round; }
.fr-ring { fill: #f6c35b; }
.fr-eye-white { fill: #fff; stroke: #5a3a22; stroke-width: 2.5; }
.fr-pupil { fill: #3b2a1c; }
.fr-shine { fill: #fff; }
.fr-beak { fill: #f29a38; stroke: #a95c14; stroke-width: 2; stroke-linejoin: round; }
.fr-feet { fill: none; stroke: #f29a38; stroke-width: 3.5; stroke-linecap: round; }
@keyframes fr-hover { 50% { transform: translateY(-5px); } }
@keyframes fr-flap-l { to { transform: rotate(28deg); } }
@keyframes fr-flap-r { to { transform: rotate(-28deg); } }

.bubble--friend {
  top: calc(9% + env(safe-area-inset-top, 0px));
  left: calc(3vw + clamp(72px, 17vmin, 120px) + 10px + env(safe-area-inset-left, 0px));
  right: auto;
  transform: none;
  max-width: min(60vw, 360px);
  background: #fff6e6;
  color: #5a3a22;
  border: 2px solid #f6c35b;
}
@media (prefers-reduced-motion: reduce) {
  .friend { transition-duration: .01s; }
  .friend .fr-body, .friend .fr-wing, .friend .fr-eye { animation: none !important; }
}

/* ---------- Template: pick-1-of-3 ---------- */
.stage {
  position: absolute;
  left: 0;
  right: 0;
  top: 22%;
  display: flex;
  justify-content: center;
  gap: 4vmin;
  z-index: 1;
}
.option {
  width: clamp(96px, 26vmin, 150px);
  height: clamp(96px, 26vmin, 150px);
  padding: clamp(12px, 4vmin, 22px);
  border: 0;
  border-radius: 24%;
  background: #fff;
  box-shadow: 0 6px 0 rgba(74, 63, 122, .18);
  cursor: pointer;
  transition: transform .08s;
}
.option img { display: block; width: 100%; height: 100%; pointer-events: none; }
.option:active { transform: scale(.92); }
.option.is-right { animation: opt-pop .5s ease-out; box-shadow: 0 0 0 6px var(--grass), 0 6px 0 rgba(74, 63, 122, .18); }
.option.is-wrong { animation: opt-wiggle .5s ease-in-out; }

@keyframes opt-pop {
  50% { transform: scale(1.15); }
}
@keyframes opt-wiggle {
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}


/* ---------- Dev (?dev=1) ---------- */
.dev-bar { position: fixed; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 10; }
.dev-bar button { font: 14px monospace; padding: 6px 10px; border-radius: 6px; border: 1px solid #333; background: #fff; }

/* Zakzak's guess: the option he is pointing at */
.option.is-guess {
  position: relative;
  box-shadow: 0 0 0 6px var(--zk), 0 6px 0 rgba(74, 63, 122, .18);
  animation: opt-point 1.2s ease-in-out infinite;
}
@keyframes opt-point {
  50% { transform: translateY(-6px); }
}

/* ---------- Doors (one per stage) ---------- */
.doors {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: 3vmin;
  z-index: 1;
}
.door {
  width: clamp(96px, 24vmin, 130px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform .08s;
}
.door svg { display: block; width: 100%; height: auto; overflow: visible; }
.door:active { transform: scale(.94); }

.door-frame { fill: #8d5a3b; }
.door-leaf  { fill: #d39a66; }
.door-knob  { fill: #ffd84d; }
.door-lock  { fill: #ffd84d; stroke: #b89a10; stroke-width: 4; display: none; }
.door-star  { fill: #ffd84d; stroke: #b89a10; stroke-width: 2; stroke-linejoin: round; display: none; }

.door.is-locked svg { opacity: .8; }       /* wood, not grey: grey arches read as tombstones */
.door.is-locked .door-leaf  { fill: #b98a63; }
.door.is-locked .door-knob  { display: none; }
.door.is-locked .door-lock  { display: inline; }
.door.is-done .door-star    { display: inline; }
.door.is-current svg { animation: door-glow 1.6s ease-in-out infinite; }
.door.is-shake { animation: opt-wiggle .4s ease-in-out; }

@keyframes door-glow {
  50% { filter: drop-shadow(0 0 10px #fff); transform: translateY(-4px); }
}

/* Landscape phones: Zakzak sized by height */
@media (orientation: landscape) {
  .zakzak { width: min(40vw, 62vh); bottom: 6%; }
  .stage {
    top: 50%;
    left: auto;
    right: calc(5vw + env(safe-area-inset-right, 0px));
    transform: translateY(-50%);
    flex-direction: column;
    gap: 3vmin;
  }
  .doors {
    top: 50%;
    left: auto;
    right: calc(5vw + env(safe-area-inset-right, 0px));
    transform: translateY(-50%);
    grid-template-columns: repeat(2, auto);
  }
  .doors { gap: 2vmin; }
  .door { width: 96px; height: 96px; }        /* hit area stays 96px */
  .door svg { width: auto; height: 100%; margin: 0 auto; }
}
.dev-bar { flex-wrap: wrap; max-width: calc(100vw - 16px); }
.dev-info { flex-basis: 100%; font: 11px/1.3 monospace; background: rgba(255,255,255,.9); padding: 6px; border-radius: 6px; white-space: pre-wrap; direction: ltr; text-align: left; }

/* ---------- Celebration ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); }
}
.door.is-unlocked svg { animation: door-unlock .9s ease-out, door-glow 1.6s ease-in-out .9s infinite; }
@keyframes door-unlock {
  0%   { transform: scale(.6) rotate(-10deg); }
  60%  { transform: scale(1.2) rotate(6deg); }
  100% { transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
}

/* ---------- Parents (small on purpose: not a child target) ---------- */
.parents-btn {
  position: absolute;
  left: calc(10px + env(safe-area-inset-left, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 0 rgba(74, 63, 122, .2);
  opacity: .85;
  z-index: 4;
}
.parents-btn svg { display: block; width: 100%; height: 100%; fill: var(--zk-line); }

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(40, 34, 70, .45);
  z-index: 20;
}
.modal-box {
  position: relative;
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 20px 20px;
  border-radius: 20px;
  background: #fff;
  color: var(--zk-line);
  font: 16px/1.5 system-ui, sans-serif;
  text-align: center;
}
.modal-box.is-shake { animation: opt-wiggle .4s; }
.modal-title { font-weight: 700; font-size: 18px; }
.gate-q { font-size: 20px; }
.gate-input {
  font: 600 24px system-ui, sans-serif;
  text-align: center;
  padding: 10px;
  border: 2px solid var(--zk);
  border-radius: 12px;
  color: var(--zk-line);
}
.modal-btn {
  font: 600 17px system-ui, sans-serif;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--zk);
  color: var(--zk-line);
}
.modal-btn--danger { background: #ffd6d6; color: #8a1f1f; }
.modal-close {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  font-size: 28px;
  color: var(--zk-line);
}

/* ---------- Child switcher (only with 2+ children) ---------- */
.kid-btn {
  position: absolute;
  right: calc(10px + env(safe-area-inset-right, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: 96px;
  height: 96px;
  padding: 12px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  z-index: 2;
}
.kid-btn img { display: block; width: 100%; height: 100%; }
.kid-btn:disabled { opacity: 1; }
.kid-tag {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  max-width: 40vw;
  padding: 4px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--zk-line);
  font: 700 18px/1.3 system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 3px 0 rgba(74, 63, 122, .2);
}
.kid-picker { flex-wrap: wrap; gap: 5vmin; align-content: center; }
.kid-face {
  width: clamp(96px, 28vmin, 160px);
  height: clamp(96px, 28vmin, 160px);
  padding: clamp(14px, 4vmin, 24px);   /* % padding would resolve against the modal width */
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 0 rgba(74, 63, 122, .25);
}
.kid-face.is-active { box-shadow: 0 0 0 6px var(--zk), 0 6px 0 rgba(74, 63, 122, .25); }
.kid-face img { display: block; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Parents panel ---------- */
.modal-box.panel { width: min(100%, 420px); max-height: calc(100% - 16px); overflow-y: auto; text-align: start; }
.panel .modal-title { text-align: center; }
.panel-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid #ece8fb; }
.panel-h { font-size: 15px; color: #7a6fb0; }
.panel-line, .panel-status, .panel-notice { font-size: 15px; }
.panel-notice { background: #fff4d6; border-radius: 10px; padding: 8px 12px; }
.panel-status { color: #2b6e2e; }
.panel-input {
  font: 16px system-ui, sans-serif;   /* 16px stops iOS zoom on focus */
  padding: 10px 12px;
  border: 2px solid #ddd6fb;
  border-radius: 12px;
  color: var(--zk-line);
}
.panel-consent { font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.panel-consent input { margin-top: 4px; width: 20px; height: 20px; flex: none; }
.kid-row { display: flex; gap: 8px; align-items: center; }
.kid-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #f6f4ff;
  font: 16px system-ui, sans-serif;
  color: var(--zk-line);
  text-align: start;
}
.kid-row.is-active .kid-pick { border-color: var(--zk); }
.kid-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-done { font-variant-numeric: tabular-nums; color: #7a6fb0; direction: ltr; }
.kid-del { border: 0; background: none; color: #8a1f1f; font: 14px system-ui, sans-serif; padding: 8px; }
.avatar-img { width: 36px; height: 36px; flex: none; }
.kid-add { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: #faf9ff; }
.avatar-pick { display: flex; gap: 6px; justify-content: space-between; }
.avatar-opt { flex: 1; padding: 6px; border: 2px solid transparent; border-radius: 12px; background: #fff; }
.avatar-opt.is-on { border-color: var(--zk); }
.avatar-opt .avatar-img { width: 100%; height: auto; max-width: 48px; }
.modal-btn--quiet { background: #f0edfb; }
.modal-btn:disabled { opacity: .5; }

@media (orientation: landscape) {
  .kid-btn { right: auto; left: calc(64px + env(safe-area-inset-left, 0px)); }
}

/* ---------- Home (leave a stage) ---------- */
.home-btn {
  position: absolute;
  bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  right: calc(6px + env(safe-area-inset-right, 0px));
  width: 96px;
  height: 96px;
  padding: 14px;
  border: 0;
  background: none;
  z-index: 3;
}
.home-btn svg {
  display: block;
  width: 100%;
  height: 100%;
  padding: 12px;
  border-radius: 50%;
  background: #fff;
  fill: var(--zk-line);
  box-shadow: 0 4px 0 rgba(74, 63, 122, .2);
}

@media (orientation: landscape) {
  .home-btn { right: auto; left: calc(56px + env(safe-area-inset-left, 0px)); }
}
.panel-link { font-size: 14px; color: var(--zk-line); }

/* ---------- Travel sign (door to another room) ---------- */
.door--travel {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 60 / 80;
}
.travel-sign {
  position: relative;
  display: block;
  width: 90%;
  aspect-ratio: 1;
  padding: 14%;
  border: .6vmin solid #fff;
  border-radius: 50%;
  background: #ffe8a3;
  box-shadow: 0 6px 0 rgba(74, 63, 122, .2);
}
.door--travel.is-current .travel-sign { animation: door-glow 1.6s ease-in-out infinite; }
.travel-sign img { display: block; width: 100%; height: 100%; }
.travel-sign::after {   /* arrow: "go there" (RTL, forward is left) */
  content: "";
  position: absolute;
  left: -6%;
  bottom: -4%;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--zk) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 5 8 12l7 7' fill='none' stroke='%234a3f7a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}
.door--travel.is-locked .travel-sign { filter: grayscale(.8); opacity: .7; animation: none; }
.door--travel.is-locked .travel-sign::after {
  background: #ffd84d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='10' rx='2' fill='%23b89a10'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='%23b89a10' stroke-width='2.5'/%3E%3C/svg%3E") center / 70% no-repeat;
}
.door--travel.is-unlocked .travel-sign { animation: door-unlock .9s ease-out, door-glow 1.6s ease-in-out .9s infinite; }

@media (orientation: landscape) {
  .door--travel { aspect-ratio: auto; }
  .travel-sign { width: auto; height: 90%; }
}

/* Soft shadow grounds Zakzak in every scene */
.zakzak::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -1%;
  height: 6%;
  border-radius: 50%;
  background: rgba(40, 34, 70, .14);
}
