.fox-pet {
  position: fixed;
  z-index: 90;
  left: calc(100vw - 164px);
  top: calc(100vh - 164px);
  width: 144px;
  height: 148px;
  --pet-facing: 1;
  --move-duration: 0ms;
  transition: left var(--move-duration) linear, top var(--move-duration) linear;
  touch-action: none;
  user-select: none;
  will-change: left, top;
}
.fox-pet.facing-left { --pet-facing: -1; }
.fox-pet.is-positioning { transition: none !important; }
.fox-pet.is-dragging { z-index: 120; transition: none !important; }
.fox-pet-trigger {
  position: absolute;
  inset: 0;
  width: 144px;
  height: 144px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: filter .2s ease;
}
.fox-pet.is-dragging .fox-pet-trigger { cursor: grabbing; }
.fox-pet-trigger:hover { filter: brightness(1.04); }
.fox-pet-sprite {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(var(--pet-facing));
  transform-origin: center bottom;
  pointer-events: none;
}
.fox-pet-cart-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #ef6149;
  box-shadow: 0 4px 12px rgba(121, 43, 29, .25);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}
.fox-pet-cart-badge[hidden], .fox-pet-bubble[hidden], .fox-pet-panel[hidden] { display: none; }
.fox-pet.is-reacting .fox-pet-sprite { animation: foxPetCheer .2s ease-in-out 4 alternate; }
.fox-pet-bubble {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 142px;
  width: max-content;
  max-width: 168px;
  padding: 8px 11px;
  border: 1px solid #bad4e2;
  border-radius: 6px;
  color: #254c62;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 10px 26px rgba(37, 76, 98, .14);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.fox-pet.near-left .fox-pet-bubble { right: auto; left: 0; }
@keyframes foxPetCheer {
  from { transform: scaleX(var(--pet-facing)) translateY(0) rotate(-2deg); }
  to { transform: scaleX(var(--pet-facing)) translateY(-10px) rotate(2deg); }
}
.fox-pet-panel {
  position: absolute;
  right: calc(100% + 8px);
  top: 8px;
  display: grid;
  gap: 0;
  width: 196px;
  padding: 10px;
  border: 1px solid #bed7e4;
  border-radius: 6px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 42px rgba(37, 76, 98, .19);
  transform-origin: right bottom;
}
.fox-pet.near-bottom .fox-pet-panel { top: auto; bottom: 8px; }
.fox-pet.near-left .fox-pet-panel { right: auto; left: calc(100% + 8px); transform-origin: left bottom; }
.fox-pet-panel::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 33px;
  width: 12px;
  height: 12px;
  border-right: 1px solid #bed7e4;
  border-bottom: 1px solid #bed7e4;
  background: #fff;
  transform: rotate(-45deg);
}
.fox-pet.near-left .fox-pet-panel::after { right: auto; left: -7px; transform: rotate(135deg); }
.fox-pet:not(.near-bottom) .fox-pet-panel::after { top: 33px; bottom: auto; }
.fox-pet-panel strong { padding: 8px 10px 10px; color: #668093; font-size: 12px; }
.fox-pet-panel a { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 9px 11px; border-radius: 4px; color: #254c62; font-weight: 750; text-decoration: none; }
.fox-pet-panel a:hover, .fox-pet-panel a[aria-current="page"] { color: #0d5c8f; background: #eaf7fd; }
.fox-pet-panel a span { color: #ef6149; }
@media (max-width: 680px) {
  .fox-pet { width: 96px; height: 100px; }
  .fox-pet-trigger { width: 96px; height: 96px; }
  .fox-pet-bubble, .fox-pet.near-left .fox-pet-bubble { right: 0; bottom: 98px; left: auto; }
  .fox-pet-panel, .fox-pet.near-left .fox-pet-panel { top: auto; right: 0; bottom: 104px; left: auto; width: 184px; transform-origin: right bottom; }
  .fox-pet-panel::after, .fox-pet.near-left .fox-pet-panel::after { right: 22px; bottom: -7px; left: auto; transform: rotate(45deg); }
}
@media (prefers-reduced-motion: reduce) { .fox-pet, .fox-pet-sprite { transition: none !important; animation: none !important; } }

.fox-purchase-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #eea44a;
  border-radius: 999px;
  color: #8b470e;
  background: #fff8e8;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .16s ease, color .16s ease, background .16s ease, border-color .16s ease;
}
.fox-purchase-button:hover { transform: translateY(-1px); background: #fff0ca; }
.fox-purchase-button.is-selected { border-color: #ef714f; color: #fff; background: #ef714f; }
.library-term .fox-purchase-button { margin-top: 12px; }
.card-tools .fox-purchase-button { min-height: 32px; }
