/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --green-border: #bbf7d0;
  --red: #dc2626;
  --red-light: #fef2f2;
  --red-border: #fecaca;
  --orange: #d97706;
  --orange-light: #fffbeb;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --text: #1e293b;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --bg: #f4f5fb;
  --card: #ffffff;
  --surface: #ffffff;    /* 输入框/按钮/选项等白色控件面 */
  --surface-2: #f8fafc;  /* 次级浅色面板(说明框/页签底/表头 hover 等) */
  --line-2: #f1f5f9;     /* 更浅的分隔线 */
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --radius: 14px;
  /* 液态玻璃(Liquid Glass): 卡片/控件半透明玻璃底 + 白亮边 + 顶部内高光;
     页面背景彩色光斑透过玻璃底形成折射感。真 blur 只给侧栏/弹窗/Toast(控制渲染开销) */
  --glass-card: rgba(255, 255, 255, .82);
  --glass-edge: rgba(255, 255, 255, .65);
  --glass-hi: rgba(255, 255, 255, .80);
  --bg-glow-1: rgba(79, 70, 229, .10);
  --bg-glow-2: rgba(22, 163, 74, .09);
  --bg-glow-3: rgba(37, 99, 235, .08);
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(52% 42% at 8% 4%, var(--bg-glow-1) 0%, transparent 62%),
    radial-gradient(46% 40% at 94% 12%, var(--bg-glow-2) 0%, transparent 60%),
    radial-gradient(60% 46% at 50% 108%, var(--bg-glow-3) 0%, transparent 65%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background-color .2s, color .2s;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; /* 禁止手机端自动放大字号, 保持最适阅读大小 */
}

/* ============ 主题: 米黄 ============ */
body[data-theme="beige"] {
  --bg: #f1e9d2;
  --card: #faf6e9;
  --surface: #fdfaf0;
  --surface-2: #f3edda;
  --line-2: #eae2c8;
  --border: #ddd0ac;
  --text: #43382a;
  --text-secondary: #6b5d49;
  --muted: #a08f70;
  --primary-light: #f0e7c8;
  --primary-border: #d6c49a;
  --glass-card: rgba(250, 246, 233, .82);
  --glass-edge: rgba(255, 252, 242, .72);
  --bg-glow-1: rgba(214, 158, 74, .14);
  --bg-glow-2: rgba(176, 128, 58, .10);
  --bg-glow-3: rgba(214, 158, 74, .10);
  --shadow: 0 1px 3px rgba(97, 78, 40, .08), 0 1px 2px rgba(97, 78, 40, .05);
  --shadow-lg: 0 10px 30px rgba(97, 78, 40, .16);
}

/* ============ 主题: 绿色(护眼) ============ */
body[data-theme="green"] {
  --bg: #c7e6c9;
  --card: #ddefdd;
  --surface: #e8f4e8;
  --surface-2: #d3e9d4;
  --line-2: #c2dec3;
  --border: #a8cfaa;
  --text: #1f3d24;
  --text-secondary: #33573a;
  --muted: #6d9073;
  --primary-light: #d5ecd6;
  --primary-border: #9cc79f;
  --glass-card: rgba(221, 239, 221, .80);
  --glass-edge: rgba(255, 255, 255, .60);
  --bg-glow-1: rgba(46, 125, 50, .10);
  --bg-glow-2: rgba(22, 101, 52, .08);
  --bg-glow-3: rgba(46, 125, 50, .09);
  --shadow: 0 1px 3px rgba(31, 61, 36, .08), 0 1px 2px rgba(31, 61, 36, .05);
  --shadow-lg: 0 10px 30px rgba(31, 61, 36, .16);
}

/* ============ 主题: 黑色(夜间) ============ */
body[data-theme="dark"] {
  --bg: #12141a;
  --card: #1a1d25;
  --surface: #232732;
  --surface-2: #20242e;
  --line-2: #262b36;
  --border: #2e3440;
  --text: #e7eaf0;
  --text-secondary: #b3bac6;
  --muted: #7e8695;
  --primary: #818cf8;
  --primary-hover: #98a0fa;
  --primary-light: #262b40;
  --primary-border: #3e4560;
  --green: #4ade80;
  --green-light: #122a1c;
  --green-border: #1f4d31;
  --red: #f87171;
  --red-light: #2e1619;
  --red-border: #5b262b;
  --orange: #fbbf24;
  --orange-light: #2e2410;
  --blue: #60a5fa;
  --blue-light: #152740;
  --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
  --glass-card: rgba(26, 29, 37, .66);
  --glass-edge: rgba(255, 255, 255, .16);
  --glass-hi: rgba(255, 255, 255, .18);
  --bg-glow-1: rgba(99, 102, 241, .13);
  --bg-glow-2: rgba(14, 116, 144, .12);
  --bg-glow-3: rgba(22, 163, 74, .08);
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; min-height: 100dvh; } /* dvh: 平板/手机切走再回来时 100vh 因浏览器工具栏展开而不准, 用动态视口高度兜底 */
.sidebar {
  width: 216px; flex-shrink: 0;
  background: var(--glass-card);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-right: 1px solid var(--glass-edge);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh; /* dvh 兜底: 避免切回应用后侧栏高度大于可视区导致导航被裁切 */
}
.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  font-size: 18px; font-weight: 700; color: var(--primary);
}
.nav { flex: 1; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-secondary); cursor: pointer;
  font-weight: 500; text-decoration: none;
  position: relative; user-select: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-badge {
  position: absolute; right: 10px;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px; line-height: 18px;
  border-radius: 9px; text-align: center; padding: 0 5px;
}
.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12px;
}
.main { flex: 1; padding: 28px 32px; max-width: 1100px; margin: 0 auto; min-width: 0; }

/* ============ 通用元素 ============ */
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--text-secondary); margin-bottom: 22px; font-size: 13px; }
.card {
  background: var(--glass-card);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow); /* 顶部内高光模拟玻璃厚度 */
  padding: 20px; margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px; border: 1px solid var(--glass-edge);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s; background: var(--surface); color: var(--text);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 1px 2px rgba(15, 23, 42, .08);
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary-border); color: var(--primary); transform: translateY(-1px); box-shadow: inset 0 1px 0 var(--glass-hi), 0 4px 10px rgba(15, 23, 42, .12); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled:hover, .btn:disabled:active { transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  color: #fff; border-color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 6px rgba(79, 70, 229, .35);
}
.btn-primary:hover {
  background: var(--primary-hover); color: #fff; border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 14px rgba(79, 70, 229, .42);
}
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red-border); background: var(--red-light); color: var(--red); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn svg { width: 15px; height: 15px; }

input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
textarea { resize: vertical; min-height: 72px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span.lab, .lab {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-single { background: var(--blue-light); color: var(--blue); }
.badge-multi { background: #faf5ff; color: #9333ea; }
.badge-judge { background: var(--orange-light); color: var(--orange); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gray { background: var(--surface-2); color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-essay { background: #fef3c7; color: #b45309; }
/* 考点等级: 掌握/熟悉/了解 */
.badge-lv3 { background: var(--red-light); color: var(--red); }
.badge-lv2 { background: var(--blue-light); color: var(--blue); }
.badge-lv1 { background: var(--surface-2); color: var(--text-secondary); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 500;
}

/* ============ 题型勾选组 ============ */
.type-chks { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chks label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; user-select: none;
}
.type-chks label.on { border-color: var(--primary-border); background: var(--primary-light); color: var(--primary); }
.type-chks input { margin: 0; cursor: pointer; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .4px;
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.td-stem { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.empty p { margin-bottom: 16px; }

/* ============ 统计卡片 ============ */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--glass-card);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
  padding: 16px 14px; min-width: 0;
}
.stat-card .num { font-size: 24px; font-weight: 700; line-height: 1.2; word-break: break-all; }
.stat-card .lab2 { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.stat-card.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.10); }
.stat-card.primary .num { color: var(--primary); }
.stat-card.red .num { color: var(--red); }
.stat-card.green .num { color: var(--green); }
.stat-card.orange .num { color: var(--orange); }

/* ============ 题库列表 ============ */
.banks-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.bank-item {
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.bank-item:hover { background: var(--bg); }
.bank-item.active { background: var(--primary-light); border-color: var(--primary-border); }
.bank-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-item.active .name { color: var(--primary); }
.bank-item .cnt { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.bank-actions { display: flex; gap: 2px; }
.icon-btn {
  border: none; background: none; cursor: pointer; padding: 4px;
  border-radius: 6px; color: var(--muted); line-height: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-light); color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; }

/* ============ 收藏夹 ============ */
.icon-btn.fav-star { color: #b6c2d2; }
.icon-btn.fav-star:hover { background: rgba(245,158,11,.12); color: #f59e0b; }
.icon-btn.fav-star.active { color: #f59e0b; }
body[data-theme="dark"] .icon-btn.fav-star { color: #4b5563; }
body[data-theme="dark"] .icon-btn.fav-star.active { color: #fbbf24; }
.fav-btn { font-weight: 600; }
.fav-btn.active { color: #b45309; border-color: #f0c26b; background: rgba(245,158,11,.10); }
body[data-theme="dark"] .fav-btn.active { color: #fbbf24; border-color: #92610c; background: rgba(251,191,36,.10); }
.chip-kp { background: rgba(79,70,229,.08); color: #4f46e5; border: 1px solid rgba(79,70,229,.18); font-weight: 600; }
body[data-theme="dark"] .chip-kp { background: rgba(129,140,248,.12); color: #a5b4fc; border-color: rgba(129,140,248,.3); }

/* ============ 答题 ============ */
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; cursor: pointer;
  transition: all .12s; background: var(--surface); user-select: none;
}
.opt:hover { border-color: var(--primary-border); }
.opt.selected { border-color: var(--primary); background: var(--primary-light); }
.opt.correct { border-color: var(--green); background: var(--green-light); }
.opt.wrong { border-color: var(--red); background: var(--red-light); }
.opt.disabled { cursor: default; pointer-events: none; }
.opt-key {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.opt.selected .opt-key { background: var(--primary); color: #fff; }
.opt.correct .opt-key { background: var(--green); color: #fff; }
.opt.wrong .opt-key { background: var(--red); color: #fff; }

.progress-wrap { margin-bottom: 18px; }
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }

.explain-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-top: 14px;
}
.explain-box .exp-title { font-weight: 600; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.explain-box.correct { border-color: var(--green-border); background: var(--green-light); }
.explain-box.incorrect { border-color: var(--red-border); background: var(--red-light); }

/* ============ 主观题 AI 批改 ============ */
.grade-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.grade-score { font-size: 22px; font-weight: 800; }
.grade-score.pass { color: var(--green); }
.grade-score.fail { color: var(--red); }
.grade-total { font-size: 14px; color: var(--text-secondary); }
.grade-point {
  display: flex; gap: 8px; padding: 7px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 13px; line-height: 1.65; align-items: flex-start;
}
.grade-point:last-child { border-bottom: none; }
.grade-point .gp-mark { flex-shrink: 0; font-weight: 700; }
.grade-point.hit .gp-mark { color: var(--green); }
.grade-point.miss .gp-mark { color: var(--red); }
.grade-point.miss .gp-point { color: var(--red); }
.grade-comment { margin-top: 8px; font-size: 13px; color: var(--text-secondary); }
.answer-ref {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--card); font-size: 13px; line-height: 1.7;
}

.result-hero { text-align: center; padding: 30px 0 20px; }
.result-hero .pct { font-size: 52px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.result-hero .pct.good { color: var(--green); }
.result-hero .pct.bad { color: var(--red); }
.result-hero .desc { color: var(--text-secondary); margin-top: 6px; }

/* ============ 复习计划 ============ */
.kp-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 10px; background: var(--surface);
}
.kp-item.due { border-color: var(--red-border); background: var(--surface); }
.kp-item > input[type="checkbox"] { width: 16px; height: 16px; flex: none; cursor: pointer; margin-top: 2px; }
.chip-due { background: var(--red-light); color: var(--red); border: 1px solid var(--red-border); font-weight: 600; }
.kp-name { font-weight: 600; font-size: 14px; }
.pips { display: flex; gap: 4px; }
.pip { width: 14px; height: 6px; border-radius: 3px; background: var(--border); }
.pip.on { background: var(--primary); }
.pip.grad { background: var(--green); }
.curve-svg { width: 100%; height: auto; display: block; }

/* ============ AI 出题 ============ */
.ai-preview-item {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
}
.ai-preview-item .stem { font-weight: 600; margin-bottom: 4px; }
.ai-preview-item .meta { color: var(--text-secondary); font-size: 13px; }
.loading-dots::after {
  content: ""; animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ============ 模态框 ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 20px; z-index: 100; overflow-y: auto;
  animation: fadeIn .15s;
}
.modal {
  background: var(--glass-card);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-lg);
  width: 100%; max-width: 640px; padding: 22px 24px;
  animation: slideUp .18s ease-out;
}
.modal.modal-sm { max-width: 420px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-head h3 { font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } }

/* ============ Toast ============ */
#toast-root {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 10px 20px; border-radius: 12px; color: #fff; font-size: 14px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), var(--shadow-lg);
  animation: slideUp .2s;
}
.toast-success { background: rgba(22, 163, 74, .88); }
.toast-error { background: rgba(220, 38, 38, .88); }
.toast-info { background: rgba(51, 65, 85, .88); }

/* ============ 响应式: 平板/手机 ============ */
@media (max-width: 860px) {
  /* 防横向溢出兜底 */
  body { overflow-x: hidden; }
  img, svg { max-width: 100%; }

  /* 字号整体放大一档: 手机上免手动缩放即可舒适阅读 */
  body { font-size: 15px; }
  input, textarea, select { font-size: 16px; } /* ≥16px 兼防 iOS 聚焦自动放大 */
  .btn { font-size: 14.5px; }

  /* 顶栏: logo 一行 + 导航一行(横向滑动) */
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: column; align-items: stretch; }
  .logo { padding: 12px 16px 4px; font-size: 16px; }
  .nav {
    flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 6px 10px 10px; gap: 4px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { padding: 9px 14px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
  .nav-badge { position: static; margin-left: 2px; min-width: 17px; height: 17px; line-height: 17px; font-size: 11px; }
  /* 用户信息条: 手机上显示为导航下方一行(紧凑化: 头像/用户名/退出登录互不重叠不溢出) */
  .sidebar-footer { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 0 12px 8px; border-top: none; max-width: 100%; min-width: 0; }
  .sidebar-footer > div:not(.user-chip) { display: none; } /* 隐藏静态提示文案, 登录后仅保留用户条 */
  .sidebar-footer .user-chip { flex: 1 1 0; margin-bottom: 0; padding: 4px 8px; gap: 6px; min-width: 0; overflow: hidden; }
  .sidebar-footer .user-chip .user-avatar { width: 24px; height: 24px; font-size: 12px; } /* 头像放大回正常尺寸 */
  .sidebar-footer .user-chip .user-name { flex: 1 1 0; min-width: 0; font-size: 13px; } /* 长用户名省略号收缩, 避免把退出登录按钮挤出边框 */
  .sidebar-footer .user-chip .vip-badge { font-size: 10px; padding: 0 6px; }
  /* 退出登录手机端样式见文件末尾「手机端补丁」块(此处靠前会被下方桌面规则覆盖) */

  /* 主区与卡片收紧 */
  .main { padding: 14px 14px 48px; width: 100%; }
  .page-title { font-size: 21px; }
  .page-sub { margin-bottom: 14px; }
  .card { padding: 14px; }
  .card-title { flex-wrap: wrap; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .banks-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .row { gap: 8px; }

  /* 章节页签: 横向滑动不换行 */
  .grp-tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 8px; scrollbar-width: none;
  }
  .grp-tabs::-webkit-scrollbar { display: none; }
  .grp-tab { flex-shrink: 0; white-space: nowrap; }
  .grp-tab.grp-exam { margin-left: 0; }

  /* 表格卡片化: 每行变一张卡片, td 前显示 data-label 列名 */
  table.tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl thead { display: none; }
  .tbl tr {
    position: relative;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); padding: 10px 12px; margin-bottom: 10px;
  }
  .tbl tbody tr:hover { background: var(--surface); }
  .tbl td { border-bottom: none; padding: 5px 2px; display: flex; align-items: center; gap: 8px; }
  .tbl td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0; min-width: 4em;
    font-size: 13px; font-weight: 600; color: var(--muted);
  }
  /* 长文本列(题干)顶部对齐列名 */
  .tbl td.td-stem { align-items: flex-start; }
  .tbl td.td-stem::before { line-height: 1.6; }
  /* 无列名首列(勾选框)挪到卡片右上角; 有列名的记录表首列与空状态行保持文档流 */
  .tbl td:first-child:not([data-label]):not([colspan]) { position: absolute; top: 10px; right: 12px; padding: 2px; }
  .td-stem { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; font-weight: 600; }

  /* 收藏夹筛选下拉: 窄屏均分铺满 */
  .row > select.fav-filter { flex: 1; min-width: 0 !important; }
  /* 各视图筛选行(select 挂在 .row 下)统一去掉桌面最小宽度, 避免并排溢出 */
  .row > select { min-width: 0 !important; }

  /* 复习计划条目允许换行 */
  .kp-item { flex-wrap: wrap; gap: 8px 10px; padding: 12px; }

  /* 弹窗与提示 */
  .modal-overlay { padding: 3vh 12px; }
  .modal { padding: 16px; max-width: 100%; }
  .modal-foot { flex-wrap: wrap; }
  #toast-root { bottom: 18px; max-width: 92vw; }
  .toast { max-width: 92vw; font-size: 13px; }

  /* 学习时长图表 */
  .study-chart { gap: 5px; }
  .result-hero .pct { font-size: 42px; }
  .explain-box { padding: 12px; }
}

/* ============ 响应式: 小屏手机(整体放大字号与触控目标, 免手动缩放) ============ */
@media (max-width: 480px) {
  body { font-size: 15px; }
  input, textarea, select { font-size: 16px; } /* ≥16px 兼防 iOS 聚焦自动放大 */
  .main { padding: 12px 10px 48px; }
  .page-title { font-size: 21px; }
  .page-sub { font-size: 13.5px; }
  .card { padding: 13px; border-radius: 12px; }
  .card-title { font-size: 15.5px; }
  .stats-grid { gap: 8px; }
  .stat-card { padding: 13px 11px; }
  .stat-card .num { font-size: 22px; }
  .stat-card .lab2 { font-size: 13px; }
  .btn { padding: 9px 14px; font-size: 14.5px; }
  .btn-sm { padding: 6px 11px; font-size: 13.5px; }
  .badge, .chip { font-size: 12.5px; }
  .grp-tab { font-size: 13.5px; padding: 6px 15px; }
  .modal-overlay { padding: 2vh 8px; }
  .opt { padding: 12px 14px; }
  .tbl tr { padding: 10px 12px; }
  .tbl td { padding: 6px 2px; }
  .toast { font-size: 13.5px; }
}

/* ============ 登录/注册墙 ============ */
#auth-root { display: none; }
#auth-root.visible {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  padding: 20px; overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(15,23,42,.08));
  padding: 30px 28px;
}
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-logo { color: var(--primary); margin-bottom: 8px; }
.auth-head h1 { font-size: 20px; margin-bottom: 4px; }
.auth-head p { font-size: 13px; }
.auth-tabs {
  display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 18px;
}
.auth-tab {
  flex: 1; padding: 8px 0; border: none; background: transparent; border-radius: 8px;
  font-size: 14px; cursor: pointer; color: var(--muted); font-family: inherit;
}
.auth-tab.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.auth-card .field { display: block; margin-bottom: 12px; }
.auth-card .field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.auth-err { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.auth-submit { width: 100%; padding: 11px 0; font-size: 15px; }
.auth-tip { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.6; }

/* 侧栏用户信息 */
.sidebar-footer .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: var(--surface-2); margin-bottom: 8px;
}
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vip-badge {
  flex-shrink: 0; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: #fef3c7; color: #b45309; font-weight: 600;
}
.btn-logout {
  width: 100%; padding: 7px 0; border: 1px solid var(--border); border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit;
}
.btn-logout:hover { color: var(--red); border-color: var(--red-border); background: var(--red-light); }
.btn-logout .lo-ic { display: none; }

/* 出题要求历史条目: 文本按钮 + 右侧 × 删除 */
.req-his-item { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.req-his-item .btn { border: none; border-radius: 0; }
.req-his-del { border: none; background: transparent; color: #94a3b8; font-size: 14px; line-height: 1; padding: 0 8px; cursor: pointer; font-family: inherit; }
.req-his-del:hover { color: var(--red); background: var(--red-light); }

/* ============ 章节页签(题库二级分类) ============ */
.grp-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2);
}
.grp-tab {
  padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); font-size: 13px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.grp-tab:hover { border-color: var(--primary-border); color: var(--primary); }
.grp-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.grp-tab.grp-exam { margin-left: auto; color: var(--primary); border-color: var(--primary-border); background: var(--primary-light); font-weight: 600; }
.grp-tab.grp-exam:hover { background: var(--primary); color: #fff; }

/* ============ 每日学习时长图表 ============ */
.study-chart {
  position: relative; /* 学习时长点击气泡的定位容器 */
  display: flex; align-items: flex-end; gap: 10px;
  height: 150px; padding: 6px 4px 0;
}
/* 点击某天柱子后在图上方短暂显示的时长气泡, 约 2 秒后自动淡出 */
.study-tip {
  position: absolute; transform: translate(-50%, -100%);
  background: rgba(15, 23, 42, .92); color: #fff;
  padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5;
  white-space: nowrap; pointer-events: none; z-index: 5;
  opacity: 0; transition: opacity .25s;
}
.study-tip.show { opacity: 1; }
.study-tip .t2 { color: #cbd5e1; }
.study-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.study-bars {
  flex: 1; width: 100%; max-width: 46px; display: flex; align-items: flex-end;
  justify-content: center; gap: 4px;
}
.study-bars .bar { width: 12px; min-height: 2px; border-radius: 4px 4px 0 0; transition: height .3s; }
.study-bars .bar.practice { background: var(--primary); }
.study-bars .bar.review { background: var(--orange); }
.study-col.today .study-bars { background: var(--surface-2); border-radius: 8px; }
.study-day { font-size: 12px; color: var(--muted); }
.study-col.today .study-day { color: var(--primary); font-weight: 600; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend-dot.practice { background: var(--primary); }
.legend-dot.review { background: var(--orange); }

/* ============ 仪表盘: 今日待复习滚动列表 ============ */
.due-list { max-height: 336px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 可点击文本(出题记录 查看/进入题库) */
.link { color: var(--primary); text-decoration: underline; cursor: pointer; }
tr[style*='pointer'] td { border-bottom: 1px solid transparent; }

/* 复习计划: 遗忘曲线横向滚动容器(宽图左右拖动查看) */
.curve-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.curve-scroll svg { min-width: 100%; }

/* 曲线图滑轨: 拖动控制宽图横向滚动(手机/桌面通用, 与图双向联动) */
.curve-range {
  flex: 1 1 auto; min-width: 120px; height: 26px; margin: 0; padding: 0;
  border: none; background: transparent; accent-color: var(--primary); cursor: pointer;
}
.curve-range::-webkit-slider-thumb { width: 16px; height: 16px; } /* 加大滑块便于手指拖动 */

/* 拖动排序: 拖到目标上方时的高亮 */
.drag-over { outline: 2px dashed var(--primary); outline-offset: 2px; }
.bank-item[draggable="true"] { cursor: grab; }
.bank-item[draggable="true"]:active { cursor: grabbing; }

/* 错题本: 「斩」按钮标红; 错误次数徽章 */
.btn-slay { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; font-weight: 700; }
.btn-slay:hover { filter: brightness(1.08); }
.wrong-times { font-weight: 700; }

/* AI 出题页: 资料颜色标注规则说明条 */
.ai-grade-note {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.7;
  margin: 4px 0 12px;
}

/* ============ 背书模式 ============ */
.recite-gap {
  display: inline-block; min-width: 96px; height: 1em;
  border-bottom: 2px solid var(--primary);
  margin: 0 6px; vertical-align: baseline;
}
#recite-input { margin-top: 4px; }

/* ============ ICP 备案号(登录页 + 侧栏底部) ============ */
.icp-beian {
  display: block; text-align: center;
  font-size: 11px; color: var(--muted); text-decoration: none;
  margin-top: 8px; letter-spacing: .3px;
}
.auth-card .icp-beian { margin-top: 14px; }
.icp-beian:hover { color: var(--text-secondary); text-decoration: underline; }

/* ============ 手机端补丁(置于文件末尾, 确保覆盖上方同名桌面规则) ============ */
@media (max-width: 860px) {
  /* 遗忘曲线宽图保持原始尺寸横向滚动, 不被上面的 svg max-width:100% 压缩(压缩会导致整图缩小文字不可读) */
  .curve-scroll svg { max-width: none; }
  /* 退出登录收为小图标按钮(覆盖桌面 width:100%/padding:7px 0/.lo-ic 隐藏): 不再挤压昵称与会员徽章 */
  .btn-logout { width: auto; flex: 0 0 auto; padding: 5px; border-radius: 8px; line-height: 0; }
  .btn-logout .lo-tx { display: none; }
  .btn-logout .lo-ic { display: inline-flex; width: 13px; height: 13px; }
  .sidebar-footer .user-chip .vip-badge { white-space: nowrap; flex: 0 0 auto; } /* 会员徽章完整显示不被收缩 */
}

