/* 宠物「丁奕铭」— 金刚鹦鹉抠图透明 PNG（2026-08-22）
 * 位置：fixed 左下角（与小分右下角呼应），台词气泡在宠物右上角
 * 页面引入 <link pet.css> 后由 pet.js 挂 #pet-root
 */

#pet-root {
  position: fixed;
  left: 12px;
  bottom: 8px;
  z-index: 9998;          /* 略低于小分(9999)，避免抢戏 */
  pointer-events: none;
  --s: 1;
  transform: scale(var(--s));
  transform-origin: bottom left;
}
@media (max-width: 899px) { #pet-root { --s: 0.85; } }
@media (max-width: 599px) { #pet-root { --s: 0.66; } }

.pet-float-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* 台词气泡：宠物右上角（向上、略偏右），尾巴指向宠物 */
.pet-bubble {
  margin-left: 44px;
  max-width: 210px;
  background: #0d2138;
  color: #e8f4fb;
  font-size: 12px;
  line-height: 1.9;
  padding: 10px 14px;
  border: 4px solid #fff;
  box-shadow: 0 4px 0 #000;
  opacity: 0;
  transform: translateY(6px) scale(.9);
  transition: opacity .18s ease, transform .18s ease;
}
.pet-bubble.show { opacity: 1; transform: translateY(0) scale(1); }

/* 舞台：抠图素材比例约 1:1.7（不同形象略有差异，object-fit 兜底） */
.pet-stage {
  position: relative;
  width: 92px;
  height: 156px;
}

.pet-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
  animation: petBob 3.6s ease-in-out infinite;
  cursor: pointer;
  pointer-events: auto;   /* #pet-root 是 pointer-events:none，单独放行图片可点 */
}
@keyframes petBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* 点击 → 左右晃动（覆盖默认上下浮动 bob，动画结束后由 JS 移除 .shake 恢复 bob） */
.pet-img.shake {
  animation: petShake 0.45s ease-in-out;
}
@keyframes petShake {
  0%, 100% { transform: translateX(0); }
  12.5% { transform: translateX(-6px); }
  37.5% { transform: translateX(6px); }
  62.5% { transform: translateX(-3px); }
  87.5% { transform: translateX(3px); }
}

/* ── 手机档折叠（G3，2026-09-30）：≤600px 丁奕铭收成角落按钮，点开弹出、点别处收起 ── */
.pet-tab {
  display: none; position: fixed; left: 10px; bottom: 10px; z-index: 9998;
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 3px 0 #000; background: #0d2138; padding: 2px; cursor: pointer;
}
.pet-tab img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
@media (max-width: 600px) {
  .pet-tab { display: block; }
  #pet-root .pet-float-box { display: none; }
  #pet-root.open .pet-float-box { display: flex; }
  #pet-root.open .pet-tab { display: none; }
}

/* 地面投影 */
.pet-shadow {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  width: 52px;
  height: 10px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 70%);
  animation: petShadowPulse 3.6s ease-in-out infinite;
}
@keyframes petShadowPulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.8; }
  50% { transform: translateX(-50%) scale(0.78); opacity: 0.4; }
}
