body {
  font-family: "Helvetica Neue", Arial, "Noto Sans SC", "Noto Serif SC", "Microsoft YaHei", "WenQuanYi Micro Hei", SimSun, sans-serif;
  margin: 0 auto;
  padding: 0;
  max-width: 1000px; /* 增大页面最大宽度 */
  width: 90%; /* 页面宽度占据 90% */
}

.has-jax {
  line-height: inherit !important; /* 避免 MathJax 公式单独改变行距 */
  display: inline-block !important; /* 防止公式影响块级元素 */
}

.page-post {
  font-size: 16px;
  line-height: 2;
  word-break: break-all;
}
/* .page-post{
  white-space: pre-line;
} */
.page-post .title {
  font-size: 23px;
  font-weight: bold;
  color: #000000;
}
.page-post .subtitle {
  font-size: 12px;
  color: #000000;
}
.page-post .post > * {
  margin: 0px 0;
}
.page-post .post > iframe {
  margin: 0;
  width: 100%;
}
.page-post .post p {
  font-family: "Noto Serif SC", "Georgia", serif;
  color: #000000;
  margin: 18px 0; /* Add this rule for consistent paragraph spacing */
}
.page-post .post h1,
.page-post .post h2 {
  font-family: "Noto Serif SC", "Georgia", serif;
  font-weight: normal;
  font-size: 20px;
  position: relative;
  font-weight: bold;
  cursor: pointer;
  color: #000000;
}
.page-post .post h1::before,
.page-post .post h2::before {
  content: '#';
  top: 0;
  font-weight: bold;
  padding-right: 6px;
  color: #000000;
}
/* .page-post h3,
 */
.page-post .post h3 {
  font-family: "Noto Serif SC", "Georgia", serif;
  font-weight: normal;
  font-size: 18px;
  position: relative;
  font-weight: bold;
  cursor: pointer;
  color: #000000;
}
.page-post h4,
.page-post h5,
.page-post h6 {
  font-family: "Arial", sans-serif;
  font-size: 15px;
  font-weight: bold;
}
.page-post blockquote {
  border-left: 3px solid #333333;
  background-color: #f7f7f7;
  padding: 0px 0px 0px 15px;
}

.page-post a {
  font-family: "Noto Serif SC" ; /* 无衬线字体 */
  color: #3366cc;
  margin: 0 2px;
  border-bottom: 1px solid #ffffff;
  font-weight: bold;
}
.page-post strong,
.page-post b {
  color: #000000;
}

/* .page-post .post ul {
  margin-left: 16px;
}
.page-post .post ol {
  margin-left: 0px;
  font-family: "Noto Serif SC" ;
  margin: 0px 0px;
}
.page-post ul > li {
  list-style: disc;
  margin-left: 2px;
  line-height: 1.6;
}

.page-post ol > li {
  list-style: decimal;
  margin-left: 20px;
  line-height: 1.6;
}

.page-post li > *{
  margin: 6px 0;
} */

/* 统一 ul 的样式 */
.page-post .post ul {
  margin: 0;
  padding-left: 20px;
  font-family: "Noto Serif SC", serif;
  list-style: disc;
}

/* 统一 ol 的样式 */
.page-post .post ol {
  margin: 0;
  padding-left: 20px;
  font-family: "Noto Serif SC", serif;
  list-style: decimal;
}

/* ul 和 ol 的 li 样式 */
.page-post .post ul > li,
.page-post .post ol > li {
  margin: 0 0 4px 0; /* 保持小的垂直间距 */
  padding: 0;
  line-height: 1.5;
}

/* li 内的子元素（如 p） */
.page-post .post li > * {
  margin: 2px 0; /* 保持小的子元素间距 */
  font-size: 16px; /* 覆盖 18px */
  font-family: inherit;
}

/* 针对 ol 和 ul 内的 .post p */
.page-post .post ul .post p,
.page-post .post ol .post p {
  font-size: 16px;
  margin: 2px 0;
  line-height: 1.5;
}

/* 为 ol 的编号加粗 */
.page-post .post ol > li::marker {
  font-weight: bold; /* 加粗编号 */
}

.page-post img {
  display: block;
  max-width: 90%;
  margin: 20px auto;
  height: auto;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.page-post img[alt='line'] {
  display: inline-block;
  vertical-align: middle;
  background-color: transparent;
  box-shadow: none;
  margin: 0 4px;
  line-height: 1;
}
.page-post pre {
  font-size: 0;
  padding: 10px;
  overflow: auto;
  border-radius: 2px;
  max-height: 610px;
  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
  line-height: 1.6;
}

.footnote-ref sup,
.footnote-ref sup {
  color: blue !important;
}
.page-post code {
  font-size: 13px;
  background-color: #e7e7e7;
  word-break: break-all;
  padding: 3px 5px;
  margin: 0 4px;
  border-radius: 5px;
  color: #4d4d4c;
  font-family: 'JetBrains Mono', monospace;
}
.page-post pre code {
  font-size: 13px;
  background-color: transparent !important;
  word-break: keep-all;
  padding: 0;
  margin: 0;
  border-radius: unset;
  color: inherit;
}

.page-post hr {
  border: none;
  height: 3px;
  background-color: #eeeeee;
}

/* 表格设计 */
.page-post .table-container {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.page-post table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  min-width: 600px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* 表头 */
.page-post th {
  background-color: #f5f5f5;
  color: #333;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 8px;
  text-align: center;
}

/* 单元格 */
.page-post td {
  background-color: #ffffff;
  color: #555;
  font-size: 13px;
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

/* 行样式 */
.page-post tr {
  border-bottom: 1px solid #e0e0e0;
}

.page-post tr:nth-child(even) td {
  background-color: #f9f9f9;
}

.page-post tr:hover td {
  background-color: #eef2f7;
  transition: background-color 0.3s ease;
}


:root {
    /* 核心背景：使用深炭黑而非纯黑 */
    --code-bg: #1e1e1e;          /* 代码区域背景 */
    --header-bg: #333131;        /* 头部背景，稍亮一点形成对比 */
    --border-color: #333333;     /* 边框颜色 */
    --text-main: #d4d4d4;        /* 主文本色 */
    --accent: #569cd6;           /* 蓝色点缀（VS Code 风格） */
}

/* 容器基础样式 */
.code-fold-container {
    margin: 2em 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    font-family: 'Cascadia Code', 'Fira Code', ui-monospace, monospace;
}

/* 现代感头部 */
.code-fold-header {
    background: var(--header-bg);
    padding: 12px 16px; /* 增加一点内边距更显高级 */
    color: #ffffff; /* 稍微淡化的文字 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 模拟 Mac 按钮（保留，在深色下非常好看） */
.header-dots {
    display: flex;
    gap: 6px;
    margin-right: 4px;
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f56; }
.dot-y { background: #ffbd2e; }
.dot-g { background: #27c93f; }

.lang-label {
    font-size: 12px;
    font-weight: 600;
    color: #858585; /* 稍微淡化的文字 */
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* 箭头动画 */
.fold-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    fill: #666; /* 默认颜色 */
}
.is-collapsed .fold-arrow { transform: rotate(-90deg); }

/* 折叠核心逻辑 */
.code-fold-content {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.code-fold-content.is-collapsed {
    grid-template-rows: 0fr;
}
.code-fold-inner { overflow: hidden; }

/* 修复行号与代码样式 */
pre.line-numbers {
    padding-left: 3.8em !important;
    margin: 0 !important;
    background: transparent !important;
    font-size: 14px !important;
    color: var(--text-main) !important;
}

.line-numbers .line-numbers-rows {
    border-right: 1px solid #333 !important;
    padding: 1em 0 !important;
    background: rgba(255, 255, 255, 0.02); /* 行号背景微显 */
}

/* 现代化复制按钮 */
.copy-btn {
    background: #3c3c3c;
    color: #ccc;
    border: 1px solid #444;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* 分享 */
.share-buttons {
  display: flex; /* 启用 Flexbox 布局 */
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
  gap: 10px; /* 按钮之间的间距 */
  margin-top: 20px; /* 顶部外边距 */
}

.share-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.share-button:hover {
  transform: scale(1.1); /* 鼠标悬停时放大按钮 */
}

.share-button i {
  font-size: 24px; /* 图标大小 */
  color: #333; /* 图标颜色 */
}

/* 评论 */
#gitalk-container {
  margin-top: 40px;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

/* 允许文本复制 */
body, p, div, span, a {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

/* 上下一篇文章 */
.navigation-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
}

.nav-button {
  padding: 10px 20px;
  text-decoration: none;
  color: #333;
  background-color: #f5f5f5;
  border-radius: 5px;
  transition: background-color 0.3s;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: #ffffff
}

.nav-button:hover:not(.disabled) {
  background-color: #e0e0e0;
}

.nav-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-button i {
  margin: 0 5px;
}

.previous {
  text-align: left;
}

.next {
  text-align: right;
}


#toc {
  position: fixed;
  top: 100px;
  left: 20px;
  width: 180px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #f8f8f8;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  font-size: 0.9em;
  z-index: 10;
  transition: all 0.3s ease;
}

#toc.collapsed {
  width: auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

#toc.collapsed .toc-header,
#toc.collapsed .toc-title,
#toc.collapsed .toc-list {
  display: none;
}

/* 透明浮动汉堡按钮 */
.toc-toggle-floating {
  position: fixed;
  top: 100px; /* 可自定义位置 */
  left: 20px;
  background: transparent;
  border: none;
  font-size: 1.6em;
  cursor: pointer;
  padding: 8px;
  z-index: 1000;
}

.toc-toggle-floating i {
  color: rgba(0, 0, 0, 0.2); /* 半透明三条线 */
}

.toc-toggle-floating:hover i {
  color: rgba(0, 123, 255, 0.5);
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.toc-title {
  font-size: 1.1em;
  font-weight: bold;
  color: #333;
}

.toc-toggle {
  background: none;
  border: none;
  font-size: 1.1em;
  cursor: pointer;
  color: #333;
  padding: 0;
}

.toc-toggle:hover {
  color: #007bff;
}

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

.toc-list li {
  margin: 5px 0;
}

.toc-list a {
  text-decoration: none;
  color: #333;
  transition: color 0.2s;
  display: block;
  padding: 2px 0;
}

.toc-list a:hover {
  color: #007bff;
}

.toc-list ul {
  padding-left: 15px;
}

.toc-list a.active {
  color: #007bff;
  font-weight: bold;
}

@media (max-width: 768px) {
  #toc {
    position: static;
    width: 100%;
    max-height: none;
    margin: 20px 0;
  }

  .toc-toggle-floating {
    top: auto;
    left: 10px;
    bottom: 20px;
  }
}