/**
 * 灵涵桌宠：定点探头打招呼，可拖到任意位置（不走路）
 */
#lhAiFloat {
  --lh-w: 128px;
  --lh-h: 196px;
  position: fixed;
  z-index: 12880;
  width: var(--lh-w);
  height: var(--lh-h);
  /* 默认：中间靠右（约快捷入口 / 全部 一带） */
  left: auto;
  right: 10px;
  top: 38%;
  bottom: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  pointer-events: none;
  background: transparent;
  overflow: visible;
}

#lhAiFloat.lh-ai-float--dragging {
  transition: none !important;
}

#lhAiFloat * { box-sizing: border-box; }

#lhAiFloat.lh-ai-float--away {
  width: 48px;
  height: 108px;
  right: 0;
  left: auto !important;
  top: 38% !important;
  bottom: auto !important;
  pointer-events: auto;
  z-index: 12900;
}
#lhAiFloat.lh-ai-float--away .lh-ai-float__hit,
#lhAiFloat.lh-ai-float--away .lh-ai-float__close,
#lhAiFloat.lh-ai-float--away .lh-ai-float__mute,
#lhAiFloat.lh-ai-float--away .lh-pet__hand,
#lhAiFloat.lh-ai-float--away .lh-pet__voice,
#lhAiFloat.lh-ai-float--away .lh-pet__shadow {
  display: none !important;
}
#lhAiFloat.lh-ai-float--away .lh-ai-float__summon { display: flex; }
#lhAiFloat.lh-ai-float--away .lh-ai-float__tip {
  display: block;
  top: -8px;
  left: auto;
  right: 52px;
  transform: none;
  white-space: nowrap;
}
#lhAiFloat.lh-ai-float--away.lh-ai-float--tip-on .lh-ai-float__tip {
  opacity: 1;
  transform: none;
}
#lhAiFloat.lh-ai-float--away .lh-ai-float__tip::after {
  left: auto;
  right: -3px;
  bottom: 12px;
  margin-left: 0;
}

.lh-ai-float__summon {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  padding: 10px 4px 12px;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%);
  box-shadow: -4px 8px 20px rgba(28, 25, 23, 0.18);
  pointer-events: auto;
  animation: lh-summon-bob 2.4s ease-in-out infinite;
  border-radius: 16px 0 0 16px;
  border-left: 3px solid rgba(251, 146, 60, 0.75);
}
.lh-ai-float__summon::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 16px 0 0 16px;
  box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.45);
  animation: lh-summon-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
.lh-ai-float__summon-face {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; object-position: center 10%; display: block;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.18);
}
.lh-ai-float__summon-label {
  writing-mode: vertical-rl;
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; color: #9a3412;
  line-height: 1;
}
.lh-ai-float__summon-hint {
  writing-mode: vertical-rl;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #c2410c;
  opacity: 0.85;
}

.lh-ai-float__hit {
  position: absolute; inset: 0; border: 0; padding: 0; margin: 0;
  background: transparent; cursor: grab; display: block;
  overflow: visible; pointer-events: auto;
}
#lhAiFloat.lh-ai-float--dragging .lh-ai-float__hit { cursor: grabbing; }

.lh-pet__stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  perspective: 700px;
}

.lh-pet__shadow {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 2px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(28, 25, 23, 0.34) 0%, transparent 72%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

.lh-pet__figure {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: 50% 100%;
  filter:
    drop-shadow(0 12px 16px rgba(28, 25, 23, 0.30))
    drop-shadow(0 2px 6px rgba(251, 146, 60, 0.12));
  animation: lh-pet-idle 3.2s ease-in-out infinite;
}

#lhAiFloat.lh-ai-float--peek .lh-pet__figure {
  animation: lh-pet-peek 1.15s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
#lhAiFloat.lh-ai-float--greet .lh-pet__figure {
  animation: lh-pet-greet 1.15s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
#lhAiFloat.lh-ai-float--talking .lh-pet__figure {
  animation: lh-pet-talk 0.5s ease-in-out infinite;
}

.lh-pet__body {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  background: transparent;
}

.lh-pet__voice {
  position: absolute;
  width: 22px; height: 22px;
  right: 10%; top: 22%;
  pointer-events: none; z-index: 4; opacity: 0;
}
#lhAiFloat.lh-ai-float--talking .lh-pet__voice { opacity: 1; }
.lh-pet__voice span {
  position: absolute; inset: 0;
  border: 2px solid rgba(251, 146, 60, 0.65);
  border-radius: 50%;
  animation: lh-voice-ring 1.05s ease-out infinite;
}
.lh-pet__voice span:nth-child(2) { animation-delay: .32s; }

.lh-pet__hand {
  position: absolute;
  width: 28px; height: 28px;
  right: 16%; top: 36%;
  opacity: 0; z-index: 5; pointer-events: none;
}
#lhAiFloat.lh-ai-float--greet .lh-pet__hand {
  animation: lh-wave 1.1s ease-out both;
}
.lh-pet__hand svg { width: 100%; height: 100%; display: block; }

.lh-ai-float__tip {
  position: absolute;
  top: 2%;
  left: 50%;
  max-width: 160px;
  white-space: nowrap;
  padding: 8px 12px;
  background: rgba(28, 25, 23, 0.92);
  color: #fff7ed;
  font-size: 12px; font-weight: 650;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(28, 25, 23, 0.2);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transform: translate(-50%, 6px) scale(0.94);
  transition: opacity .28s ease, transform .4s cubic-bezier(0.22,1,0.36,1);
}
.lh-ai-float__tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px; height: 8px;
  margin-left: -4px;
  background: rgba(28, 25, 23, 0.92);
  transform: rotate(45deg);
}
#lhAiFloat.lh-ai-float--tip-on .lh-ai-float__tip {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.lh-ai-float__close,
.lh-ai-float__mute {
  position: absolute;
  width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(28, 25, 23, 0.45); color: #fff;
  line-height: 20px; text-align: center; cursor: pointer;
  opacity: 0; transform: scale(.85);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 6; pointer-events: auto;
}
.lh-ai-float__close { top: 0; right: 0; font-size: 13px; }
.lh-ai-float__mute { top: 24px; right: 0; font-size: 10px; }
#lhAiFloat:hover .lh-ai-float__close,
#lhAiFloat:hover .lh-ai-float__mute,
#lhAiFloat.lh-ai-float--greet .lh-ai-float__close,
#lhAiFloat.lh-ai-float--greet .lh-ai-float__mute,
#lhAiFloat.lh-ai-float--tip-on .lh-ai-float__close,
#lhAiFloat.lh-ai-float--tip-on .lh-ai-float__mute,
#lhAiFloat.lh-ai-float--talking .lh-ai-float__close,
#lhAiFloat.lh-ai-float--talking .lh-ai-float__mute {
  opacity: 1; transform: scale(1);
}
#lhAiFloat.lh-ai-float--muted .lh-ai-float__mute { background: rgba(120,113,108,.7); }

@keyframes lh-pet-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes lh-pet-peek {
  0% { transform: translateY(8px) rotate(4deg) scale(0.96); }
  55% { transform: translateY(-6px) rotate(-2deg) scale(1.03); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}
@keyframes lh-pet-greet {
  0% { transform: translateY(8px) scale(0.96); }
  35% { transform: translateY(-10px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes lh-pet-talk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes lh-wave {
  0% { opacity: 0; transform: scale(0.4) rotate(-18deg); }
  25% { opacity: 1; transform: scale(1) rotate(14deg); }
  50% { transform: scale(1) rotate(-12deg); }
  75% { transform: scale(1) rotate(10deg); }
  100% { opacity: 0; transform: scale(0.5); }
}
@keyframes lh-voice-ring {
  0% { transform: scale(0.45); opacity: 0.8; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes lh-summon-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes lh-summon-pulse {
  0% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(251, 146, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .lh-pet__figure,
  .lh-pet__hand,
  .lh-pet__voice span,
  .lh-ai-float__summon {
    animation: none !important;
  }
}
