/* =========================================================
   中文学习 · 样式
   浅色为底、深色通过 [data-mode="dark"] 覆盖；主色由 --accent 驱动，
   设置页会实时改写这些变量，所以组件里只用变量、不写死颜色。
   ========================================================= */

:root {
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --surface-3: #e6ecea;
  --text: #16201d;
  --muted: #5c6a65;
  --border: #e0e8e4;
  --border-strong: #cfd9d4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 45, 38, .05), 0 10px 30px rgba(15, 45, 38, .06);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  --fs-base: 16px;
  color-scheme: light;
}

[data-mode="dark"] {
  --bg: #0d1412;
  --surface: #151f1c;
  --surface-2: #1b2723;
  --surface-3: #22302b;
  --text: #e9f0ed;
  --muted: #9aada7;
  --border: #26332f;
  --border-strong: #33443e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 壁纸层 ---------- */
.wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
  background-image: none;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: var(--wallpaper-opacity, 1);
}
body[data-wallpaper="aurora"] .wallpaper {
  background-image:
    radial-gradient(1200px 600px at 8% -10%, rgba(15, 118, 110, .16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(52, 82, 196, .12), transparent 55%),
    radial-gradient(700px 500px at 50% 110%, rgba(124, 58, 237, .10), transparent 60%);
}
body[data-wallpaper="bamboo"] .wallpaper {
  background-image:
    radial-gradient(800px 500px at 0% 100%, rgba(22, 101, 52, .18), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(202, 138, 4, .10), transparent 60%);
}
body[data-wallpaper="sand"] .wallpaper {
  background-image:
    radial-gradient(900px 600px at 100% 0%, rgba(194, 65, 12, .12), transparent 60%),
    radial-gradient(800px 500px at 0% 100%, rgba(190, 24, 93, .10), transparent 60%);
}
body[data-wallpaper="ink"] .wallpaper {
  background-image:
    radial-gradient(900px 600px at 15% 0%, rgba(51, 65, 85, .18), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(15, 118, 110, .14), transparent 60%);
}
body[data-wallpaper="image"] .wallpaper {
  background-image: var(--wallpaper-image, none);
  filter: saturate(1.02);
}
body[data-wallpaper="image"] .wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .12);
}
[data-mode="dark"] body[data-wallpaper="image"] .wallpaper::after {
  background: rgba(0, 0, 0, .55);
}

/* ---------- 框架 ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  background: color-mix(in srgb, var(--surface) calc(var(--surface-alpha, 1) * 72%), transparent);
  backdrop-filter: blur(14px) saturate(1.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 4px 6px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 17px; font-weight: 600; }
.brand-text small { font-size: 12px; color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.4;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 19px; opacity: .9; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
  font-weight: 600;
}
.nav-item[aria-current="page"] svg { opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: 0 0 8px; }
.dot[data-state="on"] { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.dot[data-state="off"] { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .15); }
.dot[data-state="err"] { background: #dc2626; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.content {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px 40px 72px;
  min-width: 0;
  outline: none;
}

.mobile-bar, .mobile-nav { display: none; }

/* ---------- 排版 ---------- */
.page-head { margin: 0 0 22px; }
.page-head h1 { font-size: 26px; line-height: 1.35; margin: 0 0 6px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); font-size: 14.5px; }
.eyebrow {
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
  margin-bottom: 6px;
}
h2 { font-size: 19px; margin: 0 0 10px; line-height: 1.4; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) calc(var(--surface-alpha, 1) * 100%), transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card + .card { margin-top: 16px; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat {
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) calc(var(--surface-alpha, 1) * 100%), transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 30px; font-weight: 650; line-height: 1.25; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-value.is-empty { color: var(--muted); opacity: .45; }
.stat-hint { font-size: 12.5px; color: var(--muted); margin-top: auto; padding-top: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { filter: brightness(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--surface-2); }
.btn.quiet { background: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: #b42318; color: #fff; }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field-label { font-size: 14px; font-weight: 550; }
.field .help { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}
input[type="date"] { max-width: 220px; }
input[type="range"] { accent-color: var(--accent); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 36px;
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 40, 34, .12);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
}
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 2px; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.swatch[aria-pressed="true"] { border-color: var(--text); }
.swatch[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.wallpaper-row { display: flex; flex-wrap: wrap; gap: 10px; }
.wallpaper-tile {
  width: 96px;
  height: 62px;
  border-radius: 12px;
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--surface-2);
  padding: 0;
  position: relative;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
}
.wallpaper-tile[aria-pressed="true"] { border-color: var(--accent); }
.wallpaper-tile span { position: absolute; inset: auto 0 4px 0; text-align: center; }
.wp-none { background: var(--surface); }
.wp-aurora { background: linear-gradient(135deg, #d7f0ea, #e3e8fb 55%, #f2e6fb); }
.wp-bamboo { background: linear-gradient(135deg, #d9ecd8, #f4ecd0); }
.wp-sand { background: linear-gradient(135deg, #fbe6d6, #f8dfe8); }
.wp-ink { background: linear-gradient(135deg, #dbe3ea, #d6ece8); }
[data-mode="dark"] .wp-none { background: #151f1c; }
[data-mode="dark"] .wp-aurora { background: linear-gradient(135deg, #123a35, #1a2342 55%, #2a1c3d); }
[data-mode="dark"] .wp-bamboo { background: linear-gradient(135deg, #14301a, #33301a); }
[data-mode="dark"] .wp-sand { background: linear-gradient(135deg, #3a2418, #351a26); }
[data-mode="dark"] .wp-ink { background: linear-gradient(135deg, #1c2733, #16302c); }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.pending { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge.approved { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge.disabled { background: var(--surface-3); color: var(--muted); }
.badge.ai { background: color-mix(in srgb, var(--accent) 12%, transparent); color: color-mix(in srgb, var(--accent) 85%, var(--text)); border-color: transparent; }
[data-mode="dark"] .badge.pending { background: #3a2c0a; color: #fbbf24; border-color: #4a3810; }
[data-mode="dark"] .badge.approved { background: #0f2a1a; color: #4ade80; border-color: #1a3d28; }

/* ---------- 空状态 ---------- */
.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 30px 22px;
  text-align: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty-state .empty-icon { font-size: 26px; opacity: .55; display: block; margin-bottom: 6px; }
.empty-state strong { display: block; color: var(--text); font-size: 15.5px; margin-bottom: 4px; font-weight: 600; }
.empty-state p { margin: 0 auto; max-width: 42ch; font-size: 13.5px; line-height: 1.7; }
.empty-state .btn { margin-top: 14px; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-size: 15px; font-weight: 550; }
.list-item .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- 提示 ---------- */
.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.7;
  margin: 12px 0;
}
.callout.warn { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.callout.info { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
[data-mode="dark"] .callout.warn { background: #2a1a0c; border-color: #4a3014; color: #fdba74; }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast {
  pointer-events: auto;
  background: #14201c;
  color: #f2f7f5;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in .18s ease-out;
  max-width: 100%;
}
.toast button { border: 0; background: transparent; color: #7dd3c7; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.toast.err { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 分隔、表格 ---------- */
.hr { height: 1px; background: var(--border); margin: 20px 0; border: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
table.simple th { font-size: 12.5px; color: var(--muted); font-weight: 550; }

/* ---------- 移动端 ---------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    background: color-mix(in srgb, var(--bg) calc(var(--surface-alpha, 1) * 88%), transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand { padding: 0; gap: 8px; }
  .mobile-bar .brand-mark { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; font-size: 17px; }
  .mobile-bar strong { font-size: 16px; }
  .mobile-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    background: color-mix(in srgb, var(--surface) calc(var(--surface-alpha, 1) * 80%), transparent);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    position: sticky;
    top: 53px;
    z-index: 29;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav .nav-item {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 14px;
    scroll-snap-align: start;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
  }
  .mobile-nav .nav-item svg { width: 16px; height: 16px; flex-basis: 16px; }
  .mobile-nav .nav-item[aria-current="page"] { border-color: transparent; }
  .content { padding: 18px 16px 56px; }
  .page-head h1 { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-value { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .sidebar, .mobile-bar, .mobile-nav, .toasts { display: none; }
  .content { padding: 0; max-width: none; }
}

/* =========================================================
   v1.0 学习流程组件
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 20, 17, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.modal-card {
  width: min(640px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) calc(var(--surface-alpha, 1) * 100%), transparent);
  backdrop-filter: blur(20px) saturate(1.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  padding: 20px;
}
.modal-card.wide { width: min(860px, 100%); }
.modal-head h2 { margin: 0 0 4px; }
.modal-body { margin: 14px 0 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.error-list { font-size: 13px; line-height: 1.7; max-height: 300px; overflow: auto; background: var(--surface-2); border-radius: 10px; padding: 10px; }
.error-list > div { padding: 3px 0; border-bottom: 1px solid var(--border); word-break: break-word; }
.error-list > div:last-child { border-bottom: 0; }

.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.material-row .title, .bank-row .title, .wrong-row .title { font-weight: 600; }
.preview-block { border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--border)); padding: 4px 0 4px 10px; }
.preview-text { white-space: pre-wrap; font-size: 14px; line-height: 1.8; word-break: break-word; }
.passage { margin: 10px 0; }
.passage summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.passage-body { margin-top: 8px; padding: 12px; background: var(--surface-2); border-radius: 10px; white-space: pre-wrap; font-size: 14px; line-height: 1.8; max-height: 300px; overflow: auto; word-break: break-word; }

.block-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.block-choice { display: flex; gap: 8px; padding: 8px; border-radius: 9px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); }
.block-choice:hover { border-color: var(--border-strong); }
.block-choice input { flex: 0 0 auto; width: 18px; height: 18px; }
.block-label { display: block; font-size: 12px; color: var(--muted); }
.block-preview { display: block; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

.question-head .stem, .stem-sm { font-size: 19px; line-height: 1.65; letter-spacing: 0; margin: 8px 0 12px; }
.stem-sm { font-size: 17px; }
.options { display: flex; flex-direction: column; gap: 9px; }
.option-btn {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  width: 100%; min-height: 50px; padding: 11px 13px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.6;
  cursor: pointer;
}
.option-btn:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.option-btn:disabled { cursor: default; opacity: .9; }
.option-btn.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.option-btn.correct { border-color: #16a34a; background: color-mix(in srgb, #16a34a 10%, var(--surface)); }
.option-btn.wrong { border-color: #b42318; background: color-mix(in srgb, #b42318 8%, var(--surface)); }
.option-letter { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 650; font-size: 13px; }
.option-text { flex: 1; min-width: 0; word-break: break-word; }
.option-mark { margin-left: auto; font-weight: 700; }
.option-btn.correct .option-mark { color: #15803d; }
.option-btn.wrong .option-mark { color: #b42318; }
.explain-box { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.8; word-break: break-word; }
.result-card { text-align: center; padding: 30px 20px; }

.review-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); margin-bottom: 10px; }
.review-options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.review-option { display: flex; align-items: flex-start; gap: 9px; padding: 7px 9px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.review-option.right { background: color-mix(in srgb, #16a34a 12%, var(--surface)); border: 1px solid color-mix(in srgb, #16a34a 30%, var(--border)); }
.quote-box { margin-top: 10px; padding: 9px 11px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); font-size: 13px; line-height: 1.7; word-break: break-word; }
.bank-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bank-row:last-child { border-bottom: 0; }
.wrong-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.wrong-row:last-child { border-bottom: 0; }
.history-detail { margin-top: 8px; }
.history-detail summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.history-session { border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; background: var(--surface); }

.progress-line { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.progress-track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.mock-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; }
.countdown { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; min-width: 90px; }
.countdown[data-urgent="1"] { color: #b42318; }
.question-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.question-dot { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.question-dot.answered { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.question-dot.current { outline: 2px solid var(--accent); outline-offset: 1px; }

.plan-days { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.plan-day { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.plan-day.today { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.plan-date { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.plan-task { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.plan-task.done .title { text-decoration: line-through; color: var(--muted); }

@media (max-width: 900px) {
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal-card { max-height: calc(100dvh - 20px); padding: 16px; border-radius: 16px; }
  .bank-row { align-items: flex-start; }
  .bank-row > .row { width: 100%; justify-content: flex-end; }
  .mock-bar { gap: 8px; }
  .countdown { font-size: 23px; }
  .question-head .stem { font-size: 18px; }
}

/* ---------- 取色器与透明度滑块 ---------- */
.color-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
input[type="color"].color-input {
  width: 54px;
  height: 44px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  flex: 0 0 auto;
}
input[type="color"].color-input::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].color-input::-webkit-color-swatch { border: 0; border-radius: 9px; }
input[type="color"].color-input::-moz-color-swatch { border: 0; border-radius: 9px; }
.color-hex { font-size: 12.5px; color: var(--muted); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type="range"] { flex: 1; min-width: 110px; accent-color: var(--accent); }
.slider-value { min-width: 46px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
body[data-translucent="on"] .card,
body[data-translucent="on"] .stat,
body[data-translucent="on"] .plan-day { backdrop-filter: blur(16px) saturate(1.06); }

/* ---------- AI 额度确认弹窗 ---------- */
.quota-list { display: flex; flex-direction: column; }
.quota-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.quota-row:last-child { border-bottom: 0; }
.quota-key { color: var(--muted); flex: 0 0 auto; }
.quota-val { text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }

/* ---------- 试卷校对 ---------- */
.paper-card { padding: 16px 18px; }
.paper-card + .paper-card { margin-top: 12px; }
.paper-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.paper-head .paper-group { width: 150px; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.paper-head .paper-number { width: 76px; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.paper-head .paper-answer { width: 118px; min-height: 36px; padding: 6px 8px; font-size: 14px; }
.paper-stem { width: 100%; font-size: 14.5px; line-height: 1.8; min-height: 96px; }
.paper-options { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.paper-option { display: flex; align-items: center; gap: 8px; }
.paper-letter {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.paper-option input { min-height: 38px; font-size: 14px; padding: 6px 10px; }
@media (max-width: 900px) {
  .paper-head .paper-group { width: 100%; }
  .paper-head .paper-number,
  .paper-head .paper-answer { width: calc(50% - 4px); }
}




/* ---------- 题目图表 ---------- */
.question-figure { margin: 4px 0 12px; }
.question-figure img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}
.paper-figure { margin: 10px 0; }
.paper-figure img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}
/* ---------- 题库批次折叠 ---------- */
.bank-batch {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
}
.bank-batch + .bank-batch { margin-top: 10px; }
.bank-batch-head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  flex-wrap: wrap;
}
.bank-batch-head::-webkit-details-marker { display: none; }
.bank-batch-head strong { font-size: 15px; }
.bank-batch-head .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.bank-batch[open] > .bank-batch-head { margin-bottom: 4px; }
/* ---------- 选项图 ---------- */
.option-images { margin: 10px 0; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 8px 10px; }
.option-images-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.option-images-row { display: flex; gap: 8px; flex-wrap: wrap; }
.option-images-row figure { margin: 0; text-align: center; }
.option-images-row img { max-height: 96px; max-width: 180px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.option-images-row figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }
.option-image { max-height: 76px; max-width: 220px; background: #fff; border-radius: 6px; }
/* ---------- 选项划线 / 大图 / 统计条 ---------- */
.option-btn.eliminated .option-text { text-decoration: line-through; color: var(--muted); opacity: .8; }
.option-btn.eliminated .option-image { opacity: .45; filter: grayscale(1); }
.option-btn.eliminated .option-letter { text-decoration: line-through; background: var(--surface-3); }
.option-image { cursor: zoom-in; }
.question-figure img { cursor: zoom-in; }
.unit-bar { width: 120px; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; flex: 0 0 120px; }
.unit-bar span { display: block; height: 100%; background: var(--accent); }
/* ---------- 星标与笔记 ---------- */
.star-btn { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; flex: 0 0 auto; }
.star-btn.on { color: #d97706; }
.note-box { margin-top: 6px; padding: 8px 10px; border-left: 3px solid #d97706; background: #fffbeb; border-radius: 6px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
[data-mode="dark"] .note-box { background: #2a2113; border-left-color: #b45309; }
/* ---------- 应用图标设置 ---------- */
.icon-current { margin: 10px 0 12px; }
.icon-current img, .icon-fallback {
  width: 72px; height: 72px; border-radius: 18px; display: block;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.icon-fallback { display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 34px; font-weight: 600; }
.icon-presets { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-preset { border: 2px solid transparent; background: transparent; padding: 0; border-radius: 16px; cursor: pointer; line-height: 0; }
.icon-preset.on { border-color: var(--accent); }
.icon-preset img { width: 56px; height: 56px; border-radius: 14px; }
/* ---------- 长按选词工具条 ---------- */
.text-tools {
  position: fixed;
  z-index: 90;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: #1f2937;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.text-tools button {
  border: 0;
  background: transparent;
  color: #f8fafc;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.text-tools button:hover { background: rgba(255,255,255,.14); }
.memo-item { align-items: flex-start; }
/* ---------- 资料分栏 + 手写笔记 ---------- */
.material-split { display: grid; grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
.material-pane { position: sticky; top: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; max-height: 70vh; overflow: auto; }
.material-body { font-size: 14px; line-height: 1.8; white-space: pre-wrap; margin-top: 6px; }
.material-figure { width: 100%; height: auto; margin-top: 10px; border-radius: 8px; background: #fff; }
@media (max-width: 760px) {
  .material-split { grid-template-columns: 1fr; }
  .material-pane { position: static; max-height: none; }
}
.ink-toggle { position: absolute; right: 12px; top: 10px; z-index: 6; }
.ink-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ink-toggle.has-ink::after { content: '●'; color: #dc2626; font-size: 9px; margin-left: 4px; vertical-align: super; }
.ink-tools { position: absolute; right: 10px; top: 44px; z-index: 7; display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-sm); flex-wrap: wrap; }
.ink-color { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.ink-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.ink-act { border: 0; background: transparent; font-size: 12.5px; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.ink-act:hover { background: var(--surface-2); }
.ink-canvas { position: absolute; inset: 0; z-index: 5; touch-action: none; cursor: crosshair; }
.ink-canvas.hidden, .ink-tools.hidden { display: none; }
/* ---------- 笔记色轮与笔刷 ---------- */
.ink-picker { position: absolute; right: 10px; top: 82px; z-index: 8; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; box-shadow: var(--shadow-md); }
.ink-picker.hidden { display: none; }
.ink-wheel { display: block; width: 132px; height: 132px; border-radius: 50%; cursor: crosshair; }
.ink-wheel-wrap { display: grid; place-items: center; }
.ink-picker-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ink-swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); display: inline-block; }
.ink-size { width: 84px; accent-color: var(--accent); }
.ink-size-label { font-size: 12px; color: var(--muted); min-width: 34px; }
.ink-stroke-preview { width: 20px; border-radius: 999px; background: #dc2626; display: inline-block; }
.ink-sep { width: 1px; height: 16px; background: var(--border); display: inline-block; }
/* ---------- 背诵卡片 ---------- */
.flashcard { perspective: 1200px; margin-top: 14px; }
.flashcard-inner { position: relative; width: 100%; min-height: 240px; transition: transform .45s; transform-style: preserve-3d; }
.flashcard-inner.flipped { transform: rotateY(180deg); }
.flashcard-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); padding: 22px; overflow: auto; }
.flashcard-face.back { transform: rotateY(180deg); background: var(--surface-2); }
.flashcard-text { font-size: 20px; line-height: 1.7; margin: 10px 0 0; white-space: pre-wrap; }
.card-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.card-row:last-child { border-bottom: 0; }
.unit-fold { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 12px; }
.unit-fold > summary { cursor: pointer; list-style: none; }
.unit-fold > summary::-webkit-details-marker { display: none; }
.unit-fold[open] > summary { margin-bottom: 10px; }