/* 隐藏 Made with Material for MkDocs */
.md-footer-copyright {
  display: none !important;
}
/* 表格完整网格边框 */
.md-typeset table:not([class]) {
  border-collapse: collapse;
}
.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  border: 1px solid var(--md-default-fg-color--lightest);
}
/* 表头浅底，与正文区分 */
.md-typeset table:not([class]) th {
  background-color: var(--md-primary-fg-color--lightest, #f5f5f5);
}

/* 图片：自适应 + 居中 + 边框突出，避免与正文混淆 */
.md-typeset p > img,
.md-typeset p > a.glightbox > img {
  display: block;
  margin: 1.2em auto;                 /* 上下留白，和正文拉开距离 */
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
  padding: 6px;                       /* 图片与边框之间的白边 */
  background: #ffffff;                /* 白底卡片感 */
  border: 1px solid #e0e0e0;          /* 浅灰描边 */
  border-radius: 8px;                 /* 圆角 */
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);  /* 轻微投影，浮起感 */
}
/* glightbox 会给图片包一层 <a>，需一并处理，否则居中失效 */
.md-typeset p > a.glightbox {
  display: block;
}
/* glightbox 包裹的可点击放大图片：悬停时边框变主题色，提示"可点" */
.md-typeset p > a.glightbox:hover > img {
  border-color: var(--md-primary-fg-color, #448aff);
}

/* 1. 将整体最大宽度调整为适中的 72rem（原默认 61rem，之前设的 85rem 太宽） */
.md-grid {
  max-width: 72rem; 
}

/* 2. 控制中间正文的最大行宽，保证最佳阅读体验 */
.md-content__inner {
  max-width: 46rem;
}

/* 3. 适度紧凑两侧边栏的内边距 */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    width: 13rem;
  }
  .md-sidebar--secondary {
    width: 12rem;
  }
}


/* ============================================================
   以下由本地 extra.css 合并而来（2026-09-03 整合，云端原内容保留于上方）
   ============================================================ */

/* 表格整体水平居中：容器居中，表格按内容宽度显示。 */
.md-typeset table {
  display: table !important;
  width: fit-content !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
/* Material 会把表格包进左起的 inline-block，需让这个容器整体居中 */
.md-typeset__scrollwrap {
  text-align: center;
}
.md-typeset__table {
  display: inline-block !important;
  max-width: 100%;
  text-align: left;
}
/* 覆盖主题 html .md-typeset__table table 的 width:100% 和 margin:0 */
html .md-typeset__table table {
  width: fit-content !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
/* 表头居中 */
.md-typeset table th {
  text-align: center;
}

/* 正文段落首行缩进 2 字符（步骤、总结等普通段落） */
.md-typeset p {
  text-indent: 2em;
}
/* 列表项内、提示块(Admonition)内、图注不缩进，避免错位 */
.md-typeset li p,
.md-typeset .admonition p,
.md-typeset figcaption {
  text-indent: 0;
}

/* 顶层列表（步骤列表/检测清单/环境列表等）左外边距加大，
   确保与上级标题/段落之间有清晰的层级缩进关系（§3.4）。
   Material 默认 ul 仅 margin-left:.625em + li margin-left:1.25em ≈ 1.875em，
   与 p{text-indent:2em} 几乎重叠，导致步骤子弹和标题正文看起来同级。 */
.md-typeset > ul,
.md-typeset > ol {
  margin-left: 2em !important;
}

/* 资源名高亮：正文中出现的课程资源（对应末尾资源表）可点击跳转夸克网盘 */
.md-typeset a.res-link {
  background: #e8f4fd;
  border: 1px solid #90caf9;
  border-radius: 4px;
  padding: 1px 6px;
  text-decoration: none;
  color: #0d47a1;
  font-weight: 600;
  white-space: nowrap;
  transition: background .2s, box-shadow .2s;
}
.md-typeset a.res-link:hover {
  background: #bbdefb;
  box-shadow: 0 0 6px rgba(13, 71, 161, .35);
}
.md-typeset a.res-link::before {
  content: "📎 ";
  font-size: .85em;
}
/* 标题内资源名不高亮过重，仅保留下划线提示可点击 */
.md-typeset h2 a.res-link,
.md-typeset h3 a.res-link,
.md-typeset h4 a.res-link {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}
.md-typeset h2 a.res-link:hover,
.md-typeset h3 a.res-link:hover,
.md-typeset h4 a.res-link:hover {
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
}

/* ===== Mermaid 流程图美化 ===== */
/* 渲染容器居中 */
.md-typeset .mermaid-rendered {
  text-align: center;
  margin: 1.2em auto;
  overflow-x: auto;
}
.md-typeset .mermaid-rendered svg {
  max-width: 100%;
  height: auto;
}
/* 节点默认样式（圆角 + 浅蓝填充 + 蓝色边框，配合 mermaid-init 的 themeVariables） */
.md-typeset .mermaid-rendered .node rect,
.md-typeset .mermaid-rendered .node polygon,
.md-typeset .mermaid-rendered .node path {
  rx: 10px;
}
/* 箭头线条颜色（themeVariables 已设，这里兜底） */
.md-typeset .mermaid-rendered .edgePath .path {
  stroke: #1e88e5 !important;
}
.md-typeset .mermaid-rendered .edge-pattern-solid {
  stroke: #1e88e5 !important;
}
.md-typeset .mermaid-rendered .flowchart-link {
  stroke: #1e88e5 !important;
}

/* ===== 素材框闪烁振荡（点击正文资源名后触发） ===== */
@keyframes res-flash-anim {
  0%   { box-shadow: 0 0 0 0 rgba(30, 136, 229, .8); transform: translateX(0); }
  15%  { box-shadow: 0 0 0 8px rgba(30, 136, 229, 0); transform: translateX(-6px); }
  30%  { box-shadow: 0 0 0 0 rgba(30, 136, 229, .8); transform: translateX(6px); }
  45%  { box-shadow: 0 0 0 8px rgba(30, 136, 229, 0); transform: translateX(-6px); }
  60%  { box-shadow: 0 0 0 0 rgba(30, 136, 229, .8); transform: translateX(6px); }
  75%  { box-shadow: 0 0 0 8px rgba(30, 136, 229, 0); transform: translateX(-3px); }
  90%  { box-shadow: 0 0 0 0 rgba(30, 136, 229, .8); transform: translateX(3px); }
  100% { box-shadow: 0 0 0 8px rgba(30, 136, 229, 0); transform: translateX(0); }
}
.md-typeset .admonition.success.res-flash {
  animation: res-flash-anim 1.2s ease-out 2;
  border-color: #1e88e5;
  outline: 3px solid rgba(30, 136, 229, .35);
  outline-offset: 2px;
}

/* ===== 外链确认弹窗 ===== */
#ext-link-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
#ext-link-modal .ext-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  transition: opacity .2s;
}
#ext-link-modal.show .ext-modal-mask { opacity: 1; }
#ext-link-modal .ext-modal {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -46%);
  width: 420px;
  max-width: 90vw;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  padding: 20px 24px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
#ext-link-modal.show .ext-modal {
  opacity: 1;
  transform: translate(-50%, -50%);
}
#ext-link-modal .ext-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0d47a1;
  margin-bottom: 12px;
}
#ext-link-modal .ext-modal-body { color: #333; font-size: 14px; }
#ext-link-modal .ext-modal-url {
  margin: 10px 0;
  padding: 8px 10px;
  background: #f5f7fa;
  border: 1px solid #e0e4ea;
  border-radius: 6px;
  font-family: Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: #1565c0;
}
#ext-link-modal .ext-modal-hint { color: #888; font-size: 12px; }
#ext-link-modal .ext-modal-actions {
  margin-top: 18px;
  text-align: right;
}
#ext-link-modal .ext-btn {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 10px;
}
#ext-link-modal .ext-btn-cancel {
  background: #f0f1f3;
  color: #444;
}
#ext-link-modal .ext-btn-cancel:hover { background: #e4e6ea; }
#ext-link-modal .ext-btn-ok {
  background: #1e88e5;
  color: #fff;
}
#ext-link-modal .ext-btn-ok:hover { background: #1976d2; }

/* ===== 图片布局统一（2026-09-01 落地：全局规限 + 行外隔离 + 点击放大） ===== */
/* 1. 所有 Markdown/HTML 图片强制块级独占、居中、上下拉开间距、限宽限高 */
.md-typeset img {
  display: block;
  margin: 1.5rem auto !important;   /* 上下留白 1.5rem，左右自动居中 */
  max-width: 80% !important;        /* 限制最大宽度，避免撑满版心 */
  max-height: 420px;                /* 限制最大高度，防止单张大图占超半屏 */
  object-fit: contain;              /* 保持宽高比不变形 */
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);  /* 浅阴影区分图文边界 */
}
/* <figure> 内的图片同样约束（figcaption 图注保持原样居中） */
.md-typeset figure img {
  max-width: 80% !important;
  max-height: 420px;
  margin: 0 auto 0.4rem auto !important;  /* figure 内上下留白收窄，给图注留位 */
}
/* 2. 特别小的示意图/图标类：可用 .img-small 进一步限幅 */
.md-typeset img.img-small {
  max-width: 300px !important;
  max-height: 200px !important;
}
/* 3. Flex 并排（连续截图）：.img-row 容器内图片横向并排、等比压缩 */
.md-typeset .img-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: flex-start;
  margin: 1.5rem 0;
}
.md-typeset .img-row img {
  flex: 1 1 0;
  min-width: 0;
  max-width: 45% !important;
  max-height: 360px;
  margin: 0 !important;   /* 覆盖全局居中 margin，避免 flex 内错位 */
}
.md-typeset .img-row figure {
  flex: 1 1 0;
  min-width: 0;
  max-width: 45%;
  margin: 0;
  text-align: center;
}
.md-typeset .img-row figure img {
  max-width: 100% !important;
  margin: 0 auto 0.3rem auto !important;
}
/* 4. 图文隔离：杜绝 float 文字环绕（本规范一律用块级 figure，无需 float） */

/* 5. 知识检测刮刮乐：<span class="spoiler">答案</span>
   默认遮罩（文字与背景同色，不可选中），悬停/点击/聚焦时揭示 */
.md-typeset .spoiler {
  background-color: var(--md-default-fg-color);
  color: var(--md-default-fg-color);
  border-radius: 3px;
  padding: 0 .28em;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, color .15s ease;
}
.md-typeset .spoiler:hover,
.md-typeset .spoiler:active,
.md-typeset .spoiler:focus {
  background-color: transparent;
  color: var(--md-accent-fg-color);
  user-select: auto;
}

/* ===== 代码块复制按钮：Material 默认仅在悬停时显示，改为常驻显示 =====
   避免“看不到/找不到复制按钮”的困惑（按钮本由 JS 注入，仅在悬停时 opacity:1）。
   此规则让其在每个代码块右上角始终可见。 */
.md-clipboard {
  opacity: 1 !important;
}
