* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 修正父容器的絕對定位問題 */
#td_ContentTop {
    position: static !important;
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
}

.flipbook-container {
    width: 100%;
    height: 800px;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.toolbar {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(52, 73, 94, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.toolbar h1 {
    color: #ecf0f1;
    font-size: 1.8rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1c5a85 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: linear-gradient(135deg, #7f8c8d 0%, #5f6c6d 100%);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn-first,
.btn-last {
    padding: 12px 16px;
}

.page-info {
    color: #ecf0f1;
    font-size: 1.1rem;
    padding: 10px 18px;
    background: rgba(52, 73, 94, 0.8);
    border-radius: 10px;
    font-weight: 600;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    text-align: center;
}

.book-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

#flipbook {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    max-height: 100%;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.8rem;
    text-align: center;
    z-index: 1000;
}

.spinner {
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top: 6px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-progress {
    margin-top: 15px;
    font-size: 1rem;
    color: #bdc3c7;
}

/* 翻書頁面樣式 */
.page {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

.page canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* 封面樣式 */
.page.cover {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    padding: 60px;
}

.page.cover h1 {
    font-size: 3rem;
    text-align: center;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
}

.page.cover p {
    font-size: 1.5rem;
    text-align: center;
    opacity: 0.9;
}

.zoom-controls {
    position: absolute;
    bottom: 100px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.zoom-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.zoom-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1c5a85 100%);
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

@media (max-width: 768px) {
    .flipbook-container {
        height: 600px;
    }

    .toolbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .toolbar h1 {
        font-size: 1.3rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .page-info {
        font-size: 0.95rem;
        padding: 8px 14px;
    }

    .btn-first,
    .btn-last {
        padding: 10px 12px;
    }

    .zoom-controls {
        bottom: 15px;
        right: 15px;
    }

    .zoom-btn {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
}