/* ============================================================
   Kaopy 2.0 · 学习工作台 v2
   VS Code 结构：顶栏 48px · 活动栏 48px · 左面板 · 中主流 ·
   右侧浏览器式窗口标签（笔记 / 课件 / 旁问 ×N）
   ============================================================ */

html, body { height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
/* 顶栏只剩首页标识、课程名和右栏三个入口（人类 10/24）：薄一些，不画底线，纵向空间还给内容 */
:root { --topbar-h: 40px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: var(--topbar-h);
  flex: none;
  padding: 0 12px;
  background: var(--canvas);
  position: relative;
  z-index: var(--z-topbar);
  /* 门户 .tb 的两档气泡底色（entry.html critical 的 --faint-bub / --faint-bub-hover），数值一致 */
  --faint-bub: color-mix(in srgb, var(--ink) 4%, transparent);
  --faint-bub-hover: color-mix(in srgb, var(--ink) 12%, transparent);
}
/* 顶栏按钮照门户的 .bub：淡底气泡，悬停加深，按下不沉；描边只来自 kaopy.css 的 :focus-visible（键盘操作） */
.topbar .bub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  min-width: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--faint-bub);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-ui);
  font-weight: var(--fw-strong);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s linear, color .2s linear;
}
.topbar .bub:hover { background: var(--faint-bub-hover); color: var(--ink); text-decoration: none; }
.topbar .bub-icon { width: 32px; padding: 0; }
.topbar .bub svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#langBtn .lang-sep::before { content: '/'; color: var(--border-strong); font-weight: var(--fw-regular); }
#langBtn .lang-zh, #langBtn .lang-en { color: var(--faint); font-weight: var(--fw-regular); }
html[lang="zh-CN"] #langBtn .lang-zh, html[lang="en-US"] #langBtn .lang-en { color: var(--ink); font-weight: var(--fw-strong); }
/* 搬进账户菜单的几项：一行一项，和菜单里别的项同一个样子 */
.account-menu__items :is(#themeBtn, #langBtn, #pinnedSummaryBtn, #guideReplay, #connBtn) { height: auto; min-width: 0; padding: 8px 10px; border-radius: var(--r-sm); background: transparent; color: var(--ink); font-weight: 400; }
.account-menu__items :is(#themeBtn, #langBtn, #pinnedSummaryBtn, #guideReplay):hover { background: var(--surface-subtle); }
.account-menu__items #connBtn .dot { width: 8px; height: 8px; margin: 0 6px; }
.topbar .conn { gap: 7px; }
.topbar-panel-toggle { flex: none; border-radius: var(--r-sm); }
.topbar-panel-toggle--left { order: -2; }
.topbar-panel-toggle--right { margin-left: 2px; }
/* 右栏三个入口（笔记、资料、旁问）一组排在最右；右栏正显示着的那一种是淡蓝底蓝图标（和 Claude Code 顶栏的面板按钮一样） */
.rp-entries { display: flex; flex: none; align-items: center; gap: 2px; margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--border); }
.topbar .rp-entry.is-on { background: var(--accent-soft); color: var(--accent-strong); }
.topbar .rp-entry .i-aside { stroke-width: 1.75; }
/* The rail is always on screen from 1024px up; below that it lives in the drawer this opens.
   `.topbar` in front so the bubble's display cannot bring it back. */
.topbar .left-drawer-toggle { display: none; }
.workspace-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
  color: var(--accent-strong);
  font-size: var(--fs-caption);
  font-weight: 600;
  text-decoration: none;
}
.workspace-home-link__logo { width: 24px; height: 24px; border-radius: 0; }
.workspace-home-link:hover { color: var(--accent); }
.workspace-home-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* 学习模式胶囊（备考 / 日常）与模式选择窗都在 workspace-mode-picker.css（t-20261027-pz69 g2） */

.course-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: clamp(132px, 18vw, 220px);
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  box-shadow: none;
  font: inherit;
  cursor: pointer;
}
.course-summary:hover { background: var(--surface-subtle); }
.course-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.course-summary__lead { display: block; min-width: 0; text-align: left; }
.course-summary__eyebrow { color: var(--faint); font-size: var(--fs-caption); font-weight: 600; line-height: 1; text-transform: uppercase; }
.course-summary__lead strong { display: block; min-width: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-ui); line-height: 1.25; }
.course-summary__metrics { display: flex; align-items: center; min-width: 0; gap: 5px; }
.course-summary__metric { max-width: 136px; overflow: hidden; padding: 4px 7px; border-radius: var(--r-pill); background: var(--surface); color: var(--muted); font-size: var(--fs-caption); font-weight: 600; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap;  border: 1px solid var(--border); }
.course-summary__stage { background: var(--accent-soft); color: var(--accent-strong); }
.course-summary > .icon { flex: none; color: var(--faint); transition: transform 160ms ease; }
.course-summary[aria-expanded="true"] > .icon { transform: rotate(180deg); }
.course-summary-menu { top: 46px; left: 54px; width: min(380px, calc(100vw - 70px)); padding: 10px; }
.course-summary-menu__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.course-summary-menu__grid > div { min-width: 0; padding: 9px 10px; border-radius: var(--r-sm); background: var(--surface);  border: 1px solid var(--border); }
.course-summary-menu__grid > div:first-child { grid-column: 1 / -1; }
.course-summary-menu__grid dt { margin-bottom: 3px; color: var(--faint); font-size: var(--fs-caption); font-weight: 600; }
.course-summary-menu__grid dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: var(--fs-caption); font-weight: 600; line-height: 1.4; }
.course-summary-menu__courses { display: grid; gap: 2px; }
.pinned-summary-panel {
  position: fixed;
  top: 58px;
  right: calc(var(--right-panel-w) + 16px);
  z-index: var(--z-pinned);
  width: min(340px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.pinned-summary-panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pinned-summary-panel__head h2 { margin: 0; font-size: var(--fs-body); }
.pinned-summary-panel__grid { display: grid; gap: 2px; margin: 0; }
.pinned-summary-panel__grid > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.pinned-summary-panel__grid > div:last-child { border-bottom: 0; }
.pinned-summary-panel__grid dt { color: var(--muted); font-size: var(--fs-caption); }
.pinned-summary-panel__grid dd { margin: 0; max-width: 210px; overflow-wrap: anywhere; color: var(--ink); font-size: var(--fs-ui); font-weight: 600; text-align: right; }
.pinned-summary-panel__grid #courseSummaryRlhfRow dd { white-space: nowrap; flex: none; display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pinned-summary-panel__grid #courseSummaryRlhfReview { height: 28px; text-decoration: none; }
body.rp-collapsed .pinned-summary-panel { right: 16px; }

.plan-breadcrumb { min-width: 0; padding: 3px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--accent-strong); cursor: pointer; font: 600 var(--fs-caption)/1.4 var(--font-sans); white-space: nowrap; }
.plan-breadcrumb:hover { background: var(--accent-soft); }
.plan-breadcrumb[hidden] { display: none; }


.countdown { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-caption); color: var(--muted); white-space: nowrap; }
.countdown strong { color: var(--ink); font-weight: 600; }

/* 输入框上方的停靠区（t-20261001-yh78）：导师改动的待确认卡在上，「下一个单元」卡在下，都和输入框同宽 */
.composer-dock { display: grid; gap: 8px; }
.composer-dock:has(> :not([hidden], [data-dock-bubble])) { margin-bottom: 9px; }
/* 和输入框上方的计划那一行同一层玻璃（plan.css .plan-strip）：同样的边、同样的卡头；出现时长出来 200ms */
.change-dock {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, .7);
  animation: change-dock-in 200ms cubic-bezier(.2, .8, .2, 1);
}
[data-theme="dark"] .change-dock { background: color-mix(in srgb, var(--canvas) 86%, transparent); box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, .05); }
@keyframes change-dock-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .change-dock { animation: none; } }
.change-dock[hidden] { display: none; }
.change-dock__head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent); font-size: var(--fs-ui); line-height: 1.5; }
/* 等你决定：提醒黄点，和计划卡尾、聊天里指过来的那一行同一个点 */
.change-dock__dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--marker); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marker) 28%, transparent); }
.change-dock__title { color: var(--ink); font-weight: var(--fw-strong); }
/* 卡片再长也不把输入框顶出屏幕：超出的部分在卡里滚动 */
.change-dock__body { max-height: min(46vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.change-dock__slot:empty { display: none; }
.change-dock__slot:not(:empty) ~ .change-dock__slot:not(:empty) { border-top: 1px solid var(--border); }
/* 「下一个单元」卡的样子在 teaching-flow.css（t-20261026-wybz） */

.video-link-dialog {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-dialog) + 10);
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--scrim);
}
.video-link-dialog__panel {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}
.project-rename-dialog { margin: auto; padding: 0; border: 0; border-radius: var(--r-md); width: 520px; max-width: calc(100vw - 32px); color: var(--ink); background: var(--surface); }
.project-rename-dialog::backdrop { background: var(--scrim); }
.video-link-dialog__panel h2 { margin: 0 0 8px; font-size: var(--fs-h2); }
.video-link-dialog__panel > p { margin: 0; color: var(--muted); font-size: var(--fs-ui); line-height: 1.65; }
.video-link-dialog__panel label { display: grid; gap: 7px; margin-top: 18px; font-size: var(--fs-ui); font-weight: 600; }
.video-link-dialog__panel .input { width: 100%; }
.video-link-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.video-link-dialog__feedback { min-height: 20px; margin-top: 10px !important; color: var(--danger) !important; font-size: var(--fs-caption) !important; }

.topbar-right { min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.topbar-right > * { flex: none; }

.gen-chip {
  display: none;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-ui);
  cursor: pointer;
  white-space: nowrap;
}
.gen-chip.show { display: inline-flex; }
.gen-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* ---------- 骨架 ---------- */
.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "navigation conversation notes";
}

/* ---------- 活动栏 ---------- */
.left-side { display: flex; min-width: 0; min-height: 0; }

.abar {
  width: var(--activity-w);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-right: 1px solid var(--border);
  background: var(--canvas);
}
.abar-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.abar-btn .icon { width: 20px; height: 20px; }
.abar-btn:hover { color: var(--ink); background: var(--surface-subtle); }
.abar-btn.is-on { color: var(--accent); background: var(--accent-soft); }

/* ---------- 左面板 ---------- */
.lp {
  width: var(--left-panel-w);
  flex: none;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
  background: var(--canvas);
}
.lp-pane { display: none; padding: 16px 14px 28px; }
.lp-pane.is-on { display: block; }

.lp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lp-head h2 { font-size: var(--fs-ui); font-weight: 600; color: var(--ink); }

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-sm);
  padding: 12px;
  text-align: center;
  font-size: var(--fs-ui);
  color: var(--faint);
  margin-bottom: 8px;
}

.file-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.material-list-item { display: flex; align-items: flex-start; gap: 0; }
.material-list-item .file-row { flex: 1; min-width: 0; }
.material-delete.btn {
  display: inline-flex;
  flex: none;
  margin-top: 6px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  border-radius: var(--r-sm);
}
.material-delete.btn:hover:not([disabled]) {
  background: transparent;
  color: var(--danger);
}
.material-delete.btn:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
.material-delete .icon { width: 12px; height: 12px; }
.material-delete[disabled] { opacity: 0.55; cursor: wait; }
.empty-materials {
  padding: 16px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: var(--fs-ui);
  line-height: 1.6;
}
/* The one empty-state ring: 20px before the sentence, drawn once (0.6s) and then still. */
.empty-materials::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin: 0 6px 0 -2px;
  vertical-align: -5px;
  background: var(--accent);
  -webkit-mask: url('../brand/kaopy-ring-once.svg') center / contain no-repeat;
  mask: url('../brand/kaopy-ring-once.svg') center / contain no-repeat;
}
@media (prefers-reduced-motion: reduce) {
  .empty-materials::before { -webkit-mask-image: url('../brand/kaopy-ring-still.svg'); mask-image: url('../brand/kaopy-ring-still.svg'); }
}
.file-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  align-items: start;
  column-gap: 8px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font-size: var(--fs-ui);
  text-align: left;
  cursor: pointer;
}
button.file-row:hover { background: var(--surface-subtle); }
.file-row > .icon { color: var(--faint); width: 20px; height: 20px; margin-top: 0; }
.file-row > .file-state { width: 16px; height: 16px; margin-top: 2px; justify-self: center; }
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-size: var(--fs-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-state.ok { color: var(--success); }
.file-row.is-busy, .file-row.is-failed { cursor: default; }
.caption.err { color: var(--danger); }
.link-btn {
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-size: var(--fs-ui);
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.link-btn:hover { text-decoration: underline; }
.src-note { margin-top: 8px; padding-left: 8px; }

.unit-interlude { position: relative; margin: 8px 12px 8px 18px; padding: 5px 0 5px 18px; }
.unit-interlude::before { content: ""; position: absolute; left: 0; top: -10px; bottom: -10px; width: 10px; border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); border-radius: 0 0 0 var(--r-sm); opacity: .55; pointer-events: none; }
.unit-interlude::after { content: ""; position: absolute; left: -3px; top: 18px; width: 5px; height: 5px; border: 1px solid var(--faint); border-radius: 50%; background: var(--surface); pointer-events: none; }
.unit-interlude__head { display: flex; align-items: center; gap: 3px; min-width: 0; }
.unit-interlude__button { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; padding: 6px 3px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font: var(--fs-caption)/1.5 var(--font-sans); cursor: pointer; text-align: left; }
.unit-interlude__button .unit-title { font: inherit; white-space: normal; line-height: 1.5; }
.unit-interlude__button:hover { color: var(--accent-strong); background: var(--surface-subtle); }
.unit-interlude__arrow { flex: none; color: var(--faint); font-size: var(--fs-caption); }
.unit-interlude__toggle { flex: none; width: 28px; height: 28px; display: grid; place-content: center; padding: 0; border: 0; border-radius: var(--r-sm); color: var(--muted); background: transparent; cursor: pointer; font-size: var(--fs-h2); transition: transform 150ms ease; }
.unit-interlude__toggle:hover { background: var(--surface-subtle); }
.unit-interlude__toggle[aria-expanded="true"] { transform: rotate(90deg); }
.unit-interlude__items { display: grid; gap: 3px; margin: 2px 0 4px; padding: 0; list-style: none; }
.unit-interlude__items[hidden] { display: none; }
.unit-interlude__items button { width: 100%; padding: 5px 3px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); text-align: left; cursor: pointer; font: var(--fs-caption)/1.4 var(--font-sans); }
.unit-interlude__items button:hover { background: var(--surface-subtle); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .unit-interlude__toggle { transition: none; } }

.unit-time-dialog {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--scrim);
}
.unit-time-panel {
  width: min(520px, 100%);
  max-height: min(680px, calc(100dvh - 36px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}
.unit-time-panel h3 { margin-bottom: 6px; font-size: var(--fs-h2); }
.unit-time-panel label { display: grid; gap: 7px; margin-top: 18px; font-size: var(--fs-ui); font-weight: 600; }
.unit-time-panel .input { width: 100%; }
.unit-time-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
/* 删除短旁问的确认框：左边一个「以后不再提示」，按钮仍靠右 */
.unit-time-panel .aside-delete-skip { display: inline-flex; align-items: center; gap: 6px; margin: 0 auto 0 0; font-size: var(--fs-caption); font-weight: 400; color: var(--muted); cursor: pointer; }
.aside-delete-skip input { margin: 0; accent-color: var(--accent); }
.unit-time-feedback { display: grid; gap: 12px; margin-top: 16px; }
.unit-time-saved, .unit-time-formula { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface);  border: 1px solid var(--border); }
.unit-time-diffs { display: grid; gap: 6px; padding-left: 20px; font-size: var(--fs-caption); }
.done-units { margin-top: 10px; padding-left: 8px; }
.done-units summary { cursor: pointer; list-style: none; }
.done-units summary::-webkit-details-marker { display: none; }
.done-units summary:hover { color: var(--muted); }
.done-item { display: flex; align-items: center; gap: 8px; padding: 8px 0 0; font-size: var(--fs-ui); color: var(--muted); }

.stage-group .done-item { padding: 8px 12px 12px; }

/* 阶段与单元（t-20261024-hnjw）：阶段是上层空间，单元是阶段之下的小标题。
   阶段常驻在顶栏面包屑（.topbar-stage）；进入讲解、实战时对话流第一项是章首（眉题「第 2 阶段」+ 大号阶段名 + 整宽深线），
   离开规划的那条回答末尾是「下一阶段 讲解 →」一行。单元小标题左对齐、无框，同行一条浅线。 */
.stage-chapter { color: var(--ink); font-family: var(--font-sans); }
.stage-chapter--head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 12px; margin: 8px 0 28px; padding-bottom: 12px; border-bottom: 1px solid var(--border-strong); }
.stage-chapter__eyebrow { grid-column: 1; margin: 0 0 4px; color: var(--faint); font: 500 var(--fs-caption)/1.4 var(--font-sans); letter-spacing: .04em; }
.stage-chapter__title { grid-column: 1; min-width: 0; margin: 0; color: var(--ink); font: 600 var(--fs-h2)/1.3 var(--font-sans); }
.stage-chapter--head .stage-transition-action { grid-column: 2; grid-row: 1 / span 2; align-self: end; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--faint); }
.stage-chapter--head .stage-transition-action::after { content: none; }
.stage-chapter--head .stage-transition-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.stage-chapter--head .stage-transition-action:hover { background: var(--surface-subtle); color: var(--ink); }
.stage-chapter .stage-transition-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stage-chapter--next { margin: 20px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.stage-chapter--next .stage-transition-action { display: inline-flex; align-items: baseline; gap: 10px; margin: 0 -6px; padding: 2px 6px; border-radius: var(--r-xs); color: var(--ink); font: 600 var(--fs-ui)/1.5 var(--font-sans); }
.stage-chapter--next .stage-chapter__eyebrow { margin: 0; }
.stage-chapter--next .stage-transition-action::after { color: var(--muted); }
.stage-chapter--next .stage-transition-action:hover .stage-chapter__name, .stage-chapter--next .stage-transition-action:hover::after { color: var(--accent-strong); }
/* 顶栏面包屑：课程名后一条淡斜杠和当前阶段名；不可点，窄屏先截课程名 */
.topbar-stage { display: inline-flex; flex: none; align-items: center; gap: 8px; margin-left: -6px; color: var(--ink); font: 600 var(--fs-ui)/1.25 var(--font-sans); white-space: nowrap; }
.topbar-stage::before { content: '/'; color: var(--faint); font-weight: 400; }
.topbar-stage[hidden] { display: none; }
/* 阶段名放在顶栏正中，不再接在课程名后面用斜杠连着（人类 10/24） */
@media (min-width: 560px) {
  .topbar-stage { position: absolute; left: 50%; transform: translateX(-50%); margin-left: 0; pointer-events: none; }
  .topbar-stage::before { content: none; }
}
/* 窄屏课程名按钮会撑满余宽：有阶段时只占自身宽度，阶段紧跟课程名。
   手机宽度放不下课程名和阶段两段：阶段由对话流顶部的章首标明，顶栏只留课程名 */
@media (max-width: 1023px) { .course-summary:has(+ .topbar-stage:not([hidden])) { flex: 0 1 auto; } }
@media (max-width: 559px) { .topbar-stage { display: none; } .course-summary:has(+ .topbar-stage:not([hidden])) { flex: 1 1 96px; } }
/* 单元开始线、结束线（t-20261021-esfa）：样子在 teaching-flow.css（t-20261026-wybz 学完的单元收成一枚章） */
.unit-folded { display: none !important; }

/* 单元教室（t-20261021-esfa 第二阶段）：主栏的回看页。顶栏贴顶，单元原对话是 surface 块，教室自己的消息按日期分段。 */
body.in-unit-room :is(#nextUnitCard, #planStrip, #scrollToLatest) { display: none !important; }
.unit-room-head { position: sticky; top: 0; z-index: 8; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 16px; padding: 10px 0 12px; border-bottom: 1px solid var(--border); background: var(--canvas); }
.unit-room-head__back-short { display: none; }
.unit-room-head__title { flex: 1 1 10em; min-width: 0; margin: 0; overflow: hidden; color: var(--ink); font: 600 var(--fs-body)/1.5 var(--font-sans); text-overflow: ellipsis; white-space: nowrap; }
.unit-room-head__done { flex: none; color: var(--success); font: 600 var(--fs-caption)/1.5 var(--font-sans); font-variant-numeric: tabular-nums; }
.unit-room-head__done.is-set-aside { color: var(--muted); }
.unit-room-origin { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.unit-room-origin__toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 8px 8px 14px; border: 0; border-radius: var(--r-md); background: none; color: var(--muted); font: 600 var(--fs-caption)/1.5 var(--font-sans); text-align: left; cursor: pointer; }
/* 右端一颗圆形展开键，和对话流里过关条的展开键同一套（t-20261026-wybz） */
.unit-room-origin.is-open .unit-room-origin__chev { transform: rotate(180deg); }
.unit-room-origin__toggle:hover { color: var(--ink); }
.unit-room-origin__toggle:hover .unit-room-origin__chev { background: var(--surface-subtle); color: var(--muted); }
.unit-room-origin__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.unit-room-origin__body { padding: 4px 14px 6px; border-top: 1px solid var(--border); }
/* 原对话只读：回执的撤销/编辑和阶段跳转作用在主线，教室里不放（回执可能晚于只读处理才画出来，所以用样式兜住） */
.unit-room-origin .rcpt__act, .unit-room-origin .stage-transition-action { display: none; }
.unit-room-origin__body[hidden] { display: none; }
.unit-room-origin__body.is-readonly .api-question-options { pointer-events: none; }
/* 导师收这一单元时留的话：一张便笺，左边导师的标，不写「单元小结」这类标签（t-20261026-wybz fixB） */
.unit-room-summary { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--muted); font-size: var(--fs-ui); line-height: 1.6; }
.unit-room-summary__mark { flex: none; width: 18px; height: 18px; margin-top: 2px; opacity: .85; }
.unit-room-summary p { margin: 0; }
.unit-room-day { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--muted); font: 400 var(--fs-caption)/1.5 var(--font-sans); }
.unit-room-day::before, .unit-room-day::after { content: ''; flex: 1 1 24px; height: 0; border-top: 1px solid var(--border-strong); }
.thread-busy-elsewhere #streamSlot :is(.api-question-section, .api-questionnaire) { opacity: .6; pointer-events: none; }
.msg-assistant.is-jump-target,
.api-questionnaire.is-jump-target,
.api-question-section.is-jump-target { border-radius: var(--r-md); box-shadow: 0 0 0 2px var(--accent); }
.math-render { max-width: 100%; color: inherit; }
.math-inline { display: inline-block; max-width: 100%; vertical-align: -0.15em; }
.math-display { display: block; max-width: 100%; margin: 2px 0; padding-block: .45em; overflow-x: auto; overflow-y: hidden; }
.math-display > .katex-display { margin: 0; min-width: max-content; }
.math-fallback { overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--fs-ui); }

/* 控制面板（设置）的行与控件在 workspace-navigation.css 的"左栏控件语言"一节 */
.api-usage__track { height: 7px; margin-bottom: 7px; overflow: hidden; border-radius: var(--r-pill); background: var(--border); }
.api-usage__track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.ctrl-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-ui); margin-bottom: 8px; }

/* ---------- 中央 ---------- */
.left-side { grid-area: navigation; }
/* The composer is the last flex item of .center, so the chat column always
   ends where the input area (staged answers, chips, box) begins, whatever its
   height. It overlaps only its own transparent button band. */
.center { --composer-overlap: 44px; position: relative; grid-area: conversation; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.rp { grid-area: notes; }

.chat { flex: 1; overflow-y: auto; min-height: 0; }
.chat-inner {
  position: relative;
  width: 100%;
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: 36px 48px calc(var(--composer-overlap) + 24px) 30px;
}
.learning-overview { align-content: stretch; gap: 12px; min-height: 0; }
.learning-overview.is-on { display: flex; flex: 1; flex-direction: column; }
.learning-overview > .knowledge-map-overview { flex: 1; }
.api-quiz-paper { display: grid; gap: 18px; }
.api-quiz-paper > legend { font-size: var(--fs-h2); font-weight: 600; }
.api-paper-question {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.api-paper-question h4 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-ui);
  line-height: 1.55;
}
.api-paper-question h4 small { flex: none; color: var(--muted); font-weight: 400; }
.api-paper-text-answer {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
textarea.api-paper-text-answer { min-height: 110px; resize: vertical; }
.api-paper-pending { margin: 0; color: var(--muted); line-height: 1.55; }
.api-paper-feedback {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 3px solid var(--marker);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.api-paper-feedback.is-correct { border-left-color: var(--success); }
.api-paper-feedback.is-wrong { border-left-color: var(--danger); }
.api-paper-feedback p { margin: 0; color: var(--muted); font-size: var(--fs-caption); line-height: 1.55; }
.api-paper-feedback .api-paper-verdict { color: var(--ink); font-weight: 600; }
.knowledge-map-overview { min-height: 0; margin-top: 0; }
.knowledge-map-page-overlay {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  padding: 16px;
  background: var(--scrim);
}
.knowledge-map-page-overlay__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.knowledge-map-page-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.knowledge-map-page-overlay__header h2 { margin: 0; color: var(--ink); font-size: var(--fs-h2); }
.knowledge-map-page-overlay__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: var(--fs-h2);
  line-height: 1;
  cursor: pointer;
}
.knowledge-map-page-overlay__body { min-width: 0; min-height: 0; padding: 16px; }
/* 搬进窗口的地图要有确定的高度，里面的 .km-scroll 才是滚动容器；高度是自动的话它被撑到整张图那么高，被面板裁掉，滚不动 */
.knowledge-map-page-overlay__body > .knowledge-map-overview { height: 100%; }
body.knowledge-map-maximized { overflow: hidden; }
@media (max-width: 767px) {
  .knowledge-map-page-overlay { padding: 0; }
  .knowledge-map-page-overlay__panel { border: 0; border-radius: 0; }
  .knowledge-map-page-overlay__body { padding: 10px; }
}
.recovery-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: center;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface));
}
.recovery-action[hidden] { display: none; }
.current-action-copy { min-width: 0; }
.current-action-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: var(--fs-caption);
  font-weight: 600;
}
.current-action-title { color: var(--ink); font-size: var(--fs-ui); line-height: 1.45; }
.current-action-description { margin-top: 4px; color: var(--muted); font-size: var(--fs-ui); line-height: 1.55; }
.recovery-detail { margin: 3px 0 0; color: var(--muted); font-size: var(--fs-ui); line-height: 1.55; }
.recovery-detail strong { color: var(--ink); font-weight: 600; }
.current-action-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.recovery-action.is-blocked {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger-soft) 40%, var(--surface));
}
@media (max-width: 720px) {
  .recovery-action { grid-template-columns: 1fr; }
  .current-action-actions { justify-content: flex-start; }
}
.course-welcome {
  margin: clamp(18px, 5vh, 48px) 0 24px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--r-md);
}
.course-welcome h2 { font-size: var(--fs-h1); font-weight: 600; line-height: var(--lh-title); letter-spacing: var(--ls-title); }
.course-welcome > p { max-width: 58ch; margin-top: 10px; color: var(--muted); line-height: 1.7; }
.course-welcome ol { display: grid; gap: 8px; margin: 22px 0 0; padding-left: 22px; color: var(--ink); }
.course-welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.empty-source { padding: 24px; color: var(--muted); line-height: 1.7; text-align: center; }

.msg-user {
  width: fit-content;
  max-width: 560px;
  margin: 0 0 30px auto;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: var(--r-md);
  font-size: var(--fs-body);
  line-height: var(--lh-read);
  border: 1px solid var(--border);
}
/* 导师提议切换模式 → 学生在选择窗里选 → 导师接着说，读起来是同一段：
   提议那条回复不写「已完成」、下边距收紧；学生的选择是一行很轻的记录（不是气泡）；导师的接续不再重复头像行 */
.msg-assistant[data-mode-proposal="true"] { margin-bottom: 6px; }
.msg-user.is-mode-choice {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  width: auto;
  max-width: none;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--faint);
  font-size: var(--fs-caption);
  line-height: 1.5;
}
.msg-user.is-mode-choice::before { content: ''; flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.msg-user.is-mode-choice + .msg-assistant > .msg-head { display: none; }
/* 插话（t-20261027-1537）：导师讲着时学生发的话，等这一步说完才送进同一个回答；气泡下一行小字说明去向 */
.msg-user.is-interjection { margin-bottom: 14px; }
.msg-user.is-interjection:is([data-interjection="sending"], [data-interjection="pending"], [data-interjection="steering"]) {
  border-style: dashed;
  color: var(--muted);
}
.msg-user.is-interjection[data-interjection="undelivered"] { border-color: var(--danger); }
.interjection-note { margin-top: 4px; color: var(--faint); font-size: var(--fs-caption); line-height: 1.5; }
.interjection-note[hidden] { display: none; }
.msg-user.is-interjection[data-interjection="undelivered"] .interjection-note { color: var(--danger); }
.interjection-resend {
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.msg-assistant { margin-bottom: 14px; border-radius: var(--r-sm); }
.msg-assistant.flash { animation: kp-flash 1.4s ease; }
@keyframes kp-flash {
  0% { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.msg-name { font-size: var(--fs-ui); font-weight: 600; }
.msg-status { font-size: var(--fs-caption); color: var(--faint); }
.generation-interruption { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; color: var(--faint); font-size: var(--fs-caption); font-weight: 400; line-height: 1.5; }
.generation-interruption::before, .generation-interruption::after { content: ''; flex: 1; height: 1px; background: var(--border); opacity: .55; }
.generation-interruption__label { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.generation-interruption__icon { width: 14px; height: 14px; stroke-width: 1.6; }
/* 续写段接在被续的回答下面，读起来是同一条回答：不再挂头像，操作栏只留在最后一段（t-20261011-s994） */
.msg-assistant:has(+ .msg-continuation) { margin-bottom: 0; }
.msg-assistant.msg-continuation { margin-top: 14px; }
.msg-assistant:has(+ .msg-continuation) > .msg-actions { display: none; }
.msg-assistant.msg-continuation > .msg-head > .klogo { display: none; }
/* Tool steps (t-20260927-fak8): one small "备课" pill per uninterrupted run.
   Running it is slightly muted; done it fades and softens until hovered or
   focused. The steps open in a popover on hover, focus or tap. */
.tool-activity-group {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  margin: 2px 0 8px;
  color: var(--faint);
  font-size: var(--fs-caption);
  line-height: 1.4;
}
.tool-activity-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(260px, 100%);
  height: 22px;
  padding: 0 9px 0 7px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface-subtle) 75%, transparent);
  color: var(--faint);
  line-height: 1;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: opacity .18s ease, filter .18s ease, border-color .18s ease, background-color .18s ease;
}
.tool-activity-pill::-webkit-details-marker { display: none; }
.tool-activity-pill::marker { content: ''; }
.tool-activity-title { flex: none; }
.tool-activity-now { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tool-activity-now::before { content: '·'; margin-right: 5px; color: var(--faint); opacity: .6; }
.tool-activity-now[hidden] { display: none; }
.tool-activity-now.is-failed { color: var(--danger); }
.tool-activity-group[data-state="running"] > .tool-activity-pill { opacity: .85; }
.tool-activity-group:is([data-state="done"], [data-state="error"]) > .tool-activity-pill { opacity: .55; filter: blur(.35px); }
.tool-activity-group:is(:hover, :focus-within, [open]) > .tool-activity-pill {
  opacity: 1;
  filter: none;
  border-color: var(--border);
  background: var(--surface);
}
.tool-activity-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-activity-mark {
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 12px;
  height: 12px;
}
.tool-activity-mark i { display: none; }
.tool-activity-mark[data-mark="running"]::before,
.tool-activity-mark[data-mark="running"]::after,
.tool-activity-mark[data-mark="running"] i {
  content: '';
  position: absolute;
  top: 4.5px;
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: tool-activity-dot 1.2s ease-in-out infinite;
}
.tool-activity-mark[data-mark="running"]::before { left: 0; }
.tool-activity-mark[data-mark="running"] i { left: 4.5px; animation-delay: .15s; }
.tool-activity-mark[data-mark="running"]::after { left: 9px; animation-delay: .3s; }
@keyframes tool-activity-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.tool-activity-mark[data-mark="done"]::before {
  content: '';
  width: 6px;
  height: 3px;
  border-bottom: 1.4px solid currentColor;
  border-left: 1.4px solid currentColor;
  transform: translateY(-1px) rotate(-45deg);
}
.tool-activity-mark[data-mark="error"]::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}
.tool-activity-pop {
  position: absolute;
  z-index: var(--z-menu);
  top: calc(100% + 5px);
  left: 0;
  min-width: 210px;
  max-width: min(290px, calc(100vw - 48px));
  max-height: 188px;
  overflow: auto;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.5;
  animation: tool-activity-pop-in .12s ease-out;
}
@keyframes tool-activity-pop-in { from { opacity: 0; transform: translateY(-2px); } }
.tool-activity-pop ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tool-activity-pop li { min-width: 0; }
/* A detail that does not fit beside its step drops to the next line, right-aligned. */
.tool-activity-row { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; min-width: 0; }
.tool-activity-row .tool-activity-mark { color: var(--faint); transform: translateY(2px); }
.tool-activity-label {
  flex: none;
  max-width: calc(100% - 18px);
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-activity-state {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tool-activity-detail {
  flex: none;
  margin-left: auto;
  padding-left: 18px;
  color: var(--faint);
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tool-activity-detail:empty { display: none; }
.tool-activity-group li[data-status="running"] .tool-activity-label,
.tool-activity-group li[data-status="running"] .tool-activity-mark { color: var(--accent-strong); }
/* 失败的一步只在步骤名旁显示一个红字「错误」，原因悬停看（t-20261014-wi0a） */
.tool-activity-group li[data-status="blocked"] .tool-activity-state {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  flex: none;
  color: var(--danger);
  font-size: var(--fs-caption);
}
@media (prefers-reduced-motion: reduce) {
  .tool-activity-mark[data-mark="running"]::before,
  .tool-activity-mark[data-mark="running"]::after,
  .tool-activity-mark[data-mark="running"] i { animation: none; opacity: .7; }
  .tool-activity-pill { transition: none; }
  .tool-activity-pop { animation: none; }
}
/* Markdown reading styles are owned by reading-content.css. */

.hl {
  background: var(--marker-soft);
  border-radius: var(--r-xs);
  padding: 0 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
[data-theme="dark"] .hl { color: var(--marker-ink); }

.api-answer-text { white-space: pre-wrap; }
/* T1 · 出处（htuw）：整条回答最后一行脚注小字，默认收起；展开后一份资料一行，页码是文字链。
   悬停页码出 T3 小玻璃浮层：页图缩略 + 摘录（阅读层衬线）+「在资料中打开」。 */
.msg-sources { position: relative; margin-top: 14px; color: var(--faint); font: 400 var(--fs-caption)/1.7 var(--font-sans); font-variant-numeric: tabular-nums; }
.msg-sources__line { display: flex; align-items: baseline; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.msg-sources__line > b { flex: none; color: var(--muted); font-weight: 600; }
.msg-sources__line:hover > b { color: var(--ink); }
.msg-sources__sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-sources__sum i { margin: 0 6px; color: var(--border-strong); font-style: normal; }
.msg-sources__chev { flex: none; width: 13px; height: 13px; align-self: center; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 150ms ease; }
.msg-sources.is-open .msg-sources__chev { transform: rotate(90deg); }
.msg-sources__rows { display: grid; gap: 2px; margin: 4px 0 0 32px; }
.msg-sources__rows[hidden] { display: none; }
.msg-sources__row { display: flex; flex-wrap: wrap; column-gap: 8px; }
.msg-sources__name { color: var(--muted); overflow-wrap: anywhere; }
.msg-sources__page { padding: 0 1px; border: 0; border-radius: 3px; background: none; color: var(--faint); font: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; cursor: pointer; }
.msg-sources__page:hover, .msg-sources__page:focus-visible, .msg-sources__page.is-hot { color: var(--accent-strong); text-decoration-color: currentColor; }
.msg-sources__page.is-hot { background: var(--accent-soft); }
.msg-sources__pop { position: absolute; z-index: var(--z-scroll-pop); width: min(300px, 100%); overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); box-shadow: var(--shadow-pop); animation: msg-sources-pop 140ms cubic-bezier(.2, .8, .2, 1); }
@keyframes msg-sources-pop { from { opacity: 0; transform: translateY(-2px); } }
.msg-sources__thumb { height: 120px; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.msg-sources__thumb img { display: block; width: 100%; height: auto; }
.msg-sources__pop-body { padding: 10px 14px 12px; }
.msg-sources__pop-src { display: flex; align-items: baseline; gap: 6px; }
.msg-sources__pop-src b { min-width: 0; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.msg-sources__pop-src span { flex: none; color: var(--faint); }
.msg-sources__pop blockquote { display: -webkit-box; margin: 6px 0 8px; overflow: hidden; color: var(--reading-ink); font-family: var(--reading-book); font-size: 14px; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.msg-sources__open { padding: 0; border: 0; background: none; color: var(--accent-strong); font: 600 var(--fs-caption)/1.5 var(--font-sans); cursor: pointer; }
.msg-sources__open::after { content: ' →'; font-weight: 400; }
@media (prefers-reduced-motion: reduce) { .msg-sources__pop { animation: none; } .msg-sources__chev { transition: none; } }
.onboarding-choices { margin: 4px 0 8px 0; }

/* T2 · 答题纸（htuw）：白纸 + 1px 线 + 一个主按钮。纸里不再套框：题与题之间一道细线。
   模型写的字（题干、选项、讲评）走阅读层衬线；纸上的标签、判分、按钮走品牌层黑体。 */
.api-questionnaire {
  max-width: 720px;
  margin: 14px 0 10px 0;
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);}
.api-questionnaire-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.api-questionnaire-head strong { color: var(--muted); font-size: var(--fs-caption); font-weight: 600; }
.api-questionnaire-head span { color: var(--muted); font-size: var(--fs-caption); }
/* Questions run top to bottom in every panel; two side by side read as
   unrelated cards and squeeze the narrower one. */
.api-questionnaire-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.api-question-section { min-width: 0; margin: 0; padding: 8px 0 4px; border: 0; border-radius: var(--r-sm); background: transparent; }
.api-question-section + .api-question-section { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--border); border-radius: 0; }
.api-question-section:disabled { opacity: 0.78; }
.api-question-section.is-flash { animation: kp-flash 1.2s ease; }
/* 题干是 fieldset 的可访问名称，也是完整的块级 Markdown 容器。 */
.api-question-stem { min-width: 0; max-width: 100%; margin: 0 0 10px; color: var(--reading-ink); font-family: var(--reading-book); font-size: 16px; font-weight: 400; line-height: 1.8; overflow-wrap: anywhere; }
.api-question-stem > :is(p, ul, ol, pre) { margin-block: 0; }
.api-question-stem > * + * { margin-top: .65em; }
.api-question-stem :is(ul, ol) { padding-inline-start: 1.55em; }
.api-question-stem li + li { margin-top: .22em; }
.api-question-stem li::marker { color: var(--reading-heading); font-weight: 600; }
.api-question-stem pre { max-width: 100%; margin: .35em 0; padding: 12px 14px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--reading-rule); border-radius: var(--r-sm); background: color-mix(in srgb, var(--reading-canvas) 48%, transparent); font: .88em/1.65 var(--font-mono); }
.api-question-stem pre code { padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; white-space: pre; }
.api-question-stem .math-display { margin-block: .1em; text-align: center; }
.api-question-stem .math-display > .katex-display { width: max-content; min-width: 100%; }
.api-question-stem .markdown-table-wrap { max-width: 100%; }
.api-question-field > span { display: block; margin-bottom: 7px; color: var(--ink); font-size: var(--fs-ui); font-weight: 600; }
/* 题干、选项、讲评里的行内代码：和正文同一套阅读层样式 */
.api-question-section :is(.api-question-stem, .option-text, .api-quiz-explanation, .api-quiz-feedback) code { padding: .1em .3em; border-radius: 4px; background: color-mix(in srgb, var(--reading-canvas) 48%, transparent); color: var(--reading-ink); font-family: var(--font-mono); font-size: .88em; }
.api-question-section :is(.api-question-stem, .option-text) .math-inline { vertical-align: -.12em; }
.api-question-field { display: block; }
.api-question-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.api-question-field input:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.api-question-options { display: flex; flex-wrap: wrap; gap: 8px; }
.api-question-option { position: relative; cursor: pointer; }
.api-question-option input { position: absolute; opacity: 0; pointer-events: none; }
.api-question-option .option-text { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.api-question-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* An option card's choice has no letter key: a title over an optional
   quieter subtitle. A survey card's "Other" line takes a whole row, and its
   box is the answer itself, so it opts out of the hidden-control rule above. */
.api-question-option.is-keyless { grid-template-columns: minmax(0, 1fr); }
.api-question-option .option-title,
.api-question-option .option-subtitle { display: block; }
.api-question-option .option-subtitle { margin-top: 2px; color: var(--muted); font-size: var(--fs-caption); line-height: var(--lh-ui); }
.api-question-other { width: 100%; }
.api-question-other .api-question-other-text {
  position: static;
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-ui);
  cursor: text;
  opacity: 1;
  pointer-events: auto;
}
.api-question-other .api-question-other-text::placeholder { color: var(--faint); }
.api-question-other .api-question-other-text:focus { border-color: var(--accent); }
.api-question-other:has(.api-question-other-text:focus) { outline: none; }
.api-questionnaire-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.api-questionnaire-status { color: var(--muted); font-size: var(--fs-caption); }
.api-questionnaire.is-submitting { opacity: 0.82; }
.api-questionnaire.is-saved { background: var(--surface); }
.api-question-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.api-question-saved { margin-top: 10px; color: var(--muted); font-size: var(--fs-caption); }
/* 完成卡上导师的收尾说明 */
.api-question-saved.is-submitted {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 5px 10px 5px 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1;
}
.api-question-saved.is-submitted::before {
  content: '✓';
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-size: var(--fs-caption);
  font-weight: 600;
}
.api-question-saved.quiz-verdict { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: var(--fs-ui); font-weight: 600; }
.api-question-saved.quiz-verdict.is-correct { color: var(--success); }
.api-question-saved.quiz-verdict.is-incorrect { color: var(--danger); }
/* 简答：答题线。标签在左，横线上写答案 */
.api-quiz-short-field { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.api-quiz-short-field > span { flex: none; color: var(--muted); font-size: var(--fs-caption); font-weight: 600; }
.api-quiz-short-field input { flex: 1; min-width: 0; min-height: 34px; padding: 4px 2px; border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font-size: var(--fs-body); }
.api-quiz-short-field input:focus { border-bottom-color: var(--accent); box-shadow: inset 0 -1px 0 var(--accent); outline: none; }
.api-quiz-short-answer {
  margin-top: 10px;
  padding: 4px 2px 6px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.6;
  overflow-wrap: anywhere;
  /* 分空作答交的是每空一行的一段文字，回显照原文分行 */
  white-space: pre-line;
}
.api-quiz-short-answer strong { margin-right: 8px; color: var(--muted); font-size: var(--fs-caption); }
.api-quiz-feedback { display: block; margin-top: 6px; color: var(--reading-ink); font-family: var(--reading-book); font-size: 15px; font-weight: 400; line-height: 1.8; }
.api-quiz-explanation { margin-top: 6px; color: var(--reading-ink); font-family: var(--reading-book); font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
/* 「答案与解析」里的答案行（rmm2）：标签是界面字，答案是阅读层衬线 */
.api-quiz-choice-result { margin-top: 8px; color: var(--reading-ink); font-family: var(--reading-book); font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; }
.api-quiz-choice-result strong { margin-right: 8px; color: var(--muted); font: 600 var(--fs-caption)/1.5 var(--font-sans); }
.api-quiz-commentary {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.api-quiz-commentary summary { color: var(--accent-strong); cursor: pointer; font-size: var(--fs-ui); font-weight: 600; }
.api-quiz-commentary-body { margin-top: 8px; color: var(--reading-ink); font-family: var(--reading-book); font-size: 15px; line-height: 1.8; }
/* 一组交完：一道细线下写「这组对了 N 题」+ 方格条，答错的知识点是文字链「回看 X」 */
.api-quiz-summary { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.api-quiz-summary strong { display: block; color: var(--ink); font-size: var(--fs-ui); }
.api-quiz-summary p { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-ui); line-height: 1.5; }
.api-quiz-summary__review { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.api-quiz-summary__link, .stage-transition-action { display: inline-flex; align-items: baseline; gap: 4px; padding: 0; border: 0; background: none; color: var(--accent-strong); font: 600 var(--fs-ui)/1.5 var(--font-sans); white-space: nowrap; cursor: pointer; }
.api-quiz-summary__link::after, .stage-transition-action::after { content: '→'; font-weight: 400; transition: transform 140ms ease; }
.api-quiz-summary__link:hover::after, .stage-transition-action:hover::after { transform: translateX(2px); }
.api-quiz-summary__link:disabled, .stage-transition-action:disabled { color: var(--faint); cursor: default; }
/* 纸上的次要动作：淡底气泡（「一起看这题的思路」「查看讲解」） */
.paper-bub { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--muted); font: 600 var(--fs-ui)/1 var(--font-sans); white-space: nowrap; cursor: pointer; transition: background-color .2s linear, color .2s linear; }
.paper-bub:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 11%, transparent); color: var(--ink); }
.paper-bub:disabled { opacity: .6; cursor: default; }

@media (max-width: 720px) {
  .api-questionnaire { margin-left: 0; padding: 15px; }
  .api-questionnaire-foot { align-items: stretch; flex-direction: column; }
}

.unverified-note {
  font-size: var(--fs-ui);
  color: var(--muted);
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
}

/* 旁问符号（#ic-aside）：圆角对话气泡里一个问号，描边 1.5 */
.i-aside { stroke-width: 1.5; }

/* 逐句旁问：每条助手消息正文右侧留 32px 页边，记号在消息里绝对定位、随内容滚动。
   指针停在正文上 100ms 后出现，吸附到指针所在行的中线；离开 150ms 后淡出；滚动时立即隐藏。
   无字、无框、无影：静止淡灰，悬停淡蓝圆底。只在精确指针、宽于 720px 时出现。 */
.aside-mark {
  position: absolute;
  z-index: var(--z-scroll-mark);
  top: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--faint);
  display: none;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 150ms ease, top 80ms ease-out, background-color 120ms ease, color 120ms ease;
}
.aside-mark .icon { width: 18px; height: 18px; }
.aside-mark.is-on { opacity: 1; pointer-events: auto; transition: opacity 120ms ease, top 80ms ease-out, background-color 120ms ease, color 120ms ease; }
.aside-mark:hover, .aside-mark:focus-visible { background: var(--accent-soft); color: var(--accent); }
.aside-mark:active { color: var(--accent-strong); }
@media (min-width: 721px) and (pointer: fine) {
  .chat-inner .msg-assistant { padding-right: 32px; }
  .aside-mark { display: grid; }
}

/* 旁问摘录句的底线（t-20261006-vcw6；t-20261026-wybz 整合改成按行画，workspace.js drawQuoteLines）：不动正文 DOM，
   一行一道挂在对话正文里。本课程所有带摘录的旁问常驻一道 accent 70% 的线；正在看的那条、指针停着的那条用 accent 100%。
   同一行里的字和行内公式连成一道笔画，碰到分式在它底下兜过去 */
.chat-inner .msg-body { text-underline-offset: 3px; }
.aside-quote-lines { position: absolute; left: 0; top: 0; z-index: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.aside-quote-line { fill: none; stroke: color-mix(in srgb, var(--accent) 70%, transparent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aside-quote-line:is(.is-current, .is-hover) { stroke: var(--accent); }

/* ChatGPT 式图标动作行 */
.msg-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; }
.ma-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ma-btn:hover { background: var(--surface-subtle); color: var(--ink); }
.ma-btn .icon { width: 16px; height: 16px; }
.ma-btn-text { width: auto; display: inline-flex; grid-auto-flow: column; gap: 6px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-caption); font-weight: 600; }
/* 「旁问」和复制同级：无框，图标加两个字 */
.ma-btn-text[data-act="aside"],
.ma-btn-text[data-act="wrong"],
.ma-btn-text[data-act="continue"] { padding: 0 8px; border-radius: var(--r-sm); }
.ma-btn:disabled { opacity: .45; cursor: default; }
.ma-btn:disabled:hover { background: none; color: var(--faint); }
.ma-btn-text[data-act="feedback"] { border: 1px solid var(--border); background: transparent; color: var(--muted); }
.ma-btn-text[data-act="feedback"]:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.rlhf-note-dialog textarea { resize: vertical; min-height: 96px; }
.rlhf-note-dialog select { min-height: 42px; }
.rlhf-note-dialog [role="alert"] { min-height: 20px; margin: 0; color: var(--danger); font-size: var(--fs-caption); }
/* 选中文字后的「旁问」药丸：挂在聊天内容（.chat-inner）里，随内容滚动 */
.selection-aside {
  position: absolute; z-index: var(--z-scroll-pop); height: 32px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-pop);
  font: var(--fs-ui)/1 var(--font-sans); cursor: pointer;
}
.selection-aside[hidden] { display: none; }
.selection-aside .icon { width: 16px; height: 16px; }
.selection-aside:hover { background: var(--accent-soft); border-color: var(--accent); }
@media (pointer: coarse) {
  .selection-aside.is-touch {
    position: fixed;
    justify-content: center;
    inset: auto 12px max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    height: 42px;
    border-color: var(--accent);
    background: var(--accent-strong);
    color: var(--on-accent);
    font-weight: 600;
  }
}

/* ---------- Quiz ---------- */
.api-question-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  min-height: 44px;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: var(--lh-ui);
  text-align: left;
  cursor: pointer;
}
.opt-key { width: 20px; color: var(--muted); font: 600 var(--fs-caption)/1.5 var(--font-sans); flex: none; }

.api-question-option.is-selected, .api-question-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent); }
.api-question-option:hover { border-color: var(--accent); }
.api-question-options.options-long { flex-direction: column; align-items: stretch; }
.options-long > .api-question-option { width: 100%; }
/* 小测的选项是答题纸上的一行：作答圈 + 字母 + 选项（阅读层衬线）+ 判后小标 */
.api-question-section[data-block-type="quiz"] .api-question-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.api-question-section[data-block-type="quiz"] .api-question-option {
  grid-template-columns: 16px 16px minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px 12px;
  color: var(--reading-ink);
  font-family: var(--reading-book);
  font-size: 15px;
  line-height: 1.55;
}
.api-question-section[data-block-type="quiz"] .api-question-option::before { content: ''; box-sizing: border-box; width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); }
.api-question-section[data-block-type="quiz"] .api-question-option:has(> input[type="checkbox"])::before { border-radius: var(--r-xs); }
.api-question-section[data-block-type="quiz"] .api-question-option :is(.opt-key) { width: auto; }
.api-question-section[data-block-type="quiz"]:not(:disabled) .api-question-option.is-selected,
.api-question-section[data-block-type="quiz"]:not(:disabled) .api-question-option:has(input:checked) { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); color: var(--reading-ink); }
.api-question-section[data-block-type="quiz"]:not(:disabled) .api-question-option:has(input:checked)::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3.5px var(--surface); }
/* 判后原位标对错：只看判分结果，不再沿用作答时的蓝色选中 */
.api-question-option__tag { font: 600 var(--fs-caption)/1 var(--font-sans); white-space: nowrap; }
.api-question-section[data-block-type="quiz"] .api-question-option.is-right { border-color: var(--success); background: var(--surface); box-shadow: inset 0 0 0 1px var(--success); }
.api-question-section[data-block-type="quiz"] .api-question-option.is-wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.api-question-section[data-block-type="quiz"] .api-question-option.is-right::before { border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 3.5px var(--surface); }
.api-question-section[data-block-type="quiz"] .api-question-option.is-wrong::before { border-color: var(--danger); background: var(--danger); box-shadow: inset 0 0 0 3.5px var(--surface); }
.api-question-section[data-block-type="quiz"]:disabled .api-question-option { color: var(--reading-ink); }
.api-question-option.is-right .api-question-option__tag { color: var(--success); }
.api-question-option.is-wrong .api-question-option__tag { color: var(--danger); }
/* 再选一次（htuw）：标出第一次的选择；单选那项已不能再选，灰掉划线；多选那组仍可勾选，只标虚线 */
.api-question-section[data-block-type="quiz"] .api-question-option.is-retired { background: var(--surface-subtle); border-style: dashed; }
.api-question-section[data-block-type="quiz"] .api-question-option.is-retired:has(input:disabled) { color: var(--faint); cursor: not-allowed; }
.api-question-section[data-block-type="quiz"] .api-question-option.is-retired:has(input:disabled) .option-text { text-decoration: line-through; }
.api-question-option.is-retired .api-question-option__tag { color: var(--muted); }

/* ---------- Survey card ----------
   Each survey question is its own card as wide as the reply text; every
   choice is one kind of small square box, two columns when all are short. The head is small print so the questions lead.
   workspace.js marks only panels without a quiz, plan confirmation or plan
   revision is-survey; those keep the look above. */
.api-questionnaire.is-survey:not(.aside-interaction-card) {
  max-width: none;
  margin: 10px 0 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-questionnaire-head { margin: 0 0 6px 2px; gap: 0; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-questionnaire-head strong { color: var(--muted); font-size: var(--fs-caption); font-weight: 600; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-questionnaire-head span { color: var(--faint); font-size: var(--fs-caption); }
/* 每道题是一张独立的窄卡，卡与卡之间留空，不再是一张大纸里用线分隔 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-questionnaire-grid { display: flex; flex-direction: column; gap: 10px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section,
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section + .api-question-section {
  position: relative;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: none;
}
/* 一次露出一张：前面的题答了（或跳过），后面的才出现（workspace.js setupSurveyReveal） */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section.is-survey-later { display: none; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section.is-survey-in { animation: survey-card-in 260ms ease-out both; }
@keyframes survey-card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section.is-survey-in { animation: none; }
}
/* 题型小标签在题干右上角：小号、低对比；跳过后换成「已跳过」 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-meta { position: absolute; top: 11px; right: 12px; font: 400 12px/1.4 var(--font-sans); }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-kind { color: var(--faint); }
/* 卡内右下角一排：提示（回车下一题）、跳过、下一题；最后一张是整组唯一的「提交」 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 28px; margin-top: 10px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-hint { margin-right: auto; color: var(--faint); font-size: 12px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-hint:empty { display: none; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-skip { padding: 4px 8px; border: 0; border-radius: var(--r-xs); background: none; color: var(--muted); font: 400 12px/1.4 var(--font-sans); cursor: pointer; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-skip:hover { color: var(--accent-strong); }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-skip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .survey-actions [hidden] { display: none; }
/* 跳过的卡不折叠，整卡转淡灰：题干、选项、边框都降到低对比，点选项重新作答后恢复 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section.is-skipped { border-color: var(--border); background: var(--surface-subtle); }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section.is-skipped :is(.api-question-stem, .api-question-field > span, .api-question-option, .option-subtitle) { color: var(--faint); }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section.is-skipped .api-question-option { border-color: var(--border); background: transparent; }
/* 已发出：整组转淡灰，只有选中项留主色，不可交互；组尾一个对勾，不写字 */
.api-questionnaire.is-survey.is-saved:not(.aside-interaction-card) .api-question-section { opacity: 1; border-color: var(--border); background: var(--surface-subtle); }
.api-questionnaire.is-survey.is-saved:not(.aside-interaction-card) :is(.api-question-stem, .api-question-field > span) { color: var(--muted); }
.api-questionnaire.is-survey.is-saved:not(.aside-interaction-card) .api-question-option:not(.is-selected) { border-color: var(--border); background: transparent; color: var(--faint); }
.api-questionnaire.is-survey.is-saved:not(.aside-interaction-card) .api-question-field input,
.api-questionnaire.is-survey.is-saved:not(.aside-interaction-card) .api-question-other-text { color: var(--muted); }
.survey-sent { display: flex; justify-content: flex-end; margin-top: 6px; color: var(--faint); }
.survey-sent svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* The stem is a plain heading here: a floated legend lays out inside the
   fieldset like any block. A free-text question's stem is its field label. */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section > legend { float: left; width: 100%; padding: 0; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section > legend + * { clear: both; }
/* 题干比正文小一号，右侧留出标签与「跳过」的位置 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-stem,
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-section > legend,
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-field > span {
  margin: 0 0 8px;
  padding-right: 64px;
  color: var(--reading-ink);
  font-family: var(--reading-book);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
}
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-field + .api-question-field { margin-top: 10px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-field input { min-height: 40px; padding: 8px 12px; font-size: 14px; }
/* 选项只有一种样式：小圆角方框。都较短时排两列，有长选项（options-long）时一列 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-options.options-long { grid-template-columns: minmax(0, 1fr); }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-option.is-keyless {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  width: 100%;
  min-height: 40px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.4;
}
.api-questionnaire.is-survey:not(.aside-interaction-card) .option-title { font-weight: 400; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .option-subtitle { margin-top: 1px; font-size: 12px; line-height: 1.4; }
/* 「其他」独占一行：虚线框里写自己的答案 */
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-options > .api-question-other.is-keyless {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  grid-column: 1 / -1;
  width: 100%;
  padding: 4px 12px;
  border-radius: var(--r-sm);
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--muted);
}
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-other .api-question-other-text { min-height: 30px; padding: 4px 2px; border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0; background: transparent; font-size: 14px; }
.api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-other .api-question-other-text:focus { border-bottom-color: var(--accent); }
@media (max-width: 520px) {
  .api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-options { grid-template-columns: minmax(0, 1fr); }
  .api-questionnaire.is-survey:not(.aside-interaction-card) .api-question-options > .api-question-other.is-keyless { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
}
/* In the aside a survey card holds one question and its own send button:
   the same rows and bubbles, sized for the narrow pane, unnumbered. */
.aside-interaction-card.is-survey .api-question-field input { min-height: 44px; padding: 10px 12px; font-size: var(--fs-ui); }
.aside-interaction-card.is-survey .api-question-option.is-keyless {
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: var(--fs-body);
  line-height: var(--lh-ui);
}
.aside-interaction-card.is-survey .api-question-option.is-keyless::before {
  content: '';
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--surface);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1;
}
.aside-interaction-card.is-survey .api-question-option.is-keyless:has(> input[type="checkbox"])::before { border-radius: var(--r-xs); }
.aside-interaction-card.is-survey .api-question-option.is-keyless:has(> input:checked)::before { border-color: var(--accent); background: var(--accent); }
.aside-interaction-card.is-survey .api-question-option.is-keyless:has(> input[type="radio"]:checked)::before { box-shadow: inset 0 0 0 3.5px var(--surface); }
.aside-interaction-card.is-survey .api-question-option.is-keyless:has(> input[type="checkbox"]:checked)::before { content: '✓'; }
.aside-interaction-card.is-survey .option-title { font-weight: 400; }
.aside-interaction-card.is-survey .option-subtitle { font-size: var(--fs-caption); }
.aside-interaction-card.is-survey .api-question-other.is-keyless { grid-template-columns: 18px auto minmax(0, 1fr); align-items: center; padding-block: 5px; border-style: dashed; border-color: var(--border-strong); color: var(--muted); }
.aside-interaction-card.is-survey .api-question-other.is-keyless::before { margin-top: 0; }
.aside-interaction-card.is-survey .api-question-other .api-question-other-text { min-height: 30px; padding: 4px 2px; border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0; background: transparent; font-size: var(--fs-ui); }
.aside-interaction-card.is-survey .api-question-other .api-question-other-text:focus { border-bottom-color: var(--accent); }
.aside-interaction-card.is-survey { padding: 14px 14px 12px; }
.aside-interaction-card.is-survey + .aside-interaction-card.is-survey { margin-top: 10px; }
.aside-interaction-card.is-survey > legend {
  float: left;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  color: var(--reading-ink);
  font-family: var(--reading-book);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.7;
}
.aside-interaction-card.is-survey > legend + * { clear: both; }
.aside-interaction-card.is-survey > .api-question-option + .api-question-option { margin-top: 8px; }
.aside-interaction-card.is-survey .api-question-field > span { font-size: var(--fs-ui); }
.api-questionnaire.aside-interaction-card.is-survey .api-question-field:first-child > span::before { content: none; }
.aside-interaction-card.is-survey .api-question-other.is-keyless { grid-template-columns: 18px minmax(0, 1fr); row-gap: 8px; }
.aside-interaction-card.is-survey .api-question-other .api-question-other-text { grid-column: 2; }
.aside-interaction-card.is-survey > .btn { margin-top: 12px; }

/* ---------- 反馈：比推荐问题更轻，避免两排同形胶囊竞争 ---------- */
.block-feedback { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 30px; }
.block-feedback > .caption:first-child { margin-right: 4px; }
.block-feedback .chip {
  height: 28px;
  padding-inline: 9px;
  border-color: transparent;
  border-radius: var(--r-sm);
  background: transparent;
}
.block-feedback .chip:hover { border-color: var(--border); background: var(--surface-subtle); }
.block-feedback .chip.is-selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.fb-note { color: var(--muted); }

/* T1 · 建议动作：学生下一句可能想说的话，靠右淡底气泡，不用蓝色、不画描边 */
.next-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 12px 0 18px;
}
.next-actions[hidden] { display: none; }
.next-action { max-width: 100%; min-height: 34px; padding: 6px 14px; border: 0; border-radius: var(--r-md); background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); font: 400 var(--fs-ui)/1.5 var(--font-sans); text-align: left; overflow-wrap: anywhere; cursor: pointer; transition: background-color .2s linear; }
.next-action:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); }

/* ---------- 输入区 ---------- */
.center > .composer {
  position: relative;
  z-index: 4;
  flex: none;
  margin-top: calc(-1 * var(--composer-overlap));
  padding: var(--composer-overlap) 28px 14px;
  background: none;
}
/* The transparent overlap lets the lesson remain visible beside the floating
   back-to-latest button. Only the composer's controls take pointer input. */
.center > .composer { pointer-events: none; }
.center > .composer > * { pointer-events: auto; }
.composer-inner { max-width: 760px; margin: 0 auto; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

@media (max-width: 620px) {
  .change-dock__body { max-height: 44vh; }
}

.staged-answers {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 9px;
  padding: 9px 10px;
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-md);
  background: var(--accent-soft);
}
.staged-answers[hidden] { display: none; }
.staged-answers::before { content: "准备发送"; color: var(--accent-strong); font-size: var(--fs-caption); font-weight: 600; }
.staged-answer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-caption);
  box-shadow: inset 0 0 0 1px var(--border);
}
.staged-answer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staged-answer button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }

/* 附件（t-20261006-ma8h）：准备发送里的附件卡、学生气泡和简答回显里的附件，同一个形状 */
.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attachment-list[hidden] { display: none; }
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px 4px 4px;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-caption);
  box-shadow: inset 0 0 0 1px var(--border);
}
.attachment-chip.staged-answer { border-radius: var(--r-sm); padding: 4px 8px 4px 4px; }
.attachment-chip.is-zoomable { cursor: zoom-in; }
.attachment-chip.is-zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.attachment-chip.is-failed { box-shadow: inset 0 0 0 1px var(--danger); }
.attachment-chip__thumb { width: 32px; height: 32px; flex: none; border-radius: var(--r-xs); object-fit: cover; background: var(--canvas); }
.attachment-chip__glyph {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 15px;
}
.attachment-chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip__status { flex: none; color: var(--muted); }
.attachment-chip.is-failed .attachment-chip__status { color: var(--danger); }
/* 读不到的文件（Mac 系统权限）：说明较长，跟着「开权限」换行，不撑出输入框 */
.attachment-chip__status:has(.link-btn), .staged-answer .attachment-chip__status:has(.link-btn) { flex: 0 1 auto; min-width: 0; overflow: visible; white-space: normal; }
.attachment-chip__status .link-btn { font-size: inherit; }
.attachment-chip__remove { flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.msg-user .attachment-list { justify-content: flex-end; }
.api-quiz-short-attachments { margin: 0 0 8px; }

.composer-box {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 12px 12px 8px;
  min-height: 110px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.composer-box textarea {
  display: block;
  width: 100%;
  max-height: 180px;
  min-height: 48px;
  border: 0;
  outline: none;
  background: none;
  resize: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  line-height: 1.6;
}
.composer-box textarea::placeholder { color: var(--faint); }
.composer-box textarea:disabled { cursor: not-allowed; color: var(--muted); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.composer-actions { display: flex; align-items: center; gap: 6px; }
.composer-actions > .btn:not([hidden]) { animation: composer-action-in 140ms ease-out; }
.composer-generation-busy[disabled] { opacity: 1; cursor: progress; }
.composer-generation-busy .icon-generation-stop { display: none; }
.composer-generation-busy:not([disabled]):is(:hover, :focus-visible) .icon-generation-spinner { display: none; }
.composer-generation-busy:not([disabled]):is(:hover, :focus-visible) .icon-generation-stop { display: block; }
@media (hover: none) {
  .composer-generation-busy:not([disabled]) .icon-generation-spinner { display: none; }
  .composer-generation-busy:not([disabled]) .icon-generation-stop { display: block; }
}
.icon-generation-spinner {
  animation: composer-generation-spin 800ms linear infinite;
  stroke-dasharray: 36 16;
  transform-origin: center;
}
@keyframes composer-action-in {
  from { opacity: .55; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes composer-generation-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .composer-actions > .btn:not([hidden]) { animation: none; }
  .icon-generation-spinner { animation: none; }
}
@media (max-width: 720px), (hover: none), (pointer: coarse) {
  .keyboard-shortcut-hint { display: none !important; }
}

/* 流式光标 */
.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  border-radius: var(--r-xs);
  background: var(--accent);
  opacity: 0.55;
  animation: kp-caret 1.2s steps(2) infinite;
}
@keyframes kp-caret { 50% { opacity: 0.12; } }

/* ---------- 右侧：浏览器式窗口标签 ---------- */
.rp {
  position: relative;
  width: var(--right-panel-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--canvas);}
.rp-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -6px;
  z-index: 4;
  width: 12px;
  border: 0;
  outline: none;
  cursor: col-resize;
  touch-action: none;
}
.rp-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  background: transparent;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}
.rp-resizer:hover::before,
.rp-resizer:focus-visible::before,
body.is-resizing-right .rp-resizer::before {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
body.is-resizing-right { cursor: col-resize; user-select: none; }
body.is-resizing-right * { cursor: col-resize !important; }

.rp-tabbar {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: none;
  padding: 6px 6px 0 8px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  transition: background-color 180ms ease, border-color 180ms ease;
}
.rp-primary-tabs {
  display: flex;
  flex: none;
  gap: 3px;
  padding: 7px 8px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}
.rp-primary-tabs[hidden], .rp-primary-tab[hidden] { display: none; }
.rp-primary-tab {
  position: relative;
  display: inline-flex;
  flex: 0 1 140px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: transparent;
  color: var(--muted);
  font: 600 var(--fs-caption)/1 var(--font-sans);
  cursor: pointer;
}
.rp-primary-tab .icon { width: 16px; height: 16px; flex: none; }
.rp-primary-tab:hover { background: color-mix(in srgb, var(--surface) 72%, transparent); color: var(--ink); }
.rp-primary-tab.is-on { margin-bottom: -1px; border-color: var(--border); border-bottom-color: var(--surface); background: var(--surface); color: var(--accent-strong); }
.rp-primary-tab:focus-visible { z-index: 1; outline: 2px solid var(--accent); outline-offset: -2px; }
.rp-primary-tabs ~ .rp-section .rp-section-resizer { display: none; }
.wtab-strip {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.wtab-strip::-webkit-scrollbar { display: none; }

.wtab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 12px;
  max-width: 160px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: none;
  color: var(--muted);
  font-size: var(--fs-ui);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
  transition: color 140ms ease, background-color 140ms ease, transform 140ms ease;
}
.wtab:hover { color: var(--ink); background: var(--surface-subtle); }
.wtab.is-on {
  background: var(--canvas);
  border-color: var(--border);
  color: var(--ink);
  font-weight: 600;
  box-shadow: none;
}
.wtab.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
}
.wtab-label { overflow: hidden; text-overflow: ellipsis; }
.wtab > .i-aside { width: 15px; height: 15px; flex: none; }
.wtab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--marker);
  margin-right: 4px;
  flex: none;
  animation: kp-pulse 1.6s ease-in-out infinite;
}
.board-update-notice {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: 600 var(--fs-ui)/1.4 var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.wtab-close {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  border-radius: var(--r-xs);
  color: var(--faint);
  flex: none;
}
.wtab-close:hover { background: var(--border); color: var(--ink); }
.wtab-close svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.wtab:focus-visible,
.rp-collapse:focus-visible,
.drawer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.rp-collapse { flex: none; margin: 0 0 4px 2px; }
.board-focus-toggle { flex: none; margin: 0 0 4px auto; font-size: var(--fs-body); }

/* 右栏三段（t-20261022-by3s）：笔记、资料、旁问各有标签条和正文，开着几段就上下平分；上下次序固定为笔记、资料、旁问 */
.rp-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.rp-section { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; }
.rp-section[hidden] { display: none; }
.rp-section[data-view="notes"] { order: 1; }
.rp-section[data-view="materials"] { order: 2; }
.rp-section[data-view="aside"] { order: 3; }
.rp-section[data-view="aside"] { min-height: min(360px, 60%); }
.rp-section:not(.is-top) { border-top: 1px solid var(--border); }
/* 段与段之间的分界线可以上下拖（workspace.js）：下面那段顶上一条 8px 的热区，悬停或拖动时亮一道蓝线 */
.rp-section { position: relative; }
.rp-section-resizer { position: absolute; top: -5px; left: 0; right: 0; z-index: 3; height: 9px; cursor: row-resize; touch-action: none; }
.rp-section.is-top > .rp-section-resizer { display: none; }
.rp-section-resizer::before { content: ""; position: absolute; left: 12px; right: 12px; top: 3px; height: 2px; border-radius: 2px; background: transparent; transition: background-color 120ms ease; }
.rp-section-resizer:hover::before,
body.is-resizing-rows .rp-section-resizer::before { background: var(--accent); }
body.is-resizing-rows { cursor: row-resize; user-select: none; }
body.is-resizing-rows * { cursor: row-resize !important; }
body.is-resizing-rows iframe { pointer-events: none; }
.rp-section__body { flex: 1; overflow-y: auto; min-height: 0; }
.rp-section[data-view="aside"] > .rp-section__body { overflow: hidden; }
.rp-body > .board-focus-toggle { display: none; }
.rp-pane { display: none; padding: 14px; }
.rp-pane.is-on { display: block; animation: right-pane-enter 190ms cubic-bezier(.2,.8,.2,1); }
@keyframes right-pane-enter { from { opacity: .45; transform: translateX(6px); } to { opacity: 1; transform: none; } }

#pane-board.rp-pane.is-on {
  display: flex;
  height: 100%;
  min-height: 0;
}

/* 旧笔记与闪卡开关（t-20261009-my53）只管旧入口：课程摘要里的笔记行、标重点的「记进笔记」。
   右栏第一个标签换成小节笔记（t-20261021-uvpy），不受这个开关影响。 */
html:not([data-notes="on"]) #courseSummaryNotesRow,
html:not([data-notes="on"]) #markNoteView { display: none !important; }

/* 缩放按钮两种图标：右栏时是「放大」，窗口时是「缩回」 */
.board-focus-toggle__exit { display: none; }
.board-focus-toggle.is-expanded .board-focus-toggle__enter { display: none; }
.board-focus-toggle.is-expanded .board-focus-toggle__exit { display: block; }

/* 右栏是一块独立面板（t-20261021-uvpy，参照 Claude Code 的侧边面板）：和对话区之间留一道缝，
   自己有圆角、细边和很轻的阴影，底色比对话区的画布亮一档、往下淡回画布；标签条长在面板顶部里面。
   面板占的总宽仍是 --right-panel-w（面板 + 右侧和左侧的缝），知识地图窗口让出的宽度照旧对得上。 */
@media (min-width: 1024px) {
  .rp {
    --rp-gap: 8px;
    width: calc(var(--right-panel-w) - var(--rp-gap));
    margin: var(--rp-gap) var(--rp-gap) var(--rp-gap) 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: linear-gradient(180deg, var(--surface) 0, color-mix(in srgb, var(--surface) 45%, var(--canvas)) 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px -18px rgba(0, 0, 0, .28);
  }
  .rp-resizer { left: calc(-1 * var(--rp-gap) - 1px); width: var(--rp-gap); }
  .rp-resizer::before { left: calc(var(--rp-gap) / 2 - 1px); top: 12px; bottom: 12px; border-radius: 2px; }
  .rp-tabbar { border-radius: var(--r-md) var(--r-md) 0 0; background: transparent; }
  .rp-body { border-radius: 0 0 var(--r-md) var(--r-md); }
}
/* 标签条在面板里面：一行药丸标签（当前那个是淡墨色底），右边放大 / 缩小与关闭两个按钮，和标签垂直居中 */
.rp-tabbar { align-items: center; padding: 6px 6px 6px 8px; }
.rp-section-title { padding: 0 10px; color: var(--muted); font-size: var(--fs-ui); font-weight: 600; }
.wtab-strip { align-items: center; gap: 4px; }
.wtab { height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-sm); }
.wtab:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.wtab.is-on { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.wtab.is-on::after { content: none; }
/* 三个视图各自只显示自己的标签（workspace.js syncViewTabs）；资料一份都没开时资料视图是一行灰字 */
.wtab-strip .wtab[hidden] { display: none; }
.rp-empty.is-on { display: flex; align-items: center; justify-content: center; height: 100%; box-sizing: border-box; }
.rp-empty__hint { margin: 0; color: var(--muted); font-size: var(--fs-ui); }
.rp-collapse, .board-focus-toggle { margin-bottom: 0; }
.rp-tabbar > .note-agent-launcher { position: static; flex: none; width: 30px; height: 30px; margin-left: auto; box-shadow: none; }
.rp-tabbar > .note-agent-launcher + .board-focus-toggle { margin-left: 0; }

/* 放大只提升内容段，右栏始终留在同一个位置，保留相同的外框、宽度与分屏。 */
.rp-window-scrim { position: fixed; inset: var(--topbar-h) 0 0; z-index: calc(var(--z-dialog) - 2); background: var(--scrim); animation: rp-scrim-in 200ms ease; }
@keyframes rp-scrim-in { from { opacity: 0; } to { opacity: 1; } }
.sp-primary[hidden] { display: none; }
@media (min-width: 1024px) {
  .sp-primary {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    bottom: 8px;
    left: 16px;
    z-index: calc(var(--z-dialog) - 1);
    width: calc(100vw - var(--right-panel-w) - 24px);
    margin: 0;
  }
  /* 右栏没有别的段时不留右栏的位置，窗口铺满 */
  body.rp-collapsed .sp-primary { width: calc(100vw - 32px); }
  body.board-focus-mode #rightPanel { z-index: calc(var(--z-dialog) - 1); }
  .sp-primary .wtab { max-width: 240px; }
  /* 笔记正文链接的浮窗挂在 body 上，窗口开着时浮在窗口之上 */
  body.board-focus-mode .km-pop { z-index: var(--z-dialog); }
}

/* 笔记 —— 纸面文档，内容由可信模板渲染结构化数据 */
.board-doc {
  position: relative;
  background: var(--board-paper);
  border: 1px solid var(--board-border);
  border-radius: var(--r-md);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.board-scroll-area {
  container-type: inline-size;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.board-scroll-area:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.board-head { display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 10px; }
.board-head > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.board-head strong { font-size: var(--fs-ui); }
.board-view-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface-subtle); }
.board-view-switch button { min-height: 30px; padding: 4px 11px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-caption); cursor: pointer; white-space: nowrap; }
.board-view-switch button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--board-border); font-weight: 600; }
.board-view-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.flashcard-workspace { max-width: 760px; margin: 18px auto 30px; color: var(--ink); }
.flashcard-workspace__notice { margin: 0 0 10px; padding: 9px 11px; border: 1px solid var(--marker); border-radius: var(--r-sm); background: var(--marker-soft); color: var(--marker-ink); font-size: var(--fs-ui); }
.flashcard-workspace__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--muted); font-size: var(--fs-caption); }
.flashcard-workspace__header > div { display: flex; align-items: baseline; gap: 8px; }
.flashcard-workspace__scope { overflow: hidden; max-width: 32ch; text-overflow: ellipsis; white-space: nowrap; }
.flashcard-workspace__header strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.flashcard { display: grid; min-height: clamp(280px, 48vh, 520px); border: 1px solid var(--board-border); border-radius: var(--r-md); background: var(--board-paper); overflow: hidden; }
.flashcard__question { display: grid; place-content: center; gap: 12px; padding: clamp(28px, 7vw, 72px); text-align: center; }
/* 只是顶上「先在心里回答」那一行；题面里的公式（KaTeX 也是 span）不跟着缩小、变灰、变大写（t-20261007-6ziq） */
.flashcard__question > span { color: var(--muted); font-size: var(--fs-caption); text-transform: uppercase; }
.flashcard__question h3 { max-width: 22ch; margin: 0 auto; font-family: Georgia, "Times New Roman", "Noto Serif SC", serif; font-size: var(--fs-h1); font-weight: 600; line-height: 1.22; text-wrap: balance; }
.flashcard.is-revealed { grid-template-rows: auto 1fr; }
.flashcard.is-revealed .flashcard__question { place-content: initial; padding: 22px 26px 18px; border-bottom: 1px solid var(--border); text-align: left; }
.flashcard.is-revealed .flashcard__question h3 { max-width: none; margin: 0; font-size: var(--fs-h2); }
.flashcard__answer { padding: clamp(22px, 4vw, 38px); font-size: var(--fs-ui); line-height: 1.65; }
.flashcard-workspace__controls { display: grid; justify-items: center; gap: 11px; margin-top: 14px; }
.flashcard-workspace__reveal { min-width: min(100%, 280px); min-height: 46px; padding: 10px 22px; border: 0; border-radius: var(--r-md); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; }
.flashcard-workspace__ratings { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 8px; width: min(100%, 470px); }
.flashcard-rating { min-height: 44px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.flashcard-rating--again { border-color: var(--danger); color: var(--danger); }
.flashcard-rating--hard { border-color: var(--marker); color: var(--marker-ink); }
.flashcard-rating--good { border-color: var(--success); color: var(--success); }
.flashcard-workspace__reveal:hover, .flashcard-rating:hover { filter: brightness(.97); }
.flashcard-workspace__reveal:focus-visible, .flashcard-rating:focus-visible, .flashcard-workspace__navigation button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.flashcard-workspace__navigation { display: flex; gap: 16px; }
.flashcard-workspace__navigation button { padding: 4px 8px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-caption); cursor: pointer; }
.flashcard-workspace__empty { display: grid; gap: 6px; min-height: 240px; place-content: center; padding: 28px; border: 1px dashed var(--border); border-radius: var(--r-md); color: var(--muted); text-align: center; }
.flashcard-workspace__empty strong { color: var(--ink); font-size: var(--fs-h2); }
@container (max-width: 560px) {
  .board-head { align-items: stretch; flex-direction: column; }
  .board-view-switch { align-self: flex-start; }
  .flashcard-workspace { margin-top: 12px; }
  .flashcard-workspace__header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .flashcard-workspace__header > div { width: 100%; justify-content: space-between; }
  .flashcard-workspace__summary { line-height: 1.4; }
  .flashcard { min-height: 330px; border-radius: var(--r-md); }
  .flashcard__question { padding: 30px 18px; }
  .flashcard__question h3 { max-width: 12ch; font-size: var(--fs-h1); }
  .flashcard.is-revealed .flashcard__question { padding: 18px; }
  .flashcard__answer { padding: 20px 18px; }
  .flashcard-workspace__ratings { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .board-head { align-items: stretch; }
  .board-view-switch { align-self: flex-start; }
  .flashcard-workspace { margin-top: 12px; }
  .flashcard-workspace__header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .flashcard { min-height: 330px; border-radius: var(--r-md); }
  .flashcard__question { padding: 32px 20px; }
  .flashcard.is-revealed .flashcard__question { padding: 18px; }
  .flashcard__answer { padding: 20px 18px; }
  .flashcard-workspace__ratings { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .flashcard-workspace *, .flashcard-workspace *::before, .flashcard-workspace *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
#boardCornell { min-width: 0; }
.board-template { display: inline-flex; flex: none; max-width: 100%; padding: 2px; border: 1px solid var(--board-border); border-radius: var(--r-sm); background: var(--surface); }
.board-template button { min-height: 28px; border: 0; border-radius: var(--r-sm); background: none; color: var(--faint); padding: 4px 8px; font-size: var(--fs-caption); line-height: 1.2; white-space: nowrap; cursor: pointer; }
.board-template button.is-on { background: var(--accent-soft); color: var(--accent-strong); }

.board-status {
  padding: 10px 12px;
  border: 1px solid var(--board-border);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 76%, var(--board-paper));
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
}
.board-status.is-updating, .board-status.is-loading { border-color: var(--marker); color: var(--marker-ink); }
.board-status.is-failed, .board-status.is-conflict { border-color: var(--danger); color: var(--danger); }
.board-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.board-filters label { display: grid; gap: 4px; color: var(--faint); font-size: var(--fs-caption); }
.board-filters .input { min-width: 0; width: 100%; min-height: 34px; padding: 6px 26px 6px 8px; font-size: var(--fs-caption); }
#boardSecs { display: flex; flex-direction: column; gap: 18px; }
.board-sec h5 {
  position: relative;
  display: inline-block;
  font-size: var(--fs-ui);
  font-weight: 600;
  padding-bottom: 7px;
}
.board-sec h5::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 2px;
  height: 2px;
  width: 0;
  border-radius: var(--r-xs);
  background: var(--accent);
  transition: width 600ms ease;
}
.board-sec.done h5::after { width: 36px; }
.board-item-list { display: grid; gap: 9px; }
.board-item {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--board-border);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 68%, var(--board-paper));
}
.board-item[data-user-owned="true"] { border-left: 3px solid var(--accent); }
.board-item:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.board-item-meta, .board-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.board-badge {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--faint);
  font-size: var(--fs-caption);
 border: 1px solid var(--border); }
.board-badge.evidence-verified_material { color: var(--success); }
.board-badge.evidence-unsupported { color: var(--marker-ink); }
.board-item-content { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-ui); line-height: 1.7; }
.board-source {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--board-border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--accent-strong);
  font: inherit;
  font-size: var(--fs-caption);
  cursor: pointer;
}
.board-source:hover { border-color: var(--accent); }
.board-source:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.board-source:disabled { border-color: var(--board-border); background: var(--surface); color: var(--faint); cursor: not-allowed;  border: 1px solid var(--border); }
.board-src { margin-top: 5px; font-size: var(--fs-caption); color: var(--faint); }
.board-empty { padding: 24px 14px; border: 1px dashed var(--board-border); border-radius: var(--r-sm); color: var(--faint); font-size: var(--fs-ui); line-height: 1.65; text-align: center; }
.board-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; }
.board-doc.template-cornell #boardSecs { gap: 10px; }
.board-doc.template-cornell .board-sec {
  display: grid; grid-template-columns: minmax(84px, 0.8fr) minmax(0, 1.8fr);
  column-gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--board-border);
}
.board-doc.template-cornell .board-sec h5 { grid-column: 1; align-self: stretch; padding: 1px 12px 7px 0; border-right: 1px solid var(--board-border); line-height: 1.55; }
.board-doc.template-cornell .board-sec .board-item-list { grid-column: 2; }

/* 课件 */
.material-pane { min-height: 100%; }
.src-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.src-file .file-main { min-width: 0; }
.src-file .verified { margin-left: auto; }
.src-file > .icon { color: var(--faint); }
.verified { display: flex; align-items: center; gap: 4px; font-size: var(--fs-caption); color: var(--success); white-space: nowrap; }
.src-seg { margin-top: 14px; }
.src-loc { display: flex; align-items: center; justify-content: space-between; }
.seg-nav { display: flex; gap: 2px; }
.seg-text {
  margin: 10px 0 12px;
  padding: 13px 15px;
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: var(--fs-ui);
  line-height: 1.8;
 border: 1px solid var(--border); }
.seg-text:focus, .material-source-status:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.material-source-status { margin: 12px 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: var(--fs-caption); line-height: 1.6;  border: 1px solid var(--border); }
.material-source-status.is-unavailable { border: 1px solid var(--marker); color: var(--marker-ink); }
.seg-text mark { background: var(--marker-soft); color: inherit; border-radius: var(--r-xs); padding: 0 2px; }
.page-chip { display: inline-flex; margin-right: 6px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font: var(--fs-caption)/1.6 var(--font-mono);  border: 1px solid var(--border); }
.material-preview-status { margin-top: 12px; padding: 28px 16px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); color: var(--muted); text-align: center; }
.viewer-hint { padding: 8px 2px 0; }
.text-preview { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-subtle); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font: var(--fs-ui)/1.75 var(--font-sans); }

/* 旁问窗口 */
.anchor-card {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.anchor-quote {
  font-size: var(--fs-ui);
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rp-pane.aside-pane.is-on {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.aside-pane > .anchor-card { flex: 0 1 auto; min-height: 0; max-height: 112px; overflow: auto; }
/* 滚动区顶上 14px 留白，渐隐带跟着滚动长出来（t-20261026-kb3r）：内容没碰到上沿时 --aside-fade 是 0，什么也不遮；
   内容切进上沿后带很快长满 36px——上半截全透明、下半截渐显，切掉一截的那行字、那个气泡隐去，不留碎边
   （workspace.js 随 scrollTop 写 --aside-fade）。滚到某条消息时停在带下面 */
.aside-thread { --aside-fade: 0px; --aside-fade-end: 0px; position: relative; display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 12px; margin: 0 0 14px; padding-top: 14px; scroll-padding-top: 36px; overflow-y: auto; overscroll-behavior: contain; -webkit-mask-image: linear-gradient(to bottom, transparent calc(var(--aside-fade) / 2), #000 var(--aside-fade), #000 calc(100% - var(--aside-fade-end)), transparent 100%); mask-image: linear-gradient(to bottom, transparent calc(var(--aside-fade) / 2), #000 var(--aside-fade), #000 calc(100% - var(--aside-fade-end)), transparent 100%); }
/* 旁问里的步骤胶囊不写字（t-20261026-kb3r）：正在做时只有三个跳动的蓝点（深一档的蓝、放大一半，深色下也看得清）；
   做完（比如图已经画出来）就收起退场，旁问不摆出「备课」过程，也不留计数 */
.aside-thread .tool-activity-group { max-height: 22px; overflow: hidden; transition: opacity .16s ease-out, max-height .16s ease-out, margin .16s ease-out, visibility 0s linear .16s; }
.aside-thread .tool-activity-group[data-state="running"] { transition: opacity .16s ease-out, max-height .16s ease-out, margin .16s ease-out, visibility 0s; }
.aside-thread .tool-activity-group > .tool-activity-pill { padding: 0 10px 0 4px; background: transparent; color: var(--accent-strong); opacity: 1; filter: none; pointer-events: none; }
.aside-thread .tool-activity-mark { transform: scale(1.5); transform-origin: 0 50%; }
.aside-thread .tool-activity-mark[data-mark="running"]::before,
.aside-thread .tool-activity-mark[data-mark="running"]::after,
.aside-thread .tool-activity-mark[data-mark="running"] i { animation-name: aside-activity-dot; }
@keyframes aside-activity-dot { 0%, 80%, 100% { opacity: .4; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-1.5px); } }
.aside-thread :is(.tool-activity-title, .tool-activity-now, .tool-activity-pop) { display: none; }
.aside-thread .tool-activity-group:not([data-state="running"]) { max-height: 0; margin-block: 0; opacity: 0; visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .aside-thread .tool-activity-group { transition: none; }
  .aside-thread .tool-activity-mark[data-mark="running"]::before,
  .aside-thread .tool-activity-mark[data-mark="running"]::after,
  .aside-thread .tool-activity-mark[data-mark="running"] i { animation: none; opacity: 1; }
}
/* 旁问回答上记重点的胶囊、笔记号、黄框和批注弹层挂在这一层（t-20261022-jgx6）：原点是滚动内容左上角，随内容滚动 */
.aside-mark-layer { position: absolute; top: 0; left: 0; right: 0; height: 0; }
.aside-thread .api-questionnaire { width: 100%; margin-left: 0; }
.aside-quiz-card > legend { display: block; margin-bottom: 12px; color: var(--ink); font-size: var(--fs-ui); font-weight: 600; line-height: 1.55; }
.amsg-user {
  align-self: flex-end;
  max-width: 90%;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: var(--fs-ui);
  line-height: 1.6;
 border: 1px solid var(--border); }
.amsg-k { display: flex; gap: 8px; font-size: var(--fs-ui); line-height: 1.7; }
.amsg-k .klogo-sm { margin-top: 3px; }
/* The aside answer holds its own width, as the main chat's .msg-body does
   (F22): long unbroken words wrap instead of widening the thread (F47). */
.generation-recovery { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; }
.generation-recovery span { color: var(--muted); font-size: var(--fs-ui); line-height: 1.6; }
/* The sentence takes the free width, so a second action (quota upgrade) sits
   beside retry at the end of the row instead of pushing retry to the middle. */
.generation-recovery > span { flex-grow: 1; }
/* 右栏旁问窄：说明独占一行，按钮排在下面一行靠右，两个按钮也排得下 */
.aside-recovery { flex-wrap: wrap; justify-content: flex-end; }
.aside-recovery > span { flex-basis: 100%; }
.aside-recovery > span:empty { display: none; }
.aside-compose { flex: none; }
.aside-compose textarea { min-height: 24px; font-size: var(--fs-ui); }
.aside-compose .composer-actions { margin-left: auto; }

/* ---------- 面板折叠（桌面态） ---------- */
@media (min-width: 1024px) {
  body.lp-collapsed .lp { display: none; }
  body.rp-collapsed #rightPanel { display: none; }
}

/* ---------- 覆盖层 ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: var(--z-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer-close { display: none; }

.sheet {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(720px, calc(100vw - 32px));
  height: min(660px, calc(100vh - 56px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}
.sheet.show { opacity: 1; visibility: visible; transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sheet-head h3 { font-size: var(--fs-body); font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 22px 26px; font-size: var(--fs-ui); line-height: 1.75; }
.sheet-body h4 { font-size: var(--fs-ui); margin: 18px 0 8px; }
.sheet-body h4:first-child { margin-top: 0; }
.sheet-body ul, .sheet-body ol { padding-left: 22px; display: flex; flex-direction: column; gap: 5px; }
.sheet-body .caption { margin-bottom: 4px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.sheet-template { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; color: var(--muted); font-size: var(--fs-caption); }
.sheet-template .input { width: 150px; height: 36px; font-size: var(--fs-ui); }
.sheet-summary { padding: 14px 16px; margin-bottom: 14px; border-radius: var(--r-sm); background: var(--marker-soft); color: var(--ink); }
.sheet-summary p { margin-top: 4px; }
.sheet-section { break-inside: avoid; }
.cornell-sheet { display: grid; grid-template-columns: minmax(140px, 0.8fr) minmax(0, 1.8fr); align-content: start; gap: 0; }
.cornell-sheet .sheet-summary { grid-column: 1 / -1; }
.cornell-sheet .sheet-section { display: contents; }
.cornell-sheet .sheet-section h4 { margin: 0; padding: 14px 12px 14px 0; border-top: 1px solid var(--border); }
.cornell-sheet .sheet-section h4 { border-right: 1px solid var(--border); }
.cornell-sheet .sheet-section ul { margin: 0; padding: 14px 12px 14px 24px; border-top: 1px solid var(--border); }
.cornell-sheet .sheet-section .caption { grid-column: 2; margin: -10px 0 12px 24px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1279px) {
  .course-summary { max-width: clamp(132px, 24vw, 220px); }
  .course-summary__metric:nth-child(3) { display: none; }
  .countdown { max-width: 180px; }
  .chat-inner { padding-left: 24px; padding-right: 44px; }
  .gen-chip.show { max-width: 150px; }
}

@media (max-width: 1023px) {
  .board-focus-toggle { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "conversation"; }
  .rp-resizer { display: none; }

  .course-summary { flex: 1 1 auto; max-width: none; }
  .course-summary__metric:nth-child(3) { display: inline-flex; }
  .topbar .left-drawer-toggle { display: inline-flex; }
  .countdown { max-width: 200px; }

  /* 左栏窄屏：圆按钮一列和气泡，见 workspace-navigation.css */

  .rp {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    right: 0;
    width: min(440px, 94vw);
    z-index: var(--z-drawer);
    transform: translateX(105%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow-pop);
    border-left: 1px solid var(--border);
  }
  body.right-open #rightPanel { transform: none; display: flex !important; }
  body.right-open .topbar { z-index: calc(var(--z-drawer) + 1); }

  .chat-inner { max-width: 760px; padding-left: 28px; padding-right: 48px; }
}

@media (max-width: 767px) {
  .topbar { gap: 4px; padding: 0 8px; }
  .course-summary { flex: 1 1 96px; max-width: none; padding-inline: 9px 7px; }
  .course-summary__lead strong { max-width: min(32vw, 160px); }
  .course-summary__metrics { display: none; }
  .topbar-right { gap: 2px; }
  .btn-icon { width: 32px; }
  .topbar .conn { width: 32px; padding: 0; justify-content: center; }
  .conn-text { display: none; }
  .gen-chip { display: none !important; }
  .center { --composer-overlap: 10px; }
  .chat-inner { padding: 24px 16px calc(var(--composer-overlap) + 24px); }
  .center > .composer { padding: var(--composer-overlap) 12px 12px; }
  .msg-user { max-width: 86%; }
  .unit-room-head { justify-content: space-between; }
  .unit-room-head__back-long { display: none; }
  .unit-room-head__back-short { display: inline; }
  .unit-room-head__title { order: 3; flex: 1 1 100%; }
  .stage-chapter__title { font-size: 20px; }

  .rp {
    inset: var(--topbar-h) 0 0;
    width: auto;
    max-width: 100%;
    height: calc(100dvh - var(--topbar-h));
    border-left: 0;
    box-shadow: none;
  }
  .rp-tabbar { padding-top: max(6px, env(safe-area-inset-top)); }
  .rp-body { padding-bottom: env(safe-area-inset-bottom); }
  .rp-pane { padding: 12px; }

  .board-head { flex-wrap: wrap; }
  .board-head > div:first-child { flex: 1 1 180px; }
  .board-filters { grid-template-columns: 1fr; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-template { width: 100%; margin-right: 0; }
  .board-doc.template-cornell .board-sec { grid-template-columns: 1fr; }
  .board-doc.template-cornell .board-sec h5,
  .board-doc.template-cornell .board-sec .board-item-list { grid-column: 1; grid-row: auto; }
  .board-doc.template-cornell .board-sec h5 { border-right: 0; }
  .cornell-sheet { display: block; }
  .cornell-sheet .sheet-section h4 { border-right: 0; }
}

/* 同门户顶栏：窄屏收起「反馈」，账户菜单里仍有反馈入口 */
@media (max-width: 600px) {
  .topbar #feedbackButton { display: none; }
}

@media (max-width: 480px) {
  .topbar { padding-inline: 6px; }
  .workspace-home-link { gap: 4px; padding-inline: 0; font-size: var(--fs-caption); }
  .workspace-home-link__logo { width: 24px; height: 24px; border-radius: 0; }
  .course-summary__lead strong { max-width: 26vw; font-size: var(--fs-caption); }
  .course-summary__eyebrow { font-size: var(--fs-caption); }
  .course-summary-menu { left: 6px; width: calc(100vw - 12px); }
  #themeBtn { display: none; }
  .topbar-right { flex: none; }
  #connBtn { display: none; }

  .lp-pane { padding: 14px 12px 24px; }

  .chat-inner { padding: 18px 12px calc(var(--composer-overlap) + 20px); }
  .msg-user { max-width: 92%; margin-bottom: 24px; padding: 9px 13px; font-size: var(--fs-ui); }
  .msg-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .block-feedback { margin-bottom: 22px; }

  .center { --composer-overlap: 8px; }
  .center > .composer { padding: var(--composer-overlap) 8px max(9px, env(safe-area-inset-bottom)); }
  .chips-row { flex-wrap: nowrap; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: none; }
  .chips-row::-webkit-scrollbar { display: none; }
  .chips-row .chip { flex: none; }
  .composer-box { padding: 10px 10px 7px; }
  .composer-foot > .caption { display: none; }

  .rp-pane { padding: 10px; }
  .board-doc { padding: 14px 13px 12px; }
  .board-template { width: 100%; }
  .board-template button { flex: 1; }
  .board-foot .btn { width: 100%; }
  .src-file { align-items: flex-start; flex-wrap: wrap; }
  .src-file .verified { width: 100%; margin-left: 28px; }
  .src-loc { align-items: flex-start; gap: 8px; }
  .seg-nav { flex: none; }
  .aside-compose { position: sticky; bottom: 0; }
  .pinned-summary-panel { top: 54px; right: 12px; }
  .sheet { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .sheet-head { padding: 14px 14px; }
  .sheet-body { padding: 18px 16px; }
  .sheet-foot { padding: 12px; gap: 8px; }
  .sheet-foot .btn { flex: 1 1 calc(50% - 4px); padding-inline: 10px; }
  .sheet-template { flex: 1 1 100%; }
  .sheet-template .input { flex: 1; width: auto; }
}

body.quiz-paper-open { overflow: hidden; }
/* 答题纸上选字旁问：旁问开在右栏，答题纸让出右栏（和地图窗口让出右栏同一个做法，桌面宽度才有） */
@media (min-width: 1024px) {
  body.quiz-paper-open.paper-aside-dock:not(.rp-collapsed):not(.board-focus-mode) .quiz-paper-overlay { right: var(--right-panel-w); }
}
.api-quiz-paper-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.api-quiz-paper-card h3,
.api-quiz-paper-card p { margin: 0; }
.api-quiz-paper-card-meta { color: var(--muted); }
.api-quiz-paper-card-result { font-weight: 600; }
.api-quiz-paper-card-entry { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.api-quiz-paper-card-entry .btn { flex: none; }
.quiz-paper-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-quiz);
  background: var(--canvas);
}
.quiz-paper-window {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  width: 100%;
  height: 100dvh;
  color: var(--ink);
  background: var(--canvas);
}
.quiz-paper-window-head,
.quiz-paper-window-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 48px);
  background: transparent;
}
.quiz-paper-window-head { border-bottom: 1px solid var(--border); }
.quiz-paper-window-foot {
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.quiz-paper-window-head h2,
.quiz-paper-window-head p { margin: 0; }
.quiz-paper-window-head p { margin-top: 4px; color: var(--muted); }
.quiz-paper-window-actions { display: flex; align-items: center; gap: 10px; }
.quiz-paper-timer {
  min-width: 76px;
  font: 600 var(--fs-h2)/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.quiz-paper-reminder,
.quiz-paper-paused {
  margin: 0;
  padding: 12px clamp(16px, 4vw, 48px);
  background: var(--marker-soft);
  color: var(--ink);
}
.quiz-paper-paused { display: grid; place-items: center; min-height: 45vh; font-size: var(--fs-h2); }
.quiz-paper-paused[hidden] { display: none; }
/* 正文是一张卷子（.quiz-paper-sheet），卷面的版式都在 study-paper.css（t-20261009-htuw） */
.quiz-paper-window-body {
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px 16px 72px;
}
/* 卷面记重点的胶囊、笔记号、黄框和批注弹层挂在这一层（t-20261022-jgx6）：原点是卷面内容左上角，随卷面滚动 */
.quiz-paper-mark-layer { position: absolute; top: 0; left: 0; right: 0; height: 0; }

/* A figure a quiz card or paper question holds sits between the question and its answer area. */
.quiz-figure { margin: 4px 0 12px; }
.quiz-figure > .canvas-visual-card,
.quiz-figure > .html-visual-card { margin-top: 0; }
.quiz-figure > .material-page-card { margin-top: 0; max-width: 100%; }
/* Same height cap as a figure in a quiz card (MAX_QUIZ_FIGURE_HEIGHT), centred. */
.quiz-figure .material-page-image {
  width: auto;
  max-width: 100%;
  max-height: 480px;
  margin-inline: auto;
}
/* 图注最前面的「图 N」由服务端按题内顺序编好；一题只有一张图时不印号 */
.quiz-figure-label { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.quiz-figure .material-page-card figcaption .quiz-figure-label { font-size: var(--fs-ui); }
/* 一题几张图（t-20261010-xizf，随堂小测卡 t-20261010-zm63 同用）：并排成行、装不下换行、底边对齐，
   每格半栏，图在格里居中且只缩不放，图注「图 N 标题」居中在图下；只有一张时不进这条规则，与单图版式相同；
   窄屏一行一张 */
.quiz-figure-row.is-multi { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin: 0 0 16px; }
.quiz-figure-row.is-multi > .quiz-figure { flex: 0 0 calc(50% - 8px); min-width: 0; margin: 0; }
.quiz-figure-row.is-multi > .quiz-figure > * { margin-bottom: 0; }
.quiz-figure-row.is-multi :is(.canvas-visual-stage, .html-visual-stage, .canvas-visual-card figcaption, .html-visual-card figcaption) { margin-inline: auto; }
.quiz-figure-row.is-multi :is(.canvas-visual-card, .html-visual-card, .material-page-card) figcaption { justify-content: center; }
.quiz-figure-row.is-multi :is(.visual-zoom-link, .material-page-open) { margin-left: 0; }
@media (max-width: 479px) { .quiz-figure-row.is-multi > .quiz-figure { flex-basis: 100%; } }

@media (max-width: 700px) {
  .quiz-paper-window-head { align-items: flex-start; flex-direction: column; }
  .quiz-paper-window-actions { width: 100%; }
  .quiz-paper-window-actions .btn { flex: 1; }
  .quiz-paper-window-foot { flex-wrap: wrap; gap: 10px; }
}

/* ---------- 图示块（T1，t-20261009-scn2）----------
   图示是印在白纸上、贴进阅读栏的一张图。块本身无底色、无外框、无阴影，与正文同一张纸；
   宽度跟 .msg-body 的 40em（同一 17px 基准，约 680px），左缘与正文对齐，图只缩不放。
   图本身 1px 边 + --r-sm；图注裸排在图下，右侧一个「放大 →」。旁问、小测、试卷「图 N」同一样式。
   --visual-w 由脚本设为图的实际宽度，图注与图同宽。 */
.canvas-visual-card,
.html-visual-card {
  --visual-w: auto;
  margin: 16px 0;
  max-width: min(40em, 100%);
  font-size: 17px;
}
@media (max-width: 600px) {
  .canvas-visual-card,
  .html-visual-card { font-size: 16px; }
}
/* 1px 纸边画在图外（不占图的宽度），680 宽的图按 1.0 显示，图左缘仍与正文对齐 */
.canvas-visual-stage,
.html-visual-stage {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--border);
  /* 白纸：图示与课件原页同规则，深浅色下都是固定纸色，不反色、不注入主题 */
  background: #fff;
}
[data-theme="dark"] :is(.canvas-visual-stage, .html-visual-stage) { box-shadow: 0 0 0 1px var(--border-strong); }
/* 画图调用进行中：图卡的位置先放一块灰色圆角占位，图卡到了就替换它（t-20261010-2jrt）。
   宽度与图卡同栏宽，16:9 接近常见图卡高度。 */
.figure-placeholder {
  width: min(40em, 100%);
  aspect-ratio: 16 / 9;
  margin: 16px 0;
  border-radius: var(--r-md);
  background: var(--surface-subtle);
  font-size: 17px;
  animation: kp-pulse 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .figure-placeholder { animation: none; }
}
:is(.canvas-visual-card, .html-visual-card).is-failed :is(.canvas-visual-stage, .html-visual-stage) { display: none; }
:is(.canvas-visual-card, .html-visual-card).is-failed figcaption { width: auto; }

.canvas-visual-card figcaption,
.html-visual-card figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  box-sizing: border-box;
  width: var(--visual-w);
  max-width: 100%;
  margin-top: 6px;
  color: var(--faint);
  font: 400 var(--fs-caption)/1.5 var(--font-sans);
}
:is(.canvas-visual-card, .html-visual-card) figcaption strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
}
/* 放大图示：图注右端一颗圆底的放大镜（t-20261026-wybz 整合），字只在读屏和悬停提示里 */
.visual-zoom-link {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: zoom-in;
  transition: border-color .16s linear, background-color .16s linear;
}
.visual-zoom-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.visual-zoom-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.visual-zoom-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.canvas-visual-bitmap {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
}
.canvas-visual-bitmap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

body.canvas-visual-lightbox-open { overflow: hidden; }
.canvas-visual-lightbox {
  position: fixed;
  z-index: var(--z-lightbox);
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 56px);
  background: var(--scrim);
}
/* 灯箱属 T3 浮层：图仍是白纸，规范阴影（深色下是描边圈）；位图按 CSS 尺寸显示 */
.canvas-visual-lightbox-bitmap {
  display: block;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: var(--shadow-modal);
}
.canvas-visual-lightbox-close,
.html-visual-lightbox-close {
  position: fixed;
  z-index: 1;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  font: 400 var(--fs-h1)/1 var(--font-sans);
  cursor: pointer;
}
:is(.canvas-visual-lightbox-close, .html-visual-lightbox-close):hover { background: var(--surface-subtle); }
:is(.canvas-visual-lightbox-close, .html-visual-lightbox-close):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 图注里的状态字：画图中、没加载出来 */
.canvas-visual-output.is-error,
.html-visual-output.is-error { color: var(--faint); }
.canvas-visual-output.is-error::before,
.html-visual-output.is-error::before { content: "· "; }

.canvas-visual-controller {
  position: absolute;
  width: 1px;
  height: 1px;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
}

/* The document lays out in a frame at least as wide as the column and is
   scaled down as a whole; the stage takes the figure's (scaled) box. */
.html-visual-frame {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  border: 0;
  background: #fff;
  transform-origin: 0 0;
}
.html-visual-stage:not(.is-fitted) .html-visual-frame { width: 100%; height: 100%; }
.html-visual-stage.is-loading .html-visual-frame { visibility: hidden; }

/* The sandboxed frame swallows clicks, so a transparent catcher covers the figure. */
.html-visual-zoom {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.html-visual-zoom:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

body.html-visual-lightbox-open { overflow: hidden; }
.html-visual-lightbox {
  position: fixed;
  z-index: var(--z-lightbox);
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 56px);
  background: var(--scrim);
}
/* 放大：图先铺满整张纸量一次尺寸，再按自己的大小放大（至多两倍）或缩小，居中（t-20261026-kb3r） */
.html-visual-lightbox-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1200px;
  max-height: 100%;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--figure-paper);
  box-shadow: var(--shadow-modal);
  transition: opacity 160ms ease-out;
}
.html-visual-lightbox-stage.is-loading { opacity: 0; }
.html-visual-lightbox-frame {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  background: var(--figure-paper);
  transform-origin: 0 0;
}
@media (prefers-reduced-motion: reduce) { .html-visual-lightbox-stage { transition: none; } }

.anchor-card > .caption { font-size: var(--fs-caption); color: var(--faint); }
.msg-status:empty { display: none; }

/* A page the tutor showed from the course's own material: the rendered page
   is white paper in both themes, read at the answer's width. */
.material-page-card {
  margin: 16px 0 0;
  max-width: 640px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.material-page-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: zoom-in;
}
.material-page-zoom:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.material-page-image {
  display: block;
  width: 100%;
  height: auto;
}
.material-page-card figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 9px 14px;
  color: var(--ink);
  font-size: var(--fs-caption);
}
.material-page-number { color: var(--muted); }
.material-page-open {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.material-page-open:hover { text-decoration: underline; }
.material-page-unavailable {
  margin: 0;
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
}
.material-page-lightbox-image {
  display: block;
  max-width: min(1200px, 100%);
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: var(--shadow-modal);
}

/* 回答里展示的课件页（t-20261025-mr2o）：左上角页码标签（同资料查看器，记了整页重点变黄）；
   页底左边文件名和页码，右边一排图标：引用、记重点、在右侧资料栏打开、放大（旁问是页右上角那枚圆钮，image-aside.css）。
   点页面框起这一页（蓝框），上方出和资料里同一份胶囊；放大只走按钮 */
.material-page-card.has-actions { position: relative; overflow: visible; }
.material-page-face {
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: #fff;
  cursor: pointer;
}
.material-page-card.is-framed { outline: 2px solid var(--accent); outline-offset: 2px; }
.material-page-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  min-width: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.material-page-card.is-framed .material-page-tag:not(.is-marked) { border-color: var(--accent); color: var(--accent-strong); }
.material-page-tag.is-marked { border-color: var(--marker); background: var(--marker-soft); color: var(--marker-ink); }
.material-page-tools { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.material-page-tool {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.material-page-tool[hidden] { display: none; }
.material-page-tool:hover { background: var(--surface-subtle); color: var(--accent-strong); }
.material-page-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.material-page-tool .icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.material-page-tool[data-act="unmark"] { color: var(--marker-ink); }
.material-page-tool[data-act="side"] { margin-left: 6px; }

/* 连着展示的几页课件叠成一手牌（t-20261025-mr2o）：每页按次序从左往右错开、微微成扇形，当前页抬到最上，
   其余按离当前页远近往下叠，位置不随翻页改变；点露出来的那一条或用 ‹ › / 左右键翻；「展开」排成纵列逐页看，「收起」叠回去。
   --n（这手几页）、--i（第几页）、--d（离当前页几页）由 material-page.js 写在 style 上 */
.material-deck { --n: 1; max-width: 640px; margin: 16px 0 0; }
.material-deck[hidden] { display: none; }
.material-deck .material-page-card { --i: 0; --d: 0; margin: 0; }
.material-deck.is-fanned .material-deck__stage {
  --step: min(26px, calc(28% / max(var(--n) - 1, 1)));
  display: grid;
  isolation: isolate;
  padding: 6px 0 12px;
}
.material-deck.is-fanned .material-page-card {
  grid-area: 1 / 1;
  align-self: start;
  width: calc(100% - var(--step) * (var(--n) - 1));
  margin-left: calc(var(--step) * var(--i));
  z-index: calc(40 - var(--d));
  transform-origin: 50% 100%;
  rotate: calc((var(--i) - (var(--n) - 1) / 2) * .7deg);
  transition: rotate 200ms cubic-bezier(.2, .8, .2, 1), translate 200ms cubic-bezier(.2, .8, .2, 1), box-shadow 160ms ease;
}
.material-deck.is-fanned .material-page-card[data-deck-pos="front"] { z-index: 50; rotate: 0deg; translate: 0 -4px; box-shadow: var(--shadow-pop); }
.material-deck.is-fanned .material-page-card[data-deck-pos="behind"] { cursor: pointer; }
.material-deck.is-fanned .material-page-card[data-deck-pos="behind"] .material-page-face { cursor: pointer; }
.material-deck.is-fanned .material-page-card[data-deck-pos="behind"]:hover { translate: 0 -2px; }
.material-deck.is-fanned .material-page-card:not([data-deck-pos="front"]) figcaption { visibility: hidden; }
.material-deck.is-column .material-deck__stage { display: grid; gap: 12px; }
.material-deck__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-caption);
}
.material-deck.is-column .material-deck__bar { margin-top: 8px; }
.material-deck__flip {
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.material-deck__flip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-strong); }
.material-deck__flip:disabled { opacity: .4; cursor: default; }
.material-deck__flip[hidden], .material-deck__position[hidden] { display: none; }
.material-deck__position { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.material-deck__toggle {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.material-deck__toggle:hover { text-decoration: underline; }
:is(.material-deck__flip, .material-deck__toggle):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .material-deck.is-fanned .material-page-card { transition: none; } }

/* 9zu7 评论 */
/* 选中胶囊：外框沿用上面的 .selection-aside，里面是一排按钮（旁问 · 引用 ｜ 记重点），按钮之间一条分隔线 */
.selection-pill { padding: 0 3px; gap: 0; cursor: default; }
.selection-pill:hover { background: var(--surface); border-color: var(--border-strong); }
.selection-pill__btn {
  position: relative; height: 26px; padding: 0 10px;
  display: inline-flex; align-items: center;
  border: 0; border-radius: var(--r-pill); background: none; color: inherit; font: inherit; cursor: pointer;
}
.selection-pill__btn:hover, .selection-pill__btn:focus-visible { background: var(--accent-soft); }
.selection-pill__label { display: inline-flex; align-items: center; gap: 5px; }
.selection-pill__sep { width: 1px; height: 14px; flex: none; background: var(--border); }
.selection-pill__tip { display: none; }
/* 桌面：悬停提示，居中在按钮上方；伸出聊天区时由 workspace.js 按左右边界平移（margin-left） */
.selection-pill__hint {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 4px 8px; border-radius: var(--r-xs); background: var(--ink); color: var(--canvas);
  font: 400 var(--fs-caption)/1.4 var(--font-sans); white-space: nowrap; pointer-events: none;
}
.selection-pill:not(.is-touch) .selection-pill__btn:hover .selection-pill__hint,
.selection-pill:not(.is-touch) .selection-pill__btn:focus-visible .selection-pill__hint {
  display: block; animation: selection-hint-in 120ms ease 300ms both;
}
@keyframes selection-hint-in { from { opacity: 0; } to { opacity: 1; } }
/* 触屏：底部通栏，按钮平分宽度，按钮文字下一行短字 */
.selection-pill.is-touch { height: auto; min-height: 54px; padding: 0; overflow: hidden; }
.selection-pill.is-touch:hover { background: var(--accent-strong); border-color: var(--accent); }
.selection-pill.is-touch .selection-pill__btn {
  flex: 1 1 0; min-width: 0; height: auto; align-self: stretch; padding: 7px 2px;
  border-radius: 0; flex-direction: column; justify-content: center; gap: 2px;
}
.selection-pill.is-touch .selection-pill__btn:hover { background: color-mix(in srgb, var(--on-accent) 12%, transparent); }
.selection-pill.is-touch .selection-pill__tip {
  display: block; white-space: nowrap; font-size: 11px; font-weight: 400; line-height: 1.3; opacity: .85; text-align: center;
}
.selection-pill.is-touch .selection-pill__sep { height: 24px; background: color-mix(in srgb, var(--on-accent) 35%, transparent); }
@media (prefers-reduced-motion: reduce) {
  .selection-pill__hint { animation: none !important; }
}

/* 评论的原句：虚下划线，和旁问的实线区分开；浏览器不支持 Custom Highlight 时用 span 包一层 */
::highlight(kp-comment) {
  text-decoration-line: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
}
span.kp-comment { text-decoration: underline dashed var(--accent) 2px; }

/* 标重点：选区铺淡黄荧光。荧光是笔记里「我的经验」条目的投影，只用 Custom Highlight 画，不改正文 DOM */
::highlight(kp-mark) { background-color: var(--mark-hl); color: var(--ink); }

/* 引用浮层（t-20261006-imgs）：上面是引文（左边一条竖线、最多两行），下面一行写一句和圆形 ⊕。
   桌面贴着选区，随内容滚动；从「准备发送」的 chip 重开时贴着 chip，用 is-fixed 固定在视口里 */
.comment-pop {
  position: absolute; z-index: var(--z-scroll-pop); width: min(340px, calc(100% - 8px));
  display: grid; gap: 8px; padding: 10px 8px 6px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
}
.comment-pop.is-fixed { position: fixed; z-index: var(--z-menu); width: min(340px, calc(100vw - 16px)); }
.comment-pop[hidden], .comment-bar[hidden] { display: none; }
.comment-quote {
  min-width: 0; padding-left: 10px; border-left: 3px solid var(--border-strong);
  color: var(--muted); font-size: var(--fs-caption); line-height: var(--lh-ui); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.comment-row { display: flex; align-items: center; gap: 6px; }
.comment-input {
  flex: 1; min-width: 0; height: var(--control-h-sm); padding: 0;
  border: 0; background: transparent; color: var(--ink); font: var(--fs-ui)/1 var(--font-sans); outline: none;
}
.comment-input::placeholder { color: var(--faint); }
/* ⊕：圆形，无填充，悬停一层浅底 */
.comment-add {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer;
}
.comment-add .icon { width: 20px; height: 20px; pointer-events: none; }
.comment-add:hover, .comment-add:focus-visible { background: var(--surface-subtle); color: var(--accent-strong); }
.comment-add:focus { outline: none; }
.comment-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
/* 触屏引用：停在输入框上方的一条输入栏，和桌面浮层同一个形状，右上角一个 × */
.comment-bar {
  display: grid; gap: 8px; margin-bottom: 9px; padding: 10px 8px 6px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface);
}
.comment-bar__head { display: flex; align-items: flex-start; gap: 6px; }
.comment-bar__head .comment-quote { flex: 1; }
.comment-bar__close {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; margin: -6px 0 -6px;
  padding: 0; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--faint);
  font: var(--fs-body)/1 var(--font-sans); cursor: pointer;
}
.comment-bar__close:hover, .comment-bar__close:focus-visible { background: var(--surface-subtle); color: var(--ink); }

/* 「准备发送」的英文标题（原规则只有中文） */
html[lang="en-US"] .staged-answers::before { content: "Ready to send"; }
/* 「准备发送」里的引用 chip：“引文前 20 字”（淡色）加那句话；单击正文在原处重开引用浮层 */
.staged-answer .staged-comment__body {
  display: block; min-width: 0; max-width: 300px; padding: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); text-align: left;
}
.staged-answer .staged-comment__body:focus { outline: none; }
.staged-answer .staged-comment__body:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.staged-comment__quote { color: var(--faint); }
.staged-comment:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }

/* 学生消息气泡里以「> 」开头的行：左边竖线、灰字的引用块 */
.msg-user__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user__quote {
  margin: 2px 0 6px; padding: 2px 10px; border-left: 3px solid var(--border-strong);
  color: var(--muted); font-size: var(--fs-ui); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-user__quote + .msg-user__text { margin-bottom: 8px; }
.msg-user__text + .msg-user__text { margin-top: 8px; }
.msg-user.has-quote > :last-child { margin-bottom: 0; }

/* 92nw 批注 / vcw6 旁问线 */
/* 指针落在可点的标记（旁问底线、重点荧光）上：手形指针 */
.chat-inner .msg-body.is-markup-hit,
.chat-inner .kp-markable.is-markup-hit { cursor: pointer; }
/* 指针停在旁问底线上的小提示：样式同胶囊按钮的悬停提示，挂在聊天内容里随内容滚动 */
.markup-tip {
  position: absolute; z-index: var(--z-scroll-pop);
  padding: 4px 8px; border-radius: var(--r-xs); background: var(--ink); color: var(--canvas);
  font: 400 var(--fs-caption)/1.4 var(--font-sans); white-space: nowrap; pointer-events: none;
  animation: selection-hint-in 120ms ease 220ms both;
}
.markup-tip[hidden] { display: none; }
/* 一处同时有几种标记时单击弹出的小菜单：外形用 .menu */
.markup-menu[hidden] { display: none; }
.markup-menu button { white-space: nowrap; }
.markup-menu button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.markup-menu .icon { width: 16px; height: 16px; flex: none; }
.markup-menu .i-note { color: var(--marker-ink); }
.markup-menu .i-aside { color: var(--accent); }

/* 每条重点末尾一个笔记号（t-20261006-imgs）。挂在消息上绝对定位（不进正文）；末尾右侧紧挨着字时放到这一行右侧的页边。
   写了批注是实心：记号色底，图标取记号色压暗（两套主题都由 --marker 推出）；没写批注是空心（is-empty）：透明底、记号色描边 */
.mark-note-badge {
  position: absolute; z-index: var(--z-scroll-mark);
  display: grid; place-items: center; width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--marker); border-radius: var(--r-xs);
  background: var(--marker); color: color-mix(in srgb, var(--marker) 30%, #000); cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.mark-note-badge .icon { width: 12px; height: 12px; stroke-width: 2.25; pointer-events: none; }
.mark-note-badge.is-empty { background: transparent; color: var(--marker-ink); }
.mark-note-badge:hover, .mark-note-badge:focus-visible { box-shadow: 0 0 0 2px var(--mark-hl); }
.mark-note-badge.is-empty:hover, .mark-note-badge.is-empty:focus-visible { background: var(--marker-soft); }
.mark-note-badge:focus { outline: none; }
.mark-note-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 带批注的重点：荧光外面逐行一圈记号色细框，压在字上、不挡点击；和笔记号同一次布局摆放、同一处清理 */
.mark-note-frame {
  position: absolute; border: 1.5px solid var(--marker); border-radius: 3px; pointer-events: none;
}
/* 记重点那一刻：一个记号色框从选区大小收进笔记号的位置（Web Animations 驱动，减少动态时不放） */
.mark-shrink-ghost {
  position: fixed; z-index: var(--z-menu); box-sizing: border-box; pointer-events: none;
  border: 2px solid var(--marker); border-radius: 6px; background: var(--mark-hl);
}

/* 重点上的批注弹层：桌面在点中的那一行下方，随内容滚动；触屏是底部通栏 */
.mark-note-pop {
  position: absolute; z-index: var(--z-scroll-pop); width: min(340px, calc(100% - 8px)); padding: 10px 10px 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  font-size: var(--fs-ui); line-height: 1.5;
}
.mark-note-pop[hidden] { display: none; }
.mark-note-pop__title { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-weight: 600; color: var(--ink); }
.mark-note-pop__title .icon { width: 15px; height: 15px; color: var(--marker-ink); }
.mark-note-input {
  display: block; width: 100%; min-height: 56px; max-height: 160px; padding: 8px 10px; resize: none;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: var(--fs-ui)/1.6 var(--font-sans); outline: none;
}
.mark-note-input:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mark-note-input::placeholder { color: var(--faint); }
.mark-note-pop__foot { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.mark-note-pop__view {
  margin-right: auto; padding: 0; border: 0; background: none; color: var(--accent-strong);
  font: var(--fs-caption)/1.5 var(--font-sans); cursor: pointer; text-align: left;
}
.mark-note-pop__view:hover { text-decoration: underline; }
.mark-note-pop__count { margin-right: 4px; font-variant-numeric: tabular-nums; }
/* 保存 / 删除重点：28×28 图标按钮，外形同回执行尾的 .rcpt__act */
.mark-note-pop__act {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; flex: none;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.mark-note-pop__act .icon { width: 16px; height: 16px; pointer-events: none; }
.mark-note-pop__act:hover, .mark-note-pop__act:focus-visible { background: var(--surface-subtle); color: var(--ink); }
.mark-note-pop__act[data-act="delete"]:hover, .mark-note-pop__act[data-act="delete"]:focus-visible { background: var(--danger-soft); color: var(--danger); }
.mark-note-pop__act:focus { outline: none; }
.mark-note-pop__act:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.mark-note-pop__act:disabled, .mark-note-pop__act:disabled:hover { background: none; color: var(--faint); opacity: .45; cursor: default; }
@media (pointer: coarse) {
  .mark-note-pop.is-touch {
    position: fixed; inset: auto 12px max(12px, env(safe-area-inset-bottom)); width: calc(100vw - 24px);
    border-color: var(--border-strong); box-shadow: var(--shadow-modal);
  }
}
@media (prefers-reduced-motion: reduce) {
  .markup-tip { animation: none !important; }
  .mark-note-pop__act { transition: none; }
}

/* r45x 课件查看器：顶栏（文件名、页码 n / N、缩放 − 适宽 +、下载）贴在资料面板顶部，下面一列连续滚动的页。
   每页是服务端的页图，上面盖一层透明文字层（每行一个 span，字号按盒高、scaleX 拉到盒宽）：能 Ctrl+F、能选字复制，
   页图本身不可选、长按不弹存图菜单。md/txt 是渲染后的正文 */
.rp-pane.material-pane.is-viewer { padding: 0; }
.rp-pane.material-pane.is-viewer.is-on { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.material-pane.is-viewer .source-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.material-viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; container-type: inline-size; background: var(--canvas); }
.mv-bar {
  flex: none; display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.mv-name { min-width: 0; max-width: 40%; margin-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: var(--fs-ui); }
@container (max-width: 359px) { .mv-name { display: none; } }
.mv-pager { display: inline-flex; align-items: center; gap: 4px; }
.mv-page-input {
  width: 3.2em; height: 26px; padding: 0 4px; border: 1px solid var(--border); border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink); font: var(--fs-caption)/1 var(--font-sans); font-variant-numeric: tabular-nums; text-align: center;
}
.mv-page-input:focus { border-color: var(--accent); outline: none; box-shadow: inset 0 0 0 1px var(--accent); }
.mv-page-total { color: var(--faint); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv-bar-gap { flex: 1; }
.mv-tool {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--muted); font: var(--fs-caption)/1 var(--font-sans); text-decoration: none; cursor: pointer;
}
.mv-tool:hover, .mv-tool:focus-visible { background: var(--surface-subtle); color: var(--ink); }
.mv-tool:focus { outline: none; }
.mv-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.mv-tool[aria-pressed="true"] { color: var(--accent-strong); }
.mv-tool .icon { width: 16px; height: 16px; }
/* 文字层状态：工具栏下面一行小字，和工具栏连成一块 */
.mv-bar:has(+ .mv-status:not([hidden])) { border-bottom-color: transparent; }
.mv-status {
  flex: none; margin: 0; padding: 0 12px 6px; border-bottom: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: var(--fs-caption); line-height: var(--lh-ui);
}
.mv-status[hidden] { display: none; }
.mv-excerpt-slot { flex: none; }
.mv-excerpt-slot:empty { display: none; }
.mv-excerpt-slot > * { margin: 0; border-radius: 0; border-width: 0 0 1px; }
.mv-scroller { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.mv-scroller:focus { outline: none; }
.mv-pages { --mv-zoom: 1; --mv-page-ratio: 16 / 9; --mv-view-h: 80vh; position: relative; padding: 12px; }
.mv-page {
  position: relative; display: block; width: calc(100% * var(--mv-zoom)); margin: 0 auto; aspect-ratio: var(--mv-page-ratio);
  border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff;
}
.mv-page + .mv-page { margin-top: 12px; }
/* 悬浮窗口里默认整页（material-viewer.js 的 data-fit="page"，每页的 --mv-page-ratio 是它自己的宽高比）：一页的高度落在可视区内，宽不超过 860px，水平居中；点缩放或适宽后照常 */
.sp-primary .mv-pages[data-fit="page"] .mv-page { width: min(100%, 860px, calc((var(--mv-view-h) - 24px) * var(--mv-page-ratio))); }
.mv-page-image {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; border-radius: inherit;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; pointer-events: none;
}
.mv-text { position: absolute; inset: 0; overflow: hidden; container-type: size; line-height: 1; -webkit-touch-callout: none; }
.mv-line { position: absolute; white-space: pre; color: transparent; font-family: sans-serif; transform-origin: 0 0; cursor: text; }
.mv-line::selection { color: transparent; background: color-mix(in srgb, var(--accent) 32%, transparent); }
.mv-text br::selection { background: transparent; }
/* 荧光画在透明文字层上：只铺底色，字仍然透明（页图上的字才是看见的字） */
.mv-line::highlight(kp-mark), .mv-line::highlight(kp-flash) { color: transparent; }
::highlight(kp-flash) { background-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.mv-tag {
  position: absolute; top: 8px; left: 8px; z-index: 3; display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px;
  border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface); color: var(--muted);
  font: 600 var(--fs-caption)/1 var(--font-sans); font-variant-numeric: tabular-nums; cursor: grab; user-select: none; -webkit-user-select: none;
}
.mv-tag .icon { display: none; width: 10px; height: 10px; }
.mv-tag:hover { border-color: var(--border-strong); }
.mv-tag:focus { outline: none; }
.mv-tag:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-tag.is-marked { border-color: var(--marker); background: var(--marker-soft); color: var(--marker-ink); cursor: pointer; }
.mv-tag.is-marked .icon { display: block; }
.mv-tag.is-dragging { opacity: .5; }
.mv-page.is-framed .mv-tag:not(.is-marked) { border-color: var(--accent); color: var(--accent-strong); }
/* 带批注的整页重点：整页外面一圈记号色框；框住时蓝框优先 */
.mv-page.is-noted { outline: 1.5px solid var(--marker); outline-offset: 2px; }
.mv-page.is-framed { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-page.is-flash { animation: mv-page-flash 1.2s ease; }
@keyframes mv-page-flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.mv-page-error {
  position: absolute; inset: 0; display: none; place-items: center; margin: 0; padding: 16px; border-radius: inherit;
  background: var(--surface); color: var(--muted); font-size: var(--fs-caption); text-align: center;
}
.mv-page.is-unavailable .mv-page-error { display: grid; }
/* 没有文字层的页（整页是图、扫描页）：鼠标停在页上或框住时，页底左边一行小字 */
.mv-page-hint {
  position: absolute; left: 8px; bottom: 8px; z-index: 2; display: none; max-width: calc(100% - 16px); margin: 0; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface); color: var(--muted);
  font: var(--fs-caption)/1.5 var(--font-sans); pointer-events: none;
}
.mv-page.is-page-only.is-framed .mv-page-hint { display: block; }
@media (hover: hover) { .mv-page.is-page-only:hover .mv-page-hint { display: block; } }
.mv-page.is-unavailable .mv-page-image { visibility: hidden; }
.mv-doc { position: relative; padding: 18px 40px 32px 22px; }
.mv-doc-body { max-width: 68ch; color: var(--ink); font-size: var(--fs-body); line-height: var(--lh-read); overflow-wrap: anywhere; }
.mv-doc-body.is-plain { white-space: pre-wrap; }
.mv-doc-body.is-markdown { display: flex; flex-direction: column; gap: 12px; }
.mv-doc-body.is-markdown :is(h2, h3, h4, h5, h6, h7) { margin: 8px 0 0; font-size: var(--fs-body); font-weight: 600; line-height: var(--lh-title); }
.mv-doc-body.is-markdown h2 { font-size: var(--fs-h2); }
.mv-doc-body.is-markdown :is(p, ul, ol, blockquote, pre) { margin: 0; }
.mv-doc-body.is-markdown :is(ul, ol) { padding-left: 24px; }
.mv-doc-body.is-markdown blockquote { padding: 8px 14px; border-left: 3px solid var(--border-strong); background: var(--surface-subtle); }
.mv-doc-body.is-markdown code { padding: 0.12em 0.34em; border-radius: var(--r-xs); background: var(--surface-subtle); font-size: var(--fs-ui); }
.mv-doc-body.is-markdown pre { overflow: auto; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-subtle); }
.mv-doc-body.is-markdown table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
.mv-doc-body.is-markdown :is(th, td) { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
@media (prefers-reduced-motion: reduce) {
  .mv-page.is-flash { animation: none; }
}

/* 课件卡（fable-plan-v3 §2.5）：准备发送、学生气泡、旁问锚点卡三处。外框、页码角标、说明行、右侧 ↗，
   和学生自己传的图片（裸缩略图、点开看大图）分得开；点开是右栏查看器跳到那一页 */
.material-card {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: min(300px, 100%);
  padding: 5px 6px 5px 5px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
  color: var(--ink); font: var(--fs-caption)/1.4 var(--font-sans); text-align: left; vertical-align: top; cursor: pointer;
}
.material-card:hover { border-color: var(--border-strong); }
.material-card:focus { outline: none; }
.material-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.material-card.is-seg { padding-left: 9px; border-left: 3px solid var(--accent); }
.material-card__thumb {
  position: relative; flex: none; display: block; height: 56px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-xs); background: #fff;
}
.material-card__thumb img { display: block; width: auto; height: 100%; max-width: 240px; object-fit: contain; }
.material-card.is-bubble .material-card__thumb { height: 120px; }
.material-card__tag { top: 3px; left: 3px; height: 16px; padding: 0 4px; cursor: inherit; }
.material-card__meta { display: grid; gap: 1px; min-width: 0; }
.material-card__name, .material-card__where, .material-card__comment { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-card__where { color: var(--muted); }
.material-card__quote {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font-size: var(--fs-ui); line-height: var(--lh-ui); overflow-wrap: anywhere;
}
.material-card__go { flex: none; align-self: flex-start; padding: 0 2px; border: 0; border-radius: var(--r-xs); background: none; color: var(--accent); font: inherit; }
button.material-card__go { cursor: pointer; }
button.material-card__go:hover, button.material-card__go:focus-visible { background: var(--accent-soft); }
.material-card__remove {
  flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--muted); font: inherit; cursor: pointer;
}
.material-card__remove:hover, .material-card__remove:focus-visible { background: var(--surface-subtle); color: var(--ink); }
/* 发送被拒时服务端指出的那张卡：红色描边，标出来时抖一下 */
.material-card.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.material-card.is-invalid.is-seg { border-left-color: var(--danger); }
.material-card.is-shake { animation: material-card-shake .42s ease; }
@keyframes material-card-shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .material-card.is-shake { animation: none; } }
.material-ref-list { display: grid; justify-items: end; gap: 8px; margin-bottom: 8px; }
.material-ref-list:last-child { margin-bottom: 0; }
.material-ref { display: grid; justify-items: end; gap: 4px; max-width: 100%; }
.material-ref__comment { margin: 0; font-size: var(--fs-ui); line-height: var(--lh-ui); overflow-wrap: anywhere; }
.anchor-material { display: flex; margin: 4px 0; }
.anchor-material .material-card { max-width: 100%; }
/* 引用整页的浮层：上面是缩略图加「文件名 · 第 N 页/张」 */
.comment-quote.has-thumb { display: flex; align-items: center; gap: 10px; }
.comment-quote__thumb { flex: none; width: auto; height: 40px; max-width: 72px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--r-xs); background: #fff; }
.comment-quote__text { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 把页码小标签拖进输入框：输入框一圈虚线 */
.composer-box.is-page-drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
/* 「我的经验」里锚在资料上的条目：原文下面一行小字「文件名 · 第 N 页/张」，点它回到课件 */
.cornell-workspace__note-source {
  display: block; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--muted);
  font: var(--fs-caption)/1.5 var(--font-sans); text-align: left; text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer;
}
.cornell-workspace__note-source.is-whole { margin-top: 0; color: inherit; font: inherit; }
.cornell-workspace__note-source:hover, .cornell-workspace__note-source:focus-visible { color: var(--accent-strong); }

/* File format stays legible without relying on colour alone. */
.file-row .material-format-icon, .src-file .material-format-icon { width: 28px; height: 32px; flex: none; color: var(--muted); stroke-width: 1.4; }
.material-format-icon[data-kind="pdf"] { color: var(--danger); }
.material-format-icon[data-kind="doc"] { color: var(--accent-strong); }
.material-format-icon[data-kind="ppt"] { color: var(--marker-ink); }
.material-format-icon[data-kind="sheet"] { color: var(--success); }
.material-format-icon rect { fill: currentColor; stroke: none; }
.material-format-icon text { fill: var(--surface); stroke: none; font: 700 9px var(--font-sans); }


/* ---------- t-20261026-wybz fixB ---------- */
/* 错题本「回到这道题」落到题卡本身，题卡闪一下（同消息的 flash） */
.api-question-section.flash { border-radius: var(--r-md); animation: kp-flash 1.4s ease; }
@media (prefers-reduced-motion: reduce) { .api-question-section.flash, .msg-assistant.flash { animation: none; box-shadow: 0 0 0 2px var(--accent); } }
/* 跟着新单元往上带时页尾垫的空白（workspace.js followRoom） */
.follow-room { height: 0; pointer-events: none; }
/* 窄栏（旁问右栏、页边浮窗、手机、笔记窗）里的表格：每一列至少四个字宽，不再一字一行竖排；放不下就在表格自己的外框里横向滚 */
:is(.msg-body, .aside-answer, .cornell-rich-content, .sn .sn-content) :is(th, td) { min-width: 5em; }
:is(.msg-body, .aside-answer, .cornell-rich-content, .sn .sn-content) .markdown-table-wrap { -webkit-overflow-scrolling: touch; }
/* 手机上「放大」图示：铺满宽度再放大一截，整张可以横着、竖着拖着看，也能双指缩放（html-visual.js / canvas-visual.js 写 is-pan） */
.html-visual-lightbox.is-pan, .canvas-visual-lightbox.is-pan { display: block; overflow: auto; padding: 72px 12px 24px; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.html-visual-lightbox.is-pan .html-visual-lightbox-stage { max-width: none; max-height: none; margin: 0 auto; }
.html-visual-lightbox.is-pan .html-visual-lightbox-frame { pointer-events: none; }
.canvas-visual-lightbox.is-pan .canvas-visual-lightbox-bitmap { max-width: none; max-height: none; margin: 0 auto; }

/* 课程还没有资料时，输入框「+」附上的课件格式文件：附件条上一颗「放进资料」（t-20261027-i1dr），点了走资料上传、进资料库。
   小图标加短字（触屏没有悬停提示，字必须露着）；蓝字是它能点，不抢状态字 */
.attachment-chip__to-materials {
  display: inline-flex; flex: none; align-items: center; gap: 4px; min-height: 28px; padding: 2px 8px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--accent-strong);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.attachment-chip__to-materials svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attachment-chip__to-materials:hover { background: var(--accent-soft); }
.attachment-chip__to-materials:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
