/* 工艺助手悬浮形象 /assets/mascot/ */
.sw-bot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  font-family: inherit;
  --sw-blue: #2744a8;
  --sw-ink: #0f1b3d;
  --sw-muted: #6b7a99;
}

/* ---------- 按钮：无边框，机器人直接站在页面上 ---------- */
.sw-bot__btn {
  position: relative;
  display: block;
  width: 104px;
  height: 120px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: transform .22s ease;
  -webkit-tap-highlight-color: transparent;
  /* 入场：从下方轻弹上来，只播一次 */
  animation: sw-bot-in .72s cubic-bezier(.22, .9, .28, 1.15) .8s both;
}
@keyframes sw-bot-in {
  from { opacity: 0; transform: translateY(22px) scale(.84); }
  to { opacity: 1; transform: none; }
}
.sw-bot__btn:hover,
.sw-bot__btn:focus-visible {
  transform: translateY(-4px);
  outline: none;
}
.sw-bot__btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  pointer-events: none;
  /* 呼吸动画放在图片上，按钮自身的命中区域保持稳定，避免点击时躲开指针 */
  animation: sw-bot-float 4.6s ease-in-out infinite;
}
.sw-bot__dot {
  position: absolute;
  top: 8px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.sw-bot__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 197, 94, .55);
  animation: sw-dot-ping 2.6s cubic-bezier(.3, 0, .2, 1) infinite;
}
@keyframes sw-dot-ping {
  0% { transform: scale(.6); opacity: .9; }
  70%, 100% { transform: scale(1.9); opacity: 0; }
}
@keyframes sw-bot-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(-1.4deg); }
  50% { transform: translateY(-5.5px) rotate(0deg); }
  75% { transform: translateY(-3px) rotate(1.4deg); }
}

/* hover：停下浮动，整体抬起来微微侧头 */
.sw-bot__btn:hover {
  animation: none;
}
.sw-bot__btn:hover img {
  animation: none;
  transform: translateY(-7px) scale(1.05) rotate(-2.5deg);
  transition: transform .26s cubic-bezier(.2, .8, .3, 1.2);
}
/* 打开面板时机器人退后半步，把注意力让给对话面板 */
.sw-bot.is-open .sw-bot__btn img {
  animation: none;
  transform: translateY(-2px) scale(.94);
  transition: transform .3s ease;
}

/* 地面投影：随浮动一起呼吸 */
.sw-bot__btn::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 72px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(11, 20, 54, .3), rgba(11, 20, 54, 0) 72%);
  transform: translateX(-50%);
  animation: sw-bot-shadow 4.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sw-bot-shadow {
  0%, 100% { opacity: .5; transform: translateX(-50%) scale(1); }
  50% { opacity: .26; transform: translateX(-50%) scale(.82); }
}
@media (prefers-reduced-motion: reduce) {
  .sw-bot__btn,
  .sw-bot__btn img,
  .sw-bot__btn::after,
  .sw-bot__dot::after { animation: none; }
}

/* ---------- 首次提示气泡 ---------- */
.sw-bot__bubble {
  position: absolute;
  right: 126px;
  bottom: 16px;
  width: 232px;
  padding: 12px 30px 12px 14px;
  background: #fff;
  border: 1px solid rgba(39, 68, 168, .1);
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 14px 30px -14px rgba(11, 20, 54, .35);
  opacity: 0;
  transform: translateY(6px) scale(.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}
.sw-bot__bubble.is-on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.sw-bot__bubble b {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  color: var(--sw-ink);
}
.sw-bot__bubble span {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  color: var(--sw-muted);
}
.sw-bot__bx {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: #aab5c8;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.sw-bot__bx:hover { background: #f2f5fb; color: #6b7a99; }

/* ---------- 展开面板 ---------- */
.sw-bot__panel {
  position: absolute;
  right: 0;
  bottom: 120px;
  width: 304px;
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(39, 68, 168, .1);
  border-radius: 18px;
  box-shadow: 0 26px 60px -22px rgba(11, 20, 54, .45), 0 2px 8px rgba(11, 20, 54, .06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .24s ease, transform .24s ease, visibility .24s;
}
.sw-bot.is-open .sw-bot__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sw-bot__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 11px;
  border-bottom: 1px solid #eef2f9;
}
.sw-bot__pic {
  width: 74px;
  height: 74px;
  object-fit: contain;
  object-position: center bottom;
  flex: 0 0 auto;
  border-radius: 14px;
  background: linear-gradient(160deg, #f4f7ff, #eaf0ff);
}
.sw-bot__head b {
  display: block;
  font-size: 13.5px;
  color: var(--sw-ink);
  letter-spacing: .01em;
}
.sw-bot__head span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--sw-muted);
}
.sw-bot__head span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}
.sw-bot__tip {
  margin: 11px 0 12px;
  font-size: 12px;
  line-height: 1.7;
  color: #5c6b86;
}

.sw-bot__act {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 7px;
  border: 1px solid #e6ecf7;
  border-radius: 10px;
  font-size: 12.8px;
  color: #22315a;
  text-decoration: none;
  transition: border-color .18s, background .18s, transform .18s;
}
.sw-bot__act em {
  font-style: normal;
  font-size: 11px;
  color: #93a0b6;
  white-space: nowrap;
}
.sw-bot__act:hover {
  border-color: #c9d8f2;
  background: #fafcff;
  transform: translateX(2px);
}
.sw-bot__act--primary {
  background: linear-gradient(135deg, #2b4bb4, #1c3578);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.sw-bot__act--primary em { color: rgba(255, 255, 255, .68); }
.sw-bot__act--primary:hover { background: linear-gradient(135deg, #3155c9, #20408c); }
.sw-bot__act:last-child { margin-bottom: 0; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .sw-bot { right: 10px; bottom: 8px; }
  .sw-bot__btn { width: 66px; height: 76px; }
  .sw-bot__panel {
    position: fixed;
    right: 14px;
    left: 14px;
    bottom: 100px;
    width: auto;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
  }
  .sw-bot__bubble {
    position: fixed;
    right: 14px;
    bottom: 106px;
    width: min(206px, calc(100vw - 28px));
    padding: 11px 26px 11px 13px;
    border-radius: 14px 14px 4px 14px;
  }
}
