/* 软萌小熊 — 骨骼分层动画 */
#pet-root {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  inset: 0;
}
#pet-root .pet-wrap {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  width: 140px;
  height: 180px;
}
#pet-root .pet-wrap:active { cursor: grabbing; }

#pet-root .pet-stage {
  position: relative;
  width: 140px;
  height: 180px;
  overflow: visible;
}

#pet-root .pet-glb-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#pet-root .pet-glb-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}

.bear-home-bear-slot .pet-glb-canvas,
.bear-home-bear-slot .pet-glb-canvas canvas {
  width: 100%;
  height: 100%;
}

/* 动态投影 */
#pet-root .pet-shadow {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 72px;
  height: 14px;
  margin-left: -36px;
  background: radial-gradient(ellipse, rgba(60,40,20,0.28) 0%, transparent 72%);
  border-radius: 50%;
  pointer-events: none;
  transform-origin: center;
  will-change: transform, filter, opacity;
}

/* 骨骼舞台 */
#pet-root .pet-rig {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  overflow: visible;
}
#pet-root .pet-part {
  position: absolute;
  overflow: visible;
  pointer-events: none;
}
#pet-root .pet-part.pet-nested {
  z-index: 1;
}
#pet-root .pet-bone {
  position: relative;
  width: 100%;
  height: 100%;
  will-change: transform;
}
#pet-root .pet-bone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left top;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* 眨眼遮罩（挂在头部骨骼内，随头动） */
#pet-root .pet-eye {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(180deg, #3d2810 0%, #1a1208 100%);
  transform-origin: center center;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

#pet-root .pet-bubble.hidden { display: none; }
#pet-root .pet-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  max-width: 200px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  background: linear-gradient(135deg, #FFF9E5, #FFE5EC);
  border: 1px solid #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  animation: petBubbleIn 0.3s ease forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes petBubbleIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#pet-chat-panel {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#pet-chat-panel.hidden { display: none; }
.pet-chat-box {
  width: 100%;
  max-width: 400px;
  max-height: 480px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pet-chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.pet-chat-header h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.pet-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 200px;
  max-height: 320px;
}
.pet-chat-msg {
  margin-bottom: 8px;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.pet-chat-msg.user { margin-left: auto; background: rgba(51,51,51,0.06); }
.pet-chat-msg.assistant { background: linear-gradient(135deg, #FFF9E5, #FFE5EC); }
.pet-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.pet-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
}
.pet-chat-input button {
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  #pet-root .pet-bone { transition: none !important; }
  #pet-root .pet-shadow { filter: blur(10px) !important; }
}
