* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: #1c2530;
    background: #f5f6f8;
    overflow-x: hidden;
}

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

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px 80px;
}

.wrap:has(.page-toc) { max-width: 1360px; }

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 0 8px;
    font-size: 14px;
    font-weight: 600;
}

.site-title {
    font-size: 28px;
    font-weight: 900;
    color: #94070a;
    letter-spacing: 1px;
}

.site-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.site-nav a { color: rgba(28, 37, 48, 0.7); }
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: #94070a; }

.page-header { padding: 20px 0 28px; }

.page-header h1 {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #94070a 0%, #a3282b 50%, #b8860b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ---- 术语卡片（页首一句话定义） ---- */
.knowledge-card {
    margin: 14px 0 0;
    padding: 13px 18px;
    background: #f7f8fa;
    border: 1px solid #e6e8ec;
    border-left: 3px solid #94070a;
    border-radius: 12px;
    font-size: 14.5px;
    line-height: 1.8;
    color: rgba(28, 37, 48, 0.85);
}
.knowledge-card b { color: #1c2530; }

.page-intro {
    margin: 16px 0 0;
    font-size: 15px;
    line-height: 1.85;
    color: rgba(28, 37, 48, 0.78);
}

.page-intro p + p { margin-top: 8px; }

.section { padding: 8px 0; }

.section-title {
    font-size: 28px;
    font-weight: 900;
    margin: 28px 0 18px;
    background: linear-gradient(135deg, #94070a 0%, #a3282b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 72px;
    height: 4px;
    background: linear-gradient(135deg, #94070a 0%, #a3282b 100%);
    border-radius: 2px;
}

.prose {
    font-size: 15px;
    line-height: 1.85;
    color: rgba(28, 37, 48, 0.82);
}

.prose p + p,
.prose ul + p,
.prose p + ul { margin-top: 10px; }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose ol li { padding-left: 0.2em; }
.prose strong { color: #1c2530; }
.prose a { color: #94070a; font-weight: 700; }

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.lesson {
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.lesson-ready { border-color: rgba(148, 7, 10, 0.45); }
.lesson-pending { border-color: #e6e8ec; }

.lesson-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.lesson-goal {
    font-size: 14px;
    color: rgba(28, 37, 48, 0.7);
    margin-bottom: 12px;
    flex: 1;
}

.btn {
    display: inline-block;
    padding: 8px 14px;
    background: #94070a;
    color: #ffffff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.btn:hover { background: #a3282b; }

.pending {
    font-size: 13px;
    color: rgba(28, 37, 48, 0.45);
}

.check-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.check {
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 14px;
    padding: 16px 18px;
}

.check b {
    display: block;
    margin-bottom: 4px;
    color: #94070a;
}

.file-block {
    margin: 18px 0 8px;
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 16px;
    overflow: hidden;
}

.file-block h3 {
    padding: 14px 18px;
    font-size: 15px;
    border-bottom: 1px solid #e6e8ec;
}

.file-block p {
    padding: 10px 18px 0;
    font-size: 13px;
    color: rgba(28, 37, 48, 0.62);
}

.file-block pre {
    margin: 12px 18px 18px;
    padding: 16px;
    overflow: auto;
    background: #171a21;
    color: #e8ecf4;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.layout:has(> .page-toc) {
    grid-template-columns: 200px minmax(0, 1fr) 176px;
}

.page-toc {
    position: sticky;
    top: 16px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    margin-top: 28px;
    padding: 4px 0 8px 16px;
    border-left: 1px solid #e6e8ec;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.page-toc::before {
    content: "本页";
    margin-bottom: 6px;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: #94070a;
}

.page-toc a {
    padding: 3px 0;
    color: rgba(28, 37, 48, 0.78);
}

.page-toc a:hover { color: #94070a; }

.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 4px;
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 16px;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

.spec-table th,
.spec-table td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e6e8ec;
}

.spec-table th {
    background: rgba(148, 7, 10, 0.06);
    font-weight: 700;
}

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

.spec-table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.spec-table a,
.page-intro a { color: #94070a; font-weight: 700; }

/* 通用垂直间隔：替代散落的 style="height:14px" */
.spacer { height: 14px; }

/* 各层的判断标准 */
.verdict {
    margin: 18px 0 4px;
    padding: 20px 22px;
    background: linear-gradient(135deg, rgba(148, 7, 10, 0.06), rgba(184, 134, 11, 0.06));
    border: 1px solid rgba(148, 7, 10, 0.22);
    border-radius: 16px;
}

.verdict-label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #94070a;
}

.verdict-q {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.65;
    color: #1c2530;
}

.verdict-note {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.75;
    color: rgba(28, 37, 48, 0.7);
}

/* 工具落地页 → 对应知识点 的回链 */
.xref {
    margin: 26px 0 8px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-left: 4px solid #94070a;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(28, 37, 48, 0.78);
}

.xref b {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: #94070a;
}

.xref a { color: #94070a; font-weight: 700; }

/* ================= 润色期新增组件 =================
   三个组件的共同目的：把「应该做某事」落成「具体值 / 具体样子」。
   .metric-grid  给数字与阈值
   .do-dont      给正反对照
   .steps        给有先后关系的动作
   ================================================= */

/* ---- 数字与阈值 ---- */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.metric {
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 14px;
    padding: 14px 16px;
}

.metric-name {
    font-size: 13px;
    font-weight: 700;
    color: rgba(28, 37, 48, 0.66);
}

.metric-value {
    margin: 4px 0 4px;
    font-size: 21px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.2px;
    color: #94070a;
}

.metric-note {
    font-size: 12.5px;
    line-height: 1.65;
    color: rgba(28, 37, 48, 0.62);
}

.metric-note code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

/* ---- 正反对照 ---- */
.do-dont {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.do-dont > div {
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.72;
    color: rgba(28, 37, 48, 0.82);
}

.do-dont .dd-title {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.do-dont .dd-yes { border-left: 4px solid #2e7d4f; }
.do-dont .dd-yes .dd-title { color: #2e7d4f; }
.do-dont .dd-no { border-left: 4px solid #b3261e; }
.do-dont .dd-no .dd-title { color: #b3261e; }

.do-dont code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: rgba(28, 37, 48, 0.06);
    padding: 1px 4px;
    border-radius: 4px;
}

/* ---- 有序动作 ---- */
.steps {
    counter-reset: step;
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.steps > div {
    position: relative;
    background: #ffffff;
    border: 1px solid #e6e8ec;
    border-radius: 14px;
    padding: 14px 16px 14px 54px;
    font-size: 14px;
    line-height: 1.75;
    color: rgba(28, 37, 48, 0.82);
}

.steps > div::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 15px;
    top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(148, 7, 10, 0.1);
    font-size: 12px;
    font-weight: 800;
    color: #94070a;
}

.steps > div b {
    display: block;
    margin-bottom: 2px;
    color: #1c2530;
}

.steps code,
.check code,
.prose code,
.verdict code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: rgba(28, 37, 48, 0.06);
    padding: 1px 4px;
    border-radius: 4px;
}

.layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 8px 36px;
    align-items: start;
}

/* grid 子项默认 min-width:auto，宽表格与长代码块会把整列撑破 */
.layout > * { min-width: 0; }

.side-nav {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 8px 18px 32px 0;
    border-right: 1px solid #e6e8ec;
}

/* 折叠条：桌面端不出现，移动端才可点 */
.side-nav-summary {
    display: none;
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

.side-nav-summary::-webkit-details-marker { display: none; }

.side-nav-body { min-width: 0; }

.side-nav a {
    display: block;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    color: rgba(28, 37, 48, 0.78);
}

.side-nav a:hover { color: #94070a; }

.side-nav a[aria-current="page"] {
    background: rgba(148, 7, 10, 0.08);
    color: #94070a;
    font-weight: 700;
}

.side-nav a.side-sub {
    padding-left: 22px;
    font-size: 13px;
}

/* 分组标题（旧写法：纯文本，不折叠）—— 已由 .side-group 取代，保留以兼容残留页面 */
.side-label {
    margin: 16px 10px 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #94070a;
}

.side-label:first-child { margin-top: 4px; }

/* ---- 可折叠分组：默认只展开当前所在的那一组 ---- */

.side-group { margin: 0; }

.side-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 15px 0 2px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.5;
    color: rgba(28, 37, 48, 0.62);
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

.side-group > summary::-webkit-details-marker { display: none; }

.side-group > summary:hover {
    color: #94070a;
    background: rgba(148, 7, 10, 0.05);
}

/* 折叠箭头：收起时朝右，展开时朝下 */
.side-group > summary::after {
    content: "";
    flex: none;
    width: 5px;
    height: 5px;
    margin-top: -3px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.side-group[open] > summary::after { transform: rotate(45deg); }

.side-group.is-current > summary {
    color: #94070a;
    background: rgba(148, 7, 10, 0.06);
}

/* 组内小标题：只用于切分，不可点 */
.side-sub-label {
    margin: 8px 10px 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(28, 37, 48, 0.4);
}

.side-sub-label:first-child { margin-top: 6px; }

/* 组内链接缩进一级，做出层级 */
.side-group > a { padding-left: 18px; }

@media (max-width: 960px) {
    .lesson-grid { grid-template-columns: repeat(2, 1fr); }
    .do-dont { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 32px; }
    .layout,
    .layout:has(> .page-toc) { grid-template-columns: 1fr; gap: 0; }

    /* 侧栏在窄屏改为可折叠：默认收起，点「目录」展开 */
    .side-nav {
        position: static;
        max-height: none;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid #e6e8ec;
        padding: 0;
        margin-bottom: 8px;
        order: 1;
        display: block;
    }

    .side-nav-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 11px 2px;
        font-size: 14px;
        font-weight: 700;
        color: #94070a;
    }

    .side-nav-summary::after {
        content: "展开";
        font-size: 12px;
        font-weight: 700;
        color: rgba(28, 37, 48, 0.55);
    }

    .side-nav-toggle:checked ~ .side-nav-summary::after { content: "收起"; }

    .side-nav-toggle:checked ~ .side-nav-summary {
        border-bottom: 1px solid #e6e8ec;
    }

    .side-nav-body {
        display: none;
        max-height: 46vh;
        overflow-y: auto;
        padding: 8px 0 14px;
    }

    .side-nav-toggle:checked ~ .side-nav-body { display: block; }

    .side-nav-body .side-label { margin-top: 14px; }
    .side-nav-body .side-label:first-child { margin-top: 4px; }

    /* 窄屏下宽表格改为横向滚动，不再撑破页面 */
    .spec-table { display: block; overflow-x: auto; }
    .file-block pre { max-width: 100%; }

    .page-toc {
        position: static;
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px 14px;
        max-height: none;
        margin: 0 0 12px;
        padding: 0 0 12px;
        border-left: 0;
        border-bottom: 1px solid #e6e8ec;
    }
    .layout-main { order: 3; }
}

@media (max-width: 640px) {
    .wrap { padding: 0 16px 56px; }
    .lesson-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 26px; }
    .site-title { font-size: 22px; }
    .site-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media print {
    body { background: #ffffff; color: #000000; }
    .wrap { max-width: none; padding: 0; }
    .site-nav,
    .side-nav,
    .page-toc { display: none; }
    .layout,
    .layout:has(> .page-toc) { display: block; }
    .page-header h1,
    .section-title {
        background: none;
        -webkit-text-fill-color: currentColor;
        color: #94070a;
    }
    .section-title::after { display: none; }
    .section { break-inside: avoid; }
    .check,
    .lesson,
    .xref,
    .file-block,
    .metric,
    .steps > div,
    .do-dont > div,
    .verdict { border-color: #cccccc; }
    .file-block pre {
        background: #ffffff;
        color: #000000;
        border: 1px solid #cccccc;
    }
    a { color: #000000; text-decoration: none; }
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 11px;
        color: #666666;
    }
}

/* 重定向桩的提示段 */
.stub-note { padding-top: 32px; }

/* 小间距工具类 */
.mt-sm { margin-top: 14px; }

/* 窄列里不让两三个字的标签被折成两行 */
.nowrap { white-space: nowrap; }
