/* DSH-inspired transparent 2.5D interactive AI pet (no boxed backgrounds) */
.ai-pet-dock {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  user-select: none;
}

.ai-pet-dock.is-hidden-route {
  display: none !important;
}

.ai-pet-bubble {
  max-width: 230px;
  padding: 8px 12px;
  border-radius: 12px 12px 12px 4px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(68, 111, 158, 0.18);
  box-shadow: 0 10px 26px rgba(18, 32, 56, 0.12);
  color: #202838;
  font-size: 12px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ai-pet-bubble.is-show {
  opacity: 1;
  transform: translateY(0);
}

.ai-pet-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 420px;
}

.ai-pet-sprite-btn {
  position: relative;
  width: 112px;
  height: 126px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  outline: none;
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out;
}

.ai-pet-sprite-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 68px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(24, 38, 62, 0.24) 0%, transparent 72%);
  pointer-events: none;
}

.ai-pet-sprite-btn.is-happy {
  animation: ai-pet-hop 0.48s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-pet-figure {
  width: 112px;
  height: 122px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 10px 16px rgba(20, 36, 62, 0.2));
  animation: ai-pet-breathe 3.4s ease-in-out infinite;
  transform-origin: center bottom;
}

.ai-pet-sprite {
  width: 96px;
  height: 104px;
  margin: 12px auto 0;
  background-repeat: no-repeat;
  background-size: 768px 936px;
  background-position: 0 0;
  filter: drop-shadow(0 8px 14px rgba(18, 32, 56, 0.18));
}

.ai-pet-float {
  position: absolute;
  left: 50%;
  top: 8px;
  font-size: 14px;
  pointer-events: none;
  animation: ai-pet-rise 0.9s ease-out forwards;
}

.ai-pet-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(68, 111, 158, 0.18);
  box-shadow: 0 8px 20px rgba(18, 32, 56, 0.1);
}

.ai-pet-action {
  border: 0;
  background: transparent;
  color: #36455d;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.ai-pet-action:hover {
  background: rgba(68, 111, 158, 0.12);
  color: #1f3c63;
}

.ai-pet-affection {
  font: 600 10.5px/1 Consolas, monospace;
  color: #e06d88;
  padding: 0 4px;
}

.ai-pet-pill {
  display: none;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(68, 111, 158, 0.22);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  color: #25334a;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(18, 32, 56, 0.12);
  transition: transform 0.18s ease;
}

.ai-pet-pill:hover {
  transform: translateY(-2px);
}

.ai-pet-dock.is-collapsed .ai-pet-body,
.ai-pet-dock.is-collapsed .ai-pet-bubble {
  display: none;
}

.ai-pet-dock.is-collapsed .ai-pet-pill {
  display: inline-flex;
}

html[data-theme='dark'] .ai-pet-bubble,
html[data-theme='dark'] .ai-pet-bar,
html[data-theme='dark'] .ai-pet-pill {
  background: rgba(24, 32, 48, 0.9);
  border-color: rgba(168, 196, 236, 0.2);
  color: #e8eef8;
}

html[data-theme='dark'] .ai-pet-action {
  color: #c2d1e6;
}

html[data-theme='dark'] .ai-pet-action:hover {
  background: rgba(140, 179, 232, 0.16);
  color: #fff;
}

@keyframes ai-pet-breathe {
  0%, 100% { transform: translateY(0) scaleY(1) scaleX(1); }
  50% { transform: translateY(-3px) scaleY(1.022) scaleX(0.99); }
}

@keyframes ai-pet-hop {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-12px) scale(1.07); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes ai-pet-rise {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(1.15); }
}

@media (max-width: 767px) {
  .ai-pet-dock {
    display: none !important;
  }
}
