/* ============================================================
   Superkids — Advanced kid-friendly design system (buildless)
   Works alongside Tailwind Play CDN. Defines the "candy" theme:
   chunky pressable buttons, bubbly cards, playful motion.
   ============================================================ */

:root {
    --sk-grape:    #6C5CE7;
    --sk-grape-dk: #5546c9;
    --sk-pink:     #FF6B9D;
    --sk-mint:     #00B894;
    --sk-sky:      #0984E3;
    --sk-sun:      #FDCB6E;
    --sk-coral:    #E17055;
    --sk-ink:      #2D2A45;
    --sk-cloud:    #F6F5FF;
    --sk-radius:   1.5rem;
    --sk-shadow:   0 18px 40px -18px rgba(108, 92, 231, .55);
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

/* ---- Global horizontal-overflow guard ----------------------
   No page should ever scroll sideways on a phone. `clip` (not
   `hidden`) is used so it does NOT create a scroll container —
   position: sticky headers keep working. Any element that is a
   touch too wide is clipped at the viewport edge instead of
   dragging the whole layout to one side. */
html, body {
    overflow-x: clip;
    max-width: 100%;
}

body {
    font-family: 'Nunito', system-ui, sans-serif;
    color: var(--sk-ink);
    background: var(--sk-cloud);
}

/* Media never forces the page wider than its column. */
img, svg, video, canvas {
    max-width: 100%;
}

h1, h2, h3, h4, .font-display, .brand {
    font-family: 'Baloo 2', 'Nunito', sans-serif;
    letter-spacing: .2px;
}

/* ---- Decorative dotted / blob backgrounds ------------------ */
.sk-dots {
    background-image: radial-gradient(rgba(108,92,231,.14) 2px, transparent 2px);
    background-size: 26px 26px;
}
.sk-blob {
    position: absolute;
    border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
    filter: blur(2px);
    opacity: .35;
    z-index: 0;
    animation: sk-float 9s ease-in-out infinite;
}

/* ---- Chunky pressable button (skeuomorphic) ---------------- */
.btn-candy {
    --c: var(--sk-grape);
    --c-dk: var(--sk-grape-dk);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    background: var(--c);
    border: none;
    border-radius: 999px;
    padding: .8rem 1.6rem;
    cursor: pointer;
    box-shadow: 0 6px 0 0 var(--c-dk), 0 14px 22px -10px var(--c);
    transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
    text-decoration: none;
    line-height: 1.1;
}
.btn-candy:hover { filter: brightness(1.04); }
.btn-candy:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 0 var(--c-dk), 0 6px 12px -8px var(--c);
}
/* disabled / mid-submit (set by the global double-submit guard in app.js): faded,
   not clickable, and no hover/press feedback so it reads as "working…". */
.btn-candy:disabled,
.btn-candy.is-submitting { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-candy:disabled:active,
.btn-candy.is-submitting:active { transform: none; }

.btn-pink  { --c: var(--sk-pink);  --c-dk: #e2487c; }
.btn-mint  { --c: var(--sk-mint);  --c-dk: #008f70; }
.btn-sky   { --c: var(--sk-sky);   --c-dk: #0768b3; }
.btn-coral { --c: var(--sk-coral); --c-dk: #c15336; }
.btn-sun   { --c: var(--sk-sun);   --c-dk: #e0a93c; color: var(--sk-ink); }
.btn-ghost {
    background: #fff; color: var(--sk-grape);
    box-shadow: 0 6px 0 0 #e7e3ff, 0 14px 22px -12px rgba(108,92,231,.4);
}
.btn-ghost:active { box-shadow: 0 1px 0 0 #e7e3ff; }
.btn-lg { font-size: 1.25rem; padding: 1.05rem 2.1rem; }
.btn-sm { font-size: .9rem; padding: .55rem 1.1rem; box-shadow: 0 4px 0 0 var(--c-dk); }

/* ---- Bubbly card ------------------------------------------- */
.card-bubble {
    background: #fff;
    border-radius: var(--sk-radius);
    box-shadow: 0 18px 40px -22px rgba(45,42,69,.35);
    border: 2px solid #fff;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
}
.card-pop:hover {
    transform: translateY(-6px) rotate(-.6deg);
    box-shadow: 0 28px 50px -22px rgba(45,42,69,.4);
}

/* ---- Tile (activity / category) ---------------------------- */
.sk-tile {
    position: relative;
    border-radius: var(--sk-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.sk-tile:hover { transform: translateY(-6px) scale(1.015); }
.sk-tile:active { transform: translateY(-1px) scale(.99); }

/* ---- Star / progress meters -------------------------------- */
.sk-progress {
    height: 14px;
    border-radius: 999px;
    background: #ece9ff;
    overflow: hidden;
}
.sk-progress > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--sk-mint), var(--sk-sky));
    transition: width .6s cubic-bezier(.34,1.56,.64,1);
}

.sk-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    background: #fff; border-radius: 999px;
    padding: .35rem .8rem; font-weight: 700; font-size: .85rem;
    box-shadow: 0 6px 16px -10px rgba(45,42,69,.5);
}

/* ---- Pill nav link ----------------------------------------- */
.sk-nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem 1rem; border-radius: 1rem;
    font-weight: 700; color: #6b6890; transition: all .15s;
}
.sk-nav-link:hover { background: #f1efff; color: var(--sk-grape); }
.sk-nav-link.active { background: var(--sk-grape); color: #fff; box-shadow: var(--sk-shadow); }
/* A dark emoji (e.g. the ⚙️ Settings gear) blends into the purple "active" bar and
   looks invisible. Give active nav-link emoji a thin white outline so they stay
   readable on the grape background — works for the gear and any other dark icon. */
.sk-nav-link.active img.emoji { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }

/* ---- Inputs ------------------------------------------------ */
.sk-input {
    width: 100%;
    border: 2px solid #e7e3ff;
    border-radius: 1rem;
    padding: .8rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.sk-input:focus {
    border-color: var(--sk-grape);
    box-shadow: 0 0 0 4px rgba(108,92,231,.16);
}
.sk-label { font-weight: 700; font-size: .9rem; color: #5a5780; margin-bottom: .35rem; display:block; }

/* ---- Answer choice button (quizzes/logic) ------------------ */
.choice {
    display: flex; align-items: center; gap: .8rem;
    width: 100%; text-align: left;
    background: #fff; border: 3px solid #ece9ff;
    border-radius: 1.2rem; padding: 1rem 1.2rem;
    font-weight: 700; font-size: 1.1rem; cursor: pointer;
    transition: transform .1s, border-color .15s, background .15s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--sk-grape); }
.choice.is-correct { border-color: var(--sk-mint); background: #e7fbf5; animation: sk-pop .35s; }
.choice.is-wrong   { border-color: var(--sk-coral); background: #fdeee9; animation: sk-shake .4s; }
.choice:disabled { cursor: default; }
.choice .tag {
    width: 2.2rem; height: 2.2rem; flex: none;
    display: grid; place-items: center;
    border-radius: 50%; background: #f1efff; color: var(--sk-grape);
    font-family: 'Baloo 2'; font-weight: 700;
}

/* ---- Mascot ------------------------------------------------ */
.sk-mascot { animation: sk-float 4.5s ease-in-out infinite; display:inline-block; }
.sk-wiggle:hover { animation: sk-wiggle .5s; }

/* ---- Keyframes --------------------------------------------- */
@keyframes sk-float { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-12px) } }
@keyframes sk-pop   { 0%{ transform: scale(1) } 50%{ transform: scale(1.06) } 100%{ transform: scale(1) } }
@keyframes sk-wiggle{ 0%,100%{transform:rotate(0)} 25%{transform:rotate(-7deg)} 75%{transform:rotate(7deg)} }
@keyframes sk-shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 60%{transform:translateX(6px)} }
@keyframes sk-rise  { from{ opacity:0; transform: translateY(16px) } to{ opacity:1; transform:none } }
.sk-rise { animation: sk-rise .5s cubic-bezier(.34,1.56,.64,1) both; }
.sk-rise-2 { animation-delay: .08s; }
.sk-rise-3 { animation-delay: .16s; }
.sk-rise-4 { animation-delay: .24s; }

/* ---- Confetti ---------------------------------------------- */
.sk-confetti {
    position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60;
}
.sk-confetti i {
    position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px;
    animation: sk-fall linear forwards;
}
@keyframes sk-fall {
    to { transform: translateY(108vh) rotate(720deg); opacity: .9; }
}

/* ---- Kid mode body ----------------------------------------- */
.kid-mode {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(255,107,157,.18), transparent),
        radial-gradient(1000px 500px at -10% 110%, rgba(9,132,227,.18), transparent),
        linear-gradient(180deg, #fff6fb 0%, #eef4ff 100%);
    min-height: 45vh;
}

/* Big touch targets for the youngest learners */
.kid-mode .btn-candy { padding: 1rem 1.9rem; font-size: 1.2rem; }

/* utility */
.sk-scrollbar::-webkit-scrollbar { height: 8px; width: 8px; }
.sk-scrollbar::-webkit-scrollbar-thumb { background: #d9d4ff; border-radius: 99px; }

/* ---- Star Pop mini-game ------------------------------------ */
.sk-game-area {
    position: relative;
    height: 22rem;
    overflow: hidden;
    border-radius: var(--sk-radius);
    background:
        radial-gradient(900px 300px at 50% 120%, rgba(108,92,231,.18), transparent),
        linear-gradient(180deg, #eef4ff, #fff6fb);
    touch-action: manipulation;
}
.sk-bubble {
    position: absolute;
    bottom: -3rem;
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 1;
    user-select: none;
    will-change: transform;
    animation: sk-rise-up linear forwards;
    filter: drop-shadow(0 6px 6px rgba(45,42,69,.18));
}
.sk-bubble:active { transform: scale(.85); }
.sk-bubble.popped {
    animation: none;
    transform: scale(1.7);
    opacity: 0;
    transition: transform .16s ease, opacity .16s ease;
}
@keyframes sk-rise-up {
    from { transform: translateY(0) rotate(-6deg); }
    to   { transform: translateY(-26rem) rotate(6deg); }
}

/* letter / number tokens (phonics + counting rounds) */
.sk-bubble--token {
    width: 3.2rem; height: 3.2rem;
    display: grid; place-items: center;
    border-radius: 50%;
    font-weight: 900; font-size: 1.6rem !important;
    color: #fff;
    background: linear-gradient(145deg, var(--sk-grape, #6C5CE7), var(--sk-sky, #0984E3));
    box-shadow: 0 8px 14px -6px rgba(45,42,69,.45);
}

/* goal banner inside the game area */
.sk-goal {
    position: absolute; top: .7rem; left: 50%; transform: translateX(-50%);
    z-index: 6; display: flex; align-items: center; gap: .5rem;
    padding: .45rem .95rem; border-radius: 99px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(3px);
    box-shadow: 0 10px 22px -12px rgba(45,42,69,.5);
    font-weight: 800; color: var(--sk-ink, #2D2A45); white-space: nowrap;
    font-family: 'Baloo 2', sans-serif;
    pointer-events: none;   /* never eat a tap meant for a bubble behind it */
}
.sk-goal .sk-goal-emoji { font-size: 1.35rem; line-height: 1; }
.sk-goal.swap { animation: sk-goal-pop .42s cubic-bezier(.34,1.56,.64,1); }

/* big "your goal" intro shown for 3s before each game.
   NOTE: these elements are centred by their container, so their pop animation
   must NOT use translateX(-50%) (that's only for the absolute top banner) -
   otherwise they jump left/right. Use a plain scale-only keyframe. */
@keyframes sk-intro-pop {
    from { transform: scale(.7); opacity: .3; }
    to   { transform: scale(1);  opacity: 1; }
}
.sk-intro-chip {
    font-size: 5rem; line-height: 1; display: inline-block;
    animation: sk-intro-pop .45s cubic-bezier(.34,1.56,.64,1);
}
.sk-intro-chip.token {
    width: 6.5rem; height: 6.5rem; margin: 0 auto;
    display: grid; place-items: center; border-radius: 50%;
    color: #fff; font-size: 3.6rem; font-family: 'Baloo 2', sans-serif; font-weight: 900;
    background: linear-gradient(145deg, var(--sk-grape), var(--sk-sky));
    box-shadow: 0 16px 28px -10px rgba(45,42,69,.5);
}
.sk-intro-count {
    margin-top: .8rem; font-family: 'Baloo 2', sans-serif; font-weight: 900;
    font-size: 2.8rem; color: var(--sk-grape);
}
.sk-intro-count.go { color: var(--sk-mint); }
.sk-intro-count.beat { animation: sk-pop .4s; }   /* pulse only - no translate */
@keyframes sk-goal-pop {
    from { transform: translateX(-50%) scale(.7); opacity: .3; }
    to   { transform: translateX(-50%) scale(1);  opacity: 1; }
}

/* floating +5 / -3 score feedback */
.sk-float-pts {
    position: absolute; z-index: 7; pointer-events: none;
    font-weight: 900; font-size: 1.5rem;
    transform: translate(-50%, 0);
    animation: sk-float-pts .85s ease-out forwards;
    font-family: 'Baloo 2', sans-serif;
}
.sk-float-pts.good { color: #00B894; }
.sk-float-pts.bad  { color: #E17055; }
@keyframes sk-float-pts {
    from { opacity: 1; transform: translate(-50%, 0) scale(.8); }
    to   { opacity: 0; transform: translate(-50%, -2.6rem) scale(1.35); }
}

/* wrong-tap shake + area flashes */
.sk-bshake { animation: sk-bshake .32s ease; }
@keyframes sk-bshake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-6px) rotate(-3deg); }
    40% { transform: translateX(6px) rotate(3deg); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.sk-game-area { transition: box-shadow .18s ease; }
.sk-game-area.flash-good { box-shadow: inset 0 0 0 5px rgba(0,184,148,.5); }
.sk-game-area.flash-bad  { box-shadow: inset 0 0 0 5px rgba(225,112,85,.6); }

/* Twemoji: size emoji SVGs to the surrounding text */
img.emoji {
    height: 1em; width: 1em;
    display: inline-block;
    margin: 0 .05em 0 .1em;
    vertical-align: -0.125em;
}

/* image helpers */
.sk-photo { object-fit: cover; width: 100%; height: 100%; display: block; }
.sk-photo-card { border-radius: var(--sk-radius); overflow: hidden; }

/* uniform square thumbnail used across all activity cards */
.sk-thumb {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 10px 22px -10px rgba(45,42,69,.5);
    display: block;
}

/* ---- Gentle Meadow theme background (legacy) --------------- */
.sk-meadow-bg {
    background-color: #f4faf1;
    background-image: linear-gradient(180deg, #e9f4ff 0%, #eff7f2 42%, #f5fbf0 68%, #fdf7ee 100%);
    background-attachment: fixed;
}

/* ============================================================
   Sunny Sky theme + cinematic weather intro (runs once on load)
   ============================================================ */
.sk-sky-bg {
    background-color: #eaf6ff;
    background-image: linear-gradient(180deg, #aee0ff 0%, #cdecff 24%, #e8f5ff 46%, #f2faef 72%, #fef9ee 100%);
    background-attachment: fixed;
    transition: filter 1.4s ease;
}
/* end-of-storm glow: whole page warms & brightens, then settles */
body.wx-sunny { filter: saturate(1.08) brightness(1.04); }

/* --- the sun (fixed, top-right, behind content) --- */
.sk-sun {
    position: fixed; top: 64px; right: 7%; width: 92px; height: 92px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #fff6c8 0%, #ffe27a 48%, #ffcf4d 100%);
    box-shadow: 0 0 0 14px rgba(255,221,99,.18), 0 0 60px 18px rgba(255,213,74,.45);
    z-index: 0; pointer-events: none; transition: opacity 1.6s ease, box-shadow 1.6s ease;
    animation: sun-breathe 7s ease-in-out infinite;
}
.sk-sun.dim { opacity: .15; box-shadow: none; }
.sk-sun.shine { box-shadow: 0 0 0 18px rgba(255,221,99,.28), 0 0 110px 40px rgba(255,213,74,.7); }
@keyframes sun-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* --- weather overlays --- */
.wx-dark {
    position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
    background: linear-gradient(180deg, rgba(58,72,100,.62), rgba(84,98,124,.44));
    transition: opacity 3.6s ease;
}
.wx-dark.on { opacity: 1; }

/* rain layer sits above content but stays non-interactive */
.wx-rain { position: fixed; inset: 0; z-index: 45; pointer-events: none; overflow: hidden; }
.wx-drop {
    position: absolute; top: -14%;
    width: 3px; border-radius: 3px;
    background: linear-gradient(180deg, rgba(120,170,225,0) 0%, rgba(86,140,210,.55) 35%, rgba(54,108,186,.98) 100%);
    box-shadow: 0 0 3px rgba(54,108,186,.55);
    animation: wx-fall linear forwards;
}
@keyframes wx-fall { to { transform: translateY(120vh); } }

/* a little seed that sprouts and grows into a tree while it rains */
.wx-sprout {
    position: fixed; left: 50%; bottom: 0; z-index: 46;
    transform: translateX(-50%) scale(0); transform-origin: 50% 100%;
    font-size: 4.2rem; line-height: 1; opacity: 0; pointer-events: none;
    transition: transform 2.4s cubic-bezier(.34,1.56,.64,1), opacity 1s ease;
    filter: drop-shadow(0 5px 6px rgba(45,42,69,.22));
    text-align: center;
}
.wx-sprout .bloom {
    position: absolute; top: -6px; left: 50%; transform: translateX(-50%) scale(0);
    font-size: 1.4rem; transition: transform .6s cubic-bezier(.34,1.56,.64,1);
}
.wx-sprout.grown .bloom { transform: translateX(-50%) scale(1); }

/* warm sun-glow bloom at the finale (behind content) */
.wx-glow {
    position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
    background: radial-gradient(700px 540px at 90% 8%, rgba(255,236,160,.85), rgba(255,236,160,0) 60%);
    transition: opacity 1.6s ease;
}
.wx-glow.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .sk-sun { animation: none; }
    .wx-dark, .wx-rain, .wx-glow { display: none !important; }
}

/* ============================================================
   Woodland ambiance — friendly forest: trees, a climbing
   squirrel, flying & perched birds, butterflies, drifting clouds.
   Decorative only (aria-hidden, pointer-events: none).
   ============================================================ */
.woodland {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.woodland > * { position: absolute; will-change: transform; }

/* soft sky wash at the top + meadow tint at the bottom */
.woodland::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(1200px 380px at 50% -8%, rgba(135,206,250,.18), transparent),
        linear-gradient(180deg, transparent 62%, rgba(125,206,160,.20) 100%);
}

/* rolling green ground band */
.wd-ground {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 150px;
    background:
        radial-gradient(120px 60px at 12% 100%, #8fd6a6 60%, transparent 62%),
        radial-gradient(160px 70px at 38% 100%, #a6e0b8 60%, transparent 62%),
        radial-gradient(140px 64px at 70% 100%, #8fd6a6 60%, transparent 62%),
        radial-gradient(180px 80px at 92% 100%, #a6e0b8 60%, transparent 62%),
        linear-gradient(180deg, transparent, rgba(143,214,166,.55) 60%, rgba(120,200,150,.8));
}

/* clouds */
.wd-cloud { top: 7%; animation: wd-drift linear infinite; opacity: .85; }
@keyframes wd-drift { from { transform: translateX(-25vw); } to { transform: translateX(125vw); } }

/* flying birds (with a little wave in the path) */
.wd-bird { animation: wd-fly linear infinite; }
@keyframes wd-fly {
    0%   { transform: translateX(-12vw) translateY(0); }
    25%  { transform: translateX(22vw)  translateY(-14px); }
    50%  { transform: translateX(55vw)  translateY(6px); }
    75%  { transform: translateX(85vw)  translateY(-10px); }
    100% { transform: translateX(125vw) translateY(0); }
}

/* perched bird gently bobs */
.wd-bob { animation: wd-bob 2.4s ease-in-out infinite; }
@keyframes wd-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* squirrel climbing up & down a trunk */
.wd-squirrel { animation: wd-climb 9s ease-in-out infinite; }
@keyframes wd-climb {
    0%   { transform: translateY(10px) rotate(-6deg) scaleX(1); }
    20%  { transform: translateY(-70px) rotate(-2deg); }
    45%  { transform: translateY(-150px) rotate(2deg); }
    55%  { transform: translateY(-150px) rotate(2deg) scaleX(-1); }
    80%  { transform: translateY(-70px) rotate(2deg) scaleX(-1); }
    100% { transform: translateY(10px) rotate(-6deg) scaleX(-1); }
}

/* butterfly flits in a loose loop */
.wd-flit { animation: wd-flit 11s ease-in-out infinite; }
@keyframes wd-flit {
    0%   { transform: translate(0,0) rotate(-8deg); }
    25%  { transform: translate(48px,-34px) rotate(8deg); }
    50%  { transform: translate(96px,6px) rotate(-6deg); }
    75%  { transform: translate(40px,-22px) rotate(10deg); }
    100% { transform: translate(0,0) rotate(-8deg); }
}

/* gentle tree sway */
.wd-sway { transform-origin: 50% 90%; animation: wd-sway 6s ease-in-out infinite; }
.wd-sway.slow { animation-duration: 8s; animation-direction: alternate; }
@keyframes wd-sway { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

/* sidebar mini woodland strip */
.wd-sidebar { position: absolute; bottom: 0; left: 0; right: 0; height: 120px; pointer-events: none; overflow: hidden; z-index: 0; }

/* ---- Large background tree + lifelike squirrel ------------- */
.wd-bigtree { position: absolute; bottom: 0; z-index: 0; }
.wd-bigtree svg { display: block; }
.wd-bigtree .wd-leaves { transform-origin: 50% 80%; animation: wd-sway 7s ease-in-out infinite; }

/* the squirrel: climbs up the trunk, pauses to eat, then climbs down */
.wd-climber { position: absolute; }
.wd-journey { animation: wd-journey 22s ease-in-out infinite; }
@keyframes wd-journey {
    0%   { transform: translateY(0)     scaleX(1); }   /* at the base, head up */
    16%  { transform: translateY(-176px) scaleX(1); }  /* reached the branch */
    20%  { transform: translateY(-186px) scaleX(1); }  /* settles */
    58%  { transform: translateY(-186px) scaleX(1); }  /* stays up here & eats */
    62%  { transform: translateY(-186px) scaleX(-1); } /* turns around to go down */
    82%  { transform: translateY(-8px)   scaleX(-1); } /* climbed back down */
    100% { transform: translateY(0)      scaleX(1); }  /* home at the base */
}

/* the nibble: tiny quick head bobs during the eating window, a look-around after */
.wd-nibble { display: inline-block; transform-origin: 50% 90%; animation: wd-nibble 22s ease-in-out infinite; }
@keyframes wd-nibble {
    0%, 23% { transform: translateY(0) rotate(0); }
    26% { transform: translateY(-3px) rotate(-4deg); }  29% { transform: translateY(0); }
    32% { transform: translateY(-3px) rotate(4deg); }   35% { transform: translateY(0); }
    38% { transform: translateY(-3px) rotate(-4deg); }  41% { transform: translateY(0); }
    44% { transform: translateY(-3px) rotate(4deg); }   47% { transform: translateY(0); }
    50% { transform: translateY(-3px) rotate(-4deg); }  53% { transform: translateY(0); }
    58% { transform: rotate(-9deg); } 60% { transform: rotate(9deg); }
    100% { transform: translateY(0) rotate(0); }
}

/* the acorn the squirrel nibbles, visible only while it's eating */
.wd-acorn { position: absolute; left: 52%; top: 58%; font-size: .62em; opacity: 0; animation: wd-acorn 22s ease-in-out infinite; }
@keyframes wd-acorn {
    0%, 22% { opacity: 0; transform: scale(.4); }
    25% { opacity: 1; transform: scale(1); }
    54% { opacity: 1; transform: scale(.55); }   /* nibbled down */
    57%, 100% { opacity: 0; transform: scale(.4); }
}

@media (prefers-reduced-motion: reduce) {
    .wd-cloud, .wd-bird, .wd-bob, .wd-squirrel, .wd-flit, .wd-sway,
    .wd-journey, .wd-nibble, .wd-acorn, .wd-leaves { animation: none !important; }
    .wd-acorn { opacity: 1; }
}
