/* Align the visible character, not the transparent 64px source canvas.
 * Players occupy x=17..47 and y=32..64. At 5/3 frame size their visible
 * bounds are centered, with a 1/12-frame vertical inset on both sides. */
#tibia-dzis .live-sprite.live-sprite-players img {
  position: absolute;
  width: 166.6666666667%;
  height: 166.6666666667%;
  max-width: none;
  left: -33.3333333333%;
  top: -75%;
}
#tibia-dzis .live-sprite {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

#tibia-dzis .live-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
}

/* Leave room for the full sprite throughout its boosted animation. */
#tibia-dzis #monster-image,
#tibia-dzis #boss-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 5px;
  box-sizing: border-box;
}

/* Keep the complete animation canvas inside its frame. */
#tibia-dzis .live-sprite:has(#monster-image),
#tibia-dzis .live-sprite:has(#boss-image) { overflow: visible; }

/*
 * Original APNG is 64 × 64. Across all 16 frames, visible pixels occupy
 * x=14..49 and y=26..64 (35 × 38). Fit that union into the shared square
 * without stretching the character, changing the file, or losing animation.
 * Scale = 64/38; horizontally center the 35-pixel visible area.
 */
#tibia-dzis .live-sprite-rashid img {
  position: absolute;
  width: 168.4210526316%;
  height: 168.4210526316%;
  max-width: none;
  left: -32.8947368421%;
  top: -68.4210526316%;
}

@media (max-width: 600px) {
  #tibia-dzis .live-sprite {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }
}
