/* 新增题型语义色（实操/排序/配对）、Markdown 内容与拖动题交互样式 */
.type-pill[data-qtype="6"] { background: #ecfeff; color: #0e7490; }
.type-pill[data-qtype="7"] { background: #fff7ed; color: #c2410c; }
.type-pill[data-qtype="8"] { background: #ecfdf5; color: #15803d; }
.type-pill[data-qtype="9"] { background: #f5f3ff; color: #6d28d9; }
:root[data-theme="dark"] .type-pill[data-qtype="6"] { background: rgba(6, 182, 212, .16); color: #67e8f9; }
:root[data-theme="dark"] .type-pill[data-qtype="7"] { background: rgba(249, 115, 22, .16); color: #fdba74; }
:root[data-theme="dark"] .type-pill[data-qtype="8"] { background: rgba(34, 197, 94, .16); color: #86efac; }
:root[data-theme="dark"] .type-pill[data-qtype="9"] { background: rgba(139, 92, 246, .18); color: #c4b5fd; }

.md-content { font-size: 0.875rem; line-height: 1.7; word-break: break-word; }
.md-content p { margin: 0 0 8px; }
.md-content p:last-child { margin-bottom: 0; }
.md-content h4 { margin: 10px 0 6px; font-size: 0.9063rem; }
.md-content ul, .md-content ol { margin: 4px 0 8px; padding-left: 20px; }
.md-content li { margin: 3px 0; }
.md-content code { padding: 1px 5px; border-radius: 4px; background: var(--surface-soft); font-family: ui-monospace, Menlo, monospace; font-size: 0.7813rem; }
.md-content pre { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-soft); border: 1px solid var(--line); overflow-x: auto; line-height: 1.5; }
.md-content pre code { padding: 0; background: transparent; font-size: 0.7813rem; }
.md-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.8125rem; background: var(--surface); border: 1px solid var(--line); }
.md-table th, .md-table td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; }
.md-table th { background: var(--surface-soft); font-weight: 600; }

/* 排序拖动题 */
.order-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.order-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: grab; user-select: none; transition: border-color .15s, background .15s;
}
.order-item:active { cursor: grabbing; }
.order-item.drag-over { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.order-item.is-ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.order-item.is-bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.order-item-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.order-idx { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-soft); color: var(--muted); font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* 拖拽配对题 */
.match-board { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.match-row { display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(160px, 1.2fr); align-items: center; gap: 10px; }
.match-left { padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-soft); font-weight: 600; font-size: 0.8438rem; }
.match-slot {
  min-height: 40px; padding: 6px 12px; border-radius: 9px; border: 1.5px dashed var(--line-strong);
  background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.8438rem; cursor: pointer; transition: all .15s ease;
}
.match-slot.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.match-slot.filled { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg); font-weight: 600; }
.match-slot.is-ok { border-style: solid; border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.match-slot.is-bad { border-style: solid; border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.match-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--line); }
.match-chip { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 0.8125rem; font-weight: 600; cursor: grab; user-select: none; }
.match-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg); }

/* 闪卡三档记忆栏 */
.flashcard-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.answer-img-wrap { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* 题干内表格消除 pre-wrap 空白 + Markdown 引用与公式块 */
.q-title.md-content { white-space: normal; }
.q-title.md-content pre { white-space: pre; }
.q-title.md-content p { margin: 0 0 8px; }
.q-title.md-content .table-wrap { margin: 8px 0; }
.q-title.md-content .md-table { margin: 0; font-size: 0.8438rem; font-weight: 400; line-height: 1.5; }
.q-title.md-content .md-table th { font-weight: 600; }
.md-content blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-soft); border-radius: 0 6px 6px 0; }
.md-math { margin: 6px 0; padding: 7px 10px; border-radius: 7px; background: var(--surface-soft); border: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; font-size: 0.7813rem; overflow-x: auto; white-space: pre-wrap; }

/* AI 思考等待动效（微环 + 跳动三点 + 实时耗时） */
@keyframes aiSpin { to { transform: rotate(360deg); } }
@keyframes aiBounce { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-3px); opacity: 1; } }
.ai-thinking { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent-fg); }
.ai-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: aiSpin .75s linear infinite; flex: none; }
.ai-dots { display: inline-flex; align-items: center; gap: 3px; }
.ai-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: aiBounce 1.1s infinite ease-in-out; font-style: normal; }
.ai-dots i:nth-child(2) { animation-delay: .16s; }
.ai-dots i:nth-child(3) { animation-delay: .32s; }
.ai-elapsed { font-size: 0.75rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 刷题三栏拖拽分隔手柄 */
.pane-resizer { position: relative; width: 12px; height: 100%; cursor: col-resize; display: flex; align-items: center; justify-content: center; user-select: none; }
.pane-resizer::after { content: ""; width: 3px; height: 42px; border-radius: 999px; background: var(--line-strong); opacity: .45; transition: height .15s, background-color .15s, opacity .15s; }
.pane-resizer:hover::after, .pane-resizer.dragging::after { height: 84px; background: var(--accent); opacity: 1; }
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none !important; }
.ai-head-bar { flex-wrap: wrap; gap: 6px; }
.ai-session-sel { flex: 1; min-width: 110px; max-width: none; padding: 3px 7px; font-size: 0.75rem; border-radius: 7px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--ink); }

@media (max-width: 640px) { .match-row { grid-template-columns: 1fr; gap: 4px; } .match-arrow { display: none; } }

/* 试题配图白底衬垫（兼容深色主题透明底 PNG）与点击放大灯箱 */
.q-img,
.md-content img,
.answer-img-wrap img,
.search-detail-body img,
.q-table-detail-box img {
  display: inline-block;
  max-width: 100%;
  background: #ffffff;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  transition: box-shadow .15s ease, transform .15s ease;
}
.q-img:hover,
.md-content img:hover,
.answer-img-wrap img:hover,
.search-detail-body img:hover,
.q-table-detail-box img:hover {
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(15, 23, 42, .12));
}
.md-img-wrap { margin: 10px 0; }
.md-img-wrap img { max-height: 300px; }
.md-img-inline { max-height: 240px; vertical-align: middle; margin: 4px 0; }

.img-lightbox-card {
  width: fit-content;
  max-width: min(94vw, 1180px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.img-lightbox-stage {
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
}
.img-lightbox-stage img {
  display: block;
  max-width: min(88vw, 1120px);
  max-height: calc(92vh - 96px);
  width: auto;
  height: auto;
  cursor: zoom-in;
}
.img-lightbox-stage img.is-actual {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

/* 导航栏自动更新探测角标 */
.nav-update-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--bad, #dc2626);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

/* 背题模式纯净答案卡片 & 更新日志精确时间戳 */
.answer-box.is-recite-clean { padding: 14px 16px; }
.recite-ans-body { margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--ok); font-size: 0.9375rem; line-height: 1.75; }
.recite-analysis-sep { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.8125rem; }
.recite-analysis-label { color: var(--muted); font-weight: 600; }
.cl-chip { display: inline-flex; align-items: center; gap: 6px; }
.cl-chip-time { font-size: 0.6875rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.cl-float-pop-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cl-float-pop-time { font-size: 0.7188rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 数学公式、代码块头部与全局 AI 抽屉 */
.md-math-inline { font-family: "Times New Roman", Georgia, serif; background: var(--surface-2, rgba(128,128,128,0.08)); padding: 1px 5px; border-radius: 4px; font-size: 0.96em; }
.md-frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: 0.85em; margin: 0 3px; line-height: 1.1; }
.md-frac-n { border-bottom: 1px solid currentColor; padding: 0 3px 1px; }
.md-frac-d { padding: 1px 3px 0; }
.md-code-block { margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius-sm, 8px); overflow: hidden; }
.md-code-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; background: var(--surface-2, rgba(128,128,128,0.08)); font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.md-code-block pre { margin: 0; border: none; border-radius: 0; }

.ai-drawer-card { max-width: 680px; width: min(94vw, 680px); max-height: 88vh; display: flex; flex-direction: column; }
.aid-q-preview { background: var(--surface-2, rgba(128,128,128,0.06)); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; }
.aid-log { flex: 1; min-height: 220px; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.aid-input-row { display: flex; gap: 8px; align-items: flex-end; }
.aid-input-row textarea { flex: 1; }
.chat-msg.is-err .chat-bubble { border: 1px solid var(--bad, #dc2626); color: var(--bad, #dc2626); }

/* 答题卡区分已答与当前、考场侧边答题卡与倒计时预警 */
.sheet-dot.answered { background: var(--accent-soft, rgba(43,92,230,0.14)); border-color: var(--accent, #2b5ce6); color: var(--accent, #2b5ce6); font-weight: 600; }
.sheet-dot.flagged { box-shadow: inset 0 0 0 2px #f59e0b; }
.exam-room-layout { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 14px; align-items: start; }
.exam-room-aside { position: sticky; top: 68px; max-height: calc(100vh - 88px); overflow-y: auto; }
.exam-timer-warn { color: #d97706 !important; font-weight: 700; }
.exam-timer-danger { color: #dc2626 !important; font-weight: 800; }
.recite-blur-mask { filter: blur(6px); user-select: none; cursor: pointer; transition: filter 0.2s; }
.recite-blur-mask.is-revealed { filter: none; user-select: text; }
.multi-blank-grid { display: grid; gap: 8px; margin-top: 8px; }
.multi-blank-row { display: flex; align-items: center; gap: 8px; }
.multi-blank-row label { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 960px) { .exam-room-layout { grid-template-columns: 1fr; } .exam-room-aside { position: static; max-height: none; } }

/* AI 助教深色用户气泡底部操作栏对比度修复 */
.ai-msg.user .ai-msg-actions { border-top-color: rgba(255, 255, 255, 0.24); }
.ai-msg.user .ai-msg-actions .link-btn,
.ai-msg.user .ai-msg-actions .ai-act-btn,
.ai-msg.user .ai-msg-actions .muted-text { color: rgba(255, 255, 255, 0.88); }
.ai-msg.user .ai-msg-actions .link-btn:hover,
.ai-msg.user .ai-msg-actions .ai-act-btn:hover { color: #ffffff; text-decoration: underline; }

/* 30 秒问题复现录制悬浮状态条 */
.diag-rec-bar {
  position: fixed;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--bad, #dc2626);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.8125rem;
  font-weight: 600;
  max-width: 92vw;
}
.diag-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad, #dc2626);
  flex: none;
  animation: diagPulse 1.1s infinite ease-in-out;
}
@keyframes diagPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
