: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;

    --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 0 60px;
    background-color: #f4f4f4;
    color: #333;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ==========================================================================
   3D 卡片容器
   ========================================================================== */

.book-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 60px;
    padding: 50px 20px;
    max-width: 1200px;
    margin: 100px auto 0;
    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-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   3D 卡片
   ========================================================================== */

@keyframes slide-fade-in {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(5vh);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.char3d-card-wrapper {
    position: relative;
    width: 300px;
    height: 450px;
    cursor: pointer;
    perspective: 1500px;
    transform-style: preserve-3d;
    transition: var(--transition-3d);
    animation: slide-fade-in both;
    animation-timeline: view();
    animation-range: entry 0% entry 50%;
}

.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;
    inset: 0;
    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;
    right: 0;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0;
    z-index: 10;
    color: #fff;
    text-align: center;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateX(0);
    transition: var(--transition-3d);
}

.char3d-title {
    width: 100%;
    margin: 0 0 10px;
    color: #f5d742;
    font-size: 26px;
    font-weight: bold;
    text-align: center;
    text-shadow: var(--text-shadow-3d);
    white-space: nowrap;
    z-index: 4;
    transform: scale(1) translateX(0);
    transition: var(--transition-3d);
}

.char3d-author {
    width: 100%;
    margin: 0 0 10px;
    color: #fff;
    font-size: 18px;
    text-align: center;
    opacity: 0.9;
    text-shadow: var(--text-shadow-3d);
    z-index: 4;
    transform: scale(1) translateX(0);
    transition: var(--transition-3d);
}

.char3d-character {
    position: absolute;
    left: 50%;
    bottom: -20px;
    height: 110%;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    transform: translateZ(50px) translateX(-50%);
    transform-style: preserve-3d;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
    transition: var(--transition-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;
    z-index: 2;
    pointer-events: none;
    transition: var(--transition-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);
}

.char3d-card-wrapper:hover .char3d-title {
    opacity: 1;
    transform: scale(1.3);
}

.char3d-card-wrapper:hover .char3d-author {
    margin-top: 5px;
    opacity: 1;
    transform: scale(1.15);
}

.char3d-card-wrapper:hover .char3d-glow {
    opacity: 1;
}

/* ==========================================================================
   分页——与 filter 页面保持一致
   ========================================================================== */

.pagination {
    clear: both;
    margin: 60px 0 30px;
    padding: 0 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.pagination-controls {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
}

.pagination-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pagination button {
    min-width: auto;
    min-height: 44px;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    box-shadow: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background: #333;
    transform: translateY(-2px);
}

.pagination button:disabled {
    background: #ccc;
    color: #fff;
    cursor: not-allowed;
    transform: none;
}

#page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
}

#page-numbers button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

#page-numbers button.active {
    background: #222;
    transform: none;
    box-shadow: none;
}

#jump-to-page {
    width: 88px;
    min-height: 44px;
    padding: 8px 12px;
    box-sizing: border-box;
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    text-align: center;
    font-size: 14px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#jump-to-page:focus {
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* 总页数和合集总数量保持居中 */
.page-indicator {
    position: relative;
    z-index: 1;
    clear: both;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto 15px;
    padding: 14px 20px;
    box-sizing: border-box;
    background-color: #f5f5f5;
    border-radius: 0;
    color: #666;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    color: #666;
    font-size: 16px;
}

/* ==========================================================================
   空状态和错误状态
   ========================================================================== */

.no-results {
    width: 100%;
    margin: 20px 0;
    padding: 60px 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    color: #666;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.no-results h3 {
    margin: 0 0 10px;
    color: #333;
    font-size: 20px;
}

.no-results p {
    margin: 0 0 20px;
    font-size: 16px;
}

.error-message {
    width: 100%;
    padding: 60px 20px;
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    border-radius: 8px;
    text-align: center;
}

/* ==========================================================================
   响应式设计
   ========================================================================== */

@media (max-width: 991px) {
    .book-grid {
        gap: 40px;
    }
}

@media (max-width: 900px) {
    .book-grid {
        margin-top: 80px;
    }
}

@media (max-width: 768px) {
    .book-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 30px 20px;
    }

    .char3d-card-wrapper {
        width: 100%;
        height: 300px;
    }

    .char3d-title {
        font-size: 20px;
    }

    .char3d-author {
        font-size: 15px;
    }

    .pagination-controls {
        flex-wrap: wrap;
    }

    #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;
    }
}

@media (max-width: 480px) {
    .book-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 20px 12px;
    }

    .char3d-card-wrapper {
        width: 100%;
        height: 240px;
    }

    .char3d-title {
        font-size: 16px;
    }

    .char3d-author {
        font-size: 13px;
    }

    .pagination {
        gap: 16px;
    }

    .pagination-controls {
        width: 100%;
        justify-content: space-between;
    }

    .pagination-jump {
        width: 100%;
    }

    #jump-to-page,
    #jump-button {
        flex-grow: 1;
        max-width: 120px;
    }

    #prev-page,
    #next-page {
        width: 100px;
    }

    #page-numbers {
        order: 2;
        width: 100%;
        margin: 10px 0;
    }

    #page-numbers button {
        display: none;
    }

    #page-numbers button.active,
    #page-numbers button:first-child,
    #page-numbers button:last-child {
        display: flex;
    }

    .page-indicator {
        font-size: 14px;
    }
}