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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 10px 0;
}

/* 绘本区域 */
.book-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
    justify-content: center;
}

/* 页码包装 - 紧贴绘本上方 */
.page-indicator-wrapper {
    margin-bottom: 15px;
}

.page-indicator {
    font-size: 22px;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    text-align: center;
    padding: 8px 25px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 绘本包装区 */
.book-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    padding: 0 20px;
}

/* 左右翻页按钮 */
.page-nav-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.page-nav-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: white;
}

.page-nav-btn:active {
    transform: translateY(0) scale(0.95);
}

.page-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 绘本容器 */
.book-container {
    perspective: 2000px;
    flex: 1;
    max-width: 900px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book {
    position: relative;
    width: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.page {
    position: relative;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 
        0 15px 50px rgba(0, 0, 0, 0.4),
        0 0 0 6px rgba(255, 255, 255, 0.15),
        inset 0 0 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.page-content {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 默认比例，会被JavaScript动态覆盖 */
    background: #fff;
    overflow: hidden;
    transition: padding-bottom 0.3s ease;
}

.page-content img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.page-turn-left {
    animation: slideLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-turn-right {
    animation: slideRight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    40% {
        transform: translateX(-30%);
        opacity: 0.5;
    }
    60% {
        transform: translateX(30%);
        opacity: 0.5;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideRight {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    40% {
        transform: translateX(30%);
        opacity: 0.5;
    }
    60% {
        transform: translateX(-30%);
        opacity: 0.5;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 对白按钮 */
.dialogue-button {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    border: 3px solid #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6),
                0 0 40px rgba(255, 107, 107, 0.4),
                0 0 60px rgba(255, 107, 107, 0.2);
    animation: glow 2s ease-in-out infinite alternate;
    transition: transform 0.3s, box-shadow 0.3s;
    z-index: 10;
}

.dialogue-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.8),
                0 0 50px rgba(255, 107, 107, 0.6),
                0 0 70px rgba(255, 107, 107, 0.4);
}

.dialogue-button.playing {
    animation: playing 0.5s ease-in-out infinite;
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.6),
                    0 0 40px rgba(255, 107, 107, 0.4),
                    0 0 60px rgba(255, 107, 107, 0.2);
    }
    to {
        box-shadow: 0 0 25px rgba(255, 107, 107, 0.8),
                    0 0 50px rgba(255, 107, 107, 0.6),
                    0 0 75px rgba(255, 107, 107, 0.4);
    }
}

@keyframes playing {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.dialogue-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* 底部控制区 */
.bottom-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* 旁白朗读按钮 */
.narrator-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.narrator-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.6);
}

.narrator-btn:active {
    transform: translateY(0);
}

.narrator-btn.playing {
    animation: buttonPulse 1s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
    }
}

/* 音量控制 */
.volume-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.6);
}

.volume-slider {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 底部全屏按钮 */
.fullscreen-btn-bottom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 编辑模式指示器 */
.edit-mode-indicator {
    position: fixed;
    top: 80px;
    right: 15px;
    background: rgba(255, 193, 7, 0.95);
    color: #333;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 1000;
    display: none;
}

.edit-mode-indicator.active {
    display: block;
}

.edit-controls {
    position: fixed;
    bottom: 100px;
    right: 15px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.edit-controls.active {
    display: flex;
}

.edit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.3s;
}

.edit-btn:hover {
    transform: translateY(-2px);
}

.edit-btn.add {
    background: #4CAF50;
    color: white;
}

.edit-btn.save {
    background: #2196F3;
    color: white;
}

.edit-btn.cancel {
    background: #f44336;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px 0;
        gap: 15px;
    }

    .top-controls {
        padding: 6px 20px;
    }

    .page-indicator {
        font-size: 18px;
        min-width: 45px;
    }

    .book-wrapper {
        gap: 10px;
        padding: 5px 10px;
        max-height: calc(100vh - 180px);
    }

    .page-nav-btn {
        width: 45px;
        height: 45px;
    }

    .page-nav-btn svg {
        width: 26px;
        height: 26px;
    }

    .page {
        border-radius: 8px;
        border-width: 2px;
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.4),
            0 0 0 4px rgba(255, 255, 255, 0.15),
            inset 0 0 15px rgba(0, 0, 0, 0.03);
    }

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

    .dialogue-button svg {
        width: 24px;
        height: 24px;
    }

    .bottom-controls {
        gap: 10px;
        padding: 10px 18px;
    }

    .narrator-btn {
        padding: 8px 15px;
        font-size: 13px;
    }

    .narrator-btn span {
        display: none;
    }

    .control-btn {
        width: 35px;
        height: 35px;
    }

    .volume-slider {
        width: 70px;
    }

    .edit-mode-indicator {
        top: 60px;
        right: 10px;
        padding: 8px 15px;
        font-size: 14px;
    }

    .edit-controls {
        bottom: 75px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .page-nav-btn {
        width: 40px;
        height: 40px;
    }

    .page-nav-btn svg {
        width: 22px;
        height: 22px;
    }

    .page-indicator {
        font-size: 16px;
        min-width: 40px;
    }

    .dialogue-button {
        width: 35px;
        height: 35px;
    }

    .dialogue-button svg {
        width: 20px;
        height: 20px;
    }

    .bottom-controls {
        gap: 8px;
        padding: 8px 12px;
    }

    .volume-slider {
        width: 50px;
    }
}
