#cato-companion{position:fixed;right:18px;bottom:18px;width:172px;z-index:20;background:#fff8e9;border:1px solid #d2c4a1;border-radius:24px;box-shadow:0 8px 28px #243d4220;padding:8px;text-align:center;overflow:hidden}#companion-help{display:block;width:100%;padding:0;background:transparent;border:0;border-radius:18px}#companion-help>svg{display:block;width:136px;height:182px;margin:auto;transform-origin:50% 95%;border-radius:18px}#cato-companion strong{font-size:18px}#cato-companion p{font-size:13px;line-height:1.4;margin:3px 0}#cato-companion span{font-size:12px;color:#526862}#companion-hide{min-height:36px;font-size:12px;padding:4px 12px;margin-top:6px}#companion-settings{max-width:440px;width:calc(100% - 32px);max-height:85dvh;overflow:auto;border:1px solid #c9b787;border-radius:24px;padding:24px;background:#fffaf0;color:#243d42}#companion-settings::backdrop{background:#14373180}.companion-check{display:flex;align-items:center;gap:12px}.companion-check input{flex:0 0 28px}body.companion-visible main{max-width:calc(100% - 210px);margin-left:auto;margin-right:210px}#cato-companion[data-motion=on][data-state=idle] svg{animation:cato-breathe 6s ease-in-out infinite}#cato-companion[data-motion=on][data-state=speaking] svg{animation:cato-speak 1.1s ease-in-out infinite}#cato-companion[data-state=listening]{border-color:#297b73;box-shadow:0 0 0 3px #9dd8ce}#cato-companion.companion-greet[data-motion=on] svg{animation:cato-greet .8s ease-in-out}body:has(dialog[open]) #cato-companion svg{animation-play-state:paused!important}@keyframes cato-breathe{50%{transform:translateY(-3px)}}@keyframes cato-speak{50%{transform:translateY(-2px) rotate(1deg)}}@keyframes cato-greet{50%{transform:translateY(-5px) rotate(-2deg)}}@media(min-width:1450px){body.companion-visible main{max-width:1020px;margin-left:auto;margin-right:auto}}@media(max-width:900px){body.companion-visible main{max-width:1020px;margin:16px auto;padding-bottom:150px}#cato-companion{right:12px;bottom:10px;width:240px;padding:6px;display:flex;align-items:center;gap:2px}#companion-help{display:flex;align-items:center;gap:8px;text-align:left}#companion-help>svg{width:59px;height:94px;flex:0 0 59px}#companion-hide{align-self:start;margin:0;padding:4px;min-width:38px}.companion-words{flex:1}}@media(prefers-reduced-motion:reduce){#cato-companion svg{animation:none!important}}@media print{#cato-companion,#companion-choose{display:none!important}}
#companion-help>svg{overflow:visible;border-radius:0;animation:none!important}
.cato-stage{transform-origin:100px 286px;transition:transform .35s ease}
.cato-head{transform-origin:100px 120px;transition:transform .4s ease}
.cato-body,.cato-head,.cato-prop{transition:opacity .18s ease}
#cato-companion[data-motion=on][data-state=idle] .cato-stage{animation:cato-breath 6s ease-in-out infinite}
#cato-companion[data-motion=on][data-state=talking] .cato-stage{animation:cato-talking 2.8s ease-in-out infinite}
#cato-companion[data-motion=on][data-state=celebrating] .cato-stage{animation:cato-celebrate .85s ease-in-out 2}
#cato-companion[data-motion=on][data-state=walking] .cato-stage{animation:cato-step .66s ease-in-out infinite}
#cato-companion[data-motion=on][data-state=goodbye] .cato-stage{animation:cato-wave 1.5s ease-in-out 2}
#cato-companion[data-motion=on][data-gesture=look] .cato-head{animation:cato-look 2.3s ease-in-out}
#cato-companion[data-motion=on][data-gesture=shift] .cato-stage{animation:cato-shift 2.3s ease-in-out}
#cato-companion[data-motion=on][data-gesture=nod] .cato-head{animation:cato-nod 2.3s ease-in-out}
#cato-companion[data-motion=off] svg *{animation:none!important;transition:none!important}
body:has(dialog[open]) #cato-companion svg *{animation-play-state:paused!important}
@keyframes cato-breath{50%{transform:translateY(-1px) scaleY(1.008)}}
@keyframes cato-talking{50%{transform:rotate(.6deg) translateY(-1px)}}
@keyframes cato-celebrate{50%{transform:translateY(-7px) rotate(-2deg)}}
@keyframes cato-step{50%{transform:translateY(-3px) translateX(3px)}}
@keyframes cato-wave{50%{transform:rotate(2deg)}}
@keyframes cato-look{35%{transform:rotate(-3deg)}70%{transform:rotate(2deg)}}
@keyframes cato-shift{50%{transform:translateX(3px) rotate(1deg)}}
@keyframes cato-nod{50%{transform:translateY(2px) rotate(-1deg)}}
@media(prefers-reduced-motion:reduce){#cato-companion svg *{animation:none!important;transition:none!important}}

.cato-hat{transform-box:fill-box;transform-origin:center bottom;animation:cato-hat-tip 2.3s ease-in-out}.cato-glasses{animation:cato-glasses-settle 2.3s ease-in-out}@keyframes cato-hat-tip{50%{rotate:-2deg;translate:0 -1px}}@keyframes cato-glasses-settle{50%{translate:0 -1px}}

/* Floating pet: original alpha artwork, no enclosing card or rectangular chrome. */
#cato-companion{top:100px;bottom:auto;right:20px;width:140px;background:transparent;border:0;border-radius:0;box-shadow:none;padding:0;overflow:visible;display:block}
#cato-companion[data-state=listening]{border:0;box-shadow:none}
#companion-help,#companion-help:hover,#companion-help:active,#companion-help:focus{display:block;width:140px;background:transparent;border:0;box-shadow:none;border-radius:0;padding:0;outline:none}
#companion-help:focus-visible{outline:2px dashed #2878bc;outline-offset:4px;border-radius:50%}
#companion-help>svg{width:140px;height:217px;filter:drop-shadow(0 3px 2px #152c2520)}
#companion-help::after{content:'';display:block;width:22px;height:5px;border-radius:50%;background:#33483d55;margin:-4px auto 0}
#cato-companion[data-state=listening] #companion-help::after{background:#267f70}
#cato-companion[data-state=talking] #companion-help::after,#cato-companion[data-state=reading] #companion-help::after{background:#aa7827}
.companion-words{position:absolute;right:calc(100% + 6px);top:35px;width:158px;background:#fffdf5;border:1px solid #d7d8c8;border-radius:14px;padding:9px;opacity:0;pointer-events:none;transform:translateX(4px);transition:opacity .15s,transform .15s}
#companion-help:hover .companion-words,#companion-help:focus-visible .companion-words{opacity:1;transform:none}
#companion-hide{position:absolute;right:0;top:0;min-height:28px;padding:3px 7px;margin:0;font-size:11px;background:#ffffffd9;border:1px solid #bfd0c3;border-radius:20px;opacity:0}
#cato-companion:hover #companion-hide,#cato-companion:focus-within #companion-hide,#companion-hide:focus-visible{opacity:1}
.cato-body{transition:transform .18s ease-out}
#cato-companion[data-motion=on][data-gesture=look] .cato-stage{animation:cato-look 2.3s ease-in-out}
#cato-companion[data-motion=on][data-gesture=nod] .cato-stage{animation:cato-nod 2.3s ease-in-out}
@keyframes cato-breath{50%{transform:translateY(-1.5px)}}
@keyframes cato-look{50%{transform:rotate(-1deg)}}
@keyframes cato-nod{50%{transform:translateY(1px) rotate(.5deg)}}
@media(max-width:900px){#cato-companion{top:auto;bottom:18px;right:12px;width:88px}#companion-help{width:88px}#companion-help>svg{width:88px;height:137px}body.companion-visible main{padding-bottom:185px}#companion-help .companion-words{top:10px;width:150px}#companion-hide{top:-8px}}
@media(hover:none){#companion-hide{opacity:1}}
#companion-help{touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}
#cato-companion[data-dragging=true] #companion-help{cursor:grabbing}
#cato-companion[data-dragging=true] .companion-words{opacity:0}
#cato-companion[data-dragging=true] .cato-stage{animation-play-state:paused!important}
#cato-companion[data-side=left] .companion-words{left:calc(100% + 6px);right:auto}
/* One continuous idle/speech motion avoids restarting the loop at each voice event. */
#cato-companion[data-motion=on]:is([data-state=idle],[data-state=listening],[data-state=thinking],[data-state=talking]) .cato-stage{animation:cato-flow 5.2s ease-in-out infinite}
@keyframes cato-flow{0%,100%{transform:translateY(0) rotate(-.3deg)}50%{transform:translateY(-2px) rotate(.3deg)}}
.companion-moves{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}.companion-moves button{font-size:14px;min-height:44px}

#companion-hide{min-width:44px;min-height:44px;font-size:13px}
