:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e6eaf2;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --green: #16a34a;
  --green-soft: #e9f9ef;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --teal: #0d9488;
  --teal-soft: #e5f7f5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 40px rgba(16, 24, 40, .12);
  --sidebar-width: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 14px; }

/* ============ 登录页 ============ */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #eef0ff 0%, transparent 50%),
    radial-gradient(900px 500px at 110% 110%, #e5f7f5 0%, transparent 50%),
    var(--bg);
}
.login-card {
  width: 420px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand h1 { font-size: 20px; font-weight: 700; }
.login-brand p { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* 联系方式区块 */
.login-contact {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px dashed var(--border);
}
.login-slogan {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.contact-grid {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.contact-text { flex: 1; min-width: 0; }
.contact-item {
  font-size: 13px;
  color: var(--text-1);
  margin-bottom: 6px;
}
.contact-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  margin-right: 6px;
}
.contact-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}
.contact-perk {
  font-size: 12px;
  color: var(--text-2);
  margin: 4px 0;
  line-height: 1.5;
}
.contact-perk b { color: var(--text-1); }
.contact-cta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--amber);
  font-weight: 600;
  text-align: center;
  padding: 6px 8px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 8px;
}
.contact-qr {
  text-align: center;
  flex-shrink: 0;
}
.contact-qr img {
  width: 110px;
  height: 110px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.contact-qr-label {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark.small { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }

.role-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 24px;
}
.role-tab {
  border: none; background: transparent; padding: 10px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text-2); transition: all .15s;
}
.role-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--surface-2); padding: 4px; border-radius: 10px;
}
.auth-tab {
  border: none; background: transparent; padding: 7px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-2); transition: all .15s;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

.login-panel { display: flex; flex-direction: column; gap: 14px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.student-picker {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; max-height: 220px; overflow: auto;
}
.student-opt {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 10px 8px; text-align: center; cursor: pointer; transition: all .15s;
}
.student-opt .s-name { font-weight: 600; }
.student-opt .s-class { font-size: 11px; color: var(--text-3); }
.student-opt:hover { border-color: var(--primary-2); }
.student-opt.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { font-size: 12px; color: var(--text-3); }

.btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  font-size: 15px; font-weight: 600; transition: opacity .15s, transform .05s;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  padding: 8px 14px; border-radius: 9px; font-size: 13px;
}
.btn-ghost:hover { color: var(--red); border-color: #f3c4c4; }

.btn-danger {
  border: 1px solid #f3c4c4; background: #fff; color: var(--red);
  cursor: pointer; border-radius: 6px; transition: all .15s;
}
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }

.login-error {
  margin-top: 12px; background: var(--red-soft); color: var(--red);
  padding: 10px 12px; border-radius: 9px; font-size: 13px;
}

/* ============ 应用布局 ============ */
.app-view { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  font-weight: 700; font-size: 16px;
}
.nav-menu { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s;
  border: none; background: transparent; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ico { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.nav-badge.hidden { display: none; }
.nav-group { font-size: 11px; color: var(--text-3); padding: 14px 12px 4px; letter-spacing: .5px; }

.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-sub { font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; }
.page-content { padding: 28px 32px; max-width: 1200px; margin: 0 auto; }

/* ============ 通用组件 ============ */
.page-head { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-desc { color: var(--text-2); font-size: 13px; margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--text-3); }
.stat-trend { font-size: 12px; margin-top: 2px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-topic { background: var(--primary-soft); color: var(--primary); }
.badge-source-真题 { background: var(--amber-soft); color: var(--amber); }
.badge-source-模拟 { background: var(--teal-soft); color: var(--teal); }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-err { background: var(--red-soft); color: var(--red); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); outline: none;
}

/* 学生搜索下拉（错题池筛选） */
.student-search { position: relative; }
.student-search .select { width: 150px; }
.student-search-list {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 200; width: 220px; max-height: 300px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px;
}
.student-search-list .ss-item {
  padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.student-search-list .ss-item:hover { background: var(--surface-2); }
.student-search-list .ss-class { color: var(--text-3); font-size: 11px; }
.student-search-list .ss-empty { padding: 10px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 错题池分页控件 */
.pool-pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 4px 4px; }
.pool-pager .btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.pool-page-info { font-size: 13px; color: var(--text-2); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl th { background: var(--surface-2); color: var(--text-2); font-weight: 600; white-space: nowrap; font-size: 12px; }
.tbl tbody tr:hover { background: var(--surface-2); }
/* 学生管理表格：手机端隐藏非核心列，只留姓名/免费额度/最近做题/活跃天数/有效期/操作 */
@media (max-width: 720px) {
  .tbl .m-hide { display: none; }
}
.word-cell {
  font-weight: 700; color: #16a34a;
  font-family: "SF Mono", ui-monospace, monospace;
  background: var(--green-soft);
  padding: 1px 8px; border-radius: 6px;
  margin: 0 3px 0 1px;
  box-shadow: 0 0 0 1px #b7e6c5;
}
.sentence-cell { color: var(--text-2); max-width: 420px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* 刷题卡 */
.practice-card { max-width: 1000px; margin: 0 auto; }
.practice-meta { margin-bottom: 10px; }
.pm-line1 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.pm-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.pm-line2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.pm-stat { font-size: 12px; color: var(--text-2); }
.pm-progress { margin-left: auto; font-weight: 600; }
.practice-timer { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.practice-sentence {
  font-size: 18px; line-height: 1.75; padding: 16px; background: var(--surface-2);
  border-radius: 12px; margin-bottom: 12px;
}
/* 正文可点击词：悬停高亮，提示可点词查义收藏 */
.clickable-word {
  cursor: pointer;
  border-bottom: 1px dotted rgba(37, 99, 235, .4);
  transition: background .12s, color .12s;
}
.clickable-word:hover {
  background: #dbeafe;
  color: #1e40af;
  border-radius: 3px;
}
/* 划词 AI 解析气泡 */
.ai-bubble {
  position: fixed;
  z-index: 200;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  animation: aiBubbleIn .12s ease;
  user-select: none;
}
.ai-bubble:hover { transform: translateY(-1px); }
@keyframes aiBubbleIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
/* AI 语境解析结果区块 */
.ai-sect { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ai-sect:last-child { border-bottom: none; }
.ai-sect-label { font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
.blank-word {
  display: inline-block; min-width: 110px; border-bottom: 2px solid var(--primary);
  padding: 0 4px; color: var(--primary); font-weight: 600; text-align: center;
}

/* 多空段落：内联输入框 */
.blank-inline { display: inline-flex; align-items: baseline; gap: 2px; margin: 0 2px; }
.blank-hint { color: var(--primary); font-weight: 700; font-family: "SF Mono", ui-monospace, monospace; }
/* 每个下划线 = 一个单字符输入格，placeholder 显示 _，输入字母即覆盖 */
.blank-chars { display: inline-flex; gap: 3px; align-items: baseline; }
.blank-char {
  width: 1.25ch;
  border: none;
  border-bottom: 1.5px solid var(--primary);
  background: transparent;
  text-align: center;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.5;
  padding: 0;
  color: var(--text);
  caret-color: var(--primary);
  transition: background .12s, color .12s;
}
.blank-char.filled {
  /* 填上字母后：浅灰底色块（学用户截图 population 样式） */
  background: #e5e7eb;
  color: #111827;
  font-weight: 700;
  border-radius: 3px;
  border-bottom-color: #6b7280;
}
/* 整词填完：hint + 所有格子合并成一个高亮色块（更强提示） */
.blank-inline.word-filled {
  background: #dbeafe;           /* 浅蓝，与正确答案的浅灰 pill 区分 */
  border-radius: 6px;
  padding: 2px 4px;
  margin: 0 3px;
  box-shadow: inset 0 0 0 1px #93c5fd;
}
.blank-inline.word-filled .blank-hint { color: #1e40af; }
.blank-inline.word-filled .blank-char.filled {
  background: transparent;
  border-bottom-color: #1e40af;
}
.blank-char::placeholder {
  color: var(--primary);
  font-weight: 700;
  opacity: 1;
}
.blank-char:focus {
  border-bottom-color: var(--primary-2);
  background: var(--primary-soft);
  outline: none;
}
.blank-char.correct { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.blank-char.wrong { color: var(--red); border-bottom-color: var(--red); font-weight: 700; }

/* 提交后：把输入框替换成「答案色块 pill」（学用户截图里的 population 样式）
   - 答对：浅灰底色块
   - 答错：学生答案（红底+删除线）+ 箭头 + 正确（绿底） */
.answer-pill-wrap {
  display: inline-flex; align-items: baseline; gap: 4px;
  margin: 0 1px;
}
.answer-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.3px;
}
.answer-pill.pill-correct {
  background: #e5e7eb;
  color: #111827;
  border: 1px solid #d1d5db;
}
.answer-pill.pill-wrong {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  text-decoration: none;
}
.answer-pill.pill-right {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #6ee7b7;
}
.answer-arrow {
  color: var(--text-3);
  font-size: 14px;
  font-weight: 400;
}
/* 右侧下划线提示（已弃用，保留类以防历史引用） */
.blank-remaining { display: none; }
.blank-inline.read .blank-word { min-width: auto; }
/* 错题重刷：已掌握的空（服务端预填）显示为绿色背景单词，表示"不必再刷" */
.blank-inline.prefilled .blank-word.prefilled-word {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
/* 只读还原原始下划线（前缀 + 空格分隔下划线，一个 _ 一个字母） */
.blank-word.spaced {
  min-width: auto; border-bottom: none; padding: 0;
  color: var(--text-3); font-weight: 400;
  font-family: "SF Mono", ui-monospace, monospace; letter-spacing: 1px;
}
.blank-dots { color: var(--text-3); }
.practice-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.practice-hint b { color: var(--primary); }
.hint-close { border: none; background: transparent; color: var(--text-3); font-size: 14px; cursor: pointer; padding: 0 4px; line-height: 1; }
.practice-input-row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.practice-input-row .input { font-size: 16px; }
/* 刷题筛选区折叠（进入做题状态后隐藏） */
.toolbar.collapsed { display: none; }
.ph-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ============ 刷题筛选页：搜索 + 筛选面板 ============ */
#searchSection { margin-bottom: 16px; }
#searchSection.collapsed { display: none; }
.search-box {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s;
}
.search-box:focus-within { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-ico { font-size: 16px; color: var(--text-3); }
.search-input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: var(--text); }
.search-input::placeholder { color: var(--text-3); }
.search-results { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.search-results.hidden { display: none; }
.search-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.search-item:hover { border-color: var(--primary-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.search-title { font-size: 14px; font-weight: 600; }
.search-meta { margin-left: auto; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.search-acc { font-size: 12px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.search-acc.acc-insufficient { color: var(--text-3); font-weight: 400; }
.search-empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }

.filter-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.filter-panel.collapsed { display: none; }
.filter-title { font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.filter-field { display: flex; flex-direction: column; gap: 6px; }
.filter-field.filter-check { justify-content: flex-end; }
.filter-label { font-size: 12px; color: var(--text-2); }
.filter-field .select { width: 100%; }
.filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.filter-search-btn { width: auto; padding: 6px 12px; font-size: 13px; }
.start-btn { width: auto; min-width: 160px; }
.filter-panel .start-btn { display: block; }

/* PC 做题态：筛选栏常驻，单行紧凑，与做题区分隔 */
.filter-panel.pc-doing { padding: 10px 14px; border-radius: 12px 12px 0 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.filter-panel.pc-doing .filter-title { display: none; }
.filter-panel.pc-doing .filter-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 0; }
.filter-panel.pc-doing .filter-field { flex-direction: row; align-items: center; gap: 6px; }
.filter-panel.pc-doing .filter-label { display: none; }
.filter-panel.pc-doing .filter-field .select { width: auto; min-width: 96px; padding: 5px 8px; font-size: 13px; }
.filter-panel.pc-doing .filter-check { gap: 5px; }
.filter-panel.pc-doing .filter-actions { margin-left: auto; }
.filter-panel.pc-doing .start-btn { min-width: auto; padding: 6px 16px; font-size: 14px; }

@media (max-width: 900px) {
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  /* 手机端：搜索 + 筛选 + 底部整行开始刷题 */
  .filter-grid { grid-template-columns: 1fr; gap: 10px; }
  .filter-panel { padding: 16px 14px; }
  .filter-actions { flex-direction: column; }
  .filter-actions .start-btn, .filter-actions .filter-search-btn { width: 100%; }
  .start-btn { width: 100%; min-width: 0; margin-top: 4px; padding: 12px; font-size: 16px; }
  .search-meta { white-space: normal; text-align: right; }
  .search-item { flex-wrap: wrap; }
}


.feedback { border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.feedback.correct { background: var(--green-soft); border: 1px solid #b7e6c5; }
.feedback.wrong { background: var(--red-soft); border: 1px solid #f3c4c4; }
.feedback .fb-title { font-weight: 700; margin-bottom: 6px; }
.feedback.correct .fb-title { color: var(--green); }
.feedback.wrong .fb-title { color: var(--red); }
.feedback .fb-line { color: var(--text-2); }
.feedback .fb-line b { color: var(--text); }

.reason-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.reason-label { font-size: 13px; color: var(--text-2); white-space: nowrap; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.pager.top-pager { margin-top: 8px; margin-bottom: 10px; justify-content: flex-start; }
.pager button { padding: 8px 16px; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .pg-info { color: var(--text-2); font-size: 13px; }

/* 推荐卡 */
.rec-loading { text-align: center; padding: 48px 16px; color: var(--text-3); font-size: 14px; }
.rec-list { display: flex; flex-direction: column; gap: 12px; }
.rec-item { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: #fff; }
.rec-item .rec-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.rec-reason { font-size: 12px; color: var(--primary); background: var(--primary-soft); padding: 2px 9px; border-radius: 999px; font-weight: 600; }

/* 图表 */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-grid .card { padding: 20px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } .stat-grid { grid-template-columns: repeat(2,1fr); } }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .bar-label { width: 120px; font-size: 13px; color: var(--text-2); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { flex: 1; height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 11px; font-weight: 600; min-width: 24px; }
.bar-row .bar-val { width: 44px; font-size: 13px; font-weight: 600; color: var(--text); }
.bar-fill.f-red { background: linear-gradient(90deg, #f87171, #ef4444); }
.bar-fill.f-teal { background: linear-gradient(90deg, #2dd4bf, #0d9488); }
.bar-fill.f-amber { background: linear-gradient(90deg, #fbbf24, #d97706); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 440px; max-width: 100%; padding: 24px; max-height: 86vh; overflow: auto; word-wrap: break-word; overflow-wrap: anywhere; }
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-actions .btn-primary { width: auto; padding: 10px 20px; }

/* 词汇卡片弹窗：手机端占满屏幕宽度的 92%，max-height 85vh 可滚动，关闭按钮固定底部 */
.vocab-modal { padding: 16px 14px 14px; }
.vocab-modal-title { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.vocab-loading { text-align: center; padding: 28px 12px; color: var(--text-3); font-size: 14px; }
.vocab-modal .vocab-card { padding: 0; background: transparent; border: none; }
.vocab-modal .ai-sect { word-wrap: break-word; }
.vocab-modal .ai-sect div { word-wrap: break-word; }

@media (max-width: 720px) {
  .modal { width: 92vw; max-width: 92vw; padding: 16px 14px; }
  .vocab-modal { padding: 14px 12px 12px; }
  .vocab-modal .ai-sect-label { word-break: break-all; }
}

/* PC 端：词汇卡片改用页面底部轻量「查词工具栏」（三行：词汇信息 → AI 按钮 → AI 解释），不遮挡原句 */
.word-sheet {
  position: fixed; bottom: 0; left: 232px; right: 0;  /* PC 端：避开左侧 232px 侧边栏，浮在主内容区（灰色大区域）上 */
  width: auto; box-sizing: border-box;
  padding: 20px 32px;
  border-radius: 16px 16px 0 0;
  background: var(--surface); box-shadow: 0 -8px 28px rgba(0,0,0,.14);
  z-index: 1500;
  display: flex; flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 85vh;  /* 内容多时最多到屏幕 85%，超出内部滚动；少时自动收缩 */
  animation: wsUp .25s ease-out;
  border-top: 1px solid var(--border);
}
@keyframes wsUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.word-sheet-close {
  position: absolute; top: 6px; right: 14px;
  background: transparent; border: none; font-size: 22px; color: var(--text-3);
  cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px;
  transition: background .12s, color .12s;
}
.word-sheet-close:hover { background: var(--surface-2); color: var(--text); }

/* 第一行：基础词汇信息横向排列，各区域顶部对齐 */
.ws-line1 { display: flex; gap: 20px; align-items: flex-start; flex-shrink: 0; }
.ws-cell { font-size: 13px; color: var(--text-2); word-wrap: break-word; overflow-wrap: break-word; }
.ws-word-cell { flex: 0 0 16%; min-width: 130px; }
.ws-coll-cell { flex: 0 0 20%; min-width: 130px; }
.ws-syn-cell { flex: 0 0 18%; min-width: 120px; }
.ws-ex-cell { flex: 1; min-width: 200px; }
.ws-word-line { display: flex; align-items: center; gap: 6px; }
.ws-word { font-size: 19px; font-weight: 700; color: var(--primary); }
.ws-pos { font-size: 12px; color: var(--text-3); font-style: italic; margin-top: 1px; }
.ws-meaning { font-size: 14px; color: var(--amber); font-weight: 600; margin-top: 2px; }
.ws-label { font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
.ws-val { line-height: 1.6; }
.ws-val .hl { color: var(--primary); font-weight: 700; }
.ws-ex-zh { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 第二行：AI 按钮（左对齐，轻量描边，不占整行） */
.ws-line2 { margin-top: 12px; flex-shrink: 0; }
.ws-ai-btn {
  display: inline-flex; align-items: center; gap: 6px;
  width: 240px; height: 38px; padding: 0 16px; box-sizing: border-box;
  font-size: 13px; color: var(--primary); text-align: left;
  border: 1px solid var(--primary); border-radius: 8px;
  background: var(--surface); cursor: pointer; transition: background .12s;
}
.ws-ai-btn:hover { background: var(--primary-soft); }

/* 第三行：AI 语境解释（点击后展开） */
.ws-line3 { margin-top: 10px; flex: 1; overflow: auto; flex-shrink: 0; }
.ai-context-wrap { font-size: 13px; color: var(--text-2); }
.ai-context-head { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 3px; }
.ai-context-meaning { font-weight: 600; color: var(--text); }
.ai-context-pos { color: var(--text-2); }
.ai-context-desc { line-height: 1.6; color: var(--text-2); }
.ai-context-note { font-size: 12px; color: #d46b08; margin-top: 3px; }

/* AI 语境解析三段式（本义 / 语境特指 / 此处指） */
.ai-context-para { display: flex; gap: 6px; line-height: 1.7; margin-bottom: 6px; align-items: baseline; }
.ai-context-para:last-child { margin-bottom: 0; }
.ai-para-label {
  flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--primary);
  background: var(--primary-soft); border-radius: 4px; padding: 1px 6px; line-height: 1.5;
}
.ai-para-text { color: var(--text); }

@media (max-width: 720px) {
  /* 手机端不创建 word-sheet（走 openModal），保险隐藏 */
  .word-sheet { display: none; }
}

/* 词汇学习卡片 */
.vocab-section { margin-top: 14px; }
.vocab-section-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.vocab-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; background: var(--surface-2); }
.vocab-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.vocab-word { font-size: 16px; color: var(--primary); }
.fav-btn { border: none; background: transparent; cursor: pointer; font-size: 18px; padding: 0 2px; line-height: 1; color: var(--text-3); transition: transform .1s; }
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.fav { color: #f5a623; }
.speak-btn { border: none; background: transparent; cursor: pointer; font-size: 16px; padding: 0 2px; line-height: 1; transition: transform .1s; }
.speak-btn:hover { transform: scale(1.2); }
.vocab-def { color: var(--text-2); margin-bottom: 8px; font-size: 13px; }
.vocab-label { font-size: 12px; color: var(--text-3); font-weight: 600; margin-right: 6px; }
.vocab-family, .vocab-syn { font-size: 13px; color: var(--text-2); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vocab-fam { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.vocab-examples { margin-top: 2px; }
.vocab-ex { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.vocab-ex .hl { color: var(--primary); font-weight: 700; }
.vocab-ex-zh {
  font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: 4px;
  padding: 6px 10px; background: #fef9f0; border-left: 3px solid #f59e0b; border-radius: 4px;
}
.vocab-meaning { color: var(--amber); font-size: 13px; font-weight: 600; }
.vocab-freq { margin-left: auto; font-size: 12px; color: var(--text-3); }
.vocab-coll { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.vocab-coll .vocab-label { display: inline; }
.vocab-exercise { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.vocab-ex-ex { margin-top: 2px; color: var(--text-3); font-family: "SF Mono", ui-monospace, monospace; font-size: 12px; line-height: 1.7; }

/* ============ 词汇本（升级版生词本） ============ */
.wb-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.wb-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; text-align: center; }
.wb-stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.wb-stat-label { font-size: 12px; color: var(--text-2); margin-top: 3px; }

.wb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wb-actions .spacer { flex: 1; }

.wb-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.wb-filter { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; cursor: pointer; transition: all .15s; }
.wb-filter:hover { border-color: var(--primary-2); }
.wb-filter.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }

.wb-batch-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.wb-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.wb-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.wb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wb-check { width: 16px; height: 16px; cursor: pointer; }
.wb-word { font-size: 17px; color: var(--text); font-weight: 700; }
.wb-pos { font-size: 12px; color: var(--text-3); font-style: italic; }
.wb-meaning { color: var(--amber); font-size: 13px; font-weight: 600; }
.wb-freq { margin-left: auto; font-size: 12px; color: var(--text-3); }
.wb-coll { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.wb-status { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.wb-status-item { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.wb-status-item input { cursor: pointer; }
.wb-detail-link { margin-left: auto; color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; }
.wb-detail-link:hover { text-decoration: underline; }
.wb-detail { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.wb-detail.hidden { display: none; }
.wb-syn, .wb-ex { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 6px; }
.wb-label { font-size: 12px; color: var(--text-3); font-weight: 600; margin-right: 6px; }
.wb-ex .hl { color: var(--primary); font-weight: 700; }

/* 词汇本单词状态标签（替代三个 checkbox） */
.wb-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.wb-tag { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.wb-tag-memo { background: #fff3e6; color: #d97706; }
.wb-tag-spell { background: #fde6e6; color: #c0392b; }
.wb-tag-mastered { background: #e8f5e9; color: #2e7d32; }

.wb-quick { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); cursor: pointer; padding: 2px 8px; border: 1px dashed var(--border); border-radius: 999px; }
.wb-quick input { cursor: pointer; margin: 0; }
.wb-quick input:disabled { cursor: not-allowed; }
.wb-quick:has(input:disabled) { opacity: .5; }
.wb-edit { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); align-items: center; }
.wb-edit label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.wb-edit input { cursor: pointer; }
.wb-edit input:disabled + span, .wb-edit label:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* 顶部 4 个概览块可点击快速筛选 */
.wb-stat-clickable { cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.wb-stat-clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: var(--primary-2); }

/* 记忆卡：先回忆、后释义 */
.memorize-reveal-area { margin-top: 14px; }
.memorize-reveal-btn { width: 100%; padding: 12px; font-size: 15px; }
.memorize-meaning.hidden { display: none; }
.memorize-btns.hidden { display: none; }

/* 记忆卡学习 */
.memorize-card { max-width: 620px; margin: 0 auto; }
.memorize-word { font-size: 28px; color: var(--primary); }
.memorize-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.memorize-pos { font-size: 13px; color: var(--text-3); font-style: italic; }
.memorize-meaning { font-size: 20px; font-weight: 600; color: var(--text); margin: 10px 0 14px; }
.memorize-sect { font-size: 14px; color: var(--text-2); margin-bottom: 12px; line-height: 1.7; }
.memorize-sect .wb-label { display: block; margin-bottom: 2px; }
.memorize-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.memorize-btns button { flex: 1; min-width: 100px; }

/* 拼写训练模式切换 */
.spell-mode-switch { display: flex; gap: 6px; }
.spell-mode { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; cursor: pointer; }
.spell-mode.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* 拼写训练：核心输入区独立一整行 */
.spell-meaning { font-size: 22px; font-weight: 600; color: var(--primary); margin: 14px 0 12px; text-align: center; }
.spell-context { font-size: 17px; color: var(--text); line-height: 1.9; margin: 14px 0 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; }
.spell-target { font-size: 18px; color: var(--text); margin: 0 0 12px; padding: 10px 14px; background: #fef9f0; border-left: 3px solid #f59e0b; border-radius: 8px; }
.spell-target .spell-hint-text, .spell-target .spell-blank { font-family: "SF Mono", ui-monospace, monospace; font-size: 20px; }
.spell-hint-text { color: var(--primary); font-weight: 700; font-family: "SF Mono", ui-monospace, monospace; }
.spell-blank { color: var(--text-3); font-family: "SF Mono", ui-monospace, monospace; letter-spacing: 6px; padding: 0 6px; border-bottom: 1.5px solid var(--text-3); }
.spell-hint { font-size: 13px; color: var(--text-3); margin: 6px 0 10px; }
.spell-input {
  display: block; width: 100%; box-sizing: border-box; padding: 12px 14px;
  font-size: 22px; line-height: 1.4; text-align: left;
  border: 2px solid var(--primary); border-radius: 10px; background: #fff; color: var(--text);
  outline: none; transition: border-color .12s, box-shadow .12s;
  font-family: "SF Mono", ui-monospace, monospace;
}
.spell-input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }
.spell-input:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }
.spell-actions { margin-top: 12px; }
.spell-submit { width: 100%; padding: 12px; font-size: 15px; }
.spell-row { display: flex; gap: 10px; margin-top: 10px; }
.spell-row .btn-ghost { flex: 1; padding: 10px; font-size: 13px; }
.spell-feedback-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.spell-feedback-actions .btn-ghost, .spell-feedback-actions .btn-primary { flex: 1; min-width: 110px; padding: 10px 14px; font-size: 14px; }

@media (max-width: 720px) {
  .wb-overview { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wb-stat-num { font-size: 22px; }
  .wb-actions .btn-primary { flex: 1; }
  .wb-top { gap: 6px; }
  .wb-freq { margin-left: 0; }
  .wb-status { gap: 12px; }
  .wb-detail-link { margin-left: 0; }
  /* 手机端：拼写输入框 100% 宽、字号 22px、按钮占满 */
  .spell-input { font-size: 22px; padding: 12px 12px; }
  .spell-row { flex-direction: column; gap: 8px; }
  .spell-row .btn-ghost { width: 100%; }
  .spell-feedback-actions { flex-direction: column; }
  .spell-feedback-actions .btn-ghost, .spell-feedback-actions .btn-primary { width: 100%; }
}

/* toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow-lg); z-index: 200; transition: opacity .2s;
}

/* 错因选择 chips */
.reason-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.reason-chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); font-size: 13px; cursor: pointer; transition: all .15s;
}
.reason-chip.selected { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }
.reason-chip:hover { border-color: var(--primary-2); }

/* 错因默认折叠：当前错因 + 修改按钮 */
.reason-compact { display: inline-flex; align-items: center; gap: 6px; }
.reason-current { font-size: 13px; color: var(--text); font-weight: 500; }
.reason-edit-btn {
  font-size: 12px; color: var(--primary); background: transparent;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 10px; cursor: pointer; line-height: 1.5;
  transition: background .12s, border-color .12s;
}
.reason-edit-btn:hover { background: var(--primary-soft); border-color: var(--primary); }

/* 手机端错题卡片（替换 7 列表格） */
.wrong-mobile-list { display: flex; flex-direction: column; gap: 10px; }
.wrong-m-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px;
}
.wmc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wmc-word { font-size: 16px; font-weight: 700; color: var(--primary); }
.wmc-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.wmc-answers { margin-top: 6px; font-size: 14px; line-height: 1.7; }
.wmc-line { display: flex; align-items: baseline; gap: 6px; }
.wmc-wrong { color: var(--red); }
.wmc-right { color: var(--green); font-weight: 700; }
.wmc-reason { margin-top: 6px; }
.wmc-details { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; }
.wmc-details summary { font-size: 13px; color: var(--primary); cursor: pointer; }
.wmc-sentence { margin-top: 6px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.wmc-sentence .hl { color: var(--primary); font-weight: 700; }

/* 反馈类型 chip */
.fb-type-chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); font-size: 13px; cursor: pointer; transition: all .15s;
}
.fb-type-chip.selected { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }
.fb-type-chip:hover { border-color: var(--primary-2); }

@media (max-width: 720px) {
  .app-view { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .nav-menu { flex-direction: row; }
  .sidebar-footer { display: none; }
  .page-content { padding: 20px 16px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
}

/* ============ 学习首页（功能入口页） ============ */
.home-welcome { padding: 6px 4px 18px; }
.home-greet { font-size: 24px; font-weight: 700; }
.home-sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }

.resume-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 16px;
  cursor: pointer; border-left: 3px solid var(--primary);
  transition: transform .12s, box-shadow .12s;
}
.resume-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.resume-icon { font-size: 22px; }
.resume-body { flex: 1; min-width: 0; }
.resume-label { font-size: 12px; color: var(--text-2); }
.resume-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-cta { color: var(--primary); font-weight: 600; font-size: 14px; white-space: nowrap; }

.entry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.entry-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 16px; cursor: pointer; text-align: left;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary-2); }
.entry-ico { font-size: 26px; margin-bottom: 10px; }
.entry-name { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.entry-desc { font-size: 12px; color: var(--text-2); }
.entry-desc b { color: var(--primary); }

.my-learning { padding: 16px; margin-bottom: 16px; }
.ml-title { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.ml-row { font-size: 14px; margin-bottom: 6px; }
.ml-row b { font-size: 16px; }
.ml-link { color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; }
.ml-link:hover { text-decoration: underline; }

.recent-wrong { padding: 16px; }
.rw-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rw-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--border);
}
.rw-item:first-of-type { border-top: none; }
.rw-word { font-size: 15px; font-weight: 700; min-width: 0; flex: 0 1 auto; }
.rw-count { font-size: 12px; color: var(--red); background: #fde6e6; padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto; }
.rw-go { margin-left: auto; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.rw-go:hover { text-decoration: underline; }

/* ============ 我的页 ============ */
.mine-list { display: flex; flex-direction: column; gap: 10px; }
.mine-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.mine-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.mine-ico { font-size: 22px; }
.mine-body { flex: 1; }
.mine-name { font-size: 15px; font-weight: 600; }
.mine-desc { font-size: 12px; color: var(--text-2); }
.mine-arrow { font-size: 20px; color: var(--text-3); }

/* ============ PC 首页：学习工作台 ============ */
.today-card { padding: 20px; margin-bottom: 16px; }
.today-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.today-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 12px;
  background: var(--surface-2); border-radius: 12px; text-align: center;
}
.today-num { font-size: 30px; font-weight: 700; line-height: 1.1; }
.today-label { font-size: 13px; color: var(--text-2); }
.today-btn { width: auto; margin-top: 8px; padding: 5px 14px; font-size: 13px; }
.today-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.today-actions .btn-primary, .today-actions .btn-ghost { width: auto; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.recent-wrong, .recent-practice { padding: 18px; }
.dash-sub { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 10px 0 8px; }
.freq-words { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.freq-word {
  padding: 5px 12px; background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s, transform .12s;
}
.freq-word b { font-weight: 700; }
.freq-word:hover { background: #e0e5ff; transform: translateY(-1px); }

/* 错题本首页：紧凑总结页（非数据表格页） */
.wb-page-title { font-size: 26px; }
.wb-rec-card { padding: 18px 20px; margin-bottom: 22px; }
.wb-all-card { padding: 14px 20px; }
.wb-card-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }

/* 反复错词行：单词/次数/按钮同一行，行高 52-60px */
.freq-word-row { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 2px; border-top: 1px solid var(--border); }
.freq-word-row:first-of-type { border-top: none; }
.freq-word-word { font-size: 18px; font-weight: 600; color: var(--text); min-width: 0; }
.freq-word-row .rw-count { font-size: 14px; flex: 0 0 auto; }
.freq-word-actions { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }

/* 手机端：反复错词行两行堆叠（单词独占一行，避免被按钮压缩截断） */
@media (max-width: 720px) {
  .freq-word-row { flex-wrap: wrap; height: auto; padding: 8px 2px; gap: 4px 10px; }
  .freq-word-word { flex: 1 1 100%; font-size: 17px; }
  .freq-word-actions { margin-left: auto; }
}

/* 小按钮：高度 32-36px，宽度自适应文字，14px */
.wb-btn {
  height: 32px; line-height: 30px; padding: 0 14px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--primary); background: transparent;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.wb-btn:hover { background: var(--primary-soft); border-color: var(--primary); }

/* 高频错因：紧凑小卡片，一行 3-4 个 */
.freq-reason-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.freq-reason-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.freq-reason-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.freq-reason-name { font-size: 14px; font-weight: 600; color: var(--text); }
.freq-reason-count { font-size: 14px; font-weight: 700; color: var(--primary); }

.unjudged-note { margin-top: 12px; font-size: 13px; color: var(--text-3); border-top: 1px dashed var(--border); padding-top: 10px; }
.rec-more { margin-top: 6px; font-size: 14px; color: var(--primary); font-weight: 600; cursor: pointer; text-align: center; padding: 8px; }
.rec-more:hover { text-decoration: underline; }

.rp-item { padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.rp-item:first-of-type { border-top: none; }
.rp-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-title { font-size: 14px; font-weight: 600; }
.rp-acc { margin-left: auto; font-size: 13px; font-weight: 600; }
.rp-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ============ 底部导航栏 ============ */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border: none; background: transparent; color: var(--text-2);
  font-size: 11px; cursor: pointer;
}
.bottom-nav-item .bni-ico { font-size: 20px; line-height: 1; }
.bottom-nav-item.active { color: var(--primary); font-weight: 600; }

@media (max-width: 720px) {
  .app-view { flex-direction: column; }
  .sidebar { display: none; }
  .page-content { padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav { display: flex; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }

  /* 老师端：侧边栏改为顶部横向滚动导航条，不隐藏（手机端也能切换所有管理页） */
  body.role-teacher .sidebar {
    display: flex;
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; overflow-x: auto;
    flex-shrink: 0;
  }
  body.role-teacher .sidebar-brand { display: none; }
  body.role-teacher .nav-menu { flex-direction: row; overflow-x: auto; padding: 8px 10px; gap: 6px; }
  body.role-teacher .nav-group { display: none; }
  body.role-teacher .nav-item { white-space: nowrap; flex-shrink: 0; padding: 7px 12px; }
  body.role-teacher .sidebar-footer { display: none; }
  body.role-teacher .bottom-nav { display: none; }
  body.role-teacher .page-content { padding: 14px 12px; }


  /* 刷题正文：手机端提高信息密度 */
  .practice-card { max-width: none; }
  .practice-meta { margin-bottom: 8px; }
  .pm-line1 { gap: 6px; margin-bottom: 2px; }
  .pm-line2 { gap: 6px; }
  .pm-title { font-size: 13px; }
  .practice-sentence {
    font-size: 15px;        /* 18px × 0.85，缩小约 15% */
    line-height: 1.6;       /* 1.55–1.65 之间 */
    padding: 2px 2px;       /* 左右 padding 最小化，正文接近屏幕宽度 */
    background: transparent;
    border-radius: 0;
    margin-bottom: 8px;
  }
  /* 填空格子同步缩小，避免比正文大 */
  .blank-char { font-size: 14px; line-height: 1.4; }
  .blank-inline { margin: 0 1px; }
  .answer-pill { font-size: 14px; }
  .practice-hint { font-size: 11px; margin-bottom: 8px; padding: 6px 8px; background: var(--surface-2); border-radius: 8px; }
  .practice-input-row { gap: 6px; }
  .practice-input-row .btn-ghost, .practice-input-row .btn-primary { padding: 7px 12px; font-size: 14px; }
}
