* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    --bg-primary: #050505;
    --bg-secondary: #0f0f0f;
    --accent-purple: #a855f7;
    --accent-purple-glow: rgba(168, 85, 247, 0.4);
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --card-bg: #121212;
    --border-color: #222222;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    /* 粘性页脚基础配置 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    /* 让内容区域占据剩余空间，将页脚推到底部 */
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--accent-purple);
}

/* Hero Section */
.hero {
    padding: 12rem 0 4rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 1rem;
    letter-spacing: -2px;
    line-height: 1.1;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* Search Bar */
.search-container {
    max-width: 650px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

#search-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.4rem 1.8rem;
    padding-right: 120px;
    /* Space for button */
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: var(--transition);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#search-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 30px var(--accent-purple-glow);
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-purple);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 15px var(--accent-purple-glow);
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2.5rem;
    padding: 6rem 0;
}

/* Book Card */
.book-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-12px) scale(1.02);
    border-color: var(--accent-purple);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.book-image-wrapper {
    width: 100%;
    /* aspect-ratio: 4 / 5.5; */
    /* Slightly taller but controlled */
    overflow: hidden;
    background: #151515;
    position: relative;
    border-bottom: 1px solid #1a1a1a;
    text-align: center;
}

.book-image {
    width: 80%;
    height: 100%;
    object-fit: contain;
    /* Adaptive to different image sizes */
    padding: 1rem;
    /* Padding to prevent image touching edges */
    transition: var(--transition);
}

.book-card:hover .book-image {
    opacity: 0.8;
}

.book-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8rem;
}

.book-meta-row {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
}

.book-label {
    color: #555;
    margin-right: 5px;
    font-size: 0.75rem;
}

.book-value {
    color: #ccc;
    font-weight: 500;
}

.book-author {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: auto;
}

.book-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #1a1a1a;
    display: flex;
    justify-content: center;
}

.view-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--accent-purple);
    color: var(--accent-purple);
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.book-card:hover .view-btn {
    background: var(--accent-purple);
    color: white;
}

/* Footer */
footer {
    padding: 4rem 0 3rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    width: 100%;
}

.footer-content {
    opacity: 0.5;
    font-size: 0.85rem;
}

.purple-highlight {
    color: var(--accent-purple);
}


/* Detail View */
#detail-view {
    padding: 2rem 0;
    /* Reduced top/bottom padding to let flex center it */
    min-height: calc(100vh - 200px);
    /* Fill the screen minus header/footer */
    display: flex;
    align-items: center;
    /* 关键：使整个内容块在页面垂直居中 */
}

.detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 平分左右比例，给图片框更多空间 */
    gap: 6rem;
    align-items: center;
    width: 100%;
    animation: fadeInUp 0.8s ease forwards;
    padding-bottom: 2rem;
}

.detail-image-side {
    background: #0f0f0f;
    border-radius: 32px;
    padding: 3.5rem;
    /* 增加内边距，让灰框显得更大、更有呼吸感 */
    border: 1px solid var(--border-color);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;

    width: 512px;
}

.detail-image {
    max-width: 100%;
    height: auto;
    height: 288px;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.detail-info-side {
    padding: 1rem 0;
}

.detail-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    /* 缩小标题字号，更显精致 */
    font-weight: 800;
    margin-bottom: 2rem;
    line-height: 1.25;
    letter-spacing: -1px;
}

.detail-meta-list {
    margin-bottom: 3.5rem;
}

.detail-meta-item {
    display: flex;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid #1a1a1a;
    font-size: 1.1rem;
}

.detail-label {
    width: 140px;
    color: #555;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.detail-value {
    color: var(--text-main);
    font-weight: 500;
}

.detail-actions {
    display: flex;
    gap: 1.5rem;
}

.btn-get {
    background: var(--accent-purple);
    color: white;
    padding: 1.2rem 3.5rem;
    border-radius: 14px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-get:hover {
    box-shadow: 0 0 40px var(--accent-purple-glow);
    transform: translateY(-4px);
    filter: brightness(1.1);
}

.btn-back {
    background: transparent;
    color: #777;
    padding: 1.2rem 2rem;
    border-radius: 14px;
    font-weight: 600;
    border: 1px solid #333;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
}

.btn-back:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.05);
}

/* Animations */
/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-card {
    animation: fadeInUp 0.6s ease forwards;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 3rem;
    border-radius: 32px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    position: relative;
    /* box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8), 0 0 40px var(--accent-purple-glow); */
    transform: translateY(40px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--accent-purple);
    transform: rotate(90deg);
}

.qr-wrapper {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #151515;
    border-radius: 20px;
    border: 1px solid #222;
    display: inline-block;
}

.qr-image {
    width: 220px;
    height: 220px;
    border-radius: 12px;
}

.wechat-info {
    margin-top: 1.5rem;
}

.wechat-id-container {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
    margin: 2rem 0;
}

.wechat-id-text {
    font-family: 'Inter', monospace;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--accent-purple);
    letter-spacing: 1px;
    text-shadow: 0 0 20px var(--accent-purple-glow);
}

.copy-btn {
    background: var(--accent-purple);
    color: white;
    border: none;
    padding: 0.8rem 3rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.2);
}

.copy-btn:hover {
    filter: brightness(1.2);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .detail-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .detail-image-side {
        padding: 1.5rem;
    }

    .detail-actions {
        flex-direction: column;
    }

    .btn-get,
    .btn-back {
        width: 100%;
        text-align: center;
    }
}

/* Loading Indicator */
#loading-indicator {
    grid-column: 1/-1;
    text-align: center;
    padding: 5rem;
    color: var(--accent-purple);
    font-size: 1.1rem;
    font-weight: 500;
}

.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
}

.loading-dots span {
    width: 14px;
    height: 14px;
    background-color: var(--accent-purple);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 10px var(--accent-purple-glow);
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0); 
        opacity: 0.5; 
    } 
    40% { 
        transform: scale(1); 
        opacity: 1; 
    }
}