/* ---------- 桌面/通用 ---------- */
.md-typeset h1 { color: #1b3660; font-weight: 700; letter-spacing: .2px; }
.md-typeset h2 { color: #1b3660; font-weight: 650; border-bottom: 1px solid rgba(27,54,96,.15); padding-bottom: .2em; }
.md-typeset h3 { color: #24406f; font-weight: 600; }

.md-typeset table:not([class]) th { background: #1b3660; color: #fff; }
.md-typeset table:not([class]) tr:nth-child(2n) td { background: #f6f7f9; }

.md-typeset blockquote { border-left: 4px solid #1b3660; background: #f4f7fb; }

.md-typeset .grid.cards > ol > li > p:first-child,
.md-typeset .grid.cards > ul > li > p:first-child { display: flex; align-items: center; gap: .4rem; }

/* 内嵌模拟器：全宽 + 足够高度 */
.md-typeset .sim-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 .8rem; }
.md-typeset .sim-actions .sim-open {
  display: inline-block; padding: .5rem 1rem; border-radius: .25rem;
  background: #1b3660; color: #fff !important; font-weight: 600; text-decoration: none;
}
.md-typeset .sim-actions .sim-open:hover { background: #24406f; }
.md-typeset .sim-actions .sim-hint { font-size: .72rem; color: #6b7280; }

.md-typeset .sim-frame {
  margin: 0 -.8rem; border: 1px solid #d5d5d5; border-radius: .3rem;
  overflow: hidden; background: #fff;
}
.md-typeset .sim-frame iframe { display: block; width: 100%; height: 1180px; border: 0; background: #fff; }

/* 平板/小笔记本 */
@media screen and (max-width: 76.2344em) {
  .md-typeset .sim-frame { margin: 0; }
  .md-typeset .sim-frame iframe { height: 80vh; min-height: 660px; }
}
/* 大屏再放宽 */
@media screen and (min-width: 100em) {
  .md-typeset .sim-frame { margin: 0 -3rem; }
  .md-typeset .sim-frame iframe { height: 1280px; }
}

/* ================= 手机端适配（≤719px） ================= */
@media screen and (max-width: 44.9375em) {

  /* 1. 表格：缩字号缩内边距 + 允许换行，让 4 列中文表在手机上尽量一屏放下 */
  .md-typeset__table { width: 100% !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .md-typeset table:not([class]) { font-size: .55rem; line-height: 1.3; display: table; width: 100%; table-layout: auto; }
  /* ★ Material 默认给单元格 min-width: 5rem(=100px)，手机 4 列就是 400px 硬底 → 必须盖掉 */
  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td { padding: .24rem .24rem; min-width: 0 !important; }
  .md-typeset table:not([class]) th { font-size: .52rem; white-space: normal; word-break: break-word; }
  .md-typeset table:not([class]) td { word-break: break-word; overflow-wrap: anywhere; }

  /* 2. 触控目标 ≥40px（抽屉导航、页脚、图标按钮） */
  .md-nav__link, .md-tabs__link, .md-footer__link, .md-footer-nav__link,
  .md-footer-meta a, .md-footer__inner a, .md-header__button, .md-search__icon {
    min-height: 40px; min-width: 40px; display: flex; align-items: center; justify-content: center;
  }
  .md-typeset .md-button, .md-typeset button { min-height: 40px; }

  /* 3. 内嵌模拟器：给足高度 + 全屏按钮拉满整行 */
  .md-typeset .sim-frame { margin: 0 -.5rem; }
  .md-typeset .sim-frame iframe { height: 88vh; min-height: 620px; }
  .md-typeset .sim-actions { flex-direction: column; align-items: stretch; }
  .md-typeset .sim-actions .sim-open { width: 100%; text-align: center; padding: .8rem 1rem; font-size: .9rem; }
  .md-typeset .sim-actions .sim-hint { text-align: center; font-size: .68rem; }

  /* 4. 标题略缩，避免一屏只有几行 */
  .md-typeset h1 { font-size: 1.45rem; }
  .md-typeset h2 { font-size: 1.18rem; }
  .md-typeset h3 { font-size: 1.02rem; }
}


/* ================= 深色主题覆盖（slate） ================= */
/* 我自定义的深蓝标题 / 白底表头是给浅色调的，深色下要重新配对比度 */
[data-md-color-scheme="slate"] {
  --kb-accent: #8fb3ff;          /* 标题用亮蓝紫，深底上够对比 */
  --kb-accent-dim: #a9c2f0;
  --kb-line: rgba(255, 255, 255, .14);
  --kb-surface: rgba(255, 255, 255, .05);
}

[data-md-color-scheme="slate"] .md-typeset h1 { color: #e8eeff; font-weight: 700; }
[data-md-color-scheme="slate"] .md-typeset h2 {
  color: var(--kb-accent);
  border-bottom: 1px solid var(--kb-line);
}
[data-md-color-scheme="slate"] .md-typeset h3 { color: var(--kb-accent-dim); }

/* 表格：深色表头 + 极淡斑马纹 */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: #2b3b5e; color: #f2f5ff;
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:nth-child(2n) td {
  background: rgba(255, 255, 255, .035);
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) td { border-color: var(--kb-line); }

/* 引用块（判据/结论） */
[data-md-color-scheme="slate"] .md-typeset blockquote {
  border-left: 4px solid var(--kb-accent);
  background: var(--kb-surface);
  color: rgba(255, 255, 255, .86);
}

/* 内嵌模拟器：边框与按钮 */
[data-md-color-scheme="slate"] .md-typeset .sim-frame {
  border-color: var(--kb-line); background: #1b1b1b;
}
[data-md-color-scheme="slate"] .md-typeset .sim-frame iframe { background: #fff; }
[data-md-color-scheme="slate"] .md-typeset .sim-actions .sim-open {
  background: #4a67c8; color: #fff !important;
}
[data-md-color-scheme="slate"] .md-typeset .sim-actions .sim-open:hover { background: #5b78d8; }
[data-md-color-scheme="slate"] .md-typeset .sim-actions .sim-hint { color: #9aa4b2; }

/* 卡片（首页五板块）在深色下的边框与底色 */
[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li,
[data-md-color-scheme="slate"] .md-typeset .grid.cards > ol > li {
  border-color: var(--kb-line);
  background: var(--kb-surface);
}

/* 代码块：给个略深底，别和正文糊在一起 */
[data-md-color-scheme="slate"] .md-typeset pre > code { background: #16181c; }
[data-md-color-scheme="slate"] .md-typeset code { background: rgba(255, 255, 255, .08); }

/* —— 深色微调（视觉复核后）：斑马纹/边框更清晰、顶栏降饱和、目录链接提亮 —— */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:nth-child(2n) td {
  background: rgba(255, 255, 255, .06);
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) td,
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  border-color: rgba(255, 255, 255, .22);
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th { background: #26365a; }

[data-md-color-scheme="slate"] .md-header,
[data-md-color-scheme="slate"] .md-tabs { background-color: #28304a; }

[data-md-color-scheme="slate"] .md-nav__link { color: rgba(255, 255, 255, .8); }
[data-md-color-scheme="slate"] .md-nav__link--active,
[data-md-color-scheme="slate"] .md-nav__link--active code { color: var(--kb-accent); }
[data-md-color-scheme="slate"] .md-nav__title { color: rgba(255, 255, 255, .92); }
