.markdown-body .viewer-trigger {
    cursor: pointer;
}

/* Markdown 正文图片：加载前骨架占位（span 包裹，避免在 p 内插入 div 破坏 HTML）
   整行宽度 + text-align:center + 行内块图片，居中稳定且不与 absolute 骨架抢 flex 高度/层叠 */
.markdown-body .md-img-wrap {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    text-align: center;
    border-radius: 6px;
    overflow: hidden;
    box-sizing: border-box;
}

.markdown-body .md-img-box {
    position: relative;
    display: inline-block;
    max-width: 100%;
    vertical-align: middle;
}

.markdown-body .md-img-wrap:not(.is-loaded) {
    min-height: 160px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.markdown-body .md-img-box > img {
    display: inline-block;
    margin: 0;
    float: none;
    position: relative;
    z-index: 1;
    vertical-align: middle;
    max-width: 100%;
    height: auto;
}

.markdown-body .md-img-watermark {
    position: absolute;
    top: 8px;
    right: 20px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: calc(6px * var(--md-img-watermark-scale, 1));
    pointer-events: none;
    user-select: none;
    color: #5ea3ed;
    font-size: calc(30px * var(--md-img-watermark-scale, 1));
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 0.5;
}

.markdown-body .md-img-watermark-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin: 0;
    object-fit: contain;
    flex: none;
    vertical-align: -0.12em;
}

.markdown-body .md-img-skeleton {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 1;
    pointer-events: none;
    background-color: #eceff3;
    background-image: linear-gradient(
        100deg,
        #eceff3 0%,
        #eceff3 32%,
        #f4f6f9 44%,
        #fafbfc 50%,
        #f4f6f9 56%,
        #eceff3 68%,
        #eceff3 100%
    );
    background-size: 240% 100%;
    animation: md-img-skeleton-shimmer 2.1s ease-in-out infinite;
}

.markdown-body .md-img-wrap.is-loaded .md-img-skeleton {
    opacity: 0;
    transition: opacity 0.28s ease;
}

.markdown-body .md-img-wrap.is-error .md-img-skeleton {
    background: #e8eaef;
    background-image: none;
    animation: none;
}

@keyframes md-img-skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: zoom-out;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: none;
}

.image-viewer-overlay.is-zoomed {
    cursor: default;
}

/* 图片容器 */
.image-viewer-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: none;
}

/* 查看器中的图片 */
.image-viewer-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.1s ease;
    cursor: zoom-in;
    touch-action: none;
    user-select: none;
}

.image-viewer-overlay.is-zoomed .image-viewer-img {
    cursor: zoom-out;
}

/* 右上角关闭按钮 */
.image-viewer-close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 10000;
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.image-viewer-close:hover,
.image-viewer-close:focus {
    background-color: rgba(255, 255, 255, 0.24);
    outline: none;
    transform: scale(1.05);
}

.image-viewer-close:active {
    transform: scale(0.95);
}

.image-viewer-close i {
    pointer-events: none;
}

