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

/* 基础样式 */
body {
    font-family: 'Noto Serif SC', serif;
    line-height: 1.8;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* 切换按钮样式 */
.format-switch {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.switch-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.switch-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.switch-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    font-weight: 600;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 30px rgba(0,0,0,0.1);
    min-height: 100vh;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" patternUnits="userSpaceOnUse" width="100" height="100"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/><circle cx="20" cy="60" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    opacity: 0.3;
}

.title {
    font-size: 3.5em;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.1em;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.4em;
    margin-bottom: 20px;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.author {
    font-size: 1.1em;
    opacity: 0.8;
    font-style: italic;
    position: relative;
    z-index: 1;
}

/* 短剧版本样式 */
.drama-content {
    padding: 20px;
    background: #1a1a1a;
    color: white;
}

.episode {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    margin-bottom: 30px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border: 2px solid #e74c3c;
    position: relative;
}

.episode::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e74c3c 0%, #f39c12 50%, #e74c3c 100%);
    animation: shine 2s linear infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.episode-title {
    font-size: 1.8em;
    color: #e74c3c;
    margin: 0;
    padding: 20px 25px 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.episode-info {
    padding: 0 25px 15px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.episode-duration, .episode-views {
    background: rgba(255,255,255,0.1);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    color: #ecf0f1;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.episode-content {
    padding: 20px 25px 25px;
}

.scene {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    border-left: 4px solid #e74c3c;
}

.scene-desc {
    color: #f39c12;
    font-style: italic;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.95em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.dialogue {
    margin-bottom: 8px;
    line-height: 1.6;
    font-size: 1.05em;
}

.dialogue strong {
    color: #3498db;
    font-weight: 700;
}

.monologue {
    color: #95a5a6;
    font-style: italic;
    background: rgba(149,165,166,0.1);
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid #95a5a6;
    margin: 10px 0;
}

.shock-text {
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    text-align: center;
    font-weight: 700;
    margin: 15px 0;
    font-size: 1.1em;
    animation: pulse 2s infinite;
    box-shadow: 0 4px 15px rgba(231,76,60,0.4);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.next-preview {
    background: rgba(52,152,219,0.2);
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    color: #ecf0f1;
}

.next-preview strong {
    color: #3498db;
}

.final-text {
    text-align: center;
    padding: 20px;
    background: rgba(231,76,60,0.2);
    border-radius: 10px;
    margin-top: 20px;
}

.final-text .end-mark {
    font-size: 1.5em;
    color: #e74c3c;
    font-weight: 700;
    margin-bottom: 10px;
}

/* 主要内容样式 */
.novel-content {
    padding: 40px;
}

.chapter {
    margin-bottom: 50px;
    position: relative;
}

.chapter-title {
    font-size: 2.2em;
    color: #34495e;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
    font-weight: 600;
    position: relative;
}

.chapter-title::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 60px;
    height: 3px;
    background: #e74c3c;
}

.chapter-content {
    font-size: 1.1em;
    line-height: 2;
    text-align: justify;
}

.chapter-content p {
    margin-bottom: 20px;
    text-indent: 2em;
    color: #2c3e50;
    position: relative;
}

.chapter-content p:first-child {
    font-size: 1.15em;
    font-weight: 500;
    color: #27ae60;
}

/* 特殊段落样式 */
.chapter-content p:has(strong),
.chapter-content p:contains("李世民"),
.chapter-content p:contains("玄武门") {
    position: relative;
}

/* 结尾标记 */
.end-mark {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px dashed #bdc3c7;
}

.end-mark p {
    font-size: 1.2em;
    color: #7f8c8d;
    font-style: italic;
    text-indent: 0 !important;
}

/* 页脚样式 */
footer {
    background: #34495e;
    color: white;
    padding: 30px 40px;
    text-align: center;
}

.footer-content p {
    margin-bottom: 10px;
    opacity: 0.8;
}

.footer-content a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    header {
        padding: 40px 20px;
    }
    
    .title {
        font-size: 2.5em;
    }
    
    .subtitle {
        font-size: 1.2em;
    }
    
    .format-switch {
        margin-top: 15px;
        gap: 8px;
    }
    
    .switch-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .novel-content {
        padding: 20px;
    }
    
    .drama-content {
        padding: 15px;
    }
    
    .episode {
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    .episode-title {
        font-size: 1.5em;
        padding: 15px 20px 8px;
    }
    
    .episode-info {
        padding: 0 20px 12px;
        gap: 15px;
    }
    
    .episode-content {
        padding: 15px 20px 20px;
    }
    
    .scene {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .dialogue {
        font-size: 1em;
    }
    
    .shock-text {
        font-size: 1em;
        padding: 8px 12px;
    }
    
    .chapter-title {
        font-size: 1.8em;
    }
    
    .chapter-content {
        font-size: 1em;
    }
    
    footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2em;
    }
    
    .chapter-title {
        font-size: 1.5em;
    }
    
    .chapter-content p {
        text-indent: 1.5em;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* 选择文本样式 */
::selection {
    background: rgba(52, 152, 219, 0.2);
    color: #2c3e50;
}

/* 动画效果 */
.chapter {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
}

.chapter:nth-child(2) { animation-delay: 0.1s; }
.chapter:nth-child(3) { animation-delay: 0.2s; }
.chapter:nth-child(4) { animation-delay: 0.3s; }
.chapter:nth-child(5) { animation-delay: 0.4s; }
.chapter:nth-child(6) { animation-delay: 0.5s; }
.chapter:nth-child(7) { animation-delay: 0.6s; }
.chapter:nth-child(8) { animation-delay: 0.7s; }

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

/* 打印样式 */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        max-width: none;
    }
    
    header {
        background: white;
        color: black;
        border-bottom: 2px solid black;
    }
    
    .chapter {
        page-break-inside: avoid;
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .chapter-title {
        color: black;
        border-bottom-color: black;
    }
    
    footer {
        background: white;
        color: black;
        border-top: 1px solid black;
    }
}