/* pet.css — Tidal Echo 桌宠样式（独立文件，配 pet/pet.js）。
   gif 自带透明通道，不垫底卡，只加跟随轮廓的投影保证花底纹上看得清。
   两种停靠位（pet.js 顶部 DOCK 开关）：
     dock-header — 顶栏名字左边（默认）：固定可见、永不挡气泡
     dock-float  — 右下角悬浮：更大更显眼，但会盖住聊天流 */

#tidalPet {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; /* 长按藏猫时 iOS 别弹"存储图像"菜单 */
  transition: opacity 0.25s ease;
}

/* 躲猫猫（长按藏起来，主菜单 Pet 一排叫回来）：淡出后彻底不可点，
   visibility 延迟到淡出结束再切，回来时立刻可见走淡入 */
#tidalPet.pet-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

#tidalPet .pet-img {
  display: block;
  width: 100%;
  image-rendering: pixelated;                       /* 像素画放大不糊 */
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.22)); /* 沿轮廓的影子，透明底也立得住 */
}

/* ── 输入区停靠（默认）：发送键正上方，挂在 .composer 内部 ──
   锚 bottom:100% = composer 上沿：输入框多行长高、键盘顶起（--keyboard-offset
   位移在 composer 自身上）都自动跟随，不跟页面死坐标绑定。 */
#tidalPet.dock-composer {
  position: absolute;
  bottom: 100%;
  right: calc(var(--side-pad, 16px) + 2px); /* 对齐发送键那一列 */
  margin-bottom: 6px;
  width: 84px;
}
#tidalPet.dock-composer .pet-label {
  bottom: 100%;
  margin-bottom: 6px;
}

/* ── 顶栏停靠：peerpill 左侧 76px 内边距那块空地 ── */
.peerpill { position: relative; }
#tidalPet.dock-header {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(40px, 6vw, 56px);
}
@media (max-width: 480px) {
  #tidalPet.dock-header { left: 0; width: 34px; } /* 窄屏 peerpill 内边距缩水，小猫也跟着缩 */
}
#tidalPet.dock-header .pet-label {
  top: 100%;              /* 顶栏上方没空间，标签朝下弹 */
  bottom: auto;
  margin-top: 6px;
  margin-bottom: 0;
}

/* ── 悬浮停靠：右下角输入区上方（备用，DOCK='float' 时启用） ── */
#tidalPet.dock-float {
  position: fixed;
  right: 10px;
  bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  width: 84px;
  z-index: 30;
}
#tidalPet.dock-float .pet-label {
  bottom: 100%;
  margin-bottom: 6px;
}

/* ── 状态小标签（点小猫时冒出来） ── */
#tidalPet .pet-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 5;
}
#tidalPet .pet-label.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes pet-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.14) rotate(-3deg); }
  70%  { transform: scale(0.96) rotate(2deg); }
  100% { transform: scale(1); }
}
#tidalPet.pet-pop .pet-img {
  animation: pet-pop 0.45s ease;
}

@media (prefers-reduced-motion: reduce) {
  #tidalPet.pet-pop .pet-img { animation: none; }
}
