/* sub2api-site · 网页桌宠样式（只作用于 .pet-* 命名空间，不污染宿主页面） */

.pet-root {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9000;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 宠物本体 ---------- */
.pet-body {
  position: absolute;
  left: 0;
  top: 0;
  width: 200px;
  height: 112.5px;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  transform-origin: 50% 100%;
  transition: filter 0.2s ease;
}

.pet-body.is-dragging {
  cursor: grabbing;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45));
}

.pet-body.is-squeezed {
  transform: scale(1.06, 0.94);
}

.pet-body video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  opacity: 0;
  transition: opacity 0.14s linear;
  pointer-events: none;
  -webkit-user-drag: none;
}

.pet-body video.is-on {
  opacity: 1;
}

/* 悬停时轻微提亮，提示可交互 */
.pet-body:hover {
  filter: drop-shadow(0 6px 14px rgba(107, 140, 255, 0.28));
}

/* ---------- 气泡 ---------- */
.pet-bubble {
  position: absolute;
  max-width: 220px;
  padding: 7px 11px;
  border-radius: 11px;
  background: rgba(12, 15, 21, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e9edf3;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.pet-bubble.is-on {
  opacity: 1;
  transform: none;
}

.pet-bubble::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: rgba(12, 15, 21, 0.94);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  transform: rotate(45deg);
}

/* ---------- 右键菜单 ---------- */
.pet-menu {
  position: fixed;
  z-index: 9010;
  min-width: 148px;
  padding: 5px;
  border-radius: 11px;
  background: #0a0c11;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 48px -22px rgba(0, 0, 0, 0.95);
  font-size: 12.5px;
  color: #e9edf3;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.pet-menu.is-on {
  opacity: 1;
  transform: none;
}

.pet-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pet-menu button:hover,
.pet-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.pet-menu hr {
  margin: 4px 6px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

/* ---------- 菜单里的尺寸调节 ----------
   注意：下面几个选择器都带 .pet-menu 前缀，否则会被上面的 `.pet-menu button`
   （特异性 0,1,1）盖掉 width / padding / display。 */
.pet-menu .pet-size {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 5px 6px;
}

.pet-menu .pet-size-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  flex: none;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #e9edf3;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease;
}

.pet-menu .pet-size-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pet-menu .pet-size-val {
  flex: 1;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: #a8b1c0;
  letter-spacing: 0.02em;
}

.pet-menu .pet-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 0 5px 6px;
}

.pet-menu .pet-preset {
  display: block;
  width: auto;
  padding: 5px 0;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #a8b1c0;
  font: inherit;
  font-size: 11.5px;
  text-align: center;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.pet-menu .pet-preset:hover {
  background: rgba(107, 140, 255, 0.16);
  color: #fff;
  border-color: rgba(107, 140, 255, 0.4);
}

.pet-menu .pet-credit {
  display: block;
  padding: 5px 9px 3px;
  color: #79828f;
  font-size: 10.5px;
  line-height: 1.5;
  text-decoration: none;
}

.pet-menu .pet-credit:hover {
  color: #a8b1c0;
}

/* ---------- 隐藏后的小开关 ---------- */
.pet-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9000;
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 12, 17, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #e9edf3;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.9);
  transition: background 0.16s ease, transform 0.16s ease;
  /* 父级 .pet-root 是 pointer-events:none，这里必须显式打开，否则点不到 */
  pointer-events: auto;
}

.pet-toggle:hover {
  background: rgba(24, 28, 38, 0.95);
  transform: translateY(-1px);
}

.pet-toggle svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.pet-root.is-hidden .pet-body {
  display: none;
}

.pet-root.is-hidden .pet-toggle {
  display: inline-flex;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .pet-bubble {
    max-width: 160px;
    font-size: 12px;
  }

  .pet-toggle {
    right: 12px;
    bottom: 12px;
    height: 32px;
    padding: 0 11px;
    font-size: 12px;
  }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .pet-body,
  .pet-bubble,
  .pet-menu,
  .pet-toggle {
    transition-duration: 0.001ms !important;
  }
}
