/* docs.qcode.cc 浏览体验样式
 *
 * 为什么不放 base.html 的内联 <style>：那段 CSS 每个 HTML 都要重传一遍（本来就有 20KB），
 * 而 HTML 响应没有 Cache-Control。放 static/ 走 VersionedStaticFiles 的 immutable 缓存，
 * 全站只下载一次。实测把这些规则内联会让文档页 gzip 后涨 16.3%，移出来后基本持平。
 *
 * 加载顺序：base.html 内联 <style>（含 :root 变量）→ theme.css（深色覆盖）→ 本文件。
 * 因此这里可以放心使用 var(--*)，也能覆盖前两者。
 */

/* ═══════════ 全站（base.html）═══════════ */
/* ───────── 键盘可达：跳到正文 ───────── */
.skip-link {
    position: absolute; left: 8px; top: -48px; z-index: 300;
    background: var(--primary); color: #1D1D1F; padding: 8px 16px;
    border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; font-weight: 600;
    transition: top 0.15s;
}
.skip-link:focus { top: 0; text-decoration: none; color: #1D1D1F; }

/* 只给读屏软件的文字（如首页搜索框的 <label>） */
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ───────── 顶栏搜索框 ───────── */
.nav-search { position: relative; flex: 0 1 320px; min-width: 0; }
.nav-search input {
    width: 100%; height: 34px; padding: 0 34px 0 32px;
    background: rgba(255,255,255,0.07); color: #F5F1EE;
    border: 1px solid rgba(255,255,255,0.11); border-radius: var(--radius);
    font-size: 13px; font-family: inherit; outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.42); }
.nav-search input:focus {
    border-color: var(--primary); background: rgba(255,255,255,0.12);
}
/* F01: the top bar is dark, so the primary focus outline is not bright enough; use white for
   keyboard focus. This file loads after base.html's inline style and wins over its outline: none. */
.nav-search input:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.nav-search .nav-search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; opacity: 0.45; pointer-events: none;
}
.nav-search kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-family: inherit; font-size: 10px; line-height: 1;
    color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px; padding: 3px 5px; pointer-events: none;
}
.nav-suggest {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 210;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.nav-suggest-item {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 9px 14px; font-size: 13px; color: var(--text-700);
}
.nav-suggest-item:hover, .nav-suggest-item.is-active {
    background: var(--primary-light); color: var(--text-900); text-decoration: none;
}
.nav-suggest-cat { font-size: 11px; color: var(--text-500); flex: none; }

/* 顶栏右侧那组（定价/企业版/主站/语言）。display 写在这里而不是元素的 style 属性上：
   内联样式压得过媒体查询，窄屏就藏不掉——改动前它整组 398px 宽，是移动端横向溢出的主因。 */
.nav-desktop-only { display: flex; gap: 2px; align-items: center; }
.nav-user { font-size: 13px; color: rgba(255,255,255,0.6); white-space: nowrap; }
.nav-cta { white-space: nowrap; flex: none; }
/* 1025–1280px 顶栏放不下全部文字链接：先让「qcode.cc ↗」让位（抽屉与页脚里都还有），
   再收紧间距、藏掉 ⌘K 提示，给搜索框留出可用的宽度（de/ru 文案最长） */
@media (max-width: 1280px) {
    .nav-ext-main { display: none; }
    .top-nav { gap: 14px; }
    .nav-links a { padding: 6px 10px; }
    .nav-search kbd { display: none; }
    .nav-search input { padding-right: 10px; }
}

/* ───────── 汉堡与抽屉 ───────── */
.nav-burger {
    display: none; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex: none;
    background: transparent; border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px; color: rgba(255,255,255,0.8); cursor: pointer;
}
.nav-burger:hover { color: #fff; border-color: rgba(255,255,255,0.35); }
.nav-drawer {
    display: none; position: absolute; left: 0; right: 0; top: 64px;
    background: #0A0A0B; border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 12px 16px 18px; z-index: 190;
    max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px);
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}
.nav-drawer.is-open { display: block; }
.nav-drawer a {
    display: block; padding: 10px 12px; border-radius: var(--radius);
    color: rgba(255,255,255,0.78); font-size: 14px;
}
.nav-drawer a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-drawer .drawer-group { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 10px; padding-top: 10px; }
.nav-drawer .drawer-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.6); padding: 4px 12px;
}
.nav-drawer a.is-current { color: var(--primary); font-weight: 600; }
.nav-drawer a.drawer-cta {
    display: flex; justify-content: center; margin: 4px 0 10px;
    color: #1D1D1F; padding: 10px 12px;
}
.nav-drawer a.drawer-cta:hover { background: var(--primary); color: #1D1D1F; }
body.drawer-open { overflow: hidden; }

/* ───────── 代码块：复制按钮与语言标签 ───────── */
.code-block { position: relative; }
.code-block > .code-copy,
.tut-copy-cell > .code-copy {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    display: inline-flex; align-items: center; gap: 5px;
    height: 26px; padding: 0 8px;
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.14); border-radius: 6px;
    font-size: 12px; font-family: inherit; cursor: pointer;
    opacity: 0.75; transition: opacity 0.15s, background-color 0.15s;
}
.code-block:hover > .code-copy,
.code-block > .code-copy:focus-visible,
.tut-copy-cell > .code-copy:focus-visible { opacity: 1; }
.code-block > .code-copy:hover,
.tut-copy-cell > .code-copy:hover { background: rgba(255,255,255,0.16); color: #fff; }
.code-block > .code-copy.is-copied,
.tut-copy-cell > .code-copy.is-copied { background: rgba(52,199,89,0.22); color: #7ee2a8; opacity: 1; }
.code-block > .code-copy.is-failed,
.tut-copy-cell > .code-copy.is-failed { background: rgba(255,69,58,0.22); color: #ffb3ad; opacity: 1; }
.code-copy-icon {
    width: 12px; height: 12px; flex: none;
    border: 1.5px solid currentColor; border-radius: 3px;
    box-shadow: 2.5px -2.5px 0 -1.5px currentColor, 3.5px -3.5px 0 -1.5px currentColor;
}
.code-block.is-copied .code-copy-icon, .code-copy.is-copied .code-copy-icon { box-shadow: none; }
.code-block[data-lang]::before {
    content: attr(data-lang);
    position: absolute; top: 10px; left: 14px;
    font-size: 10.5px; letter-spacing: 0.04em; text-transform: lowercase;
    color: rgba(255,255,255,0.34); pointer-events: none;
}
.code-block[data-lang] pre { padding-top: 28px; }
.code-block:not([data-lang]) pre { padding-right: 52px; }
/* Touch screens have no hover: the copy button is always shown and enlarged for touch targets */
@media (hover: none), (pointer: coarse) {
    .code-block > .code-copy,
    .tut-copy-cell > .code-copy { opacity: 1; min-height: 36px; min-width: 36px; padding: 0 10px; }
}

/* ───────── 目录当前位置 ───────── */
.doc-toc a.is-active {
    color: var(--primary-text); font-weight: 600;
    border-left: 2px solid var(--primary); margin-left: -8px; padding-left: 6px;
}

/* ───────── ≤1024px：导航收进抽屉 ───────── */
@media (max-width: 1024px) {
    .top-nav { padding: 0 12px; gap: 10px; }
    .nav-burger { display: inline-flex; }
    .nav-links, .nav-desktop-only { display: none; }
    .nav-brand span:not(.logo-mark) { display: none; }
    .nav-search { flex: 1 1 auto; }
    .nav-search kbd { display: none; }
}

/* ═══════════ 文档详情页（document.html）═══════════ */
/* Full-width detail layout: the old 1440px cap left large empty gutters on wide screens.
   The rail widths (260px / 200px) are unchanged; the middle column absorbs the rest. */
.doc-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 200px;
    margin: 0 auto;
    min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px);
}

/* Sidebar */
.doc-sidebar {
    border-right: 1px solid var(--border);
    padding: 24px 12px; background: var(--bg-white);
    position: sticky; top: 64px; height: calc(100vh - 64px); height: calc(100dvh - 64px);
    overflow-y: auto;
}
.side-filter {
    width: 100%; height: 32px; margin-bottom: 14px; padding: 0 10px;
    font-size: 12.5px; font-family: inherit; color: var(--text-900);
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius); outline: none;
}
.side-filter:focus { border-color: var(--primary); }
.side-section { margin-bottom: 10px; }
.side-section[hidden] { display: none; }
.side-section-title {
    font-size: 11px; font-weight: 700; color: var(--text-500);
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 6px 12px; margin-bottom: 2px;
    cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px;
    border-radius: 6px;
}
.side-section-title::-webkit-details-marker { display: none; }
.side-section-title:hover { background: var(--border-light); color: var(--text-700); }
.side-section-title::after {
    content: ''; margin-left: auto; width: 6px; height: 6px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg); transition: transform 0.15s;
}
.side-section[open] > .side-section-title::after { transform: rotate(45deg); }
.side-link {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px 7px 20px; font-size: 13px; color: var(--text-500);
    border-radius: 6px; border-left: 2px solid transparent;
    transition: color 0.1s, background-color 0.1s; margin: 1px 0;
}
.side-link:hover { color: var(--text-900); background: var(--border-light); text-decoration: none; }
.side-link.active {
    color: var(--primary-text); background: var(--primary-light);
    border-left-color: var(--primary); font-weight: 600;
}
.side-link .lock { font-size: 10px; opacity: 0.6; }

/* Reading measure: images, tables and code may use the full article width, but running text
   keeps a comfortable line length on ultra-wide screens. Scoped to direct children of the
   markdown container so card/CTA internals stay centered. 1100px is the single knob. */
:root {
    --doc-measure: 1100px;
    /* Light theme only: a very soft lift so screenshots read as screenshots, not page art. */
    --doc-img-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 10px 30px rgba(0, 0, 0, 0.07);
}
html[data-theme="dark"] { --doc-img-shadow: none; }
.doc-content.prose > :is(
    p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6, dl,
    .callout, .admonition, .doc-fallback, .os-tabs, .tut-overview-block
) {
    max-width: var(--doc-measure);
}

/* Heading anchors and in-page TOC jumps must clear the 64px header plus the tutorial's
   sticky step bar, not just the header. */
.prose h2,
.prose h3,
.tut-step h3 {
    scroll-margin-top: 112px;
}

/* Markdown wraps a standalone image in a paragraph. That paragraph must escape the text
   measure, otherwise the screenshot can never grow past 1100px on a wide screen. */
.doc-content.prose > p:has(> img:only-child),
.doc-content.prose > p:has(> .doc-zoom-wrap:only-child),
.doc-content.prose > p:has(> a > img:only-child),
.doc-content.prose > p:has(> a > .doc-zoom-wrap:only-child),
.doc-content.prose > p.doc-figure {
    max-width: none;
}

/* Screenshots: fill the article column up to their intrinsic size, with a hairline that
   separates a white UI capture from the white page and the light-theme-only soft shadow. */
.doc-content.prose img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 8px);
    box-shadow: var(--doc-img-shadow);
    cursor: zoom-in;
}

/* doc-zoom.js wraps every clickable screenshot in this span so the zoom badge can be
   positioned on it. It stays inline-level, so the image keeps its text-flow position. */
.doc-zoom-wrap {
    position: relative; display: inline-block;
    max-width: 100%; line-height: 0; vertical-align: top;
}
/* Zoom affordance in the upper inline-end corner: a dark translucent circle with a white
   magnifier, 24px, 8px from the top and inline-end edge. The lower inline-end corner is
   reserved for the qcode.cc watermark on the screenshot, which must stay fully visible;
   logical properties put the badge in the upper-left for RTL (ar / fa).
   Pure CSS + an inline SVG data URI, no icon font. */
.doc-zoom-wrap::after {
    content: ""; position: absolute;
    inset-block-start: 8px; inset-inline-end: 8px;
    width: 24px; height: 24px; border-radius: 999px;
    background-color: rgba(10, 10, 11, 0.5);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 15px 15px;
    opacity: 0.85; pointer-events: none;
    transition: opacity 0.15s, background-color 0.15s;
}
.doc-zoom-wrap:hover::after,
.doc-zoom-wrap:focus-within::after {
    opacity: 1; background-color: rgba(10, 10, 11, 0.78);
}

/* Tables and code keep the full column width; the reading measure only applies to prose. */
.doc-content.prose > :is(.table-wrap, pre) { max-width: 100%; }

/* Screenshot lightbox (created by doc-zoom.js). The overlay is pure chrome: no text. */
.doc-zoom-overlay {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    padding: 4vh 2vw; background: rgba(10, 10, 11, 0.92);
    cursor: zoom-out;
}
.doc-zoom-image {
    max-width: 96vw; max-height: 92vh; width: auto; height: auto;
    border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 4px;
    background: #fff; box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
    cursor: default;
}
.doc-zoom-close {
    position: fixed; top: calc(10px + env(safe-area-inset-top, 0px));
    inset-inline-end: calc(10px + env(safe-area-inset-right, 0px));
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    background: rgba(0, 0, 0, 0.45); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px;
    font: 400 28px/1 Arial, sans-serif; cursor: pointer;
}
.doc-zoom-close:hover { background: rgba(255, 255, 255, 0.18); }
.doc-zoom-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body.doc-zoom-open { overflow: hidden; }

/* Content */
/* No max-width here either: the article must fill the middle grid column. */
.doc-content {
    padding: 40px 56px;
    background: var(--bg-white);
}
.doc-meta { margin-bottom: 24px; }
.doc-meta .breadcrumb {
    font-size: 13px; color: var(--text-500); margin-bottom: 8px;
}
.doc-meta .breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.doc-meta .breadcrumb li { margin: 0; }
.doc-meta .breadcrumb li + li::before { content: "/"; margin: 0 0.3em; }
.doc-meta .breadcrumb a { color: var(--text-500); font-weight: 400; }
.doc-content > h1.doc-title { margin-top: 0; }
.doc-desc { color: var(--text-500); font-size: 16px; margin-bottom: 12px; line-height: 1.6; }
.doc-fallback {
    background: #fef3c7; border: 1px solid #f59e0b; border-radius: var(--radius-lg);
    padding: 10px 16px; margin-bottom: 16px; font-size: 13px; color: #92400e;
    display: flex; align-items: center; gap: 8px;
}

/* TOC */
.doc-toc {
    padding: 24px 16px;
    position: sticky; top: 64px; height: calc(100vh - 64px); height: calc(100dvh - 64px);
    overflow-y: auto;
}
.toc-title {
    font-size: 11px; font-weight: 700; color: var(--text-500);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 12px;
}
.doc-toc a {
    display: block; font-size: 12px; color: var(--text-500);
    padding: 3px 0; line-height: 1.5;
    transition: color 0.1s;
    /* 环境变量名这类长串在 200px 宽的目录里会被直接切掉 */
    overflow-wrap: anywhere;
}
.doc-toc a:hover { color: var(--primary-text); text-decoration: none; }
.doc-toc ul { list-style: none; padding-left: 12px; }
.doc-toc > ul { padding-left: 0; }

/* Prev/Next */
.doc-nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    max-width: var(--doc-measure);
    margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
}
.doc-nav-item {
    padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
    transition: border-color 0.15s, background-color 0.15s, color 0.15s; color: var(--text-700);
}
.doc-nav-item:hover { border-color: var(--primary); background: var(--primary-light); text-decoration: none; color: var(--text-900); }
.doc-nav-item .label { font-size: 12px; color: var(--text-500); font-weight: 600; margin-bottom: 4px; }
.doc-nav-item .title { font-size: 14px; font-weight: 600; }
.doc-nav-next { text-align: right; }

/* 宽表：滚动交给外层容器。表格自身保持 display:table，
   否则 width:max-content 会让窄表也缩成一团。min-width:max-content 保证宽表不被压扁。 */
.prose .table-wrap {
    overflow-x: auto; max-width: 100%; margin: 16px 0;
    border: 1px solid var(--border); border-radius: 12px;
    /* 右边还有列没显示时给个阴影提示。表格本来就能横向滚，但滚动条是 overlay 式的，
       不滚就看不见——审计里"数据被裁掉且找不回来"说的就是这个观感。
       local 背景跟着内容滚，scroll 背景固定：滚到尽头时白色把阴影盖住，提示自然消失。 */
    background:
        linear-gradient(to right, var(--bg-white) 30%, color-mix(in srgb, var(--bg-white) 0%, transparent)) left / 32px 100% no-repeat local,
        linear-gradient(to left, var(--bg-white) 30%, color-mix(in srgb, var(--bg-white) 0%, transparent)) right / 32px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) left / 14px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) right / 14px 100% no-repeat scroll;
}
.prose .table-wrap > table {
    display: table; width: 100%; min-width: min(100%, 640px);
    margin: 0; border: none; border-radius: 0;
}
.prose pre { overflow-x: auto; max-width: 100%; }

/* 行内 code 与长链接：ANTHROPIC_BASE_URL、完整 URL 这类不含空格的长串在窄屏顶得出屏。
   anywhere 只在放不下时才断，正常行宽下与不加一样。 */
.prose { overflow-wrap: break-word; }
.prose :not(pre) > code, .prose a { overflow-wrap: anywhere; }

/* 移动端才出现的两个入口：左侧目录抽屉、正文顶部的本页目录 */
.doc-mobile-bar { display: none; gap: 8px; margin-bottom: 14px; }
.doc-mobile-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; font-size: 13px; font-weight: 600;
    color: var(--text-700); background: var(--bg-white);
    border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.doc-mobile-btn:hover { border-color: var(--primary); color: var(--primary-text); }
.doc-toc-inline { display: none; margin: 0 0 20px; }
.doc-toc-inline > summary {
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-700);
    padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--bg-white); list-style: none;
}
.doc-toc-inline > summary::-webkit-details-marker { display: none; }
.doc-toc-inline[open] > summary { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.doc-toc-inline .toc { border: 1px solid var(--border); border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 10px 14px; }
.doc-toc-inline a { display: block; font-size: 13px; color: var(--text-500); padding: 4px 0; }
.doc-toc-inline ul { list-style: none; padding-left: 14px; margin: 0; }
.doc-toc-inline > details > ul, .doc-toc-inline .toc > ul { padding-left: 0; }
.doc-updated { font-size: 12px; color: var(--text-500); margin-top: 6px; }

/* 正文顶部的一行提示：右栏 CTA 只在 ≥1281px 出现，窄于它时由这一行顶上 */
.prose .doc-inline-cta {
    display: none; margin: 12px 0 18px; padding: 8px 12px;
    font-size: 13.5px; line-height: 1.5; color: var(--text-700);
    background: var(--primary-light); border: 1px solid var(--primary-20);
    border-radius: var(--radius-lg);
}
.prose .doc-inline-cta a { font-weight: 600; white-space: nowrap; }
.doc-inline-cta .sep { color: var(--text-500); margin: 0 0.25em; }

/* 文末：相关文档 + 一张品牌色 CTA 卡 + 企业版文字链接 */
.doc-related { max-width: var(--doc-measure); margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border); }
/* padding/border 归零是为了压掉 .prose h2 的下划线 */
.prose h2.doc-related-title {
    font-size: 15px; font-weight: 700; color: var(--text-900);
    margin: 0 0 16px; padding-bottom: 0; border-bottom: none;
}
/* 固定 2 列：4 张卡在正文列里排成 2×2，不会出现 3+1 */
.doc-related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .doc-related-grid { grid-template-columns: minmax(0, 1fr); } }
.prose a.doc-related-card {
    display: block; padding: 14px 16px; background: var(--bg-white);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    color: var(--text-900); font-weight: 400;
    transition: border-color 0.15s;
}
.prose a.doc-related-card:hover { border-color: var(--primary); text-decoration: none; color: var(--text-900); }
.doc-related-card .t { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.doc-related-card .d {
    font-size: 12px; color: var(--text-500); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.doc-cta {
    max-width: var(--doc-measure);
    margin-top: 40px; padding: 28px; text-align: center;
    background: var(--primary-light); border: 1px solid var(--primary-20);
    border-radius: var(--radius-xl);
}
.prose .doc-cta-title { font-size: 17px; font-weight: 700; color: var(--text-900); margin: 0 0 6px; }
.prose .doc-cta-sub { font-size: 13.5px; color: var(--text-700); margin: 0 auto 18px; max-width: 34em; }
.doc-cta-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* Phones: the two buttons stack at full width instead of wrapping side by side (labels never wrap) */
@media (max-width: 420px) {
    .doc-cta-actions { flex-direction: column; align-items: stretch; }
    .doc-cta-actions .btn { width: 100%; white-space: nowrap; }
}
.prose .doc-cta-ent { margin: 12px 0 0; text-align: center; font-size: 13px; }

/* 右栏目录下方的小卡 */
.toc-cta {
    margin-top: 24px; padding: 16px; text-align: center;
    background: var(--primary-light); border: 1px solid var(--primary-20);
    border-radius: var(--radius-lg);
}
.toc-cta-name { font-size: 13px; font-weight: 700; color: var(--text-900); margin-bottom: 6px; }
.toc-cta-sub { font-size: 12px; color: var(--text-700); margin-bottom: 12px; line-height: 1.45; }
.doc-toc .toc-cta a.btn { display: flex; justify-content: center; color: #1D1D1F; margin-bottom: 8px; padding: 7px 12px; font-size: 12px; }
.doc-toc .toc-cta a.toc-cta-ent { color: var(--primary-text); font-size: 12px; font-weight: 500; padding: 0; white-space: nowrap; }
.doc-toc .toc-cta a.toc-cta-ent:hover { text-decoration: underline; }

/* ───────── Tutorial components (markdown-authored, enhanced by doc-tut.js) ─────────
   The article body is written by hand in Markdown, so these blocks arrive as plain
   <div class="tut-*">. Everything visual, and any interaction, is added here and in
   doc-tut.js; writers only type the small markers documented in the writing guide. */

/* Tutorial info card: a list of "label: value" pairs rendered as one horizontal card.
   Capped at the reading measure so it lines up with running text on ultra-wide screens. */
.tut-meta {
    max-width: var(--doc-measure);
    margin: 20px 0 24px; padding: 14px 18px;
    background: var(--border-light); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.tut-meta ul {
    display: flex; flex-wrap: wrap; gap: 8px 28px;
    margin: 0; padding: 0; list-style: none;
}
.tut-meta li {
    margin: 0;
    font-size: 14px; line-height: 1.5; color: var(--text-700);
}
.tut-meta li strong { color: var(--text-900); font-weight: 600; }
.tut-meta li code { font-size: 12.5px; }
@media (max-width: 720px) {
    .tut-meta ul { flex-direction: column; gap: 6px; }
}

/* Step list: a CSS-counter timeline. Each .tut-step gets the next number in a solid
   brand-coloured circle, connected by a hairline. Writers never type the numbers. */
.tut-steps { counter-reset: tut-step; margin: 26px 0 8px; }
.tut-step {
    counter-increment: tut-step;
    position: relative; padding-left: 64px; padding-bottom: 26px;
    scroll-margin-top: 112px;   /* clears the 64px header plus the sticky step bar */
}
.tut-step::before {
    content: counter(tut-step);
    position: absolute; left: 0; top: -2px; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 999px;
    background: #D97757; color: #fff;
    font-size: 17px; font-weight: 700; line-height: 1;
}
.tut-step:not(:last-child)::after {
    content: "";
    position: absolute; left: 19px; top: 42px; bottom: -2px;
    width: 2px; background: var(--border);
}
.tut-step > h2,
.tut-step > h3,
.tut-step > h4 {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 0 0 10px;
}
.tut-step > :is(p, ul, ol, blockquote, dl, details, .callout, .admonition) {
    max-width: var(--doc-measure);
}
/* A screenshot inside a step fills the step content area, not the text measure. */
.tut-step > p:has(> img:only-child),
.tut-step > p:has(> .doc-zoom-wrap:only-child),
.tut-step > p:has(> a > img:only-child),
.tut-step > p:has(> a > .doc-zoom-wrap:only-child),
.tut-step > p.doc-figure { max-width: none; }
.tut-step > p:has(> img:only-child),
.tut-step > p:has(> .doc-zoom-wrap:only-child) { margin: 14px 0 0; }
.tut-step img { max-width: 100%; height: auto; }
@media (max-width: 720px) {
    .tut-step { padding-left: 44px; padding-bottom: 20px; }
    .tut-step::before { width: 30px; height: 30px; font-size: 14px; }
    .tut-step:not(:last-child)::after { left: 14px; top: 32px; }
    /* Phones: let each body screenshot break out of the 44px timeline indent and use the
       whole content column. The same 44px is added back to the width, so the right edge
       stays put and no horizontal scrolling is introduced. Thumbnail previews are not
       paragraphs inside .tut-step and keep their normal size. */
    .tut-step > p:has(> img:only-child),
    .tut-step > p:has(> .doc-zoom-wrap:only-child),
    .tut-step > p:has(> a > img:only-child),
    .tut-step > p:has(> a > .doc-zoom-wrap:only-child),
    .tut-step > p.doc-figure {
        width: calc(100% + 44px); max-width: none;
        margin-left: -44px; margin-right: 0;
    }
    /* Because the screenshot now slides over the timeline indent, it also runs under the
       2px connecting line (left 14px). Paint the rail first and the screenshot on top, so
       the line stops at the image edge instead of showing through it. The shadow, radius
       and zoom badge all belong to the image / its wrapper, so they are untouched. */
    .tut-step:not(:last-child)::after { z-index: 0; }
    .tut-step :is(img, .doc-zoom-wrap) { position: relative; z-index: 1; }
}

/* Thumbnail overview strip: on pages with an answer card it follows that card, otherwise
   it sits above the step list. Horizontally scrollable on phones; the number under each
   preview is the only visible text. */
.tut-overview {
    display: flex; gap: 10px; max-width: var(--doc-measure);
    margin: 0 0 6px; padding: 4px 2px 10px;
    overflow-x: auto; scrollbar-width: thin;
}
.prose a.tut-overview-item {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 4px; background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); color: var(--text-500); text-decoration: none;
}
.prose .tut-overview-item img {
    display: block; width: auto; height: 64px; max-width: none;
    border: none; border-radius: 6px; background: #fff; box-shadow: none;
    cursor: pointer;
}
.tut-overview-item span { font-size: 12px; font-weight: 600; line-height: 1; }
.prose a.tut-overview-item:hover,
.prose a.tut-overview-item:focus-visible {
    border-color: #D97757; color: var(--primary-text); text-decoration: none;
}
.prose a.tut-overview-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 720px) {
    .prose .tut-overview-item img { height: 52px; }
}

/* Title above the strip. doc-tut.js generates the block and, on pages with an answer
   card, moves it directly under that card so the first screen shows the one-line answer
   and the screenshot previews together. The heading names the strip and its step count. */
.tut-overview-block { max-width: var(--doc-measure); margin: 0 0 10px; }
.tut-overview-block > .tut-overview-title {
    margin: 0 0 4px; font-size: 12px; font-weight: 600; line-height: 1.5;
    letter-spacing: 0.01em; color: var(--text-500);
}
.tut-overview-block > .tut-overview { margin: 0; padding-top: 0; }

/* Completion line above the steps and the round toggle at the end of every step title.
   The empty circle means "not yet", the filled circle with a check means "done". */
.tut-progress { margin: 0 0 18px; font-size: 13px; font-weight: 600; color: var(--text-500); }
.tut-step-done {
    flex: none; margin-left: auto; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: var(--bg-white); border: 1px solid var(--border); border-radius: 999px;
    color: var(--text-500); cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.tut-step-done::before {
    content: ""; width: 12px; height: 12px;
    border: 1.5px solid var(--text-300); border-radius: 999px;
}
.tut-step-done:hover { border-color: #D97757; }
.tut-step-done:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tut-step-done[aria-pressed="true"] { border-color: #D97757; background: rgba(217, 119, 87, 0.12); }
.tut-step-done[aria-pressed="true"]::before {
    content: "\2713"; width: 18px; height: 18px; border: none;
    background: #D97757; color: #fff;
    font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
@media (max-width: 720px) {
    .tut-step-done { width: 24px; height: 24px; }
}

/* Inline reference to a numbered callout drawn on a screenshot. Same fill and white
   numeral as the step circles, small enough to sit inside a line of text. */
.tut-ref {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.3em; height: 1.3em; margin: 0 0.12em;
    border-radius: 999px; background: #D97757; color: #fff;
    font-size: 0.78em; font-weight: 700; line-height: 1;
    font-variant-numeric: tabular-nums; vertical-align: 0.08em;
}

/* Collapsible troubleshooting note inside a step. Keeps the callout palette so a
   warning still reads as a warning, but folds the long explanation away by default. */
.tut-help {
    max-width: var(--doc-measure);
    margin: 14px 0 0; padding: 0 14px 12px;
    background: var(--primary-light); border: 1px solid var(--primary-20);
    border-radius: var(--radius-lg);
}
.tut-help > summary {
    display: flex; align-items: center; gap: 8px;
    margin: 0 -14px; padding: 10px 14px;
    font-size: 13.5px; font-weight: 600; color: var(--text-900);
    cursor: pointer; list-style: none;
}
.tut-help > summary::-webkit-details-marker { display: none; }
.tut-help > summary::before {
    content: "?";
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; flex: none;
    border-radius: 999px; background: #D97757; color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1;
}
.tut-help[open] > summary { border-bottom: 1px solid var(--primary-20); }
.tut-help > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tut-help > :not(summary) { font-size: 13.5px; }
.tut-help > :not(summary):first-of-type { margin-top: 10px; }
.tut-help > :last-child { margin-bottom: 0; }

/* Answer card at the top of a tutorial: one sentence, a compact key/value table and
   the date the page was checked. The brand rule on the inline-start edge connects it
   to the step rail below; a soft surface keeps it distinct from the article body. */
.tut-answer {
    max-width: var(--doc-measure);
    margin: 18px 0 24px; padding: 12px 16px;
    background: var(--border-light);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-lg);
}
.tut-answer > :first-child { margin-top: 0; }
.tut-answer > :last-child { margin-bottom: 0; }
.tut-answer > p { margin: 0 0 8px; font-size: 15px; line-height: 1.65; }
.tut-answer .table-wrap {
    margin: 8px 0 6px; background: var(--bg-white);
}
.tut-answer table { font-size: 13.5px; }
.tut-answer th,
.tut-answer td { padding: 4px 10px; vertical-align: top; line-height: 1.45; }
.tut-answer th { padding: 4px 10px; font-size: 12px; }
.tut-answer td:first-child { color: var(--text-500); white-space: nowrap; }
.tut-answer td:nth-child(2) { width: 100%; }
.tut-answer td code {
    padding-top: 1px; padding-bottom: 1px;
    font-size: 12.5px; overflow-wrap: anywhere;
}
.tut-answer p.tut-verified {
    margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-500);
}
/* Copy control next to a code value in the answer table. Only the value column gets
   one; the icon-only button sits inline after the code and is revealed when the row
   is hovered, so it never reserves a text-width gap. Touch screens always show it. */
.tut-copy-cell {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    vertical-align: top;
}
.tut-copy-cell > code { min-width: 0; }
.tut-copy-cell > .code-copy {
    position: static; flex: none;
    width: 22px; height: 22px; padding: 0;
    min-width: 0; min-height: 0; line-height: 1;
    justify-content: center; opacity: 0;
    background: var(--bg-white); color: var(--text-500);
    border: 1px solid var(--border); border-radius: 5px;
}
.tut-copy-cell > .code-copy .code-copy-text { display: none; }
.tut-answer tr:hover .tut-copy-cell > .code-copy,
.tut-answer tr:focus-within .tut-copy-cell > .code-copy,
.tut-copy-cell > .code-copy:focus-visible,
.tut-copy-cell > .code-copy.is-copied,
.tut-copy-cell > .code-copy.is-failed { opacity: 1; }
.tut-copy-cell > .code-copy:hover {
    background: var(--primary-light); color: var(--primary-text);
    border-color: var(--primary-20);
}
.tut-copy-cell > .code-copy.is-copied {
    background: rgba(52,199,89,0.14); color: #1a7f3c;
    border-color: rgba(52,199,89,0.35);
}
.tut-copy-cell > .code-copy.is-failed {
    background: rgba(255,69,58,0.12); color: #b42318;
    border-color: rgba(255,69,58,0.3);
}
@media (hover: none), (pointer: coarse) {
    .tut-copy-cell > .code-copy { opacity: 1; }
}
@media (max-width: 720px) {
    .tut-answer { padding: 12px 14px; }
    .tut-answer td:first-child { white-space: normal; }
}

/* Error table under the "Common errors" heading. The first column quotes the exact
   message, so it is monospaced and may break anywhere; the table keeps the standard
   horizontal scroller on narrow screens. */
.tut-errors { max-width: var(--doc-measure); margin: 14px 0 20px; }
.tut-errors .table-wrap { margin: 0; }
.tut-errors table { font-size: 13.5px; }
.tut-errors th,
.tut-errors td { padding: 9px 12px; vertical-align: top; }
.tut-errors :is(th, td):first-child {
    font-family: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12.5px; overflow-wrap: anywhere;
}
.tut-errors td:last-child { min-width: 12em; }

/* Region label rendered into the static HTML for crawlers and no-JS readers. When
   doc-tut.js upgrades a row of panels to tabs, the same text sits on the tab button,
   so the in-panel copy is hidden there (the script also sets the hidden attribute). */
.tut-alt-label {
    margin: 0 0 8px;
    font-size: 14px; font-weight: 600; line-height: 1.5;
    color: var(--text-700);
}
.tut-alt-tabs .tut-alt-label { display: none; }

/* Region tabs reuse the OS tab chrome; only the width is capped so the tab set lines up
   with the rest of the tutorial text on large screens. */
.tut-alt-tabs { max-width: var(--doc-measure); margin: 16px 0; }
.tut-alt-tabs .os-tabs-panel > :first-child { margin-top: 0; }
.tut-alt-tabs .os-tabs-panel > :last-child { margin-bottom: 0; }

/* "What success looks like" note, placed under the screenshot of a step. The circle and the
   tick are drawn with CSS (borders / rotation), so no icon font or image is needed. */
.tut-check {
    position: relative; max-width: var(--doc-measure);
    margin: 12px 0 0; padding: 10px 14px 10px 44px;
    background: #EDF8F0; border: 1px solid #CBE7D3;
    border-radius: var(--radius-lg);
    font-size: 13.5px; line-height: 1.55; color: var(--text-700);
}
.tut-check::before {
    content: ""; position: absolute; left: 13px; top: 11px;
    width: 20px; height: 20px; border-radius: 999px; background: #2E9E52;
}
.tut-check::after {
    content: ""; position: absolute; left: 19px; top: 17px;
    width: 8px; height: 4px;
    border-left: 2px solid #fff; border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}
.tut-check > :first-child { margin-top: 0; }
.tut-check > :last-child { margin-bottom: 0; }
html[data-theme="dark"] .tut-check {
    background: rgba(46, 158, 82, 0.13); border-color: rgba(46, 158, 82, 0.38);
}

/* "Before you start" checklist. Same card palette as .tut-meta, but a vertical list with a
   square box per item makes it read as something to tick off. The box is pure CSS. */
.tut-before {
    max-width: var(--doc-measure);
    margin: 0 0 24px; padding: 14px 18px;
    background: var(--bg-white); border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-lg);
}
.tut-before ul { margin: 0; padding: 0; list-style: none; }
.tut-before li {
    position: relative;
    display: block;
    margin: 0; padding: 5px 6px 5px 31px; border-radius: 6px;
    font-size: 14px; line-height: 1.5; color: var(--text-700);
    cursor: pointer; user-select: none;
    transition: background-color 0.12s, color 0.12s;
}
.tut-before li + li { margin-top: 2px; }
.tut-before li:hover { background: var(--border-light); }
.tut-before li:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.tut-before li::before {
    content: ""; position: absolute; left: 6px; top: 7px;
    width: 15px; height: 15px;
    background: var(--bg-white); border: 1.5px solid var(--text-400, #9A918A);
    border-radius: 3px;
}
.tut-before li[aria-checked="true"] { color: var(--text-500); }
.tut-before li[aria-checked="true"]::before {
    content: "\2713"; width: 15px; height: 15px;
    background: #2E9E52; border-color: #2E9E52;
    color: #fff; font-size: 10px; font-weight: 700; line-height: 12px; text-align: center;
}

/* "All done" card after the last step. A soft green gradient, a large CSS tick and the
   author's next-step links laid out as buttons. */
.tut-done {
    position: relative; max-width: var(--doc-measure);
    margin: 30px 0 8px; padding: 76px 26px 26px;
    background: linear-gradient(180deg, #EAF7EE 0%, #F8FDF9 100%);
    border: 1px solid #CBE7D3; border-radius: var(--radius-lg);
    text-align: center;
}
.tut-done::before {
    content: ""; position: absolute; top: 18px; left: 50%; margin-left: -23px;
    width: 46px; height: 46px; border-radius: 999px; background: #2E9E52;
}
.tut-done::after {
    content: ""; position: absolute; top: 34px; left: 50%; margin-left: -9px;
    width: 18px; height: 9px;
    border-left: 3px solid #fff; border-bottom: 3px solid #fff;
    transform: rotate(-45deg);
}
.tut-done > :first-child { margin-top: 0; }
.tut-done > :last-child { margin-bottom: 0; }
.tut-done ul {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
    margin: 14px 0 0; padding: 0; list-style: none;
}
.tut-done li { margin: 0; }
.tut-done a {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 16px; font-size: 13.5px; font-weight: 600;
    color: var(--primary-text); background: var(--bg-white);
    border: 1px solid var(--primary-20); border-radius: 999px;
}
.tut-done a:hover { border-color: var(--primary); text-decoration: none; }
.tut-done a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
html[data-theme="dark"] .tut-done {
    background: linear-gradient(180deg, rgba(46, 158, 82, 0.16) 0%, rgba(46, 158, 82, 0.05) 100%);
    border-color: rgba(46, 158, 82, 0.36);
}
@keyframes tut-done-glow {
    0%   { box-shadow: 0 0 0 0 rgba(46, 158, 82, 0); }
    35%  { box-shadow: 0 0 0 7px rgba(46, 158, 82, 0.18); }
    100% { box-shadow: 0 0 0 0 rgba(46, 158, 82, 0); }
}
.tut-done.is-complete { animation: tut-done-glow 0.6s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .tut-done.is-complete { animation: none; }
}
@media (max-width: 720px) {
    .tut-before { padding: 12px 14px; }
    .tut-done { padding: 68px 18px 20px; }
    .tut-done ul { flex-direction: column; align-items: stretch; }
    .tut-done a { width: 100%; }
}

/* Sticky "current step" bar inside the step list. It parks right under the 64px site header
   (base.html .top-nav), with a lower z-index so the header and its drawer always stay on top.
   It only exists while .tut-steps is on screen; doc-tut.js injects the markup. */
.tut-sticky {
    position: sticky; top: 64px; z-index: 80;
    display: flex; align-items: center; gap: 12px;
    margin: 0 0 14px; padding: 8px 12px;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    font-size: 13px; color: var(--text-700);
}
.tut-sticky[hidden] { display: none; }
.tut-sticky-count { font-weight: 700; color: var(--text-900); font-variant-numeric: tabular-nums; }
.tut-sticky-count-short { display: none; }
.tut-sticky-title {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tut-sticky-back {
    flex: none; margin-left: auto; padding: 4px 10px;
    font-size: 12.5px; font-weight: 600; font-family: inherit;
    color: var(--primary-text); background: transparent;
    border: 1px solid var(--primary-20); border-radius: 999px; cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.tut-sticky-back:hover { border-color: var(--primary); background: var(--primary-light); }
.tut-sticky-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 720px) {
    /* Phones have no room for the back button: keep only "3 / 12" and the step title. */
    .tut-sticky { gap: 6px; padding: 7px 10px; }
    .tut-sticky-count-full { display: none; }
    .tut-sticky-count-short { display: inline; }
    .tut-sticky-back { display: none; }
}

/* ───────── OS 安装选项卡（div[data-os]）───────── */
/* ───────── OS 安装选项卡（div[data-os]）───────── */
.os-tabs { margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-white); overflow: hidden; }
.os-tabs-nav { display: flex; gap: 4px; padding: 8px 10px 0; background: var(--border-light); border-bottom: 1px solid var(--border); overflow-x: auto; }
.os-tab-btn {
    padding: 7px 14px; font-size: 13px; font-weight: 600; font-family: inherit;
    color: var(--text-500); background: transparent; border: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
    border-radius: 6px 6px 0 0; white-space: nowrap; transition: color 0.15s, background-color 0.15s;
}
.os-tab-btn:hover { color: var(--text-900); }
.os-tab-btn.is-active { color: var(--primary-text); background: var(--bg-white); border-bottom-color: var(--primary); }
.os-tabs-panel { padding: 14px 16px; }
.os-tabs-panel[hidden] { display: none; }
.os-tabs-panel > :first-child { margin-top: 0; }
.os-tabs-panel > :last-child { margin-bottom: 0; }

/* Middle breakpoint: 1024-1280px — drop the right TOC/CTA rail to give
   content room. Keep left sidebar for navigation. */
@media (max-width: 1280px) {
    .doc-layout { grid-template-columns: 240px minmax(0, 1fr); max-width: 1180px; }
    .doc-toc { display: none; }
    .doc-toc-inline { display: block; }   /* 右栏没了，目录挪到正文顶部 */
    .prose .doc-inline-cta { display: block; }
    .doc-content { padding: 32px 40px; max-width: none; }
}

/* 窄屏 / 平板：单列。
   🔴 中列必须写成 minmax(0, 1fr)：grid item 的默认 min-width 是 auto，
   写 1fr 会被最宽的那行代码整个撑开——改动前 390px 视口下正文实际宽 1149px，
   标题、正文、引用全部被裁到屏幕外。1280 与桌面断点本来就是 minmax(0,1fr)，
   唯独这一处漏了。 */
@media (max-width: 1024px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); }
    .doc-toc { display: none; }
    .doc-content { padding: 20px 16px; max-width: 100%; min-width: 0; }
    .doc-mobile-bar { display: flex; }
    /* 侧栏改成抽屉：66 条导航在窄屏原本是 display:none，等于完全没有导航 */
    .doc-sidebar {
        position: fixed; left: 0; top: 64px; bottom: 0; width: min(320px, 86vw);
        z-index: 180; transform: translateX(-100%); transition: transform 0.2s;
        box-shadow: var(--shadow-lg); height: auto;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }
    .doc-sidebar.is-open { transform: translateX(0); }
    .prose h1 { font-size: 26px; }
    .prose h2 { font-size: 20px; }
}

/* ═══════════ 首屏「60 秒接上」三步（首页 + /docs hub 共用）═══════════ */
/* 首页与 hub 都放在 .container 里，左右边距由容器给，和下面的区块左对齐 */
.qs-steps { padding: 28px 0 8px; }
.qs-head { font-size: 18px; font-weight: 700; color: var(--text-900); line-height: 1.35; margin: 0 0 14px; }
.qs-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.qs-card {
    position: relative; padding: 18px 18px 16px;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-xl); min-width: 0;
    display: flex; flex-direction: column;
}
/* 第三张卡装着一排工具，比前两张高不少；把链接压到卡片底部，三张看起来才是一组 */
.qs-card > .qs-link:last-child, .qs-card > .qs-tools { margin-top: auto; }
.qs-num {
    position: absolute; top: 14px; right: 16px;
    font-size: 22px; font-weight: 800; color: var(--border); line-height: 1;
}
.qs-title { font-size: 15px; font-weight: 700; color: var(--text-900); margin-bottom: 6px; }
.qs-desc { font-size: 13px; color: var(--text-500); line-height: 1.55; margin-bottom: 12px; }
.qs-link {
    display: inline-block; font-size: 13px; font-weight: 600;
    color: var(--primary-text); text-decoration: none;
}
.qs-link:hover { text-decoration: underline; }
.qs-link-sub { display: block; margin-top: 6px; font-weight: 500; color: var(--text-500); }
.qs-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.qs-tool {
    display: inline-block; padding: 5px 10px; font-size: 12.5px;
    color: var(--text-700); background: var(--border-light);
    border: 1px solid transparent; border-radius: 999px; text-decoration: none;
}
.qs-tool:hover { border-color: var(--primary); color: var(--primary-text); text-decoration: none; }
.qs-tool-more { background: transparent; color: var(--primary-text); font-weight: 600; }
@media (max-width: 900px) {
    .qs-grid { grid-template-columns: minmax(0, 1fr); }
    .qs-steps { padding: 20px 0 4px; }
}

/* 搜索结果里的关键词高亮（ts_headline 的记号在路由里转义后换成 <mark>） */
.result-excerpt mark {
    background: var(--primary-light); color: var(--primary-text);
    padding: 0 2px; border-radius: 3px; font-weight: 600;
}

/* hub 分类卡片副标题：来自 _meta.json 的分类 description（四语） */
.cat-desc { font-size: 12.5px; color: var(--text-500); font-weight: 400;
            margin-left: 10px; flex: 1 1 auto; min-width: 0;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) { .cat-desc { display: none; } }

/* ═══════════ 全站页脚 / 推广条 / 降级提示（base.html）═══════════ */
/* 页脚与顶栏一样恒深色，不随主题翻转 */
.site-footer {
    background: #0A0A0B; border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6); font-size: 13px; padding: 36px 24px 28px;
}
/* 1152 = .container 的 1200 减去两侧 24px 内边距，与正文区块左右对齐 */
.footer-inner {
    max-width: 1152px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 32px;
}
.site-footer .footer-h {
    font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
    color: rgba(255,255,255,0.9); margin: 0 0 10px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 6px; line-height: 1.45; }
.site-footer a { color: rgba(255,255,255,0.66); }
.site-footer a:hover { color: #fff; text-decoration: none; }
.site-footer a[aria-current] { color: var(--primary); }
.site-footer .footer-copy {
    max-width: 1152px; margin: 28px auto 0; padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px;
}
@media (max-width: 860px) { .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .site-footer { padding: 28px 16px 24px; } }

.promo-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9000;
    background: rgba(15,15,20,0.95); backdrop-filter: blur(8px);
    border-top: 1px solid rgba(217,119,87,0.4); padding: 12px 24px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.promo-inner {
    max-width: 960px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.promo-copy { flex: 1; min-width: 0; }
.promo-name { font-size: 14px; font-weight: 600; color: #fff; margin: 0 0 2px; }
.promo-text { font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.4; margin: 0; }
.promo-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.promo-banner .btn { white-space: nowrap; }
.promo-close {
    background: none; border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.7);
    padding: 6px 12px; border-radius: 999px; font-size: 12px; font-family: inherit;
    cursor: pointer; white-space: nowrap; transition: border-color 0.15s, color 0.15s;
}
.promo-close:hover { border-color: rgba(255,255,255,0.5); color: #fff; }
/* 推广条出现后给页面底部让出同样的高度，否则它会一直盖住页脚最后一行 */
body.has-promo { padding-bottom: 72px; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 640px) {
    .promo-banner { display: none; }
    body.has-promo { padding-bottom: 0; }
}

.degraded-banner {
    background: #fef3c7; border-bottom: 1px solid #f59e0b; padding: 8px 16px;
    text-align: center; font-size: 13px; color: #92400e;
}

/* ═══════════ 分类页（docs/category.html）═══════════ */
.cat-page { max-width: 980px; margin: 0 auto; padding: 28px 24px 48px; }
.cat-page-crumb { font-size: 12.5px; color: var(--text-500); margin-bottom: 16px; }
.cat-page-crumb a { color: var(--text-500); }
.cat-page-crumb .sep { margin: 0 6px; }
.cat-page-crumb .cur { color: var(--text-700); }
.cat-page-head { margin-bottom: 28px; }
.cat-page-head h1 {
    font-size: 26px; font-weight: 700; color: var(--text-900); margin: 0 0 8px;
    display: flex; align-items: center; gap: 10px;
}
.cat-page-head h1 .icon { font-size: 22px; }
.cat-page-head p { font-size: 14px; color: var(--text-500); margin: 0; }
.cat-page-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.cat-page-card {
    display: flex; flex-direction: column; padding: 18px 18px 16px;
    background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-xl);
    transition: border-color 0.15s;
}
.cat-page-card:hover { border-color: var(--primary); text-decoration: none; }
.cat-page-card .t { font-size: 15px; font-weight: 700; color: var(--text-900); line-height: 1.4; margin-bottom: 8px; }
/* 不给 .d 加 flex-grow：被拉高后 line-clamp 截掉的第 4 行会露出来；日期用 margin-top:auto 压到底 */
.cat-page-card .d {
    font-size: 12.5px; color: var(--text-500); line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-page-card .u { font-size: 11px; color: var(--text-500); margin-top: auto; padding-top: 12px; }
.cat-page-empty { text-align: center; color: var(--text-500); padding: 40px 0; }
.cat-page-back { margin-top: 32px; text-align: center; }
.cat-page-back a {
    display: inline-block; padding: 10px 24px; background: var(--border-light);
    border: 1px solid var(--border); border-radius: 999px;
    font-size: 13px; color: var(--text-700); transition: border-color 0.15s, color 0.15s;
}
.cat-page-back a:hover { border-color: var(--text-300); color: var(--text-900); text-decoration: none; }

/* ═══════════ Touch and small screens ═══════════ */
/* 16px text in inputs stops iOS Safari from zooming the page on focus */
@media (max-width: 1024px), (pointer: coarse) {
    .nav-search input,
    .side-filter,
    .cat-block > summary .cat-filter,
    .chat-input input,
    input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"],
    textarea, select { font-size: 16px; }
}

/* Reduced motion: no transitions or animations (covers the sidebar drawer slide) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Korean breaks between syllables by default, which splits words mid-word on narrow screens.
   Keep words whole in prose; overflow-wrap still breaks a long URL or model id. Code is untouched. */
html[lang|="ko"] :is(h1,h2,h3,h4,h5,p,li,a,span,td,th,label,button,blockquote,dd,summary,figcaption) { word-break: keep-all; overflow-wrap: break-word; }
html[lang|="ko"] :is(pre, code, pre *, code *) { word-break: normal; }
