/* 全局基础样式（修复安卓滚动+美化） */
:root {
    --primary: #409eff;       /* 主色调 */
    --primary-light: #ecf5ff; /* 主色浅背景 */
    --gray-light: #f8f9fa;    /* 浅灰背景 */
    --gray-border: #e5e6eb;   /* 边框色 */
    --text-main: #333;        /* 主文本色 */
    --text-secondary: #666;   /* 次要文本色 */
    --text-light: #999;       /* 浅文本色 */
}

html, body {
    height: auto !important;
    min-height: 100%;
    overflow: visible !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch; /* 安卓顺滑滚动 */
    font-family: "PingFang SC", "Microsoft Yahei", sans-serif;
    background-color: var(--gray-light);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
a {
    text-decoration: none;
    color: var(--primary);
    transition: all 0.2s ease;
}
a:hover {
    color: #337ecc;
}
ul, li {
    list-style: none;
}
.container {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 顶部导航栏（粘性定位+美化） */
.header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 999;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    max-width: 750px;
    margin: 0 auto;
}

/* 菜单按钮美化 */
.menu-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-light);
    border-radius: 50%;
    font-size: 18px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0; /* 防止按钮被压缩 */
}
.menu-btn:hover {
    background: #ddeeff;
}

/* 搜索框深度美化（核心：修复输入问题+输入不放大） */
.search-wrap {
    flex: 1;
    position: relative;
    height: 40px; /* 固定高度，避免布局错乱 */
}
.search-form {
    width: 100%;
    height: 100%;
}
.search-input {
    width: 100%;
    height: 100%;
    padding: 0 45px 0 40px; /* 右侧预留按钮空间，修复输入遮挡 */
    border: 1px solid var(--gray-border);
    border-radius: 20px;
    outline: none;
    font-size: 30px !important; /* 强制16px，避免iOS自动放大 */
    background: var(--gray-light);
    transition: all 0.2s;
    -webkit-appearance: none; /* 移除iOS默认样式 */
}
/* 搜索框聚焦美化 */
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
    background: #fff;
}

/* 搜索按钮美化（修复遮挡输入问题） */
.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1; /* 按钮在上层，但不遮挡输入 */
}

/* 侧边菜单美化 */
.category-menu {
    position: fixed;
    top: 0;
    left: -280px;
    height: 100%;
    background: #fff;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding-top: 70px;
    overflow-y: auto; /* 菜单过长可滚动 */
}
.category-menu.show {
    left: 0;
}
.category-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-border);
}
.category-item a {
    color: var(--text-main);
    font-size: 14px;
    display: block;
}
.category-item a:hover {
    color: var(--primary);
    padding-left: 4px;
}
/* 遮罩层 */
.mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 998;
    display: none;
    backdrop-filter: blur(1px);
}
.mask.show {
    display: block;
}

/* 面包屑 */
.breadcrumb {
    padding: 12px 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 小说卡片主体 */
.novel-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin: 15px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.novel-title {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
}
.novel-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: var(--primary-light);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* 小说简介 */
.intro-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
    color: var(--text-main);
}
.novel-intro {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* 下载按钮美化 */
.download-area {
    margin: 20px 0;
}
.download-btn {
    display: block;
    width: 100%;
    height: 46px;
    line-height: 46px;
    text-align: center;
    background: var(--primary);
    color: #fff !important;
    border-radius: 23px;
    margin-bottom: 12px;
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(64, 158, 255, 0.2);
    transition: all 0.2s;
}
.download-btn:hover {
    background: #337ecc;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(64, 158, 255, 0.3);
}
.download-btn.secondary {
    background: #fff;
    color: var(--primary) !important;
    border: 1px solid var(--primary);
    box-shadow: none;
}
.download-btn.secondary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(64, 158, 255, 0.1);
}
.download-tips {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    margin-top: 10px;
}

/* 上一篇/下一篇 深度美化 */
.page-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 0 10px;
    margin-top: 10px;
    border-top: 1px dashed var(--gray-border);
}
.page-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--primary-light);
    border-radius: 18px;
    font-size: 14px;
    max-width: 45%;
}
.page-nav-item.prev {
    justify-content: flex-start;
}
.page-nav-item.next {
    justify-content: flex-end;
}
.page-nav-item i {
    font-size: 12px;
    color: var(--primary);
}
.page-nav-item a {
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.page-nav-item a:hover {
    color: var(--primary);
}

/* 相关小说 深度美化 */
.related-novels {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin: 0 15px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.related-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.related-title::before {
    content: "";
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 2px;
}
.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px; /* 自适应列间距 */
}
.related-item {
    padding: 10px 12px;
    background: var(--primary-light);
    border-radius: 8px;
    transition: all 0.2s;
}
.related-item:hover {
    background: #ddeeff;
    transform: translateY(-2px);
}
.related-item a {
    color: var(--text-main);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.related-item a:hover {
    color: var(--primary);
}

/* 底部 */
.footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    padding: 20px 15px;
}

/* 自适应适配小屏手机 */
@media (max-width: 375px) {
    .novel-title {
        font-size: 20px;
    }
    .download-btn {
        height: 42px;
        line-height: 42px;
        font-size: 15px;
    }
    .related-list {
        grid-template-columns: 1fr 1fr; /* 小屏强制两列 */
    }
    .page-nav-item {
        max-width: 43%;
        padding: 6px 10px;
    }
}