/* QAI assistant mascot in the bottom-right corner */
#qumu{position:fixed;z-index:24;right:8px;bottom:6px;width:96px;aspect-ratio:1.093;pointer-events:none;transition:right .3s cubic-bezier(.2,.8,.2,1)}
#qumu:not(.ready),body.locked #qumu,body.locked #qumuChat{display:none}
/* step aside while the output panel is open so the assistant never covers it */
body:has(#con.open) #qumu,body:has(#con.open) #qumuChat{right:calc(min(540px,100vw) + 14px)}
.qumu-btn{position:absolute;inset:0;padding:0;border:0;background:none;cursor:pointer;pointer-events:auto;border-radius:24px}
.qumu-btn:focus-visible{outline:3px solid color-mix(in srgb,var(--a,#0a6cc2) 55%,transparent);outline-offset:2px}
.qumu-btn:before{content:"";position:absolute;left:22%;right:26%;bottom:-2px;height:9px;border-radius:50%;background:rgba(20,60,120,.18);filter:blur(2px);animation:qumuShadow 3s ease-in-out infinite alternate}
.q-fig{position:absolute;inset:0;animation:qumuFloat 3s ease-in-out infinite alternate;transform-origin:50% 100%}
.q-fig img{position:absolute;inset:0;width:100%;height:100%;user-select:none;-webkit-user-drag:none}
.q-hand{transform-origin:12% 47.5%}
.qumu-btn:hover .q-fig{filter:drop-shadow(0 6px 14px rgba(20,110,230,.35))}
/* sound rings from the headset mic while talking */
.q-rings{position:absolute;left:63%;top:47%;width:0;height:0;opacity:0}
.q-rings i{position:absolute;left:-6px;top:-6px;width:12px;height:12px;border-radius:50%;border:1.5px solid #2aa8ff;animation:qumuRing 1.1s ease-out infinite}
.q-rings i:nth-child(2){animation-delay:.37s}.q-rings i:nth-child(3){animation-delay:.74s}

#qumu.talk .q-fig{animation:qumuTalk .36s ease-in-out infinite alternate}
#qumu.talk .q-rings{opacity:1}
#qumu.happy .q-fig{animation:qumuHop .5s ease-out 2}

/* reactions: a pose image stands in for the default figure, a little larger so its props read */
.q-fig img.q-react{inset:auto 0 0 auto;width:var(--qs,128%);height:auto;max-width:none;transform-origin:50% 100%;pointer-events:none}
#qumu[data-react] .q-fig>img:not(.q-react),#qumu[data-react] .q-rings{visibility:hidden}
#qumu[data-react=hello]{--qs:158%}
/* Compensate for transparent padding so every pose stays aligned to the window edge. */
#qumu[data-react=hello] .q-react{right:-18.5%}
#qumu[data-react=wave] .q-react{right:-8.5%}
#qumu[data-react=peek] .q-react{right:-23.1%}
#qumu[data-react=curious] .q-react{right:-18.5%}
#qumu[data-react=working] .q-react{right:-13.9%}
#qumu[data-react=thumbsup] .q-react{right:-15.6%}
#qumu[data-react=cheer] .q-react,#qumu[data-react=coffee] .q-react{right:-19.2%}
/* stays below the chat window while it is open */
body:has(#qumuChat.open) #qumu{--qs:96%}
body:has(#qumuChat.open) #qumu[data-react] .q-react{right:0}
#qumu[data-react] .qumu-bubble{bottom:calc(100% + 34px)}
#qumu[data-react=hello] .qumu-bubble{bottom:calc(100% + 62px)}
#qumu[data-react=hello] .q-react{animation:qumuPop .32s ease-out,qumuSway 1.6s .32s ease-in-out infinite alternate}
#qumu[data-react=wave] .q-react{animation:qumuWiggle 1.6s ease-in-out}
#qumu[data-react=peek] .q-react{animation:qumuPeek 2.8s cubic-bezier(.2,.8,.2,1) both}
#qumu[data-react=curious] .q-react{animation:qumuPop .28s ease-out,qumuTilt 1.2s .28s ease-in-out infinite alternate}
#qumu[data-react=working] .q-react{animation:qumuPop .28s ease-out,qumuType .3s .28s ease-in-out infinite alternate}
#qumu[data-react=thumbsup] .q-react{animation:qumuPop .28s ease-out,qumuDrift 1.3s .28s ease-in-out infinite alternate}
#qumu[data-react=cheer] .q-react{animation:qumuPop .2s ease-out,qumuLeap .7s .2s cubic-bezier(.2,.8,.2,1) 3}
#qumu[data-react=coffee] .q-react{animation:qumuPop .4s ease-out,qumuBreathe 2.6s .4s ease-in-out infinite alternate}
@keyframes qumuFloat{to{transform:translateY(-6px)}}
@keyframes qumuShadow{to{transform:scaleX(.88);opacity:.7}}
@keyframes qumuPop{from{opacity:0;transform:scale(.8)}}
@keyframes qumuSway{from{transform:rotate(-2deg)}to{transform:rotate(2deg)}}
@keyframes qumuWiggle{0%{opacity:0;transform:scale(.8)}12%{opacity:1;transform:none}30%,70%{transform:rotate(-4deg)}50%,90%{transform:rotate(4deg)}100%{transform:none}}
/* Peek from the right edge, then duck back. */
@keyframes qumuPeek{0%,100%{transform:translateX(38%) scaleX(-1);clip-path:inset(0 56% 0 0)}22%,82%{transform:scaleX(-1);clip-path:inset(0)}}
@keyframes qumuTilt{from{transform:rotate(-3deg)}to{transform:rotate(3deg)}}
@keyframes qumuType{to{transform:translateY(-2px)}}
@keyframes qumuDrift{from{transform:translateY(0) rotate(-2deg)}to{transform:translateY(-6px) rotate(2deg)}}
@keyframes qumuLeap{45%{transform:translateY(-18px) scale(1.03)}}
@keyframes qumuBreathe{to{transform:scale(1.025)}}
@keyframes qumuTalk{from{transform:translateY(0) scale(1)}to{transform:translateY(-3px) scale(1.015)}}
@keyframes qumuHop{50%{transform:translateY(-14px)}}
@keyframes qumuRing{from{transform:scale(.4);opacity:1}to{transform:scale(2.6);opacity:0}}

/* guided walkthrough: the traced line, the rings on the buttons and the step card. Only the card takes clicks. */
.qg{position:fixed;inset:0;z-index:40;pointer-events:none}.qg[hidden]{display:none}
.qg-line{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.qg-line>path{fill:none;stroke:var(--a,#1677e5);stroke-width:3;stroke-linecap:round;stroke-dasharray:2 9;animation:qgTrace .6s linear infinite}
.qg-line marker path{fill:var(--a,#1677e5)}
.qg-rings i{position:fixed;border-radius:14px;border:3px solid var(--a,#1677e5);box-shadow:0 0 0 4px color-mix(in srgb,var(--a,#1677e5) 22%,transparent);animation:qgPulse 1.3s ease-in-out infinite}
.qg-tip{position:fixed;left:0;top:0;width:min(330px,calc(100vw - 24px));padding:12px 14px;border-radius:14px;background:var(--solid,#fff);color:var(--ink,#12233a);border:1px solid var(--line,rgba(0,0,0,.1));box-shadow:0 18px 44px -12px rgba(20,60,120,.45);pointer-events:auto;font:500 .88rem/1.45 var(--font,system-ui)}
.qg-text{margin:0;color:inherit}
.qg-crumbs{display:flex;flex-wrap:wrap;gap:2px 4px;margin-bottom:6px;color:var(--muted,#55667a);font-size:.7rem}
.qg-crumbs span:not(:last-child):after{content:" ›";margin-left:4px}
.qg-crumbs .done{opacity:.6}.qg-crumbs .on{color:var(--a,#1677e5);font-weight:700}
.qg-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.qg-actions button{padding:4px 11px;border:1px solid var(--line2,rgba(0,0,0,.18));border-radius:999px;background:var(--surface,#fff);color:var(--ink,#12233a);font:500 .76rem var(--font,system-ui);cursor:pointer}
.qg-actions .primary{border-color:var(--a,#1677e5);background:var(--a,#1677e5);color:#fff}
.qc-guide-choices{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.qc-guide-choices button{padding:5px 10px;border:1px solid #b9d8fb;border-radius:999px;background:#eef6ff;color:#0f5bb5;font:500 .76rem var(--font,system-ui);cursor:pointer}
.qc-guide-choices button:hover{background:#dcecff}
@keyframes qgTrace{to{stroke-dashoffset:-11}}
@keyframes qgPulse{50%{box-shadow:0 0 0 9px color-mix(in srgb,var(--a,#1677e5) 8%,transparent)}}
@media(prefers-reduced-motion:reduce){.qg-line>path,.qg-rings i{animation:none}}
[data-mode=dark] .qc-guide-choices button{border-color:rgba(74,168,240,.35);background:rgba(74,168,240,.12);color:#8cc8ff}

/* speech bubble */
.qumu-bubble{position:absolute;right:14px;bottom:calc(100% + 6px);width:max-content;max-width:min(270px,calc(100vw - 40px));padding:10px 14px;border-radius:16px;background:#fff;color:#1d2a3a;font:500 .86rem/1.45 var(--font,system-ui);box-shadow:0 10px 30px -8px rgba(20,60,120,.35),0 0 0 1px rgba(20,60,120,.08);transform:translateY(6px) scale(.96);transform-origin:85% 100%;opacity:0;transition:opacity .2s,transform .2s,bottom .2s;pointer-events:none}
.qumu-bubble:after{content:"";position:absolute;right:30px;bottom:-7px;width:14px;height:14px;background:#fff;transform:rotate(45deg);box-shadow:3px 3px 4px -2px rgba(20,60,120,.15)}
.qumu-bubble.on{opacity:1;transform:none}

/* chat window */
#qumuChat{position:fixed;z-index:26;right:16px;bottom:106px;width:min(370px,calc(100vw - 32px));max-height:min(560px,calc(100dvh - 126px));display:none;flex-direction:column;overflow:hidden;border-radius:18px;background:var(--solid,#fff);color:var(--ink,#12233a);border:1px solid var(--line,rgba(0,0,0,.1));box-shadow:0 24px 60px -16px rgba(20,60,120,.4);transition:right .3s cubic-bezier(.2,.8,.2,1)}
#qumuChat.open{display:flex;animation:qumuIn .22s ease-out}
@keyframes qumuIn{from{opacity:0;transform:translateY(12px) scale(.98)}}
.qc-head{display:flex;align-items:center;gap:10px;padding:12px 12px 12px 14px;background:linear-gradient(135deg,#2f95f5,#1463d6);color:#fff}
.qc-avatar{position:relative;flex:none;width:42px;height:42px;border-radius:50%;background:#eaf4ff;overflow:hidden}
.qc-avatar img{position:absolute;left:2px;top:4px;width:40px;height:auto}
.qc-title{flex:1;min-width:0;line-height:1.2}.qc-title b{display:block;font-size:1rem}.qc-title small{font-size:.75rem;opacity:.85}
.qc-icon{display:grid;place-items:center;width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:#fff;cursor:pointer}
.qc-icon:hover{background:rgba(255,255,255,.2)}
.qc-icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.qc-log{flex:1;min-height:160px;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:8px;background:var(--sunk,#f6f8fb)}
.qc-msg{max-width:86%;padding:8px 12px;border-radius:14px;font-size:.88rem;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.qc-msg.qumu{align-self:flex-start;background:#fff;border:1px solid var(--line,rgba(0,0,0,.08));border-bottom-left-radius:4px}
.qc-msg.user{align-self:flex-end;background:#1677e5;color:#fff;border-bottom-right-radius:4px}
.qc-msg.note{align-self:center;max-width:100%;padding:4px 10px;background:transparent;color:var(--muted,#55667a);font-size:.75rem;text-align:center}
.qc-typing{display:inline-flex;gap:4px}.qc-typing i{width:6px;height:6px;border-radius:50%;background:#1677e5;animation:qumuDot 1s infinite}
.qc-typing i:nth-child(2){animation-delay:.15s}.qc-typing i:nth-child(3){animation-delay:.3s}
@keyframes qumuDot{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.qc-chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 10px;background:var(--sunk,#f6f8fb)}
.qc-chips:empty{display:none}
.qc-chips button{padding:5px 10px;border:1px solid #b9d8fb;border-radius:999px;background:#eef6ff;color:#0f5bb5;font:500 .76rem var(--font,system-ui);cursor:pointer}
.qc-chips button:hover{background:#dcecff}
.qc-form{display:flex;gap:6px;padding:10px;border-top:1px solid var(--line,rgba(0,0,0,.08));background:var(--solid,#fff)}
.qc-form input{flex:1;min-width:0;padding:9px 12px;border:1px solid var(--line2,rgba(0,0,0,.18));border-radius:999px;background:var(--surface,#fff);color:var(--ink,#12233a);font:inherit;font-size:.88rem}
.qc-form input:focus{outline:none;border-color:#1677e5;box-shadow:0 0 0 3px rgba(22,119,229,.22)}
.qc-form button{flex:none;display:grid;place-items:center;width:38px;height:38px;border:0;border-radius:50%;background:#1677e5;color:#fff;cursor:pointer}
.qc-form button.mic{background:#e6f1ff;color:#1463d6}
.qc-form button.mic.on{background:#e5484d;color:#fff;animation:qumuDot 1.2s infinite}
.qc-form button:disabled{opacity:.5;cursor:not-allowed}
.qc-form svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

@media(max-width:600px){
  #qumu{width:76px;right:4px}#qumuChat{right:8px;left:8px;width:auto;bottom:84px}
  body:has(#con.open) #qumu,body:has(#con.open) #qumuChat{display:none}
}
@media(prefers-reduced-motion:reduce){#qumu .q-fig,#qumu .q-react,.qumu-btn:before{animation:none!important}}

/* dark mode */
[data-mode=dark] .qumu-bubble,[data-mode=dark] .qumu-bubble:after{background:#1f2a3f;color:#e6edf7}
[data-mode=dark] .qumu-bubble{box-shadow:0 10px 30px -8px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.1)}
[data-mode=dark] .qc-msg.qumu{background:#1b2436;border-color:rgba(255,255,255,.08)}
[data-mode=dark] .qc-chips button{border-color:rgba(74,168,240,.35);background:rgba(74,168,240,.12);color:#8cc8ff}
[data-mode=dark] .qc-chips button:hover{background:rgba(74,168,240,.2)}
[data-mode=dark] .qc-form button.mic{background:rgba(74,168,240,.16);color:#8cc8ff}
