/* 小说框架子主题 - 章节阅读器样式（依赖 story.css 的命名规范） */

/* 章节页自有布局：不使用父主题文章侧边栏容器 */
.novel-frame-chapter-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
    margin-top: 14px;
}

.novel-frame-chapter-main {
    min-width: 0;
}

.novel-frame-reader-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 80px;
}

.novel-frame-reader-panel {
    padding: 16px;
    border-radius: 8px;
    background: var(--main-bg-color, #fff);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
}

.novel-frame-reader-panel-title {
    margin: 0 0 12px;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
}

.novel-frame-reader-story-link {
    display: block;
    margin-bottom: 14px;
    color: inherit;
    font-weight: 600;
    line-height: 1.45;
    text-decoration: none;
}

.novel-frame-reader-story-link:hover {
    color: #0469d0;
}

.novel-frame-reader-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.novel-frame-reader-meta div {
    min-width: 0;
    padding: 10px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .025);
    text-align: center;
}

.novel-frame-reader-meta dt {
    margin: 0 0 4px;
    font-size: 12px;
    opacity: .55;
}

.novel-frame-reader-meta dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.novel-frame-reader-pay-message {
    margin: 0 0 14px;
    line-height: 1.7;
    opacity: .82;
}

.novel-frame-reader-pay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.novel-frame-reader-pay-actions .but {
    flex: 1 1 auto;
    text-align: center;
}

.novel-frame-reader-directory-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.novel-frame-reader-directory-head .novel-frame-reader-panel-title {
    margin-bottom: 0;
}

.novel-frame-reader-directory-head span {
    font-size: 12px;
    opacity: .55;
}

.novel-frame-reader-directory {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 520px;
    overflow-y: auto;
}

.novel-frame-reader-directory-item {
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.novel-frame-reader-directory-item:last-child {
    border-bottom: none;
}

.novel-frame-reader-directory-link {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 6px;
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
}

.novel-frame-reader-directory-link:hover,
.novel-frame-reader-directory-item.is-current .novel-frame-reader-directory-link {
    background: rgba(4, 105, 208, .08);
    color: inherit;
}

.novel-frame-reader-directory-index {
    font-size: 12px;
    opacity: .45;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.novel-frame-reader-directory-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.novel-frame-reader-directory-flag {
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
    background: #e8f6ed;
    color: #2d8a4d;
}

.novel-frame-reader-directory-flag.is-paid {
    background: #fde9e7;
    color: #c0392b;
}

.novel-frame-reader-directory-flag.is-vip-free {
    background: #fff3d6;
    color: #b68100;
}

/* 章节 article：清零父主题 .box-body 的默认 padding，让 header / toolbar 铺到圆角边缘
 * 子节点（header / body / toolbar / access-notice / paid-preview）都自带 padding 或 margin，
 * 不依赖父层 padding；overflow:hidden 配合 .radius8 保住 8px 圆角裁剪，header 底色才能贴着圆角 */
.novel-frame-chapter-article.box-body {
    padding: 0;
    overflow: hidden;
}

/* 章节头部：标题区独立成「章首」，与正文/工具栏拉开层次
 * - 中心淡蓝径向高光 + 顶部到透明的浅灰渐变，营造焦点
 * - 底部 1px 分隔线，与下方 toolbar 自然过渡
 * - 标题左右各留 110px 给右上「沉浸阅读」按钮（绝对定位）的视觉空间，避免长标题贴边 */
.novel-frame-chapter-header {
    padding: 24px 24px 20px;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(4, 105, 208, .05) 0%, transparent 60%),
        linear-gradient(180deg, rgba(15, 23, 42, .015) 0%, transparent 100%);
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}

.novel-frame-chapter-breadcrumb {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1;
}

.novel-frame-chapter-breadcrumb a {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .045);
    color: rgba(15, 23, 42, .7);
    text-decoration: none;
    transition: color .15s ease, background-color .15s ease, transform .15s ease;
}

.novel-frame-chapter-breadcrumb a:hover,
.novel-frame-chapter-breadcrumb a:focus {
    color: #0469d0;
    background: rgba(4, 105, 208, .08);
    transform: translateX(-2px);
}

.novel-frame-chapter-title {
    margin: 4px 0 2px;
    padding: 0 110px;
    font-size: 24px;
    line-height: 1.45;
    font-weight: 600;
    letter-spacing: .5px;
    text-align: center;
}

/* 阅读工具栏（上一章 / 目录 / 下一章 CTA） */
.novel-frame-reader-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(0, 0, 0, .02);
}

.novel-frame-reader-tool {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 64px;
    padding: 6px 12px;
    color: rgba(15, 23, 42, .82);
    background: transparent;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: color .15s ease, background-color .15s ease;
}

.novel-frame-reader-tool i {
    font-size: 18px;
    line-height: 1;
}

.novel-frame-reader-tool-label {
    font-size: 12px;
    line-height: 1.3;
}

.novel-frame-reader-tool:hover,
.novel-frame-reader-tool:focus {
    color: #0469d0;
    background: rgba(4, 105, 208, .06);
    text-decoration: none;
}

.novel-frame-reader-tool.is-disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.novel-frame-reader-cta {
    flex: 0 1 auto;
    margin-left: auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 130px;
    max-width: 260px;
    padding: 10px 22px;
    border-radius: 999px;
    color: #fff;
    text-align: center;
    text-decoration: none;
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .22);
    transition: filter .15s ease;
}

.novel-frame-reader-cta:hover,
.novel-frame-reader-cta:focus {
    color: #fff;
    text-decoration: none;
    filter: brightness(1.08);
}

.novel-frame-reader-cta.is-disabled {
    pointer-events: none;
    background: linear-gradient(135deg, #94a3b8 0%, #475569 100%);
    box-shadow: none;
    opacity: .65;
}

.novel-frame-reader-cta-main {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.novel-frame-reader-cta-sub {
    max-width: 200px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.2;
    opacity: .82;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.novel-frame-reader-access-notice {
    margin: 14px 20px 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(4, 105, 208, .08);
    color: #0469d0;
    font-size: 13px;
    line-height: 1.7;
}

/* 文字章节正文 */
.novel-frame-chapter-body {
    padding: 0 20px 20px;
}

.novel-frame-chapter-body.is-novel .novel-frame-chapter-content {
    font-size: 17px;
    line-height: 1.9;
    max-width: 780px;
    margin: 20px auto;
}

.novel-frame-chapter-body.is-novel .novel-frame-chapter-content p {
    text-indent: 2em;
    margin: 0 0 1em;
}

/* 漫画章节：垂直图片流 */
.novel-frame-comic-images {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: 900px;
    margin: 0 auto;
    background: #000;
}

.novel-frame-comic-page {
    margin: 0;
    width: 100%;
    line-height: 0;
}

.novel-frame-comic-page img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 900px;
    margin: 0 auto;
}

.novel-frame-comic-empty {
    padding: 40px 20px;
}

/* 付费墙 */
.novel-frame-paywall {
    padding: 40px 20px;
    text-align: center;
    background: rgba(0, 0, 0, .02);
    margin: 20px;
}

.novel-frame-paywall-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.novel-frame-paywall-msg {
    font-size: 15px;
    margin: 0 0 16px;
    color: inherit;
    opacity: .85;
}

.novel-frame-paywall-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 付费章节试看 */
.novel-frame-paid-preview {
    position: relative;
    max-width: 900px;
    margin: 20px auto 0;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(0, 0, 0, .025);
    border: 1px solid rgba(0, 0, 0, .06);
}

.novel-frame-paid-preview::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 120px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--main-bg-color, #fff));
}

.novel-frame-paid-preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(4, 105, 208, .06);
}

.novel-frame-paid-preview-kicker {
    font-weight: 600;
    color: #0469d0;
}

.novel-frame-paid-preview-note {
    font-size: 12px;
    opacity: .58;
}

.novel-frame-comic-preview-images {
    max-height: 760px;
    overflow: hidden;
}

.novel-frame-novel-preview-content {
    padding: 20px 24px 50px;
    margin: 0;
}

.novel-frame-paid-preview-empty {
    margin: 0;
    padding: 36px 20px 70px;
}

/* 响应式：手机端阅读体验优化 */
@media (max-width: 992px) {
    .novel-frame-chapter-layout {
        grid-template-columns: 1fr;
    }

    .novel-frame-reader-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .novel-frame-chapter {
        padding-bottom: 72px;
    }

    .novel-frame-chapter-layout {
        gap: 12px;
        margin-top: 0;
    }

    .novel-frame-chapter-article.box-body {
        overflow: hidden;
        padding: 0;
        border-radius: 16px;
    }

    .novel-frame-chapter-header {
        padding: 16px 14px 13px;
        background: linear-gradient(135deg, rgba(4, 105, 208, .08), rgba(4, 105, 208, .02));
        border-bottom: 0;
    }

    .novel-frame-chapter-breadcrumb {
        margin-bottom: 10px;
        font-size: 12px;
    }

    .novel-frame-chapter-breadcrumb a {
        padding: 5px 10px;
        background: rgba(255, 255, 255, .6);
    }

    .novel-frame-chapter-title {
        margin: 0;
        padding: 0;
        font-size: 18px;
        font-weight: 600;
        letter-spacing: 0;
        text-align: left;
    }

    .novel-frame-chapter-body {
        padding: 0 14px 16px;
    }

    .novel-frame-chapter-body.is-novel .novel-frame-chapter-content {
        margin: 16px auto;
        font-size: 16.5px;
        line-height: 1.9;
    }

    .novel-frame-chapter-body.is-comic {
        padding: 0;
    }

    .novel-frame-comic-images {
        max-width: none;
        width: 100%;
    }

    .novel-frame-comic-page img {
        max-width: none;
    }

    .novel-frame-reader-toolbar {
        gap: 6px;
        padding: 10px 12px;
        background: rgba(0, 0, 0, .015);
    }

    /* 移动端隐藏文章顶部那一份 toolbar，避免与底部固定栏重复 */
    .novel-frame-reader-toolbar.is-top {
        display: none;
    }

    .novel-frame-reader-toolbar.is-bottom {
        position: fixed;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 12px;
        z-index: 60;
        gap: 6px;
        padding: 8px 12px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .94);
        box-shadow: 0 -4px 14px rgba(15, 23, 42, .08);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-tool {
        min-width: 50px;
        padding: 4px 10px;
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-tool i {
        font-size: 16px;
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-tool-label {
        font-size: 11px;
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-cta {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        padding: 8px 18px;
        box-shadow: 0 4px 12px rgba(15, 23, 42, .22);
    }

    .novel-frame-reader-access-notice {
        margin: 10px 14px 0;
        border-radius: 12px;
    }

    .novel-frame-reader-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .novel-frame-reader-panel {
        padding: 14px;
        border-radius: 14px;
    }

    .novel-frame-reader-panel-title {
        font-size: 15px;
    }

    .novel-frame-reader-story-link {
        margin-bottom: 10px;
        font-size: 14px;
    }

    .novel-frame-reader-meta div {
        padding: 8px 5px;
    }

    .novel-frame-reader-meta dt {
        font-size: 11px;
    }

    .novel-frame-reader-meta dd {
        overflow: hidden;
        font-size: 12px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .novel-frame-reader-directory {
        display: flex;
        gap: 8px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .novel-frame-reader-directory::-webkit-scrollbar {
        display: none;
    }

    .novel-frame-reader-directory-item {
        flex: 0 0 128px;
        border-bottom: 0;
        scroll-snap-align: start;
    }

    .novel-frame-reader-directory-link {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 10px;
        border-radius: 12px;
        background: rgba(0, 0, 0, .025);
    }

    .novel-frame-reader-directory-index {
        text-align: left;
    }

    .novel-frame-reader-directory-title {
        display: -webkit-box;
        min-height: 36px;
        font-size: 13px;
        line-height: 1.4;
        white-space: normal;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .novel-frame-reader-directory-flag {
        justify-self: start;
        font-size: 10px;
    }

    .novel-frame-paywall {
        margin: 14px 0 0;
        padding: 28px 16px;
        border-radius: 16px;
    }

    .novel-frame-paywall-actions .but,
    .novel-frame-reader-pay-actions .but {
        border-radius: 999px;
    }

    .novel-frame-paid-preview {
        margin-top: 14px;
        border-radius: 14px;
    }

    .novel-frame-paid-preview-head {
        padding: 10px 12px;
    }

    .novel-frame-novel-preview-content {
        padding: 16px 14px 46px;
    }
}

@media (max-width: 360px) {
    .novel-frame-reader-toolbar.is-bottom {
        gap: 4px;
        padding: 6px 10px;
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-tool {
        min-width: 44px;
        padding: 3px 6px;
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-cta {
        padding: 6px 12px;
    }

    .novel-frame-reader-toolbar.is-bottom .novel-frame-reader-cta-sub {
        display: none;
    }
}

/* 深色模式 */
body.dark-theme .novel-frame-reader-toolbar,
body.dark-theme .novel-frame-paywall,
body.dark-theme .novel-frame-reader-panel,
body.dark-theme .novel-frame-paid-preview {
    background: rgba(255, 255, 255, .03);
}

body.dark-theme .novel-frame-reader-meta div,
body.dark-theme .novel-frame-paid-preview-head,
body.dark-theme .novel-frame-reader-access-notice {
    background: rgba(255, 255, 255, .04);
}

body.dark-theme .novel-frame-reader-directory-item,
body.dark-theme .novel-frame-paid-preview {
    border-color: rgba(255, 255, 255, .08);
}

body.dark-theme .novel-frame-paid-preview::after {
    background: linear-gradient(to bottom, rgba(18, 18, 18, 0), var(--main-bg-color, #1b1d21));
}

body.dark-theme .novel-frame-reader-tool {
    color: rgba(255, 255, 255, .82);
}

body.dark-theme .novel-frame-reader-tool:hover,
body.dark-theme .novel-frame-reader-tool:focus {
    color: #60a5fa;
    background: rgba(94, 168, 255, .12);
}

body.dark-theme .novel-frame-reader-cta {
    background: linear-gradient(135deg, #4b5563 0%, #1f2937 100%);
}

body.dark-theme .novel-frame-reader-cta.is-disabled {
    background: linear-gradient(135deg, #475569 0%, #1f2937 100%);
}

/* 夜间桌面：章节头部反相 */
body.dark-theme .novel-frame-chapter-header {
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(96, 165, 250, .07) 0%, transparent 60%),
        linear-gradient(180deg, rgba(255, 255, 255, .025) 0%, transparent 100%);
    border-bottom-color: rgba(255, 255, 255, .06);
}

body.dark-theme .novel-frame-chapter-breadcrumb a {
    background: rgba(255, 255, 255, .05);
    color: rgba(255, 255, 255, .68);
}

body.dark-theme .novel-frame-chapter-breadcrumb a:hover,
body.dark-theme .novel-frame-chapter-breadcrumb a:focus {
    color: #60a5fa;
    background: rgba(94, 168, 255, .12);
}

@media (max-width: 768px) {
    body.dark-theme .novel-frame-chapter-header {
        background: linear-gradient(135deg, rgba(94, 168, 255, .12), rgba(255, 255, 255, .02));
    }

    body.dark-theme .novel-frame-chapter-breadcrumb a {
        background: rgba(255, 255, 255, .06);
    }

    body.dark-theme .novel-frame-reader-toolbar.is-bottom {
        background: rgba(26, 28, 32, .92);
        box-shadow: 0 -4px 14px rgba(0, 0, 0, .35);
    }

    body.dark-theme .novel-frame-reader-directory-link {
        background: rgba(255, 255, 255, .04);
    }
}

/* 章节目录抽屉 */
.novel-frame-toc-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    pointer-events: none;
}

.novel-frame-toc-drawer[hidden] {
    display: none;
}

.novel-frame-toc-drawer.is-open {
    pointer-events: auto;
}

.novel-frame-toc-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    transition: opacity .25s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.novel-frame-toc-drawer.is-open .novel-frame-toc-drawer-overlay {
    opacity: 1;
}

.novel-frame-toc-drawer-panel {
    position: relative;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    width: min(360px, 86vw);
    height: 100%;
    background: var(--main-bg-color, #fff);
    box-shadow: -8px 0 24px rgba(15, 23, 42, .15);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
}

.novel-frame-toc-drawer.is-open .novel-frame-toc-drawer-panel {
    transform: translateX(0);
}

.novel-frame-toc-drawer-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 16px 14px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.novel-frame-toc-drawer-headings {
    flex: 1 1 auto;
    min-width: 0;
}

.novel-frame-toc-drawer-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.novel-frame-toc-drawer-meta {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: .55;
}

.novel-frame-toc-drawer-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .15s ease;
}

.novel-frame-toc-drawer-close:hover,
.novel-frame-toc-drawer-close:focus {
    background: rgba(0, 0, 0, .06);
}

.novel-frame-toc-drawer-close i {
    font-size: 16px;
}

.novel-frame-toc-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.novel-frame-toc-drawer-empty {
    padding: 30px 18px;
    text-align: center;
}

.novel-frame-toc-drawer-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.novel-frame-toc-drawer-item {
    border-bottom: 1px solid rgba(0, 0, 0, .04);
}

.novel-frame-toc-drawer-item:last-child {
    border-bottom: 0;
}

.novel-frame-toc-drawer-link {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 18px;
    color: inherit;
    text-decoration: none;
    transition: background-color .15s ease;
}

.novel-frame-toc-drawer-link:hover,
.novel-frame-toc-drawer-link:focus {
    background: rgba(4, 105, 208, .06);
    color: inherit;
    text-decoration: none;
}

.novel-frame-toc-drawer-item.is-current .novel-frame-toc-drawer-link {
    background: rgba(4, 105, 208, .08);
    color: #0469d0;
}

.novel-frame-toc-drawer-index {
    font-size: 13px;
    opacity: .5;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.novel-frame-toc-drawer-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.novel-frame-toc-drawer-link-title {
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.novel-frame-toc-drawer-flag {
    align-self: flex-start;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10.5px;
    line-height: 1.5;
    background: #e8f6ed;
    color: #2d8a4d;
}

.novel-frame-toc-drawer-flag.is-paid {
    background: #fde9e7;
    color: #c0392b;
}

.novel-frame-toc-drawer-flag.is-vip-free {
    background: #fff3d6;
    color: #b68100;
}

.novel-frame-toc-drawer-current-icon {
    color: #0469d0;
    font-size: 14px;
}

/* 抽屉打开时锁滚（避免背后阅读区滚动） */
body.novel-frame-toc-open {
    overflow: hidden;
}

/* 抽屉暗色 */
body.dark-theme .novel-frame-toc-drawer-overlay {
    background: rgba(0, 0, 0, .65);
}

body.dark-theme .novel-frame-toc-drawer-panel {
    background: var(--main-bg-color, #1b1d21);
    box-shadow: -8px 0 24px rgba(0, 0, 0, .45);
}

body.dark-theme .novel-frame-toc-drawer-head {
    border-color: rgba(255, 255, 255, .08);
}

body.dark-theme .novel-frame-toc-drawer-item {
    border-color: rgba(255, 255, 255, .05);
}

body.dark-theme .novel-frame-toc-drawer-link:hover,
body.dark-theme .novel-frame-toc-drawer-link:focus {
    background: rgba(94, 168, 255, .1);
}

body.dark-theme .novel-frame-toc-drawer-item.is-current .novel-frame-toc-drawer-link {
    background: rgba(94, 168, 255, .14);
    color: #60a5fa;
}

body.dark-theme .novel-frame-toc-drawer-current-icon {
    color: #60a5fa;
}

body.dark-theme .novel-frame-toc-drawer-close:hover,
body.dark-theme .novel-frame-toc-drawer-close:focus {
    background: rgba(255, 255, 255, .08);
}

/* 沉浸式阅读 */

/* 入口按钮（章节 header 右上角） */
.novel-frame-chapter-header {
    position: relative;
}

.novel-frame-immersive-enter {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: rgba(15, 23, 42, .78);
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.novel-frame-immersive-enter i {
    font-size: 13px;
}

.novel-frame-immersive-enter:hover,
.novel-frame-immersive-enter:focus {
    color: #0469d0;
    border-color: rgba(4, 105, 208, .35);
    background: rgba(4, 105, 208, .06);
}

body.dark-theme .novel-frame-immersive-enter {
    border-color: rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: rgba(255, 255, 255, .78);
}

body.dark-theme .novel-frame-immersive-enter:hover,
body.dark-theme .novel-frame-immersive-enter:focus {
    color: #60a5fa;
    border-color: rgba(94, 168, 255, .35);
    background: rgba(94, 168, 255, .12);
}

/* 浮动工具条：默认隐藏（沉浸态才显示）
 * z-index 1030：低于父主题 modal (1050)、抽屉 (9999)，高于普通内容；
 * 这样分享 modal / 抽屉打开时浮动条会被自然遮住，避免遮挡 */
.novel-frame-immersive-bar {
    position: fixed;
    top: 50%;
    right: 14px;
    z-index: 1030;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 22px rgba(15, 23, 42, .12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transform: translateY(-50%);
}

.novel-frame-immersive-bar[hidden] {
    display: none;
}

html.novel-frame-immersive body .novel-frame-immersive-bar {
    display: flex;
}

/* 浮动按钮（bar 直接子节点） */
.novel-frame-immersive-bar > .novel-frame-immersive-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 56px;
    padding: 8px 4px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: rgba(15, 23, 42, .78);
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.novel-frame-immersive-bar > .novel-frame-immersive-btn i {
    font-size: 16px;
    line-height: 1;
}

.novel-frame-immersive-bar > .novel-frame-immersive-btn:hover,
.novel-frame-immersive-bar > .novel-frame-immersive-btn:focus {
    color: #0469d0;
    background: rgba(4, 105, 208, .08);
    text-decoration: none;
}

.novel-frame-immersive-bar .novel-frame-immersive-btn.is-disabled {
    opacity: .42;
    cursor: not-allowed;
    pointer-events: none;
}

.novel-frame-immersive-btn-label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
}

/* favorite / share slot：复用父主题按钮 markup，把内置 text/count 隐掉，统一外观 */
.novel-frame-immersive-slot {
    position: relative;
    display: block;
}

.novel-frame-immersive-slot > a,
.novel-frame-immersive-slot > span.hover-show {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    width: 56px;
    padding: 8px 4px 22px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: rgba(15, 23, 42, .78);
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.novel-frame-immersive-slot svg {
    width: 16px;
    height: 16px;
}

.novel-frame-immersive-slot > a:hover,
.novel-frame-immersive-slot > a:focus,
.novel-frame-immersive-slot > span.hover-show:hover,
.novel-frame-immersive-slot > span.hover-show:focus {
    color: #0469d0;
    background: rgba(4, 105, 208, .08);
    text-decoration: none;
}

.novel-frame-immersive-slot > a > text,
.novel-frame-immersive-slot > a > count,
.novel-frame-immersive-slot > span.hover-show > text {
    display: none;
}

.novel-frame-immersive-slot > .novel-frame-immersive-btn-label {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 6px;
    width: auto;
    padding: 0;
    text-align: center;
    color: rgba(15, 23, 42, .78);
    font-size: 11px;
    line-height: 1.3;
    pointer-events: none;
}

/* favorite actived 高亮（父主题加 .actived 类） */
.novel-frame-immersive-slot > a.actived {
    color: #e64a3b;
}

/* 退出按钮：用主题色提示 */
.novel-frame-immersive-bar > .novel-frame-immersive-exit {
    margin-top: 4px;
    color: #fff;
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
}

.novel-frame-immersive-bar > .novel-frame-immersive-exit:hover,
.novel-frame-immersive-bar > .novel-frame-immersive-exit:focus {
    color: #fff;
    filter: brightness(1.08);
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
}

/* 深色：浮动条背景反转 */
body.dark-theme .novel-frame-immersive-bar {
    background: rgba(28, 30, 36, .92);
    box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
}

body.dark-theme .novel-frame-immersive-bar > .novel-frame-immersive-btn,
body.dark-theme .novel-frame-immersive-slot > a,
body.dark-theme .novel-frame-immersive-slot > span.hover-show,
body.dark-theme .novel-frame-immersive-slot > .novel-frame-immersive-btn-label {
    color: rgba(255, 255, 255, .82);
}

body.dark-theme .novel-frame-immersive-bar > .novel-frame-immersive-btn:hover,
body.dark-theme .novel-frame-immersive-bar > .novel-frame-immersive-btn:focus,
body.dark-theme .novel-frame-immersive-slot > a:hover,
body.dark-theme .novel-frame-immersive-slot > a:focus,
body.dark-theme .novel-frame-immersive-slot > span.hover-show:hover,
body.dark-theme .novel-frame-immersive-slot > span.hover-show:focus {
    color: #60a5fa;
    background: rgba(94, 168, 255, .12);
}

body.dark-theme .novel-frame-immersive-bar > .novel-frame-immersive-exit {
    background: linear-gradient(135deg, #4b5563 0%, #1f2937 100%);
}

/* 夜间按钮当前 active 视觉反馈：body.dark-theme 时显示暖色表明"当前是夜间"
 * 父主题不会给 .toggle-theme 加 aria-pressed，纯用 body class 条件选择即可 */
body.dark-theme .novel-frame-immersive-night {
    color: #ffd68a;
}

body.dark-theme .novel-frame-immersive-night:hover,
body.dark-theme .novel-frame-immersive-night:focus {
    color: #ffe9b5;
    background: rgba(255, 214, 138, .12);
}

/* 沉浸态：隐藏所有非阅读区域
 * 含父主题顶部导航、移动端导航、页脚、tabbar、WP admin bar、右侧浮动入口 `.float-right`；
 * 以及子主题侧栏、章节头、翻章工具栏、权限提示、评论区、面包屑、文章元数据 */
html.novel-frame-immersive body .header,
html.novel-frame-immersive body > .header,
html.novel-frame-immersive body .mobile-header,
html.novel-frame-immersive body .footer,
html.novel-frame-immersive body .footer-tabbar,
html.novel-frame-immersive body .footer-tabbar-placeholder,
html.novel-frame-immersive body .float-right,
html.novel-frame-immersive body #wpadminbar,
html.novel-frame-immersive body .novel-frame-reader-sidebar,
html.novel-frame-immersive body .novel-frame-chapter-header,
html.novel-frame-immersive body .novel-frame-reader-toolbar,
html.novel-frame-immersive body .novel-frame-reader-access-notice,
html.novel-frame-immersive body #comments,
html.novel-frame-immersive body .comments-area,
html.novel-frame-immersive body #respond,
html.novel-frame-immersive body .breadcrumb-area,
html.novel-frame-immersive body .post-meta {
    display: none !important;
}

/* 沉浸态：主区铺满
 * 默认 body 背景跟随主题色（避免白天小说模式下出现黑色窗框）；
 * 漫画章节由服务端 body_class filter 加 `novel-frame-chapter-type-comic`：
 *   - 日间：浅灰窗框 #f5f6f8（不用纯白避免漫画对比度过强）
 *   - 夜间：纯黑 #000（与漫画 .novel-frame-comic-images 容器无缝融合）
 * 关键：必须按 body.dark-theme 拆两条规则，否则日夜切换时漫画沉浸态背景永远不变，
 * 用户点击「夜间」按钮虽已触发父主题 .toggle-theme，但视觉上没有任何变化，体感「点击无效」 */
html.novel-frame-immersive body {
    margin-top: 0 !important;
    padding-top: 0 !important;
    background: var(--main-bg-color, #fff);
}

html.novel-frame-immersive body.novel-frame-chapter-type-comic {
    background: #f5f6f8;
}

html.novel-frame-immersive body.dark-theme.novel-frame-chapter-type-comic {
    background: #000;
}

html.novel-frame-immersive body .container.novel-frame-chapter {
    max-width: none;
    width: 100%;
    padding: 0;
    margin: 0;
}

html.novel-frame-immersive body .novel-frame-chapter-layout {
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0;
}

html.novel-frame-immersive body .novel-frame-chapter-main {
    min-width: 0;
    width: 100%;
}

html.novel-frame-immersive body .novel-frame-chapter-article.box-body {
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

html.novel-frame-immersive body .novel-frame-chapter-body {
    padding: 0;
}

/* 沉浸态：漫画拉伸至屏宽，文字仍保留易读最大宽度。
 * 漫画图片容器背景同步 body：日间浅灰、夜间纯黑（与上面 body 规则两两呼应，避免日间出现
 * 「body 浅 + 容器黑」的双层割裂感） */
html.novel-frame-immersive body .novel-frame-comic-images {
    max-width: none;
    width: 100%;
    background: #f5f6f8;
}

html.novel-frame-immersive body.dark-theme .novel-frame-comic-images {
    background: #000;
}

html.novel-frame-immersive body .novel-frame-comic-page img {
    max-width: min(100vw, 1200px);
}

html.novel-frame-immersive body .novel-frame-chapter-body.is-novel {
    padding: 24px 16px 80px;
    background: var(--main-bg-color, #fff);
}

html.novel-frame-immersive body .novel-frame-chapter-body.is-novel .novel-frame-chapter-content {
    margin: 0 auto;
    max-width: 780px;
}

/* 沉浸态：付费墙仍然要可见，且不被裁切 */
html.novel-frame-immersive body .novel-frame-paywall,
html.novel-frame-immersive body .novel-frame-paid-preview {
    margin: 24px auto;
    max-width: 900px;
}

/* 响应式：移动端浮动条收紧靠右 */
@media (max-width: 768px) {
    .novel-frame-immersive-enter {
        top: 12px;
        right: 12px;
        padding: 4px 10px;
        font-size: 11px;
    }

    .novel-frame-immersive-bar {
        right: 8px;
        padding: 6px 4px;
        border-radius: 18px;
    }

    .novel-frame-immersive-bar > .novel-frame-immersive-btn {
        width: 48px;
        padding: 6px 2px;
    }

    .novel-frame-immersive-slot > a,
    .novel-frame-immersive-slot > span.hover-show {
        width: 48px;
        padding: 6px 2px 20px;
    }

    .novel-frame-immersive-bar > .novel-frame-immersive-btn i,
    .novel-frame-immersive-slot svg {
        width: 15px;
        height: 15px;
        font-size: 15px;
    }

    .novel-frame-immersive-btn-label,
    .novel-frame-immersive-slot > .novel-frame-immersive-btn-label {
        font-size: 10px;
    }

    /* 移动端沉浸态：去掉 chapter 容器底部留白（原来给固定 toolbar 留位） */
    html.novel-frame-immersive body .novel-frame-chapter {
        padding-bottom: 0;
    }

    /* 滚动自动隐藏（移动端）：reader.js 给 body 加 .novel-frame-scrolling后，
     * 沉浸浮动条与底部固定翻章栏在滚动时淡出滑开，停止 500ms 后恢复。 */
    .novel-frame-immersive-bar {
        transition: opacity .2s ease, transform .25s ease;
    }

    .novel-frame-reader-toolbar.is-bottom {
        transition: opacity .2s ease, transform .25s ease;
    }

    body.novel-frame-scrolling .novel-frame-immersive-bar {
        opacity: 0;
        pointer-events: none;
        transform: translate(24px, -50%);
    }

    body.novel-frame-scrolling .novel-frame-reader-toolbar.is-bottom {
        opacity: 0;
        pointer-events: none;
        transform: translateY(36px);
    }
}
