/* =========================================================
   桌面小宠 —— 奶油小兔（Canvas 渲染）
   ========================================================= */

.pet {
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: 76px;
  height: 160px;
  z-index: 45;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  transition: opacity .2s;
}
.pet.hidden { display: none; }
.pet.dragging { cursor: grabbing; }
.pet.gone { opacity: 0; }

.pet-canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 10px 16px rgba(160, 120, 90, .14));
}

/* ---------- 待处理订单红点 ---------- */
.pet-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  border: 2px solid #fff;
  background: #d9534f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 4px 10px rgba(217, 83, 79, .35);
}
.pet-badge[hidden] { display: none; }
.pet-badge.pop { animation: badge-pop .42s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes badge-pop {
  0% { transform: scale(.2); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---------- 气泡 ---------- */
.pet-bubble {
  position: absolute;
  right: calc(100% - 10px);
  bottom: 84px;
  width: max-content;
  max-width: 168px;
  min-width: 56px;
  padding: 9px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  box-shadow: 0 8px 20px rgba(160, 120, 90, .14);
  opacity: 0;
  transform: translateY(6px) scale(.94);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.pet-bubble.show { opacity: 1; transform: translateY(0) scale(1); }
.pet-bubble::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: 14px;
  width: 9px;
  height: 9px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(-45deg);
}
.pet.bubble-right .pet-bubble {
  right: auto;
  left: calc(100% - 10px);
  border-radius: 14px 14px 14px 4px;
}
.pet.bubble-right .pet-bubble::after {
  right: auto;
  left: -5px;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(-45deg);
}

/* ---------- 粒子 ---------- */
.pet-particle {
  position: absolute;
  left: 50%;
  bottom: 58%;
  font-size: 16px;
  pointer-events: none;
  animation: pet-float .95s ease-out forwards;
}
@keyframes pet-float {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -64px) scale(1.15); }
}

@media (max-width: 380px) {
  .pet { width: 66px; height: 140px; right: 10px; bottom: 78px; }
  .pet-bubble { max-width: 140px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .pet-particle { animation-duration: .01ms; }
}
