/* Sir Nib and the Dragon — styles. Loads after gamekit.css.
   Autumn storybook palette: russet + goldenrod + oak brown + dusk teal. */

:root {
    --teal-deep: #1F4E58;
    --teal: #2E6E6E;
    --russet: #C1552E;
    --russet-deep: #9E4423;
    --gold: #E8A928;
    --gold-light: #F5C95E;
    --oak: #6B4A2B;
    --oak-deep: #4E3620;
    --oak-light: #A87848;
    --parchment: #F9EED6;
    --parchment-deep: #F2E3BC;
    --ink: #3E2A1C;
    --dd-font: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', Arial, sans-serif;
}

body { font-family: var(--dd-font); background: var(--teal-deep); overflow: hidden; color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { position: fixed; inset: 0; overflow: hidden; }
#app > section { position: absolute; inset: 0; overflow: hidden; }
.depth { position: absolute; inset: 0; pointer-events: none; }

.bg-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fg-svg { z-index: 4; pointer-events: none; }

/* ══════════════════════════════════════════════════════════════
   TITLE
   ══════════════════════════════════════════════════════════════ */
#screen-title {
    display: flex; flex-direction: column; align-items: center;
    background:
        radial-gradient(120% 60% at 50% 108%, rgba(232, 169, 40, 0.5) 0%, rgba(232, 169, 40, 0) 60%),
        linear-gradient(180deg, var(--teal-deep) 0%, var(--teal) 55%, #7FA88C 100%);
}
#title-inner {
    flex: 1; width: 100%;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; justify-content: safe center;
    overflow-y: auto; overscroll-behavior: contain;
    gap: clamp(8px, 1.6vh, 16px);
    padding: 16px 12px calc(var(--gk-corner-clear) + 4px);
}
#title-art { width: min(88vw, 430px); }
#title-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 24px rgba(20, 40, 44, 0.45)); }

.game-title {
    font-size: clamp(1.9rem, 7.2vw, 3.4rem); font-weight: 800; text-align: center; line-height: 1.05;
    color: var(--gold-light);
    text-shadow: 0 3px 0 var(--russet-deep), 0 7px 18px rgba(20, 40, 44, 0.55);
    animation: dd-title-bob 5s ease-in-out infinite;
}
.game-title .amp { font-size: 0.55em; color: var(--parchment); display: inline-block; margin: 0 2px; }
@keyframes dd-title-bob { 0%, 100% { transform: rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }

.tagline { color: var(--parchment); font-size: clamp(1rem, 3.4vw, 1.3rem); font-weight: 700; text-shadow: 0 2px 6px rgba(20, 40, 44, 0.5); }

#btn-start { min-width: min(78vw, 320px); }
#btn-book { min-height: 52px; padding: 8px 26px; font-size: clamp(1rem, 3.4vw, 1.2rem); }

#title-stickers { display: flex; gap: 8px; margin-top: 2px; }
.mini-sticker {
    width: clamp(42px, 10vw, 56px); height: clamp(42px, 10vw, 56px); border-radius: 50%;
    background: rgba(249, 238, 214, 0.18); border: 2px dashed rgba(249, 238, 214, 0.55);
    display: flex; align-items: center; justify-content: center;
}
.mini-sticker.owned { background: var(--parchment); border-style: solid; border-color: var(--gold); box-shadow: 0 3px 10px rgba(20, 40, 44, 0.4); }
.mini-sticker svg { width: 88%; height: 88%; }
.mini-sticker .q { color: rgba(249, 238, 214, 0.85); font-weight: 800; font-size: 1.2rem; }

#golden-note {
    background: linear-gradient(180deg, #F5CE3C, #E8A928); color: var(--oak-deep);
    font-weight: 800; padding: 8px 18px; border-radius: 20px; font-size: clamp(0.9rem, 3vw, 1.05rem);
    box-shadow: 0 4px 14px rgba(232, 169, 40, 0.5);
    animation: dd-glow-pulse 2.6s ease-in-out infinite;
}
@keyframes dd-glow-pulse { 0%, 100% { box-shadow: 0 4px 14px rgba(232,169,40,0.5); } 50% { box-shadow: 0 4px 26px rgba(245,206,60,0.85); } }

#info-btn {
    position: absolute; left: var(--gk-corner-inset); bottom: var(--gk-corner-inset); z-index: 8;
    min-height: 52px; padding: 10px 18px; border: none; border-radius: 30px;
    background: rgba(249, 238, 214, 0.18); color: var(--parchment); font-size: 0.95rem; font-weight: 700;
    cursor: pointer; backdrop-filter: blur(4px); font-family: inherit;
}

/* keep the title column below the fixed HUD on phones */
@media (max-width: 719px) {
    #title-inner { padding-top: calc(var(--gk-hud-clear-top) + 4px); justify-content: flex-start; justify-content: safe center; }
}
/* short phones: shrink the tableau so the golden banner clears the corner pill */
@media (max-height: 620px) {
    #title-inner { gap: 6px; }
    #title-art { width: min(76vw, 340px); }
}

/* ══════════════════════════════════════════════════════════════
   STORY — stage on top, parchment panel below
   ══════════════════════════════════════════════════════════════ */
#screen-story { display: flex; flex-direction: column; }

#stage { position: relative; flex: 1 1 40%; min-height: 168px; overflow: hidden; background: var(--teal-deep); }

#cast { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.char-slot {
    position: absolute; transform: translate(-50%, -50%) scale(var(--s, 1));
    transform-origin: center bottom; border: none; background: none; padding: 0; cursor: pointer;
    pointer-events: auto; width: clamp(96px, 17vw, 168px);
    animation: dd-bob 3.4s ease-in-out infinite;
}
.char-slot svg { width: 100%; height: auto; display: block; overflow: visible; pointer-events: none; }
.char-cinder { width: clamp(110px, 20vw, 196px); animation-duration: 3.9s; }
.char-clover { width: clamp(110px, 20vw, 192px); animation-duration: 4.3s; }
.char-captain { width: clamp(100px, 18vw, 172px); animation-duration: 4.8s; }
@keyframes dd-bob {
    0%, 100% { transform: translate(-50%, -50%) scale(var(--s, 1)); }
    50% { transform: translate(-50%, calc(-50% - 6px)) scale(var(--s, 1)); }
}
.char-slot.talking { animation: dd-talk 0.7s ease-in-out infinite; }
@keyframes dd-talk {
    0%, 100% { transform: translate(-50%, -50%) scale(var(--s, 1)) rotate(-1.5deg); }
    50% { transform: translate(-50%, calc(-50% - 5px)) scale(var(--s, 1)) rotate(1.5deg); }
}
.char-slot.react { animation: dd-react 0.7s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes dd-react {
    0% { transform: translate(-50%, -50%) scale(var(--s, 1)); }
    40% { transform: translate(-50%, calc(-50% - 14px)) scale(calc(var(--s, 1) * 1.08)); }
    100% { transform: translate(-50%, -50%) scale(var(--s, 1)); }
}

#chapter-badge {
    position: absolute; left: 10px; top: var(--gk-hud-inset-top); z-index: 5;
    display: flex; align-items: center; gap: 6px;
    background: rgba(62, 42, 28, 0.78); color: var(--parchment);
    font-weight: 800; font-size: 0.85rem; padding: 6px 12px 6px 8px; border-radius: 16px;
}
#chapter-badge svg { width: 18px; height: 20px; }

/* leaf page-turn wipe */
#leaf-wipe { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0; }
#leaf-wipe.go { animation: dd-wipe 0.6s ease-out; }
#leaf-wipe.go::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 15% 30%, rgba(193, 85, 46, 0.95), transparent 11%),
        radial-gradient(circle at 35% 65%, rgba(232, 169, 40, 0.95), transparent 10%),
        radial-gradient(circle at 55% 25%, rgba(138, 138, 62, 0.95), transparent 11%),
        radial-gradient(circle at 75% 60%, rgba(217, 123, 46, 0.95), transparent 10%),
        radial-gradient(circle at 90% 35%, rgba(245, 201, 94, 0.95), transparent 11%),
        linear-gradient(100deg, rgba(78, 54, 32, 0.96) 30%, rgba(78, 54, 32, 0) 70%);
    animation: dd-wipe-move 0.6s ease-out;
}
@keyframes dd-wipe { from { opacity: 1; } to { opacity: 0; } }
@keyframes dd-wipe-move { from { transform: translateX(-105%); } to { transform: translateX(115%); } }

/* ── the parchment panel ── */
#panel {
    position: relative; z-index: 7; flex: none;
    max-height: 66%;
    overflow-y: auto; overscroll-behavior: contain;
    background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-deep) 100%);
    border-top: 5px solid var(--oak);
    box-shadow: 0 -8px 24px rgba(20, 40, 44, 0.35);
    padding: 10px clamp(10px, 3vw, 22px) 10px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}

#choose-banner {
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    color: var(--oak-deep); font-weight: 800; font-size: clamp(1.05rem, 4vw, 1.5rem);
    padding: 8px 24px; border-radius: 20px; border: 3px solid var(--oak);
    box-shadow: 0 5px 14px rgba(78, 54, 32, 0.3);
}
#choose-banner.pop { animation: dd-boing 0.6s cubic-bezier(0.2, 1.7, 0.4, 1); }
@keyframes dd-boing { 0% { transform: translateY(-40px) scale(0.6); } 60% { transform: translateY(4px) scale(1.08); } 100% { transform: translateY(0) scale(1); } }

#story-card {
    position: relative; width: min(100%, 680px);
    background: #FFFDF4; border: 3px solid var(--oak-light); border-radius: 20px;
    padding: 20px 64px 14px 16px; min-height: 84px;
    box-shadow: 0 6px 16px rgba(78, 54, 32, 0.18);
}
#story-card.line-in { animation: dd-line-in 0.35s ease-out; }
@keyframes dd-line-in { from { opacity: 0.3; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

#speaker-chip {
    position: absolute; top: -14px; left: 14px;
    color: #FFF; font-weight: 800; font-size: 0.85rem;
    padding: 4px 14px; border-radius: 14px; background: var(--oak);
    box-shadow: 0 3px 8px rgba(62, 42, 28, 0.35);
}
#story-text { font-size: clamp(1.02rem, 3.4vw, 1.38rem); font-weight: 700; line-height: 1.45; color: var(--ink); }

#ear-btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border: none; border-radius: 50%;
    background: var(--teal); color: #fff; font-size: 1.35rem; cursor: pointer;
    box-shadow: 0 3px 8px rgba(31, 78, 88, 0.4);
    animation: dd-ear 2.6s ease-in-out infinite;
}
@keyframes dd-ear { 0%, 100% { transform: translateY(-50%) rotate(-4deg); } 50% { transform: translateY(-50%) scale(1.07) rotate(4deg); } }

/* ── choices: big picture rows ── */
#choice-area { width: min(100%, 680px); display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
    display: flex; align-items: center; gap: 14px;
    width: 100%; min-height: 92px; padding: 10px 16px;
    background: linear-gradient(180deg, #FFFDF4, var(--parchment));
    border: 4px solid var(--oak); border-radius: 24px; cursor: pointer;
    box-shadow: 0 8px 18px rgba(78, 54, 32, 0.25);
    font-family: inherit; text-align: left;
    transition: transform 0.25s, opacity 0.35s;
    animation: dd-choice-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}
.choice-btn:nth-child(2) { animation-delay: 0.12s; }
@keyframes dd-choice-in { from { opacity: 0; transform: translateY(18px) scale(0.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
.choice-btn .ch-art { flex: none; width: clamp(56px, 12vw, 72px); }
.choice-btn .ch-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 3px 5px rgba(62, 42, 28, 0.3)); }
.choice-btn .ch-label { font-size: clamp(1.1rem, 4.2vw, 1.5rem); font-weight: 800; color: var(--ink); }
.choice-btn.wiggle { animation: dd-cardwig 0.6s ease-in-out; }
@keyframes dd-cardwig { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.6deg) scale(1.02); } 75% { transform: rotate(1.6deg) scale(1.02); } }
.choice-btn.faded { opacity: 0.18; transform: scale(0.94); pointer-events: none; }
.choice-btn.picked { border-color: var(--gold); box-shadow: 0 10px 26px rgba(232, 169, 40, 0.55); animation: dd-picked 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) forwards; }
@keyframes dd-picked { to { transform: scale(1.05); } }
.choice-btn:active { transform: scale(0.97); }
.choice-btn.nudge { animation: dd-cardwig 0.5s ease; }
.choice-btn.halo { border-color: var(--gold); animation: dd-halo 1.1s ease-in-out infinite; }
@keyframes dd-halo { 0%, 100% { box-shadow: 0 0 0 4px rgba(232, 169, 40, 0.45); } 50% { box-shadow: 0 0 0 12px rgba(232, 169, 40, 0.15); } }

/* find-the-knot + recall rows */
.find-row { display: flex; gap: 12px; justify-content: center; width: 100%; }
.find-row .choice-btn { width: auto; min-width: 96px; min-height: 92px; justify-content: center; }
.recall-icon { font-size: 2.6rem; line-height: 1; width: auto !important; }
.find-spot {
    flex: 1; max-width: 130px; min-height: 92px; border: 4px solid var(--oak);
    border-radius: 22px; background: linear-gradient(180deg, #FFFDF4, var(--parchment));
    cursor: pointer; box-shadow: 0 6px 14px rgba(78, 54, 32, 0.25);
    animation: dd-choice-in 0.4s ease-out backwards;
}
.find-spot:nth-child(2) { animation-delay: 0.1s; }
.find-spot:nth-child(3) { animation-delay: 0.2s; }
.find-spot svg { width: 74%; height: auto; margin: auto; display: block; }
.find-spot.is-correct svg { filter: drop-shadow(0 0 8px rgba(245, 201, 94, 0.95)); }
.find-spot.found { border-color: var(--gold); animation: dd-picked 0.5s ease forwards; }
.find-spot.faded { opacity: 0.2; pointer-events: none; }
.find-spot.nudge { animation: dd-cardwig 0.5s ease; }
.find-spot.halo { animation: dd-halo 1.1s ease-in-out infinite; }

/* ── the acorn page-turn button ── */
#next-btn {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    margin: 2px 4px 8px auto; padding: 4px 10px;
    border: none; background: none; cursor: pointer; z-index: 8;
    font-family: inherit;
}
#panel #next-btn { flex: none; }
#next-btn svg { width: 86px; height: 86px; filter: drop-shadow(0 0 14px rgba(245, 201, 94, 0.8)) drop-shadow(0 5px 8px rgba(62, 42, 28, 0.35)); animation: dd-acorn-pulse 1.3s ease-in-out infinite; }
@keyframes dd-acorn-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
#next-btn:active svg { transform: scale(0.92); }
#next-word { font-weight: 800; color: var(--oak-deep); font-size: 0.95rem; }
#next-btn.hooray #next-word { color: var(--russet); font-size: 1.1rem; }

#howto {
    align-self: flex-end; margin: 2px 18px -4px 0;
    background: var(--gold-light); color: var(--oak-deep); font-weight: 800;
    padding: 8px 14px; border-radius: 18px; border: 3px solid var(--oak);
    box-shadow: 0 6px 16px rgba(62, 42, 28, 0.35);
    animation: dd-howto 1.4s ease-in-out infinite;
    pointer-events: none;
}
.howto-hand { display: inline-block; animation: dd-hand 1.4s ease-in-out infinite; }
@keyframes dd-howto { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }
@keyframes dd-hand { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(14deg) translateY(-3px); } }

/* ══════════════════════════════════════════════════════════════
   STICKER BOOK + GROWN-UPS
   ══════════════════════════════════════════════════════════════ */
#book-overlay, #info-overlay {
    position: fixed; inset: 0; z-index: 930; background: rgba(31, 46, 40, 0.62);
    display: flex; align-items: center; justify-content: center; animation: gk-fade-in 0.25s;
    padding: 12px;
}
#book-card, #info-card {
    position: relative; width: min(94vw, 560px); max-height: min(88vh, 640px); overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--parchment); text-align: left;
    border: 4px solid var(--oak);
}
#book-card h2, #info-card h2 { color: var(--russet); margin-bottom: 6px; padding-right: 56px; }
.book-hint { margin-bottom: 12px; font-weight: 700; }
#book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.book-slot {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: #FFFDF4; border: 3px dashed var(--oak-light); border-radius: 18px;
    padding: 10px 6px; min-height: 128px; cursor: pointer; font-family: inherit;
}
.book-slot.owned { border-style: solid; border-color: var(--gold); box-shadow: inset 0 0 18px rgba(232, 169, 40, 0.18); }
.book-slot .slot-art { width: clamp(64px, 16vw, 84px); height: clamp(64px, 16vw, 84px); display: flex; align-items: center; justify-content: center; }
.book-slot .slot-art svg { width: 100%; height: 100%; }
.book-slot .q { font-size: 2rem; font-weight: 800; color: var(--oak-light); }
.book-slot .slot-name { font-weight: 800; font-size: clamp(0.82rem, 2.6vw, 0.98rem); color: var(--ink); text-align: center; line-height: 1.2; }
.book-slot.golden.owned { background: linear-gradient(180deg, #FFF7DC, #F5E3A8); }
.book-slot.stamp { animation: dd-stamp 0.7s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes dd-stamp { 0% { transform: scale(2) rotate(-8deg); opacity: 0; } 55% { transform: scale(0.92) rotate(3deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
#book-close, #info-close {
    position: absolute; right: 10px; top: 10px; width: 52px; height: 52px;
    border: none; border-radius: 50%; background: var(--parchment-deep);
    font-size: 1.2rem; cursor: pointer; font-family: inherit;
}

#info-card p { line-height: 1.5; margin-bottom: 6px; }
.info-block { margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--oak-light); }
.info-block h3 { color: var(--russet); font-size: 1.05rem; margin-bottom: 4px; }
.info-fine { font-size: 0.9rem; opacity: 0.85; margin-top: 8px; }
#level-picker { display: flex; gap: 10px; margin: 10px 0; }
.lvl-btn {
    flex: 1; min-height: 76px; padding: 8px; border: 3px solid var(--oak-light); border-radius: 18px;
    background: #FFFDF4; color: var(--ink); font-family: inherit; font-size: 0.85rem;
    cursor: pointer; line-height: 1.35;
}
.lvl-btn.sel { border-color: var(--russet); background: #FBE7CE; box-shadow: 0 4px 12px rgba(193, 85, 46, 0.3); }

/* ══════════════════════════════════════════════════════════════
   scene art animations (classes emitted by art.js)
   ══════════════════════════════════════════════════════════════ */
.dd-drift { animation: dd-drift 14s ease-in-out infinite alternate; }
@keyframes dd-drift { from { transform: translateX(-8px); } to { transform: translateX(10px); } }
.dd-sway { animation: dd-sway 4.5s ease-in-out infinite; }
@keyframes dd-sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
.dd-flag { animation: dd-flagwave 2.2s ease-in-out infinite; }
@keyframes dd-flagwave { 0%, 100% { transform: skewY(0deg); } 50% { transform: skewY(-6deg); } }
.dd-leaf { animation: dd-leaffall 7s ease-in-out infinite; }
@keyframes dd-leaffall {
    0%, 100% { transform: translate(0, 0) rotate(0); opacity: 0.9; }
    50% { transform: translate(9px, 14px) rotate(24deg); opacity: 1; }
}
.dd-smoke { animation: dd-smoke 5s ease-in-out infinite; }
@keyframes dd-smoke { 0%, 100% { transform: translateY(0); opacity: 0.9; } 50% { transform: translateY(-9px); opacity: 0.6; } }
.dd-ember { animation: dd-emberpulse 1.4s ease-in-out infinite; }
@keyframes dd-emberpulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.dd-bell { animation: dd-bellswing 1.6s ease-in-out infinite; }
@keyframes dd-bellswing { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
.dd-lantern { animation: dd-lanternflick 2.8s ease-in-out infinite; }
@keyframes dd-lanternflick { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }
.dd-twinkle { animation: dd-twinkleA 2.4s ease-in-out infinite; }
@keyframes dd-twinkleA { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.dd-shimmer { animation: dd-shimmerA 3s ease-in-out infinite; }
@keyframes dd-shimmerA { 0%, 100% { opacity: 0.9; transform: translateX(0); } 50% { opacity: 0.5; transform: translateX(6px); } }
.dd-flame { animation: dd-flameA 0.5s ease-in-out infinite alternate; }
@keyframes dd-flameA { from { transform: scaleY(0.86); } to { transform: scaleY(1.12); } }
.dd-bonfire { animation: dd-flameA 0.6s ease-in-out infinite alternate; }
.dd-spark { animation: dd-sparkrise 2.2s ease-in infinite; }
@keyframes dd-sparkrise { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
.dd-kite { animation: dd-kitebob 3.6s ease-in-out infinite; }
@keyframes dd-kitebob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.dd-eyes { animation: dd-blink 4.4s infinite; transform-origin: center; }
@keyframes dd-blink { 0%, 92%, 100% { transform: scaleY(1); } 95%, 97% { transform: scaleY(0.1); } }
.dd-plume { animation: dd-sway 2.6s ease-in-out infinite; }
.dd-tail { animation: dd-tailsway 3.4s ease-in-out infinite; }
@keyframes dd-tailsway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(8deg); } }
.dd-ear-l { animation: dd-earflick 5.4s ease-in-out infinite; transform-origin: 42px 38px; }
.dd-ear-r { animation: dd-earflick 6.2s ease-in-out infinite; transform-origin: 78px 38px; }
@keyframes dd-earflick { 0%, 90%, 100% { transform: rotate(0); } 94% { transform: rotate(-9deg); } }
.dd-dash { animation: dd-dashflick 0.5s linear infinite alternate; }
@keyframes dd-dashflick { from { opacity: 0.35; } to { opacity: 0.95; } }
.dd-peek { animation: dd-peekbob 2.4s ease-in-out infinite; }
@keyframes dd-peekbob { 0%, 100% { transform: translateY(4px); } 50% { transform: translateY(-4px); } }
.dd-tear { animation: dd-teardrop 2.2s ease-in-out infinite; }
@keyframes dd-teardrop { 0%, 100% { transform: translateY(0); opacity: 0.9; } 60% { transform: translateY(6px); opacity: 0.3; } }
.dd-wing-l, .dd-wing-r { animation: dd-wingidle 3.2s ease-in-out infinite; }
@keyframes dd-wingidle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
.dd-flap { animation: dd-flapA 0.7s ease-in-out infinite alternate !important; }
.dd-flap2 { animation: dd-flapB 0.7s ease-in-out infinite alternate !important; }
@keyframes dd-flapA { from { transform: rotate(-14deg); } to { transform: rotate(10deg); } }
@keyframes dd-flapB { from { transform: rotate(14deg); } to { transform: rotate(-10deg); } }
.dd-sneezepuff { animation: dd-puff 1.1s ease-out infinite; transform-origin: 84px 58px; }
@keyframes dd-puff { 0% { transform: scale(0.5); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.25) translateX(8px); opacity: 0; } }
.dd-tailflame { animation: dd-sway 2.2s ease-in-out infinite; }
.dd-stache { animation: dd-stachetwitch 6s ease-in-out infinite; }
@keyframes dd-stachetwitch { 0%, 92%, 100% { transform: scaleX(1); } 95% { transform: scaleX(1.12); } }
.dd-ptail { animation: dd-tailsway 3.8s ease-in-out infinite; }
.dd-phead { animation: dd-headbob 4.2s ease-in-out infinite; }
@keyframes dd-headbob { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(2.4deg); } }
.dd-mane { animation: dd-sway 3.6s ease-in-out infinite; }
.dd-splash { animation: dd-splashA 1.1s ease-out infinite; transform-origin: 100px 80px; }
@keyframes dd-splashA { 0% { transform: scale(0.6); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1.15) translateY(-6px); opacity: 0; } }
.dd-string { animation: dd-stringtug 3s ease-in-out infinite; transform-origin: 100px 50px; }
@keyframes dd-stringtug { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(2deg); } }

/* ══════════════════════════════════════════════════════════════
   reduced motion — settle everything on its rest pose, first paint
   ══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
    #leaf-wipe.go, #leaf-wipe.go::before { animation: none; opacity: 0; }
    .dd-spark, .dd-sneezepuff, .dd-splash { opacity: 0.6; }
}

/* short phones: keep the stage visible above a tall choice stack */
@media (max-height: 620px) {
    #stage { min-height: 148px; }
    #panel { max-height: 70%; }
    #story-card { padding-top: 16px; min-height: 68px; }
    #next-btn svg { width: 72px; height: 72px; }
    .choice-btn { min-height: 88px; }
}
