/* 技术文章详情页样式 */
body {
  overflow-x: hidden; /* 防止横向滚动 */
  background-color: #f2f3f5;
}

.tech-detail-container {
  /* 模仿系统文章页布局：使用 flex 而不是 grid，避免横向滚动问题 */
  display: flex;
  gap: 24px;
  align-items: flex-start;
  max-width: 1200px; /* 默认最大宽度（适用于屏幕宽度小于 1200px） */
  margin: 40px auto 0; /* 与文章列表页保持一致 */
  padding: 24px;
  padding-left: 0px;
  padding-right: 0px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0; /* 允许子元素缩小，避免产生横向滚动条 */
}

/* 左侧导航 - 桌面端隐藏 */
.tech-sidebar {
  display: none;
}

/* 桌面端（≥768px） */
@media (min-width: 768px) {
  .tech-sidebar {
    display: none !important; /* 桌面端完全隐藏 */
  }
}

/* 左侧分类侧边栏（使用首页样式） - 桌面端隐藏 */
.tech-detail-sidebar-left {
  display: none;
}

/* 桌面端（≥768px）完全隐藏 */
@media (min-width: 768px) {
  .tech-detail-sidebar-left {
    display: none !important;
  }
}

/* 自定义侧边栏滚动进度条 */
.tech-detail-sidebar-left .ddkk-sidebar-scrollbar-track,
.tech-detail-sidebar-left .ddkk-sidebar-scrollbar-thumb {
  position: absolute;
  right: 1px;
  border-radius: 999px;
  pointer-events: none;
  display: none;
}

.tech-detail-sidebar-left .ddkk-sidebar-scrollbar-track {
  top: 12px;
  bottom: 12px;
  width: 4px;
  background-color: rgba(0, 0, 0, 0.03);
}

.tech-detail-sidebar-left .ddkk-sidebar-scrollbar-thumb {
  top: 12px;
  width: 4px;
  height: 200px;
  background-color: rgba(0, 0, 0, 0.28);
}

/* 桌面端显示自定义滚动条 */
@media (min-width: 768px) {
  .tech-detail-sidebar-left .ddkk-sidebar-scrollbar-track,
  .tech-detail-sidebar-left .ddkk-sidebar-scrollbar-thumb {
    display: block;
  }
}

/* 移除选中状态的背景颜色，只保留文字颜色 */
.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-item.active .sidebar-link {
  background: transparent !important;
  color: #1677ff !important;
}

.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-item.active .sidebar-link .sidebar-icon {
  color: #1677ff !important;
}

/* 点击时字体变成蓝色 - 使用更高优先级和 !important */
.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-link:active,
.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-list .sidebar-item .sidebar-link:active {
  background: transparent !important;
  color: #1677ff !important;
}

.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-link:active .sidebar-icon,
.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-list .sidebar-item .sidebar-link:active .sidebar-icon {
  color: #1677ff !important;
}

.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-link:active .sidebar-text,
.tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-list .sidebar-item .sidebar-link:active .sidebar-text {
  color: #1677ff !important;
}

/* 移动端侧边栏样式 */
@media (max-width: 767.98px) {
  .tech-detail-sidebar-left {
    display: flex !important;
    position: fixed;
    top: 55px;
    left: 0;
    width: 150px;
    height: calc(100vh - 55px)!important; 
    height: calc(100dvh - 55px)!important; 
    max-height: none;
    z-index: 10001 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
    overflow-y: auto;
    background: #ffffff;
    box-shadow: none;
    padding: 0;
    flex-direction: column;
    /* 移除移动端点击高亮 */
    -webkit-tap-highlight-color: transparent;
  }

  .tech-detail-sidebar-left.show {
    transform: translateX(0);
  }

  /* 移除侧边栏内链接的点击高亮 */
  .tech-detail-sidebar-left .ddkk-sidebar-index .sidebar-link {
    -webkit-tap-highlight-color: transparent;
  }
}

/* 主内容区 */
.tech-detail-main {
  background: #fff;
  padding: 25px;
  border-radius: 4px; /* 小圆角 */
  box-shadow: none; /* 移除阴影 */
  flex: 1;            /* 在 flex 布局中占据剩余空间 */
  min-width: 0;       /* 允许内容区缩小，避免产生横向滚动条 */
  overflow-wrap: break-word; /* 防止内容溢出 */
}

/* 当目录隐藏时，主内容区域占据全部宽度 */
.tech-detail-container.toc-hidden {
  /* 目录隐藏时，保留 gap，确保精选推荐和主内容区域之间有间距 */
  gap: 24px; /* 保持与正常状态相同的间距 */
}

.tech-detail-container.toc-hidden .tech-detail-main {
  flex: 1; /* 占据剩余空间 */
  max-width: 100%; /* 确保不超出容器 */
}

/* 当目录隐藏但精选推荐存在时，侧边栏仍然显示（只显示精选推荐） */
.tech-detail-container.toc-hidden .tech-detail-sidebar {
  width: 300px; /* 保持宽度，只显示精选推荐 */
  flex-shrink: 0; /* 防止被压缩 */
  min-width: 300px; /* 确保最小宽度 */
}

.tech-detail-container.toc-hidden .tech-detail-sidebar .tech-detail-toc {
  display: none !important; /* 隐藏目录 */
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f0f0;
}

.article-title {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 16px 0;
  color: #000;
}

/* 创建一个包装器行让 article-meta 和 article-tags 在同一行 */
.article-header {
  display: flex;
  flex-direction: column;
}

/* 使用 flex 布局让 article-meta 和 article-tags 在同一行 */
.article-header > .article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: #999;
  margin-bottom: 0;
  align-items: center;
}

/* 让 article-tags 在同一行，靠右对齐 */
.article-header > .article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  margin-top: -24px; /* 负边距让它们在同一行，根据 article-meta 的高度调整 */
  position: relative;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-item a {
  color: #1890ff;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.meta-item a:hover {
  text-decoration: none;
}

.tag {
  padding: 2px 8px;
  background: #f0f0f0;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
}

/* 文章内容 - 模仿系列教程文章页样式 */
.article-content {
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
  word-wrap: break-word;
  font-weight: 400;
  color: #252933;
  padding-bottom: 1px;
  background-color: #fff;
}

.article-content p {
  line-height: inherit;
  margin: 22px 0;
}

.article-content p:last-child {
  margin-bottom: 0;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  font-weight: 600;
  line-height: 1.5;
  color: #252933;
  margin-top: 25px;
  margin-bottom: 10px;
  padding-bottom: 5px;
  transition: color 0.2s ease;
}

/* 点击锚链接时标题高亮显示（仅字体颜色变红色） */
.article-content .catalog-h.ddkk-heading-highlight {
  color: #f9007d !important;
}

.article-content h1 {
  font-size: 22px;
  line-height: 34px;
  margin-bottom: 5px;
  padding-bottom: 0;
  border-bottom: none;
  margin-top: 0;
}

.article-content h2 {
  font-size: 20px;
  line-height: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ececec;
}

.article-content h3 {
  font-size: 18px;
  line-height: 26px;
}

.article-content h4 {
  font-size: 16px;
  line-height: 24px;
}

.article-content h5 {
  font-size: 15px;
  line-height: 22px;
}

.article-content h6 {
  font-size: 14px;
  line-height: 22px;
}

.article-content ul,
.article-content ol {
  margin: 22px 0;
  padding-left: 28px;
  line-height: inherit;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

.article-content li {
  margin-bottom: 0;
  line-height: inherit;
}

.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
  margin-top: 3px;
}

.article-content ol li {
  padding-left: 6px;
}

.article-content a {
  color: #1677ff;
  text-decoration: none;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.article-content a:hover {
  color: #0958d9;
}

.article-content img {
  max-width: 100%;
  height: auto;
}

.article-content code:not(pre code) {
  word-break: break-word;
  border-radius: 2px;
  background-color: #fff5f5;
  font-size: 0.87em;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  color: #ff502c;
  padding: 0.065em 0.4em;
}

.article-content pre {
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 0;
  overflow-x: auto;
  margin: 0;
  line-height: 1.6;
}

.article-content pre code {
  padding: 15px 12px;
  margin: 0;
  display: block;
  overflow-x: auto;
  overflow-wrap: normal;
  word-wrap: normal;
  word-break: normal;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-variant-ligatures: common-ligatures;
  font-feature-settings: 'liga' 1, 'calt' 1;
  border-radius: 0;
}

.article-content blockquote {
  color: #666;
  padding: 1px 23px;
  margin: 22px 0;
  border-left: 4px solid #cbcbcb;
  background-color: #f8f8f8;
}

.article-content blockquote p {
  margin: 10px 0;
}

.article-content blockquote p:not(:last-child) {
  margin-bottom: 8px;
}

.article-content table {
  display: inline-block !important;
  font-size: 12px;
  width: auto;
  max-width: 100%;
  overflow: auto;
  border: 1px solid #f6f6f6;
  margin: 22px 0;
}

.article-content table thead {
  background: #f6f6f6;
  color: #000;
}

.article-content table tr:nth-child(2n) {
  background-color: #fcfcfc;
}

.article-content table th,
.article-content table td {
  padding: 12px 7px;
  line-height: 24px;
  text-align: left;
  border: none;
}

/* ==================== 代码块增强样式（模仿系列教程） ==================== */
/* CSS变量 - 用于全屏关闭按钮主题适配 */
:root {
  --ddkk-code-fullscreen-close-bg: rgba(255, 255, 255, 0.1);
  --ddkk-code-fullscreen-close-border: rgba(255, 255, 255, 0.25);
  --ddkk-code-fullscreen-close-color: rgba(255, 255, 255, 0.88);
  --ddkk-code-fullscreen-close-hover-bg: rgba(255, 255, 255, 0.2);
  --ddkk-code-fullscreen-close-hover-border: rgba(255, 255, 255, 0.38);
}

:root[data-ddkk-hljs-theme-mode="light"] {
  --ddkk-code-fullscreen-close-bg: rgba(0, 0, 0, 0.05);
  --ddkk-code-fullscreen-close-border: rgba(0, 0, 0, 0.12);
  --ddkk-code-fullscreen-close-color: rgba(15, 23, 42, 0.86);
  --ddkk-code-fullscreen-close-hover-bg: rgba(0, 0, 0, 0.09);
  --ddkk-code-fullscreen-close-hover-border: rgba(0, 0, 0, 0.2);
}

:root[data-ddkk-hljs-theme="monokai"] {
  --ddkk-code-fullscreen-close-bg: rgba(248, 248, 242, 0.15);
  --ddkk-code-fullscreen-close-border: rgba(248, 248, 242, 0.35);
  --ddkk-code-fullscreen-close-color: #f8f8f2;
  --ddkk-code-fullscreen-close-hover-bg: rgba(248, 248, 242, 0.24);
  --ddkk-code-fullscreen-close-hover-border: rgba(248, 248, 242, 0.5);
}

:root[data-ddkk-hljs-theme="atom-one-dark"] {
  --ddkk-code-fullscreen-close-bg: rgba(246, 248, 250, 0.13);
  --ddkk-code-fullscreen-close-border: rgba(246, 248, 250, 0.35);
  --ddkk-code-fullscreen-close-color: #f6f8fa;
  --ddkk-code-fullscreen-close-hover-bg: rgba(246, 248, 250, 0.22);
  --ddkk-code-fullscreen-close-hover-border: rgba(246, 248, 250, 0.5);
}

:root[data-ddkk-hljs-theme="vs2015"] {
  --ddkk-code-fullscreen-close-bg: rgba(245, 245, 245, 0.17);
  --ddkk-code-fullscreen-close-border: rgba(245, 245, 245, 0.4);
  --ddkk-code-fullscreen-close-color: #f5f5f5;
  --ddkk-code-fullscreen-close-hover-bg: rgba(245, 245, 245, 0.27);
  --ddkk-code-fullscreen-close-hover-border: rgba(245, 245, 245, 0.55);
}

:root[data-ddkk-hljs-theme="atom-one-light"] {
  --ddkk-code-fullscreen-close-bg: rgba(31, 35, 42, 0.08);
  --ddkk-code-fullscreen-close-border: rgba(31, 35, 42, 0.18);
  --ddkk-code-fullscreen-close-color: #1f232a;
  --ddkk-code-fullscreen-close-hover-bg: rgba(31, 35, 42, 0.14);
  --ddkk-code-fullscreen-close-hover-border: rgba(31, 35, 42, 0.28);
}

:root[data-ddkk-hljs-theme="xcode"] {
  --ddkk-code-fullscreen-close-bg: rgba(20, 27, 37, 0.06);
  --ddkk-code-fullscreen-close-border: rgba(20, 27, 37, 0.16);
  --ddkk-code-fullscreen-close-color: #1c222d;
  --ddkk-code-fullscreen-close-hover-bg: rgba(20, 27, 37, 0.13);
  --ddkk-code-fullscreen-close-hover-border: rgba(20, 27, 37, 0.26);
}

/* 代码块容器 */
.ddkk-code-block {
  position: relative;
  background: transparent;
  border-radius: 4px;
  border: none;
  margin: 40px 0 16px 0;
  overflow: visible;
}

.ddkk-code-block pre code.hljs {
  border-radius: 4px;
  padding: 15px 12px;
}

/* GitHub 和 Xcode 主题使用不同的背景色，与文章主区域形成视觉区分 */
:root[data-ddkk-hljs-theme="github"] .ddkk-code-block pre code.hljs {
  background-color: #f6f8fa !important;
}

:root[data-ddkk-hljs-theme="xcode"] .ddkk-code-block pre code.hljs {
  background-color: #f8f8f8 !important;
}

.ddkk-code-block pre {
  margin: 0;
}

/* 代码块操作按钮容器 */
.ddkk-code-btn-container {
  position: absolute;
  top: -28px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

.ddkk-code-copy-btn,
.ddkk-code-line-number-btn,
.ddkk-code-fullscreen-btn {
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.4;
  height: 20px;
  color: rgba(0, 0, 0, 0.65);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ddkk-code-copy-btn:hover,
.ddkk-code-line-number-btn:hover,
.ddkk-code-fullscreen-btn:hover {
  color: #1677ff;
  border-color: #1677ff;
}

.ddkk-code-copy-btn.ddkk-code-copy-success {
  color: #52c41a;
  border-color: #52c41a;
}

.ddkk-code-line-number-btn.ddkk-code-btn-active,
.ddkk-code-fullscreen-btn.ddkk-code-btn-active {
  color: #1677ff;
  border-color: #1677ff;
  background: rgba(22, 119, 255, 0.1);
}

/* 主题选择下拉框 */
.ddkk-code-theme-select {
  padding: 2px 8px;
  padding-right: 24px;
  font-size: 12px;
  line-height: 1.4;
  height: 20px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.95);
  color: rgba(0, 0, 0, 0.65);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(0,0,0,0.65)' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 12px;
}

.ddkk-code-theme-select:hover {
  border-color: #1677ff;
}

.ddkk-code-theme-select:focus {
  outline: none;
  border-color: #1677ff;
  box-shadow: 0 0 0 1px rgba(22, 119, 255, 0.15);
}

/* 代码行号显示样式 */
.ddkk-code-block pre code table.hljs-ln {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: none;
  background: transparent !important;
  box-shadow: none;
}

.ddkk-code-block pre code table.hljs-ln td {
  padding: 0;
  border: none;
  background: transparent !important;
  line-height: inherit;
  vertical-align: top;
}

.ddkk-code-block pre code table.hljs-ln td.hljs-ln-numbers {
  text-align: left;
  padding-right: 1em;
  padding-left: 8px;
  user-select: none;
  pointer-events: none;
  width: 1.25em;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

:root .ddkk-code-block pre code table.hljs-ln td.hljs-ln-numbers .hljs-ln-n {
  display: inline-block;
  width: 100%;
  background: transparent !important;
}

:root.ddkk-hljs-theme-light .ddkk-code-block pre code table.hljs-ln td.hljs-ln-numbers,
:root.ddkk-hljs-theme-light .ddkk-code-block pre code table.hljs-ln td.hljs-ln-numbers .hljs-ln-n {
  color: rgba(15, 23, 42, 0.5);
  background: transparent !important;
}

:root.ddkk-hljs-theme-dark .ddkk-code-block pre code table.hljs-ln td.hljs-ln-numbers,
:root.ddkk-hljs-theme-dark .ddkk-code-block pre code table.hljs-ln td.hljs-ln-numbers .hljs-ln-n {
  color: rgba(226, 232, 240, 0.55);
  background: transparent !important;
}

.ddkk-code-block pre code table.hljs-ln td.hljs-ln-code {
  padding-left: 0;
  padding-right: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  background: transparent !important;
  line-height: inherit;
  vertical-align: top;
}

.ddkk-code-block pre code table.hljs-ln tr {
  line-height: inherit;
  background: transparent !important;
  margin: 0;
  padding: 0;
}

/* 代码全屏显示容器 */
.ddkk-code-fullscreen-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  transition: background-color 0.3s ease;
}

:root.ddkk-hljs-theme-dark .ddkk-code-fullscreen-container {
  background: rgba(0, 0, 0, 0.9);
}

:root.ddkk-hljs-theme-light .ddkk-code-fullscreen-container {
  background: rgba(255, 255, 255, 0.95);
}

.ddkk-code-fullscreen-block {
  position: relative;
  max-width: 95%;
  max-height: 95%;
  margin: 0;
  border-radius: 8px;
  padding: 0;
  box-sizing: border-box;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

:root.ddkk-hljs-theme-dark .ddkk-code-fullscreen-block {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
}

:root.ddkk-hljs-theme-light .ddkk-code-fullscreen-block {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
}

.ddkk-code-fullscreen-block pre {
  flex: 1;
  max-height: calc(95vh - 60px);
  overflow: auto;
  margin: 0;
  box-sizing: border-box;
  padding: 20px;
  background: transparent;
}

/* 全屏代码块滚动条样式 - 深色主题 */
:root.ddkk-hljs-theme-dark .ddkk-code-fullscreen-block pre::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

:root.ddkk-hljs-theme-dark .ddkk-code-fullscreen-block pre::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

:root.ddkk-hljs-theme-dark .ddkk-code-fullscreen-block pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.1);
}

:root.ddkk-hljs-theme-dark .ddkk-code-fullscreen-block pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 全屏代码块滚动条样式 - 浅色主题 */
:root.ddkk-hljs-theme-light .ddkk-code-fullscreen-block pre::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

:root.ddkk-hljs-theme-light .ddkk-code-fullscreen-block pre::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

:root.ddkk-hljs-theme-light .ddkk-code-fullscreen-block pre::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

:root.ddkk-hljs-theme-light .ddkk-code-fullscreen-block pre::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.ddkk-code-fullscreen-block pre code {
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-variant-ligatures: common-ligatures;
  font-feature-settings: 'liga' 1, 'calt' 1;
  display: block;
}

.ddkk-code-fullscreen-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--ddkk-code-fullscreen-close-color);
  background: var(--ddkk-code-fullscreen-close-bg);
  border: 1px solid var(--ddkk-code-fullscreen-close-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
}

.ddkk-code-fullscreen-close:hover {
  color: var(--ddkk-code-fullscreen-close-color);
  background: var(--ddkk-code-fullscreen-close-hover-bg);
  border-color: var(--ddkk-code-fullscreen-close-hover-border);
}

.article-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #f0f0f0;
  color: #999;
  font-size: 14px;
}

/* 右侧边栏容器 */
.tech-detail-sidebar {
  position: sticky;
  top: 65px; /* 导航栏50px + 15px间距，确保滚动时距离导航栏底部15px */
  align-self: flex-start; /* 确保 sticky 定位正确工作 */
  flex-shrink: 0;
  flex-grow: 0;
  width: 300px;          /* 与 .ddkk-article-toc 保持一致 */
  min-width: 300px;      /* 确保最小宽度 */
  display: flex;
  flex-direction: column;
  gap: 16px; /* 目录和精选推荐之间的间距 */
}

/* 右侧目录 - 使用系统目录组件（模仿系列教程文章页布局） */
.tech-detail-sidebar .tech-detail-toc {
  flex-shrink: 0; /* 防止被压缩 */
}

/* 小于1200px时默认隐藏目录和侧边栏 */
@media (max-width: 1199.98px) {
  .tech-detail-sidebar {
    display: none !important;
  }
  
  /* 小屏幕时，目录隐藏，主内容区域占据全部宽度 */
  .tech-detail-main {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* 覆盖目录组件的默认隐藏规则（ddkk-toc.css 中在1366px以下隐藏，我们需要在1200px-1366px之间显示） */
/* 技术文章页面：1200px及以上显示目录，小于1200px隐藏 */
@media (min-width: 1200px) {
  .tech-detail-sidebar .tech-detail-toc #tocml {
    display: block !important;
  }
}

/* 确保目录组件占满父容器宽度 */
.tech-detail-sidebar .tech-detail-toc .ddkk-toc {
  width: 100%;
  background: #ffffff;
  border-radius: 4px; /* 小圆角 */
  padding: 12px;
  padding-left: 14px; /* 与系统目录指示条间距一致 */
  box-sizing: border-box; /* 包含内边距，宽度与精选推荐卡片一致 */
}

.tech-detail-sidebar .ddkk-toc {
  height: auto;
}

.tech-detail-sidebar .ddkk-toc-aside {
  flex: 0 0 auto;
  overflow-y: visible;
  overflow-x: visible;
}

/* 使用系统目录组件的默认布局，仅覆盖需要的样式，避免撑破宽度 */
.tech-detail-sidebar .tech-detail-toc .ddkk-toc-aside {
  width: 100%;
  background: transparent;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}

/* 精选推荐卡片样式 - 独立显示在目录下方 */
.tech-detail-sidebar .featured-card {
  padding: 0; /* 移除内边距，让图片和标题直接显示 */
  border-radius: 4px; /* 恢复圆角，让每个卡片独立 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); /* 恢复阴影，区分卡片 */
  border: 1px solid #f0f0f0; /* 恢复边框，区分卡片 */
  background: #ffffff !important; /* 确保白色背景 */
  width: 100%; /* 与目录卡片一样宽 */
  flex-shrink: 0; /* 防止被压缩 */
  box-sizing: border-box; /* 与目录容器对齐宽度 */
}

.tech-detail-sidebar.no-toc .featured-card {
  display: block;
}

.tech-detail-sidebar .featured-card .sidebar-title {
  padding: 12px 12px 8px 12px; /* 标题内边距 */
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.88);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tech-detail-sidebar .featured-item {
  display: block;
  border-radius: 0; /* 移除圆角 */
  overflow: hidden;
  transition: box-shadow 0.3s ease;
  position: relative;
  will-change: box-shadow;
  -webkit-tap-highlight-color: transparent;
}

.tech-detail-sidebar .featured-item:hover {
  box-shadow: none; /* 移除悬浮阴影 */
}

.tech-detail-sidebar .featured-image {
  width: 100%;
  height: auto;
  display: block;
  border: none; /* 移除边框 */
  outline: none; /* 移除轮廓 */
}

/* ==================== 响应式设计 ==================== */
/* 移动端目录按钮默认隐藏（桌面端） */
.ddkk-toc-toggler {
  display: none;
}

/* 桌面端（≥768px）强制隐藏移动端目录抽屉和遮罩层，避免在电脑端误显示 */
@media (min-width: 768px) {
  .ddkk-article-toc-mobile,
  .ddkk-article-toc-mask {
    display: none !important;
  }
}

/* 移动端（≤767.98px） */
@media (max-width: 767.98px) {
  .tech-detail-container {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    padding: 10px;
    padding-top: 70px; /* 增加顶部间距，避免内容太靠近导航栏 */
    margin-top: 0;
    transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
  }

  /* 侧边栏容器 - 移动端固定定位，抽屉样式 */
  .tech-sidebar {
    position: fixed !important;
    top: 55px;
    left: 0;
    width: 150px;
    height: calc(100vh - 55px) !important;
    height: calc(100dvh - 55px) !important;
    max-height: none;
    z-index: 10001 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
    overflow-y: auto;
    background: #ffffff;
    box-shadow: none;
    padding: 0;
    display: block !important;
  }

  .tech-sidebar.show {
    transform: translateX(0);
  }

  .tech-sidebar .sidebar-card {
    padding: 10px;
    background: #ffffff !important;
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  .tech-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .tech-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
  }

  .tech-nav-item:hover,
  .tech-nav-item.active {
    background: #e6f7ff;
    color: #1890ff;
    font-weight: 500;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-icon svg {
    width: 100%;
    height: 100%;
  }

  /* 移动端显示精选推荐：在文章内容下方展示侧边栏中的精选推荐卡片 */
  .tech-detail-sidebar {
    display: block !important;
    position: static;
    top: auto;
    width: 100%;
    min-width: 0;
    max-height: none;
    overflow: visible;
    margin-top: 16px;
  }

  /* 避免与移动端抽屉目录重复，隐藏右侧目录块，只保留精选推荐 */
  .tech-detail-sidebar .tech-detail-toc {
    display: none;
  }

  /* 主内容区域 - 移动端：抽屉打开时向右移动 */
  .tech-detail-main {
    transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
    width: 100%;
  }

  .tech-detail-container.sidebar-open .tech-detail-main {
    transform: translateX(140px);
  }

  /* 遮罩层 - 移除背景，避免一闪而过 */
  .ddkk-sidebar-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 10000 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86),
                visibility 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
  }

  .ddkk-sidebar-mask.show {
    opacity: 0;
    visibility: hidden;
  }

  /* 抽屉打开时禁止页面滚动 */
  body.ddkk-sidebar-open {
    overflow: hidden;
  }
  
  /* 移动端目录按钮 - 固定在导航栏下方 */
  .ddkk-toc-toggler {
    position: fixed;
    top: 69px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 4px; /* 正方形，圆角 */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* 提高层级，确保在移动端显示在文章锁定器之上 */
    z-index: 10001 !important;
    transition: top 0.2s, right 0.2s, transform 0.3s;
    padding: 0;
  }

  .ddkk-toc-toggler:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .ddkk-toc-toggler:active {
    transform: scale(0.95);
  }

  .ddkk-toc-toggler svg {
    width: 18px;
    height: 18px;
    color: rgba(0, 0, 0, 0.65);
  }

  /* 移动端目录抽屉 */
  .ddkk-article-toc-mobile {
    position: fixed;
    top: 0px;
    right: 0;
    width: 80vw;
    max-width: 80%;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    /* 提高层级，确保在移动端显示在文章锁定器之上 */
    z-index: 10001 !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .ddkk-article-toc-mobile.show {
    transform: translateX(0);
  }

  /* 目录抽屉头部 */
  .ddkk-toc-mobile-header {
    padding: 16px;
    padding-bottom: 0px;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    /* 让头部主体刚好出现在导航栏下方，上面一小段背景被导航栏遮住，过渡更自然 */
    margin-top: 59px;
  }

  /* 目录抽屉标题 */
  .ddkk-toc-mobile-title {
    font-size: 16px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.88);
    margin: 0;
    flex: 1;
  }

  .ddkk-toc-mobile-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
  }

  .ddkk-toc-mobile-close:hover {
    background: rgba(0, 0, 0, 0.06);
  }

  .ddkk-toc-mobile-close:active {
    background: rgba(0, 0, 0, 0.1);
  }

  .ddkk-toc-mobile-close svg {
    width: 20px;
    height: 20px;
    color: rgba(0, 0, 0, 0.65);
    stroke-width: 2;
  }

  /* 目录抽屉内容 */
  .ddkk-toc-mobile-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0px;
    padding-left: 5px; /* 为目录指示条预留空间 */
    position: relative;
  }

  /* 目录抽屉遮罩层 */
  .ddkk-article-toc-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    /* 提高层级，位于文章锁定器之上但低于目录抽屉 */
    z-index: 10000 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86),
                visibility 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
  }

  .ddkk-article-toc-mask.show {
    opacity: 1;
    visibility: visible;
  }

  /* 目录抽屉打开时禁止页面滚动 */
  body.ddkk-article-toc-open {
    overflow: hidden !important;
  }
  
  .tech-detail-main {
    width: 100%;
    padding: 24px 16px;
    box-sizing: border-box;
  }
  
  /* 移动端：缩小标题字体 */
  .article-title {
    font-size: 18px;
    line-height: 1.4;
  }
  
  /* 移动端：缩小元信息字体 */
  .article-meta {
    font-size: 12px;
    gap: 12px;
    margin-bottom: 20px; /* 增加底部间距，和标签拉开距离 */
    padding-left: 0; /* 确保没有左边距 */
    margin-left: 0; /* 确保没有左边距 */
  }
  
  /* 移动端：隐藏作者/阅读/时间/分类前面的图标，保证文字与标签左对齐 */
  .article-meta i {
    display: none;
  }
  
  /* 移动端：隐藏文章标签 */
  .article-header > .article-tags {
    display: none !important;
  }
  
  /* 移动端：确保第一个 meta-item 和第一个 tag 对齐 */
  .article-header > .article-meta > .meta-item:first-child {
    margin-left: 0;
    padding-left: 0;
  }
  
  /* 移动端：标签字体和边距 - 不显示背景色块，只显示灰色文字 */
  .tag {
    font-size: 12px;
    padding: 0; /* 移除内边距 */
    background: transparent; /* 移除背景色 */
    border-radius: 0; /* 移除圆角 */
    color: #999; /* 灰色文字 */
  }
  
  /* 移动端：缩小内容字体 */
  .article-content {
    font-size: 14px;
    line-height: 1.7;
  }
  
  /* 移动端：缩小标题字体 */
  .article-content h1 { font-size: 20px; }
  .article-content h2 { font-size: 18px; }
  .article-content h3 { font-size: 16px; }
  .article-content h4 { font-size: 15px; }
  .article-content h5 { font-size: 14px; }
  .article-content h6 { font-size: 13px; }
  
  /* 移动端：缩小段落间距 */
  .article-content p {
    margin: 12px 0;
  }
  
  /* 移动端：缩小代码字体 */
  .article-content code {
    font-size: 13px;
  }
  
  /* 移动端：缩小代码块字体 */
  .article-content pre {
    font-size: 13px;
  }
  
  /* 移动端：缩小引用块字体 */
  .article-content blockquote {
    font-size: 13px;
    padding: 10px 16px;
  }
  
  /* 移动端：缩小表格字体 */
  .article-content th,
  .article-content td {
    font-size: 13px;
    padding: 8px;
  }
  
  /* 移动端：缩小页脚字体 */
  .article-footer {
    font-size: 12px;
  }
  
  /* 移动端代码块字体优化 */
  .article-content pre code {
    font-size: 11px;
  }

  .ddkk-code-block pre code.hljs {
    font-size: 11px;
  }

  /* 移动端代码块按钮优化 */
  .ddkk-code-btn-container {
    top: -26px;
    right: 4px;
    gap: 3px;
  }

  .ddkk-code-theme-select {
    max-width: 80px;
    font-size: 11px;
    padding: 2px 6px;
    padding-right: 20px;
    background-position: right 4px center;
    background-size: 10px;
  }

  .ddkk-code-copy-btn,
  .ddkk-code-line-number-btn,
  .ddkk-code-fullscreen-btn {
    padding: 2px 6px;
    font-size: 11px;
    height: 18px;
  }
}

/* ============================================
   Mermaid 图表样式 - 响应式支持
   ============================================ */

/* Mermaid 容器基础样式 */
.article-content .mermaid-container {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  margin: 1.5em 0;
  padding: 1em;
  background: #f8f9fa;
  border-radius: 4px;
  box-sizing: border-box;
  position: relative;
  -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

/* Mermaid 缩放控制按钮 */
.article-content .mermaid-zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
}

.article-content .mermaid-zoom-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: all 0.2s;
  box-sizing: border-box;
}

.article-content .mermaid-zoom-btn:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #1677ff;
  color: #1677ff;
}

.article-content .mermaid-zoom-btn:active:not(:disabled) {
  background: #e6f7ff;
  transform: scale(0.95);
}

.article-content .mermaid-zoom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.article-content .mermaid-zoom-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Mermaid 全屏模式 */
.article-content .mermaid-container.mermaid-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 20px;
  background: #fff;
  z-index: 9999;
  border-radius: 0;
}

.article-content .mermaid-container.mermaid-fullscreen {
  overflow: hidden;
}

.article-content .mermaid-container.mermaid-fullscreen .mermaid-responsive-wrapper {
  width: 100%;
  height: calc(100vh - 40px);
  min-height: calc(100vh - 40px);
  overflow: auto;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.article-content .mermaid-container.mermaid-fullscreen .mermaid-responsive-wrapper:active {
  cursor: grabbing;
}

.article-content .mermaid-container.mermaid-fullscreen .mermaid-zoom-controls {
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mermaid 响应式包装器 */
.article-content .mermaid-responsive-wrapper {
  width: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  position: relative;
  -webkit-overflow-scrolling: touch;
  cursor: default;
}

/* Mermaid 图表元素 */
.article-content .mermaid {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

/* Mermaid SVG 响应式 */
.article-content .mermaid svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 移动端优化 */
@media (max-width: 767px) {
  .article-content .mermaid-container {
    margin: 1em 0;
    padding: 0.75em;
    border-radius: 3px;
  }

  .article-content .mermaid-responsive-wrapper {
    min-height: 150px;
  }

  /* 确保移动端可以横向滚动查看大图表 */
  .article-content .mermaid-container {
    -webkit-overflow-scrolling: touch;
    overflow: auto;
  }

  /* 移动端字体大小调整 */
  .article-content .mermaid svg {
    font-size: 12px;
  }

  /* 移动端缩放按钮调整 */
  .article-content .mermaid-zoom-controls {
    top: 4px;
    right: 4px;
    padding: 3px;
    gap: 3px;
  }

  .article-content .mermaid-zoom-btn {
    width: 24px;
    height: 24px;
  }

  .article-content .mermaid-zoom-btn svg {
    width: 14px;
    height: 14px;
  }

  /* 移动端全屏模式 */
  .article-content .mermaid-container.mermaid-fullscreen {
    padding: 10px;
  }

  .article-content .mermaid-container.mermaid-fullscreen {
    overflow: hidden;
  }

  .article-content .mermaid-container.mermaid-fullscreen .mermaid-responsive-wrapper {
    height: calc(100vh - 20px);
    min-height: calc(100vh - 20px);
    overflow: auto;
  }

  .article-content .mermaid-container.mermaid-fullscreen .mermaid-zoom-controls {
    top: 8px;
    right: 8px;
  }
}

/* 平板设备优化 */
@media (min-width: 768px) and (max-width: 1024px) {
  .article-content .mermaid-container {
    padding: 1em;
  }
}

/* 桌面端优化 */
@media (min-width: 1025px) {
  .article-content .mermaid-container {
    padding: 1.25em;
  }

  .article-content .mermaid svg {
    font-size: 14px;
  }
}

/* 平板端和小屏PC端（768px-1199.98px） */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .tech-detail-container {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
  }
  
  .tech-detail-main {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ============= 技术文章详情页主容器宽度响应式适配（PC端） ============= */
/* <1200px：使用默认最大宽度 1200px */

/* 1200px–1499px：最大宽度 1300px */
@media (min-width: 1200px) and (max-width: 1499.98px) {
  .tech-detail-container {
    max-width: 1300px;
  }
}

/* 1500px–1599px：最大宽度 1500px */
@media (min-width: 1500px) and (max-width: 1599.98px) {
  .tech-detail-container {
    max-width: 1500px;
  }
}

/* 1600px–1699px：最大宽度 1600px */
@media (min-width: 1600px) and (max-width: 1699.98px) {
  .tech-detail-container {
    max-width: 1600px;
  }
}

/* 1700px–1919px：最大宽度 1700px */
@media (min-width: 1700px) and (max-width: 1919.98px) {
  .tech-detail-container {
    max-width: 1700px;
  }
}

/* 1920px–2559px：最大宽度 1700px */
@media (min-width: 1920px) and (max-width: 2559.98px) {
  .tech-detail-container {
    max-width: 1700px;
  }
}

/* ≥2560px：最大宽度 1900px */
@media (min-width: 2560px) {
  .tech-detail-container {
    max-width: 1900px;
  }
}

