body .markdown-body img,
body .markdown-summary img,
body .comment-content img {
  display: block;
  max-width: 50%;
  max-height: 40vh;
  width: auto;
  height: auto;
  margin-inline: auto;
  border-radius: 5px;
  object-fit: contain;
}

.markdown-expandable-image {
  cursor: zoom-in;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.markdown-expandable-image:hover {
  transform: translateY(-2px) scale(1.015);
  filter: brightness(1.04) saturate(1.04);
  box-shadow: 0 10px 28px rgba(83, 35, 63, 0.18);
}

.markdown-expandable-image:focus-visible {
  outline: 3px solid var(--pink, #ef71a8);
  outline-offset: 4px;
}

.markdown-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 10, 18, 0);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  opacity: 0;
  cursor: zoom-out;
  touch-action: none;
  overscroll-behavior: contain;
  transition: background-color 220ms ease, opacity 220ms ease;
}

.markdown-image-viewer-open {
  background: rgba(17, 10, 18, 0.92);
  opacity: 1;
}

.markdown-image-viewer-frame {
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 100%;
  opacity: 0;
  scale: 0.9;
  transition: opacity 220ms ease, scale 220ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: scale;
}

.markdown-image-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  transform: translate(var(--viewer-translate-x, 0), var(--viewer-translate-y, 0)) scale(var(--viewer-scale, 1));
  will-change: transform;
}

.markdown-image-viewer-open .markdown-image-viewer-frame {
  opacity: 1;
  scale: 1;
}

.markdown-image-viewer-dragging .markdown-image-viewer-image {
  cursor: grabbing;
}

.markdown-image-viewer-closing .markdown-image-viewer-frame {
  opacity: 0;
  scale: 0.94;
}

.markdown-image-viewer-close {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.markdown-image-viewer-open .markdown-image-viewer-close {
  opacity: 1;
  transform: scale(1);
}

.markdown-image-viewer-close:hover {
  background: rgba(0, 0, 0, 0.72);
  transform: scale(1.06);
}

.markdown-image-viewer-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .markdown-expandable-image,
  .markdown-image-viewer,
  .markdown-image-viewer-frame,
  .markdown-image-viewer-close {
    transition: none;
  }

  .markdown-expandable-image:hover {
    transform: none;
  }
}

@media (max-width: 768px) {
  body .markdown-body img,
  body .markdown-summary img,
  body .comment-content img {
    max-width: 80%;
    max-height: 40vh;
  }

  .markdown-image-viewer {
    padding: 12px;
  }

  .markdown-image-viewer-close {
    top: 12px;
    right: 12px;
  }
}
