:root {
    --primary-gradient: linear-gradient(45deg, #6a11cb, #2575fc);
    --primary-color: #2575fc;
    --secondary-color: #6a11cb;
    --dark-gradient: linear-gradient(45deg, #5910b0, #1e65da);
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --min-touch-size: 44px;
    
    /* 3D效果变量 */
    --transition-3d: all 0.7s cubic-bezier(0.23, 1, 0.32, 1);
    --text-shadow-3d: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    min-height: 100vh;
    position: relative;
    padding-bottom: 60px;
    overflow-x: hidden;
}

/* ==========================================================================
   页面标题样式
   ========================================================================== */
h1 {
    text-align: center;
    margin: 70px 0 30px;  
    color: #333;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
    font-size: 30px;
    left: 50%;
    transform: translateX(-50%);
}

h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px;
}

/* ==========================================================================
   3D卡片容器布局系统
   ========================================================================== */
.book-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 60px;
    padding: 50px 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    perspective: 1500px;
}

/* 容器加载状态 */
.book-grid.loading {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-state {
    text-align: center;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   3D卡片样式和动画
   ========================================================================== */

/* 卡片进入动画 */
@keyframes slide-fade-in {
    from {
        opacity: 0;
        transform: scale(.8) translateY(5vh);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 3D卡片包装器 */
.char3d-card-wrapper {
    position: relative;
    width: 300px;
    height: 450px;
    transition: var(--transition-3d);
    cursor: pointer;
    perspective: 1500px;
    transform-style: preserve-3d;
    
    /* 视图触发动画效果 */
    animation: slide-fade-in both;
    animation-timeline: view();
    animation-range: entry 0% entry 50%;
}

/* 3D卡片主体 */
.char3d-card {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: var(--transition-3d);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    will-change: transform;
}

/* 卡片正面 */
.char3d-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background-position: center;
    background-size: cover;
    border-radius: 15px;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: var(--transition-3d);
}

/* 卡片渐变遮罩 */
.char3d-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: 1;
    transition: var(--transition-3d);
}

/* 卡片内容区域 */
.char3d-content {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0;
    z-index: 10; 
    color: #fff;
    text-align: center;
    transition: var(--transition-3d);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateX(0);
}

/* 卡片标题 */
.char3d-title {
    font-size: 26px;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-shadow: var(--text-shadow-3d);
    color: #f5d742;
    transition: var(--transition-3d);
    white-space: nowrap;
    z-index: 4;
    transform: scale(1) translateX(0);
    width: 100%;
    text-align: center;
}

/* 卡片副标题 */
.char3d-author {
    font-size: 18px;
    color: #fff;
    margin: 0 0 10px 0;
    opacity: 0.9;
    transition: var(--transition-3d);
    text-shadow: var(--text-shadow-3d);
    z-index: 4;
    transform: scale(1) translateX(0);
    width: 100%;
    text-align: center;
}

/* 角色图片 */
.char3d-character {
    position: absolute;
    height: 110%;
    transform: translateZ(50px) translateX(-50%);
    left: 50%;
    bottom: -20px;
    opacity: 0;
    transition: var(--transition-3d);
    z-index: 3;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
    pointer-events: none;
    transform-style: preserve-3d;
}

/* 光晕效果 */
.char3d-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, 
                              rgba(255, 255, 255, 0.2) 0%, 
                              rgba(0, 0, 0, 0) 70%);
    opacity: 0;
    transition: var(--transition-3d);
    pointer-events: none;
    z-index: 2;
}

/* ==========================================================================
   3D卡片悬停效果
   ========================================================================== */
.char3d-card-wrapper:hover .char3d-card {
    transform: rotateX(25deg) translateZ(0);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.char3d-card-wrapper:hover .char3d-front::after {
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 70%);
}

.char3d-card-wrapper:hover .char3d-character {
    opacity: 1;
    transform: translateZ(100px) translateX(-50%);
}

.char3d-card-wrapper:hover .char3d-content {
    bottom: 50%;
    transform: translateY(50%) translateZ(120px) translateX(0);
}

.char3d-card-wrapper:hover .char3d-title {
    transform: scale(1.3) translateX(0);
    opacity: 1;
}

.char3d-card-wrapper:hover .char3d-author {
    transform: scale(1.15) translateX(0);
    opacity: 1;
    margin-top: 5px;
}

.char3d-card-wrapper:hover .char3d-glow {
    opacity: 1;
}

/* ==========================================================================
   分页导航样式
   ========================================================================== */
.pagination {
    text-align: center;
    margin: 40px 0 30px;
    padding-bottom: 20px;
    clear: both;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pagination button {
    padding: 10px 18px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    letter-spacing: 0.5px;
    min-width: var(--min-touch-size);
    min-height: var(--min-touch-size);
}

.pagination button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    letter-spacing: 1px;
}

.pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#page-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

#page-numbers button {
    width: var(--min-touch-size);
    height: var(--min-touch-size);
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

#page-numbers button.active {
    background: var(--dark-gradient);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#jump-to-page {
    width: 70px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 30px;
    text-align: center;
    font-size: 14px;
    transition: all 0.3s ease;
    min-height: var(--min-touch-size);
    box-sizing: border-box;
}

#jump-to-page:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.2);
    outline: none;
}

/* 页面指示器 */
.page-indicator {
    margin-top: 20px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: #666;
    clear: both;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* 省略号样式 */
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--min-touch-size);
    font-size: 16px;
    color: #666;
}

/* ==========================================================================
   空状态和错误状态
   ========================================================================== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin: 20px 0;
    width: 100%;
}

.no-results h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #333;
}

.no-results p {
    margin: 0 0 20px 0;
    font-size: 16px;
}

.error-message {
    text-align: center;
    padding: 60px 20px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    border: 2px solid #f5c6cb;
    width: 100%;
}

/* ==========================================================================
   响应式设计 - 3D卡片布局适配
   ========================================================================== */

/* 大屏幕适配 (991px+) */
@media (max-width: 991px) {
    .book-grid {
        gap: 40px;
    }
}

/* 中等屏幕适配 (768px - 991px) */
@media (max-width: 768px) {
    /* 标题适配 */
    h1 {
        margin: 65px 0 20px;
        font-size: 28px;
    }
    
    /* 3D卡片布局 */
    .book-grid {
        gap: 20px;
        padding: 30px 20px;
    }
    
    .char3d-card-wrapper {
        width: 250px;
        height: 375px;
    }
    
    .char3d-title {
        font-size: 22px;
    }
    
    .char3d-author {
        font-size: 16px;
    }
    
    /* 分页组件适配 */
    .pagination {
        padding: 0 15px 20px;
    }
    
    /* 简化页码显示 */
    #page-numbers button {
        display: none;
    }
    
    #page-numbers button:nth-child(1),
    #page-numbers button:nth-child(2),
    #page-numbers button.active,
    #page-numbers button:last-child {
        display: flex;
    }
}

/* 移动设备 (480px - 768px) */
@media (max-width: 480px) {
    /* 标题适配 */
    h1 {
        margin: 60px 0 15px;
        font-size: 24px;
    }
    
    /* 3D卡片布局 */
    .book-grid {
        gap: 15px;
        padding: 20px 15px;
    }
    
    .char3d-card-wrapper {
        width: 220px;
        height: 330px;
    }
    
    .char3d-title {
        font-size: 20px;
    }
    
    .char3d-author {
        font-size: 14px;
    }
    
    /* 分页组件移动端优化 */
    .pagination {
        gap: 20px;
    }
    
    .pagination-controls,
    .pagination-jump {
        width: 100%;
    }
    
    .pagination-controls {
        justify-content: space-between;
    }
    
    #jump-to-page,
    #jump-button {
        flex-grow: 1;
        max-width: 120px;
    }
    
    #prev-page, 
    #next-page {
        width: 100px;
    }
    
    /* 页码显示优化 */
    #page-numbers {
        order: 2;
        margin: 10px 0;
        width: 100%;
    }
    
    #page-numbers button {
        display: none;
    }
    
    #page-numbers button.active,
    #page-numbers button:first-child,
    #page-numbers button:last-child {
        display: flex;
    }
}