/* 基础变量和全局样式 */
: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;
}

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

.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;
}

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

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

/* 主题选项 */
.theme-default {
    --text-color: #333;
    --bg-color: #f9f5e9;
    --header-color: #8b4513;
    --highlight-color: #f0e68c;
    --search-highlight: #ff0000;
    --settings-btn-color: #4a6fa5;
}

.theme-eye-care {
    --text-color: #556b2f;
    --bg-color: #e1f7d5;
    --header-color: #4b5320;
    --highlight-color: #c1e1c1;
    --search-highlight: #8b0000;
    --settings-btn-color: #5a7f5a;
}

.theme-dark {
    --text-color: #ddd;
    --bg-color: #222;
    --header-color: #8b4513;
    --highlight-color: #555;
    --search-highlight: #ff4500;
    --settings-btn-color: #5a5a8a;
}

/* 字体大小选项 */
.font-small {
    font-size: 0.9rem;
}

.font-medium {
    font-size: 1rem;
}

.font-large {
    font-size: 1.1rem;
}

.font-xlarge {
    font-size: 1.2rem;
}

/* 搜索结果容器 */
#search-results-container {
    padding-top: 60px;
}

.search-result-item {
    margin-bottom: 25px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.result-source {
    font-size: 0.9rem;
    color: var(--header-color);
    margin-bottom: 8px;
    font-weight: bold;
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 10px;
}

.pagination-btn {
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid #ddd;
    background-color: #f8f8f8;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #e9e9e9;
}

.pagination-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.page-info {
    margin: 0 15px;
}

/* 用户链接样式 */
.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;
    }
}

/* 在 style.css 文件末尾添加以下内容 */

/* 确保主题应用到整个内容区域 */
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);
}

/* 分页按钮样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 10px;
    background-color: var(--bg-color);
}

.pagination-btn {
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid var(--header-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--highlight-color);
    color: var(--text-color);
}

.pagination-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    margin: 0 15px;
    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: #007aff;
	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;
}