/* 样式保持不变，仅增加分页控件样式 */
:root {
    --primary-color: #667eea;
    --bg-color: #f8f9fa;
    --text-color: #1f2937;
    --border-radius: 20px;
    --transition-speed: 0.3s;
}
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    background: #f8f9fa;
    color: #333;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 0;
    min-height: 100vh;
}
.categories-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}
.page-header {
    margin-bottom: 28px;
    padding: 0 4px;
}
.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}
.page-header p {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.4;
}
.categories-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}
.category-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 16 / 10;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    will-change: transform;
    transform: translateZ(0);
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}
.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.category-card:hover img {
    transform: scale(1.03);
}
.category-card .overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 14px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
    pointer-events: none;
}
.category-card .label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.wallpaper-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    min-height: 100vh;
}
.wallpaper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 4px;
}
.back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.back:hover {
    background: #f0f0f0;
    transform: translateX(-2px);
}
.category-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.category-info h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}
.category-info .count {
    font-size: 13px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 20px;
}
.wallpaper-grid {
    display: grid;
    gap: 16px;
    width: 100%;
    contain: content;
}
.wall-item {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 16 / 9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    will-change: transform;
    transform: translateZ(0);
}
.wall-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}
.wall-item .img-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #e5e7eb;
}
.wall-item .img-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
}
.wall-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
    will-change: opacity;
}
.wall-item img.loaded {
    opacity: 1;
}
.preview-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    z-index: 10;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    pointer-events: auto;
}
.wall-item:hover .preview-btn {
    opacity: 1;
    transform: translateY(0);
}
.loading, .error {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    grid-column: 1 / -1;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin-center 0.8s linear infinite;
    margin: 0 auto 16px;
}
.spinner-small {
    width: 28px;
    height: 28px;
    border: 2px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin-center 0.6s linear infinite;
    margin: 0 auto 8px;
}
/* 分页控件样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding: 20px;
    grid-column: 1 / -1;
}
.page-btn {
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
    background: #f0f0f0;
    transform: translateY(-2px);
}
.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.page-info {
    font-size: 14px;
    color: #6b7280;
}
.retry-btn {
    margin-top: 12px;
    padding: 8px 20px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.retry-btn:hover {
    background: #e0e0e0;
}
/* 响应式 */
@media (max-width: 480px) {
    .categories-page, .wallpaper-page { padding: 16px 12px 32px; }
    .categories-grid { gap: 12px; grid-template-columns: repeat(2, 1fr); }
    .wallpaper-grid { gap: 10px; grid-template-columns: repeat(2, 1fr); }
    .category-info h2 { font-size: 18px; }
    .preview-btn { padding: 4px 10px; font-size: 10px; bottom: 8px; right: 8px; }
    .page-btn { padding: 6px 14px; font-size: 12px; }
}
@media (min-width: 481px) and (max-width: 640px) {
    .categories-grid, .wallpaper-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (min-width: 641px) and (max-width: 768px) {
    .categories-grid, .wallpaper-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .wallpaper-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 1025px) and (max-width: 1280px) {
    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .wallpaper-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}
@media (min-width: 1281px) {
    .categories-grid { grid-template-columns: repeat(4, 1fr); }
    .wallpaper-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; }
}
@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes spin-center {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}