/* KishMat 58.57: layered SVG expressions and organic motion, not a video/GIF.
   Separate poses + expression phases. Presentation only: no gameplay changes. */
.mastery-shell .mastery-mascot-hero{isolation:isolate}
.mastery-shell .mastery-mascot-hero::after{content:'';position:absolute;inset:8% 11%;border-radius:50%;pointer-events:none;z-index:-1;background:radial-gradient(ellipse,#57dea62c,transparent 69%);animation:km57-halo-breathe 5.3s ease-in-out infinite}
.mastery-shell [data-mastery-mascot] .mastery-companion-svg{animation:km57-lifelike 5.8s cubic-bezier(.42,.05,.48,.95) infinite!important;filter:drop-shadow(0 12px 13px #075b4645)}
.mastery-shell [data-mastery-mascot] .mastery-companion-body{transform-origin:120px 204px;transform-box:view-box;animation:km57-breath 4.6s ease-in-out infinite}
.mastery-shell [data-mastery-mascot] .companion-eye-unit{transition:transform .34s cubic-bezier(.22,.8,.32,1),opacity .3s ease;transform-origin:center;transform-box:fill-box}
.mastery-shell [data-mastery-mascot][data-blink="yes"] .companion-eye-unit{transform:scaleY(.055)!important}
.mastery-shell [data-mastery-mascot] .companion-eyebrow{transform-origin:center;transform-box:fill-box;transition:transform .42s cubic-bezier(.24,.82,.32,1),opacity .3s ease}
.mastery-shell [data-mastery-mascot] .companion-cape{opacity:0;transform-origin:120px 146px;transition:opacity .5s ease;pointer-events:none}
.mastery-shell[data-companion-rank="explorer"] .companion-cape,.mastery-shell[data-companion-rank="hero"] .companion-cape{opacity:1}
.mastery-shell [data-mastery-mascot] .companion-rank-jewel,.mastery-shell [data-mastery-mascot] .companion-rank-wreath{opacity:0;transition:opacity .5s ease}
.mastery-shell[data-companion-rank="explorer"] .companion-rank-jewel,.mastery-shell[data-companion-rank="hero"] .companion-rank-jewel,.mastery-shell[data-companion-rank="hero"] .companion-rank-wreath{opacity:1}
.mastery-shell[data-companion-rank="hero"] .companion-cape{filter:drop-shadow(0 1px 5px #ebce645d)}
.mastery-shell [data-mastery-mascot] .companion-mouth{opacity:1;transition:opacity .34s ease,transform .42s cubic-bezier(.24,.82,.32,1)}
.mastery-shell [data-mastery-mascot] .companion-mouth-wide,.mastery-shell [data-mastery-mascot] .companion-mouth-surprise,.mastery-shell [data-mastery-mascot] .companion-mouth-pensive,.mastery-shell [data-mastery-mascot] .companion-smile-eye{opacity:0;transition:opacity .34s ease,transform .42s cubic-bezier(.24,.82,.32,1)}
.mastery-shell [data-mastery-mascot][data-mood="thinking"] .companion-mouth{opacity:.38;transform:translateY(1px)}
.mastery-shell [data-mastery-mascot][data-mood="oops"] .companion-mouth{opacity:.18}
.mastery-shell [data-mastery-mascot][data-mood="thinking"] .companion-mouth-pensive,.mastery-shell [data-mastery-mascot][data-mood="oops"] .companion-mouth-pensive{opacity:1;transform:translateY(1px)}
.mastery-shell [data-mastery-mascot][data-mood="thinking"] .companion-eyebrow{transform:translateY(-2px) rotate(-4deg)}
.mastery-shell [data-mastery-mascot][data-mood="happy"] .companion-mouth,.mastery-shell [data-mastery-mascot][data-mood="encouraging"] .companion-mouth,.mastery-shell [data-mastery-mascot][data-mood="victory"] .companion-mouth,.mastery-shell [data-mastery-mascot][data-mood="worldComplete"] .companion-mouth{opacity:0}
.mastery-shell [data-mastery-mascot][data-mood="happy"] .companion-mouth-wide,.mastery-shell [data-mastery-mascot][data-mood="encouraging"] .companion-mouth-wide,.mastery-shell [data-mastery-mascot][data-mood="victory"] .companion-mouth-wide,.mastery-shell [data-mastery-mascot][data-mood="worldComplete"] .companion-mouth-wide{opacity:1}
.mastery-shell [data-mastery-mascot][data-mood="happy"] .companion-eye-unit,.mastery-shell [data-mastery-mascot][data-mood="victory"] .companion-eye-unit,.mastery-shell [data-mastery-mascot][data-mood="worldComplete"] .companion-eye-unit{opacity:0}
.mastery-shell [data-mastery-mascot][data-mood="happy"] .companion-smile-eye,.mastery-shell [data-mastery-mascot][data-mood="victory"] .companion-smile-eye,.mastery-shell [data-mastery-mascot][data-mood="worldComplete"] .companion-smile-eye{opacity:1}
.mastery-shell [data-mastery-mascot][data-beat="notice"] .companion-mouth-wide,.mastery-shell [data-mastery-mascot][data-beat="notice"] .companion-mouth-pensive{opacity:0}
.mastery-shell [data-mastery-mascot][data-beat="notice"] .companion-mouth-surprise{opacity:1}
.mastery-shell [data-mastery-mascot][data-beat="notice"] .companion-eye-unit{opacity:1;transform:scale(1.12)!important}
.mastery-shell [data-mastery-mascot][data-beat="notice"] .companion-smile-eye{opacity:0}
.mastery-shell [data-mastery-mascot][data-mood="oops"] .companion-eyebrow{transform:rotate(10deg) translateY(3px)}
.mastery-shell [data-mastery-mascot][data-mood="oops"] .companion-eye-unit{transform:translateY(-2px)}
.mastery-shell [data-mastery-mascot][data-mood="oops"][data-beat="notice"] .companion-mouth-surprise{opacity:1}
.mastery-shell [data-mastery-mascot][data-beat="reassure"] .companion-mouth{opacity:.92}
.mastery-shell [data-mastery-mascot][data-beat="reassure"] .companion-mouth-surprise,.mastery-shell [data-mastery-mascot][data-beat="reassure"] .companion-mouth-pensive{opacity:0}
.mastery-shell [data-mastery-mascot][data-pose="look-left"] .companion-eye-unit{transform:translateX(-3px)}
.mastery-shell [data-mastery-mascot][data-pose="look-right"] .companion-eye-unit{transform:translateX(3px)}
.mastery-shell [data-mastery-mascot][data-mood="idle"] .companion-mouth{transform:translateY(0)}
.mastery-shell [data-mastery-mascot][data-mood="idle"] .companion-mouth-pensive{opacity:0}
.mastery-shell [data-mastery-mascot][data-pose="tilt"] .mastery-companion-body{animation:km57-ponder 1.15s ease-in-out both}
.mastery-shell [data-mastery-mascot][data-pose="nod"] .mastery-companion-body{animation:km57-nod 1.15s ease-in-out both}
.mastery-shell [data-mastery-mascot][data-pose="stretch"] .mastery-companion-arm{animation:km57-wave 1.2s ease-in-out}
.mastery-shell [data-mastery-mascot] .mastery-companion-arm{transform-box:fill-box;transform-origin:center 15%;transition:transform .44s cubic-bezier(.22,.82,.3,1)}
.mastery-shell [data-mastery-mascot][data-mood="thinking"] .companion-arm-right{transform:translate(-8px,-9px) rotate(-14deg)}
.mastery-shell [data-mastery-mascot][data-beat="celebrate"] .companion-arm-left{transform:rotate(-31deg) translateY(-6px)}
.mastery-shell [data-mastery-mascot][data-beat="celebrate"] .companion-arm-right{transform:rotate(32deg) translateY(-7px)}
.mastery-shell [data-mastery-mascot][data-beat="reassure"] .companion-arm-right{transform:rotate(-14deg)}
.mastery-shell [data-mastery-mascot][data-beat="triumph"] .companion-arm-left{transform:rotate(-43deg) translateY(-9px)}
.mastery-shell [data-mastery-mascot][data-beat="triumph"] .companion-arm-right{transform:rotate(43deg) translateY(-9px)}
.mastery-shell [data-mastery-mascot][data-mood="happy"][data-beat="celebrate"] .mastery-companion-svg,.mastery-shell [data-mastery-mascot][data-mood="encouraging"][data-beat="celebrate"] .mastery-companion-svg,.mastery-shell [data-mastery-mascot][data-mood="victory"][data-beat="celebrate"] .mastery-companion-svg,.mastery-shell [data-mastery-mascot][data-mood="worldComplete"][data-beat="celebrate"] .mastery-companion-svg{animation:km57-cheer 1.25s cubic-bezier(.23,.85,.4,1) both!important}
.mastery-shell [data-mastery-mascot][data-mood="oops"][data-beat="notice"] .mastery-companion-svg{animation:km57-gentle-oops .7s ease-in-out both!important}
.mastery-shell [data-mastery-mascot][data-beat="triumph"] .mastery-companion-svg{animation:km57-grand-win 1.55s cubic-bezier(.2,.9,.38,1) both!important}
.mastery-shell [data-mastery-mascot][data-beat="settle"] .mastery-companion-svg{animation:km57-settle 1s ease-out both!important}
.mastery-shell [data-mastery-mascot] .companion-emotion-particles{opacity:0;transition:opacity .2s ease;transform-origin:120px 120px;transform-box:view-box}
.mastery-shell [data-mastery-mascot][data-beat="celebrate"] .companion-emotion-particles,.mastery-shell [data-mastery-mascot][data-beat="triumph"] .companion-emotion-particles{opacity:1;animation:km57-particles 1.4s ease-in-out infinite alternate}
.mastery-shell .mastery-companion-level{position:absolute;bottom:4px;right:50%;transform:translateX(50%);white-space:nowrap;padding:5px 13px;border:1px solid #ffffffab;border-radius:999px;color:#115c45;background:linear-gradient(110deg,#fffceded,#fff5c5ee);box-shadow:0 5px 17px #0a614d23;font-size:.75rem;font-weight:900;z-index:5;pointer-events:none}
.mastery-shell[data-companion-rank="explorer"] .mastery-companion-level{background:linear-gradient(110deg,#dcfff0,#a5f4df)}
.mastery-shell[data-companion-rank="hero"] .mastery-companion-level{background:linear-gradient(110deg,#fff2bd,#e8ba67);color:#694213}
.mastery-shell .mastery-mascot-assistant{transition:box-shadow .3s,border-color .3s}
.mastery-shell .mastery-mascot-assistant[data-beat="celebrate"],.mastery-shell .mastery-mascot-assistant[data-beat="triumph"]{border-color:#d7b05e;box-shadow:0 0 0 3px #f2cc6a45,0 12px 29px #cfb65a2e}
.mastery-shell .mastery-mascot-assistant[data-mood="thinking"]{border-color:#73c9b9}
.mastery-shell .mastery-mascot-assistant[data-mood="oops"]{border-color:#e1c69e}
.mastery-shell .mastery-assistant-speech{transition:opacity .25s ease;max-width:100%;min-width:0;text-wrap:pretty}
.mastery-shell .mastery-assistant-pawn{overflow:visible;isolation:isolate}
html[data-theme="dark"] .mastery-shell .mastery-companion-level{background:linear-gradient(115deg,#27463d,#395f51);color:#dfffea;border-color:#68a68a}
html[data-theme="dark"] .mastery-shell[data-companion-rank="hero"] .mastery-companion-level{background:linear-gradient(115deg,#624c2e,#795f32);color:#fff3c1;border-color:#c0a66b}
@keyframes km57-halo-breathe{0%,100%{transform:scale(.91);opacity:.64}55%{transform:scale(1.06);opacity:1}}
@keyframes km57-lifelike{0%,100%{transform:translateY(1px) rotate(-.5deg)}26%{transform:translateY(-4px) rotate(.65deg)}55%{transform:translateY(-7px) rotate(-.45deg)}78%{transform:translateY(-3px) rotate(.75deg)}}
@keyframes km57-breath{0%,100%{transform:scale(1,1)}52%{transform:scale(1.019,.993)}}
@keyframes km57-ponder{0%,100%{transform:rotate(0)}40%{transform:rotate(-5deg)}75%{transform:rotate(-3deg)}}
@keyframes km57-nod{0%,100%{transform:translateY(0)}35%{transform:translateY(5px)}65%{transform:translateY(-3px)}}
@keyframes km57-wave{0%,100%{transform:rotate(0)}30%{transform:rotate(-10deg)}70%{transform:rotate(8deg)}}
@keyframes km57-cheer{0%{transform:translateY(0) rotate(0) scale(1)}20%{transform:translateY(3px) scale(.96,1.04)}48%{transform:translateY(-16px) rotate(-7deg) scale(1.06)}68%{transform:translateY(-9px) rotate(5deg)}82%{transform:translateY(1px) scale(.97,1.03)}100%{transform:translateY(-3px) scale(1)}}
@keyframes km57-grand-win{0%{transform:translateY(0) scale(1)}14%{transform:translateY(5px) scale(.91,1.06)}42%{transform:translateY(-22px) rotate(-12deg) scale(1.08)}65%{transform:translateY(-16px) rotate(9deg) scale(1.07)}84%{transform:translateY(1px) rotate(-3deg)}100%{transform:translateY(-7px) rotate(0)}}
@keyframes km57-gentle-oops{0%,100%{transform:rotate(0) translateY(0)}28%{transform:rotate(-5deg) translateY(2px)}66%{transform:rotate(4deg) translateY(3px)}}
@keyframes km57-settle{0%{transform:translateY(-7px) rotate(2deg)}55%{transform:translateY(2px) rotate(-1deg)}100%{transform:translateY(0) rotate(0)}}
@keyframes km57-particles{0%{transform:scale(.85) rotate(-8deg);opacity:.4}100%{transform:scale(1.12) rotate(10deg);opacity:1}}
@media(min-width:800px) and (min-height:660px){.mastery-shell .mastery-assistant-pawn{width:clamp(110px,10vw,144px);min-width:clamp(110px,10vw,144px);flex-basis:clamp(110px,10vw,144px);height:clamp(115px,11vw,152px)}.mastery-shell .mastery-mascot-assistant{min-height:135px}}
@media(max-width:799px) and (min-height:680px){.mastery-shell .mastery-assistant-pawn{width:clamp(76px,21vw,104px);min-width:clamp(76px,21vw,104px);flex-basis:clamp(76px,21vw,104px);height:clamp(78px,21vw,108px)}.mastery-shell .mastery-mascot-assistant{min-height:85px}}
@media(max-width:680px){.mastery-shell .mastery-companion-level{bottom:-3px;font-size:.65rem;padding:4px 9px}}
@media(max-height:680px) and (max-width:799px){.mastery-shell .mastery-assistant-pawn{min-width:54px;width:54px;flex-basis:54px;height:56px}.mastery-shell .mastery-mascot-assistant{min-height:58px}}
@media(max-height:450px){.mastery-shell .mastery-assistant-pawn{min-width:38px;width:38px;flex-basis:38px;height:40px}.mastery-shell .mastery-mascot-assistant{min-height:42px}}
@media(prefers-reduced-motion:reduce){.mastery-shell [data-mastery-mascot] .mastery-companion-svg,.mastery-shell [data-mastery-mascot] .mastery-companion-body,.mastery-shell [data-mastery-mascot] .companion-emotion-particles,.mastery-shell [data-mastery-mascot] .mastery-companion-arm,.mastery-shell .mastery-mascot-hero::after{animation:none!important;transition:none!important;will-change:auto!important}}
