/* ============================================================
   英语练习卷 · 设计系统
   笔记驱动的命题练习站 · 浅色 / 深色双主题
   ------------------------------------------------------------
   设计取向：干净的 SaaS 观感
   - 一切颜色 / 圆角 / 阴影 / 字号都走变量，主题切换只换变量
   - 作答区保留「试卷」质感（衬线正文、编号、答题线），
     外壳与控件走产品化风格，两者形成主次对比
   ============================================================ */

/* ============================================================
   1. 设计令牌
   ============================================================ */
:root {
  color-scheme: light;

  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f2f4f7;

  --border: #e5e7ec;
  --border-2: #eef0f4;
  --border-strong: #d3d7de;

  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-active: #3730a3;
  --primary-soft: #eef2ff;
  --primary-border: #c7d2fe;
  --primary-text: #3730a3;

  --success: #059669;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --info-border: #bae6fd;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px -1px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 10px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 26px -8px rgba(16, 24, 40, .12), 0 4px 10px -6px rgba(16, 24, 40, .06);
  --shadow-xl: 0 28px 56px -16px rgba(16, 24, 40, .22), 0 8px 20px -12px rgba(16, 24, 40, .1);
  --ring: 0 0 0 3px rgba(79, 70, 229, .16);

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --serif: "Times New Roman", Times, "Songti SC", "SimSun", "Noto Serif SC", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a0c11;
  --surface: #12151c;
  --surface-2: #171b23;
  --surface-3: #1c212b;

  --border: #262c37;
  --border-2: #1f242e;
  --border-strong: #39414f;

  --text: #e9ecf1;
  --text-2: #98a2b3;
  --text-3: #667085;

  --primary: #6366f1;
  --primary-hover: #7c7ff5;
  --primary-active: #818cf8;
  --primary-soft: rgba(99, 102, 241, .14);
  --primary-border: rgba(99, 102, 241, .42);
  --primary-text: #a5b4fc;

  --success: #34d399;
  --success-soft: rgba(16, 185, 129, .13);
  --success-border: rgba(16, 185, 129, .34);
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, .13);
  --warning-border: rgba(245, 158, 11, .34);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, .13);
  --danger-border: rgba(239, 68, 68, .34);
  --info: #38bdf8;
  --info-soft: rgba(14, 165, 233, .13);
  --info-border: rgba(14, 165, 233, .34);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px -1px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, .5), 0 2px 4px -2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 26px -8px rgba(0, 0, 0, .6), 0 4px 10px -6px rgba(0, 0, 0, .4);
  --shadow-xl: 0 28px 56px -16px rgba(0, 0, 0, .8), 0 8px 20px -12px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(99, 102, 241, .28);
}

/* ============================================================
   2. 基础
   ============================================================ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
/* 全局链接：默认不带下划线（与原「英语课后练习题.html」一致），
   悬停时才出现下划线；按钮式链接始终保持无下划线。 */
a {
  color: var(--primary);
  text-decoration: none;
  text-underline-offset: 2px;
  transition: color .12s;
}
a:hover { text-decoration: underline; }
a:focus-visible { border-radius: var(--r-xs); }
/* 按钮 / 卡片 / 导航这类「长得像按钮」的链接永远不要下划线 */
.btn, .btn:hover,
.navitem, .navitem:hover,
.stat-card, .stat-card:hover,
.ni-act, .ni-act:hover,
.brand, .brand:hover,
.list-item > a, .list-item > a:hover,
.chip, .chip:hover { text-decoration: none; }

code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
}
.ico svg { display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ============================================================
   3. 顶栏与导航
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 58px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; text-decoration: none; color: inherit; flex: 0 0 auto;
}
.brand .logo-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}
.brand .logo-mark svg { width: 34px; height: 34px; display: block; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-txt b { font-size: 14px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand-txt small { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

.mainnav {
  display: flex; align-items: center; gap: 2px;
  margin-left: 6px; overflow-x: auto; scrollbar-width: none;
}
.mainnav::-webkit-scrollbar { display: none; }

.navitem {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 550;
  color: var(--text-2); text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.navitem .ico svg { width: 15px; height: 15px; }
.navitem:hover { background: var(--surface-3); color: var(--text); }
.navitem.on { background: var(--primary-soft); color: var(--primary-text); font-weight: 620; }
.navitem.on .ico { color: var(--primary); }
.navitem .cnt {
  font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--danger); color: #fff;
  border-radius: var(--r-full); padding: 1px 6px; margin-left: 2px;
}
.navitem .cnt:empty, .navitem .cnt[hidden] { display: none; }

.topactions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-2);
  border: 1px solid transparent; border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm .ico svg { width: 15px; height: 15px; }

.ai-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 620; letter-spacing: .02em;
  padding: 4px 9px; border-radius: var(--r-full);
  background: var(--success-soft); color: var(--success);
  border: 1px solid var(--success-border);
  white-space: nowrap; cursor: default;
}
.ai-badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.ai-badge.off { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }

/* ============================================================
   4. 页面容器
   ============================================================ */
.page {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page.wide { max-width: 1280px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 {
  font-size: 21px; font-weight: 680; letter-spacing: -.022em; line-height: 1.3;
}
.page-head .desc { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.65; }
.page-head .desc b { color: var(--text); font-weight: 620; font-variant-numeric: tabular-nums; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   5. 面板与卡片
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; min-height: 44px; padding: 10px 15px;
  border-bottom: 1px solid var(--border-2);
  background: linear-gradient(var(--surface), var(--surface-2));
}
.panel-head h2 {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 640; letter-spacing: -.005em;
}
.panel-head h2 .ico { color: var(--text-3); }
.panel-head h2 .ico svg { width: 15px; height: 15px; }
.panel-body { padding: 15px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.panel-body.scroll { overflow-y: auto; flex: 1 1 auto; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 16px 17px;
  display: flex; flex-direction: column; gap: 10px;
}
.card h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 640; margin: 0;
}
.card h3 .ico { color: var(--text-3); }
.card h3 .ico svg { width: 16px; height: 16px; }
.card p { font-size: 12.5px; color: var(--text-2); line-height: 1.7; margin: 0; }

/* 概览数字卡 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
}
.stat-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-card .sc-ico {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); flex: 0 0 auto;
}
.stat-card .sc-body b {
  display: block; font-size: 22px; font-weight: 660; line-height: 1.25;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.stat-card .sc-body span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.stat-card.warn { border-color: var(--warning-border); background: var(--warning-soft); }
.stat-card.warn .sc-ico { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.stat-card.warn .sc-body b { color: var(--warning); }
.stat-card.danger { border-color: var(--danger-border); background: var(--danger-soft); }
.stat-card.danger .sc-ico { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.stat-card.danger .sc-body b { color: var(--danger); }
.stat-card.ok { border-color: var(--success-border); background: var(--success-soft); }
.stat-card.ok .sc-ico { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.stat-card.ok .sc-body b { color: var(--success); }

/* ============================================================
   6. 按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; font-weight: 580;
  padding: 0 14px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-3); }
.btn:active { transform: translateY(.5px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ico svg { width: 15px; height: 15px; }

.btn.primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ok { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.btn.warn { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.btn.danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-xs); gap: 5px; }
.btn.sm .ico svg { width: 14px; height: 14px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 13.5px; border-radius: var(--r-md); }
.btn.link {
  height: auto; padding: 0; border: none; background: none; box-shadow: none;
  color: var(--primary); font-size: 12px; font-weight: 560;
}
.btn.link:hover { text-decoration: underline; background: none; }

/* ============================================================
   7. 表单
   ------------------------------------------------------------
   注意：试卷里的控件（.blank-input / .match-select / .writing-area）
   有原卷自己的一套样式，必须用 :not() 排除掉。
   否则 input[type="text"]（权重 0,1,1）会盖过 .blank-input（0,1,0），
   把行内填空变成 width:100% 的方框、掉到单独一行。
   ============================================================ */
input[type="text"]:not(.blank-input), input[type="password"], input[type="number"], input[type="date"],
textarea:not(.writing-area), select:not(.match-select), .input {
  font-family: inherit; font-size: 12.5px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 8px 10px; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: var(--shadow-xs);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, textarea:hover, select:hover { border-color: var(--text-3); }
input:focus, textarea:focus, select:focus {
  border-color: var(--primary); box-shadow: var(--ring);
}
textarea { resize: vertical; line-height: 1.7; min-height: 84px; }
select:not(.match-select) {
  cursor: pointer; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.6 9.6L12 15l5.4-5.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
[data-theme="dark"] select:not(.match-select) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.6 9.6L12 15l5.4-5.4'/%3E%3C/svg%3E");
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 620; color: var(--text-2);
}
.field .desc { font-size: 11px; color: var(--text-3); line-height: 1.7; }
.hint { font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* 分割线 */
.divider { height: 1px; background: var(--border-2); margin: 2px 0; }

/* ============================================================
   8. 标签 / 徽标
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 580;
  padding: 2px 8px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.badge.primary { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-border); }
.badge.ok { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge.warn { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge.mono { font-family: var(--mono); font-size: 10px; }

/* ============================================================
   9. 试卷（作答区）
   ------------------------------------------------------------
   这一段的类名与视觉参数**逐条对照原「英语课后练习题.html」**：
   .paper-wrap/.paper/.seal/.paper-head/.paper-title/.paper-subtitle/.paper-meta
   .section/.section-title/.section-instruction/.passage/.audio-bar/.cloze-ref
   .question/.q-stem/.q-num/.q-text/.q-score/.uline
   .options/.option/.opt-key/.opt-text/.blank-input
   .correction-row/.corr-label/.match-row/.match-select
   .order-words/.order-answer/.order-placeholder/.chip
   .writing-area
   .explain/.note-tip/.ai-note-ref
   .ai-report/.ai-report-score/.ai-report-overall
   .ai-comment/.ai-comment-head/.ai-verdict/.ai-rows/.ai-row/.ai-comment-text
   不在题干上挂题型 / 分值 / 笔记编号等标签。
   ============================================================ */
.sheet-wrap {
  padding: 8px 0 40px;
  display: flex; justify-content: center;
}

/* 试卷纸张：宽度、内边距、衬线底字都与原版一致 */
.sheet {
  position: relative;
  width: 100%; max-width: 900px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-2);
  /* 左侧留出密封线的位置 */
  padding: 52px 60px 72px 100px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.95;
  color: var(--text);
  overflow: hidden;
}

/* 顶部流动的渐变条 */
.sheet::after {
  content: "";
  position: absolute; left: 0; top: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--primary), #7c5cd6, var(--primary));
  background-size: 200% 100%;
  animation: sheetShine 8s linear infinite;
}
@keyframes sheetShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* 密封线 */
.sheet::before {
  content: "";
  position: absolute; left: 72px; top: 34px; bottom: 34px;
  border-left: 1px dashed rgba(220, 80, 80, .50);
  pointer-events: none;
}
.seal {
  position: absolute; left: 0; top: 0; bottom: 0; width: 72px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.seal span {
  writing-mode: vertical-rl;
  font-size: 12px; letter-spacing: 9px;
  color: rgba(200, 60, 60, .65);
  font-family: var(--font);
}

/* 卷头 */
.paper-head { text-align: center; }
.paper-title {
  font-size: 27px; font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: 4px;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.35;
}
.paper-subtitle {
  margin: 0 0 18px;
  font-size: 13.5px; color: var(--text-3);
  letter-spacing: 1.5px;
  font-family: var(--font);
}
.paper-meta {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 14px; color: var(--text-2);
  border-top: 2px solid var(--text);
  border-bottom: 1px solid var(--border-strong);
  padding: 10px 4px;
  margin-bottom: 32px;
  font-family: var(--font);
}
.paper-meta span { letter-spacing: .5px; }
.paper-meta .blank-line { color: var(--text-3); letter-spacing: 1px; }
.paper-score { font-weight: 700; letter-spacing: 1px; }
.paper-score.ok { color: var(--success); }
.paper-score.warn { color: var(--warning); }
.paper-score.danger { color: var(--danger); }

/* 大题 */
.section { margin-bottom: 40px; }
.section-title {
  font-size: 17px; font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: 1.5px;
  color: var(--text);
  padding-left: 14px;
  position: relative;
  font-family: var(--font);
}
.section-title::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 18px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), #0ea5e9);
}
.section-instruction {
  margin: 0 0 16px; font-size: 13.5px;
  color: var(--text-3); line-height: 1.85;
  padding-left: 14px;
  font-family: var(--font);
}

/* 阅读 / 完形材料 */
.passage {
  margin: 0 0 18px;
  font-size: 15.5px; line-height: 2.1;
  white-space: pre-wrap; text-align: justify;
  color: var(--text-2);
  font-family: var(--serif);
  padding: 18px 22px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
}
.passage .cloze-ref {
  display: inline-block;
  vertical-align: super;
  font-size: .72em; font-weight: 800;
  color: var(--primary);
  margin: 0 2px 0 3px;
}

/* 听力条 */
.audio-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary-soft), var(--info-soft));
  border: 1px solid var(--primary-border);
  border-radius: var(--r-md);
}
.audio-tip {
  font-size: 12.5px; color: var(--text-3);
  font-family: var(--font);
}
.audio-text {
  font-family: var(--serif); font-size: 13.5px; line-height: 1.95;
  color: var(--text-2); white-space: pre-wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--primary-border);
  width: 100%;
}

/* 匹配题备选库 */
.bank {
  margin: 0 0 18px 26px; padding: 12px 16px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 14px; line-height: 2; color: var(--text-2);
}
.bank b { color: var(--text); }
.bank .bank-item { margin-right: 16px; }
.bank .bank-key { font-weight: 700; color: var(--text-2); }

/* 小题 */
.question { margin: 0 0 22px; }
.q-stem { line-height: 2.05; }
.q-num { font-weight: 800; margin-right: 3px; color: var(--text); }
.q-text { white-space: pre-wrap; }
.q-score {
  font-size: 12px; color: var(--text-3);
  margin-left: 6px;
  font-family: var(--font);
}
/* 题干里的空线（非填空类题型用） */
.uline {
  display: inline-block; width: 4.2em;
  border-bottom: 1.2px solid var(--text-2);
}

/* 选项缺失时的兜底提示 */
.q-warn {
  margin: 6px 0 0; font-size: 12px; color: var(--warning);
  font-family: var(--font);
}

/* 选项 */
.options {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px 26px; margin: 8px 0 0 26px;
}
.options.judge { grid-template-columns: 1fr 1fr; max-width: 440px; }
.option {
  display: flex; align-items: baseline; gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  line-height: 1.85;
  transition: all .12s ease;
  border: 1px solid transparent;
}
.option:hover { background: var(--surface-2); border-color: var(--border-2); }
.option input {
  accent-color: var(--primary);
  cursor: pointer; margin: 0;
  transform: translateY(1px);
  width: 15px; height: 15px;
  flex: 0 0 auto;
}
.opt-key {
  font-weight: 700;
  color: var(--text-2);
  min-width: 1.4em;
  font-family: var(--font);
}
.opt-text { flex: 1; color: var(--text-2); }
.option.on { background: var(--primary-soft); border-color: var(--primary-border); }
.option.correct { background: var(--success-soft); border-color: var(--success-border); }
.option.correct .opt-key,
.option.correct .opt-text { color: var(--success); font-weight: 700; }
.option.wrong { background: var(--danger-soft); border-color: var(--danger-border); }
.option.wrong .opt-key,
.option.wrong .opt-text { color: var(--danger); }
.option.wrong .opt-text { text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* 填空 */
.blank-input {
  font-family: inherit; font-size: inherit;
  color: var(--primary-text);
  border: none; border-bottom: 1.6px solid var(--text-2);
  background: transparent;
  width: 8.5em; text-align: center;
  padding: 0 4px; margin: 0 4px;
  outline: none;
  transition: all .15s;
  font-weight: 600;
}
.blank-input.wide { width: min(100%, 28em); text-align: left; }
.blank-input:focus {
  border-bottom-color: var(--primary);
  background: var(--primary-soft);
  border-radius: 4px 4px 0 0;
}
.blank-input.correct { color: var(--success); border-bottom-color: var(--success); font-weight: 700; }
.blank-input.wrong {
  color: var(--danger);
  border-bottom-color: var(--danger);
  text-decoration: line-through;
}

/* 改错 */
.correction-row {
  margin: 10px 0 0 26px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.corr-label {
  font-size: 13.5px; color: var(--text-3); font-weight: 600;
  font-family: var(--font);
}

/* 匹配 */
.match-row { margin: 8px 0 0 26px; }
.match-select {
  font-family: inherit; font-size: 15px;
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
  max-width: 100%;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-xs);
}
.match-select:hover { border-color: var(--text-3); }
.match-select:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.match-select.correct {
  border-color: var(--success); background: var(--success-soft);
  color: var(--success); font-weight: 700;
}
.match-select.wrong {
  border-color: var(--danger); background: var(--danger-soft); color: var(--danger);
}

/* 连词成句 */
.order-answer {
  margin: 10px 0 0 26px;
  min-height: 50px;
  padding: 10px 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  transition: all .15s;
}
.order-answer.correct {
  border-color: var(--success); border-style: solid; background: var(--success-soft);
}
.order-answer.correct .chip {
  border-color: var(--success-border); color: var(--success); background: var(--surface);
}
.order-answer.wrong {
  border-color: var(--danger); border-style: solid; background: var(--danger-soft);
}
.order-answer.wrong .chip {
  border-color: var(--danger-border); color: var(--danger); background: var(--surface);
}
.order-placeholder { font-size: 13px; color: var(--text-3); font-family: var(--font); }
.order-words {
  margin: 10px 0 0 26px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chip {
  font-family: inherit; font-size: 14.5px;
  padding: 5px 14px; border-radius: var(--r-full);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s cubic-bezier(.4, 0, .2, 1);
  box-shadow: var(--shadow-xs);
  font-weight: 500;
}
.chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chip:disabled { cursor: default; opacity: .85; transform: none; }
.chip:disabled:hover {
  background: var(--surface); border-color: var(--border-strong);
  color: var(--text-2); box-shadow: var(--shadow-xs);
}

/* 写作 / 翻译 */
textarea.writing-area {
  display: block;
  margin: 10px 0 0 26px;
  width: calc(100% - 26px);
  min-height: 130px;
  font-family: inherit; font-size: 15px; line-height: 2;
  padding: 12px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  resize: vertical; outline: none;
  transition: all .15s;
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
textarea.writing-area.short { min-height: 70px; }
textarea.writing-area::placeholder { color: var(--text-3); }
textarea.writing-area:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--ring);
}

/* 答案解析（原卷 .explain） */
.explain {
  margin: 12px 0 0 26px;
  padding: 12px 16px;
  font-size: 13.5px; line-height: 1.9;
  color: var(--text-2);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-left: 3px solid var(--text-3);
  border-radius: 0 10px 10px 0;
  font-family: var(--font);
}
.explain b { color: var(--text); }
.ref-text { white-space: pre-wrap; margin-top: 6px; }

/* 双击题干的笔记提示（原卷 .note-tip） */
.note-tip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 0 26px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--primary-soft), var(--info-soft));
  border: 1px solid var(--primary-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-2);
  animation: tipIn .22s cubic-bezier(.2,.7,.3,1);
  box-shadow: var(--shadow-sm);
}
@keyframes tipIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.note-tip .nt-label { font-size: 14px; }
.note-tip .nt-id {
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #fff;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
}
.note-tip .nt-title { font-weight: 700; color: var(--text); }
.note-tip .nt-link {
  margin-left: auto;
  color: var(--primary-text); text-decoration: none;
  font-size: 12.5px; font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  background: var(--surface);
  border: 1px solid var(--primary-border);
  transition: all .15s;
}
.note-tip .nt-link:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* 笔记引用块（原卷 .ai-note-ref） */
.ai-note-ref {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--primary-border);
  border-radius: 10px;
  font-size: 13px; line-height: 1.8;
}
.ai-note-ref .ref-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--primary-text);
  font-weight: 700; margin-bottom: 8px; letter-spacing: .3px;
}
.ai-note-ref .ref-head .id-badge {
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #fff;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: 10.5px; line-height: 1.6; font-weight: 700; letter-spacing: .5px;
}
.ai-note-ref blockquote {
  margin: 6px 0 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  color: var(--text);
  font-style: normal;
  white-space: pre-wrap; font-size: 13px;
  box-shadow: var(--shadow-xs);
}
.ai-note-ref a.ref-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--primary-text);
  text-decoration: none; font-weight: 600;
  padding: 5px 11px;
  background: var(--surface);
  border: 1px solid var(--primary-border);
  border-radius: var(--r-xs);
  transition: all .15s;
}
.ai-note-ref a.ref-link:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: var(--shadow-sm); transform: translateY(-1px);
  text-decoration: none;
}
.ai-note-ref .ref-note { font-size: 12.5px; color: var(--text-3); }
.ai-note-ref.none {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}
.ai-note-ref.none .ref-head { color: var(--danger); }
.ai-note-ref.none blockquote { border-left-color: var(--danger); }

/* ============================================================
   10. 成绩报告（原卷 .ai-report / .ai-comment）
   ============================================================ */
.ai-report {
  position: relative;
  margin: 0 0 32px;
  padding: 26px 28px 24px 32px;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(124, 92, 214, .10), transparent 70%),
    radial-gradient(500px 200px at 0% 100%, rgba(79, 70, 229, .08), transparent 70%),
    linear-gradient(135deg, var(--surface), var(--primary-soft));
  border: 1px solid var(--primary-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  font-family: var(--font);
}
.ai-report::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--primary), #7c5cd6);
}
.ai-report-title {
  font-size: 13.5px; font-weight: 700;
  color: var(--primary-text);
  margin-bottom: 14px;
  letter-spacing: .4px;
  display: flex; align-items: center; gap: 8px;
}
.ai-report-title .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
  animation: reportPulse 2s ease-in-out infinite;
}
@keyframes reportPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, .06); }
}
.ai-report-score {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.ai-report-score .big {
  font-size: 48px; font-weight: 800;
  line-height: 1; letter-spacing: -1.5px;
  background: linear-gradient(135deg, var(--primary), #7c5cd6);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  font-family: Georgia, "Times New Roman", serif;
}
.ai-report-score .small { font-size: 17px; color: var(--text-3); font-weight: 600; }
.ai-report-score .pct {
  font-size: 13px; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #7c5cd6);
  padding: 4px 14px; border-radius: var(--r-full);
  box-shadow: var(--shadow-sm);
  letter-spacing: .3px;
}
.ai-report-facts { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 12px; }
.ai-report-facts .fact b {
  display: block; font-size: 19px; font-weight: 700; line-height: 1.3;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.ai-report-facts .fact span { font-size: 11.5px; color: var(--text-3); }
.ai-report-facts .fact.ok b { color: var(--success); }
.ai-report-facts .fact.warn b { color: var(--warning); }
.ai-report-facts .fact.danger b { color: var(--danger); }
.ai-report-mode {
  margin-left: auto; font-size: 11.5px; font-weight: 700;
  padding: 4px 12px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--primary-border);
  color: var(--primary-text);
}
.ai-report-overall {
  font-size: 14px; line-height: 1.95;
  color: var(--text-2);
  white-space: pre-wrap;
  padding-top: 14px;
  border-top: 1px dashed var(--primary-border);
}
.ai-report-overall b { color: var(--primary-text); }

/* 单题批改卡片（原卷 .ai-comment） */
.ai-comment {
  position: relative;
  margin: 16px 0 0 26px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: commentIn .35s cubic-bezier(.2, .7, .3, 1);
  font-family: var(--font);
}
@keyframes commentIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-comment::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.ai-comment.correct::before { background: linear-gradient(180deg, #10b981, #059669); }
.ai-comment.partial::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.ai-comment.wrong::before { background: linear-gradient(180deg, #ef4444, #dc2626); }
.ai-comment.blank::before { background: var(--border-strong); }

.ai-comment-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px 12px 22px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-2);
  font-size: 12.5px; color: var(--text-3);
}
.ai-comment.correct .ai-comment-head { background: linear-gradient(90deg, var(--success-soft) 0%, var(--surface-2) 70%); }
.ai-comment.partial .ai-comment-head { background: linear-gradient(90deg, var(--warning-soft) 0%, var(--surface-2) 70%); }
.ai-comment.wrong   .ai-comment-head { background: linear-gradient(90deg, var(--danger-soft) 0%, var(--surface-2) 70%); }

.ai-verdict {
  font-weight: 700; font-size: 12.5px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  display: inline-flex; align-items: center; gap: 5px;
  letter-spacing: .3px;
}
.ai-comment.correct .ai-verdict { background: var(--success-soft); color: var(--success); }
.ai-comment.partial .ai-verdict { background: var(--warning-soft); color: var(--warning); }
.ai-comment.wrong   .ai-verdict { background: var(--danger-soft); color: var(--danger); }
.ai-comment.blank   .ai-verdict { background: var(--surface-3); color: var(--text-3); }

.ai-tag {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), #7c5cd6);
  color: #fff;
  letter-spacing: .5px;
  font-weight: 700;
  text-transform: uppercase;
}

.ai-points {
  margin-left: auto;
  font-size: 12.5px; color: var(--text-3);
  font-weight: 600;
  display: inline-flex; align-items: baseline; gap: 4px;
}
.ai-points b {
  font-size: 20px;
  color: var(--text);
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  letter-spacing: -.5px;
}
.ai-comment.correct .ai-points b { color: var(--success); }
.ai-comment.wrong   .ai-points b { color: var(--danger); }
.ai-comment.partial .ai-points b { color: var(--warning); }

.ai-comment-body {
  padding: 14px 18px 16px 22px;
  font-size: 13.5px; line-height: 1.85;
  color: var(--text-2);
}
.ai-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ai-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; }
.ai-row-label {
  flex-shrink: 0;
  min-width: 70px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 3px 10px;
  border-radius: var(--r-xs);
  text-align: center;
  line-height: 1.6;
  letter-spacing: .4px;
}
.ai-row-value {
  flex: 1;
  color: var(--text);
  word-break: break-word;
  padding-top: 3px;
}
.ai-row-value.correct { color: var(--success); font-weight: 700; }
.ai-comment-text {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text-2);
  white-space: pre-wrap;
}
.ai-comment-text b {
  display: inline-block;
  margin-right: 8px;
  color: var(--primary-text);
  font-size: 11.5px;
  padding: 2px 9px;
  background: var(--primary-soft);
  border-radius: 5px;
  vertical-align: 2px;
  letter-spacing: .4px;
  font-weight: 700;
}

/* ============================================================
   11. 笔记库 / 出题
   ============================================================ */
/* ---- 知识范围：可搜索的二级级联选择器 ---- */
.nsel {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.nsel-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.nsel-search {
  flex: 1 1 220px; min-width: 180px;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.nsel-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.nsel-search .ico { color: var(--text-3); flex: 0 0 auto; display: inline-flex; }
.nsel-search .ico svg { width: 14px; height: 14px; }
.nsel-search input {
  flex: 1 1 auto; min-width: 0;
  border: none; outline: none; background: transparent;
  font: inherit; font-size: 12.5px; color: var(--text);
}
.nsel-tree { max-height: 380px; overflow: auto; padding: 5px; }

/* 一行：一级 / 二级 / 叶子 */
.ns-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .12s;
}
.ns-row:hover { background: var(--surface-2); }
.ns-g .ns-name { font-size: 13px; font-weight: 680; }
.ns-m .ns-name { font-size: 12.5px; font-weight: 620; }
.ns-n .ns-name { font-size: 12px; font-weight: 500; color: var(--text-2); }
.ns-n { padding-left: 12px; }

.ns-caret {
  flex: 0 0 auto; width: 18px; height: 18px;
  border: none; background: transparent; padding: 0;
  display: grid; place-items: center;
  color: var(--text-3); cursor: pointer; border-radius: var(--r-xs);
}
.ns-caret:hover { background: var(--surface-3); color: var(--text); }
.ns-caret svg { width: 12px; height: 12px; transition: transform .15s; }
.ns-caret.open svg { transform: rotate(90deg); }
.ns-caret.leaf { visibility: hidden; }

/* 三态勾选框 */
.ns-check {
  flex: 0 0 auto; width: 17px; height: 17px;
  border-radius: 5px; border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid; place-items: center; color: #fff;
  transition: all .13s;
}
.ns-check svg { width: 11px; height: 11px; opacity: 0; }
.ns-check.on { background: var(--primary); border-color: var(--primary); }
.ns-check.on svg { opacity: 1; }
.ns-check.half { background: var(--primary); border-color: var(--primary); }
.ns-check.half::after {
  content: ""; width: 8px; height: 2px; border-radius: 1px; background: #fff;
}
.ns-check.half svg { display: none; }

.ns-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-code {
  flex: 0 0 auto; font-family: var(--mono); font-size: 10px;
  color: var(--primary-text); background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 0 5px; border-radius: var(--r-xs);
}
.ns-count { margin-left: auto; flex: 0 0 auto; font-size: 11px; color: var(--text-3); }

/* 笔记直接挂在分类下面（只有一级分类） */
.ns-notes {
  margin-left: 15px; padding-left: 8px;
  border-left: 1px solid var(--border);
}
.ns-group.hit > .ns-row .ns-name { color: var(--primary-text); }

/* 搜索命中的叶子 */
.ns-hit { background: var(--warning-soft); border-radius: 3px; padding: 0 2px; }
.nsel-empty { padding: 24px 12px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.nsel-sum {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 11px; border-top: 1px solid var(--border);
  background: var(--surface-2); font-size: 11.5px; color: var(--text-3);
}
.nsel-sum .chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-text);
  border: 1px solid var(--primary-border); font-size: 11px; font-weight: 600;
}

.note-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.note-item:hover { border-color: var(--primary-border); box-shadow: var(--shadow-sm); }
.note-item .ni-body { flex: 1 1 auto; min-width: 0; }
.note-item .ni-title { font-size: 13px; font-weight: 640; line-height: 1.45; }
.note-item .ni-sum {
  font-size: 12px; color: var(--text-2); line-height: 1.7; margin-top: 5px;
  white-space: pre-wrap;
}
.note-item .ni-acts { display: flex; gap: 2px; flex: 0 0 auto; }
.note-item .ni-act {
  width: 26px; height: 26px; display: grid; place-items: center;
  border: none; background: none; cursor: pointer;
  color: var(--text-3); border-radius: var(--r-xs);
  transition: background .12s, color .12s;
}
.note-item .ni-act:hover { background: var(--surface-3); color: var(--primary); }
.note-item .ni-act.del:hover { color: var(--danger); }
.note-item .ni-act .ico svg { width: 14px; height: 14px; }

/* 笔记库按分类（班级 / 课程）分组，笔记直接挂在分类下面 */
#noteList { display: flex; flex-direction: column; gap: 18px; }
.ng-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: var(--text);
  padding-bottom: 7px; margin-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.ng-head .ico { color: var(--primary); display: inline-flex; }
.ng-count { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--text-3); }
.ng .note-item { margin-bottom: 8px; }

/* 错题本条目：卷面结构 + 一行掌握状态（不用标签胶囊） */
#wrongList { display: flex; flex-direction: column; gap: 14px; }
#wrongList .question {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  background: var(--surface);
}
.wrong-state { font-size: 12px; font-weight: 700; margin-right: 4px; }
.wrong-state.open { color: var(--warning); }
.wrong-state.done { color: var(--success); }

/* 题型数量表 */
.type-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}
.type-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.type-row.on { border-color: var(--primary); background: var(--primary-soft); }
.type-row .tr-name { flex: 1 1 auto; font-size: 12.5px; font-weight: 560; min-width: 0; }
.type-row input {
  width: 58px; flex: 0 0 auto; text-align: center;
  font-weight: 620; font-variant-numeric: tabular-nums;
}

/* ============================================================
   12. 列表 / 历史
   ============================================================ */
.list { display: flex; flex-direction: column; gap: 9px; }
.list-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.list-item:hover { border-color: var(--primary-border); box-shadow: var(--shadow-sm); }
.list-item .li-body { flex: 1 1 auto; min-width: 0; }
.list-item .li-title { font-size: 13px; font-weight: 620; line-height: 1.45; }
.list-item .li-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-3); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.list-item .li-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.list-item .li-score {
  flex: 0 0 auto; text-align: center; min-width: 62px;
}
.list-item .li-score b {
  display: block; font-size: 17px; font-weight: 680; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.list-item .li-score span { font-size: 10px; color: var(--text-3); }

/* 空状态 / 骨架 */
.empty {
  text-align: center; color: var(--text-3);
  font-size: 12px; padding: 30px 10px; line-height: 1.9;
}
.empty b { display: block; color: var(--text-2); font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.empty .big {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: var(--r-xl);
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-3);
}
.empty .big svg { width: 26px; height: 26px; }

.skeleton {
  height: 72px; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============================================================
   13. 图表
   ============================================================ */
.bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 110px; padding-top: 8px;
}
.bar-chart .bar {
  flex: 1 1 0; min-height: 3px;
  background: linear-gradient(var(--primary), color-mix(in srgb, var(--primary) 60%, var(--surface)));
  border-radius: 4px 4px 0 0; opacity: .85;
  transition: opacity .15s;
  position: relative;
}
.bar-chart .bar:hover { opacity: 1; }
.bar-chart .bar span {
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--text-3); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bar-chart.tall { height: 150px; padding-bottom: 20px; }

.acc-row {
  display: grid; grid-template-columns: 96px 1fr 62px;
  gap: 10px; align-items: center; font-size: 12px;
}
.acc-row .acc-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.acc-fill { height: 100%; border-radius: var(--r-full); background: var(--primary); transition: width .4s; }
.acc-fill.ok { background: var(--success); }
.acc-fill.warn { background: var(--warning); }
.acc-fill.danger { background: var(--danger); }
.acc-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }

/* ============================================================
   14. 弹窗 / 提示 / 加载
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(11, 14, 20, .55);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.modal-mask.show { display: flex; animation: fade .14s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: min(760px, 100%); max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.05);
}
@keyframes pop {
  from { transform: translateY(8px) scale(.985); opacity: .5; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 17px;
  border-bottom: 1px solid var(--border-2);
}
.modal-head h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 640; }
.modal-head h3 .ico { color: var(--primary); }
.modal-head h3 .ico svg { width: 17px; height: 17px; }
.modal-body { padding: 17px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  padding: 12px 17px; border-top: 1px solid var(--border-2);
  display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2);
}
.modal-foot:empty { display: none; }
.modal.wide { width: min(940px, 100%); }

.toast-wrap {
  position: fixed; top: 68px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  position: relative;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 11px 15px 11px 17px;
  font-size: 12.5px; max-width: 360px; line-height: 1.6;
  pointer-events: auto;
  animation: slideIn .2s cubic-bezier(.2, .9, .3, 1.05);
}
.toast::before {
  content: ''; position: absolute; left: -1px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.toast.ok::before { background: var(--success); }
.toast.err::before { background: var(--danger); }
.toast.warn::before { background: var(--warning); }
.toast b { display: block; margin-bottom: 2px; font-weight: 640; }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading-mask {
  position: fixed; inset: 0;
  background: rgba(11, 14, 20, .45);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 300;
}
.loading-mask.show { display: flex; }
.loading-box {
  background: var(--surface); border: 1px solid var(--border);
  padding: 28px 38px; border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl); text-align: center; min-width: 280px;
}
.loading-box p { margin: 15px 0 3px; font-size: 13.5px; font-weight: 620; }
.loading-box span { font-size: 11.5px; color: var(--text-3); }
.spinner {
  width: 32px; height: 32px; margin: 0 auto;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   15. 滚动条
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 6px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ============================================================
   16. 打印：只留试卷
   ============================================================ */
@media print {
  body { background: #fff; display: block; }
  .topbar, .no-print, .toast-wrap, .modal-mask, .loading-mask, .page-head, .head-actions { display: none !important; }
  .page { max-width: none; padding: 0; }
  .sheet {
    box-shadow: none; border: none; border-radius: 0;
    padding: 0; max-width: none;
  }
  /* 原卷打印时去掉装饰条与密封线 */
  .sheet::before, .sheet::after, .seal { display: none; }
  .question, .explain, .ai-report, .ai-note-ref { break-inside: avoid; }
  .section { break-inside: auto; }
  .note-tip { display: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* ============================================================
   17. 响应式
   ============================================================ */
@media (max-width: 900px) {
  .brand-txt small { display: none; }
  .navitem span { display: none; }
  .navitem { padding: 8px 10px; }
  .page { padding: 16px 14px 56px; }
  /* 原卷在窄屏去掉密封线留白 */
  .sheet { padding: 30px 24px 44px; }
  .sheet::before, .seal { display: none; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .ai-report-score .big { font-size: 30px; }
}
@media (max-width: 620px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand .logo-mark, .brand .logo-mark svg { width: 30px; height: 30px; }
  .ai-badge { display: none; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
  /* 原卷的窄屏处理：选项单列、去掉左缩进 */
  .options { grid-template-columns: 1fr; margin-left: 0; }
  .passage, .explain, .note-tip, .bank,
  .order-words, .order-answer, .correction-row, .match-row,
  textarea.writing-area { margin-left: 0; }
  textarea.writing-area { width: 100%; }
  .paper-title { font-size: 20px; letter-spacing: 2px; }
  .paper-meta { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
