/* --- 移动端基础重置 --- */
* { margin:0; padding:0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { background: #f8f8f8; color: #333; font-family: -apple-system, Helvetica, sans-serif; font-size: 14px; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; border: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ellipsis-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- 通用布局 --- */
.m-wrap { padding: 12px; }
.m-box { background: #fff; margin-bottom: 12px; padding: 15px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.m-title { font-size: 16px; font-weight: bold; border-left: 4px solid #ff6600; padding-left: 10px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.m-title .more { font-size: 12px; font-weight: normal; color: #999; }

/* --- Header & Nav --- */
.m-header { background: #fff; border-bottom: 1px solid #eee; padding: 10px 15px; position: sticky; top: 0; z-index: 1000; }
.m-header .top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.m-header .logo { font-size: 20px; font-weight: bold; color: #ff6600; }
.m-nav-scroll { display: flex; overflow-x: auto; padding: 10px 0; background: #fff; border-bottom: 1px solid #eee; }
.m-nav-scroll::-webkit-scrollbar { display: none; }
.m-nav-scroll a { padding: 0 15px; white-space: nowrap; color: #555; font-size: 15px; }
.m-nav-scroll a.active { color: #ff6600; font-weight: bold; }

/* --- 书籍列表项 (饱满风格) --- */
.m-book-item { display: flex; padding: 12px 0; border-bottom: 1px solid #f5f5f5; }
.m-book-item:last-child { border-bottom: none; }
.m-book-cover { width: 75px; height: 100px; border-radius: 4px; object-fit: cover; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.m-book-info { flex: 1; margin-left: 15px; min-width: 0; }
.m-book-info h4 { font-size: 16px; color: #222; margin-bottom: 6px; }
.m-book-info .intro { font-size: 13px; color: #777; line-height: 1.5; margin-bottom: 8px; height: 38px; }
.m-book-info .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #999; }
.tag-cat { padding: 1px 5px; border: 1px solid #ff6600; color: #ff6600; border-radius: 3px; font-size: 10px; }

/* --- 排行榜索引 --- */
.rank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rank-card { background: #fff; border: 1px solid #eee; padding: 15px; border-radius: 8px; text-align: center; }

/* --- 目录页列表 --- */
.m-chapter-list { display: grid; grid-template-columns: 1fr; }
.m-chapter-list a { padding: 12px 0; border-bottom: 1px dotted #eee; color: #444; font-size: 15px; }

/* --- 阅读页风格 --- */
.read-container { background: #f4f1e7; min-height: 100vh; padding-bottom: 40px; }
.read-content { font-size: 20px; line-height: 2.5; color: #333; white-space: pre-line; min-height: 600px; text-indent: 2em;}

/* --- 翻页按钮 --- */
.m-page-nav { display: flex; justify-content: space-between; padding: 20px 0; }
.m-page-nav a, .m-page-nav span { flex: 1; text-align: center; background: #fff; border: 1px solid #ddd; margin: 0 5px; padding: 10px; border-radius: 5px; font-size: 14px; }
.m-page-nav .active { background: #ff6600; color: #fff; border-color: #ff6600; }

/* --- 搜索框 --- */
.search-wrap { display: flex; background: #f2f2f2; border-radius: 20px; padding: 6px 15px; }
.search-wrap input { flex: 1; border: none; background: none; outline: none; font-size: 14px; }



/* ========== 沉浸式阅读页专属样式 ========== */
body { transition: background-color 0.3s, color 0.3s; margin: 0; min-height: 100vh; }

/* 顶部导航栏 */
.reader-top-bar {
    position: fixed; top: 0; left: 0; right: 0; height: 50px;
    background: rgba(255, 255, 255, 0.95); box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    display: flex; justify-content: space-between; align-items: center; padding: 0 15px;
    transform: translateY(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1000;
}
.reader-top-bar a { font-size: 16px; color: #333; font-weight: 500; }

/* 底部设置栏 */
.reader-bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.95); box-shadow: 0 -1px 5px rgba(0,0,0,0.05);
    padding: 20px 15px; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1000;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)); /* 兼容 iPhone 底部小黑条 */
}

/* 控制菜单呼出 */
body.menu-active .reader-top-bar { transform: translateY(0); }
body.menu-active .reader-bottom-bar { transform: translateY(0); }

/* 正文基础排版 */
.read-container { min-height: 100vh; }
.chapter-title { font-size: 22px; font-weight: bold; margin: 20px 0; line-height: 1.4; }
.chapter-meta { font-size: 12px; color: #999; margin-bottom: 30px; }
.read-content { font-size: 20px; line-height: 2.2; white-space: pre-line; min-height: 60vh; text-indent: 2em; }

/* 底部按钮 (覆盖基础样式) */
.m-page-nav a { flex: 1; text-align: center; margin: 0 5px; padding: 12px 0; border-radius: 5px; font-size: 15px; border: none; background: rgba(0,0,0,0.05); }

/* 设置行 */
.setting-row { display: flex; align-items: center; margin-bottom: 20px; gap: 15px; }
.setting-row:last-child { margin-bottom: 0; }
.setting-row .label { font-weight: bold; color: #666; font-size: 14px; width: 40px; }
.setting-row button { padding: 6px 15px; border: 1px solid #ddd; background: transparent; border-radius: 20px; font-size: 14px; color: #333; outline: none; }
.setting-row .val { min-width: 50px; text-align: center; font-weight: bold; font-size: 16px; color: #333;}
.setting-row .btn-reset { border: none; text-decoration: underline; color: #999; font-size: 12px; padding: 0;}

/* 主题颜色块按钮 */
.theme-colors { display: flex; gap: 15px; flex: 1; justify-content: space-between; }
.theme-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.theme-btn.active { border-color: #ff6600; transform: scale(1.1); transition: 0.2s; }
.theme-default { background: #f4f1e7; }
.theme-white { background: #ffffff; border: 1px solid #ddd; }
.theme-green { background: #cce8cf; }
.theme-sepia { background: #e8dcb8; }
.theme-dark { background: #1a1a1a; border: 1px solid #555; }

/* ========== 阅读页  5套主题颜色作用于全局 ========== */
/* ========== 沉浸式阅读页专属样式 (起点标准版) ========== */

/* 1. 定义全局主题变量 (核心护眼配色) */

:root {
    --rd-bg: #f6f1e7;            /* 默认羊皮纸 */
    --rd-text: #333333;          /* 正文颜色 */
    --rd-text-sub: #999999;      /* 副标题/作者颜色 */
    --rd-menu-bg: rgba(255, 255, 255, 0.90); /* 菜单毛玻璃背景 */
    --rd-menu-border: rgba(0, 0, 0, 0.06);   /* 菜单边框 */
    --rd-btn-bg: transparent;    /* 按钮背景 */
    --rd-btn-border: #dddddd;    /* 按钮边框 */
}

body.theme-white {
    --rd-bg: #ffffff;
    --rd-menu-bg: rgba(245, 245, 245, 0.90);
}
body.theme-green {
    --rd-bg: #e1ebd8;
    --rd-text: #2b3d27;
    --rd-menu-bg: rgba(213, 227, 203, 0.90);
    --rd-btn-border: rgba(43, 61, 39, 0.2);
}
body.theme-sepia {
    --rd-bg: #eedcb5;
    --rd-text: #4c3b22;
    --rd-menu-bg: rgba(230, 208, 161, 0.90);
    --rd-btn-border: rgba(76, 59, 34, 0.2);
}
body.theme-dark {
    --rd-bg: #1a1a1a;
    --rd-text: #757575;
    --rd-text-sub: #555555;
    --rd-menu-bg: rgba(26, 26, 26, 0.95);
    --rd-menu-border: rgba(255, 255, 255, 0.05);
    --rd-btn-bg: rgba(255, 255, 255, 0.05);
    --rd-btn-border: rgba(255, 255, 255, 0.1);
}

/* 2. 强制应用变量到全局基础结构 */
body {
    background-color: var(--rd-bg) !important;
    transition: background-color 0.3s ease;
    margin: 0;
    min-height: 100vh;
}
.read-container { background: transparent !important; min-height: 100vh; }

/* 3. 正文排版高级感优化 (起点级专业排版) */
.chapter-title {
    font-size: 24px; font-weight: bold; margin: 35px 0 25px;
    line-height: 1.4; color: var(--rd-text) !important;
    letter-spacing: 0.5px;
}
.chapter-meta {
    font-size: 13px; color: var(--rd-text-sub) !important;
    margin-bottom: 40px; letter-spacing: 1px;
}

/* 整个正文的基准设定 */
@font-face {
    font-family: 'AntiScrapingFont';
    src: url('/static/template/common/woff/custom.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}
.read-content {
    font-family: 'AntiScrapingFont', 'PingFang SC', 'Helvetica Neue', Helvetica, 'Microsoft YaHei', sans-serif;
    font-size: 20px;
    line-height: 1.8; /* 专业阅读行距：1.8 是移动端的黄金比例 */
    letter-spacing: 1px; /* 稍微拉开字间距，减少视觉疲劳 */
    color: var(--rd-text) !important;
    text-align: justify; /* 两端对齐，让右侧边缘像出版书一样整齐 */
    text-justify: inter-ideograph; /* 针对中文的对齐优化 */
    min-height: 60vh;

    /* 注意：如果你的内容全挤在一起没有换行，说明你后端返回的是纯文本，必须保留下面这行；
       如果后端返回的是带 <p> 标签的 HTML，可以将这一行注释掉 */
    white-space: pre-line;
}

/* 专门控制段落间距和首行缩进 (如果你后端输出的是 <p> 或 <div> 标签) */
.read-content p,
.read-content div {
    text-indent: 2em; /* 严格首行缩进 2 字符 */
    margin-top: 0;
    margin-bottom: 1.2em; /* 段落间距：略大于单行行距，形成清晰的视觉分块感 */
}

/* 4. 菜单栏通用高级质感 (毛玻璃) */
.reader-top-bar, .reader-bottom-bar {
    position: fixed !important; left: 0; right: 0; z-index: 1000;
    background: var(--rd-menu-bg) !important;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); /* 核心高级感：毛玻璃 */
    border: 1px solid var(--rd-menu-border);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.reader-top-bar {
    top: 0; height: 52px;
    display: flex; justify-content: space-between; align-items: center; padding: 0 15px;
    transform: translateY(-100%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.reader-top-bar a { font-size: 15px; color: var(--rd-text); font-weight: 500; }

.reader-bottom-bar {
    bottom: 0; padding: 25px 20px calc(25px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
    border-radius: 20px 20px 0 0; /* 底部菜单做圆角处理更现代 */
}

/* 呼出状态 */
body.menu-active .reader-top-bar, body.menu-active .reader-bottom-bar { transform: translateY(0); }

/* 5. 底部操作按钮 */
.m-page-nav a {
    flex: 1; text-align: center; margin: 0 6px; padding: 12px 0;
    border-radius: 8px; font-size: 15px; font-weight: 500;
    background: var(--rd-menu-bg); border: 1px solid var(--rd-menu-border);
    color: var(--rd-text) !important; box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* 6. 设置选项排版 */
.setting-row { display: flex; align-items: center; margin-bottom: 25px; gap: 15px; }
.setting-row:last-child { margin-bottom: 0; }
.setting-row .label { font-weight: bold; color: var(--rd-text-sub); font-size: 13px; width: 35px; letter-spacing: 1px;}
.setting-row button {
    padding: 8px 18px; background: var(--rd-btn-bg); border: 1px solid var(--rd-btn-border);
    border-radius: 20px; font-size: 14px; color: var(--rd-text); outline: none; transition: 0.2s;
}
.setting-row .val { min-width: 50px; text-align: center; font-weight: 500; font-size: 17px; color: var(--rd-text);}
.setting-row .btn-reset { border: none; text-decoration: none; color: var(--rd-text-sub); font-size: 13px; padding: 0; background: transparent;}

/* 7. 主题颜色球 */
.theme-colors { display: flex; gap: 15px; flex: 1; justify-content: space-between; align-items: center;}
.theme-btn {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
/* 起点风格选中状态：外围加一圈当前字体的颜色作为环 */
.theme-btn.active { box-shadow: 0 0 0 2px var(--rd-menu-bg), 0 0 0 4px var(--rd-text); transform: scale(0.95); }
.theme-default { background: #f6f1e7; }
.theme-white { background: #ffffff; }
.theme-green { background: #e1ebd8; }
.theme-sepia { background: #eedcb5; }
.theme-dark { background: #1a1a1a; border: 1px solid #444; }

/* 8. 新手引导遮罩 (极致修复掉到底部的问题) */
.reader-guide-mask {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 99999 !important; /* 确保在最顶层 */
    display: none; justify-content: center; align-items: center;
}
.guide-box {
    background: transparent; padding: 40px 20px; border-radius: 12px;
    text-align: center; width: 75%; max-width: 300px;
    border: 1px dashed rgba(255, 255, 255, 0.4);
}
.guide-box p {
    margin-bottom: 30px; padding-bottom: 30px;
    font-size: 17px; color: #ffffff; line-height: 1.8; letter-spacing: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.guide-box button {
    background: transparent; color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.7); padding: 10px 0;
    width: 85%; border-radius: 25px; font-size: 16px; letter-spacing: 2px; outline: none;
}
/* 18log.com */