.gallery-container {
    padding: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 新增网格系统设置 */
.am-g {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px; /* 抵消item的边距 */
}

.gallery-item {
    box-sizing: border-box; /* 关键修复 */
    padding: 0 8px; /* 创建间距 */
    margin-bottom: 16px;
    break-inside: avoid;
    width: 100%; /* 默认移动端1列 */
}

.gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.gallery-item img:hover {
    transform: scale(1.03); /* 悬停时轻微放大 */
}

/* 桌面端：4列 */
@media (min-width: 1025px) {
    .gallery-item {
        width: 25%; /* 配合父容器的-8px边距 */
    }
}

/* 平板端：3列 */
@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-item {
        width: 33.3333%;
    }
}

/* 移动端：2列 */
@media (max-width: 768px) {
    .gallery-item {
        width: 50%;
    }
}

/* 小屏幕：1列 */
@media (max-width: 480px) {
    .gallery-item {
        width: 50%;
    }
}


/* 遮罩层 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* 子元素垂直排列 */
}

/* 画框 */
.modal-content {
    position: relative;
    max-width: 90vw; /* 最大宽度占屏幕90% */
    max-height: 80vh; /* 最大高度占屏幕90% */
    background: white;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* 图片样式 */
#modalImage {
    max-width: 100%;
    max-height: 100%; /* 留出底部按钮空间 */
    object-fit: contain; /* 保持比例 */
    border-radius: 15px;     /* 设置图片圆角 */
}

/* 下载按钮 */
.modal-footer {
    margin-top: 10px; /* 与画框的间距 */
    text-align: center;
}

.download-btn {
    /* position: absolute;
    bottom: 0; */
    /* left: 50%; */
    /* transform: translateX(-50%); */
    padding: 10px 20px;
    background: rgba(0, 119, 255, 0.5);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    /*opacity: 0.5; /* 元素整体透明度为 0.5 */
}

.download-btn:hover {
    background: rgba(0, 0, 255, 0.5);
}

 /* 关闭按钮 */
 .close-btn {
    position: absolute;
    bottom: -4px;
    left: -4px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    /* text-align: center; */
    /*background-color: #e0e0e0; /* 浅灰色背景 */
    border-radius: 50%; /* 圆形 */
    color: #333;
    font-size: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.close-btn:hover {
    /*background-color: #d0d0d0; /* 悬停时背景变深 */
    color: #f00; /* 悬停时“×”变红 */
}