/* 博客桌宠：透明 WebM + 可拖动（素材来自 dsh-pet，MIT） */
#blog-pet {
  /* 随视口宽度缩放：小屏收、大屏放。
     上限 560px 仍小于素材原生宽度（640×360），不会糊；
     移动端整只隐藏，见下面 768px 的断点 */
  --pet-w: clamp(240px, 25vw, 560px);
  position: fixed;
  left: 16px;
  bottom: 24px;
  width: var(--pet-w);
  height: auto;
  aspect-ratio: 640 / 360;
  z-index: 9998;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  transition: opacity .35s ease;
  filter: saturate(1.22) contrast(1.06);
  will-change: left, top;
}
#blog-pet.ready { opacity: 1; }
#blog-pet.dragging { cursor: grabbing; }
#blog-pet video {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
@media (max-width: 768px) {
  #blog-pet { display: none !important; }
}
@media print {
  #blog-pet { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  #blog-pet { transition: none; }
}

/* 右键动作菜单：全部走主题变量，亮/暗自动跟随 */
#blog-pet-menu {
  position: fixed;
  z-index: 10001;
  display: none;
  min-width: 182px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  background: var(--anzhiyu-card-bg, #fff);
  color: var(--anzhiyu-fontcolor, #363636);
  border: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  box-shadow: var(--anzhiyu-shadow-blackdeep, 0 14px 40px rgba(0, 0, 0, .16));
  font-size: 12.5px;
  line-height: 1.4;
  user-select: none;
  transform-origin: top left;
}
#blog-pet-menu.is-open { animation: pet-menu-in .18s ease-out; }
@keyframes pet-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.97); }
  to { opacity: 1; transform: none; }
}
#blog-pet-menu::-webkit-scrollbar { width: 4px; }
#blog-pet-menu::-webkit-scrollbar-thumb {
  background: var(--anzhiyu-scrollbar, rgba(60, 60, 67, .4));
  border-radius: 4px;
}
#blog-pet-menu .pet-menu-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--anzhiyu-fontcolor, #363636);
}
#blog-pet-menu .pet-menu-head::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--anzhiyu-main, #425AEF);
  box-shadow: 0 0 0 3px var(--anzhiyu-main-op, rgba(66, 90, 239, .14));
}
#blog-pet-menu .pet-menu-group {
  padding: 9px 9px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--anzhiyu-secondtext, #9aa0b4);
}
#blog-pet-menu .pet-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--anzhiyu-fontcolor, #363636);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#blog-pet-menu .pet-menu-item::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--anzhiyu-card-border, #d8deea);
  transition: background .15s ease;
}
#blog-pet-menu .pet-menu-item:hover,
#blog-pet-menu .pet-menu-item:focus-visible {
  background: var(--anzhiyu-secondbg, #f7f7f9);
  color: var(--anzhiyu-main, #425AEF);
  outline: none;
}
#blog-pet-menu .pet-menu-item:hover::before,
#blog-pet-menu .pet-menu-item:focus-visible::before {
  background: var(--anzhiyu-main, #425AEF);
}
#blog-pet-menu .pet-menu-sep {
  height: 1px;
  margin: 7px 9px;
  background: var(--anzhiyu-card-border, #e3e8f7);
}
#blog-pet-menu .pet-menu-tabs {
  display: flex;
  gap: 2px;
  margin: 0 4px 6px;
  padding: 2px;
  border-radius: 9px;
  background: var(--anzhiyu-secondbg, #f7f7f9);
}
#blog-pet-menu .pet-tab {
  flex: 1 1 0;
  padding: 6px 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--anzhiyu-secondtext, #9aa0b4);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#blog-pet-menu .pet-tab.is-on {
  background: var(--anzhiyu-card-bg, #fff);
  color: var(--anzhiyu-main, #425AEF);
  box-shadow: var(--anzhiyu-shadow-border, 0 1px 3px rgba(0, 0, 0, .08));
}
#blog-pet-menu .pet-menu-pane[hidden] { display: none; }
#blog-pet-menu .pet-tool-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--anzhiyu-fontcolor, #363636);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
#blog-pet-menu .pet-tool-row i {
  width: 16px;
  color: var(--anzhiyu-secondtext, #9aa0b4);
  font-size: 13px;
  text-align: center;
}
#blog-pet-menu .pet-tool-row:hover,
#blog-pet-menu .pet-tool-row:focus-visible {
  background: var(--anzhiyu-secondbg, #f7f7f9);
  color: var(--anzhiyu-main, #425AEF);
  outline: none;
}
#blog-pet-menu .pet-tool-row:hover i,
#blog-pet-menu .pet-tool-row:focus-visible i {
  color: var(--anzhiyu-main, #425AEF);
}
@media (prefers-reduced-motion: reduce) {
  #blog-pet-menu.is-open { animation: none; }
}

/* 隐藏后的恢复入口 */
#blog-pet-restore {
  position: fixed;
  left: 16px;
  bottom: 24px;
  z-index: 9997;
  display: none;
  padding: 7px 12px;
  border: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  border-radius: 999px;
  background: var(--anzhiyu-card-bg, #fff);
  color: var(--anzhiyu-secondtext, #9aa0b4);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--anzhiyu-shadow-border, 0 1px 3px rgba(0, 0, 0, .08));
  transition: color .15s ease, border-color .15s ease;
}
#blog-pet-restore:hover,
#blog-pet-restore:focus-visible {
  color: var(--anzhiyu-main, #425AEF);
  border-color: var(--anzhiyu-main, #425AEF);
  outline: none;
}
@media (max-width: 768px) {
  #blog-pet-restore { display: none !important; }
}

/* 对话气泡：随机推荐 / 关于我 */
#blog-pet-bubble {
  position: fixed;
  z-index: 10002;
  display: block;
  max-width: 300px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(.98);
  transform-origin: 50% 100%;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  pointer-events: none;
}
#blog-pet-bubble.is-on {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#blog-pet-bubble .pet-bubble-card {
  position: relative;
  padding: 12px 14px 12px;
  border: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  border-radius: 14px;
  background: var(--anzhiyu-card-bg, #fff);
  color: var(--anzhiyu-fontcolor, #363636);
  box-shadow: var(--anzhiyu-shadow-blackdeep, 0 8px 24px rgba(0, 0, 0, .12));
  line-height: 1.6;
}
#blog-pet-bubble .pet-bubble-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--anzhiyu-secondbg, #f7f7f9);
  color: var(--anzhiyu-main, #425AEF);
  font-size: 11px;
  letter-spacing: .02em;
}
#blog-pet-bubble .pet-bubble-tag[hidden] { display: none; }
#blog-pet-bubble .pet-bubble-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 4px;
}
#blog-pet-bubble .pet-bubble-title[hidden] { display: none; }
#blog-pet-bubble .pet-bubble-text {
  font-size: 12.5px;
  color: var(--anzhiyu-secondtext, #7b8296);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 10.8em;
  overflow: hidden;
}
#blog-pet-bubble .pet-bubble-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--anzhiyu-main, #425AEF);
  text-decoration: none;
}
#blog-pet-bubble .pet-bubble-link[hidden] { display: none; }
#blog-pet-bubble .pet-bubble-link:hover { text-decoration: underline; }
#blog-pet-bubble .pet-bubble-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--anzhiyu-secondtext, #9aa0b4);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s ease, background .15s ease;
}
#blog-pet-bubble .pet-bubble-close:hover {
  opacity: 1;
  background: var(--anzhiyu-secondbg, #f7f7f9);
}
#blog-pet-bubble .pet-bubble-tail {
  position: absolute;
  top: 100%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -7px;
  background: var(--anzhiyu-card-bg, #fff);
  border-right: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  border-bottom: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  transform: rotate(45deg);
}
/* 桌宠被拖到顶部、气泡翻到角色下方时，箭头翻到气泡上沿朝上 */
#blog-pet-bubble.is-below .pet-bubble-tail {
  top: -7px;
  margin-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-top: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  border-left: 1px solid var(--anzhiyu-card-border, #e3e8f7);
}
@media (max-width: 768px) {
  #blog-pet-bubble { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  #blog-pet-bubble { transition: none; }
}
/* 倒计时 / 取消跳转 */
#blog-pet-bubble .pet-bubble-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--anzhiyu-card-border, #e3e8f7);
}
#blog-pet-bubble .pet-bubble-actions[hidden] { display: none; }
#blog-pet-bubble .pet-bubble-count {
  font-size: 12px;
  color: var(--anzhiyu-secondtext, #9aa0b4);
}
#blog-pet-bubble .pet-bubble-cancel {
  flex: none;
  padding: 3px 10px;
  border: 1px solid var(--anzhiyu-card-border, #e3e8f7);
  border-radius: 999px;
  background: transparent;
  color: var(--anzhiyu-secondtext, #7b8296);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
#blog-pet-bubble .pet-bubble-cancel:hover,
#blog-pet-bubble .pet-bubble-cancel:focus-visible {
  color: var(--anzhiyu-main, #425AEF);
  border-color: var(--anzhiyu-main, #425AEF);
  outline: none;
}
/* 长文案（关于我）：放宽一点，别把话截掉 */
#blog-pet-bubble.is-long { max-width: 340px; }
#blog-pet-bubble.is-long .pet-bubble-text {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}
#blog-pet-bubble.is-long .pet-bubble-text::-webkit-scrollbar { width: 4px; }
#blog-pet-bubble.is-long .pet-bubble-text::-webkit-scrollbar-thumb {
  background: var(--anzhiyu-scrollbar, #d6dbe8);
  border-radius: 4px;
}
#blog-pet-bubble .pet-bubble-tag i { font-size: 11px; }
/* 右侧那整组悬浮按钮改由桌宠菜单接管：只是藏起来，DOM 保留
   （桌宠的「切换深浅 / 单栏·双栏 / 阅读模式 / 跳到评论 / 回到顶部」还是代理点它们）
   移动端不藏，桌宠在移动端本来就不显示；
   桌宠被隐藏后（html.pet-hidden）按钮还给页面，否则那几项就彻底没入口了 */
@media (min-width: 769px) {
  html:not(.pet-hidden) #rightside { display: none !important; }
  /* 阅读模式右上角的 × 收进「设置」页；桌宠藏起来后同样还给页面 */
  html:not(.pet-hidden) .exit-readmode { display: none !important; }
}