/* ==========================================================================
   OpenBlog — 主题样式
   设计口径：
   1. 颜色来自低饱和粉色系，但用量克制——大面积是纸白与灰，粉色只做强调。
   2. 圆角与阴影偏"纸"而非"气球"：小圆角、细描边、浅投影，不再满屏悬浮气泡。
   3. 动效短、轻、有方向感（120~200ms），不做夸张回弹。
   4. 图标一律线条 SVG，不用 emoji；不依赖任何外链字体。
   ========================================================================== */

:root {
    /* 主色板（后台可逐项覆盖，见 Theme::cssVariables） */
    --c-primary: #d4738c;
    --c-primary-soft: #f7e6ea;
    --c-accent: #8f6f7d;
    --c-bg: #fbf8f8;
    --c-surface: #ffffff;
    --c-text: #2f2a2c;
    --c-muted: #7d7376;

    /* 派生 */
    --c-primary-deep: #b85a73;
    --c-border: #ece4e6;
    --c-border-strong: #ded3d6;
    --c-shadow: rgba(58, 42, 48, 0.05);
    --c-shadow-strong: rgba(58, 42, 48, 0.1);
    --c-ink: #191617;

    /* 类型与尺寸 */
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 10px;
    --radius-pill: 999px;
    --measure: 720px;
    --content-width: 1120px;
    /* 「文字轨」= 卡片内正文内容的左内边距。
     * 头版正文、列表行的字形/缩略图、区块标题共用这一个数值，
     * 左边线才不会一节一个样。加宽这里，整页正文会一起往右让。 */
    --rail: 30px;
    /* 列表行里字形列的宽度与它到正文的间距。
     * 正文左边缘 = --rail + --glyph + --glyph-gap，
     * 头版正文也按这个算式对齐（见 .feature__body）。 */
    --glyph: 34px;
    --glyph-gap: 18px;

    /* 动效：短促、线性偏缓，不做回弹 */
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --dur-fast: 110ms;
    --dur: 170ms;

    --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC",
        "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --fs-body: 16.5px;
    --lh-body: 1.75;
}

@media (prefers-color-scheme: dark) {
    :root {
        --c-bg: #171416;
        --c-surface: #1f1b1d;
        --c-text: #e9e2e4;
        --c-muted: #a2979b;
        --c-primary-soft: #2c2024;
        --c-border: #302a2d;
        --c-border-strong: #3d3538;
        --c-shadow: rgba(0, 0, 0, 0.3);
        --c-shadow-strong: rgba(0, 0, 0, 0.5);
        --c-ink: #fbf7f8;
    }
}

/* 手动指定暗色：与 prefers-color-scheme 走同一套变量，
   差别只是"跟系统"还是"用户说了算"。后台可选 auto / light / dark。 */
:root[data-scheme="dark"] {
    --c-bg: #171416;
    --c-surface: #1f1b1d;
    --c-text: #e9e2e4;
    --c-muted: #a2979b;
    --c-primary-soft: #2c2024;
    --c-border: #302a2d;
    --c-border-strong: #3d3538;
    --c-shadow: rgba(0, 0, 0, 0.3);
    --c-shadow-strong: rgba(0, 0, 0, 0.5);
    --c-ink: #fbf7f8;
    --c-primary-deep: #e9a6b7;
}

/* 系统暗色 + 用户显式选了亮色时，把系统那套压回去 */
@media (prefers-color-scheme: dark) {
    :root[data-scheme="light"] {
        --c-bg: #fbf8f8;
        --c-surface: #ffffff;
        --c-text: #2f2a2c;
        --c-muted: #7d7376;
        --c-primary-soft: #f7e6ea;
        --c-border: #ece4e6;
        --c-border-strong: #ded3d6;
        --c-shadow: rgba(58, 42, 48, 0.05);
        --c-shadow-strong: rgba(58, 42, 48, 0.1);
        --c-ink: #191617;
        --c-primary-deep: #b85a73;
    }
}

/* --------------------------------------------------------------------------
   基础
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

/* [hidden] 必须真的隐藏。
   布局规则里的 display:flex/grid 优先级高于 UA 的 [hidden]{display:none}，
   于是 data-reply-hint 这种"默认隐藏、点了才显示"的元素会一直挂在页面上。 */
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    color: var(--c-text);
    background: var(--c-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; border-style: none; }

a { color: inherit; text-decoration: none; transition: color var(--dur-fast) var(--ease); }

a:hover { color: var(--c-primary-deep); }

h1, h2, h3, h4, h5, h6 {
    margin: 1.5em 0 0.55em;
    line-height: 1.35;
    font-weight: 650;
    letter-spacing: -0.005em;
    color: var(--c-ink);
}

h1 { font-size: clamp(1.5rem, 3.1vw, 1.95rem); }
h2 { font-size: clamp(1.24rem, 2.3vw, 1.45rem); }
h3 { font-size: 1.12rem; }

p { margin: 0 0 1.05em; }

hr {
    border: 0;
    border-top: 1px solid var(--c-border);
    margin: 2.4em 0;
}

code, pre, kbd { font-family: var(--font-mono); font-size: 0.88em; }

::selection { background: var(--c-primary-soft); color: var(--c-ink); }

:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.container { width: 100%; max-width: var(--content-width); margin: 0 auto; padding: 0 22px; }

.site-main { flex: 1; padding: 30px 0 64px; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    padding: 10px 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    z-index: 100;
}

.skip-link:focus { left: 12px; top: 12px; }

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 22px;
}

.card--hover { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }

.card--hover:hover {
    border-color: var(--c-border-strong);
    box-shadow: 0 6px 18px -12px var(--c-shadow-strong);
}

.empty-state {
    text-align: center;
    padding: 46px 24px;
    color: var(--c-muted);
}

.empty-state h3 { margin: 0 0 8px; color: var(--c-text); font-size: 1.06rem; }
.empty-state p { margin: 0 0 16px; font-size: 0.93rem; }
.empty-state--tight { padding: 26px 20px; }

.field__hint {
    color: var(--c-muted);
    font-size: 0.82rem;
    margin: 6px 0 0;
    /* 说明文字里常年出现一整条路径（/www/wwwroot/.../openblog.sqlite）、
       一个 ini 名（upload_max_filesize）或一段 URL。默认不折行的话，
       它们会把面板顶宽、把整页拉出横向滚动条 —— 而这些字符串恰恰是
       "最需要让人完整读到"的那类内容，截断或省略号都不行。 */
    overflow-wrap: anywhere;
    word-break: break-word;
}
.field__hint code { overflow-wrap: anywhere; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.4; display: inline-block; }

/* 按钮：扁平、细描边，不做悬浮气球。
   统一 38px 最小高度——原来主按钮 9px 内边距撑到 36px、
   .btn--sm 只有 30px，同一行里「读这篇」和小按钮高度不一样，
   排在一起像两套控件。 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--c-primary);
    border: 1px solid var(--c-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn:hover { background: var(--c-primary-deep); border-color: var(--c-primary-deep); color: #fff; }
.btn:active { transform: translateY(1px); }

.btn:focus-visible,
.like-btn:focus-visible,
.action-btn:focus-visible,
.pagination__item:focus-visible,
.human-check__option:focus-within {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn--ghost {
    background: transparent;
    border-color: var(--c-border-strong);
    color: var(--c-text);
}

.btn--ghost:hover { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-deep); }

.btn--soft { background: var(--c-primary-soft); border-color: transparent; color: var(--c-primary-deep); }
.btn--soft:hover { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn--sm { min-height: 32px; padding: 5px 12px; font-size: 0.82rem; }
/* 两字的按钮（"搜索" / "重置"）在 flex 行里会被压成一条竖排文字 ——
   现在这些按钮都写在 flex 容器里，容器空间不够时 flex 默认会缩它们，
   缩到比两个字还窄就竖排了。这一类按钮没有可缩的余地，定死不缩。 */
.btn--fixed { flex: none; white-space: nowrap; }
.btn--block { width: 100%; }

.input, .select, .textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.94rem;
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }

.field { margin-bottom: 16px; }
.field__label { display: block; margin-bottom: 6px; font-size: 0.86rem; font-weight: 600; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.6;
    /* 列被挤窄时「已发布」会折成「已发/布」，状态是词不是字，不给折行 */
    white-space: nowrap;
}

/*
 * 外链角标：用 border 拼一个右上方向的箭头。
 * 不用字体里的 ↗（有些字体没有那个字形），也不用 mask（部分浏览器会留底色方块）。
 * 站内链接不带这个角标。
 */
a[rel~="external"]::after {
    content: "";
    display: inline-block;
    width: 0.42em;
    height: 0.42em;
    margin-left: 0.3em;
    vertical-align: 0.15em;
    border-top: 1.2px solid currentColor;
    border-right: 1.2px solid currentColor;
    opacity: 0.7;
    transform: rotate(45deg);
}

a[rel~="external"]:hover::after { opacity: 1; }

.tag-link {
    color: var(--c-muted);
    font-size: 0.82rem;
    border-bottom: 1px solid transparent;
}

.tag-link:hover { color: var(--c-primary-deep); border-bottom-color: currentColor; }

.tag-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.alert--success { background: #f1f8f3; border-color: #cfe6d7; color: #2f6b48; }
.alert--error { background: #fdf2f3; border-color: #f2d3d8; color: #a2404f; }
.alert--notice { background: #fdf8ef; border-color: #eddfc4; color: #7c5f28; }

@media (prefers-color-scheme: dark) {
    .alert--success { background: #1b241e; border-color: #2c3d33; color: #8fcaa8; }
    .alert--error { background: #2a1d20; border-color: #43292e; color: #e8a2ad; }
    .alert--notice { background: #262117; border-color: #40382a; color: #d9c08a; }
}

/* --------------------------------------------------------------------------
   头部：品牌 + 导航 + 搜索
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 64px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand__mark {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 9px;
    transition: transform var(--dur) var(--ease);
}

.brand__mark--sm { width: 30px; height: 30px; border-radius: 8px; }
.brand__mark--lg { width: 58px; height: 58px; border-radius: 14px; }
.brand:hover .brand__mark, .brand:hover .brand__logo { transform: rotate(-4deg); }

.brand__logo {
    width: 36px;
    height: 36px;
    flex: none;
    object-fit: contain;
    border-radius: 8px;
}

.brand__logo--sm { width: 30px; height: 30px; }

.brand__text { display: flex; flex-direction: column; min-width: 0; }

.brand__name {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--c-ink);
    line-height: 1.25;
}

.brand__tagline {
    font-size: 0.74rem;
    color: var(--c-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 22ch;
}

.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.nav__link {
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--c-text);
    white-space: nowrap;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.nav__link:hover { background: var(--c-primary-soft); color: var(--c-primary-deep); }

.nav__link--active { color: var(--c-primary-deep); font-weight: 650; background: var(--c-primary-soft); }

.nav__link--admin { border: 1px solid var(--c-border-strong); }

/* ---- 导航下拉子菜单 ----
   用 details/summary 而不是 :hover：hover 下拉在触屏上点不出来、
   键盘也 tab 不进去。details 自带这两件事。
   父项本身还是链接，箭头只负责展开。 */
.nav__group { position: relative; }
.nav__group__summary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.nav__group__summary::-webkit-details-marker { display: none; }
.nav__group__summary::marker { content: ''; }
.nav__group__label { color: inherit; text-decoration: none; }
/* 箭头本身只有 8px 的笔画，直接做成热区的话手指根本点不中
   （实测命中区 11x11，而 WCAG 2.5.8 要求指针目标至少 24x24）。
   所以把它撑成一个 26px 的方形热区，笔画用伪元素居中画出来。
   父项链接仍然独占左侧，点到箭头才会展开 —— 两种意图不打架。 */
.nav__group__caret {
    position: relative;
    flex: none;
    width: 26px;
    height: 26px;
    margin-left: -4px;
    opacity: .75;
}
.nav__group__caret::before {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: transform var(--dur-fast) var(--ease);
}
.nav__group[open] > .nav__group__summary .nav__group__caret::before {
    transform: rotate(-135deg) translate(-1px, -1px);
}
.nav__group[open] > .nav__group__summary,
.nav__group.is-active > .nav__group__summary { color: var(--c-primary-deep); background: var(--c-primary-soft); }

/* summary 里嵌了一个 <a>，两段热区要分清楚：
   label 负责"去父项页面"，caret 负责"展开子菜单"。
   给 label 一点右内边距，免得两个可点区域在视觉上连成一片、点错。 */
.nav__group__label { padding-right: 2px; }

/* 基础规则只写「长什么样」，不写 display。
   display 由下面的展开/收起两条规则给：写在这儿等于默认可见。 */
.nav__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: 176px;
    padding: 6px;
    gap: 1px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .35);
}

/* 收起时**必须真的不渲染**。
   这里原来只写了「展开时什么样」，没写「收起时什么样」，而 display: grid
   写在基础规则里——于是面板在关闭状态下照样参与布局：它是 position:absolute
   的浮层，就成了一块带边框和阴影的方块，压在下面正文上、盖住首屏内容。
   用 display 而不是 visibility/opacity：后两者仍参与命中测试与无障碍树，
   键盘 Tab 也会走进一组看不见的链接，等于换个方式坏。
   这条与下面那条同为 (0,1,1)，靠顺序在后胜出。 */
details.nav__group:not([open]) > .nav__dropdown { display: none; }

/* 展开态：只在 [open] 时才建立网格 */
details.nav__group[open] > .nav__dropdown { display: grid; }
.nav__dropdown__link {
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    font-size: .89rem;
    color: var(--c-text);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav__dropdown__link:hover { background: var(--c-primary-soft); color: var(--c-primary-deep); }
.nav__dropdown__link.is-active { color: var(--c-primary-deep); font-weight: 650; background: var(--c-primary-soft); }

.nav-toggle {
    display: none;
    width: 40px;
    height: 38px;
    margin-left: auto;
    padding: 9px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    cursor: pointer;
}

.nav-toggle__bar { display: block; height: 1.6px; background: var(--c-text); border-radius: 1px; }
.nav-toggle__bar + .nav-toggle__bar { margin-top: 4px; }

/* 搜索：明确边框的输入框，不靠 emoji 充当图标 */
.search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 32px;
    min-width: 190px;
    height: 38px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.search:focus-within { border-color: var(--c-primary); background: var(--c-surface); }

.search__icon {
    position: absolute;
    left: 9px;
    width: 16px;
    height: 16px;
    color: var(--c-muted);
    pointer-events: none;
}

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

.search__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.88rem;
    padding: 0;
}

.search__input:focus { outline: none; }
.search__input::placeholder { color: var(--c-muted); opacity: 0.85; }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search__hint {
    display: none;
    padding: 1px 5px;
    border: 1px solid var(--c-border);
    border-radius: 3px;
    background: var(--c-surface);
    color: var(--c-muted);
    font-size: 0.68rem;
}

@media (min-width: 900px) { .search__hint { display: inline-block; } }

.search--full {
    min-width: 0;
    width: 100%;
    height: 46px;
    padding-left: 38px;
}

.search--full .search__icon { left: 13px; width: 18px; height: 18px; }
.search--full .search__input { font-size: 1rem; }
.search--full .btn { flex: none; margin-left: 6px; }

.search-panel { padding: 16px; }

/* --------------------------------------------------------------------------
   面包屑 / 页头 / 分区标题
   -------------------------------------------------------------------------- */

.crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--c-muted);
    margin-bottom: 14px;
}

.crumbs a { color: var(--c-muted); }
.crumbs a:hover { color: var(--c-primary-deep); }

.list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--c-border);
}

.list-head__title { margin: 0; font-size: 1.35rem; }
.list-head__meta { margin: 0; color: var(--c-muted); font-size: 0.84rem; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 34px 0 14px;
}

/* 区块标题与列表行的字形落在同一条左轨上。
   只缩标题本身，不缩整个 flex 容器 —— 容器右侧还挂着"文档/动态/归档"
   这些 chip 与页码，它们必须跟分页、侧栏保持原来的右边线。 */
.section-head__title {
    margin: 0;
    padding-left: var(--rail);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-muted);
}
.section-head__meta { font-size: 0.8rem; color: var(--c-muted); }

.page-hint { margin: 30px 0 0; font-size: 0.8rem; color: var(--c-muted); text-align: center; }

/* --------------------------------------------------------------------------
   布局
   -------------------------------------------------------------------------- */

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

/* 侧边栏在左：DOM 顺序不变（内容在前、侧栏在后，利于阅读与 SEO），
   只用 grid 顺序把侧栏挪到左边，移动端折叠时仍然是内容优先。 */
.layout--left { grid-template-columns: 300px minmax(0, 1fr); }
.layout--left > .layout__content { order: 2; }
.layout--left > .sidebar { order: 1; }

/* 无侧栏：内容区自然铺满，读长文时更舒服 */
.layout--none { grid-template-columns: minmax(0, 1fr); gap: 0; }
.layout--none > .sidebar { display: none; }

/* --------------------------------------------------------------------------
   头版：首页最顶部那一篇
   -------------------------------------------------------------------------- */

.feature {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
    /* 原来是 8px：头版底边和"最近在写"标题只差一行字的距离，
       两节黏在一起。这里跟 .section-head 的 34px 顶部间距成一对，
       让"头版 → 列表"和"标题 → 列表"是同一个节奏。 */
    margin-bottom: 26px;
    border-radius: var(--radius-lg);
}

.feature--text { grid-template-columns: minmax(0, 1fr); }
/* 单栏头版（也就是没有封面那一支）的标题字号略收，读起来像「一篇文章的开头」。 */
.feature--text .feature__title { font-size: clamp(1.35rem, 2.4vw, 1.7rem); }
.feature--text .feature__body { padding: 30px calc(var(--rail) + var(--glyph) + var(--glyph-gap) - 1px); }

/* 头版要跟下面的列表和侧栏在同一个版心里。
 *
 * 原来给 .feature--text 钉了 `max-width: 860px`，本意是"别让没封面的头版
 * 在 1120px 里显得像半个空盒子"。但这条规则的代价是：头版左贴版心、
 * 右边停在 860px，而下面的 .layout 是 1076px（内容 734 + 间距 42 + 侧栏 300），
 * 于是头版右侧空出一条 216px 的缝——顶上短一截，下面长一截，
 * 页面像"上半部分是另一个网站"。
 *
 * 收窄这件事本身没错，错在收窄的依据是"有没有封面"而不是"有没有侧栏"。
 * 没有侧栏时，正文一栏铺满 1076px，头版收窄到 860px 是刻意的留白；
 * 有侧栏时，正文本来就只有 734px，头版必须跟它一样宽才对齐。
 * 所以把 max-width 挪到 .layout--none 上——那才是"内容真的铺满整版"的情形。
 */
.feature--text { max-width: none; }
/* 没有侧栏时正文铺满整版，头版收窄到 860px 是刻意的留白 */
.feature--text.feature--solo { max-width: 860px; }

.feature__media { display: block; overflow: hidden; background: var(--c-primary-soft); }

/* 图片撑满左栏高度、按 cover 裁切。
   原来 height:100% + min-height:300px，左栏被固定拉到 367px，
   右栏文字只占 200px 高，头版中间留一大块白；
   而给图片定 4:3 又会反过来把左栏撑高。
   现在高度由 aspect-ratio 决定、内容居中，两边不吃亏。 */
.feature__media img {
    width: 100%;
    height: 100%;
    min-height: 260px;
    object-fit: cover;
    display: block;
    transition: transform 400ms var(--ease);
}

.feature:hover .feature__media img { transform: scale(1.015); }

/* 头版正文跟列表行走同一条文字轨。
 * 列表的正文左边缘是 --rail + --glyph + --glyph-gap，这里照抄同一个算式，
 * 头版标题与列表标题就会落在同一条竖线上。 */
.feature__body {
    /* 头版是 .card（带 1px 边框），列表行没有边框。
       减去这 1px，两条轨才真正重合；不差这一点的话，
       肉眼能看出头版标题比列表标题右移了 1px。 */
    padding: 36px calc(var(--rail) + var(--glyph) + var(--glyph-gap) - 1px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.feature__kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: var(--c-muted);
}

.feature__kicker a { color: var(--c-primary-deep); font-weight: 600; }

.feature__title { margin: 0 0 12px; font-size: clamp(1.4rem, 2.6vw, 1.85rem); line-height: 1.3; }
.feature__title a { color: var(--c-ink); }
.feature__title a:hover { color: var(--c-primary-deep); }

.feature__summary {
    margin: 0 0 22px;
    color: var(--c-muted);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feature__foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.feature__stats {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.8rem;
    color: var(--c-muted);
}

/* 图片加载失败（404 / 文件被删）：把 <img> 收起来。
   固定宽高比的容器里留着 alt 文案会撑破盒子、挤乱同行文字，
   藏掉之后跟「本来就没有封面」是同一套表现。 */
img.is-broken { visibility: hidden; }
.is-broken.post-item__thumb,
.is-broken.feature__media,
.is-broken.article__cover { background: var(--c-primary-soft); }

/* 头版封面挂了：不能只把 <img> 藏掉。
   头版是两栏 grid（1.05fr 图 + 1fr 文），图挂了之后那一栏仍然占着位置、
   有底色和 260px 最小高度，于是标题被挤到右半边、左边留一块空白板子——
   这正是「没有封面的置顶文章排版怎么这样」的样子。
   服务端的 .feature--text 是按 cover 字段有没有值决定的，字段有值但文件
   404 时它不会生效，所以这里在客户端再兜一层：整块媒体栏收掉，卡片回退成
   纯文字头版（与 .feature--text 同一套观感）。 */
.feature--broken { grid-template-columns: minmax(0, 1fr); }
.feature--broken .feature__media { display: none; }
.feature--broken .feature__title { font-size: clamp(1.35rem, 2.4vw, 1.7rem); }
/* 没有图时整块卡片都是文字，右上角那块"图片底色"没有意义 */
.feature--broken { background: var(--c-surface); }

/* --------------------------------------------------------------------------
   文章列表
   -------------------------------------------------------------------------- */

.post-list { display: grid; gap: 0; border-top: 1px solid var(--c-border); }

/* 列表行与头版共用同一条文字轨。
 *
 * 原来是 `padding: 20px 10px`，而头版正文内边距是 34/38px。
 * 同一栏里因此出现三条左基线：头版标题、列表字形、列表标题各走各的，
 * 读起来像"每节都差一点"。现在两者都从 --rail 起算：
 *   行容器左边缘 = --rail，字形落在这里；
 *   正文左边缘   = --rail + --glyph + --glyph-gap，
 * 头版正文用同一个 calc 把自己也钉在这条线上。 */
.post-item {
    display: grid;
    grid-template-columns: var(--glyph) minmax(0, 1fr);
    gap: var(--glyph-gap);
    padding: 20px var(--rail);
    border: 0;
    border-bottom: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: transparent;
    transition: background-color var(--dur) var(--ease);
}

.post-item:hover { background: var(--c-surface); box-shadow: none; }

/* 封面走右侧缩略图，不是横跨整行的 21:9 大图。
   跨行时 726px 宽 → 311px 高，一条列表 500px，
   一屏只放得下一篇；缩略图 168px 宽后一条降到 162px。 */
.post-item__thumb {
    grid-column: 2;
    grid-row: 1;
    width: 168px;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--c-primary-soft);
}

.post-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 420ms var(--ease); }
.post-item:hover .post-item__thumb img { transform: scale(1.02); }

.post-item__glyph {
    display: grid;
    place-items: center;
    width: var(--glyph);
    height: var(--glyph);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    color: var(--c-muted);
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    background: var(--c-bg);
}

.post-item:has(.post-item__thumb) { grid-template-columns: minmax(0, 1fr) 168px; }
/* 有缩略图时没有字形列，正文自己就是首列：左内边距补上字形那一份，
   否则有图没图的两种条目，标题会差 52px。 */
.post-item:has(.post-item__thumb) { padding-left: calc(var(--rail) + var(--glyph) + var(--glyph-gap)); }
.post-item:has(.post-item__thumb) .post-item__body { grid-column: 1; padding-right: 22px; }

/* 缩略图与正文首行对齐。默认 stretch 会把图拉成和正文一样高（约 88px），
   3:2 被压扁；居中又会在短条目上浮起来。 */
.post-item__thumb { align-self: start; }

/* 头版是 grid 第二列，缩略图规则会把它挤到右边，这里还原 */
.feature .post-item__thumb,
.feature__media { grid-column: auto; grid-row: auto; width: auto; }

/* 基线对齐。
 *
 * 原来是 align-items: center，而「10-04」和「2026」是两个不同字号的兄弟节点
 * （0.8rem vs 0.72rem），高度 22.39px vs 20.14px。居中之后矮的那个
 * 被往下推了 1px，两个数字不在同一条基线上，看起来就是"错落的、
 * 分两段的日期"。看起来像字距问题，其实是盒模型对齐方式的问题——
 * 改 align-items 才是治本，调字号只是把它藏起来。
 *
 * 顺带把 flex-wrap 收紧：这一行是元信息（分类 / 日期 / 年份），
 * 在窄屏上宁可整体换行，也不要年份被单独挤到第二行跟日期分家。 */
.post-item__line { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 7px; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.7;
}

.chip--soft { background: var(--c-primary-soft); color: var(--c-primary-deep); }
.chip--pin { background: var(--c-primary); color: #fff; }

/* 日期与年份是一体的（"10-04 2026"），所以两者同字号、同色、同透明度。
 * 年份原来是 0.72rem + opacity 0.75，比日期小一圈又淡一档，
 * 视觉上被拆成了两个不相关的元素。层级要靠位置和间距表达，
 * 不靠"把年份调淡"——那个做法只制造噪音，不制造层级。 */
.post-item__date { font-size: 0.8rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.post-item__year { font-size: 0.8rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }

.post-item__title { margin: 0 0 6px; font-size: 1.16rem; line-height: 1.42; }
.post-item__title a { color: var(--c-ink); }
.post-item__title a:hover { color: var(--c-primary-deep); }

.post-item__summary {
    margin: 0 0 11px;
    color: var(--c-muted);
    font-size: 0.92rem;
    line-height: 1.68;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-item__foot {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-wrap: wrap;
    font-size: 0.79rem;
    color: var(--c-muted);
}

/* 分页 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 5px; margin-top: 30px; flex-wrap: wrap; }

.pagination__item {
    min-width: 36px;
    height: 36px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.pagination__item:hover { border-color: var(--c-primary); color: var(--c-primary-deep); }
.pagination__item--active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pagination__item--active:hover { color: #fff; }
.pagination__item--disabled { opacity: 0.4; pointer-events: none; }

/* --------------------------------------------------------------------------
   侧边栏
   -------------------------------------------------------------------------- */

.sidebar { display: grid; gap: 18px; align-content: start; position: sticky; top: 84px; }

.side-card { padding: 18px; }

.side-card__title {
    margin: 0 0 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-muted);
}

.side-about__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }

.side-about__avatar {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 10px;
    object-fit: contain;
}

.side-about__name { margin: 0 0 3px; font-weight: 700; font-size: 0.98rem; color: var(--c-ink); }
.side-about__bio { margin: 0; font-size: 0.83rem; color: var(--c-muted); line-height: 1.55; }

.side-about__links { display: flex; flex-wrap: wrap; gap: 6px; }

.side-link {
    padding: 3px 9px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--c-muted);
}

.side-link:hover { border-color: var(--c-primary); color: var(--c-primary-deep); background: var(--c-primary-soft); }

.side-about__intro { margin: 12px 0 0; font-size: 0.83rem; color: var(--c-muted); line-height: 1.65; }

.side-stats { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-border); }
.side-stats__item { display: flex; flex-direction: column; font-size: 0.74rem; color: var(--c-muted); }
.side-stats__item strong { font-size: 1.05rem; color: var(--c-ink); font-variant-numeric: tabular-nums; line-height: 1.3; }

.side-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.side-timeline li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.87rem; }
.side-timeline a { color: var(--c-text); }
.side-timeline a:hover { color: var(--c-primary-deep); }
.side-timeline time { font-size: 0.74rem; color: var(--c-muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.side-list--links li { justify-content: flex-start; }
.side-more { display: inline-block; margin-top: 12px; font-size: 0.8rem; color: var(--c-primary-deep); }

.side-search { display: flex; gap: 8px; }
.side-search .input { flex: 1; min-width: 0; }

/* 内联 SVG 图标的默认尺寸。
   partials/icon.php 默认给 class="icon"，但之前没有对应的 CSS 规则，
   于是任何没显式指定大小的调用（比如编辑器里那句加密提示）会把 SVG 撑满整行。
   1em 的方框跟当前字号对齐，正是行内图标该有的样子。 */
.icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    vertical-align: -0.14em;
}

/* 只给屏幕阅读器的文字 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }

.side-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 0.89rem; }
.side-list a { color: var(--c-text); }
.side-list a:hover { color: var(--c-primary-deep); }
.side-list__count { color: var(--c-muted); font-size: 0.79rem; font-variant-numeric: tabular-nums; }

.side-ranked { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; counter-reset: rank; }

.side-ranked li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 9px; align-items: baseline; font-size: 0.89rem; }

.side-ranked__no {
    font-family: var(--font-serif);
    font-size: 0.88rem;
    color: var(--c-muted);
    font-variant-numeric: tabular-nums;
}

.side-ranked a { color: var(--c-text); }
.side-ranked a:hover { color: var(--c-primary-deep); }

.side-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }

.side-comments__head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 0.82rem; }
.side-comments__head strong { color: var(--c-ink); }
.side-comments__head span { color: var(--c-muted); font-size: 0.76rem; }
.side-comments__text { margin: 4px 0 3px; font-size: 0.83rem; color: var(--c-text); line-height: 1.55; }
.side-comments__link { font-size: 0.76rem; color: var(--c-muted); }
.side-comments__link:hover { color: var(--c-primary-deep); }

/* --------------------------------------------------------------------------
   文章详情
   -------------------------------------------------------------------------- */

/* 版心才是排版的第一性问题。
   原来是「文章卡片 + 190px 侧栏」把 1076px 铺满：正文拿到 766px，
   但中文一行在这个字号下 720px 就到头了，于是每行只填 340px 左右、
   右边空出 300 多像素——看着像没写完就换行。
   现在正文列限到 720px（--measure），目录挤在它右边、卡片跟着收窄，
   整屏居中；下面的评论、相关阅读同样用这个宽度，不再一块宽一块窄。 */
.reading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; align-items: start; }

/* 版心限宽。
   两段阈值：
   - 780px 起就限宽，别让正文随视口一路长到 760px 一行；
   - 目录并排要等到 1000px。780~1000px 这段并排会把正文挤到 450px 一行，
     比不限宽还难受，所以目录先留在正文下面（折叠版），到 1000px 再进右栏。 */
@media (min-width: 780px) {
    .reading:not(:has(.reading__toc)) { grid-template-columns: minmax(0, var(--measure)); justify-content: center; }
}

@media (min-width: 1000px) {
    .reading:has(.reading__toc) {
        grid-template-columns: minmax(0, var(--measure)) 168px;
        gap: 36px;
        justify-content: center;
    }
    .reading__toc { order: 2; }
}

.reading > * { min-width: 0; }

.article { padding: 38px 40px; border-radius: var(--radius-lg); }

/* 780px 以下卡片会贴到边，内边距收一点 */
@media (max-width: 779px) {
    .article { padding: 32px 26px; }
}

/* 文章页的外围区块（评论、相关阅读、上一篇/下一篇）跟随版心，不再一条宽一条窄。
   宽度 = 正文版心 + 目录列 + 间距；目录列在 .reading 里占掉自己那一份，
   正文仍然拿满 --measure。 */
.article-wrap { display: grid; gap: 0; min-width: 0; }
@media (min-width: 780px) {
    .article-wrap { max-width: var(--measure); margin-inline: auto; }
}

@media (min-width: 1000px) {
    .article-wrap:has(.reading__toc) { max-width: calc(var(--measure) + 36px + 168px); }
}

.article__header { margin-bottom: 26px; }

.article__category {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--c-primary-deep);
}

.article__title { margin: 0 0 14px; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.32; }

.article__meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 0.83rem; color: var(--c-muted); }
.article__updated { font-style: italic; }

/* 封面：给一个高度上限。原来 638px 宽配原图比例能长到 425px 高，
   第一屏全是图，标题和正文都被推下去了。 */
.article__cover { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--c-border); }
.article__cover img {
    width: 100%;
    aspect-ratio: 2 / 1;
    max-height: 320px;
    object-fit: cover;
    display: block;
}

.article__body { font-size: 1.02rem; line-height: 1.85; }

/* 目录进右栏之后，卡片里那份折叠目录就是重复内容了 */
@media (min-width: 1000px) {
    .reading:has(.reading__toc) .toc--inline { display: none; }
}

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

.article__body h2 {
    margin: 2.1em 0 0.7em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--c-border);
    font-size: 1.3rem;
}

.article__body h3 { margin: 1.7em 0 0.55em; font-size: 1.12rem; }

.article__body a { color: var(--c-primary-deep); border-bottom: 1px solid var(--c-primary-soft); }
.article__body a:hover { border-bottom-color: var(--c-primary); }

.article__body blockquote {
    margin: 1.6em 0;
    padding: 2px 0 2px 18px;
    border-left: 3px solid var(--c-primary);
    color: var(--c-muted);
    font-family: var(--font-serif);
    font-size: 1.02rem;
}

.article__body blockquote p:last-child { margin-bottom: 0; }

.article__body ul, .article__body ol { padding-left: 1.4em; }
.article__body li { margin-bottom: 0.42em; }

.article__body code:not(pre code) {
    padding: 1.5px 5px;
    border-radius: 3px;
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-size: 0.86em;
}

.article__body .code-block {
    margin: 1.6em 0;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    background: #faf7f8;
    color: #3a3336;
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.65;
}

@media (prefers-color-scheme: dark) {
    .article__body .code-block { background: #141112; color: #e2dade; border-color: #2c2629; }
}

.article__body .code-block code { background: transparent; color: inherit; padding: 0; }

.article__body .table-wrap { overflow-x: auto; margin: 1.6em 0; }

.article__body table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.article__body th, .article__body td { padding: 9px 12px; border: 1px solid var(--c-border); text-align: left; }
.article__body thead th { background: var(--c-bg); font-weight: 650; }


/* 正文图片：不设死高度，等比缩放，绝不允许比容器宽 */
.article__body img {
    border-radius: var(--radius-sm);
    max-width: 100%;
    height: auto;
    display: block;
}

.article__body p > img { margin: 1.6em auto; }

/* 独立成段的图片给宽屏一点呼吸：不放大、只居中 */
@media (min-width: 780px) {
    .article__body > p > img:only-child { margin-left: auto; margin-right: auto; }
}

/* 代码块：移动端横滑，别把整页撑出横向滚动条 */
.article__body .code-block {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* 表格：外层横滑 + 不换行的窄列 */
.article__body .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* 长链接/长单词不该顶破手机窄屏 */
.article__body { overflow-wrap: break-word; }
.article__body a { word-break: break-word; }


.article__footer { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--c-border); display: grid; gap: 18px; }

.article__actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.like-btn, .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 13px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.like-btn:hover, .action-btn:hover { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-deep); }
.like-btn.is-liked { border-color: var(--c-primary); color: var(--c-primary-deep); background: var(--c-primary-soft); }

/* 心形用内联 SVG 的线条路径。
   原来是用 ::before/::after 两个圆角方块拼的——在 1px 描边 + 小尺寸下，
   两瓣对不齐，看着像裂开的屁股。线条路径在任何尺寸下都稳。 */
.like-btn__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    transition: transform var(--dur) var(--ease);
}

/* 已喜欢的实心效果：fill 跟描边同色，形状不变 */
.like-btn.is-liked .like-btn__icon { fill: currentColor; }

.like-btn__word { font-size: 0.82rem; }

.like-btn.is-beating { animation: like-pop 380ms var(--ease); }
.like-btn.is-beating .like-btn__icon { animation: like-hb 380ms var(--ease); }

@keyframes like-hb {
    0% { transform: scale(1); }
    40% { transform: scale(1.28); }
    70% { transform: scale(0.96); }
    100% { transform: scale(1); }
}

@keyframes like-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* 目录 */
.toc { margin: 0 0 26px; padding: 14px 18px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); }
.toc summary { cursor: pointer; font-size: 0.85rem; font-weight: 650; color: var(--c-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.toc ol { margin: 12px 0 0; padding-left: 1.2em; display: grid; gap: 5px; font-size: 0.88rem; }
.toc__l3 { margin-left: 14px; list-style: circle; }
.toc a { color: var(--c-text); }
.toc a:hover { color: var(--c-primary-deep); }

.reading__toc { position: sticky; top: 84px; border-left: 1px solid var(--c-border); padding-left: 18px; }

.reading__toc-title {
    margin: 0 0 10px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-muted);
}

.reading__toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 0.83rem; }
.reading__toc .toc__l3 { margin-left: 10px; color: var(--c-muted); }
.reading__toc a { color: var(--c-muted); }
.reading__toc a:hover { color: var(--c-primary-deep); }

/* 上一篇 / 下一篇 */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }

.prevnext__item {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    transition: border-color var(--dur) var(--ease);
}

.prevnext__item:hover { border-color: var(--c-primary); }
.prevnext__item--next { text-align: right; }
.prevnext__item--empty { color: var(--c-muted); font-size: 0.86rem; }

.prevnext__label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-muted);
}

.prevnext__title { font-size: 0.93rem; font-weight: 600; color: var(--c-ink); }

.related { margin-top: 22px; }

.related__list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 11px; }

.related__list li { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.related__list a { color: var(--c-text); font-size: 0.94rem; }
.related__list a:hover { color: var(--c-primary-deep); }
.related__meta { font-size: 0.78rem; color: var(--c-muted); white-space: nowrap; }

/* --------------------------------------------------------------------------
   评论
   -------------------------------------------------------------------------- */

.comments { margin-top: 22px; padding: 28px 30px; }

.comment-list { display: grid; gap: 0; }

.comment {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--c-border);
}

.comment:last-child { border-bottom: 0; }

.comment__avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-size: 0.88rem;
    font-weight: 700;
    overflow: hidden;
}

.comment__avatar img { width: 100%; height: 100%; object-fit: cover; }

.comment__head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 5px; flex-wrap: wrap; }
.comment__author { font-weight: 650; font-size: 0.92rem; }
.comment__time { font-size: 0.77rem; color: var(--c-muted); }
.comment__body { font-size: 0.93rem; white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.comment__actions { margin-top: 7px; }

.comment__reply-link {
    padding: 2px 0;
    border: 0;
    background: none;
    color: var(--c-muted);
    font-family: inherit;
    font-size: 0.79rem;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.comment__reply-link:hover { color: var(--c-primary-deep); border-bottom-color: currentColor; }

.comment__replies { margin-top: 6px; padding-left: 14px; border-left: 2px solid var(--c-border); display: grid; }
.comment__replies .comment { grid-template-columns: 30px minmax(0, 1fr); padding: 12px 0; }
.comment__replies .comment__avatar { width: 30px; height: 30px; font-size: 0.78rem; }

.comment-form { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--c-border); }
.comment-form__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; }

.reply-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    margin-bottom: 14px;
    border-left: 3px solid var(--c-primary);
    background: var(--c-primary-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   人机验证
   -------------------------------------------------------------------------- */

.human-check {
    margin: 18px 0;
    padding: 16px 18px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    display: grid;
    gap: 10px;
}

.human-check__title {
    margin: 0 0 12px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--c-muted);
}

.human-check__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 2px; }

.human-check__img {
    display: block;
    width: 180px;
    height: 64px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
}

.human-check__side { display: grid; gap: 6px; justify-items: start; }

.human-check .field__label { margin-bottom: 0; }
.human-check .field__hint { margin-top: 0; }

.human-check__input { letter-spacing: 0.22em; font-family: var(--font-mono); text-transform: uppercase; max-width: 220px; }

.human-check__box { margin: 4px 0 0; padding: 12px 14px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }

/* legend 里的 <strong> 原来是个粉底大色块，视觉重量压过题目本身。
   题目才是要读的内容，答案只做轻微强调。 */
.human-check__box legend { padding: 0 6px; font-size: 0.82rem; color: var(--c-muted); }
.human-check__box legend strong {
    color: var(--c-primary-deep);
    font-family: var(--font-mono);
    font-weight: 650;
    letter-spacing: 0.02em;
}

.human-check__options { display: flex; gap: 8px; flex-wrap: wrap; }

.human-check__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 62px;
    min-height: 36px;
    padding: 5px 12px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.human-check__option:hover { border-color: var(--c-primary); }
.human-check__option:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-deep); }
.human-check__option input { accent-color: var(--c-primary); margin: 0; }

/* --------------------------------------------------------------------------
   归档 / 搜索 / 站点地图
   -------------------------------------------------------------------------- */

.month-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }

.month-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
    color: var(--c-text);
}

.month-pill:hover { border-color: var(--c-primary); color: var(--c-primary-deep); }
.month-pill.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.month-pill__count { font-size: 0.74rem; opacity: 0.7; }

.sitemap { display: grid; gap: 18px; }
.sitemap__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.sitemap__group { margin-bottom: 18px; }
.sitemap__month { margin: 0 0 8px; font-size: 0.86rem; color: var(--c-muted); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.sitemap__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.sitemap__list li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 0.9rem; }
.sitemap__date { font-size: 0.76rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--c-border); background: var(--c-surface); padding: 26px 0 30px; font-size: 0.85rem; color: var(--c-muted); }

.site-footer__inner { display: grid; gap: 16px; }

.site-footer__top { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; justify-content: space-between; }
.site-footer__bottom { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--c-border); }

.site-footer__legal { margin: 0; font-size: 0.79rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.site-footer__legal a { color: var(--c-muted); }
.site-footer__legal a:hover { color: var(--c-primary-deep); }

.site-footer__brand { display: flex; align-items: center; gap: 10px; }
.site-footer__brand strong { color: var(--c-ink); font-size: 0.92rem; }
.site-footer__tagline { font-size: 0.78rem; }

.site-footer__links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer__links a { color: var(--c-muted); }
.site-footer__links a:hover { color: var(--c-primary-deep); }
.site-footer__note { margin: 0; font-size: 0.79rem; }

/* --------------------------------------------------------------------------
   通用页（错误页 / 维护页 / 登录页）
   -------------------------------------------------------------------------- */

.plain-body {
    background: var(--c-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 18px;
}

.plain-wrap { width: 100%; max-width: 560px; margin: 0 auto; }

.plain-card {
    padding: 34px 32px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
}

.plain-card__logo { display: flex; justify-content: center; margin-bottom: 14px; }
.plain-card__logo img { width: 58px; height: 58px; object-fit: contain; border-radius: 14px; }

.plain-card__code {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: 2.6rem;
    line-height: 1;
    color: var(--c-primary);
    text-align: center;
    letter-spacing: 0.04em;
}

.plain-card__title { margin: 0 0 10px; text-align: center; font-size: 1.22rem; }
.plain-card__text { margin: 0 0 12px; color: var(--c-muted); font-size: 0.92rem; text-align: center; }

.plain-card__list { margin: 0 0 18px; padding: 0 0 0 2px; list-style: none; display: grid; gap: 8px; justify-items: center; }
.plain-card__list a { font-size: 0.9rem; color: var(--c-primary-deep); }
.plain-card__list a::after { content: "›"; margin-left: 4px; opacity: 0.55; }

.plain-card__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.plain-card__detail {
    margin: 16px 0 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    font-size: 0.8rem;
    color: var(--c-muted);
    overflow-x: auto;
    white-space: pre-wrap;
}

.plain-foot { margin: 18px 0 0; text-align: center; font-size: 0.78rem; color: var(--c-muted); }

.login-card { max-width: 420px; }
.login-form { margin-top: 20px; }

/* 自动建站后的一次性凭据卡片：只在第一次打开登录页时出现。
   用等宽字体展示口令，避免 l/1、O/0 看混。 */
.autoboot-card { text-align: left; }
.autoboot-card__hint { margin: 6px 0; font-size: 0.86rem; }
.autoboot-card__list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin: 8px 0;
    align-items: baseline;
}
.autoboot-card__list dt { font-size: 0.8rem; color: var(--c-muted); }
.autoboot-card__list dd { margin: 0; }
.autoboot-card__list code {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.95rem;
    word-break: break-all;
}

/* 设置页的分组导航与组件开关 */
.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--c-border);

    /* 设置页是整站最长的一页（十几个分组、上万像素），分组导航一走就看不见了，
       想跳到「AI 助手」得先把滚轮搓到底。粘住它，滚到哪一组都能横着跳。
       背景不能透明：透过去的话，下面的字段会从导航的缝隙里显出来。
       底部那道 1px 边框原本是"页头与内容的分界"，粘住以后它变成"导航与内容的
       分界"，所以补一层底阴影，滚动时能看出这是一层浮起来的条。 */
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--c-bg);
}

.settings-nav.is-stuck {
    border-bottom-color: transparent;
    box-shadow: 0 1px 0 var(--c-border), 0 8px 14px -10px rgba(58, 50, 54, 0.35);
}

.settings-nav__item {
    padding: 5px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    color: var(--c-muted);
}

.settings-nav__item:hover { border-color: var(--c-primary); color: var(--c-primary-deep); background: var(--c-primary-soft); }

.widget-picker { display: grid; gap: 7px; }

.widget-picker__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.widget-picker__item:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.widget-picker__item input { margin-top: 3px; }

.chip--ok { background: #e3f1e7; color: #2f6b45; }

/* 设置页里的小节锚点，滚动时上方留点空白。
   这个值要盖住「粘住的设置导航」的高度 —— 太小的话点一下分组，
   标题正好被导航条压在下面，看起来像没跳。 */
.panel[id] { scroll-margin-top: 96px; }

/* 编辑器工具栏与 AI 结果面板 */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--c-border);
}

.editor-toolbar__sep { width: 1px; height: 18px; background: var(--c-border-strong); margin: 0 2px; }
.editor-toolbar .btn__icon { width: 14px; height: 14px; }

.ai-result {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--c-bg);
    font-size: 0.86rem;
    line-height: 1.7;
}

.ai-result .outline-map { margin-top: 4px; }

/* 导航排序列表 *//* 导航排序列表 */
.nav-sortable { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.nav-sortable__item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
}

.nav-sortable__item.is-hidden { opacity: 0.6; }
.nav-sortable__item.is-dragging { opacity: 0.4; border-style: dashed; }
.nav-sortable__item.is-drop-target { border-color: var(--c-primary); background: var(--c-primary-soft); }

.nav-sortable__handle { cursor: grab; color: var(--c-muted); display: flex; align-items: center; }
.nav-sortable__handle svg { width: 16px; height: 16px; }
.nav-sortable__handle:active { cursor: grabbing; }

.nav-sortable__main { min-width: 140px; }
.nav-sortable__label { font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.nav-sortable__href { font-size: 0.76rem; color: var(--c-muted); word-break: break-all; }
.nav-sortable__form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: auto; }

/* 附件存储页的顶部筛选条 */
.attach-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.attach-toolbar__filters { display: flex; gap: 6px; flex-wrap: wrap; }
.attach-filter {
    padding: 5px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    color: var(--c-muted);
}
.attach-filter:hover { border-color: var(--c-primary); color: var(--c-primary-deep); }
.attach-filter.is-active { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-deep); }

/* --------------------------------------------------------------------------
   后台
   -------------------------------------------------------------------------- */

.admin-body { background: var(--c-bg); }

.admin-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.admin-side {
    padding: 20px 16px;
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--c-border);
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--c-ink);
}

.admin-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.admin-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--c-text);
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.admin-menu a:hover { background: var(--c-primary-soft); color: var(--c-primary-deep); }
.admin-menu a.is-active { background: var(--c-primary); color: #fff; font-weight: 600; }
.admin-menu a.is-active .menu-icon { opacity: 1; }

.menu-icon { width: 17px; height: 17px; flex: none; opacity: 0.72; }

.btn__icon { width: 15px; height: 15px; flex: none; }
.btn__icon--lead { margin-right: 2px; }
.btn__icon--ghost { opacity: 0.8; }
.btn--sm .btn__icon { width: 14px; height: 14px; }
.admin-topbar__actions .btn { white-space: nowrap; }

.admin-menu .menu-badge {
    margin-left: auto;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-size: 0.72rem;
    font-weight: 700;
}

.admin-menu a.is-active .menu-badge { background: rgba(255, 255, 255, 0.24); color: #fff; }

.admin-main { padding: 24px 28px 60px; min-width: 0; }

.admin-topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-topbar h1 { margin: 0; font-size: 1.28rem; }
.admin-topbar__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }

.stat { padding: 16px 18px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.stat__label { font-size: 0.8rem; color: var(--c-muted); margin-bottom: 5px; }
.stat__value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat__unit { font-size: 0.8rem; color: var(--c-muted); font-weight: 500; margin-left: 3px; }

.panel {
    padding: 20px 22px;
    margin-bottom: 20px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
}

.panel__title {
    margin: 0 0 16px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.98rem;
}

/* 两列自适应网格。
   minmax 的下限必须写成 min(360px, 100%)，不能只写 360px：
   容器本身比 360px 窄时（手机上、或者前台把这张网格放进有内边距的版心里），
   固定下限会把格子撑出容器，页面横向溢出——而且溢出量正好是
   "360 - 容器宽度"，在 360px 屏上最明显。
   用 min(360px, 100%) 之后，宽屏还是"每列至少 360px"，窄屏自动收到容器宽度。 */
.admin-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 20px; }

/* 设置页列数多、字段密，宁可窄一点也不要挤成一条 */
.admin-grid-2 > .panel { min-width: 0; }
.admin-grid-2--single { grid-template-columns: minmax(0, 1fr); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.89rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.data-table th { font-size: 0.78rem; letter-spacing: 0.04em; color: var(--c-muted); font-weight: 700; white-space: nowrap; }
.data-table tbody tr:hover { background: var(--c-bg); }
.data-table--compact { font-size: 0.82rem; max-height: 320px; display: block; overflow-y: auto; }
.log-detail { font-family: var(--font-mono); font-size: 0.78rem; color: var(--c-muted); word-break: break-all; }

.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input, .filters .select { width: auto; min-width: 150px; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
/* 侧栏太窄会把里面的输入框挤到几十像素宽（实测 71px），文本框内容被裁掉。
   给一个最小宽度，并在窄容器里让封面行改成上下排。 */
.editor-side { min-width: 0; }
.editor-side .field, .editor-side .input, .editor-side .select, .editor-side textarea { min-width: 0; }
.editor-main { display: grid; gap: 14px; }

.editor-title {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-ink);
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 650;
}

.editor-title:focus { outline: none; border-color: var(--c-primary); }

.editor-body { min-height: 420px; font-family: var(--font-mono); font-size: 0.92rem; line-height: 1.75; }

.preview-box {
    padding: 16px 18px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    min-height: 160px;
    max-height: 460px;
    overflow-y: auto;
}

.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.color-field { display: flex; align-items: center; gap: 9px; }

.color-field input[type="color"] {
    width: 40px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    cursor: pointer;
}

.swatch-row { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }

.swatch {
    padding: 9px 16px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease);
}

.swatch.is-active { border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }

.logo-picker { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 18px; align-items: start; }
.logo-picker__preview { display: grid; place-items: center; gap: 8px; padding: 14px; border: 1px dashed var(--c-border-strong); border-radius: var(--radius-sm); }
.logo-picker__preview img { max-width: 100%; max-height: 70px; object-fit: contain; }
.logo-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.logo-picker__item { display: block; padding: 5px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); cursor: pointer; }
.logo-picker__item:hover { border-color: var(--c-primary); }
.logo-picker__item img { width: 100%; height: 48px; object-fit: contain; display: block; }

/* 封面选择器：文本框 + 媒体库缩略图点选 */
.cover-picker { display: grid; gap: 12px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
/* 预览固定宽度，文本区最少 150px；两栏放不下就换行，避免输入框被压成一条缝。 */
.cover-picker__row { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; }
@media (max-width: 1100px) { .cover-picker__row { grid-template-columns: minmax(0, 1fr); } }

.cover-picker__preview {
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
}

.cover-picker__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-picker__empty { color: var(--c-muted); font-size: 0.8rem; }
.cover-picker__actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.cover-picker__actions .btn { flex: 0 0 auto; white-space: nowrap; }
.cover-picker__control { min-width: 0; }

.cover-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; min-width: 0; }

.cover-picker__item {
    padding: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.cover-picker__item:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.cover-picker__item.is-active { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-soft); }
.cover-picker__item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* SEO 推送区 */
.discover-links { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 14px; font-size: 0.84rem; color: var(--c-muted); }
.discover-links a { color: var(--c-primary-deep); }
.panel__subtitle { margin: 18px 0 8px; font-size: 0.9rem; color: var(--c-text); overflow-wrap: anywhere; }
.push-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.82rem; color: var(--c-muted); }
.push-log li { display: flex; gap: 10px; align-items: center; padding: 7px 11px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); }
.push-log__time { font-variant-numeric: tabular-nums; }
.push-log__tag { padding: 1px 7px; border-radius: var(--radius-sm); background: var(--c-primary-soft); color: var(--c-primary-deep); font-weight: 600; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 13px; }

.media-item { overflow: hidden; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.media-item__thumb { aspect-ratio: 1; display: grid; place-items: center; background: var(--c-bg); }
.media-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-item__info { padding: 9px 11px; font-size: 0.76rem; color: var(--c-muted); word-break: break-all; }

.dropzone {
    padding: 32px 20px;
    text-align: center;
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius);
    background: var(--c-bg);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.dropzone.is-drag, .dropzone:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.dropzone__icon { width: 32px; height: 32px; color: var(--c-muted); }

/* 说明文字是这一块里唯一需要"读"的东西，给它一个可读的行长。
   dropzone 自己撑满面板宽度（1440px 屏上近 1200px），行不受限时
   那句话会拉成长长一条 —— 中间那段"单个上限 2MB"被挤到视野外，
   而它正是这一块最该被看见的信息。
   说明文字统一居中、最宽 60ch，视觉上变成一段而不是一条。 */
.dropzone__hint {
    max-width: 62ch;
    margin: 10px auto 0;
    text-align: center;
}
.dropzone__title { margin: 8px 0 0; }

/* 窄屏上 dropzone 的内边距收一收：32px 上下在手机上会把"点击选择文件"
  那行挤到折行，图标、标题、说明三层叠起来比屏幕还高 */
@media (max-width: 640px) {
    .dropzone { padding: 22px 14px; }
    .dropzone__hint { font-size: 0.78rem; }
}

.code-block-inline {
    font-family: var(--font-mono);
    font-size: 0.83rem;
    background: var(--c-bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    overflow-x: auto;
    white-space: pre;
}

/* 柱状图。
   ------------------------------------------------------------------
   **刻度是要抽稀的。** 一条 30 天的趋势有 30 根柱子，每根柱子下面都写
   "09-08" 的话，一列只有十几像素宽、而标签要五六十像素 —— 30 个标签
   连成一条黑糊糊的带子，标的是哪一天一个都读不出来（实机验证过：
   整行糊成一个色块）。所以标签抽稀：只在"每隔若干天"的柱子上显示，
   剩下的柱子用 title 属性承接悬停信息。

   抽稀的密度交给模板算（它知道有几根柱子、容器多宽），这里只负责
   "隐藏的标签仍占位" —— 用 visibility 而不是 display，
   柱子的对齐基线才不会因为有无标签而高低不一。 */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 132px; padding-top: 10px; }
.bar-chart--tall { height: 168px; }
.bar-chart--dense { height: 112px; }

.bar-chart__col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    height: 100%;
    /* 柱子是"数据"，标签是"读数"：悬停时柱子才亮，
       但标签不该跟着一起闪，所以这里不加 transition */
    position: relative;
}

/* 抽稀后仍要让鼠标能落到每一根柱子上：
   柱子本身太窄（30 天时约 10px），把可点区域撑到整列 —— 
   title 提示挂在这层，指针移到列上就能读到"某天多少浏览"。 */
.bar-chart__col::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.bar-chart__bar { width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; background: var(--c-primary); min-height: 3px; opacity: 0.85; }
.bar-chart__col:hover .bar-chart__bar { opacity: 1; }

.bar-chart__label {
    font-size: 0.66rem;
    color: var(--c-muted);
    white-space: nowrap;
    line-height: 1.2;
    /* 抽稀：被跳过的刻度仍然占位，否则柱子会因为有无标签而错位 */
    visibility: hidden;
    font-variant-numeric: tabular-nums;
}

.bar-chart__label.is-shown { visibility: visible; }

/* --------------------------------------------------------------------------
   安装向导
   -------------------------------------------------------------------------- */

.install-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px; background: var(--c-bg); }
.install-card { width: 100%; max-width: 620px; padding: 34px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); }

.install-steps { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }

.install-step {
    flex: 1;
    min-width: 110px;
    padding: 8px 6px;
    text-align: center;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    color: var(--c-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.install-step.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

.check-list { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 7px; }

.check-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    font-size: 0.89rem;
}

.check-list .mark { font-weight: 700; }
.check-list .ok { color: #3f8259; }
.check-list .fail { color: #c04a5c; }
.check-list .value { margin-left: auto; color: var(--c-muted); font-size: 0.82rem; }


/* 加密文章的解锁提示与上锁条 */
.article__lockbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 22px;
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--c-primary-soft);
    font-size: 0.84rem;
    color: var(--c-primary-deep);
}

.article__lockbar svg { width: 16px; height: 16px; flex: 0 0 auto; }
.article__lockbar-form { margin-left: auto; }

.link-btn {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.locked-note {
    max-width: 480px;
    margin: 8px auto 12px;
    padding: 30px 26px;
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius);
    background: var(--c-bg);
    text-align: center;
}

.locked-note__icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
}

.locked-note__icon svg { width: 26px; height: 26px; }
.locked-note__title { margin: 0 0 8px; font-size: 1.08rem; }
.locked-note__text { color: var(--c-muted); font-size: 0.88rem; line-height: 1.7; margin-bottom: 20px; }
.locked-note__error { color: #b3545f; font-size: 0.88rem; }

.unlock-form { text-align: left; }
.unlock-form__actions { margin-top: 12px; }

/* --------------------------------------------------------------------------
   媒体查看器（图片灯箱 / 视频 / 音频 / 文档内嵌）
   -------------------------------------------------------------------------- */

body.has-viewer { overflow: hidden; }

/* 正文图片：可点放大时给个手势提示，不抢眼 */
.article__body img.is-zoomable { cursor: zoom-in; }
.article__body img.is-zoomable:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }

.viewer {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: viewer-in var(--dur) var(--ease);
}

.viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 11, 13, 0.9);
    backdrop-filter: blur(3px);
}

.viewer__stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.viewer--image.is-grabbing .viewer__stage { cursor: grabbing; }

.viewer__img {
    max-width: 92vw;
    max-height: 84vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    transition: transform 90ms linear;
    will-change: transform;
    user-select: none;
}

.viewer--image.is-zoomed .viewer__img { transition: none; cursor: grab; }

.viewer__video-wrap {
    position: relative;
    width: min(1100px, 94vw);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.viewer__video {
    width: 100%;
    max-height: 82vh;
    background: #000;
    border-radius: var(--radius);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

.viewer__caption { margin: 0; color: #e7dfe2; font-size: 0.88rem; text-align: center; }

.viewer__toolbar {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    background: rgba(28, 23, 26, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f2eaed;
}

.viewer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}

.viewer__btn:hover { background: rgba(255, 255, 255, 0.14); }
.viewer__btn svg { width: 19px; height: 19px; }

.viewer__zoom {
    min-width: 46px;
    text-align: center;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: #cfc4c8;
}

.viewer__count { font-size: 0.78rem; color: #cfc4c8; padding: 0 4px; font-variant-numeric: tabular-nums; }

.viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: rgba(28, 23, 26, 0.72);
    color: #f2eaed;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
}

.viewer__nav:hover { background: rgba(28, 23, 26, 0.95); }
.viewer__nav svg { width: 22px; height: 22px; }
.viewer__nav--prev { left: 20px; }
.viewer__nav--next { right: 20px; }

@keyframes viewer-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 正文里的附件卡片：视频 / 音频 / 文档 / 压缩包 */
.embed {
    margin: 26px 0;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    overflow: hidden;
}

.embed__video { position: relative; background: #000; }
.embed__video video { display: block; width: 100%; max-height: 62vh; background: #000; }

.embed__expand {
    position: absolute;
    right: 10px;
    top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(18, 14, 16, 0.7);
    color: #f2eaed;
    cursor: pointer;
}

.embed__expand svg { width: 17px; height: 17px; }
.embed__expand:hover { background: rgba(18, 14, 16, 0.92); }

.embed__audio { padding: 14px 16px; }
.embed__audio audio { width: 100%; display: block; }

.embed__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
}

.embed__head:hover { background: var(--c-bg); color: inherit; }

.embed__icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
}

.embed__icon svg { width: 20px; height: 20px; }

/* 名称与类型是 <span>，必须转成块级才能上下排列；
   否则文件名会跟"PDF 文档"挤在同一行，看起来像文件名后面接了乱码。 */
.embed__info { min-width: 0; display: block; }
.embed__name { display: block; font-weight: 600; font-size: 0.94rem; line-height: 1.4; word-break: break-all; }
.embed__meta { display: block; font-size: 0.78rem; color: var(--c-muted); margin-top: 2px; }
.embed__action { margin-left: auto; font-size: 0.82rem; color: var(--c-primary-deep); white-space: nowrap; }

.embed__pdf { width: 100%; height: min(78vh, 760px); border: 0; display: block; background: var(--c-bg); }
.embed--pdf .embed__head { border-bottom: 1px solid var(--c-border); }

/* 正文里的图片墙（图集） */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin: 26px 0;
}

.gallery__item {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    background: var(--c-bg);
}

.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease); }
.gallery__item:hover img { transform: scale(1.04); }
.gallery__item:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* 后台附件存储 */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }

.attach-item {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.attach-item__preview {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-bg);
    overflow: hidden;
    position: relative;
}

.attach-item__preview img { width: 100%; height: 100%; object-fit: cover; }
.attach-item__preview video { width: 100%; height: 100%; object-fit: cover; }
.attach-item__glyph { color: var(--c-muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.attach-item__glyph svg { width: 34px; height: 34px; }
.attach-item__ext { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-primary-deep); }

.attach-item__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.attach-item__name { font-size: 0.84rem; font-weight: 600; line-height: 1.4; word-break: break-all; margin: 0; }
.attach-item__meta { font-size: 0.74rem; color: var(--c-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.attach-item__foot { margin-top: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* 附件处理面板（图片转格式 / 视频轻量化）。
   .attach-item 是 flex column、卡片本身只有 ~168px 宽，面板塞在里面会被
   挤成一条竖排文字（下拉框和输入框都展不开）。所以打开时让**卡片自己**
   跨满整行，面板才有一整行的宽度可用。 */
.attach-item:has(.attach-optimize:not([hidden])) {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
}

/* 跨行时预览图不再撑满，固定成缩略图尺寸 */
.attach-item:has(.attach-optimize:not([hidden])) .attach-item__preview {
    width: 168px;
    flex: 0 0 168px;
}

.attach-item:has(.attach-optimize:not([hidden])) .attach-item__body {
    flex: 1 1 auto;
    min-width: 0;
}

.attach-optimize {
    margin-top: 10px;
    padding: 12px 13px 13px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    display: grid;
    gap: 7px;
}

.attach-optimize[hidden] { display: none; }

.attach-optimize__title {
    margin: 0 0 2px;
    font-weight: 650;
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.attach-optimize__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 9px; }
.attach-optimize__row .field__label { margin-bottom: 3px; }
.attach-optimize .input { width: 100%; }
.attach-optimize .btn { justify-self: start; margin-top: 2px; }

/* 窄屏上没有横向空间可借，卡片保持竖向堆叠，面板自然占满卡宽 */
@media (max-width: 640px) {
    .attach-item:has(.attach-optimize:not([hidden])) { flex-direction: column; gap: 0; }
    .attach-item:has(.attach-optimize:not([hidden])) .attach-item__preview {
        width: auto;
        flex: 0 0 auto;
    }
    .attach-optimize__row { grid-template-columns: minmax(0, 1fr); }
    .attach-optimize .input { max-width: 220px; }
}

.attach-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
}

.attach-upload { display: grid; gap: 10px; }

/* 人机验证：多种题型的公共壳 + 各题型的专属块 */
.human-check__prompt { font-size: 0.9rem; color: var(--c-text); margin: 8px 0 12px; font-weight: 600; }
.human-check__prompt code { font-size: 0.86rem; }
.human-check__seq {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    letter-spacing: 0.22em;
    padding: 12px 14px;
    background: var(--c-surface);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    word-break: break-all;
    text-align: center;
}
.human-check__expr {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 650;
    color: var(--c-ink);
    padding: 10px 0;
    letter-spacing: 0.06em;
}
.human-check__option.is-correct { border-color: var(--c-primary); background: var(--c-primary-soft); }
.human-check__option.is-wrong { border-color: #c2707d; background: #fbe9ec; }
.human-check__picked { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; min-height: 30px; }
.human-check__picked-item {
    font-family: var(--font-mono);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-size: 0.86rem;
}

.human-check__slider { display: flex; align-items: center; gap: 14px; }
.human-check__slider input[type="range"] { flex: 1; accent-color: var(--c-primary); }
.human-check__slider-value { font-variant-numeric: tabular-nums; font-size: 0.86rem; color: var(--c-muted); min-width: 44px; text-align: right; }

/* 顶部导航里的下拉分组 */
/* 顶部导航里的下拉分组：真正的样式在上面的「导航下拉子菜单」一段。
   这里曾经还有一套 .nav__group-toggle / .nav__sub / .is-open 的旧实现，
   但视图早就不吐这些类名了 —— 两套规则同时存在只会让人以为改哪套都行。 */

/* 明暗切换按钮 */
.scheme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--c-text);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.scheme-toggle:hover { border-color: var(--c-primary); color: var(--c-primary-deep); }
.scheme-toggle svg { width: 18px; height: 18px; }
.scheme-toggle .scheme-toggle__sun { display: none; }
:root[data-scheme="dark"] .scheme-toggle .scheme-toggle__sun { display: block; }
:root[data-scheme="dark"] .scheme-toggle .scheme-toggle__moon { display: none; }

/* 友情链接 */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

.link-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.link-card:hover { border-color: var(--c-primary); color: inherit; }
.link-card__logo {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    object-fit: cover;
    background: var(--c-bg);
}

.link-card__logo--letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--c-primary-deep);
    background: var(--c-primary-soft);
    border-color: transparent;
}

.link-card__name { font-weight: 650; font-size: 0.98rem; display: flex; align-items: center; gap: 6px; }
.link-card__name svg { width: 13px; height: 13px; color: var(--c-muted); }
.link-card__desc { font-size: 0.83rem; color: var(--c-muted); margin-top: 3px; line-height: 1.5; }
.link-card__host {
    font-size: 0.74rem;
    color: var(--c-muted);
    margin-top: 5px;
    /* 域名优先按点断行；break-all 会把 example.com 劈成 exa/mple.com */
    overflow-wrap: anywhere;
}

.link-self { border-color: var(--c-primary); }

/* 文章解锁表单 */
.unlock-form { max-width: 420px; }
.unlock-form .field__hint { margin-top: 6px; }

/* AI 结构与分析面板 */
.outline-map { display: grid; gap: 14px; }
.outline-root {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-weight: 650;
    font-size: 0.9rem;
    justify-self: start;
}
.outline-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.outline-branch { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px 14px; background: var(--c-surface); }
.outline-branch__title { font-weight: 650; font-size: 0.9rem; margin: 0 0 8px; }
.outline-branch ul { margin: 0; padding-left: 1.1em; display: grid; gap: 5px; font-size: 0.84rem; color: var(--c-muted); }

.ai-panel { border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); padding: 16px 18px; margin-bottom: 18px; }
.ai-panel__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ai-panel__head svg { width: 17px; height: 17px; color: var(--c-primary-deep); }
.ai-panel__title { font-weight: 650; font-size: 0.92rem; margin: 0; }
.ai-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .layout,
    .layout--left,
    .layout--none { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .layout--left > .layout__content,
    .layout--left > .sidebar { order: initial; }
    .sidebar { position: static; }
    .layout--none > .sidebar { display: grid; }
    .reading { grid-template-columns: minmax(0, 1fr); }
    .reading__toc { position: static; border-left: 0; padding-left: 0; }
    .editor-layout { grid-template-columns: minmax(0, 1fr); }
    .logo-picker { grid-template-columns: minmax(0, 1fr); }
    .cover-picker__row { grid-template-columns: minmax(0, 1fr); }
    .cover-picker__grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }

    .admin-shell { grid-template-columns: minmax(0, 1fr); }
    .admin-side {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--c-border);
    }
    .admin-menu { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); display: grid; }
}

@media (max-width: 860px) {
    .feature { grid-template-columns: minmax(0, 1fr); }
    .feature__media img { min-height: 190px; aspect-ratio: 21 / 9; }
    /* 单栏时字形列不参与头版（它只属于列表行），正文直接用 --rail 起排，
       并跟同断点下的 .post-item 行内缩进保持一致。 */
    .feature__body { padding: 26px calc(var(--rail) - 1px); }
}

@media (max-width: 760px) {
    :root { --fs-body: 16px; }

    .container { padding: 0 16px; }

    /* 通用内边距放在本块最前面。这一块里既有 `.card` 这类通用规则，
       也有 `.post-item` / `.feature` 这类组件规则，二者都只由 1 个类名
       选择，写在后面的胜出。原来通用规则排在最末，把组件的
       `padding: 16px 0` / `.feature { padding: 0 }` 全部盖掉——
       表现是列表密度调整"改了没效果"、头版卡片里再套一层内边距。
       通用在前、组件在后，意图才真正生效。 */
    .card { padding: 18px; }
    .article { padding: 22px 17px; border-radius: var(--radius-sm); }
    .comments, .related { padding: 20px 17px; border-radius: var(--radius-sm); }

    /* ---- 移动端一篇文章：一行 20 字左右，行高松一点，读着不累 ---- */
    .reading { gap: 20px; }
    .article__header { margin-bottom: 18px; }

    .article__title { font-size: 1.34rem; line-height: 1.4; margin-bottom: 10px; }
    .article__meta { gap: 7px; font-size: 0.78rem; }
    .article__meta .dot { display: none; }
    .article__meta > span, .article__meta > time { white-space: nowrap; }

    /* 封面别用 16:9 切掉主体，手机上改 3:2 全景一点，并贴边出血 */
    .article__cover { margin: 0 -17px 20px; border-left: 0; border-right: 0; border-radius: 0; }
    .article__cover img { aspect-ratio: 3 / 2; max-height: none; }

    .article__body { font-size: 1.02rem; line-height: 1.9; }
    .article__body h2 { font-size: 1.16rem; margin: 1.9em 0 0.6em; }
    .article__body h3 { font-size: 1.04rem; margin: 1.5em 0 0.5em; }

    .article__body blockquote { padding-left: 14px; font-size: 0.98rem; }
    .article__body ul, .article__body ol { padding-left: 1.2em; }

    .article__body .code-block {
        margin: 1.4em -17px;
        padding: 14px 17px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        font-size: 0.82rem;
    }

    /* 表格：贴边横滑，给个滑动提示的阴影 */
    .article__body .table-wrap {
        margin: 1.4em -17px;
        padding: 0 17px;
        background:
            linear-gradient(90deg, var(--c-surface) 30%, rgba(255,255,255,0)) left / 22px 100% no-repeat local,
            linear-gradient(270deg, var(--c-surface) 30%, rgba(255,255,255,0)) right / 22px 100% no-repeat local;
    }
    .article__body table { font-size: 0.86rem; min-width: 100%; width: auto; }
    .article__body th, .article__body td { padding: 8px 10px; white-space: nowrap; }

    /* 目录：手机上是折叠的，别一进来就占掉半屏 */
    .toc--inline { margin-bottom: 20px; }
    .toc--inline ol { max-height: 42vh; overflow-y: auto; }

    /* 操作按钮：够一行摆开，手指点得中（最小 40px） */
    .article__actions { gap: 8px; }
    .like-btn, .action-btn { padding: 9px 14px; font-size: 0.82rem; min-height: 40px; }

    .article__footer { margin-top: 26px; padding-top: 18px; gap: 14px; }
    .tag-row { gap: 6px; }

    .prevnext { gap: 10px; }
    .prevnext__item { padding: 13px 15px; }

    .related__list li { padding: 12px 0; }

    /* 相关阅读 / 评论区跟正文保持同一套缩进（内边距在上面的通用区） */
    .comment { padding: 14px 0; }
    .comment__body { font-size: 0.94rem; line-height: 1.75; }
    /* 头部：.site-header__inner 同时也是 .container，两条规则同为 1 个类名，
       后写的这条胜出。原来写 `padding: 10px 0` 会把 .container 的左右 16px
       一并抹掉，于是手机端品牌与按钮贴着屏幕边缘、跟正文对不齐。
       这里显式保留左右内边距。 */
    .site-header__inner { flex-wrap: wrap; gap: 10px 12px; padding: 9px 16px; }

    .nav-toggle { display: block; }

    .nav {
        display: none;
        order: 3;
        width: 100%;
        margin: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-top: 6px;
        border-top: 1px solid var(--c-border);
    }

    .nav.is-open { display: flex; }

    /* 没脚本时的兜底：手机端 .nav 默认 display:none，而展开靠 JS 加
       .is-open —— 脚本没加载（被禁用 / 被拦 / 加载失败）就等于整站没有导航，
       手机用户连首页之外的页面都点不到。
       所以用 <html class="no-js"> 判定：head 里那段内联脚本一上来就把它
       改成 js，改不掉说明脚本真的没跑，此时把导航直接铺开、汉堡按钮藏起来。
       不搞 :target 之类的花活 —— "脚本没了"已经够糟，兜底就该越笨越可靠。 */
    html.no-js .nav-toggle { display: none; }
    html.no-js .nav { display: flex; }

    .search { order: 4; width: 100%; min-width: 0; }

    /* ---- 列表与头版：手机上要能一眼扫过，别一条占掉一整屏 ---- */
    .post-list { border-top: 0; }

    /* 手机端：缩略图在右、固定小尺寸，正文占左边。
       原来封面横跨整行 16:9，一条 342px，第一屏看不到第二篇。 */
    /* 手机端字形列隐藏，正文直接落在 --rail 上；
       头版在这个断点（见 860px）也用 --rail，两者仍然同一条线。 */
    .post-item {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 16px var(--rail);
    }

    /* 手机端竖排，缩略图列不再占用左边，正文不需要再补字形那一份 */
    .post-item:has(.post-item__thumb) { padding-left: var(--rail); }

    .post-item:has(.post-item__thumb) { grid-template-columns: minmax(0, 1fr) 104px; }

    .post-item__glyph { display: none; }

    .post-item__thumb {
        width: 104px;
        aspect-ratio: 3 / 2;
        border-radius: var(--radius-sm);
    }

    .post-item:has(.post-item__thumb) .post-item__body {
        grid-column: 1;
        padding-right: 14px;
        align-self: start;
    }

    .post-item__line { gap: 7px; margin-bottom: 4px; }
    .post-item__title { font-size: 1.02rem; line-height: 1.45; margin-bottom: 4px; }
    .post-item__summary {
        font-size: 0.86rem;
        line-height: 1.62;
        margin-bottom: 8px;
        -webkit-line-clamp: 2;
    }
    /* 小屏上标签挤在脚注里会换行成两排，只留阅读时长与浏览量 */
    .post-item__foot .tag-link { display: none; }
    .post-item__foot { gap: 8px; font-size: 0.76rem; }
    .post-item__date, .post-item__year { font-size: 0.76rem; }

    /* .feature 是 .card + padding:0 的组合。手机端 .card 的 18px 内边距
       会把它盖掉，头版于是"卡片里再套一层内边距"。这里重新压回 0，
       内边距只由 .feature__body 一处提供。 */
    .feature { padding: 0; border-radius: var(--radius); margin-bottom: 16px; }
    .feature__media img { aspect-ratio: 16 / 9; min-height: 0; }
    .feature__body { padding: 16px calc(var(--rail) - 1px) 18px; }
    .feature__kicker { font-size: 0.75rem; gap: 6px; margin-bottom: 8px; }
    .feature__title { font-size: 1.28rem; margin-bottom: 8px; }
    .feature__summary { font-size: 0.9rem; margin-bottom: 16px; -webkit-line-clamp: 3; }
    .feature__foot { gap: 12px; }
    .feature__stats { gap: 7px; font-size: 0.75rem; }

    .list-head { flex-wrap: wrap; gap: 4px 10px; margin-bottom: 14px; }
    .crumbs { font-size: 0.78rem; margin-bottom: 10px; }

    .pagination { gap: 4px; margin-top: 22px; }
    .pagination__item { min-width: 40px; height: 40px; padding: 0 12px; }

    /* 折叠菜单里的项要够大够好点，别做成 28px 的小药丸 */
    .nav__link { padding: 11px 12px; font-size: 0.97rem; }

    /* 手机上子菜单不做浮层：浮层会盖住下面的项，手指也不好定位。
       直接在父项下面缩进铺开，跟折叠菜单同一套手感。 */
    .nav__dropdown {
        position: static;
        min-width: 0;
        margin: 2px 0 2px 14px;
        padding: 2px 0 2px 10px;
        border: 0;
        border-left: 2px solid var(--c-border-strong);
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }
    .nav__dropdown__link { padding: 10px 12px; font-size: .94rem; }
    .nav__group__summary { justify-content: space-between; width: 100%; }
    .search { height: 42px; }

    .comment-form__grid { grid-template-columns: 1fr; }
    .prevnext { grid-template-columns: 1fr; }
    .prevnext__item--next { text-align: left; }
    .article__actions { gap: 7px; }
    .human-check__img { width: 100%; height: auto; max-width: 220px; }
    .human-check__input { max-width: none; }

    /* 后台两栏网格：minmax(360px, …) 在 390px 屏上必然溢出——
       面板自己还有内边距，360 的下限撑不进去。窄屏一律单列。 */
    .admin-grid-2 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .admin-main { padding: 18px 16px 48px; }
    .stat__value { font-size: 1.35rem; }

    /* 查看器在窄屏：工具条上移一点，导航箭头收小，别盖住图 */
    .viewer__toolbar { bottom: 14px; padding: 5px 8px; }
    .viewer__btn { width: 34px; height: 34px; }
    .viewer__nav { width: 40px; height: 40px; }
    .viewer__nav--prev { left: 8px; }
    .viewer__nav--next { right: 8px; }
    .viewer__img { max-width: 96vw; max-height: 76vh; }
    .viewer__video-wrap { width: 96vw; }
    .viewer__video { max-height: 70vh; }

    .gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
    .link-grid { grid-template-columns: 1fr; }
    .attach-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .embed__pdf { height: 70vh; }
    .outline-branches { grid-template-columns: 1fr; }
    .nav__sub { position: static; box-shadow: none; border: 0; padding: 0 0 0 10px; margin-top: 2px; }
    .settings-nav { margin-bottom: 16px; }
    .settings-nav__item { padding: 6px 10px; font-size: 0.79rem; }
    .attach-toolbar { gap: 8px; }
    .nav-sortable__form { margin-left: 0; width: 100%; }
    .nav-sortable__form .input { flex: 1; max-width: none !important; }
    .nav__sub a { padding: 10px 12px; font-size: 0.95rem; }

    /* ---- 触控目标：手机上把"链接/按钮"垫到手指点得中的高度 ----
       WCAG 2.5.8 要求指针目标至少 24×24，这里按 28px 起步、导航类 32px。
       正文段落里的行内链接不在此列（它们在句子里，撑高会拆散行距）。 */
    .site-footer__links { gap: 2px 14px; }
    .site-footer__links a { padding: 5px 0; min-height: 30px; display: inline-flex; align-items: center; }
    .site-footer__legal a { padding: 4px 0; min-height: 28px; display: inline-flex; align-items: center; }

    .tag-link { padding: 3px 0; }
    .side-comments__link { display: inline-block; padding: 3px 0; min-height: 26px; }
    /* 侧栏链接（关于卡片里的按钮、链接列表、归档列表）：垫到手指点得中的高度 */
    .side-link { min-height: 32px; }
    .side-list a { display: inline-flex; align-items: center; min-height: 30px; }

    /* 侧边栏卡片之间收紧一点，手机上一张卡一张卡地滚太慢 */
    .sidebar { gap: 14px; }
    .section-head { margin: 26px 0 12px; }

    /* 文章操作按钮铺满一行，别两个挤在左边一小块 */
    .article__actions { gap: 8px; }
    .like-btn, .action-btn { flex: 1 1 auto; justify-content: center; min-height: 42px; }
}

/* ==========================================================================
   语法高亮
   八套内置主题，只改颜色，不改结构。
   挂在 <html data-code-theme="..."> 上，所以换主题不用动任何一篇文章。
   变量名用 --hl-* 前缀，跟站点自己的 --c-* 分开，避免主题之间互相污染。
   ========================================================================== */

.code-block {
    --hl-bg: #fbfaf9;
    --hl-fg: #38323a;
    --hl-border: var(--c-border);
    --hl-bar: #f4f1f2;
    --hl-comment: #9a9296;
    --hl-keyword: #a34d7f;
    --hl-string: #4a7a53;
    --hl-number: #b0603a;
    --hl-function: #3f6ea8;
    --hl-variable: #8a5db0;
    --hl-constant: #a8622a;
    --hl-tag: #a34d7f;
    --hl-attr: #3f6ea8;
    --hl-punct: #857d82;
    --hl-meta: #9a9296;
    --hl-inserted: #3f7a4a;
    --hl-deleted: #b04a4a;

    margin: 1.7em 0;
    border: 1px solid var(--hl-border);
    border-radius: var(--radius);
    background: var(--hl-bg);
    overflow: hidden;
}

.code-block__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px 7px 13px;
    background: var(--hl-bar);
    border-bottom: 1px solid var(--hl-border);
    font-family: var(--font-sans);
    font-size: 0.74rem;
}

.code-block__lang {
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hl-comment);
}

.code-block__lines { color: var(--hl-comment); opacity: 0.75; }

.code-block__copy {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--hl-comment);
    font-family: inherit;
    font-size: 0.74rem;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.code-block__copy:hover { background: var(--c-surface); border-color: var(--c-border); color: var(--c-text); }
.code-block__copy-icon { width: 13px; height: 13px; }
.code-block__copy.is-done { color: #2f7a4a; border-color: transparent; }
.code-block__copy.is-done .code-block__copy-icon { display: none; }

.code-block__pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    font-family: var(--font-mono);
    font-size: 0.855rem;
    line-height: 1.62;
    color: var(--hl-fg);
}

.code-block__pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }

/* 行号：不用 <ol> 裹行，而是给每行一个计数器。
   原因是代码本身可能是任意文本，拆行会动到内容；用背景渐变 + 计数器
   可以做到"纯装饰、不碰内容"。 */
html[data-code-lines="on"] .code-block__pre code {
    counter-reset: code-line;
    display: block;
}

html[data-code-lines="on"] .code-block__pre code::before {
    counter-increment: code-line;
    content: counter(code-line);
    display: inline-block;
    width: 2.2em;
    margin-right: 0.9em;
    text-align: right;
    color: var(--hl-comment);
    opacity: 0.55;
    user-select: none;
}

html[data-code-lines="on"] .code-block__pre code > span { display: inline; }

.tok-comment { color: var(--hl-comment); font-style: italic; }
.tok-keyword { color: var(--hl-keyword); }
.tok-string { color: var(--hl-string); }
.tok-number { color: var(--hl-number); }
.tok-function { color: var(--hl-function); }
.tok-variable { color: var(--hl-variable); }
.tok-constant { color: var(--hl-constant); }
.tok-tag { color: var(--hl-tag); }
.tok-attr { color: var(--hl-attr); }
.tok-punct { color: var(--hl-punct); }
.tok-meta { color: var(--hl-meta); }
.tok-inserted { color: var(--hl-inserted); }
.tok-deleted { color: var(--hl-deleted); }

/* --- 主题：只覆盖颜色 --- */

html[data-code-theme="paper"] .code-block {
    --hl-bg: #fdfcfa; --hl-fg: #3a343b; --hl-bar: #f6f3f1;
    --hl-keyword: #a34d7f; --hl-string: #3f7350; --hl-number: #a86339; --hl-function: #3d6a9c;
}

html[data-code-theme="midnight"] .code-block {
    --hl-bg: #191519; --hl-fg: #e6dfe3; --hl-border: #2e272d; --hl-bar: #221c21;
    --hl-comment: #7a7079; --hl-keyword: #e39ab8; --hl-string: #93c39b;
    --hl-number: #e0a878; --hl-function: #8fb6e6; --hl-variable: #c3a0e6;
    --hl-constant: #e0b878; --hl-tag: #e39ab8; --hl-attr: #8fb6e6; --hl-punct: #8a8089;
}

html[data-code-theme="github"] .code-block {
    --hl-bg: #ffffff; --hl-fg: #24292f; --hl-border: #d8dee4; --hl-bar: #f6f8fa;
    --hl-comment: #6e7781; --hl-keyword: #cf222e; --hl-string: #0a3069;
    --hl-number: #0550ae; --hl-function: #8250df; --hl-variable: #953800;
    --hl-constant: #0550ae; --hl-tag: #116329; --hl-attr: #0550ae; --hl-punct: #57606a;
}

html[data-code-theme="onedark"] .code-block {
    --hl-bg: #282c34; --hl-fg: #abb2bf; --hl-border: #3a4049; --hl-bar: #21252b;
    --hl-comment: #5c6370; --hl-keyword: #c678dd; --hl-string: #98c379;
    --hl-number: #d19a66; --hl-function: #61afef; --hl-variable: #e06c75;
    --hl-constant: #d19a66; --hl-tag: #e06c75; --hl-attr: #d19a66; --hl-punct: #abb2bf;
}

html[data-code-theme="dracula"] .code-block {
    --hl-bg: #282a36; --hl-fg: #f8f8f2; --hl-border: #3d4052; --hl-bar: #21222c;
    --hl-comment: #6272a4; --hl-keyword: #ff79c6; --hl-string: #f1fa8c;
    --hl-number: #bd93f9; --hl-function: #50fa7b; --hl-variable: #8be9fd;
    --hl-constant: #bd93f9; --hl-tag: #ff79c6; --hl-attr: #50fa7b; --hl-punct: #f8f8f2;
}

html[data-code-theme="nord"] .code-block {
    --hl-bg: #2e3440; --hl-fg: #d8dee9; --hl-border: #3b4252; --hl-bar: #292e39;
    --hl-comment: #616e88; --hl-keyword: #81a1c1; --hl-string: #a3be8c;
    --hl-number: #b48ead; --hl-function: #88c0d0; --hl-variable: #d8dee9;
    --hl-constant: #b48ead; --hl-tag: #81a1c1; --hl-attr: #8fbcbb; --hl-punct: #81a1c1;
}

html[data-code-theme="solarized"] .code-block {
    --hl-bg: #fdf6e3; --hl-fg: #657b83; --hl-border: #eee8d5; --hl-bar: #f5efdc;
    --hl-comment: #93a1a1; --hl-keyword: #859900; --hl-string: #2aa198;
    --hl-number: #d33682; --hl-function: #268bd2; --hl-variable: #b58900;
    --hl-constant: #cb4b16; --hl-tag: #268bd2; --hl-attr: #b58900; --hl-punct: #839496;
}

html[data-code-theme="monokai"] .code-block {
    --hl-bg: #272822; --hl-fg: #f8f8f2; --hl-border: #3b3c35; --hl-bar: #1e1f1a;
    --hl-comment: #75715e; --hl-keyword: #f92672; --hl-string: #e6db74;
    --hl-number: #ae81ff; --hl-function: #a6e22e; --hl-variable: #fd971f;
    --hl-constant: #ae81ff; --hl-tag: #f92672; --hl-attr: #a6e22e; --hl-punct: #f8f8f2;
}

/* ==========================================================================
   表格
   ========================================================================== */

.md-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.895rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.md-table th,
.md-table td {
    padding: 9px 13px;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
    vertical-align: top;
}

.md-table thead th {
    background: var(--c-bg);
    font-weight: 650;
    font-size: 0.83rem;
    letter-spacing: 0.02em;
    color: var(--c-text);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.md-table tbody tr:last-child td { border-bottom: 0; }
.md-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--c-bg) 60%, transparent); }
.md-table tbody tr:hover { background: var(--c-primary-soft); }
.md-table .is-center { text-align: center; }
.md-table .is-right { text-align: right; }

/* ==========================================================================
   正文里的提示块 / 折叠块 / 标签页 / 链接卡
   ========================================================================== */

.callout {
    margin: 1.6em 0;
    padding: 13px 16px;
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-muted);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    font-size: 0.93rem;
}

.callout__title { margin: 0 0 6px; font-weight: 650; font-size: 0.92rem; }
.callout__body > :first-child { margin-top: 0; }
.callout__body > :last-child { margin-bottom: 0; }

.callout--info { border-left-color: var(--c-primary); background: var(--c-primary-soft); }
.callout--info .callout__title { color: var(--c-primary-deep); }
.callout--warn { border-left-color: #d99b4a; background: #fdf8ef; }
.callout--warn .callout__title { color: #8a6320; }
.callout--aside { border-left-color: var(--c-border-strong); }

html[data-scheme="dark"] .callout--warn { background: #2b2418; }
html[data-scheme="dark"] .callout--warn .callout__title { color: #e0bd7d; }
html[data-scheme="dark"] .callout--info { background: var(--c-primary-soft); }

.callout--details { border-left-color: var(--c-border-strong); padding: 0; background: var(--c-surface); }
.callout--details > .callout__summary {
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 650;
    font-size: 0.9rem;
    list-style: none;
}
.callout--details > .callout__summary::-webkit-details-marker { display: none; }
.callout--details > .callout__summary::before {
    content: "";
    display: inline-block;
    width: 0; height: 0;
    margin-right: 8px;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform var(--dur-fast) var(--ease);
}
.callout--details[open] > .callout__summary::before { transform: rotate(90deg); }
.callout--details > .callout__body { padding: 0 16px 14px; }

/* 标签页：radio + CSS，没有 JS 时全部内容依次展开，不会"点不动就看不到" */
.tabs { margin: 1.7em 0; border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.tabs__radio { position: absolute; opacity: 0; pointer-events: none; }
.tabs__label {
    display: inline-block;
    padding: 9px 15px;
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--c-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tabs__label:hover { color: var(--c-text); }
.tabs__panel {
    display: none;
    padding: 15px 17px;
    border-top: 1px solid var(--c-border);
    font-size: 0.94rem;
}
.tabs__panel > :first-child { margin-top: 0; }
.tabs__panel > :last-child { margin-bottom: 0; }

.tabs__radio:nth-of-type(1):checked ~ .tabs__label:nth-of-type(1),
.tabs__radio:nth-of-type(2):checked ~ .tabs__label:nth-of-type(2),
.tabs__radio:nth-of-type(3):checked ~ .tabs__label:nth-of-type(3),
.tabs__radio:nth-of-type(4):checked ~ .tabs__label:nth-of-type(4),
.tabs__radio:nth-of-type(5):checked ~ .tabs__label:nth-of-type(5),
.tabs__radio:nth-of-type(6):checked ~ .tabs__label:nth-of-type(6) {
    color: var(--c-primary-deep);
    border-bottom-color: var(--c-primary);
}

.tabs__radio:nth-of-type(1):checked ~ .tabs__panel:nth-of-type(1),
.tabs__radio:nth-of-type(2):checked ~ .tabs__panel:nth-of-type(2),
.tabs__radio:nth-of-type(3):checked ~ .tabs__panel:nth-of-type(3),
.tabs__radio:nth-of-type(4):checked ~ .tabs__panel:nth-of-type(4),
.tabs__radio:nth-of-type(5):checked ~ .tabs__panel:nth-of-type(5),
.tabs__radio:nth-of-type(6):checked ~ .tabs__panel:nth-of-type(6) {
    display: block;
}

/* 链接卡：不抓取外部内容，只展示域名与路径 */
.embed-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.6em 0;
    padding: 13px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: inherit;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.embed-link:hover { border-color: var(--c-primary); background: var(--c-primary-soft); color: inherit; }
.embed-link__icon { flex: 0 0 auto; color: var(--c-muted); display: inline-flex; }
.embed-link__icon .embed__icon { width: 20px; height: 20px; }
.embed-link__body { min-width: 0; display: grid; gap: 2px; }
.embed-link__host { font-weight: 650; font-size: 0.9rem; }
.embed-link__path { font-size: 0.8rem; color: var(--c-muted); word-break: break-all; }
.embed-link__arrow { flex: 0 0 auto; margin-left: auto; width: 8px; height: 8px; border-top: 1.6px solid currentColor; border-right: 1.6px solid currentColor; transform: rotate(45deg); opacity: 0.5; }
.embed-link::after { display: none; }

.embed--image { margin: 1.7em 0; }
.embed--image .embed__image-link { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--c-border); }
.embed--image img { display: block; width: 100%; height: auto; }
.embed__caption { margin-top: 8px; text-align: center; font-size: 0.82rem; color: var(--c-muted); }

/* 标题锚点（插件加的）：悬停才出现，不干扰阅读 */
.heading-anchor {
    margin-left: 8px;
    opacity: 0;
    color: var(--c-muted);
    transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.article__body h2:hover .heading-anchor,
.article__body h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--c-primary); }
.heading-anchor svg { width: 0.78em; height: 0.78em; vertical-align: baseline; }

.post-plugin-reading {
    margin: 0 0 20px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    font-size: 0.84rem;
    color: var(--c-muted);
}

/* ==========================================================================
   文章页：可开关的侧边栏
   ========================================================================== */

/* align-items: start —— 不写的话 grid 默认 stretch，侧栏会被拉到和正文一样高，
   里面的卡片跟着一起膨胀，第一张卡下面拖出一大片空白。
   首页/归档的 .layout 本来就写了 start，只有文章页漏了。 */
.article-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; align-items: start; }
.article-shell.article-layout { grid-template-columns: minmax(0, 1fr) 300px; }
.article-shell.article-layout--left { grid-template-columns: 300px minmax(0, 1fr); }
.article-shell.article-layout--left > .article-wrap { order: 2; }
.article-shell.article-layout--left > .sidebar { order: 1; }

/* 带侧栏时正文版心收窄：手里有一条 720px 的正文列，再留 300px 侧栏，
   在 1440px 的屏幕上刚好，中间不需要额外留白。
 *
 * 这里有两个必须一起改的地方，改一个不解一个就会出问题：
 *
 * 1) 侧栏版式下，卡片内的目录是多余的（真正的目录已经在侧栏那一栏里），
 *    所以要 display: none。
 * 2) 但 `display: none` 的元素**仍然留在 DOM 里**，`.reading:has(.reading__toc)`
 *    照样命中。上面那条 1000px 断点于是继续给一个已经看不见的目录
 *    留出 168px + 36px 间距 —— 正文列被压成 516px，正文只剩 434px 一行，
 *    右边空出 340px。阅读页本来是"一行 20 字"的设计，被挤成了
 *    "一行 12 字还提前换行"。
 *
 * 所以单栏化必须显式写死，不能指望 :has() 自己发现目录没了。
 * 同一条规则里把列定义收回单列，正文才能重新拿满 720px。 */
.article-shell.article-layout .reading { grid-template-columns: minmax(0, var(--measure)); }
.article-shell.article-layout .reading__toc { display: none; }
.article-shell.article-layout .article-wrap { max-width: var(--measure); }

/* ==========================================================================
   动态（朋友圈）
   ========================================================================== */

.moment-intro {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 22px;
    margin-bottom: 22px;
}
.moment-intro__avatar { flex: 0 0 auto; }
.moment-intro__avatar img { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }
.moment-intro__avatar svg { width: 56px; height: 56px; border-radius: 14px; }
.moment-intro__name { margin: 0; font-weight: 700; font-size: 1.05rem; }
.moment-intro__bio { margin: 5px 0 0; color: var(--c-muted); font-size: 0.9rem; line-height: 1.7; }
.moment-intro__meta { margin: 8px 0 0; font-size: 0.79rem; color: var(--c-muted); }

.moments { list-style: none; margin: 0; padding: 0; }

.moment { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 14px; }

/* 时间轴：一条竖线 + 一个点，靠 ::after 连到下一张卡。
   最后一项不画线，否则列表末尾会拖出一截悬空的线。 */
.moment__rail { position: relative; display: flex; justify-content: center; padding-top: 22px; }
.moment__rail::after {
    content: "";
    position: absolute;
    top: 30px; bottom: -22px; left: 50%;
    width: 1px;
    background: var(--c-border);
    transform: translateX(-50%);
}
.moment:last-child .moment__rail::after { display: none; }
.moment__dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--c-surface);
    border: 2px solid var(--c-primary);
    z-index: 1;
}

.moment__card { margin-bottom: 18px; padding: 18px 20px; }
.moment__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.moment__avatar img, .moment__avatar svg { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; display: block; }
.moment__who { display: grid; gap: 1px; min-width: 0; }
.moment__name { font-weight: 650; font-size: 0.94rem; }
.moment__time { font-size: 0.77rem; color: var(--c-muted); }
.moment__anchor { margin-left: auto; color: var(--c-muted); opacity: 0.6; transition: opacity var(--dur-fast) var(--ease); }
.moment__anchor:hover { opacity: 1; color: var(--c-primary); }
.moment__anchor svg { width: 15px; height: 15px; }

.moment__body { margin: 0 0 12px; font-size: 0.98rem; line-height: 1.82; }
.moment--single .moment__content { font-size: 1rem; }

.moment__media { display: grid; gap: 5px; margin-bottom: 12px; }
.moment__media--single { grid-template-columns: 1fr; max-width: 420px; }
.moment__media--few { grid-template-columns: repeat(3, 1fr); }
.moment__media--grid { grid-template-columns: repeat(3, 1fr); }

.moment__photo {
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
}
.moment__media--single .moment__photo { aspect-ratio: auto; }
.moment__media--single .moment__photo img { width: 100%; height: auto; }
.moment__photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--dur) var(--ease); }
.moment__photo:hover img { transform: scale(1.04); }

.moment__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.8rem; color: var(--c-muted); }
.moment__stat { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.moment__stat svg { width: 14px; height: 14px; }
.moment__stat:hover { color: var(--c-primary-deep); }
.moment--single .moment__foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-border); gap: 9px; }

/* ==========================================================================
   文档
   ========================================================================== */

/* --------------------------------------------------------------------------
   文档：Plume 式侧边目录树
   --------------------------------------------------------------------------
   侧栏是三段式：固定头（标题 + 收起）、搜索框、可滚动列表。
   固定头 + 滚动列表（而不是整根侧栏一起滚）是为了让"搜索文档标题"
   在滚到第 40 条时还看得见——搜索框滚出视口，这个功能就等于没有。
   -------------------------------------------------------------------------- */

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
.doc-layout--tree { grid-template-columns: 268px minmax(0, 1fr); }
.doc-layout--tree:has(.doc-toc) { grid-template-columns: 268px minmax(0, 1fr) 168px; }

.doc-index { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.doc-index--tree { grid-template-columns: 268px minmax(0, 1fr); }
.doc-index__main { min-width: 0; }
/* 正文里的本页目录只给窄屏用。宽屏时右栏已经有同样的列表，
   两处都显示等于把一份目录抄了两遍。 */
.toc--mobile { display: none; }
@media (max-width: 1000px) {
    .toc--mobile { display: block; }
}
/* 收起侧栏：只留一条竖着的按钮，正文吃满。宽屏才有意义，窄屏本来就是抽屉。 */
.doc-layout--collapsed.doc-layout--tree { grid-template-columns: 40px minmax(0, 1fr); }
.doc-layout--collapsed.doc-layout--tree:has(.doc-toc) { grid-template-columns: 40px minmax(0, 1fr) 168px; }
.doc-layout--collapsed .doc-side__search,
.doc-layout--collapsed .doc-side__scroll { display: none; }
.doc-layout--collapsed .doc-side__head { padding: 12px 5px; justify-content: center; }
.doc-layout--collapsed .doc-side__home span { display: none; }
.doc-layout--collapsed .doc-side__toggle svg { transform: rotate(180deg); }
@media (max-width: 1000px) {
    /* 窄屏收起状态没意义，抽屉必须能整个打开 */
    .doc-layout--collapsed.doc-layout--tree,
    .doc-layout--collapsed.doc-layout--tree:has(.doc-toc) { grid-template-columns: minmax(0, 1fr); }
    .doc-layout--collapsed .doc-side__search { display: block; }
    .doc-layout--collapsed .doc-side__scroll { display: block; }
    .doc-layout--collapsed .doc-side__head { padding: 12px 14px; justify-content: space-between; }
    .doc-layout--collapsed .doc-side__home span { display: inline; }
}

.doc-side {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    position: sticky;
    top: 84px;
    /* 上限跟着视口走，但留出页头 + 底部一点余量，避免最后一列被压到看不见 */
    max-height: calc(100vh - 108px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.doc-side__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--c-border);
    flex: none;
}
.doc-side__home {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 650;
    font-size: 0.9rem;
    color: var(--c-text);
    min-width: 0;
}
.doc-side__home svg { width: 16px; height: 16px; color: var(--c-primary-deep); flex: none; }
.doc-side__home span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-side__home:hover { color: var(--c-primary-deep); }

.doc-side__toggle {
    flex: none;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    color: var(--c-muted);
    cursor: pointer;
    transition: transform 140ms linear, color 140ms linear, border-color 140ms linear;
}
.doc-side__toggle svg { width: 15px; height: 15px; }
.doc-side__toggle:hover { color: var(--c-primary-deep); border-color: var(--c-primary-soft); }

/* 搜索框 */
.doc-side__search { position: relative; padding: 10px 12px; flex: none; border-bottom: 1px solid var(--c-border); }
.doc-side__search-icon {
    position: absolute;
    left: 21px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--c-muted);
    pointer-events: none;
}
.doc-side__search-input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 30px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    font: inherit;
    font-size: 0.85rem;
    color: var(--c-text);
    -webkit-appearance: none;
    appearance: none;
}
.doc-side__search-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.doc-side__search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.doc-side__scroll { overflow-y: auto; overscroll-behavior: contain; padding: 8px 8px 12px; flex: 1 1 auto; min-height: 0; }

.doc-side__group + .doc-side__group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--c-border); }
.doc-side__group-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin: 0 0 4px;
    padding: 4px 6px;
    font-size: 0.73rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--c-muted);
}
.doc-side__group-count { font-size: 0.7rem; font-weight: 500; opacity: 0.7; }
.doc-side__list, .doc-tree__children { list-style: none; margin: 0; padding: 0; }
.doc-tree__children { padding-left: 10px; border-left: 1px solid var(--c-border); margin-left: 9px; }

.doc-tree__item { min-width: 0; }
.doc-tree__row { display: flex; align-items: center; gap: 2px; }
/* details 的 summary 不能有 display:flex 之外的花样：Safari 上 summary
   设了 display 就会丢掉默认的三角，所以自己画。 */
details.doc-tree__branch > summary { list-style: none; cursor: pointer; }
details.doc-tree__branch > summary::-webkit-details-marker { display: none; }
details.doc-tree__branch > summary::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    margin-left: 2px;
    background: currentColor;
    color: var(--c-muted);
    /* 用 CSS 画一个小三角，不依赖字体里有没有 ▸ */
    clip-path: polygon(35% 20%, 35% 80%, 75% 50%);
    transition: transform 140ms linear;
    transform-origin: 55% 50%;
}
details.doc-tree__branch[open] > summary::before { transform: rotate(90deg); }

.doc-tree__link {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.855rem;
    color: var(--c-text);
    line-height: 1.45;
    min-width: 0;
    transition: background 130ms linear, color 130ms linear;
}
.doc-tree__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tree__link:hover { background: var(--c-bg); color: var(--c-primary-deep); }
.doc-tree__link.is-current {
    background: var(--c-primary-soft);
    color: var(--c-primary-deep);
    font-weight: 650;
    /* 当前项左边一道竖线，扫一眼就知道"我在哪一页" */
    box-shadow: inset 2px 0 0 var(--c-primary);
}
.doc-tree__lock { width: 12px; height: 12px; flex: none; opacity: 0.6; }
.doc-tree__ver, .doc-tree__count {
    flex: none;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    color: var(--c-muted);
}
.doc-side__empty, .doc-side__nomatch {
    margin: 10px 6px;
    font-size: 0.83rem;
    color: var(--c-muted);
    line-height: 1.7;
}

/* 抽屉按钮与遮罩：只在窄屏出现（见下方 @media） */
.doc-drawer-btn { display: none; }
.doc-scrim { display: none; }

.doc-article { padding: 34px 38px; }
.doc-article { padding: 34px 38px; }
.doc-body { font-size: 0.965rem; }
.doc-body h2 { margin-top: 2.1em; }

.doc-toc {
    position: sticky;
    top: 84px;
    border-left: 1px solid var(--c-border);
    padding-left: 14px;
    font-size: 0.83rem;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.doc-toc__title { margin: 0 0 8px; font-weight: 650; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-muted); }
.doc-toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.doc-toc__list a { color: var(--c-muted); display: block; line-height: 1.5; }
.doc-toc__list a:hover { color: var(--c-primary-deep); }
.doc-toc__list .toc__l3 { padding-left: 11px; font-size: 0.96em; }

.doc-group { margin-bottom: 18px; padding: 20px 22px; }
.doc-group__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--c-border); }
.doc-group__title { margin: 0; font-size: 1.06rem; }
.doc-group__count { font-size: 0.79rem; color: var(--c-muted); }
.doc-group__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.doc-entry__link { display: inline-flex; align-items: center; gap: 7px; font-size: 1rem; font-weight: 650; }
.doc-entry__summary { margin: 5px 0 0; font-size: 0.87rem; color: var(--c-muted); line-height: 1.65; }
.doc-entry__meta { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--c-muted); }
.doc-entry__kids { font-size: 0.72rem; font-weight: 500; color: var(--c-muted); }
/* 子文档在分组卡片里按层级缩进，缩进量小一点：三层以上的目录树
   每层缩进 20px，到第四层就只剩一半宽度了 */
.doc-entry--d1 { margin-left: 18px; }
.doc-entry--d2 { margin-left: 34px; }
.doc-entry--d3, .doc-entry--d4, .doc-entry--d5 { margin-left: 48px; }

.doc-cards { display: grid; gap: 18px; }

/* 正文末尾的子文档清单 */
.doc-children { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--c-border); }
.doc-children__title { margin: 0 0 12px; font-size: 0.95rem; }
.doc-children__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-children__item { padding: 11px 13px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); }
.doc-children__link { font-weight: 650; font-size: 0.94rem; }
.doc-children__summary { margin: 5px 0 0; font-size: 0.86rem; color: var(--c-muted); line-height: 1.65; }
.doc-children__more { margin: 5px 0 0; font-size: 0.76rem; color: var(--c-muted); }

.badge--ok { background: #eef7f0; border-color: #cfe6d7; color: #2f6b48; }
.badge--warn { background: #fdf8ef; border-color: #eddfc4; color: #7c5f28; }
html[data-scheme="dark"] .badge--ok { background: #1d2a21; border-color: #2c4234; color: #8fc9a4; }
html[data-scheme="dark"] .badge--warn { background: #2b2418; border-color: #43391f; color: #e0bd7d; }

.chip--lock { display: inline-flex; align-items: center; gap: 3px; background: var(--c-bg); border: 1px solid var(--c-border); color: var(--c-muted); }
.chip--lock svg { width: 11px; height: 11px; }
.doc-article__version { vertical-align: middle; font-size: 0.72rem; }

/* ==========================================================================
   文章形式与短链后台
   ========================================================================== */

.kind-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 9px; }
.kind-switch__item {
    display: flex;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.kind-switch__item:has(input:checked) { border-color: var(--c-primary); background: var(--c-primary-soft); }
.kind-switch__item input { margin-top: 3px; flex: 0 0 auto; }
.kind-switch__label { font-weight: 650; font-size: 0.88rem; }
.kind-switch__hint { display: block; margin-top: 2px; font-size: 0.76rem; color: var(--c-muted); line-height: 1.5; }

.shortlink-code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 2px 7px;
    border-radius: 3px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    word-break: break-all;
}

.sparkline { display: flex; align-items: flex-end; gap: 3px; height: 52px; }
.sparkline__bar {
    flex: 1;
    min-width: 3px;
    border-radius: 2px 2px 0 0;
    background: var(--c-primary);
    opacity: 0.35;
    transition: opacity var(--dur-fast) var(--ease);
    position: relative;
}
.sparkline__bar:hover { opacity: 0.85; }
.sparkline__bar[data-empty="1"] { background: var(--c-border); opacity: 1; }

.dist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dist-list li { display: flex; align-items: center; gap: 9px; font-size: 0.84rem; }
.dist-list__bar { flex: 1; height: 6px; border-radius: 3px; background: var(--c-bg); overflow: hidden; }
.dist-list__fill { display: block; height: 100%; background: var(--c-primary); opacity: 0.6; }
.dist-list__label { min-width: 76px; color: var(--c-muted); }
.dist-list__value { min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* 侧栏组件的排序器 */
.widget-sort { display: grid; gap: 7px; }
.widget-sort__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    cursor: grab;
    font-size: 0.87rem;
}
.widget-sort__item.is-dragging { opacity: 0.45; }
.widget-sort__item.is-over { border-color: var(--c-primary); }
.widget-sort__handle { color: var(--c-muted); display: inline-flex; cursor: grab; }
.widget-sort__handle svg { width: 14px; height: 14px; }
.widget-sort__order { margin-left: auto; font-size: 0.76rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }

/* 侧栏：数据条两种排法 */
.side-stats--grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.side-stats--grid .side-stats__item { display: grid; gap: 2px; }
.side-about__head--square .side-about__avatar { border-radius: 6px; }
.side-about__head--round .side-about__avatar { border-radius: 50%; }
.side-about__avatar { width: var(--avatar-size, 52px); height: var(--avatar-size, 52px); }
.side-link--external::after { content: "↗"; margin-left: 3px; font-size: 0.75em; opacity: 0.5; }

/* ==========================================================================
   新增块的响应式
   ========================================================================== */

/* 三栏（目录 + 正文 + 本页目录）要到 1280 才放得下：
   1180 时正文只剩 560px，文档里表格代码块多，会横滑到没法读 */
@media (max-width: 1280px) {
    .doc-layout--tree:has(.doc-toc) { grid-template-columns: 252px minmax(0, 1fr); }
    .doc-layout--tree:has(.doc-toc) .doc-toc { display: none; }
}

/* 1000 以下侧栏改成抽屉：横着再挤一列，正文就只有手机宽度了 */
@media (max-width: 1000px) {
    .doc-layout--tree, .doc-layout--tree:has(.doc-toc), .doc-index--tree { grid-template-columns: minmax(0, 1fr); }
    .doc-toc { display: none; }

    .doc-drawer-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        height: 40px;
        padding: 0 14px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius-sm);
        background: var(--c-surface);
        color: var(--c-text);
        font: inherit;
        font-size: 0.88rem;
        font-weight: 600;
        cursor: pointer;
        width: fit-content;
    }
    .doc-drawer-btn svg { width: 16px; height: 16px; color: var(--c-primary-deep); }

    .doc-layout--tree > .doc-side, .doc-index--tree > .doc-side {
        position: fixed;
        z-index: 60;
        top: 0;
        left: 0;
        height: 100dvh;
        max-height: none;
        width: min(320px, 86vw);
        border-radius: 0;
        border: 0;
        border-right: 1px solid var(--c-border);
        transform: translateX(-102%);
        transition: transform 180ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.02);
    }
    .doc-layout--tree.is-drawer-open > .doc-side,
    .doc-index--tree.is-drawer-open > .doc-side { transform: none; }

    .doc-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(0, 0, 0, 0.32);
        border: 0;
        padding: 0;
    }
    .doc-scrim[hidden] { display: none; }

    .doc-side__toggle { display: none; }
}

@media (max-width: 1024px) {
    .article-shell.article-layout,
    .article-shell.article-layout--left { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    .article-shell.article-layout--left > .article-wrap,
    .article-shell.article-layout--left > .sidebar { order: initial; }
    .article-shell.article-layout .reading__toc { display: block; }
    .article-shell.article-layout .article-wrap { max-width: none; }
}

@media (max-width: 760px) {
    .moment { grid-template-columns: 14px minmax(0, 1fr); gap: 10px; }
    .moment__card { padding: 15px 16px; }
    .moment__media--few,
    .moment__media--grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .moment-intro { padding: 17px; gap: 13px; }
    .moment-intro__avatar img, .moment-intro__avatar svg { width: 46px; height: 46px; }

    /* 代码块：贴边横滑，工具条也跟着出血，否则右侧会留一条缝。
       出血量 -17px 是按正文卡片（.article__body 的 17px 内边距）算的，
       所以必须限定在正文里。打印页 / 文档页的代码块不在正文容器内，
       跟着出血就会顶出页面、产生 1~2px 的横向滚动。 */
    .article__body .code-block { margin: 1.4em -17px; border-radius: 0; border-left: 0; border-right: 0; }
    .article__body .code-block__pre { padding: 12px 17px; font-size: 0.8rem; }
    .article__body .code-block__bar { padding: 7px 17px; border-radius: 0; }
    /* 正文之外的代码块（打印页、文档页）：正常留边，保证长行只在自己的横滑区里滚 */
    .code-block__pre { font-size: 0.8rem; }

    .md-table th, .md-table td { padding: 8px 10px; white-space: nowrap; }
    .md-table { font-size: 0.84rem; }

    .tabs__label { padding: 9px 12px; font-size: 0.83rem; }
    .tabs__panel { padding: 13px 15px; }

    .doc-article { padding: 22px 17px; }
    .doc-group { padding: 17px; }
    .doc-entry--d1 { margin-left: 12px; }
    .doc-entry--d2 { margin-left: 22px; }
    .doc-entry--d3, .doc-entry--d4, .doc-entry--d5 { margin-left: 30px; }
    .doc-side__search-input { height: 38px; }
    /* 手机上目录项垫高到能点中（WCAG 2.5.8 的 24px 下限留足余量） */
    .doc-tree__link { padding: 9px 10px; font-size: 0.9rem; }
    details.doc-tree__branch > summary::before { width: 16px; height: 16px; }

    .side-stats--grid { grid-template-columns: repeat(3, 1fr); }
}

/* ==========================================================================
   阅读进度 / 回到顶部
   ========================================================================== */

.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 200;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    pointer-events: none;
}

.read-progress span {
    display: block;
    height: 100%;
    background: var(--c-primary);
    transform-origin: 0 50%;
    transform: scaleX(0);
    will-change: transform;
}

.to-top {
    position: fixed;
    right: 22px;
    bottom: 24px;
    z-index: 150;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur), border-color var(--dur-fast) var(--ease);
    box-shadow: 0 8px 22px -14px var(--c-shadow-strong);
}

.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { border-color: var(--c-primary); color: var(--c-primary-deep); }
.to-top svg { width: 17px; height: 17px; }

/* 站外链角标可以整站关掉。原来这条规则无条件生效，
   于是"我不想要那个小箭头"没有任何办法——只能改 CSS。 */
.no-external-icon .article__body a[rel~="external"]::after,
.no-external-icon .article__body .embed-link::after { content: none; }

/* 关掉角标之后，正文里的外链至少要能从颜色上区分出来 */
.no-external-icon .article__body a[rel~="external"] { text-decoration: underline dotted; text-underline-offset: 3px; }

@media (max-width: 760px) {
    .to-top { right: 14px; bottom: 16px; width: 38px; height: 38px; }
}

/* 首页 section-head 右侧的内容形式入口 */
.section-head--tabs { align-items: center; }
.section-head__links { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.section-head__links .chip { font-size: 0.78rem; }
.section-head__links .section-head__meta { margin-left: 4px; }
.moment-card__actions { display: flex; gap: 7px; margin: 9px 0 0; }

@media (max-width: 760px) {
    .section-head--tabs { flex-wrap: wrap; gap: 8px; }
    .section-head__links { margin-left: 0; width: 100%; }
}

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

/* =====================================================================
   访客分析 / 站点监测
   ===================================================================== */

/* 数字卡片：一组并排的关键指标。用 grid auto-fit，
   窄屏自己折行，不需要为每个断点写一次列数。 */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 10px;
}
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
}
.stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    /* 数字用等宽字形：否则每次刷新数值跳动时整块宽度都在抖 */
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.stat-card__label { font-size: .78rem; color: var(--c-muted); }

/* 横向分布条。比饼图好读——同一屏能放十行，还能直接比长度。 */
.side-bars { display: grid; gap: 6px; margin-top: 10px; }
.side-bars--roomy { gap: 8px; margin-top: 0; }
.side-bars__label {
    font-size: .78rem;
    color: var(--c-muted);
    margin: 0 0 4px;
    text-transform: none;
}
.side-bars__row {
    display: grid;
    grid-template-columns: minmax(56px, 30%) 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: .84rem;
}
.side-bars__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.side-bars__track {
    height: 7px;
    border-radius: 4px;
    background: var(--c-primary-soft);
    overflow: hidden;
}
.side-bars__fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--c-primary);
    /* 动画短而线性：这里是"数据出现"，不是装饰，不该有回弹 */
    transition: width var(--dur-page) var(--ease);
}
.side-bars__value {
    font-variant-numeric: tabular-nums;
    color: var(--c-muted);
    font-size: .8rem;
}

/* 访客卡里的说明行 */
.side-visitors__meta {
    margin: 10px 0 0;
    font-size: .78rem;
    color: var(--c-muted);
}

/* 监测状态 */
.side-monitor__state {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 10px;
    font-size: .9rem;
    font-weight: 600;
}
.side-monitor__dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #3f9d69;
    box-shadow: 0 0 0 3px rgba(63, 157, 105, .18);
}
.side-monitor__state.is-down .side-monitor__dot {
    background: #c2504f;
    box-shadow: 0 0 0 3px rgba(194, 80, 79, .18);
}
.side-monitor__list { margin-top: 10px; }
.side-monitor__list .is-down { color: #c2504f; }

/* 图表：更高、标签更省地方 */
.bar-chart--tall .bar-chart__bar { max-width: 30px; }
.bar-chart--dense .bar-chart__label { font-size: .62rem; }
.bar-chart__bar--bad { background: #c2504f; }

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
    font-size: .76rem;
    color: var(--c-muted);
}
.chart-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend__dot {
    width: 8px; height: 8px;
    border-radius: 2px;
    background: var(--c-primary);
    display: inline-block;
}

/* 后台筛选用的一排控件 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.filter-bar .input { max-width: 260px; }
.filter-bar form { margin: 0; }

/* 访客哈希：不用等宽字体的话，混着数字字母读起来会跳 */
.hash-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .76rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--c-bg);
    color: var(--c-muted);
    border: 1px solid var(--c-border);
    text-decoration: none;
    display: inline-block;
}

/* 哈希现在是个链接（点进访客详情）。给它一个能被认出来的悬停态，
   否则读者只会当它是一串灰字。 */
a.hash-chip:hover {
    color: var(--c-primary-deep);
    border-color: var(--c-primary);
    background: var(--c-primary-soft);
}

/* 详情页顶部关于"这不是 IP"的说明。这里必须读得进去，不是装饰。 */
.visit-hash-note {
    border-left: 2px solid var(--c-primary);
    padding: 2px 0 2px 14px;
    margin-bottom: 20px;
}

.visit-hash-note p { margin: 0 0 8px; line-height: 1.72; }
.visit-hash-note p:last-child { margin-bottom: 0; }
.visit-hash-note strong { color: var(--c-text); }

.empty-state--inline { padding: 8px 0; }
.nowrap { white-space: nowrap; }

.attach-badge--danger {
    background: rgba(194, 80, 79, .12);
    color: #c2504f;
    border-color: rgba(194, 80, 79, .3);
}

.panel__subtitle {
    font-size: .95rem;
    font-weight: 650;
    margin: 18px 0 6px;
}

.uptime-form { margin-bottom: 8px; }
.uptime-form .field__label { margin: 0; }

/* 导航子项在后台列表里的缩进与枝干 */
.nav-sortable__item--child { margin-left: 22px; }
.nav-sortable__branch { color: var(--c-border-strong); font-size: .9rem; }

/* 侧边栏访客/监测卡在手机上要能压得住 */
@media (max-width: 720px) {
    .stat-cards { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
    .stat-card { padding: 10px 11px; }
    .stat-card__value { font-size: 1.25rem; }
    .side-bars__row { grid-template-columns: minmax(48px, 34%) 1fr auto; font-size: .8rem; }
    .filter-bar .input { max-width: none; flex: 1 1 140px; }
    .nav-sortable__item--child { margin-left: 12px; }
}

/* 短链口令页的表单。
   布局（居中卡片、品牌、页脚）由 layouts/plain.php 提供，
   这里只管表单本身的间距——卡里再套一张卡是"看着不对但说不清哪不对"
   的典型来源。 */
.lock-form { display: grid; gap: 12px; text-align: left; }

/* 二维码容器：白底圆角，别让浅色主题把二维码的静区吃掉 */
.qr-box {
    display: flex;
    justify-content: center;
    padding: 12px;
    background: #ffffff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
}
.qr-box svg { display: block; }

/* 导入说明用的**块级**样例代码：不需要语法高亮，只要对齐、能横滑。
   （正文里那种"一个路径 / 一个 ini 名"的行内代码用 .code-inline，
   两者的排版要求正好相反：一个必须独占一行且不折行，
   另一个必须跟着句子走、该换行就换行。） */
.code-block-inline {
    margin: 8px 0 12px;
    padding: 12px 14px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: .8rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--c-muted);
}

/* 行内代码：路径、ini 名、URL。
   ------------------------------------------------------------------
   它必须"跟着句子走"—— 用 display:inline-block 的那一刻就错了：
   行内块是一个不可拆分的原子盒，句子换行时它会整个掉到下一行，
   于是"数据全部在 /\nstorage/openblog.sqlite\n 中"这种断法就出现了，
   看到的人会以为漏了一行。

   现在用 inline（默认值），并在长路径特有的连字符、斜杠、下划线后面
   给浏览器留出断行点：一整条 /www/wwwroot/OpenBlog/storage/openblog.sqlite
   在窄屏上比一行还长，不留断点就只能横向溢出，把面板顶宽。 */
.code-inline {
    font-family: var(--font-mono);
    font-size: 0.86em;
    padding: 1px 6px;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    background: var(--c-bg);
    color: var(--c-text);
    /* anywhere 而不是 break-all：break-all 会把英文单词也拆开，
       而这里的内容本来就是路径、术语，按字符断更合适 */
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* 插件列表：每个插件一张小卡，停用的整体降低对比度 */
.plugin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.plugin-item {
    padding: 13px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
}
/* 停用态不是"看不见"，是"一眼看出它没在工作"：
   降低整体不透明度而不是改成灰色文字，这样里面的 badge 还能区分颜色 */
.plugin-item.is-off { opacity: .62; }
.plugin-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.plugin-item__name { font-size: .95rem; margin-right: 4px; }
.plugin-item__desc { margin: 8px 0 0; font-size: .85rem; line-height: 1.65; }
.plugin-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 8px;
    font-size: .78rem;
    color: var(--c-muted);
}

/* 控制台上插件卡片里的文字行 */
.dash-card__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.dash-card__lines li {
    font-size: .86rem;
    color: var(--c-text);
    line-height: 1.6;
    padding-left: 14px;
    position: relative;
}
/* 用一个小方点当项目符号，不用圆点：圆点在细字重下会显得发飘 */
.dash-card__lines li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: .62em;
    width: 5px;
    height: 1px;
    background: var(--c-primary);
}

/* ==========================================================================
   Markdown 容器与行内语法（对齐主流文档主题的写作口径）
   ========================================================================== */

/* 马克笔：底色是一条渐变，不是整块高亮。整块高亮在中文正文里像划重点笔漏了墨，
   而且一整段都亮起来之后，真正要紧的那半句反而被淹掉。 */
.mark {
  padding: 0 2px;
  border-radius: 3px;
  background-image: linear-gradient(to right, var(--c-primary-soft, #f6e2e7) 50%, transparent 50%);
  background-size: 200% 100%;
  background-position: 0 60%;
  background-repeat: no-repeat;
  transition: background-position 0.5s ease;
}
.mark--info, .mark--note { background-image: linear-gradient(to right, #e3e9f5 50%, transparent 50%); }
.mark--tip { background-image: linear-gradient(to right, #dff2e4 50%, transparent 50%); }
.mark--warning { background-image: linear-gradient(to right, #fbeecb 50%, transparent 50%); }
.mark--danger, .mark--caution { background-image: linear-gradient(to right, #fadae0 50%, transparent 50%); }
.mark--important { background-image: linear-gradient(to right, #e6e2f7 50%, transparent 50%); }
@media (prefers-reduced-motion: reduce) {
  .mark { transition: none; background-position: 100% 60%; }
}

/* 隐秘文本：默认盖一层遮罩，悬停或点击才露出。 */
.plot {
  position: relative;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--c-border, #e7e2e4);
  color: transparent;
  cursor: help;
  transition: color 0.18s ease, background 0.18s ease;
}
.plot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255, 255, 255, 0.5) 4px, rgba(255, 255, 255, 0.5) 8px);
}
.plot:hover, .plot:focus, .plot.is-revealed { color: inherit; background: transparent; }
.plot:hover::after, .plot:focus::after, .plot.is-revealed::after { display: none; }
.plot--blur { background: transparent; color: transparent; text-shadow: 0 0 8px rgba(0, 0, 0, 0.7); }
.plot--blur::after { display: none; }
.plot--click { cursor: pointer; }

/* 行内注释：点一下/悬停出气泡。用 span 不用 button，
   因为它出现在正文里，按钮语义会打断读者的朗读流。 */
.annotate {
  position: relative;
  padding: 0 4px;
  border-bottom: 1px dashed var(--c-primary, #d4738c);
  color: var(--c-primary, #d4738c);
  cursor: help;
}
.annotate--missing { border-bottom-style: dotted; color: var(--c-muted, #8a8189); }
.annotate__popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: none;
  width: max-content;
  max-width: min(360px, 78vw);
  padding: 10px 12px;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 8px;
  background: var(--c-card, #fff);
  box-shadow: 0 8px 24px rgba(60, 40, 50, 0.12);
  color: var(--c-text, #2f2a2d);
  font-size: 0.86rem;
  line-height: 1.7;
  white-space: normal;
  text-align: left;
}
.annotate:hover .annotate__popover,
.annotate:focus .annotate__popover,
.annotate:focus-within .annotate__popover { display: block; }

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.7;
  vertical-align: 1px;
  background: rgba(212, 115, 140, 0.12);
  color: var(--c-primary, #d4738c);
}
.badge--info, .badge--note { background: #e6ecf7; color: #4a5d80; }
.badge--warning { background: #fbeecb; color: #8a6512; }
.badge--danger { background: #fadae0; color: #a33b52; }
.badge--important { background: #e6e2f7; color: #5b4d95; }

/* 行内图标与文字同色同粗细 */
.md-icon {
  width: 1em;
  height: 1em;
  margin-right: 6px;
  vertical-align: -0.14em;
}
.callout__title .md-icon { margin-right: 7px; }

/* 提示框：左侧一道色条 + 浅底。不用大色块，一整屏彩色框会读不下去。 */
.callout {
  margin: 18px 0;
  padding: 0;
  border-left: 3px solid var(--c-primary, #d4738c);
  border-radius: 0 8px 8px 0;
  background: rgba(212, 115, 140, 0.06);
  overflow: hidden;
}
.callout__title {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 10px 16px 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--c-text, #2f2a2d);
}
.callout__body { padding: 6px 16px 12px; }
.callout__body > :first-child { margin-top: 0; }
.callout__body > :last-child { margin-bottom: 0; }
.callout--info { border-color: #7d92b8; background: rgba(125, 146, 184, 0.07); }
.callout--tip { border-color: #6faa83; background: rgba(111, 170, 131, 0.07); }
.callout--warn { border-color: #d8a83f; background: rgba(216, 168, 63, 0.08); }
.callout--danger { border-color: #cf5f76; background: rgba(207, 95, 118, 0.07); }
.callout--important { border-color: #8a7bc8; background: rgba(138, 123, 200, 0.07); }
.callout--aside { border-color: var(--c-muted, #8a8189); background: rgba(138, 129, 137, 0.06); }

/* 卡片与卡片网格 */
.md-card {
  margin: 16px 0;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 8px;
  background: var(--c-card, #fff);
  overflow: hidden;
}
.md-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border, #e7e2e4);
  background: rgba(212, 115, 140, 0.04);
  font-weight: 600;
  font-size: 0.92rem;
}
.md-card__head .md-icon { margin-right: 0; color: var(--c-primary, #d4738c); }
.md-card__body { padding: 12px 14px; }
.md-card__body > :first-child { margin-top: 0; }
.md-card__body > :last-child { margin-bottom: 0; }

.card-grid { display: grid; gap: 14px; margin: 16px 0; }
@media (min-width: 700px) { .card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.card-grid > .md-card { margin: 0; }

/* 折叠面板 */
.collapse {
  margin: 16px 0;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-card, #fff);
}
.collapse__item + .collapse__item { border-top: 1px solid var(--c-border, #e7e2e4); }
.collapse__toggle { position: absolute; opacity: 0; pointer-events: none; }
.collapse__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  user-select: none;
}
.collapse__head:hover { background: rgba(212, 115, 140, 0.05); }
.collapse__chevron {
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}
.collapse__toggle:checked + .collapse__head .collapse__chevron { transform: rotate(45deg); }
.collapse__toggle:focus-visible + .collapse__head { outline: 2px solid var(--c-primary, #d4738c); outline-offset: -2px; }
.collapse__body { display: none; padding: 0 14px 13px; }
.collapse__toggle:checked ~ .collapse__body { display: block; }
.collapse__body > :first-child { margin-top: 0; }
.collapse__body > :last-child { margin-bottom: 0; }

/* 步骤条 */
.steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: step; }
.steps__item { position: relative; display: flex; gap: 14px; padding-bottom: 20px; }
.steps__item:last-child { padding-bottom: 0; }
/* 竖线由每个圆点自己画到下一个，而不是整块背景：最后一项不该拖着一条尾巴 */
.steps__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 2px;
  width: 1.5px;
  background: var(--c-border, #e7e2e4);
}
.steps__marker {
  flex: none;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1.5px solid var(--c-primary, #d4738c);
  background: var(--c-card, #fff);
  color: var(--c-primary, #d4738c);
  font-size: 0.8rem;
  font-weight: 700;
}
.steps__content { flex: 1; min-width: 0; padding-top: 2px; }
.steps__title { margin: 0 0 4px; font-weight: 600; font-size: 0.95rem; }
.steps__content > :last-child { margin-bottom: 0; }

/* 时间线 */
.timeline { margin: 18px 0; padding: 0; list-style: none; }
.timeline__item { position: relative; padding: 0 0 20px 24px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: 0;
  width: 1.5px;
  background: var(--c-border, #e7e2e4);
}
.timeline__dot {
  position: absolute;
  left: 0;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c-primary, #d4738c);
}
.timeline__time {
  display: block;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted, #8a8189);
}
.timeline__title { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; }
.timeline__body { margin-top: 4px; }
.timeline__body > :last-child { margin-bottom: 0; }

/* 文件树 */
.file-tree {
  margin: 16px 0;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 8px;
  background: var(--c-card, #fff);
  overflow: hidden;
}
.file-tree__head {
  padding: 9px 13px;
  border-bottom: 1px solid var(--c-border, #e7e2e4);
  background: rgba(212, 115, 140, 0.04);
  font-size: 0.84rem;
  font-weight: 600;
}
.file-tree__list { padding: 8px 0; overflow-x: auto; }
.file-tree__item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 13px 2px calc(13px + var(--ft-depth, 0) * 16px);
  font-size: 0.86rem;
  line-height: 1.7;
  white-space: nowrap;
}
.file-tree__item.is-dir > .file-tree__name { font-weight: 600; }
.file-tree__item.is-strong > .file-tree__name { font-weight: 700; color: var(--c-primary, #d4738c); }
.file-tree__item.is-placeholder { color: var(--c-muted, #8a8189); }
.file-tree__icon { display: inline-grid; place-items: center; flex: none; width: 15px; height: 15px; color: var(--c-muted, #8a8189); }
.file-tree__icon svg { width: 15px; height: 15px; }
.file-tree__item.is-dir .file-tree__icon { color: var(--c-primary, #d4738c); }
.file-tree__name { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
.file-tree__comment { color: var(--c-muted, #8a8189); font-size: 0.8rem; }
.file-tree__tag {
  padding: 0 6px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
}
.file-tree__tag--add { background: #dff2e4; color: #2f6b46; }
.file-tree__tag--remove { background: #fadae0; color: #a33b52; }

/* 示例窗口 */
.window {
  margin: 16px 0;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 8px;
  background: var(--c-card, #fff);
  overflow: hidden;
}
.window__head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--c-border, #e7e2e4);
  background: rgba(212, 115, 140, 0.04);
  font-size: 0.84rem;
  font-weight: 600;
}
.window__body { padding: var(--window-gap, 16px); overflow: auto; }
.window__body > :first-child { margin-top: 0; }
.window__body > :last-child { margin-bottom: 0; }

/* Flex 容器 */
.md-flex { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; }
.md-flex--column { flex-direction: column; }
.md-flex--justify-start { justify-content: flex-start; }
.md-flex--justify-center { justify-content: center; }
.md-flex--justify-end { justify-content: flex-end; }
.md-flex--justify-between { justify-content: space-between; }
.md-flex--justify-around { justify-content: space-around; }
.md-flex--justify-evenly { justify-content: space-evenly; }
.md-flex--align-start { align-items: flex-start; }
.md-flex--align-center { align-items: center; }
.md-flex--align-end { align-items: flex-end; }
.md-flex > * { margin: 0; min-width: 0; }

.md-columns { columns: 2; column-gap: 24px; margin: 16px 0; }
@media (max-width: 700px) { .md-columns { columns: 1; } }

/* 字段说明 */
.field-group { margin: 16px 0; display: grid; gap: 10px; }
.field {
  padding: 11px 14px;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 8px;
  background: var(--c-card, #fff);
}
.field__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.field__name { font-size: 0.88rem; font-weight: 700; color: var(--c-primary, #d4738c); }
.field__type, .field__unit { font-size: 0.78rem; color: var(--c-muted, #8a8189); }
.field__type:hover { color: var(--c-primary, #d4738c); }
.field__flag { padding: 0 7px; border-radius: 20px; font-size: 0.68rem; font-weight: 600; }
.field__flag--required { background: #fadae0; color: #a33b52; }
.field__flag--deprecated { background: var(--c-border, #e7e2e4); color: var(--c-muted, #8a8189); text-decoration: line-through; }
.field:not(.field--bare) .field__head .field__flag:not([class*="--"]) { background: #e6ecf7; color: #4a5d80; }
.field__desc { margin: 7px 0 0; font-size: 0.86rem; line-height: 1.75; color: var(--c-text, #2f2a2d); }
.field__enum, .field__default { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; font-size: 0.8rem; }
.field__enum-label, .field__default-label { color: var(--c-muted, #8a8189); }
.field__enum-item, .field__default code { padding: 1px 6px; border-radius: 4px; background: rgba(138, 129, 137, 0.1); font-size: 0.78rem; }
.field__constraint { margin: 6px 0 0; font-size: 0.8rem; color: var(--c-muted, #8a8189); }

/* 表格增强容器 */
.md-table-block { position: relative; margin: 18px 0; }
.md-table-block.is-center > .table-wrap { margin-inline: auto; }
.md-table-block.is-full-width > .table-wrap { width: 100%; }
.md-table-block.is-max-content > .table-wrap { overflow-x: auto; }
.md-table-block.is-max-content .md-table td,
.md-table-block.is-max-content .md-table th { white-space: nowrap; }
.md-table-block__tools {
  position: absolute;
  top: -2px;
  right: 0;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.md-table-block:hover .md-table-block__tools,
.md-table-block:focus-within .md-table-block__tools { opacity: 1; }
.md-table-block__copy {
  padding: 3px 9px;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 6px;
  background: var(--c-card, #fff);
  color: var(--c-muted, #8a8189);
  font-size: 0.74rem;
  cursor: pointer;
}
.md-table-block__copy:hover { color: var(--c-primary, #d4738c); border-color: var(--c-primary, #d4738c); }
.md-table-block__title {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--c-muted, #8a8189);
}
.md-table tr.is-note td { background: rgba(125, 146, 184, 0.1); }
.md-table tr.is-tip td { background: rgba(111, 170, 131, 0.1); }
.md-table tr.is-important td { background: rgba(138, 123, 200, 0.1); }
.md-table tr.is-danger td { background: rgba(207, 95, 118, 0.1); }

/* 二维码容器 */
.md-qrcode { margin: 18px 0; text-align: center; }
.md-qrcode.is-left { text-align: left; }
.md-qrcode.is-right { text-align: right; }
.md-qrcode__canvas {
  display: inline-block;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--c-border, #e7e2e4);
  line-height: 0;
}
.md-qrcode.is-card {
  display: inline-block;
  padding: 18px 20px;
  border: 1px solid var(--c-border, #e7e2e4);
  border-radius: 10px;
  background: var(--c-card, #fff);
}
.md-qrcode__title { margin: 8px 0 0; font-size: 0.82rem; color: var(--c-muted, #8a8189); }

/* ==========================================================================
   代码块：行号 / 行高亮 / 差异 / 聚焦 / 折叠
   ========================================================================== */

.code-block__pre { counter-reset: none; }
.code-line {
  display: block;
  min-height: 1.5em;
  padding-left: var(--code-gutter, 0);
  position: relative;
}
/* 行号用 counter 画在左侧装订线里，不进入可复制文本 */
.code-block[data-code-numbers="1"] .code-line { padding-left: 42px; }
.code-block[data-code-numbers="1"] .code-line::before {
  content: attr(data-line);
  position: absolute;
  left: 0;
  width: 30px;
  padding-right: 8px;
  text-align: right;
  color: var(--code-line-no, rgba(255, 255, 255, 0.28));
  font-variant-numeric: tabular-nums;
  user-select: none;
  pointer-events: none;
}
.code-line.is-highlighted {
  background: rgba(212, 115, 140, 0.16);
  box-shadow: inset 2px 0 0 var(--c-primary, #d4738c);
}
.code-line.is-diff.is-add { background: rgba(111, 170, 131, 0.16); box-shadow: inset 2px 0 0 #6faa83; }
.code-line.is-diff.is-remove { background: rgba(207, 95, 118, 0.16); box-shadow: inset 2px 0 0 #cf5f76; }
.code-line.is-warning { background: rgba(216, 168, 63, 0.16); box-shadow: inset 2px 0 0 #d8a83f; }
.code-line.is-error { background: rgba(207, 95, 118, 0.2); box-shadow: inset 2px 0 0 #cf5f76; }
.code-line__sign {
  display: inline-block;
  width: 12px;
  margin-left: -14px;
  font-weight: 700;
  user-select: none;
}
.code-line.is-diff.is-add .code-line__sign { color: #7cc79a; }
.code-line.is-diff.is-remove .code-line__sign { color: #e88c9f; }
/* 聚焦：没被聚焦的行压暗，但不隐藏——隐藏掉的行会让人以为代码没那么长。
   0.35 太狠了：一个 4 行的块里只有 1 行亮着，剩下 3 行几乎读不出来，
   看起来更像渲染坏了。0.55 足够把注意力引过去，又不至于读不了上下文。 */
.code-block[data-code-focused="1"] .code-line { opacity: 0.55; transition: opacity 0.16s ease; }
.code-block[data-code-focused="1"] .code-line.is-focus,
.code-block[data-code-focused="1"] .code-block__pre:hover .code-line,
.code-block[data-code-focused="1"] .code-block__pre:focus-within .code-line { opacity: 1; }

/* 折叠：默认只露前 N 行，展开按钮压在渐隐带上 */
.code-block[data-code-collapsed] .code-block__pre { max-height: calc(var(--code-line-height, 1.5em) * 16); overflow: hidden; }
.code-block[data-code-collapsed] .code-block__fold {
  position: relative;
  margin-top: -46px;
  padding-top: 32px;
  text-align: center;
  background: linear-gradient(to bottom, transparent, var(--code-bg, #1f1b1d) 72%);
}
.code-block[data-code-collapsed].is-expanded .code-block__pre { max-height: none; }
.code-block[data-code-collapsed].is-expanded .code-block__fold { display: none; }
.code-block__fold-btn {
  padding: 5px 14px;
  border: 1px solid currentColor;
  border-radius: 20px;
  background: transparent;
  color: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  opacity: 0.85;
}
.code-block__fold-btn:hover { opacity: 1; }

.code-block__lang[title] { cursor: help; }

/* 复制按钮的成功态 */
.code-block__copy.is-done { color: #7cc79a; }

/* 亮色主题下代码块的可读性微调 */
:root[data-scheme="light"] .code-block {
  --code-line-no: rgba(0, 0, 0, 0.28);
}

/* ==========================================================================
   数学公式（服务端渲染，零 JS、零字体文件）
   ========================================================================== */

.math {
  font-family: "Latin Modern Math", "STIX Two Math", Cambria Math, Georgia, "Times New Roman", serif;
  font-size: 1.04em;
  line-height: 1.5;
  white-space: nowrap;
}
.math--inline { padding: 0 1px; }
.math-block {
  margin: 18px 0;
  overflow-x: auto;
  /* 公式从左到右读，居中会让人找不到起点；长公式靠左也和正文同一起跑线 */
  text-align: left;
}
.math--block { display: inline-block; padding: 4px 0; }

/* 分数：上下两行 + 一道横线。用 flex column 而不是 inline-block 堆叠，
   否则分母比分子长的时候整个分数的基线会跳。 */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: -0.5em;
  margin: 0 0.14em;
  line-height: 1.15;
}
.math-frac-top,
.math-frac-bot { padding: 0 0.24em; }
.math-frac-top { border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.math-frac-bot { padding-top: 1px; }

/* 根号：横线用 border-top 画，长度跟着内容走 */
.math-sqrt { display: inline-flex; align-items: stretch; margin: 0 0.06em; }
.math-sqrt::before { content: ""; }
.math-sqrt-arg {
  border-top: 1px solid currentColor;
  padding: 1px 0.16em 0 0.1em;
  margin-left: -0.06em;
}

/* 大运算符：上下限竖着排在符号正上方/正下方，跟 LaTeX 的 display 模式一致 */
.math-op {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: -0.62em;
  margin: 0 0.1em;
  line-height: 1.05;
}
.math-op-lim { display: inline-flex; flex-direction: column; align-items: center; }
.math-op-lim sup,
.math-op-lim sub { font-size: 0.68em; line-height: 1.15; }
.math-op-lim sup { order: 0; }
.math-op-lim sub { order: 1; }
.math-op-sym { font-size: 1.3em; line-height: 1; }
.math-op-sym sup, .math-op-sym sub { font-size: 0.7em; }

/* 重音：符号浮在字符上方或下方，用 grid 叠而不是绝对定位 */
.math-accent {
  display: inline-grid;
  justify-items: center;
  vertical-align: -0.2em;
}
.math-accent-mark {
  font-size: 0.85em;
  line-height: 0.7;
  letter-spacing: -0.06em;
}
.math-accent-base { line-height: 1.1; }

/* 字体变体 */
.math-bf { font-weight: 700; }
.math-it { font-style: italic; }
.math-rm, .math-op { font-style: normal; }
.math-cal { font-family: "Latin Modern Math", "STIX Two Math", cursive, serif; font-style: italic; }
.math-bb { font-family: "Latin Modern Math", "STIX Two Math", serif; font-weight: 600; }

/* 上下标默认小一号，与正文的 sup/sub 区分开 */
.math sup, .math sub { font-size: 0.72em; line-height: 0; }
.math sup { vertical-align: 0.52em; }
.math sub { vertical-align: -0.28em; }
/* 嵌套（e^{-x^2}）时再缩一号，否则两个 2 一样大，读不出层级 */
.math sup sup, .math sup sub, .math sub sup, .math sub sub { font-size: 0.8em; }

.math-raw {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(138, 129, 137, 0.08);
  font-size: 0.84rem;
  overflow-x: auto;
}

/* 插件卡片上的动作按钮排。
   卡片头部是 flex space-between，按钮多了会把标题挤到换行——
   所以按钮单独成一栏靠右，并且自己也允许换行。 */
.plugin-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  flex: none;
}
.plugin-item__actions form { display: contents; }
.plugin-item__actions .btn { white-space: nowrap; }
/* 窄屏下按钮整栏落到标题下面，并靠左对齐——
   右对齐在窄屏会缩成一小撮，反而看不出有几个按钮 */
@media (max-width: 640px) {
  .plugin-item__head { align-items: flex-start; }
  .plugin-item__actions { justify-content: flex-start; width: 100%; }
}
