/* css/modules/markdown.css — Q3 Markdown 渲染样式（INTERACT-SPEC §2.11 Q3；第 26 轮 Q3b 二轮 round-26.md §N9）
 * 作用域：.msg.assistant .md-*（惰性 DOM，不影响初始截图 / cmp2 基线）
 * 复用 SPEC §6 已登记：.md-pre / .md-code / .md-ul / .md-ol（states.css 已实现基础值，本文件仅补充）
 *
 * 证据缩写：
 *   [E2-4.5]  HOST-EVIDENCE-2 §4.5 主区快照（ref/host-main-1_main.png）：主区底 #fcfcfc，代码/表格块 #f6f6f6–#f7f7f8
 *   [PIL]     本轮对 ref/host-main-1_main.png 的像素测量（tests/module-md-render.html 内同源断言）：
 *             表格块 y=208..462 / x=41..866 底色 #f6f6f6（173884 px，全图第 2 多）；外框 1px #ebebeb + 1px #f5f5f5 内衬，
 *             四角 2px 圆角过渡（#f4→#e9）；表头行文字带 y=223..236（14px 行），首行正文 y=244..258；
 *             表头与首行间隔线 y=376 #ededed（1px 弱线）；无竖直分隔列；表头暗像素密度 461 vs 正文 1066/740（表头字重不高于正文 → 500）
 *             蓝色链接系：最深 #0d52de / #1758df，抗锯齿 #81a2e4 #9eb6e5；行内 code 底 #e8e8e8 带（y=51..55 等 4–6px 高短带）
 *   [HCSS:x]  宿主 dtcoder-glass-react.css `.glass-markdown-content x` 规则（bundle 实证）
 *             table: border-collapse:separate; border:1px solid var(--dtcoder-color-border)(=#0000000d); border-radius:8px; overflow:hidden
 *             th/td: border-right/bottom 1px; padding 8px 12px; text-align:left; vertical-align:top; th:last-child/td:last-child border-right:none
 *             th: background transparent; font-weight semibold(600) [被 [PIL] 表头密度实测下调为 500，SPEC §2.11 亦要求 500]; color muted(#0000007d); font-size 12px; padding-top/bottom 10px
 *             h1 24px / h2 16px(--font-size-md) / h3 18px / h4 未单列(→继承 body 14px 加粗) ; 全部 semibold, line-height 1.2, margin 24px 0 12px
 *             blockquote: margin 12px 0; padding 8px 12px; bg page-dark; radius 6px; font-size 12px; border-left 3px solid border
 *             hr: border 0; border-top 1px solid border; margin 12px 0
 *             a: color var(--dtcoder-color-link)(=--info=--color-blue-a11); underline; hover 82% mix
 *             code(inline): padding 1.5px 3px; radius 4px; bg --glass-markdown-inline-code-bg; weight regular
 *             code-block-header: height 28px; padding 0 10px; border-bottom 1px border-light; bg card-light 70%; mono; muted 色
 *             code-block: border 1px --color-gray-border-light(#0000000d); radius 12px; bg --dtcoder-code-block-bg-color(=card-light=#00000006)
 *             ol: padding-left 1.8em decimal; ul: padding-left 1.5em disc; li margin 0 0 4px; ul ul ul square; ol ol lower-alpha; ol ol ol lower-roman
 *             li.task-list-item: position relative; padding-inline-start 1.75em; list-style none; input absolute inset-inline-start 0 top .7em
 *             p: margin-block 4px; white-space pre-wrap; strong: bold
 *
 * ── 第 26 轮 Q3b 增量证据（round-26.md §N9 ①②④）──
 *   [PIL-26]  ref/host-main-1_main.png 复测定值：
 *             · 表格底 **#f6f6f6**（bbox x=41..866/y=208..462 众数；#f7f7f8 仅在主区右缘 x=916..919 滚动条槽，不属于表格）→ 表格 #f6f6f6，代码块沿用区间上限 #f7f7f8
 *             · 外框 1px #ebebeb（y=207/463、x=40/867 各 805/235px 一致）+ 内衬 1px #f5f5f5；四角 ≈8px（对角线 8 步 #fc→#f9→#ef→#ea→#ec→#f1→#f3→#f5）
 *             · **无斑马纹**（表体除文字带外全 #f6f6f6；宿主 CSS 无 tr:nth-child 规则，grep 0）；**无竖线**（x=43..864 列众数全 #f6f6f6）
 *             · 表头与表体间**无分隔线**（y=237..243 全 #f6f6f6）；原记的 y=376 #ededed 弱线经 ASCII 复核为 Markdown 破折号文字行 `---…`（y=377 x=54..456 周期 2–3px），**撤销表头分隔线**
 *             · 表头字色 #212121/#252525 与正文 #2f2f2f/#222222 同深 → 表头**非 muted**，改用正文色；字重密度 461 vs 1066 → 500 维持
 *   [HCSS-26] 代码块：宿主 CodeHighlighter `showCopyButton = true` 默认（main-b1WagHab.js const CodeHighlighter）→ 有复制按钮，做；
 *             `.code-highlighter__action-button` 24×24 / border 1px / radius 6px / bg --popover(=gray-1) / color secondary / hover color text+border primary；
 *             图标 lucide Copy 12px strokeWidth 1.75；`.code-highlighter__actions--header` position static opacity 1（头部右侧常驻）；
 *             `.code-highlighter` --code-highlighter-line-height 1.5；`__scroll` max-height 420px overflow auto；`__line-root` padding 0 10px
 *   [TOK]     css/modules/tokens.css 变量（Q4）：--am-gray-1 #fcfcfc L12509 / --am-gray-3 #f1f1f1 L12511 / --am-gray-4 #e8e8e8 L12512 / --am-gray-12 #202020 L12520 /
 *             --am-gray-a2 L12522 / --am-gray-a3 #0000000d L12523 / --am-gray-a11 #0000007d L12531 / --am-info(=blue-11 #0068e8 L12543) / --am-muted-foreground /
 *             --am-success #00834d L12591 / --am-destructive / --am-radius-{4,6,8,12} / --am-font-size-{sm,body,md,lg,2xl} / --am-font-weight-* / --am-line-height-heading / --am-font-family-code
 *             ④ 全部 var(--am-*, <fallback>)，fallback 保留原实测值，自测页不载 tokens.css 亦可独立渲染
 *
 * ── 第 27 轮 Q25 ④ 复核（round-27.md §N9；ref/host-message-conv-20260922-174219.png）──
 *   该多轮对话截图主区内**无表格、无围栏代码块**（#f7f7f8 0 px；#f6f6f6 仅 1416 px 且散布于标题栏/滚动条，无连续块带 ≥8 行），
 *   行内 code 疑似带 y=201..219 经 bbox 复核为文字抗锯齿（文字与 #e8e8e8 边距 L1/R0），非底色块 → 无法复核行内 code 底。
 *   结论：表格 #f6f6f6 / 代码块 #f7f7f8 / 行内 code #e8e8e8 维持 ref/host-main-1_main.png 实测值不变；新截图新增可复核项：
 *   助手正文字色 #202020（暗像素众数，与 --am-gray-12 完全一致）→ .md-root color 的 fallback 自 #252525 校正为 #202020。
 */

/* 根容器 [HCSS:.glass-markdown-content] font-size 14px / medium */
.msg.assistant .md-root { font-size: var(--am-font-size-body, 14px); line-height: 22px; color: var(--am-gray-12, #202020); /* [PIL] host-main-1 最深 #252525 → [Q25] host-message-conv 暗像素众数 #202020，fallback 校正 */ }
.msg.assistant .md-root > :first-child { margin-top: 0; }
.msg.assistant .md-root > :last-child { margin-bottom: 0; }

/* 段落 [HCSS:p] */
.msg.assistant .md-p { margin: 4px 0; white-space: pre-wrap; word-break: break-word; }

/* 标题 [HCSS:h1-h6] */
.msg.assistant .md-h { font-weight: var(--am-font-weight-semibold, 600); line-height: var(--am-line-height-heading, 1.2); margin: 24px 0 12px; color: var(--am-gray-12, #202020); }
.msg.assistant .md-h1 { font-size: var(--am-font-size-2xl, 24px); }
.msg.assistant .md-h2 { font-size: var(--am-font-size-md, 16px); }
.msg.assistant .md-h3 { font-size: var(--am-font-size-lg, 18px); }
.msg.assistant .md-h4 { font-size: var(--am-font-size-body, 14px); }
.msg.assistant .md-h5 { font-size: var(--am-font-size-body, 14px); font-weight: var(--am-font-weight-bold, 700); }
.msg.assistant .md-h6 { font-size: var(--am-font-size-sm, 12px); font-weight: var(--am-font-weight-bold, 700); color: var(--am-muted-foreground, #0000007d); }
.msg.assistant .md-h + .md-ul, .msg.assistant .md-h + .md-ol { margin-top: 4px; } /* [HCSS:h2+ul] */

/* 强调 [HCSS:strong/em/del] */
.msg.assistant .md-strong { font-weight: var(--am-font-weight-bold, 700); }
.msg.assistant .md-em { font-style: italic; }
.msg.assistant .md-del { text-decoration: line-through; opacity: .85; }

/* 链接 [HCSS:a] + [PIL] 蓝色系 #0d52de；SPEC §2.11 指定 #0066cc 系 → 取 #0066cc（与实测 #0d52de 同色相，Δ 在抗锯齿区间内） */
.msg.assistant .md-link { color: var(--am-info, #0066cc); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--am-info, #0066cc) 55%, transparent); text-underline-offset: 2px; cursor: pointer; }
.msg.assistant .md-link:hover { color: color-mix(in oklab, var(--am-info, #0066cc) 82%, var(--am-gray-12, #202020)); }
.msg.assistant .md-link--file { font-family: var(--am-font-family-code, var(--mono)); font-size: var(--type-body-size);  line-height: var(--type-body-line); }
.msg.assistant .md-unsafe-link { color: inherit; }

/* 行内 code [HCSS:code inline] + [PIL] 底 #e8e8e8；states.css 已给 #f1f1f1，此处按宿主实测覆盖 */
.msg.assistant .md-code { font-family: var(--am-font-family-code, var(--mono)); font-size: var(--am-font-size-sm, 12px); background: var(--am-gray-4, #e8e8e8); border-radius: var(--am-radius-4, 4px); padding: 1.5px 3px; font-weight: var(--am-font-weight-regular, 400); word-break: break-word; }
/* 文件路径型行内 code [HCSS:code.inline-code-with-hover--file-reference]：链接色 + 10% 链接色混底 + 下划线 */
.msg.assistant .md-code--file { cursor: pointer; color: var(--am-info, #0066cc); background: color-mix(in srgb, var(--am-info, #0066cc) 10%, var(--am-gray-4, #e8e8e8)); font-weight: var(--am-font-weight-medium, 500); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--am-info, #0066cc) 55%, transparent); }

/* 围栏代码块 —— 第 27 轮 Q40 ② 定值 [SHOT-Q40] ref/host-message-q40-20260922-180600.png（3x：ref/host-message-codeblock-3x.png）
 *   宿主窗口「开发1 · Glass」1200×948；主区内 5 个围栏代码块 y=257..314 / 327..384 / 397..454 / 467..524 / 537..594（各 58 高，块间 gap 12，前段正文→块 18）
 *   [PIL] 块 1 外框 bbox (320,257)-(1147,314) 828×58：
 *     · 底色 **#f6f6f6**（内部众数 589/行）= --am-gray-a2 #00000006 叠 #fcfcfc（宿主 --dtcoder-code-block-bg-color=card-light=gray-a2）
 *       → 解 N2 #35/#36/#39：既非 --am-gray-2 #f9f9f9 也非旧基准 #f6f7f8，定 var(--am-gray-a2)；旧 #f7f7f8 为主区右缘滚动条槽误采
 *     · 边框 1px **#e9e9e9**（y=257/314 行、x=320/1147 列各 806/36 px 一致）= --am-gray-a3 #0000000d 叠 #fcfcfc
 *     · 圆角 **8px**（左上角 y=257 首像素 x=327 → y=264 收敛 x=320，7 行过渡；非 12）
 *     · **无语言标签头**（块顶 y=258 起即底色，无 28px 头带；宿主 L11074 `[data-streamdown=code-block-header]{display:none}`，
 *       CodeHighlighter 自家头仅 filePath 时出现）→ .md-codeblock-head 默认隐藏，保留 DOM/data-lang 供测试与可访问性
 *     · **复制按钮静态不可见**（宿主 `.code-highlighter__actions` absolute top 8 right 8 opacity 0，hover 显示）→ 改为块内右上角悬浮，hover 显示
 *     · 代码字：文字 bbox 起点 (334,273)：padding-left 13 = 12 + 1 边框 → **padding 12px**；等宽字形 pitch 8.4–9px → **14px** mono
 *       （宿主 --glass-markdown-code-font-size = --dtcoder-markdown-code-font-size ?? --font-size-body 14px）；字色 #1f1f1f–#222222 → gray-12
 *     · 底部横向滚动条：y=306..311 thumb #a4a4a4（x=327..917）、轨道透明；块高 58 = 1+12+21(行高 1.5)+12+6(滚动条)+5+1
 *   [HCSS] .code-highlighter --code-highlighter-line-height 1.5；__scroll max-height 420px overflow auto；__line-root padding 0 10px white-space pre */
.msg.assistant .md-codeblock { position: relative; margin: 12px 0; border: 1px solid var(--am-gray-a3, #e9e9e9); border-radius: var(--am-radius-8, 8px); background: var(--am-gray-a2, #00000006); overflow: hidden; }
/* 头默认隐藏 [SHOT-Q40 无头带][HCSS L11074]；保留 .md-codeblock-lang DOM（data-lang 在 .md-codeblock 上） */
.msg.assistant .md-codeblock-head { display: none; }
.msg.assistant .md-codeblock-lang { text-transform: lowercase; }
/* 动作区 [HCSS:.code-highlighter__actions] absolute top 8 right 8 opacity 0 → hover/focus-within 1 */
.msg.assistant .md-codeblock-actions { position: absolute; top: 8px; right: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; opacity: 0; transition: opacity .2s ease; }
.msg.assistant .md-codeblock:hover .md-codeblock-actions, .msg.assistant .md-codeblock:focus-within .md-codeblock-actions { opacity: 1; }
/* 复制按钮 [HCSS-26:.code-highlighter__action-button] 24×24 / border 1px / radius 6 / bg gray-1 / secondary；hover color text + border primary */
.msg.assistant .md-codeblock-copy { box-sizing: border-box; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--am-gray-a3, #0000000d); border-radius: var(--am-radius-6, 6px); background: var(--am-gray-1, #fcfcfc); color: var(--am-muted-foreground, #0000007d); cursor: pointer; transition: color .15s, border-color .15s; }
.msg.assistant .md-codeblock-copy:hover { color: var(--am-gray-12, #202020); border-color: var(--am-gray-12, #202020); }
.msg.assistant .md-codeblock-copy:focus-visible { outline: 2px solid var(--am-info, #0066cc); outline-offset: 1px; }
/* 图标：lucide Copy 12px strokeWidth 1.75（两叠矩形，CSS 绘制不引 SVG）；copied → 对勾（宿主 MessageFlowCheck） */
.msg.assistant .md-codeblock-copy-icon { position: relative; width: 12px; height: 12px; display: block; }
.msg.assistant .md-codeblock-copy-icon::before, .msg.assistant .md-codeblock-copy-icon::after { content: ''; position: absolute; box-sizing: border-box; border: 1.75px solid currentColor; border-radius: 2px; width: 8px; height: 8px; }
.msg.assistant .md-codeblock-copy-icon::before { left: 0; top: 4px; }
.msg.assistant .md-codeblock-copy-icon::after { left: 4px; top: 0; background: var(--am-gray-1, #fcfcfc); }
.msg.assistant .md-codeblock-copy[data-state="copied"] { color: var(--am-success, #00834d); border-color: var(--am-success, #00834d); }
.msg.assistant .md-codeblock-copy[data-state="copied"] .md-codeblock-copy-icon::before { display: none; }
.msg.assistant .md-codeblock-copy[data-state="copied"] .md-codeblock-copy-icon::after { left: 3px; top: 0; width: 5px; height: 9px; border-width: 0 1.75px 1.75px 0; border-radius: 0; background: transparent; transform: rotate(45deg); }
.msg.assistant .md-codeblock-copy[data-state="failed"] { color: var(--am-destructive, #c00900cf); border-color: var(--am-destructive, #c00900cf); }
/* 代码体 [SHOT-Q40] padding 12 / 14px mono / 行高 1.5=21px / 字色 gray-12；[HCSS] max-height 420 overflow auto；横向滚动条 6px thumb #a4a4a4 */
.msg.assistant .md-codeblock .md-pre { margin: 0; border-radius: 0; background: transparent; padding: 12px; font-family: var(--am-font-family-code, var(--mono)); font-size: var(--am-font-size-body, 14px); line-height: 1.5; color: var(--am-gray-12, #202020); max-height: 420px; overflow: auto; scrollbar-width: thin; }
.msg.assistant .md-codeblock .md-pre::-webkit-scrollbar { width: 6px; height: 6px; }
.msg.assistant .md-codeblock .md-pre::-webkit-scrollbar-track { background: transparent; }
.msg.assistant .md-codeblock .md-pre::-webkit-scrollbar-thumb { border-radius: 999px; background: #a4a4a4; /* [PIL] y=306..311 thumb 众数 */ }
.msg.assistant .md-pre-code { font-family: inherit; font-size: inherit; background: transparent; padding: 0; white-space: pre; }

/* 表格 [HCSS:table/th/td] + [PIL-26]；[Q40 ③] host-message-q40 截图主区无表格（#f6f6f6 连续块带全部为上述 5 个代码块，宽 828 无列分隔/无表头行带）→ 表格值维持不变 底 #f6f6f6、框 #ebebeb、无竖线、无斑马纹、无表头分隔线、圆角 8、th 500 同正文色 */
/* ① 横向溢出：wrap 容器内滚动，min-width:0 防撑破 thread；表格 min-width max-content 让长内容触发 wrap 的 overflow-x */
.msg.assistant .md-table-wrap { margin: 12px 0; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; border-radius: var(--am-radius-8, 8px); }
.msg.assistant .md-table { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; background: #f6f6f6; border: 1px solid var(--am-gray-a3, #ebebeb); border-radius: var(--am-radius-8, 8px); overflow: hidden; font-size: var(--am-font-size-body, 14px); line-height: 22px; }
.msg.assistant .md-th, .msg.assistant .md-td { padding: 8px 12px; text-align: left; vertical-align: top; border: 0; }
.msg.assistant .md-th { font-weight: var(--am-font-weight-medium, 500); color: var(--am-gray-12, #202020); font-size: var(--am-font-size-body, 14px); line-height: 22px; padding-top: 10px; padding-bottom: 10px; background: transparent; white-space: nowrap; }
.msg.assistant .md-td { white-space: normal; }
.msg.assistant .md-align-center { text-align: center; }
.msg.assistant .md-align-right { text-align: right; }
.msg.assistant .md-td .md-p, .msg.assistant .md-th .md-p { margin: 0; white-space: normal; }
.msg.assistant .md-td .md-code { white-space: normal; }

/* 引用块 [HCSS:blockquote] */
.msg.assistant .md-blockquote { margin: 12px 0; padding: 8px 12px; background: var(--am-gray-3, #f1f1f1); /* [HCSS] page-dark=gray-3 */ border-left: 3px solid var(--am-gray-a3, #ebebeb); border-radius: var(--am-radius-6, 6px); font-size: var(--am-font-size-sm, 12px); line-height: 20px; color: var(--am-gray-12, #202020); }
.msg.assistant .md-blockquote > .md-p { margin: .5em 0; }
.msg.assistant .md-blockquote > .md-p:first-child { margin-top: 0; }
.msg.assistant .md-blockquote > .md-p:last-child { margin-bottom: 0; }

/* 分隔线 [HCSS:hr] */
.msg.assistant .md-hr { border: 0; border-top: 1px solid var(--am-gray-a3, #ebebeb); margin: 12px 0; height: 0; }

/* 列表 [HCSS:ol/ul/li 嵌套]（.md-ul/.md-ol 基础 margin/padding 由 states.css §6 登记项提供，此处按宿主 list-style 补充） */
.msg.assistant .md-ul { list-style-type: disc; padding-left: 22px; margin: 4px 0; }
.msg.assistant .md-ol { list-style-type: decimal; padding-left: 25px; margin: 4px 0; }
.msg.assistant .md-li { margin: 0 0 4px; position: relative; list-style-position: outside; }
.msg.assistant .md-li > .md-p { margin: 0 0 4px; }
.msg.assistant .md-ul .md-ul, .msg.assistant .md-ol .md-ul, .msg.assistant .md-ul .md-ol, .msg.assistant .md-ol .md-ol { margin: 4px 0; }
.msg.assistant .md-ul .md-ul { list-style-type: circle; }
.msg.assistant .md-ul .md-ul .md-ul, .msg.assistant .md-ol .md-ol .md-ul { list-style-type: square; }
.msg.assistant .md-ol .md-ol { list-style-type: lower-alpha; }
.msg.assistant .md-ol .md-ol .md-ol { list-style-type: lower-roman; }

/* 任务列表 [HCSS:li.task-list-item] per-item，不影响同列表内普通项 */
.msg.assistant .md-li--task { list-style: none; padding-inline-start: 1.75em; margin-left: -1.5em; }
.msg.assistant .md-ol .md-li--task { margin-left: -1.8em; }
.msg.assistant .md-task-checkbox { position: absolute; inset-inline-start: 0; top: .35em; margin: 0; width: 14px; height: 14px; accent-color: var(--am-success, #00834d); /* HOST-EVIDENCE-2 §2 CircleCheck 绿 */ }
.msg.assistant .md-li--done { color: var(--am-muted-foreground, #0000007d); }

/* toast（Q3b ③）：复用 states.css .am-toast 全部样式，仅加标识类 */
.md-toast { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .msg.assistant .md-codeblock-copy { transition: none; }
}
