/* 仅作用于知识库，沿用站点配色、宋体与圆角。 */
.tpkb {
    --tpkb-bg: var(--tata-bg, #f1f4f8);
    --tpkb-card: var(--tata-card, #fff);
    --tpkb-text: var(--tata-text, #283443);
    --tpkb-muted: var(--tata-muted, #637385);
    --tpkb-accent: var(--tata-accent, #2679a8);
    --tpkb-soft: var(--tata-soft, #e8f3fb);
    --tpkb-line: var(--tata-line, #e5ebf1);
    --tpkb-radius: var(--tata-radius, 18px);
    --tpkb-code-keyword: #8a44a1;
    --tpkb-code-string: #187550;
    --tpkb-code-number: #a25716;
    --tpkb-code-name: #1b69a3;
    --tpkb-code-comment: #687885;
    color: var(--tpkb-text);
    font-family: SimSun, "Songti SC", serif;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
.tpkb *, .tpkb *::before, .tpkb *::after { box-sizing: border-box; }
body.tpkb-view .wp-site-blocks > main#wp--skip-link--target.tpkb-main {
    width: min(1180px, calc(100% - 40px));
    max-width: 1180px;
    padding: 0 !important;
    background: transparent;
    border: 0;
    border-radius: 0;
    flex-grow: 1;
    margin-inline: auto;
    margin-block: 32px 40px;
}
.tpkb h1, .tpkb h2, .tpkb h3, .tpkb h4, .tpkb h5, .tpkb h6 { font-family: SimSun, "Songti SC", serif; color: var(--tpkb-text); line-height: 1.45; letter-spacing: 0; }
.tpkb h1 { margin: 0 0 16px; font-size: clamp(28px, 3vw, 38px); }
.tpkb h2 { font-size: clamp(23px, 2vw, 28px); }
.tpkb h3 { font-size: 21px; }
.tpkb p { margin: 0 0 16px; }
.tpkb a { color: var(--tpkb-accent); text-underline-offset: .2em; }
.tpkb button, .tpkb input { font: inherit; }
.tpkb button { cursor: pointer; }
.tpkb :is(a, button, input, summary, pre):focus-visible { outline: 3px solid var(--tpkb-accent); outline-offset: 4px; }
.tpkb :is(h2, h3, h4, h5, h6)[id] { scroll-margin-top: 110px; }
.tpkb-visually-hidden, .tpkb-skip-link:not(:focus) { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.tpkb-skip-link:focus { position: fixed; top: 8px; left: 16px; padding: 12px 20px; background: #fff; color: #185b82; z-index: 100000; border-radius: 8px; }
.tpkb-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; padding: 16px 22px; background: var(--tpkb-card); border: 1px solid var(--tpkb-line); border-radius: var(--tpkb-radius); }
.tpkb-breadcrumbs { min-width: 0; flex: 1 1 220px; }
.tpkb-breadcrumbs ol { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 5px 10px; font-size: 14px; }
.tpkb-breadcrumbs li { display: inline; }
.tpkb-breadcrumbs li:not(:last-child)::after { content: "/"; color: var(--tpkb-muted); margin-left: 10px; }
.tpkb-breadcrumbs a { text-decoration: none; }
.tpkb-breadcrumbs [aria-current] { color: var(--tpkb-muted); }
.tpkb-search { display: flex; gap: 8px; flex: 0 1 320px; min-width: 230px; }
.tpkb .tpkb-search input { min-width: 0; width: 100%; background: var(--tpkb-bg); border: 1px solid var(--tpkb-line); color: var(--tpkb-text); padding: 8px 12px; border-radius: 9px; font-size: 15px; }
.tpkb .tpkb-search input::placeholder { color: var(--tpkb-muted); opacity: 1; }
.tpkb .tpkb-search button, .tpkb .tpkb-button { border: 1px solid var(--tpkb-accent); background: var(--tpkb-accent); color: var(--tpkb-card); border-radius: 9px; padding: 8px 16px; font-size: 15px; font-weight: 700; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; }
.tpkb .tpkb-button-secondary { background: var(--tpkb-soft); color: var(--tpkb-accent); border-color: transparent; }
.tpkb-actions { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; margin-top: 24px; }
.tpkb-sheet { background: var(--tpkb-card); border: 1px solid var(--tpkb-line); border-radius: var(--tpkb-radius); padding: clamp(24px, 4vw, 42px); box-shadow: 0 4px 18px rgba(35, 62, 88, .025); }
.tpkb-eyebrow { color: var(--tpkb-accent); font-size: 13px; letter-spacing: .04em; margin-bottom: 8px !important; }
.tpkb-lead { color: var(--tpkb-muted); font-size: 17px; line-height: 1.95; max-width: 780px; }
.tpkb-meta, .tpkb-row-meta { font-size: 13px; color: var(--tpkb-muted); }
.tpkb-stats { display: flex; flex-wrap: wrap; gap: 18px 48px; margin: 28px 0 0; padding-top: 22px; border-top: 1px solid var(--tpkb-line); }
.tpkb-stats > div { min-width: 95px; display: flex; flex-direction: column-reverse; gap: 2px; }
.tpkb-stats dt { font-size: 13px; color: var(--tpkb-muted); }
.tpkb-stats dd { font-size: 29px; font-weight: 700; color: var(--tpkb-accent); margin: 0; line-height: 1.35; }
.tpkb-section { margin-top: 30px; }
.tpkb-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding-inline: 4px; }
.tpkb-section-heading h2 { margin: 0; }
.tpkb-section-heading > span { color: var(--tpkb-muted); font-size: 13px; }
.tpkb-rows { display: flex; flex-direction: column; gap: 14px; }
.tpkb a.tpkb-row { display: flex; align-items: center; gap: 22px; width: 100%; padding: 24px 28px; background: var(--tpkb-card); color: var(--tpkb-text); border: 1px solid var(--tpkb-line); border-radius: var(--tpkb-radius); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tpkb-row-number { display: flex; flex: 0 0 52px; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 13px; background: var(--tpkb-soft); color: var(--tpkb-accent); font-size: 23px; line-height: 1; }
.tpkb-row-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.tpkb-row-title { font-size: 22px; font-weight: 700; line-height: 1.5; }
.tpkb-row-summary { color: var(--tpkb-muted); font-size: 15px; }
.tpkb-row-arrow { color: var(--tpkb-accent); background: var(--tpkb-soft); border-radius: 10px; width: 36px; min-height: 50px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 21px; }
.tpkb-empty { background: var(--tpkb-card); color: var(--tpkb-muted); border: 1px dashed var(--tpkb-line); border-radius: var(--tpkb-radius); padding: 32px; line-height: 1.9; }
.tpkb-empty p:last-child { margin-bottom: 0; }
.tpkb-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 18px; margin: 30px 0; font-size: 14px; }
.tpkb-video-list { list-style: none; margin: 0; padding: 0; }
.tpkb-video-list > li + li { border-top: 1px solid var(--tpkb-line); padding-top: 20px; margin-top: 20px; }
.tpkb-video-list a { font-size: 19px; font-weight: 700; text-decoration: none; }
.tpkb-video-list p { margin: 5px 0 0; }
.tpkb-video-timestamps { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 14px 0 0; list-style: none; }
.tpkb-video-timestamps li > :is(a, span) { display: inline-block; border-radius: 7px; background: var(--tpkb-soft); color: var(--tpkb-accent); padding: 4px 10px; font-size: 13px; font-weight: 400; line-height: 1.6; }
.tpkb-video-timestamps a:hover { text-decoration: underline; }
.tpkb-learning-entry { margin-block: 0 22px; max-width: none !important; }

/* 阅读正文与右侧目录，手机端目录折叠到文章上方。 */
.tpkb-reading-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.tpkb-reading-layout.tpkb-has-toc { grid-template-columns: minmax(0, 1fr) 220px; }
.tpkb-article { min-width: 0; grid-column: 1; grid-row: 1; }
.tpkb-article-header { max-width: 780px; margin: 0 auto 30px; padding-bottom: 24px; border-bottom: 1px solid var(--tpkb-line); }
.tpkb-article-header h1 { margin-top: 14px; }
.tpkb-article-header .tpkb-meta { margin-bottom: 0; }
.tpkb-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tpkb-tags a { background: var(--tpkb-soft); border-radius: 7px; padding: 3px 10px; font-size: 13px; text-decoration: none; }
.tpkb-prose { max-width: 780px; margin-inline: auto; font-size: 17px; line-height: 1.95; min-width: 0; }
.tpkb-prose > :first-child { margin-top: 0; }
.tpkb-prose h2 { margin: 1.8em 0 .7em; padding-bottom: .35em; border-bottom: 1px solid var(--tpkb-line); }
.tpkb-prose h3, .tpkb-prose h4 { margin: 1.6em 0 .65em; }
.tpkb-prose p, .tpkb-prose ul, .tpkb-prose ol, .tpkb-prose blockquote, .tpkb-prose table { margin: 0 0 1.2em; }
.tpkb-prose li + li { margin-top: .3em; }
.tpkb-prose li > p { margin-bottom: .5em; }
.tpkb-prose img { max-width: 100%; height: auto; border-radius: 10px; }
.tpkb-prose blockquote { margin-inline: 0; padding: 12px 20px; border-inline-start: 4px solid var(--tpkb-accent); background: var(--tpkb-soft); border-radius: 0 10px 10px 0; color: var(--tpkb-text); }
.tpkb-prose blockquote > :last-child { margin-bottom: 0; }
.tpkb-prose table { display: block; overflow-x: auto; width: 100%; border-collapse: collapse; font-size: 15px; }
.tpkb-prose th, .tpkb-prose td { padding: 10px 14px; border: 1px solid var(--tpkb-line); text-align: start; min-width: 70px; }
.tpkb-prose th { background: var(--tpkb-soft); }
.tpkb-prose hr { height: 1px; border: 0; background: var(--tpkb-line); margin: 28px 0; }
.tpkb .tpkb-heading-anchor { margin-left: .45em; font-size: .75em; text-decoration: none; opacity: 0; }
.tpkb-prose :is(h2, h3, h4, h5, h6):hover .tpkb-heading-anchor, .tpkb-heading-anchor:focus { opacity: 1; }
.tpkb-toc { grid-column: 2; grid-row: 1; position: sticky; top: calc(24px + var(--wp-admin--admin-bar--height, 0px)); background: var(--tpkb-card); border: 1px solid var(--tpkb-line); border-radius: var(--tpkb-radius); padding: 18px 12px; }
.tpkb-toc summary { cursor: pointer; font-size: 16px; font-weight: 700; padding: 0 7px 8px; list-style-position: inside; }
.tpkb-toc summary > span { float: right; color: var(--tpkb-accent); }
.tpkb-toc nav { max-height: calc(100vh - 150px); overflow-y: auto; }
.tpkb-toc ol { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 1.65; }
.tpkb-toc li { margin: 3px 0; }
.tpkb-toc a { display: block; padding: 7px 9px; color: var(--tpkb-muted); text-decoration: none; border-radius: 7px; border-left: 2px solid transparent; }
.tpkb-toc a:hover, .tpkb-toc a[aria-current] { background: var(--tpkb-soft); color: var(--tpkb-accent); }
.tpkb-toc a[aria-current] { border-left-color: var(--tpkb-accent); }
.tpkb-toc-level-3 { padding-left: 12px; }
.tpkb-toc-level-4 { padding-left: 22px; }
.tpkb-article-section { max-width: 780px; margin: 32px auto 0; padding-top: 24px; border-top: 1px solid var(--tpkb-line); }
.tpkb-article-section > h2 { margin: 0 0 18px; }
.tpkb-note { margin: 28px auto; max-width: 780px; background: var(--tpkb-soft); border-left: 4px solid var(--tpkb-accent); border-radius: 10px; padding: 20px 24px; }
.tpkb-note h2 { margin: 0 0 10px; font-size: 20px; }
.tpkb-note ul { margin-bottom: 0; }
.tpkb-neighbors { display: flex; gap: 14px; margin: 32px auto 0; max-width: 780px; }
.tpkb-neighbor { display: flex; flex-direction: column; flex: 1; padding: 16px 20px; border-radius: 12px; background: var(--tpkb-soft); text-decoration: none; min-width: 0; }
.tpkb-neighbor > span { font-size: 13px; color: var(--tpkb-muted); }
.tpkb-neighbor strong { margin-top: 4px; font-size: 17px; }
.tpkb-neighbor-next { text-align: right; }
.tpkb-related-list, .tpkb-source-list { margin: 0; padding: 0; list-style: none; }
.tpkb-related-list li + li { margin-top: 8px; }
.tpkb-related-list a { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 9px; border: 1px solid var(--tpkb-line); text-decoration: none; }
.tpkb-related-list a > span:first-child { flex: 1; }
.tpkb-related-list small { color: var(--tpkb-muted); font-size: 12px; }
.tpkb-source-list { counter-reset: sources; }
.tpkb-source-list li { counter-increment: sources; padding: 16px 0 16px 32px; position: relative; border-top: 1px solid var(--tpkb-line); }
.tpkb-source-list li:first-child { border-top: 0; padding-top: 0; }
.tpkb-source-list li::before { content: counter(sources, decimal-leading-zero); position: absolute; left: 0; color: var(--tpkb-muted); font-size: 13px; }
.tpkb-source-list .tpkb-meta { margin: 4px 0 0; }
.tpkb-source-title { font-weight: 700; text-decoration: none; }
.tpkb-example + .tpkb-example { margin-top: 30px; }
.tpkb-example h3 { margin-top: 18px; }
.tpkb-status { display: inline-block; color: var(--tpkb-muted); border: 1px solid var(--tpkb-line); font-size: 13px; border-radius: 7px; padding: 3px 10px; }
.tpkb-status.is-verified { color: var(--tpkb-accent); background: var(--tpkb-soft); }
.tpkb-code-label { font-size: 14px; color: var(--tpkb-muted); margin-bottom: 8px !important; }

/* 代码块保持原始文本可复制，长行在块内横向滚动。 */
.tpkb code, .tpkb pre { font-family: Consolas, "Cascadia Code", monospace; }
.tpkb :not(pre) > code { background: var(--tpkb-soft); color: var(--tpkb-accent); border-radius: 5px; padding: .12em .35em; font-size: .88em; overflow-wrap: anywhere; }
.tpkb pre { display: block; max-width: 100%; overflow: auto; border: 1px solid var(--tpkb-line); background: var(--tpkb-bg); color: var(--tpkb-text); border-radius: 10px; padding: 18px 20px; line-height: 1.7; font-size: 14px; tab-size: 4; white-space: pre; }
.tpkb pre > code { background: transparent; color: inherit; padding: 0; border: 0; border-radius: 0; font-size: inherit; white-space: pre; word-break: normal; overflow-wrap: normal; }
.tpkb-code-wrap { margin: 0 0 1.3em; border: 1px solid var(--tpkb-line); border-radius: 11px; overflow: hidden; background: var(--tpkb-bg); }
.tpkb-code-wrap pre { border: 0; border-top: 1px solid var(--tpkb-line); border-radius: 0; margin: 0; }
.tpkb-code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 14px; background: var(--tpkb-soft); font-family: SimSun, "Songti SC", serif; font-size: 12px; color: var(--tpkb-muted); }
.tpkb-code-toolbar button { background: var(--tpkb-card); color: var(--tpkb-accent); border: 1px solid var(--tpkb-line); border-radius: 6px; padding: 3px 11px; font-size: 12px; min-height: 28px; }
.tpkb .hljs-keyword, .tpkb .hljs-selector-tag, .tpkb .hljs-literal { color: var(--tpkb-code-keyword); }
.tpkb .hljs-string, .tpkb .hljs-doctag { color: var(--tpkb-code-string); }
.tpkb .hljs-number, .tpkb .hljs-symbol { color: var(--tpkb-code-number); }
.tpkb .hljs-title, .tpkb .hljs-built_in, .tpkb .hljs-type { color: var(--tpkb-code-name); }
.tpkb .hljs-comment { color: var(--tpkb-code-comment); font-style: italic; }
.tpkb .hljs-params { color: inherit; }
.tpkb .tpkb-math-source {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    vertical-align: middle;
    white-space: nowrap;
    padding-block: .12em;
}
/* 只约束公式外壳，普通行内文本继续使用原来的基线与换行。 */
.tpkb .tpkb-math-source:has(> .katex-display) {
    display: block;
    width: 100%;
    overflow: visible;
    padding-block: 0;
}
.tpkb .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: 8px; }
.tpkb .katex { font-size: 1.08em; }
html[data-tata-theme="dark"] .tpkb, html[data-theme="dark"] .tpkb {
    --tpkb-code-keyword: #d5a4ee;
    --tpkb-code-string: #a1d6b1;
    --tpkb-code-number: #ecc28d;
    --tpkb-code-name: #8dc8ef;
    --tpkb-code-comment: #9baab7;
}
@media (hover: hover) and (pointer: fine) {
    .tpkb a.tpkb-row:hover { transform: translateY(-2px); border-color: var(--tpkb-accent); box-shadow: 0 8px 25px rgba(35, 80, 120, .08); }
    .tpkb a.tpkb-row:hover .tpkb-row-title { color: var(--tpkb-accent); }
    .tpkb-related-list a:hover, .tpkb-neighbor:hover { outline: 1px solid var(--tpkb-accent); }
}
@media (max-width: 900px) {
    .tpkb-reading-layout.tpkb-has-toc { grid-template-columns: minmax(0, 1fr); }
    .tpkb-toc { grid-column: 1; grid-row: 1; position: static; }
    .tpkb-has-toc .tpkb-article { grid-row: 2; }
    .tpkb-toc nav { max-height: 340px; }
    .tpkb-toc summary { padding-bottom: 0; }
    .tpkb-toc details[open] summary { padding-bottom: 10px; }
}
@media (max-width: 781px) {
    body.tpkb-view .wp-site-blocks > main#wp--skip-link--target.tpkb-main { width: calc(100% - 24px); }
    .tpkb-toolbar { padding: 16px; gap: 14px; }
    .tpkb-search { flex: 1 1 100%; min-width: 0; }
    .tpkb-sheet { padding: 25px 22px; }
    .tpkb h1 { font-size: 28px; }
    .tpkb-section-heading { align-items: flex-start; }
    .tpkb-section-heading > span { max-width: 40%; text-align: right; }
    .tpkb a.tpkb-row { padding: 20px; gap: 14px; }
    .tpkb-row-number { width: 40px; height: 44px; flex-basis: 40px; font-size: 20px; }
    .tpkb-row-title { font-size: 21px; }
    .tpkb-row-summary { font-size: 14px; }
    .tpkb-row-arrow { width: 25px; font-size: 18px; min-height: 44px; }
    .tpkb-stats { gap: 20px 30px; }
    .tpkb-prose { font-size: 16px; }
    .tpkb pre { padding: 16px; font-size: 13px; }
    .tpkb .tpkb-heading-anchor { opacity: .7; }
}
@media (max-width: 480px) {
    .tpkb a.tpkb-row { gap: 12px; padding: 18px 16px; }
    .tpkb-row-number { width: 32px; height: 38px; flex-basis: 32px; font-size: 17px; border-radius: 9px; }
    .tpkb-row-arrow { width: 18px; background: transparent; }
    .tpkb-row-title { font-size: 20px; }
    .tpkb-row-meta { font-size: 12px; }
    .tpkb-sheet { padding: 23px 18px; }
    .tpkb-stats { justify-content: space-between; gap: 12px; }
    .tpkb-stats > div { min-width: 75px; }
    .tpkb-stats dd { font-size: 25px; }
    .tpkb-neighbors { flex-direction: column; }
    .tpkb-related-list small { display: none; }
    .tpkb-empty { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .tpkb *, .tpkb *::before, .tpkb *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
