/* Fan Life — styles.
   Low-arousal palette, big touch targets, no flashing, gentle motion (and less of it with
   "Reduce motion"). The stage keeps a fixed 16:10 shape so layouts stay predictable. */

/* Andika, bundled (fonts/, SIL Open Font License) so the game looks the same offline. */
@font-face { font-family: 'Andika'; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/andika-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Andika'; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/andika-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #f6efe4;
  --card: #fffdf8;
  --ink: #3d3a4b;
  --ink-soft: #6b6680;
  --line: #e8dccb;
  --accent: #5fa8d3;
  --go: #52b788;
  --glow: #ffcf3d;
  --warm: #f4a261;
  --shadow: 0 5px 0 rgba(61, 58, 75, 0.1);
  --font: 'Andika', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --zone-blue: #7fb3e0;
  --zone-green: #7cc47f;
  --zone-yellow: #ffd166;
  --zone-red: #e76f51;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: var(--font); -webkit-user-select: none; user-select: none;
  overscroll-behavior: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
svg { display: block; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: flex; }

/* ---------- shared buttons ---------- */
.round {
  width: clamp(50px, 9.5vh, 76px); aspect-ratio: 1; border-radius: 50%; flex: none;
  background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; position: relative;
  transition: transform 0.15s;
}
.round svg { width: 58%; height: 58%; }
.round.small { width: clamp(44px, 7.5vh, 60px); }
.round:active, .pill:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(61, 58, 75, 0.1); }
.pill {
  display: inline-flex; align-items: center; gap: 0.5em; padding: 0.55em 1.3em; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); font-size: clamp(20px, 3.2vh, 30px); font-weight: 700;
}
.pill svg { width: 1.3em; height: 1.3em; }
.pill.go { background: var(--go); color: #fff; }

/* ---------- title ---------- */
#screen-title {
  flex-direction: column; align-items: center; justify-content: center; gap: 3vh;
  background: radial-gradient(circle at 50% 35%, #fff8ec, #f6efe4 60%, #efe3d2);
}
.title-art { display: flex; gap: 2vw; align-items: flex-end; height: 34vh; }
.title-art .char { height: 100%; width: auto; }
.title-art.row .char { height: 70%; }
#screen-title h1 { margin: 0; font-size: clamp(44px, 9vh, 96px); letter-spacing: 0.02em; }
.big-play {
  width: clamp(96px, 18vh, 150px); aspect-ratio: 1; border-radius: 50%; background: var(--go);
  box-shadow: 0 8px 0 #3f9b73; display: grid; place-items: center; animation: breathe 2.4s ease-in-out infinite;
}
.big-play svg { width: 50%; margin-left: 8%; }

/* ---------- character select ---------- */
#screen-select { flex-direction: column; align-items: center; justify-content: safe center; gap: 1.8vh; padding: 2vh 16px; overflow: auto; }
#screen-select > * { flex: none; }
.prompt { margin: 0; font-size: clamp(28px, 5vh, 50px); text-align: center; }
.select-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2vh 2.5vw; width: min(1100px, 100%); }
.pick {
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow); padding: 1.6vh 1vw 1.2vh;
  display: flex; flex-direction: column; align-items: center; gap: 1vh; transition: transform 0.25s, opacity 0.25s, box-shadow 0.25s;
}
.pick .char { height: clamp(70px, 17vh, 210px); width: auto; }
/* "Make your own", Back, and the little 2×2 of heroes on More… and the groups: as big as a hero */
.pick .mk-plus, .pick .mini4 { height: clamp(70px, 17vh, 210px); width: auto; aspect-ratio: 5 / 6; }
.pick .mini4 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; place-items: center; }
.pick .mini4 .char { height: 100%; width: 100%; }
.pick .mini4.n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.pick .mini4.n2 { grid-template-rows: 1fr; }
.pick.back { background: transparent; box-shadow: none; }
.pick span { font-size: clamp(18px, 3vh, 30px); font-weight: 700; text-align: center; line-height: 1.15; }
.pick.on { transform: scale(1.06); box-shadow: 0 0 0 6px var(--glow), var(--shadow); }
.select-grid.has-pick .pick:not(.on) { opacity: 0.45; }
@media (max-aspect-ratio: 1/1) {
  /* portrait: three across, sized by the width too, so a phone shows every hero without scrolling */
  .select-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4vh 3vw; }
  .pick { border-radius: 20px; padding: 1.2vh 4px 1vh; gap: 0.6vh; }
  .pick .char, .pick .mk-plus, .pick .mini4 { height: clamp(52px, min(11vh, 20vw), 160px); }
  .pick span { font-size: clamp(14px, min(2.6vh, 4.4vw), 28px); }
}

/* ---------- map (My Day) ---------- */
#screen-map {
  flex-direction: column; overflow-y: auto; padding: max(2vh, env(safe-area-inset-top)) 16px 2vh;
  background: linear-gradient(90deg, #ffe7c9 0%, #f3f1e6 35%, #e3ecf7 62%, #cfcaeb 85%, #aaa5d6 100%);
}
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.map-head h2 { margin: 0; font-size: clamp(28px, 5.5vh, 54px); }
.map-tools { display: flex; gap: 12px; }
.map-path {
  flex: 1 0 auto; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 16vh 2.2vw; padding: 12vh 0 2vh; position: relative;
}
.stop {
  position: relative; width: clamp(92px, 11vw, 160px); display: flex; flex-direction: column; align-items: center; gap: 1vh;
}
.stop .disc {
  width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; border: 5px solid transparent; transition: transform 0.2s;
}
.stop .disc svg { width: 62%; height: 62%; }
.stop b { font-size: clamp(16px, 2.6vh, 24px); text-align: center; line-height: 1.1; }
.stop.here .disc { border-color: var(--glow); animation: breathe 2.6s ease-in-out infinite; }
.stop .badge { position: absolute; top: -4px; right: 2px; width: 34%; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.12)); }
.stop .token { position: absolute; bottom: calc(100% - 2.5vh); left: 50%; width: 68%; transform: translateX(-50%); pointer-events: none; z-index: 2; }
.stop .token .char { width: 100%; height: auto; }

/* hold-to-open (grown-ups) */
.hold .hold-ring {
  position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--go) calc(var(--p, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
}

/* ---------- play screen ---------- */
#screen-play {
  flex-direction: column; gap: 1.2vh;
  padding: max(1.2vh, env(safe-area-inset-top)) 16px max(1.2vh, env(safe-area-inset-bottom));
}
.bar { display: flex; align-items: center; gap: 12px; flex: none; }
.strip { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: center; gap: clamp(8px, 1.4vw, 16px); }
.card {
  width: clamp(48px, 9.5vh, 80px); height: clamp(48px, 9.5vh, 80px); border-radius: 18px; background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; position: relative; transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s; flex: none;
}
.card-art { position: absolute; inset: 12%; }
.card-art svg { width: 100%; height: 100%; }
.card.now { transform: scale(1.14); box-shadow: 0 0 0 4px var(--glow), var(--shadow); }
.card.done { opacity: 0.5; }
.card.done::after {
  content: ''; position: absolute; right: -8px; top: -8px; width: 44%; aspect-ratio: 1; border-radius: 50%;
  background: var(--go) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat;
  box-shadow: 0 0 0 3px var(--bg);
}
.card.flip { animation: flip 0.5s ease; }
.card-label { position: absolute; bottom: -1.5em; font-size: clamp(13px, 2vh, 18px); font-weight: 700; }

.stage-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.stage {
  position: relative; width: min(100cqw, 160cqh); aspect-ratio: 16 / 10; border-radius: 26px; overflow: hidden;
  background: #efe7da; box-shadow: var(--shadow); touch-action: none; container-type: inline-size;
  transition: opacity 0.38s;
}
.stage.fading { opacity: 0; }
.stage > .bg, .stage > .props, .stage > .tint, .stage > .fx { position: absolute; inset: 0; }
.stage > .bg svg { width: 100%; height: 100%; }
.stage > .tint { z-index: 20; pointer-events: none; background: #4a5a9c; mix-blend-mode: multiply; opacity: 0; transition: opacity 0.9s; }
.stage.dim > .tint { opacity: 0.32; }
.stage.night > .tint { opacity: 0.36; }
.stage.night.dark > .tint { opacity: 0.52; }
/* a room light is on: night scenes stay easy to see */
.stage.night.lit > .tint, .stage.night.dark.lit > .tint { opacity: 0.12; }
.stage > .fx { z-index: 30; pointer-events: none; }
.fx .choices, .fx .echo-bubble { pointer-events: auto; }

.prop, .hero {
  position: absolute; transform: translate(-50%, -100%);
  transition: left 0.8s ease-in-out, top 0.8s ease-in-out, width 0.8s ease-in-out, opacity 0.35s;
}
.prop.instant, .hero.instant, .fast .prop, .fast .hero { transition: none; }
.prop svg, .hero svg { width: 100%; height: auto; overflow: visible; }
.prop.hidden { opacity: 0; pointer-events: none; }
.act { position: relative; }
.prop.target, .prop.drop, .hero.target, .hero.slot-target { cursor: pointer; }
.prop.decor { pointer-events: none; }
.stage .props { pointer-events: none; }
.stage .prop:not(.decor), .stage .hero { pointer-events: auto; }
.prop.target::after, .hero.target::after, .hero.slot-target::after { content: ''; position: absolute; inset: -30% -25%; }
.prop.target .act, .hero.target .act { animation: glow 1.7s ease-in-out infinite; }
.prop.drop .act { filter: drop-shadow(0 0 6px rgba(95, 168, 211, 0.9)); }
.act.squished { transform: scale(1.22, 0.72); transform-origin: 50% 100%; transition: transform 0.12s; }
.act { transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1); }
/* night/dim: a bright halo drawn above the tint so targets stay easy to spot */
.halo {
  position: absolute; border-radius: 40%; pointer-events: none; z-index: 31;
  border: 4px solid rgba(255, 226, 92, 0.95);
  box-shadow: 0 0 18px 6px rgba(255, 214, 64, 0.75), inset 0 0 18px 4px rgba(255, 226, 92, 0.45);
  animation: halo 1.6s ease-in-out infinite;
}
.halo.halo-drop { border-color: rgba(160, 214, 255, 0.9); box-shadow: 0 0 16px 4px rgba(120, 190, 240, 0.6); border-style: dashed; }
@keyframes halo { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
.stage.night .target .act, .stage.dim .target .act { animation-name: glowbright; }
@keyframes glowbright {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 230, 90, 1)) drop-shadow(0 0 2px #fff); }
  50% { filter: drop-shadow(0 0 20px rgba(255, 220, 40, 1)) drop-shadow(0 0 6px #fff); }
}
.prop.drop.over .act { filter: drop-shadow(0 0 14px rgba(82, 183, 136, 1)); transform: scale(1.06); transition: transform 0.15s; }
.ring {
  position: absolute; border-radius: 45%; border: 4px dashed var(--glow); pointer-events: none;
  box-shadow: 0 0 12px rgba(255, 207, 61, 0.9); animation: ringpulse 1.5s ease-in-out infinite;
}

/* hero idle + moods + speeds */
.hero .bob, .is-char .bob, .calm-box .bob { animation: bob 3.4s ease-in-out infinite; }
.is-char .bob { animation-duration: 4.1s; }
[data-speed='0'] .bob { animation: none; }
[data-speed='2'] .bob { animation-duration: 1.4s; }
[data-speed='3'] .bob { animation: shake 0.14s linear infinite; }
.char .blades { transform-box: fill-box; transform-origin: center; animation: spin 1.8s linear infinite; }
[data-speed='0'] .blades, .still .blades { animation-play-state: paused; }
[data-speed='2'] .blades { animation-duration: 0.55s; }
[data-speed='3'] .blades { animation-duration: 0.16s; }
.char .tail { transform-box: fill-box; transform-origin: 0% 70%; animation: sway 2.4s ease-in-out infinite; }
[data-speed='0'] .tail, .still .tail { animation-play-state: paused; }
[data-speed='2'] .tail { animation-duration: 0.9s; }
[data-speed='3'] .tail { animation-duration: 0.35s; }
/* elevator: the floor needle sweeps, arrows take turns, floor numbers count up */
.char .needle { transform-origin: 100px 70px; animation: needle 3.4s ease-in-out infinite; }
.char .lamp { animation: lamp 2.8s ease-in-out infinite; }
.char .lamp-b { animation-delay: -1.4s; }
.char .floor { --T: 6s; opacity: 0; animation: floor var(--T) linear infinite; }
.char .floor-2 { animation-delay: calc(var(--T) * -0.75); }
.char .floor-3 { animation-delay: calc(var(--T) * -0.5); }
.char .floor-4 { animation-delay: calc(var(--T) * -0.25); }
[data-speed='0'] :is(.needle, .lamp, .floor), .still :is(.needle, .lamp, .floor) { animation-play-state: paused; }
[data-speed='2'] .needle { animation-duration: 1.3s; }
[data-speed='3'] .needle { animation-duration: 0.5s; }
[data-speed='2'] .lamp { animation-duration: 1.2s; }
[data-speed='3'] .lamp { animation-duration: 0.6s; }
[data-speed='2'] .floor { --T: 2.6s; }
[data-speed='3'] .floor { --T: 1.2s; }
/* light bulb: the light around the glass breathes; dim when the speed is "off" */
.char .shine { transform-origin: 100px 78px; animation: shine 3.2s ease-in-out infinite; }
[data-speed='0'] .shine { animation: none; opacity: 0.12; }
.still .shine { animation-play-state: paused; }
[data-speed='2'] .shine { animation-duration: 1.6s; }
[data-speed='3'] .shine { animation: shinebig 1s ease-in-out infinite; }
/* box heroes (js/art/heroes/box.js): the drum spins, the mug turns, the clouds drift */
.char .bx-spin { transform-box: fill-box; transform-origin: center; animation: spin 3.2s linear infinite; }
.char .bx-turn { transform-box: fill-box; transform-origin: 50% 100%; animation: bxturn 3s ease-in-out infinite; }
.char .bx-drift { animation: bxdrift 9s linear infinite; }
.char .bx-rise { transform-box: fill-box; transform-origin: 50% 100%; animation: bxrise 3s ease-in-out infinite; }
.char .bx-pulse { transform-box: fill-box; transform-origin: center; animation: bxpulse 1.6s ease-in-out infinite; }
.char .bx-pop { animation: bxpop 2.6s ease-in-out infinite; }
[data-speed='0'] :is(.bx-spin, .bx-turn, .bx-drift, .bx-rise, .bx-pulse, .bx-pop), .still :is(.bx-spin, .bx-turn, .bx-drift, .bx-rise, .bx-pulse, .bx-pop) { animation-play-state: paused; }
[data-speed='2'] :is(.bx-rise, .bx-pop) { animation-duration: 1.3s; }
[data-speed='3'] :is(.bx-rise, .bx-pop) { animation-duration: 0.6s; }
[data-speed='2'] .bx-pulse { animation-duration: 0.8s; }
[data-speed='3'] .bx-pulse { animation-duration: 0.4s; }
[data-speed='2'] .bx-spin { animation-duration: 1.1s; }
[data-speed='3'] .bx-spin { animation-duration: 0.4s; }
[data-speed='2'] .bx-turn { animation-duration: 1.4s; }
[data-speed='3'] .bx-turn { animation-duration: 0.7s; }
[data-speed='2'] .bx-drift { animation-duration: 3.5s; }
[data-speed='3'] .bx-drift { animation-duration: 1.4s; }
/* the picture hero (js/art/custom.js): its dance follows the speed, like the fan's blades */
.char .move-bounce { transform-origin: 100px 240px; animation: squish 1.7s ease-in-out infinite; }
.char .move-sway { transform-origin: 100px 236px; animation: dance 2.2s ease-in-out infinite; }
.char .jelly { animation: jelly 1.9s ease-in-out infinite; animation-delay: calc(var(--k) * -0.16s); }
.char .move-jelly > .face { --a: 3.5; animation: jelly 1.9s ease-in-out infinite; animation-delay: -0.3s; }
[data-speed='0'] :is(.move-bounce, .move-sway, .jelly, .move-jelly > .face),
.still :is(.move-bounce, .move-sway, .jelly, .move-jelly > .face) { animation-play-state: paused; }
[data-speed='2'] :is(.move-bounce, .move-sway, .jelly, .move-jelly > .face) { animation-duration: 0.9s; }
[data-speed='3'] :is(.move-bounce, .move-sway, .jelly, .move-jelly > .face) { animation-duration: 0.42s; }
.char .puff { transform-box: fill-box; transform-origin: center; animation: puff 2.6s ease-out infinite; opacity: 0; }
.char .puff:nth-child(2) { animation-delay: 0.87s; }
.char .puff:nth-child(3) { animation-delay: 1.74s; }
[data-speed='0'] .puff, .still .puff { animation: none; }
[data-speed='2'] .puff { animation-duration: 1.2s; }
[data-speed='3'] .puff { animation-duration: 0.6s; }
.talking .mouth { transform-box: fill-box; transform-origin: center; animation: talk 0.2s ease-in-out infinite alternate; }
.hero .zzz { position: absolute; left: 70%; top: 0; display: none; font-weight: 700; color: #8e7dbe; font-size: 2.2cqw; }
.hero.asleep .zzz { display: block; }
.zzz span { position: absolute; animation: zz 3s ease-in-out infinite; opacity: 0; }
.zzz span:nth-child(2) { animation-delay: 1s; font-size: 1.2em; }
.zzz span:nth-child(3) { animation-delay: 2s; font-size: 1.45em; }
.hero.sway .bob { animation: swaysoft 2s ease-in-out infinite; }

/* one-shot animations */
.a-celebrate { animation: hop 0.9s ease; }
.a-hop { animation: hop 0.7s ease; }
.a-wiggle { animation: wiggle 0.8s ease; }
.a-stretch { animation: stretch 0.9s ease; transform-origin: 50% 100%; }
.a-shake { animation: shakeonce 0.6s ease; }
.a-bump { animation: bump 0.45s ease; transform-origin: 50% 100%; }
.a-boop { animation: boop 0.4s ease; transform-origin: 50% 100%; }

/* prop states */
.stream { animation: stream 0.35s linear infinite; }
.swirl { transform-box: fill-box; transform-origin: center; animation: spin 0.6s linear infinite; }
.tail.wag { transform-box: fill-box; transform-origin: 0% 100%; animation: wag 0.35s ease-in-out infinite; }
.stage.driving .scenery { animation: drive 7s linear infinite; }
.stage.noisy .is-char .act::after {
  content: ''; position: absolute; left: 50%; top: -14%; width: 70%; height: 22%; transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 24'%3E%3Cpath d='M6 12 q4 -8 8 0 t8 0 M26 12 q4 -8 8 0 t8 0 M46 12 q3 -6 6 0' fill='none' stroke='%23e76f51' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: noise 0.5s ease-in-out infinite alternate;
}

/* flying/dragged items */
.flyer { position: fixed; z-index: 90; pointer-events: none; will-change: transform; }
.flyer svg { width: 100%; height: 100%; }
.flyer.held { filter: drop-shadow(0 10px 8px rgba(61, 58, 75, 0.25)); transform: scale(1.08); }

/* hints, particles, meters, timers */
.hand { position: absolute; width: 7cqw; z-index: 40; transform: translate(-48%, -6%); filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.2)); opacity: 0; }
.particle { position: absolute; width: 3.2cqw; transform: translate(-50%, -50%); animation: floatup 1.4s ease-out forwards; }
.particle.p-heart { width: 2.6cqw; }
.particle.p-bubble {
  width: 2.4cqw; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 25%, rgba(191, 230, 247, 0.6) 26%); border: 2px solid #9fd8f0;
}
.meter, .timer { position: absolute; width: 8cqw; transform: translate(-50%, -50%); }
.meter circle, .timer circle { fill: none; stroke-width: 6; }
.meter .track, .timer .track { stroke: rgba(255, 253, 248, 0.9); }
.meter .fill { stroke: var(--go); stroke-dasharray: 100; stroke-dashoffset: 100; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.2s; stroke-linecap: round; }
.timer { left: 88%; top: 16%; width: 11cqw; background: var(--card); border-radius: 50%; box-shadow: var(--shadow); padding: 0.6cqw; transform: none; }
.timer .fill { stroke: var(--accent); stroke-dasharray: 100; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1s linear; stroke-linecap: round; }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4cqw; }
.breath {
  position: absolute; left: 50%; top: 36%; width: 28cqw; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(191, 230, 247, 0.75), rgba(142, 202, 230, 0.35));
  border: 4px solid rgba(95, 168, 211, 0.8); transform: translate(-50%, -50%) scale(0.5);
  transition: transform 3.6s ease-in-out; display: grid; place-items: center;
}
.breath.in { transform: translate(-50%, -50%) scale(1); }
.breath span { font-size: 4cqw; font-weight: 700; color: #2f6f96; }
.fast .breath { transition-duration: 0.05s; }

.choices { position: absolute; left: 0; right: 0; bottom: 5%; display: flex; justify-content: center; gap: 2.5cqw; animation: rise 0.4s ease; }
.choices.leaving { opacity: 0; transition: opacity 0.35s; }
.choice {
  width: 17cqw; background: var(--card); border-radius: 2cqw; box-shadow: var(--shadow); padding: 1.4cqw 1cqw 1cqw;
  display: flex; flex-direction: column; align-items: center; gap: 0.6cqw; transition: transform 0.25s, opacity 0.25s;
}
.choice .c-art { width: 80%; aspect-ratio: 1.25; }
.choice .c-art svg { width: 100%; height: 100%; }
.choice .c-word { font-size: 2.6cqw; font-weight: 700; }
.choice.picked { transform: scale(1.12); box-shadow: 0 0 0 5px var(--glow), var(--shadow); }
.choice.faded { opacity: 0.25; }

.echo-bubble {
  position: absolute; right: 3%; bottom: 4%; display: flex; align-items: center; gap: 1cqw; padding: 1cqw 2.2cqw 1cqw 1cqw;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow); font-size: 3cqw; font-weight: 700; animation: rise 0.4s ease;
}
.echo-bubble svg { width: 5.5cqw; animation: talk 0.5s ease-in-out infinite alternate; }

.chapter-card {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2cqw;
  background: rgba(255, 253, 248, 0.88); animation: fadein 0.4s ease; z-index: 50;
}
.chapter-card.leaving { opacity: 0; transition: opacity 0.4s; }
.cc-icon { width: 18cqw; height: 18cqw; }
.cc-icon svg { width: 100%; height: 100%; }
.cc-title { font-size: 6cqw; font-weight: 700; }

/* ---------- Explore mode (the house) ---------- */
.world-acts { flex: 1; min-width: 0; display: none; justify-content: safe center; align-items: flex-start; gap: clamp(14px, 2vw, 26px); overflow-x: auto; overflow-y: hidden; padding: 4px 6px clamp(18px, 2.6vh, 24px); scrollbar-width: none; }
.world-acts::-webkit-scrollbar { display: none; }
#btn-map { display: none; }
#screen-play.world-free #strip { display: none; }
#screen-play.world-free .world-acts { display: flex; }
#screen-play.world-free #btn-map { display: grid; }
#screen-play.world-free .bar { margin-bottom: 0; }
.w-act {
  width: clamp(48px, 9.5vh, 80px); height: clamp(48px, 9.5vh, 80px); border-radius: 18px; flex: none;
  background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; position: relative; transition: transform 0.15s;
}
.w-act:active { transform: translateY(3px); }
.w-act-art { position: absolute; inset: 12%; }
.w-act-art svg { width: 100%; height: 100%; }
.w-act-label { position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: clamp(10px, 1.7vh, 15px); font-weight: 700; max-width: calc(100% + clamp(14px, 2vw, 26px)); overflow: hidden; text-overflow: ellipsis; }
.w-act.done::after {
  content: ''; position: absolute; right: -7px; top: -7px; width: 26px; aspect-ratio: 1; border-radius: 50%;
  background: var(--go) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/70% no-repeat;
  box-shadow: 0 0 0 3px var(--bg);
}
/* depth: everything in the room sorts inside the props layer, under the tint and effects */
.stage.world > .props { z-index: 1; }
.stage.world .prop, .stage.world .hero { transition: opacity 0.35s; }
.stage.world .prop:not(.decor) { cursor: pointer; }
.stage.world { cursor: pointer; }
.prop.near .act { filter: drop-shadow(0 0 7px rgba(255, 207, 61, 0.95)); }
.w-hero .dir { transition: transform 0.15s; }
.w-hero.left .dir { transform: scaleX(-1); }
.w-hero.walking .bob { animation: walk 0.36s ease-in-out infinite; }
.w-shadow { position: absolute; left: 18%; right: 18%; bottom: -2.5%; height: 9%; border-radius: 50%; background: rgba(61, 58, 75, 0.16); }
@keyframes walk { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5%) rotate(2deg); } }
.w-prompt {
  position: absolute; transform: translate(-50%, -100%); pointer-events: auto; z-index: 2;
  width: 4.4cqw; min-width: 34px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--go); color: #fff; box-shadow: 0 3px 0 rgba(61, 58, 75, 0.2), 0 0 0 3px #fff;
  font-size: 2.4cqw; font-weight: 700; animation: bob 1.6s ease-in-out infinite;
}
.w-prompt svg { width: 72%; height: 72%; transform: rotate(-12deg); }
.w-prompt.wide { aspect-ratio: auto; width: auto; padding: 0.25em 0.7em; border-radius: 999px; font-size: 1.6cqw; }
.w-sign {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; width: 5.4cqw; aspect-ratio: 1;
  border-radius: 50%; background: var(--card); box-shadow: 0 3px 0 rgba(61, 58, 75, 0.15); display: grid; place-items: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.w-sign svg { width: 72%; height: 72%; }
.w-sign.near { box-shadow: 0 0 0 4px var(--glow), 0 3px 0 rgba(61, 58, 75, 0.15); transform: translate(-50%, -50%) scale(1.12); }
.w-dest {
  position: absolute; width: 4cqw; aspect-ratio: 2.4; transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid rgba(95, 168, 211, 0.85); animation: destpulse 1s ease-out infinite;
}
@keyframes destpulse { from { opacity: 1; transform: translate(-50%, -50%) scale(0.6); } to { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }
.choice.focus { transform: scale(1.08); box-shadow: 0 0 0 5px var(--accent), var(--shadow); }
/* the house map */
.map-panel { width: min(900px, 100%); }
.house-map svg { width: 100%; height: auto; max-height: 64vh; overflow: visible; }
.m-room { cursor: pointer; }
.m-room > rect:first-child { transition: stroke 0.2s; }
.m-room.here > rect:first-child { stroke: var(--glow); stroke-width: 9; }
.m-room.focus > rect:first-child { stroke: var(--accent); stroke-width: 10; }
.m-room:hover > rect:first-child { stroke: var(--accent); }
.m-label { font: 700 30px var(--font); fill: var(--ink); }
.reduce-motion .w-hero.walking .bob, .reduce-motion .w-prompt, .reduce-motion .w-dest { animation: none; }

/* body signals */
.ring-meter::before {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--ring, var(--go)) calc(var(--comfort, 1) * 1turn), rgba(61, 58, 75, 0.1) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}
.ring-meter[data-stage='1'] { --ring: var(--zone-yellow); }
.ring-meter[data-stage='2'] { --ring: var(--warm); }
.w-tummy { position: absolute; left: 30%; width: 40%; top: 70%; display: none; pointer-events: none; }
.w-tummy svg { width: 100%; height: auto; }
.w-hero.rumbling .w-tummy, .w-hero[data-need='hungry'][data-stage='2'] .w-tummy { display: block; animation: tummy 0.45s ease-in-out infinite alternate; }
@keyframes tummy { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
.w-hero[data-need='potty'][data-stage='2'] > .act { animation: pottydance 0.9s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes pottydance { 0%, 100% { transform: rotate(-4deg) translateX(-3%); } 50% { transform: rotate(4deg) translateX(3%); } }
.w-think {
  position: absolute; left: 60%; bottom: 88%; width: 48%; aspect-ratio: 1.15; border-radius: 50%; pointer-events: none;
  background: #fff; border: 3px solid var(--ink); display: grid; place-items: center; animation: fadein 0.3s ease;
}
.w-think[hidden] { display: none; }
.w-think::before, .w-think::after { content: ''; position: absolute; border-radius: 50%; background: #fff; border: 3px solid var(--ink); }
.w-think::before { width: 22%; aspect-ratio: 1; left: 2%; bottom: -16%; }
.w-think::after { width: 11%; aspect-ratio: 1; left: -10%; bottom: -34%; }
.w-think svg { width: 66%; height: 66%; }
.w-act.way { box-shadow: 0 0 0 4px var(--glow), var(--shadow); animation: breathe 1.6s ease-in-out infinite; }
.w-sign.way { box-shadow: 0 0 0 5px var(--glow), 0 3px 0 rgba(61, 58, 75, 0.15); animation: waypulse 1.6s ease-in-out infinite; }
@keyframes waypulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.18); } }
.prop.way .act { filter: drop-shadow(0 0 10px rgba(255, 207, 61, 1)); }
.body-needs { flex: 1; display: grid; gap: 2vh; }
.need-row { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; font-size: clamp(18px, 3vh, 26px); }
.need-row .ic { width: clamp(40px, 7vh, 60px); aspect-ratio: 1; }
.need-row .ic svg { width: 100%; height: 100%; }
.need-bar { height: 20px; border-radius: 10px; background: #eee6da; overflow: hidden; min-width: 80px; }
.need-bar i { display: block; height: 100%; border-radius: 10px; background: var(--go); }
.need-row[data-stage='1'] .need-bar i { background: var(--zone-yellow); }
.need-row[data-stage='2'] .need-bar i { background: var(--warm); }
.need-word { color: var(--ink-soft); font-weight: 700; min-width: 4.5em; }
/* wardrobe */
.wardrobe-panel { width: min(1060px, 100%); }
.wd-tabs { display: flex; gap: 10px; }
.wd-tab { padding: 0.4em 1.2em; border-radius: 999px; background: #f1e8da; font-size: clamp(18px, 3vh, 26px); font-weight: 700; }
.wd-tab.on { background: var(--accent); color: #fff; }
.wd-tab.focus, .wd-opt.focus { outline: 4px solid var(--accent); outline-offset: 3px; }
.wardrobe { display: flex; gap: clamp(12px, 2.5vw, 30px); align-items: flex-start; }
.wd-left { width: 26%; flex: none; text-align: center; }
.wardrobe-hero svg { width: 100%; height: auto; overflow: visible; }
.wd-line { height: 2.6em; overflow: hidden; margin: 1vh 0 0; font-size: clamp(16px, 2.6vh, 24px); line-height: 1.3; font-weight: 700; }
.wardrobe-rows { flex: 1; display: grid; gap: 1.6vh; align-content: start; min-height: calc(5 * clamp(46px, 8.5vh, 70px) + 4 * 1.6vh); }
.wd-row { display: grid; grid-template-columns: 5.2em 1fr; align-items: center; gap: 10px; }
.wd-row > b { font-size: clamp(16px, 2.6vh, 22px); }
.wd-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.wd-opt {
  width: clamp(46px, 8.5vh, 70px); aspect-ratio: 1; border-radius: 16px; background: #faf5ec; border: 3px solid transparent;
  display: grid; place-items: center; padding: 6px;
}
.wd-opt svg { width: 100%; height: 100%; overflow: visible; }
.wd-opt.on { border-color: var(--go); background: #e9f6ee; }
.wd-row.big .wd-opt { width: clamp(60px, 12vh, 96px); }
.reduce-motion .w-hero > .act, .reduce-motion .w-tummy, .reduce-motion .way { animation: none !important; }

/* story map: scenes in a place */
.m-room.place > rect:first-child { stroke-dasharray: 14 10; }
.map-scenes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.5vh; justify-content: center; }
.map-scenes .empty { color: var(--ink-soft); }
.scene-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 18px; background: #faf5ec;
  box-shadow: var(--shadow); text-align: left; max-width: 300px;
}
.scene-card .ic { width: clamp(40px, 7vh, 56px); aspect-ratio: 1; flex: none; }
.scene-card .ic svg { width: 100%; height: 100%; }
.sc-text { display: flex; flex-direction: column; font-size: clamp(14px, 2.2vh, 18px); line-height: 1.2; }
.sc-text b { font-size: clamp(15px, 2.4vh, 20px); }

/* store */
.w-list { cursor: pointer; }
.w-list.done { opacity: 0.55; }
.w-list-gap { width: clamp(6px, 1.5vw, 24px); flex: none; }
.stage.world .prop.is-char.walking .bob { animation: walk 0.4s ease-in-out infinite; }
/* music */
.music-panel { width: min(980px, 100%); }
.music { display: flex; gap: clamp(12px, 2.5vw, 30px); align-items: flex-start; }
.music-left { width: 30%; flex: none; text-align: center; }
.music-hero { position: relative; cursor: pointer; touch-action: none; }
.mh-hero svg { width: 100%; height: auto; overflow: visible; }
.mh-uke { position: absolute; width: 30%; left: 52%; top: 42%; transform: rotate(-35deg); transform-origin: 50% 70%; }
.mh-uke svg { width: 100%; height: auto; }
.mh-uke.strum { animation: strum 0.3s ease; }
@keyframes strum { 50% { transform: rotate(-28deg) translateY(-4%); } }
.music-hero.done .mh-hero { animation: hop 0.8s ease; }
.m-note { position: absolute; width: 14%; top: 30%; pointer-events: none; animation: floatup 1.4s ease-out forwards; }
.music-right { flex: 1; display: grid; gap: 2vh; }
.music-songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.song { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 16px; background: #faf5ec; border: 3px solid transparent; text-align: left; font-size: clamp(15px, 2.4vh, 20px); }
.song .ic { width: 40px; height: 40px; flex: none; }
.song .ic svg { width: 100%; height: 100%; }
.song.on { border-color: var(--go); background: #e9f6ee; }
.song.focus { outline: 4px solid var(--accent); outline-offset: 2px; }
.music-dots { display: flex; flex-wrap: wrap; gap: 6px; min-height: 2.6em; align-content: flex-start; }
.music-dots i { width: 16px; height: 16px; border-radius: 50%; background: #eee6da; }
.music-dots i.long { width: 28px; border-radius: 8px; }
.music-dots i.on { background: var(--go); }
.music-dots .hint { margin: 0; color: var(--ink-soft); font-weight: 700; }
.music-btns { display: flex; gap: 12px; }
#ov-music.listening #music-strum { opacity: 0.4; }
/* after listening, My turn is the next thing to try; playing note by note, it's the main one */
#ov-music.heard #music-strum, #ov-music.mine #music-strum { background: var(--go); color: #fff; box-shadow: 0 0 0 4px var(--glow), var(--shadow); }
#ov-music.heard #music-listen, #ov-music.mine #music-listen { background: var(--card); color: var(--ink); }
/* name writing */
.write-panel { width: min(900px, 100%); }
.write-panel .panel-head { flex-wrap: wrap; }
.wr-slots { display: flex; justify-content: center; gap: 10px; margin: 1vh 0 2vh; flex-wrap: wrap; }
.wr-slot { position: relative; width: clamp(48px, 9vh, 80px); height: clamp(60px, 11vh, 100px); border-bottom: 5px solid var(--line); display: grid; place-items: center; font-size: clamp(40px, 8vh, 72px); font-weight: 700; color: var(--go); }
.wr-slot i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; color: #e7e1ee; z-index: -1; }
.wr-slot { z-index: 0; }
.wr-slot.now { border-bottom-color: var(--glow); }
.wr-slot:not(.done) { color: #c9c2d6; }
.wr-tiles { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: clamp(70px, 12vh, 104px); }
.wr-tile { width: clamp(60px, 11vh, 96px); height: clamp(60px, 11vh, 96px); border-radius: 18px; background: #fff4e0; box-shadow: var(--shadow); font-size: clamp(34px, 6.5vh, 58px); font-weight: 700; }
.wr-tile.used { background: transparent; box-shadow: none; }
.wr-tile.focus { outline: 4px solid var(--accent); outline-offset: 3px; }
.wr-tile.nudge { animation: wiggle 0.5s ease; }
.wr-trace { display: grid; place-items: center; }
#write-canvas { width: min(46vh, 360px); height: min(46vh, 360px); border-radius: 24px; background: #fffdf8; box-shadow: inset 0 0 0 3px var(--line); touch-action: none; cursor: crosshair; }
#ov-write.cheer .wr-slot.done { animation: hop 0.8s ease; }

/* yes / no, quiet voice */
.a-nod { animation: nod 1.2s ease-in-out; transform-origin: 50% 100%; }
@keyframes nod { 0%, 100% { transform: none; } 20%, 60% { transform: translateY(3%) rotate(0deg) scaleY(0.96); } 40%, 80% { transform: translateY(-2%); } }
.a-headshake { animation: headshake 1.2s ease-in-out; }
@keyframes headshake { 0%, 100% { transform: none; } 15%, 55% { transform: translateX(-4%) rotate(-3deg); } 35%, 75% { transform: translateX(4%) rotate(3deg); } }
.caption.quiet { color: #6b6680; font-size: 0.86em; }
.caption.quiet::before { content: 'shh'; display: inline-block; margin-right: 0.5em; padding: 0 0.4em; border-radius: 0.4em; background: #e4dcf5; color: #6b5a9c; font-size: 0.6em; vertical-align: middle; }

/* driving across town */
.stage.drive .d-car { position: absolute; width: 11%; transform: translate(-50%, -78%); z-index: 5; pointer-events: none; }
.d-flip { position: relative; transition: transform 0.2s; }
.d-car.right .d-flip { transform: scaleX(-1); }
.d-body svg { width: 100%; height: auto; }
.d-grown, .d-hero { position: absolute; top: -26%; }
.d-grown { left: 28%; width: 28%; }
.d-hero { left: 60%; width: 24%; top: -18%; }
.d-grown svg, .d-hero svg { width: 100%; height: auto; }
.d-car.moving .d-flip { animation: drivebump 0.3s ease-in-out infinite; }
@keyframes drivebump { 50% { translate: 0 -2%; } }
.t-place { cursor: pointer; }
.t-place.dest .t-glow { animation: breathe 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.house-map .t-place:hover rect:first-of-type { opacity: 0.9; }
/* coloring */
.color-panel { width: min(900px, 100%); }
.color-wrap { display: flex; gap: 2vw; align-items: center; }
.color-page { flex: 1; }
.color-page svg { width: 100%; height: auto; max-height: 60vh; border-radius: 16px; touch-action: none; }
.c-part { cursor: pointer; }
.c-part.focus { stroke: var(--accent); stroke-width: 6; }
.color-crayons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.crayon { width: clamp(44px, 8vh, 64px); aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: var(--shadow); border: 4px solid transparent; }
.crayon.on { border-color: var(--ink); transform: scale(1.1); }
/* name writing: a bigger tracing box, the hero's line up top */
.wr-line { flex: 1; margin: 0; text-align: center; font-weight: 700; font-size: clamp(15px, 2.4vh, 20px); min-width: 8em; }
#write-canvas { width: min(60vh, 78vw, 520px) !important; height: min(60vh, 78vw, 520px) !important; }
.write-panel .wr-slots { margin: 0.5vh 0 1vh; }

/* the use bubble over a thing that starts a routine shows the routine's picture */
.w-prompt.starts { background: var(--card); width: 5.2cqw; box-shadow: 0 0 0 4px var(--go), 0 3px 0 rgba(61, 58, 75, 0.2); }
.w-prompt-act { width: 78%; height: 78%; display: block; }
.w-prompt-act svg { width: 100%; height: 100%; transform: none; }
.w-prompt-key { position: absolute; right: -14%; bottom: -10%; width: 46%; aspect-ratio: 1; border-radius: 50%; background: var(--go); color: #fff; font-size: 1.4cqw; display: grid; place-items: center; }
.w-act.near-act { box-shadow: 0 0 0 4px var(--go), var(--shadow); transform: scale(1.06); }
.calm-needs { max-width: 520px; margin: -0.5vh auto 1.6vh; text-align: left; gap: 1vh; }
/* with the body bars showing, the hero is a bit smaller so it all fits */
.calm-panel:has(.calm-needs:not([hidden])) .calm-hero { width: clamp(90px, 17vh, 160px); }
.calm-panel:has(.calm-needs:not([hidden])) .calm-line { margin: 0.6vh 0 1.4vh; }

/* subtitles on the hero picker */
.mini-caption {
  min-height: 1.4em; margin: 0; padding: 0.3em 0.9em; border-radius: 18px; background: var(--card); box-shadow: var(--shadow);
  font-size: clamp(22px, 4vh, 40px); font-weight: 700; text-align: center; max-width: min(900px, 92vw);
}
.mini-caption:empty { visibility: hidden; }
.mini-caption .mw { border-radius: 0.2em; padding: 0 0.06em; transition: background 0.15s, opacity 0.2s; opacity: 0.35; }
.mini-caption .mw.now { background: #ffe9a8; opacity: 1; }
.mini-caption .mw.said { opacity: 1; }

/* the playground swings */
.a-swing { animation: swing 1.1s ease-in-out; transform-origin: 50% -80%; }
.a-swinghigh { animation: swinghigh 1.1s ease-in-out; transform-origin: 50% -80%; }
@keyframes swing { 25% { transform: rotate(10deg); } 75% { transform: rotate(-10deg); } }
@keyframes swinghigh { 25% { transform: rotate(22deg); } 75% { transform: rotate(-22deg); } }
/* holding hands: look both ways, and a little heart between the two hands */
.a-look { animation: look 1.3s ease-in-out; }
@keyframes look { 0%, 12% { transform: none; } 22%, 50% { transform: scaleX(-1); } 60%, 100% { transform: none; } }
.w-hold { position: absolute; width: 3.6%; transform: translate(-50%, -50%); pointer-events: none; z-index: 2000; }
.w-hold svg { width: 100%; height: auto; display: block; }
/* the sea at the beach rolls in and out, slowly */
.stage.world .art-surf { animation: surf 4.5s ease-in-out infinite; }
@keyframes surf { 50% { transform: translate(-1.5%, 4%); } }
.reduce-motion .a-look, .reduce-motion .art-surf { animation: none !important; }
/* First / Then while a trip waits (tidy up first, potty first) */
.w-ft { position: absolute; left: 2%; top: 3%; display: flex; align-items: center; gap: 0.5cqw; padding: 0.5cqw 1cqw 1.6cqw; border-radius: 1.6cqw; background: #fff4e0; box-shadow: var(--shadow); z-index: 3; }
.w-ft-card { position: relative; width: 6cqw; height: 6cqw; display: grid; place-items: center; }
.w-ft-card svg { width: 80%; height: 80%; }
.w-ft-card b { position: absolute; bottom: -1.25em; font-size: 1.3cqw; }
.w-ft-card.now { border-radius: 14px; box-shadow: 0 0 0 3px var(--glow); background: var(--card); }
.w-ft-arrow { font-size: 2.4cqw; font-weight: 700; color: var(--ink-soft); }
/* "5 more minutes" at the playground */
.w-timer-chip { position: absolute; right: 2%; top: 3%; display: flex; align-items: center; gap: 0.8cqw; padding: 0.4cqw 1.4cqw 0.4cqw 0.4cqw; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 1.7cqw; z-index: 3; }
.w-timer-chip i { width: 4.4cqw; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--warm) calc(var(--left, 1) * 1turn), #eee6da 0); }

/* My Day: pick the day */
.day-picker { display: flex; justify-content: center; gap: 14px; margin-top: 1.5vh; flex-wrap: wrap; }
.day-btn {
  display: flex; align-items: center; gap: 10px; padding: 6px 18px 6px 8px; border-radius: 999px; background: var(--card);
  box-shadow: var(--shadow); font-size: clamp(16px, 2.8vh, 24px); border: 4px solid transparent; transition: transform 0.15s;
}
.day-btn .ic { width: clamp(36px, 6.5vh, 54px); aspect-ratio: 1; }
.day-btn .ic svg { width: 100%; height: 100%; }
.day-btn.on { border-color: var(--glow); transform: scale(1.04); }

/* ---------- caption bar ---------- */
.caption-bar {
  flex: none; display: flex; align-items: center; gap: clamp(10px, 1.5vw, 20px); min-height: clamp(78px, 16vh, 150px);
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 1vh clamp(10px, 1.5vw, 20px);
}
.speaker { width: clamp(52px, 10vh, 92px); aspect-ratio: 1; border-radius: 50%; background: #eef4fa; flex: none; display: grid; place-items: center; overflow: hidden; }
.speaker svg { width: 78%; height: 78%; }
.speaker[data-who='hero'] svg { width: 84%; height: 84%; }
.caption {
  flex: 1; min-width: 0; font-size: clamp(24px, 2.4vw + 2.2vh, 58px); line-height: 1.35; word-spacing: 0.12em;
  touch-action: none; cursor: pointer;
}
.caption.mode-off { visibility: hidden; }
.w { position: relative; display: inline-block; white-space: nowrap; border-radius: 0.22em; padding: 0 0.08em; transition: background 0.15s, opacity 0.25s, color 0.2s; }
.caption.mode-reveal .w.pending { opacity: 0.1; }
.w.now { background: #ffe9a8; }
.w.speaking, .w.pressed { background: #cfeaff; }
.w.sounding-out { background: #fff1d6; }
.k { display: inline-block; transition: transform 0.12s, color 0.12s; }
.k.sounding { color: #d9480f; transform: translateY(-0.14em); }
.k.silent { color: inherit; }
.w.sounding-out .k.silent { opacity: 0.35; }
.w.sounding-out .k + .k { margin-left: 0.06em; }
.w.heart.sounding-out::before, .w.heart.pressed::before {
  content: '♥'; position: absolute; left: 50%; top: -0.6em; transform: translateX(-50%); font-size: 0.42em; color: #e76f51;
}
.w.now .ch { display: inline-block; animation: letter 0.28s both; animation-delay: calc(var(--i) * 40ms); }
.pn { color: var(--ink-soft); }
.caption.echo .w { color: #2f6f96; }
.caption.echo { animation: echo 1.6s ease-in-out infinite; }

.next {
  flex: none; width: clamp(64px, 12vh, 104px); aspect-ratio: 1; border-radius: 50%; background: var(--go);
  box-shadow: 0 5px 0 #3f9b73; display: grid; place-items: center; animation: breathe 2.2s ease-in-out infinite;
}
.next svg { width: 52%; }
/* the helper arrow (does the step for you): there, but quieter than the thing to tap */
.next.helper { animation: none; opacity: 0.8; transform: scale(0.82); }
/* "go on" inside the scene, on steps with nothing else to do */
.scene-next {
  position: absolute; right: 4%; top: 46%; width: 9%; aspect-ratio: 1; border-radius: 50%; background: var(--go);
  box-shadow: 0 0 0 0.6cqw #fff, 0 0 0 1.3cqw var(--glow), 0 5px 0 1.3cqw rgba(63, 155, 115, 0.35);
  display: grid; place-items: center; z-index: 3000; animation: breathe 2.2s ease-in-out infinite;
}
.scene-next svg { width: 52%; }
.reduce-motion .scene-next { animation: none; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: rgba(40, 36, 60, 0.35); padding: 16px;
}
.overlay.open { display: flex; animation: fadein 0.25s ease; }
.panel {
  background: var(--card); border-radius: 30px; box-shadow: 0 10px 40px rgba(40, 36, 60, 0.25);
  width: min(1000px, 100%); max-height: 100%; overflow: auto; padding: clamp(16px, 3vh, 30px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1.5vh; }
.panel-head h2 { margin: 0; font-size: clamp(26px, 4.5vh, 42px); }
.panel h3 { margin: 2.5vh 0 1.2vh; font-size: clamp(20px, 3vh, 28px); color: var(--ink-soft); }

.talk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 15vw, 160px), 1fr)); gap: 12px; }
.say-btn {
  background: #f3f7fb; border-radius: 20px; padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: clamp(16px, 2.4vh, 22px); font-weight: 700; line-height: 1.15; text-align: center; box-shadow: 0 3px 0 rgba(61, 58, 75, 0.08);
}
.say-btn .ic { width: clamp(44px, 8vh, 70px); height: clamp(44px, 8vh, 70px); }
.say-btn .ic svg { width: 100%; height: 100%; }
.say-btn.core { background: #fff4df; }
.say-btn.on { box-shadow: 0 0 0 4px var(--glow); }
.empty { color: var(--ink-soft); font-size: clamp(16px, 2.4vh, 22px); }

/* calm corner */
.overlay.calm { background: rgba(58, 64, 120, 0.55); }
.calm-panel { background: #eef0fb; text-align: center; width: min(820px, 100%); }
.calm-hero { width: clamp(120px, 26vh, 230px); margin: 0 auto; position: relative; }
.calm-hero .hero-box { position: relative; }
.calm-line { font-size: clamp(22px, 3.6vh, 36px); font-weight: 700; margin: 1vh 0 2vh; min-height: 1.3em; }
.zones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.zone { border-radius: 18px; padding: 1.4vh 6px; font-weight: 700; font-size: clamp(15px, 2.3vh, 22px); box-shadow: var(--shadow); line-height: 1.1; }
.zone.blue { background: var(--zone-blue); } .zone.green { background: var(--zone-green); }
.zone.yellow { background: var(--zone-yellow); } .zone.red { background: var(--zone-red); color: #fff; }
.zone.on { outline: 5px solid #fff; }
.calm-tools { display: flex; justify-content: center; gap: 14px; margin: 2.2vh 0; flex-wrap: wrap; }
.tool { background: var(--card); border-radius: 20px; padding: 10px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; box-shadow: var(--shadow); min-width: 110px; }
.tool .ic { width: clamp(40px, 7vh, 60px); aspect-ratio: 1; }
.squish { width: clamp(70px, 12vh, 110px); aspect-ratio: 1; border-radius: 50%; margin: 0 auto; background: radial-gradient(circle at 35% 30%, #ffd9e0, #f28482); box-shadow: var(--shadow); transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); touch-action: none; }
.squish.down { transform: scale(1.25, 0.7); transition: transform 0.25s ease; }
.calm-breath { width: clamp(120px, 22vh, 200px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; background: radial-gradient(circle, rgba(191, 230, 247, 0.9), rgba(142, 202, 230, 0.4)); border: 4px solid rgba(95, 168, 211, 0.8); transform: scale(0.55); transition: transform 3.6s ease-in-out; display: grid; place-items: center; font-weight: 700; font-size: clamp(20px, 3vh, 30px); color: #2f6f96; }
.calm-breath.in { transform: scale(1); }

/* done / first-then */
.done-panel { text-align: center; width: min(760px, 100%); }
.done-star { width: clamp(80px, 16vh, 140px); margin: 0 auto; animation: breathe 2.4s ease-in-out infinite; }
.done-panel h2 { font-size: clamp(34px, 6vh, 60px); margin: 1vh 0 2vh; }
.first-then { display: flex; align-items: center; justify-content: center; gap: 3vw; margin-bottom: 3vh; }
.ft-col { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: clamp(18px, 2.8vh, 26px); }
.ft-col span { font-weight: 700; color: var(--ink-soft); }
.ft-card { width: clamp(90px, 17vh, 150px); aspect-ratio: 1; border-radius: 24px; background: #f3f7fb; display: grid; place-items: center; box-shadow: var(--shadow); position: relative; }
.ft-card svg { width: 66%; height: 66%; }
.ft-card.did { opacity: 0.6; }
.ft-card.upnext { box-shadow: 0 0 0 5px var(--glow), var(--shadow); }
.ft-arrow svg { width: clamp(36px, 6vh, 56px); }
.done-actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }

/* grown-ups */
.grown-panel { width: min(900px, 100%); font-size: 18px; }
.grown-panel section { border-top: 2px solid var(--line); padding: 14px 0 6px; }
.grown-panel h3 { margin: 0 0 10px; }
.grown-panel p.note { margin: 0 0 10px; color: var(--ink-soft); font-size: 15px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 8px 0; }
.row > label { min-width: 190px; font-weight: 700; }
.row input[type='text'], .row select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; min-width: 200px; }
.row input[type='range'] { width: 220px; accent-color: var(--accent); }
.seg { display: inline-flex; background: #f1ebe1; border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 16px; }
.seg button.on { background: var(--card); box-shadow: 0 2px 0 rgba(61, 58, 75, 0.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; background: #f1ebe1; font-weight: 700; font-size: 16px; }
.chip .ic { width: 34px; height: 30px; }
.chip .ic svg, .tool .ic svg { width: 100%; height: 100%; }
.chip.on { background: #d8f0e2; box-shadow: 0 0 0 3px var(--go); }
.mini-heroes { display: flex; gap: 10px; flex-wrap: wrap; }
.mini-heroes button { width: 84px; padding: 6px; border-radius: 16px; background: #f1ebe1; display: flex; flex-direction: column; align-items: center; font-weight: 700; font-size: 14px; }
.mini-heroes button.on { background: #d8f0e2; box-shadow: 0 0 0 3px var(--go); }
.mini-heroes .char { width: 60px; height: auto; }
.mini-heroes .mk-plus { width: 60px; height: 72px; border-width: 3px; border-radius: 14px; }
.btn-plain { padding: 8px 14px; border-radius: 12px; background: #f1ebe1; font-weight: 700; font-size: 16px; }
.btn-warn { background: #fde2dc; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 16px; font-size: 18px; max-width: 90vw; text-align: center; animation: rise 0.3s ease;
}

/* ---------- make your own hero (js/game/maker.js) ---------- */
.maker-panel { width: min(1060px, 100%); }
.maker-panel .panel-head h2 { font-size: clamp(22px, 3.6vh, 34px); white-space: nowrap; }
.mk-steps { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mk-dot { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 5px; border-radius: 999px; background: #f1ebe1; font-weight: 700; font-size: 15px; }
.mk-dot b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #fffdf8; font-size: 13px; }
.mk-dot.on { background: var(--accent); color: #fff; }
.mk-dot.on b { color: var(--ink); }
.mk-dot.done b { background: #d8f0e2; }
.mk-dot:disabled { opacity: 0.45; cursor: default; }
.maker { display: flex; gap: clamp(12px, 2.5vw, 30px); align-items: flex-start; }
.mk-stage {
  flex: none; width: min(36vw, calc(60vh * 5 / 6)); aspect-ratio: 5 / 6; border-radius: 18px; position: relative; overflow: hidden;
  touch-action: none; box-shadow: inset 0 0 0 3px var(--line);
  background: repeating-conic-gradient(#f3eee6 0% 25%, #fffdf8 0% 50%) 0 0 / 24px 24px;
}
.mk-stage[data-step='fit'], .mk-stage[data-step='face'] { cursor: grab; }
.mk-stage[data-step='edges'] { cursor: crosshair; }
.mk-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mk-hero { position: absolute; inset: 0; }
.mk-hero .char { width: 100%; height: 100%; overflow: visible; }
.mk-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-weight: 700; color: var(--ink-soft); text-align: center; padding: 12px; }
.mk-empty svg { width: 40%; }
.mk-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.6vh; }
.mk-controls { display: grid; gap: 1.4vh; align-content: start; }
.mk-controls .row { display: grid; grid-template-columns: 7em 1fr; align-items: center; gap: 10px; }
.mk-controls .row > label { font-weight: 700; min-width: 0; }
.mk-controls .row { margin: 0; }
.mk-controls .row input[type='text'] { min-width: 0; }
.mk-controls input[type='text'] { font: inherit; font-size: 18px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; width: 100%; -webkit-user-select: text; user-select: text; }
.mk-controls input[type='range'] { width: 100%; }
.mk-controls .note { margin: 0; }
.mk-say { margin: 0; font-size: clamp(18px, 2.8vh, 24px); font-weight: 700; line-height: 1.3; }
.mk-file { align-self: flex-start; cursor: pointer; justify-self: start; }
.mk-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-btns button:disabled { opacity: 0.45; }
.mk-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; }
.mk-nav #mk-next { margin-left: auto; }
.mk-nav button:disabled { opacity: 0.45; }
@media (max-aspect-ratio: 1/1) {
  .maker { flex-direction: column; align-items: center; }
  .mk-stage { width: min(70vw, 40vh); }
  .mk-right { width: 100%; }
}
/* the hero picker's "Make your own" tile */
.mk-plus { border: 4px dashed #cfc4b2; border-radius: 22px; display: grid; place-items: center; }
.mk-plus svg { width: 55%; }
.pick-parts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pick-parts button { width: clamp(60px, 10vh, 92px); padding: 4px 4px 2px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); border: 3px solid transparent; font-weight: 700; font-size: clamp(12px, 1.9vh, 16px); display: flex; flex-direction: column; align-items: center; }
.pick-parts button.on { border-color: var(--go); background: #e9f6ee; }
.pick-parts svg { width: 100%; height: auto; overflow: hidden; }

/* ---------- keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bxturn { 0%, 100% { transform: translateX(0) scaleX(1); } 25% { transform: translateX(14px) scaleX(0.7); } 50% { transform: translate(0, -3px) scaleX(0.9); } 75% { transform: translateX(-14px) scaleX(0.7); } }
@keyframes bxrise { 0%, 100% { transform: scaleY(0.82); } 50% { transform: scaleY(1.08); } }
@keyframes bxpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes bxpop { 0%, 100% { transform: translateY(6px); } 50% { transform: translateY(-8px); } }
@keyframes bxdrift { from { transform: translateX(0); } to { transform: translateX(var(--w)); } }
@keyframes needle { 0%, 100% { transform: rotate(-58deg); } 50% { transform: rotate(58deg); } }
@keyframes lamp { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes floor { 0%, 22% { opacity: 1; } 25%, 97% { opacity: 0; } 100% { opacity: 1; } }
@keyframes shine { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.03); } }
@keyframes shinebig { 0%, 100% { opacity: 0.85; transform: scale(1.06); } 50% { opacity: 1; transform: scale(1.14); } }
@keyframes squish { 0%, 100% { transform: scale(1.04, 0.95); } 50% { transform: scale(0.97, 1.04); } }
@keyframes dance { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes jelly { 0%, 100% { transform: translateX(calc(var(--a) * -1px)); } 50% { transform: translateX(calc(var(--a) * 1px)); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5%); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.5%) rotate(-1deg); } 75% { transform: translateX(1.5%) rotate(1deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(8deg); } }
@keyframes swaysoft { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes wag { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(14deg); } }
@keyframes puff { 0% { transform: translate(0, 0) scale(0.4); opacity: 0; } 20% { opacity: 0.95; } 100% { transform: translate(14px, -60px) scale(1.6); opacity: 0; } }
@keyframes talk { from { transform: scaleY(1); } to { transform: scaleY(0.45); } }
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 207, 61, 0.9)) drop-shadow(0 0 1px #fff); }
  50% { filter: drop-shadow(0 0 13px rgba(255, 196, 0, 1)) drop-shadow(0 0 3px #fff); }
}
@keyframes ringpulse { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-12%) scale(1.03, 0.97); } 55% { transform: translateY(0) scale(1.05, 0.94); } 75% { transform: translateY(-4%); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
@keyframes stretch { 0%, 100% { transform: scale(1); } 45% { transform: scale(0.94, 1.1); } }
@keyframes shakeonce { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6%); } 40%, 80% { transform: translateX(6%); } }
@keyframes bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.1, 0.9); } 70% { transform: scale(0.96, 1.05); } }
@keyframes boop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06, 0.94); } }
@keyframes stream { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }
@keyframes drive { to { transform: translateX(-1600px); } }
@keyframes noise { from { transform: translateX(-50%) scale(0.9); opacity: 0.6; } to { transform: translateX(-50%) scale(1.1); opacity: 1; } }
@keyframes floatup { 0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx, 0px)), -260%) scale(1); opacity: 0; } }
@keyframes zz { 0% { transform: translate(0, 0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(20px, -40px); opacity: 0; } }
@keyframes letter { from { opacity: 0; transform: translateY(0.25em); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes echo { 0%, 100% { background: transparent; } 50% { background: #eaf6ff; } }

/* ---------- reduce motion: keep meaning (fan spins, speeds), drop decoration ---------- */
.reduce-motion .hero .bob, .reduce-motion .is-char .bob, .reduce-motion .big-play, .reduce-motion .next,
.reduce-motion .stop.here .disc, .reduce-motion .done-star, .reduce-motion .caption.echo,
.reduce-motion .echo-bubble svg, .reduce-motion .particle { animation: none !important; }
.reduce-motion .particle { display: none; }
.reduce-motion .halo { animation: none; }
.reduce-motion .w.now .ch { animation: none; }
.reduce-motion .stage.driving .scenery { animation-duration: 20s; }

@media (max-height: 520px) {
  .caption-bar { min-height: 70px; border-radius: 18px; }
  .card-label { display: none; }
}

/* Build version on the title screen (commit · date), for checking which update a tablet has. */
#version { position: fixed; right: 10px; bottom: 6px; font-size: 11px; color: var(--ink-soft); opacity: .5; pointer-events: none; }

/* ---------- phones and portrait ----------
   Designed for landscape tablets first. Portrait: the top bar takes two rows (the buttons that are
   always there, then this room's things to do or the picture schedule), and sizes follow the width
   too. Phone landscape: the always-there buttons go down the left, the room's things down the right,
   so the scene gets the height. */
.title-corner { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); }

/* words inside the scene keep a readable size on a small stage */
.choice .c-word { font-size: max(2.6cqw, 13px); }
.choice { width: max(17cqw, 78px); }
.echo-bubble { font-size: max(3cqw, 14px); }
.w-prompt.wide { font-size: max(1.6cqw, 11px); }
.w-sign { width: max(5.4cqw, 28px); }
.w-ft-card b { font-size: max(1.3cqw, 9px); }
.w-timer-chip { font-size: max(1.7cqw, 11px); }

@media (max-aspect-ratio: 1/1) {
  .title-art.row { flex-wrap: wrap; justify-content: center; height: auto; max-width: 92vw; gap: 2vh 4vw; }
  .title-art.row .char { height: min(13vh, 24vw); }
  .title-art { height: min(34vh, 70vw); }

  .round { width: clamp(46px, min(9.5vh, 14vw), 76px); }
  .round.small { width: clamp(42px, min(7.5vh, 11vw), 60px); }
  .card, .w-act { width: clamp(46px, min(9.5vh, 13vw), 80px); height: clamp(46px, min(9.5vh, 13vw), 80px); }

  /* the bar: Home on the left, Map / Talk / My body on the right; the room's things on a row below */
  .bar { flex-wrap: wrap; row-gap: 1.2vh; }
  #btn-home { margin-right: auto; }
  #strip, .world-acts { order: 1; flex: 1 0 100%; }
  .world-acts { gap: clamp(12px, 3vw, 26px); }

  /* My Day */
  .map-head { flex-direction: column; gap: 1vh; }
  .map-head h2 { font-size: clamp(28px, min(5.5vh, 9vw), 54px); text-align: center; }
  .map-tools { flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
  .map-tools .pill { font-size: clamp(18px, min(3.2vh, 5.2vw), 30px); padding: 0.45em 0.9em; }
  .day-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .day-btn { font-size: clamp(14px, min(2.4vh, 4vw), 24px); padding: 4px 10px 4px 4px; gap: 6px; text-align: left; line-height: 1.1; }
  .day-btn .ic { width: clamp(32px, min(6vh, 10vw), 54px); flex: none; }
  .map-path { gap: 9vh 3vw; padding: 8vh 0 2vh; }
  .stop { width: clamp(64px, 20vw, 150px); }
  .stop b { font-size: clamp(13px, min(2.4vh, 3.8vw), 24px); }

  .talk-grid { grid-template-columns: repeat(auto-fill, minmax(clamp(90px, 15vw, 160px), 1fr)); }

  /* hero picker (the grid is set up with the other picker styles) */
  #screen-select { gap: 1.4vh; }
  .prompt { font-size: clamp(24px, min(5vh, 7.4vw), 50px); }
  .pick .char, .pick .mk-plus, .pick .mini4 { height: clamp(50px, min(9vh, 18vw), 160px); }
  .mini-caption { font-size: clamp(18px, min(3.6vh, 5.4vw), 40px); }
  .pick-parts button { width: clamp(52px, min(9vh, 15vw), 92px); }
  /* labels under the room's things wrap instead of being cut off */
  .world-acts { padding-bottom: 2.3em; }
  .w-act-label { white-space: normal; text-align: center; line-height: 1.05; width: calc(100% + clamp(12px, 3vw, 26px)); max-width: none; }
}

@media (max-aspect-ratio: 1/1) and (max-width: 600px) {
  /* the caption: "hear it again" sits on top of the box, so the words get the width */
  .caption-bar { position: relative; margin-top: 24px; min-height: clamp(78px, 13vh, 150px); padding: 8px 10px; gap: 10px; border-radius: 20px; }
  #btn-replay { position: absolute; left: 50%; top: 0; translate: -50% -58%; width: 48px; }
  .speaker { width: min(10vh, 14vw); }
  .next { width: min(12vh, 17vw); }
  .caption { font-size: clamp(20px, 6.6vw, 30px); line-height: 1.3; }
  #screen-play { padding-left: 10px; padding-right: 10px; }

  /* overlays */
  .overlay { padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
  .panel { padding: 14px; border-radius: 24px; }
  .panel-head { flex-wrap: wrap; }
  .need-row { font-size: clamp(15px, 4.4vw, 26px); gap: 8px; }
  .need-row .ic { width: clamp(32px, 9vw, 60px); }
  .need-bar { min-width: 40px; }
  .need-word { min-width: 0; }
  .zones { gap: 6px; }
  .zone { padding: 1.2vh 2px; font-size: clamp(14px, 3.8vw, 22px); }
  .tool { min-width: 90px; padding: 8px 10px; }
  /* wardrobe, music, coloring: one column, the hero beside its line */
  .wardrobe, .music, .color-wrap { flex-direction: column; align-items: stretch; }
  .wd-left, .music-left { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; }
  .wardrobe-hero, .music-hero { width: 32%; flex: none; }
  .wd-line { flex: 1; height: auto; max-height: 4em; margin: 0; }
  .wardrobe-rows { min-height: 0; }
  .wd-row { grid-template-columns: 1fr; gap: 4px; }
  .wd-opt { width: clamp(42px, min(8.5vh, 12.5vw), 70px); padding: 4px; }
  .wd-row.big .wd-opt { width: clamp(56px, min(12vh, 18vw), 96px); }
  .wd-tab { font-size: clamp(16px, 4.6vw, 26px); padding: 0.4em 0.9em; }
  .wardrobe-panel .pill, .color-panel .pill, .music-btns .pill { font-size: clamp(17px, 5vw, 30px); padding: 0.5em 0.9em; }
  .music-songs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .song { padding: 6px 8px; gap: 6px; font-size: clamp(14px, 4vw, 20px); }
  .song .ic { width: 28px; height: 28px; }
  .music-btns { flex-wrap: wrap; justify-content: center; }
  .color-crayons { grid-template-columns: repeat(auto-fill, minmax(clamp(44px, 8vh, 64px), 1fr)); justify-items: center; }
  .first-then { gap: 4vw; }
  .ft-card { width: clamp(80px, 26vw, 150px); }
}

@media (max-height: 520px) and (min-aspect-ratio: 13/10) {
  /* safe areas: in landscape a phone's notch is at the side */
  #screen-select, #screen-map { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

  /* hero picker: one row of smaller tiles */
  #screen-select { gap: 1.4vh; padding-top: 8px; padding-bottom: 8px; }
  .prompt { font-size: clamp(22px, 7vh, 50px); }
  .select-grid { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
  .pick { border-radius: 18px; padding: 6px 4px 5px; gap: 3px; }
  .pick .char, .pick .mk-plus, .pick .mini4 { height: clamp(40px, 14vh, 120px); }
  .pick span { font-size: clamp(13px, 4vh, 20px); }
  .mini-caption { font-size: clamp(16px, 5.5vh, 30px); }
  .pick-parts button { width: clamp(50px, 14vh, 80px); }
  .pill { font-size: clamp(17px, 5.5vh, 28px); }

  /* My Day */
  .map-path { gap: 12vh 2vw; padding: 9vh 0 1vh; }
  .stop { width: clamp(64px, 10vw, 140px); }
  .day-picker { gap: 8px; margin-top: 1vh; }
  .day-btn { font-size: clamp(14px, 4.4vh, 22px); padding: 3px 14px 3px 4px; }
  .day-btn .ic { width: clamp(28px, 9vh, 48px); }

  /* play: buttons down the left, the room's things (or the schedule) down the right */
  #screen-play.active {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: repeat(4, auto) minmax(0, 1fr) auto;
    gap: 8px 10px; padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  #screen-play .bar { display: contents; }
  .round { width: clamp(42px, 12vh, 60px); }
  .round.small { width: clamp(40px, 11vh, 52px); }
  #btn-home { grid-area: 1 / 1; }
  #btn-map { grid-area: 2 / 1; }
  #btn-talk { grid-area: 3 / 1; }
  #btn-calm { grid-area: 4 / 1; }
  .stage-wrap { grid-column: 2; grid-row: 1 / 6; }
  #strip, .world-acts {
    grid-column: 3; grid-row: 1 / 6; flex-direction: column; justify-content: safe center; align-items: center;
    overflow-y: auto; overflow-x: hidden; min-height: 0;
  }
  #strip { padding: 8px 6px; gap: 10px; }
  .world-acts { width: 86px; padding: 4px 0 20px; gap: 22px; }
  .card, .w-act { width: clamp(42px, 12vh, 64px); height: clamp(42px, 12vh, 64px); }
  .w-act-label { max-width: 84px; font-size: 11px; }
  .w-list-gap { height: 6px; width: auto; }
  .caption-bar { grid-column: 1 / -1; grid-row: 6; min-height: 58px; padding: 4px 10px; border-radius: 18px; }
  .speaker { width: clamp(42px, 13vh, 70px); }
  .next { width: clamp(50px, 15vh, 76px); }
  .caption { font-size: clamp(20px, 2vw + 3vh, 40px); line-height: 1.25; }

  /* overlays */
  .overlay { padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
  .panel { padding: 12px 16px; border-radius: 22px; }
  .panel-head { margin-bottom: 1vh; }
  .panel h3 { margin: 1.5vh 0 1vh; }
  .talk-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
  .say-btn { padding: 8px 4px 6px; border-radius: 16px; font-size: clamp(14px, 4vh, 20px); }
  .say-btn .ic { width: clamp(30px, 9vh, 60px); height: clamp(30px, 9vh, 60px); }
  /* My body: the hero and its words on the left, the body bars and tools on the right */
  .calm-panel { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); column-gap: 18px; align-items: center; }
  .calm-panel > * { grid-column: 2; }
  .calm-panel .calm-hero, .calm-panel:has(.calm-needs:not([hidden])) .calm-hero { grid-column: 1; grid-row: 1 / 4; width: min(100%, 44vh); }
  .calm-panel .calm-line, .calm-panel:has(.calm-needs:not([hidden])) .calm-line { grid-column: 1; grid-row: 4 / 6; align-self: start; margin: 0; font-size: clamp(18px, 6vh, 32px); }
  #calm-needs { grid-row: 1; margin: 0 0 1.4vh; width: 100%; }
  #calm-zones { grid-row: 2; }
  .calm-tools { grid-row: 3; margin: 2vh 0; }
  #calm-activity { grid-row: 4; }
  #calm-ready { grid-row: 5; justify-self: center; }
  .zone { padding: 1vh 4px; }
  .tool { padding: 6px 14px; }
  .tool .ic { width: clamp(30px, 9vh, 50px); }
  .calm-breath { width: clamp(80px, 26vh, 200px); }
  .squish { width: clamp(60px, 18vh, 110px); }
  .done-star { width: clamp(44px, 13vh, 140px); }
  .done-panel h2 { font-size: clamp(26px, 8vh, 60px); margin: 0 0 1vh; }
  .first-then { margin-bottom: 2vh; }
  .ft-card { width: clamp(64px, 20vh, 150px); }
  .music-left, .wd-left { width: min(30%, 50vh); }
  .music-right { gap: 1vh; }
  .music-songs { gap: 6px; }
  .song { padding: 4px 10px; }
  .song .ic { width: 30px; height: 30px; }
  .wardrobe-rows { gap: 1vh; min-height: 0; }
  .wd-opt { width: clamp(38px, 11vh, 70px); padding: 4px; }
  .wd-row.big .wd-opt { width: clamp(48px, 15vh, 96px); }
}
