/* Mermaid 图表 */
.markdown-section .mermaid {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  margin: 1.2em 0;
  padding: 8px 0;
}

.markdown-section .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* 右侧：本页目录 + 批注 */
#right-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  background: #fafbfc;
  border-left: 1px solid #eaecef;
  padding: 72px 14px 24px;
  box-sizing: border-box;
  font-size: 13px;
  line-height: 1.5;
}

.right-panel-section + .right-panel-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eaecef;
}

.right-panel-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.02em;
}

#ann-count {
  font-weight: 400;
  color: #909399;
}

/* 正文区域为右侧栏留出空间（docsify .content 为 absolute + right:0，margin 无效） */
section.content,
.content {
  right: 260px;
}

body.close section.content,
body.close .content {
  right: 260px;
}

.page-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-toc li {
  margin: 4px 0;
  line-height: 1.45;
}

.page-toc li.toc-h2 {
  padding-left: 0;
}

.page-toc li.toc-h3 {
  padding-left: 12px;
}

.page-toc li.toc-h4 {
  padding-left: 24px;
  font-size: 12px;
  color: #606266;
}

.page-toc a {
  color: #606266;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-toc a:hover,
.page-toc a.active {
  color: var(--theme-color, #2563eb);
}

.page-toc-empty {
  color: #909399;
  font-size: 12px;
}

/* 左侧栏不展开页内小标题（subMaxLevel=0 的兜底） */
.sidebar .app-sub-sidebar {
  display: none !important;
}

/* 批注列表 */
.page-annotations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ann-card {
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.ann-quote {
  color: #606266;
  border-left: 3px solid #fde68a;
  padding-left: 8px;
  margin-bottom: 6px;
  font-style: italic;
  word-break: break-word;
}

.ann-comment {
  color: #303133;
  margin-bottom: 6px;
  word-break: break-word;
}

.ann-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #909399;
  font-size: 11px;
}

.ann-delete {
  border: none;
  background: none;
  color: #f56c6c;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.ann-delete:hover {
  text-decoration: underline;
}

.ann-empty {
  color: #909399;
  font-size: 12px;
}

/* 正文内高亮 */
mark.apigc-ann {
  background: #fef3c7;
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
}

mark.apigc-ann.active {
  background: #fde047;
  outline: 1px solid #f59e0b;
}

/* 选取批注浮动按钮 */
#ann-toolbar {
  position: absolute;
  z-index: 100;
  display: none;
  background: #303133;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#ann-toolbar.visible {
  display: block;
}

#ann-popover {
  position: absolute;
  z-index: 101;
  display: none;
  width: 280px;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

#ann-popover.visible {
  display: block;
}

#ann-popover textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 8px;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

#ann-popover .ann-pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

#ann-popover button {
  border: 1px solid #dcdfe6;
  background: #fff;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

#ann-popover button.primary {
  background: var(--theme-color, #2563eb);
  border-color: var(--theme-color, #2563eb);
  color: #fff;
}

@media (max-width: 1100px) {
  #right-panel {
    display: none;
  }
  section.content,
  .content,
  body.close section.content,
  body.close .content {
    right: 0;
  }
}
