/* ------------------------------------------------------------
   萌宠「禾兔」
   ------------------------------------------------------------
   全部颜色取自主题令牌，所以各套皮肤 + 深色模式都自动适配。
   位置贴在右下角，浮动图标（.fab）会自动落在它上方：fab.js 检测到萌宠存在时
   给 body 加 .has-pet，图标整组上抬；后台关掉萌宠就没有这个类，图标落回底部。
   ------------------------------------------------------------ */
.pet {
  position: fixed; right: 18px; bottom: 22px; z-index: 45;
  display: flex; align-items: flex-end; gap: 4px;
  pointer-events: none;
}

.pet-badge {
  pointer-events: auto;
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  box-shadow: 0 6px 18px rgba(20, 40, 80, .14);
  cursor: pointer; padding: 0; flex: none;
  display: grid; place-items: center;
  animation: pet-bob 3.4s ease-in-out infinite;
  transition: transform .18s, box-shadow .18s;
}
.pet-badge:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 24px rgba(20, 40, 80, .2); }
.pet-badge svg { width: 44px; height: 44px; display: block; overflow: visible; }
@keyframes pet-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
/* 说话时轻轻一跳 */
.pet.talk .pet-badge { animation: pet-hop .62s ease; }
@keyframes pet-hop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-8px) scale(1.06); }
  70% { transform: translateY(0) scale(.98); }
  100% { transform: translateY(0) scale(1); }
}
/* 耳朵与眼睛的小动作 */
.pet-ear-l { transform-origin: 24px 26px; animation: pet-ear 6.5s ease-in-out infinite; }
.pet-ear-r { transform-origin: 40px 26px; animation: pet-ear 6.5s ease-in-out .3s infinite; }
@keyframes pet-ear {
  0%, 86%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(-7deg); }
  94% { transform: rotate(4deg); }
}
.pet-eyes { transform-origin: 32px 34px; animation: pet-blink 5.2s ease-in-out infinite; }
@keyframes pet-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.12); }
}

/* 气泡 */
.pet-bubble {
  pointer-events: auto;
  position: relative; max-width: 216px; margin-right: 8px; margin-bottom: 8px;
  background: var(--card); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 9px 26px 9px 12px; font-size: 12.8px; line-height: 1.6;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(6px) scale(.96); transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
  visibility: hidden;
}
.pet-bubble.on { opacity: 1; transform: none; visibility: visible; }
.pet-bubble::after {
  content: ''; position: absolute; right: -5px; bottom: 12px; width: 9px; height: 9px;
  background: var(--card); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(-45deg);
}
.pet-bubble b { color: var(--brand); font-weight: 700; }
.pet-close {
  position: absolute; right: 3px; top: 3px; width: 20px; height: 20px;
  border: 0; background: none; color: var(--sub-2); font-size: 14px; line-height: 1;
  cursor: pointer; border-radius: 50%; display: grid; place-items: center;
}
.pet-close:hover { background: var(--fill); color: var(--ink-2); }

@media (max-width: 600px) {
  .pet { right: 12px; bottom: 16px; }
  .pet-badge { width: 48px; height: 48px; }
  .pet-badge svg { width: 38px; height: 38px; }
  .pet-bubble { max-width: 56vw; font-size: 12.2px; }
}
@media print {
  .pet { display: none !important; }
}
