/* Black Cat V2: production raster renderer layered above the legacy sprite contract. */
.chat-shell .chat-companion-cat {
  --chat-cat-halo: color-mix(in srgb, var(--color-border-strong) 84%, transparent);
  --chat-cat-shadow: color-mix(in srgb, var(--color-overlay) 38%, transparent);
  right: 12px;
  width: 78px;
  height: 68px;
  place-items: stretch;
  filter: drop-shadow(0 7px 10px var(--chat-cat-shadow));
}

.chat-shell .chat-companion-cat .chat-cat-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: center bottom;
  animation: chatCatV2Idle 4.8s ease-in-out infinite;
  filter:
    drop-shadow(0 0 1px var(--chat-cat-halo))
    drop-shadow(0 2px 3px var(--chat-cat-shadow));
}

.chat-shell .chat-companion-cat .chat-cat-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: auto;
  transform-origin: center bottom;
  animation: none;
  user-select: none;
  -webkit-user-drag: none;
}

.chat-shell .chat-companion-cat .chat-cat-frame.is-closed {
  opacity: 0;
  transform:
    translate(var(--chat-cat-closed-x, 0), var(--chat-cat-closed-y, 0))
    scale(var(--chat-cat-closed-scale-x, 1), var(--chat-cat-closed-scale-y, 1));
}

.chat-shell .chat-companion-cat:not(.has-blink) .chat-cat-frame.is-closed {
  display: none;
}

.chat-shell .chat-companion-cat.is-blinking .chat-cat-frame.is-closed {
  opacity: 1;
}

.chat-shell .chat-companion-cat.is-talking .chat-cat-stage,
.chat-shell .chat-companion-cat.is-working .chat-cat-stage {
  animation: none;
}

.chat-shell .chat-companion-cat.is-outing .chat-cat-stage {
  animation: chatCatV2Outing 1.2s ease-in-out infinite;
}

.chat-shell .chat-companion-cat.is-returned .chat-cat-stage {
  animation: chatCatV2Returned 2.5s ease-in-out infinite;
}

.chat-shell .chat-companion-cat.is-close .chat-cat-stage {
  animation: chatCatV2Close 3.4s ease-in-out infinite;
}

.chat-shell .chat-companion-cat.is-shy .chat-cat-stage {
  animation: chatCatV2Shy 3.8s ease-in-out infinite;
}

.chat-shell .chat-companion-cat.is-quiet .chat-cat-stage {
  opacity: 0.92;
  animation-duration: 6.2s;
}

@keyframes chatCatV2Idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1px) scale(1.008); }
}

@keyframes chatCatV2Outing {
  0%, 100% { transform: translateX(-1px) translateY(0); }
  50% { transform: translateX(1px) translateY(-1px); }
}

@keyframes chatCatV2Returned {
  0%, 78%, 100% { transform: translateY(0); }
  87% { transform: translateY(-3px); }
}

@keyframes chatCatV2Close {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1px) scale(1.012); }
}

@keyframes chatCatV2Shy {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(1px) rotate(-0.7deg); }
}

html[data-chat-cat-paused] .chat-shell .chat-companion-cat .chat-cat-stage {
  animation-play-state: paused !important;
}

html[data-chat-cat-paused] .chat-shell .chat-companion-cat .chat-cat-frame.is-closed {
  opacity: 0 !important;
}

.g-desktop-chat-app .chat-companion-cat {
  right: 70px;
  width: 74px;
  height: 64px;
  image-rendering: auto;
}

@media (max-width: 620px) {
  .chat-shell .chat-companion-cat {
    right: 8px;
    width: 70px;
    height: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-shell .chat-companion-cat .chat-cat-stage {
    animation: none !important;
    transform: none !important;
  }

  .chat-shell .chat-companion-cat .chat-cat-frame.is-closed {
    display: none !important;
    animation: none !important;
    opacity: 0 !important;
  }
}
