/* PAT presentation uses the owner-approved articulated bird rig. */
.garden-shell { margin:0; background:#173c30; color:#153f36; font-family:Nunito,"Segoe UI",sans-serif; }
.garden-shell * { box-sizing:border-box; }
.garden-shell [hidden] { display:none !important; }
.garden { position:relative; isolation:isolate; width:100%; height:100svh; min-height:680px; max-height:1100px; overflow:hidden; }
.garden-backdrop,.garden-shade { position:absolute; inset:0; width:100%; height:100%; z-index:-4; object-fit:cover; object-position:center 60%; }
.garden-shade { z-index:-2; background:linear-gradient(180deg,#0c364e36,transparent 25%,transparent 77%,#082e303d); }
.garden-header { position:absolute; inset:22px 26px auto; display:flex; align-items:center; justify-content:space-between; color:#fff6cd; z-index:8; }
.garden-header h1 { font-size:clamp(24px,3vw,36px); line-height:1; margin:0; font-weight:900; letter-spacing:-1px; text-shadow:0 2px 10px #173927; }
.garden-icon { border:1px solid #fff6; width:48px; height:48px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:#194a37c9; color:#fff8da; text-decoration:none; font-size:28px; cursor:pointer; }
.garden-sound { position:relative; }
.garden-sound input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; margin:0; }
.garden-sound:has(input:not(:checked)) { opacity:.55; }
.garden-sound:has(input:focus-visible),.garden button:focus-visible,.garden a:focus-visible { outline:3px solid #fff7ca; outline-offset:5px; }
.garden-sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.garden-action { position:absolute; left:61%; top:49%; width:clamp(240px,27vw,360px); aspect-ratio:1; padding:0; border:0; background:none; z-index:2; cursor:pointer; transform-origin:50% 88%; touch-action:manipulation; }
.garden-action img { position:absolute; inset:0; display:block; width:100%; height:auto; filter:drop-shadow(0 8px 4px #533e3020); transition:opacity 1.1s ease; }
.friend-stir,.friend-awake { opacity:0; }
.garden[data-wake="stirring"] .friend-sleep,.garden[data-wake="awake"] .friend-sleep,.garden[data-wake="awake"] .friend-stir { opacity:0; }
.garden[data-wake="stirring"] .friend-stir,.garden[data-wake="awake"] .friend-awake { opacity:1; }
.garden[data-wake="awake"] .garden-action { animation:friend-stretch 2s ease-in-out both; }
.garden button:disabled { cursor:default; opacity:1; }
.garden-action-ring { position:absolute; left:18%; top:43%; width:34%; aspect-ratio:1; border:2px solid #fff2b4a0; border-radius:50%; box-shadow:0 0 22px #ffd57680; opacity:0; }
.garden[data-phase="MEANING"] .garden-action-ring { animation:bird-invite 2.8s ease-in-out infinite; }
.garden-bird { position:absolute; left:12%; top:43%; width:clamp(180px,21vw,260px); aspect-ratio:1; padding:0; border:0; background:none; cursor:pointer; z-index:4; -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
.garden-contact-shadow { position:absolute; height:3.5%; background:radial-gradient(ellipse,#193b2c60 0%,#193b2c20 45%,transparent 73%); border-radius:50%; pointer-events:none; z-index:0; }
.friend-shadow { left:61%; top:82%; width:27%; }
.bird-shadow { left:15%; top:78%; width:13%; transition:opacity .3s; }
.garden-panel { position:absolute; left:6%; bottom:5%; width:min(420px,45%); min-height:150px; z-index:6; padding:18px 20px; border-radius:40% 40% 25px 25px / 24% 24% 25px 25px; border:1px solid #edcf8db3; background:linear-gradient(155deg,#fff8dceF,#dfd3a1f5); box-shadow:0 12px 32px #0e332e45,inset 0 0 0 3px #fff6d750; text-align:center; }
.garden-listen { position:absolute; left:calc(50% - 26px); top:-28px; width:54px; height:54px; border-radius:50%; border:2px solid #e3cb8f; background:#fff5d8; color:#276f58; cursor:pointer; box-shadow:0 4px 10px #28503c30; }
.garden-listen svg { width:30px; height:30px; fill:currentColor; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.garden-listen.is-playing { box-shadow:0 0 0 7px #ffe8a270,0 0 22px #fff3b9; }
.garden-slots,.garden-choices { display:flex; gap:12px; justify-content:center; align-items:center; direction:ltr; }
.garden-slots { margin:14px 0 16px; }
.garden-slots:empty,.garden-choices:empty { display:none; }
.garden-slot { width:70px; height:65px; border-bottom:3px solid #b59e69; display:grid; place-items:center; font:700 48px/1 "Trebuchet MS",sans-serif; color:#164c4a; }
.garden-slot.is-filled { border-color:#6e9973; }
.garden-slot.is-sounding { color:#974e1f; border-color:#e4a42e; background:#ffe5a390; border-radius:12px; }
.garden-tile { min-width:72px; height:72px; padding:0 16px; border:1px solid #ddbd7a; border-radius:22px; background:linear-gradient(#fffdf1,#ffe8ac); color:#164c4a; box-shadow:0 4px 0 #b69c67,0 6px 14px #88794b25; font:700 48px/1 "Trebuchet MS",sans-serif; cursor:pointer; touch-action:manipulation; }
.garden-tile:active { transform:translateY(3px); box-shadow:0 1px 0 #b69c67; }
.garden-tile.is-help { outline:3px solid #519064; outline-offset:4px; }
.garden-tile.is-chosen { background:#c9e5b2; }
.garden[data-phase="TEACH"] .garden-slot { width:100px; height:100px; font-size:76px; }
.garden[data-phase="TRANSFER"] .garden-panel { box-shadow:0 0 0 100vmax #153c3680,0 12px 32px #0e332e45; }
.garden[data-phase="TRANSFER"] .garden-action,.garden[data-phase="TRANSFER"] .garden-bird { filter:brightness(.65); }
.garden[data-phase="TRANSFER"] .garden-tile { min-width:145px; font-size:48px; }
.garden-primary { width:58px; height:54px; border-radius:50%; border:1px solid #174c39; background:#287558; color:#fffbe9; box-shadow:0 4px 0 #164c39; cursor:pointer; margin:8px auto 0; }
.garden-primary svg { width:30px; height:30px; fill:currentColor; }
.garden-help { position:absolute; left:25px; bottom:22px; width:44px; height:44px; border:1px solid #fff5c590; border-radius:50%; background:#194a37c9; color:#fff5cf; font:700 24px/1 inherit; z-index:7; cursor:pointer; }
.garden-panel:not([hidden])~.garden-help { left:auto; right:25px; }
.garden-audio-warning { position:absolute; top:80px; right:24px; max-width:250px; border-radius:18px; padding:10px 16px; background:#fff6dc; color:#446643; z-index:9; font-size:16px; }
.garden[data-phase="ERROR"] .garden-panel { min-height:160px; }
.garden[data-phase="ERROR"] #gardenPrompt { position:static; width:auto; height:auto; overflow:visible; clip-path:none; white-space:normal; font-size:20px; }
.garden-sunlight { position:absolute; top:-24%; left:25%; width:30%; height:98%; transform:rotate(27deg); opacity:.22; background:linear-gradient(90deg,transparent,#fff7cf70,transparent); filter:blur(25px); pointer-events:none; z-index:-1; transition:opacity 3s,width 3s; }
.garden[data-wake="awake"] .garden-sunlight { opacity:.65; width:55%; }
.garden-plants { position:absolute; inset:0; z-index:1; pointer-events:none; }
.garden-plants img { position:absolute; width:clamp(140px,17vw,240px); bottom:-8%; right:-3%; transform-origin:50% 94%; filter:brightness(.72) saturate(.8); transition:filter 3s; }
.garden-plants img:nth-child(2) { width:13%; left:39%; bottom:-5%; transform:scaleX(-1); }
.garden[data-wake="awake"] .garden-plants img { animation:plant-awaken 3.8s ease-in-out both; filter:brightness(1.13) saturate(1.15) drop-shadow(0 0 13px #ffdf8540); }
.garden[data-wake="awake"] .garden-plants img:nth-child(2) { animation-delay:.4s; }
.garden-magic { position:absolute; inset:0; pointer-events:none; z-index:3; }
.garden-magic i { position:absolute; width:5px; height:5px; border-radius:50%; background:#fff3b5; box-shadow:0 0 13px #ffdf85; animation:garden-spark 3s ease-out both; }
.garden[data-state="encouraging"] .bird-pose { animation:bird-look .8s ease-in-out both; }
.garden[data-state="happy"] .bird-wing-near { animation:wing-invite .8s ease-in-out 2; }
.bird-pose { display:block; position:absolute; inset:0; transform-origin:63% 87%; animation:bird-settled 4.6s ease-in-out infinite; }
.bird-body { position:absolute; left:32%; top:0; width:52%; height:auto; z-index:3; }
.bird-tail { position:absolute; left:-10%; top:49%; width:64%; z-index:0; transform-origin:88% 62%; transform:rotate(9deg); }
.bird-wing { position:absolute; display:block; transform-style:preserve-3d; will-change:transform; }
.bird-wing img { display:block; width:100%; height:auto; }
.bird-wing-near { z-index:5; left:61%; top:42%; width:52%; transform-origin:6% 28%; transform:rotate(68deg) scale(.78,.82); }
.bird-wing-far { z-index:1; left:-4%; top:42%; width:55%; transform-origin:94% 36%; transform:rotate(-67deg) scale(.7,.8); }
.bird-cue { position:absolute; width:35%; height:11%; left:44%; bottom:-2%; border:2px solid #fff3b0b0; border-radius:50%; box-shadow:0 0 18px #ffdb78a0; animation:bird-invite 2.8s ease-in-out infinite; }
.garden:not([data-state="ready"]) .bird-cue { display:none; }
.garden[data-state="flying"] .bird-pose,.garden[data-state="landing"] .bird-pose { animation:none; }
.garden[data-state="flying"] .bird-wing-near { animation:wing-near .24s ease-in-out infinite; }
.garden[data-state="flying"] .bird-wing-far { animation:wing-far .24s ease-in-out infinite; }
.garden[data-state="flying"] .bird-tail { animation:tail-flight .48s ease-in-out infinite; }
.garden[data-state="landing"] .bird-wing-near { animation:wing-land-near .65s ease-out both; }
.garden[data-state="landing"] .bird-wing-far { animation:wing-land-far .65s ease-out both; }
.garden[data-state="looking"] .bird-pose { animation:bird-look 1.2s ease-in-out both; }
.garden[data-state="demonstrating"] .bird-pose { animation:bird-lean 2.8s ease-in-out both; }
.garden[data-state="demonstrating"] .bird-wing-near { animation:wing-pat 2.8s ease-in-out both; }
.garden[data-state="inviting"] .bird-wing-near { animation:wing-invite 1.6s ease-in-out both; }
.study-touch { position:absolute; pointer-events:none; width:50px; height:50px; z-index:3; opacity:0; }
.study-touch span { position:absolute; inset:18%; border-radius:50%; border:1.5px solid #fff2b4; box-shadow:0 0 14px #ffd57680; }
.garden[data-state="demonstrating"] .study-touch { animation:touch-visible 2.8s ease-in-out both; }
.garden[data-state="demonstrating"] .study-touch span { animation:touch-ripple 1.3s ease-out 2; }
.garden[data-state="demonstrating"] .study-touch span:nth-child(2) { animation-delay:.15s; }
.garden[data-state="demonstrating"] .study-touch span:nth-child(3) { animation-delay:.3s; }
.study-motes { position:absolute; inset:0; pointer-events:none; z-index:1; }
.study-motes i { position:absolute; width:3px; height:3px; background:#fff8c6; border-radius:50%; box-shadow:0 0 9px #ffe2a4; opacity:.4; animation:mote-drift 9s ease-in-out infinite; }
.study-motes i:nth-child(1) { left:30%; top:35%; }
.study-motes i:nth-child(2) { left:45%; top:28%; animation-delay:-3s; }
.study-motes i:nth-child(3) { left:72%; top:51%; animation-delay:-6s; }
.study-motes i:nth-child(4) { left:56%; top:65%; animation-delay:-2s; }
.study-motes i:nth-child(5) { left:21%; top:70%; animation-delay:-5s; }
@keyframes wing-near { 0%,100% { transform:rotate(-67deg) scale(1,.72); } 50% { transform:rotate(64deg) scale(.9,.85); } }
@keyframes wing-far { 0%,100% { transform:rotate(64deg) scale(.85,.65); } 50% { transform:rotate(-61deg) scale(.8,.75); } }
@keyframes wing-land-near { 0% { transform:rotate(-67deg) scale(1,.72); } 40% { transform:rotate(48deg) scale(.85,.8); } 70% { transform:rotate(-20deg) scale(.8,.7); } 100% { transform:rotate(68deg) scale(.78,.82); } }
@keyframes wing-land-far { 0% { transform:rotate(64deg) scale(.85,.65); } 40% { transform:rotate(-50deg) scale(.8,.75); } 70% { transform:rotate(20deg) scale(.7,.7); } 100% { transform:rotate(-67deg) scale(.7,.8); } }
@keyframes tail-flight { 50% { transform:rotate(-3deg); } }
@keyframes bird-settled { 50% { transform:rotate(-.6deg) translateY(-1px); } }
@keyframes bird-invite { 0%,100% { opacity:.2; transform:scale(.9); } 50% { opacity:.9; transform:scale(1.06); } }
@keyframes bird-look { 40%,75% { transform:rotate(7deg); } }
@keyframes bird-lean { 25%,77% { transform:rotate(10deg); } }
@keyframes wing-pat { 0%,100% { transform:rotate(68deg) scale(.78,.82); } 25%,60% { transform:rotate(-22deg) scale(.9,.75); } 40%,75% { transform:rotate(-13deg) scale(.9,.75); } }
@keyframes wing-invite { 35%,65% { transform:rotate(-36deg) scale(.78,.65); } }
@keyframes friend-rest { 50% { transform:scaleY(1.008) rotate(.15deg); } }
@keyframes touch-visible { 25%,80% { opacity:.7; } }
@keyframes touch-ripple { from { opacity:.7; transform:scale(.5); } to { opacity:0; transform:scale(1.7); } }
@keyframes mote-drift { 50% { transform:translate(12px,-20px); opacity:.15; } }

@keyframes friend-stretch { 35% { transform:translateY(-4px) rotate(-.6deg); } 70% { transform:translateY(-1px) rotate(.3deg); } }
@keyframes plant-awaken { 20% { rotate:-4deg; } 50% { rotate:3deg; } 80% { rotate:-1deg; } }
@keyframes garden-spark { from { opacity:0; transform:translateY(15px) scale(.3); } 30% { opacity:.8; } to { opacity:0; transform:translateY(-130px) scale(.5); } }
@media(max-width:600px) {
 .garden { min-height:700px; }
 .garden-backdrop { object-position:61% center; }
 .garden-header { inset:16px 16px auto; }
 .garden-header h1 { font-size:26px; }
 .garden-icon { width:44px; height:44px; }
 .garden-action { width:65%; left:33%; top:39%; }
 .garden-bird { width:49%; left:7%; top:22%; }
 .friend-shadow { left:35%; top:67%; width:60%; }
 .garden-panel { left:7%; bottom:4%; width:86%; padding:18px 12px; min-height:150px; }
 .garden-slot { width:62px; height:60px; font-size:44px; }
 .garden-tile { min-width:68px; height:68px; font-size:44px; padding:0 12px; }
 .garden-help { left:16px; bottom:16px; }
 .garden-panel:not([hidden])~.garden-help { right:8px; bottom:225px; }
 .garden-plants img { width:38%; bottom:-5%; right:-6%; }
 .garden-plants img:nth-child(2) { width:25%; left:-6%; bottom:17%; }
 .garden[data-phase="TRANSFER"] .garden-tile { min-width:125px; font-size:43px; }
}
@media(max-height:600px) and (min-width:601px) {
 .garden { min-height:360px; }
 .garden-header { inset:12px 18px auto; }
 .garden-header h1 { font-size:26px; }
 .garden-action { width:28%; top:26%; }
 .garden-bird { width:23%; top:17%; }
 .garden-panel { left:5%; bottom:6%; width:40%; padding:12px; }
 .garden-slots { margin:10px 0; }
 .garden-slot { width:55px; height:50px; font-size:40px; }
 .garden-tile { min-width:58px; height:58px; font-size:40px; }
 .garden[data-phase="TRANSFER"] .garden-tile { min-width:115px; font-size:40px; }
}
@media(prefers-reduced-motion:reduce) { .garden * { animation:none !important; transition:none !important; } }
.garden[data-phase="WORLD"] .garden-panel { background:none; border:0; box-shadow:none; min-height:0; width:80px; left:calc(50% - 40px); bottom:6%; padding:0; }

.garden-action .friend-sleep { transform-origin:50% 88%; animation:friend-rest 5s ease-in-out infinite; }
.garden[data-wake] .friend-sleep { animation:none; }
.garden-bird:disabled { pointer-events:none; }

.garden-shell { padding:0; width:100%; max-width:none; }

@media(max-width:600px) and (max-height:740px) {
 .garden { min-height:560px; }
 .garden-action { top:29%; }
 .garden-bird { top:17%; }
 .friend-shadow { top:59%; }
}
@media(max-width:600px) and (max-height:650px) {
 .garden-action { top:25%; }
 .garden-bird { top:14%; }
}

/* Keep the approved bird invitation, independently of the learning panel. */
#gameScreen[data-phase="INTRO"] #gardenBird:not(:disabled) { overflow: visible; }
#gameScreen[data-phase="INTRO"] #gardenBird:not(:disabled)::before {
    content: "";
    position: absolute;
    inset: 4% 12% 12%;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, #fff8d65c 0%, #ffe18745 40%, transparent 75%);
    animation: wordGardenBirdGlow 5.6s ease-in-out 1s infinite;
}
@keyframes wordGardenBirdGlow {
    0%, 17%, 72%, 100% { opacity: 0; transform: scale(.94); }
    26%, 48% { opacity: 1; transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
    #gameScreen[data-phase="INTRO"] #gardenBird:not(:disabled)::before {
        opacity: .65;
        animation: none !important;
    }
}

/* WORD GARDEN BIRD INTRO FINGER V3 */

/* The old fox-area touch cue must not appear during the intro. */
#gameScreen[data-phase="INTRO"] .study-touch,
#gameScreen[data-phase="INTRO"] .study-touch::before,
#gameScreen[data-phase="INTRO"] .study-touch::after {
    visibility: hidden !important;
    opacity: 0 !important;
    animation: none !important;
}

/* The finger belongs to the bird button, not the scene coordinates. */
#gameScreen[data-phase="INTRO"] #gardenBird:not(:disabled)::after {
    content: "";
    position: absolute;
    top: 28%;
    right: -8%;
    width: clamp(72px, 50%, 104px);
    height: clamp(72px, 50%, 104px);
    background: url("../img/onboarding-tour/tour-tap-hand.webp") center / contain no-repeat;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    filter:
        drop-shadow(0 5px 3px rgba(255, 255, 255, .8))
        drop-shadow(0 7px 12px rgba(27, 72, 99, .55));
    z-index: 20;
    pointer-events: none;
    transform-origin: 50% 30%;
    animation: wordGardenBirdFingerHint 2.5s ease-in-out .3s infinite;
}

@keyframes wordGardenBirdFingerHint {
    0%, 10%, 85%, 100% {
        opacity: 0;
        transform: translate(10px, 12px) scale(.82);
    }

    22%, 48% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    59% {
        opacity: 1;
        transform: translate(-5px, -6px) scale(.93);
    }

    72% {
        opacity: 0;
        transform: translate(0, 0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    #gameScreen[data-phase="INTRO"] #gardenBird:not(:disabled)::after {
        opacity: 1;
        transform: none;
        animation: none !important;
    }
}

/* WORD GARDEN ENCHANTED TOY DOCK V1 */
/* The dock is a small, sculpted object in the world, not a modal or form. */
#gameScreen:not([data-phase="WORLD"]):not([data-phase="ERROR"]) #gardenPanel:not([hidden]) {
    position: absolute;
    left: clamp(18px, 5%, 78px);
    bottom: clamp(16px, 5%, 48px);
    width: clamp(330px, 32vw, 400px);
    min-height: 0;
    padding: 34px 18px 20px;
    overflow: visible;
    isolation: isolate;
    border: 3px solid #f8eaa5;
    border-radius: 35% 28% 29% 25% / 29% 27% 34% 30%;
    background:
        radial-gradient(ellipse at 50% 7%, #fff8d7 0%, transparent 40%),
        radial-gradient(ellipse at 12% 78%, #a8eed4bb 0%, transparent 46%),
        linear-gradient(160deg, #e7ffed 0%, #bce7db 46%, #8fd2c0 100%);
    box-shadow:
        0 8px 0 #398b6d,
        0 15px 0 #154b3c7a,
        0 24px 37px #0c403a7a,
        0 0 0 5px #f4e99a75,
        inset 0 3px 0 #ffffffd9,
        inset 0 -8px 15px #1b766145;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: rotate(-1deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-align: center;
}

/* An engraved winding branch and a tiny glint decorate the rim. */
#gameScreen:not([data-phase="WORLD"]):not([data-phase="ERROR"]) #gardenPanel:not([hidden])::before {
    content: "";
    position: absolute;
    inset: 9px 10px 10px;
    border: 2px solid #fffdf282;
    border-radius: 35% 29% 32% 28% / 31% 29% 35% 32%;
    background:
        radial-gradient(circle at 16% 22%, #fffde8b5 0 3px, transparent 4px),
        radial-gradient(circle at 81% 75%, #fffde8cc 0 4px, transparent 5px),
        radial-gradient(circle at 87% 20%, #ffffffa3 0 2px, transparent 3px);
    pointer-events: none;
    z-index: 0;
}
#gameScreen:not([data-phase="WORLD"]):not([data-phase="ERROR"]) #gardenPanel:not([hidden])::after {
    content: "";
    position: absolute;
    width: 41%;
    height: 14px;
    bottom: -18px;
    left: 29.5%;
    border-radius: 50%;
    background: #0a4c3c52;
    filter: blur(8px);
    z-index: -1;
    pointer-events: none;
}

/* Preserve the reading-only reveal: the backdrop intentionally dims. */
#gameScreen[data-phase="TRANSFER"] #gardenPanel:not([hidden]) {
    box-shadow:
        0 0 0 100vmax #153c3680,
        0 8px 0 #398b6d,
        0 24px 37px #0c403a7a,
        inset 0 3px 0 #ffffffd9;
}

/* Playful flower-shaped sound medallion, without replacing its accessible button. */
#gardenHear {
    position: absolute;
    top: -33px;
    left: 50%;
    width: 66px;
    height: 66px;
    margin: 0;
    border: 4px solid #fff4c7;
    border-radius: 42% 58% 47% 53% / 54% 44% 56% 46%;
    background: radial-gradient(circle at 35% 26%, #fffef4, #ffe7a0 51%, #f8aa63 100%);
    color: #16615e;
    box-shadow: 0 5px 0 #ae703b, 0 10px 19px #165e505c, inset 0 3px 0 #fffef4;
    transform: translateX(-50%) rotate(4deg);
    z-index: 4;
    cursor: pointer;
    transition: filter .15s ease, box-shadow .15s ease;
}
#gardenHear svg {
    position: relative;
    z-index: 2;
    width: 31px;
    height: 31px;
    filter: drop-shadow(0 1px 0 #ffffff);
}
#gardenHear::before {
    content: "";
    position: absolute;
    inset: -9px;
    border: 2px dashed #fff3bce8;
    border-radius: 50%;
    opacity: .82;
    pointer-events: none;
}
#gardenHear.is-playing {
    box-shadow: 0 5px 0 #ae703b, 0 0 0 8px #fff2af8c, 0 0 22px #ffe0a6;
}
@media (hover: hover) and (pointer: fine) {
    #gardenHear:hover:not(:disabled) { filter: brightness(1.06); }
}
#gardenHear:active:not(:disabled) {
    transform: translateX(-50%) rotate(4deg) translateY(3px);
    box-shadow: 0 2px 0 #ae703b, 0 5px 12px #165e505c;
}

/* Little physical letter stones, lively silhouettes and easy touch targets. */
#gardenSlots, #gardenChoices {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 12px;
    direction: ltr;
    max-width: 100%;
    width: 100%;
}
#gardenSlots:empty, #gardenChoices:empty { display: none; }
#gardenSlots { margin: 4px 0 10px; }
#gardenChoices { margin: 3px 0 1px; }

#gardenChoices .garden-tile {
    --stone-face: #cbd1fa;
    --stone-rim: #8884b8;
    position: relative;
    isolation: isolate;
    flex: 0 0 auto;
    width: 82px;
    min-width: 82px;
    height: 88px;
    min-height: 88px;
    padding: 0;
    border: 3px solid #fffbeb;
    border-radius: 31px 26px 28px 23px;
    background:
        radial-gradient(circle at 26% 17%, #ffffffeb, transparent 36%),
        linear-gradient(160deg, #ffffff 0%, var(--stone-face) 79%);
    box-shadow:
        0 7px 0 var(--stone-rim),
        0 12px 16px #0e4a3e4d,
        inset 0 3px 0 #ffffff;
    color: #103b52;
    font: 900 51px/1 ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
    text-shadow: 0 2px 0 #ffffffbb;
    transform: rotate(-4deg);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
#gardenChoices .garden-tile:nth-child(2) {
    --stone-face: #ffd4b5;
    --stone-rim: #cf956d;
    border-radius: 26px 31px 22px 28px;
    transform: rotate(4deg);
}
#gardenChoices .garden-tile:nth-child(3) {
    --stone-face: #c5f5c2;
    --stone-rim: #86b680;
    transform: rotate(-2deg);
}
#gardenChoices .garden-tile::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 12px;
    right: 12px;
    height: 12px;
    border-radius: 100%;
    background: linear-gradient(180deg, #ffffffdb, #ffffff00);
    z-index: -1;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    #gardenChoices .garden-tile:hover:not(:disabled) {
        transform: rotate(0) translateY(-5px) scale(1.04);
        box-shadow: 0 11px 0 var(--stone-rim), 0 17px 23px #0e4a3e62, inset 0 3px 0 #ffffff;
        filter: saturate(1.12);
    }
}
#gardenChoices .garden-tile:active:not(:disabled) {
    transform: rotate(0) translateY(5px) scale(.97);
    box-shadow: 0 2px 0 var(--stone-rim), 0 4px 8px #0e4a3e42;
}
#gardenChoices .garden-tile.is-help {
    outline: 4px solid #238f6b;
    outline-offset: 4px;
}
#gardenChoices .garden-tile.is-chosen {
    --stone-face: #b2f7b9;
    --stone-rim: #63a96c;
    color: #195d3d;
    border-color: #faffeb;
}
#gardenChoices .garden-tile:focus-visible,
#gardenHear:focus-visible,
#gardenContinue:focus-visible {
    outline: 4px solid #175f9a;
    outline-offset: 5px;
}

/* Built letters are inset forest gems, visually distinct from choices. */
#gardenSlots .garden-slot {
    flex: 0 1 auto;
    width: 76px;
    min-width: 0;
    height: 70px;
    min-height: 70px;
    border: 3px dashed #69a68d;
    border-radius: 27px 23px 26px 21px;
    background: linear-gradient(165deg, #e9fff5bd, #9fd6cbbd);
    box-shadow: inset 0 3px 9px #265d505a, 0 2px 0 #ffffffa3;
    color: #174a4a;
    font: 900 46px/1 ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
}
#gardenSlots .garden-slot.is-filled {
    border: 3px solid #fff9c5;
    background: radial-gradient(circle at 35% 17%, #ffffff, #caf6cf 85%);
    box-shadow: 0 4px 0 #67a97c, 0 7px 13px #0e4a3e33;
}
#gardenSlots .garden-slot.is-sounding {
    color: #815016;
    border-color: #ffed99;
    background: linear-gradient(165deg, #fffefa, #ffd68e);
    box-shadow: 0 0 0 5px #ffeaa485, 0 0 15px #ffed93;
}
#gameScreen[data-phase="TEACH"] #gardenSlots .garden-slot {
    width: 102px;
    height: 100px;
    font-size: 75px;
}

/* Whole-word choice buttons need legibility and width at 320 px. */
#gameScreen[data-phase="TRANSFER"] #gardenChoices .garden-tile {
    flex: 1 1 0;
    min-width: 0;
    max-width: 160px;
    height: 86px;
    font-size: clamp(31px, 3vw, 42px);
    padding: 0 3px;
}

#gardenContinue {
    position: relative;
    z-index: 1;
    width: 62px;
    height: 60px;
    margin: 9px auto 0;
    border: 3px solid #e5ffe7;
    border-radius: 24px 26px 23px 28px;
    background: linear-gradient(165deg, #8ff1a3, #168e6b);
    color: #fffef4;
    box-shadow: 0 6px 0 #0b604f, 0 11px 18px #10564065;
    cursor: pointer;
}
#gardenContinue svg { width: 32px; height: 32px; }
#gardenContinue:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #0b604f;
}

/* Feedback states are intentionally dormant until the game logic enables them. */
#gardenChoices .garden-tile.garden-answer-correct {
    --stone-face: #b6f8b9;
    --stone-rim: #55a76d;
    border-color: #fffad0;
    animation: gardenStoneYay .46s cubic-bezier(.18,.8,.28,1.1) both;
}
#gardenChoices .garden-tile.garden-answer-tryagain {
    --stone-face: #ffe9cd;
    --stone-rim: #d5a777;
    animation: gardenStoneTryAgain .38s ease-out both;
}
@keyframes gardenStoneYay {
    0% { transform: translateY(1px) scale(.96); }
    48% { transform: translateY(-9px) scale(1.11) rotate(3deg); }
    100% { transform: translateY(0) scale(1) rotate(0); }
}
@keyframes gardenStoneTryAgain {
    0%, 100% { transform: translateX(0) rotate(0); }
    30% { transform: translateX(-4px) rotate(-3deg); }
    60% { transform: translateX(4px) rotate(3deg); }
}

@media (max-width: 600px) {
    #gameScreen:not([data-phase="WORLD"]):not([data-phase="ERROR"]) #gardenPanel:not([hidden]) {
        left: 50%;
        bottom: 4.5%;
        width: min(326px, calc(100% - 26px));
        padding: 32px 12px 18px;
        transform: translateX(-50%) rotate(-1deg);
    }
    #gardenChoices, #gardenSlots { gap: 10px; }
    #gardenChoices .garden-tile { width: 75px; min-width: 75px; height: 80px; min-height: 80px; font-size: 47px; }
    #gardenSlots .garden-slot { width: 71px; height: 65px; min-height: 65px; font-size: 43px; }
    #gameScreen[data-phase="TEACH"] #gardenSlots .garden-slot { width: 98px; height: 93px; font-size: 70px; }
    #gameScreen[data-phase="TRANSFER"] #gardenChoices .garden-tile { height: 80px; font-size: 33px; }
}
@media (max-width: 350px) {
    #gameScreen:not([data-phase="WORLD"]):not([data-phase="ERROR"]) #gardenPanel:not([hidden]) {
        width: calc(100% - 20px);
        padding-inline: 10px;
    }
    #gardenChoices .garden-tile { width: 68px; min-width: 68px; height: 76px; min-height: 76px; }
    #gardenSlots .garden-slot { width: 64px; }
}
@media (max-height: 600px) and (min-width: 601px) {
    #gameScreen:not([data-phase="WORLD"]):not([data-phase="ERROR"]) #gardenPanel:not([hidden]) {
        left: 5%;
        bottom: 6%;
        width: min(335px, 40%);
        padding-top: 26px;
        padding-bottom: 12px;
    }
    #gardenChoices .garden-tile { height: 69px; min-height: 69px; width: 68px; min-width: 68px; font-size: 42px; }
    #gardenSlots .garden-slot { height: 58px; min-height: 58px; width: 60px; font-size: 39px; }
    #gardenHear { width: 56px; height: 56px; top: -27px; }
}
@media (prefers-reduced-motion: reduce) {
    #gardenChoices .garden-tile, #gardenHear { transition: none !important; }
    #gardenChoices .garden-tile.garden-answer-correct,
    #gardenChoices .garden-tile.garden-answer-tryagain { animation: none !important; }
}

/* MAP story layers; the forest scene keeps its existing layout and choreography. */
.garden .map-art { display:none; }
.garden[data-scene="treasure"] { min-height:0; max-height:none; height:100svh; }
.garden[data-scene="treasure"] :is(.bird-pose,.bird-shadow,.friend-shadow,.study-touch,.garden-plants,.garden-sunlight),
.garden[data-scene="treasure"] #gardenAction > img:not(.map-art) { display:none; }
.garden[data-scene="treasure"] .garden-backdrop { object-position:center; }
.garden[data-scene="treasure"] #gardenBird { left:8%; top:auto; bottom:12%; width:34%; height:62%; aspect-ratio:auto; }
.garden[data-scene="treasure"] #gardenAction { left:43%; top:auto; bottom:15%; width:50%; max-width:760px; aspect-ratio:4/3; }
.garden[data-scene="treasure"] .map-art { display:block; position:absolute; inset:0; width:100%; height:100%; object-fit:contain; pointer-events:none; }
.garden[data-scene="treasure"] #gardenBird .map-art { object-position:center bottom; filter:drop-shadow(0 12px 8px #23492e55); transition:opacity .3s ease; }
.garden[data-scene="treasure"] .pirate-invite { opacity:0; }
.garden[data-scene="treasure"]:is([data-state="inviting"],[data-state="happy"],[data-state="greeting"]) .pirate-ready { opacity:0; }
.garden[data-scene="treasure"]:is([data-state="inviting"],[data-state="happy"],[data-state="greeting"]) .pirate-invite { opacity:1; }
.garden[data-scene="treasure"] #gardenAction .map-art { filter:drop-shadow(0 10px 6px #4f402f44); transition:opacity .5s ease,transform .9s ease,clip-path 1.4s ease; }
.garden[data-scene="treasure"] :is(.map-opening,.map-open) { opacity:0; }
.garden[data-scene="treasure"][data-map="opening"] .map-closed { opacity:0; transform:scaleX(.8); }
.garden[data-scene="treasure"][data-map="opening"] .map-opening { opacity:1; }
.garden[data-scene="treasure"] .map-open { clip-path:inset(0 100% 0 0); transform:scaleX(.85); }
.garden[data-scene="treasure"]:is([data-map="trail"],[data-map="open"]) :is(.map-closed,.map-opening) { opacity:0; }
.garden[data-scene="treasure"]:is([data-map="trail"],[data-map="open"]) .map-open { opacity:1; clip-path:inset(0); transform:scaleX(1); }
.garden[data-scene="treasure"] .garden-action-ring { left:28%;top:35%;width:45%; }
.garden[data-scene="treasure"][data-wake="awake"] #gardenAction { animation:none; }
.garden[data-scene="treasure"]:is([data-phase="SOUND_CHECK"],[data-phase="TEACH"],[data-phase="BUILD"],[data-phase="BLEND"],[data-phase="TRANSFER"],[data-phase="CONFIRM"]) #gardenBird { left:42%;bottom:23%;width:24%;height:40%; }
.garden[data-scene="treasure"]:is([data-phase="SOUND_CHECK"],[data-phase="TEACH"],[data-phase="BUILD"],[data-phase="BLEND"],[data-phase="TRANSFER"],[data-phase="CONFIRM"]) #gardenAction { left:64%;bottom:23%;width:34%; }
@media(max-width:600px) {
 .garden[data-scene="treasure"] #gardenBird { left:0;top:30%;bottom:auto;width:55%;height:43%; }
 .garden[data-scene="treasure"] #gardenAction { left:32%;top:45%;bottom:auto;width:68%; }
 .garden[data-scene="treasure"]:is([data-phase="SOUND_CHECK"],[data-phase="TEACH"],[data-phase="BUILD"],[data-phase="BLEND"],[data-phase="TRANSFER"],[data-phase="CONFIRM"]) #gardenBird { left:0;top:23%;bottom:auto;width:44%;height:30%; }
 .garden[data-scene="treasure"]:is([data-phase="SOUND_CHECK"],[data-phase="TEACH"],[data-phase="BUILD"],[data-phase="BLEND"],[data-phase="TRANSFER"],[data-phase="CONFIRM"]) #gardenAction { left:42%;top:32%;bottom:auto;width:57%; }
 .garden[data-scene="treasure"][data-phase="INTRO"] #gardenWordIntro { top:90px;bottom:auto; }
}
@media(max-width:600px) and (max-height:650px) {
 .garden[data-scene="treasure"] #gardenBird { top:30%;height:42%; }
 .garden[data-scene="treasure"] #gardenAction { top:43%; }
 .garden[data-scene="treasure"]:is([data-phase="SOUND_CHECK"],[data-phase="TEACH"],[data-phase="BUILD"],[data-phase="BLEND"],[data-phase="TRANSFER"],[data-phase="CONFIRM"]) #gardenBird { top:13%;height:30%; }
 .garden[data-scene="treasure"]:is([data-phase="SOUND_CHECK"],[data-phase="TEACH"],[data-phase="BUILD"],[data-phase="BLEND"],[data-phase="TRANSFER"],[data-phase="CONFIRM"]) #gardenAction { top:20%; }
}
@media(max-height:600px) and (min-width:601px) {
 .garden[data-scene="treasure"] #gardenBird { left:8%;bottom:8%;height:65%;width:32%; }
 .garden[data-scene="treasure"] #gardenAction { left:48%;bottom:10%;width:44%; }
}
@media(prefers-reduced-motion:reduce) {
 .garden[data-scene="treasure"] .map-art { transition:none !important; }
}

.garden[data-scene="treasure"][data-phase="INTRO"] #gardenBird:not(:disabled)::after { right:20%;top:38%; }

@media(max-width:600px) and (max-height:650px) {
 .garden[data-scene="treasure"][data-phase="INTRO"] #gardenBird { top:36%;height:38%; }
}

/* WORD GARDEN WORLD TRANSITION V1 */
#gardenTransition[hidden] {
    display: none !important;
}

#gardenTransition {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 3vh, 24px);
    box-sizing: border-box;
    overflow-y: auto;
    padding: max(24px, env(safe-area-inset-top))
             max(18px, env(safe-area-inset-right))
             max(24px, env(safe-area-inset-bottom))
             max(18px, env(safe-area-inset-left));
    background: linear-gradient(165deg, #122746f2, #163b58ed 54%, #153a34f2);
    color: #fff;
    text-align: center;
    isolation: isolate;
}

#gardenTransition::before {
    content: "";
    position: absolute;
    inset: 7%;
    z-index: -1;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 32px;
    background: radial-gradient(ellipse at 50% 25%, rgba(255, 218, 127, .16), transparent 68%);
    pointer-events: none;
}

#gardenTransitionHeading {
    max-width: 680px;
    margin: 0;
    font-size: clamp(28px, 6vw, 52px);
    font-weight: 900;
    line-height: 1.15;
    text-wrap: balance;
}

#gardenTransitionDescription {
    max-width: 540px;
    margin: 0;
    color: #e0edf4;
    font-size: clamp(16px, 3vw, 21px);
    line-height: 1.5;
    text-wrap: pretty;
}

.garden-transition-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    width: min(100%, 420px);
    margin-top: 10px;
}

#gardenNextWorld,
#gardenFinishWorld {
    min-height: 56px;
    padding: 14px 22px;
    border-radius: 18px;
    font: inherit;
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 800;
    line-height: 1.3;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease;
}

#gardenNextWorld {
    border: 2px solid #ffe5a0;
    background: linear-gradient(180deg, #ffe59c, #f4b94f);
    color: #493011;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

#gardenFinishWorld {
    border: 2px solid rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .09);
    color: #fff;
}

#gardenNextWorld:hover:not(:disabled),
#gardenFinishWorld:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

#gardenNextWorld:focus-visible,
#gardenFinishWorld:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}

#gardenNextWorld:disabled,
#gardenFinishWorld:disabled {
    opacity: .55;
    cursor: wait;
}

#gardenTransitionStatus {
    min-height: 1.5em;
    max-width: 520px;
    margin: 0;
    color: #ffe5a0;
    font-size: 15px;
}

@media (max-height: 580px) {
    #gardenTransition {
        gap: 10px;
        padding-block: 12px;
    }

    #gardenTransitionHeading {
        font-size: clamp(24px, 5vh, 36px);
    }

    #gardenTransitionDescription {
        font-size: 15px;
    }

    #gardenNextWorld,
    #gardenFinishWorld {
        min-height: 46px;
        padding: 9px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #gardenNextWorld,
    #gardenFinishWorld {
        transition: none;
    }
}

/* Word Garden transition magic polish v1 */
#gardenTransition {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 28px);
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.24), rgba(255,255,255,0) 34%),
    linear-gradient(180deg, rgba(15, 48, 96, 0.18) 0%, rgba(9, 36, 78, 0.48) 100%);
  backdrop-filter: blur(6px);
  z-index: 40;
}

#gardenTransition[hidden] {
  display: none !important;
}

#gardenTransition .garden-transition__panel {
  width: min(92vw, 520px);
  min-height: min(72vh, 640px);
  border-radius: 34px;
  padding: 24px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  border: 3px solid rgba(255,255,255,0.34);
  box-shadow:
    0 22px 60px rgba(12, 31, 72, 0.30),
    inset 0 2px 0 rgba(255,255,255,0.55);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.46), rgba(255,255,255,0) 34%),
    linear-gradient(180deg, rgba(36, 124, 198, 0.88) 0%, rgba(28, 109, 125, 0.88) 56%, rgba(39, 133, 98, 0.9) 100%);
  position: relative;
  overflow: hidden;
}

#gardenTransition .garden-transition__panel::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 28px;
  border: 2px solid rgba(255,255,255,0.16);
  pointer-events: none;
}

#gardenTransition .garden-transition__panel::after {
  content: "🗺️";
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 34px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.18));
  opacity: 0.95;
}

#gardenTransition .garden-transition__content,
#gardenTransition .garden-transition__body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#gardenTransition .garden-transition__title,
#gardenTransition h2 {
  margin: 120px 0 4px;
  color: #ffffff;
  text-align: center;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 18px rgba(0,0,0,0.20);
}

#gardenTransition .garden-transition__title::before,
#gardenTransition h2::before {
  content: "✨";
  display: block;
  font-size: 24px;
  margin-bottom: 10px;
}

#gardenTransition .garden-transition__text,
#gardenTransition p {
  margin: 0 0 6px;
  max-width: 290px;
  color: rgba(255,255,255,0.96);
  text-align: center;
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.25;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,0.16);
}

#gardenTransition .garden-transition__actions {
  width: 100%;
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

#gardenTransition button {
  width: 100%;
  min-height: 64px;
  border-radius: 999px;
  padding: 14px 18px;
  font-size: clamp(21px, 2.6vw, 28px);
  font-weight: 900;
  letter-spacing: -0.02em;
  border: 0;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

#gardenTransition button:hover,
#gardenTransition button:focus-visible {
  transform: translateY(-1px) scale(1.01);
  outline: none;
}

#gardenTransition button:active {
  transform: translateY(1px) scale(0.995);
}

#gardenNextWorld {
  color: #5a3300;
  background: linear-gradient(180deg, #ffe78a 0%, #ffc948 100%);
  box-shadow:
    0 12px 22px rgba(111, 69, 0, 0.22),
    inset 0 2px 0 rgba(255,255,255,0.68);
}

#gardenFinishWorld {
  color: #ffffff;
  background: rgba(255,255,255,0.12);
  border: 3px solid rgba(255,255,255,0.40);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

#gardenFinishWorld:hover,
#gardenFinishWorld:focus-visible {
  background: rgba(255,255,255,0.18);
}

#gardenTransitionStatus {
  min-height: 24px;
  margin-top: 2px;
  color: #fef7d0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

@media (max-width: 640px) {
  #gardenTransition {
    padding: 10px;
  }

  #gardenTransition .garden-transition__panel {
    width: min(94vw, 420px);
    min-height: min(78vh, 620px);
    border-radius: 28px;
    padding: 18px 16px 18px;
  }

  #gardenTransition .garden-transition__title,
  #gardenTransition h2 {
    margin-top: 112px;
    font-size: clamp(30px, 9vw, 42px);
  }

  #gardenTransition .garden-transition__text,
  #gardenTransition p {
    max-width: 250px;
    font-size: clamp(17px, 5vw, 21px);
  }

  #gardenTransition button {
    min-height: 60px;
    font-size: clamp(19px, 5.2vw, 24px);
  }
}