/* ============================================================
   微信电脑版 UI 皮肤（双主题：浅色 / 深色）
   - 在官方 WeUI（res.wx.qq.com WeUI v1.1.3）与 style.css 之上定制
   - 全部配色走 CSS 变量：浅色为默认（:root），深色用 [data-theme="dark"]
   - 左侧 rail 始终保持微信深色；主区随主题切换，对比度均达 AA
   - 关卡页：最左导航栏 + 中间会话列表 + 主聊天区 + 右侧编辑器面板
   ============================================================ */

/* S28 · weui.min.css 下线（全站零 weui-* 类）：补回它实际生效的 UA 默认归零，
   与原 weui 的 *{margin:0;padding:0} 计算效果完全一致；类级规则按特异性照常覆盖。 */
* { margin: 0; padding: 0; }
a { text-decoration: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
a img, img { border: 0; }

/* ============ 浅色主题（默认） ============ */
:root {
  /* 全局 token（让 style.css 各组件自动跟随） */
  --bg: #ededed;
  --bg-2: #e3e3e3;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --panel-2: #f7f7f7;
  --border: #e7e7e7;
  --border-2: #d9d9d9;
  --text: #191919;
  --text-2: #5e5e5e;
  --text-3: #8a8a8a;
  --accent: #07c160;
  --accent-2: rgba(7, 193, 96, .12);
  --accent-text: #07c160;
  --ok: #07c160;
  --ok-bg: rgba(7, 193, 96, .12);
  --warn: #fa9d3b;
  --warn-bg: rgba(250, 157, 59, .14);
  --err: #fa5151;
  --err-bg: rgba(250, 81, 81, .12);
  --code-bg: #f5f5f5;
  --grad: #07c160;
  --grad-soft: rgba(7, 193, 96, .12);
  --shadow: 0 1px 8px rgba(0, 0, 0, .10);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .08);
  --glow: none;
  --r: 10px;

  /* 微信专属 token */
  --wx-bg: #ededed;
  --wx-bg-2: #e3e3e3;
  --wx-bg-3: #d6d6d6;
  /* 2026-11-05：浅色主题下这条栏不再是深色。工作台把三门课的切换
     合并进了这一列（有橘猫 logo 的这条），深色条压在浅色内容旁边太割裂，
     所以取与内容区相同的底色，只用一条 1px 细线分界。 */
  --wx-rail: #ededed;
  --wx-rail-icon: #5e5e5e;
  --wx-rail-icon-hover: #191919;
  --wx-rail-icon-active: #07c160;
  --wx-rail-hover-bg: rgba(0, 0, 0, .055);
  --wx-rail-line: #dcdcdc;
  --wx-rail-ring: rgba(0, 0, 0, .06);
  --wx-panel: #ffffff;
  --wx-panel-2: #f7f7f7;
  --wx-chat: #ededed;
  --wx-input: #ffffff;
  --wx-text: #191919;
  --wx-text-2: #5e5e5e;
  --wx-text-3: #8a8a8a;
  --wx-border: #e7e7e7;
  --wx-border-2: #d9d9d9;
  --wx-accent: #07c160;
  --wx-accent-d: #06ad56;
  --wx-accent-soft: rgba(7, 193, 96, .12);
  /* 选中会话 = 微信里「当前打开着的那条」：两套主题都只做灰阶（微信的会话列表选中项就是一块灰，
     不是品牌绿）。浅色 #ededed → #dcdcdc 压深；深色 #2e2e2e → #404040 抬起。 */
  --wx-sess-hover-bg: #e7e7e7;      /* 鼠标划过：比列表底 #ededed 略深一点点 */
  --wx-sess-active-bg: #dcdcdc;     /* 选中 = 微信会话列表那种「浅灰压深」，不是品牌绿 */
  --wx-sess-active-fg: #191919;
  --wx-sess-active-sub: #5e5e5e;
  --wx-bubble-me: #95ec69;
  --wx-bubble-me-text: #111111;
  --wx-bubble-you: #ffffff;
  --wx-bubble-you-text: #191919;
  --wx-bubble-border: #e7e7e7;
  --wx-note-bg: #fff7e6;
  --wx-note-border: #ffd591;
  --wx-note-text: #ad6800;
  --wx-demo-bg: #191919;
  --wx-demo-text: #e8e8e8;
  --wx-code-inline-bg: #f2f2f2;
  --wx-code-inline-text: #07c160;
  --wx-err: #fa5151;
  --wx-err-bg: rgba(250, 81, 81, .12);
  --wx-shadow: 0 1px 8px rgba(0, 0, 0, .10);
  --wx-shadow-sm: 0 1px 4px rgba(0, 0, 0, .08);
  --wx-modal-mask: rgba(0, 0, 0, .4);
  --wx-modal-card: #ffffff;
  --wx-modal-text: #191919;
  --wx-send-disabled: #b6e6c8;
  --wx-scroll: rgba(0, 0, 0, .18);
}

/* ============ 深色主题 ============ */
[data-theme="dark"] {
  --bg: #1f1f1f;
  --bg-2: #262626;
  --panel: #2a2a2a;
  --panel-solid: #2a2a2a;
  --panel-2: #242424;
  --border: #3a3a3a;
  --border-2: #444444;
  --text: #e8e8e8;
  --text-2: #b5b5b5;
  --text-3: #9a9a9a;
  --accent: #07c160;
  --accent-2: rgba(7, 193, 96, .20);
  --accent-text: #07c160;
  --ok: #07c160;
  --ok-bg: rgba(7, 193, 96, .18);
  --warn: #fa9d3b;
  --warn-bg: rgba(250, 157, 59, .18);
  --err: #ff6a6a;
  --err-bg: rgba(255, 106, 106, .16);
  --code-bg: #1a1a1a;
  --grad: #07c160;
  --grad-soft: rgba(7, 193, 96, .20);
  --shadow: 0 1px 10px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 5px rgba(0, 0, 0, .4);
  --glow: none;

  --wx-bg: #2e2e2e;
  --wx-bg-2: #373737;
  --wx-bg-3: #424242;
  --wx-rail: #2e2e2e;
  --wx-rail-icon: #8a8a8a;
  --wx-rail-icon-hover: #d4d4d4;
  --wx-rail-icon-active: #07c160;
  --wx-rail-hover-bg: rgba(255, 255, 255, .08);
  --wx-rail-line: rgba(255, 255, 255, .10);
  --wx-rail-ring: rgba(255, 255, 255, .14);
  --wx-panel: #2a2a2a;
  --wx-panel-2: #242424;
  --wx-chat: #1f1f1f;
  --wx-input: #1f1f1f;
  --wx-text: #e8e8e8;
  --wx-text-2: #b5b5b5;
  --wx-text-3: #9a9a9a;
  --wx-border: #3a3a3a;
  --wx-border-2: #444444;
  --wx-accent: #07c160;
  --wx-accent-d: #06ad56;
  --wx-accent-soft: rgba(7, 193, 96, .20);
  --wx-sess-hover-bg: #373737;      /* WeUI dark --weui-BG-COLOR-ACTIVE */
  --wx-sess-active-bg: #404040;
  --wx-sess-active-fg: #ffffff;
  --wx-sess-active-sub: rgba(255, 255, 255, .72);
  --wx-bubble-me: #2e9d57;
  --wx-bubble-me-text: #ffffff;
  --wx-bubble-you: #2c2c2c;
  --wx-bubble-you-text: #e8e8e8;
  --wx-bubble-border: #3a3a3a;
  --wx-note-bg: #3a2f17;
  --wx-note-border: #5c4a1f;
  --wx-note-text: #e0a44a;
  --wx-demo-bg: #0f0f0f;
  --wx-demo-text: #d8d8d8;
  --wx-code-inline-bg: #2c2c2c;
  --wx-code-inline-text: #4ed18a;
  --wx-err: #ff6a6a;
  --wx-err-bg: rgba(255, 106, 106, .16);
  --wx-shadow: 0 1px 10px rgba(0, 0, 0, .5);
  --wx-shadow-sm: 0 1px 5px rgba(0, 0, 0, .4);
  --wx-modal-mask: rgba(0, 0, 0, .6);
  --wx-modal-card: #2a2a2a;
  --wx-modal-text: #e8e8e8;
  --wx-send-disabled: #2a5a3c;
  --wx-scroll: rgba(255, 255, 255, .20);
}

/* 字体：微信用苹方 / 微软雅黑 */
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ===================== 关卡页：微信电脑版三栏布局 ===================== */
body:has(#viewLesson:not([hidden])) .sidebar { display: none !important; }
/* 关卡页去掉顶部栏，把空间让给内容区；导航（上一关/下一关）已并入聊天头部、主页/帮助在左侧 rail */
body:has(#viewLesson:not([hidden])) .topbar { display: none; }

.wx-rail-avatar {
  width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex: none;
  box-shadow: 0 0 0 1px var(--wx-rail-ring);
}
.wx-rail-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 左上角 LOGO 就是「回课程主页」入口（原房子图标已去掉） */
a.wx-rail-avatar { display: block; cursor: pointer; transition: box-shadow .15s; }
a.wx-rail-avatar:hover { box-shadow: 0 0 0 2px var(--wx-accent); }
.wx-rail-btn {
  width: 40px; height: 40px; border: none; background: transparent; border-radius: 9px;
  font-size: 20px; line-height: 1; cursor: pointer; color: var(--wx-rail-icon);
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.wx-rail-btn:hover { background: var(--wx-rail-hover-bg); color: var(--wx-rail-icon-hover); }
.wx-rail-btn.active { background: var(--wx-accent-soft); color: var(--wx-rail-icon-active); }
.wx-rail-spacer { flex: 1 1 auto; }

/* —— 中间会话列表（仿微信 PC 会话栏）—— */
#viewLesson .wx-sessions , #viewPlay .wx-sessions {
  flex: 0 0 300px; width: 300px; height: 100%;
  background: var(--wx-bg); border-right: 1px solid var(--wx-border-2);
  display: flex; flex-direction: column; min-width: 0; flex: none;
}
.wx-sess-search { padding: 9px 12px; background: var(--wx-bg); }
.wx-sess-search input {
  width: 100%; box-sizing: border-box; border: none; border-radius: 6px;
  padding: 7px 10px; font-size: 13px; background: #e3e3e3; color: var(--wx-text); outline: none;
}
[data-theme="dark"] .wx-sess-search input { background: #3a3a3a; }
.wx-sess-search input::placeholder { color: var(--wx-text-3); }
.wx-sess-list { flex: 1 1 auto; overflow-y: auto; padding: 0 0 10px; }
.wx-sess {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--wx-border-2);
}
.wx-sess:hover { background: var(--wx-sess-hover-bg); }
/* 选中会话：等同于微信里「当前正在看的那个会话」——只把整行底色压深/抬起一档，
   文字保持原色，头像方牌也不变样（和微信一致）。 */
.wx-sess.active { background: var(--wx-sess-active-bg); }
.wx-sess.active .wx-sess-name { color: var(--wx-sess-active-fg); }
.wx-sess.active .wx-sess-msg,
.wx-sess.active .wx-sess-ch,
.wx-sess.active .wx-sess-time { color: var(--wx-sess-active-sub); }
.wx-sess.active .wx-sess-av { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }

/* S41：可见会话列表首项「0-0 课程说明」—— 暖金，和普通关卡（灰底）区分开 */
.wx-sess.wx-sess-intro .wx-sess-av { background: rgba(255,198,92,.18); }
.wx-sess.wx-sess-intro .intro-idx { color: #a85b08; font-size: 12px; font-weight: 800; }
.wx-sess.wx-sess-intro .wx-sess-name { color: #a85b08; font-weight: 650; }
.wx-sess.wx-sess-intro.active { background: rgba(255,198,92,.14); }
.wx-sess.wx-sess-intro.active .wx-sess-name { color: #a85b08; }
[data-theme="dark"] .wx-sess.wx-sess-intro .wx-sess-av { background: rgba(255,198,92,.16); }
[data-theme="dark"] .wx-sess.wx-sess-intro .intro-idx,
[data-theme="dark"] .wx-sess.wx-sess-intro .wx-sess-name { color: #ffc65c; }
[data-theme="dark"] .wx-sess.wx-sess-intro.active .wx-sess-name { color: #ffc65c; }
.wx-sess-av {
  width: 40px; height: 40px; border-radius: 7px; flex: none;
  background: var(--wx-accent); display: grid; place-items: center;
  position: relative;            /* 未读红点挂在右上角，不能被子元素裁掉 */
}
.wx-sess-av img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
/* ---------- 会话头像：改成关卡号铭牌（1-1 / 1-2 一类的方牌） ----------
   原来每行都是同一只橘猫，重复且没有信息量；直接印关卡号，
   做成带高光 / 内阴影 / 细描边的小金属牌质感，40px 方框不换。 */
.wx-sess-idx {
  width: 100%; height: 100%; box-sizing: border-box;
  display: grid; place-items: center;
  border-radius: 10px;
  font: 800 12.5px/1 ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  letter-spacing: -.4px;
  color: #2b3446;
  background: #e3e8f0;          /* 扁平：纯色，无渐变 / 无投影 / 无高光 */
  user-select: none;
}
.wx-sess-idx-play { font-size: 17px; letter-spacing: 0; text-shadow: none; }
/* 选中时方牌保持原样：只换整行的底色，头像不变（微信里选中会话头像也不变样） */
[data-theme="dark"] .wx-sess-idx {
  color: #ecf1fa;
  background: #4a505c;          /* 扁平：纯色，无渐变 / 无投影 */
}

.wx-sess-av .emoji { font-size: 20px; }
.wx-sess-body { flex: 1 1 auto; min-width: 0; }
.wx-sess-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wx-sess-name {
  font-size: 14px; font-weight: 600; color: var(--wx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wx-sess-time { font-size: 11px; color: var(--wx-text-3); flex: none; }
.wx-sess-ch {
  font-size: 11px; color: var(--wx-accent); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wx-sess-msg {
  font-size: 12.5px; color: var(--wx-text-3); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-top: 2px;
}

/* —— 主区：聊天/内容在上，编辑器输入区在下（仿微信输入框）—— */
#viewLesson .pane-left , #viewPlay .pane-left {
  flex: 1 1 auto; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; background: var(--wx-chat);
}
#viewLesson .pane-scroll , #viewPlay .pane-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#viewLesson .wx-compose , #viewPlay .wx-compose { flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0; }

/* —— 融合关：隐藏旧内容，聊天占主区（头固定 / 消息滚动），编辑器在下方 —— */
.fusion-chat #viewLesson .pane-scroll , #viewPlay .pane-scroll { display: none; }
.fusion-chat #viewLesson .teach-chat , #viewPlay .teach-chat {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
}
.fusion-chat #viewLesson .tc-stream , #viewPlay .tc-stream { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* ===================== 聊天气泡 / 发送条（微信风） ===================== */
#viewLesson .tc-head , #viewPlay .tc-head {
  background: var(--wx-panel); border-bottom: 1px solid var(--wx-border); border-radius: 0;
  padding: 11px 16px; display: flex; align-items: center; gap: 12px; flex: none;
}
#viewLesson .tc-name , #viewPlay .tc-name { color: var(--wx-text); font-size: 15px; }
#viewLesson .tc-name #tcLesson , #viewPlay .tc-name #tcLesson { color: var(--wx-text-2); font-weight: 500; font-size: 13px; }
#viewLesson .tc-sub , #viewPlay .tc-sub { color: var(--wx-text-3); font-size: 12px; margin-top: 1px; }
#viewLesson .tc-avatar , #viewPlay .tc-avatar { background: var(--wx-accent); box-shadow: none; }
#viewLesson .tc-prog , #viewPlay .tc-prog { color: var(--wx-accent); font-size: 12.5px; font-weight: 700; text-align: center; }
/* 聊天头部右侧：上一关 / 下一关 / 重来 */
#viewLesson .tc-head-actions , #viewPlay .tc-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#viewLesson .tc-nav , #viewPlay .tc-nav {
  min-width: 34px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--wx-border); background: var(--wx-panel-2); color: var(--wx-text);
  font-size: 15px; line-height: 1; cursor: pointer; transition: background .15s, opacity .15s;
}
#viewLesson .tc-nav:hover { background: var(--wx-bg-2); }
#viewLesson .tc-nav:disabled { opacity: .4; cursor: default; }
#viewLesson .tc-restart , #viewPlay .tc-restart {
  background: var(--wx-panel); color: var(--wx-accent);
  border: 1px solid var(--wx-accent); box-shadow: none;
  height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
#viewLesson .tc-restart:hover { background: var(--wx-accent-soft); }

#viewLesson .tc-stream , #viewPlay .tc-stream { background: var(--wx-chat); color: var(--wx-text); padding: 18px 16px; }
#viewLesson .tc-bubble , #viewPlay .tc-bubble {
  position: relative;
  background: var(--wx-bubble-you); color: var(--wx-bubble-you-text);
  border: 1px solid var(--wx-bubble-border); border-radius: 4px;
  box-shadow: var(--wx-shadow-sm);
}
#viewLesson .tc-bubble code {
  background: var(--wx-code-inline-bg); color: var(--wx-code-inline-text);
  padding: 1px 6px; border-radius: 6px; font-family: ui-monospace, monospace;
}
/* 老师头像气泡左上小尖角（仿微信） */
#viewLesson .tc-msg.tutor .tc-bubble , #viewPlay .tc-msg.tutor .tc-bubble { border-top-left-radius: 3px; }
/* 老师气泡：左侧小尾巴（描边 + 填充两层） */
#viewLesson .tc-msg.tutor .tc-bubble::before {
  content: ""; position: absolute; top: 9px; left: -7px;
  width: 0; height: 0; border: 7px solid transparent;
  border-right-color: var(--wx-bubble-border);
}
#viewLesson .tc-msg.tutor .tc-bubble::after {
  content: ""; position: absolute; top: 10px; left: -5px;
  width: 0; height: 0; border: 6px solid transparent;
  border-right-color: var(--wx-bubble-you);
}
#viewLesson .tc-msg.tc-user , #viewPlay .tc-msg.tc-user { max-width: 92%; align-self: flex-end; }
#viewLesson .tc-msg.tc-user .tc-bubble , #viewPlay .tc-msg.tc-user .tc-bubble {
  background: var(--wx-bubble-me); color: var(--wx-bubble-me-text);
  border: none; border-top-right-radius: 3px;
}
/* 学生气泡：右侧小尾巴 */
#viewLesson .tc-msg.tc-user .tc-bubble::before {
  content: ""; position: absolute; top: 9px; right: -6px;
  width: 0; height: 0; border: 7px solid transparent;
  border-left-color: var(--wx-bubble-me);
}
#viewLesson .tc-note , #viewPlay .tc-note {
  background: var(--wx-note-bg); border: 1px dashed var(--wx-note-border); color: var(--wx-note-text);
}
#viewLesson .tc-demo pre { background: var(--wx-demo-bg); color: var(--wx-demo-text); }
#viewLesson .tc-lbl , #viewPlay .tc-lbl { color: var(--wx-accent); }
#viewLesson .tc-hint , #viewPlay .tc-hint { color: var(--wx-text-3); }

/* 发送条：2026-11-23 起「发送」已合并进「运行 · 判分」，整条常驻隐藏。
   保留 DOM 只为 teachEngine 的 disabled / 文案钩子，不再占据底栏位置。 */
#viewLesson .tc-sendbar , #viewPlay .tc-sendbar ,
.fusion-chat #viewLesson .tc-sendbar , .fusion-chat #viewPlay .tc-sendbar { display: none !important; }
/* 底部灰色提示条去掉（信息已合并进「发送批改」按钮与聊天引导），让内容区更大 */
#viewLesson .tc-sendhint , #viewPlay .tc-sendhint { display: none; }
#viewLevel .tc-sendbtn,
#viewLesson .tc-sendbtn , #viewPlay .tc-sendbtn {
  background: var(--wx-accent); color: #ffffff; font-weight: 600; box-shadow: none; border: none;
  border-radius: 8px; padding: 9px 16px; font-size: 13.5px; cursor: pointer;
}
#viewLesson .tc-sendbtn:hover { filter: none; background: var(--wx-accent-d); }
#viewLesson .tc-sendbtn:disabled { background: var(--wx-send-disabled); cursor: default; }
#viewLesson .tc-sendbar.on .tc-sendhint , #viewPlay .tc-sendbar.on .tc-sendhint { color: var(--wx-accent); }

/* ===================== 编辑器输入区（仿微信输入框，置于聊天/内容下方） ===================== */
#viewLesson .wx-compose , #viewPlay .wx-compose {
  background: var(--wx-panel); border-top: 1px solid var(--wx-border-2);
  padding: 8px 12px 10px;
}
#viewLesson .wx-compose .ed-head , #viewPlay .wx-compose .ed-head {
  background: transparent; border-bottom: none; padding: 0 0 4px;
  display: flex; align-items: center; gap: 8px;
}
#viewLesson .wx-compose .ed-title , #viewPlay .wx-compose .ed-title { font-size: 13px; font-weight: 600; color: var(--wx-text-2); }
#viewLesson .wx-compose .ed-btns , #viewPlay .wx-compose .ed-btns { display: flex; gap: 5px; }
#viewLesson .wx-compose .sbtn , #viewPlay .wx-compose .sbtn { padding: 4px 8px; }
/* S45 2026-11-17：符号助手行默认收起（减一行，把高度让给代码编辑区），
   点底栏「⌘ 符号助手」(app.js toggle .wx-compose.sym-open) 才展开 */
#viewLesson .wx-compose .symbar , #viewPlay .wx-compose .symbar {
  background: transparent; border-bottom: none; border-top: 1px solid var(--wx-border);
  padding: 4px 0; overflow-x: auto; flex-wrap: nowrap;
  display: none;
}
#viewLesson .wx-compose.sym-open .symbar , #viewPlay .wx-compose.sym-open .symbar {
  display: flex;
}
#viewLesson .wx-compose .ed-body.comp-code , #viewPlay .wx-compose .ed-body.comp-code {
  height: clamp(120px, 21vh, 260px); margin: 4px 0;
  border: 1px solid var(--wx-border); border-radius: 8px; overflow: hidden; background: var(--code-bg);
}
#viewLesson .wx-compose .ed-body.comp-code .CodeMirror , #viewPlay .wx-compose .ed-body.comp-code .CodeMirror { height: 100%; }
#viewLesson .wx-compose .ed-actions , #viewPlay .wx-compose .ed-actions {
  background: transparent; border-top: none; display: flex; align-items: center; gap: 8px;
  padding: 2px 0; flex-wrap: wrap;
}
/* ===================== 主区网格：rail | sessions | main（main 内含 聊天/内容 + 底部编辑输出分屏） ===================== */
#viewLesson .split , #viewPlay .split {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  /* S46 2026-11-18：grid 行 1fr→minmax(0,1fr)。grid 里 1fr 的最小值是 auto，
     内容一多就把行撑破、把底部 .compose-band 顶出视口；minmax(0,1fr) 让行严格
     不超过可用高度，band 稳稳落在栏底（运行/发送 可见）。 */
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "sessions main";
  height: 100%;
}
#viewLesson .wx-sessions , #viewPlay .wx-sessions { grid-area: sessions; min-height: 0; }
#viewLesson .pane-left , #viewPlay .pane-left { grid-area: main; min-height: 0; max-height: none; border-right: none; }

/* 底部编辑/输出分屏：编辑器(左) + 控制台(右) 左右并排；绝不浮动、绝不遮挡 */
#viewLesson .compose-band , #viewPlay .compose-band {
  flex: 0 0 auto;
  display: flex; flex-direction: row;
  min-height: 0;
  /* S46 2026-11-18：band 高度调矮（原 clamp(240,42vh,440) 在矮视口把底部按钮行顶出首屏）。
     调矮后与缩小后的视频一起让出空间，保证顶部聊天头栏(tc-head)和底部运行/发送栏同时可见。 */
  height: clamp(190px, 36vh, 340px);
  background: var(--wx-panel);
  border-top: 1px solid var(--wx-border-2);
}
/* 左：编辑器（覆盖默认 flex:0 0 auto，改为在分屏内纵向填满） */
#viewLesson .compose-band .wx-compose , #viewPlay .compose-band .wx-compose {
  flex: 1 1 56%; min-width: 0;
  border-right: 1px solid var(--wx-border);
}
#viewLesson .compose-band .wx-compose .ed-body.comp-code , #viewPlay .compose-band .wx-compose .ed-body.comp-code {
  flex: 1 1 auto; height: auto; min-height: 0; margin: 6px 0;
}
/* 右：控制台输出 */
#viewLesson .compose-band .console-dock , #viewPlay .compose-band .console-dock {
  grid-area: auto;
  flex: 1 1 44%; min-width: 300px;
  position: static; left: auto; right: auto; top: auto; bottom: auto; z-index: auto;
  width: auto; max-width: none; height: auto; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--wx-panel); color: var(--wx-text);
  border: none; border-left: 1px solid var(--wx-border);
  border-radius: 0; box-shadow: none; overflow: hidden;
}
#viewLesson .compose-band .console-dock .cd-head , #viewPlay .compose-band .console-dock .cd-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; cursor: default; user-select: none;
  background: var(--wx-panel-2); border-bottom: 1px solid var(--wx-border);
}
#viewLesson .compose-band .console-dock .cd-grip , #viewPlay .compose-band .console-dock .cd-grip { display: none; }
#viewLesson .compose-band .console-dock .cd-dot , #viewPlay .compose-band .console-dock .cd-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--wx-text-3); box-shadow: 0 0 0 3px rgba(0, 0, 0, .04);
  transition: background .2s, box-shadow .2s;
}
#viewLesson .compose-band .console-dock .cd-dot.run , #viewPlay .compose-band .console-dock .cd-dot.run { background: var(--wx-accent); box-shadow: 0 0 0 3px var(--wx-accent-soft); }
#viewLesson .compose-band .console-dock .cd-dot.err , #viewPlay .compose-band .console-dock .cd-dot.err { background: var(--wx-err); box-shadow: 0 0 0 3px var(--wx-err-bg); }
#viewLesson .compose-band .console-dock .cd-title , #viewPlay .compose-band .console-dock .cd-title { font-size: 13px; font-weight: 600; color: var(--wx-text); }
#viewLesson .compose-band .console-dock .cd-status , #viewPlay .compose-band .console-dock .cd-status { font-size: 11px; color: var(--wx-text-3); white-space: nowrap; }
#viewLesson .compose-band .console-dock .cd-spacer , #viewPlay .compose-band .console-dock .cd-spacer { flex: 1 1 auto; }
#viewLesson .compose-band .console-dock .mini , #viewPlay .compose-band .console-dock .mini {
  height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; cursor: pointer;
  background: var(--wx-panel); color: var(--wx-text-2); border: 1px solid var(--wx-border);
}
#viewLesson .compose-band .console-dock .mini:hover { background: var(--wx-bg-2); }
/* 2026-11-23：「复制」按钮去掉外框，做成纯文字工具钮 */
#btnCopy { border: none !important; background: transparent !important; padding-left: 6px; padding-right: 6px; }
#btnCopy:hover { background: var(--wx-bg-2) !important; }
/* 2026-11-23：状态徽章着色 + 移到关卡编号（1-1）正下方。
   头像列改竖排：上=编号铭牌 40×40，下=紧凑徽章。 */
.wx-sess-state.done { background: var(--ok-bg); color: #07994c; }
.wx-sess-state.lock { background: var(--wx-bg-2); color: var(--wx-text-3); }
[data-theme="dark"] .wx-sess-state.done { background: rgba(7, 193, 96, .22); color: #57d996; }
[data-theme="dark"] .wx-sess-state.lock { background: rgba(255, 255, 255, .08); color: var(--wx-text-3); }
.wx-sess-av {
  height: auto; align-self: flex-start; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
}
.wx-sess-av .wx-sess-idx { width: 40px; height: 40px; flex: none; }
.wx-sess-av .wx-sess-state {
  display: inline-block; white-space: nowrap; font-size: 9px; line-height: 1.25;
  padding: 1px 4px; border-radius: 4px; font-weight: 600;
}
.wx-tool-row button {
  border: none; background: transparent; color: var(--wx-text-3);
  font-size: 12px; line-height: 1; padding: 5px 8px; border-radius: 5px;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.wx-tool-row button:hover { background: var(--wx-bg-2); color: var(--wx-text); }
.wx-tool-row button:active { transform: translateY(1px); }
/* 窄屏：字更小、间距更紧，保证三个按钮 + 发送都不换行 */
@media (max-width: 560px) {
  .wx-tool-row { gap: 0; margin-left: 0; }
  .wx-tool-row button { font-size: 11px; padding: 5px 5px; }
}

/* ============================================================
   2026-11-05 · 手机端（≤900px）：主框架修复 + 可点区放大
   ------------------------------------------------------------
   ① 主框架原来是固定三列 60px + 300px + 1fr：390px 手机上
      主区只剩 30px，编辑器和聊天被压成一条竖线，整课没法用。
      这里改成「56px 竖栏 + 主区」，会话列表收进左侧抽屉，
      由竖栏里新增的「关卡」按钮开合（桌面端完全不变）。
   ② 可点区：实测符号按钮高 25px、底部工具条 21px、控制台
      「复制/清空」24px，手指点下去常点错邻居，统一抬到 32px 起。
   ============================================================ */
.wx-sess-scrim { display: none; }

/* 「⌘ 符号助手」按钮：原来是浏览器默认样式（18×22 的灰块） */
.wx-tool {
  border: none; background: transparent; border-radius: 7px;
  color: var(--wx-text-3); font-family: inherit; font-size: 14px; line-height: 1;
  padding: 4px 7px; cursor: pointer;
}
.wx-tool:hover { background: var(--wx-bg-2); color: var(--wx-text); }
.wx-tool:active { transform: translateY(1px); }

@media (max-width: 900px) {
  /* —— 主框架：主区单列（会话列表收进左侧抽屉） —— */
  #viewLesson .split, #viewPlay .split {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "main";
  }
  #viewLesson .pane-left, #viewPlay .pane-left { grid-area: main; }

  /* —— 会话列表 → 左侧抽屉 —— */
  #viewLesson .wx-sessions, #viewPlay .wx-sessions {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
    width: min(80vw, 330px); height: auto;
    transform: translateX(-130%);
    transition: transform .22s cubic-bezier(.22, .61, .36, 1);
    box-shadow: 16px 0 40px rgba(15, 23, 42, .16);
    border-right: 1px solid var(--wx-border-2);
  }
  #viewLesson .wx-sessions.open, #viewPlay .wx-sessions.open { transform: none; }
  .wx-sess-scrim {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(15, 23, 42, .34); opacity: 0; pointer-events: none;
    transition: opacity .2s;
  }
  .wx-sess-scrim.on { opacity: 1; pointer-events: auto; }

  /* 会话行更高，手指不容易点串行 */
  .wx-sess { padding: 13px 14px; }
  .wx-sess-search { padding: 10px 12px; }
  .wx-sess-search input { padding: 9px 11px; font-size: 14px; }

  /* —— 可点区：32px 起步 —— */
  .sym { min-height: 34px; min-width: 34px; padding: 7px 11px; font-size: 14px; }
  #viewLesson .wx-compose .symbar, #viewPlay .wx-compose .symbar { gap: 8px; padding: 8px 10px; }
  #viewLesson .compose-band .console-dock .mini, #viewPlay .compose-band .console-dock .mini {
    height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px;
  }
  .wx-tool {
    width: 34px; height: 34px; padding: 0;
    display: grid; place-items: center; font-size: 16px;
  }
  .wx-tool-row { gap: 3px; }
  .wx-tool-row button {
    min-height: 34px; display: inline-flex; align-items: center;
    padding: 0 7px; font-size: 11.5px;
  }
}

/* 编辑区 + 控制台：334px 宽并排放不下（控制台 min-width:300 会把编辑器挤成 34px 一条缝），
   手机上改成上下：编辑器在上、控制台固定 96~150px。 */
@media (max-width: 900px) {
  #viewLesson .compose-band, #viewPlay .compose-band {
    flex-direction: column;
    /* S66：原 height:clamp(300,50vh,460) 已被下方更具体的 #viewLesson 规则
       clamp(300,56vh,520) 永久覆盖（实测 800px 视口取 520），故剔除。 */
  }
  #viewLesson .compose-band .wx-compose, #viewPlay .compose-band .wx-compose {
    flex: 1 1 auto; min-height: 0; border-right: none;
    border-bottom: 1px solid var(--wx-border-2);
  }
  #viewLesson .compose-band .console-dock, #viewPlay .compose-band .console-dock {
    flex: 0 0 auto; min-width: 0; width: auto;
    height: clamp(96px, 20vh, 150px);
    border-left: none; border-top: 1px solid var(--wx-border-2);
  }
}

@media (max-width: 900px) {
  /* 🔴 .sym-tip「符号助手」在 nowrap 的符号栏里会被压成一列竖字（实测 78px 高），
     整条符号栏因此涨到 95px、把编辑器挤成 2px。必须锁死不收缩。 */
  #viewLesson .wx-compose .sym-tip, #viewPlay .wx-compose .sym-tip {
    flex: 0 0 auto; white-space: nowrap;
  }
  /* 底部按钮条：运行 / 提交判分 压成一整行，工具条落在第二行 */
  #viewLesson .wx-compose .ed-actions, #viewPlay .wx-compose .ed-actions {
    gap: 8px; padding: 6px 0 4px;
  }
  #viewLesson .wx-compose .ed-actions .btn, #viewPlay .wx-compose .ed-actions .btn {
    flex: 1 1 auto; padding: 8px 10px; font-size: 12.5px;
  }
  /* 编辑区拿回高度：分屏再高一点，控制台窄一点 */
  #viewLesson .compose-band, #viewPlay .compose-band { height: clamp(300px, 56vh, 520px); }
  #viewLesson .compose-band .console-dock, #viewPlay .compose-band .console-dock {
    height: clamp(96px, 15vh, 130px);
  }
}

/* 「⌘ + 三个工具按钮」容器：原来没有样式，div 是块级，⌘ 会独占一行 */
.wx-input-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }

@media (max-width: 900px) {
  /* 聊天头：课名缩成单行省略，别一字一行竖着排 */
  #viewLesson .tc-head, #viewPlay .tc-head { padding: 8px 10px; gap: 8px; }
  #viewLesson .tc-name, #viewPlay .tc-name {
    flex: 1 1 auto; min-width: 0; font-size: 12.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #viewLesson .tc-name #tcLesson, #viewPlay .tc-name #tcLesson { font-size: 12px; }
  #viewLesson .tc-prog, #viewPlay .tc-prog { flex: 0 0 auto; font-size: 11.5px; }
  #viewLesson .tc-head-actions, #viewPlay .tc-head-actions { flex: 0 0 auto; gap: 4px; }
  .tc-nav, .tc-restart { height: 32px; min-width: 32px; padding: 0 8px; font-size: 12px; }

  /* 编辑器标题行：main.py + 三颗按钮压在一行 */
  #viewLesson .wx-compose .ed-head, #viewPlay .wx-compose .ed-head {
    flex-wrap: nowrap; gap: 6px; padding: 2px 0 6px;
  }
  .ed-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #viewLesson .wx-compose .ed-head .sbtn, #viewPlay .wx-compose .ed-head .sbtn {
    padding: 5px 7px; font-size: 11.5px; white-space: nowrap;
  }

  /* 按钮条：第一行「运行」，第二行「⌘ + 重置代码 对比答案 执行回放 + 发送」 */
  #viewLesson .wx-compose .ed-actions, #viewPlay .wx-compose .ed-actions {
    gap: 6px; padding: 6px 0 4px; flex-wrap: wrap;
  }
  #viewLesson .wx-compose .ed-actions .wx-input-tools, #viewPlay .wx-compose .ed-actions .wx-input-tools {
    flex: 1 1 auto; flex-wrap: nowrap; gap: 4px;
  }
  #viewLesson .wx-compose .ed-actions .wx-tool-row,
  #viewPlay .wx-compose .ed-actions .wx-tool-row { flex-wrap: nowrap; }
  #viewLesson .tc-sendbar, #viewPlay .tc-sendbar { margin-left: 0; flex: 0 0 auto; }
}

@media (max-width: 900px) {
  /* C++ 的符号栏里还套了「符号 / 函数」两行（.sym-row），每行自己会换行 → 涨到 187px。
     手机上一行改成横向滑动，不再往下堆。 */
  #viewLesson .wx-compose .sym-row, #viewPlay .wx-compose .sym-row {
    display: flex; align-items: center;
    flex-wrap: nowrap; overflow-x: auto; gap: 8px;
    -webkit-overflow-scrolling: touch;
  }
  #viewLesson .wx-compose .symbar, #viewPlay .wx-compose .symbar,
  #viewLesson .wx-compose .sym-row, #viewPlay .wx-compose .sym-row {
    scrollbar-width: none;
  }
  #viewLesson .wx-compose .sym-row::-webkit-scrollbar, #viewPlay .wx-compose .sym-row::-webkit-scrollbar,
  #viewLesson .wx-compose .symbar::-webkit-scrollbar, #viewPlay .wx-compose .symbar::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 900px) {
  /* 按钮条排布：第一行「▶ 运行 + 发送」，第二行「⌘ + 重置/对比/回放」。
     原来 ⌘ 与工具条挤在 运行 后面，发送被顶到第三行。 */
  #viewLesson .wx-compose .ed-actions .wx-input-tools,
  #viewPlay .wx-compose .ed-actions .wx-input-tools { flex: 1 1 100%; order: 2; }
  #viewLesson .wx-compose .ed-actions .tc-sendbar,
  #viewPlay .wx-compose .ed-actions .tc-sendbar { order: 1; margin-left: 0; }
  #viewLesson .wx-compose .ed-actions .tc-sendbtn,
  #viewPlay .wx-compose .ed-actions .tc-sendbtn { min-height: 36px; padding: 0 14px; font-size: 13px; }
  .wx-tool-row button { font-size: 11px; padding: 0 6px; }
}

@media (max-width: 900px) {
  /* 标题行右侧现在有 5 颗按钮（看提示/参考答案/重置代码 + app.js 注入的对比答案/回放），
     换行会占掉两行；手机改成一条横向滑动的单行，省下的高度还给编辑器。 */
  #viewLesson .wx-compose .ed-btns, #viewPlay .wx-compose .ed-btns {
    flex-wrap: nowrap; overflow-x: auto; justify-content: flex-end;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #viewLesson .wx-compose .ed-btns::-webkit-scrollbar,
  #viewPlay .wx-compose .ed-btns::-webkit-scrollbar { display: none; }
  #viewLesson .wx-compose .ed-btns .sbtn, #viewPlay .wx-compose .ed-btns .sbtn { flex: 0 0 auto; }
}

@media (max-width: 900px) {
  /* 标题行的 5 颗按钮（.sbtn / app.js 注入的 .iz-sbtn）也抬到 30px */
  #viewLesson .wx-compose .ed-head .sbtn, #viewPlay .wx-compose .ed-head .sbtn {
    min-height: 30px; display: inline-flex; align-items: center;
  }
}


/* ================================================================
   2026-11-06 修：桌面下编辑器被挤成 2px + 课程目录欢迎态半渲染
   ----------------------------------------------------------------
   原来「.sym-tip 不换行 / 符号栏单行 / 按钮条单行 / 编辑区拿回高度」
   这些规则只写在 @media(max-width:900px) 里，桌面 1064px 完全不生效：
   符号栏里的「符号助手」被压成 4 个竖排字(91px)、底部按钮条折成两行(137px)，
   302px 的 compose-band 被吃光 → #normalEditor 只剩 2px，学生写不了代码。
   另外 body.course-home（课程目录欢迎态）没有任何 CSS，导致欢迎卡片、
   「标题 / 目标」占位符、空编辑器、空控制台全部堆在同一屏。
   这里统一提到全局生效，窄屏媒体查询里的同款规则仍可继续覆盖细节。
   ================================================================ */

/* —— 1) 符号栏：单行横滑，标签不许被压成竖字 —— */
#viewLesson .wx-compose .symbar,
#viewPlay .wx-compose .symbar {
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
#viewLesson .wx-compose .symbar::-webkit-scrollbar,
#viewPlay .wx-compose .symbar::-webkit-scrollbar { display: none; }
#viewLesson .wx-compose .sym-tip,
#viewPlay .wx-compose .sym-tip { flex: 0 0 auto; white-space: nowrap; }
#viewLesson .wx-compose .symbar .sym,
#viewPlay .wx-compose .symbar .sym { flex: 0 0 auto; }
/* C++ 站符号栏外面还套了一层 .sym-row，整体也不能收缩换行 */
#viewLesson .wx-compose .sym-row,
#viewPlay .wx-compose .sym-row {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; flex: 0 0 auto;
}

/* —— 2) 底部按钮条：单行横滑，⌘ 工具组不再独占一行 —— */
#viewLesson .wx-compose .ed-actions,
#viewPlay .wx-compose .ed-actions {
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; align-items: center;
}
#viewLesson .wx-compose .ed-actions::-webkit-scrollbar,
#viewPlay .wx-compose .ed-actions::-webkit-scrollbar { display: none; }
#viewLesson .wx-compose .ed-actions > *,
#viewPlay .wx-compose .ed-actions > * { flex: 0 0 auto; }
#viewLesson .wx-compose .ed-actions .btn,
#viewPlay .wx-compose .ed-actions .btn { flex: 0 0 auto; white-space: nowrap; }
#viewLesson .wx-compose .wx-input-tools,
#viewPlay .wx-compose .wx-input-tools {
  display: flex; align-items: center; gap: 4px; min-width: 0;
}
#viewLesson .wx-compose .wx-tool-row,
#viewPlay .wx-compose .wx-tool-row { display: flex; flex-wrap: nowrap; gap: 3px; }

/* —— 3) 编辑区保底高度：任何情况下都不许再被压成 2px —— */
#viewLesson .compose-band .wx-compose .ed-body.comp-code,
#viewPlay .compose-band .wx-compose .ed-body.comp-code { min-height: 110px; }

/* —— 4) 课程目录欢迎态：只显示欢迎卡片 —— */
body.course-home #viewLesson .pane-scroll,
body.course-home #viewLesson .compose-band,
body.course-home #viewLesson .teach-chat { display: none !important; }
body.course-home #viewLesson .home-welcome {
  display: flex; flex: 1 1 auto; min-height: 0;
  align-items: center; justify-content: center; padding: 24px; overflow-y: auto;
}
body.course-home .home-welcome .hw-card {
  width: min(680px, 100%); box-sizing: border-box;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e3e8f2);
  border-radius: 16px;
  box-shadow: 0 12px 44px rgba(28, 37, 64, .09);
  padding: 34px 38px;
}
body.course-home .home-welcome .hw-card h1 { margin: 12px 0 10px; font-size: clamp(24px, 3vw, 34px); }
body.course-home .home-welcome .hw-card p { line-height: 1.75; }
@media (max-width: 640px) {
  body.course-home #viewLesson .home-welcome { padding: 14px; align-items: flex-start; }
  body.course-home .home-welcome .hw-card { padding: 22px 20px; margin-top: 12px; }
}

/* ============================================================
   2026-11-11 · 可读性补丁（python / cpp 同步）
   次级文字统一提到 --wx-text-2；--wx-text-3 只保留给「锁定态」，
   这样「已解锁深色 / 未解锁浅色」的区分还在，但不再看不清字。
   ============================================================ */
.wx-sess-msg,
.wx-sess-time,
.wx-sess-search input::placeholder,
#viewLesson .tc-sub, #viewPlay .tc-sub,
#viewLesson .tc-hint, #viewPlay .tc-hint,
#viewLesson .wx-compose .ed-title, #viewPlay .wx-compose .ed-title,
#viewLesson .compose-band .console-dock .cd-status,
#viewPlay .compose-band .console-dock .cd-status,
.wx-compose .sym-tip,
.compose-band .muted { color: var(--wx-text-2); }
.wx-sess-search input::placeholder { opacity: 1; }

/* 工具条 / 控制台按钮：文字压到主文本色，hover 变色仍保留 */
#viewLesson .wx-compose .ed-head .sbtn:not(:hover),
#viewPlay .wx-compose .ed-head .sbtn:not(:hover),
#viewLesson .wx-compose .ed-btns .sbtn:not(:hover),
#viewPlay .wx-compose .ed-btns .sbtn:not(:hover),
#viewLesson .compose-band .console-dock .mini:not(:hover),
#viewPlay .compose-band .console-dock .mini:not(:hover),
.wx-tool-row button:not(:hover) { color: var(--wx-text); font-weight: 600; }
.wx-compose .symbar .sym:not(:hover) { color: var(--wx-text-2); }

/* 未解锁小锁：悬停立刻出气泡（不依赖浏览器原生 title 的延迟） */
.wx-lock::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 8px); bottom: -4px;
  white-space: nowrap; font-size: 12px; line-height: 1.4;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, .88); color: #fff;
  opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity .16s, transform .16s; z-index: 40;
}
.wx-lock:hover::after { opacity: 1; transform: translateY(0); }

/* ============================================================
   2026-11-11 · C++ 补齐 Python 已有的锁定态 / 居中弹窗 / 复制按钮
   ============================================================ */
/* 锁住的关卡：标题降一档、方牌减淡，保留版式不跳动 */
.wx-sess.is-locked:not(.active) .wx-sess-name { color: var(--wx-text-3); font-weight: 500; }
.wx-sess.is-locked .wx-sess-idx { opacity: .5; }
.wx-sess.is-locked .wx-sess-msg { opacity: .72; }

/* 锁定提示：屏幕正中央的气泡弹窗（替换原来的贴底条） */
.wx-toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, calc(-50% + 14px));
  background: rgba(0, 0, 0, .82); color: #fff; font-size: 13.5px; line-height: 1.5;
  padding: 13px 20px; border-radius: 12px; max-width: 80vw; text-align: center;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .38);
  opacity: 0; pointer-events: none; z-index: 1000; transition: opacity .2s, transform .2s;
}
.wx-toast.on { opacity: 1; transform: translate(-50%, -50%); }

/* 聊天代码块：复制按钮浮在代码右上角，与代码同一区域 */
.dm-code { position: relative; }
.dm-code pre { margin: 0; }
.dm-copy {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font: 600 12px/1 inherit; padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--wx-border-2); background: var(--wx-panel); color: var(--wx-text-2);
  cursor: pointer; box-shadow: var(--shadow-sm); transition: background .15s, color .15s, border-color .15s;
}
.dm-copy:hover { background: var(--wx-bg-2); color: var(--wx-text); }
.dm-copy.done { color: var(--wx-accent); border-color: var(--wx-accent); }

/* 未解锁关卡：头像角标小锁 */
.wx-sess-av { position: relative; }
.wx-lock {
  position: absolute; right: -3px; bottom: -3px; font-size: 11px; line-height: 1;
  filter: grayscale(1) opacity(.92); cursor: help; pointer-events: auto;
}

/* 2026-11-11: reserve room for the floating copy button */
.dm-code > pre { padding-right: 54px !important; }

/* ---- S27 · rail 已移除：会话列头工具簇（返回课程中心 / 主题 / 账号） ---- */
.wx-sess-search { display: flex; align-items: center; gap: 8px; }
.wx-sess-search input { flex: 1 1 auto; min-width: 0; }
.wx-rail-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.wx-rail-tools .wx-rail-avatar { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.wx-rail-tools .wx-rail-avatar svg { width: 20px; height: 20px; }
.wx-rail-tools .wx-rail-btn { width: 34px; height: 34px; border-radius: 8px; }

/* rail 移除后，移动端「关卡列表」抽屉开关改放在主区头部（桌面隐藏） */
.wx-drawer-toggle {
  display: none;
  border: none; background: transparent; border-radius: 8px;
  color: var(--wx-text-2); cursor: pointer;
  width: 30px; height: 30px; padding: 0;
  place-items: center; flex: none;
}
.wx-drawer-toggle:hover { background: var(--wx-hover-bg, rgba(128, 128, 128, .14)); color: var(--wx-text); }
@media (max-width: 900px) {
  .wx-drawer-toggle { display: grid; }
}

/* ==== S38 · 2026-11-17 =============================================
   ① 左侧目录章节之间细线隔断；② 课时头随内容一起滚（不再固定占位置）；
   ③ 小杜老师头像与其他头像一致，用透明底而不是微信绿。
   =================================================================== */
.side-nav .nav-ch + .nav-ch {
  border-top: 1px solid var(--wx-border);
  margin-top: 10px;
  padding-top: 10px;
}
#viewLesson .teach-chat, #viewPlay .teach-chat {
  overflow-y: auto !important;
  overscroll-behavior: contain;
  min-height: 0 !important;   /* S42：聊天区不再死占 520px（style.css 基础 520px 会撑出 #app，把运行/发送裁出首屏） */
  flex: 1 1 auto;
}
/* S42：课时页不滚动即可见底部「运行/发送」——顶部全局导航占 54px（body padding-top:54px），
   #app 必须收成 视口高 − 54px。用 vh 兜底（部分浏览器不支持 dvh，theme-star 的 dvh 声明会
   回退成 100vh 而溢出；dvh 生效时 theme-star 的 !important 仍优先）。 */
body.dm-star #app {
  height: calc(100vh - var(--dm-nav-h, 54px));
}
/* S45 2026-11-17（覆盖 S42 的 static）：视频上方聊天头栏(tc-head「小杜老师·课程名·←→」)
   钉在 .teach-chat 滚动容器顶部。旧版聊天/视频把容器滚下去时 tc-head 上移到绝对 top<54，
   跑进 0~54 的全局 .dm-nav(杜鸣工作室, z-2000) 后被盖住；sticky top:0 让它永不滚出、
   始终完整露在导航下方。保留 !important 压过其它位置规则。 */
#viewLesson .teach-chat .tc-head, #viewPlay .teach-chat .tc-head { position: sticky !important; top: 0; z-index: 3; background: var(--wx-panel); }
#viewLesson .tc-stream, #viewPlay .tc-stream {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}
#viewLesson .tc-avatar, #viewPlay .tc-avatar { background: transparent !important; }
@media (max-width: 900px) {
  .side-nav .nav-ch + .nav-ch { margin-top: 8px; padding-top: 8px; }
}

/* =====================================================================
   S65b 2026-11-20 · 布局扩容：教程区 + 编辑区都更大，功能不折叠
   —— 追加在文件末尾，用 html:root/body 提权压过上面的 !important，
      不动任何既有规则，便于回滚（删掉本段即可）。
   ===================================================================== */

/* --- P2 · 会话侧栏 300 → 258px，把宽度让给教程区/编辑区 --- */
@media (min-width: 901px){
  html:root #viewLesson .split, html:root #viewPlay .split{
    grid-template-columns: 258px minmax(0, 1fr) !important;
  }
}

/* --- P2 · 聊天头收紧（省 ~6px 高） --- */
@media (min-width: 901px){
  #viewLesson .tc-head, #viewPlay .tc-head{ padding-top: 8px !important; padding-bottom: 8px !important; }
}

/* --- P0-2 · 符号助手常显（去掉 sym-open 折叠依赖），单行横滑不占额外高 --- */
#viewLesson .wx-compose .symbar, #viewPlay .wx-compose .symbar{
  display: flex !important; min-height: 24px !important;
}
/* 空工具提示不换行占位 */
#viewLesson .wx-compose .sym-tip, #viewPlay .wx-compose .sym-tip{ flex: 0 0 auto !important; }

/* --- P0-1 · 控制台无实质输出时收成 18px 竖条，编辑器吃满整条带 --- */
/* .console-idle 由 index.html 内联的轻量 observer 打在 #composeBand 上；
   点竖条任意处即展开（.console-idle 移除），有真实输出时自动展开。 */
@media (min-width: 901px){
  html:root #viewLesson .compose-band.console-idle .console-dock,
  html:root #viewPlay .compose-band.console-idle .console-dock{
    flex: 0 0 18px !important; min-width: 18px !important;
    border-left: 1px solid var(--wx-border) !important; cursor: pointer;
  }
  html:root #viewLesson .compose-band.console-idle .console-dock .cd-head,
  html:root #viewLesson .compose-band.console-idle .console-dock .cd-body,
  html:root #viewPlay .compose-band.console-idle .console-dock .cd-head,
  html:root #viewPlay .compose-band.console-idle .console-dock .cd-body{ display: none !important; }
  html:root #viewLesson .compose-band.console-idle .wx-compose,
  html:root #viewPlay .compose-band.console-idle .wx-compose{ flex: 1 1 100% !important; }
}

/* ============================================================
   2026-11-23 · 编辑器区布局微调（按用户截图）
   ① main.cpp + 符号助手合并到同一行，省一行高度给编辑区
   ② 控制台输出常驻显示（JS 已停打 console-idle，这里也兜底）
   ③ 复制/清空按钮 + 页面内按钮整体缩小
   ============================================================ */
/* ① ed-head 里的 symbar 与 main.cpp 同行 */
html:root #viewLesson .wx-compose .ed-head,
html:root #viewPlay .wx-compose .ed-head { flex-wrap: nowrap; gap: 6px; padding: 0 0 4px; }
html:root #viewLesson .wx-compose .ed-head .symbar,
html:root #viewPlay .wx-compose .ed-head .symbar {
  display: flex !important;          /* 常驻显示，不再依赖 .sym-open 展开 */
  flex: 1 1 auto !important; min-width: 0;
  border-top: none !important; border-bottom: none !important;
  padding: 0 !important; margin: 0; gap: 5px;
  background: transparent !important;
  overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
html:root #viewLesson .wx-compose .ed-head .symbar::-webkit-scrollbar,
html:root #viewPlay .wx-compose .ed-head .symbar::-webkit-scrollbar { display: none; }
html:root #viewLesson .wx-compose .ed-head .ed-title,
html:root #viewPlay .wx-compose .ed-head .ed-title { flex: 0 0 auto; }
html:root #viewLesson .wx-compose .ed-head .ed-btns,
html:root #viewPlay .wx-compose .ed-head .ed-btns { display: none !important; } /* 空容器不再占位 */

/* ② 控制台兜底：即便 class 残留也不折叠 */
html:root #viewLesson .compose-band.console-idle .console-dock,
html:root #viewPlay .compose-band.console-idle .console-dock {
  flex: 1 1 44% !important; min-width: 300px !important; cursor: default !important;
}
html:root #viewLesson .compose-band.console-idle .console-dock .cd-head,
html:root #viewLesson .compose-band.console-idle .console-dock .cd-body,
html:root #viewPlay .compose-band.console-idle .console-dock .cd-head,
html:root #viewPlay .compose-band.console-idle .console-dock .cd-body { display: flex !important; }

/* ③ 符号按钮缩小 */
html:root #viewLesson .wx-compose .symbar .sym,
html:root #viewPlay .wx-compose .symbar .sym {
  min-height: 21px; padding: 3px 7px; font-size: 11.5px; line-height: 1;
}
/* C++ 符号栏外层 .sym-row 也压紧一行 */
html:root #viewLesson .wx-compose .symbar .sym-row,
html:root #viewPlay .wx-compose .symbar .sym-row { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
/* 复制/清空按钮缩小 */
html:root #viewLesson .compose-band .console-dock .mini,
html:root #viewPlay .compose-band .console-dock .mini {
  height: 20px; padding: 0 6px; font-size: 10.5px; border-radius: 5px;
}
/* 底栏工具按钮缩小 */
html:root .wx-tool-row button { font-size: 10.5px; padding: 3px 6px; }
/* 运行·判分主按钮缩小 */
html:root #viewLesson .wx-compose .ed-actions .btn.primary,
html:root #viewPlay .wx-compose .ed-actions .btn.primary { padding: 6px 10px; font-size: 12px; }
/* 上方聊天头的前后关/重来按钮缩小 */
html:root .tc-nav, html:root .tc-restart { height: 28px; min-width: 28px; padding: 0 6px; font-size: 11px; }

/* 窄屏：符号助手仍与 main.cpp 同行，按钮不过度放大 */
@media (max-width: 900px) {
  html:root #viewLesson .wx-compose .ed-head .symbar,
  html:root #viewPlay .wx-compose .ed-head .symbar { padding: 0 !important; margin-left: 2px; }
  html:root #viewLesson .wx-compose .symbar .sym,
  html:root #viewPlay .wx-compose .symbar .sym { min-height: 26px; min-width: 26px; padding: 4px 7px; font-size: 11.5px; }
  html:root #viewLesson .compose-band .console-dock .mini,
  html:root #viewPlay .compose-band .console-dock .mini { height: 24px; padding: 0 8px; font-size: 11px; }
}

/* ============================================================
   2026-11-23 · S74 三处微调（按用户截图）
   ① 左栏宽度与 grid 列对齐（P2 把列改 258px 但 .wx-sessions 仍 300px → 溢出 42px 被盖住）
   ② main.cpp 标题加右侧细线，与后面的「符号助手」文字隔开
   ③ 控制台「复制/清空」外框缩小、两钮靠近（.mini flex:1 被拉伸成大框）
   ============================================================ */
/* ① 左栏 258px 与 grid 列一致 */
@media (min-width: 901px){
  html:root #viewLesson .wx-sessions,
  html:root #viewPlay .wx-sessions { width: 258px !important; flex: 0 0 258px !important; }
}
/* ② main.cpp 标题右侧细线 */
html:root #viewLesson .wx-compose .ed-head .ed-title,
html:root #viewPlay .wx-compose .ed-head .ed-title {
  padding-right: 9px !important; margin-right: 3px;
  border-right: 1px solid var(--wx-border, #ccc) !important;
}
/* ③ 复制/清空：不拉伸、紧凑小框、两钮靠近 */
html:root #viewLesson .compose-band .console-dock .cd-head .mini,
html:root #viewPlay .compose-band .console-dock .cd-head .mini {
  flex: 0 0 auto !important; width: auto !important;
  height: 22px; padding: 0 9px; font-size: 11px; border-radius: 5px;
  border: 1px solid var(--wx-border, #ccc) !important;
  background: var(--wx-panel) !important; color: var(--wx-text-2) !important;
}
html:root #btnCopy {
  border: 1px solid var(--wx-border, #ccc) !important;
  background: var(--wx-panel) !important; padding: 0 9px !important;
}
html:root #viewLesson .compose-band .console-dock .cd-head,
html:root #viewPlay .compose-band .console-dock .cd-head { gap: 5px !important; padding: 7px 10px !important; }

/* ============================================================
   2026-11-24 · S76 课程列表减负
   ① 锁定的未解锁关（.compact）默认只显示一行标题，副行藏起来
   ② 「未完成」筛选按钮：紧凑、选中态高亮
   ============================================================ */
html:root #wxSessions .wx-sess.compact .wx-sess-msg,
html:root #wxSessionsPlay .wx-sess.compact .wx-sess-msg { display: none !important; }
html:root #wxSessions .wx-sess.compact,
html:root #wxSessionsPlay .wx-sess.compact { padding-top: 7px; padding-bottom: 7px; }
/* 筛选按钮：嵌在搜索框右侧 */
html:root .wx-todo-filter {
  flex: 0 0 auto; margin-left: 4px; padding: 5px 8px;
  font-size: 11px; line-height: 1; white-space: nowrap;
  color: var(--wx-text-3); background: transparent;
  border: 1px solid var(--wx-border); border-radius: 6px; cursor: pointer;
}
html:root .wx-todo-filter:hover { color: var(--wx-text); border-color: var(--wx-accent, #ffc65c); }
html:root .wx-todo-filter.on { color: #04122b; background: var(--wx-accent, #ffc65c); border-color: var(--wx-accent, #ffc65c); font-weight: 700; }
