* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

html {
    overflow: hidden;
}

body {
    margin: 0;
    overflow: hidden;
    background: #ffffff;
    color: #20262e;
    font-family: Inter, "Noto Sans SC", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 999;
    padding: 9px 13px;
    border: 1px solid #cfd5da;
    border-radius: 7px;
    background: #ffffff;
    color: #20262e;
    font-size: 14px;
    font-weight: 700;
    transform: translateY(-150%);
    transition: transform .16s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

a:focus-visible,
summary:focus-visible,
#mainContent:focus-visible {
    outline: 2px solid #66717c;
    outline-offset: 3px;
}

#mainContent:focus:not(:focus-visible) {
    outline: none;
}

/* 顶部固定 */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    height: 64px;
    border-bottom: 1px solid #e7eaee;
    background: #ffffff;
}

.topbar-inner {
    width: min(1420px, calc(100% - 48px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.logo {
    color: #151a21;
    font-size: 21px;
    font-weight: 760;
    line-height: 1;
    letter-spacing: -0.45px;
}

/* 三栏 */
.docs-shell {
    width: min(1420px, calc(100% - 48px));
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    min-height: 0;
    margin: 64px auto 0;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 255px;
    overflow: hidden;
}

/* 左侧：标题固定，只有目录滚动 */
.sidebar {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border-right: 1px solid #edf0f3;
    background: #ffffff;
}

.sidebar-inner {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-head {
    flex: 0 0 auto;
    padding: 30px 22px 17px 12px;
    background: #ffffff;
}

.sidebar-title {
    color: #1b2129;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
}

.sidebar-subtitle {
    margin-top: 4px;
    color: #9aa3ad;
    font-size: 13px;
}

.docs-nav {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #c2cad2 #f6f7f8;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 0 14px 56px 0;
}

.docs-nav::-webkit-scrollbar {
    width: 8px;
}

.docs-nav::-webkit-scrollbar-track {
    background: #f6f7f8;
    border-radius: 10px;
}

.docs-nav::-webkit-scrollbar-thumb {
    border: 2px solid #f6f7f8;
    border-radius: 10px;
    background: #c2cad2;
}

.nav-home {
    display: block;
    margin: 0 0 -4px 12px;
    padding: 8px 12px;
    border-radius: 7px;
    color: #66717c;
    font-size: 15px;
    font-weight: 600;
}

.nav-home:hover,
.nav-home.active {
    background: #f1f3f5;
    color: #151b22;
}

.nav-section {
    flex: 0 0 auto;
}

.nav-section-title {
    position: relative;
    margin-bottom: 6px;
    padding: 0 10px 0 25px;
    color: #2e353e;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.55;
}

.nav-section-title::before {
    position: absolute;
    top: 9px;
    left: 12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8e98a3;
    content: "";
}

.nav-children {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 14px;
}

.nav-children::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 14px;
    width: 1px;
    background: #e9edf0;
    content: "";
}

.nav-link {
    position: relative;
    display: block;
    width: 100%;
    min-height: 38px;
    margin-left: 1px;
    padding: 8px 10px 8px 20px;
    border-radius: 7px;
    color: #6f7984;
    font-size: 15px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    transition: color .16s ease, background .16s ease;
}

.nav-link:hover {
    background: #f6f7f8;
    color: #242b33;
}

.nav-link.active {
    background: #eef1f3;
    color: #151b22;
    font-weight: 650;
}

.nav-link.active::before {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: -1px;
    width: 2px;
    border-radius: 2px;
    background: #252c35;
    content: "";
}

/* 正文独立滚动 */
.article-scroll {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    scroll-padding-top: 18px;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #d0d6dc transparent;
}

.article-scroll::-webkit-scrollbar {
    width: 7px;
}

.article-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.article-scroll::-webkit-scrollbar-thumb {
    border: 2px solid #ffffff;
    border-radius: 10px;
    background: #d0d6dc;
}

.article {
    width: min(100%, 920px);
    margin: 0 auto;
    padding: 40px 46px 110px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: #9aa3ad;
    font-size: 13px;
}

.breadcrumb a:hover {
    color: #4e5965;
}

.article-header {
    margin-bottom: 42px;
    padding-bottom: 28px;
    border-bottom: 1px solid #edf0f2;
}

.article h1 {
    margin: 0;
    color: #141a21;
    font-size: 34px;
    font-weight: 760;
    line-height: 1.35;
    letter-spacing: -0.55px;
}

.article-header p {
    max-width: 760px;
    margin: 13px 0 0;
    color: #6d7782;
    font-size: 17px;
    line-height: 1.85;
}

.article-section {
    padding-bottom: 6px;
}

.article-section + .article-section {
    margin-top: 42px;
}

.article h2 {
    position: relative;
    margin: 0 0 17px;
    color: #1a2027;
    font-size: 24px;
    font-weight: 720;
    line-height: 1.45;
    letter-spacing: -0.2px;
    scroll-margin-top: 18px;
}

.article h2::before {
    position: absolute;
    top: 8px;
    left: -18px;
    width: 3px;
    height: 20px;
    border-radius: 4px;
    background: #c7cdd3;
    content: "";
}

.article h3 {
    margin: 28px 0 10px;
    color: #272e36;
    font-size: 19px;
    font-weight: 680;
    line-height: 1.5;
}

.article p {
    margin: 0 0 18px;
    color: #505a65;
    font-size: 17px;
    line-height: 1.85;
}

.article ul,
.article ol {
    margin: 12px 0 21px;
    padding-left: 24px;
    color: #505a65;
    font-size: 17px;
    line-height: 1.78;
}

.article li {
    margin: 6px 0;
    padding-left: 2px;
}

.article code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f2f4f6;
    color: #343c45;
    font-family: Consolas, Monaco, monospace;
    font-size: .92em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.inline-link {
    color: #26394f;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: #aeb8c3;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.inline-link:hover {
    text-decoration-color: #26394f;
}

.callout {
    margin: 24px 0 5px;
    padding: 16px 18px;
    border: 1px solid #e5e9ec;
    border-radius: 9px;
    background: #f8f9fa;
}

.callout-title {
    margin-bottom: 3px;
    color: #29313a;
    font-size: 14px;
    font-weight: 700;
}

.callout-text {
    color: #626c77;
    font-size: 15px;
    line-height: 1.75;
}

.table-wrap {
    width: 100%;
    margin: 20px 0 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e9ec;
    border-radius: 9px;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 15px;
    line-height: 1.65;
}

.doc-table th,
.doc-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e8ebee;
    border-right: 1px solid #edf0f2;
    text-align: left;
    vertical-align: top;
}

.doc-table th:last-child,
.doc-table td:last-child {
    border-right: 0;
}

.doc-table tr:last-child td {
    border-bottom: 0;
}

.doc-table th {
    background: #f7f8f9;
    color: #343c45;
    font-weight: 700;
}

.doc-table td {
    color: #59636e;
}

.pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid #edf0f2;
}

.pager a {
    min-width: 0;
    padding: 13px 15px;
    border: 1px solid #e5e8eb;
    border-radius: 9px;
    transition: background .16s ease, border-color .16s ease;
}

.pager a:hover {
    border-color: #d3d8dd;
    background: #f8f9fa;
}

.pager small,
.pager strong {
    display: block;
}

.pager small {
    margin-bottom: 3px;
    color: #9aa2ab;
    font-size: 12px;
}

.pager strong {
    overflow-wrap: break-word;
    color: #333b44;
    font-size: 14px;
    font-weight: 650;
}

.pager-next {
    text-align: right;
}

/* 右侧锚点独立滚动 */
.toc {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #cfd5db transparent;
    border-left: 1px solid #edf0f2;
    background: #ffffff;
}

.toc::-webkit-scrollbar {
    width: 7px;
}

.toc::-webkit-scrollbar-track {
    background: transparent;
}

.toc::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #cfd5db;
}

.toc-inner {
    width: 100%;
    min-height: 100%;
    padding: 40px 18px 48px 25px;
}

.toc-title {
    margin-bottom: 12px;
    color: #343d47;
    font-size: 15px;
    font-weight: 700;
}

.toc-nav {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.toc-nav::before {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 1px;
    background: #e8ebee;
    content: "";
}

.toc-link {
    position: relative;
    display: block;
    width: 100%;
    padding: 8px 6px 8px 15px;
    color: #838d98;
    font-size: 15px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: break-word;
    transition: color .16s ease, background .16s ease;
}

.toc-link:hover {
    color: #3c4650;
}

.toc-link.active {
    border-radius: 5px;
    background: #f5f7f8;
    color: #151b22;
    font-weight: 700;
}

.toc-link.active::before {
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: -1px;
    width: 2px;
    border-radius: 2px;
    background: #222a33;
    content: "";
}

@media (max-width: 1120px) {
    .docs-shell {
        grid-template-columns: 255px minmax(0, 1fr);
    }

    .toc {
        display: none;
    }
}

@media (max-width: 760px) {
    html,
    body {
        height: auto;
        overflow: auto;
    }

    .topbar {
        height: 58px;
    }

    .topbar-inner,
    .docs-shell {
        width: min(100% - 28px, 1420px);
    }

    .docs-shell {
        height: auto;
        margin-top: 58px;
        display: block;
        overflow: visible;
    }

    .sidebar {
        height: auto;
        border-right: 0;
        border-bottom: 1px solid #edf0f2;
    }

    .sidebar-inner {
        height: auto;
        overflow: visible;
    }

    .sidebar-head {
        padding: 24px 0 15px;
    }

    .docs-nav {
        max-height: 46vh;
        min-height: 220px;
        overflow-y: auto;
        padding: 0 8px 28px 0;
    }

    .article-scroll {
        height: auto;
        overflow: visible;
    }

    .article {
        width: 100%;
        padding: 30px 2px 70px;
    }

    .article h1 {
        font-size: 28px;
    }

    .article h2 {
        font-size: 21px;
    }

    .article h2::before {
        display: none;
    }

    .article p,
    .article ul,
    .article ol {
        font-size: 16px;
    }

    .pager {
        grid-template-columns: 1fr;
    }

    .pager-next {
        text-align: left;
    }
}


/* =========================
   通用文章组件
========================= */

.summary-card {
    margin: 4px 0 24px;
    padding: 19px 20px;
    border: 1px solid #dfe4e8;
    border-radius: 10px;
    background: #f7f9fa;
}

.summary-label {
    margin-bottom: 5px;
    color: #87919c;
    font-size: 13px;
    font-weight: 700;
}

.summary-main {
    color: #1b222a;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.65;
}

.summary-sub {
    margin-top: 7px;
    color: #626d78;
    font-size: 15px;
    line-height: 1.75;
}

.term-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 21px 0 5px;
}

.term-item {
    padding: 15px 16px;
    border: 1px solid #e5e9ec;
    border-radius: 9px;
    background: #fff;
}

.term-item strong,
.term-item span {
    display: block;
}

.term-item strong {
    margin-bottom: 4px;
    color: #242b33;
    font-size: 15px;
}

.term-item span {
    color: #6b7580;
    font-size: 14px;
    line-height: 1.65;
}

.notice-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
    margin: 10px 0;
    padding: 11px 14px;
    border: 1px solid #ece4e4;
    border-radius: 8px;
    background: #faf8f8;
    color: #666f79;
    font-size: 14px;
}

.notice-row.good {
    border-color: #e1e7e3;
    background: #f7f9f8;
}

.notice-key {
    color: #3f4750;
    font-weight: 700;
}

.flow-line {
    display: flex;
    align-items: stretch;
    gap: 5px;
    margin: 22px 0 24px;
}

.flow-step {
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 13px;
    border: 1px solid #e3e7ea;
    border-radius: 9px;
    background: #fafbfb;
}

.flow-step span,
.flow-step strong,
.flow-step small {
    display: block;
}

.flow-step span {
    margin-bottom: 8px;
    color: #a1a9b2;
    font-size: 12px;
    font-weight: 700;
}

.flow-step strong {
    color: #2a3139;
    font-size: 14px;
}

.flow-step small {
    margin-top: 6px;
    color: #77818c;
    font-size: 12px;
    line-height: 1.6;
}

.flow-arrow {
    flex: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b3bac2;
    font-size: 18px;
}

.compare-list {
    margin: 18px 0 22px;
    border: 1px solid #e5e9ec;
    border-radius: 9px;
    overflow: hidden;
}

.compare-row {
    display: grid;
    grid-template-columns: 115px minmax(0, 1fr);
    gap: 18px;
    padding: 12px 15px;
    border-bottom: 1px solid #edf0f2;
    background: #fff;
}

.compare-row:last-child {
    border-bottom: 0;
}

.compare-row strong {
    color: #303842;
    font-size: 15px;
}

.compare-row span {
    color: #68727d;
    font-size: 15px;
}

.two-column-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 19px 0 24px;
}

.mini-card {
    padding: 16px 17px;
    border: 1px solid #e3e7ea;
    border-radius: 9px;
    background: #fafbfb;
}

.mini-card-title {
    margin-bottom: 8px;
    color: #262e37;
    font-size: 16px;
    font-weight: 700;
}

.mini-card ul {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.7;
}

.code-explain {
    margin: 19px 0 22px;
    border: 1px solid #e3e7ea;
    border-radius: 9px;
    overflow: hidden;
}

.code-explain > div {
    display: grid;
    grid-template-columns: 125px minmax(0, 1fr);
    gap: 15px;
    padding: 11px 14px;
    border-bottom: 1px solid #edf0f2;
}

.code-explain > div:last-child {
    border-bottom: 0;
}

.code-explain span {
    color: #68727c;
    font-size: 14px;
}

.tip-box {
    margin-top: 18px;
    padding: 13px 15px;
    border-left: 3px solid #7e8994;
    border-radius: 0 7px 7px 0;
    background: #f7f8f9;
    color: #626c77;
    font-size: 14px;
    line-height: 1.75;
}

.compare-note {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 5px;
}

.compare-note > div {
    padding: 14px 15px;
    border: 1px solid #e4e8eb;
    border-radius: 9px;
}

.compare-note strong,
.compare-note span {
    display: block;
}

.compare-note strong {
    margin-bottom: 4px;
    color: #2d353e;
    font-size: 14px;
}

.compare-note span {
    color: #6c7680;
    font-size: 14px;
    line-height: 1.65;
}

.factor-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 20px;
}

.factor-list span {
    padding: 6px 11px;
    border: 1px solid #e1e5e8;
    border-radius: 999px;
    background: #fafbfb;
    color: #626d77;
    font-size: 13px;
}

.checklist {
    display: grid;
    gap: 8px;
    margin: 18px 0 20px;
}

.checklist label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid #e8ebed;
    border-radius: 7px;
    background: #fbfbfc;
    color: #5d6772;
    font-size: 14px;
    line-height: 1.6;
}

.checklist label span {
    color: #444d57;
    font-weight: 700;
}

.faq-list {
    border-top: 1px solid #e5e9ec;
}

.faq-list details {
    border-bottom: 1px solid #e5e9ec;
}

.faq-list summary {
    position: relative;
    padding: 15px 32px 15px 0;
    color: #333b44;
    font-size: 16px;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}

.faq-list summary::-webkit-details-marker {
    display: none;
}

.faq-list summary::after {
    position: absolute;
    top: 14px;
    right: 4px;
    color: #9aa2ab;
    content: "+";
}

.faq-list details[open] summary::after {
    content: "−";
}

.faq-list details > div {
    padding: 0 30px 15px 0;
    color: #68727d;
    font-size: 15px;
    line-height: 1.75;
}

.next-guide {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    margin-top: 18px;
}

.next-guide a {
    padding: 14px 15px;
    border: 1px solid #e3e7ea;
    border-radius: 9px;
    background: #fff;
    transition: background .16s ease, border-color .16s ease;
}

.next-guide a:hover {
    border-color: #cfd5da;
    background: #f8f9fa;
}

.next-guide strong,
.next-guide span {
    display: block;
}

.next-guide strong {
    margin-bottom: 4px;
    color: #303841;
    font-size: 14px;
}

.next-guide span {
    color: #79838e;
    font-size: 13px;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .flow-line {
        flex-direction: column;
    }

    .flow-arrow {
        flex-basis: 18px;
        height: 18px;
        transform: rotate(90deg);
    }
}

@media (max-width: 640px) {
    .term-grid,
    .two-column-cards,
    .compare-note,
    .next-guide {
        grid-template-columns: 1fr;
    }

    .compare-row,
    .code-explain > div,
    .notice-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}


@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* refined_06 speed article */
.article strong {
    color: #343d46;
}

@media (max-width: 720px) {
    .article .factor-list {
        gap: 6px;
    }

    .article .factor-list span {
        padding: 5px 9px;
        font-size: 12px;
    }
}


/* TRXT.IO promotion / friend links */
.friend-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-top: 16px;
}

.friend-links a {
    display: flex;
    min-height: 42px;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid #e3e7ea;
    border-radius: 8px;
    background: #fff;
    color: #46515c;
    font-size: 14px;
    line-height: 1.45;
    transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.friend-links a:hover {
    border-color: #cfd5da;
    background: #f8f9fa;
    color: #232b33;
}

.context-promo {
    margin-top: 16px;
    padding-left: 13px;
    border-left: 2px solid #d9dee3;
    color: #626d78;
}

.site-promo {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin: 34px 0 4px;
    padding: 13px 0;
    border-top: 1px solid #edf0f2;
    border-bottom: 1px solid #edf0f2;
    color: #7a848e;
    font-size: 13px;
    line-height: 1.65;
}

.site-promo-label {
    flex: 0 0 auto;
    color: #4f5963;
    font-weight: 600;
}

.site-promo a {
    color: #46515c;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: #c7cdd3;
    text-underline-offset: 3px;
}

.site-promo a:hover {
    color: #232b33;
    text-decoration-color: currentColor;
}

@media (max-width: 900px) {
    .friend-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .friend-links {
        grid-template-columns: 1fr;
    }

    .site-promo {
        display: block;
    }

    .site-promo-label {
        display: block;
        margin-bottom: 3px;
    }
}
