/* Helmut, the pixel astronaut beside the planner assistant (frontend/mascot.js).
   .helmut-fig carries the mood (m-*) and stacked looks (f-*); #helmut carries arrive/leave and the talking mouth. */

#helmut { position: fixed; left: 0; top: 0; z-index: 40; width: 56px; height: 63px; pointer-events: none;
         will-change: transform; --eye: #9ef2ff; --ant: #ff8a4c; }
#helmut[hidden] { display: none; }
#helmut.touring { display: none; }

.helmut-fig { position: absolute; inset: 0; pointer-events: auto; cursor: grab; touch-action: none; user-select: none;
             transform-origin: 50% 85%; animation: rFloat 3.2s ease-in-out infinite;
             filter: drop-shadow(0 3px 0 #0003); }
.helmut-fig:active { cursor: grabbing; }
.helmut-fig svg { display: block; overflow: visible; }
/* joints pivot at fixed sprite pixels, so hidden extras (the flag, the frost) never shift them */
.helmut-fig svg g, .helmut-fig svg rect, .helmut-fig svg polygon { transform-box: view-box; }

/* parts */
.helmut-fig .head { transform-origin: 8px 9.5px; transition: transform .25s ease; }
.helmut-fig .armL { transform-origin: 2.5px 10.6px; animation: rSwayL 3.2s ease-in-out infinite; }
.helmut-fig .armR { transform-origin: 13.5px 10.6px; animation: rSwayR 3.2s ease-in-out infinite; }
.helmut-fig .legL { transform-origin: 5px 15px; }
.helmut-fig .legR { transform-origin: 10.5px 15px; }
.helmut-fig .legL, .helmut-fig .legR { animation: rDangle 3.2s ease-in-out infinite; }
.helmut-fig .legR { animation-delay: -1.6s; }
.helmut-fig .eyes .e, .helmut-fig .mouth .e { fill: var(--eye); }
.helmut-fig .eyes { filter: drop-shadow(0 0 .7px var(--eye)); transition: transform .12s steps(1); }
.helmut-fig .ant { fill: var(--ant); animation: rBlink 2.4s steps(1) infinite; }
.helmut-fig .lamp { fill: #8d8f99; }
.helmut-fig .cone { fill: #ffe9a3; opacity: 0; transform-origin: 5px -0.5px; transition: opacity .4s; }
.helmut-fig .mouth, .helmut-fig .blush, .helmut-fig .sweat, .helmut-fig .frost, .helmut-fig .flag,
.helmut-fig .flames { opacity: 0; transition: opacity .2s; }
.helmut-fig .sweat { transform-origin: 14.5px 1px; }
.helmut-fig .eyes .scan { animation: rScan 1.1s steps(6) infinite alternate; }

/* talking: the assistant's replies come out of Helmut's visor */
#helmut.mouth-open .f-talk .mouth { opacity: 1; }
.helmut-fig.f-talk .head { animation: rTalk .26s ease-in-out infinite alternate; }
/* each keystroke blips the antenna */
#helmut.key .ant { animation: rKey .25s steps(1); }

/* stacked looks */
.helmut-fig.f-blush .blush { opacity: 1; }
.helmut-fig.f-hot .sweat { opacity: 1; animation: rDrip 1s ease-in infinite; }
.helmut-fig.f-cold .frost { opacity: 1; }
.helmut-fig.f-cold { animation: rShiver .09s linear infinite; }
.helmut-fig.f-flag .flag { opacity: 1; }
.helmut-fig.f-flag .armR { transform: rotate(-25deg); animation: none; }
.helmut-fig.f-night .lamp { fill: #ffe27a; }
.helmut-fig.f-night .cone { opacity: .28; animation: rLamp 4s ease-in-out infinite; }
.helmut-fig.f-rad { --eye: #c8ff4d; }
.helmut-fig.f-rad .eyes { animation: rFlicker 2.6s steps(1) infinite; }
.helmut-fig.f-signal { --ant: #ff4b4b; }

/* moods */
.helmut-fig.m-listen { transform: rotate(-6deg); animation: rFloatLean 3.2s ease-in-out infinite; --ant: #7fe08a; }
.helmut-fig.m-listen .head { transform: rotate(-4deg); }
.helmut-fig.m-think { --ant: #6fb6ff; }
.helmut-fig.m-think .head { transform: rotate(8deg); }
.helmut-fig.m-think .ant { animation-duration: .6s; }
.helmut-fig.m-think .armR { animation: none; transform: rotate(-150deg); }
.helmut-fig.m-plan { animation: rBusy .7s ease-in-out infinite; --ant: #ffd36b; }
.helmut-fig.m-plan .ant { animation: rRainbow 1.2s steps(1) infinite; }
.helmut-fig.m-plan .armL { animation: rTypeL .28s steps(1) infinite; }
.helmut-fig.m-plan .armR { animation: rTypeR .28s steps(1) infinite; }
.helmut-fig.m-ride { animation: rBounce .42s ease-in-out infinite; }
.helmut-fig.m-ride .armL { animation: rCheerL .84s ease-in-out infinite; }
.helmut-fig.m-ride .armR { animation: rCheerR .84s ease-in-out infinite; }
.helmut-fig.m-ride .flames { opacity: 1; }
.helmut-fig.m-ride .flames rect { animation: rFlame .12s steps(1) infinite; }
.helmut-fig.m-sleep { animation: rSleep 5s ease-in-out infinite; --ant: #6a5146; }
.helmut-fig.m-sleep .head { transform: rotate(10deg); }
.helmut-fig.m-sleep .ant { animation: none; }
.helmut-fig.m-sleep .armL, .helmut-fig.m-sleep .armR, .helmut-fig.m-sleep .legL, .helmut-fig.m-sleep .legR { animation-duration: 5s; }
.helmut-fig.m-happy, .helmut-fig.m-nod { animation: rHop .6s cubic-bezier(.3, .7, .4, 1); }
.helmut-fig.m-nod { animation: rNod .45s ease-in-out; }
.helmut-fig.m-celebrate { animation: rFlip 1.1s cubic-bezier(.3, .6, .3, 1); }
.helmut-fig.m-celebrate .armL, .helmut-fig.m-proud .armL { animation: none; transform: rotate(150deg); }
.helmut-fig.m-celebrate .armR, .helmut-fig.m-proud .armR { animation: none; transform: rotate(-150deg); }
.helmut-fig.m-celebrate .flames { opacity: 1; }
.helmut-fig.m-celebrate .flames rect { animation: rFlame .12s steps(1) infinite; }
.helmut-fig.m-proud { animation: rHop .7s ease-out 2; }
.helmut-fig.m-sad { animation: rSad 2.4s ease-in-out infinite; --ant: #8a6a5e; }
.helmut-fig.m-sad .head { transform: rotate(7deg) translateY(1px); }
.helmut-fig.m-sad .armL, .helmut-fig.m-sad .armR { animation: none; }
.helmut-fig.m-scared { animation: rShiver .08s linear infinite; }
.helmut-fig.m-scared .sweat { opacity: 1; animation: rDrip .8s ease-in infinite; }
.helmut-fig.m-wake { animation: rStartle .5s cubic-bezier(.2, .9, .3, 1.4); }
.helmut-fig.m-dizzy { animation: rWobble .5s ease-in-out infinite; }
.helmut-fig.m-dizzy .head { animation: rHeadSpin .9s ease-in-out infinite; }
.helmut-fig.m-love { animation: rHop .7s ease-out; --eye: #ff8fb1; }
.helmut-fig.m-love .blush { opacity: 1; }
.helmut-fig.m-wave .armR { animation: rWave .36s ease-in-out infinite alternate; }
.helmut-fig.m-salute .armR { animation: none; transform: rotate(-128deg); }
.helmut-fig.m-salute { animation: none; transform: translateY(-2px); }
.helmut-fig.m-whoa { animation: rWobble 1s ease-in-out infinite; }
.helmut-fig.m-whoa .armL { animation: none; transform: rotate(160deg); }
.helmut-fig.m-whoa .armR { animation: none; transform: rotate(-160deg); }
.helmut-fig.m-whoa .legL { animation: rKick .3s ease-in-out infinite alternate; }
.helmut-fig.m-whoa .legR { animation: rKick .3s ease-in-out infinite alternate-reverse; }
.helmut-fig.m-cough { animation: rCough .42s ease-in-out 3; }
.helmut-fig.m-curious .head { transform: rotate(-12deg); }
.helmut-fig.m-yawn { animation: rStretch 1.4s ease-in-out; }
.helmut-fig.m-yawn .mouth { opacity: 1; }
.helmut-fig.m-yawn .armL { animation: none; transform: rotate(140deg); }
.helmut-fig.m-yawn .armR { animation: none; transform: rotate(-140deg); }
.helmut-fig.m-carried { animation: rCarried .6s ease-in-out infinite; cursor: grabbing; }
.helmut-fig.m-carried .armL { animation: none; transform: rotate(150deg); }
.helmut-fig.m-carried .armR { animation: none; transform: rotate(-150deg); }
.helmut-fig.m-carried .legL { animation: rKick .22s ease-in-out infinite alternate; }
.helmut-fig.m-carried .legR { animation: rKick .22s ease-in-out infinite alternate-reverse; }

/* rocket-boot arrival and exit */
#helmut.arrive .helmut-fig { animation: rArrive .82s cubic-bezier(.2, .8, .3, 1) both; }
#helmut.leave .helmut-fig { animation: rLeave .65s cubic-bezier(.6, 0, .8, .4) both; }
#helmut.arrive .flames, #helmut.leave .flames { opacity: 1; }
#helmut.arrive .flames rect, #helmut.leave .flames rect { animation: rFlame .1s steps(1) infinite; }
#helmut.arrive .helmut-bubble, #helmut.leave .helmut-bubble { opacity: 0; }

/* speech bubble */
.helmut-bubble { position: absolute; bottom: calc(100% + 12px); right: -8px; width: max-content; max-width: 200px;
                padding: 6px 10px; border: 2px solid #2a1d17; border-radius: 10px; background: #fffaf5; color: #2a1d17;
                font: 600 12px/1.35 Inter, system-ui, sans-serif; box-shadow: 3px 3px 0 #2a1d1740;
                opacity: 0; transform: translateY(4px) scale(.9); transform-origin: 85% 100%;
                transition: opacity .16s, transform .2s cubic-bezier(.3, 1.5, .5, 1); pointer-events: none; }
.helmut-bubble::after { content: ""; position: absolute; top: 100%; right: 18px; width: 8px; height: 8px;
                       background: #fffaf5; border: 2px solid #2a1d17; border-top: 0; border-left: 0;
                       transform: translateY(-4px) rotate(45deg); }
.helmut-bubble.on { opacity: 1; transform: none; }
#helmut.bubble-left .helmut-bubble { right: auto; left: -8px; transform-origin: 15% 100%; }
#helmut.bubble-left .helmut-bubble::after { right: auto; left: 18px; }
.helmut-bubble.think { padding: 6px 9px; display: flex; gap: 4px; }
.helmut-bubble.think i { width: 5px; height: 5px; background: #2a1d17; animation: rDot 1s steps(1) infinite; }
.helmut-bubble.think i:nth-child(2) { animation-delay: .2s; }
.helmut-bubble.think i:nth-child(3) { animation-delay: .4s; }

/* particles */
.helmut-p { position: absolute; pointer-events: none; }
.helmut-p.confetti { left: 26px; top: 14px; width: 5px; height: 5px; animation: pConfetti 1.3s cubic-bezier(.2, .7, .4, 1) both; }
.helmut-p.puff { left: 22px; top: 56px; width: 9px; height: 9px; background: #c9a48d; opacity: .8;
                animation: pPuff .7s ease-out both; }
.helmut-p.spark { width: 7px; height: 7px; background: #ffd36b;
                 clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
                 animation: pSpark .8s ease-out both; }
.helmut-p.heart { left: 30px; top: -4px; width: 12px; height: 11px; background: #ff8fb1;
                 clip-path: polygon(50% 100%, 0 40%, 0 15%, 15% 0, 35% 0, 50% 18%, 65% 0, 85% 0, 100% 15%, 100% 40%);
                 animation: pRise 1.2s ease-out both; }
.helmut-p.zzz { left: 44px; top: -2px; font: 700 13px/1 Inter, system-ui, sans-serif; color: #e9ddd4;
               text-shadow: 1px 1px 0 #2a1d17; animation: pZzz 2.6s ease-out both; }
.helmut-p.pop { left: 46px; top: -10px; font: 800 18px/1 Inter, system-ui, sans-serif; color: #ffd36b;
               text-shadow: 1.5px 1.5px 0 #2a1d17; animation: pPop .9s cubic-bezier(.3, 1.6, .5, 1) both; }
.helmut-p.orbit { left: 8px; top: -8px; width: 40px; height: 14px; animation: pOrbit .55s linear 4; }
.helmut-p.orbit::before, .helmut-p.orbit::after { content: "\2726"; position: absolute; font-size: 11px; color: #ffd36b;
                                                text-shadow: 1px 1px 0 #2a1d17; }
.helmut-p.orbit::before { left: 0; top: 0; }
.helmut-p.orbit::after { right: 0; top: 2px; }
.helmut-p.rain { left: 12px; top: -22px; width: 30px; height: 12px; background: #8d94a6; border-radius: 6px;
                box-shadow: 4px 7px 0 -4px #9ee6ff, 14px 9px 0 -4px #9ee6ff, 24px 7px 0 -4px #9ee6ff;
                animation: pRain 2.6s ease-in-out both; }

@keyframes rFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes rFloatLean { 0%, 100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(-6deg) translateY(-3px); } }
@keyframes rSleep { 0%, 100% { transform: translateY(0) rotate(4deg); } 50% { transform: translateY(-9px) rotate(-2deg); } }
@keyframes rSwayL { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(8deg); } }
@keyframes rSwayR { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
@keyframes rDangle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes rBlink { 0%, 70% { opacity: 1; } 71%, 100% { opacity: .25; } }
@keyframes rKey { 0% { fill: #fff; } }
@keyframes rTalk { from { transform: translateY(0); } to { transform: translateY(-.6px) rotate(-2deg); } }
@keyframes rScan { from { transform: translateX(0); } to { transform: translateX(6px); } }
@keyframes rRainbow { 0% { fill: #ff8a4c; } 25% { fill: #ffd36b; } 50% { fill: #7fe08a; } 75% { fill: #6fb6ff; } }
@keyframes rBusy { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes rTypeL { 0% { transform: rotate(-35deg); } 50% { transform: rotate(-20deg); } }
@keyframes rTypeR { 0% { transform: rotate(20deg); } 50% { transform: rotate(35deg); } }
@keyframes rBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes rCheerL { 0%, 100% { transform: rotate(150deg); } 50% { transform: rotate(110deg); } }
@keyframes rCheerR { 0%, 100% { transform: rotate(-110deg); } 50% { transform: rotate(-150deg); } }
@keyframes rFlame { 0% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rHop { 0%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(1px) scale(1.08, .9); }
                  45% { transform: translateY(-12px) scale(.95, 1.06); } 75% { transform: translateY(0) scale(1.05, .95); } }
@keyframes rNod { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(2px) rotate(3deg); } }
@keyframes rFlip { 0% { transform: translateY(0) rotate(0); } 18% { transform: translateY(2px) scale(1.1, .88); }
                   55% { transform: translateY(-26px) rotate(-200deg); } 85% { transform: translateY(-4px) rotate(-360deg); }
                   100% { transform: translateY(0) rotate(-360deg); } }
@keyframes rSad { 0%, 100% { transform: translateY(3px) scale(1, .96); } 50% { transform: translateY(4px) scale(1, .95); } }
@keyframes rShiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1px); } 75% { transform: translateX(1px); } }
@keyframes rDrip { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(3px); opacity: 0; } }
@keyframes rStartle { 0% { transform: translateY(0); } 40% { transform: translateY(-14px) scale(1.06); } 100% { transform: translateY(0); } }
@keyframes rWobble { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes rHeadSpin { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
@keyframes rWave { from { transform: rotate(-150deg); } to { transform: rotate(-105deg); } }
@keyframes rKick { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@keyframes rCough { 0%, 100% { transform: translate(0, 0); } 35% { transform: translate(-2px, 2px) rotate(-6deg); } }
@keyframes rStretch { 0%, 100% { transform: scale(1, 1); } 45% { transform: scale(.96, 1.08) translateY(-3px); } }
@keyframes rCarried { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes rLamp { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
@keyframes rFlicker { 0%, 88%, 92%, 100% { opacity: 1; } 89% { opacity: .4; } 93% { opacity: .7; } }
@keyframes rDot { 0% { opacity: 1; transform: translateY(-2px); } 33% { opacity: .35; transform: none; } }
@keyframes rArrive { 0% { transform: translate(60px, -90px) rotate(18deg); opacity: 0; } 25% { opacity: 1; }
                     80% { transform: translate(0, 4px) rotate(-3deg) scale(1.06, .94); } 100% { transform: none; opacity: 1; } }
@keyframes rLeave { 0% { transform: none; } 20% { transform: translateY(3px) scale(1.06, .92); }
                    100% { transform: translate(40px, -120px) rotate(14deg); opacity: 0; } }

@keyframes pConfetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; }
                       60% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 1; }
                       100% { transform: translate(var(--dx), calc(var(--dy) + 50px)) rotate(var(--rot)); opacity: 0; } }
@keyframes pPuff { 0% { transform: translate(0, 0) scale(.5); opacity: .8; } 100% { transform: translate(var(--dx), -6px) scale(1.6); opacity: 0; } }
@keyframes pSpark { 0% { transform: scale(0) rotate(0); opacity: 1; } 50% { transform: scale(1.2) rotate(45deg); opacity: 1; }
                    100% { transform: scale(0) rotate(90deg); opacity: 0; } }
@keyframes pRise { 0% { transform: translateY(0) scale(.4); opacity: 0; } 20% { transform: translateY(-4px) scale(1); opacity: 1; }
                   100% { transform: translateY(-34px) scale(.9); opacity: 0; } }
@keyframes pZzz { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 20% { opacity: 1; }
                  100% { transform: translate(16px, -30px) scale(1.3); opacity: 0; } }
@keyframes pPop { 0% { transform: translateY(6px) scale(.2); opacity: 0; } 40% { transform: translateY(-4px) scale(1.2); opacity: 1; }
                  75% { opacity: 1; } 100% { transform: translateY(-8px) scale(1); opacity: 0; } }
@keyframes pOrbit { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
@keyframes pRain { 0% { opacity: 0; transform: translateY(-6px); } 15%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

@media (max-width: 760px) {
  #helmut { width: 48px; height: 54px; }
  .helmut-fig svg { width: 48px; height: 54px; }
  .helmut-bubble { max-width: 160px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .helmut-fig, .helmut-fig *, #helmut.arrive .helmut-fig, #helmut.leave .helmut-fig { animation: none !important; }
  .helmut-fig .head { transition: none; }
}
