/* ========== 设计变量 ========== */
/* 版心宽度必须全站统一：页头、首页 Hero、合规信息、文档页正文都用 --shell。
   以前页头是 1000px、文档页是 1080px，宽屏下页头比正文窄 40px，
   品牌 logo 和正文左边缘对不齐。 */
:root {
    --shell: 1080px;
    /* 页头实际渲染高度：上下 15px 内边距 + 品牌块约 51px + 1px 下边框。
       sticky 偏移（见下面的 [id] 规则）依赖它，改页头内边距或品牌字号时要同步。 */
    --header-h: 84px;
    --brand: #e85d2a;
    --brand-strong: #cc491e;
    --brand-text: #d94f24;
    --ink: #18202a;
    --ink-soft: #46515c;
    --muted: #697480;
    --muted-2: #8a949e;
    --line: #e2e7ec;
    --line-soft: #eef2f5;
    --bg: #f5f7fa;
}

/* ========== 公共基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main {
    flex: 1;
}

/* 页头是 sticky 的：锚点跳转要把它让出来，否则目标会被压在页头下面。
   放在目标元素上（而不是 html 的 scroll-padding-top），
   这样文档页里已按自己版式调好的 .doc-card h3/h4 不会被叠加两次偏移。 */
[id] {
    scroll-margin-top: calc(var(--header-h) + 16px);
}

/* 键盘用户跳过导航直达正文；
   鼠标/触摸用户看不到它，因为它只在获得焦点时移入视口。 */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    padding: 10px 18px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    text-decoration: none;
    border-radius: 0 0 10px 0;
    box-shadow: 0 6px 18px rgba(24, 32, 42, 0.12);
}
.skip-link:focus {
    left: 0;
}

/* 统一的键盘焦点样式：默认的 outline 在浅色卡片上几乎看不见。 */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========== Header ========== */
header {
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}
.brand-text h1 {
    font-size: 20px;
    color: #222;
}
.brand-text p {
    font-size: 12px;
    color: #999;
}
/* 导航样式只作用于页头的菜单（#nav-menu）：页面里的面包屑、章节导航
   也用 <nav>，收窄选择器可以避免被这里的绝对定位/折叠规则连带影响。 */
#nav-menu a {
    color: #555;
    text-decoration: none;
    margin-left: 24px;
    font-size: 14px;
    transition: color 0.2s;
}
#nav-menu a:hover {
    color: #d94f24;
}
/* 当前所在页：可见的选中态（HTML 里用 aria-current="page" 标注）。 */
#nav-menu a[aria-current="page"] {
    color: var(--brand-text);
    font-weight: 600;
}

/* ========== 移动端菜单按钮 ========== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    gap: 5px;
}
.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #555;
    transition: all 0.3s;
}
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== Footer ========== */
footer {
    background: #20272e;
    color: #b7bec5;
    text-align: center;
    padding: 30px 20px;
    font-size: 13px;
}
footer a {
    color: #d8dde2;
    text-decoration: none;
    margin: 0 10px;
}
footer a:hover {
    color: #fff;
}

/* ========== 文档页（用户协议 / 隐私政策 / 联系我们） ========== */
/* 三个页面共用这一套排版：正文直接写在各自的 HTML 里，不请求任何接口。
   视觉沿用首页那套语言：品牌橙做点缀，白卡 + 细边框 + 浅灰底。 */

/* 页头：面包屑 + 标题 + 摘要 + 版本信息 */
.doc-hero {
    background: #fff;
    border-bottom: 1px solid #e9edf2;
}
.doc-hero-inner {
    /* 与正文卡片同一条阅读栏（卡片 820 + 卡片两侧各 20）：标题、摘要、版本徽标
       和下面的正文左边缘对齐，整页只有一条竖轴，读长条款时视线不用来回跳。
       页头还是全站版心 --shell，它属于站点框架，不跟着文档走。 */
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 20px 28px;
}
.crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8a949e;
    font-size: 13px;
    margin-bottom: 14px;
}
.crumb a {
    color: #8a949e;
    text-decoration: none;
}
.crumb a:hover {
    color: #d94f24;
}
.crumb .sep {
    color: #ccd3da;
}
.page-title {
    font-size: 32px;
    line-height: 1.25;
    color: #18202a;
    letter-spacing: -0.2px;
    margin-bottom: 10px;
}
.doc-lead {
    color: #697480;
    font-size: 15px;
    max-width: 660px;
}
.doc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f6f8;
    border: 1px solid #e4e9ee;
    color: #5f6975;
    font-size: 12.5px;
}

/* 正文单栏排版 */
/* 文档页是几千字的长条款，读者是从头往下读的：正文独占一栏、居中成一条
   舒适的行宽，比「左边目录 + 右边正文」更容易读。目录已移除（窄屏下它会
   变成一条横向滚动的标签条，宽屏下又要占掉 216px 行宽），页面里不再有
   需要 JS 生成的版式，关掉脚本也是完整的一页。 */
.doc-container {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 28px 20px 56px;
}
/* .doc-layout 现在只是一层结构容器（HTML 里保留着，正文按它那层缩进手写）：
   原来的「216px 目录 + 正文」两栏 grid 已随目录一起删掉，正文卡片
   自己居中。别再给它加列宽 —— 文档页只需要一条竖轴。 */

/* 正文卡片 */
.doc-card {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e2e7ec;
    border-radius: 12px;
    padding: 40px 46px;
    box-shadow: 0 2px 14px rgba(24, 32, 42, 0.05);
}
.doc-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    color: #18202a;
    margin: 30px 0 14px;
    scroll-margin-top: 96px;
}
/* 章标题前的小色条：长文里快速定位章节起点。 */
.doc-card h3::before {
    content: "";
    flex: 0 0 auto;
    width: 6px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(180deg, #f0803f, #e0402a);
}
.doc-card h3:first-child {
    margin-top: 0;
}
.doc-card h3:not(:first-child) {
    border-top: 1px solid #eef2f5;
    padding-top: 26px;
}
.doc-card h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15.5px;
    color: #18202a;
    margin: 22px 0 8px;
    scroll-margin-top: 96px;
}
.doc-card h4::before {
    content: "";
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e85d2a;
}
.doc-card p {
    color: #46515c;
    font-size: 15px;
    line-height: 1.85;
    margin-bottom: 12px;
}
.doc-card ul,
.doc-card ol {
    margin: 0 0 14px 20px;
}
.doc-card li {
    color: #46515c;
    font-size: 15px;
    line-height: 1.85;
    margin-bottom: 7px;
}
.doc-card li::marker {
    color: #e0854f;
}
.doc-card strong {
    color: #18202a;
}
.doc-card a {
    color: #d94f24;
    text-decoration: none;
    border-bottom: 1px solid rgba(217, 79, 36, 0.35);
}
.doc-card a:hover {
    border-bottom-color: #d94f24;
}

/* 提示框：需要格外留意的段落（例如防诈骗提醒）。 */
.callout {
    background: #fff8f4;
    border: 1px solid #ffe2d1;
    border-left: 4px solid #e85d2a;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 14px 0 16px;
}
.callout p {
    color: #8a4b2a;
    margin-bottom: 0;
}
.callout p + p {
    margin-top: 8px;
}

/* 联系信息卡片 */
.contact-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 6px 0 22px;
}
.contact-card {
    background: #fbfcfd;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    padding: 16px 18px;
}
.contact-card .label {
    color: #8a949e;
    font-size: 12.5px;
    margin-bottom: 6px;
}
.contact-card .value {
    color: #27313b;
    font-size: 15px;
    line-height: 1.6;
}
.contact-card .value a {
    color: #d94f24;
    text-decoration: none;
    border-bottom: 1px solid rgba(217, 79, 36, 0.35);
}
.contact-card .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.ghost-button {
    display: inline-flex;
    align-items: center;
    line-height: 1.4;
    text-decoration: none;
    font: inherit;
    font-size: 13px;
    color: #46515c;
    background: #fff;
    border: 1px solid #e2e7ec;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.ghost-button:hover {
    color: #d94f24;
    border-color: #f0c3ad;
}
.ghost-button.is-copied {
    color: #1f9d55;
    border-color: #bfe6cd;
}

/* 返回顶部：长文档滚过半屏后出现 */
.to-top {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid #e2e7ec;
    background: rgba(255, 255, 255, 0.96);
    color: #46515c;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(24, 32, 42, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.to-top:hover {
    color: #d94f24;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* 打印：协议这类文档常被打印或另存为 PDF */
@media print {
    header,
    footer,
    .to-top,
    .crumb,
    .doc-badges {
        display: none !important;
    }
    body {
        background: #fff;
    }
    .doc-hero {
        border-bottom: 0;
    }
    .doc-hero-inner,
    .doc-container {
        max-width: none;
        padding: 0;
    }
    .doc-card {
        max-width: none;
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}

/* ========== 响应式：600px 以下 ========== */
@media (max-width: 600px) {
    .header-inner {
        padding: 0 15px;
    }
    .brand-text h1 {
        font-size: 18px;
    }
    .brand-text p {
        font-size: 11px;
    }
    .brand-logo {
        width: 38px;
        height: 38px;
    }
    .menu-toggle {
        display: flex;
    }
    #nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-bottom: 1px solid var(--line);
    }
    /* 展开高度不能写成固定值：导航现在有 4 个链接（约 208px），
       原来的 max-height: 200px 会把最后一项「隐私政策」裁掉一半。
       改成跟随视口并按需滚动，条目增减都不会再被裁。 */
    #nav-menu.active {
        max-height: min(70vh, 420px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #nav-menu a {
        display: block;
        margin: 0;
        padding: 15px 20px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 15px;
    }
    #nav-menu a:last-child {
        border-bottom: none;
    }
    footer {
        padding: 25px 15px;
        font-size: 12px;
        line-height: 1.8;
    }
    footer a {
        margin: 0 8px;
        font-size: 12px;
    }
    .doc-hero-inner {
        padding: 24px 18px 22px;
    }
    .page-title {
        font-size: 24px;
    }
    .doc-lead {
        font-size: 14px;
    }
    .doc-container {
        /* 左右 18px 与 .doc-hero-inner 的窄屏内边距一致：标题和正文卡片左边缘
           对齐（两处各写一个值，改一个就得改另一个）。 */
        padding: 18px 18px 40px;
    }
    .doc-card {
        padding: 22px 18px;
        border-radius: 10px;
    }
    .doc-card h3 {
        font-size: 17px;
        margin: 26px 0 10px;
    }
    .doc-card h3:not(:first-child) {
        padding-top: 20px;
    }
    .doc-card h4 {
        font-size: 15px;
    }
    .doc-card p,
    .doc-card li {
        font-size: 14.5px;
    }
    .contact-cards {
        grid-template-columns: 1fr;
    }
    .to-top {
        right: 14px;
        bottom: 16px;
    }
}
