/* 1. 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background-color: #f4f6f9; 
    color: #333; 
    padding: 15px; 
}

h1 { text-align: center; margin-bottom: 20px; font-size: 20px; color: #2c3e50; }

/* 2. 图片网格布局 (响应式) */
.gallery {
    display: grid;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
    /* 手机默认单列，平板2列，电脑3列以上 */
    grid-template-columns: 1fr; 
}

/* 3. 图片卡片样式 */
.card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card img {
    width: 100%;
    /* 手机端高度自适应，保持原图比例，防止被裁切 */
    height: auto; 
    display: block;
    cursor: pointer;
}

.card-info {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title { 
    font-size: 15px; 
    font-weight: bold; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 60%;
}

.btn-download {
    padding: 8px 15px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    /* 增加手机端点击热区 */
    min-width: 60px; 
    text-align: center;
}
.btn-download:active { background-color: #2980b9; }

/* 4. 手机端全屏预览遮罩层 */
.lightbox {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    justify-content: center; align-items: center;
    z-index: 1000; cursor: pointer;
}
.lightbox.active { display: flex; }
.lightbox img { 
    /* 确保预览图不超出手机屏幕 */
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
}

/* 5. 平板和电脑端的自适应 */
@media (min-width: 600px) {
    .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
     .gallery { 
        grid-template-columns: repeat(2, 1fr); 
    }
    body { padding: 20px; }
}
