/* 以既有首页为基准：Logo 在左，阅读页目录按钮位于 Logo 之后。 */
:root{--site-bar-height:80px;--site-bar-inset:32px;--site-menu-size:44px;--site-brand-gap:32px;--site-logo-width:136px;--bar:80px}
@media(max-width:639px){:root{--site-bar-inset:20px;--site-brand-gap:20px;--site-logo-width:100px}}
.site-header,.page-bar{box-sizing:border-box;height:var(--site-bar-height);padding:0 var(--site-bar-inset);display:flex;align-items:center;justify-content:space-between}
.site-header{width:100vw;border:0}
.site-header .brand{margin-left:0;height:44px;display:flex;align-items:center}
.site-header .brand-logo,.ainooks-home img{display:block;width:var(--site-logo-width);height:auto}
.page-bar{--bar:80px;border-bottom:0}
.page-bar .brand-group{gap:var(--site-brand-gap)}
.page-bar .brand-group .icon-button{width:var(--site-menu-size);min-width:var(--site-menu-size)}
.page-bar .zoom-tools{margin-left:auto}
.page-bar>.user-trigger{margin-left:12px}
.pdf-reader{height:calc(100dvh - var(--site-bar-height))}
@media(max-width:700px){.outline{top:var(--site-bar-height)}.page-bar>.user-trigger{margin-left:0}.page-bar .zoom-tools{gap:0}.page-bar .zoom-tools button,.page-bar #overview.icon-button{min-width:24px;width:24px;padding:4px 2px}.page-bar .zoom-tools output{min-width:30px}}
@media(max-width:380px){.page-bar .zoom-tools output{display:none}}
@media(max-width:380px){.page-bar .brand-group{gap:8px}}

/* 逻辑图入口与头像采用同一23px画布、1.6描边与前景色。 */
.page-bar #overview.icon-button{color:#171717}
.page-bar #overview.icon-button svg{width:23px;height:23px;flex:none}
@media(max-width:700px){.page-bar #overview.icon-button{min-width:32px;width:32px;padding:4px}}

/* 目录右侧分隔线负责收起；保留左缘窄边供悬停或触控展开。 */

/* 加减入口沿用头像的颜色、尺寸和圆头描边。 */
.page-bar #zoom-out,.page-bar #zoom-in{color:#171717;display:inline-flex;align-items:center;justify-content:center}
.page-bar #zoom-out svg,.page-bar #zoom-in svg{width:23px;height:23px;flex:none}
@media(max-width:700px){.page-bar #zoom-out,.page-bar #zoom-in{min-width:32px;width:32px;padding:4px}}

/* 桌面逻辑图与头像的图形画布间距由45px收为30px。 */
@media(min-width:701px){.page-bar{column-gap:9px}.page-bar>.user-trigger{margin-left:0}}

/* 20号黑色胶囊保持原版38px高度；按图形边缘统一相邻间距。 */
.page-bar .zoom-tools{gap:24.7px}
.page-bar .zoom-capsule{display:inline-flex;align-items:center;gap:2px;height:38px;padding:4px;background:#171717;color:#fff;border-radius:999px;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",Arial,sans-serif}
.page-bar .zoom-capsule #zoom-out,.page-bar .zoom-capsule #zoom-in{width:30px;min-width:30px;height:30px;min-height:30px;padding:0;color:#fff;background:transparent;border-radius:50%}
.page-bar .zoom-capsule #zoom-out:hover,.page-bar .zoom-capsule #zoom-in:hover{background:#414141}
.page-bar .zoom-capsule #zoom-out svg,.page-bar .zoom-capsule #zoom-in svg{width:17px;height:17px;stroke-width:1.6}
.page-bar .zoom-capsule #zoom-percent{display:block;min-width:46px;width:46px;font-family:inherit;font-size:13px;font-weight:400;line-height:1;text-align:center;color:#fff;font-variant-numeric:tabular-nums}
body.detail-open .page-bar .zoom-capsule{display:none}
@media(max-width:700px){.page-bar .zoom-tools{gap:21.7px}}
@media(max-width:380px){.page-bar{padding-inline:12px}.page-bar .zoom-tools{gap:13.7px}.page-bar #overview.icon-button{width:24px;min-width:24px;padding:0}.page-bar>.user-trigger{width:28px;min-width:28px}}

/* 沿用首页文章入口的蓝紫柔和渐变，统一控件悬停。 */
:root{--interaction-hover-background:radial-gradient(ellipse 34% 85% at 13% 75%,rgba(160,120,245,.12),transparent 78%),radial-gradient(ellipse 27% 115% at 56% 15%,rgba(117,163,245,.1),transparent 80%),radial-gradient(ellipse 23% 65% at 88% 68%,rgba(202,137,225,.09),transparent 78%),radial-gradient(ellipse 18% 90% at 37% 47%,rgba(139,190,230,.06),transparent 75%)}
.page-bar .zoom-capsule #zoom-out:hover,.page-bar .zoom-capsule #zoom-in:hover,.hero-navigation #hero-logic:hover{background:var(--interaction-hover-background)}
/* 黑底主按钮保留对比度，叠加同款渐变。 */
.cover-actions button.primary-action:not(:disabled):hover{background-color:var(--mint);background-image:var(--interaction-hover-background);color:#fff}

/* 正文直接开始，程序定位正文时不绘制标题式焦点框。 */
.node-dialog #detail:focus{outline:none}

/* 当前阅读节点沿用悬停渐变，离开鼠标后仍保留选中提示。 */
.outline .outline-chapter>.outline-node.active{background:var(--interaction-hover-background)}

/* 章节列表仅保留文字与留白，不显示分隔线和收展箭头。 */
.outline .outline-chapter{border-bottom:0;margin-bottom:8px;padding-bottom:8px}
.outline .outline-chapter>button:first-child::after{content:none;display:none}

/* 章节之间只保留留白，展开或收起均不显示横线。 */
.outline .outline-chapter:not(.collapsed){border-bottom:0}

/* 保留目录展开与收起热区，不再绘制竖向轨道。 */

/* 目录固定显示，无整栏收起或边缘触发热区。 */
@media(max-width:700px){.pdf-reader{grid-template-columns:minmax(120px,38vw) minmax(0,1fr)}.pdf-reader .outline{position:static;width:auto;box-shadow:none;min-width:0}}

:is(.outline button,.node-dialog .node-controls button,.page-bar button,.user-trigger,.reading-diagram-controls button,.hero-chapters .chapter-link,.hero-navigation button,.cover-actions button,.cover-footer button,.hero-home,.mindmap-topic,.login-close):not(:disabled):hover{background:var(--interaction-hover-background)}

/* 阅读目录采用编号在上、名称在下的左对齐白底标题。 */
.outline .outline-chapter>button:first-child{
  display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:8px 14px;margin-bottom:10px;
  width:fit-content;max-width:100%;
  min-height:52px;background:#fff!important;border-radius:9px;
  color:var(--sidebar-ink)!important;font-size:14px;line-height:1.6;text-align:left;
}
.outline .outline-chapter>button:first-child>span{
  flex-shrink:0;font-size:12px;color:var(--sidebar-ink)!important;
}
.outline .outline-chapter>button:first-child>strong{
  font-size:16px;line-height:1.5;font-weight:600;color:var(--sidebar-ink)!important;overflow-wrap:anywhere;text-wrap:balance;
}
.outline .outline-chapter>button:first-child:hover{
  background-color:#fff!important;background-image:none!important;
}
.outline .outline-chapter.collapsed>button:first-child{margin-bottom:0}
.outline .outline-parent{font-size:14px;font-weight:500;line-height:1.65;padding:10px 8px;margin-top:12px;margin-bottom:5px}
.outline .outline-chapter>.outline-node{font-size:13px;line-height:1.65;padding:10px 10px 10px 17px;min-height:44px;border-radius:8px}
@media(max-width:700px){
  .outline .outline-chapter>button:first-child>span{font-size:11px}
  .outline .outline-chapter>button:first-child{gap:4px;padding:8px 10px}
  .outline .outline-chapter>button:first-child>strong{font-size:14px}
  .outline .outline-parent{font-size:12px;padding-inline:4px;overflow-wrap:anywhere}
  .outline .outline-chapter>.outline-node{font-size:12px;padding-inline:9px;overflow-wrap:anywhere}
}
.outline .outline-parent{display:grid;grid-template-columns:max-content max-content minmax(0,1fr);column-gap:0;align-items:baseline}
.outline .outline-topic-number{white-space:nowrap;margin-right:.125em}
.outline .outline-topic-separator{margin-right:4px}
.outline .outline-topic-title{min-width:0;overflow-wrap:anywhere}
.outline .outline-chapter>.outline-node{padding-left:var(--topic-inset,17px)!important}

/* 小节背景贴合文字；把层级缩进移到外侧，保留文字与主题名称对齐。 */
.outline .outline-chapter>.outline-node{
  --node-offset:max(0px,calc(var(--topic-inset,17px) - 10px));
  width:fit-content;max-width:calc(100% - var(--node-offset));
  margin-left:var(--node-offset);padding-left:10px!important;
}

/* 正文占满可用区域，以原左侧收紧后的留白作为两侧统一边距。 */
.node-dialog #detail,.node-dialog #detail:has(.development-art),.node-dialog #detail:has(.llm-compact){width:100%;max-width:none;margin-inline:0;padding-inline:calc(max(0px,(100% - 1150px)/2)*2/3 + 32px)}
.node-dialog .node-footer{width:100%;max-width:none;margin-inline:0}
@media(max-width:700px){.node-dialog #detail,.node-dialog #detail:has(.development-art),.node-dialog #detail:has(.llm-compact){padding-inline:13.333px}}

/* 翻页区上下留白在互换后同步缩至2/3。 */
.node-dialog .node-footer,.node-dialog .resource-links+.node-footer{margin-top:42.667px}
.node-dialog #detail,.node-dialog #detail:has(.development-art),.node-dialog #detail:has(.llm-compact){padding-bottom:21.333px}
@media(max-width:700px){.node-dialog .node-footer,.node-dialog .resource-links+.node-footer{margin-top:26.667px}}

/* 逻辑图容器接收进入／返回焦点时不绘制整块外框。 */
.logic-map:focus,.logic-map:focus-visible{outline:none;box-shadow:none}

/* 与 Chapter 首行的 24px 目录留白＋8px 标题内边距一致；滚动后仍保留。 */
.pdf-reader{--reader-top-gap:32px}
.pdf-reader .logic-map{margin-top:var(--reader-top-gap);height:calc(100% - var(--reader-top-gap))}

/* 小节选中使用主页同款渐变，章节颜色不因聚焦灰显。 */
#graph .node-selection-background{display:none;pointer-events:none}
#graph .node.selected .node-selection-background{display:block}
#graph .node-selection-background>div{width:100%;height:100%;border-radius:12px;background:var(--interaction-hover-background)}
#graph .node.selected>rect{stroke-width:1px!important;filter:none}

/* 特殊正文也遵循统一的页尾间距与翻页宽度。 */
.node-dialog #detail:has(.helix-overview){padding-bottom:21.333px}
.node-dialog #detail:has(.development-art) .node-footer{width:100%;max-width:none;margin-inline:0}
.node-dialog #detail:has(.runtime-overview) .node-footer{margin-top:42.667px;padding-top:0}
@media(max-width:700px){.node-dialog #detail:has(.runtime-overview) .node-footer{margin-top:26.667px}}
