/* Companion hero and chibi animation. Only transform and opacity are animated. */
.chibi { width: 100%; height: 100%; display: block; overflow: visible; }
.chibi .c-all, .chibi .c-head, .chibi .c-look, .chibi .c-eye, .chibi .c-ear, .chibi .c-tail, .chibi .c-wing-l, .chibi .c-wing-r, .chibi .c-body, .chibi .c-paw, .chibi .c-tongue, .chibi .c-shadow { transform-box: fill-box; }
.chibi .c-all { transform-origin: 50% 100%; }
.chibi .c-head { transform-origin: 50% 88%; }
.chibi .c-look { transform-origin: 50% 88%; transition: transform .2s ease-out; }
.chibi .c-pupil { transition: transform .14s ease-out; }
.chibi .c-eye { transform-origin: 50% 50%; }
.chibi .c-eye-closed { opacity: 0; }
.chibi .c-blush { transition: opacity .5s; }
.chibi .c-ear { transform-origin: 50% 95%; }
.chibi .c-tail { transform-origin: 8% 92%; }
.chibi .c-wing-l { transform-origin: 90% 30%; }
.chibi .c-wing-r { transform-origin: 10% 30%; }
.chibi .c-body { transform-origin: 50% 100%; }
.chibi .c-paw { transform-origin: 50% 100%; }
.chibi .c-tongue { transform-origin: 50% 0; }

.live .c-eye { animation: cb-blink 5.4s infinite; }
.live .c-tail { animation: cb-swish 3.8s ease-in-out infinite; }
.live .c-body { animation: cb-breathe 4.2s ease-in-out infinite; }
.live .c-wing-l { animation: cb-wingl 5s ease-in-out infinite; }
.live .c-wing-r { animation: cb-wingr 5s ease-in-out infinite; }
@keyframes cb-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
@keyframes cb-swish { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(9deg); } }
@keyframes cb-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.03); } }
@keyframes cb-wingl { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
@keyframes cb-wingr { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(4deg); } }

/* ---- states (set as classes on the svg by companion.js) ---- */
.chibi.is-content .c-eye, .chibi.is-sleep .c-eye { opacity: 0; }
.chibi.is-content .c-eye-closed, .chibi.is-sleep .c-eye-closed { opacity: 1; }
.chibi.is-drowsy .c-eye { transform: scaleY(.5); animation: none; }
.chibi.is-happy .c-blush, .chibi.is-content .c-blush { opacity: .6; }
.chibi.is-sleep .c-blush { opacity: .35; }
.chibi.is-yawn .c-yawn { opacity: .9; }
.chibi.is-yawn .c-eye { opacity: 0; }
.chibi.is-yawn .c-eye-closed { opacity: 1; }
.chibi.is-flick .c-tongue { opacity: .9; }
.live.is-sleep .c-tail, .live.is-sleep .c-wing-l, .live.is-sleep .c-wing-r { animation: none; }
.live.is-sleep .c-body { animation: cb-sleepbreath 5.2s ease-in-out infinite; }
@keyframes cb-sleepbreath { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 1.06); } }
.chibi.is-sleep .c-all { transform: translateY(6px) scale(1.04, .9); }
.chibi.is-sleep .c-look { transform: translateY(8px) rotate(7deg) !important; }
.chibi.is-content .c-all { transform: rotate(calc(var(--lean, 0) * 1deg)) translateY(2px); transition: transform .3s ease-out; }

/* ---- acts (data-act on the stage) ---- */
.hero-stage[data-act="stretch"] .c-all { animation: cb-stretch 1.9s ease-in-out; }
.hero-stage[data-act="hop"] .c-all { animation: cb-hop .9s cubic-bezier(.3, .7, .4, 1); }
.hero-stage[data-act="hop"] .c-shadow { animation: cb-shadow .9s ease-out; }
.hero-stage[data-act="twirl"] .c-all { animation: cb-twirl 1.1s ease-in-out; }
.hero-stage[data-act="squish"] .c-all { animation: cb-squish 1.6s ease-in-out; }
.hero-stage[data-act="greet"] .c-all { animation: cb-greet 2.4s ease-in-out; }
.hero-stage[data-act="yawn"] .c-look { animation: cb-yawn 2.2s ease-in-out; }
.hero-stage[data-act="ear"] .c-ear-l, .hero-stage[data-act="ear"] .c-ear { animation: cb-ear .7s ease-in-out; }
.hero-stage[data-act="groom"] .c-look { animation: cb-groomhead 2.4s ease-in-out; }
.hero-stage[data-act="groom"] .c-paw { animation: cb-paw 2.4s ease-in-out; }
.hero-stage[data-act="chase"] .c-moth { animation: cb-moth 3.6s ease-in-out; }
.hero-stage[data-act="flick"] .c-tongue { animation: cb-tongue .9s ease-in-out 2; }
.hero-stage[data-care="water"] .c-look { animation: cb-sip 3.2s ease-in-out; }
.hero-stage[data-care="water"] .c-bowl { opacity: 1; transform: none; }
.hero-stage[data-care="water"] .c-ripple { animation: cb-ripple 1.3s ease-out 2; }
.hero-stage[data-care="candle"] .c-candle { opacity: 1; transform: none; }
.hero-stage[data-care="candle"] .c-warm { opacity: 1; }
.hero-stage[data-care="candle"] .c-flame { animation: cb-flame .6s ease-in-out infinite alternate; }
@keyframes cb-stretch { 0%, 100% { transform: scale(1, 1); } 35% { transform: scale(.94, 1.1); } 70% { transform: scale(1.06, .92); } }
@keyframes cb-hop { 0% { transform: translateY(0) scale(1.04, .94); } 35% { transform: translateY(-34px) scale(.96, 1.06); } 70% { transform: translateY(0) scale(1.05, .93); } 100% { transform: translateY(0); } }
@keyframes cb-shadow { 0%, 100% { transform: scale(1); opacity: .16; } 35% { transform: scale(.7); opacity: .08; } }
@keyframes cb-twirl { 0% { transform: translateY(0) scaleX(1); } 30% { transform: translateY(-26px) scaleX(0); } 60% { transform: translateY(-20px) scaleX(-1); } 100% { transform: translateY(0) scaleX(1); } }
@keyframes cb-squish { 0% { transform: scale(1); } 25% { transform: scale(1.1, .84); } 45% { transform: scale(1.04, .92); } 65% { transform: scale(1.09, .86); } 100% { transform: scale(1); } }
@keyframes cb-greet { 0% { transform: scale(1, .9); } 25% { transform: scale(.95, 1.09); } 50% { transform: translateY(-16px); } 70% { transform: translateY(0) scale(1.04, .95); } 100% { transform: scale(1); } }
@keyframes cb-yawn { 0%, 100% { transform: rotate(0) translateY(0); } 40%, 70% { transform: rotate(-5deg) translateY(-3px) scale(1.03); } }
@keyframes cb-ear { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-9deg); } 60% { transform: rotate(5deg); } }
@keyframes cb-groomhead { 0%, 100% { transform: rotate(0); } 30%, 80% { transform: rotate(7deg) translateY(3px); } }
@keyframes cb-paw { 0%, 100% { opacity: 0; transform: translate(0, 0); } 25%, 80% { opacity: 1; transform: translate(-6px, -34px); } 50% { opacity: 1; transform: translate(-6px, -30px) rotate(-8deg); } 65% { opacity: 1; transform: translate(-6px, -36px) rotate(6deg); } }
@keyframes cb-moth { 0% { opacity: 0; transform: translate(-30px, 30px); } 15% { opacity: .95; } 40% { transform: translate(70px, -20px); } 70% { transform: translate(150px, 14px); } 90% { opacity: .95; } 100% { opacity: 0; transform: translate(190px, -10px); } }
@keyframes cb-tongue { 0%, 100% { transform: scaleY(.2); } 50% { transform: scaleY(1); } }
@keyframes cb-sip { 0%, 100% { transform: rotate(0) translateY(0); } 15%, 35%, 55%, 75% { transform: rotate(5deg) translateY(10px); } 25%, 45%, 65% { transform: rotate(0) translateY(2px); } }
@keyframes cb-ripple { 0% { transform: scale(.4); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes cb-flame { 0% { transform: scale(1, 1); opacity: .95; } 100% { transform: scale(.9, 1.12); opacity: 1; } }

/* ---- hero stage ---- */
.hero { margin: 0 0 14px; }
.hero-stage { position: relative; height: clamp(236px, 66vw, 310px); border-radius: 26px; overflow: hidden; background: linear-gradient(180deg, #3f4f3a 0%, #55664c 62%, #6f8265 100%); isolation: isolate; }
.hero-glow { position: absolute; left: 50%; top: 40%; width: 86%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(248, 236, 190, calc(.18 + var(--glow, .4) * .5)) 0%, rgba(248, 236, 190, .08) 48%, rgba(248, 236, 190, 0) 70%); animation: cb-glow 7s ease-in-out infinite; z-index: 0; }
@keyframes cb-glow { 0%, 100% { opacity: .85; transform: translate(-50%, -50%) scale(1); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } }
.hero-rock { position: absolute; left: 50%; bottom: 0; width: 88%; transform: translateX(-50%); height: auto; z-index: 1; }
.hero-stars { position: absolute; inset: 0; z-index: 0; opacity: .5; }
.c-hit { position: absolute; left: 50%; bottom: 14%; width: clamp(160px, 46vw, 230px); aspect-ratio: 1; transform: translateX(-50%); background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; z-index: 3; border-radius: 40%; }
.c-hit:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 4px; }
.c-sparks { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.spark { position: absolute; width: 14px; height: 14px; opacity: 0; animation: cb-spark 1.5s ease-out forwards; }
@keyframes cb-spark { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 25% { opacity: .95; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1); } }
.c-bubble { position: absolute; left: 50%; top: 10px; max-width: 80%; transform: translate(-50%, 4px); margin: 0; padding: 6px 14px; border-radius: 99px; background: rgba(248, 243, 230, .94); color: var(--sage-700); font-family: var(--font-display); font-style: italic; font-size: .92rem; text-align: center; opacity: 0; transition: opacity .5s, transform .5s; z-index: 5; pointer-events: none; }
.c-bubble.show { opacity: 1; transform: translate(-50%, 0); }
.c-zz { position: absolute; left: calc(50% + 34px); top: 32%; z-index: 4; color: #f3e6b4; font-family: var(--font-display); font-size: 1.1rem; opacity: 0; pointer-events: none; }
.hero-stage.asleep .c-zz { animation: cb-zz 4.2s ease-in-out infinite; }
@keyframes cb-zz { 0% { opacity: 0; transform: translate(0, 10px); } 40% { opacity: .85; } 100% { opacity: 0; transform: translate(10px, -16px); } }
.c-moth { position: absolute; left: 6%; top: 34%; width: 22px; opacity: 0; z-index: 4; pointer-events: none; }
.c-bowl { position: absolute; left: 50%; bottom: 7%; width: 96px; margin-left: -48px; opacity: 0; transform: translateY(10px); transition: opacity .5s, transform .5s; z-index: 4; pointer-events: none; }
.c-ripple { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; }
.c-candle { position: absolute; right: 7%; bottom: 12%; width: 34px; opacity: 0; transform: translateY(8px); transition: opacity .6s, transform .6s; z-index: 4; pointer-events: none; }
.c-flame { transform-box: fill-box; transform-origin: 50% 100%; }
.c-warm { position: absolute; inset: 0; z-index: 4; opacity: 0; transition: opacity .8s; pointer-events: none; background: radial-gradient(circle at 56% 50%, rgba(255, 196, 110, .34) 0%, rgba(255, 196, 110, .12) 40%, rgba(255, 196, 110, 0) 66%); }
.hero-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 4px 2px; font-size: .88rem; color: var(--ink-soft); }
.hero-meta a { color: var(--sage-700); }
.bond-line { height: 5px; background: var(--sage-200); border-radius: 99px; overflow: hidden; margin: 4px 4px 10px; }
.bond-line span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.hero .care-row { margin-top: 4px; }
.hero.hero-empty .hero-stage { opacity: .96; }
.hero-invite { display: block; text-align: center; margin: 6px 0 0; }
.familiar-art svg { width: 180px; height: 180px; margin: 0 auto; display: block; }
.lineup { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lineup figure { margin: 0; text-align: center; }
.lineup svg { width: 100%; height: auto; }
.paused *, .paused { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .chibi *, .hero-stage *, .hero-glow, .spark, .c-bubble { animation: none !important; }
  .chibi .c-look, .chibi .c-pupil { transition: none; }
  .spark { opacity: .85; }
}
