/* ThyroMentor 视觉与全端响应式系统（Cytology Lightbox & Ink Ledger）
   只在 SITE_PROFILE=teaching 激活（body.teach）。
   设计原则：
   1. 实验室阅片纸底色（#f0efeb / #fefefd），纯中性标本暗场（#161616），不给染色片引入色偏；
   2. 人类判读操作与状态严格使用墨色（#1a1916），AI 模型信息严格专属钴蓝（#2545c7）；
   3. 禁用蓝紫渐变、霓虹发光、玻璃拟态；所有统计数字启用 tabular-nums；
   4. 手机端单手触控优先：44px+ 触摸目标、16px 输入框防 iOS 自动缩放、dvh + 安全区避让、横竖屏自适应。 */

body.teach {
  --bg: #f0efeb;
  --bg-soft: #e5e3dd;
  --surface: #f8f7f4;
  --surface-strong: #fefefd;
  --surface-muted: #f3f2ee;

  --text: #1a1916;
  --text-soft: #4c4a45;
  --text-muted: #75726b;

  --primary: #1a1916;
  --primary-hover: #35332e;
  --primary-soft: #ebe8e1;
  --primary-faint: #f6f5f1;

  --line: #dfddd6;
  --line-strong: #c4c1b8;
  --focus: rgba(26, 25, 22, 0.22);

  --ai: #2545c7;
  --ai-strong: #193191;
  --ai-soft: #e8edfc;
  --ai-surface: #f6f8fe;
  --ai-line: #ccd6f6;

  --stage: #161616;

  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 10px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", "HarmonyOS Sans SC", "MiSans",
    "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-tap-highlight-color: rgba(26, 25, 22, 0.08);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.teach kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-strong);
  color: var(--text-soft);
  font: 600 11px/18px "Cascadia Mono", Consolas, monospace;
  text-align: center;
}

.teach .panel {
  padding: 18px 20px;
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.teach .chip {
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.teach .btn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease,
    transform 80ms ease;
}

.teach .btn:active:not(:disabled) {
  transform: translateY(1px);
}

.teach .btn-outline-ink {
  border-color: var(--text);
  background: var(--surface-strong);
  color: var(--text);
}

.teach .btn-outline-ink:hover {
  background: var(--primary-soft);
}

.teach .btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-soft);
}

.teach .btn-quiet:hover {
  border-color: var(--line);
  background: var(--surface-muted);
}

/* ===== 顶栏 ===== */
.teach-topbar {
  display: flex;
  align-items: stretch;
  gap: var(--space-5);
  min-height: 58px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.teach-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.teach-brand:hover {
  text-decoration: none;
}

.teach-mark {
  width: 26px;
  height: 26px;
  flex: none;
  fill: var(--primary);
}

.teach-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
}

.teach-brand-text strong {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.teach-brand-text small {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

.teach-nav {
  display: flex;
  flex: 1;
  gap: var(--space-1);
}

.teach-nav .nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 58px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 140ms ease, box-shadow 140ms ease;
}

.teach-nav .nav-link:hover {
  background: none;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--line-strong);
}

.teach-nav .nav-link.active {
  background: none;
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.teach-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
}

.teach-user-name {
  max-width: 140px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.teach-user .btn {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
}

/* ===== 登录/注册页 ThyroMentor 品牌头 ===== */
.teach-auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.teach-auth-brand:hover {
  text-decoration: none;
}

.teach-auth-brand div {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.teach-auth-brand strong {
  font-size: 17px;
  font-weight: 750;
}

.teach-auth-brand span {
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== 任务标题条 ===== */
.teach-subhead {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 28px 12px;
}

.teach-subhead-compact {
  max-width: 1180px;
}

.teach-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-width: 0;
  margin-right: auto;
}

.teach-title h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.teach-title .eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.teach-mode {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-muted);
  font-size: 13px;
}

.mode-pill svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.mode-pill strong {
  color: var(--primary);
  font-weight: 700;
}

.back-link {
  order: 3;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.back-link::before {
  content: "←";
  margin-right: 6px;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.nav-toggle strong {
  font-variant-numeric: tabular-nums;
}

.nav-toggle::after {
  content: "▾";
  font-size: 11px;
}

/* ===== 作答页三栏 ===== */
.quiz-shell.teach-shell {
  grid-template-columns: 278px minmax(0, 1fr) 356px;
  gap: 16px;
  max-width: 1600px;
  padding: 0 28px 48px;
}

.quiz-shell.teach-shell.no-ai {
  grid-template-columns: 278px minmax(0, 1fr);
  max-width: 1380px;
}

.teach-shell.no-ai .ai-panel {
  display: none;
}

.teach-shell:not(.mode-ai_review) .legend-final {
  display: none;
}

@keyframes teach-rise {
  from {
    transform: translateY(10px);
  }
}

.teach-shell > * {
  animation: teach-rise 420ms var(--ease-out) backwards;
}

.teach-shell > :nth-child(2) {
  animation-delay: 60ms;
}

.teach-shell > :nth-child(3) {
  animation-delay: 120ms;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.side-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

/* ----- 左栏：进度、防丢状态与题号筛选 ----- */
.teach .quiz-sidebar {
  top: 16px;
}

.sheet-grabber {
  display: none;
}

.progress-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.progress-figure strong {
  color: var(--text);
  font-size: 34px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.teach .progress-block {
  margin-bottom: var(--space-4);
}

.teach .progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-soft);
}

.teach .progress-fill {
  border-radius: 999px;
  background: var(--primary);
  transition: width 300ms var(--ease-out);
}

.save-line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.storage-guard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.storage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-soft);
  font-size: 11.5px;
}

.storage-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #257a54;
}

.storage-backup-btn {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.storage-backup-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 var(--space-4);
  border-block: 1px solid var(--line);
}

.side-stats div {
  padding: 10px 0;
}

.side-stats div + div {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.side-stats dt,
.case-meta dt {
  color: var(--text-muted);
  font-size: 12px;
}

.side-stats dd,
.case-meta dd {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.teach .nav-head {
  margin-bottom: 8px;
}

.teach .nav-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.nav-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.nav-filter-pill {
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.nav-filter-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.nav-filter-pill.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface-strong);
}

.nav-empty-filter {
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.nav-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: 12px;
}

.nav-legend li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  position: relative;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-strong);
}

.legend-swatch.answered {
  border-color: var(--text);
  background: var(--text);
}

.legend-swatch.awaiting-final {
  border: 1.5px dashed var(--text);
  background: var(--surface-strong);
}

.legend-swatch.reviewed::after,
.teach .nav-pill.reviewed::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  border: 5px solid transparent;
  border-top-color: #c58a12;
  border-right-color: #c58a12;
  border-top-right-radius: 3px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 6px;
}

.teach .nav-pill {
  position: relative;
  min-height: 34px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.teach .nav-pill:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.teach .nav-pill.answered,
.teach .nav-pill.reviewed.answered {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface-strong);
}

.teach .nav-pill.reviewed {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text-soft);
}

.teach .nav-pill.awaiting-final,
.teach .nav-pill.answered.awaiting-final {
  border: 1.5px dashed var(--text);
  background: var(--surface-strong);
  color: var(--text);
}

.teach .nav-pill.active,
.teach .nav-pill.active.answered,
.teach .nav-pill.active.reviewed {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.teach .nav-pill.unanswered-alert {
  border-color: #cf5f58;
  background: var(--danger-soft);
  color: #8a2a25;
  box-shadow: none;
}

.teach .question-nav-help {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.85;
}

/* ----- 中栏：标本观察与判读 ----- */
.inline-stepper-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 12px;
}

.inline-step-track {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.inline-step {
  color: var(--text-muted);
  font-weight: 600;
}

.inline-step.active {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface-strong);
}

.inline-step.done {
  color: var(--text);
}

.inline-step-sep {
  color: var(--line-strong);
  font-size: 11px;
}

.inline-step-jump {
  padding: 3px 9px;
  border: 1px solid var(--ai-line);
  border-radius: 999px;
  background: var(--ai-soft);
  color: var(--ai-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.teach .case-panel .case-head {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 14px;
}

.case-title {
  margin-right: auto;
}

.case-title .eyebrow {
  margin-bottom: 0;
}

.case-title h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.case-meta {
  display: flex;
  margin: 0;
}

.case-meta div {
  min-width: 86px;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.case-meta dd {
  font-size: 14px;
}

.teach .review-toggle {
  min-height: 36px;
}

.teach .image-grid {
  margin-bottom: 8px;
}

.teach .image-tile {
  position: relative;
  border: 1px solid #262626;
  border-radius: 8px;
  background: var(--stage);
}

.teach .image-tile::after {
  content: "点击全屏放大";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.78);
  color: #f4f3ef;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
  transition: opacity 140ms ease;
}

.teach .image-tile:hover::after,
.teach .image-tile:focus-visible::after {
  opacity: 1;
}

.teach-shell .image-tile img {
  max-height: 46vh;
  max-height: 46dvh;
}

.teach .image-loading,
.teach .image-error {
  border-radius: 8px;
}

.teach .image-feedback-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 8px;
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.image-zoom-tip {
  margin-right: auto;
  color: var(--text-muted);
}

.image-feedback-sep {
  display: none;
}

.teach .image-feedback-btn {
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--line);
  background: transparent;
  font-size: 12px;
}

.teach .answer-block {
  container-type: inline-size;
  margin-bottom: 14px;
}

.teach .section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.teach .section-head h3 {
  margin-right: auto;
  font-size: 15px;
  font-weight: 700;
}

.locked-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 650;
}

.teach .shortcut-hint {
  font-weight: 500;
}

.teach .option-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

@container (max-width: 560px) {
  .teach .option-group {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

.teach .option-pill {
  min-height: 48px;
  padding: 8px 10px;
  border-color: var(--line-strong);
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease,
    box-shadow 140ms ease;
}

.teach .option-pill:hover {
  border-color: var(--primary);
  background: var(--primary-faint);
}

.teach .option-pill.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.teach .option-key {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  border-radius: 5px;
  font-weight: 700;
}

.teach .option-group.locked .option-pill {
  cursor: not-allowed;
  border-style: dashed;
  background: var(--surface-muted);
  color: var(--text-muted);
  box-shadow: none;
}

.teach .option-group.locked .option-pill.selected {
  border-style: solid;
  border-color: var(--text);
  background: var(--primary-soft);
  color: var(--text);
}

.teach .option-group.locked .option-pill.selected .option-key {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface-strong);
}

.teach .note-field {
  margin-bottom: 8px;
}

.teach .note-field textarea {
  min-height: 60px;
  border-color: var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.teach .action-dock {
  bottom: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px -12px rgba(16, 32, 29, 0.3);
}

.teach .btn-submit {
  margin-left: auto;
  border-color: var(--text);
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.teach .btn-submit:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface-strong);
}

/* ----- 右栏：ThyroMentor AI 面板 ----- */
.ai-panel {
  position: sticky;
  top: 16px;
  height: fit-content;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  border-color: var(--ai-line);
  background: var(--ai-surface);
}

.ai-panel .side-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.ai-panel .side-head h2 {
  color: var(--ai-strong);
}

.ai-disclaimer {
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
}

.ai-mode-help {
  margin: 0 0 var(--space-4);
  color: var(--text-soft);
  font-size: 13px;
}

.ai-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.ai-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.ai-step + .ai-step::before {
  content: "";
  position: absolute;
  top: 12px;
  right: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 1px;
  background: var(--line-strong);
}

.ai-step.done + .ai-step::before {
  background: var(--primary);
}

.ai-step-no {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-strong);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ai-step.active {
  color: var(--text);
}

.ai-step.active .ai-step-no {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.ai-step.done {
  color: var(--primary-hover);
}

.ai-step.done .ai-step-no {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--surface-strong);
}

.ai-empty,
.ai-locked p {
  margin: 0 0 var(--space-3);
  color: var(--text-soft);
  font-size: 14px;
}

.ai-locked {
  padding: 16px;
  border: 1px dashed var(--ai-line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
}

.ai-locked .btn {
  width: 100%;
}

.ai-locked .btn-primary {
  border-color: var(--ai);
  background: var(--ai);
}

.ai-locked .btn-primary:hover {
  border-color: var(--ai-strong);
  background: var(--ai-strong);
}

.ai-locked .feedback {
  margin-top: var(--space-2);
}

.ai-suggestion > span {
  display: block;
  color: var(--ai);
  font-size: 12px;
  font-weight: 700;
}

.ai-suggestion strong {
  display: block;
  margin-top: 2px;
  color: var(--ai-strong);
  font-size: 29px;
  font-weight: 750;
  line-height: 1.2;
}

.ai-suggestion p {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.ai-meter {
  display: inline-flex;
  gap: 3px;
}

.ai-meter i {
  width: 14px;
  height: 5px;
  border-radius: 2px;
  background: var(--ai-line);
}

.ai-meter[data-level="low"] i:nth-child(-n + 1),
.ai-meter[data-level="medium"] i:nth-child(-n + 2),
.ai-meter[data-level="high"] i {
  background: var(--ai);
}

.ai-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--ai-line);
}

.ai-section h3 {
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.ai-features {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.ai-features li {
  position: relative;
  padding: 5px 10px 5px 20px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.ai-features li::before {
  content: "";
  position: absolute;
  top: 0.85em;
  left: 8px;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--ai);
}

.ai-rationale {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.68;
}

.ai-decision h3 {
  color: var(--text);
  font-size: 15px;
}

.ai-hint {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.ai-peek {
  display: none;
  width: 100%;
  margin-bottom: 10px;
}

.ai-peek-card {
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ai-peek-card img {
  width: 52px;
  height: 40px;
  flex: none;
  border-radius: 4px;
  background: var(--stage);
  object-fit: cover;
}

.ai-peek-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  line-height: 1.25;
}

.ai-peek-copy strong {
  font-size: 13px;
  font-weight: 700;
}

.ai-peek-copy small {
  color: var(--text-muted);
  font-size: 11.5px;
}

.ai-peek-cta {
  color: var(--ai-strong);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.ai-confirm {
  position: sticky;
  bottom: -18px;
  margin: var(--space-3) -20px -18px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--ai-line);
  background: var(--ai-surface);
}

.ai-confirm .btn {
  width: 100%;
}

.ai-confirm .ai-hint {
  margin: 6px 0 0;
  text-align: center;
}

.ai-final-options {
  display: grid;
  gap: 6px;
}

.ai-final-option {
  position: relative;
  display: grid;
  gap: 1px;
  min-height: 54px;
  padding: 8px 12px 8px 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.ai-final-option::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 13px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

.ai-final-option.selected::before {
  content: "";
  border-color: var(--text);
  background: var(--text);
  box-shadow: inset 0 0 0 3.5px var(--surface-strong);
}

.ai-final-title {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.ai-final-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}

.ai-opt-kbd {
  margin-left: auto;
}

.ai-final-option.is-ai .ai-final-title {
  color: var(--ai);
}

.ai-final-option.is-ai .ai-final-value {
  color: var(--ai-strong);
}

.ai-final-option:hover {
  border-color: var(--primary);
  background: var(--primary-faint);
}

.ai-final-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.ai-final-more:not(.selected)::before {
  content: "+";
  border-style: dashed;
}

.ai-final-more[aria-expanded="true"]:not(.selected)::before {
  content: "−";
}

.ai-final-more:not(.selected) .ai-final-value {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.ai-final-others {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
  margin-left: 21px;
  padding-left: 20px;
  border-left: 1px solid var(--line-strong);
}

.ai-final-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.ai-final-sub:hover {
  border-color: var(--primary);
  background: var(--primary-faint);
}

.ai-final-sub.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.chip-ai {
  border-color: var(--ai-line);
  background: var(--ai-soft);
  color: var(--ai-strong);
}

.ai-compare {
  display: grid;
  margin: 0 0 10px;
  font-size: 14px;
}

.ai-compare div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 7px 0;
}

.ai-compare div + div {
  border-top: 1px dashed var(--ai-line);
}

.ai-compare dt {
  color: var(--text-muted);
}

.ai-compare dd {
  margin: 0;
  font-weight: 650;
}

.ai-compare-ai {
  color: var(--ai-strong);
}

.ai-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-adopt {
  display: flex;
  width: 100%;
  margin-top: var(--space-3);
  border-color: var(--ai-line);
  background: var(--surface-strong);
  color: var(--ai-strong);
}

.ai-reason {
  margin-top: var(--space-3);
}

.ai-reason textarea {
  min-height: 64px;
  border-color: var(--ai-line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
}

.ai-prob-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-prob-head h3 {
  margin: 0;
}

.ai-prob-source {
  color: var(--text-muted);
  font-size: 11px;
}

.ai-prob-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 50px;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.ai-prob-row + .ai-prob-row {
  margin-top: 7px;
}

.ai-prob-row strong {
  text-align: right;
  font-weight: 600;
}

.ai-prob-row.is-top {
  color: var(--text);
  font-weight: 700;
}

.ai-prob-row.is-top strong {
  color: var(--ai-strong);
  font-weight: 700;
}

.ai-prob-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ai-soft);
}

.ai-prob-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--ai);
  opacity: 0.45;
}

.ai-prob-row.is-top .ai-prob-fill {
  background: var(--ai-strong);
  opacity: 1;
}

.ai-prob-malignant.is-high .ai-prob-fill {
  background: #b43c2f;
}

.ai-prob-malignant.is-high strong {
  color: #9c2f23;
}

.ai-prob-malignant.is-mid .ai-prob-fill {
  background: #b7791f;
}

.ai-prob-malignant.is-mid strong {
  color: #8f5b12;
}

.ai-prob-malignant.is-low .ai-prob-fill {
  background: var(--primary);
}

.ai-prob-benign .ai-prob-fill {
  background: var(--ai);
  opacity: 0.5;
}

.ai-inline-prob {
  color: var(--ai-strong);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ai-footnote {
  margin: var(--space-4) 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== 首页：工作台进度总览与批次账本 ===== */
.teach .page-shell.teach-home {
  max-width: 1120px;
  padding-top: 30px;
}

.home-kicker {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.home-intro h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 750;
}

.home-intro p {
  max-width: 64ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 14.5px;
}

.unauth-hero {
  display: grid;
  gap: 10px;
  padding: 10px 4px;
}

.unauth-hero h2 {
  margin: 0;
  font-size: 24px;
}

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 22px 0 18px;
  padding: 18px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.resume-banner-main {
  flex: 1;
  min-width: 0;
}

.resume-stats {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.resume-eyebrow {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.resume-stat-primary strong {
  font-size: 28px;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.resume-stat-primary small {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.resume-stat-meta {
  display: flex;
  gap: 16px;
  color: var(--text-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.resume-progress-bar {
  height: 7px;
  margin-bottom: 8px;
}

.resume-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.resume-banner-action {
  flex: none;
}

.resume-cta {
  min-height: 46px;
  padding: 0 20px;
  font-size: 14.5px;
}

/* 可折叠三步说明 */
.protocol-card {
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.protocol-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.protocol-summary::-webkit-details-marker {
  display: none;
}

.protocol-toggle-hint {
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.mode-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0 18px 16px;
  border-top: 1px solid var(--line);
  list-style: none;
  counter-reset: mode;
}

.mode-legend li {
  padding: 14px 20px 4px 0;
  counter-increment: mode;
}

.mode-legend li + li {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.mode-legend li::before {
  content: "STEP 0" counter(mode);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.mode-legend li.is-ai-step::before,
.mode-legend li.is-ai-step h2 {
  color: var(--ai-strong);
}

.mode-legend h2 {
  margin: 2px 0 5px;
  font-size: 16px;
  font-weight: 700;
}

.mode-legend p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.teach .tasks-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.teach .task-card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.teach .task-card:hover {
  border-color: var(--line-strong);
  box-shadow: none;
}

.task-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.teach .task-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.task-batch-summary {
  color: var(--text-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.teach .task-card .task-meta {
  margin: 6px 0 0;
}

.task-desc {
  margin: 8px 0 0;
}

.batch-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.filter-pill {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill:hover {
  border-color: var(--text);
  color: var(--text);
}

.filter-pill.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface-strong);
}

.table-scroll {
  margin-top: 14px;
  overflow-x: auto;
}

.teach .mode-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}

.teach .mode-table th,
.teach .mode-table td {
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  vertical-align: middle;
}

.teach .mode-table thead th {
  padding-bottom: 8px;
  border-bottom-color: var(--line-strong);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.teach .mode-table tbody tr:last-child > * {
  border-bottom: 0;
}

.teach .mode-table tbody tr.is-row-active {
  background: var(--primary-faint);
}

.mode-table th[scope="row"] {
  padding-left: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.teach .mode-table .history-subtext {
  display: inline;
  margin-left: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.batch-action-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-right: 6px;
}

.batch-mini-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.batch-state-badge {
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.batch-state-badge.is-active {
  color: var(--text);
  font-weight: 650;
}

.batch-state-badge.is-done {
  color: #257a54;
  font-weight: 600;
}

.batch-mini-bar {
  width: 140px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-soft);
}

.batch-mini-bar > div {
  height: 100%;
  border-radius: 999px;
  background: var(--text);
}

.teach .mode-table .btn {
  min-width: 108px;
  min-height: 38px;
}

.batch-empty-cell {
  padding: 20px 0 !important;
  color: var(--text-muted);
  text-align: center !important;
}

.mode-unavailable {
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state-box {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  text-align: center;
}

/* ===== 结果页与后台扩展 ===== */
.teach-result-summary {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.teach-behavior-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.result-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-line-ai strong {
  color: var(--ai-strong);
}

.teach .result-img {
  background: var(--stage);
}

.teach .chart-series.series-primary .chart-line,
.teach .chart-series.series-primary .chart-point {
  stroke: var(--ai);
}

.teach .chart-series.series-primary .chart-area {
  fill: var(--ai);
}

.teach .chart-legend-item.series-primary i {
  background: var(--ai);
}

.teach .sparkline-line,
.teach .sparkline-dot {
  stroke: var(--ai);
}

.teach .reader-track-volume > i {
  background: var(--text);
}

.teach .reader-track-acc > i {
  background: var(--ai);
}

.teach-export-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--ai-line);
  border-radius: var(--radius-md);
  background: var(--ai-surface);
}

.teach-export-callout h3 {
  margin: 0 0 4px;
  color: var(--ai-strong);
  font-size: 16px;
}

.teach-export-callout .btn-primary {
  border-color: var(--ai);
  background: var(--ai);
}

.q-ai-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.q-ai-status.is-ready {
  border: 1px solid var(--ai-line);
  background: var(--ai-surface);
  color: var(--ai-strong);
}

.q-ai-status.is-missing {
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
}

/* ===== 只在单列布局出现的部件（多栏时不显示） ===== */
.flow-hint,
.flow-btn,
.dock-icon,
.sheet-only,
.sheet-close,
.sheet-backdrop,
.ai-inline {
  display: none;
}

.teach .question-nav {
  position: relative;
  max-height: max(180px, calc(100vh - 520px));
  margin: -5px;
  padding: 5px;
  overflow-y: auto;
}

.ai-inline {
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--ai-line);
  border-radius: var(--radius-md);
  background: var(--ai-surface);
  font-size: 14px;
}

.ai-inline-label {
  color: var(--ai);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ai-inline strong {
  color: var(--ai-strong);
  font-size: 16px;
}

.ai-inline-wait {
  color: var(--text-muted);
}

.ai-inline-more {
  min-height: 36px;
  margin-left: auto;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ai-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  cursor: pointer;
}

/* ===== 响应式断点体系 ===== */
@media (max-width: 1380px) and (min-width: 1181px) {
  .quiz-shell.teach-shell {
    grid-template-columns: 236px minmax(0, 1fr) 338px;
    gap: 14px;
    padding: 0 18px 44px;
  }
}

@media (max-width: 1180px) {
  .quiz-shell.teach-shell {
    grid-template-columns: 272px minmax(0, 1fr);
  }

  .teach-shell .ai-panel {
    position: static;
    grid-column: 2;
    max-height: none;
  }

  .ai-confirm {
    position: static;
  }

  .inline-stepper-bar {
    display: flex;
  }

  .inline-stepper-bar[hidden],
  .ai-inline[hidden] {
    display: none;
  }

  .ai-inline {
    display: flex;
  }
}

/* ---------- 单列（<= 1000px）：手机/平板竖屏沉浸作答 ---------- */
@media (max-width: 1000px) {
  .quiz-shell.teach-shell,
  .quiz-shell.teach-shell.no-ai {
    grid-template-columns: 1fr;
    padding-bottom: calc(126px + env(safe-area-inset-bottom));
  }

  .teach-shell > * {
    animation: none;
  }

  .teach-shell .quiz-main {
    order: 1;
  }

  .teach-shell .ai-panel {
    grid-column: auto;
    order: 2;
  }

  .teach-shell .image-tile img {
    max-height: 54vh;
    max-height: 54dvh;
  }

  .nav-toggle {
    display: inline-flex;
  }

  /* 底部抽屉：支持顶部拖拽条下滑关闭 */
  .teach .quiz-sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    max-height: 85vh;
    max-height: 85dvh;
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -18px 40px -24px rgba(26, 25, 22, 0.5);
    visibility: hidden;
    transform: translateY(102%);
    transition: transform 260ms var(--ease-out), visibility 0s 260ms;
  }

  .sheet-grabber {
    display: flex;
    justify-content: center;
    padding: 4px 0 10px;
    touch-action: none;
    cursor: grab;
  }

  .sheet-grabber span {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
  }

  body.sheet-open .quiz-sidebar {
    visibility: visible;
    transform: none;
    transition: transform 260ms var(--ease-out), visibility 0s;
  }

  body.sheet-open {
    overflow: hidden;
  }

  .sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 39;
    display: block;
    background: rgba(26, 25, 22, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  body.sheet-open .sheet-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sheet-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-soft);
    font-size: 16px;
    cursor: pointer;
  }

  .quiz-sidebar .side-head h2 {
    margin-right: auto;
  }

  .sheet-only {
    display: flex;
  }

  .progress-block .sheet-only {
    width: 100%;
    min-height: 42px;
    margin-top: 10px;
  }

  .quiz-sidebar > .sheet-only {
    width: 100%;
    min-height: 48px;
    margin: 18px 0 0;
  }

  .teach .question-nav {
    max-height: none;
    overflow: visible;
  }

  .nav-grid {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  }

  .teach .nav-pill {
    min-height: 44px;
  }

  .nav-filter-pill {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 12.5px;
  }

  /* 拇指热区底部操作条：提示语 + 上一题 / 下一步 / 下一题 */
  .teach .action-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 6px 8px;
    margin: 0;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 0;
    background: var(--surface-strong);
    box-shadow: 0 -8px 20px -16px rgba(26, 25, 22, 0.45);
  }

  .flow-hint {
    display: block;
    grid-column: 1 / -1;
    min-height: 18px;
    margin: 0;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .teach .flow-btn {
    display: inline-flex;
    min-height: 48px;
    padding: 0 12px;
    font-size: 15px;
    font-weight: 700;
    transition: none;
  }

  .teach .flow-btn.flow-ai {
    border-color: var(--ai);
    background: var(--ai);
  }

  .teach .flow-btn:disabled {
    border: 1px dashed var(--line-strong);
    background: var(--surface-muted);
    color: var(--text-muted);
    opacity: 1;
  }

  .teach-quiz .action-dock #prev-btn,
  .teach-quiz .action-dock #next-btn {
    min-height: 48px;
    padding: 0;
    border-color: var(--line-strong);
    background: var(--surface-strong);
    color: var(--text);
  }

  .dock-icon {
    display: inline;
    font-size: 26px;
    line-height: 1;
  }

  .dock-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .teach-quiz .action-dock #save-btn,
  .teach-quiz .action-dock #submit-btn,
  .teach-quiz #ai-reveal-btn,
  .teach-quiz .ai-confirm {
    display: none;
  }

  .ai-peek {
    display: flex;
  }

  .ai-final-option {
    min-height: 58px;
  }

  .ai-final-sub {
    min-height: 46px;
  }

  .teach #quiz-feedback:not(:empty) {
    position: fixed;
    right: 12px;
    bottom: calc(110px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 21;
    padding: 10px 12px;
    border: 1px solid #d9a7a3;
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    color: #842b27;
    box-shadow: 0 8px 20px -14px rgba(26, 25, 22, 0.5);
  }

  .teach #quiz-feedback[data-kind="success"]:not(:empty) {
    border-color: #b7d5c4;
    background: var(--success-soft);
    color: #1d6042;
  }

  .ai-panel,
  .case-panel,
  .ai-decision {
    scroll-margin: 12px 0 132px;
  }
}

/* ---------- 手机端（<= 760px）深度适配 ---------- */
@media (max-width: 760px) {
  .teach-topbar {
    flex-wrap: wrap;
    gap: 0 var(--space-3);
    padding: 8px 14px 0;
  }

  .teach-brand {
    flex: 1;
    min-height: 42px;
  }

  .teach-brand-text small {
    font-size: 11px;
  }

  .teach-nav {
    order: 3;
    flex-basis: 100%;
    gap: 4px;
    overflow-x: auto;
  }

  .teach-nav .nav-link {
    min-height: 42px;
    padding: 0 12px 0 0;
  }

  .teach-user .btn {
    min-height: 38px;
  }

  .teach-quiz .teach-topbar {
    display: none;
  }

  .teach-quiz .teach-subhead {
    position: sticky;
    top: 0;
    z-index: 15;
    gap: 8px;
    max-width: none;
    padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-strong);
  }

  .teach-quiz .back-link {
    order: 0;
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-left: -6px;
    border-radius: 50%;
    color: var(--text);
    font-size: 18px;
  }

  .teach-quiz .back-link::before {
    margin: 0;
  }

  .teach-quiz .back-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .teach-quiz .teach-title {
    flex: 1;
    flex-wrap: nowrap;
    margin: 0;
  }

  .teach-quiz .teach-title h1 {
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .teach-quiz .teach-title .eyebrow,
  .teach-quiz .mode-pill {
    display: none;
  }

  .nav-toggle {
    min-height: 38px;
    padding: 0 12px;
  }

  .quiz-shell.teach-shell {
    gap: 12px;
    padding-top: 10px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .ai-panel,
  .case-panel,
  .ai-decision {
    scroll-margin-top: 64px;
  }

  .teach .panel {
    padding: 14px;
  }

  .inline-stepper-bar {
    padding: 6px 8px;
    font-size: 11.5px;
  }

  .teach .case-panel .case-head {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }

  .case-title {
    display: flex;
    flex: none;
    align-items: baseline;
    gap: 6px;
  }

  .case-title .eyebrow {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
  }

  .case-title h2 {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
  }

  .case-meta {
    min-width: 0;
  }

  .case-meta div {
    display: none;
  }

  .case-meta div:nth-child(2) {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .case-meta div:nth-child(2) dt {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .case-meta div:nth-child(2) dd {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .teach .review-toggle {
    flex: none;
    min-height: 38px;
    padding: 0 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .teach-shell .image-tile img {
    max-height: 42vh;
    max-height: 42dvh;
  }

  .teach .image-tile::after {
    content: "双击/点击放大";
    padding: 3px 8px;
    font-size: 11px;
  }

  .teach .image-grid {
    margin-bottom: 6px;
  }

  .image-zoom-tip {
    display: none;
  }

  .teach .image-feedback-bar {
    justify-content: flex-start;
    margin-bottom: 12px;
  }

  .teach .image-feedback-btn {
    min-height: 38px;
    padding: 0 11px;
    font-size: 12.5px;
  }

  .teach .section-head {
    flex-direction: row;
    align-items: center;
    margin-bottom: 8px;
  }

  .teach .option-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .teach .option-pill {
    min-height: 46px;
    padding: 8px 12px;
  }

  .teach .note-field {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .teach .note-field textarea {
    height: 46px;
    min-height: 46px;
    padding: 10px 12px;
    resize: none;
  }

  .teach .note-field textarea:focus {
    height: 98px;
  }

  .ai-suggestion strong {
    font-size: 26px;
  }

  .ai-prob-row {
    grid-template-columns: 72px minmax(0, 1fr) 46px;
    font-size: 12.5px;
  }

  /* 首页手机端：进度卡吸睛，批次改卡片行 */
  .teach .page-shell.teach-home {
    padding: 18px 12px 40px;
  }

  .home-intro h1 {
    font-size: 24px;
  }

  .resume-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin: 16px 0;
    padding: 16px;
  }

  .resume-cta {
    width: 100%;
  }

  .mode-legend {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }

  .mode-legend li,
  .mode-legend li + li {
    padding: 12px 0;
    border-left: 0;
  }

  .mode-legend li + li {
    border-top: 1px solid var(--line);
  }

  .teach .task-card {
    padding: 16px;
  }

  .teach .task-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .teach .task-card .table-scroll {
    overflow-x: visible;
  }

  .teach .mode-table,
  .teach .mode-table tbody,
  .teach .mode-table tr,
  .teach .mode-table th,
  .teach .mode-table td {
    display: block;
    min-width: 0;
  }

  .teach .mode-table thead {
    display: none;
  }

  .teach .mode-table tbody tr {
    padding: 12px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    background: var(--surface);
  }

  .teach .mode-table tbody tr.is-row-active {
    border-color: var(--text);
    background: var(--surface-strong);
  }

  .teach .mode-table th[scope="row"] {
    padding: 0 0 6px;
    border: 0;
    color: var(--text);
    font-size: 15px;
  }

  .teach .mode-table td {
    padding: 0;
    border: 0;
  }

  .batch-action-cell {
    flex-wrap: wrap;
    padding-right: 0;
  }

  .teach .mode-table .btn {
    min-width: 116px;
    min-height: 44px;
  }

  /* 登录/注册页手机端减少顶部留白 */
  .teach .auth-shell {
    padding: 24px 14px calc(32px + env(safe-area-inset-bottom));
  }

  .teach .auth-panel {
    width: 100%;
    max-width: 440px;
  }

  .teach .auth-panel .btn-primary {
    width: 100%;
    min-height: 46px;
  }

  /* 弹窗贴合手机底部操作习惯 */
  .teach .modal {
    align-items: flex-end;
    padding: 0;
  }

  .teach .modal-card {
    width: 100%;
    max-width: none;
    max-height: 90vh;
    max-height: 90dvh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
  }
}

/* ---------- 手机横屏适配（避免标本被顶底栏挤压） ---------- */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 1000px) {
  .teach-quiz .teach-subhead {
    position: static;
  }

  .teach-shell .image-tile img {
    max-height: 62vh;
  }

  .teach .option-group {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .teach .action-dock {
    padding-top: 5px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .flow-hint {
    display: none;
  }

  .teach .flow-btn,
  .teach #prev-btn,
  .teach #next-btn {
    min-height: 40px;
  }
}

/* ---------- 触屏防 iOS 自动缩放 + 隐藏键盘快捷键提示 ---------- */
@media (hover: none) and (pointer: coarse), (max-width: 760px) {
  .teach .shortcut-hint,
  .teach .question-nav-help,
  .ai-opt-kbd {
    display: none;
  }

  body.teach input,
  body.teach textarea,
  body.teach select {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .teach-shell > * {
    animation: none;
  }

  .teach .progress-fill,
  .teach .quiz-sidebar,
  body.sheet-open .quiz-sidebar,
  .sheet-backdrop {
    transition: none;
  }
}

/* ----- 快捷跳至首道未完成 & 灯箱切题按钮 & 首页分组条 ----- */
.teach .nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-jump-pending {
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary-hover);
  font: inherit;
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
}

.nav-jump-pending:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.lightbox-tool:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.resume-arm-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

/* =====================================================================
   教学站逐题提交流程（body.lock-flow，2026-11-28）
   - 每题首答“提交”后锁定；有 AI 的题在主选项区里选终答
   - 底部主按钮在所有宽度都显示，Enter 等同点击
   - 窄屏（<=1180px）把 AI 卡片放在选项正上方，不用滚到页面底部
   ===================================================================== */
.lock-flow .option-pill {
  position: relative;
}

.option-tags {
  position: absolute;
  top: -9px;
  right: 6px;
  display: inline-flex;
  gap: 4px;
  pointer-events: none;
}

.option-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}

.option-tag.tag-first {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text-soft);
}

.option-tag.tag-ai {
  border: 1px solid var(--ai-line);
  background: var(--ai-soft);
  color: var(--ai-strong);
}

.teach .option-group.final-pick .option-pill {
  border-color: var(--ai-line);
}

.teach .option-group.final-pick .option-pill:hover {
  border-color: var(--ai);
  background: var(--ai-surface);
}

.teach .option-group.final-pick .option-pill.selected {
  border-color: var(--ai);
  background: var(--ai-soft);
  color: var(--ai-strong);
  box-shadow: inset 0 0 0 1px var(--ai);
}

/* 首答 / AI / 终答 对照条 */
.ai-compare-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}

.ai-compare-strip > div {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.ai-compare-strip dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

.ai-compare-strip dd {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-compare-strip .is-ai {
  border-color: var(--ai-line);
  background: var(--ai-soft);
}

.ai-compare-strip .is-ai dd {
  color: var(--ai-strong);
}

.ai-compare-strip .is-empty dd {
  color: var(--text-muted);
  font-weight: 500;
}

/* 底部主按钮：多栏布局也显示 */
.teach-quiz.lock-flow .action-dock {
  flex-wrap: nowrap;
}

.teach-quiz.lock-flow .action-dock #prev-btn {
  order: 0;
}

.teach-quiz.lock-flow .action-dock #next-btn {
  order: 1;
}

.teach-quiz.lock-flow .action-dock .flow-btn {
  order: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 42px;
  font-weight: 700;
  white-space: nowrap;
}

.teach-quiz.lock-flow .action-dock .flow-btn.flow-ai {
  border-color: var(--ai);
  background: var(--ai);
}

.teach-quiz.lock-flow .action-dock .flow-btn:disabled {
  border: 1px dashed var(--line-strong);
  background: var(--surface-muted);
  color: var(--text-muted);
  opacity: 1;
}

.teach-quiz.lock-flow .action-dock .flow-hint {
  order: 3;
  display: block;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 0;
}

.teach-quiz.lock-flow .action-dock #save-btn {
  order: 4;
}

.teach-quiz.lock-flow .action-dock #submit-btn {
  order: 5;
}

.teach-quiz.lock-flow .action-dock #next-btn {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

/* AI 卡片（窄屏放在选项上方） */
.teach-quiz .ai-inline.is-review {
  display: none;
}

.ai-inline-card {
  width: 100%;
}

.ai-inline-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--ai-strong);
  font-size: 14px;
  font-weight: 700;
}

.ai-inline-title span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

@media (max-width: 1180px) {
  .teach-quiz.lock-flow .teach-shell.mode-ai_review .ai-panel {
    display: none;
  }

  .teach-quiz .ai-inline.is-review:not([hidden]) {
    display: block;
    padding: 12px;
  }
}

@media (max-width: 1000px) {
  /* 单列：沿用原有网格操作条（提示语 / 上一题 · 主按钮 · 下一题） */
  .teach-quiz.lock-flow .action-dock .flow-hint {
    order: -1;
    flex: none;
    white-space: nowrap;
  }

  .teach-quiz.lock-flow .action-dock #prev-btn {
    order: 0;
  }

  .teach-quiz.lock-flow .action-dock .flow-btn {
    order: 1;
    min-width: 0;
    min-height: 48px;
  }

  .teach-quiz.lock-flow .action-dock #next-btn {
    order: 2;
  }
}

/* =====================================================================
   左侧任务进度栏折叠（2026-11-28）：多栏布局下收起成 56px 窄栏，答题区变宽
   ===================================================================== */
.side-rail,
.side-collapse {
  display: none;
}

@media (min-width: 1001px) {
  .side-collapse {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }

  .side-collapse:hover {
    border-color: var(--line-strong);
    color: var(--text);
  }

  .quiz-shell.teach-shell.side-collapsed {
    grid-template-columns: 56px minmax(0, 1fr) 356px;
  }

  .quiz-shell.teach-shell.no-ai.side-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .teach-shell.side-collapsed .quiz-sidebar {
    padding: 10px 6px;
  }

  .teach-shell.side-collapsed .quiz-sidebar > :not(.side-rail) {
    display: none !important;
  }

  .teach-shell.side-collapsed .side-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 0 8px;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--text);
    cursor: pointer;
  }

  .teach-shell.side-collapsed .side-rail:hover {
    background: var(--surface-muted);
  }

  .side-rail-icon {
    font-size: 20px;
    line-height: 1;
    color: var(--text-soft);
  }

  .side-rail-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
    writing-mode: vertical-rl;
    letter-spacing: 2px;
  }

  .side-rail-count {
    font-size: 12px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    writing-mode: vertical-rl;
  }

  .side-rail-bar {
    position: relative;
    width: 6px;
    height: 120px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-muted);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .side-rail-bar i {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 0;
    background: var(--text);
    transition: height 200ms ease;
  }
}

@media (max-width: 1380px) and (min-width: 1181px) {
  .quiz-shell.teach-shell.side-collapsed {
    grid-template-columns: 56px minmax(0, 1fr) 338px;
  }
}

@media (max-width: 1180px) and (min-width: 1001px) {
  .quiz-shell.teach-shell.side-collapsed,
  .quiz-shell.teach-shell.no-ai.side-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }
}

/* 交卷按钮：没做完时为灰色虚线、不可点 */
.teach .btn-submit:disabled {
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 1;
}

/* =====================================================================
   手机/平板竖屏操作（2026-11-28）：五档选项放进底部拇指区；紧凑 AI 卡
   ===================================================================== */
.dock-answer-slot {
  display: none;
}

.ol-a,
.ol-b {
  display: inline;
}

@media (max-width: 1000px) {
  .teach-quiz.dock-answers .answer-block {
    display: none;
  }

  .teach-quiz.dock-answers .quiz-shell.teach-shell,
  .teach-quiz.dock-answers .quiz-shell.teach-shell.no-ai {
    padding-bottom: calc(196px + env(safe-area-inset-bottom));
  }

  .teach-quiz .action-dock .dock-answer-slot {
    display: block;
    order: -1;
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 6px;
  }

  #dock-answer-slot #answer-options.option-group {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  #dock-answer-slot .option-pill {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    min-height: 50px;
    padding: 5px 2px;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
  }

  #dock-answer-slot .option-key {
    display: none;
  }

  #dock-answer-slot .option-label {
    display: block;
    width: 100%;
  }

  #dock-answer-slot .ol-a,
  #dock-answer-slot .ol-b {
    display: block;
  }

  #dock-answer-slot .option-tags {
    top: -9px;
    right: 50%;
    transform: translateX(50%);
  }

  #dock-answer-slot .option-tag {
    padding: 0 5px;
    font-size: 10px;
    line-height: 15px;
  }

  #ai-inline {
    scroll-margin-top: 64px;
  }
}

/* 紧凑 AI 卡（宽度 <= 1180px 时显示在图片下方） */
.ai-inline-card .ai-compare-strip {
  margin-bottom: 10px;
}

.ai-mini-probs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 6px 6px;
  border: 1px solid var(--ai-line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.ai-mini-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.ai-mini-val {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ai-mini-track {
  position: relative;
  width: 18px;
  height: 46px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--ai-soft);
}

.ai-mini-track i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  background: #9fb0ea;
}

.ai-mini-lab {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.ai-mini-col.is-top .ai-mini-val,
.ai-mini-col.is-top .ai-mini-lab {
  color: var(--ai-strong);
  font-weight: 700;
}

.ai-mini-col.is-top .ai-mini-track i {
  background: var(--ai);
}

.ai-mini-features {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.ai-mini-features li {
  position: relative;
  padding: 3px 0 3px 12px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
}

.ai-mini-features li::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--ai);
}

.ai-mini-rationale {
  border-top: 1px solid var(--ai-line);
  padding-top: 6px;
}

.ai-mini-rationale summary {
  color: var(--ai-strong);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-mini-rationale p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.55;
}
