/* StudyDesk 样式：浅色 / 儿童友好 / 大圆角 / 微动效，无 CDN 依赖 */
:root {
  --blue: #3B82F6; --blue-dark: #2563EB; --gold: #F59E0B; --green: #10B981; --red: #EF4444;
  --ink: #1E293B; --ink-2: #475569; --ink-3: #94A3B8;
  --bg: #F1F5F9; --card: #FFFFFF; --line: #E2E8F0;
  --radius: 16px; --shadow: 0 2px 10px rgba(15, 23, 42, .06);
  /* 错题排版层次专用 */
  --wq-red-bg: rgba(239, 68, 68, .08);
  --wq-green-bg: rgba(16, 185, 129, .09);
  --wq-opt-bg: #F8FAFC;
  --wq-sub-bg: #F1F5F9;
}

/* ---------- 深色模式（14.3「必备」） ---------- */
:root[data-theme="dark"] {
  --blue: #60A5FA; --blue-dark: #3B82F6; --gold: #FBBF24; --green: #34D399; --red: #F87171;
  --ink: #E5E9F0; --ink-2: #B6C2D2; --ink-3: #7E8AA0;
  --bg: #0F172A; --card: #1E293B; --line: #334155;
  --shadow: 0 2px 12px rgba(0, 0, 0, .45);
  --wq-red-bg: rgba(248, 113, 113, .14);
  --wq-green-bg: rgba(52, 211, 153, .14);
  --wq-opt-bg: rgba(148, 163, 184, .10);
  --wq-sub-bg: rgba(148, 163, 184, .08);
}

/* ---------- 护眼暖色模式（14.3「必备」） ---------- */
:root[data-theme="eye"] {
  --blue: #2F7D6B; --blue-dark: #246655; --gold: #C8852B; --green: #3C9A6E; --red: #C9534B;
  --ink: #3A3327; --ink-2: #6B5F49; --ink-3: #9A8A6F;
  --bg: #F3E9D2; --card: #FBF3E2; --line: #E2D3B3;
  --shadow: 0 2px 10px rgba(120, 95, 50, .10);
  --wq-red-bg: rgba(201, 83, 75, .10);
  --wq-green-bg: rgba(60, 154, 110, .11);
  --wq-opt-bg: rgba(120, 95, 50, .05);
  --wq-sub-bg: rgba(120, 95, 50, .07);
}

/* 深色 / 护眼下，把几处硬编码白色面覆盖为卡片色，避免刺眼白块 */
:root[data-theme="dark"] .topbar, :root[data-theme="eye"] .topbar { background: var(--card); border-color: var(--line); }
:root[data-theme="dark"] .opt, :root[data-theme="eye"] .opt { background: var(--card); }
:root[data-theme="dark"] .q-explain, :root[data-theme="eye"] .q-explain { background: var(--bg); }
:root[data-theme="dark"] .rubric-head, :root[data-theme="eye"] .rubric-head { background: linear-gradient(135deg, var(--bg), var(--line)); }
:root[data-theme="dark"] .btn.ghost, :root[data-theme="eye"] .btn.ghost { background: var(--bg); }
:root[data-theme="dark"] .tabbar, :root[data-theme="eye"] .tabbar { background: var(--card); border-color: var(--line); }
:root[data-theme="dark"] input, :root[data-theme="eye"] input,
:root[data-theme="dark"] textarea, :root[data-theme="eye"] textarea,
:root[data-theme="dark"] select, :root[data-theme="eye"] select { background: var(--card); color: var(--ink); }

/* 主题选择器（我的页） */
.theme-row { display: flex; gap: 10px; }
.theme-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); transition: border-color .15s, transform .08s; }
.theme-opt:active { transform: scale(.97); }
.theme-opt.on { border-color: var(--blue); }
.theme-opt span:last-child { font-size: 13px; color: var(--ink-2); }
.theme-opt.on span:last-child { color: var(--blue); font-weight: 600; }
.theme-swatch { width: 46px; height: 30px; border-radius: 8px; border: 1px solid var(--line); }
.theme-swatch.t-light { background: linear-gradient(135deg, #FFFFFF 50%, #F1F5F9 50%); }
.theme-swatch.t-dark { background: linear-gradient(135deg, #1E293B 50%, #0F172A 50%); }
.theme-swatch.t-eye { background: linear-gradient(135deg, #FBF3E2 50%, #F3E9D2 50%); }

/* 护眼休息页（14.2 / 11.1 防沉迷，不可跳过） */
.eye-rest { position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, .97); color: #fff; display: none; align-items: center; justify-content: center; }
.eye-rest.show { display: flex; }
.eye-rest-box { text-align: center; padding: 30px; max-width: 320px; }
.eye-emoji { font-size: 56px; }
.eye-title { font-size: 20px; font-weight: 700; margin: 12px 0; }
.eye-tip { color: #CBD5E1; font-size: 14px; line-height: 1.7; }
.eye-count { font-size: 44px; font-weight: 800; margin: 18px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.eye-sub { color: #94A3B8; font-size: 12px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }
a { color: var(--blue); text-decoration: none; }

/* ---------- 布局骨架 ---------- */
.app { max-width: 960px; margin: 0 auto; padding: 0 16px 96px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); margin: 0 -16px 16px;
}
.topbar .title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar .back { font-size: 20px; color: var(--ink-2); padding: 2px 8px; border-radius: 8px; }
.topbar .back:hover { background: var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #93C5FD, #3B82F6);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}

/* ---------- 底部 TabBar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; color: var(--ink-3); padding: 4px 0;
}
.tabbar a .ico { font-size: 22px; }
.tabbar a.on { color: var(--blue); font-weight: 600; }

/* ---------- 卡片与通用 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--ink-3); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.right { text-align: right; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  background: var(--blue); color: #fff; transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: #EFF6FF; color: var(--blue-dark); }
.btn.gold { background: var(--gold); }
.btn.green { background: var(--green); }
.btn.gray { background: var(--bg); color: var(--ink-2); }
.btn.danger { background: #FEE2E2; color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; background: var(--bg); color: var(--ink-2);
}
.chip.blue { background: #EFF6FF; color: var(--blue-dark); }
.chip.gold { background: #FEF3C7; color: #B45309; }
.chip.green { background: #D1FAE5; color: #047857; }
.chip.red { background: #FEE2E2; color: #B91C1C; }
.chip.purple { background: #EDE9FE; color: #6D28D9; }

.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); }
.field textarea { min-height: 88px; resize: vertical; }

.empty { text-align: center; color: var(--ink-3); padding: 48px 0; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .emoji { font-size: 52px; }
.login-logo h1 { font-size: 24px; margin-top: 8px; }
.login-logo p { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.demo-tip {
  margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: #EFF6FF;
  color: var(--blue-dark); font-size: 13px; text-align: center;
}

/* ---------- 工作台 ---------- */
.hero {
  background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff;
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.hero .stats { display: flex; gap: 8px; margin-top: 12px; }
.hero .stat { flex: 1; background: rgba(255,255,255,.16); border-radius: 12px; padding: 10px; text-align: center; }
.hero .stat b { font-size: 20px; display: block; }
.hero .stat span { font-size: 12px; opacity: .85; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.quick a {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 6px; text-align: center; color: var(--ink); font-size: 13px; font-weight: 600;
}
.quick a .ico { font-size: 26px; display: block; margin-bottom: 6px; }

.task-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: none; }
.task-item .t-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.task-item .t-title { font-weight: 600; font-size: 14px; }
.task-item .t-sub { font-size: 12px; color: var(--ink-3); }
.progress-ring { font-size: 13px; font-weight: 700; color: var(--blue); min-width: 44px; text-align: right; }

.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #60A5FA, #3B82F6); border-radius: 99px; transition: width .4s; }

/* ---------- 学科 ---------- */
.subj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.subj-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 10px; text-align: center; color: var(--ink);
}
.subj-card .ico { font-size: 30px; }
.subj-card .name { font-weight: 700; margin: 6px 0 2px; }
.subj-card .num { font-size: 12px; color: var(--ink-3); }

/* ---------- 错题本 ---------- */
.wq-item { display: flex; gap: 12px; padding: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.wq-item .body { flex: 1; min-width: 0; }
.wq-item .stem { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wq-item .meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wq-item .thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--bg); flex-shrink: 0; }

/* 错题列表删除按钮：整卡是链接，删除做成右上角独立小按钮（避免误触） */
.wq-item-wrap { position: relative; }
.wq-item-wrap .wq-item { margin-bottom: 0; }
.wq-item-wrap + .wq-item-wrap { margin-top: 12px; }
.wq-del-btn {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--red);
  font-size: 14px; line-height: 1; cursor: pointer; opacity: .55;
  transition: opacity .15s, background .15s;
}
.wq-del-btn:hover { opacity: 1; background: #FEF2F2; }
.wq-del-btn:active { transform: scale(.94); }

.streak-dots { display: flex; gap: 6px; align-items: center; }
.streak-dots i { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: inline-block; }
.streak-dots i.on { background: var(--green); }

/* ---------- 闪卡 ---------- */
.flash { perspective: 1200px; margin: 16px 0; }
.flash-inner {
  position: relative; width: 100%; min-height: 260px; transform-style: preserve-3d;
  transition: transform .45s;
}
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px; text-align: center;
}
.flash-face.back { transform: rotateY(180deg); background: linear-gradient(135deg, #EFF6FF, #DBEAFE); }
.flash-face .word { font-size: 24px; font-weight: 700; }
.flash-face .phon { color: var(--ink-3); margin-top: 6px; }
.flash-face .poem { font-size: 18px; line-height: 2; white-space: pre-line; }
/* ---------- 单元闯关卡片面（勿用 .flash-face：它是 absolute+inset:0，离开 .flash-inner 会铺满全屏遮住页面） ---------- */
.ch-face {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  min-height: 150px; padding: 22px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ch-face .word { font-size: 24px; font-weight: 700; }
.ch-face .poem { font-size: 18px; line-height: 2; white-space: pre-line; }
.ch-face.back { background: linear-gradient(135deg, #EFF6FF, #DBEAFE); }
.grade-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grade-btns .btn { flex-direction: column; padding: 12px 4px; font-size: 13px; }
.grade-btns .btn small { font-size: 11px; font-weight: 400; opacity: .8; }

/* ---------- 出题 ---------- */
.q-block { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.q-block .q-type { font-size: 12px; color: var(--blue-dark); font-weight: 700; margin-bottom: 6px; }
.q-block .q-stem { font-weight: 600; margin-bottom: 12px; white-space: pre-line; }
.opt {
  display: block; width: 100%; text-align: left; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); margin-bottom: 8px; background: #fff; font-size: 14px;
}
.opt.sel { border-color: var(--blue); background: #EFF6FF; }
.opt.right { border-color: var(--green); background: #D1FAE5; }
.opt.wrong { border-color: var(--red); background: #FEE2E2; }
.source-box {
  margin-top: 10px; padding: 10px 12px; background: #F8FAFC; border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0; font-size: 12px; color: var(--ink-2);
}
.score-hero { text-align: center; padding: 20px; }
.score-hero .num { font-size: 44px; font-weight: 800; color: var(--blue); }

/* ---------- 主观题量规批改面板 ---------- */
.rubric-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rubric-head { padding: 9px 12px; background: linear-gradient(135deg, #EEF2FF, #E0E7FF); color: var(--blue-dark); font-size: 13px; font-weight: 700; }
.rubric-sec { padding: 8px 12px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-2); }
.rubric-sec b { color: var(--ink); display: block; margin-bottom: 3px; }
.rubric-li { line-height: 1.5; margin: 2px 0; }

/* ---------- 商城 ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.prod {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
  text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.prod .emoji { font-size: 36px; }
.prod .name { font-weight: 700; font-size: 14px; }
.prod .pts { color: var(--gold); font-weight: 800; }
.prod .gap { font-size: 12px; color: var(--ink-3); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.pending { background: #FEF3C7; color: #B45309; }
.badge.approved { background: #D1FAE5; color: #047857; }
.badge.rejected { background: #FEE2E2; color: #B91C1C; }
.badge.redeemed { background: #DBEAFE; color: #1D4ED8; }

/* ---------- 家长模式 ---------- */
.parent-frame { border: 3px solid #1E293B; border-radius: 20px; padding: 14px; position: relative; }
.parent-flag {
  position: absolute; top: -14px; left: 16px; background: #1E293B; color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 999px;
}
.parent-frame .topbar { margin: -14px -14px 12px; border-radius: 17px 17px 0 0; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border: none; }
.kv b { font-size: 16px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: #1E293B; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.green { background: var(--green); }
#toast.info { background: #1E293B; }

/* ---------- 模态弹窗 ---------- */
#modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.modal-card {
  position: relative; width: 100%; max-width: 360px; background: var(--card);
  border-radius: var(--radius); box-shadow: 0 12px 40px rgba(15,23,42,.25); padding: 18px;
  animation: modalIn .18s ease-out;
}
.modal-card h3 { font-size: 16px; margin-bottom: 14px; }
.modal-card.wide { max-width: 560px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* Prompt 管理页 */
.pm-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-2); background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.pm-textarea {
  width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical;
}
.pm-content-preview {
  margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; color: var(--ink-2); background: var(--bg);
  padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow: auto;
}

/* 分数飘字动画 */
.float-pts {
  position: fixed; left: 50%; top: 40%; transform: translateX(-50%);
  font-size: 34px; font-weight: 800; color: var(--gold); pointer-events: none; z-index: 98;
  animation: floatUp 1.4s ease-out forwards; text-shadow: 0 2px 8px rgba(245,158,11,.35);
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.6); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-70px) scale(1); }
}

.spin { display: inline-block; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- AI 讲题（苏格拉底对话） ---------- */
.tutor-page {
  max-width: 960px; margin: 0 auto; padding: 0 16px 96px;
  display: flex; flex-direction: column; height: calc(100vh - 56px);
}
.tutor-context {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px; flex-shrink: 0;
}
.tutor-context .ctx-img { width: 100%; border-radius: 12px; margin-bottom: 8px; }
.tutor-context .ctx-stem { font-size: 16px; font-weight: 600; line-height: 1.5; }
.tutor-context .ctx-opts { margin: 8px 0; }
.tutor-context .ctx-row { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.tutor-context .ctx-answer {
  margin-top: 8px; display: none; padding-top: 8px; border-top: 1px dashed var(--line);
}
.tutor-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; flex-shrink: 0; }
.tutor-steps .ts { display: flex; align-items: center; gap: 6px; opacity: .4; font-size: 13px; transition: all .2s; }
.tutor-steps .ts.on { opacity: 1; color: var(--blue); font-weight: 600; }
.tutor-steps .ts.cur { color: var(--gold); }
.tutor-steps .ts i {
  width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: flex;
  align-items: center; justify-content: center; font-style: normal; font-size: 12px; border: 1px solid var(--line);
}
.tutor-steps .ts.on i { background: var(--blue); color: #fff; border-color: var(--blue); }
.tutor-steps .ts.cur i { background: var(--gold); color: #fff; border-color: var(--gold); }
.tutor-steps .ts-arrow { color: var(--ink-3); font-size: 12px; }
.chat {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 4px 2px; min-height: 120px;
}
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble.tutor { background: var(--card); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.bubble.student { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.tutor-done {
  text-align: center; padding: 14px; background: #ECFDF5; color: #047857; border-radius: 12px;
  font-weight: 700; display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 4px;
}
.tutor-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; flex-shrink: 0; }
.tutor-input textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none;
  min-height: 42px; max-height: 120px; line-height: 1.5;
}
.tutor-input .btn { flex-shrink: 0; padding: 10px 14px; }
.tutor-input .btn:disabled, .tutor-input textarea:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 错题组卷打印 ---------- */
@page { size: A4; margin: 14mm; }
.print-page { max-width: 980px; margin: 0 auto; padding: 12px 16px 96px; }
.print-toolbar {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 5;
}
.pt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pt-row + .pt-row { margin-top: 10px; }
.pt-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.pt-field select, .pt-field input { padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; }
.pt-field input[type=number] { width: 64px; }
.pf-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 16px; }
.pf-pick-item {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px; font-size: 13px; cursor: pointer;
}
.pf-pick-item input { flex: 0 0 auto; }
.pf-pick-subj { color: var(--blue); font-weight: 700; flex: 0 0 auto; }
.pf-pick-stem { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper {
  width: 794px; max-width: 100%; margin: 0 auto; background: #fff; color: #111;
  border: 1px solid #E5E7EB; border-radius: 6px; box-shadow: 0 6px 24px rgba(15,23,42,.12);
  padding: 40px 44px; min-height: 1000px;
}
.paper-head { border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 22px; }
.paper-title { font-size: 26px; font-weight: 800; text-align: center; letter-spacing: 4px; }
.paper-meta { margin-top: 12px; font-size: 14px; color: #374151; }
.paper-foot { margin-top: 30px; padding-top: 12px; border-top: 1px dashed #CBD5E1; font-size: 12px; color: #9CA3AF; text-align: center; }
.exam-q { display: flex; gap: 8px; padding: 14px 0; border-bottom: 1px dashed #E5E7EB; }
.exam-no { font-weight: 700; flex: 0 0 24px; }
.exam-body { flex: 1; }
.exam-stem { font-size: 16px; line-height: 1.8; color: #111; white-space: pre-wrap; }
.exam-opt { font-size: 15px; line-height: 1.9; color: #1F2937; }
.exam-blank { margin-top: 8px; font-size: 15px; color: #374151; }
.exam-answer { margin-top: 10px; padding: 8px 12px; background: #ECFDF5; border-radius: 8px; font-size: 14px; color: #065F46; }
.exam-kp { margin-top: 6px; font-size: 13px; color: #9333EA; }
.exam-analysis { margin-top: 6px; font-size: 14px; color: #374151; }
@media print {
  body { background: #fff; }
  .topbar, .tabbar, .no-print { display: none !important; }
  .print-page { max-width: none; padding: 0; margin: 0; }
  .paper { width: auto; border: none; box-shadow: none; border-radius: 0; padding: 0; min-height: 0; }
  .exam-q { break-inside: avoid; page-break-inside: avoid; }
  .paper-head { break-after: avoid; }
}

/* ---------- 学习统计 ---------- */
.stat-hero { text-align: center; padding: 16px 8px; }
.stat-hero .num { font-size: 30px; font-weight: 800; }
.stat-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.stat-label { width: 84px; flex: 0 0 auto; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-track { flex: 1; height: 12px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.stat-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #60A5FA); border-radius: 8px; transition: width .4s; }
.stat-fill.alt { background: linear-gradient(90deg, var(--red), #FCA5A5); }
.stat-num { width: 28px; flex: 0 0 auto; text-align: right; font-weight: 700; font-size: 13px; }
.trend { display: flex; align-items: flex-end; gap: 10px; height: 110px; padding-top: 10px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar { width: 60%; max-width: 28px; background: linear-gradient(180deg, var(--blue), #93C5FD); border-radius: 6px 6px 0 0; min-height: 4px; }
.trend-x { font-size: 11px; color: var(--ink-3); margin-top: 6px; }

/* ---------- 成长记录 ---------- */
.growth-hero .num { font-size: 26px; font-weight: 800; text-align: center; }
.growth-hero .muted { text-align: center; }
.heat { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0; }
.heat-cell { aspect-ratio: 1; border-radius: 6px; background: #EEF2F7; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--ink-3); overflow: hidden; }
.heat-cell.lvl-1 { background: #BBF7D0; color: #065F46; }
.heat-cell.lvl-2 { background: #6EE7B7; color: #065F46; }
.heat-cell.lvl-3 { background: #34D399; color: #064E3B; }
.heat-cell.lvl-4 { background: #059669; color: #fff; }
.heat-cell.small { width: 16px; height: 16px; display: inline-flex; aspect-ratio: auto; vertical-align: middle; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); margin-top: 4px; flex-wrap: wrap; }
.growth-list { display: flex; flex-direction: column; gap: 8px; }
.growth-li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.growth-li:last-child { border-bottom: none; }
.g-remark { font-size: 14px; }
.g-delta { font-weight: 800; font-size: 16px; }
.g-delta.plus { color: var(--green); }
.g-delta.minus { color: var(--red); }

/* ---------- 错题搜索 ---------- */
#wq-search, #wq-subject, #wq-tag {
  padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font-size: 14px; color: var(--ink);
}
#wq-search:focus, #wq-subject:focus, #wq-tag:focus { border-color: var(--blue); outline: none; }
#wq-search { min-width: 0; }
#wq-subject, #wq-tag { cursor: pointer; }

/* ---------- 记忆调度日历 ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.cal-grid.cal-head { margin-bottom: 2px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; background: #F8FAFC;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink);
}
.cal-cell.cal-wd { background: transparent; border: none; font-weight: 700; color: var(--ink-3); aspect-ratio: auto; padding: 4px 0; }
.cal-cell.cal-empty { background: transparent; border: none; }
.cal-cell.cal-past { opacity: .45; }
.cal-cell.cal-today { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,.18); font-weight: 800; }
.cal-dnum { font-variant-numeric: tabular-nums; }
.cal-none { color: #CBD5E1; }
.cal-badge {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.cal-cell.cal-today .cal-badge { background: var(--blue-dark); }
.cal-cell.cal-done { background: #D1FAE5; border-color: #34D399; }
.cal-cell.cal-miss { border: 1px dashed var(--gold); cursor: pointer; }
.cal-cell.cal-miss:hover { background: #FEF3C7; }
.cal-tag { position: absolute; bottom: 3px; right: 4px; font-size: 9px; color: #B45309; font-weight: 700; }

/* 7 个底部 Tab 时略缩字号，避免拥挤 */
.tabbar a { font-size: 11px; }
.tabbar a .ico { font-size: 20px; }

/* ---------- 工具箱 ---------- */
.page { display: block; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.tool-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 10px; text-align: center; display: flex; flex-direction: column; gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:active { transform: scale(.96); }
.tool-ico { font-size: 30px; }
.tool-name { font-weight: 700; font-size: 14px; }
.tool-desc { color: var(--ink-3); font-size: 12px; line-height: 1.4; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink-2); }
.stat-big { font-weight: 800; color: var(--blue); font-size: 16px; }
.chip-soft {
  display: inline-block; background: var(--bg); color: var(--ink-2);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; margin: 0 6px 6px 0;
}
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.add-row input, .add-row select { flex: 1; min-width: 110px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.icon-btn { font-size: 18px; padding: 4px 6px; border-radius: 8px; flex-shrink: 0; }
.icon-btn:hover { background: var(--bg); }

/* 学习计时器 */
.timer-card { text-align: center; }
.timer-face { font-size: 64px; font-weight: 800; letter-spacing: 2px; color: var(--ink); font-variant-numeric: tabular-nums; margin: 8px 0; }
.timer-presets { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.timer-presets .btn.on { border-color: var(--blue); color: var(--blue); }
.timer-actions { display: flex; gap: 10px; justify-content: center; }
.timer-byrow { margin-top: 10px; }
.timer-logs { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.timer-log { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.timer-log:last-child { border-bottom: none; }

/* 作业清单 */
.hw-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hw-item:last-child { border-bottom: none; }
.hw-item.done .hw-title { text-decoration: line-through; color: var(--ink-3); }
.hw-check input { width: 20px; height: 20px; accent-color: var(--green); }
.hw-body { flex: 1; }
.hw-title { font-size: 14px; }
.hw-meta { color: var(--ink-3); font-size: 12px; }

/* 考试倒计时 */
.exam-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exam-item:last-child { border-bottom: none; }
.exam-days { min-width: 62px; text-align: center; background: var(--bg); border-radius: 12px; padding: 8px 4px; }
.exam-days .big { display: block; font-size: 24px; font-weight: 800; color: var(--blue); }
.exam-days small { color: var(--ink-3); font-size: 11px; }
.exam-item.soon .exam-days { background: #FEF3C7; }
.exam-item.soon .exam-days .big { color: var(--gold); }
.exam-item.past .exam-days .big { color: var(--ink-3); }
.exam-body { flex: 1; }
.exam-name { font-weight: 600; font-size: 14px; }
.exam-meta { color: var(--ink-3); font-size: 12px; }

/* 成绩单 */
.line-chart { width: 100%; height: auto; }
.score-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.score-item:last-child { border-bottom: none; }
.score-item span:first-child { flex: 1; font-size: 14px; }
.score-avg { font-weight: 800; color: var(--blue); font-size: 16px; min-width: 34px; text-align: right; }

/* 阅读打卡 */
.read-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.rc-head { text-align: center; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.rc-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg); color: var(--ink-2); font-size: 12px; }
.rc-cell.empty { background: transparent; }
.rc-cell.has { background: #D1FAE5; color: #065F46; font-weight: 700; }
.read-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.read-item:last-child { border-bottom: none; }
.read-item span:nth-child(2) { flex: 1; color: var(--ink-2); }

/* 口算闪电战 */
.mental-card { text-align: center; }
.mental-top { display: flex; justify-content: space-around; margin: 8px 0; color: var(--ink-2); }
.mental-top b { color: var(--blue); font-size: 20px; }
.mental-q { font-size: 40px; font-weight: 800; padding: 20px 0; font-variant-numeric: tabular-nums; }
.mental-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.mental-row input { width: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; text-align: center; font-size: 18px; }
.mental-actions { display: flex; gap: 10px; justify-content: center; }

/* 学科管理 + banner */
.banner b { font-size: 15px; }
.banner .muted { margin-top: 2px; }
.sj-list { display: flex; flex-direction: column; gap: 8px; }
.sj-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sj-item:last-child { border-bottom: none; }
.sj-ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.sj-body { flex: 1; }
.sj-name { font-weight: 600; font-size: 14px; }
.sj-code { color: var(--ink-3); font-size: 12px; }

/* 内容安全页（§9.1） */
.stat-box { flex: 1; text-align: center; background: var(--card-2); border-radius: 14px; padding: 14px 6px; }
.bignum { font-size: 30px; font-weight: 800; color: var(--blue); line-height: 1.1; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-1); font-size: 14px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--ink-3); border-radius: 26px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 数据看板（§15 埋点与数据指标） */
.ns-card { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.ns-label { font-size: 13px; opacity: .9; }
.ns-rate { font-size: 38px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.ns-sub { font-size: 12px; opacity: .85; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin-bottom: 0; }
.card-title { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.card-main { font-size: 16px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.ev-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev-row:last-child { border-bottom: none; }
.chip.on { background: var(--blue); color: #fff; }
.pm-unread { border-left: 3px solid var(--blue); }
.dot-red { width: 9px; height: 9px; border-radius: 50%; background: #EF4444; display: inline-block; vertical-align: middle; }

/* ===== 老师端 / 班级作业（§5.9）===== */
.seg { display: flex; gap: 4px; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 9px; font-size: 14px; color: var(--ink-2); cursor: pointer; font-family: inherit; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.invite-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.invite-code { font-family: monospace; font-size: 26px; font-weight: 800; letter-spacing: 4px; color: var(--blue); }
.chip.gray { background: var(--bg); color: var(--ink-2); }
.btn.red { background: #EF4444; color: #fff; }

/* ===== 多端实时同步 · Web 大屏 ===== */
.live-board { max-width: 860px; }
.live-header { background: linear-gradient(135deg, #1E293B, #0F172A); color: #fff; border-radius: 18px; padding: 18px 20px; margin-bottom: 14px; }
.live-header h2 { margin: 8px 0 4px; font-size: 22px; }
.live-header .muted { color: rgba(255,255,255,.65); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.live-dot.on { background: #10B981; box-shadow: 0 0 0 4px rgba(16,185,129,.25); }
.live-dot.off { background: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,.25); }
.live-status { font-size: 13px; font-weight: 600; }
.live-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.live-stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; text-align: center; }
.live-stat b { display: block; font-size: 24px; font-weight: 800; color: var(--ink); }
.live-stat span { font-size: 12px; color: var(--ink-2); }
.live-feed { display: flex; flex-direction: column; gap: 8px; min-height: 300px; }
.live-event { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; animation: live-in .35s ease; }
@keyframes live-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.live-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.live-text { font-size: 15px; line-height: 1.5; color: var(--ink); }
.live-time { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
@media (max-width: 560px) { .live-stats { grid-template-columns: repeat(2, 1fr); } }


/* ================= 错题排版层次（题干 / 我的答案 / 正确答案 / 解析） =================
   原来题干直接塞进 <h3>，HTML 会把换行符折叠成空格，整段挤成一行；
   现在统一用 .wq-* 结构，靠「字号 + 颜色 + 底色」三层拉开层次。 */
.wq-q-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.wq-detail { display: flex; flex-direction: column; gap: 12px; }

/* 题干：字最大、颜色最深，保留原始换行 */
.wq-stem {
  font-size: 16.5px; line-height: 1.85; color: var(--ink); font-weight: 600;
  white-space: pre-wrap; word-break: break-word; letter-spacing: .01em;
}
.wq-stem.sm { font-size: 15.5px; line-height: 1.8; font-weight: 600; }

/* 选项：次级信息，浅底 + 细边 */
.wq-opts { display: flex; flex-direction: column; gap: 6px; }
.wq-opt {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--wq-opt-bg); font-size: 14.5px; color: var(--ink-2); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}

/* 答案区：标签是浅灰小字，值是大而醒目的彩色字 */
.wq-answers { display: flex; flex-wrap: wrap; gap: 10px; }
.wq-ans {
  flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
}
.wq-ans.mine { background: var(--wq-red-bg); }
.wq-ans.right { background: var(--wq-green-bg); }
.wq-ans-label { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.wq-ans-val { font-size: 17px; font-weight: 700; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.wq-ans.mine .wq-ans-val { color: var(--red); }
.wq-ans.right .wq-ans-val { color: var(--green); }

/* 解析：次级灰，浅底块 */
.wq-analysis { background: var(--wq-sub-bg); border-radius: 12px; padding: 12px 14px; }
.wq-analysis .wq-ans-label { display: block; margin-bottom: 4px; }
.wq-analysis-body {
  margin: 0; font-size: 14px; line-height: 1.8; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}

/* 错题列表项题干：多行保留，最多显示 2 行 */
.wq-stem-inline {
  white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 识别确认：汇总条 + 多题卡片 */
.wq-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.wq-sum-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 999px;
  background: var(--wq-red-bg); color: var(--red); font-size: 13px; font-weight: 700;
}
.wq-sum-badge.plain { background: var(--wq-green-bg); color: var(--green); }
.wq-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: var(--card); }
.wq-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.wq-no {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px;
  background: var(--wq-sub-bg); color: var(--ink-2); font-size: 12.5px; font-weight: 700;
}

/* 同类题卡片 */
.wq-analog-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 10px; background: var(--card); }
.wq-analog-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.wq-loading { padding: 14px; color: var(--ink-2); font-size: 14px; }
.wq-hint {
  padding: 14px; border-radius: 12px; background: var(--wq-sub-bg);
  color: var(--ink-2); font-size: 14px; line-height: 1.7;
}
/* StudyDesk 样式：浅色 / 儿童友好 / 大圆角 / 微动效，无 CDN 依赖 */
:root {
  --blue: #3B82F6; --blue-dark: #2563EB; --gold: #F59E0B; --green: #10B981; --red: #EF4444;
  --ink: #1E293B; --ink-2: #475569; --ink-3: #94A3B8;
  --bg: #F1F5F9; --card: #FFFFFF; --line: #E2E8F0;
  --radius: 16px; --shadow: 0 2px 10px rgba(15, 23, 42, .06);
  /* 错题排版层次专用 */
  --wq-red-bg: rgba(239, 68, 68, .08);
  --wq-green-bg: rgba(16, 185, 129, .09);
  --wq-opt-bg: #F8FAFC;
  --wq-sub-bg: #F1F5F9;
}

/* ---------- 深色模式（14.3「必备」） ---------- */
:root[data-theme="dark"] {
  --blue: #60A5FA; --blue-dark: #3B82F6; --gold: #FBBF24; --green: #34D399; --red: #F87171;
  --ink: #E5E9F0; --ink-2: #B6C2D2; --ink-3: #7E8AA0;
  --bg: #0F172A; --card: #1E293B; --line: #334155;
  --shadow: 0 2px 12px rgba(0, 0, 0, .45);
  --wq-red-bg: rgba(248, 113, 113, .14);
  --wq-green-bg: rgba(52, 211, 153, .14);
  --wq-opt-bg: rgba(148, 163, 184, .10);
  --wq-sub-bg: rgba(148, 163, 184, .08);
}

/* ---------- 护眼暖色模式（14.3「必备」） ---------- */
:root[data-theme="eye"] {
  --blue: #2F7D6B; --blue-dark: #246655; --gold: #C8852B; --green: #3C9A6E; --red: #C9534B;
  --ink: #3A3327; --ink-2: #6B5F49; --ink-3: #9A8A6F;
  --bg: #F3E9D2; --card: #FBF3E2; --line: #E2D3B3;
  --shadow: 0 2px 10px rgba(120, 95, 50, .10);
  --wq-red-bg: rgba(201, 83, 75, .10);
  --wq-green-bg: rgba(60, 154, 110, .11);
  --wq-opt-bg: rgba(120, 95, 50, .05);
  --wq-sub-bg: rgba(120, 95, 50, .07);
}

/* 深色 / 护眼下，把几处硬编码白色面覆盖为卡片色，避免刺眼白块 */
:root[data-theme="dark"] .topbar, :root[data-theme="eye"] .topbar { background: var(--card); border-color: var(--line); }
:root[data-theme="dark"] .opt, :root[data-theme="eye"] .opt { background: var(--card); }
:root[data-theme="dark"] .q-explain, :root[data-theme="eye"] .q-explain { background: var(--bg); }
:root[data-theme="dark"] .rubric-head, :root[data-theme="eye"] .rubric-head { background: linear-gradient(135deg, var(--bg), var(--line)); }
:root[data-theme="dark"] .btn.ghost, :root[data-theme="eye"] .btn.ghost { background: var(--bg); }
:root[data-theme="dark"] .tabbar, :root[data-theme="eye"] .tabbar { background: var(--card); border-color: var(--line); }
:root[data-theme="dark"] input, :root[data-theme="eye"] input,
:root[data-theme="dark"] textarea, :root[data-theme="eye"] textarea,
:root[data-theme="dark"] select, :root[data-theme="eye"] select { background: var(--card); color: var(--ink); }

/* 主题选择器（我的页） */
.theme-row { display: flex; gap: 10px; }
.theme-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); transition: border-color .15s, transform .08s; }
.theme-opt:active { transform: scale(.97); }
.theme-opt.on { border-color: var(--blue); }
.theme-opt span:last-child { font-size: 13px; color: var(--ink-2); }
.theme-opt.on span:last-child { color: var(--blue); font-weight: 600; }
.theme-swatch { width: 46px; height: 30px; border-radius: 8px; border: 1px solid var(--line); }
.theme-swatch.t-light { background: linear-gradient(135deg, #FFFFFF 50%, #F1F5F9 50%); }
.theme-swatch.t-dark { background: linear-gradient(135deg, #1E293B 50%, #0F172A 50%); }
.theme-swatch.t-eye { background: linear-gradient(135deg, #FBF3E2 50%, #F3E9D2 50%); }

/* 护眼休息页（14.2 / 11.1 防沉迷，不可跳过） */
.eye-rest { position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, .97); color: #fff; display: none; align-items: center; justify-content: center; }
.eye-rest.show { display: flex; }
.eye-rest-box { text-align: center; padding: 30px; max-width: 320px; }
.eye-emoji { font-size: 56px; }
.eye-title { font-size: 20px; font-weight: 700; margin: 12px 0; }
.eye-tip { color: #CBD5E1; font-size: 14px; line-height: 1.7; }
.eye-count { font-size: 44px; font-weight: 800; margin: 18px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.eye-sub { color: #94A3B8; font-size: 12px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }
a { color: var(--blue); text-decoration: none; }

/* ---------- 布局骨架 ---------- */
.app { max-width: 960px; margin: 0 auto; padding: 0 16px 96px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); margin: 0 -16px 16px;
}
.topbar .title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar .back { font-size: 20px; color: var(--ink-2); padding: 2px 8px; border-radius: 8px; }
.topbar .back:hover { background: var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #93C5FD, #3B82F6);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}

/* ---------- 底部 TabBar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; color: var(--ink-3); padding: 4px 0;
}
.tabbar a .ico { font-size: 22px; }
.tabbar a.on { color: var(--blue); font-weight: 600; }

/* ---------- 卡片与通用 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--ink-3); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.right { text-align: right; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; font-size: 15px; font-weight: 600;
  background: var(--blue); color: #fff; transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: #EFF6FF; color: var(--blue-dark); }
.btn.gold { background: var(--gold); }
.btn.green { background: var(--green); }
.btn.gray { background: var(--bg); color: var(--ink-2); }
.btn.danger { background: #FEE2E2; color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; background: var(--bg); color: var(--ink-2);
}
.chip.blue { background: #EFF6FF; color: var(--blue-dark); }
.chip.gold { background: #FEF3C7; color: #B45309; }
.chip.green { background: #D1FAE5; color: #047857; }
.chip.red { background: #FEE2E2; color: #B91C1C; }
.chip.purple { background: #EDE9FE; color: #6D28D9; }

.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); }
.field textarea { min-height: 88px; resize: vertical; }

.empty { text-align: center; color: var(--ink-3); padding: 48px 0; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .emoji { font-size: 52px; }
.login-logo h1 { font-size: 24px; margin-top: 8px; }
.login-logo p { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.demo-tip {
  margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: #EFF6FF;
  color: var(--blue-dark); font-size: 13px; text-align: center;
}

/* ---------- 工作台 ---------- */
.hero {
  background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff;
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.hero .stats { display: flex; gap: 8px; margin-top: 12px; }
.hero .stat { flex: 1; background: rgba(255,255,255,.16); border-radius: 12px; padding: 10px; text-align: center; }
.hero .stat b { font-size: 20px; display: block; }
.hero .stat span { font-size: 12px; opacity: .85; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.quick a {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 6px; text-align: center; color: var(--ink); font-size: 13px; font-weight: 600;
}
.quick a .ico { font-size: 26px; display: block; margin-bottom: 6px; }

.task-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: none; }
.task-item .t-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.task-item .t-title { font-weight: 600; font-size: 14px; }
.task-item .t-sub { font-size: 12px; color: var(--ink-3); }
.progress-ring { font-size: 13px; font-weight: 700; color: var(--blue); min-width: 44px; text-align: right; }

.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #60A5FA, #3B82F6); border-radius: 99px; transition: width .4s; }

/* ---------- 学科 ---------- */
.subj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.subj-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 10px; text-align: center; color: var(--ink);
}
.subj-card .ico { font-size: 30px; }
.subj-card .name { font-weight: 700; margin: 6px 0 2px; }
.subj-card .num { font-size: 12px; color: var(--ink-3); }

/* ---------- 错题本 ---------- */
.wq-item { display: flex; gap: 12px; padding: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.wq-item .body { flex: 1; min-width: 0; }
.wq-item .stem { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wq-item .meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wq-item .thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--bg); flex-shrink: 0; }

/* 错题列表删除按钮：整卡是链接，删除做成右上角独立小按钮（避免误触） */
.wq-item-wrap { position: relative; }
.wq-item-wrap .wq-item { margin-bottom: 0; }
.wq-item-wrap + .wq-item-wrap { margin-top: 12px; }
.wq-del-btn {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--red);
  font-size: 14px; line-height: 1; cursor: pointer; opacity: .55;
  transition: opacity .15s, background .15s;
}
.wq-del-btn:hover { opacity: 1; background: #FEF2F2; }
.wq-del-btn:active { transform: scale(.94); }

.streak-dots { display: flex; gap: 6px; align-items: center; }
.streak-dots i { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: inline-block; }
.streak-dots i.on { background: var(--green); }

/* ---------- 闪卡 ---------- */
.flash { perspective: 1200px; margin: 16px 0; }
.flash-inner {
  position: relative; width: 100%; min-height: 260px; transform-style: preserve-3d;
  transition: transform .45s;
}
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px; text-align: center;
}
.flash-face.back { transform: rotateY(180deg); background: linear-gradient(135deg, #EFF6FF, #DBEAFE); }
.flash-face .word { font-size: 24px; font-weight: 700; }
.flash-face .phon { color: var(--ink-3); margin-top: 6px; }
.flash-face .poem { font-size: 18px; line-height: 2; white-space: pre-line; }
/* ---------- 单元闯关卡片面（勿用 .flash-face：它是 absolute+inset:0，离开 .flash-inner 会铺满全屏遮住页面） ---------- */
.ch-face {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  min-height: 150px; padding: 22px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ch-face .word { font-size: 24px; font-weight: 700; }
.ch-face .poem { font-size: 18px; line-height: 2; white-space: pre-line; }
.ch-face.back { background: linear-gradient(135deg, #EFF6FF, #DBEAFE); }
.grade-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grade-btns .btn { flex-direction: column; padding: 12px 4px; font-size: 13px; }
.grade-btns .btn small { font-size: 11px; font-weight: 400; opacity: .8; }

/* ---------- 出题 ---------- */
.q-block { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.q-block .q-type { font-size: 12px; color: var(--blue-dark); font-weight: 700; margin-bottom: 6px; }
.q-block .q-stem { font-weight: 600; margin-bottom: 12px; white-space: pre-line; }
.opt {
  display: block; width: 100%; text-align: left; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); margin-bottom: 8px; background: #fff; font-size: 14px;
}
.opt.sel { border-color: var(--blue); background: #EFF6FF; }
.opt.right { border-color: var(--green); background: #D1FAE5; }
.opt.wrong { border-color: var(--red); background: #FEE2E2; }
.source-box {
  margin-top: 10px; padding: 10px 12px; background: #F8FAFC; border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0; font-size: 12px; color: var(--ink-2);
}
.score-hero { text-align: center; padding: 20px; }
.score-hero .num { font-size: 44px; font-weight: 800; color: var(--blue); }

/* ---------- 主观题量规批改面板 ---------- */
.rubric-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rubric-head { padding: 9px 12px; background: linear-gradient(135deg, #EEF2FF, #E0E7FF); color: var(--blue-dark); font-size: 13px; font-weight: 700; }
.rubric-sec { padding: 8px 12px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-2); }
.rubric-sec b { color: var(--ink); display: block; margin-bottom: 3px; }
.rubric-li { line-height: 1.5; margin: 2px 0; }

/* ---------- 商城 ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.prod {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
  text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.prod .emoji { font-size: 36px; }
.prod .name { font-weight: 700; font-size: 14px; }
.prod .pts { color: var(--gold); font-weight: 800; }
.prod .gap { font-size: 12px; color: var(--ink-3); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.pending { background: #FEF3C7; color: #B45309; }
.badge.approved { background: #D1FAE5; color: #047857; }
.badge.rejected { background: #FEE2E2; color: #B91C1C; }
.badge.redeemed { background: #DBEAFE; color: #1D4ED8; }

/* ---------- 家长模式 ---------- */
.parent-frame { border: 3px solid #1E293B; border-radius: 20px; padding: 14px; position: relative; }
.parent-flag {
  position: absolute; top: -14px; left: 16px; background: #1E293B; color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 999px;
}
.parent-frame .topbar { margin: -14px -14px 12px; border-radius: 17px 17px 0 0; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border: none; }
.kv b { font-size: 16px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: #1E293B; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.green { background: var(--green); }
#toast.info { background: #1E293B; }

/* ---------- 模态弹窗 ---------- */
#modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.modal-card {
  position: relative; width: 100%; max-width: 360px; background: var(--card);
  border-radius: var(--radius); box-shadow: 0 12px 40px rgba(15,23,42,.25); padding: 18px;
  animation: modalIn .18s ease-out;
}
.modal-card h3 { font-size: 16px; margin-bottom: 14px; }
.modal-card.wide { max-width: 560px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* Prompt 管理页 */
.pm-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-2); background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.pm-textarea {
  width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical;
}
.pm-content-preview {
  margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; color: var(--ink-2); background: var(--bg);
  padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow: auto;
}

/* 分数飘字动画 */
.float-pts {
  position: fixed; left: 50%; top: 40%; transform: translateX(-50%);
  font-size: 34px; font-weight: 800; color: var(--gold); pointer-events: none; z-index: 98;
  animation: floatUp 1.4s ease-out forwards; text-shadow: 0 2px 8px rgba(245,158,11,.35);
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.6); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-70px) scale(1); }
}

.spin { display: inline-block; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- AI 讲题（苏格拉底对话） ---------- */
.tutor-page {
  max-width: 960px; margin: 0 auto; padding: 0 16px 96px;
  display: flex; flex-direction: column; height: calc(100vh - 56px);
}
.tutor-context {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px; flex-shrink: 0;
}
.tutor-context .ctx-img { width: 100%; border-radius: 12px; margin-bottom: 8px; }
.tutor-context .ctx-stem { font-size: 16px; font-weight: 600; line-height: 1.5; }
.tutor-context .ctx-opts { margin: 8px 0; }
.tutor-context .ctx-row { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.tutor-context .ctx-answer {
  margin-top: 8px; display: none; padding-top: 8px; border-top: 1px dashed var(--line);
}
.tutor-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; flex-shrink: 0; }
.tutor-steps .ts { display: flex; align-items: center; gap: 6px; opacity: .4; font-size: 13px; transition: all .2s; }
.tutor-steps .ts.on { opacity: 1; color: var(--blue); font-weight: 600; }
.tutor-steps .ts.cur { color: var(--gold); }
.tutor-steps .ts i {
  width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: flex;
  align-items: center; justify-content: center; font-style: normal; font-size: 12px; border: 1px solid var(--line);
}
.tutor-steps .ts.on i { background: var(--blue); color: #fff; border-color: var(--blue); }
.tutor-steps .ts.cur i { background: var(--gold); color: #fff; border-color: var(--gold); }
.tutor-steps .ts-arrow { color: var(--ink-3); font-size: 12px; }
.chat {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 4px 2px; min-height: 120px;
}
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble.tutor { background: var(--card); align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.bubble.student { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.tutor-done {
  text-align: center; padding: 14px; background: #ECFDF5; color: #047857; border-radius: 12px;
  font-weight: 700; display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 4px;
}
.tutor-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; flex-shrink: 0; }
.tutor-input textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none;
  min-height: 42px; max-height: 120px; line-height: 1.5;
}
.tutor-input .btn { flex-shrink: 0; padding: 10px 14px; }
.tutor-input .btn:disabled, .tutor-input textarea:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 错题组卷打印 ---------- */
@page { size: A4; margin: 14mm; }
.print-page { max-width: 980px; margin: 0 auto; padding: 12px 16px 96px; }
.print-toolbar {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow);
  position: sticky; top: 64px; z-index: 5;
}
.pt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pt-row + .pt-row { margin-top: 10px; }
.pt-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.pt-field select, .pt-field input { padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; }
.pt-field input[type=number] { width: 64px; }
.pf-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 16px; }
.pf-pick-item {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px; font-size: 13px; cursor: pointer;
}
.pf-pick-item input { flex: 0 0 auto; }
.pf-pick-subj { color: var(--blue); font-weight: 700; flex: 0 0 auto; }
.pf-pick-stem { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper {
  width: 794px; max-width: 100%; margin: 0 auto; background: #fff; color: #111;
  border: 1px solid #E5E7EB; border-radius: 6px; box-shadow: 0 6px 24px rgba(15,23,42,.12);
  padding: 40px 44px; min-height: 1000px;
}
.paper-head { border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 22px; }
.paper-title { font-size: 26px; font-weight: 800; text-align: center; letter-spacing: 4px; }
.paper-meta { margin-top: 12px; font-size: 14px; color: #374151; }
.paper-foot { margin-top: 30px; padding-top: 12px; border-top: 1px dashed #CBD5E1; font-size: 12px; color: #9CA3AF; text-align: center; }
.exam-q { display: flex; gap: 8px; padding: 14px 0; border-bottom: 1px dashed #E5E7EB; }
.exam-no { font-weight: 700; flex: 0 0 24px; }
.exam-body { flex: 1; }
.exam-stem { font-size: 16px; line-height: 1.8; color: #111; white-space: pre-wrap; }
.exam-opt { font-size: 15px; line-height: 1.9; color: #1F2937; }
.exam-blank { margin-top: 8px; font-size: 15px; color: #374151; }
.exam-answer { margin-top: 10px; padding: 8px 12px; background: #ECFDF5; border-radius: 8px; font-size: 14px; color: #065F46; }
.exam-kp { margin-top: 6px; font-size: 13px; color: #9333EA; }
.exam-analysis { margin-top: 6px; font-size: 14px; color: #374151; }
@media print {
  body { background: #fff; }
  .topbar, .tabbar, .no-print { display: none !important; }
  .print-page { max-width: none; padding: 0; margin: 0; }
  .paper { width: auto; border: none; box-shadow: none; border-radius: 0; padding: 0; min-height: 0; }
  .exam-q { break-inside: avoid; page-break-inside: avoid; }
  .paper-head { break-after: avoid; }
}

/* ---------- 学习统计 ---------- */
.stat-hero { text-align: center; padding: 16px 8px; }
.stat-hero .num { font-size: 30px; font-weight: 800; }
.stat-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.stat-label { width: 84px; flex: 0 0 auto; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-track { flex: 1; height: 12px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.stat-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #60A5FA); border-radius: 8px; transition: width .4s; }
.stat-fill.alt { background: linear-gradient(90deg, var(--red), #FCA5A5); }
.stat-num { width: 28px; flex: 0 0 auto; text-align: right; font-weight: 700; font-size: 13px; }
.trend { display: flex; align-items: flex-end; gap: 10px; height: 110px; padding-top: 10px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar { width: 60%; max-width: 28px; background: linear-gradient(180deg, var(--blue), #93C5FD); border-radius: 6px 6px 0 0; min-height: 4px; }
.trend-x { font-size: 11px; color: var(--ink-3); margin-top: 6px; }

/* ---------- 成长记录 ---------- */
.growth-hero .num { font-size: 26px; font-weight: 800; text-align: center; }
.growth-hero .muted { text-align: center; }
.heat { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0; }
.heat-cell { aspect-ratio: 1; border-radius: 6px; background: #EEF2F7; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--ink-3); overflow: hidden; }
.heat-cell.lvl-1 { background: #BBF7D0; color: #065F46; }
.heat-cell.lvl-2 { background: #6EE7B7; color: #065F46; }
.heat-cell.lvl-3 { background: #34D399; color: #064E3B; }
.heat-cell.lvl-4 { background: #059669; color: #fff; }
.heat-cell.small { width: 16px; height: 16px; display: inline-flex; aspect-ratio: auto; vertical-align: middle; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); margin-top: 4px; flex-wrap: wrap; }
.growth-list { display: flex; flex-direction: column; gap: 8px; }
.growth-li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.growth-li:last-child { border-bottom: none; }
.g-remark { font-size: 14px; }
.g-delta { font-weight: 800; font-size: 16px; }
.g-delta.plus { color: var(--green); }
.g-delta.minus { color: var(--red); }

/* ---------- 错题搜索 ---------- */
#wq-search, #wq-subject, #wq-tag {
  padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; font-size: 14px; color: var(--ink);
}
#wq-search:focus, #wq-subject:focus, #wq-tag:focus { border-color: var(--blue); outline: none; }
#wq-search { min-width: 0; }
#wq-subject, #wq-tag { cursor: pointer; }

/* ---------- 记忆调度日历 ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.cal-grid.cal-head { margin-bottom: 2px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; background: #F8FAFC;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink);
}
.cal-cell.cal-wd { background: transparent; border: none; font-weight: 700; color: var(--ink-3); aspect-ratio: auto; padding: 4px 0; }
.cal-cell.cal-empty { background: transparent; border: none; }
.cal-cell.cal-past { opacity: .45; }
.cal-cell.cal-today { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(59,130,246,.18); font-weight: 800; }
.cal-dnum { font-variant-numeric: tabular-nums; }
.cal-none { color: #CBD5E1; }
.cal-badge {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.cal-cell.cal-today .cal-badge { background: var(--blue-dark); }
.cal-cell.cal-done { background: #D1FAE5; border-color: #34D399; }
.cal-cell.cal-miss { border: 1px dashed var(--gold); cursor: pointer; }
.cal-cell.cal-miss:hover { background: #FEF3C7; }
.cal-tag { position: absolute; bottom: 3px; right: 4px; font-size: 9px; color: #B45309; font-weight: 700; }

/* 7 个底部 Tab 时略缩字号，避免拥挤 */
.tabbar a { font-size: 11px; }
.tabbar a .ico { font-size: 20px; }

/* ---------- 工具箱 ---------- */
.page { display: block; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.tool-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 10px; text-align: center; display: flex; flex-direction: column; gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:active { transform: scale(.96); }
.tool-ico { font-size: 30px; }
.tool-name { font-weight: 700; font-size: 14px; }
.tool-desc { color: var(--ink-3); font-size: 12px; line-height: 1.4; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink-2); }
.stat-big { font-weight: 800; color: var(--blue); font-size: 16px; }
.chip-soft {
  display: inline-block; background: var(--bg); color: var(--ink-2);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; margin: 0 6px 6px 0;
}
.add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.add-row input, .add-row select { flex: 1; min-width: 110px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.icon-btn { font-size: 18px; padding: 4px 6px; border-radius: 8px; flex-shrink: 0; }
.icon-btn:hover { background: var(--bg); }

/* 学习计时器 */
.timer-card { text-align: center; }
.timer-face { font-size: 64px; font-weight: 800; letter-spacing: 2px; color: var(--ink); font-variant-numeric: tabular-nums; margin: 8px 0; }
.timer-presets { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.timer-presets .btn.on { border-color: var(--blue); color: var(--blue); }
.timer-actions { display: flex; gap: 10px; justify-content: center; }
.timer-byrow { margin-top: 10px; }
.timer-logs { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.timer-log { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.timer-log:last-child { border-bottom: none; }

/* 作业清单 */
.hw-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hw-item:last-child { border-bottom: none; }
.hw-item.done .hw-title { text-decoration: line-through; color: var(--ink-3); }
.hw-check input { width: 20px; height: 20px; accent-color: var(--green); }
.hw-body { flex: 1; }
.hw-title { font-size: 14px; }
.hw-meta { color: var(--ink-3); font-size: 12px; }

/* 考试倒计时 */
.exam-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exam-item:last-child { border-bottom: none; }
.exam-days { min-width: 62px; text-align: center; background: var(--bg); border-radius: 12px; padding: 8px 4px; }
.exam-days .big { display: block; font-size: 24px; font-weight: 800; color: var(--blue); }
.exam-days small { color: var(--ink-3); font-size: 11px; }
.exam-item.soon .exam-days { background: #FEF3C7; }
.exam-item.soon .exam-days .big { color: var(--gold); }
.exam-item.past .exam-days .big { color: var(--ink-3); }
.exam-body { flex: 1; }
.exam-name { font-weight: 600; font-size: 14px; }
.exam-meta { color: var(--ink-3); font-size: 12px; }

/* 成绩单 */
.line-chart { width: 100%; height: auto; }
.score-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.score-item:last-child { border-bottom: none; }
.score-item span:first-child { flex: 1; font-size: 14px; }
.score-avg { font-weight: 800; color: var(--blue); font-size: 16px; min-width: 34px; text-align: right; }

/* 阅读打卡 */
.read-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.rc-head { text-align: center; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.rc-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg); color: var(--ink-2); font-size: 12px; }
.rc-cell.empty { background: transparent; }
.rc-cell.has { background: #D1FAE5; color: #065F46; font-weight: 700; }
.read-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.read-item:last-child { border-bottom: none; }
.read-item span:nth-child(2) { flex: 1; color: var(--ink-2); }

/* 口算闪电战 */
.mental-card { text-align: center; }
.mental-top { display: flex; justify-content: space-around; margin: 8px 0; color: var(--ink-2); }
.mental-top b { color: var(--blue); font-size: 20px; }
.mental-q { font-size: 40px; font-weight: 800; padding: 20px 0; font-variant-numeric: tabular-nums; }
.mental-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.mental-row input { width: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; text-align: center; font-size: 18px; }
.mental-actions { display: flex; gap: 10px; justify-content: center; }

/* 学科管理 + banner */
.banner b { font-size: 15px; }
.banner .muted { margin-top: 2px; }
.sj-list { display: flex; flex-direction: column; gap: 8px; }
.sj-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sj-item:last-child { border-bottom: none; }
.sj-ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.sj-body { flex: 1; }
.sj-name { font-weight: 600; font-size: 14px; }
.sj-code { color: var(--ink-3); font-size: 12px; }

/* 内容安全页（§9.1） */
.stat-box { flex: 1; text-align: center; background: var(--card-2); border-radius: 14px; padding: 14px 6px; }
.bignum { font-size: 30px; font-weight: 800; color: var(--blue); line-height: 1.1; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-1); font-size: 14px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--ink-3); border-radius: 26px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 数据看板（§15 埋点与数据指标） */
.ns-card { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.ns-label { font-size: 13px; opacity: .9; }
.ns-rate { font-size: 38px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.ns-sub { font-size: 12px; opacity: .85; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin-bottom: 0; }
.card-title { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.card-main { font-size: 16px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.ev-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev-row:last-child { border-bottom: none; }
.chip.on { background: var(--blue); color: #fff; }
.pm-unread { border-left: 3px solid var(--blue); }
.dot-red { width: 9px; height: 9px; border-radius: 50%; background: #EF4444; display: inline-block; vertical-align: middle; }

/* ===== 老师端 / 班级作业（§5.9）===== */
.seg { display: flex; gap: 4px; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 9px; font-size: 14px; color: var(--ink-2); cursor: pointer; font-family: inherit; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.invite-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.invite-code { font-family: monospace; font-size: 26px; font-weight: 800; letter-spacing: 4px; color: var(--blue); }
.chip.gray { background: var(--bg); color: var(--ink-2); }
.btn.red { background: #EF4444; color: #fff; }

/* ===== 多端实时同步 · Web 大屏 ===== */
.live-board { max-width: 860px; }
.live-header { background: linear-gradient(135deg, #1E293B, #0F172A); color: #fff; border-radius: 18px; padding: 18px 20px; margin-bottom: 14px; }
.live-header h2 { margin: 8px 0 4px; font-size: 22px; }
.live-header .muted { color: rgba(255,255,255,.65); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.live-dot.on { background: #10B981; box-shadow: 0 0 0 4px rgba(16,185,129,.25); }
.live-dot.off { background: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,.25); }
.live-status { font-size: 13px; font-weight: 600; }
.live-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.live-stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; text-align: center; }
.live-stat b { display: block; font-size: 24px; font-weight: 800; color: var(--ink); }
.live-stat span { font-size: 12px; color: var(--ink-2); }
.live-feed { display: flex; flex-direction: column; gap: 8px; min-height: 300px; }
.live-event { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; animation: live-in .35s ease; }
@keyframes live-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.live-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.live-text { font-size: 15px; line-height: 1.5; color: var(--ink); }
.live-time { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
@media (max-width: 560px) { .live-stats { grid-template-columns: repeat(2, 1fr); } }


/* ================= 错题排版层次（题干 / 我的答案 / 正确答案 / 解析） =================
   原来题干直接塞进 <h3>，HTML 会把换行符折叠成空格，整段挤成一行；
   现在统一用 .wq-* 结构，靠「字号 + 颜色 + 底色」三层拉开层次。 */
.wq-q-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.wq-detail { display: flex; flex-direction: column; gap: 12px; }

/* 题干：字最大、颜色最深，保留原始换行 */
.wq-stem {
  font-size: 16.5px; line-height: 1.85; color: var(--ink); font-weight: 600;
  white-space: pre-wrap; word-break: break-word; letter-spacing: .01em;
}
.wq-stem.sm { font-size: 15.5px; line-height: 1.8; font-weight: 600; }

/* 选项：次级信息，浅底 + 细边 */
.wq-opts { display: flex; flex-direction: column; gap: 6px; }
.wq-opt {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--wq-opt-bg); font-size: 14.5px; color: var(--ink-2); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}

/* 答案区：标签是浅灰小字，值是大而醒目的彩色字 */
.wq-answers { display: flex; flex-wrap: wrap; gap: 10px; }
.wq-ans {
  flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
}
.wq-ans.mine { background: var(--wq-red-bg); }
.wq-ans.right { background: var(--wq-green-bg); }
.wq-ans-label { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.wq-ans-val { font-size: 17px; font-weight: 700; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.wq-ans.mine .wq-ans-val { color: var(--red); }
.wq-ans.right .wq-ans-val { color: var(--green); }

/* 解析：次级灰，浅底块 */
.wq-analysis { background: var(--wq-sub-bg); border-radius: 12px; padding: 12px 14px; }
.wq-analysis .wq-ans-label { display: block; margin-bottom: 4px; }
.wq-analysis-body {
  margin: 0; font-size: 14px; line-height: 1.8; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}

/* 错题列表项题干：多行保留，最多显示 2 行 */
.wq-stem-inline {
  white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 识别确认：汇总条 + 多题卡片 */
.wq-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.wq-sum-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 999px;
  background: var(--wq-red-bg); color: var(--red); font-size: 13px; font-weight: 700;
}
.wq-sum-badge.plain { background: var(--wq-green-bg); color: var(--green); }
.wq-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: var(--card); }
.wq-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.wq-no {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px;
  background: var(--wq-sub-bg); color: var(--ink-2); font-size: 12.5px; font-weight: 700;
}

/* 同类题卡片 */
.wq-analog-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 10px; background: var(--card); }
.wq-analog-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.wq-loading { padding: 14px; color: var(--ink-2); font-size: 14px; }
.wq-hint {
  padding: 14px; border-radius: 12px; background: var(--wq-sub-bg);
  color: var(--ink-2); font-size: 14px; line-height: 1.7;
}

/* 本地识别低质量提示（云端降级时） */
.wq-warn {
  background: var(--wq-red-bg); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px;
  font-size: 13.5px; line-height: 1.7; color: var(--ink-2);
}
.wq-warn b { color: var(--ink); }

/* ============================================================
   移动端适配块（v1.28）
   说明：原生 SPA 桌面优先，此处仅针对窄屏做「后定义覆盖」，
   不影响桌面/平板布局。家长态底部 tab 多达 11 个，必须可横滑。
   ============================================================ */

/* ---------- 平板/手机：≤ 640px ---------- */
@media (max-width: 640px) {
  /* 容器收紧，给底部 tabbar 留位 */
  .app { padding: 0 12px 80px; }

  /* 卡片内距略减 */
  .card { padding: 14px; margin-bottom: 12px; }
  .card h3 { font-size: 15px; }

  /* 顶部标题省略，防止长标题撑破 */
  .topbar .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 底部 TabBar：横向滚动 + 增大热区（家长态 11 个 tab 不拥挤） */
  .tabbar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    scrollbar-width: none;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar a {
    flex: 0 0 auto;
    min-width: 60px;
    padding: 7px 4px;            /* 热区高度 ≈ 52px，拇指友好 */
    font-size: 11px;
    gap: 2px;
  }
  .tabbar a .ico { font-size: 21px; }

  /* 4 列网格降 2 列，避免窄屏挤压 */
  .quick, .grade-btns, .live-stats { grid-template-columns: repeat(2, 1fr); }
  /* 3 列网格降 2 列 */
  .subj-grid, .tool-grid { grid-template-columns: repeat(2, 1fr); }

  /* 内联表格横向滚动（如 pk-table），不换行保证可读 */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table td, table th { white-space: nowrap; }
}

/* ---------- 小手机：≤ 480px ---------- */
@media (max-width: 480px) {
  /* 弹窗底部弹出（iOS 风格），全屏化，单手可达 */
  #modal-root { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: none;
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    animation: modalSheetIn .2s ease-out;
  }
  .modal-card.wide { max-width: none; }
  @keyframes modalSheetIn {
    from { opacity: .6; transform: translateY(20px); }
    to   { opacity: 1; transform: none; }
  }

  /* 更小屏进一步收紧 */
  .app { padding: 0 10px 78px; }
  .card { padding: 12px; }
  .btn { padding: 11px 14px; font-size: 15px; }
}

/* ---------- 超小屏：≤ 360px ---------- */
@media (max-width: 360px) {
  .tabbar a { min-width: 54px; font-size: 10px; }
  .tabbar a .ico { font-size: 19px; }
  .subj-grid, .tool-grid, .quick, .grade-btns, .live-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- AI 智能判卷（§9.x） ---------- */
.gd-prev { flex: 0 0 auto; }
.gd-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; white-space: pre-wrap; word-break: break-word; line-height: 1.6;
  max-height: 220px; overflow: auto;
}
.gd-analog {
  background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
  padding: 8px 10px; margin-top: 6px; font-size: 13px; line-height: 1.6;
}
.gd-analog + .gd-analog { margin-top: 6px; }
.wq-card-head .chip.blue { background: var(--blue); color: #fff; }
.wq-card-head .chip.blue input { vertical-align: middle; margin-right: 4px; }
/* 判卷模式切换（对照判分 / AI 直判） */
.gd-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gd-mode { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  cursor: pointer; font-size: 14px; line-height: 1.4; }
.gd-mode span { font-size: 12px; }
.gd-mode.on { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--card)); }
@media (max-width: 640px) { .gd-modes { grid-template-columns: 1fr; } }

/* ---------- v1.38：doc 类型长段落闪卡适配 ----------
   .flash-face 是 absolute+inset:0，内容超过 min-height:260px 时会溢出遮住评分按钮（老坑再现）。
   doc 类型改用滚动布局：卡面内滚动，高度锁定，不影响 word/poem/text 的翻卡体验。 */
.flash.doc-mode { margin: 12px 0; }
.flash.doc-mode .flash-inner { min-height: 300px; height: min(62vh, 560px); }
.flash.doc-mode .flash-face { justify-content: flex-start; align-items: stretch; text-align: left; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.flash.doc-mode .flash-face .poem { font-size: 15px; line-height: 1.9; width: 100%; }
.flash.doc-mode .flash-face .doc-hint { position: sticky; bottom: 0; background: linear-gradient(transparent, #fff 45%); padding: 18px 0 6px; margin-top: 8px; font-size: 12px; }
@media (max-width: 640px) {
  .flash.doc-mode .flash-inner { height: min(58vh, 480px); }
  .flash.doc-mode .flash-face .poem { font-size: 14px; }
}

/* ---------- v1.40：词书管理分组视图 ---------- */
.dk-group { border-left:4px solid var(--blue); padding:12px 14px; }
.dk-group > .row b { font-size:15px; }
.dk-group-body { display:flex; flex-direction:column; gap:10px; }
.dk-group-body .dk-item { margin:0; box-shadow:none; border:1px solid var(--line,#eef2f7); }
.dk-flash { animation: dkFlash 2.4s ease-out; }
@keyframes dkFlash {
  0%, 55% { box-shadow:0 0 0 3px var(--green); background:color-mix(in srgb, var(--green) 8%, var(--card)); }
  100% { box-shadow:none; background:var(--card); }
}
@media (prefers-reduced-motion: reduce) { .dk-flash { animation:none; box-shadow:0 0 0 3px var(--green); } }

/* ---------- v1.40：出题中心家长态 / 校对台 ---------- */
.rv-item:last-child { border-bottom:none !important; }

/* ---------- v1.45：徽章墙 / 成就弹窗 / 跟读行 ---------- */
.badge-wall { display:grid; grid-template-columns:repeat(auto-fill, minmax(96px, 1fr)); gap:10px; margin-top:10px; }
.badge-item { display:flex; flex-direction:column; align-items:center; gap:4px; padding:12px 6px; border-radius:14px; text-align:center; }
.badge-item.on { background:color-mix(in srgb, var(--gold) 12%, var(--card)); box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent); }
.badge-item.off { background:var(--bg-2, #f3f4f6); opacity:.55; filter:grayscale(1); }
.badge-item .b-ico { font-size:26px; line-height:1; }
.badge-item .b-name { font-size:12px; font-weight:700; }
.badge-item .b-desc { font-size:10px; color:var(--ink-2); }
.badge-unlock { display:flex; flex-wrap:wrap; gap:10px; margin:12px 0 4px; }
.badge-unlock-item { display:flex; flex-direction:column; align-items:center; gap:4px; padding:14px 18px; border-radius:16px; background:color-mix(in srgb, var(--gold) 14%, var(--card)); box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--gold) 40%, transparent); }
.badge-unlock-item .b-ico { font-size:34px; animation:badgePop .5s ease; }
@keyframes badgePop { 0% { transform:scale(.3); } 60% { transform:scale(1.25); } 100% { transform:scale(1); } }
@media (prefers-reduced-motion: reduce) { .badge-unlock-item .b-ico { animation:none; } }

/* ---------- v1.51：暗黑模式增强（跟随系统 swatch + 四选一布局） ---------- */
.theme-swatch.t-auto { background: linear-gradient(90deg, #FFFFFF 50%, #1E293B 50%); }
.theme-row { flex-wrap: wrap; }
.theme-opt { min-width: 72px; }
