/* =====================================================================
   杜鸣工作室 · 代码编程三课「视觉统一层」（2026-11-09）
   ---------------------------------------------------------------------
   只在 compare（双语对照）站加载，用来把这一站拉到与 python / cpp 两站
   完全一致的组件规格上。所有数值都取自 python / cpp 的实测值，不是猜的：

     字体栈        -apple-system, BlinkMacSystemFont, "Segoe UI",
                   "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei"
     代码字体      "Cascadia Code" 14.5px / 行高 1.65（实测 23.925px）
     编辑标题行    .ed-head 高 42px，标题 13px / 600
     小按钮 .sbtn  12px / 高 32px / 圆角 7px / padding 0 10px
                   bg #121b2c / 文字 #b4bcca / 边框 1px rgba(255,255,255,.1)
     主按钮 .abtn  14.5px / 600 / 高 41px / 圆角 10px / bg #121b2c / 文字 #f5f2ea
                   提交判分 = #07c160 绿底 + #04122b 深字（取消原来的金→红渐变）
     编辑器容器    圆角 8px / 边框 1px #3a3a3a / 底 #0a1124

   另外修两处「不能正常显示」：
     1) video 模式下 .compose-band 仍被钉死在 46vh，聊天区一隐藏就剩下半屏纯黑；
        同时 dm-mode.js 把 .col-scroll 放开成 flex:0 0 auto（自然高 759px），
        把同一列里的 .col-work 挤到 2px —— 代码编辑器整块消失。
        这里把高度改成「讲义可滚 + 编辑器保底」，两栏各自吃满整屏。
     2) .lesson-video video 是 preload="none"，元数据没来时高度为 0，
        视频区变成一条 0px 的缝隙（截图里那个 0:00 黑框就是这么来的）。
        用 aspect-ratio 先把 16:9 的位置占住。

   引入位置必须是本页最后一个 <link>，靠「同权重 + 后置」和必要的 ID 提权压过
   wxchat.css / dm-mode.js 运行时注入的 !important。
   ===================================================================== */

/* ============ 1. 排版：与 python / cpp 同一套字体栈 ============ */
/* wxchat.css 里 body.wxapp 的 font-family 带 !important，这里必须同权重带
   !important 且后置才能压过去（否则整页仍是 PingFang SC 打头）。 */
body.wxapp,
body.wxapp button,
body.wxapp input,
body.wxapp select,
body.wxapp textarea {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif !important;
}

/* 代码字体 / 字号：原来 12.5px monospace，两门主课是 Cascadia Code 14.5px */
body.wxapp .CodeMirror,
body.wxapp .CodeMirror pre.CodeMirror-line,
body.wxapp .CodeMirror pre.CodeMirror-line-like,
body.wxapp .CodeMirror textarea,
body.wxapp .py-hint-box,
body.wxapp .sol-code,
body.wxapp .sol-code code,
body.wxapp .content pre,
body.wxapp .content code,
body.wxapp .content pre code {
  font-family: "Cascadia Code", "SF Mono", "Cascadia Mono", Consolas,
               "Courier New", monospace !important;
}
body.wxapp .ed-host .CodeMirror {
  font-size: 14.5px !important;
  line-height: 1.65 !important;
}
body.wxapp .CodeMirror-lines { padding: 4px 0; }

/* ============ 2. 编辑器容器：与 python 的 .comp-code 同规格 ============ */
body.wxapp .col-work .ed-host {
  border-radius: 8px;
}
/* python 的 .comp-code 实测：容器底 rgb(26,26,26)、边框 #3a3a3a，
   里面的 CodeMirror 才是深蓝 rgb(10,17,36)。这里照抄，两站才对得上。 */
html[data-dm-theme="dark"] body.wxapp .col-work .ed-host {
  background: #1a1a1a !important;
  border: 1px solid #3a3a3a !important;
}
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror,
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror-gutters {
  background: #0a1124 !important;
}
/* 浅色：容器底对齐 cpp 实测的 rgb(242,246,255)，代码区回到纯白 */
html[data-dm-theme="light"] body.wxapp .col-work .ed-host {
  background: #f2f6ff !important;
}
html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror,
html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror-gutters {
  background: #ffffff !important;
}

/* ============ 3. 编辑标题行：对齐 .ed-head（42px / 13px 600） ============ */
body.wxapp .ed-label {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--wx-border);
}
body.wxapp .ed-lab-t {
  font-size: 13px;
  font-weight: 600;
  font-family: "Cascadia Code", "SF Mono", Consolas, monospace;
  letter-spacing: 0;
}
body.wxapp .ed-tools { gap: 6px; }

/* ============ 4. 小按钮 .sbtn（看提示 / 参考答案 / 重置代码） ============ */
body.wxapp .ed-tools .sbtn,
body.wxapp .ed-label .sbtn {
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
  background: var(--wx-panel-2);
  color: #b4bcca;
  border: 1px solid rgba(255, 255, 255, .1);
}
body.wxapp .ed-tools .sbtn:hover,
body.wxapp .ed-label .sbtn:hover {
  background: var(--wx-bg-2);
  color: var(--wx-text);
}
html[data-dm-theme="dark"] body.wxapp .ed-tools .sbtn,
html[data-dm-theme="dark"] body.wxapp .ed-label .sbtn {
  background: #121b2c;
  color: #b4bcca;
  border-color: rgba(255, 255, 255, .1);
}

/* ============ 5. 按钮条：运行 / 提交判分 与两门主课同尺寸同色 ============ */
body.wxapp .actions {
  gap: 8px;
  padding: 6px 12px;
  min-height: 46px;
}
body.wxapp .actions .abtn {
  height: 41px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  font-family: inherit;
  background: var(--wx-panel-2);
  color: var(--wx-text);
  border: 1px solid rgba(255, 255, 255, .12);
}
html[data-dm-theme="dark"] body.wxapp .actions .abtn {
  background: #121b2c;
  color: #f5f2ea;
  border-color: rgba(255, 255, 255, .12);
}
body.wxapp .actions .abtn:hover { border-color: rgba(255, 255, 255, .28); }

/* 提交判分：两门主课是 #07c160 绿底深字，这里取消原来的金→红渐变 */
body.wxapp .actions .abtn.primary,
html[data-dm-theme="dark"] body.wxapp .actions .abtn.primary {
  background: #07c160;
  color: #04122b;
  border: 1px solid transparent;
  font-weight: 700;
}
body.wxapp .actions .abtn.primary:hover { background: #06ad56; }
body.wxapp .actions .abtn:disabled { opacity: .5; }

/* 对比答案 / 执行回放：两门主课是小尺寸（32px）的次级按钮，跟着一起降级，
   免得一条按钮条上出现「两个胖的、两个瘦的」 */
body.wxapp .actions #pyDiff,
body.wxapp .actions #cppDiff,
body.wxapp .actions #pyReplay,
body.wxapp .actions #cppReplay {
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 400;
}

/* ============ 6. video 模式：让编辑区吃满整屏，别留半屏纯黑 ============ */
/* dm-mode.js 把 .teach-chat 隐藏后，.compose-band 仍被 wxchat.css 钉在
   clamp(300px,46vh,520px) + flex:0 0 auto —— 下面 54vh 全是空底。
   #composeBand 提权，压过 wxchat.css 与 dm-mode.js 的 !important。
   max-height 卡在「视口高 - 顶部导航」：三站的 .wrap 都是 height:100vh 而
   body 有 54px 上内边距，整页本来就多出 54px；这里不跟着再往下撑，
   否则最底下的「运行 / 提交判分」会被挤出首屏。 */
html[data-dm-mode="video"] body.wxapp #composeBand {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100dvh - var(--dm-nav-h, 54px)) !important;
}

/* 讲义区（.col-scroll）在 video 模式被放开成 flex:0 0 auto，自然高 759px
   会把同一列里的编辑器挤出容器（实测 .ed-host 只剩 2px）。改成「可滚 + 会收缩」。 */
html[data-dm-mode="video"] body.wxapp #composeBand .col-scroll {
  flex: 1 1 54% !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  /* 底部留白：滚动到底时最后一行文字不会被切掉半个字高 */
  padding-bottom: 14px !important;
}
/* 编辑器区给一条底线，任何高度下都不许再塌 */
html[data-dm-mode="video"] body.wxapp #composeBand .col-work {
  flex: 1 1 46% !important;
  min-height: 200px !important;
}
html[data-dm-mode="video"] body.wxapp #composeBand .col-work .ed-host {
  min-height: 150px;
}

/* ============ 7. 视频：preload="none" 之前先把 16:9 的位置占住 ============ */
body.wxapp .lesson-video video {
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: contain;
}

/* ============ 8. 栏内改「编辑器在上、控制台在下」 ============
   原来每栏是「编辑器 56% | 控制台 44%」并排，双语两栏一分，
   1366 下编辑器只有 266px 宽、1080 下只剩 186px ≈ 15 个字，代码根本写不了。
   而 python / cpp 的编辑器是占满整宽的（实测 538×130）。
   改成上下堆叠后，compare 的编辑器宽度变为整栏宽（503 / 360），
   与控制台仍在同一栏内，纵向比例也和主课一致。 */
body.wxapp .col-work {
  flex-direction: column !important;
  gap: 6px;
  padding: 2px 10px 6px;
}
body.wxapp .col-work .ed-host {
  flex: 1 1 auto !important;
  width: 100%;
  min-height: 0;
}
body.wxapp .col-out {
  flex: 0 0 auto !important;
}
body.wxapp .col-out .console {
  flex: 0 0 auto !important;
  /* 控制台压到 72px：编辑器和控制台同栏上下分，控制台每多 1px 编辑器就少 1px。
     python / cpp 在 1080×600 下编辑器是 378×110，这里要能对得上。 */
  height: 72px;
  min-height: 0;
}
body.wxapp .col-out .verdict { flex: none; }
/* 视频模式下整屏都是编辑带的，控制台可以给回 96px */
html[data-dm-mode="video"] body.wxapp #composeBand .col-out .console { height: 96px; }

/* 窄屏（≤1000px）：一屏一语言时同样别塌 */
@media (max-width: 1000px) {
  body.wxapp .compose-band { height: auto !important; flex: 1 1 auto !important; min-height: 0 !important; }
  body.wxapp .col-work { min-height: 220px; }
  html[data-dm-mode="video"] body.wxapp #composeBand .col-scroll { flex: 0 1 auto !important; max-height: 46% !important; }
}

/* ============ 9. 视口高度对齐（三站通病） ============
   body 有 padding-top: 54px（统一顶栏的让位），而 .wrap 是 height:100vh ——
   两者相加永远多出 54px，最底下那条「▶ 运行 / ✓ 提交判分」正好被推到首屏
   之外，学生必须先滚动才能提交。这里把 .wrap 收成「视口高 − 导航高」。
   同样的规则已同步加到 python / cpp 的 assets/css/theme-star.css，三课一致。 */
body.wxapp .wrap {
  height: calc(100dvh - var(--dm-nav-h, 54px)) !important;
}

/* 游客态的「免费体验」悬浮条（position:fixed / 46~52px / z-index 1600）会压住
   最底下的「▶ 运行 / ✓ 提交判分」。:has() 精准命中，登录用户没有这条，
   布局完全不变；不支持 :has() 的老浏览器自动忽略，退回原样。 */
body:has(#dmFreeBar) .wrap {
  height: calc(100dvh - var(--dm-nav-h, 54px) - 52px) !important;
}

/* ============ 10. 对照同步（sync.js） ============
   两个开关放在每栏标题行（.col-head）的最右边：图标 + 状态色，
   不额外占高度，两栏都有（窄屏切语言时也能点到）。
   ⇅ = 滚动同步   ⇄ = 代码同写 */
body.wxapp .col-head { position: relative; }
body.wxapp .col-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.wxapp .dm-sync-box {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
body.wxapp .dm-sync-btn {
  height: 26px;
  min-width: 26px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 7px;
  border: 1px solid var(--wx-border);
  background: var(--wx-panel);
  color: var(--wx-text-3);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
body.wxapp .dm-sync-btn:hover { background: var(--wx-bg-2); color: var(--wx-text); }
/* 开启态用主题强调色（深色金 / 浅色蓝），和下面的绿色「提交判分」区分开，
   不会被误认成按钮重复 */
body.wxapp .dm-sync-btn.on {
  color: #04122b;
  background: var(--dm-accent, #E8C27A);
  border-color: transparent;
  font-weight: 600;
}
body.wxapp .dm-sync-txt { display: none; }
@media (min-width: 1180px) {
  body.wxapp .dm-sync-txt { display: inline; }
}
html[data-dm-theme="light"] body.wxapp .dm-sync-btn {
  background: #ffffff;
  border-color: rgba(28, 37, 64, .16);
  color: #4d5b7c;
}
html[data-dm-theme="light"] body.wxapp .dm-sync-btn.on {
  background: #2560d8;
  border-color: transparent;
  color: #ffffff;
}
body.wxapp .dm-sync-ico { font-size: 13px; }
body.wxapp .dm-sync-btn[data-sync="scroll"] .dm-sync-ico { font-size: 15px; }

/* 「← 由 Python 自动对照」标记：贴在编辑标题行文件名之后 */
body.wxapp .dm-gen-badge {
  font-size: 11px;
  font-weight: 400;
  color: var(--wx-text-3);
  background: rgba(7, 193, 96, .12);
  border: 1px solid rgba(7, 193, 96, .30);
  border-radius: 5px;
  padding: 1px 6px;
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-dm-theme="light"] body.wxapp .dm-gen-badge {
  color: #15803d;
  background: rgba(21, 128, 61, .10);
  border-color: rgba(21, 128, 61, .28);
}

/* 开关状态提示（1.6 秒自动消失） */
body.wxapp .dm-sync-toast,
.dm-sync-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 8px);
  z-index: 1700;
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(12, 19, 32, .94);
  color: #f5f2ea;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid rgba(232, 194, 122, .28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.dm-sync-toast.show { opacity: 1; transform: translate(-50%, 0); }
html[data-dm-theme="light"] .dm-sync-toast {
  background: rgba(255, 255, 255, .98);
  color: #15203a;
  border-color: rgba(28, 37, 64, .14);
  box-shadow: 0 8px 24px rgba(21, 32, 58, .14);
}

/* 首次进入的一次性说明 */
body.wxapp .dm-sync-tip,
.dm-sync-tip {
  position: fixed;
  left: 50%;
  /* 抬到按钮条上方：底部「▶ 运行 / ✓ 提交判分」不能被这条提示盖住 */
  bottom: 92px;
  transform: translateX(-50%);
  /* 容器不吃鼠标事件，只有「知道了」按钮可点，压在什么上面都不挡操作 */
  pointer-events: none;
  z-index: 1700;
  max-width: min(680px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  border-radius: 12px;
  background: rgba(12, 19, 32, .97);
  color: #f5f2ea;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid rgba(232, 194, 122, .30);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  transition: opacity .24s, transform .24s;
}
.dm-sync-tip b { color: #E8C27A; flex: none; }
.dm-sync-tip span { color: #b4bcca; }
.dm-sync-tip i {
  font-style: normal;
  color: #E8C27A;
  padding: 0 2px;
}
.dm-sync-tip.out { opacity: 0; transform: translate(-50%, 10px); }
.dm-sync-tip-x {
  pointer-events: auto;
  flex: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: transparent;
  color: #f5f2ea;
  font-size: 12px;
  cursor: pointer;
}
.dm-sync-tip-x:hover { background: rgba(255, 255, 255, .08); }
html[data-dm-theme="light"] .dm-sync-tip {
  background: #ffffff;
  color: #15203a;
  border-color: rgba(28, 37, 64, .12);
  box-shadow: 0 12px 32px rgba(21, 32, 58, .16);
}
html[data-dm-theme="light"] .dm-sync-tip b { color: #1f4fd1; }
html[data-dm-theme="light"] .dm-sync-tip span { color: #3c4a66; }
html[data-dm-theme="light"] .dm-sync-tip i { color: #1f4fd1; }
html[data-dm-theme="light"] .dm-sync-tip-x {
  border-color: rgba(28, 37, 64, .18);
  color: #15203a;
}

/* 窄屏：标题行留给语言芯片和通关标记，开关缩到 24px 仍可点 */
@media (max-width: 640px) {
  body.wxapp .dm-sync-btn { width: 24px; height: 24px; }
  body.wxapp .dm-gen-badge { display: none; }
  .dm-sync-tip { flex-wrap: wrap; }
}

/* ---------- 10.1 讲义代码块：浅色主题下必须是浅底 ----------
   index.html 里 .content pre 写死 background:rgba(7,11,26,.5) + color:#bfe8ff，
   没有浅色分支。浅色主题下这层半透明黑压在白色上变成中灰，配浅蓝字只有 2:1 左右，
   注释（dmcode.js 的 .hl-com）几乎看不见。
   dmcode.js 本来就会按 pre 实际底色自动加 .on-light 换浅色高亮方案，
   只是被这个写死的深色底挡住了 —— 这里把底色改浅，.on-light 就会生效。 */
html[data-dm-theme="light"] body.wxapp .content pre {
  background: #f6f8fc !important;
  border-color: rgba(28, 37, 64, .14) !important;
  color: #16233d !important;
}
html[data-dm-theme="light"] body.wxapp .content pre code {
  color: #16233d !important;
  background: none !important;
}
/* .on-light 的注释色 #98a2b3 在白底上仍偏淡（约 2.4:1），
   这里是课程示例，注释本身就是讲解内容，压深到 5.6:1 */
html[data-dm-theme="light"] body.wxapp .content .dm-code {
  --hl-com: #5c6675;
}

/* ---------- 10.2 空编辑器占位提示（compare.js 的 attachPlaceholder） ----------
   🔴 不用 CodeMirror 自带 placeholder：这份 5.65 构建没实现渲染
   （getOption 有值、DOM 里不生成 .CodeMirror-placeholder）。
   这层只是个纯文本提示，pointer-events:none —— 点它等于点编辑器，打字从 1:1 开始。 */
body.wxapp .CodeMirror .dm-ph {
  position: absolute;
  top: 2px;
  right: 10px;
  pointer-events: none;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(245, 242, 234, .34);   /* 2.4:1 → 3.9:1：提示要能看清，又别像真代码 */
  z-index: 1;
}
html[data-dm-theme="light"] body.wxapp .CodeMirror .dm-ph {
  color: rgba(21, 32, 58, .42);
}
body.wxapp .CodeMirror .dm-ph[hidden] { display: none; }

/* ============ 11. 讲义区瘦身：能少滚一次就少滚一次 ============
   实测 1440×900 下 #pyScroll 可视 386px，内容 911px（溢出 525px ≈ 2.4 屏），
   学生每关要滚两三下才看得完。三处纯浪费：
     ① 提示框 114px —— dm-mode.js 的 `display:block !important` 压过了 [hidden]，
        明明 hidden 还在占位（而且提前把提示内容漏给学生了）；
     ② 视频 242px —— 在滚动容器里跟着讲义一起滚走，学生一滚就看不到；
     ③ 段落 / 卡片的外边距各多 2~4px，七八处叠起来就是几十像素。 */

/* ① 提示框：只有点「看提示」后才该出现（compare.js 里 hidden=true 时用） */
html[data-dm-mode="video"] body.wxapp .col-scroll .hint-box[hidden] {
  display: none !important;
}

/* ② 视频收成一条标题栏：默认折叠，点一下才展开播放 */
html[data-dm-mode="video"] body.wxapp .lesson-video.dm-vfold video { display: none !important; }
html[data-dm-mode="video"] body.wxapp .lesson-video.dm-vfold .vlabel {
  border-top: 0;
  padding: 7px 11px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
html[data-dm-mode="video"] body.wxapp .lesson-video.dm-vfold .vlabel::before {
  content: "▶ ";
  color: var(--dm-accent, #E8C27A);
}
html[data-dm-mode="light"] body.wxapp .lesson-video.dm-vfold .vlabel::before { color: #2560d8; }
html[data-dm-mode="video"] body.wxapp .lesson-video:not(.dm-vfold) .vlabel { cursor: pointer; }
/* 折叠态别留 10px 外边距，省一点是一点 */
html[data-dm-mode="video"] body.wxapp .lesson-video.dm-vfold { margin-bottom: 8px; }
html[data-dm-mode="video"] body.wxapp .lesson-video:not(.dm-vfold) { margin-bottom: 10px; }

/* ③ 讲义排版收紧：都在原值上减 2~4px，肉眼几乎看不出，累计能省 30~40px */
html[data-dm-mode="video"] body.wxapp .col-scroll .goal { margin-bottom: 6px; }
html[data-dm-mode="video"] body.wxapp .col-scroll .content p { margin: 0 0 6px; }
html[data-dm-mode="video"] body.wxapp .col-scroll .content p:last-child { margin-bottom: 0; }
html[data-dm-mode="video"] body.wxapp .col-scroll .content pre,
html[data-dm-mode="video"] body.wxapp .col-scroll .content .dm-code { margin: 6px 0; }
html[data-dm-mode="video"] body.wxapp .col-scroll .instr { margin-top: 8px; padding: 8px 11px; }
html[data-dm-mode="video"] body.wxapp .col-scroll .instr li { margin: 1px 0; }
html[data-dm-mode="video"] body.wxapp .col-scroll .wb { margin-top: 8px; padding-top: 7px; }
html[data-dm-mode="video"] body.wxapp .col-scroll .wb-grid { gap: 4px; }

/* ---------- 11.1 浅色主题下的讲义区配色 ----------
   index.html 里 .content 的正文色写死成 #d6e0ff（深色主题的浅紫白），
   .lesson-video / .instr 的底色写死成 rgba(7,11,26,.5)（深色半透明）。
   浅色主题下正文与白底只有 1.3:1，几乎读不出来 —— 这三处必须给浅色分支。 */
html[data-dm-theme="light"] body.wxapp .col-scroll .content {
  color: #26324d;
}
html[data-dm-theme="light"] body.wxapp .col-scroll .content strong { color: #12203a; }
html[data-dm-theme="light"] body.wxapp .col-scroll .lesson-video {
  background: #ffffff;
  border-color: rgba(28, 37, 64, .14);
}
html[data-dm-theme="light"] body.wxapp .col-scroll .lesson-video .vlabel {
  border-top-color: rgba(28, 37, 64, .1);
  color: #44526e;
}
html[data-dm-theme="light"] body.wxapp .col-scroll .instr {
  background: #f7f9fd;
  border-color: rgba(28, 37, 64, .14);
}
html[data-dm-theme="light"] body.wxapp .col-scroll .instr ol { color: #44526e; }
html[data-dm-theme="light"] body.wxapp .col-scroll .wb { border-top-color: rgba(28, 37, 64, .14); }
html[data-dm-theme="light"] body.wxapp .col-scroll .wc {
  background: #eef3fb;
  border-color: rgba(28, 37, 64, .14);
  color: #3b4863;
}

/* ============================================================
   12. 编辑器语法配色（深/浅各一套，按 data-dm-theme 显式给色）
   ------------------------------------------------------------
   为什么不用 CodeMirror 自带主题的配色：
     · material-darker 的注释只有 #545454，压在 #0a1124 上约 2.6:1，
       学生看不清；浅色主题漏进深色页面时更糟 —— print 是深紫 #330aa、
       777 是深绿 #164、括号纯黑，整段代码等于看不见（用户截图反馈）。
     · 这里按「页面当前主题」直接给色，与编辑器身上挂的是哪个 cm-s-*
       无关，漏主题也不会瞎。全部实测 WCAG 对比度（底色 #0a1124 / #fff）：
       深色：正文 15.9、注释 6.3、关键字 9.0、内置函数 13.0、数字 8.7、
             字符串 12.9、运算符 12.9、类型 12.6（都 ≥ 6:1）
       浅色：正文 16.2、注释 5.8、关键字 10.3、内置函数 8.4、数字 6.6、
             字符串 7.9、运算符 10.2、类型 7.1
   ============================================================ */
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror { color: #e6ecff; }

html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-comment,
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-comment * { color: #8496b8; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-keyword { color: #c9a2ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-builtin { color: #ffd166; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-def { color: #82b1ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-number { color: #ff8fa3; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-string,
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-string-2 { color: #9be89b; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-operator,
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-bracket,
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-punctuation { color: #cbd6ee; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-variable { color: #e6ecff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-variable-2 { color: #a9c4ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-variable-3,
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-type { color: #6fe3ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-property { color: #b9a2ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-atom { color: #ffd166; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-meta { color: #ffb86b; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-qualifier { color: #a9e34b; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-tag { color: #ff8fa3; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-attribute { color: #c9a2ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-link { color: #6fe3ff; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-header { color: #ffd166; font-weight: 700; }
html[data-dm-theme="dark"] body.wxapp .CodeMirror .cm-error { color: #fff; background: #c62828; }

html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror { color: #15203a; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-comment,
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-comment * { color: #5c6675; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-keyword { color: #7f0055; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-builtin { color: #0b4aa2; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-def { color: #0033a0; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-number { color: #0b6b3a; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-string { color: #1a3fd0; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-string-2 { color: #b3261e; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-operator,
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-bracket,
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-punctuation { color: #33415c; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-variable { color: #15203a; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-variable-2 { color: #1b4fd0; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-variable-3,
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-type { color: #00607a; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-property { color: #7f0055; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-atom { color: #7f0055; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-meta { color: #b3261e; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-qualifier { color: #6b4a00; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-tag { color: #b3261e; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-attribute { color: #7f0055; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-link { color: #00607a; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-header { color: #6b4a00; font-weight: 700; }
html[data-dm-theme="light"] body.wxapp .CodeMirror .cm-error { color: #fff; background: #b3261e; }

/* 光标 / 选区：深色下用品牌暖金，浅色下用蓝，任何主题都能一眼找到闪烁光标 */
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror .CodeMirror-cursor {
  border-left: 2px solid #ffd166;
}
html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror .CodeMirror-cursor {
  border-left: 2px solid #2560d8;
}
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror div.CodeMirror-selected,
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror-focused div.CodeMirror-selected {
  background: rgba(120, 160, 255, .26) !important;
}
html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror div.CodeMirror-selected,
html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror-focused div.CodeMirror-selected {
  background: rgba(37, 96, 216, .18) !important;
}
/* 行号：深色下原主题 #545454 几乎糊在底上，提到 6:1 以上 */
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror .CodeMirror-linenumber { color: #8b9ab8; }
html[data-dm-theme="dark"] body.wxapp .ed-host .CodeMirror .CodeMirror-gutters { border-right: 1px solid rgba(120,160,255,.14); }
html[data-dm-theme="light"] body.wxapp .ed-host .CodeMirror .CodeMirror-linenumber { color: #6b7a96; }
