/* 性能优化：使用 content-visibility 提升渲染性能 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

html, body {
    touch-action: pan-x pan-y;
    -ms-touch-action: pan-x pan-y;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

/* 图片加载优化 */
img {
    content-visibility: auto;
    contain: paint;
}

/* 图片防盗保护样式 */
img, figure, .gallery-item {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
    pointer-events: auto !important;
}

/* 防止图片被选中 */
img::selection {
    background: transparent !important;
}

/* 防止长按保存（iOS） */
img {
    -webkit-touch-callout: none !important;
}

/* 防止图片在移动端被拖拽 */
figure, .gallery-item {
    touch-action: pan-x pan-y;
    -webkit-touch-action: pan-x pan-y;
}

/* 防止图片被保存的遮罩层（可选） */
.gallery-item {
    position: relative;
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1;
    pointer-events: none;
}

.gallery-item img {
    position: relative;
    z-index: 0;
}

/* 截图保护样式 */
@media (prefers-reduced-motion: reduce) {
    body {
        filter: blur(20px) !important;
    }
}

/* 防止截图时的内容捕获 */
body.screenshot-detected {
    filter: blur(30px) !important;
}

body.screenshot-detected img,
body.screenshot-detected figure,
body.screenshot-detected .gallery-item {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 减少动画对性能的影响 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

header {
    background-color: #333;
    color: #fff;
    padding: 1rem;
    text-align: center;
}

nav ul {
    list-style: none;
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: #555;
}

main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-container {
    margin-top: 1rem;
}

.category-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
}

.gallery-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
}

.gallery-item figcaption {
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* 友情链接样式 */
.friendlinks-section {
    background-color: #f8f8f8;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

.friendlinks-section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.friendlinks-section h3 {
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
    border-bottom: none;
    font-size: 1.3rem;
}

.friendlinks-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.friendlinks-list a {
    color: #666;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.friendlinks-list a:hover {
    color: #d4af37;
    border-color: #d4af37;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 添加 footer 样式 */
footer {
    background-color: #2c2c2c;
    color: #fff;
    padding: 0;
    margin-top: 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    text-align: left;
}

.footer-section h4 {
    color: #d4af37;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    color: #ccc;
    line-height: 1.6;
    margin: 0.5rem 0;
}

.footer-bottom {
    background-color: #1a1a1a;
    padding: 1.5rem 2rem;
    text-align: center;
    border-top: 1px solid #444;
}

.footer-bottom p {
    margin: 0.3rem 0;
    font-size: 0.85rem;
    color: #999;
}

.footer-bottom a {
    color: #d4af37;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-bottom a:hover {
    color: #fff;
    text-decoration: underline;
}

/* 响应式 footer */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 1.5rem;
    }
    
    .friendlinks-list {
        gap: 0.5rem;
    }
    
    .friendlinks-list a {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* 页面头部样式 */
.page-header {
    background: linear-gradient(135deg, #f8f8f8 0%, #fff 100%);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.page-title {
    font-size: 2rem;
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
}

.page-description {
    color: #666;
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto 2rem;
    text-align: center;
    font-size: 1.1rem;
}

.page-description strong {
    color: #d4af37;
}

.page-description em {
    color: #8b6914;
    font-style: normal;
    font-weight: bold;
}

/* 添加 article 样式 */
article header {
    background: transparent;
    color: #333;
    padding: 1rem 0;
    text-align: left;
}

article header h2 {
    color: #333;
    margin-bottom: 1rem;
}

article header p {
    color: #666;
    line-height: 1.8;
    max-width: 800px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .page-header {
        padding: 1.5rem 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-description {
        font-size: 1rem;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    position: relative;
    margin: 5% auto;
    padding: 20px;
    width: 80%;
    max-width: 900px;
    max-height: 90vh;
    background-color: #fff;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

.modal-content img {
    max-width: 100%;
    max-height: 65vh;
    margin: 20px auto;
    cursor: grab;
    transition: transform 0.1s ease;
    object-fit: contain;
    flex-shrink: 1;
}

.modal-controls {
    margin-top: 20px;
}

#load-hd, #load-ultra {
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    margin: 0 5px;
}

#load-hd:hover, #load-ultra:hover {
    background-color: #555;
}

#load-hd:disabled, #load-ultra:disabled {
    background-color: #999;
    cursor: not-allowed;
}

#load-ultra {
    background-color: #d4af37;
    color: #000;
    font-weight: bold;
}

#load-ultra:hover {
    background-color: #e5c048;
}

.loading {
    display: none;
    margin-top: 10px;
    color: #666;
}

/* 分类加载提示 */
.category-loading {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

.no-images {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
    grid-column: 1 / -1;
}

/* 加载更多按钮 */
.load-more-btn {
    grid-column: 1 / -1;
    padding: 12px 30px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 20px auto;
    display: block;
    transition: background-color 0.3s;
}

.load-more-btn:hover {
    background-color: #555;
}

.load-more-btn:disabled {
    background-color: #999;
    cursor: not-allowed;
}

/* 加载完成提示 */
.complete-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* 响应式设计 - 手机端优化 */
@media (max-width: 768px) {
    header {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem;
        margin-top: 0.5rem;
    }
    
    nav a {
        padding: 0.3rem 0.6rem;
        font-size: 0.85rem;
    }
    
    main {
        padding: 0.5rem;
    }
    
    h3 {
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        font-size: 1.1rem;
    }
    
    .category-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .gallery-item {
        border-radius: 4px;
    }
    
    .gallery-item img {
        height: auto;
        aspect-ratio: 1;
        object-fit: cover;
    }
    
    .gallery-item .caption {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1rem;
    }
    
    nav a {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .category-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .gallery-item .caption {
        padding: 0.4rem;
        font-size: 0.7rem;
    }
    
    /* 回到顶部按钮手机端样式 */
    #back-to-top {
        width: 45px !important;
        height: 45px !important;
        font-size: 20px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
}