  /* Nuclear bypass for automated tests: disable ALL motion immediately if ?test is in URL */
  html[data-test] *, 
  html[data-test] *::before, 
  html[data-test] *::after {
    animation: none !important;
    transition: none !important;
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }

  * { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent;
      user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
  html, body { height:100%; overflow:hidden; }
  /* position:fixed anchors to the initial viewport on iOS so the address bar
     showing/hiding doesn't cause a visible layout resize when switching screens */
  body {
    position:fixed; width:100%;
    font-family:"Comic Sans MS","PingFang SC","Microsoft YaHei","Segoe UI",system-ui,sans-serif;
    background:linear-gradient(#8fd5f7, #c9efb0 65%, #8fd06a);
    transition:background .5s;
  }
  body.theme-snow   { background:linear-gradient(#1d3f8f, #4f8fd8 60%, #cfeaff); }
  body.theme-ocean  { background:linear-gradient(#8fdcf0, #2fa7c9 55%, #0e6e96); }
  body.theme-pizza  { background:linear-gradient(#ffd98a, #ffb35c 60%, #e8843c); }
  body.theme-bike   { background:linear-gradient(#9bdcf7, #cdeefb 45%, #a8e08c 70%, #79c861); }
  body.theme-pasta  { background:repeating-conic-gradient(#f3ece0 0% 25%, #e25b4a 0% 50%) 0 0 / 16vmin 16vmin; }
  body.theme-trace  { background:linear-gradient(#4d3390, #8a5fc9 55%, #c9aef0); }
  body.theme-memory { background:linear-gradient(#f7c948, #f08a4b 60%, #d9663a); }
  body.theme-music  { background:linear-gradient(#3b2a6e, #7a4fb8 55%, #c86bb1); }
  body.theme-whosays{ background:linear-gradient(#2f9e6e, #57c98a 55%, #bdeccf); }
  body.theme-story  { background:linear-gradient(#244b8f, #6f8fd0 60%, #f0d6a8); }
  body.theme-space  { background:linear-gradient(#070726, #181848 50%, #34215c); }
  body.theme-zoo    { background:linear-gradient(#bfe6ff, #dff3ff 40%, #c8e89a 62%, #8fc85a); }
  body.theme-farm   { background:linear-gradient(#cdeffb, #eaf7ff 42%, #f3e2a8 64%, #e0c06a); }
  body.theme-sky    { background:linear-gradient(#5fb8ef, #9fd8f7 50%, #d6eefb); }
  body.theme-feelings { background:linear-gradient(#ffe3c2, #ffd0e0 52%, #ddc9ff); }
  body.theme-scavenger{ background:linear-gradient(#bfe8ff, #d8f5c8 55%, #ffe6a8); }
  body.theme-senses   { background:linear-gradient(#ffe0ef, #e7dcff 52%, #cfeffe); }
  body.theme-dragon { background:linear-gradient(#3a1c4a, #7a3b8a 50%, #e08a5a); }
  body.theme-dino   { background:linear-gradient(#5c9e57, #9ed07e 55%, #e6dba0); }
  body.theme-icecream { background:linear-gradient(#ffd1e8, #ffe6c0 55%, #bfe8ff); }
  body.theme-pets   { background:linear-gradient(#ffe6a8, #ffd2e0 55%, #b8e6c0); }
  body.theme-dressup { background:linear-gradient(#ffe0f2, #e2e6ff 60%, #d8f0e0); }
  body.theme-sort   { background:linear-gradient(#5aa9d6, #9fd0e8 55%, #dff0f8); }
  body.theme-cups     { background:linear-gradient(#ffd98a, #f7b267 55%, #e07a5f); }
  body.theme-nightday { background:linear-gradient(165deg, #87ceeb 0%, #4a7fbf 40%, #1a3366 100%); }
  body.theme-measure { background:linear-gradient(#bfe8ff, #eaf7d8 55%, #cdeec0); }

  .screen { position:absolute; inset:0; display:flex; flex-direction:column;
            align-items:center; justify-content:center; padding:2vmin;
            animation:screenIn .44s cubic-bezier(0.34,1.56,0.64,1) both; }
  @keyframes screenIn { 0%{opacity:0; transform:scale(.86);} 100%{opacity:1; transform:scale(1);} }
  /* contextual transitions: drilling forward slides in from the right, going home from the left */
  .screen.fwd  { animation:enterFwd  .44s cubic-bezier(0.34,1.56,0.64,1) both; }
  .screen.back { animation:enterBack .44s cubic-bezier(0.34,1.56,0.64,1) both; }
  @keyframes enterFwd  { 0%{opacity:0; transform:translateX(30vw) scale(.9);}  100%{opacity:1; transform:translateX(0) scale(1);} }
  @keyframes enterBack { 0%{opacity:0; transform:translateX(-24vw) scale(.9);} 100%{opacity:1; transform:translateX(0) scale(1);} }
  /* quick child-friendly "wipe" flash when scenery changes */
  #wipe { position:fixed; inset:0; z-index:120; pointer-events:none; opacity:0;
          background:radial-gradient(circle at 50% 45%, rgba(255,255,255,.92), rgba(255,255,255,.55) 45%, rgba(255,255,255,0) 72%); }
  #wipe.run { animation:wipeFlash .46s ease-out; }
  @keyframes wipeFlash { 0%{opacity:0; transform:scale(.4);} 35%{opacity:.7;} 100%{opacity:0; transform:scale(1.6);} }
  .hidden { display:none !important; }
  button { font-family:inherit; cursor:pointer; }

  /* ================= WORLD MAP HUB ================= */
  #hub { padding:0; overflow:hidden; }
  #hub h1 {
    position:absolute; top:1.2vmin; width:100%; text-align:center; z-index:5;
    font-size:clamp(22px, 5vmin, 46px); color:#fff; margin:0;
    text-shadow:0 3px 0 rgba(0,0,0,.25); pointer-events:none;
  }
  /* A top-down sea the worlds sit in as islands, with clouds drifting over it.
     The top/bottom vignette is the same one the world trail paints on its ground,
     so the map and the inside of a world read as one place seen at two zooms. */
  #map { position:relative; width:100%; height:100%;
         background:linear-gradient(180deg, rgba(0,0,0,.07), rgba(0,0,0,0) 20%,
                                            rgba(0,0,0,0) 80%, rgba(0,0,0,.07)),
                    linear-gradient(#7ecdee, #a3ddf3 46%, #74c4e6); }
  #mapBg { position:absolute; inset:0; width:100%; height:100%; }
  /* stepping stones along the causeway — the map-scale twin of #trailDots */
  #mapDots { position:absolute; inset:0; z-index:1; pointer-events:none; }
  #mapDots i { position:absolute; display:block; border-radius:50%;
               width:clamp(4px,.9vmin,8px); height:clamp(4px,.9vmin,8px);
               transform:translate(-50%,-50%); background:#c8a878; opacity:.55; }
  /* island scenery: DOM, not SVG, so it never distorts with the stretched viewBox.
     Sizing and shadow match .tr-fixed — the same trees at a smaller zoom. */
  #mapDeco { position:absolute; inset:0; z-index:1; pointer-events:none; }
  #mapDeco span { position:absolute; transform:translate(-50%,-50%); opacity:.85;
                  font-size:clamp(15px,3.4vmin,30px);
                  filter:drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
  /* Sea life that drifts across the map and boings when tapped — the hub twin of
     .tr-prop, so the map is as alive to poke at as the inside of a world. */
  #mapProps { position:absolute; inset:0; z-index:2; overflow:hidden; }
  /* The centering transform is on the base rule, not only inside @keyframes mapWander:
     reduced motion kills the animation, and a prop would otherwise jump half its own
     size off the water it was placed in. */
  .map-prop { position:absolute; transform:translate(-50%,-50%);
              border:none; background:none; padding:6px; line-height:1;
              font-size:clamp(20px,4.4vmin,38px); opacity:.9;
              filter:drop-shadow(0 3px 3px rgba(0,0,0,.22));
              animation:mapWander ease-in-out infinite alternate; }
  @keyframes mapWander { from{transform:translate(-50%,-50%) scaleX(1);}
                         to  {transform:translate(calc(-50% + 96px),-50%) scaleX(-1);} }
  .map-prop.boing { animation:trBoing .5s ease-out; }
  .sun { position:absolute; top:1.5vmin; right:13vmin; font-size:clamp(34px,7.5vmin,68px);
         animation:spin 24s linear infinite; z-index:1; pointer-events:none; }
  @keyframes spin { to { transform:rotate(360deg); } }
  .cloud { position:absolute; font-size:clamp(28px,6.5vmin,58px); opacity:.95; z-index:1;
           left:-15vw; animation:drift linear infinite; pointer-events:none; }
  @keyframes drift { to { transform:translateX(130vw); } }

  /* ---- Self-contained world node: flex column, no absolute/grid conflict ---- */
  .node { position:relative; display:flex; flex-direction:column; align-items:center; gap:.7vmin;
          border:none; background:none; padding:0; }
  /* "New!" pennant planted above a disc — gold, matching the app's reward colour language */
  .node-new { position:absolute; top:-.6em; left:50%; transform:translateX(-50%); z-index:2;
    background:#ffd23e; color:#5b3c00; font-size:clamp(9px,1.8vmin,14px); font-weight:bold;
    padding:.18em .7em; border-radius:99px; border:2px solid #fff; white-space:nowrap;
    box-shadow:0 2px 0 rgba(0,0,0,.2); animation:newPulse 2.2s ease-in-out infinite; }
  @keyframes newPulse { 0%,100%{transform:translateX(-50%) scale(1);}
                        50%  {transform:translateX(-50%) scale(1.08);} }
  .node-disc {
    position:relative; width:clamp(58px,15vmin,118px); height:clamp(58px,15vmin,118px);
    border-radius:50%; display:flex; align-items:center; justify-content:center; overflow:hidden;
    font-size:clamp(28px,8vmin,58px); border:5px solid #fff;
    /* layered depth: drop + ambient cast, inner core shade, inner top sheen */
    box-shadow:0 6px 0 rgba(0,0,0,.16), 0 12px 22px rgba(0,0,0,.24),
               inset 0 -8px 11px rgba(0,0,0,.18), inset 0 7px 11px rgba(255,255,255,.42);
    transition:transform .5s cubic-bezier(0.175,0.885,0.32,1.275);   /* bouncy spring release */
  }
  /* glossy highlight sweep across the top of every disc */
  .node-disc::after { content:""; position:absolute; top:5%; left:13%; width:74%; height:44%;
    border-radius:50%; pointer-events:none;
    background:radial-gradient(closest-side, rgba(255,255,255,.72), rgba(255,255,255,0)); }
  .node-disc>span { position:relative; z-index:1; line-height:1; filter:drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
  .node:active .node-disc { transform:scale(.82); transition:transform .09s ease-out; }   /* fast squish-in */
  .node-label { font-size:clamp(11px,2.1vmin,17px); font-weight:bold; color:#fff; max-width:26vmin;
    text-shadow:0 1px 0 rgba(0,0,0,.4); background:rgba(0,0,0,.2); padding:.12em .8em; border-radius:99px;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .node-stars { font-size:clamp(10px,1.9vmin,15px); min-height:1.1em; letter-spacing:-1px; }
  .b-snow   { background:linear-gradient(#7fb6f7,#3a6fd0); }
  .b-ocean  { background:linear-gradient(#4fc4e0,#1583ad); }
  .b-memory { background:linear-gradient(#ffd166,#e8913a); }
  .b-bike   { background:linear-gradient(#8fd96a,#4a9e35); }
  .b-music  { background:linear-gradient(#c77ff2,#8246c8); }
  .b-whosays{ background:linear-gradient(#5ad29a,#2f9e6e); }
  .b-pizza  { background:linear-gradient(#ffb04f,#e0701e); }
  .b-pasta  { background:linear-gradient(#f08a6a,#cf4530); }
  .b-trace  { background:linear-gradient(#b07fe8,#7444c4); }
  .b-paint  { background:linear-gradient(#ff8fb1,#e84393); }
  .b-story  { background:linear-gradient(#6f8fd0,#34508f); }
  .b-rocket { background:linear-gradient(#5a6bd8,#2a2f7a); }
  .b-sort   { background:linear-gradient(#7a5fd0,#3a2a7a); }
  .b-pattern{ background:linear-gradient(#9b6fe0,#5a3aa0); }
  .b-dragon { background:linear-gradient(#a05bc0,#6a2f8a); }
  .b-dino   { background:linear-gradient(#7fc96a,#3f8e35); }
  .b-icecream { background:linear-gradient(#ff9ec9,#e84393); }
  .b-petfeed { background:linear-gradient(#ffc06a,#e0852e); }
  .b-petmatch{ background:linear-gradient(#ffb38f,#e06a3a); }
  .b-petcare { background:linear-gradient(#7fd0e0,#2f8ea0); }
  .b-dressup { background:linear-gradient(#ff9ed6,#c84398); }
  .b-sortkind { background:linear-gradient(#ffc87a,#e08a30); }
  .b-nightday { background:linear-gradient(#4ab3e8,#1a3366); }
  /* .b-body is also used as a balloon shape in bike.js; override to circle+color for hub disc */
  .node-disc.b-body { border-radius:50%; background:linear-gradient(#7fd4c0,#2f9e8a); }
  .c-pets   { background:linear-gradient(#ffba6a,#e07a2e); }
  .c-num    { background:linear-gradient(#7fb6f7,#3a6fd0); }
  .c-shape  { background:linear-gradient(#ff9f4f,#e0701e); }
  .c-brain  { background:linear-gradient(#5ad29a,#2f9e6e); }
  .c-animal { background:linear-gradient(#ffd166,#e8913a); }
  .c-space  { background:linear-gradient(#5a6bd8,#26265a); }
  .c-create { background:linear-gradient(#ff8fb1,#e84393); }

  /* ---- World hub: every world keeps a FIXED spot on the map (see HUB_LAYOUT in hub.js).
         Percentage coords instead of an auto-fit grid, so a disc never moves between a
         phone and a tablet — she navigates the map by place, not by reading. ---- */
  #mapNodes.worlds { position:absolute; inset:0; z-index:4; }
  /* Only the animation NAMES are overridden, so the base .node timing and the
     nth-child stagger below still apply; these keyframes carry the centering
     transform along, which a plain translateY bob would otherwise wipe out. */
  #mapNodes.worlds .node { position:absolute; transform:translate(-50%,-50%);
                           width:max-content; animation-name:worldPop, worldFloat; }
  /* the map has room the game grid doesn't — let full world names through */
  #mapNodes.worlds .node-label { max-width:32vmin; }
  @keyframes worldFloat { 0%,100%{transform:translate(-50%,-50%);}
                          50%   {transform:translate(-50%,calc(-50% - 1vmin));} }
  @keyframes worldPop   { 0%{opacity:0; transform:translate(-50%,-50%) scale(.3);}
                          100%{opacity:1; transform:translate(-50%,-50%) scale(1);} }
  .node { animation:nodePop .55s cubic-bezier(0.34,1.56,0.64,1) backwards, catFloat 4.6s ease-in-out infinite;
          animation-delay:0s, .55s; }
  /* staggered idle bob so the grid breathes instead of sitting static */
  .node:nth-child(4n+1) { animation-delay:0s, .7s; }   .node:nth-child(4n+2) { animation-delay:0s, 1.6s; }
  .node:nth-child(4n+3) { animation-delay:0s, 2.5s; }   .node:nth-child(4n)   { animation-delay:0s, 3.4s; }
  @keyframes catFloat { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-1vmin);} }
  @keyframes nodePop  { 0%{opacity:0; transform:scale(.3);} 100%{opacity:1; transform:scale(1);} }
  #games { padding:0; overflow:hidden; }
  #games #gamesHome { position:absolute; top:2vmin; left:2vmin; z-index:12; }
  #gamesTitle { position:absolute; top:2.5vmin; width:100%; text-align:center; color:#fff;
                font-size:clamp(22px,5vmin,40px); text-shadow:0 3px 0 rgba(0,0,0,.25); pointer-events:none;
                padding:0 2vmin; z-index:11; }

  /* ---- The world trail: one long path she scrolls along, Super Mario 3 style.
         Sized in pixels by worldtrail.js against the live viewport, so the wander has
         real distance to it rather than squeezing to fit. ---- */
  /* The road runs along the screen's long axis, so the scroll axis flips with it:
     down a portrait phone, across a landscape one (see worldTrail.measure). */
  #trailView { position:absolute; inset:0; overflow-x:auto; overflow-y:hidden;
               -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain; }
  #trailView::-webkit-scrollbar { height:0; width:0; }
  @media (max-aspect-ratio: 100/115) {
    #trailView { overflow-x:hidden; overflow-y:auto; overscroll-behavior-y:contain;
                 overscroll-behavior-x:auto; }
  }
  #trailCanvas { position:relative; height:100%; }
  #trailBg { position:absolute; left:0; top:0; }
  /* clipped so a wandering prop can't stretch the scrollable width past the canvas */
  #trailDeco { position:absolute; inset:0; overflow:hidden; }
  #gameNodes { position:absolute; inset:0; }
  /* nodes sit ON the path — the same disc system as the map, just placed by pixel */
  .tr-node { position:absolute; transform:translate(-50%,-50%); width:max-content; z-index:4; }
  .tr-node .node-disc { width:clamp(72px,18vmin,124px); height:clamp(72px,18vmin,124px);
                        font-size:clamp(34px,9.5vmin,64px); }
  .tr-node .node-label { max-width:34vmin; }
  /* keyframes carry the centering transform, as on the world map */
  .tr-node { animation-name:trNodePop; }
  @keyframes trNodePop { 0%{opacity:0; transform:translate(-50%,-50%) scale(.4);}
                         100%{opacity:1; transform:translate(-50%,-50%) scale(1);} }

  /* her buddy, standing on the path and walking it when she picks a game */
  /* The buddy is placed by pixel and centred with a transform, so it must NOT run
     .mascot's bob/talk keyframes — those set `transform` outright and would throw
     it off the path. Its inner .buddy span keeps the idle wiggle and talk squash. */
  #trailBuddy { position:absolute; z-index:6; width:clamp(46px,10vmin,84px);
                font-size:clamp(40px,9vmin,74px); transform:translate(-50%,-100%);
                pointer-events:none; filter:drop-shadow(0 4px 5px rgba(0,0,0,.3));
                animation:none !important; }

  /* The world party: the node that closes a path. Bigger and warmer than a game disc so
     it reads as a destination, with a slow shine rather than another bouncing thing. */
  .tr-party .node-disc { width:clamp(88px,22vmin,150px); height:clamp(88px,22vmin,150px);
                         font-size:clamp(42px,12vmin,78px); }
  .party-disc { border-radius:50%; background:linear-gradient(#ffd76a,#f2913d);
                box-shadow:0 6px 0 rgba(0,0,0,.18), 0 0 0 5px rgba(255,255,255,.9); }
  .tr-party .node-label { color:#5b3c00; background:rgba(255,255,255,.92);
                          border-radius:99px; padding:.1em .7em; }
  .tr-party .party-disc::before { content:""; position:absolute; inset:-14px; border-radius:50%;
    background:radial-gradient(circle, rgba(255,214,62,.45), rgba(255,214,62,0) 70%);
    animation:partyGlow 3.2s ease-in-out infinite; pointer-events:none; z-index:-1; }
  @keyframes partyGlow { 0%,100%{transform:scale(1); opacity:.55;}
                         50%   {transform:scale(1.14); opacity:.9;} }

  /* scenery — decoration only, never a target that matters */
  .tr-mark  { position:absolute; transform:translate(-50%,-50%); z-index:3;
              font-size:clamp(26px,6vmin,50px); filter:drop-shadow(0 2px 2px rgba(0,0,0,.22)); }
  .tr-fixed { position:absolute; transform:translate(-50%,-50%); z-index:2; opacity:.85;
              font-size:clamp(20px,4.6vmin,40px); filter:drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
  .tr-prop  { position:absolute; transform:translate(-50%,-50%);   /* as .map-prop: survives reduced motion */
              z-index:3; border:none; background:none; padding:6px;
              font-size:clamp(24px,5.4vmin,46px); line-height:1;
              filter:drop-shadow(0 3px 3px rgba(0,0,0,.22));
              animation:trWander ease-in-out infinite alternate; }
  @keyframes trWander { from{transform:translate(-50%,-50%) scaleX(1);}
                        to  {transform:translate(calc(-50% + 78px),-50%) scaleX(-1);} }
  .tr-prop.boing { animation:trBoing .5s ease-out; }
  @keyframes trBoing { 0%{transform:translate(-50%,-50%) scale(1);}
                       40%{transform:translate(-50%,-64%) scale(1.28);}
                       100%{transform:translate(-50%,-50%) scale(1);} }

  /* name entry */
  #namescreen { background:linear-gradient(#8fd5f7,#c9efb0 70%,#8fd06a); z-index:78; }
  .name-card { background:#fff; border-radius:30px; padding:4vmin 5vmin; display:flex; flex-direction:column;
               align-items:center; gap:2.2vmin; box-shadow:0 8px 0 rgba(0,0,0,.2); max-width:92%; }
  .name-card .mascot { width:clamp(80px,18vmin,150px); }
  .name-card h2 { font-size:clamp(20px,4.6vmin,34px); color:#444; text-align:center; }
  #nameInput { font-family:inherit; font-size:clamp(20px,5vmin,32px); text-align:center; padding:1.6vmin 3vmin;
               border:3px solid #c9aef0; border-radius:18px; width:min(78vw,420px); color:#333; }
  #nameInput:focus { outline:none; border-color:#7444c4; }
  #nameStart { border:none; border-radius:20px; padding:2vmin 5vmin; font-family:inherit;
               font-size:clamp(18px,4vmin,28px); font-weight:bold; background:#ffd23e; color:#5b3c00; box-shadow:0 5px 0 rgba(0,0,0,.22); }
  #nameStart:active { transform:scale(.95); }
  #nameSkip { border:none; background:none; color:#aaa; font-family:inherit; font-size:clamp(13px,2.8vmin,18px); text-decoration:underline; }
  .diff-grid { display:flex; gap:2.4vmin; flex-wrap:wrap; justify-content:center; }
  .diff-btn { border:none; border-radius:22px; padding:2.4vmin 3vmin; min-width:clamp(96px,26vw,150px);
              display:flex; flex-direction:column; align-items:center; gap:.6vmin; font-family:inherit;
              background:#f3ecff; color:#5b3c8c; box-shadow:0 5px 0 rgba(0,0,0,.18); cursor:pointer; }
  .diff-btn:nth-child(2) { background:#fff0d6; color:#7a5300; }
  .diff-btn:nth-child(3) { background:#ffe0ec; color:#8a2350; }
  .diff-btn:active { transform:scale(.95); }
  .diff-emoji { font-size:clamp(34px,8vmin,56px); line-height:1; }
  .diff-name { font-size:clamp(17px,3.8vmin,26px); font-weight:bold; }
  .diff-btn small { font-size:clamp(12px,2.6vmin,16px); opacity:.7; }
  #setName { background:#cdeafe; color:#1b4e7a; }
  #setDash { background:#d8f0d0; color:#2b5e1f; }

  /* dress-up (drawn, composable SVG character + closet) */
  #dressup { padding:0; }
  #dressBar { display:flex; align-items:center; justify-content:center; gap:1.4vmin; width:100%; padding:1.2vmin; z-index:20; }
  /* flex-end + a bottom pad the height of the kit's ground band: the doll stands on the
     grass rather than hovering above it */
  #dressStage { flex:1; width:100%; display:flex; align-items:flex-end; justify-content:center;
                transition:background .3s; min-height:0; padding:1vmin 1vmin 13%;
                position:relative; overflow:hidden; }
  #dollWrap { width:clamp(150px,40vmin,300px); max-height:100%; display:flex; }
  .dollsvg { width:100%; height:auto; max-height:100%; overflow:visible; filter:drop-shadow(0 6px 8px rgba(0,0,0,.18)); }
  .dollsvg g { transform-box:fill-box; transform-origin:center; }
  /* the layer that just changed pops in; the whole doll gives a happy wiggle */
  .dollsvg g.pop { animation:partPop .45s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes partPop { 0%{transform:scale(.25);} 60%{transform:scale(1.2);} 100%{transform:scale(1);} }
  #dollWrap.snap { animation:dollSnap .4s ease-in-out; }
  @keyframes dollSnap { 0%,100%{transform:scale(1) rotate(0);} 40%{transform:scale(1.05) rotate(-1.5deg);} 70%{transform:scale(1.02) rotate(1deg);} }
  /* the closet drawer at the bottom */
  #closet { width:100%; background:linear-gradient(#ffffffee,#f1e6ff); border-top:3px solid #fff;
    border-radius:26px 26px 0 0; box-shadow:0 -4px 16px rgba(0,0,0,.13); padding:1.4vmin 1vmin 1.8vmin; z-index:20; }
  #closetTabs { display:flex; justify-content:center; gap:1.2vmin; margin-bottom:1.2vmin; flex-wrap:wrap; }
  .ctab { border:none; border-radius:50%; width:clamp(40px,8.5vmin,58px); height:clamp(40px,8.5vmin,58px);
    font-size:clamp(19px,4.6vmin,30px); background:#ececf2; box-shadow:0 3px 0 rgba(0,0,0,.15);
    transition:transform .09s ease-out; }
  .ctab:active { transform:scale(.9); }
  .ctab.sel { background:#ffd23e; box-shadow:0 3px 0 #d9a400; }
  #closetTray { display:flex; gap:1.6vmin; overflow-x:auto; padding:1vmin .6vmin .4vmin;
    -webkit-overflow-scrolling:touch; scroll-snap-type:x proximity; }
  .cslot { flex:0 0 auto; border:3px solid #fff; border-radius:18px; scroll-snap-align:center; overflow:hidden;
    width:clamp(56px,13vmin,88px); height:clamp(56px,13vmin,88px); font-size:clamp(28px,7vmin,50px);
    background:radial-gradient(circle at 40% 32%, #fff, #e7ecf5); box-shadow:0 4px 0 rgba(0,0,0,.16);
    display:flex; align-items:center; justify-content:center; transition:transform .09s ease-out; padding:0; }
  .cslot svg { width:100%; height:100%; display:block; }
  .cslot.none-slot { color:#b6b9c4; font-weight:bold; font-size:clamp(13px,3vmin,18px); }
  .cslot:active { transform:scale(.86); }
  .cslot.sel { border-color:#ffd23e; box-shadow:0 0 0 3px #ffd23e, 0 4px 0 rgba(0,0,0,.16); }

  /* dashboard */
  #dashboard { justify-content:flex-start; padding-top:8vmin; overflow-y:auto; }
  #dashHome { position:absolute; top:2vmin; left:2vmin; z-index:10; }
  #dashboard h2 { font-size:clamp(20px,4.6vmin,34px); color:#fff; text-shadow:0 3px 0 rgba(0,0,0,.25); margin-bottom:2vmin; }
  #dashStats { display:grid; grid-template-columns:repeat(3,1fr); gap:1.6vmin; width:100%; max-width:680px; margin-bottom:2.5vmin; padding:0 2vmin; }
  @media (max-width:560px) { #dashStats { grid-template-columns:repeat(2,1fr); } }
  .stat { background:rgba(255,255,255,.92); border-radius:18px; padding:2vmin 1vmin; text-align:center; box-shadow:0 4px 0 rgba(0,0,0,.15); }
  .stat .sv { font-size:clamp(20px,4.6vmin,32px); font-weight:bold; color:#444; }
  .stat .sl { font-size:clamp(11px,2.4vmin,16px); color:#888; }
  #dashList { width:100%; max-width:680px; padding:0 2vmin 4vmin; }
  .dash-cat { background:rgba(255,255,255,.92); border-radius:18px; padding:1.6vmin 2.4vmin; margin-bottom:1.6vmin; box-shadow:0 4px 0 rgba(0,0,0,.12); }
  .dash-cat h3 { font-size:clamp(15px,3.2vmin,22px); color:#7444c4; margin-bottom:.8vmin; }
  .dash-row { display:flex; justify-content:space-between; align-items:center; padding:.5vmin 0; font-size:clamp(13px,2.8vmin,19px); color:#555; border-top:1px solid #eee; }
  .dash-row .dp { font-size:clamp(13px,2.8vmin,19px); margin:0; background:none; }

  /* buddy chooser */
  #charscreen { background:linear-gradient(#b8a0ee,#c9efb0 75%,#8fd06a); z-index:78; }
  .char-card { background:#fff; border-radius:30px; padding:3.5vmin 4vmin; display:flex; flex-direction:column;
               align-items:center; gap:2.4vmin; box-shadow:0 8px 0 rgba(0,0,0,.2); max-width:94%;
               max-height:92vh; overflow-y:auto; }
  .char-card h2 { font-size:clamp(20px,4.6vmin,34px); color:#444; text-align:center; }
  .char-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:2vmin; }
  @media (max-width:420px) { .char-grid { grid-template-columns:repeat(2,1fr); } }
  .char-btn { border:none; background:#f4f0fc; border-radius:20px; padding:1.6vmin 1vmin; display:flex;
              flex-direction:column; align-items:center; gap:.4vmin; box-shadow:0 4px 0 rgba(0,0,0,.12); }
  .char-btn:active { transform:scale(.92); }
  .char-btn.sel { background:#ffd23e; outline:4px solid #f0a813; }
  .char-btn .ch-e { font-size:clamp(34px,8vmin,58px); line-height:1; }
  .char-btn .ch-n { font-size:clamp(12px,2.6vmin,18px); font-weight:bold; color:#555; }
  #charDone { border:none; border-radius:20px; padding:1.8vmin 5vmin; font-family:inherit;
              font-size:clamp(18px,4vmin,28px); font-weight:bold; background:#ffd23e; color:#5b3c00; box-shadow:0 5px 0 rgba(0,0,0,.22); }
  #charDone:active { transform:scale(.95); }
  #setBuddy { background:#e7dcff; color:#5a3aa0; }

  .corner-btn { position:absolute; z-index:6; border:none; border-radius:50%;
    width:clamp(44px,9vmin,66px); height:clamp(44px,9vmin,66px); font-size:clamp(20px,4.4vmin,32px);
    background:#fff; box-shadow:0 4px 0 rgba(0,0,0,.2); }
  .corner-btn:active { transform:scale(.92); }
  /* The ⚙️ must be held, not tapped (see the parent gate in hub.js). The ring fills
     over the hold so a grown-up can see the gesture working. */
  #settingsBtn.holding { transform:scale(.92); box-shadow:0 0 0 3px rgba(255,255,255,.9); }
  #settingsBtn.holding::after { content:""; position:absolute; inset:-5px; border-radius:50%;
    border:3px solid rgba(255,255,255,.95); border-top-color:transparent;
    animation:settingsHold .8s linear forwards; }
  @keyframes settingsHold { from { transform:rotate(0deg); opacity:.35; }
                            to   { transform:rotate(360deg); opacity:1; } }
  #bookBtn { top:1.4vmin; right:1.4vmin; }
  #settingsBtn { bottom:1.4vmin; left:1.4vmin; opacity:.85; }

  /* ================= MASCOT ================= */
  .mascot { pointer-events:none; animation:mbob 3s ease-in-out infinite; }
  .mascot svg { width:100%; height:auto; filter:drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
  @keyframes mbob  { 50% { transform:translateY(-1vmin); } }
  .mascot.talking   { animation:mtalk .38s ease-in-out infinite; }
  @keyframes mtalk { 50% { transform:translateY(-.7vmin) rotate(2deg); } }
  .mascot.celebrate { animation:mjump .55s ease-in-out infinite; }
  @keyframes mjump { 50% { transform:translateY(-3vmin) rotate(-3deg); } }
  .mascot .eyes { transform-box:fill-box; transform-origin:center; animation:blink 4.2s infinite; }
  @keyframes blink { 0%,93%,100% { transform:scaleY(1);} 95.5% { transform:scaleY(.1);} }
  .mascot .armR { transform-box:fill-box; transform-origin:0% 100%; animation:wave 3.4s ease-in-out infinite; }
  @keyframes wave { 0%,68%,100% { transform:rotate(0);} 78% { transform:rotate(-24deg);} 88% { transform:rotate(6deg);} }
  #hubMascot   { position:absolute; left:1%; bottom:3%; width:clamp(74px,15vmin,140px); font-size:clamp(64px,13vmin,124px); z-index:4; }
  #buddySpeech { position:absolute; left:clamp(76px,18vmin,152px); bottom:clamp(18px,4.5%,56px);
                 max-width:min(58vmin,320px); background:#fff; border-radius:16px 16px 16px 4px;
                 padding:1.8vmin 2.6vmin; font-size:clamp(13px,3.2vmin,21px); font-weight:600;
                 color:#333; box-shadow:0 4px 14px rgba(0,0,0,.18); line-height:1.4;
                 pointer-events:none; z-index:10; transition:opacity .38s, transform .38s; }
  #buddySpeech.narrator-out { opacity:0; transform:translateY(5px); }
  #buddySpeech.hidden { display:none; }
  #gameMascot  { position:fixed; left:1vmin; bottom:1vmin; width:clamp(58px,11.5vmin,100px); font-size:clamp(50px,10vmin,90px); z-index:30; }
  #celebMascot { width:clamp(95px,21vmin,180px); font-size:clamp(84px,19vmin,164px); }
  .mascot .buddy { display:block; line-height:1; text-align:center; filter:drop-shadow(0 4px 4px rgba(0,0,0,.25));
                   transform-origin:center bottom; animation:buddyIdle 5.5s ease-in-out infinite; }
  /* occasional happy wiggle/ear-flick when the buddy is just hanging out */
  @keyframes buddyIdle { 0%,80%,100%{transform:rotate(0) scale(1);}
                         86%{transform:rotate(-8deg) scale(1.06);}
                         92%{transform:rotate(6deg) scale(1.05);}
                         97%{transform:rotate(-2deg) scale(1.02);} }
  .mascot.talking .buddy   { animation:buddyTalk .4s ease-in-out infinite; }
  @keyframes buddyTalk { 50%{transform:scale(1.08) rotate(-3deg);} }

  /* ================= GAME ================= */
  #game header {
    display:flex; align-items:center; gap:1.6vmin; width:100%; max-width:980px;
    padding:1vmin 1.6vmin; z-index:20;
  }
  .round-btn {
    border:none; border-radius:50%; width:clamp(48px, 9vmin, 72px); height:clamp(48px, 9vmin, 72px);
    font-size:clamp(22px, 4.5vmin, 34px); background:#fff; box-shadow:0 4px 0 rgba(0,0,0,.2); flex-shrink:0;
  }
  .round-btn:active { transform:scale(.92); }
  #instruction {
    flex:1; background:rgba(255,255,255,.93); border-radius:20px; padding:1.4vmin 2.2vmin;
    font-size:clamp(16px, 3.6vmin, 28px); font-weight:bold; color:#333; text-align:center;
    min-height:2em; display:flex; align-items:center; justify-content:center;
  }
  #playArea { position:relative; flex:1; width:100%; max-width:980px; overflow:hidden; border-radius:14px; }
  #progress { display:flex; gap:1.5vmin; padding:1.6vmin; z-index:20; flex-wrap:wrap; justify-content:center; }
  #progress .dot {
    width:clamp(14px,3.2vmin,24px); height:clamp(14px,3.2vmin,24px); border-radius:50%;
    background:rgba(255,255,255,.45); border:2px solid #fff;
  }
  #progress .dot.done { background:#ffd23e; }

  /* ----- shared bits ----- */
  .popped { animation:pop .45s ease forwards !important; pointer-events:none !important; }
  @keyframes pop { 40%{transform:scale(1.6); opacity:1;} 100%{transform:scale(0); opacity:0;} }
  .shake { animation:shake .5s; }
  @keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-10px) rotate(-4deg);} 75%{transform:translateX(10px) rotate(4deg);} }
  @keyframes floaty { 0%,100%{transform:translateY(0) rotate(-5deg);} 50%{transform:translateY(-2.2vmin) rotate(5deg);} }
  .mini-star { position:fixed; font-size:clamp(30px,7vmin,56px); z-index:90;
               animation:pop .9s ease forwards; pointer-events:none; }
  .confetto { position:fixed; top:-8vh; z-index:95; font-size:clamp(20px,5vmin,40px);
              animation:fall linear forwards; pointer-events:none; }
  @keyframes fall { to { transform:translateY(115vh) rotate(540deg); } }
  #fxC { position:fixed; inset:0; width:100vw; height:100vh; z-index:85; pointer-events:none; }
  #trailC { position:fixed; inset:0; width:100vw; height:100vh; z-index:84; pointer-events:none; }
  .floater { position:fixed; z-index:88; font-size:clamp(26px,6vmin,48px); pointer-events:none;
             animation:floatUp 1.4s ease-out forwards; }
  @keyframes floatUp { to { transform:translateY(-26vh) rotate(18deg); opacity:0; } }

  /* ----- snow ----- */
  .snowflake {
    position:absolute; border:none; background:none; z-index:5;
    font-size:clamp(44px, 10vmin, 84px); line-height:1;
    filter:drop-shadow(0 2px 3px rgba(0,0,0,.3));
    animation:floaty 3s ease-in-out infinite;
  }
  .snowdust { position:absolute; top:-6vh; color:#fff; z-index:1; pointer-events:none;
              animation:snowfall linear infinite; }
  @keyframes snowfall { to { transform:translateY(110vh); } }
  /* drawn winter scene + counting tray (Counting Critters) */
  .snow-scene { position:absolute; inset:0; width:100%; height:100%; z-index:0; pointer-events:none; }
  .snowfield { position:absolute; inset:0; z-index:2; }
  .snowflake.critter.tapped { animation:critterPop .5s ease forwards !important; pointer-events:none; }
  @keyframes critterPop { 0%{transform:scale(1) rotate(0);} 35%{transform:scale(1.3) translateY(-14px) rotate(18deg);}
                          100%{transform:scale(0) rotate(45deg); opacity:0;} }
  .count-tray { position:absolute; left:0; right:0; bottom:0; z-index:6; display:flex; align-items:center;
    justify-content:center; gap:2.4vmin; padding:1vmin 2vmin; background:rgba(255,255,255,.32);
    border-top:3px solid rgba(255,255,255,.6); }
  .count-num { font-size:clamp(34px,9vmin,72px); font-weight:bold; color:#1d3f8f; min-width:1.3em; text-align:center;
    text-shadow:0 2px 0 rgba(255,255,255,.6); }
  .count-num.bump { animation:numBump .4s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes numBump { 0%{transform:scale(1);} 45%{transform:scale(1.45);} 100%{transform:scale(1);} }
  .count-slots { display:flex; gap:1.2vmin; flex-wrap:wrap; justify-content:center; }
  .count-slot { width:clamp(28px,6.4vmin,50px); height:clamp(28px,6.4vmin,50px); border-radius:50%;
    border:2.5px dashed rgba(29,63,143,.4); display:flex; align-items:center; justify-content:center; font-size:clamp(17px,4vmin,30px); }
  .count-slot.filled { border-style:solid; border-color:#1d3f8f; background:rgba(255,255,255,.72);
    animation:slotPop .45s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes slotPop { 0%{transform:scale(0);} 60%{transform:scale(1.3);} 100%{transform:scale(1);} }

  /* ----- ocean ----- */
  .fish-btn { position:absolute; border:none; background:none; z-index:5;
              animation:floaty 3.4s ease-in-out infinite; }
  .fish-btn svg { width:clamp(86px, 18vmin, 150px); height:auto;
                  filter:drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
  .wave { position:absolute; bottom:-8%; width:200%; height:26%; border-radius:45%;
          background:rgba(255,255,255,.16); z-index:1; pointer-events:none;
          animation:waveShift ease-in-out infinite alternate; }
  @keyframes waveShift { from { transform:translateX(-22%);} to { transform:translateX(0);} }
  .bubble { position:absolute; bottom:-6vh; border-radius:50%; z-index:1; pointer-events:none;
            background:rgba(255,255,255,.35); animation:rise linear infinite; }
  @keyframes rise { to { transform:translateY(-115vh); } }

  /* ----- pizza / kitchen ----- */
  .pizza-wrap { position:absolute; inset:0; display:flex; flex-direction:column;
                align-items:center; justify-content:space-evenly; z-index:5; }
  .pizza-wrap svg.pizza { width:clamp(140px, 32vmin, 270px); height:auto;
                          filter:drop-shadow(0 5px 6px rgba(0,0,0,.25)); }
  #pizzaHolder { position:relative; }
  .laid-topping { position:absolute; transform:translate(-50%,-50%); z-index:6; pointer-events:none;
                  font-size:clamp(26px,6vmin,46px); animation:land .4s ease; }
  .choice-row { display:flex; gap:3vmin; flex-wrap:wrap; justify-content:center; }
  .choice {
    border:none; background:rgba(255,255,255,.95); border-radius:24px;
    padding:1.8vmin; box-shadow:0 6px 0 rgba(0,0,0,.2); touch-action:none;
    display:flex; align-items:center; justify-content:center;
  }
  .choice svg { display:block; width:clamp(58px, 13vmin, 110px); height:auto; pointer-events:none; }
  .choice.tok { font-size:clamp(34px,8vmin,64px); width:clamp(64px,14vmin,108px); height:clamp(64px,14vmin,108px); }
  .landed { animation:land .5s ease; }
  @keyframes land { 0%{transform:scale(2.2); opacity:0;} 100%{transform:scale(1); opacity:1;} }

  /* ----- bike ----- */
  /* vmin, not %: a scene.strip tile is 6:1, so the band's height is what sets tree size */
  .treeline { position:absolute; bottom:12%; width:100%; overflow:hidden; white-space:nowrap;
              height:clamp(62px,20vmin,158px); z-index:2; pointer-events:none; }
  .treeline .marquee { height:100%; }
  .treeline.far { bottom:21%; height:clamp(44px,14vmin,110px); opacity:.75; }
  .marquee { display:inline-block; animation:scrollLeft linear infinite; }
  @keyframes scrollLeft { to { transform:translateX(-50%); } }
  .road { position:absolute; bottom:0; width:100%; height:14%; background:#5f6b78; z-index:1; }
  .road::after { content:""; position:absolute; top:45%; width:100%; height:8%;
    background:repeating-linear-gradient(90deg, #fff 0 42px, transparent 42px 100px);
    animation:roadmove .55s linear infinite; }
  @keyframes roadmove { to { background-position-x:-100px; } }
  /* the rider is drawn SVG and already faces the way she travels, so no scaleX(-1) here */
  .rider { position:absolute; left:5%; bottom:8%; z-index:6; pointer-events:none;
           width:clamp(74px,19vmin,148px); filter:drop-shadow(0 3px 3px rgba(0,0,0,.3));
           animation:ride .7s ease-in-out infinite; }
  .rider svg { display:block; width:100%; height:auto; }
  @keyframes ride { 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-1vmin);} }
  .balloon { position:absolute; border:none; background:none; z-index:8; }
  .b-body {
    position:relative; width:clamp(60px,13vmin,104px); height:clamp(72px,15.5vmin,124px);
    border-radius:50% 50% 50% 50% / 56% 56% 44% 44%;
    display:flex; align-items:center; justify-content:center;
    color:#fff; font-weight:bold; font-size:clamp(28px,6.6vmin,52px); text-shadow:0 2px 0 rgba(0,0,0,.35);
    box-shadow:inset -7px -9px 0 rgba(0,0,0,.14), inset 8px 6px 10px rgba(255,255,255,.25), 0 3px 4px rgba(0,0,0,.25);
    animation:floaty 2.6s ease-in-out infinite;
  }
  .b-num { position:relative; z-index:2; }
  .b-shine { position:absolute; top:12%; left:17%; width:34%; height:30%; border-radius:50%; z-index:1;
    background:radial-gradient(closest-side, rgba(255,255,255,.9), rgba(255,255,255,0)); }
  .b-knot { width:0; height:0; border-left:6px solid transparent; border-right:6px solid transparent;
    border-top:9px solid #888; margin:-3px auto 0; filter:brightness(.8); }
  .b-string { width:2px; height:clamp(26px,5.5vmin,44px); background:rgba(255,255,255,.85); margin:0 auto; }

  /* ----- pasta ----- */
  .pasta-wrap { position:absolute; inset:0; display:flex; flex-direction:column;
                align-items:center; justify-content:center; gap:2.5vmin; padding:2vmin 2vmin 8vmin; z-index:5; }
  .pasta-wrap svg.plate { width:clamp(180px, 42vmin, 360px); height:auto;
                          filter:drop-shadow(0 5px 6px rgba(0,0,0,.3)); }
  .food-row { display:flex; gap:2.6vmin; flex-wrap:wrap; justify-content:center;
              background:rgba(255,255,255,.35); border-radius:22px; padding:1.6vmin 2.4vmin; }
  .fooditem {
    width:clamp(54px,11.5vmin,88px); height:clamp(54px,11.5vmin,88px); border-radius:50%;
    border:none; touch-action:none; display:flex; align-items:center; justify-content:center;
    font-size:clamp(34px,8vmin,60px); background:none; box-shadow:none;
  }
  .fooditem.ball { box-shadow:0 4px 0 rgba(0,0,0,.25); }
  .fooditem.on-plate { pointer-events:none; animation:land .4s ease; }
  .yum-badge, .count-badge { position:absolute; top:7%; right:9%; z-index:8; min-width:1.5em; text-align:center;
    font-size:clamp(28px,7.5vmin,56px); font-weight:bold; color:#fff; border:3px solid #fff;
    border-radius:50%; padding:.05em .22em; box-shadow:0 4px 0 rgba(0,0,0,.22); text-shadow:0 2px 0 rgba(0,0,0,.25); }
  .yum-badge { background:#e25b4a; }
  .count-badge { background:#a05bc0; }
  .yum-badge.bump, .count-badge.bump { animation:numBump .4s cubic-bezier(0.34,1.56,0.64,1); }

  /* ----- trace ----- */
  #guideC, #inkC { position:absolute; inset:0; width:100%; height:100%; }
  #inkC { z-index:6; touch-action:none; }
  #guideC { z-index:5; }
  /* pulsing "start here" marker for tracing */
  .trace-start { position:absolute; transform:translate(-50%,-50%); z-index:7; pointer-events:none;
    width:clamp(24px,5.6vmin,42px); height:clamp(24px,5.6vmin,42px); border-radius:50%;
    background:#48d168; border:3px solid #fff; box-shadow:0 0 0 0 rgba(72,209,104,.55);
    animation:traceStartPulse 1.1s ease-out infinite; }
  @keyframes traceStartPulse { 0%{box-shadow:0 0 0 0 rgba(72,209,104,.55);} 100%{box-shadow:0 0 0 18px rgba(72,209,104,0);} }
  /* "new shapes" shuffle button, floating in the top-right of the trace canvas */
  .trace-shuffle { position:absolute; top:1.4vmin; right:1.4vmin; z-index:8; }

  /* ----- memory ----- */
  .mem-grid { position:absolute; inset:0; display:flex; flex-wrap:wrap; gap:1.8vmin;
              align-content:center; justify-content:center; padding:2vmin; z-index:5; }
  .mem-card { border:none; background:none; perspective:700px; }
  .mem-inner { position:relative; width:100%; height:100%;
               transition:transform .45s; transform-style:preserve-3d; }
  .mem-card.flipped .mem-inner, .mem-card.matched .mem-inner { transform:rotateY(180deg); }
  .mem-face { position:absolute; inset:0; backface-visibility:hidden; -webkit-backface-visibility:hidden;
              border-radius:14px; display:flex; align-items:center; justify-content:center;
              font-size:clamp(28px,6.6vmin,56px); box-shadow:0 5px 0 rgba(0,0,0,.2); }
  .mem-face.front { background:linear-gradient(#b07fe8,#7444c4); color:#fff; border:3px solid #fff; }
  .mem-face.back  { background:#fff; transform:rotateY(180deg); border:3px solid #ffd23e; }
  .mem-card.matched { animation:matchGlow .7s ease; }
  .mem-card.matched .mem-face.back { box-shadow:0 0 18px 4px #ffd23e; }
  .mem-card.hint-glow .mem-face.front { animation:hintPulse 1s ease-in-out infinite; }
  @keyframes hintPulse { 0%,100%{box-shadow:0 0 0 0 rgba(255,210,62,0);} 50%{box-shadow:0 0 0 8px rgba(255,210,62,.6);} }
  @keyframes matchGlow { 40% { transform:scale(1.18); } }

  /* ----- music / animal band ----- */
  .music-stage { position:absolute; inset:0; display:flex; flex-direction:column;
                 align-items:center; justify-content:flex-end; padding-bottom:3vmin; z-index:5; }
  .music-note { position:absolute; font-size:clamp(22px,5vmin,40px); z-index:4; pointer-events:none;
                animation:noteUp 1.6s ease-out forwards; }
  @keyframes noteUp { to { transform:translateY(-30vh) rotate(20deg); opacity:0; } }
  .music-keys { display:flex; gap:1.6vmin; justify-content:center; flex-wrap:wrap; }
  .mkey { width:clamp(54px,12vmin,104px); height:clamp(78px,19vmin,150px); border-radius:16px;
          border:none; border-bottom:8px solid rgba(0,0,0,.25); background:rgba(255,255,255,.95);
          font-size:clamp(30px,7vmin,58px); box-shadow:0 5px 0 rgba(0,0,0,.25);
          transition:transform .08s; }
  .mkey:active, .mkey.lit { transform:translateY(5px); }
  .mkey.lit { background:#ffd23e; }
  .mkey.glow { animation:keyGlow .9s ease-in-out infinite; background:#ffeeaa; }
  @keyframes keyGlow { 50% { box-shadow:0 0 22px 6px #ffd23e, 0 5px 0 rgba(0,0,0,.25); transform:translateY(-4px); } }

  /* ----- who says that ----- */
  .ws-wrap { position:absolute; inset:0; display:flex; flex-direction:column;
             align-items:center; justify-content:center; gap:3vmin; z-index:5; }
  #wsListen { border:none; border-radius:50%; width:clamp(90px,20vmin,160px); height:clamp(90px,20vmin,160px);
              font-size:clamp(40px,9vmin,72px); background:#fff; box-shadow:0 6px 0 rgba(0,0,0,.22);
              animation:listenPulse 1.6s ease-in-out infinite; }
  @keyframes listenPulse { 50% { transform:scale(1.08); box-shadow:0 0 26px 6px rgba(255,255,255,.6),0 6px 0 rgba(0,0,0,.22);} }
  #wsListen:active { transform:scale(.94); }
  .ws-choices { display:flex; gap:3vmin; flex-wrap:wrap; justify-content:center; }
  .ws-animal { border:none; border-radius:24px; background:rgba(255,255,255,.95);
               width:clamp(74px,16vmin,130px); height:clamp(74px,16vmin,130px); font-size:clamp(40px,9vmin,76px);
               box-shadow:0 6px 0 rgba(0,0,0,.2); }
  .ws-animal:active { transform:scale(.93); }

  /* ----- space games (rocket / sort / pattern) ----- */
  .space-bg { position:absolute; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
  .twinkle { position:absolute; color:#fff; border-radius:50%; background:#fff; animation:tw 2.4s infinite; }
  @keyframes tw { 0%,100%{opacity:.25; transform:scale(.7);} 50%{opacity:1; transform:scale(1.2);} }
  .rocket-pad { position:absolute; bottom:4%; left:0; width:100%; display:flex; justify-content:center; z-index:3; }
  .rocket { width:clamp(60px,15vmin,116px); display:flex; flex-direction:column; align-items:center;
            filter:drop-shadow(0 4px 6px rgba(0,0,0,.4)); transition:transform .35s cubic-bezier(.5,-0.4,.5,1.4); }
  .rk-svg { width:100%; height:auto; }
  .rk-flame { width:clamp(14px,3.4vmin,26px); height:clamp(26px,6.4vmin,50px); margin-top:-9%;
    background:radial-gradient(circle at 50% 22%, #fff, #ffd23e 45%, #ff6a1a 85%);
    border-radius:50% 50% 50% 50% / 20% 20% 92% 92%; transform-origin:top center; transform:scaleY(0); opacity:.95; }
  .rk-flame.puff { animation:thrust .4s ease-out; }
  @keyframes thrust { 0%{transform:scaleY(0);} 45%{transform:scaleY(1);} 100%{transform:scaleY(0);} }
  .rocket.launch { animation:launch 1.4s ease-in forwards; }
  .rocket.launch .rk-flame { animation:flameRoar .16s infinite alternate; transform:scaleY(1.7); }
  @keyframes flameRoar { from{transform:scaleY(1.3);} to{transform:scaleY(2.1);} }
  @keyframes launch { 0%{transform:translateY(0) rotate(0);} 12%{transform:translateY(1.5vmin) rotate(-2deg);}
                      20%{transform:translateY(0) rotate(2deg);} 100%{transform:translateY(-130vh) rotate(4deg);} }
  .num-pad { position:absolute; top:6%; left:0; width:100%; display:flex; gap:2vmin; flex-wrap:wrap;
             justify-content:center; z-index:4; padding:0 2vmin; }
  .numkey { width:clamp(54px,12vmin,96px); height:clamp(54px,12vmin,96px); border-radius:20px; border:none;
            font-size:clamp(28px,7vmin,52px); font-weight:bold; color:#23306b; background:rgba(255,255,255,.95);
            box-shadow:0 5px 0 rgba(0,0,0,.3); }
  .numkey:active { transform:translateY(4px); }
  .numkey.glow { animation:keyGlow .9s ease-in-out infinite; background:#ffeeaa; }
  .sort-bins { position:absolute; top:5%; left:0; width:100%; display:flex; justify-content:space-around; z-index:3; }
  .bin { display:flex; flex-direction:column; align-items:center; justify-content:center;
         border:4px dashed rgba(255,255,255,.7); border-radius:24px; background:rgba(255,255,255,.08); }
  .bin.big   { width:clamp(120px,30vmin,240px); height:clamp(110px,26vmin,210px); font-size:clamp(50px,13vmin,110px); }
  .bin.small { width:clamp(86px,20vmin,160px);  height:clamp(86px,20vmin,160px); font-size:clamp(30px,7vmin,58px); }
  .bin.over { border-color:#ffd23e; background:rgba(255,210,62,.22); }
  .binlbl { font-size:clamp(13px,3vmin,22px); font-weight:bold; color:#fff; text-shadow:0 2px 0 rgba(0,0,0,.4); }
  .bin .sortitem { position:static !important; margin:.3vmin; }
  .sort-tray { position:absolute; bottom:5%; left:0; width:100%; display:flex; gap:2.4vmin; flex-wrap:wrap;
               justify-content:center; z-index:4; background:rgba(255,255,255,.12); border-radius:20px;
               padding:1.6vmin; max-width:94%; margin:0 auto; }
  .sortitem { border:none; background:none; touch-action:none; line-height:1;
              filter:drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
  .sortitem.big   { font-size:clamp(52px,13vmin,104px); }
  .sortitem.small { font-size:clamp(26px,6vmin,46px); }
  /* ----- Sort It (classify by color or kind) ----- */
  .sk-stage { position:absolute; inset:0; z-index:5; }
  /* bins + tray are absolutely placed so picking up an item never reflows/jumps the bins */
  .sk-bins { position:absolute; top:4%; left:0; width:100%; display:flex; justify-content:space-around;
             align-items:flex-start; gap:2vmin; padding:0 2vmin; }
  .sk-bin { display:flex; flex-direction:column; align-items:center; gap:.6vmin; flex:1; max-width:34%;
            background:rgba(255,255,255,.24); border-radius:20px; padding:1.4vmin 1vmin; border:3px solid rgba(255,255,255,.55); }
  .sk-bin.hint { animation:skHint .6s ease-in-out 3; }
  @keyframes skHint { 0%,100%{box-shadow:0 0 0 0 rgba(255,210,62,0);} 50%{box-shadow:0 0 0 8px rgba(255,210,62,.75);} }
  .sk-badge { width:clamp(40px,9vmin,68px); height:clamp(40px,9vmin,68px); border-radius:50%; border:3px solid #fff;
              display:flex; align-items:center; justify-content:center; font-size:clamp(24px,6vmin,44px); box-shadow:0 3px 0 rgba(0,0,0,.18); }
  .sk-basket { width:100%; min-height:clamp(46px,12vmin,96px); display:flex; flex-wrap:wrap; align-content:flex-start;
               align-items:center; justify-content:center; gap:.5vmin; }
  .sk-binlbl { font-size:clamp(12px,2.8vmin,20px); font-weight:bold; color:#fff; text-shadow:0 2px 0 rgba(0,0,0,.4); }
  .sk-tray { position:absolute; bottom:4%; left:2vmin; right:2vmin; display:flex; flex-wrap:wrap; gap:2vmin;
             justify-content:center; align-items:center; background:rgba(255,255,255,.2); border-radius:20px;
             padding:1.6vmin; min-height:clamp(60px,14vmin,110px); }
  .sk-item { border:none; background:none; touch-action:none; line-height:1; font-size:clamp(36px,9vmin,64px);
             filter:drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
  .sk-item.on-plate { font-size:clamp(26px,6vmin,46px); pointer-events:none; animation:land .4s ease; }
  .pattern-row { position:absolute; top:14%; left:0; width:100%; display:flex; gap:1.4vmin; flex-wrap:wrap;
                 justify-content:center; align-items:center; z-index:3; padding:0 2vmin; }
  .patcell { width:clamp(40px,9vmin,76px); height:clamp(40px,9vmin,76px); border-radius:16px;
             display:flex; align-items:center; justify-content:center; font-size:clamp(26px,6vmin,50px);
             background:rgba(255,255,255,.14); }
  .patcell.q { background:rgba(255,255,255,.3); border:3px dashed #ffd23e; animation:keyGlow 1s ease-in-out infinite; }
  .pattern-choices { position:absolute; bottom:8%; left:0; width:100%; display:flex; gap:3vmin;
                     justify-content:center; flex-wrap:wrap; z-index:4; }
  .patchoice { width:clamp(64px,15vmin,120px); height:clamp(64px,15vmin,120px); border-radius:24px; border:none;
               font-size:clamp(34px,8vmin,64px); background:rgba(255,255,255,.95); box-shadow:0 6px 0 rgba(0,0,0,.3); }
  .patchoice:active { transform:scale(.93); }

  /* ----- dragon feed ----- */
  .dragon-wrap { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center;
                 justify-content:center; gap:2.5vmin; z-index:5; }
  .dragon { width:clamp(150px,34vmin,300px); font-size:clamp(96px,26vmin,220px); line-height:1;
            display:flex; align-items:center; justify-content:center; filter:drop-shadow(0 5px 6px rgba(0,0,0,.35)); }
  .dragon-svg { width:100%; height:auto; display:block; }
  .dragon.chomp { animation:chomp .32s ease; }
  @keyframes chomp { 40% { transform:scale(1.16) rotate(-3deg); } 70% { transform:scale(.97) rotate(2deg); } }
  .treat-row { display:flex; gap:2.6vmin; flex-wrap:wrap; justify-content:center;
               background:rgba(255,255,255,.28); border-radius:20px; padding:1.6vmin 2.2vmin; }
  .treat { width:clamp(50px,11.5vmin,84px); height:clamp(50px,11.5vmin,84px); border:none; background:none;
           font-size:clamp(34px,8vmin,60px); touch-action:none; filter:drop-shadow(0 2px 2px rgba(0,0,0,.3)); }

  /* ----- body match ----- */
  .body-wrap { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:5; }
  .body-doll { width:clamp(200px, 65vmin, 480px); filter:drop-shadow(0 8px 15px rgba(0,0,0,.2)); transition: transform .5s cubic-bezier(0.16, 1, 0.3, 1); transform-origin: center 15%; }
  .body-doll.zoom-face { transform: scale(2.2) translateY(5%); }
  .body-overlay { position:absolute; width:clamp(200px, 65vmin, 480px); height:auto; transition: transform .5s cubic-bezier(0.16, 1, 0.3, 1); transform-origin: center 15%; }
  .body-overlay.zoom-face { transform: scale(2.2) translateY(5%); }

  /* ----- hide and seek ----- */
  .hideseek-wrap { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6vmin; z-index:5; }
  .hideseek-stage { position:relative; }
  .hide-spot { position:relative; width:clamp(170px, 42vmin, 320px); height:clamp(170px, 42vmin, 320px); }
  .hide-spot svg { position:absolute; inset:0; width:100%; height:100%; filter:drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
  /* Soft, visible drop ghosts at the real in/on/under positions. Generous (~38% of the box). */
  .hs-zone { position:absolute; width:38%; height:38%; transform:translate(-50%,-50%); border-radius:50%;
             border:3px dashed rgba(255,255,255,0.9); background:rgba(255,255,255,0.16);
             box-shadow:inset 0 0 0 4px rgba(0,0,0,0.04); z-index:6; pointer-events:none; }
  .hs-zone.correct-hint { animation:hsPulse 1s ease-in-out infinite; border-color:#ffd64d; background:rgba(255,214,77,0.32); }
  @keyframes hsPulse { 0%,100% { transform:translate(-50%,-50%) scale(1); } 50% { transform:translate(-50%,-50%) scale(1.12); } }
  .hideseek-buddy { z-index:10; font-size:clamp(56px, 14vmin, 88px); line-height:1; cursor:pointer;
                    filter:drop-shadow(0 4px 5px rgba(0,0,0,0.4)); transition:transform 0.2s ease; }
  .hideseek-buddy.on-plate { animation:bounceIn 0.4s; }

  /* hint-highlight: 2nd-mistake cue used by 10+ games — glowing border pulse */
  .hint-highlight { animation:hintHighlight 1s ease-in-out infinite !important; }
  @keyframes hintHighlight { 0%,100%{box-shadow:0 0 0 0 rgba(255,210,62,0);} 50%{box-shadow:0 0 0 10px rgba(255,210,62,.75);} }

  /* ----- three cups (find the ball after a shuffle) ----- */
  .cups-stage { position:relative; width:min(94%, 560px); height:clamp(220px, 46vmin, 360px); margin:0 auto; }
  .cups-shadow { position:absolute; left:5%; right:5%; bottom:9%; height:8%;
    background:radial-gradient(closest-side, rgba(0,0,0,0.22), rgba(0,0,0,0)); }
  /* a cup: outer slot slides horizontally; inner lift hops/lifts vertically (decoupled transforms) */
  .cup-slot { position:absolute; left:0; bottom:12%; border:none; background:none; padding:0; cursor:pointer;
    transition: transform var(--swapMs, .55s) cubic-bezier(.34,1.1,.6,1); will-change:transform; z-index:10; }
  .cups-stage.no-slide .cup-slot { transition:none; }
  .cup-lift { width:100%; height:100%; transition: transform .4s cubic-bezier(.34,1.5,.6,1);
    filter:drop-shadow(0 5px 5px rgba(0,0,0,0.32)); }
  .cup-lift svg { display:block; width:100%; height:100%; }
  .cup-lift.lifted { transform: translateY(-62%); }
  .cup-lift.hop-over  { animation: cupHopOver  var(--swapMs, .55s) ease-in-out; }
  .cup-lift.hop-under { animation: cupHopUnder var(--swapMs, .55s) ease-in-out; }
  @keyframes cupHopOver  { 0%,100% { transform:translateY(0) scale(1); }   50% { transform:translateY(-52%) scale(1.05); } }
  @keyframes cupHopUnder { 0%,100% { transform:translateY(0) scale(1); }   50% { transform:translateY(12%)  scale(.96); } }
  .cup-lift.nudge { animation: cupNudge .5s ease; }
  @keyframes cupNudge { 0%,100% { transform:translateY(0) rotate(0); } 25% { transform:translateY(-9%) rotate(-5deg); } 75% { transform:translateY(-9%) rotate(5deg); } }
  .cups-ball { position:absolute; bottom:14%; z-index:5; opacity:0; transition:opacity .18s ease; }
  .cups-ball svg { display:block; width:100%; height:100%; filter:drop-shadow(0 3px 3px rgba(0,0,0,0.3)); }
  .cups-ball.show { opacity:1; }
  .cups-ball.pop { animation: ballPop .5s ease; }
  @keyframes ballPop { 0% { transform:translateY(0) scale(1); } 40% { transform:translateY(-30%) scale(1.15); } 100% { transform:translateY(0) scale(1); } }

  .flash-wrap { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center;
                justify-content:center; gap:5vmin; z-index:5; }
  .flash-nest { position:relative; width:clamp(200px,46vmin,340px); height:clamp(200px,46vmin,340px); }
  .flash-eggs { position:absolute; inset:0; }
  .flash-egg { position:absolute; font-size:clamp(42px,11vmin,78px); line-height:1;
               transform:translate(-50%,-50%); filter:drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
  .flash-egg.hatched { animation:bounceIn .5s; }
  .flash-cover { position:absolute; inset:0; border-radius:50% 50% 45% 45%;
                 background:radial-gradient(circle at 42% 36%, #c49558, #7a4e20);
                 box-shadow:inset 0 6px 0 rgba(255,255,255,.12), 0 6px 14px rgba(0,0,0,.4);
                 opacity:0; transition:opacity 0.45s ease; pointer-events:none; }
  .flash-cover.visible { opacity:1; pointer-events:auto; }
  .flash-cards { display:flex; gap:4vmin; justify-content:center; }
  .flash-card { border:none; border-radius:22px; background:#fff; box-shadow:0 6px 0 rgba(0,0,0,.26);
                width:clamp(72px,17vmin,122px); height:clamp(72px,17vmin,122px);
                font-size:clamp(38px,10vmin,72px); font-weight:bold; color:#333; }
  .flash-card:active { transform:scale(.91); box-shadow:0 3px 0 rgba(0,0,0,.26); }

  /* ----- pet match (give them the same) ----- */
  .match-wrap { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center;
                justify-content:center; gap:4vmin; z-index:5; }
  .match-sides { display:flex; gap:5vmin; align-items:flex-start; justify-content:center; }
  .match-side { display:flex; flex-direction:column; align-items:center; gap:2vmin; }
  .match-pet-icon { font-size:clamp(60px,15vmin,110px); line-height:1; filter:drop-shadow(0 4px 5px rgba(0,0,0,.3)); }
  .match-bowl { display:flex; flex-wrap:wrap; gap:1.2vmin; justify-content:center; align-items:center;
                min-width:clamp(80px,20vmin,160px); min-height:clamp(50px,13vmin,96px);
                background:rgba(255,255,255,.28); border-radius:16px; padding:1.6vmin 2vmin; }
  .bowl-treat { font-size:clamp(26px,7vmin,50px); line-height:1.1; }
  .match-bowl.match-drop { border:3px dashed rgba(255,255,255,.7); }
  .match-bowl.match-done { border-color:#ffd64d; background:rgba(255,214,77,.32); animation:bowlPop .4s ease; }
  @keyframes bowlPop { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

  /* ----- ice cream (stacking toy) ----- */
  .ice-stage { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center;
               justify-content:flex-end; padding:1.5vmin 2vmin 3vmin; z-index:5; gap:2.4vmin; }
  .ice-stack { position:relative; flex-shrink:0;
               width:clamp(120px,34vmin,260px); height:clamp(150px,44vmin,340px); }
  /* solid, detailed waffle cone anchored at the bottom-center */
  .ice-cone { position:absolute; left:50%; bottom:0; transform:translateX(-50%);
    width:clamp(56px,15vmin,116px); height:clamp(70px,19vmin,150px);
    background:linear-gradient(#e0b06a,#c8893f);
    background-image:repeating-linear-gradient(48deg, rgba(110,64,18,.4) 0 2px, transparent 2px 10px),
                     repeating-linear-gradient(-48deg, rgba(110,64,18,.4) 0 2px, transparent 2px 10px);
    clip-path:polygon(50% 100%, 0 0, 100% 0); }
  .scoop { position:absolute; left:50%; transform:translateX(-50%);
    width:clamp(58px,15.5vmin,120px); height:clamp(46px,12vmin,94px); border-radius:50% 50% 46% 46%;
    box-shadow:inset -6px -9px 0 rgba(0,0,0,.12), inset 6px 7px 9px rgba(255,255,255,.45), 0 2px 4px rgba(0,0,0,.22);
    animation:scoopWobble .62s cubic-bezier(.34,1.3,.6,1) both; }
  /* squash-and-stretch: drop in, squish flat on impact, rebound tall, settle */
  @keyframes scoopWobble {
    0%   { transform:translate(-50%,-46vh) scaleY(1.1); opacity:0; }
    55%  { opacity:1; }
    72%  { transform:translate(-50%,0) scale(1.24,.72); }
    86%  { transform:translate(-50%,-1.2vh) scale(.9,1.14); }
    100% { transform:translate(-50%,0) scale(1,1); } }
  .cherry-top { position:absolute; left:50%; transform:translateX(-50%); z-index:6; line-height:1;
    font-size:clamp(26px,7vmin,52px); animation:scoopWobble .55s cubic-bezier(.34,1.3,.6,1) both; }
  .tub-row { display:flex; gap:2.4vmin; flex-wrap:wrap; justify-content:center; align-items:flex-end; }
  /* bright scoop "tubs" with a gradient scoop bulging out of a cup */
  .tub { position:relative; border:none; background:none; flex-shrink:0;
    width:clamp(54px,12.5vmin,92px); height:clamp(62px,14.5vmin,108px);
    transition:transform .09s ease-out; }
  .tub:active { transform:scale(.88); }
  .tub-cup { position:absolute; bottom:0; left:50%; transform:translateX(-50%); width:88%; height:54%;
    border-radius:8px 8px 16px 16px; background:linear-gradient(#ffffff,#dde4ee);
    box-shadow:inset 0 -4px 0 rgba(0,0,0,.1), 0 4px 0 rgba(0,0,0,.18); }
  .tub-scoop { position:absolute; top:0; left:50%; transform:translateX(-50%); width:92%; height:66%;
    border-radius:50% 50% 44% 44%; border:3px solid #fff;
    background:radial-gradient(circle at 38% 30%, rgba(255,255,255,.7), transparent 46%), var(--c);
    box-shadow:inset -4px -6px 0 rgba(0,0,0,.12); }
  .ice-cherry { border:none; border-radius:22px; padding:1.2vmin 3.4vmin; font-weight:bold; color:#7a1f2b;
    font-size:clamp(26px,7vmin,48px); background:#fff; box-shadow:0 5px 0 rgba(0,0,0,.2); }
  .ice-cherry:active { transform:scale(.93); }
  .ice-cherry.pulse { animation:cherryPulse 1s ease-in-out infinite; }
  @keyframes cherryPulse { 50% { transform:scale(1.12); } }

  /* ----- pets ----- */
  .pet-choices { position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
                 gap:4vmin; flex-wrap:wrap; padding:2vmin; z-index:5; }
  .pet-choice { border:none; background:rgba(255,255,255,.92); border-radius:28px;
                width:clamp(80px,18vmin,150px); height:clamp(80px,18vmin,150px);
                font-size:clamp(44px,11vmin,90px); box-shadow:0 6px 0 rgba(0,0,0,.2); }
  .pet-choice:active { transform:scale(.93); }
  .petcare-wrap { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center;
                  justify-content:center; gap:3vmin; z-index:5; }
  .care-mood { font-size:clamp(36px,9vmin,68px); line-height:1; }
  .care-mood.bump { animation:chomp .35s ease; }
  .care-pet { font-size:clamp(90px,24vmin,200px); line-height:1; filter:drop-shadow(0 5px 6px rgba(0,0,0,.3)); }
  .care-pet.happy { animation:chomp .4s ease; }
  .care-status { font-size:clamp(28px,7vmin,52px); letter-spacing:1.4vmin; min-height:1.2em; }
  .care-tools { display:flex; gap:3vmin; }
  .care-tool { border:none; background:#fff; border-radius:24px; width:clamp(64px,15vmin,110px);
               height:clamp(64px,15vmin,110px); font-size:clamp(34px,8vmin,64px); box-shadow:0 6px 0 rgba(0,0,0,.2); transition:opacity .3s; }
  .care-tool:active { transform:translateY(4px); }
  .care-tool.care-used { opacity:.35; box-shadow:none; cursor:default; }

  /* ================= STICKER BOOK ================= */
  #stickerbook { overflow:hidden; padding:1vmin; gap:1vmin; }
  #bookTitle { margin:0; flex-shrink:0; font-size:clamp(18px,4vmin,26px); color:#fff; text-align:center; text-shadow:0 2px 0 rgba(0,0,0,.2); }
  #bookTop { display:flex; align-items:center; gap:1.4vmin; width:100%; max-width:980px; padding:.5vmin; z-index:3; }
  #sceneBtns { flex:1; display:flex; gap:1vmin; overflow-x:auto; justify-content:center; flex-wrap:wrap; }
  .scene-btn { border:none; border-radius:50px; padding:1vmin 2.4vmin; font-family:inherit; font-weight:bold;
               font-size:clamp(13px,2.8vmin,19px); background:rgba(255,255,255,.85); color:#555; box-shadow:0 3px 0 rgba(0,0,0,.15); white-space:nowrap; }
  .scene-btn.sel { background:#ffd23e; color:#5b3c00; }
  #stickerScene { position:relative; flex:1; width:100%; max-width:980px; z-index:2;
                  border-radius:18px; overflow:hidden; box-shadow:inset 0 0 0 3px rgba(255,255,255,.4); }
  #stickerScene.sc-park   { background:linear-gradient(#bfe9ff,#d8f7c8 70%,#9bd870); }
  #stickerScene.sc-space  { background:linear-gradient(#0a0a2e,#241a55 60%,#3a2a66); }
  #stickerScene.sc-ocean  { background:linear-gradient(#9fe4f5,#3aa9cc 55%,#0e6e96); }
  #stickerScene.sc-castle { background:linear-gradient(#ffd6f0,#e0b3ff 55%,#b692e8); }
  #stickerScene.sc-bed    { background:linear-gradient(#3a2a6e,#6a5aa8 60%,#caa0e0); }
  .scene-deco { position:absolute; bottom:1vmin; width:100%; text-align:center;
                font-size:clamp(26px,7vmin,52px); pointer-events:none; opacity:.95; letter-spacing:1vmin; }
  #stickerHint { color:#fff; font-size:clamp(13px,2.8vmin,20px); z-index:2; padding:.4vmin;
                 text-shadow:0 2px 0 rgba(0,0,0,.3); text-align:center; }
  #stickerPalette { display:flex; gap:1.4vmin; width:100%; max-width:980px; overflow-x:auto; padding:1.2vmin;
                    background:rgba(255,255,255,.25); border-radius:18px; z-index:3; align-items:center; min-height:11vmin; }
  .pal-item { border:none; background:rgba(255,255,255,.8); border-radius:14px; flex-shrink:0;
              width:clamp(46px,10vmin,74px); height:clamp(46px,10vmin,74px); font-size:clamp(28px,6.5vmin,48px); box-shadow:0 3px 0 rgba(0,0,0,.15); }
  .pal-item.sel { background:#ffd23e; outline:4px solid #f0a813; transform:scale(1.08); }
  .sticker { position:absolute; transform:translate(-50%,-50%); font-size:clamp(40px,9vmin,80px);
             touch-action:none; cursor:grab; filter:drop-shadow(0 3px 3px rgba(0,0,0,.35)); z-index:5; animation:bounceIn .4s;
             transition:transform .18s cubic-bezier(0.34,1.56,0.64,1), filter .18s ease; }
  /* lifted off the page while dragging — bigger, tilted, fuzzy shadow cast below */
  .sticker.lifted { transform:translate(-50%,-50%) scale(1.28) rotate(4deg); cursor:grabbing;
                    filter:drop-shadow(0 14px 12px rgba(0,0,0,.4)); z-index:30; transition:none; }
  .sticker.settle { animation:stickSettle .42s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes stickSettle { 0%{transform:translate(-50%,-50%) scale(1.28) rotate(4deg);}
                           55%{transform:translate(-50%,-50%) scale(.9) rotate(-2deg);}
                           100%{transform:translate(-50%,-50%) scale(1) rotate(0);} }
  #bookHome, #sceneClear { flex-shrink:0; }

  /* ================= PAINT ================= */
  #paint { padding:0; }
  #paintBar { display:flex; align-items:center; gap:1vmin; width:100%; padding:1vmin 1.4vmin;
              flex-wrap:wrap; justify-content:center; z-index:20; }
  #swatches { display:flex; gap:1vmin; flex-wrap:wrap; justify-content:center; }
  .swatch { width:clamp(34px,7vmin,52px); height:clamp(34px,7vmin,52px); border-radius:50%;
            border:3px solid #fff; box-shadow:0 3px 0 rgba(0,0,0,.2); }
  .swatch.sel { outline:4px solid #ffd23e; outline-offset:2px; transform:scale(1.12); }
  #paintBar .round-btn { width:clamp(42px,8vmin,60px); height:clamp(42px,8vmin,60px); font-size:clamp(18px,4vmin,28px); }
  #paintBar .round-btn.on { background:#ffd23e; }
  #paintCanvasWrap { position:relative; flex:1; width:100%; max-width:980px; margin:0 auto 1vmin;
                     background:rgba(255,255,255,.92); border-radius:16px; overflow:hidden;
                     box-shadow:inset 0 0 0 3px rgba(255,255,255,.5); }
  #paintC { position:absolute; inset:0; width:100%; height:100%; touch-action:none; }
  #paintInstruct {
    position:absolute; top:13.5vmin; width:min(90%, 480px); left:50%; transform:translateX(-50%);
    background:rgba(255,255,255,.94); border-radius:20px; padding:1.2vmin 2.4vmin;
    font-size:clamp(15px,3.2vmin,24px); font-weight:bold; color:#444; text-align:center;
    box-shadow:0 4px 12px rgba(0,0,0,.15); z-index:25; pointer-events:none;
    opacity:0; transition:opacity .4s, transform .4s; transform:translateX(-50%) translateY(-10px);
  }
  #paintInstruct.on { opacity:1; transform:translateX(-50%) translateY(0); }

  /* ================= STORY ================= */
  #story { padding:0; }
  .story-scene { position:absolute; inset:0; display:flex; flex-direction:column;
                 align-items:center; justify-content:center; cursor:pointer; }
  .story-art { font-size:clamp(54px,15vmin,130px); text-align:center; line-height:1.3;
               filter:drop-shadow(0 4px 5px rgba(0,0,0,.3)); margin-bottom:2vmin; pointer-events:none; }
  .story-textbox { background:rgba(255,255,255,.94); border-radius:22px; max-width:88%; margin:0 2vmin;
                   padding:2.4vmin 3vmin; font-size:clamp(17px,3.7vmin,28px); color:#333; line-height:1.45;
                   text-align:center; box-shadow:0 5px 0 rgba(0,0,0,.18); pointer-events:none; }
  .story-tap-hint { color:#fff; font-size:clamp(13px,2.8vmin,20px); margin-top:1.6vmin;
                    text-shadow:0 2px 0 rgba(0,0,0,.3); pointer-events:none; animation:hintPulse 1.8s ease-in-out infinite; }
  @keyframes hintPulse { 50% { opacity:.5; } }
  .story-nav { position:absolute; bottom:2vmin; width:100%; display:flex; align-items:center;
               justify-content:center; gap:3vmin; z-index:10; }
  #storyDots { display:flex; gap:1.2vmin; }
  #storyDots .sdot { width:clamp(10px,2.4vmin,16px); height:clamp(10px,2.4vmin,16px); border-radius:50%;
                     background:rgba(255,255,255,.45); border:2px solid #fff; }
  #storyDots .sdot.on { background:#ffd23e; }
  #storyHome { position:absolute; top:2vmin; left:2vmin; z-index:10; }
  #storyRead { position:absolute; top:2vmin; right:2vmin; z-index:10; }

  /* ================= SETTINGS ================= */
  #settings { background:rgba(20,20,60,.6); z-index:75; }
  .settings-card { background:#fff; border-radius:24px; padding:3vmin 4vmin; max-width:92%;
                   box-shadow:0 8px 0 rgba(0,0,0,.2); display:flex; flex-direction:column; gap:2.4vmin;
                   max-height:94%; overflow-y:auto; -webkit-overflow-scrolling:touch; }
  .settings-card h2 { font-size:clamp(20px,4.5vmin,32px); color:#444; text-align:center; }
  .settings-card .row { display:flex; flex-direction:column; gap:.8vmin; }
  .settings-card .row > span { font-size:clamp(14px,3vmin,20px); color:#666; font-weight:bold; }
  .voice-status { margin:0; align-self:center; color:#655478; font-size:clamp(13px,2.8vmin,17px); line-height:1.5; }
  html[lang="zh-CN"] body { font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif; }
  .seg { display:flex; gap:1vmin; flex-wrap:wrap; }
  .seg button { border:none; border-radius:14px; padding:1.4vmin 2.4vmin; font-size:clamp(14px,3vmin,20px);
                font-weight:bold; background:#eee; color:#555; box-shadow:0 3px 0 rgba(0,0,0,.12); }
  .seg button.sel { background:#7444c4; color:#fff; }
  /* Actions wrap instead of overflowing the card, and Done takes a full-width row of
     its own so the way out of settings is always the big obvious thing at the bottom. */
  .settings-card .closeRow { display:flex; flex-wrap:wrap; gap:1.4vmin; justify-content:center; }
  .settings-card .closeRow + .closeRow { margin-top:-1vmin; }   /* rows read as one block */
  .settings-card .settings-version + .closeRow { margin-top:0; }
  .settings-card .closeRow button { border:none; border-radius:18px; padding:1.5vmin 3vmin;
    font-size:clamp(15px,3.2vmin,22px); font-weight:bold; box-shadow:0 4px 0 rgba(0,0,0,.18);
    flex:0 1 auto; min-height:44px; }
  /* the destructive pair sits apart from the harmless buttons, and reads quieter */
  .settings-card .closeRow.danger { margin-top:.4vmin; }
  .settings-card .closeRow.danger button { font-size:clamp(13px,2.8vmin,18px); padding:1.2vmin 2.4vmin; }
  #setDone { flex:1 0 100%; }
  /* Done is pinned to the bottom of the card, so however tall the panel gets — a long
     language list, a short landscape screen — the way out is never scrolled off. */
  .settings-card .closeRow.done { position:sticky; bottom:0; z-index:2;
    background:#fff; padding-top:1.4vmin; margin-top:0;
    box-shadow:0 -8px 10px -6px rgba(255,255,255,.95); }
  #setDone { background:#ffd23e; color:#5b3c00; }
  #setReset { background:#f0a0a0; color:#7a1f1f; }
  #setRestart { background:#f0c8a0; color:#7a3c00; }
  .settings-version { font-size:clamp(11px,2.2vmin,15px); color:#bbb; text-align:center; margin:1.5vmin 0 0; letter-spacing:.04em; }
  /* A short screen (a phone held sideways) has width to spare and no height. Put each
     label beside its buttons instead of above, and let the card use the width — that
     keeps the whole panel on one screen instead of behind a scrollbar. */
  @media (max-height:560px) and (orientation:landscape) {
    .settings-card { width:min(96%,720px); max-width:none; padding:2vmin 3vmin; gap:1.2vmin; }
    .settings-card h2 { font-size:clamp(17px,4vmin,24px); }
    .settings-card .row { flex-direction:row; align-items:center; gap:2vmin; }
    .settings-card .row > span { flex:0 0 clamp(88px,20%,150px); text-align:right; }
    .settings-card .row > .seg { flex:1 1 auto; }
    .settings-card .closeRow { gap:1.2vmin; }
    .settings-version { margin:.4vmin 0 0; }
  }

  /* Snow's moon: its own layer so it keeps a uniform aspect. The scene SVG behind it
     is preserveAspectRatio=none, which turned a circle into an oval. */
  .snow-moon { position:absolute; top:4%; right:8%; width:clamp(52px,15vmin,104px); z-index:1;
               pointer-events:none; }
  .snow-moon svg { width:100%; height:auto; display:block; }

  /* ================= SCENE KIT =================
     Shared drawn-SVG scenery layers (js/scene.js). Every layer is decorative and
     inert — nothing here can take a tap from the game sitting on top of it. */
  .sc-scene { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:0; }
  .sc-scene * { pointer-events:none; }
  .sc-band { position:absolute; left:-2%; right:-2%; }
  .sc-band svg { width:100%; height:100%; display:block; }
  /* far silhouettes sit on the horizon and are allowed to stretch — a wider hill
     is still a hill, and it keeps the band seamless on any screen */
  .sc-canopy { top:0; height:22%; opacity:.55; }
  .sc-far { bottom:19%; height:17%; opacity:.5; }
  /* mid props keep their aspect: each is its own small SVG placed by percentage,
     the same trick the world map uses for island scenery */
  .sc-mid { position:absolute; left:0; right:0; bottom:15%; height:20%; opacity:.9; }
  .sc-prop { position:absolute; bottom:0; display:block; }
  .sc-prop svg { width:100%; height:auto; display:block;
                 filter:drop-shadow(0 2px 2px rgba(0,0,0,.14)); }
  /* A tileable band for scrolling games (scene.strip). Fixed aspect so repeats line up,
     and inline-block so a marquee can carry a row of them. */
  .sc-strip { display:inline-block; vertical-align:bottom; height:100%; width:auto; }
  .sc-ground { position:absolute; left:0; right:0; bottom:0; height:17%; }
  .sc-groundline { position:absolute; left:0; right:0; top:0; height:2px; opacity:.22; }
  /* the foreground frame — nearest the eye, cropped by the screen edges on purpose */
  .sc-frame { position:absolute; bottom:0; height:30%; width:21%; opacity:.9; }
  .sc-frame svg { width:100%; height:100%; display:block;
                  filter:drop-shadow(0 3px 4px rgba(0,0,0,.18)); }
  .sc-frame-l { left:0; }
  .sc-frame-r { right:0; }
  .sc-drifts { position:absolute; inset:0; }
  .sc-drift { position:absolute; left:-12%; display:block; animation:scSwim linear infinite; }
  .sc-drift svg { width:100%; height:auto; display:block; }
  @keyframes scSwim { from{transform:translateX(0)} to{transform:translateX(125vw)} }
  .sc-motes { position:absolute; inset:0; }
  .sc-mote { position:absolute; display:block; border-radius:50%; }
  .sc-bubble  { animation:scRise linear infinite; }
  .sc-snow    { animation:scFall linear infinite; }
  .sc-pollen  { animation:scDrift ease-in-out infinite alternate; }
  .sc-dust    { animation:scDrift ease-in-out infinite alternate; opacity:.7; }
  .sc-sparkle { animation:scTwinkle ease-in-out infinite; }
  @keyframes scRise    { 0%{transform:translateY(0); opacity:.6} 100%{transform:translateY(-70vh); opacity:0} }
  @keyframes scFall    { 0%{transform:translateY(-10vh); opacity:.9} 100%{transform:translateY(80vh); opacity:.2} }
  @keyframes scDrift   { from{transform:translate(0,0)} to{transform:translate(14px,-18px)} }
  @keyframes scTwinkle { 0%,100%{opacity:.25; transform:scale(.7)} 50%{opacity:1; transform:scale(1.15)} }

  /* ================= CELEBRATE ================= */
  #celebrate {
    position:fixed; inset:0; background:rgba(20,20,60,.55); z-index:80;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2vmin;
  }
  #celebrate .big { font-size:clamp(30px, 8vmin, 64px); color:#fff; font-weight:bold;
                    text-shadow:0 4px 0 rgba(0,0,0,.35); text-align:center; animation:bounceIn .6s; }
  #celebrate .sticker-reveal { font-size:clamp(54px, 13vmin, 110px); animation:bounceIn .8s; }
  #celebrate .sub { font-size:clamp(16px, 3.6vmin, 28px); color:#ffd23e; font-weight:bold;
                    text-shadow:0 2px 0 rgba(0,0,0,.35); text-align:center; }
  @keyframes bounceIn { 0%{transform:scale(0);} 60%{transform:scale(1.25);} 100%{transform:scale(1);} }
  #celebrate .btns { display:flex; gap:3vmin; flex-wrap:wrap; justify-content:center; }
  #celebrate button {
    border:none; border-radius:22px; padding:2.2vmin 4vmin;
    font-size:clamp(17px, 3.8vmin, 28px); font-weight:bold; background:#ffd23e; color:#5b3c00;
    box-shadow:0 5px 0 rgba(0,0,0,.25);
  }
  #celebrate button:active { transform:scale(.94); }

  #musicBtn { position:fixed; bottom:2vmin; right:2vmin; z-index:70; opacity:.55; }
  #musicBtn.on { opacity:1; background:#ffd23e; }

  /* ================= ROCKET QUEST ================= */
  #questBar { position:absolute; left:50%; bottom:1.4vmin; transform:translateX(-50%); z-index:6;
    display:flex; align-items:center; gap:1.1vmin; border:none;
    background:rgba(255,255,255,.24); border-radius:99px; padding:.7vmin 1.8vmin;
    box-shadow:0 4px 0 rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.4); max-width:88vw; }
  #questBar:active { transform:translateX(-50%) scale(.95); }
  .q-rocket { font-size:clamp(22px,5vmin,40px); line-height:1; filter:drop-shadow(0 2px 2px rgba(0,0,0,.3));
    animation:qrock 3s ease-in-out infinite; }
  @keyframes qrock { 50% { transform:translateY(-.5vmin) rotate(-5deg); } }
  .q-slots { display:flex; gap:.6vmin; }
  .q-slot { width:clamp(16px,3.4vmin,26px); height:clamp(16px,3.4vmin,26px); border-radius:50%;
    display:flex; align-items:center; justify-content:center; font-size:clamp(10px,2.3vmin,17px);
    background:rgba(0,0,0,.16); border:2px solid rgba(255,255,255,.6); }
  .q-slot.filled { background:radial-gradient(circle at 50% 38%, #fff6b0, #ffd23e); border-color:#fff;
    box-shadow:0 0 8px #ffd23e; }
  .q-slot.pop { animation:qpop .55s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes qpop { 0%{transform:scale(0) rotate(-40deg);} 60%{transform:scale(1.45);} 100%{transform:scale(1) rotate(0);} }

  #rocketLaunch { position:fixed; inset:0; z-index:110; display:flex; flex-direction:column;
    align-items:center; justify-content:center; gap:3vmin; overflow:hidden;
    background:radial-gradient(circle at 50% 120%, #34215c, #0a0a26 70%); }
  #rocketLaunch::before { content:""; position:absolute; inset:0; pointer-events:none;
    background:radial-gradient(2px 2px at 20% 30%, #fff, transparent),
               radial-gradient(2px 2px at 70% 20%, #fff, transparent),
               radial-gradient(2px 2px at 40% 60%, #fff, transparent),
               radial-gradient(2px 2px at 85% 70%, #fff, transparent),
               radial-gradient(2px 2px at 55% 85%, #fff, transparent),
               radial-gradient(2px 2px at 10% 80%, #fff, transparent);
    opacity:.8; animation:twinkle 2.4s ease-in-out infinite; }
  @keyframes twinkle { 50% { opacity:.35; } }
  .rl-text { color:#fff; font-weight:bold; text-align:center; padding:0 4vmin; z-index:2;
    font-size:clamp(20px,5vmin,40px); text-shadow:0 3px 0 rgba(0,0,0,.4); }
  .rl-rocket { font-size:clamp(80px,22vmin,180px); line-height:1; z-index:2;
    filter:drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
  .rl-rocket.shake { animation:rlShake .12s linear infinite; }
  @keyframes rlShake { 0%,100%{transform:translate(0,0) rotate(0);} 25%{transform:translate(-1.5vmin,0) rotate(-2deg);} 75%{transform:translate(1.5vmin,0) rotate(2deg);} }
  .rl-rocket.blast { animation:rlBlast 2.6s cubic-bezier(.45,0,.9,.35) forwards; }
  @keyframes rlBlast { 0%{transform:translateY(0) scale(1);} 30%{transform:translateY(-6vh) scale(1.05);} 100%{transform:translateY(-130vh) scale(.4);} }
  .rl-count { color:#ffd23e; font-weight:bold; font-size:clamp(40px,12vmin,110px); z-index:2;
    text-shadow:0 3px 0 rgba(0,0,0,.4); min-height:1.1em; }

  @media (prefers-reduced-motion: reduce) {
    /* Disable bouncy/spinning game animations; keep instant opacity changes for feedback */
    .dragon.chomp, .care-pet.happy { animation: none !important; }
    .mem-inner { transition: none !important; }
    .mem-card.matched { animation: none !important; }
    .popped { animation: none !important; opacity: 0 !important; }
    .landed { animation: none !important; }
    .floater { animation: none !important; opacity: 0 !important; }
    .count-badge.bump, .yum-badge.bump, .count-num.bump { animation: none !important; }
    .mkey.glow, .numkey.glow { animation: none !important; background: #ffeeaa !important; }
    .hs-zone.correct-hint { animation: none !important; border-color:#ffd64d !important; background:rgba(255,214,77,0.32) !important; }
    /* cups: drop the decorative hop but keep the slide (it's the trackable motion) and the lift */
    .cup-lift.hop-over, .cup-lift.hop-under, .cup-lift.nudge { animation: none !important; }
    .cup-slot { transition-timing-function: ease !important; }
    .cups-ball.pop { animation: none !important; }
    /* real-time games: stop decorative loops (object motion is slowed in JS via reducedMotion()) */
    .dl-bubble, .mo-canopy .marquee, .mo-far .marquee, .dl-far .marquee, .dl-near .marquee { animation: none !important; }
    .fu-cell, .fu-alien, .eg-egg, .mo-monkey, .mk-animal { animation: none !important; }
    .dl-hoop.dl-collected, .eg-egg.eg-caught, .mk-animal.pop, .mo-banana.got { animation: none !important; opacity: 0 !important; }
    .rw-pad.rw-hint .rw-strip { animation: none !important; }
    /* world map: no idle bob or entrance pop, and a still New! pennant (the gold
       pill still reads as new without pulsing) */
    #mapNodes.worlds .node { animation: none !important; }
    .node-new { animation: none !important; }
    /* world trail: scenery holds still and nodes don't pop in; the buddy still
       moves between games, it just teleports rather than walking (see worldtrail.js) */
    .tr-prop, .tr-node, .map-prop { animation: none !important; }
    .tr-party .party-disc::before { animation: none !important; }
    /* scenery holds still; it was drawn to look complete without motion */
    .sc-mote, .sc-drift { animation: none !important; }
    .sc-drift { left:auto; right:22%; }
    .sc-sparkle { opacity: .7 !important; }
  }
