.image-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999; /* 确保最高层级，不被遮挡 */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* 遮罩层 - 黑色高透明 */
.image-preview-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: zoom-out;
    transition: opacity 0.3s ease;
}

/* --- 核心修改点：滚动容器样式 --- */
/* 图片外层容器 - 负责处理滚动 */
.image-preview-wrap {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 100vh; /* 关键：高度不能超过视口 */
    overflow-y: auto;  /* 关键：当内容超出时显示垂直滚动条 */
    overflow-x: hidden;/* 禁止水平滚动 */
    width: 100%;
}

/* 图片内层容器 - 负责在滚动区域内居中 */
.image-preview-inner {
    display: flex;
    align-items: center;    /* 垂直居中 */
    justify-content: center;/* 水平居中 */
    min-height: 100%;       /* 关键：确保容器至少有父容器的高度，才能让内容真正居中 */
    padding: 20px;        /* 上下内边距，让图片上下都有呼吸空间 */
}
/* --- 修改结束 --- */

/* 预览图片 - 保持比例 */
.image-preview-img {
    max-width: 100%;
    height: auto; /* 关键：让高度自动适应宽度，保持比例 */
    border-radius: 6px;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.15);
    transition: transform 0.2s ease-out;
    cursor: grab;
}

.image-preview-img:active {
    cursor: grabbing;
}


.image-preview-controls {
    position: fixed;
    bottom: 50px;
    right: 20px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-preview-close{
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2;
}

/* 优化后的关闭按钮样式 - 简洁现代 */
.image-preview-btn {
    background: rgba(200, 200, 200, 0.1); /* 半透明白色背景 */
    border: none;
    color: #999999;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    -webkit-backdrop-filter: blur(8px);
}

/* hover效果 - 背景变白，文字变黑 */
.image-preview-btn:hover {
    background: rgba(200, 200, 200, 0.2); /* 半透明白色背景 */
    color: #666666;
    transform: scale(1.05); /* 轻微放大 */
}

/* 点击效果 */
.image-preview-close:active {
    transform: scale(0.98);
}

.image-preview-close:focus {
    outline: none;
}

/* 禁止背景滚动 */
body.image-preview-open {
    overflow: hidden;
}