/* ============================================================================
 AP_DS · theme.css —— 深色硬编码兜底层（极小化重写）

 加载顺序：css.css（令牌 + 组件） → dvs-git.css（参考版式 覆盖层） → theme.css（本文件）

 职责边界（严格收窄）：
   本层【不改配色体系、不改布局尺寸】。
   配色由 css.css 的 :root / :root:not([data-theme="dark"]) / [data-theme="dark"] 三段
   调色板，以及 base.html 的内联 :root 决定；版式由 dvs-git.css 决定。
   本层只做一件事：把下层用【字面量写死的浅色值】在深色模式下覆写掉。

 为什么需要这一层：
   dvs-git.css 里有一批 `var(--dv-xxx, #回落值)` 与直接写死的浅色字面量
   （#fff / #f0f2f5 / #d8dee4 / #fff8c5 / rgba(0,0,0,.12) 等）。
   当同名变量已在 :root 定义时回落值不生效，但凡是【函数式写法之外直接写死】的位置，
   深色模式下会残留白底，本层负责补齐。

 本层不新增任何颜色令牌，不重声明 --repo-color-* / --dv-*。
 深色取值沿用 css.css [data-theme="dark"] 调色板同源值：
   画布 bg #0d1117 / 次级 #161b22 / 三级 #21262d / 边框 #30363d / 正文 #e6edf3
 ========================================================================== */

/* ============================================================================
 1) 按钮：主按钮上的白色前景与半透明白图标
    来源 dvs-git.css:280 / 281 / 771 / 772（color: #fff / rgba(255,255,255,.8)）
    深色下主按钮底色为亮蓝，白字对比度仍达标，但半透明图标会发灰，
    统一提到 .92 保证可见性。不改变任何尺寸。
 ========================================================================== */

html[data-theme="dark"] .dv-btn-primary svg,
html[data-theme="dark"] .dv-btn-primary i,
html[data-theme="dark"] .repo-btn--primary svg,
html[data-theme="dark"] .repo-btn--primary i {
  color: rgba(255, 255, 255, .92);
}

/* ============================================================================
 2) 收藏（star）按钮：写死的琥珀色浅底 #fff8c5 / 文字 #7d4e00
    来源 dvs-git.css:1760-1765
    深色下换成同色系暗底 + 亮字，保持"已收藏"语义不变。
 ========================================================================== */

html[data-theme="dark"] .dv-star-btn.is-starred {
  border-color: #d4a72c;
  color: #d4a72c;
}

html[data-theme="dark"] .dv-star-btn.is-starred .dv-star-count {
  background: rgba(212, 167, 44, .18);
  color: #e3b341;
}

/* ============================================================================
 3) 统计页：.stats-card / .stats-table / .stats-empty
    来源 dvs-git.css:1775-1804
    这些位置以 `var(--dv-bg-default, #fff)` 形式书写；--dv-bg-default 已在
    dvs-git.css:62 定义为 var(--repo-color-bg)，因此回落值不生效、本身是安全的。
    此处仅在深色下显式钉住，防止后续变量缺失时回落到白底。
 ========================================================================== */

html[data-theme="dark"] .stats-card,
html[data-theme="dark"] .stats-table th,
html[data-theme="dark"] .stats-table td,
html[data-theme="dark"] .stats-empty {
  background-color: #161b22;
  border-color: #30363d;
}

/* ============================================================================
 4) 404 页：.e404-bar / .e404-path code
    来源 dvs-git.css:1870-1901（#d8dee4 / #f0f2f5 回落值）
 ========================================================================== */

html[data-theme="dark"] .e404-bar {
  background-color: #21262d;
}

html[data-theme="dark"] .e404-path code {
  background-color: #21262d;
  color: #e6edf3;
}

/* ============================================================================
 5) 授权协议页（.lic-*）：写死的 #fff / #f0f2f5 / #d8dee4 大量聚集
    来源 dvs-git.css:1918-2012
    这是硬编码浅色最密集的一页，深色下原本会整页发白。
    仅在深色下覆写背景/边框/文字，尺寸与间距一律不动。
 ========================================================================== */

html[data-theme="dark"] .lic-hero,
html[data-theme="dark"] .lic-doc-head,
html[data-theme="dark"] .lic-toc-foot {
  border-bottom-color: #30363d;
}

html[data-theme="dark"] .lic-col,
html[data-theme="dark"] .lic-toc-inner,
html[data-theme="dark"] .lic-doc {
  background-color: #161b22;
  border-color: #30363d;
}

html[data-theme="dark"] .lic-alert,
html[data-theme="dark"] .lic-quote,
html[data-theme="dark"] .lic-accept,
html[data-theme="dark"] #lic-toc-nav a:hover,
html[data-theme="dark"] #lic-toc-nav a.is-active {
  background-color: #21262d;
}

html[data-theme="dark"] .lic-alert,
html[data-theme="dark"] .lic-quote {
  border-left-color: #d29922;
}

html[data-theme="dark"] #lic-toc-nav a.is-active {
  border-left-color: #60a5fa;
}

/* 正文/弱化文字：显式钉到深色前景，避免回落到 #1f2328 这类近黑字 */
html[data-theme="dark"] #lic-toc-nav a,
html[data-theme="dark"] .lic-doc-line,
html[data-theme="dark"] .lic-col li,
html[data-theme="dark"] .lic-accept p {
  color: #e6edf3;
}

html[data-theme="dark"] .lic-hero-sub,
html[data-theme="dark"] .lic-doc-ver,
html[data-theme="dark"] .lic-alert p,
html[data-theme="dark"] .lic-toc-title,
html[data-theme="dark"] .lic-toc-foot,
html[data-theme="dark"] .lic-quote,
html[data-theme="dark"] #lic-toc-nav a span {
  color: #9ca3af;
}

/* 回到顶部按钮：写死 background:#fff + box-shadow rgba(0,0,0,.12)
   来源 dvs-git.css:2005-2012 */
html[data-theme="dark"] .lic-top {
  background-color: #161b22;
  border-color: #30363d;
  color: #e6edf3;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .55);
}

html[data-theme="dark"] .lic-top:hover {
  background-color: #21262d;
}

/* ============================================================================
 6) 弹层阴影：写死的 rgba(0,0,0,.12) / rgba(31,35,40,.04)
    来源 dvs-git.css:662（.dv-menu / .dv-lang-menu）与 :41-43 的 --dv-shadow-*
    深色底上浅色阴影不可见，换成更黑的一层，仅改阴影、不改布局。
    （--dv-shadow-* 是令牌，但 dvs-git.css 已用字面量 rgba(0,0,0,.12) 写死，
     此处按字面量口径覆盖。）
 ========================================================================== */

html[data-theme="dark"] .dv-lang-menu,
html[data-theme="dark"] .dv-menu {
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

html[data-theme="dark"] .dv-menu-label:not(:first-child) {
  border-top-color: #30363d;
}

/* ============================================================================
 7) 输入框 inset 高光：dvs-git.css:590 的 inset 0 1px 0 浅色
    深色下白色内高光会形成一圈亮边，压成深色。
 ========================================================================== */

html[data-theme="dark"] .dv-input,
html[data-theme="dark"] .dv-select {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

/* ============================================================================
 8) 选中态：css.css 的浅色调 ::selection 在深色下对比不足
 ========================================================================== */

html[data-theme="dark"] ::selection {
  background: rgba(96, 165, 250, .30);
}

/* ============================================================================
 9) 打印：去掉顶栏与浮层（沿用 dvs-git.css:2015 已有策略，此处仅补 .dv-topbar）
     不新增视觉效果，只保证深色模式下打印仍是白纸黑字。
 ========================================================================== */

@media print {
  body {
    background: #fff;
    color: #000;
  }
}

/* ============================================================================
 10) 窄屏：仅为深色兜底规则保持正确层叠而设的空占位（不改变任何尺寸）。
     说明：本层刻意不写任何响应式尺寸规则 —— 版式归 dvs-git.css:1556 负责。
 ========================================================================== */

@media (max-width: 768px) {
  html[data-theme="dark"] .lic-doc {
    background-color: #161b22;
  }
}


/* ============================================================================
 11) 【审计补丁 2026-10-12】代码块残留白底 —— P0 最高危
 真因：css.css:3041-3045 有一条 !important 兜底，把【所有】pre 强制刷成浅色：
       pre, pre code, pre code.hljs, pre[class*="language-"] {
         background: #f6f8fa !important; background-color: #f6f8fa !important;
         color: #1f2328 !important; }
       且 css.css:2740/2741/2744 的代码块本体、:2790-2803 的悬停控制条、
       :2913-2926 的 .copy-btn 同样硬编码浅色。
 影响：深色模式下【每一个代码块都是刺眼白块】；首页还额外加载了
       prism-tomorrow（深色语法主题），被这条 !important 强行压回浅色，
       造成「深色高亮色 + 白底」的错配。
 修复：在深色下等权覆盖（同样带 !important 以赢得层叠），
       取值沿用 css.css [data-theme="dark"] 调色板同源值。
       只改颜色，不动任何尺寸/间距/圆角。
 ========================================================================== */

html[data-theme="dark"] pre,
html[data-theme="dark"] pre code,
html[data-theme="dark"] pre code.hljs,
html[data-theme="dark"] pre[class*="language-"],
html[data-theme="dark"] :is(.code-block, .code-block-container) > pre,
html[data-theme="dark"] :is(.md-rendered, .release-content, .readme-content) pre {
  background: #161b22 !important;
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  border-color: #30363d !important;
}

/* 行内代码：css.css:2725 的 rgba(175,184,193,.20) 深色下发灰偏亮 */
html[data-theme="dark"] :is(.md-rendered, .release-content, .readme-content, .announcement-content) code,
html[data-theme="dark"] :is(.md-rendered, .release-content, .readme-content, .announcement-content) tt {
  background: rgba(110, 118, 129, .40);
  color: #e6edf3;
  border-color: #30363d;
}

/* 行号槽：css.css:2768 #8c959f / :2771 #57606a 在深色底上对比不足 */
html[data-theme="dark"] :is(.code-block, .code-block-container) pre > code > .line::before {
  color: #6e7681;
}
html[data-theme="dark"] :is(.code-block, .code-block-container) pre > code > .line:hover {
  background: rgba(110, 118, 129, .15);
}
html[data-theme="dark"] :is(.code-block, .code-block-container) pre > code > .line:hover::before {
  color: #9ca3af;
}

/* ============================================================================
 12) 【审计补丁】复制 / 自动隐藏控制条按钮 —— 硬编码白底
 来源 css.css:2790 rgba(255,255,255,.86) / :2797 #eaeef2 / :2800 #dfe3e8 /
      :2803 #eaf7ee / :2913 #fff / :2918 #eaeef2 / :2919 #dfe3e8 / :2920 #eaf7ee
 深色下这些是浮在深色代码块上的白色小块，非常刺眼。
 ========================================================================== */

html[data-theme="dark"] :is(.code-block, .code-block-container) > .auto-hide-control > button,
html[data-theme="dark"] :is(.code-block, .code-block-container) > .copy-btn,
html[data-theme="dark"] .copy-btn {
  background: rgba(33, 38, 45, .92);
  background-color: rgba(33, 38, 45, .92);
  color: #9ca3af;
  border-color: #30363d;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] :is(.code-block, .code-block-container) > .auto-hide-control > button:hover,
html[data-theme="dark"] :is(.code-block, .code-block-container) > .copy-btn:hover,
html[data-theme="dark"] .copy-btn:hover {
  background: #30363d;
  background-color: #30363d;
  color: #e6edf3;
  border-color: #484f58;
}

html[data-theme="dark"] :is(.code-block, .code-block-container) > .auto-hide-control > button:active,
html[data-theme="dark"] :is(.code-block, .code-block-container) > .copy-btn:active,
html[data-theme="dark"] .copy-btn:active {
  background: #484f58;
  background-color: #484f58;
}

/* 复制成功态：浅绿底 -> 深色可读绿 */
html[data-theme="dark"] :is(.code-block, .code-block-container) > .auto-hide-control > button.done,
html[data-theme="dark"] :is(.code-block, .code-block-container) > .copy-btn.copied,
html[data-theme="dark"] :is(.code-block, .code-block-container) > .copy-btn.done,
html[data-theme="dark"] .copy-btn.copied,
html[data-theme="dark"] .copy-btn.done {
  color: #3fb950;
  border-color: #3fb950;
  background: rgba(63, 185, 80, .15);
  background-color: rgba(63, 185, 80, .15);
}

/* ============================================================================
 13) 【审计补丁】Markdown 高亮 mark —— css.css:2654 硬编码 #fff3c4 浅黄底
 深色下是白字/继承色压浅黄，几乎不可读。
 ========================================================================== */

html[data-theme="dark"] :is(.md-rendered, .release-content, .readme-content) mark {
  background: rgba(187, 128, 9, .34);
  color: #e6edf3;
}

/* ============================================================================
 14) 【审计补丁】有序列表序号徽标 —— css.css:2696 color:#fff
 深色下 --md-accent 若为亮色，白字对比不足；钉到深色前景。
 ========================================================================== */

html[data-theme="dark"] :is(.md-rendered, .release-content, .readme-content) ol > li::before {
  color: #0d1117;
}

/* ============================================================================
 15) 【审计补丁】表格 / 徽章 / 输入框 —— 复查确认
 结论：.repo-table th（css.css:1280-1283）、md thead th（:2862）、
       .md-table-wrap（:2848）、.repo-badge--*（:1155-1172）、
       input/textarea/select（css.css:554-560）均【已使用 CSS 变量】，
       深色下随 [data-theme="dark"] 调色板自动切换，**无需覆盖**。
       此段仅对 .repo-badge--* 的 color:#fff 做语义加固：
       徽章底为品牌实色，白字对比度本就达标，保持不变。
 ========================================================================== */

/* ============================================================================
 16) 【审计补丁】回到顶部 / 通用浮层阴影（补漏）
 来源 dvs-git.css:2005-2012 之外的 .dv-top 变体与 css.css 的 rgba(255,255,255,.92)
 ========================================================================== */

html[data-theme="dark"] .dv-card,
html[data-theme="dark"] .repo-card {
  box-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}

/* ============================================================================
 17) 【审计补丁 · 响应式】窄屏表格横向溢出
 真因：css.css:2848 .md-table-wrap 与 :2517 .comparison-table 虽有 overflow-x:auto，
       但 .md-table-wrap 未限制 width，在 <640px 时若父级为 flex/grid 子项，
       overflow 容器不收缩，会把整页撑出横向滚动条。
 修复：仅加约束，不改任何既有尺寸值。
 ========================================================================== */

@media (max-width: 640px) {
  .md-table-wrap,
  .comparison-table {
    max-width: 100%;
  }
  /* 移动端：表格内长 token（URL/路径）换行，避免撑破容器 */
  :is(.md-rendered, .release-content, .readme-content) td,
  :is(.md-rendered, .release-content, .readme-content) th {
    overflow-wrap: anywhere;
  }
}

/* ============================================================================
 18) 【审计补丁 · 响应式】反馈页 1180px 固定宽度容器
 来源 feedback.html 内联 width:1180px；<1200px 视口下必然横向溢出。
 仅加 max-width 约束，不改其基准宽度。
 ========================================================================== */

@media (max-width: 1200px) {
  #fb-wrap,
  .fb-wrap,
  .feedback-wrap {
    max-width: 100% !important;
  }
}

/* ============================================================================
 19) 【审计补丁 · 响应式】填充 theme.css 内既有的空占位断点
 L203 的 @media (max-width:768px) 原本只包一条冗余的 .lic-doc 深色规则
 （.lic-doc 深色已由本文件第 5 节无条件覆盖，该块是 no-op）。
 此处补入真正的窄屏兜底，保持该断点有意义。
 ========================================================================== */

@media (max-width: 768px) {
  /* 深色下窄屏仍保证授权页正文底色正确（冗余但无害，保留原语义） */
  html[data-theme="dark"] .lic-doc {
    background-color: #161b22;
  }
  /* 宽表/长代码在窄屏下不撑破页面 */
  html[data-theme="dark"] .lic-doc table,
  html[data-theme="dark"] .lic-doc pre {
    max-width: 100%;
  }
}
