/* ============ 重置 & 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
*:focus { outline: none; }

:root {
  --primary: #4A90D9;
  --primary-dark: #3A7BC8;
  --primary-light: #E8F1FC;
  --success: #52C41A;
  --warning: #FAAD14;
  --danger: #FF4D4F;
  --text: #1A1A1A;
  --text-secondary: #666;
  --text-light: #999;
  --bg: #F5F7FA;
  --card-bg: #FFFFFF;
  --border: #E8E8E8;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

html { font-size: 14px; height: 100%; -webkit-text-size-adjust: 100%; }
html.web-edition { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============ 顶部栏 ============ */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  flex-shrink: 0;
  position: static;
  z-index: 100;
  box-shadow: none;
}
.header-inner {
  max-width: none;
  margin: 0;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-icon { font-size: 18px; }
.logo-text { font-size: 15px; font-weight: 700; }
.logo { display: flex; align-items: center; gap: 6px; }
.btn-icon {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.3); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-badge {
  font-size: 13px;
  opacity: 0.95;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-actions .btn-text {
  color: rgba(255,255,255,0.92);
}
.header-actions .btn-text:hover {
  color: #fff;
}
.nav-tabs {
  max-width: none;
  margin: 0;
  padding: 0 8px;
  display: flex;
  flex-shrink: 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-icon { font-size: 16px; }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.trial-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 5px 36px 5px 10px;
  font-size: 12px;
  background: #FFFBE6;
  border-bottom: 1px solid #FFE58F;
  color: #876800;
  position: relative;
}
.trial-banner.warn {
  background: #FFF2F0;
  border-bottom-color: #FFCCC7;
  color: #A8071A;
}
.trial-banner .btn-text { color: var(--primary-dark); font-weight: 600; padding: 2px 6px; }
.trial-banner-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.trial-banner-close:hover { opacity: 1; }

/* ============ 工作区布局（左侧历史 + 拖动） ============ */
.workspace {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  max-width: none;
  margin: 0;
  width: 100%;
  align-items: stretch;
}
.history-sidebar {
  width: var(--sidebar-width, 280px);
  min-width: 180px;
  max-width: 420px;
  flex: 0 0 var(--sidebar-width, 280px);
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  order: 3;
}
.history-sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 6px 8px 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 4px;
}
.history-sidebar-header h3 { font-size: 12px; font-weight: 600; display: none; }
.history-lib-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
}
.history-lib-tab,
.history-lib-action {
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-light, #8c8c8c);
  cursor: pointer;
  line-height: 1.35;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.history-lib-tab:hover,
.history-lib-action:hover {
  color: var(--text, #333);
  background: rgba(0, 0, 0, 0.04);
}
.history-lib-tab.is-active {
  background: rgba(74, 144, 217, 0.14);
  color: var(--primary, #4A90D9);
  font-weight: 600;
}
.history-lib-action {
  margin-left: auto;
  color: var(--text-light, #8c8c8c);
}
.history-lib-action.is-back {
  color: var(--primary, #4A90D9);
}
.history-sidebar-hint,
.exam-history-drawer-hint {
  font-size: 11px;
  color: var(--text-light);
  padding: 0 10px 6px;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.history-sidebar .history-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: block; /* 不用 flex 列，避免子项被压扁叠在一起 */
  min-height: 0;
}
.history-sidebar .history-item {
  display: grid !important;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 0 6px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 0;
  min-height: 64px;
  height: auto !important;
  max-height: none !important;
  flex: none !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
  position: relative;
}
.history-sidebar .history-item-check {
  grid-row: 1 / span 2;
  grid-column: 1;
  align-self: center;
  margin: 0 0 0 8px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.history-sidebar .history-item-body {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  min-width: 0;
  overflow: visible;
}
.history-sidebar .history-item:not(.has-check) .history-item-body {
  grid-column: 1 / -1;
}
.history-sidebar .history-item-actions {
  grid-column: 2;
  grid-row: 2;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  padding: 2px 8px 8px;
  border-top: none;
  width: auto;
  min-width: 0;
}
.history-sidebar .history-item:not(.has-check) .history-item-actions {
  grid-column: 1 / -1;
}
.history-sidebar .history-archive-btn,
.history-sidebar .history-group-btn,
.history-sidebar .history-del {
  font-size: 11px;
  padding: 2px 4px;
  white-space: nowrap;
}
.history-lib-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-light, #8c8c8c);
  padding: 6px 10px 4px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-merge-bar {
  display: none;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: #f7f9fc;
  flex-shrink: 0;
}
.history-merge-bar.is-visible {
  display: flex;
}
.history-merge-bar .history-merge-count {
  font-size: 12px;
  color: var(--text-secondary, #666);
  margin-right: 4px;
}
.history-merge-bar .btn-sm {
  font-size: 11px;
  padding: 2px 6px;
}
.history-sidebar .history-title {
  display: block !important;
  font-size: 13px;
  line-height: 1.5 !important;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: break-word; /* 勿用 anywhere，避免一字一行 */
  max-height: none !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
  overflow: visible !important;
  writing-mode: horizontal-tb !important;
}
.history-sidebar .history-time {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-sidebar .history-item-main {
  display: block !important;
  width: 100%;
  min-width: 0;
  overflow: visible !important;
}
.resize-handle {
  width: 5px;
  flex: 0 0 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 10;
  transition: background 0.15s;
  order: 2;
}
.resize-handle:hover,
.resize-handle.dragging {
  background: var(--primary-light);
}
.resize-handle::after {
  content: '';
  position: absolute;
  right: 2px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.workspace-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  order: 1;
}
.main {
  max-width: none;
  margin: 0;
  padding: 8px 10px 10px;
}
.panel { display: none; }
.panel.active { display: block; }

/* ============ 紧凑表单 ============ */
.form-card-compact {
  padding: 10px 12px;
  margin-bottom: 8px;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 8px;
}
.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
}
.field-inline.field-grow { flex: 1 1 120px; min-width: 100px; }
.field-inline.field-full { flex: 1 1 100%; min-width: 140px; }
.field-inline.field-wide input { min-width: 5em; }
.field-inline > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.field-inline input,
.field-inline select {
  width: auto;
  min-width: 3.5em;
  max-width: 7em;
  padding: 4px 6px;
  font-size: 13px;
  flex: 1;
}
.field-inline.field-grow input { max-width: none; }
.field-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.field-block > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.field-block input { padding: 5px 8px; font-size: 13px; }
.field-block textarea { min-height: 0; }

.reflect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.reflect-grid .field-block { margin-bottom: 0; }
.reflect-grid textarea { min-height: 52px; }

.compact-details {
  margin-bottom: 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.compact-details summary {
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 2px 0;
}
.compact-details textarea { margin-top: 6px; min-height: 48px; }
.lesson-constraints .constraints-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 6px 0 8px;
  line-height: 1.5;
}
.lesson-constraints .field-block { margin-bottom: 8px; }
.lesson-constraints .field-block span { font-size: 12px; }
.lesson-constraints select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #fff;
}

.capture-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.capture-tab {
  flex: 1 1 calc(16.666% - 6px);
  min-width: 52px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
}
.capture-tab-icon {
  font-size: 18px;
  line-height: 1;
  display: block;
}
.capture-tab-label {
  font-size: 11px;
  font-weight: 600;
  display: block;
}
.capture-tab:hover { border-color: var(--primary); color: var(--primary); }
.capture-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}
.capture-pane { display: none; margin-bottom: 8px; }
.capture-pane.active { display: block; }
.capture-pane textarea {
  min-height: 72px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.45;
}
.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.form-footnote {
  font-size: 12px;
  color: var(--text-light);
  margin: 4px 0 10px;
  line-height: 1.5;
}
.recorder-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rec-btn-sm {
  padding: 6px 12px !important;
  font-size: 13px !important;
  border-width: 1px !important;
  gap: 6px !important;
  width: auto !important;
  display: inline-flex !important;
}
.rec-list-compact { max-height: 80px; overflow-y: auto; }
.capture-hint {
  font-size: 12px;
  color: var(--text-light);
  margin: 6px 0 4px;
  line-height: 1.5;
}
.observe-media-panel {
  margin: 10px 0 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e8edf2;
  border-radius: 8px;
}
.observe-media-title {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--text-secondary);
}
.observe-media-section-label {
  flex: 1 0 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}
.observe-media-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.observe-media-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
  max-width: 220px;
  position: relative;
}
.observe-media-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.observe-media-meta span {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.observe-media-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #c45c5c;
  font-size: 12px;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1.4;
}
.observe-media-del:hover {
  color: #a33;
  text-decoration: underline;
}
.observe-media-item audio {
  width: 100%;
  height: 32px;
}
.observe-media-image img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e0e6ed;
}
.observe-inline-fig {
  margin: 12px 0;
  text-align: center;
}
.observe-inline-fig img {
  max-width: min(100%, 520px);
  max-height: 360px;
  border-radius: 8px;
  border: 1px solid #e0e6ed;
  object-fit: contain;
  background: #fafafa;
}
.observe-inline-fig figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: #666;
}
.rec-list-compact .rec-item { padding: 4px 8px; font-size: 12px; }
.image-preview-compact { margin-top: 6px; }
.image-preview-compact .img-preview-item { width: 56px; height: 56px; }

.btn-primary-compact {
  margin-top: 0;
  padding: 10px 14px;
  font-size: 15px;
  width: 100%;
}
.app-footer-compact {
  flex-shrink: 0;
  max-width: none;
  padding: 4px 10px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}
.app-footer-compact .sep { color: var(--border); }

.footer-sponsor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(360px, 55vw);
  vertical-align: middle;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(22, 119, 255, 0.06);
}
.footer-sponsor-item {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}
.footer-sponsor-item:hover { color: var(--primary); text-decoration: underline; }
.footer-sponsor-item.is-empty { color: var(--text-light); font-weight: 500; }
.footer-credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text-light);
  font-size: 11px;
  opacity: 0.85;
}
.footer-credits a { color: var(--text-light); }

/* ============ 表单卡片（通用） ============ */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.required { color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 2px; }

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  transition: border 0.2s, background 0.2s;
  width: 100%;
}
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  accent-color: var(--primary);
  flex-shrink: 0;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

/* ============ 捕获区域（听评记） ============ */
.observe-capture-section {
  margin-bottom: 10px;
}
.observe-capture-section .capture-tabs {
  margin-top: 0;
}
.observe-notes-block,
.observe-draft-block {
  margin-bottom: 10px;
}
.observe-draft-block {
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.observe-grow-ta {
  width: 100%;
  max-height: none;
  overflow: hidden;
  resize: none;
  field-sizing: content;
  box-sizing: border-box;
}
#observe-content.observe-grow-ta {
  min-height: 52px;
}
#observe-transcript.observe-grow-ta {
  min-height: 72px;
}
.capture-pane .capture-field-label:first-child {
  margin-top: 0;
}
.capture-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.observe-workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.observe-workspace-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.observe-organize-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.observe-organize-hint {
  margin: 0 0 8px;
}
.observe-mode-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.observe-mode-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.observe-mode-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.observe-mode-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.observe-submit-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.observe-submit-block .btn-primary-compact {
  margin-top: 0;
  width: 100%;
}
.observe-summary-chip {
  display: none;
  margin: 8px auto 0;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}
.observe-summary-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.observe-summary-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.result-transcript-block {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.result-transcript-block summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.result-transcript-inner { margin-top: 8px; }
.result-header-sub { margin-bottom: 4px; }
.result-header-sub h3 { display: none; }
.result-transcript-hint { margin-top: 0; }
.history-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.capture-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.capture-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.section-hint {
  font-size: 12px;
  color: var(--text-light);
  margin: -6px 0 10px;
  line-height: 1.5;
}
.capture-modes-hint {
  margin: 4px 0 12px;
  padding: 8px 12px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  color: var(--primary-dark);
}
.template-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.template-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.btn-sm {
  width: auto !important;
  min-width: auto !important;
  margin-top: 0 !important;
  padding: 8px 14px !important;
  font-size: 13px !important;
}
.template-file-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  background: #F6FFED;
  border: 1px solid #B7EB8F;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.template-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-source-actions {
  flex-wrap: wrap;
}
.lesson-source-bound {
  margin-top: 8px;
  padding: 8px 12px;
  background: #F0F5FF;
  border: 1px solid #ADC6FF;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #1D39C4;
  word-break: break-all;
}
.lesson-source-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lesson-source-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #FFF7E6;
  border: 1px solid #FFD591;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.lesson-source-list .lesson-source-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-source-picker {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border, #E8E8E8);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #FAFAFA;
}
.lesson-source-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
}
.lesson-source-picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* 录音区域 */
.recorder { display: flex; flex-direction: column; gap: 10px; }
.rec-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.rec-btn:hover { background: #D6E8FA; }
.rec-btn.recording {
  border-style: solid;
  background: #FFE8E8;
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,79,0.3); }
  50% { box-shadow: 0 0 0 8px rgba(255,77,79,0); }
}
.rec-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--danger);
  font-weight: 600;
}
.rec-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}
.rec-wave span {
  display: block;
  width: 3px;
  height: 100%;
  background: var(--danger);
  border-radius: 2px;
  animation: wave 0.8s ease-in-out infinite;
}
.rec-wave span:nth-child(1) { animation-delay: 0s; }
.rec-wave span:nth-child(2) { animation-delay: 0.1s; }
.rec-wave span:nth-child(3) { animation-delay: 0.2s; }
.rec-wave span:nth-child(4) { animation-delay: 0.15s; }
.rec-wave span:nth-child(5) { animation-delay: 0.05s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.rec-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-item-del {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
}

/* 拍照/上传区域 */
.capture-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.capture-btn {
  flex: 1;
  min-width: 80px;
  padding: 14px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.capture-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.capture-btn span:first-child { font-size: 24px; }

.media-preview {
  display: none;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
}
.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.img-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
}
.img-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-preview-item .img-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ 按钮 ============ */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: transform 0.1s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(74,144,217,0.4); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--primary); color: #fff; }

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
}
.btn-text:hover { color: var(--primary); }

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
}

/* ============ 结果卡片 ============ */
.result-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.result-header h3 { font-size: 14px; }
.result-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.result-view-btn.active {
  color: var(--primary);
  font-weight: 600;
}
.result-edit-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 8px;
}
.result-content {
  font-size: 13px;
  line-height: 1.6;
  min-height: 280px;
  max-height: none;
  overflow: visible;
}
.result-content.typewriter-active {
  cursor: pointer;
}
.typewriter-hint {
  font-size: 12px;
  color: var(--primary);
  margin: 0 0 8px;
}
.typewriter-cursor {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  animation: typewriter-blink 0.75s step-end infinite;
  margin-left: 1px;
}
@keyframes typewriter-blink {
  50% { opacity: 0; }
}
.result-editor {
  width: 100%;
  min-height: 280px;
  max-height: none;
  height: auto;
  overflow: hidden;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.65;
  font-family: inherit;
  resize: none;
  background: #fff;
  field-sizing: content; /* 新浏览器可随内容增高；旧浏览器靠 JS autoGrow */
}
.result-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.result-ppt-hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.result-ppt-hint summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 600;
}
.result-ppt-hint ol {
  margin: 8px 0 0 18px;
  line-height: 1.6;
}
.result-content h1, .result-content h2 {
  margin-top: 16px;
  margin-bottom: 8px;
}
.result-content h1 { font-size: 18px; font-weight: 700; color: var(--primary-dark); border-left: 4px solid var(--primary); padding-left: 10px; }
.result-content h2 { font-size: 16px; font-weight: 600; color: #333; }
.result-content p { margin-bottom: 8px; }
.result-content p.emphasis { font-weight: 600; color: #333; }
.result-content ul, .result-content ol {
  margin-left: 20px;
  margin-bottom: 8px;
}
.result-content .tree-line {
  position: relative;
  padding: 4px 0 4px 12px;
  margin-left: 8px;
  border-left: 2px solid var(--primary-light);
  color: var(--text);
}
.result-content .tree-line.indent-2 { margin-left: 24px; }
.result-content .tree-line.indent-3 { margin-left: 40px; }
.result-content .tree-line.indent-4 { margin-left: 56px; }
.result-content li.no-bullet { list-style: none; margin-left: 0; padding-left: 0; }
.result-content li.indent-3 { margin-left: 32px; }
.result-content li.indent-4 { margin-left: 48px; }

/* ============ 历史记录 ============ */
.history-empty {
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
  line-height: 1.6;
}
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: visible;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.history-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.12);
}
.history-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* button 在 Chrome 等浏览器默认 overflow:hidden，会裁掉中文标题上半截 */
.history-item-main {
  flex: 1;
  display: block;
  padding: 10px 10px 6px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  overflow: visible !important;
  appearance: none;
  -webkit-appearance: none;
}
.history-reflect-link {
  display: block;
  width: 100%;
  margin: 0;
  padding: 2px 10px 10px;
  border: none;
  background: none;
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: #8c8c8c;
  cursor: pointer;
  font-family: inherit;
}
.history-reflect-link:hover {
  color: var(--primary, #4A90D9);
}
.history-reflect-link.has-content {
  color: #8c8c8c;
}
.history-reflect-link.has-content::before {
  content: '';
}
.lesson-reflect-modal {
  width: min(720px, 96vw);
  max-height: 90vh;
  overflow: auto;
}
.lesson-reflect-modal .modal-body {
  padding-top: 12px;
}
.lesson-reflect-course {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: #F5F7FA;
  border-radius: var(--radius-sm, 6px);
  font-size: 13px;
  color: #595959;
  line-height: 1.5;
}
.lesson-reflect-modal .reflect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 12px;
}
.app-footer .footer-brand {
  color: var(--text-light, #8c8c8c);
  white-space: nowrap;
}
/* 品牌「π」：衬线斜体，避免系统默认 Π/π 发扁发丑 */
.brand-pi {
  font-family: "Cambria Math", Cambria, "Times New Roman", "Noto Serif", "Songti SC", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.12em;
  line-height: 1;
  letter-spacing: 0.02em;
  display: inline-block;
  vertical-align: -0.02em;
  color: inherit;
}
@media (max-width: 640px) {
  .lesson-reflect-modal .reflect-grid {
    grid-template-columns: 1fr;
  }
}
.history-title {
  display: block;
  width: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: visible;
}
.history-time {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.4;
  white-space: nowrap;
}
.history-item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px 6px 6px 0;
  flex-shrink: 0;
}
.history-archive-btn,
.history-group-btn,
.history-del {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0.55;
  font-size: 11px;
  color: var(--text-light, #8c8c8c);
  transition: opacity 0.2s, color 0.2s;
  line-height: 1.3;
  white-space: nowrap;
  font-family: inherit;
}
.history-archive-btn:hover,
.history-group-btn:hover {
  opacity: 1;
  color: var(--primary, #4A90D9);
}
.history-group-btn.is-done {
  opacity: 0.9;
  color: #389e0d;
}
.history-group-btn.is-done:hover {
  color: #cf1322;
}
.exam-badge-vis-school {
  background: rgba(82, 196, 26, 0.12);
  color: #389e0d;
}
.history-del:hover {
  opacity: 1;
  color: #cf1322;
}

/* ============ Loading ============ */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 设置整页（非弹窗） ============ */
.settings-page {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: none;
  flex-direction: column;
  background: #eef2f7;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}
body.settings-open {
  overflow: hidden;
}
/* 设置页在 #app 内：不可再隐藏整个 #app，否则设置页一起消失变白屏 */
body.settings-open .header,
body.settings-open .nav-tabs,
body.settings-open .trial-banner,
body.settings-open .access-banner,
body.settings-open .workspace,
body.settings-open .app-footer {
  visibility: hidden;
  pointer-events: none;
}
.settings-page-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.settings-page-title {
  flex: 1 1 auto;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  line-height: 1.3;
  writing-mode: horizontal-tb;
}
.settings-back-btn {
  flex: 0 0 auto;
  width: auto !important;
  margin-top: 0 !important;
  white-space: nowrap;
}
.settings-page-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.settings-page-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.settings-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.2;
}
.settings-tab:hover {
  background: #f3f7fc;
  color: var(--primary-dark);
}
.settings-tab.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.settings-panel {
  display: none;
}
.settings-panel.is-active {
  display: block;
}
.settings-mod {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px 20px;
  margin-bottom: 14px;
}
.settings-mod-title {
  font-size: 17px;
  font-weight: 650;
  margin: 0 0 10px;
  color: var(--text);
}
.settings-empty-hint {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}
.settings-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 18px;
  margin: 12px 0 16px;
}
@media (min-width: 720px) {
  .settings-fields-2 {
    grid-template-columns: 1fr 1fr;
  }
  .settings-fields-2 .form-item.full {
    grid-column: 1 / -1;
  }
}
.settings-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 14px;
  align-items: center;
}
.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.org-unit-staff-list {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}
.settings-page .settings-btn-inline,
.settings-page .btn-primary.settings-btn-inline,
.settings-page .btn-secondary.settings-btn-inline {
  width: auto !important;
  min-width: 120px;
  margin-top: 0 !important;
  display: inline-flex;
}
.settings-page .points-summary {
  background: #f7f9fc;
  border: 1px solid #e8eef6;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0 0;
}
.settings-page .settings-site-notice {
  background: #f7f9fc;
  border: 1px solid #e8eef6;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0 12px;
}
.settings-page .about-block {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  font-size: 14px;
  line-height: 1.7;
}
.settings-page .settings-section-intro {
  margin: 0 0 12px;
}
.settings-page .profile-readonly-row {
  margin-bottom: 0;
}
.settings-page input[type="text"],
.settings-page input[type="password"],
.settings-page input[type="email"],
.settings-page select,
.settings-page textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
}

/* ============ 通用弹窗（试卷库等） ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; }
.modal-body { padding: 20px; }
.modal-body .form-grid { grid-template-columns: 1fr; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.modal-footer .btn-primary { width: auto; min-width: 80px; margin-top: 0; }

.config-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: none;
}
.config-status.ok { background: #F6FFED; color: var(--success); border: 1px solid #B7EB8F; display: block; }
.config-status.err { background: #FFF2F0; color: var(--danger); border: 1px solid #FFCCC7; display: block; }

.about-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.about-block h4 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
}
.about-block a { color: var(--primary); text-decoration: none; }
.about-block a:hover { text-decoration: underline; }

/* ============ 页脚版权 ============ */
.app-footer {
  text-align: center;
  color: var(--text-light);
  line-height: 1.4;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 10060;
  animation: toastIn 0.3s;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ 响应式 ============ */
.app-footer a { color: var(--primary); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.app-footer a.footer-dl-link {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary-light);
}
.app-footer a.footer-dl-link:hover {
  text-decoration: none;
  background: #dbeafe;
}

@media (max-width: 900px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; overflow: visible; }
  .workspace { flex-direction: column; min-height: auto; }
  .history-sidebar {
    order: -1; /* 窄屏仍置顶，便于点历史 */
    width: 100% !important;
    max-width: none;
    max-height: 200px;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  .resize-handle { display: none; }
  .history-sidebar .history-list { max-height: 200px; min-height: 120px; }
}
@media (max-width: 600px) {
  .meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    align-items: center;
  }
  .field-inline {
    width: auto;
    min-width: 0;
    display: flex;
    align-items: center;
  }
  .field-inline.field-grow,
  .field-inline.field-full {
    grid-column: 1 / -1;
  }
  .field-inline > span {
    flex-shrink: 0;
    min-width: 2.2em;
  }
  .field-inline input,
  .field-inline select {
    max-width: none;
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  .reflect-grid { grid-template-columns: 1fr; }
  .capture-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .capture-tab {
    flex: none;
    min-width: 0;
    padding: 10px 4px;
  }
  .capture-tab-icon { font-size: 20px; }
  .capture-tab-label { font-size: 12px; }
  .logo-text { font-size: 16px; }
  .tab-label { font-size: 12px; }
  .tab-icon { font-size: 20px; }
  .result-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .result-actions { width: 100%; }
  .btn-secondary { flex: 1; text-align: center; }
  .card-title { font-size: 18px; }
  .main {
    padding: 10px 12px calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .form-card { padding: 14px; }
  .form-card-compact { padding: 12px; }
  .capture-actions { gap: 6px; }
  .capture-btn { min-width: 70px; padding: 10px 6px; font-size: 13px; }
  .app-footer-compact {
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
}

/* ============ 网页版 video.naham.cn：更大字号，阅读更省力 ============ */
html.web-edition body { line-height: 1.55; }
html.web-edition .logo-text { font-size: 17px; }
html.web-edition .tab { font-size: 15px; padding: 8px 6px; }
html.web-edition .tab-icon { font-size: 18px; }
html.web-edition .trial-banner { font-size: 14px; padding: 7px 12px; }
html.web-edition .history-sidebar-header h3 { font-size: 14px; }
html.web-edition .history-sidebar-hint { font-size: 13px; }
html.web-edition .field-inline label,
html.web-edition .field-block label { font-size: 14px; }
html.web-edition .field-inline input,
html.web-edition .field-inline select,
html.web-edition .field-block input { font-size: 15px; padding: 6px 8px; }
html.web-edition .field-block textarea,
html.web-edition .capture-pane textarea,
html.web-edition textarea { font-size: 15px; line-height: 1.55; }
html.web-edition .form-hint { font-size: 13px; }
html.web-edition .capture-tab { padding: 8px 5px; }
html.web-edition .capture-tab-label { font-size: 12px; }
html.web-edition .capture-tab-icon { font-size: 19px; }
html.web-edition .btn-primary { font-size: 16px; padding: 12px 16px; }
html.web-edition .btn-secondary { font-size: 15px; }
html.web-edition .result-header h3 { font-size: 16px; }
html.web-edition .result-content { font-size: 15px; line-height: 1.65; }
html.web-edition .result-content h1 { font-size: 20px; }
html.web-edition .result-content h2 { font-size: 18px; }
html.web-edition .history-item .history-title { font-size: 14px; }
html.web-edition .history-time { font-size: 12px; }
html.web-edition .app-footer { font-size: 13px; }
html.web-edition .modal-body input,
html.web-edition .modal-body select { font-size: 15px; }
html.web-edition .about-block { font-size: 14px; }
html.web-edition .loading-hint {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}
@media (max-width: 600px) {
  html.web-edition { font-size: 17px; }
  html.web-edition .tab-label { font-size: 14px; }
  html.web-edition .capture-tabs {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  html.web-edition .capture-tab {
    padding: 10px 4px;
  }
  html.web-edition .capture-tab-label { font-size: 13px; }
  html.web-edition .capture-tab-icon { font-size: 22px; }
  html.web-edition .btn-primary,
  html.web-edition .btn-primary-compact { font-size: 17px; padding: 12px 16px; }
  html.web-edition .form-footnote { font-size: 13px; }
  html.web-edition .main {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

/* ============ 启动加载 & 微信引导页 ============ */
.boot-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 15px;
}
.boot-loading.hidden { display: none; }
.boot-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.boot-logo { font-size: 36px; }

.wechat-guide {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.wechat-guide-card {
  width: 100%;
  max-width: 360px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px 22px 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.wechat-guide-logo { font-size: 42px; margin-bottom: 8px; }
.wechat-guide-card h1 {
  font-size: 20px;
  margin-bottom: 12px;
  color: var(--text);
}
.wechat-guide-lead {
  color: #ad6800;
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}
.wechat-guide-card > p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-align: left;
}
.wechat-guide-steps {
  text-align: left;
  margin: 0 0 14px 18px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}
.wechat-guide-code {
  font-size: 14px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
  text-align: left;
}
.wechat-guide-try { width: 100%; }
.wechat-guide-foot {
  margin-top: 14px;
  font-size: 13px;
}
.wechat-guide-foot a { color: var(--primary); text-decoration: none; }

html.ta-mobile-safe body {
  overflow-y: auto !important;
  overflow-x: hidden;
  height: auto !important;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
html.ta-mobile-safe #app {
  height: auto !important;
  min-height: 100%;
  overflow: visible !important;
}
html.ta-mobile-safe .workspace,
html.ta-mobile-safe .workspace-main,
html.ta-mobile-safe .main {
  overflow: visible !important;
  min-height: 0;
}
html.ta-mobile-safe .login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* ============ 微信内置浏览器 ============ */
html.wechat body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
html.wechat #app {
  height: auto;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow: visible;
}
html.wechat .workspace {
  min-height: 0;
}
html.wechat .main {
  overflow: visible;
}

/* ============ 登录页 ============ */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: linear-gradient(160deg, #4A90D9 0%, #2f6eb5 55%, #1f4f86 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { font-size: 42px; margin-bottom: 8px; }
.login-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text);
}
.login-hint {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 10px;
}
.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.login-tab {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}
.login-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}
.login-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.login-code-row input {
  flex: 1;
  min-width: 0;
}
.login-code-row .btn-sm {
  flex-shrink: 0;
  white-space: nowrap;
}
.settings-account-block {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.settings-profile-block {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.settings-profile-block h4,
.settings-account-block h4 {
  font-size: 15px;
  margin-bottom: 8px;
}
.account-login-name {
  font-size: 14px;
  color: var(--primary-dark);
  margin-bottom: 10px;
}
.profile-readonly-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.profile-readonly-row span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--text-secondary);
  font-size: 13px;
}
.points-summary {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f7fb;
  color: #445;
  font-size: 13px;
  line-height: 1.55;
}
.points-summary strong { color: #1a5fb4; }
.points-summary .points-soft-tip {
  margin-top: 6px;
  color: #778;
  font-size: 12px;
}
.topup-panel {
  margin: 0 0 14px;
  padding: 12px 12px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafbfc;
}
.topup-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #334;
  margin-bottom: 6px;
}
.topup-panel-body {
  font-size: 13px;
  line-height: 1.55;
  color: #556;
}
.topup-panel-body .topup-closed {
  color: #778;
  font-size: 12.5px;
}
.topup-pack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.topup-pack-row button {
  font-size: 12px;
}
.topup-order-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e5e7eb;
}
.topup-order-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
  color: #667;
}
.topup-order-item strong { color: #334; font-weight: 600; }
.referral-block { margin: 0 0 14px; }
.referral-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.referral-code-row input {
  flex: 1;
  min-width: 0;
}
.btn-block {
  width: 100%;
  margin-top: 4px;
}
.login-demo {
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
  text-align: left;
}
.login-demo strong {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.5px;
}
.login-contact-hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: #f7f8fa;
  border-radius: var(--radius-sm);
  text-align: center;
}
.login-contact-hint strong {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.5px;
  color: var(--primary-dark);
}
.login-wechat-hint {
  margin: -6px 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #ad6800;
  text-align: center;
}
.login-field {
  display: block;
  text-align: left;
  margin-bottom: 14px;
}
.login-fields-row {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}
.login-fields-row .login-field {
  flex: 1;
  min-width: 0;
  margin-bottom: 10px;
}
#login-register-panel .login-field {
  margin-bottom: 10px;
}
#login-register-panel .login-field span {
  margin-bottom: 4px;
  font-size: 12px;
}
#login-register-panel .login-field input {
  padding: 9px 10px;
  font-size: 14px;
}
#login-register-panel .login-field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.login-field span {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.login-submit {
  width: 100%;
  margin-top: 6px;
}
.login-form-msg {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}
.login-form-msg.is-error {
  background: #fff2f0;
  color: #a8071a;
  border: 1px solid #ffccc7;
}
.login-form-msg.is-ok {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}
.login-skip {
  width: 100%;
  margin-top: 10px;
}
html.desktop-edition .login-foot a[href="/admin.html"],
html.desktop-edition .login-foot a[href="/download.html"],
html.desktop-edition #footer-web-link {
  display: none !important;
}
.login-foot {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-light);
}
.settings-section-title {
  font-size: 15px;
  margin: 4px 0 6px;
}
.settings-section-intro {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 12px;
  line-height: 1.5;
}
.settings-site-notice {
  background: #f7f9fc;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 8px;
}
.lesson-board-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.lesson-board-opt input {
  width: auto;
  margin: 0;
}
.board-diagram-preview {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}
.board-diagram-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.board-diagram-header h4 {
  margin: 0;
  font-size: 15px;
}
.board-diagram-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-light);
}
.board-design-text {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.board-design-text p {
  margin: 0 0 8px;
}
.board-design-text p:last-child {
  margin-bottom: 0;
}
.board-diagram-svg-label {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.board-diagram-canvas {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.board-diagram-svg-wrap svg {
  display: block;
  max-width: 100%;
  height: auto;
}
.board-diagram-loading,
.board-diagram-error {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.board-diagram-error {
  color: #cf1322;
}

/* ============ 命题组卷 ============ */
.exam-layout {
  display: flex;
  gap: 12px;
  height: auto;
  min-height: calc(100vh - 140px);
  /* 左栏可向下长，中/右栏不跟着被撑高 */
  align-items: flex-start;
}

.exam-sidebar-reopen {
  display: inline-flex;
  flex: 0 0 36px;
  width: 36px;
  align-self: flex-start;
  height: calc(100vh - 140px);
  position: sticky;
  top: 12px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.2em;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fff;
  color: #1677ff;
  font-size: 13px;
  cursor: pointer;
  padding: 12px 0;
  justify-content: center;
  align-items: center;
}

.exam-sidebar-reopen:hover {
  background: #f0f7ff;
  border-color: #91caff;
}

.exam-layout.exam-sidebar-collapsed {
  gap: 8px;
}

/* 收起时整栏隐藏（含上传/AI命题等 Tab），只留竖条「条件」 */
.exam-layout.exam-sidebar-collapsed .exam-sidebar {
  display: none;
}

.exam-layout.exam-sidebar-collapsed .exam-sidebar-reopen {
  display: inline-flex;
}

.exam-sidebar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 0;
  flex-shrink: 0;
}

.exam-sidebar-toolbar-title {
  font-size: 12px;
  color: #888;
}

.exam-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  /* 不限高、不内部滚动；高度随内容，由外层页面滚动 */
  align-self: flex-start;
}

.exam-sidebar-content {
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.exam-history-panel {
  flex: 0 0 auto;
  max-height: 38%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
}

.exam-history-toggle-btn.exam-history-flash {
  color: #1677ff;
  animation: examHistoryBtnFlash 1.1s ease;
}

@keyframes examHistoryBtnFlash {
  0%, 100% { background: transparent; }
  30% { background: rgba(22, 119, 255, 0.12); }
}

.exam-history-badge {
  display: inline-block;
  min-width: 16px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 8px;
  background: #1677ff;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  vertical-align: middle;
}

.exam-history-toggle-btn.is-active {
  color: #1677ff;
  font-weight: 600;
}

/* 右侧历史抽屉：与试卷预览同宽，互斥显示 */
.exam-history-drawer {
  width: 420px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
  display: none;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 12px;
  min-height: 0;
  animation: examPreviewSlideIn 0.25s ease;
}

.exam-history-drawer.exam-history-open {
  display: flex;
}

.exam-history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
  border-bottom: none;
  background: #fafafa;
  flex-shrink: 0;
}

.exam-history-drawer-header .history-lib-nav {
  flex: 1;
  min-width: 0;
}

.exam-history-drawer-header h4 {
  display: none;
}

.exam-history-drawer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.exam-history-drawer-hint {
  background: #fafafa;
}

.exam-history-drawer-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
}

.exam-history-drawer-list .history-item {
  margin-bottom: 6px;
}

.exam-hist-item {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.exam-hist-item .history-item-main {
  width: 100%;
  padding-bottom: 6px;
}

.exam-hist-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  padding: 0 8px 8px;
  border-top: 1px solid #f0f0f0;
  margin-top: 0;
  padding-top: 6px;
}

.exam-hist-actions .btn-text {
  padding: 2px 6px;
  font-size: 12px;
  color: var(--primary, #4a90d9);
}

.exam-hist-actions .btn-text:hover {
  background: rgba(74, 144, 217, 0.08);
  border-radius: 4px;
}

.exam-hist-actions .history-del {
  margin-left: auto;
  opacity: 0.75;
  font-size: 12px;
  padding: 2px 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: #c45c5c;
}

.exam-history-drawer-list .history-title {
  font-size: 13px;
}

.exam-history-drawer-list .history-time {
  font-size: 11px;
}

.exam-history-drawer-list .history-empty {
  margin: 12px 6px;
  font-size: 13px;
  color: #999;
  line-height: 1.5;
}

.exam-knowledge-scope {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 8px 4px;
}

/* 右侧抽屉：上传模式「标签上 + 历史下」 */
.exam-drawer-section {
  margin-bottom: 12px;
}
.exam-drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
  padding: 4px 4px 8px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 8px;
}
.exam-drawer-section-history .exam-drawer-section-title {
  margin-top: 4px;
}
.exam-history-drawer.exam-drawer-upload-combo .exam-history-drawer-list .exam-knowledge-tags,
.exam-history-drawer.exam-drawer-upload-combo .exam-history-drawer-list .exam-kaodian-tags,
.exam-history-drawer.exam-drawer-tags .exam-history-drawer-list .exam-knowledge-tags,
.exam-history-drawer.exam-drawer-tags .exam-history-drawer-list .exam-kaodian-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px 8px;
  margin-bottom: 4px;
}

.exam-history-drawer.exam-drawer-upload-combo .exam-tag,
.exam-history-drawer.exam-drawer-tags .exam-tag {
  display: inline-block;
  width: auto;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
  background: #f5f7fa;
  border: 1px solid #e8e8e8;
  color: #333;
}

.exam-history-drawer.exam-drawer-upload-combo .exam-tag:hover,
.exam-history-drawer.exam-drawer-tags .exam-tag:hover {
  border-color: #1677ff;
  color: #1677ff;
  background: #e8f3ff;
}

.exam-tags-empty {
  margin: 0 0 8px !important;
  padding: 8px 4px !important;
}

/* 兼容旧版左栏知识标签样式（若缓存页仍残留节点） */
.exam-history-panel.exam-history-as-upload-tags {
  display: none !important;
}

.exam-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  flex-shrink: 0;
}

.exam-history-header h4 {
  margin: 0;
  font-size: 13px;
  color: #333;
}

.exam-history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px;
}

.exam-history-list .history-item {
  margin-bottom: 4px;
}

.exam-history-list .history-title {
  font-size: 12px;
}

.exam-history-list .history-time {
  font-size: 11px;
}

.exam-history-list .history-empty {
  margin: 8px 4px;
  font-size: 12px;
  color: #999;
}

.exam-upload-source-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 4px;
}

.exam-upload-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 14px;
  background: #f7f9fc;
  color: #333;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.exam-upload-source-tag:hover {
  border-color: #1677ff;
  color: #1677ff;
  background: #f0f7ff;
}

.exam-upload-source-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.exam-upload-source-count {
  flex-shrink: 0;
  color: #999;
  font-size: 11px;
}

.exam-upload-card,
.exam-filter-card,
.exam-bank-stats {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e8e8e8;
}

.exam-collapsible {
  padding: 0;
}

/* 模式切换 Tab 固定在左栏顶部 */
.exam-mode-tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
  overflow: hidden;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.exam-mode-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
}

.exam-mode-tab:hover {
  background: #f5f7fa;
}

.exam-mode-tab.active {
  color: #1677ff;
  background: #f0f5ff;
  border-bottom-color: #1677ff;
  font-weight: 600;
}

/* 库内/线上搜索切换 */
.exam-search-source-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.exam-source-tab {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.exam-source-tab:hover {
  border-color: #1677ff;
  color: #1677ff;
}

.exam-source-tab.active {
  background: #1677ff;
  border-color: #1677ff;
  color: #fff;
}

/* AI对话窗口（高度由中栏固定视口高度约束，内部滚动） */
.exam-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 12px;
  min-height: 0;
  scroll-behavior: smooth;
}

.exam-chat-empty {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-size: 14px;
}

.exam-chat-msg {
  margin-bottom: 10px;
  position: relative;
}

.exam-chat-msg-has-questions {
  margin-bottom: 12px;
}

/* 折叠后的摘要行 */
.exam-chat-msg-summary {
  display: none;
  width: 100%;
  text-align: left;
  border: 1px dashed #e5e7eb;
  background: #fafafa;
  color: #64748b;
  font-size: 12px;
  padding: 6px 28px 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.4;
}
.exam-chat-msg-summary:hover {
  border-color: #91caff;
  color: #1677ff;
  background: #f0f7ff;
}

/* AI消息折叠按钮 */
.exam-chat-fold-btn {
  position: absolute;
  right: 2px;
  top: 4px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: #999;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s ease, color 0.2s ease;
  padding: 0;
  line-height: 20px;
  text-align: center;
}

.exam-chat-msg:hover .exam-chat-fold-btn,
.exam-chat-msg-collapsed .exam-chat-fold-btn {
  opacity: 1;
}

.exam-chat-fold-btn:hover {
  color: #1677ff;
}

/* 收起：只留摘要行 */
.exam-chat-msg-collapsed > .exam-chat-msg-summary {
  display: block;
}
.exam-chat-msg-collapsed .exam-chat-bubble,
.exam-chat-msg-collapsed .exam-chat-question-card,
.exam-chat-msg-collapsed .exam-chat-modify,
.exam-chat-msg-collapsed .exam-chat-result-bar,
.exam-chat-msg-collapsed .exam-chat-add-all-btn,
.exam-chat-msg-collapsed .exam-chat-type-section,
.exam-chat-msg-collapsed .exam-related-papers-chat,
.exam-chat-msg-collapsed .exam-gen-step {
  display: none !important;
}

.exam-chat-msg-user {
  text-align: right;
}

.exam-chat-msg-user .exam-chat-bubble {
  display: inline-block;
  max-width: 80%;
  background: #1677ff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 12px 12px 2px 12px;
  font-size: 13px;
  text-align: left;
}

.exam-chat-msg-ai .exam-chat-bubble {
  display: block;
  width: 100%;
  background: #f5f5f5;
  padding: 10px 14px;
  border-radius: 12px 12px 12px 2px;
  font-size: 13px;
  text-align: left;
}

.exam-chat-msg-ai .exam-chat-bubble-compact {
  padding: 6px 12px;
  font-size: 12px;
  color: #64748b;
}

/* 出题结果顶栏：吸顶，方便边滚边加入 */
.exam-chat-result-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin: 4px 0 8px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.exam-chat-result-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.exam-chat-type-section {
  margin: 10px 0 4px;
  font-weight: 600;
  font-size: 12px;
  color: #64748b;
}

/* 打字机光标 */
.exam-chat-msg-ai .exam-chat-bubble span:empty::after {
  content: '▋';
  color: #1677ff;
  animation: exam-cursor-blink 1s step-end infinite;
}

@keyframes exam-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.exam-chat-msg-ai .exam-chat-bubble pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
}

.exam-chat-loading {
  display: inline-block;
  padding: 12px 16px;
  background: #f5f5f5;
  border-radius: 12px;
  font-size: 13px;
  color: #999;
}

.exam-chat-loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ccc;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: exam-spin 0.8s linear infinite;
  margin-left: 6px;
  vertical-align: middle;
}

@keyframes exam-spin {
  to { transform: rotate(360deg); }
}

/* ============ AI生成过程任务面板（仿IDE todo风格） ============ */
.exam-gen-panel {
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fafbfc;
  transition: opacity 0.35s ease;
}

.exam-gen-panel-collapsed {
  opacity: 0;
  pointer-events: none;
}

.exam-gen-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e8e8e8;
}

.exam-gen-panel-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #d6e4ff;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: exam-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.exam-gen-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.exam-gen-panel-steps {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
}

/* 单个步骤 */
.exam-gen-step {
  display: flex;
  gap: 14px;
  padding-bottom: 24px;
  position: relative;
  transition: all 0.3s ease;
}

/* 左侧竖线连接（除最后一个） */
.exam-gen-step:not(:last-child) .exam-gen-step-marker::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: -4px;
  width: 2px;
  background: #e8e8e8;
  transition: background 0.3s ease;
}

.exam-gen-step-done:not(:last-child) .exam-gen-step-marker::after {
  background: #52c41a;
}

.exam-gen-step-marker {
  position: relative;
  flex-shrink: 0;
  width: 16px;
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

/* 圆点 */
.exam-gen-step-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #d9d9d9;
  background: #fff;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

/* 状态：pending */
.exam-gen-step-pending .exam-gen-step-dot {
  border-color: #d9d9d9;
  background: #fff;
}

.exam-gen-step-pending .exam-gen-step-label {
  color: #bbb;
}

.exam-gen-step-pending .exam-gen-step-desc {
  color: #ccc;
}

/* 状态：active */
.exam-gen-step-active .exam-gen-step-dot {
  border-color: #1677ff;
  background: #1677ff;
  box-shadow: 0 0 0 4px rgba(22,119,255,0.15);
  animation: exam-gen-pulse 1.5s ease-in-out infinite;
}

@keyframes exam-gen-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22,119,255,0.15); }
  50% { box-shadow: 0 0 0 8px rgba(22,119,255,0.08); }
}

.exam-gen-step-active .exam-gen-step-label {
  color: #1677ff;
  font-weight: 600;
}

.exam-gen-step-active .exam-gen-step-desc {
  color: #69b1ff;
}

/* 状态：done */
.exam-gen-step-done .exam-gen-step-dot {
  border-color: #52c41a;
  background: #52c41a;
}

.exam-gen-step-done .exam-gen-step-dot::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
}

.exam-gen-step-done .exam-gen-step-label {
  color: #52c41a;
}

.exam-gen-step-done .exam-gen-step-desc {
  color: #b7eb8f;
}

.exam-gen-step-content {
  flex: 1;
  min-width: 0;
}

.exam-gen-step-label {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: color 0.3s ease;
  line-height: 1.5;
}

.exam-gen-step-desc {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
  transition: color 0.3s ease;
}

/* ============ 下载确认弹窗 ============ */
.exam-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.exam-confirm-overlay.exam-confirm-show {
  opacity: 1;
}

.exam-confirm-dialog {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
  transform: scale(0.85) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exam-confirm-overlay.exam-confirm-show .exam-confirm-dialog {
  transform: scale(1) translateY(0);
}

.exam-confirm-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: exam-bounce-in 0.5s ease;
}

@keyframes exam-bounce-in {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.exam-confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.exam-confirm-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 16px;
}

.exam-confirm-question {
  font-size: 15px;
  color: #333;
  font-weight: 500;
  margin-bottom: 20px;
}

.exam-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.exam-confirm-actions button {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.exam-confirm-actions .btn-primary {
  background: #1677ff;
  color: #fff;
}

.exam-confirm-actions .btn-primary:hover {
  background: #4096ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22,119,255,0.3);
}

.exam-confirm-actions .btn-secondary {
  background: #f0f0f0;
  color: #666;
}

.exam-confirm-actions .btn-secondary:hover {
  background: #e8e8e8;
}

.exam-chat-question-card {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  background: #fff;
  width: 100%;
}

.exam-chat-question-card .exam-chat-q-stem {
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 6px;
}

.exam-chat-question-card .exam-chat-q-options {
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
  line-height: 1.6;
}

.exam-chat-question-card .exam-chat-q-ans {
  font-size: 12px;
  color: #52c41a;
  margin-bottom: 2px;
}

.exam-chat-question-card .exam-chat-q-analysis {
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}

.exam-chat-q-add-btn {
  margin-top: 6px;
}

/* AI对话输入框 */
.exam-chat-input-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
  flex-shrink: 0;
}

.exam-chat-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.exam-chat-img-btn {
  flex-shrink: 0;
  min-width: 32px;
  height: 34px;
  font-size: 16px;
  line-height: 1;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.exam-chat-img-btn:hover {
  border-color: #1677ff;
  color: #1677ff;
}

.exam-chat-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exam-chat-image-preview[hidden] {
  display: none !important;
}

.exam-chat-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #d9d9d9;
  background: #fff;
}

.exam-chat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.exam-chat-thumb button {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 0 0 0 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  padding: 0;
}

.exam-chat-input {
  flex: 1;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  resize: none;
  min-height: 34px;
  max-height: 80px;
  line-height: 1.4;
  font-family: inherit;
}

.exam-chat-input:focus {
  outline: none;
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

.exam-chat-send-btn {
  flex-shrink: 0;
  align-self: flex-end;
}

/* 中栏：题库/AI + 操作合并单行 */
.exam-mid-toolbar,
.exam-mid-tabs {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 0;
  border-bottom: 1px solid #e8e8e8;
  background: #fafafa;
  min-height: 40px;
}
.exam-mid-tabs-left {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 0;
}
.exam-mid-tab {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  padding: 9px 12px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.exam-mid-tab:hover { color: #1677ff; }
.exam-mid-tab.active {
  color: #1677ff;
  font-weight: 600;
  border-bottom-color: #1677ff;
  background: #fff;
}
.exam-mid-tab-count {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 5px;
  margin-left: 2px;
  font-size: 11px;
  color: #999;
  background: #f0f0f0;
  border-radius: 8px;
}
.exam-mid-tab.active .exam-mid-tab-count {
  color: #1677ff;
  background: #e6f4ff;
}
.exam-mid-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  gap: 4px;
}
.exam-mid-actions-bank,
.exam-mid-actions-ai {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 2px 6px;
  min-width: 0;
}
.exam-mid-actions-shared {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px 6px;
  margin-left: 4px;
}
.exam-mid-actions-bank .btn-text,
.exam-mid-actions-bank .btn-primary,
.exam-mid-actions-ai .btn-text,
.exam-mid-actions-ai .btn-primary {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 2px 6px;
  font-size: 12px;
}
.exam-mid-round-label {
  max-width: 7.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #666;
  margin-right: 2px;
}
.exam-mid-actions-bank .exam-count {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}
.exam-tab-panel {
  min-height: 0;
}
.exam-related-papers-chat {
  margin-top: 10px;
}
.exam-related-papers-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.exam-related-paper-link {
  background: none;
  border: none;
  padding: 0;
  color: #1677ff;
  cursor: pointer;
  text-align: left;
  font-size: inherit;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exam-related-paper-link:hover {
  text-decoration: underline;
}

/* AI对话 / 题目列表 空间切换 */
.exam-ai-chat-expanded {
  flex: 1 1 0 !important;
  min-height: 55% !important;
}

.exam-ai-chat-collapsed,
.exam-ai-chat-folded {
  flex: 0 0 auto !important;
  max-height: 46px !important;
  min-height: 46px !important;
  overflow: hidden !important;
}

.exam-ai-chat-folded .exam-chat-body,
.exam-ai-chat-collapsed .exam-chat-body {
  display: none !important;
}

.exam-list-mode-grown {
  flex: 1 1 0 !important;
  min-height: 220px !important;
  margin-top: 8px !important;
}

/* 组题/单元 题型分配行 */
.exam-compose-type-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.exam-compose-type-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}

.exam-compose-type-row input[type="number"] {
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 13px;
  width: 50px;
}

.exam-compose-type-row input[type="number"]:focus {
  outline: none;
  border-color: #1677ff;
}

/* 修改条件区域 */
.exam-chat-modify {
  margin-top: 10px;
  padding: 8px 10px;
  background: #fafcff;
  border-radius: 8px;
  border: 1px dashed #c5d8f5;
}
.exam-chat-modify-toggle {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #1677ff;
  cursor: pointer;
  padding: 2px 0;
}
.exam-chat-modify-folded .exam-chat-modify-body {
  display: none;
}
.exam-chat-modify-body {
  margin-top: 8px;
}

.exam-chat-modify-title {
  font-size: 12px;
  color: #1677ff;
  font-weight: 600;
  margin-bottom: 8px;
}

.exam-chat-modify-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 6px;
}

.exam-chat-modify-row select,
.exam-chat-modify-row input {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
}

.exam-chat-modify-row input[type="text"] {
  flex: 1;
  min-width: 120px;
}

.exam-chat-modify-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.exam-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px 8px 0 0;
  transition: background 0.15s;
}

.exam-collapse-header:hover {
  background: #f5f7fa;
}

.exam-collapse-header h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary, #333);
}

.exam-collapse-icon {
  font-size: 11px;
  color: #999;
  transition: transform 0.2s;
}

.exam-collapsible.collapsed .exam-collapse-icon {
  transform: rotate(-90deg);
}

.exam-collapse-body {
  padding: 0 12px 12px;
}

.exam-collapsible.collapsed .exam-collapse-body {
  display: none;
}

.exam-hint {
  font-size: 12px;
  color: #999;
  margin: 4px 0;
}

.exam-upload-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
}

.exam-upload-tab {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.exam-upload-tab.active {
  background: var(--primary, #4A90D9);
  color: #fff;
  border-color: var(--primary, #4A90D9);
}

.exam-upload-help {
  position: relative;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  cursor: help;
  user-select: none;
  background: #f8fafc;
  z-index: 2;
}

/* fixed 浮层，避免被侧栏 / 收缩卡片 overflow 裁切 */
.exam-upload-help-tip {
  display: none;
  position: fixed;
  z-index: 10050;
  width: min(300px, calc(100vw - 24px));
  max-height: min(70vh, 360px);
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  white-space: pre-line;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
}

.exam-upload-help-tip.is-open {
  display: block;
}

.exam-file-btn {
  display: block;
  text-align: center;
  padding: 8px 12px;
  background: var(--primary, #4A90D9);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 6px;
  transition: opacity 0.2s;
}

.exam-file-btn:hover {
  opacity: 0.85;
}

.exam-file-btn-sm {
  padding: 5px 8px;
  font-size: 12px;
}

.exam-upload-go {
  width: 100%;
  margin-top: 4px;
}

.exam-upload-status {
  font-size: 12px;
  min-height: 16px;
}

.exam-loading { color: var(--primary, #4A90D9); }
.exam-success { color: var(--success, #52C41A); }
.exam-error { color: #ff4d4f; }
.exam-info { color: #666; }

.exam-filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.exam-select,
.exam-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 12px;
  min-width: 0;
}

.exam-search-btn {
  width: 100%;
  margin-top: 4px;
}

.exam-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.exam-bank-actions {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}

.exam-stat-item {
  text-align: center;
  padding: 6px 4px;
  background: #f5f7fa;
  border-radius: 4px;
}

.exam-stat-num {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary, #4A90D9);
}

.exam-stat-label {
  font-size: 11px;
  color: #999;
}

.exam-kaodian-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.exam-tag {
  display: inline-block;
  padding: 2px 6px;
  background: #f0f5ff;
  border: 1px solid #adc6ff;
  border-radius: 3px;
  font-size: 11px;
  color: #2f54eb;
  cursor: pointer;
  transition: all 0.2s;
}

.exam-tag:hover {
  background: #adc6ff;
}

.exam-tag-more {
  background: #f5f5f5;
  border-color: #d9d9d9;
  color: #999;
  cursor: default;
}

/* 题目列表：锁在视口高度，标题行+显示区+输入框一屏可见 */
.exam-question-list {
  flex: 1;
  min-width: 0;
  height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exam-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  min-width: 0;
}

.exam-list-header h4 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-count {
  font-size: 12px;
  color: #999;
}

.exam-list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

.exam-question-item {
  padding: 8px 10px;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  margin-bottom: 6px;
  transition: all 0.2s;
}

.exam-question-item:hover {
  border-color: var(--primary, #4A90D9);
  box-shadow: 0 1px 4px rgba(74, 144, 217, 0.1);
}

.exam-question-in-paper {
  background: #f6ffed;
  border-color: #b7eb8f;
}

.exam-q-item-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.exam-q-check {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  cursor: pointer;
}
.exam-q-check input.exam-q-checkbox {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #1677ff;
}

.exam-batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: #f5f7fa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
}

.exam-batch-bar-compact {
  position: sticky;
  top: 0;
  z-index: 2;
}

.exam-batch-del-btn {
  color: #c0392b !important;
}
.exam-batch-del-btn:hover {
  color: #922b21 !important;
}

.exam-related-papers {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #f0f7ff;
  border: 1px solid #91caff;
  border-radius: 6px;
}

.exam-related-papers-title {
  font-size: 13px;
  font-weight: 600;
  color: #1677ff;
  margin-bottom: 6px;
}

.exam-related-papers-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 2px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #d6e4ff;
}

.exam-related-paper-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 4px 0;
  border-top: 1px dashed #d6e4ff;
  font-size: 12px;
}

.exam-related-papers-toolbar + .exam-related-paper-row {
  border-top: none;
}

.exam-related-paper-check {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.exam-related-paper-name {
  flex: 1 1 140px;
  min-width: 0;
  color: #333;
  word-break: break-all;
}

.exam-related-paper-meta {
  color: #888;
  flex-shrink: 0;
}

.exam-related-paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}

.exam-related-papers-more {
  text-align: center;
  padding: 8px 0 2px;
}

.exam-related-expand-btn {
  font-weight: 600;
  color: var(--primary, #4a90d9);
}

.exam-q-type {
  display: inline-block;
  padding: 1px 6px;
  background: #e6f7ff;
  border: 1px solid #91d5ff;
  border-radius: 3px;
  font-size: 11px;
  color: #1890ff;
}

.exam-q-kaodian {
  font-size: 11px;
  color: #666;
}

.exam-badge {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 16px;
}

.exam-badge-img { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.exam-badge-ans { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.exam-badge-opt { background: #f9f0ff; color: #722ed1; border: 1px solid #d3adf7; }
.exam-badge-ai { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
.exam-badge-vis { margin-left: 2px; }
.exam-badge-vis-private { background: #f5f5f5; color: #595959; border: 1px solid #d9d9d9; }
.exam-badge-vis-region { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
.exam-badge-vis-platform { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }

.exam-upload-visibility { margin-top: 6px; }
.exam-paper-vis-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  margin-left: 6px;
}
.exam-paper-vis-edit .exam-select-sm { max-width: 110px; }

.exam-q-stem {
  font-size: 12px;
  color: #333;
  line-height: 1.5;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.exam-q-actions {
  text-align: right;
}

/* 题目 SVG/图片 展示 */
.exam-q-image {
  margin: 6px 0;
  text-align: center;
  max-width: 100%;
}
.exam-q-image img {
  max-width: 160px;
  max-height: 120px;
  width: auto;
  height: auto;
  border-radius: 4px;
  background: #fafafa;
  padding: 2px;
  border: 1px solid #f0f0f0;
}

/* 试卷预览中的配图（接近原卷，不宜过大） */
.exam-paper-body .exam-q-image img {
  max-width: 180px;
  max-height: 140px;
}

.exam-q-source {
  font-size: 11px;
  color: #999;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-filter-actions {
  gap: 8px;
}

/* 试卷预览 */
/* 右栏预览：默认隐藏，AI生成/加入试卷后展开 */
.exam-paper-preview {
  width: 420px;
  flex-shrink: 0;
  height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
  display: none;          /* 默认隐藏 */
  flex-direction: column;
  overflow: hidden;
  animation: examPreviewSlideIn 0.3s ease;
}

/* 展开状态 */
.exam-paper-preview.exam-preview-show {
  display: flex;
}

@keyframes examPreviewSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 右栏关闭按钮 */
.exam-preview-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.exam-preview-close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* 中栏浮动"预览试卷"按钮 */
.exam-preview-toggle-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 10;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(74,144,217,0.3);
  transition: background 0.2s;
}
.exam-preview-toggle-btn:hover {
  background: #357abd;
}
.exam-preview-toggle-btn .exam-preview-badge {
  display: inline-block;
  background: #fff;
  color: #4a90d9;
  border-radius: 10px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: bold;
  margin-left: 4px;
  min-width: 16px;
  text-align: center;
}

.exam-paper-header {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.exam-paper-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.exam-title-input {
  flex: 1;
  font-size: 15px !important;
  font-weight: 600;
  text-align: center;
  min-width: 0;
}

.exam-header-download {
  flex-shrink: 0;
  white-space: nowrap;
}

.exam-paper-actions-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.exam-paper-meta-row {
  display: flex;
  gap: 6px;
}

.exam-paper-score-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 6px;
  padding: 4px 2px;
  font-size: 12px;
  color: #475569;
}

.exam-score-label {
  font-weight: 600;
  color: #334155;
}

.exam-score-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.exam-score-input,
.exam-a4-score-input {
  width: 48px;
  padding: 2px 4px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  text-align: center;
}

.exam-a4-score-input-q {
  width: 42px;
  margin: 0 2px;
}

.exam-a4-q-score {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: normal;
  color: #64748b;
  white-space: nowrap;
  vertical-align: baseline;
}

.exam-score-hint {
  color: #94a3b8;
  font-size: 11px;
}

.exam-meta-input {
  font-size: 12px !important;
  flex: 1;
}

.exam-paper-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
}

.exam-preview-hint {
  text-align: center;
  padding: 40px 0;
}

.exam-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
}

.exam-checkbox input {
  margin: 0;
}

.exam-select-sm {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  max-width: 140px;
}

.exam-a4-end-answers {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed #cbd5e1;
}

.exam-a4-end-answers h4 {
  margin: 0 0 12px;
  font-size: 16px;
  text-align: center;
}

.exam-a4-end-item {
  margin: 6px 0;
  font-size: 14px;
  line-height: 1.5;
}

.exam-upload-meta {
  margin: 8px 0 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.exam-upload-split {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.exam-upload-split input {
  margin: 0;
}

/* A4试卷预览样式 */
.exam-a4-paper {
  background: #fff;
  padding: 24px 28px;
  min-height: 400px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-radius: 2px;
}

.exam-a4-school {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.exam-a4-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.exam-a4-meta {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.exam-a4-info {
  text-align: center;
  font-size: 12px;
  color: #333;
  margin-bottom: 8px;
}

.exam-a4-divider {
  border: none;
  border-top: 1px dashed #ccc;
  margin: 8px 0 16px;
}

.exam-a4-section {
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 8px;
}

.exam-a4-question {
  margin-bottom: 10px;
  position: relative;
  padding-right: 78px;
  min-height: 28px;
}

.exam-a4-q-toolbar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  padding: 1px 2px;
}

.exam-a4-q-stem {
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.exam-a4-q-score {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: normal;
  color: #64748b;
  white-space: nowrap;
  pointer-events: auto;
}

.exam-a4-score-input-q {
  width: 42px;
  margin: 0;
}

.exam-a4-options {
  margin: 4px 0 4px 20px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.exam-a4-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  white-space: normal;
}

.exam-a4-option-letter {
  flex-shrink: 0;
}

.exam-a4-option-img {
  display: inline-block;
  max-height: 28px;
  max-width: 90px;
  width: auto;
  height: auto;
  vertical-align: middle;
  margin: 0 !important;
}

.exam-a4-img {
  max-width: 180px;
  max-height: 150px;
  width: auto;
  height: auto;
  margin: 4px 0;
}

.exam-a4-img-sm {
  max-width: 120px;
  max-height: 90px;
  width: auto;
  height: auto;
  margin: 2px 0;
}

.exam-formula-placeholder {
  display: inline-block;
  padding: 0 6px;
  background: #f5f5f5;
  border: 1px dashed #d9d9d9;
  border-radius: 3px;
  font-size: 11px;
  color: #999;
}

.exam-a4-answer {
  font-size: 12px;
  color: #cc0000;
  margin-top: 4px;
  padding-left: 20px;
}

.exam-a4-analysis {
  font-size: 12px;
  color: #0066cc;
  margin-top: 2px;
  padding-left: 20px;
}

.exam-a4-q-actions {
  position: absolute;
  top: 0;
  right: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.exam-a4-question:hover .exam-a4-q-actions {
  opacity: 1;
}

/* ===== 题目列表头部操作区 ===== */
.exam-list-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 4px 8px;
  min-width: 0;
}
.exam-list-header-actions .btn-text,
.exam-list-header-actions .btn-primary,
.exam-list-header-actions .btn-secondary {
  flex: 0 0 auto;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  word-break: keep-all;
}
.exam-list-header-actions .exam-count {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
}

.exam-paper-del-btn {
  color: #c0392b !important;
  margin-left: 6px;
  vertical-align: middle;
}
.exam-paper-del-btn:hover {
  color: #922b21 !important;
}

.exam-star-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 4px 0 2px;
  flex-wrap: wrap;
}
.exam-star-btn {
  border: none;
  background: transparent;
  padding: 0 1px;
  margin: 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #d0d0d0;
}
.exam-star-btn.on,
.exam-star-btn:hover,
.exam-star-rating:hover .exam-star-btn.on {
  color: #e6a23c;
}
.exam-star-btn:hover {
  color: #f0b84a;
}
.exam-star-meta {
  margin-left: 6px;
  font-size: 11px;
  color: #888;
}

/* ===== 宽模态框（试卷库） ===== */
.exam-modal-wide .modal,
.exam-modal-wide {
  max-width: 900px;
  width: 90%;
}
.exam-modal-tall .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

/* 拆题校对弹窗 */
.exam-review-modal {
  max-width: 640px;
}
.exam-review-modal .modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #999;
}
.exam-review-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 12px;
  color: #666;
}
.exam-review-textarea {
  min-height: 180px;
  font-family: inherit;
  line-height: 1.5;
}
.exam-review-footer {
  flex-wrap: wrap;
}
.exam-review-footer .btn-text {
  margin-right: auto;
}

/* ===== 试卷库弹窗 ===== */
.exam-paper-browser-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.exam-paper-browser-filter .exam-input {
  flex: 1;
}
.exam-paper-browser-batch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #fff7e6;
  border: 1px solid #ffd591;
  border-radius: 6px;
}
.exam-paper-browser-layout {
  display: flex;
  gap: 16px;
  min-height: 360px;
}
.exam-paper-browser-list {
  width: 42%;
  border-right: 1px solid #eee;
  padding-right: 12px;
  overflow-y: auto;
  max-height: 420px;
}
.exam-paper-admin-hint {
  margin: 0 0 8px;
  font-size: 12px;
}
.exam-paper-browser-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}
.exam-paper-browser-item:hover {
  background: #f0f4ff;
}
.exam-paper-browser-item.active {
  background: #e3ecff;
}
.exam-paper-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding-top: 2px;
  cursor: pointer;
}
.exam-paper-check input {
  width: 16px;
  height: 16px;
  accent-color: #1677ff;
  cursor: pointer;
}
.exam-paper-browser-item-main {
  flex: 1 1 auto;
  min-width: 0;
}
.exam-paper-browser-item-title {
  font-weight: 600;
  font-size: 13px;
  color: #333;
  margin-bottom: 2px;
}
.exam-paper-browser-item-meta {
  font-size: 12px;
  color: #999;
}
.exam-paper-browser-item:has(.exam-paper-checkbox:checked) {
  background: #fff7e6;
  outline: 1px solid #ffd591;
}
.exam-paper-browser-detail {
  flex: 1;
  padding-left: 4px;
  overflow-y: auto;
  max-height: 420px;
}
.exam-paper-browser-detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.exam-paper-browser-detail-questions {
  font-size: 13px;
  line-height: 1.6;
}
.exam-paper-browser-detail-questions .exam-paper-q-item {
  padding: 6px 8px;
  border-bottom: 1px solid #f5f5f5;
}

/* ===== 智能选题弹窗 ===== */
.exam-auto-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.exam-auto-select-row > label {
  min-width: 70px;
  font-size: 14px;
  color: #555;
}
.exam-auto-select-sections {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}
.exam-input-num {
  width: 60px;
  text-align: center;
}

/* ===== AI 改题弹窗 ===== */
.exam-ai-original {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.exam-ai-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 6px;
}
.exam-textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.exam-textarea:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.12);
}
.exam-ai-result {
  margin-top: 14px;
  border: 1px solid #d4edda;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f0fff4;
  font-size: 14px;
  line-height: 1.7;
  max-height: 240px;
  overflow-y: auto;
}
.exam-ai-result-title {
  font-weight: 600;
  color: #28a745;
  margin-bottom: 6px;
}

/* ===== A4 预览 AI 改题按钮 ===== */
.exam-a4-q-actions .btn-text-sm {
  margin-left: 4px;
}

/* 响应式：窄于约三列最小可用宽度才叠成单列（原 1200 与桌面默认窗宽撞车） */
@media (max-width: 1100px) {
  .exam-layout {
    flex-direction: column;
  }
  .exam-sidebar {
    width: 100%;
    max-height: none;
  }
  .exam-sidebar-content {
    overflow-y: visible;
  }
  .exam-mode-tabs {
    position: relative;
  }
  .exam-question-list {
    height: auto;
    max-height: none;
    position: relative;
    top: auto;
    min-height: 360px;
  }
  .exam-paper-preview,
  .exam-history-drawer {
    width: 100%;
    display: none;
    height: auto;
    max-height: 480px;
    position: relative;
    top: auto;
  }
  .exam-paper-preview.exam-preview-show {
    display: flex;
  }
  .exam-history-drawer.exam-history-open {
    display: flex;
    max-height: 360px;
  }
  .exam-preview-toggle-btn {
    position: relative;
    top: 0;
    right: 0;
    margin: 4px 0;
  }
  .exam-paper-browser-layout {
    flex-direction: column;
  }
  .exam-paper-browser-list {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eee;
    padding-right: 0;
    padding-bottom: 12px;
    max-height: 200px;
  }
}
