/* 教资答题 — React SPA 样式（移动优先） */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px; line-height: 1.6; color: #1f2937; background: #f3f4f6;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
h1 { font-size: 22px; margin: 12px 0; }
.muted { color: #6b7280; font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }

/* ── 卡片 ── */
.card { background: #fff; border-radius: 12px; padding: 16px; margin: 12px 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card.tight { padding: 12px; margin: 8px 0; }
.card.highlight { border: 1.5px solid #2563eb; background: #eff6ff; }

/* ── 按钮 ── */
.btn {
  display: block; width: 100%; min-height: 48px; padding: 12px 16px; margin: 8px 0;
  font-size: 17px; font-weight: 600; color: #fff; background: #2563eb; border: 0; border-radius: 10px;
  cursor: pointer; transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.gray { background: #6b7280; }
.btn.green { background: #059669; }
.btn.outline { background: #fff; color: #2563eb; border: 1.5px solid #2563eb; }
.btn.small { min-height: 40px; font-size: 15px; padding: 8px 14px; width: auto; display: inline-block; margin-right: 8px; }
.link-btn { background: none; border: 0; color: #2563eb; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.link-btn:active { background: #eff6ff; }

/* ── 顶栏 ── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 8px 0; margin: -12px -16px 8px; padding-left: 12px; padding-right: 12px;
  background: rgba(243,244,246,.96); backdrop-filter: blur(6px); border-bottom: 1px solid #e5e7eb;
}
.bar-title { flex: 1; font-size: 16px; font-weight: 600; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-right { font-size: 14px; color: #6b7280; min-width: 48px; text-align: right; }
.icon-btn { width: 40px; height: 40px; border: 0; background: #fff; border-radius: 10px;
  font-size: 20px; line-height: 1; cursor: pointer; color: #374151; }
.icon-btn.ghost { background: none; pointer-events: none; }

/* ── 输入 ── */
input[type=text], input[type=number], select {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
}
input[type=range] { width: 100%; margin: 10px 0; }
label { display: block; margin: 10px 0 4px; font-size: 14px; color: #4b5563; }

/* ── 标签 chips ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip {
  padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; gap: 4px;
  border: 1.5px solid #d1d5db; border-radius: 999px; background: #fff; font-size: 15px;
  cursor: pointer; user-select: none;
}
.chip small { color: #9ca3af; font-size: 12px; }
.chip.on { background: #2563eb; color: #fff; border-color: #2563eb; }
.chip.on small { color: #dbeafe; }

/* ── 进度条 ── */
.prog { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin: 8px 0 4px; }
.prog-fill { height: 100%; background: #2563eb; transition: width .25s ease; }

/* ── 题目 ── */
.qmeta { font-size: 13px; color: #6b7280; margin-bottom: 4px; }
.stem { font-size: 17px; line-height: 1.75; margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px; margin: 8px 0;
  min-height: 48px; border: 1.5px solid #d1d5db; border-radius: 10px; background: #fff;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.opt:active { background: #f9fafb; }
.opt.on { border-color: #2563eb; background: #eff6ff; }
.opt.right { border-color: #059669; background: #ecfdf5; }
.opt.wrong { border-color: #dc2626; background: #fef2f2; }
.opt b { color: #2563eb; min-width: 22px; font-weight: 700; }
.opt.right b { color: #059669; }
.opt.wrong b { color: #dc2626; }
.opt span { flex: 1; }
.opt-detail { display: flex; gap: 10px; padding: 6px 0; font-size: 15px; }
.opt-detail b { color: #2563eb; min-width: 22px; }

/* ── 反馈 / 解析 ── */
.fb { border-radius: 10px; padding: 12px; margin: 10px 0; font-size: 15px; }
.fb.ok { background: #ecfdf5; border: 1px solid #059669; color: #065f46; }
.fb.bad { background: #fef2f2; border: 1px solid #dc2626; color: #991b1b; }
.fb.no { background: #fef2f2; border: 1px solid #dc2626; }
.note { font-size: 14px; color: #374151; white-space: pre-wrap; word-break: break-word; margin-top: 8px; }
.detail { border-top: 1px solid #f3f4f6; margin-top: 8px; padding-top: 8px; }

/* ── 布局辅助 ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-actions { display: flex; justify-content: space-between; margin-top: 10px; border-top: 1px solid #f3f4f6; padding-top: 6px; }
.nav-row { display: flex; gap: 10px; margin: 4px 0 10px; }
.nav-row .btn { flex: 1; margin: 0; padding: 9px 0; font-size: 14px; }
.hint { text-align: center; color: #9ca3af; font-size: 13px; margin: 8px 0; }
.hint b { display: inline-block; padding: 1px 7px; border: 1px solid #d1d5db; border-radius: 4px;
  background: #fff; color: #6b7280; font-size: 12px; font-weight: 600; }

/* ── 解析内容（Markdown 渲染）── */
.note { margin-top: 8px; font-size: 14px; line-height: 1.7; color: #374151; }
.note .md-h { font-weight: 700; color: #111827; margin: 10px 0 5px; font-size: 15px;
  padding-left: 8px; border-left: 3px solid #2563eb; }
.note .md-p { margin: 6px 0; }
.note .md-ul, .note .md-ol { margin: 6px 0; padding-left: 22px; }
.note .md-ul li, .note .md-ol li { margin: 4px 0; }
.note .md-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px;
  border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.note .md-table th, .note .md-table td { border: 1px solid #e5e7eb; padding: 7px 9px; text-align: left;
  vertical-align: top; }
.note .md-table th { background: #f3f4f6; font-weight: 600; color: #111827; white-space: nowrap; }
.note .md-table tr:nth-child(even) td { background: #fafafa; }
.note code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 13px;
  font-family: ui-monospace, Menlo, Consolas, monospace; }
.note b { color: #111827; }

/* ── 成绩 ── */
.big-score { font-size: 46px; font-weight: 800; color: #2563eb; line-height: 1.1; }
.big-score small { font-size: 16px; font-weight: 400; color: #6b7280; }

/* ── 恢复码横幅 ── */
.recover-banner {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 100;
  width: min(92%, 420px); background: #fff; border: 2px solid #2563eb; border-radius: 14px;
  padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); text-align: center;
}
.recover-banner .code {
  font-family: ui-monospace, monospace; font-size: 28px; font-weight: 700; letter-spacing: 3px;
  color: #1d4ed8; background: #eff6ff; border-radius: 8px; padding: 10px; margin: 10px 0;
}

/* ── 统计 ── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.stat b { display: block; font-size: 24px; font-weight: 700; color: #2563eb; }
.stat small { color: #6b7280; font-size: 12px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; margin-top: 10px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; height: 100%; min-width: 0; }
.bar-fill { width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; transition: height .3s; }
.bar-lbl { font-size: 10px; color: #6b7280; margin-top: 3px; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 999;
  background: rgba(17,24,39,.93); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 15px; max-width: 90%; animation: fadein .18s ease;
}
.toast.warn { background: rgba(180,83,9,.95); }
.toast.error { background: rgba(153,27,27,.95); }
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── 打印 / 导出 PDF ── */
@media print {
  .topbar, .no-print, .btn, .toast, .recover-banner, .nav-row { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #e5e7eb; break-inside: avoid; }
}

/* ── 小屏优化 ── */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stem { font-size: 16px; }
}

/* ══════════ 搜题 ══════════ */
.search-row { display: flex; align-items: center; gap: 8px; }
.search-input {
  flex: 1; padding: 10px 12px; font-size: 15px; border: 1px solid #d5d9e0;
  border-radius: 8px; background: #fff; -webkit-appearance: none;
}
.search-input:focus { outline: none; border-color: #4c7cf3; }
.chips-tight { margin: 10px 0 4px; flex-wrap: wrap; }
.sr-list { margin-top: 8px; }
.sr-item {
  padding: 10px 0; border-top: 1px solid #eef0f4;
}
.sr-item:first-child { border-top: none; }
.sr-stem { font-size: 14px; line-height: 1.55; color: #1f2430; word-break: break-word; }
.sr-meta { margin-top: 6px; }
mark.hl { background: #fff2a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.link-btn.on { color: #1f8b4c; font-weight: 600; }

/* 详情弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,20,30,.55);
  display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.detail-head { font-size: 12px; color: #7a8291; margin-bottom: 6px; }
.detail-stem { font-size: 15px; line-height: 1.65; color: #1f2430; white-space: pre-wrap; word-break: break-word; }
.detail-opts { margin-top: 12px; }
.detail-opt {
  padding: 8px 10px; margin-bottom: 6px; border: 1px solid #e6e9ef; border-radius: 8px;
  font-size: 14px; line-height: 1.5; color: #2a3040;
}
.detail-opt.right { border-color: #b7e0c4; background: #f2fbf5; }
.detail-ans { margin-top: 12px; font-size: 14px; color: #1f8b4c; }
.detail-note { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e6e9ef; }
.modal-foot {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #eef0f4; background: #fafbfc;
}
.modal-foot .btn { flex: 1; }

.mk-badge {
  display: inline-block; font-size: 11px; line-height: 1; padding: 2px 5px;
  border-radius: 4px; margin-right: 5px; vertical-align: middle;
  background: #eef1f6; color: #66707f;
}
.mk-badge.related { background: #e8f0fe; color: #2b5fd9; }
.mk-badge.partial { background: #fff4e0; color: #b4761a; }
.mk-badge.fuzzy   { background: #fdecec; color: #c0392b; }
.fuzzy-tip {
  margin: 8px 0; padding: 8px 10px; font-size: 13px; line-height: 1.5;
  background: #fff8e6; border-left: 3px solid #f0b429; border-radius: 4px; color: #7a5a12;
}

.opt-warn {
  margin: 10px 0 2px; padding: 8px 10px; font-size: 13px; line-height: 1.5;
  background: #fdecec; border-left: 3px solid #e05c5c; border-radius: 4px; color: #9c2b2b;
}

/* ---- 案例分析题：材料 + 小问 ---- */
.case-wrap { margin: 4px 0 10px; }
.case-material {
  background: #f5f8fc; border-left: 3px solid #4a7fc1; border-radius: 5px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 14.5px; line-height: 1.75; color: #2c3e50;
}
.case-material > summary {
  cursor: pointer; font-weight: 600; color: #35618f; font-size: 13px;
  list-style: none; margin-bottom: 6px; user-select: none;
}
.case-material > summary::-webkit-details-marker { display: none; }
.case-material-body { padding-top: 4px; }
.case-subs-title { font-size: 13px; color: #7a8899; margin: 0 0 8px 2px; }
.case-subs { display: flex; flex-direction: column; gap: 8px; }
.case-sub {
  display: flex; gap: 9px; align-items: flex-start;
  background: #fbfcfd; border: 1px solid #e6ebf1; border-radius: 6px;
  padding: 9px 11px; font-size: 15px; line-height: 1.7; color: #1f2937;
}
.case-sub-idx {
  flex: 0 0 auto; min-width: 20px; height: 20px; border-radius: 50%;
  background: #4a7fc1; color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.case-sub-txt { flex: 1 1 auto; }

/* ---- 案例分析：列表 ---- */
.case-li {
  background: #fff; border: 1px solid #e6ebf1; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.case-li:hover { border-color: #4a7fc1; box-shadow: 0 2px 8px rgba(74,127,193,.12); }
.case-li-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.case-li-tag {
  background: #4a7fc1; color: #fff; font-size: 12px; font-weight: 600;
  padding: 1px 8px; border-radius: 10px;
}
.case-li-n { font-size: 12px; color: #7a8899; }
.case-li-brief { font-size: 14px; line-height: 1.6; color: #2c3e50; }

/* ---- 案例分析：练习页 ---- */
.case-q { margin: 0 0 16px; padding: 12px 0 0; border-top: 1px dashed #e6ebf1; }
.case-q-head { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 9px; }
.case-q-stem { flex: 1 1 auto; font-size: 15px; line-height: 1.7; color: #1f2937; }
.case-opt-grid { display: flex; flex-direction: column; gap: 7px; margin-left: 29px; }
.case-opt {
  background: #fbfcfd; border: 1px solid #e6ebf1; border-radius: 6px;
  padding: 9px 12px; font-size: 14.5px; line-height: 1.6; color: #2c3e50; cursor: pointer;
  transition: all .14s;
}
.case-opt:hover { border-color: #9db8d9; background: #f6f9fd; }
.case-opt.on { border-color: #4a7fc1; background: #eaf2fb; }
.case-opt.right { border-color: #34a853; background: #e9f7ec; }
.case-opt.wrong { border-color: #e05c5c; background: #fdecec; }
.case-noopt {
  margin-left: 29px; padding: 9px 12px; font-size: 13.5px; color: #8a94a6;
  background: #f8f9fb; border: 1px dashed #dfe5ec; border-radius: 6px;
}
.case-verdict { display: inline-block; margin: 8px 0 0 29px; font-size: 13.5px; padding: 3px 10px; border-radius: 4px; }
.case-verdict.ok { background: #e9f7ec; color: #1e7e34; }
.case-verdict.bad { background: #fdecec; color: #9c2b2b; }
.case-verdict.none { background: #f2f4f7; color: #6b7684; }
.case-actions { display: flex; gap: 10px; margin-top: 18px; }
.case-note { margin-top: 12px; font-size: 13px; color: #7a8899; }

.btn-ghost {
  background: transparent; border: 1px solid #d7dee7; color: #4a5568;
  padding: 7px 13px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.btn-ghost:hover { border-color: #4a7fc1; color: #35618f; }

.case-hint { margin-bottom: 10px; }

.ai-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px;
  font-size: 11px; font-weight: 400; color: #92400e; background: #fef3c7;
  border: 1px solid #fde68a; vertical-align: middle;
}
.case-reason {
  margin: 8px 0 0; padding: 9px 11px; border-radius: 6px;
  background: #f8fafc; border-left: 3px solid #94a3b8;
  font-size: 13px; line-height: 1.65; color: #475569;
}
