/* DPH Reader —— 阅读页沉浸化（仅文章页，html.dph-rd 前缀隔离） */
/* 字号三档：s=16 / m=18 / l=20；行高 1.8 / 1.9 / 1.95 */

html.dph-rd {
    --dph-rd-fs: 18px;
    --dph-rd-lh: 1.9;
    --dph-rd-fs-sub: 19px;
    --dph-rd-fs-quiz: 17px;
    --dph-rd-fs-li: 17.5px;
    scroll-behavior: smooth;
}

html.dph-rd.dph-rd-fs-s {
    --dph-rd-fs: 16px;
    --dph-rd-lh: 1.8;
    --dph-rd-fs-sub: 17px;
    --dph-rd-fs-quiz: 15px;
    --dph-rd-fs-li: 16px;
}

html.dph-rd.dph-rd-fs-l {
    --dph-rd-fs: 20px;
    --dph-rd-lh: 1.95;
    --dph-rd-fs-sub: 21px;
    --dph-rd-fs-quiz: 19px;
    --dph-rd-fs-li: 19.5px;
}

/* ---------- 正文排版 ---------- */
html.dph-rd .art-content p:not([class]) {
    font-size: var(--dph-rd-fs) !important;
    line-height: var(--dph-rd-lh) !important;
    letter-spacing: .012em;
}

html.dph-rd .dph-figure > p.dph-sub {
    font-size: var(--dph-rd-fs-sub) !important;
    line-height: 1.62 !important;
}

html.dph-rd .art-content li {
    font-size: var(--dph-rd-fs-li) !important;
    line-height: 1.82 !important;
}

html.dph-rd .dph-quiz p,
html.dph-rd .dph-quiz span {
    font-size: var(--dph-rd-fs-quiz) !important;
    line-height: 1.72 !important;
}

html.dph-rd .art-content blockquote,
html.dph-rd .art-content blockquote p {
    font-size: var(--dph-rd-fs) !important;
    line-height: var(--dph-rd-lh) !important;
}

/* ---------- 米黄背景 ---------- */
html.dph-rd-bg-warm,
html.dph-rd-bg-warm body {
    background: #f7f4ed !important;
}

html.dph-rd-bg-warm .tb-b-card,
html.dph-rd-bg-warm .content.tb-b-card,
html.dph-rd-bg-warm .art-content,
html.dph-rd-bg-warm .dph-figure.dph-cog {
    background: #faf8f3 !important;
    border-color: #ece5d8 !important;
}

html.dph-rd-bg-warm .dph-quiz {
    background: #f3efe5 !important;
}

/* ---------- 专注模式 ---------- */
html.dph-rd-focus .header,
html.dph-rd-focus .tb-rtools,
html.dph-rd-focus .dph-rail,
html.dph-rd-focus .tb-copyright,
html.dph-rd-focus .tb-topper,
html.dph-rd-focus .art-footer {
    display: none !important;
}

html.dph-rd-focus .tb-container {
    margin-left: 0 !important;
}

html.dph-rd-focus .tb-main-wraper {
    max-width: 780px !important;
    margin: 0 auto !important;
    padding: 44px 20px 0;
}

html.dph-rd-focus .tb-main {
    width: 100% !important;
    margin-left: 0 !important;
    float: none !important;
}

html.dph-rd-focus .content.tb-b-card {
    border: 0 !important;
    box-shadow: none !important;
}

/* ---------- 顶部阅读进度条 ---------- */
.dph-rd-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: #2b2f36;
    z-index: 99999;
    pointer-events: none;
    transition: width .1s linear;
    opacity: .9;
}

/* ---------- 工具条 ---------- */
.dph-rd-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    margin: -6px 0 16px;
}

.dph-rd-tools button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    font-size: 12px;
    line-height: 1.2;
    color: #6b7280;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background .14s ease, color .14s ease;
    -webkit-tap-highlight-color: transparent;
}

.dph-rd-tools button:hover {
    background: #f2f4f7;
    color: #2b2f36;
}

.dph-rd-tools button.on {
    color: #2b2f36;
    background: #eceff3;
}

.dph-rd-tools .dph-rd-ico {
    font-size: 12px;
    transform: translateY(-.5px);
}

/* ---------- 沉浸态下的移动端 ---------- */
@media (max-width: 768px) {
    html.dph-rd .art-content p:not([class]) {
        line-height: calc(var(--dph-rd-lh) - .05) !important;
    }

    html.dph-rd-focus .tb-main-wraper {
        padding: 54px 14px 0;
    }

    .dph-rd-tools {
        margin: -4px 0 14px;
    }
}

/* 与「听全文」按钮同行时两端对齐 */
html.dph-rd .dph-tts-entry.has-rd {
    justify-content: space-between;
    gap: 10px;
}

html.dph-rd .dph-tts-entry.has-rd .dph-rd-tools {
    margin: 0 0 0 auto;
    flex: 0 0 auto;
}

/* 专注模式下工具条浮到右上角，随时可退出 */
html.dph-rd-focus .dph-rd-tools {
    position: fixed;
    top: 14px;
    right: 16px;
    margin: 0 !important;
    padding: 3px;
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid #e6e9ee;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(17, 24, 39, .07);
    z-index: 9998;
}

/* 正文小标题（直接子级 h3）：与正文拉开层级 */
html.dph-rd .art-content > h3 {
    font-size: 20px !important;
    line-height: 1.6 !important;
    font-weight: 600;
    color: #1f2328;
    margin: 2em 0 .7em !important;
    padding: 0;
    border: 0;
}

html.dph-rd .art-content > h3:first-child {
    margin-top: .6em !important;
}

@media (max-width: 640px) {
    html.dph-rd .art-content > h3 {
        font-size: 18.5px !important;
        margin: 1.7em 0 .6em !important;
    }
}
