.topic-chapter-page {
    overflow-x: clip;
}

.topic-chapter-wrap {
    padding-top: 22px;
}

.topic-chapter-page .breadcrumb {
    min-width: 0;
}

.topic-chapter-page .breadcrumb a,
.topic-chapter-page .breadcrumb b {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.manual-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.chapter-document,
.topic-card,
.author-hook,
.course-hook {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.chapter-document {
    min-width: 0;
    overflow: hidden;
}

.chapter-header {
    padding: 46px 64px 34px;
    border-bottom: 1px solid var(--line);
}

.chapter-eyebrow {
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.chapter-eyebrow i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #aab2bf;
}

.chapter-header h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.28;
    letter-spacing: -0.04em;
    overflow-wrap: anywhere;
}

.chapter-summary {
    max-width: 810px;
    margin: 17px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.85;
}

.chapter-meta {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    color: #8992a0;
    font-size: 11px;
}

.chapter-meta b {
    color: #596270;
    font-weight: 600;
}

.video-note {
    margin: 28px 64px 0;
    padding: 18px 20px;
    border: 1px solid #d9e3f7;
    border-radius: 9px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    background: #f7faff;
}

.video-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--blue);
    font-size: 13px;
    font-weight: 750;
}

.video-note strong {
    font-size: 14px;
}

.video-note p {
    margin: 4px 0 0;
    color: #6d7786;
    font-size: 12px;
}

.video-note a {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid #c7d5ef;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    color: var(--blue);
    background: #fff;
    font-size: 12px;
    font-weight: 650;
}

.video-note a:hover {
    border-color: var(--blue);
}

.document-body {
    padding: 38px 64px 45px;
    color: #3f4855;
    font-size: 17px;
    line-height: 1.95;
    overflow-wrap: anywhere;
}

.document-body > :first-child {
    margin-top: 0;
}

.document-body h1,
.document-body h2,
.document-body h3,
.document-body h4 {
    color: var(--text);
    line-height: 1.45;
    letter-spacing: -0.025em;
    scroll-margin-top: 95px;
}

.document-body h1 {
    margin: 38px 0 18px;
    font-size: 30px;
}

.document-body h2 {
    margin: 34px 0 16px;
    font-size: 25px;
}

.document-body h3 {
    margin: 29px 0 13px;
    font-size: 21px;
}

.document-body h4 {
    margin: 25px 0 11px;
    font-size: 18px;
}

.document-body p {
    margin: 0 0 19px;
}

.document-body ul,
.document-body ol {
    margin: 0 0 20px;
    padding-left: 26px;
}

.document-body li {
    margin: 8px 0;
}

.document-body a {
    color: var(--blue);
    text-decoration: underline;
    text-decoration-color: rgba(40, 100, 220, 0.35);
    text-underline-offset: 3px;
}

.document-body blockquote {
    margin: 24px 0;
    padding: 17px 21px;
    border-left: 4px solid var(--blue);
    border-radius: 0 8px 8px 0;
    color: #526078;
    background: #f5f8ff;
}

.document-body blockquote > :last-child {
    margin-bottom: 0;
}

.document-body code {
    padding: 0.14em 0.34em;
    border-radius: 4px;
    color: #a33d44;
    background: #f5f1f2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
}

.document-body pre {
    max-width: 100%;
    margin: 24px 0;
    padding: 20px;
    overflow: auto;
    border-radius: 9px;
    color: #e8edf5;
    background: #18202d;
    font-size: 14px;
    line-height: 1.7;
}

.document-body pre code {
    padding: 0;
    color: inherit;
    background: transparent;
    font-size: inherit;
}

.document-body img {
    max-width: 100%;
    height: auto;
    margin: 10px auto 24px;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: block;
}

.document-body table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    font-size: 14px;
}

.document-body th,
.document-body td {
    min-width: 120px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.document-body th {
    color: var(--text);
    background: #f6f8fb;
}

.document-body hr {
    height: 1px;
    margin: 35px 0;
    border: 0;
    background: var(--line);
}

.chapter-pagination {
    margin: 0 64px 46px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.chapter-pagination a {
    min-width: 0;
    min-height: 78px;
    padding: 17px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: #fff;
}

.chapter-pagination a:hover {
    border-color: #b8c9ed;
    background: #f9fbff;
}

.chapter-pagination small {
    color: #8a93a0;
    font-size: 10px;
}

.chapter-pagination strong {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.45;
    text-overflow: ellipsis;
}

.chapter-pagination .next {
    text-align: right;
}

.topic-sidebar {
    position: sticky;
    top: 90px;
    display: grid;
    gap: 12px;
}

.topic-card {
    overflow: hidden;
}

.topic-back {
    padding: 23px 22px 0;
    display: block;
    color: var(--blue);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.11em;
}

.topic-card h2 {
    margin: 8px 22px 18px;
    font-size: 18px;
    line-height: 1.45;
}

.progress-copy {
    padding: 0 22px;
    display: flex;
    justify-content: space-between;
    color: #778190;
    font-size: 10px;
}

.progress-copy b {
    color: #596270;
}

.progress-track {
    height: 4px;
    margin: 10px 22px 20px;
    overflow: hidden;
    border-radius: 10px;
    background: #e8ebf0;
}

.progress-track i {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: var(--blue);
}

.toc-toggle {
    display: none;
}

.topic-toc {
    max-height: min(52vh, 520px);
    overflow-y: auto;
    border-top: 1px solid var(--line);
}

.topic-toc a {
    min-height: 52px;
    padding: 10px 18px;
    border-bottom: 1px solid #edf0f3;
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 7px;
    align-items: center;
    color: #667180;
}

.topic-toc a:last-child {
    border-bottom: 0;
}

.topic-toc a:hover {
    color: var(--blue);
    background: #fafcff;
}

.topic-toc a.active {
    color: var(--blue);
    background: var(--blue-soft);
}

.topic-toc span {
    font-size: 9px;
    font-weight: 750;
}

.topic-toc b {
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.author-hook {
    padding: 18px;
}

.author-head {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.author-head img {
    width: 50px;
    height: 50px;
    border-radius: 9px;
    display: block;
    object-fit: cover;
}

.author-head div {
    min-width: 0;
}

.author-head small {
    color: var(--blue);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.author-head h2 {
    margin: 4px 0 3px;
    font-size: 15px;
}

.author-head span {
    color: #7b8593;
    font-size: 9px;
}

.author-hook > p {
    margin: 13px 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}

.hook-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
}

.hook-actions a,
.hook-actions button {
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    color: #596474;
    font-size: 10px;
    font-weight: 650;
    font-family: inherit;
    cursor: pointer;
}

.hook-actions a:hover,
.hook-actions button:hover {
    border-color: #b8c9ed;
    color: var(--blue);
    background: #f9fbff;
}

.course-hook {
    padding: 0 18px 18px;
    overflow: hidden;
    position: relative;
    background: #fff;
}

.course-hook-title {
    min-height: 54px;
    margin: 0 -18px 15px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.course-hook-title h2 {
    margin: 0;
    font-size: 15px;
}

.course-hook-title span {
    padding: 5px 8px;
    border-radius: 5px;
    color: #b7661f;
    background: #fff1e4;
    font-size: 9px;
}

.course-hook-cover {
    min-height: 118px;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #203b76, #2767d9);
}

.course-hook-cover small {
    font-size: 8px;
    letter-spacing: 0.13em;
    opacity: 0.7;
}

.course-hook-cover strong {
    margin-top: 10px;
    font-size: 17px;
}

.course-hook-cover span {
    margin-top: 6px;
    color: #dce6ff;
    font-size: 9px;
}

.course-hook > p {
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.65;
}

.course-hook .course-hook-link {
    min-height: 36px;
    margin-top: 13px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--blue);
    font-size: 10px;
    font-weight: 700;
}

.course-hook .course-hook-link:hover {
    background: #1d57c9;
}

body.topic-contact-open {
    overflow: hidden;
}

.topic-contact-modal[hidden] {
    display: none;
}

.topic-contact-modal {
    padding: 24px;
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(17, 28, 48, 0.58);
    backdrop-filter: blur(4px);
}

.topic-contact-dialog {
    width: min(680px, 100%);
    max-height: calc(100vh - 48px);
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 14px;
    position: relative;
    overflow: auto;
    background: #fff;
    box-shadow: 0 28px 80px rgba(11, 25, 51, 0.3);
}

.topic-contact-dialog > h2 {
    margin: 0;
    color: #202938;
    font-size: 27px;
}

.topic-contact-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    place-items: center;
    color: #647082;
    background: #f2f4f7;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.topic-contact-close:hover {
    color: #273141;
    background: #e8ebf0;
}

.topic-contact-content {
    margin-top: 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 28px;
    align-items: center;
}

.topic-contact-copy h3 {
    margin: 0 0 12px;
    color: #252e3c;
    font-size: 21px;
}

.topic-contact-copy > p {
    margin: 0;
    color: #5c6675;
    font-size: 14px;
    line-height: 1.8;
}

.topic-contact-copy p strong {
    color: #27354d;
}

.topic-wechat-id {
    margin-top: 22px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    background: #fafbfc;
}

.topic-wechat-id span {
    color: #778190;
    font-size: 11px;
}

.topic-wechat-id strong {
    color: #253046;
    font-size: 16px;
}

.topic-wechat-id button {
    padding: 7px 10px;
    border: 1px solid #c8d7f3;
    border-radius: 6px;
    color: var(--blue);
    background: #f1f6ff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.topic-copy-status {
    min-height: 20px;
    margin-top: 8px !important;
    color: #667184 !important;
    font-size: 11px !important;
}

.topic-contact-qr-wrap {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.topic-contact-qr-wrap img {
    width: 100%;
    height: auto;
    border-radius: 7px;
    display: block;
}

.topic-contact-qr-wrap p {
    margin: 8px 3px 0;
    color: #7b8593;
    font-size: 9px;
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 1100px) {
    .manual-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    .chapter-header,
    .document-body {
        padding-inline: 42px;
    }

    .video-note,
    .chapter-pagination {
        margin-inline: 42px;
    }
}

@media (max-height: 860px) and (min-width: 821px) {
    .topic-back {
        padding-top: 17px;
    }

    .topic-card h2 {
        margin-bottom: 12px;
    }

    .progress-track {
        margin-bottom: 14px;
    }

    .topic-toc a {
        min-height: 44px;
        padding-block: 7px;
    }

    .author-hook {
        padding: 15px;
    }
}

@media (max-width: 820px) {
    .topic-chapter-wrap {
        padding-top: 16px;
    }

    .manual-layout {
        display: flex;
        flex-direction: column;
    }

    .topic-sidebar {
        width: 100%;
        position: static;
        display: contents;
    }

    .topic-card {
        width: 100%;
        padding: 17px 18px;
        order: -1;
    }

    .author-hook,
    .course-hook {
        width: 100%;
        order: 1;
    }

    .topic-back {
        padding: 0;
    }

    .topic-card h2 {
        margin: 7px 0 13px;
    }

    .progress-copy {
        padding: 0;
    }

    .progress-track {
        margin: 9px 0 14px;
    }

    .toc-toggle {
        width: 100%;
        min-height: 42px;
        padding: 0 12px;
        border: 1px solid var(--line);
        border-radius: 7px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #f8f9fb;
        font-size: 12px;
        font-weight: 650;
        cursor: pointer;
    }

    .toc-toggle i {
        font-style: normal;
        transition: transform 0.18s ease;
    }

    .toc-toggle[aria-expanded="true"] i {
        transform: rotate(180deg);
    }

    .topic-toc {
        max-height: 0;
        overflow: hidden;
        border-top: 0;
        transition: max-height 0.22s ease;
    }

    .topic-toc.open {
        max-height: 460px;
        margin-top: 10px;
        overflow-y: auto;
        border: 1px solid var(--line);
        border-radius: 7px;
    }

    .chapter-document {
        width: 100%;
    }

    .chapter-header,
    .document-body {
        padding-inline: 38px;
    }

    .video-note,
    .chapter-pagination {
        margin-inline: 38px;
    }

    .topic-contact-modal {
        padding: 10px;
    }

    .topic-contact-dialog {
        max-height: calc(100vh - 20px);
        padding: 24px 18px;
    }

    .topic-contact-content {
        grid-template-columns: 1fr;
    }

    .topic-contact-qr-wrap {
        width: min(240px, 100%);
        margin: 0 auto;
    }
}

@media (max-width: 620px) {
    .topic-chapter-wrap {
        padding-inline: 9px;
    }

    .topic-chapter-page .breadcrumb {
        overflow: hidden;
        white-space: nowrap;
    }

    .topic-chapter-page .breadcrumb a,
    .topic-chapter-page .breadcrumb b {
        max-width: 90px;
    }

    .chapter-header {
        padding: 30px 22px 26px;
    }

    .chapter-header h1 {
        font-size: 29px;
    }

    .chapter-summary {
        font-size: 14px;
    }

    .video-note {
        margin: 20px 22px 0;
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .video-note a {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .document-body {
        padding: 28px 22px 34px;
        font-size: 16px;
        line-height: 1.9;
    }

    .document-body h1 {
        font-size: 26px;
    }

    .document-body h2 {
        font-size: 22px;
    }

    .document-body h3 {
        font-size: 19px;
    }

    .chapter-pagination {
        margin: 0 22px 34px;
        grid-template-columns: 1fr;
    }

    .chapter-pagination .next {
        text-align: left;
    }

    .author-hook {
        padding: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .topic-toc,
    .toc-toggle i {
        transition-duration: 0.01ms;
    }
}
