/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f0ff 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.title {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #1a5fb4 0%, #007bff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(26, 95, 180, 0.1);
    animation: float 3s ease-in-out infinite;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
    font-weight: 300;
}

/* 书籍容器样式 */
.book-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 400px;
    margin: 0 auto 40px;
    perspective: 1500px; /* 增加透视效果 */
}

.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page {
    position: absolute;
    width: 50%;
    height: 100%;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    backface-visibility: hidden;
    overflow: hidden;
    transform-origin: left center; /* 设置翻页原点 */
}

/* 翻页动画类 */
.page-flipping {
    animation: pageFlip 1s cubic-bezier(0.4, 0, 0.2, 1.5);
}

.page-flipped {
    transform: rotateY(-180deg);
}

/* 加强翻页动画效果 */
@keyframes pageFlip {
    0% {
        transform: rotateY(0deg);
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: rotateY(-90deg);
        box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: rotateY(-180deg);
        box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.1);
    }
}

#left-page {
    left: 0;
    border-right: 1px solid #e0e0e0;
}

#right-page {
    right: 0;
    border-left: 1px solid #e0e0e0;
}

.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.question-prompt {
    font-size: 1.2rem;
    color: #666;
    line-height: 1.6;
}

.answer-placeholder {
    font-size: 1.1rem;
    color: #999;
    font-style: italic;
}

.answer {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a5fb4;
    text-align: center;
    line-height: 1.8;
    animation: fadeIn 0.8s ease;
}

.book-spine {
    position: absolute;
    width: 10px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to right, #1a5fb4, #007bff);
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* 书皮样式 */
.book-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a5fb4 0%, #007bff 100%);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(26, 95, 180, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 2;
}

.book-cover:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(26, 95, 180, 0.4);
}

.cover-title {
    font-size: 2.5rem;
    color: #fff;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

.cover-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cover-decoration {
    position: absolute;
    bottom: 30px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: pulse 3s ease-in-out infinite;
}

/* 问题输入区域 */
.question-container {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

#question-input {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 1rem;
    width: 100%;
    max-width: 400px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

#question-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #1a5fb4 0%, #007bff 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 95, 180, 0.3);
}

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

/* 历史记录区域 */
.history-container {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-container h3 {
    font-size: 1.2rem;
    color: #1a5fb4;
    margin-bottom: 0;
    font-weight: 600;
}

.made-by-link {
    font-size: 0.9rem;
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.3s ease;
}

.made-by-link:hover {
    color: #1a5fb4;
    transform: translateY(-2px);
    text-decoration: underline;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    animation: slideIn 0.5s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-question {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.history-answer {
    font-size: 0.9rem;
    color: #666;
}

/* 动画容器 */
.animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* 动画定义 */
@keyframes float {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pageTurn {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(-30deg);
    }
}

@keyframes confetti {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .book-container {
        height: 300px;
    }
    
    .cover-title {
        font-size: 2rem;
    }
    
    .answer {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .book-container {
        height: 250px;
    }
    
    .page {
        padding: 20px;
    }
    
    .cover-title {
        font-size: 1.8rem;
    }
}