* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    background: #405266;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.flipbook-viewport {
    width: 90%;
    max-width: 1400px;
    height: 80vh;
    max-height: 800px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}

#flipbook {
    width: 1200px;
    height: 700px;
}

#flipbook .page {
    width: 600px;
    height: 700px;
    background: white;
    overflow: hidden;
}

/* 页面内容 */
.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    position: relative;
}

/* 照片框 - 充满整个页面 */
.photo-frame {
    width: 100%;
    height: 100%;
    background: white;
    padding: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;  /* 完整显示照片，不裁剪 */
}

.photo-title {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 0;
    color: white;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
    text-align: center;
    z-index: 10;
    width: 90%;
}

.photo-desc {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: white;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8);
    z-index: 10;
    width: 90%;
}

/* 跨页照片样式 */
.spread-photo {
    overflow: hidden;
    background: white;
    position: relative;
    width: 100%;
    height: 100%;
}

.spread-img {
    position: absolute;
    height: 100%;
    width: auto;
    max-width: none;
    min-width: 200%;  /* 照片最小宽度为两页宽度 */
    top: 0;
}

/* 左页：显示照片的左半部分 */
.spread-left .spread-img {
    left: 0;
    /* 照片从左边开始，显示左半部分 */
}

/* 右页：显示照片的右半部分 */
.spread-right .spread-img {
    right: 0;
    /* 照片从右边结束，显示右半部分 */
}

/* 跨页照片的文字只在左页显示 */
.spread-right .photo-title,
.spread-right .photo-desc {
    display: none;
}

/* 封面页 */
.cover-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cover-title {
    font-size: 64px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
}

.cover-subtitle {
    font-size: 24px;
    opacity: 0.9;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.cover-year {
    font-size: 100px;
    font-weight: bold;
    margin-top: 50px;
    opacity: 0.2;
}

/* Turn.js 样式覆盖 */
.turn-page {
    background-color: white;
}

/* 页面可拖拽区域提示 */
.flipbook-viewport {
    cursor: grab;
}

.flipbook-viewport:active {
    cursor: grabbing;
}

/* 页面边角拖拽提示 */
#flipbook .turn-page {
    cursor: pointer;
}

#flipbook .page {
    user-select: none;
    -webkit-user-drag: none;
}

/* 增强拖拽反馈 */
.grabbing #flipbook {
    cursor: grabbing !important;
}

/* 页面内元素不阻止拖拽 */
#flipbook .page * {
    pointer-events: auto;
}

#flipbook img {
    pointer-events: auto;
}

/* 确保照片可点击 */
.photo-frame img {
    cursor: zoom-in;
}

/* 页面边角拖拽指示器 */
#flipbook::before,
#flipbook::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    z-index: 1000;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* 右上角指示器 */
#flipbook::before {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 10px;
}

/* 右下角指示器 */
#flipbook::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 10px;
}

/* 悬停时高亮边角 */
.flipbook-viewport:hover #flipbook::before,
.flipbook-viewport:hover #flipbook::after {
    border-color: rgba(102, 126, 234, 0.6);
    border-width: 3px;
}

/* 导航控制 */
.nav-button {
    position: fixed;
    width: 48px;
    height: 48px;
    bottom: 60px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 1000;
}

#prevBtn {
    left: 50%;
    transform: translateX(calc(-50% - 70px));
}

#nextBtn {
    right: 50%;
    transform: translateX(calc(50% + 70px));
}

.nav-button:hover:not(:disabled) {
    transform: translateX(calc(-50% - 70px)) scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

#nextBtn:hover:not(:disabled) {
    transform: translateX(calc(50% + 70px)) scale(1.1);
}

.nav-button:active:not(:disabled) {
    transform: translateX(calc(-50% - 70px)) scale(0.95);
}

#nextBtn:active:not(:disabled) {
    transform: translateX(calc(50% + 70px)) scale(0.95);
}

.nav-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.page-counter {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    min-width: 90px;
    text-align: center;
    user-select: none;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 35px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.usage-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    z-index: 1000;
}

/* 响应式设计 */
@media (max-width: 1300px) {
    #flipbook {
        width: 1000px;
        height: 600px;
    }

    #flipbook .page {
        width: 500px;
        height: 600px;
    }

    .photo-title {
        font-size: 28px;
        bottom: 60px;
    }

    .photo-desc {
        font-size: 16px;
        bottom: 30px;
    }

    .cover-title {
        font-size: 48px;
    }
}

@media (max-width: 1100px) {
    #flipbook {
        width: 800px;
        height: 480px;
    }

    #flipbook .page {
        width: 400px;
        height: 480px;
    }

    .photo-title {
        font-size: 24px;
        bottom: 50px;
    }

    .photo-desc {
        font-size: 15px;
        bottom: 25px;
    }

    .cover-title {
        font-size: 40px;
    }

    .cover-year {
        font-size: 70px;
    }
}

@media (max-width: 900px) {
    #flipbook {
        width: 600px;
        height: 400px;
    }

    #flipbook .page {
        width: 300px;
        height: 400px;
    }

    .photo-title {
        font-size: 20px;
        bottom: 40px;
    }

    .photo-desc {
        font-size: 14px;
        bottom: 20px;
    }

    .cover-title {
        font-size: 32px;
    }

    .cover-subtitle {
        font-size: 16px;
    }

    .navigation-controls {
        padding: 12px 25px;
        gap: 20px;
    }

    .nav-button {
        width: 40px;
        height: 40px;
    }

    .page-counter {
        font-size: 16px;
        min-width: 70px;
    }
}

/* 移动端优化 - 通过JavaScript添加的mobile-device类 */
.mobile-device {
    overflow: hidden;
}

.mobile-device .flipbook-viewport {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 0;
    }

/* 横屏模式 - 完整展示相册 */
.mobile-device #flipbook {
    width: 86vw;
    height: 60vw;
    max-height: 75vh;
    max-width: none;
}

.mobile-device #flipbook .page {
    width: 43vw;
    height: 60vw;
    max-height: 75vh;
}

.mobile-device .cover-title {
    font-size: 4vw;
}

.mobile-device .cover-subtitle {
    font-size: 1.5vw;
}

.mobile-device .cover-year {
    font-size: 7vw;
    margin-top: 2vw;
}

.mobile-device .photo-title {
    font-size: 2vw;
    bottom: 3vw;
}

.mobile-device .photo-desc {
    font-size: 1.5vw;
    bottom: 1.5vw;
}

.mobile-device #prevBtn {
    position: fixed;
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.mobile-device #nextBtn {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.mobile-device .nav-button {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mobile-device .nav-button svg {
    width: 18px;
    height: 18px;
}

.mobile-device .page-counter {
    position: fixed;
    left: 50%;
    bottom: 2vh;
    transform: translateX(-50%);
    font-size: 12px;
    min-width: 50px;
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 12px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* 隐藏页面边角指示器 */
.mobile-device #flipbook::before,
.mobile-device #flipbook::after {
    display: none;
}

/* 强制横屏提示（竖屏时显示） */
@media (max-width: 768px) and (orientation: portrait) {
    body::before {
        content: '请旋转设备至横屏以获得最佳体验';
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 20px 40px;
        border-radius: 10px;
        font-size: 18px;
        z-index: 10000;
        text-align: center;
    }

    body::after {
        content: '↻';
        position: fixed;
        top: calc(50% + 50px);
        left: 50%;
        transform: translate(-50%, 0);
        font-size: 60px;
        color: white;
        z-index: 10000;
        animation: rotate 2s linear infinite;
    }

    @keyframes rotate {
        from { transform: translate(-50%, 0) rotate(0deg); }
        to { transform: translate(-50%, 0) rotate(360deg); }
    }
}

/* 页面加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    animation: fadeIn 0.5s ease-in;
}
