/* 基础变量和全局样式 */
:root {
    --text-color: #333;
    --bg-color: #f9f5e9;
    --header-color: #8b4513;
    --highlight-color: #f0e68c;
    --search-highlight: #ff0000;
    --settings-btn-color: #4a6fa5;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.9;
}

/* 容器和布局样式 */
.container {
    max-width: 600px;
    margin: 0 auto;
    color: #8b0000;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    color: #8b0000;
}

.content {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    line-height: 2.25rem;
}

/* 按钮样式 */
.btn {
    display: block;
    width: 90%;
    padding: 12px;
    background-color: #8b0000;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 18px;
    border: none;
    margin: 0 auto;
    transition: all 0.3s;
}

.btn:hover {
    transform: scale(1.02);
}

/* 书籍封面样式 */
.book-covers {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    text-align: center;
}

.book-cover {
    width: 150px;
    height: 240px;
    object-fit: cover;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.book-cover:hover {
    transform: scale(1.05);
}

.book-caption {
    text-align: center;
    font-size: 0.9em;
    margin-top: 5px;
    color: #555;
}

/* 作者和页脚样式 */
.author {
    text-align: right;
    margin-bottom: 30px;
    font-weight: bold;
    margin-right: 30px;
}

.footer {
    text-align: center;
    margin-top: 40px;
    font-size: 1.2em;
}

/* 赞助商样式 */
.sponsor {
    margin: 30px auto;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
}

.sponsor-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #8B0000;
}

.sponsor-qrcode {
    width: 270px;
    height: 351px;
    margin: 15px auto;
    background-color: #fff;
    padding: 10px;
    border: 1px solid #ddd;
}

.sponsor-note {
    font-size: 0.8em;
    margin-top: 10px;
}

/* 文本修饰样式 */
.boxed {
    border: 1px solid #666;
    color: #666;
    padding: 0 0.06em;
    margin: 0 0.06em;
    line-height: normal;
    display: inline-block;
    font-size: 0.9em;
    transform-origin: left center;
}

ins {
    text-decoration: none;
    font-weight: bold;
    color: #c00;
}

/* 页面标题样式 */
.page-title {
    font-size: 1.3rem;
    text-align: center;
    margin: 0;
    padding: 10px 15px;
    color: var(--header-color);
    border-bottom: 1px solid var(--header-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 搜索相关样式 */
.search-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(173, 216, 230, 0.9);
    padding: 10px 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    display: none;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.search-container.visible {
    display: flex;
}

.search-input-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

#search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.95rem;
    width: 100%;
    flex: 1;
    background-color: rgba(255,255,255,0.8);
    transition: all 0.3s;
    padding-right: 80px;
    box-sizing: border-box;
}

#search-input:focus {
    outline: none;
    border-color: var(--settings-btn-color);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.search-result-counter {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 0.8em;
    pointer-events: none;
}

.search-btn, .search-hide-btn, .mulu-btn, .mulu-close-btn, .settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.search-btn {
    color: var(--header-color);
    font-size: 1.2rem;
    padding: 5px;
}

.search-btn:hover {
    transform: scale(1.1);
}

.search-hide-btn {
    color: #666;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 4px;
}

.search-hide-btn:hover {
    background-color: rgba(0,0,0,0.1);
    color: #333;
}

/* 下拉菜单样式 */
.search-dropdown {
    position: fixed;
    top: 110px;
    left: 10px;
    right: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 101;
    display: none;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform-origin: top center;
    animation: dropdownFadeIn 0.25s ease-out;
    border: 1px solid rgba(0,0,0,0.08);
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-dropdown.visible {
    display: block;
}

.search-dropdown-item {
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    color: #333;
}

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

.search-dropdown-item:hover {
    background-color: #f8f8f8;
}

.search-dropdown-item:active {
    background-color: #f0f0f0;
    transform: scale(0.98);
}

.search-dropdown-item i {
    margin-right: 10px;
    color: var(--header-color);
    font-size: 1.1rem;
    min-width: 20px;
    text-align: center;
}

/* 设置面板样式 */
.settings-btn {
    position: fixed;
    bottom: 70px;
    right: 15px;
    background: #8b0000;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    z-index: 101;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    font-size: 0.9rem;
}

.settings-btn:hover {
    transform: scale(1.1);
}

.settings-panel {
    position: fixed;
    bottom: 120px;
    right: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 102;
    display: none;
    width: 160px;
    animation: fadeIn 0.2s ease-out;
}

.settings-panel.show {
    display: block;
}

.setting-option {
    margin-bottom: 12px;
}

.setting-option:last-child {
    margin-bottom: 0;
}

.setting-option label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #555;
}

.setting-option select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
}

/* 内容样式 */
#content {
    margin-top: 0px;
}

/* .content-item {
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
} */

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

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 20px;
    color: #888;
    display: none;
}

/* 用户链接样式 */
.user-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.user-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.user-link:hover {
    color: #0066cc;
}

/* 目录菜单样式 */
.mulu-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: #f8f4e8;
    z-index: 1000;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0,0,0,0.15);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid rgba(0,0,0,0.1);
}

.mulu-menu.active {
    left: 0;
}

.mulu-header {
    padding: 18px 15px;
    background: #7a3b11;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mulu-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.mulu-close-btn {
    color: white;
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.mulu-close-btn:active {
    background: rgba(255,255,255,0.2);
}

.mulu-content {
    padding: 15px 0;
}

.mulu-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mulu-content li {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mulu-content li:last-child {
    border-bottom: none;
}

.mulu-content a {
    display: block;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    position: relative;
}

.mulu-content a:active {
    background: rgba(0,0,0,0.05);
    transform: translateX(3px);
}

.mulu-content a::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #7a3b11;
    opacity: 0;
    transition: opacity 0.2s;
}

.mulu-content a:active::after,
.mulu-content a:hover::after {
    opacity: 1;
}

.mulu-content a i {
    margin-right: 10px;
    color: #7a3b11;
}

.mulu-btn {
    color: #7a3b11;
    font-size: 1.3rem;
    padding: 0;
    margin-right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.mulu-btn:active {
    background: rgba(122,59,17,0.1);
}

/* 遮罩层 */
.mulu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mulu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 480px) {
    body {
        padding-top: 80px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 70px;
    }
    
    .page-title {
        font-size: 1.1rem;
        padding: 8px 10px;
    }
    
    .search-container {
        top: 50px;
        padding: 8px 10px;
    }
    
    .settings-btn {
        width: 40px;
        height: 40px;
        bottom: 70px;
        right: 15px;
        font-size: 0.9rem;
    }
    
    .settings-panel {
        bottom: 120px;
        right: 15px;
        width: 160px;
        padding: 12px;
    }
    
    .content-item {
        margin-bottom: 15px;
        padding-bottom: 8px;
    }
    
    .search-dropdown {
        top: 100px;
        left: 8px;
        right: 8px;
        border-radius: 10px;
    }
    
    .search-dropdown-item {
        padding: 16px 20px;
        font-size: 1rem;
    }
    
    #search-input {
        padding: 10px 15px;
        font-size: 1rem;
    }
}

@media (min-width: 481px) {
    .settings-btn {
        top: 12px;
        bottom: auto;
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
    
    .settings-panel {
        top: 55px;
        bottom: auto;
    }
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    .search-dropdown {
        background: #2a2a2a;
        border-color: rgba(255,255,255,0.1);
    }
    
    .search-dropdown-item {
        color: #eee;
        border-bottom-color: rgba(255,255,255,0.1);
    }
    
    .search-dropdown-item:hover {
        background-color: #333;
    }
    
    .search-dropdown-item:active {
        background-color: #3a3a3a;
    }
}

/* 确保主题应用到整个内容区域 */
body.theme-default,
body.theme-default .content,
body.theme-default .content-item {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.theme-eye-care,
body.theme-eye-care .content,
body.theme-eye-care .content-item {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.theme-dark,
body.theme-dark .content,
body.theme-dark .content-item {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* 搜索高亮 */
.search-highlight {
    background-color: var(--search-highlight);
    color: white !important;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

/* 文章内部文本的样式 */
/* NOTE 样式 */
.note {
    background-color: #f1f1f1;
    padding: 10px;
    border-left: 3px solid #ccc;
    margin: 10px 0;
}
/* TIP 样式 */
.tip {
    background-color: #e6e6ff;
    padding: 10px;
    border-left: 3px solid #999;
    margin: 10px 0;
}
/* IMPORTANT 样式 */
.important {
    background-color: #f9f0ff;
    padding: 10px;
    border-left: 3px solid #c788ff;
    margin: 10px 0;
}
/* WARNING 样式 */
.warning {
    background-color: #fff9e6;
    padding: 10px;
    border-left: 3px solid #ffd54f;
    margin: 10px 0;
}
/* CAUTION 样式 */
.caution {
    background-color: #ffe6e6;
    padding: 10px;
    border-left: 3px solid #ff9e9e;
    margin: 10px 0;
}

/* 定义不同颜色的底纹样式，带有圆角效果 */
.yellow {
    background-color: #fff9c4;
    padding: 1px 3px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.blue {
    background-color: #bbdefb;
    padding: 1px 3px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.green {
    background-color: #c8e6c9;
    padding: 1px 3px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.pink {
    background-color: #f8bbd0;
    padding: 1px 3px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 题目与答案 */
.question-container {
    background-color: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.question {
    font-weight: 500;
    margin-bottom: 12px;
}
.answer-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border-radius: 8px;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.answer-btn:active {
    background-color: #0062cc;
    transform: scale(0.98);
} 
.answer {
    margin-top: 12px;
    padding: 12px;
    background-color: #c8e6c9;
    border-radius: 8px;
    display: none;
    animation: fadeIn 0.3s ease;
} 
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
.blank {
    text-decoration: underline;
    color: #007aff;
    font-weight: bold;
}

/* 主容器样式 */
.main-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* 内容区域调整 */
#content {
    margin-top: 60px;
    margin-bottom: 20px;
    padding-bottom: 30px;
}

/* 平板和电脑端样式调整 */
@media (min-width: 768px) {
    .main-container {
        max-width: 750px;
        padding: 0 10px;
    }
    
    body {
        padding-top: 60px;
        padding-bottom: 100px;
    }
    
    #content {
        margin-top: 70px;
        margin-bottom: 100px;
    }
    
    .content-item {
        margin-bottom: 20px;
        padding: 15px;
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    .question {
        font-size: 1.05rem;
        line-height: 1.8;
    }
    
    .answer-btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .answer {
        padding: 15px;
        margin-top: 15px;
    }
}

/* 电脑大屏幕样式 */
@media (min-width: 768px) {
    .main-container {
        max-width: 750px;
        padding: 30 30px;
    }
    
    #content {
        margin-top: 10px;
        margin-bottom: 0px;
        padding: 0 0px;
    }
}

/* 确保底部有足够空间 */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    border-top: 1px solid rgba(0,0,0,0.1);
}

.page-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background-color: #007bff;
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    text-align: center;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #cccccc;
}

.page-btn:active:not(:disabled) {
    transform: scale(0.95);
    background-color: #6d0000;
}

#page-info {
    font-size: 15px;
    color: #555;
    min-width: 80px;
    text-align: center;
}

/* 保持手机端样式不变 */
@media (max-width: 767px) {
    body {
        padding-top: 50px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 30px;
    }
    
    .main-container {
        padding: 0 0px;
    }
    
    #content {
        margin-top: 10px;
        margin-bottom: 0px;
    }

    .pagination-controls {
        padding: 10px 10px;
        gap: 10px;
    }

    .page-btn {
        padding: 8px 15px;
        font-size: 14px;
        min-width: 70px;
    }

    #page-info {
        font-size: 14px;
    }
}

/* 页码选择器样式 */
.page-selector {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1001;
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 90%;
    max-height: 200px;
    overflow-y: auto;
}

.page-selector-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: #f0f0f0;
    color: #333;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-selector-btn:hover {
    background: #e0e0e0;
}

.page-selector-btn.active {
    background: #007bff;
    color: white;
}

#page-info {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #007bff;
    color: #007bff;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

#page-info:active {
    background: rgba(0, 123, 255, 0.1);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .page-selector {
        bottom: 50px;
        max-width: 95%;
    }
    
    .page-selector-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

