        :root {
            --bg: #f5f7fb;
            --card: #ffffff;
            --text: #1c2533;
            --muted: #627084;
            --line: #d9e2ef;
            --brand: #21487f;
            --brand-soft: #2f5e9f;
            --ok: #14683b;
            --warn: #8a5a00;
            --fallback: #9a3f00;
        }

        /* Keep the centered archive shell from shifting horizontally when a
           directory has enough reports to introduce a vertical scrollbar. */
        html {
            overflow-y: scroll;
            scrollbar-gutter: stable;
        }

        * { box-sizing: border-box; }

        body {
            margin: 0;
            color: var(--text);
            background: radial-gradient(circle at 0% 0%, #d7e5ff 0%, rgba(215,229,255,0) 26%), radial-gradient(circle at 100% 100%, #e5efff 0%, rgba(229,239,255,0) 30%), var(--bg);
            font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
        }

        body.theme-bright {
            background: radial-gradient(circle at 0% 0%, #f2f8ff 0%, rgba(242,248,255,0) 36%), radial-gradient(circle at 100% 100%, #f7fbff 0%, rgba(247,251,255,0) 36%), #f8fbff;
            color: #152235;
        }

        body.theme-dark {
            --bg: #0f1725;
            --card: #151f31;
            --text: #e6edf9;
            --muted: #9fb1cc;
            --line: #25344f;
            --brand: #1e3a63;
            --brand-soft: #2a4f86;
            --ok: #5fd694;
            --warn: #f1b764;
            --fallback: #ff9a69;
            background: radial-gradient(circle at 0% 0%, #1b2a42 0%, rgba(27,42,66,0) 34%), radial-gradient(circle at 100% 100%, #17263f 0%, rgba(23,38,63,0) 34%), #0f1725;
            color: var(--text);
        }

        .container {
            max-width: 1180px;
            margin: 0 auto;
            padding: 22px 16px 36px;
        }

        .hero {
            border-radius: 16px;
            background: linear-gradient(130deg, var(--brand) 0%, var(--brand-soft) 100%);
            color: #fff;
            padding: 22px 20px 16px;
            box-shadow: 0 10px 28px rgba(20, 43, 78, 0.22);
        }

        .hero-top {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 12px;
        }

        .hero-controls {
            display: inline-flex;
            gap: 8px;
            align-items: center;
        }

        .hero h1 { margin: 0; font-size: 28px; line-height: 1.25; }
        .hero p { margin: 8px 0 0; opacity: 0.92; font-size: 14px; }

        .toolbar {
            margin-top: 12px;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .summary { color: var(--muted); font-size: 14px; }

        .lang-switch {
            display: inline-flex;
            background: #fff;
            border: 1px solid #c9d6ea;
            border-radius: 10px;
            overflow: hidden;
        }

        .lang-switch button {
            border: 0;
            background: transparent;
            color: #274a7a;
            font-size: 13px;
            padding: 7px 12px;
            cursor: pointer;
            min-width: 56px;
        }

        .lang-switch button.active {
            background: #244b83;
            color: #fff;
            font-weight: 600;
        }

        .theme-switch {
            display: inline-flex;
            border: 1px solid rgba(255, 255, 255, 0.42);
            border-radius: 10px;
            overflow: hidden;
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(4px);
        }

        .theme-switch button {
            border: 0;
            background: transparent;
            color: #fff;
            font-size: 12px;
            padding: 7px 10px;
            cursor: pointer;
            min-width: 62px;
        }

        .theme-switch button.active {
            background: #fff;
            color: #21487f;
            font-weight: 700;
        }

        body.theme-dark .content-panel,
        body.theme-dark .toc,
        body.theme-dark details.group,
        body.theme-dark .directory-block,
        body.theme-dark details.directory-node,
        body.theme-dark .card {
            background: #172235;
            border-color: #2b3a57;
            box-shadow: none;
        }

        body.theme-dark details.group > summary,
        body.theme-dark details.directory-node > summary,
        body.theme-dark .toc a {
            background: #1a2a41;
            border-color: #324665;
            color: #d7e3f8;
        }

        body.theme-dark .meta,
        body.theme-dark .section-meta,
        body.theme-dark .toc .count,
        body.theme-dark .chip {
            color: #a9bdd9;
        }

        .hero .lang-switch {
            border-color: rgba(255, 255, 255, 0.42);
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(4px);
        }

        .hero .lang-switch button {
            color: #fff;
        }

        .hero .lang-switch button.active {
            background: #fff;
            color: #21487f;
        }

        .directory-context {
            margin-top: 18px;
            padding: 15px 18px 17px;
            border: 1px solid #d5e1f2;
            border-radius: 16px;
            background:
                linear-gradient(115deg, rgba(255, 255, 255, 0.94) 0%, rgba(244, 248, 255, 0.92) 70%, rgba(235, 243, 255, 0.92) 100%);
            box-shadow: 0 12px 28px rgba(31, 65, 111, 0.07);
        }

        .context-intro {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 11px;
            color: #5c718f;
            font-size: 12px;
        }

        .context-kicker {
            color: #254c84;
            font-family: "Songti SC", "STSong", "SimSun", serif;
            font-size: 15px;
            font-weight: 700;
            letter-spacing: 0.08em;
        }

        .context-rule { width: 22px; height: 1px; background: #a9bfdf; }
        .context-hint { color: #7286a1; }

        .section-nav { display: flex; min-width: 0; }
        .nav-level { min-width: 0; }

        .nav-list {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            overflow-x: auto;
            scrollbar-width: thin;
            padding: 2px 2px 5px;
        }

        .primary-nav-list { gap: 9px; }

        .nav-item {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            text-decoration: none;
            border: 1px solid #cedcf1;
            background: rgba(255, 255, 255, 0.7);
            color: #305481;
            border-radius: 999px;
            padding: 8px 13px;
            font-size: 13px;
            font-weight: 650;
            line-height: 1;
            white-space: nowrap;
            flex: 0 0 auto;
            transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
        }

        .nav-item:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 14px rgba(36, 75, 131, 0.13);
            border-color: #9db9ea;
            background: #ffffff;
        }

        .nav-item.active {
            background: #2d5795;
            border-color: #2d5795;
            color: #fff;
            font-weight: 700;
            box-shadow: 0 8px 16px rgba(36, 75, 131, 0.22);
        }

        .nav-item .count { color: #7185a1; font-size: 11px; font-weight: 700; }
        .nav-item.active .count { color: rgba(255, 255, 255, 0.84); }

        .directory-step {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid #dce6f4;
        }

        .step-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            margin-bottom: 9px;
        }

        .step-title-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; }

        .step-marker {
            display: grid;
            place-items: center;
            width: 25px;
            height: 25px;
            flex: 0 0 auto;
            border-radius: 8px;
            color: #31598f;
            background: #e5eefb;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.04em;
        }

        .step-label {
            margin: 0 0 1px;
            color: #7c8fa9;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.08em;
        }

        .step-title-wrap h3 {
            margin: 0;
            color: #1e467d;
            font-family: "Songti SC", "STSong", "SimSun", serif;
            font-size: 16px;
            line-height: 1.2;
            overflow-wrap: anywhere;
        }

        .scope-switch {
            display: inline-flex;
            align-items: stretch;
            flex: 0 0 auto;
            overflow: hidden;
            border: 1px solid #ccd9ec;
            border-radius: 9px;
            background: rgba(255, 255, 255, 0.76);
        }

        .scope-switch .nav-item {
            border: 0;
            border-radius: 0;
            padding: 7px 10px;
            background: transparent;
            box-shadow: none;
            font-size: 12px;
        }

        .scope-switch .nav-item + .nav-item { border-left: 1px solid #d7e2f1; }
        .scope-switch .nav-item.active { background: #e5eefb; color: #214b82; }
        .scope-switch .nav-item.active .count { color: #315b91; }

        .child-nav-list { gap: 7px; }
        .child-nav-list .nav-item { background: #f9fbff; padding: 7px 12px; }
        .child-nav-list .nav-item.active { background: #2d5795; }

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        /* Preserve the original archive layout: the primary navigation stays
           light and horizontal, while deeper folders add only a compact row. */
        .primary-nav {
            margin-top: 12px;
            align-items: center;
        }

        .primary-nav .nav-list { padding-left: 0; }

        .subnav-rows {
            display: grid;
            gap: 5px;
            margin-top: 4px;
            padding-left: 2px;
        }

        .subnav-row {
            align-items: center;
            gap: 9px;
            min-width: 0;
        }

        .subnav-label {
            flex: 0 0 auto;
            max-width: 180px;
            overflow: hidden;
            color: #637a9a;
            font-size: 12px;
            font-weight: 700;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .subnav-row .nav-list { padding: 1px 2px 3px; }
        .subnav-row .nav-item { padding: 7px 11px; font-size: 12px; }

        .section-title-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .section-title-row .scope-switch { margin-left: auto; }

        .nav-overflow {
            position: relative;
            flex: 0 0 auto;
        }

        .nav-overflow > summary {
            list-style: none;
            cursor: pointer;
            border: 1px solid #d6e1f2;
            background: #f7faff;
            color: #24497c;
            border-radius: 999px;
            padding: 7px 12px;
            font-size: 13px;
            user-select: none;
        }

        .nav-overflow > summary::-webkit-details-marker { display: none; }
        .nav-overflow[open] > summary { background: #e7f0ff; border-color: #9fbaea; }

        .nav-overflow-menu {
            position: absolute;
            right: 0;
            top: calc(100% + 6px);
            z-index: 10;
            min-width: 220px;
            max-height: 320px;
            overflow: auto;
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: 10px;
            box-shadow: 0 10px 24px rgba(18, 33, 58, 0.16);
            padding: 8px;
            display: grid;
            gap: 6px;
        }

        .content-panel {
            margin-top: 12px;
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: 14px;
            box-shadow: 0 6px 14px rgba(18, 33, 58, 0.06);
            padding: 12px;
        }

        .section-header { margin-bottom: 12px; display: grid; gap: 6px; }

        .breadcrumbs {
            font-size: 13px;
            color: var(--muted);
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
        }

        .breadcrumbs a { color: #1f4b84; text-decoration: none; }
        .breadcrumbs a:hover { text-decoration: underline; }

        .section-title { margin: 0; font-size: 20px; color: #1f4b84; }
        .section-meta { margin: 0; color: var(--muted); font-size: 13px; }

        .archive-layout {
            display: grid;
            grid-template-columns: 190px 1fr;
            gap: 12px;
            align-items: start;
        }

        .toc {
            position: sticky;
            top: 12px;
            background: #f6f9ff;
            border: 1px solid #d8e3f3;
            border-radius: 10px;
            padding: 10px 8px;
        }

        .toc h3 {
            margin: 0 0 8px;
            font-size: 16px;
            color: #254f8e;
        }

        .toc ul {
            margin: 0;
            padding: 0;
            list-style: none;
            display: grid;
            gap: 6px;
        }

        .toc a {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            text-decoration: none;
            color: #24497c;
            border: 1px solid #d6e1f2;
            background: #f7faff;
            border-radius: 9px;
            padding: 6px 8px;
            font-size: 13px;
        }

        .toc a:hover { background: #ecf3ff; border-color: #bfd0eb; }
        .toc .count { color: #5f7492; }

        .archive-main {
            min-width: 0;
        }

        .empty {
            border: 1px dashed #bed0e8;
            border-radius: 10px;
            padding: 24px;
            color: var(--muted);
            font-size: 14px;
            background: #fbfdff;
        }

        .directory-block,
        details.directory-node {
            border: 1px solid #d5e0f0;
            border-radius: 12px;
            background: #fff;
            margin-bottom: 10px;
            overflow: hidden;
        }

        .directory-block-heading,
        details.directory-node > summary {
            cursor: pointer;
            list-style: none;
            padding: 12px 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            background: #f7faff;
            border-bottom: 1px solid #dbe5f4;
        }

        details.directory-node > summary::-webkit-details-marker { display: none; }

        .directory-block-heading h3,
        .directory-title {
            margin: 0;
            color: #24497d;
            font-size: 16px;
            font-weight: 700;
            overflow-wrap: anywhere;
        }

        .directory-node-body { padding: 0; }

        .directory-children {
            margin: 0 12px 12px 26px;
            padding-left: 12px;
            border-left: 2px solid #dbe6f6;
        }

        details.directory-node.depth-1,
        details.directory-node.depth-2,
        details.directory-node.depth-3,
        details.directory-node.depth-4,
        details.directory-node.depth-5 {
            margin: 10px 0 0;
            border-radius: 10px;
            background: #fbfdff;
        }

        details.directory-node.depth-1 > summary,
        details.directory-node.depth-2 > summary,
        details.directory-node.depth-3 > summary,
        details.directory-node.depth-4 > summary,
        details.directory-node.depth-5 > summary {
            padding: 10px 12px;
            background: #f9fbff;
            font-size: 14px;
        }

        body.theme-dark .directory-children { border-color: #324665; }

        body.theme-dark .directory-context {
            border-color: #2b4060;
            background: linear-gradient(115deg, rgba(24, 38, 59, 0.96) 0%, rgba(22, 38, 60, 0.95) 100%);
            box-shadow: none;
        }

        body.theme-dark .context-kicker,
        body.theme-dark .step-title-wrap h3 { color: #d7e7ff; }
        body.theme-dark .context-hint,
        body.theme-dark .step-label { color: #9cb1cd; }
        body.theme-dark .context-rule,
        body.theme-dark .directory-step { border-color: #314764; }
        body.theme-dark .step-marker { color: #bfd7ff; background: #243b5c; }

        body.theme-dark .nav-item {
            border-color: #385273;
            background: #182942;
            color: #d8e8ff;
        }

        body.theme-dark .nav-item .count { color: #a9c2e3; }
        body.theme-dark .nav-item.active {
            border-color: #5b88cb;
            background: #456fae;
            color: #fff;
        }

        body.theme-dark .scope-switch { border-color: #385273; background: #182942; }
        body.theme-dark .scope-switch .nav-item.active { background: #29486f; color: #eff6ff; }
        body.theme-dark .scope-switch .nav-item + .nav-item { border-color: #385273; }
        body.theme-dark .child-nav-list .nav-item { background: #17283e; }
        body.theme-dark .child-nav-list .nav-item.active { background: #456fae; }

        details.group {
            border: 1px solid #d5e0f0;
            border-radius: 12px;
            background: #fff;
            margin-bottom: 10px;
            overflow: hidden;
        }

        details.group:last-child { margin-bottom: 0; }

        details.group > summary {
            cursor: pointer;
            list-style: none;
            padding: 12px 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            background: #f7faff;
            border-bottom: 1px solid #dbe5f4;
        }

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

        .group-title {
            display: flex;
            align-items: baseline;
            gap: 6px;
            flex-wrap: wrap;
            color: #24497d;
            font-size: 16px;
            font-weight: 700;
        }

        .chip {
            border-radius: 999px;
            padding: 2px 9px;
            font-size: 12px;
            background: #eef4ff;
            color: #48648b;
            border: 1px solid #d2dff2;
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 12px;
            padding: 12px;
        }

        .card {
            border: 1px solid #dbe4f1;
            border-radius: 12px;
            padding: 13px;
            background: #fff;
            box-shadow: 0 4px 10px rgba(13, 27, 47, 0.05);
            display: flex;
            flex-direction: column;
            gap: 10px;
            min-width: 0;
        }

        .title { margin: 0; font-size: 16px; line-height: 1.45; min-height: 44px; }
        .title { overflow-wrap: anywhere; word-break: break-word; }
        .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
        .meta-file {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr);
            align-items: baseline;
            gap: 4px;
            width: 100%;
        }

        .meta-label { flex: 0 0 auto; }

        .file-name {
            display: block;
            min-width: 0;
            max-width: none;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            vertical-align: bottom;
        }

        .meta-directory {
            min-width: 0;
            color: #71819a;
            font-size: 11px;
            white-space: nowrap;
        }

        .meta-directory > span:last-child {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .badge {
            display: inline-flex;
            align-items: center;
            border-radius: 999px;
            border: 1px solid transparent;
            padding: 2px 9px;
            font-size: 11px;
            line-height: 1.45;
        }

        .badge-ok { color: var(--ok); background: #ebf8f1; border-color: #c9e8d8; }
        .badge-warn { color: var(--warn); background: #fff6e7; border-color: #f1ddb3; }
        .badge-fallback { color: var(--fallback); background: #fff0e9; border-color: #f0c6b0; }

        .row {
            margin-top: auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
        }

        .read-btn {
            text-decoration: none;
            border: 1px solid #bfd0ea;
            background: #f2f7ff;
            color: #21487f;
            font-size: 13px;
            font-weight: 600;
            border-radius: 8px;
            padding: 7px 11px;
            transition: transform 0.12s ease, box-shadow 0.12s ease;
        }

        .read-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 5px 10px rgba(33, 72, 127, 0.14);
        }

        @media (max-width: 900px) {
            .nav-overflow-menu {
                right: auto;
                left: 0;
                max-width: calc(100vw - 32px);
            }

            .archive-layout {
                grid-template-columns: 1fr;
            }

            .toc {
                position: static;
            }
        }

        @media (max-width: 640px) {
            .hero h1 { font-size: 23px; }
            .container { padding: 14px 10px 24px; }
            .grid { grid-template-columns: 1fr; }
            details.group > summary { padding: 10px 11px; }
            .hero-top { flex-direction: column; align-items: stretch; }
            .hero-controls { justify-content: space-between; }
            .directory-context { margin-top: 14px; padding: 13px 12px 14px; }
            .context-hint { display: none; }
            .step-header { align-items: flex-start; flex-direction: column; gap: 8px; }
            .scope-switch { align-self: stretch; }
            .scope-switch .nav-item { flex: 1 1 auto; justify-content: center; }
            .subnav-row { align-items: flex-start; flex-direction: column; gap: 4px; }
            .subnav-label { max-width: 100%; }
            .subnav-row .nav-list { width: 100%; }
            .section-title-row { align-items: flex-start; flex-direction: column; }
            .section-title-row .scope-switch { margin-left: 0; }
        }
