/* ============================================================
   Simon · 生物错题复盘
   视觉语言取自主理人形象插画：藏青 / 青蓝 / 奶油 / 琥珀，
   粗描边 + 硬投影，波普但克制。
   ============================================================ */
:root {
  --bg: #f6f1e4;
  --surface: #ffffff;
  --surface-2: #fdfaf2;
  --line: #e8e0cd;
  --ink: #1b2340;
  --muted: #6f7385;
  --primary: #22307a;
  --primary-deep: #16204f;
  --primary-soft: #e8ecff;
  --cyan: #29b6d8;
  --cyan-soft: #e2f5fa;
  --amber: #f0a93b;
  --amber-soft: #fdf1dc;
  --coral: #e4572e;
  --coral-soft: #fcebe5;
  --green: #2e9e6b;
  --green-soft: #e4f5ec;
  --radius: 14px;
  --bw: 1.5px;
  --shadow: 4px 4px 0 rgba(27, 35, 64, .10);
  --shadow-pop: 4px 4px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 100% -8%, rgba(41, 182, 216, .10) 0%, transparent 60%),
    radial-gradient(800px 500px at -5% 105%, rgba(240, 169, 59, .10) 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { letter-spacing: -.3px; }

/* ---------- 全站背景：主理人插画铺底，淡到不影响阅读 ---------- */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('/img/simon.jpg') center 22% / min(52vh, 460px) auto no-repeat,
    radial-gradient(900px 500px at 100% -8%, rgba(41, 182, 216, .10) 0%, transparent 60%),
    radial-gradient(800px 500px at -5% 105%, rgba(240, 169, 59, .10) 0%, transparent 55%),
    var(--bg);
  opacity: .14;
}
body > #app { position: relative; z-index: 1; }

/* ---------- 登录 ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 28px 20px;
  position: relative;
  background:
    radial-gradient(1100px 620px at 50% -15%, rgba(34, 48, 122, .16) 0%, transparent 62%),
    radial-gradient(1000px 600px at 8% 4%, rgba(41, 182, 216, .22) 0%, transparent 58%),
    radial-gradient(900px 520px at 100% 12%, rgba(240, 169, 59, .24) 0%, transparent 55%),
    radial-gradient(800px 500px at -5% 105%, rgba(41, 182, 216, .14) 0%, transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 430px; background: var(--surface);
  border: var(--bw) solid var(--ink); border-radius: 22px;
  padding: 30px 30px 26px; box-shadow: 10px 10px 0 rgba(22, 32, 79, .22);
}
.auth-hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 22px; }
.auth-avatar {
  width: 104px; height: 104px; border-radius: 50%; overflow: hidden;
  border: 2.5px solid var(--ink); box-shadow: 5px 5px 0 rgba(27, 35, 64, .16);
  background: #fff; margin-bottom: 14px;
}
.auth-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mascot-avatar { width: 112px; height: 112px; }
.auth-card h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -1px; }
.auth-card h1 span { color: var(--cyan); }
.auth-card h1 .bio { color: var(--amber); }
.auth-mascot {
  width: 122px; height: 122px; object-fit: cover; border-radius: 50%;
  border: 2.5px solid var(--ink); box-shadow: 5px 5px 0 rgba(27, 35, 64, .2);
  margin-top: 12px; background: #fff;
}
.mascot-card { display: flex; align-items: center; gap: 14px; }
.mascot {
  width: 84px; height: 84px; object-fit: cover; border-radius: 18px; flex: none;
  border: var(--bw) solid var(--ink); box-shadow: 3px 3px 0 var(--shadow);
}
.mascot-say { font-size: 14px; font-weight: 600; line-height: 1.7; }
.auth-card .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.demo-tip {
  margin-top: 18px; padding: 13px 15px; background: var(--surface-2);
  border: var(--bw) dashed var(--ink); border-radius: 12px;
  font-size: 13px; line-height: 1.85;
}
.demo-tip b { color: var(--primary); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field label .badge { margin-left: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 13px; background: var(--surface);
  border: var(--bw) solid var(--ink); border-radius: 11px; outline: none; transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { box-shadow: 3px 3px 0 var(--cyan); }
.textarea { resize: vertical; min-height: 76px; line-height: 1.7; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: var(--bw) solid var(--ink); background: var(--surface);
  border-radius: 11px; cursor: pointer; transition: .13s; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(27, 35, 64, .18); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn.primary { background: var(--primary); border-color: var(--ink); color: #fffdf7; box-shadow: 3px 3px 0 var(--amber); }
.btn.primary:hover { background: var(--primary-deep); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: 8px; font-weight: 600; }
.btn.danger { color: var(--coral); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--surface);
  border-right: var(--bw) solid var(--ink);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px; }
.brand b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.6px; line-height: 1.15; }
.brand span { display: block; font-size: 11px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px;
  cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500;
  border: 1.5px solid transparent; transition: .14s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--cyan-soft); color: var(--ink); border-color: var(--ink); box-shadow: 3px 3px 0 rgba(27, 35, 64, .12); }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 8px 4px; }
.sidebar .spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px;
  background: var(--surface-2); border: var(--bw) solid var(--ink);
}
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fffdf7;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
  border: 1.5px solid var(--ink);
}
.user-chip .meta { min-width: 0; flex: 1; }
.user-chip .meta b { display: block; font-size: 13px; }
.user-chip .meta span { font-size: 11px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; padding: 30px 34px 70px; max-width: 1320px; }
.page-head { margin-bottom: 22px; }
.page-head h2 { margin: 0 0 5px; font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: var(--bw) solid var(--ink);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h3 {
  margin: 0 0 16px; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .sidebar { display: none; } .main { padding: 20px 16px 60px; }
}

/* ---------- 统计块 ---------- */
.stat {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .label { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: linear-gradient(180deg, var(--cyan-soft), #fff 78%); }
.stat.accent .value { color: var(--primary); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.badge.subject { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.badge.exam { background: var(--coral-soft); color: var(--coral); border-color: var(--coral); }
.badge.homework { background: var(--cyan-soft); color: #1a8aa5; border-color: var(--cyan); }
.badge.cause { background: var(--amber-soft); color: #a86a10; border-color: var(--amber); }
.badge.ok { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.badge.warn { background: var(--amber-soft); color: #a86a10; border-color: var(--amber); }
.badge.bad { background: var(--coral-soft); color: var(--coral); border-color: var(--coral); }

/* ---------- 错题卡 ---------- */
.mistake {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.mistake + .mistake { margin-top: 12px; }
.mistake.done { opacity: .58; }
.mistake .top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }
.mistake .stem { font-size: 15px; line-height: 1.75; margin-bottom: 11px; white-space: pre-wrap; }
.answer-box { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
@media (max-width: 720px) { .answer-box { grid-template-columns: 1fr; } }
.answer-box > div { padding: 11px 13px; border-radius: 11px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.answer-box .mine { background: var(--coral-soft); border: 1px solid var(--coral); }
.answer-box .right { background: var(--green-soft); border: 1px solid var(--green); }
.answer-box .t { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.answer-box .mine .t { color: var(--coral); }
.answer-box .right .t { color: var(--green); }
.mistake .foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.mistake .note {
  margin-top: 11px; padding: 11px 13px; background: var(--amber-soft);
  border: 1px solid var(--amber); border-radius: 10px; font-size: 13px; white-space: pre-wrap;
}
.mistake img.thumb { max-width: 220px; border-radius: 9px; border: var(--bw) solid var(--ink); margin-top: 10px; display: block; }

/* ---------- 掌握度条 ---------- */
.mastery { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.mastery .bar {
  flex: 1; height: 9px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 99px; overflow: hidden;
}
.mastery .bar i { display: block; height: 100%; border-radius: 99px; background: var(--cyan); }
.mastery .num { font-size: 12px; font-weight: 600; color: var(--ink); width: 52px; text-align: right; }

/* ---------- 筛选 ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 120px; padding: 8px 11px; font-size: 13px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 13px; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; transition: .13s;
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 rgba(27, 35, 64, .16); }
.chip.on { background: var(--primary); color: #fffdf7; box-shadow: 2px 2px 0 var(--amber); }

/* ---------- 题号速选 ---------- */
.qnum-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.qnum {
  width: 42px; height: 42px; border-radius: 11px; border: var(--bw) solid var(--ink);
  background: var(--surface); font-size: 14px; font-weight: 700; cursor: pointer; transition: .12s;
  display: grid; place-items: center; position: relative;
}
.qnum:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(27, 35, 64, .18); }
.qnum.on { background: var(--primary); color: #fffdf7; box-shadow: 3px 3px 0 var(--amber); }
.qnum.done { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.qnum.done::after {
  content: ''; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--green);
}
.qnum.judge { font-size: 12px; }
.qnum.wide { width: auto; min-width: 42px; padding: 0 11px; font-size: 13px; }
/* 考试单元：让它在一堆单元里跳出来 */
.chip.exam-chip { background: var(--amber-soft); border-color: var(--amber); font-weight: 700; }
.chip.exam-chip.on { background: var(--primary); border-color: var(--ink); color: #fffdf7; }

/* ---------- 快速录入：左侧单元目录（分组、单列纵向） ----------
   原来 30+ 个胶囊横铺 5 行，长名称挤压、插画透出、新卷子掉到孤零零一行。
   这里改成独立一列：白底不透明、内部滚动、跟着页面 sticky。 */
.bank-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.bank-content { min-width: 0; }
.unit-nav {
  padding: 0; overflow: hidden; position: sticky; top: 18px;
  display: flex; flex-direction: column; max-height: calc(100vh - 170px); min-height: 0;
}
.unit-nav-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: var(--bw) solid var(--ink);
  background: var(--surface-2); border-radius: 12px 12px 0 0;
}
.unit-nav-head b { font-size: 14px; }
.unit-nav-head .badge { font-size: 11px; padding: 1px 7px; white-space: nowrap; }
.unit-nav-scroll { position: relative; overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.unit-nav-item {
  position: relative; display: flex; align-items: center; width: 100%; text-align: left;
  padding: 7px 34px 7px 10px; margin-bottom: 3px; border: 1.5px solid transparent;
  border-radius: 9px; background: transparent;
  font-size: 12.5px; line-height: 1.45; cursor: pointer; transition: .12s;
}
/* 教材单元名较长：宽度留给名称，题量绝对定位到右侧，避免末尾单字被挤到第二行 */
.unit-nav-item .label {
  flex: 1; min-width: 0; overflow: hidden; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  word-break: break-word;
}
.unit-nav-item .cnt {
  position: absolute; right: 10px; top: 7px;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.unit-nav-item:hover { background: var(--surface-2); border-color: var(--line); }
.unit-nav-item.on {
  background: var(--primary); border-color: var(--ink); color: #fffdf7;
  box-shadow: 2px 2px 0 var(--amber); font-weight: 600;
}
.unit-nav-item.on .cnt { color: #dfe5ff; }
.unit-nav-item.exam:not(.on) .label::before {
  content: '●'; color: var(--amber); font-size: 9px; margin-right: 5px; vertical-align: 1px;
}
.unit-nav-group {
  display: flex; justify-content: space-between; padding: 11px 10px 5px; margin-top: 5px;
  border-top: 1px dashed var(--line); font-size: 11px; font-weight: 700;
  color: var(--muted); letter-spacing: .4px;
}
.unit-nav-group span { font-weight: 500; opacity: .75; }
@media (max-width: 900px) {
  .bank-layout { grid-template-columns: 1fr; gap: 12px; }
  .unit-nav { position: static; max-height: 264px; }
}
/* 非选择题：情境材料 */
.q-context {
  background: var(--surface-2); border-left: 4px solid var(--cyan); border-radius: 8px;
  padding: 10px 13px; font-size: 13px; line-height: 1.75; color: var(--muted);
  white-space: pre-wrap; margin-bottom: 12px;
}
/* 题号按文档模块分组：组头 = 资料里那一节的标题 */
.qgroup { border-left: 3px solid var(--line); padding: 0 0 4px 13px; margin-bottom: 16px; }
.qgroup:last-child { margin-bottom: 0; }
.qgroup-h { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; flex-wrap: wrap; }
.qgroup-name {
  font-size: 13px; font-weight: 700; color: var(--primary);
  border-bottom: 2px solid var(--amber); padding-bottom: 1px;
}
.qnum-legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }

/* 错题本：按模块分组 */
.mgroup { margin-bottom: 26px; }
.unit-group { margin-bottom: 30px; }
.unit-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 8px 12px; border-radius: 11px;
  background: var(--cyan-soft); border: var(--bw) solid var(--ink);
  box-shadow: 3px 3px 0 rgba(27, 35, 64, .1);
}
.unit-name { font-size: 15px; font-weight: 700; }
.unit-name::before { content: '📚'; margin-right: 7px; }
.mgroup-h { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; flex-wrap: wrap; }
.mgroup-name { font-size: 14px; font-weight: 700; }
.mgroup-name::before {
  content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  background: var(--cyan); border: 1.5px solid var(--ink); margin-right: 7px; vertical-align: 1px;
}
.badge.loc-badge { border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* 导出格式选择 */
.export-list { display: grid; gap: 9px; }
.export-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  padding: 11px 14px; border: var(--bw) solid var(--ink); border-radius: 12px;
  background: var(--surface); transition: .13s;
}
.export-opt:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--amber); background: var(--surface-2); }
.export-opt .en {
  flex: none; min-width: 48px; font-weight: 700; font-size: 13px; color: var(--primary);
  background: var(--primary-soft); border-radius: 7px; padding: 4px 0; text-align: center;
}
.export-opt .tx { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.export-opt .tx b { font-size: 14px; }
.export-opt .go { flex: none; font-size: 16px; color: var(--primary); }
.qnum-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--ink); vertical-align: -1px; margin-right: 5px; }

/* 初始密码提醒 */
.pwd-warn {
  margin-top: 8px; padding: 6px 9px; border-radius: 9px; font-size: 12px; font-weight: 600;
  background: var(--amber-soft); border: 1.5px solid var(--amber); color: #8a5410; text-align: center;
}

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; }

/* ---------- 图表 ---------- */
.chart-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.chart-row .name { width: 130px; font-size: 13px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-row .track { flex: 1; height: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.chart-row .track i { display: block; height: 100%; border-radius: 5px; }
.chart-row .val { width: 40px; text-align: right; font-size: 13px; font-weight: 600; flex: none; }

/* ---------- 复习方案 ---------- */
.day {
  border: var(--bw) solid var(--ink); border-radius: var(--radius); background: var(--surface);
  overflow: hidden; box-shadow: var(--shadow);
}
.day + .day { margin-top: 14px; }
.day .head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.day.review .head { background: var(--coral-soft); border-bottom: 1px solid var(--coral); }
.day .head .d { font-weight: 700; font-size: 15px; }
.day .head .tip { color: var(--muted); font-size: 13px; flex: 1; min-width: 200px; }
.day .body { padding: 6px 18px 14px; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.task:last-child { border-bottom: 0; }
.task .idx {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2);
  border: 1.5px solid var(--ink); display: grid; place-items: center; font-size: 11px; font-weight: 700;
  flex: none; margin-top: 2px;
}
.task .info { flex: 1; min-width: 0; }
.task .info .s { font-size: 14px; line-height: 1.65; }
.task .acts { display: flex; gap: 6px; flex: none; flex-wrap: wrap; }
.task.done { opacity: .55; }
.task.done .info .s { text-decoration: line-through; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(27, 35, 64, .48); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal {
  background: var(--surface); border: 2px solid var(--ink); border-radius: 18px;
  width: 100%; max-width: 660px; max-height: 88vh; overflow: auto;
  box-shadow: 8px 8px 0 rgba(27, 35, 64, .30);
}
.modal .m-head { padding: 16px 22px; border-bottom: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); position: sticky; top: 0; }
.modal .m-head h3 { margin: 0; font-size: 17px; }
.modal .m-body { padding: 20px 22px; }
.modal .m-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 10px; }
.close-x { background: none; border: 1.5px solid var(--ink); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; color: var(--ink); line-height: 1; font-size: 16px; }
.close-x:hover { background: var(--coral-soft); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fffdf7; padding: 11px 20px; border-radius: 11px;
  font-size: 14px; font-weight: 500; border: 1.5px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(41, 182, 216, .8);
  opacity: 0; pointer-events: none; transition: .22s; z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 8px 10px; border-bottom: 1.5px solid var(--ink); white-space: nowrap;
}
.tbl td { padding: 11px 10px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr[data-hot] { cursor: pointer; }
.tbl td .badge { margin-right: 4px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.advice {
  padding: 12px 15px; background: var(--cyan-soft); border: 1px solid var(--cyan);
  border-radius: 11px; font-size: 13px; line-height: 1.8;
}

/* ---------- 课时卡片 ---------- */
.lesson-card {
  border: var(--bw) solid var(--ink); border-radius: 12px; padding: 14px 16px;
  background: var(--surface-2); cursor: pointer; transition: .14s;
}
.lesson-card:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--cyan); background: #fff; }
.lesson-card .lname { font-size: 14px; font-weight: 600; line-height: 1.5; }
.lesson-card .lcount { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 题目行 / 详情 ---------- */
.q-row {
  display: flex; gap: 14px; align-items: flex-start; padding: 12px 0;
  border-bottom: 1px dashed var(--line); cursor: pointer;
}
.q-row:last-child { border-bottom: 0; }
.q-row:hover .q-stem { color: var(--primary); }
.q-main { flex: 1; min-width: 0; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.q-stem { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.q-detail-stem {
  font-size: 15px; line-height: 1.8; white-space: pre-wrap;
  background: var(--surface-2); border: var(--bw) solid var(--ink);
  border-radius: 12px; padding: 15px 17px;
}
.bank-lesson { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

/* ---------- 快速录入面板 ---------- */
.qpanel { margin-top: 16px; }
.qpanel .panel-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .qpanel .panel-grid { grid-template-columns: 1fr; } }
.qpanel .side {
  position: sticky; top: 20px;
  border: var(--bw) solid var(--ink); border-radius: 13px;
  background: var(--surface-2); padding: 16px;
  box-shadow: 4px 4px 0 rgba(27, 35, 64, .10);
}
.saved-flag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--green-soft); border: 1.5px solid var(--green); color: var(--green);
  font-size: 13px; font-weight: 600;
}

/* ---------- 题库配图 ---------- */
.q-context img.q-img,
.q-detail-stem img.q-img,
.stem img.q-img,
.answer-box img.q-img,
.right img.q-img {
  display: block; max-width: min(100%, 560px); height: auto;
  margin: 10px 0 4px; padding: 6px;
  background: #fff; border: var(--bw) solid var(--ink); border-radius: 10px;
  cursor: zoom-in;
  box-shadow: 3px 3px 0 rgba(27, 35, 64, .08);
}
.answer-box .right img.q-img { max-width: 100%; }
.img-zoom-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 18, 34, .78);
  display: grid; place-items: center; padding: 28px;
  cursor: zoom-out; animation: zoomfade .16s ease;
}
.img-zoom-mask img {
  max-width: 96vw; max-height: 92vh; height: auto;
  background: #fff; border-radius: 12px; padding: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
}
@keyframes zoomfade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- DNA 艺术元素（双螺旋 · 蓝 green 主视觉） ---------- */
.dna-deco {
  position: fixed; z-index: 0; pointer-events: none; user-select: none;
  border-radius: 50%; object-fit: cover; background: #fff;
  opacity: .5; filter: blur(.4px) saturate(1.05);
  animation: dnaFloat 14s ease-in-out infinite;
}
.auth-wrap .dna-deco { position: absolute; }
.dna-a {
  width: 460px; height: 460px; left: -150px; bottom: -140px;
  transform: rotate(-14deg);
  -webkit-mask-image: radial-gradient(circle at 62% 38%, #000 34%, transparent 72%);
  mask-image: radial-gradient(circle at 62% 38%, #000 34%, transparent 72%);
  animation-delay: -3s;
}
.dna-b {
  width: 380px; height: 380px; right: -120px; top: -110px;
  transform: rotate(16deg);
  -webkit-mask-image: radial-gradient(circle at 40% 60%, #000 34%, transparent 72%);
  mask-image: radial-gradient(circle at 40% 60%, #000 34%, transparent 72%);
  animation-delay: -8s;
}
@keyframes dnaFloat {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 10px -18px; rotate: 3deg; }
}
/* 漂浮气泡（呼应 DNA 图里的圆点） */
.auth-wrap::before, .auth-wrap::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.auth-wrap::before {
  width: 14px; height: 14px; left: 22%; top: 18%;
  background: radial-gradient(circle at 32% 30%, #b8e986, #8dc63f 70%);
  box-shadow: 0 6px 14px rgba(141, 198, 63, .35);
  animation: dotRise 9s ease-in-out infinite;
}
.auth-wrap::after {
  width: 10px; height: 10px; right: 20%; bottom: 24%;
  background: radial-gradient(circle at 32% 30%, #9fd8f5, #3a8fd0 70%);
  box-shadow: 0 6px 14px rgba(58, 143, 208, .35);
  animation: dotRise 11s ease-in-out -4s infinite;
}
@keyframes dotRise {
  0%, 100% { translate: 0 0; }
  50% { translate: 8px -22px; }
}
/* 侧栏底部 DNA 水印 */
.sidebar { position: relative; overflow: hidden; }
.dna-watermark {
  position: absolute; left: 50%; bottom: -60px; translate: -50% 0;
  width: 240px; height: 240px; border-radius: 50%; object-fit: cover;
  opacity: .12; pointer-events: none; user-select: none;
  -webkit-mask-image: radial-gradient(circle, #000 40%, transparent 72%);
  mask-image: radial-gradient(circle, #000 40%, transparent 72%);
}
.sidebar > *:not(.dna-watermark) { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) {
  .dna-deco, .auth-wrap::before, .auth-wrap::after { animation: none; }
}

/* ---------- 题干里的表格 ---------- */
.q-table-wrap { overflow-x: auto; margin: 10px 0 4px; }
.q-table {
  border-collapse: collapse; width: 100%; min-width: 320px;
  background: #fff; font-size: 13px;
  border: var(--bw) solid var(--ink);
}
.q-table th, .q-table td {
  border: 1px solid var(--line); padding: 6px 9px; text-align: center; line-height: 1.55;
}
.q-table th { background: var(--surface-2); font-weight: 600; color: var(--ink); }
.q-table tbody tr:nth-child(even) td { background: #fbf8ef; }

/* ---------- 题库管理（教师端） ---------- */
.qbank-stem {
  font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; cursor: pointer;
}
.qbank-stem:hover { color: var(--primary); }
.pager {
  display: flex; gap: 8px; align-items: center; justify-content: flex-end;
  flex-wrap: wrap; margin-top: 14px;
}
.pager .select { width: auto; padding: 6px 10px; font-size: 13px; }
.tbl tbody tr[data-id] { cursor: pointer; }
code.input {
  display: block; padding: 9px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px; color: var(--ink); background: var(--surface-2);
  border: var(--bw) solid var(--line); border-radius: 10px;
}

/* ---------- 题目编辑里的「实际样子」预览 ---------- */
.q-preview-card {
  border: var(--bw) solid var(--line); border-radius: 12px;
  background: var(--surface-2); padding: 10px 12px; margin-bottom: 14px;
}
.q-preview-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.q-preview-card [data-preview] {
  max-height: 340px; overflow: auto; background: var(--surface);
  border-radius: 10px; padding: 10px 12px;
}
.q-preview-card img.q-img { max-width: 100%; height: auto; }

/* ==============================================================
   手机 / 小屏适配
   窄屏时侧边栏藏起来，改用「顶部条 + 底部标签」导航，
   表格横滚、弹窗贴底全宽、按钮加大触控热区。
   ============================================================== */
.m-top, .m-tabbar { display: none; }

/* ---------- 学生错题（教师端）：名单 + 明细 ---------- */
.stu-wrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.roster { display: flex; flex-direction: column; gap: 6px; max-height: 640px; overflow: auto; }
.roster-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 11px;
  border: 1.5px solid transparent; cursor: pointer; transition: .13s;
}
.roster-item:hover { background: var(--surface-2); }
.roster-item.on { background: var(--primary-soft); border-color: var(--ink); box-shadow: 2px 2px 0 rgba(27,35,64,.14); }
.roster-item .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--primary); color: #fffdf7; border: 1.5px solid var(--ink);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.roster-item .r-info { flex: 1; min-width: 0; }
.roster-item .r-info > b { display: block; font-size: 14px; }
.roster-item .r-info .muted b { font-weight: 700; }
.roster-item .r-right { text-align: right; flex: none; }
.stu-detail .back-btn { display: none; }
@media (max-width: 980px) {
  .stu-wrap { grid-template-columns: 1fr; }
  .roster { max-height: none; }
  .stu-wrap:not(.show-detail) .stu-detail { display: none; }
  .stu-wrap.show-detail .stu-list-panel { display: none; }
  .stu-detail .back-btn { display: inline-flex; }
}

@media (max-width: 860px) {
  /* 侧边栏换导航方式 */
  .sidebar { display: none; }
  .shell { display: block; }
  .main { padding: 14px 13px 96px; max-width: none; }

  .m-top {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 40;
    padding: 9px 13px; background: var(--surface);
    border-bottom: var(--bw) solid var(--ink);
  }
  .m-top .m-brand b { font-size: 17px; letter-spacing: -.5px; }
  .m-top .m-user { font-size: 13px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-top .btn.sm { padding: 6px 10px; }

  .m-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: var(--bw) solid var(--ink);
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -3px 0 rgba(27, 35, 64, .06);
  }
  .m-tabbar .nav-item {
    flex: 1; min-width: 0; flex-direction: column; gap: 1px;
    padding: 5px 2px; font-size: 11px; border-radius: 9px; text-align: center;
  }
  .m-tabbar .nav-item .ico { width: auto; font-size: 17px; line-height: 1.1; }
  .m-tabbar .nav-item .lb { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .m-tabbar .nav-item.active { box-shadow: none; }

  /* 字号与留白 */
  .page-head { margin-bottom: 16px; }
  .page-head h2 { font-size: 21px; }
  .page-head p { font-size: 13px; }
  .card { padding: 15px; border-radius: 12px; }
  .card + .card { margin-top: 13px; }
  .stat { padding: 13px 14px; }
  .stat .value { font-size: 25px; }

  /* 工具栏：一排一个，别挤 */
  .toolbar { gap: 8px; margin-bottom: 14px; }
  .toolbar .select, .toolbar .input { width: 100%; min-width: 0; flex: 1 1 auto; }
  .toolbar .grow { flex: 1 1 100%; min-width: 0; }
  .toolbar .btn { flex: 1 1 auto; }
  .row { gap: 10px; }
  .row > * { flex: 1 1 100%; min-width: 0; }

  /* 表格：横着滑，别把字压成一列 */
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { white-space: nowrap; }
  .tbl td:nth-child(2) { white-space: normal; min-width: 220px; }
  /* 题库列表：单元/课时列在手机上省略，信息在详情里还有 */
  .tbl.hide-sm-col th:nth-child(3), .tbl.hide-sm-col td:nth-child(3) { display: none; }

  /* 弹窗：贴底的全屏卡片 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none; width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0;
    border-bottom: 0; box-shadow: none;
  }
  .modal .m-body { padding: 15px 15px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .modal .m-head { padding: 13px 15px; }
  .close-x { width: 32px; height: 32px; }

  /* 触控热区 */
  .btn { padding: 11px 16px; }
  .btn.sm { padding: 7px 12px; font-size: 13px; }
  .chip { padding: 7px 14px; }
  .qnum { width: 46px; height: 46px; }

  /* 图表名字太宽会挤掉条形图 */
  .chart-row .name { width: 96px; }
  .qpanel .side { position: static; }
  .q-detail-stem { padding: 13px 13px; font-size: 14.5px; }
  .toast { bottom: 74px; }
}

@media (max-width: 420px) {
  .auth-card { padding: 24px 20px 20px; border-radius: 18px; }
  .auth-card h1 { font-size: 26px; }
  .mascot-avatar { width: 92px; height: 92px; }
  .stat .value { font-size: 23px; }
  .m-top .m-user { display: none; }
}

/* 弹窗里的双列表单在小屏一行一个 */
@media (max-width: 860px) {
  .modal .row { flex-direction: column; gap: 10px; }
  .modal .row > .field { flex: none !important; width: 100%; }
}
