/* 小机器人彩蛋：随机从屏幕边缘走进来，冒一句俏皮话，点它会蹦 */
#museBot {
  position: fixed;
  bottom: 22px;
  z-index: 15;
  width: 96px;
  pointer-events: none;
  opacity: 0;
  --dir: -1;
  transform-origin: bottom center;
  transition: opacity 0.2s ease;
}
#museBot.show {
  opacity: 1;
}
#museBot img {
  position: relative;
  z-index: 1;
  display: block;
  width: 96px;
  height: 96px;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  animation: museBob 1.15s ease-in-out infinite;
}
/* 进出场时的机械行走步态：大步伐 + 身体摇摆（持续到进出场结束） */
#museBot.walking img {
  animation: museWalk 0.42s ease-in-out infinite;
}
#museBot.walking .muse-shadow {
  animation: museShadowWalk 0.42s ease-in-out infinite;
}
#museBot.jump img {
  animation: museJump 0.45s ease;
}
@keyframes museBob {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-6px) rotate(2deg);
  }
}
@keyframes museWalk {
  0%,
  100% {
    transform: translateY(0) rotate(-7deg);
  }
  25% {
    transform: translateY(-14px) rotate(5deg);
  }
  50% {
    transform: translateY(0) rotate(7deg);
  }
  75% {
    transform: translateY(-14px) rotate(-5deg);
  }
}
@keyframes museJump {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-30px) rotate(-6deg);
  }
  70% {
    transform: translateY(-30px) rotate(6deg);
  }
}
/* 脚下阴影：随跳动缩放，行走时加快 */
#museBot .muse-shadow {
  position: absolute;
  z-index: 0;
  bottom: -4px;
  left: 50%;
  width: 72px;
  height: 14px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 70%);
  animation: museShadow 1.15s ease-in-out infinite;
  pointer-events: none;
}
@keyframes museShadow {
  0%,
  100% {
    transform: translateX(-50%) scaleX(1);
    opacity: 0.85;
  }
  50% {
    transform: translateX(-50%) scaleX(0.76);
    opacity: 0.5;
  }
}
@keyframes museShadowWalk {
  0%,
  100% {
    transform: translateX(-50%) scaleX(1);
    opacity: 0.9;
  }
  50% {
    transform: translateX(-50%) scaleX(0.68);
    opacity: 0.45;
  }
}
#museBot .muse-bubble {
  position: absolute;
  bottom: 104px;
  left: 50%;
  transform: translateX(-50%) scale(0.6);
  transform-origin: bottom center;
  max-width: 210px;
  min-width: 120px;
  padding: 9px 30px 9px 12px;
  background: #fff;
  border: 1px solid #e3e6e8;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  font-size: 13px;
  line-height: 1.5;
  color: #20262c;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: auto;
  text-align: left;
}
#museBot .muse-bubble::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid #e3e6e8;
  border-bottom: 1px solid #e3e6e8;
  transform: translateX(-50%) rotate(45deg);
}
#museBot.talk .muse-bubble {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
#museBot .muse-bubble-close {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #9aa1a8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
#museBot .muse-bubble-close:hover {
  color: #c8102e;
}
@media (max-width: 760px) {
  #museBot {
    width: 72px;
    bottom: 14px;
  }
  #museBot img {
    width: 72px;
    height: 72px;
  }
  #museBot .muse-shadow {
    width: 54px;
    height: 11px;
  }
  #museBot .muse-bubble {
    bottom: 80px;
    font-size: 12px;
    max-width: 170px;
  }
}

/* ---------- 随机进场 / 离场（--dir：左侧 -1，右侧 1） ---------- */
#museBot.in-walk { animation: museInWalk 1.6s cubic-bezier(0.2, 0.6, 0.3, 1) both; }
#museBot.in-hop { animation: museInHop 1.5s linear both; }
#museBot.in-peek { animation: museInPeek 2.2s ease-in-out both; }
#museBot.in-drop { animation: museInDrop 1.1s linear both; }
#museBot.in-pop { animation: museInPop 0.9s ease-out both; }
#museBot.out-walk { animation: museOutWalk 1.1s ease-in both; }
#museBot.out-hop { animation: museOutHop 1.2s linear both; }
#museBot.out-sink { animation: museOutSink 0.7s ease-in both; }

/* 一步一步走进来 */
@keyframes museInWalk {
  from { transform: translateX(calc(var(--dir) * 170px)); }
  to { transform: translateX(0); }
}
/* 一蹦一蹦跳进来，落地压一下 */
@keyframes museInHop {
  0% { transform: translateX(calc(var(--dir) * 170px)) translateY(0); }
  15% { transform: translateX(calc(var(--dir) * 128px)) translateY(-40px); }
  30% { transform: translateX(calc(var(--dir) * 86px)) translateY(0) scaleY(0.88); }
  47% { transform: translateX(calc(var(--dir) * 46px)) translateY(-32px); }
  64% { transform: translateX(calc(var(--dir) * 10px)) translateY(0) scaleY(0.9); }
  80% { transform: translateX(0) translateY(-14px); }
  92% { transform: translateX(0) translateY(0) scaleY(0.94); }
  100% { transform: translateX(0) translateY(0) scaleY(1); }
}
/* 先从屏幕边探出半个身子看一眼，再跳出来 */
@keyframes museInPeek {
  0% { transform: translateX(calc(var(--dir) * 150px)) rotate(0); }
  28% { transform: translateX(calc(var(--dir) * 70px)) rotate(calc(var(--dir) * -14deg)); }
  48% { transform: translateX(calc(var(--dir) * 70px)) rotate(calc(var(--dir) * -14deg)); }
  56% { transform: translateX(calc(var(--dir) * 84px)) rotate(calc(var(--dir) * -4deg)); }
  78% { transform: translateX(0) translateY(-26px) rotate(0); }
  90% { transform: translateX(0) translateY(0) scaleY(0.9); }
  100% { transform: translateX(0) translateY(0) scaleY(1); }
}
/* 从天而降，落地弹两下 */
@keyframes museInDrop {
  0% { transform: translateY(-110vh); animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
  55% { transform: translateY(0) scaleY(1.06); }
  63% { transform: translateY(0) scale(1.12, 0.8); }
  76% { transform: translateY(-34px) scale(0.96, 1.04); }
  88% { transform: translateY(0) scale(1.05, 0.92); }
  100% { transform: translateY(0) scale(1); }
}
/* 从屏幕底边冒出来 */
@keyframes museInPop {
  0% { transform: translateY(140px) scale(0.9); }
  55% { transform: translateY(-26px) scale(1.02, 1.06); }
  75% { transform: translateY(4px) scale(1.05, 0.93); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes museOutWalk {
  from { transform: translateX(0); }
  to { transform: translateX(calc(var(--dir) * 170px)); }
}
@keyframes museOutHop {
  0% { transform: translateX(0) translateY(0) scaleY(0.9); }
  20% { transform: translateX(calc(var(--dir) * 40px)) translateY(-36px) scaleY(1); }
  40% { transform: translateX(calc(var(--dir) * 80px)) translateY(0) scaleY(0.9); }
  60% { transform: translateX(calc(var(--dir) * 120px)) translateY(-36px) scaleY(1); }
  100% { transform: translateX(calc(var(--dir) * 190px)) translateY(0); }
}
/* 挥手般轻跳一下，然后沉到屏幕底下 */
@keyframes museOutSink {
  0% { transform: translateY(0) scaleY(1); }
  25% { transform: translateY(-22px) scaleY(1.05); }
  45% { transform: translateY(0) scale(1.06, 0.9); }
  100% { transform: translateY(150px) scale(0.9); }
}
