/* ===================== 智慧题库 · 移动 H5 ===================== */
:root {
  --primary: #f97316;
  --primary-d: #ea580c;
  --primary-l: #fff7ed;
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #94a3b8;
  --border: #eceff3;
  --success: #16a34a;
  --danger: #ef4444;
  --top-h: 50px;
  --tab-h: 56px;
  --gap: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; outline: none; }
img { display: block; }
.muted { color: var(--muted); font-size: 12px; }
.center { text-align: center; }

/* ---------- 顶部栏 ---------- */
.m-top {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center;
  padding-left: 10px; padding-right: 10px;
}
.m-top .m-title { flex: 1; text-align: center; font-weight: 700; font-size: 17px; }
.m-back {
  width: 34px; height: 34px; font-size: 28px; line-height: 1;
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.m-login-link { color: #fff; font-size: 14px; padding: 6px 4px; font-weight: 600; }
.m-user-dot { color: #fff; font-size: 18px; padding: 6px 4px; }
.m-search {
  flex: 1; display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.22); border-radius: 18px;
  padding: 0 12px; height: 34px;
}
.m-search .ico { font-size: 13px; opacity: .9; }
.m-search input {
  flex: 1; border: none; background: transparent; color: #fff;
  font-size: 14px; height: 34px;
}
.m-search input::placeholder { color: rgba(255,255,255,.8); }

/* ---------- 页面容器 ---------- */
.m-page {
  padding: calc(var(--top-h) + env(safe-area-inset-top) + var(--gap)) 12px calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  min-height: 100vh;
}
.m-card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: var(--gap);
}

/* ---------- 首页 Hero ---------- */
.m-hero { padding: 6px 4px 14px; }
.m-hero h1 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.m-hero p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- 分类横滑 ---------- */
.m-cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.m-cats::-webkit-scrollbar { display: none; }
.m-cat {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 18px;
  background: #fff; color: #475569; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); white-space: nowrap;
}
.m-cat.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 题库列表 ---------- */
.m-list { display: flex; flex-direction: column; gap: var(--gap); }
.m-bank {
  background: var(--card); border-radius: 14px; padding: 12px;
  display: flex; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.m-bank:active { background: #fafafa; }
.m-bank-cover { width: 56px; height: 56px; border-radius: 12px; flex: 0 0 auto; }
.m-bank-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.m-bank-name { font-weight: 700; font-size: 15px; line-height: 1.35; }
.m-bank-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; }
.m-bank-tags { display: flex; gap: 6px; }
.tag {
  background: var(--primary-l); color: var(--primary-d);
  font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 600;
}
.tag.gray { background: #f1f5f9; color: #64748b; }

/* ---------- 通用按钮 ---------- */
.m-btn {
  display: block; width: 100%; padding: 13px; border-radius: 12px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 700;
  text-align: center;
}
.m-btn:active { background: var(--primary-d); }
.m-btn.light { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

/* ---------- 空态 ---------- */
.m-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.m-empty .ico { font-size: 44px; margin-bottom: 10px; }
.m-empty p { margin: 4px 0; font-size: 15px; color: #475569; }
.m-empty p.sub { font-size: 12px; color: var(--muted); }
.m-empty .m-btn { width: auto; display: inline-block; padding: 10px 24px; margin-top: 14px; }

/* ---------- 题库详情 ---------- */
.m-mode-title { font-weight: 700; font-size: 15px; margin: 16px 4px 10px; }
.m-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-mode {
  background: var(--card); border-radius: 14px; padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); border: 1px solid var(--border);
}
.m-mode:active { background: var(--primary-l); }
.m-mode .mi { font-size: 26px; }
.m-mode b { font-size: 15px; }
.m-mode i { font-style: normal; font-size: 12px; color: var(--muted); }

/* ===================== 答题（全屏） ===================== */
.m-session {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.m-s-head {
  background: var(--primary); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  flex: 0 0 auto;
}
.m-s-exit { font-size: 18px; color: #fff; width: 30px; height: 30px; }
.m-s-title { flex: 1; min-width: 0; }
.m-s-title .t1 { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-s-title .t2 { font-size: 12px; opacity: .9; }
.m-s-timer { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-s-timer.warn { color: #fde047; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .4; } }

.m-progress { height: 4px; background: rgba(255,255,255,.3); flex: 0 0 auto; }
.m-progress i { display: block; height: 100%; background: #fff; transition: width .25s; }

.m-s-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 14px 20px; }
.m-q-stem { font-size: 17px; font-weight: 600; line-height: 1.55; margin-bottom: 8px; }
.m-q-type { color: var(--muted); font-size: 12px; margin-bottom: 14px; }

.m-opts { display: flex; flex-direction: column; gap: 12px; }
.m-opt {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fff; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 14px 14px; min-height: 52px;
}
.m-opt:active { border-color: var(--primary); }
.m-opt .k {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid #cbd5e1; color: #64748b; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.m-opt .v { flex: 1; font-size: 15px; line-height: 1.5; padding-top: 1px; }
.m-opt.sel { border-color: var(--primary); background: var(--primary-l); }
.m-opt.sel .k { background: var(--primary); color: #fff; border-color: var(--primary); }
.m-opt.correct { border-color: var(--success); background: #f0fdf4; }
.m-opt.correct .k { background: var(--success); color: #fff; border-color: var(--success); }
.m-opt.wrong { border-color: var(--danger); background: #fef2f2; }
.m-opt.wrong .k { background: var(--danger); color: #fff; border-color: var(--danger); }

.m-analysis {
  margin-top: 16px; border-radius: 12px; padding: 12px 14px;
  background: #f8fafc; font-size: 14px; line-height: 1.6;
}
.m-analysis.ok { background: #f0fdf4; }
.m-analysis.no { background: #fef2f2; }
.m-analysis .h { font-weight: 700; margin-bottom: 6px; font-size: 13px; }
.m-analysis.ok .h { color: var(--success); }
.m-analysis.no .h { color: var(--danger); }

.m-s-foot {
  flex: 0 0 auto; display: flex; gap: 10px; padding: 10px 12px;
  background: #fff; border-top: 1px solid var(--border);
}
.m-f-btn {
  flex: 1; padding: 13px; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: var(--primary); color: #fff;
}
.m-f-btn:active { background: var(--primary-d); }
.m-f-btn:disabled { opacity: .4; }
.m-f-btn.light { background: #f1f5f9; color: #475569; }
.m-f-btn.save { background: #fff; color: var(--primary); border: 1px solid var(--primary); flex: 0 0 auto; padding-left: 16px; padding-right: 16px; }
.m-f-btn.primary { }

/* ---------- 结果 ---------- */
.m-result { text-align: center; padding: 24px 16px; }
.m-score {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 6px solid var(--primary); color: var(--primary);
}
.m-score .num { font-size: 38px; font-weight: 800; line-height: 1; }
.m-score .tot { font-size: 13px; color: var(--muted); }
.m-score.pass { border-color: var(--success); color: var(--success); }
.m-score.fail { border-color: var(--danger); color: var(--danger); }
.m-result h2 { margin: 6px 0 14px; font-size: 20px; }
.m-result h2.pass { color: var(--success); }
.m-result h2.fail { color: var(--danger); }
.m-res-stats { display: flex; justify-content: space-around; }
.m-res-stats div { display: flex; flex-direction: column; gap: 2px; }
.m-res-stats b { font-size: 20px; }
.m-res-stats span { font-size: 12px; color: var(--muted); }

.m-review { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-review .rh { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.m-review .rh strong { flex: 1; font-size: 14px; line-height: 1.55; font-weight: 600; }
.m-review .rm { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.m-fav { color: var(--muted); font-size: 18px; flex: 0 0 auto; }
.m-fav.on { color: #f59e0b; }
.m-del { color: var(--danger); font-size: 12px; flex: 0 0 auto; padding: 4px 6px; }

.m-res-btns { display: flex; gap: 10px; margin-top: 16px; }
.m-res-btns .m-btn { flex: 1; }

/* ===================== 我的 ===================== */
.m-profile {
  background: linear-gradient(135deg, var(--primary), #fb923c);
  border-radius: 14px; padding: 18px 16px; color: #fff;
  display: flex; align-items: center; gap: 14px; margin-bottom: var(--gap);
}
.m-profile.gate { background: #fff; color: var(--text); border: 1px solid var(--border); }
.m-profile .ava {
  width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
  flex: 0 0 auto;
}
.m-profile.gate .ava { background: var(--primary-l); color: var(--primary); }
.m-profile .pi { flex: 1; min-width: 0; }
.m-profile .nm { font-size: 17px; font-weight: 700; }
.m-profile .uid { font-size: 12px; opacity: .85; }
.m-profile.gate .uid { color: var(--muted); }
.m-exit-btn { background: rgba(255,255,255,.25); color: #fff; padding: 6px 12px; border-radius: 16px; font-size: 13px; }
.m-profile.gate .arrow, .m-menu-item .arrow { color: #cbd5e1; font-size: 20px; }

.m-stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: var(--gap); }
.m-stat-grid .sg { background: #fff; border-radius: 12px; padding: 12px 4px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-stat-grid .sg b { display: block; font-size: 18px; color: var(--primary-d); }
.m-stat-grid .sg span { font-size: 11px; color: var(--muted); }

.m-menu { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
.m-menu-item:last-child { border-bottom: none; }
.m-menu-item:active { background: #fafafa; }
.m-menu-item .mi { font-size: 18px; }
.m-menu-item span:nth-child(2) { flex: 1; text-align: left; }

/* ---------- 我的题库 ---------- */
.m-mybanks { margin-top: 18px; }
.m-menu-title { font-size: 13px; color: var(--muted); font-weight: 600; margin: 4px 4px 10px; letter-spacing: .5px; }
.m-mybank { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-mybank:active { background: #fafafa; }
.m-mybank .cv { width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0; }
.m-mybank .bi { flex: 1; min-width: 0; }
.m-mybank .bn { font-size: 14px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-mybank .bm { font-size: 12px; color: var(--muted); margin-top: 4px; }
.m-mybank .go { font-size: 13px; color: var(--primary); font-weight: 600; flex-shrink: 0; }
.m-empty.mini { padding: 28px 20px; }
.m-empty.mini .ico { font-size: 34px; }

.m-foot-tip { text-align: center; color: var(--muted); font-size: 11px; margin-top: 24px; }

/* ---------- 子页列表 ---------- */
.m-sub-list { display: flex; flex-direction: column; gap: 10px; }
.m-sub { background: #fff; border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-sub .ss { flex: 1; min-width: 0; }
.m-sub .ss b { display: block; font-size: 15px; margin-bottom: 2px; }
.m-sub .sr { font-size: 18px; font-weight: 800; color: var(--primary-d); }
.m-sub .sr i { font-size: 12px; color: var(--muted); font-weight: 400; font-style: normal; }
.m-sub .sr.pass { color: var(--success); }
.m-sub .sr.fail { color: var(--danger); }

/* ===================== 底部 Tab ===================== */
.m-tab {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--border);
  display: flex;
}
.m-tab button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #94a3b8; font-size: 11px; }
.m-tab button .ti { font-size: 22px; }
.m-tab button.on { color: var(--primary); }

/* ===================== 弹窗 / Toast ===================== */
.m-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.m-modal {
  width: 100%; max-width: 460px; background: #fff; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: up .25s ease;
}
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.m-tabs { display: flex; gap: 20px; justify-content: center; margin-bottom: 16px; }
.m-tabs span { font-size: 17px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.m-tabs span.on { color: var(--primary); border-bottom: 2px solid var(--primary); }
.m-field { margin-bottom: 12px; }
.m-field input {
  width: 100%; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; background: #f8fafc;
}
.m-field input:focus { border-color: var(--primary); background: #fff; }
.m-toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 80;
  background: rgba(0,0,0,.8); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; max-width: 80%; text-align: center;
}
.m-toast.ok { background: rgba(22,163,74,.92); }
.m-toast.err { background: rgba(239,68,68,.92); }

/* ===================== 我的课程 / 课程中心（移动端） ===================== */
.m-mycourse { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-mycourse:active { background: #fafafa; }
.m-mycourse .cv { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--primary-light); }
.m-mycourse .bi { flex: 1; min-width: 0; }
.m-mycourse .bn { font-size: 14px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-mycourse .bm { font-size: 12px; color: var(--muted); margin-top: 4px; }
.m-mycourse .go { font-size: 13px; color: var(--primary); font-weight: 600; flex-shrink: 0; }

.m-courses { display: flex; flex-direction: column; gap: 12px; }
.m-course { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.m-course .cccv { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--primary-light); }
.m-course .ccinfo { flex: 1; min-width: 0; }
.m-course .cctitle { font-size: 14px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-course .ccsub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.m-course .ccprice { font-size: 13px; color: var(--primary-d); font-weight: 700; margin-top: 4px; }

/* ===================== 富文本题干 / 解析（图片自适应） ===================== */
.m-rich img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; display: block; }
.m-rich p { margin: 6px 0; }
.m-rich table { width: 100%; border-collapse: collapse; font-size: 13px; }
.m-rich td, .m-rich th { border: 1px solid var(--border); padding: 6px 8px; }
.m-q-stem .q-no { margin-right: 2px; }

/* ===================== 答题页：本题操作（标记/收藏/解析/答题卡） ===================== */
.m-s-actions {
  display: flex; align-items: center; flex: none;
  background: #fff; border-top: 1px solid var(--border); padding: 6px 4px;
}
.m-qa {
  flex: 1; background: none; border: none; display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 6px 0; color: #64748b; font-size: 11px;
  cursor: pointer; font-family: inherit;
}
.m-qa i { font-style: normal; font-size: 18px; line-height: 1; }
.m-qa.on { color: var(--primary); }
.m-qa:active { opacity: .6; }

/* ===================== 答题卡弹层 ===================== */
.m-sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90;
  display: flex; align-items: flex-end;
}
.m-sheet {
  width: 100%; background: #fff; border-radius: 16px 16px 0 0; padding: 14px 14px 20px;
  max-height: 70vh; overflow-y: auto;
}
.m-sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.m-sheet-head b { font-size: 16px; }
.m-sheet-head .muted { flex: 1; font-size: 12px; }
.m-sheet-close {
  background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 0 4px;
}
.m-card-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.m-card-item {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: #475569; font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.m-card-item.ok { background: var(--success); color: #fff; border-color: var(--success); }
.m-card-item.no { background: var(--danger); color: #fff; border-color: var(--danger); }
.m-card-item.done { background: var(--primary-l); color: var(--primary-d); border-color: var(--primary); }
.m-card-item.mk { box-shadow: inset 0 0 0 2px #a855f7; }
.m-card-item.cur { outline: 2px solid var(--primary); outline-offset: 1px; }
.m-card-legend {
  display: flex; gap: 14px; justify-content: center; margin-top: 14px;
  font-size: 12px; color: var(--muted);
}
.m-card-legend .d {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px;
}
.m-card-legend .d.ok { background: var(--success); }
.m-card-legend .d.no { background: var(--danger); }
.m-card-legend .d.todo { background: #fff; border: 1px solid var(--border); }
.m-card-legend .d.mk { background: #a855f7; }

/* ===================== 模拟试题：模式 / 科目 / 套卷 ===================== */
.m-set-modes { display: flex; gap: 10px; }
.m-set-mode {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 14px; font-weight: 600; color: #475569; cursor: pointer;
  font-family: inherit;
}
.m-set-mode.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.m-subj-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; }
.m-subj-scroll::-webkit-scrollbar { display: none; }
.m-subj {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; color: #475569; cursor: pointer; font-family: inherit;
}
.m-subj.on { background: var(--primary-l); color: var(--primary-d); border-color: var(--primary); }
.m-sets { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.m-set {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px;
  padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); border: 1px solid var(--border);
}
.m-set:active { background: #fafafa; }
.m-set .sn { font-size: 14px; font-weight: 700; }
.m-set .sc { flex: 1; font-size: 12px; color: var(--muted); }
.m-set .go { font-size: 13px; color: var(--primary); font-weight: 600; }
