/* 文章浅色主题唯一入口：白底、深灰文字，蓝／橙／紫标识章节。 */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #ffffff;
  --sidebar: #ffffff;
  --surface-raised: #f5f5f5;
  --surface-hover: #eeeeee;
  --ink: #202020;
  --sidebar-ink: #444444;
  --muted: #666666;
  --line: #dedede;
  --accent: #326aa8;
  --mint: #444444;
  --chapter-1: #326aa8;
  --chapter-2: #9b561f;
  --chapter-3: #82529b;
  --chapter-1-surface: #e7eff8;
  --chapter-2-surface: #f8eee4;
  --chapter-3-surface: #f0e9f5;
  --map-paper: var(--bg);
  --map-ink: var(--ink);
  --map-muted: var(--sidebar-ink);
  --map-rule: var(--line);
}
body { background: var(--bg); color: var(--ink); }
::selection, .exhibition-cover ::selection { background: #dce8f5; color: #202020; }
* { scrollbar-color: #aaaaaa var(--bg); }
button, select, input { color: var(--ink); background: transparent; border-color: var(--line); }
button:hover { background: var(--surface-hover); }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible,
.reading-diagram-frame:focus-visible { outline-color: var(--accent); }
.skip { background: var(--sidebar); color: var(--ink); }
.page-bar { background: var(--sidebar); border-color: var(--line); }
.brand-group .edition-brand, .brand-group .edition-brand:hover { color: var(--ink); }
.reader-location, .zoom-tools output { color: var(--muted); }
.icon-button img { filter: none; }

/* 阅读目录使用深灰文字与浅灰选中背景。 */
.outline, .logic-map, #graph { filter: none; }
.outline { background: var(--sidebar); border-color: var(--line); border-right:0; }
.outline .outline-heading, .outline .outline-heading > span,
.outline .outline-chapter > button, .outline .outline-chapter > button:first-child > span,
.outline .outline-chapter > button strong, .outline .outline-parent,
.outline .outline-node, .outline .outline-node:hover, .outline .outline-node.active {
  color: var(--sidebar-ink) !important;
}
.outline .outline-heading > span, .outline .outline-chapter > button:first-child > span {
  color: var(--muted) !important;
}
.outline .outline-node:hover, .outline .outline-chapter > button:first-child:hover {
  background: var(--surface-hover);
}
.outline .outline-node.active { background: #eeeeee; color: var(--ink) !important; }
.outline .outline-chapter { border-color: var(--line); }
.logic-map { background: var(--bg); background-image: none; }
#graph .muted-child rect, #graph .muted-main rect { fill: #f5f5f5 !important; stroke: #bcbcbc !important; }
#graph .muted-child text, #graph .muted-child tspan,
#graph .muted-main text, #graph .muted-main tspan { fill: var(--muted) !important; }
#graph > svg > g text:not(.node text) { fill: var(--sidebar-ink); }
#graph .node:focus-visible > rect { stroke: var(--accent) !important; }
#map-error { background: #fff2ed; color: #9b442a; }

/* 首页原片保持原色，导航统一浅色。 */
.exhibition-cover { background: var(--bg); }
.hero-navigation { background: #fffffff5; color: var(--sidebar-ink); border: 1px solid var(--line); box-shadow: 0 8px 28px #00000030; }
.hero-chapters .chapter-link { color: var(--sidebar-ink); }
.hero-chapters .chapter-link:hover { background: #eeeeee; color: var(--ink); }
.hero-navigation #hero-logic { background: #e9e9e9; color: var(--ink); }
.hero-navigation #hero-logic:hover { background: #dedede; }
.hero-chapters { border-color: var(--line); }
.cover-actions .primary-action { background: #e3e1dd; color: #252525; }
.cover-actions .primary-action:hover { background: #f0eeea; }
.cover-actions .primary-action img { filter: none; }
.cover-reserve {
  color-scheme: light;
  --chapter-1: #326aa8;
  --chapter-2: #9b561f;
  --chapter-3: #82529b;
  --map-paper: #fff;
  --map-ink: #202020;
  --map-muted: #555;
  --map-rule: #dedede;
  background: var(--map-paper);
  color: var(--map-ink);
  scrollbar-color: #aaa var(--map-paper);
}
.cover-reserve ::selection { background: #dce8f5; color: #202020; }
.chapter-mindmap:nth-child(1) { --map-accent: var(--chapter-1); }
.chapter-mindmap:nth-child(2) { --map-accent: var(--chapter-2); }
.chapter-mindmap:nth-child(3) { --map-accent: var(--chapter-3); }
.mindmap-root strong { color: var(--map-accent); }
.mindmap-topic-number { opacity: 1; }

/* 正文、放大图片与控件。教学素材的像素与原色不做修改。 */
.node-dialog, .node-dialog #detail { background: var(--paper); color: var(--ink); }
.node-dialog .reading-heading h2 { color: #000; }
.node-dialog #points { color: var(--ink); }
.node-dialog #points li::marker { color: var(--muted); }
.node-dialog .resource-links .resource-link,
.resource-link:not(.video-resource-link), .resource-link:not(.video-resource-link):visited,
.resource-link:not(.video-resource-link):hover, .quote-source, .quote-source:visited,
.quote-source:hover { color: var(--muted); }
.node-dialog .resource-links .resource-link:hover { color: var(--ink); }
.resource-link.video-resource-link, .resource-link.video-resource-link:hover { color: var(--chapter-3); }
.node-dialog .node-controls button, .node-dialog .node-controls button:last-child,
.node-dialog .node-controls button:hover { color: var(--muted); background: transparent; }
.node-dialog .node-controls button strong { color: var(--sidebar-ink); }
.stack-image figcaption, .stack-image .prompt-example-caption,
.image-pair-subtitle, .overview-api-notes, .runtime-concept-note, .timeline-scope-note,
.capability-evidence, #points .capability-evidence { color: var(--muted); }
.three-image-cards .stack-image-button { background: transparent; }
.lightbox { background: var(--sidebar); border-color: var(--line); color: var(--ink); }
.lightbox::backdrop { background: #080808dc; }
.lightbox-toolbar { color: var(--sidebar-ink); }
.verification { color: var(--muted); background: var(--surface-raised); }
.cost-quote { color: var(--sidebar-ink); border-color: #555; }
.table-note, :root .table-note { color: var(--muted); }
.node-dialog .point-emphasis, .node-dialog .table-term-highlight, .node-dialog .summary-reason { color: #b33e32; }

/* 表格层次使用白色与浅灰。 */
.table-scroll { border-color: var(--line); }
.parameter-table, .layer-term-table { color: var(--ink); }
.parameter-table th, .parameter-table td,
.core-concepts-table .parameter-table th, .core-concepts-table .parameter-table td,
.layer-term-table th, .layer-term-table td { border-color: var(--line); }
.parameter-table thead th, .core-concepts-table .parameter-table thead th,
.layer-term-table thead th { background: #eeeeee; color: var(--ink); }
.parameter-table tbody th, .core-concepts-table .parameter-table tbody th { background: #f5f5f5; color: var(--ink); }
.parameter-table tbody tr:nth-child(even) td, .core-concepts-table .parameter-table tbody tr:nth-child(even) td,
.layer-term-table tbody tr:nth-child(even) { background: #fafafa; }
.parameter-table tbody tr:nth-child(odd) td, .core-concepts-table .parameter-table tbody tr:nth-child(odd) td { background: var(--paper); }
.table-summary, .table-summary li { color: var(--ink); }

/* 文字时间线、展开说明与源稿；图像素材仍保留其原有底色。 */
.history-timeline, .agent-source-transcript, .overview-api-details {
  background: var(--surface-raised); border-color: var(--line);
}
.history-event { border-color: var(--line); }
.history-year, .company-timeline-step time, .shared-timeline-card time,
.above time, .openai-label { color: var(--chapter-1); }
.below time, .anthropic-label { color: var(--chapter-2); }
.history-event strong, .company-timeline-step strong, .shared-timeline-card strong,
.agent-source-text { color: var(--ink); }
.history-event p, .company-timeline-detail, .shared-timeline-card > span,
.agent-source-note, .agent-source-transcript summary, .overview-api-details summary { color: var(--muted); }
.timeline-company-title, .company-timeline h3, .blackbox-comparison-cards .desktop-card-caption,
.agent-function-cards .image-section-heading, .evolution-comparison-card figcaption,
.runtime-overview, .runtime-file-explanation { color: var(--sidebar-ink); }
.runtime-concept-formula, .runtime-concept-formula span { color: var(--sidebar-ink); }
.runtime-concept-captions h4, .runtime-file-explanation strong { color: var(--chapter-1); }
.runtime-concept-captions > div:nth-child(2) h4 { color: var(--chapter-2); }
.runtime-concept-captions p { color: var(--muted); }
.company-timeline-row::before, .shared-timeline-axis::before,
.shared-timeline-stem { background: #555; }
.company-timeline-dot, .above .shared-timeline-dot { background: var(--chapter-1); }
.below .shared-timeline-dot { background: var(--chapter-2); }
.overview-bottom-note { border-color: var(--line); }
.route-flow-node.idea { background: #edf4ed; border-color: #9cb69e; color: #3e6342; }
.route-flow-node.model { background: #e7eff8; border-color: #9db8d6; color: var(--chapter-1); }
.route-flow-node.hardware { background: #f8eee4; border-color: #bd9675; color: var(--chapter-2); }
.route-flow-label { background: var(--paper); border-color: #bd9675; color: var(--chapter-2); }

/* 内嵌逻辑图与按钮采用同一浅色主题，不对教学图片作滤镜。 */
.reading-diagram h3, .reading-source a { color: var(--ink); }
.reading-diagram-controls button { background: var(--surface-raised); color: var(--sidebar-ink); border-color: #aaaaaa; }
.reading-diagram-controls button:hover { background: #eeeeee; color: var(--ink); }
.reading-diagram-controls span, .reading-source { color: var(--muted); }
.reading-diagram-frame { background: #fafafa; scrollbar-color: #aaaaaa #fafafa; }
.reading-diagram .node .label, .reading-diagram .nodeLabel, .reading-diagram .node text,
.reading-diagram .node tspan, .reading-diagram .nodeLabel p { color: var(--ink) !important; fill: var(--ink) !important; }
.reading-diagram .node rect, .reading-diagram .node polygon,
.reading-diagram .node circle { fill: #f7f7f7 !important; stroke: #999999 !important; }
.reading-diagram .flowchart-link, .reading-diagram .edgePaths path { stroke: #777 !important; }
.reading-diagram.concept-map .node.idea rect{fill:#e7eff8!important;stroke:#326aa8!important}
.reading-diagram.concept-map .node.method rect{fill:#e7f1ef!important;stroke:#36736c!important}
.reading-diagram.concept-map .node.support rect{fill:#f6ede4!important;stroke:#98602f!important}

@media (max-width: 700px) {
  .outline { background: var(--sidebar); box-shadow: 22px 0 65px #00000055; }
}

/* 正文与章节大标题使用深灰，小节目录保留清晰层次。 */
.outline .outline-chapter > button:first-child,
.outline .outline-chapter > button:first-child > span,
.outline .outline-chapter > button:first-child > strong { color: var(--ink) !important; }
.node-dialog .video-card-caption, .node-dialog .video-card-caption > span { color: var(--ink); }

/* 阅读精修：共享图文起点，保持已确认的颜色与宋体。 */
:root { --reading-measure: 46rem; --reading-gap: 32px; }
.node-dialog #detail, .node-dialog #detail:has(.development-art), .node-dialog #detail:has(.llm-compact) {
  padding: 40px 48px 64px;
}
.node-dialog .reading-heading { margin-bottom: var(--reading-gap); padding-bottom: 24px; border-bottom: 0; }
.node-dialog .reading-heading h2 { text-align: center; padding-inline: 0; }
.node-dialog #points {
  max-width: none; margin: var(--reading-gap) 0 24px;
  padding-left: 0; font-size: 18px; line-height: 1.9; letter-spacing: .01em;
}
.node-dialog #points li { padding-left: 0; margin-bottom: 0; }
.node-dialog #points li + li { margin-top: 20px; }
.node-dialog .stack-image figcaption, .node-dialog .desktop-card-caption {
  font-size: 14px; line-height: 1.6; margin-top: 16px;
}
.outline .outline-chapter > button:first-child { font-size: 15px; gap: 8px; }
.outline .outline-chapter > button:first-child > span { font-size: 12px; }
.outline .outline-chapter > button:first-child > strong { font-weight: 600; }
.outline .outline-parent { font-size: 14px; font-weight: 600; padding: 20px 8px 8px; }
.outline .outline-chapter > .outline-node { font-size: 13px; line-height: 1.65; padding: 10px 12px 10px 20px; }
.node-dialog .resource-links {
  justify-content: flex-start; align-items: baseline; text-align: left;
  flex-wrap: wrap; gap: 8px 20px; margin: 28px 0 0;
}
.node-dialog .resource-links .resource-link { font-size: 13px; line-height: 1.8; }
.node-dialog .resource-links .resource-link:hover { text-underline-offset: 4px; }
.node-dialog .node-footer, .node-dialog .resource-links + .node-footer { margin-top: 32px; }
.node-dialog .node-controls button, .node-dialog .node-controls button:last-child {
  font-size: 12px; min-height: 52px; gap: 4px;
}
.node-dialog .node-controls button strong { font-size: 15px; line-height: 1.65; }
@media (max-width: 700px) {
  .node-dialog #detail, .node-dialog #detail:has(.development-art), .node-dialog #detail:has(.llm-compact) {
    padding: 28px 20px 40px;
  }
  .node-dialog #points { font-size: 16px; line-height: 1.9; margin-top: 28px; padding-left: 0; }
  .node-dialog #points li + li { margin-top: 16px; }
  .node-dialog .stack-image figcaption, .node-dialog .desktop-card-caption { font-size: 13px; margin-top: 12px; }
  .node-dialog .resource-links { gap: 8px 16px; }
  .node-dialog .resource-links .resource-link { font-size: 12px; }
  .node-dialog .node-controls { gap: 20px; }
  .node-dialog .node-controls button strong { font-size: 14px; }
}
@media (max-width: 700px) {
  .node-dialog .image-stack.model-file-cards { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .node-dialog .model-file-cards .stack-image:first-child .stack-image-button,
  .node-dialog .model-file-cards .stack-image-button { height: auto; min-height: 0; padding: 0; }
  .node-dialog .model-file-cards .stack-image:first-child .stack-image-button img,
  .node-dialog .model-file-cards .stack-image-button img { height: auto; max-height: none; width: 100%; }
}

/* 精简阅读顶栏：目录入口与图标工具。 */
#overview.icon-button, #actual-size.icon-button { width:44px; padding:0; color:var(--muted); align-items:center; justify-content:center; }
#overview.icon-button:not([hidden]) { display:inline-flex; }

#actual-size.icon-button { display:inline-flex; }
@media (max-width:700px) { #actual-size.icon-button { display:none; } }

/* 四章架构：工具使用为绿色，感悟与思考保留紫色。 */
:root{--chapter-3:#36736c;--chapter-3-surface:#e7f1ef;--chapter-4:#82529b;--chapter-4-surface:#f0e9f5}
.chapter-mindmap:nth-child(4){--map-accent:var(--chapter-4)}
@media(min-width:1000px){.cover-reserve{grid-template-columns:repeat(4,minmax(0,1fr));column-gap:clamp(20px,3vw,50px)}}

/* 五章架构：方法章为棕色，感悟与思考保留紫色。 */
:root{--chapter-4:#98602f;--chapter-4-surface:#f6ede4;--chapter-5:#82529b;--chapter-5-surface:#f0e9f5}
.chapter-mindmap:nth-child(5){--map-accent:var(--chapter-5)}
@media(min-width:1000px){.cover-reserve{grid-template-columns:repeat(5,minmax(0,1fr));column-gap:clamp(16px,2vw,32px)}}
.hero-chapters .chapter-entries{flex-wrap:wrap}

/* 正式品牌入口：紧邻目录，返回网站首页。 */
/* 标题自动接收阅读焦点，但不绘制浏览器默认焦点边框。 */
#detail-title:focus{outline:none}
.ainooks-home{display:inline-flex;align-items:center;flex:none;min-height:44px;text-decoration:none}
.ainooks-home img{display:block;width:136px;height:auto}
@media(max-width:700px){.brand-group{gap:20px}.ainooks-home img{width:100px}.page-bar{padding:0 12px;gap:6px}.zoom-tools{gap:2px}.zoom-tools button{min-width:32px;padding:8px 6px}#overview.icon-button{width:34px}.zoom-tools output{min-width:34px}}

/* 正文页只保留返回逻辑图入口；缩放控件只服务逻辑图视图。 */
body.detail-open #zoom-out,body.detail-open #zoom-percent,body.detail-open #zoom-in,body.detail-open #actual-size{display:none}

/* 阅读进度位于两侧等宽翻页区之间；悬停整块高亮。 */
.node-dialog .node-controls{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:stretch;gap:20px;width:100%}
.node-dialog .node-controls #reading-progress{align-self:center;justify-self:center;margin:0;padding:0;font-size:11px;line-height:1.6;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap;text-align:center}
.node-dialog .node-controls button,.node-dialog .node-controls button:last-child{width:fit-content;max-width:100%;min-width:0;min-height:72px;padding:12px 16px;border:0;border-radius:8px;background:transparent;justify-self:start}
.node-dialog .node-controls button:last-child{justify-self:end}
.node-dialog .node-controls button:not(:disabled):hover{background:#f2f2f2}
.node-dialog .node-controls button strong,.node-dialog .node-controls button:hover strong{text-decoration:none}
.node-dialog .node-controls button:disabled{background:transparent}
@media(max-width:700px){.node-dialog .node-controls{gap:8px}.node-dialog .node-controls button,.node-dialog .node-controls button:last-child{padding:12px 8px}}

/* 08号表达：圆角、薄边框与柔弧连接；色彩仍由现有主题与聚焦状态提供。 */
#graph .node rect { stroke: var(--line) !important; stroke-width: 1px !important; }
#graph .node:hover { filter: brightness(.99); }
#graph .node:focus-visible > rect { stroke: var(--accent) !important; stroke-width: 2px !important; }
#graph .branch-connectors path { stroke-linecap: round; stroke-linejoin: round; }

/* 阅读界面隐藏滚动条外观，滚轮、触控和键盘滚动仍可用。 */
.pdf-reader,.pdf-reader *,.node-dialog,.node-dialog *, .exhibition-cover{scrollbar-width:none}
.pdf-reader::-webkit-scrollbar,.pdf-reader *::-webkit-scrollbar,.node-dialog::-webkit-scrollbar,.node-dialog *::-webkit-scrollbar,.exhibition-cover::-webkit-scrollbar{display:none;width:0;height:0}

/* 多章节逻辑图使用独立配色，不循环复用前五章。 */
:root{
 --chapter-4:#a33f50;--chapter-4-surface:#f7e9ed;
 --chapter-6:#77721f;--chapter-6-surface:#f2f1e3;
 --chapter-7:#237f98;--chapter-7-surface:#e5f2f6;
 --chapter-8:#5153a4;--chapter-8-surface:#ededf8;
 --chapter-9:#ad4c85;--chapter-9-surface:#f7e8f1;
}

/* 全站文章截图统一圆角，裁剪截图与录屏封面沿用同一尺寸。 */
:root{--article-media-radius:16px}
#image-stack img,#large-image{border-radius:var(--article-media-radius)}
#image-stack .stack-image-button,
#image-stack .video-card-media,
#image-stack .siri-crop,
#image-stack .task-row-clip,
#image-stack .overview-device-shot,
#large-frame.siri-crop,
#large-frame .task-row-clip{border-radius:var(--article-media-radius);overflow:hidden}
