/* ============================================================
   数学专题辅导 · 原型样式
   设计变量单点定义；色板沿用模板 #2563eb 体系，按移动端扩展
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-weak: #eff4ff;
  --primary-soft: #dbe7fe;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --border: #e3e6ea;
  --success: #16a34a;
  --success-weak: #ecfdf3;
  --warn: #d97706;
  --warn-weak: #fef6e7;
  --danger: #dc2626;
  --danger-weak: #fef2f2;

  --r-card: 16px;
  --r-btn: 12px;
  --r-sm: 10px;
  --shadow-card: 0 1px 3px rgba(17, 24, 39, .06);
  --shadow-pop: 0 8px 28px rgba(17, 24, 39, .16);

  --tabbar-h: 62px;
  --device-w: 430px;   /* 版心宽度：手机满宽，平板/桌面由媒体查询放宽 */
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e8eaee;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* PC 上呈现手机框；真机上全屏 */
.device {
  position: relative;
  width: 100%;
  max-width: var(--device-w);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 24px rgba(17, 24, 39, .10);
}

.app {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}
.app.no-tab { padding-bottom: 24px; }

/* ---------------- 图标 ---------------- */
.icon { width: 22px; height: 22px; flex: none; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 30px; height: 30px; }
.icon-xl { width: 40px; height: 40px; }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 6px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar .title { flex: 1; font-size: 17px; font-weight: 600; text-align: center; }
.topbar .tb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; border: none; background: none;
  color: var(--text); border-radius: 10px; cursor: pointer;
}
.topbar .tb-btn:active { background: var(--bg); }

.page-head { padding: 20px 18px 6px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

/* ---------------- 卡片 / 区块 ---------------- */
.card {
  margin: 12px 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}
.card h2 { margin: 0 0 10px; font-size: 16px; font-weight: 650; }
.section-label {
  display: flex; align-items: center; gap: 6px;
  margin: 18px 18px 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}

.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 12px; color: var(--faint); }

/* AI 标记：AI 内容与人工确认内容视觉分离 */
.ai-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 999px;
  background: var(--primary-weak); color: var(--primary);
  font-size: 11px; font-weight: 600;
}
.ai-tag .icon { width: 12px; height: 12px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--r-btn);
  font-size: 15px; font-family: inherit; color: var(--text);
  cursor: pointer;
}
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-weak { background: var(--primary-weak); border-color: var(--primary-soft); color: var(--primary); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 14px 20px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn .icon { width: 19px; height: 19px; }

.btn-row { display: flex; gap: 10px; margin: 12px 14px; }
.btn-row .btn { flex: 1; }

/* ---------------- 表单 ---------------- */
.field { margin: 14px 0; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text); }
.field input, .field select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  font-size: 16px; font-family: inherit;
  background: var(--card); color: var(--text);
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }

/* ---------------- 芯片 / 筛选 ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  font-size: 13px; color: var(--muted);
  cursor: pointer;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-row { display: flex; gap: 8px; margin: 4px 14px 0; flex-wrap: wrap; }

/* 配额胶囊 */
.quota-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  background: var(--primary-weak); color: var(--primary);
  border-radius: 999px; font-size: 13px; font-weight: 600;
}

/* ---------------- 底部 Tab ---------------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  z-index: 30;
  display: flex;
  width: 100%; max-width: var(--device-w);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; background: none;
  color: var(--faint);
  font-size: 12px; font-family: inherit;
  cursor: pointer;
}
.tab.on { color: var(--primary); font-weight: 600; }
.tab .icon { width: 25px; height: 25px; }

/* ============================================================
   登录 / 年级
   ============================================================ */
.auth-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 28px 26px;
  background: var(--card);
}
.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.brand .logo {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .30);
}
.brand h1 { margin: 14px 0 2px; font-size: 22px; font-weight: 700; }
.brand p { margin: 0; font-size: 14px; color: var(--muted); }
.auth-tip { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--faint); }

.grade-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.grade-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  font-size: 17px; font-family: inherit; color: var(--text);
  cursor: pointer;
}
.grade-btn.on { border-color: var(--primary); background: var(--primary-weak); color: var(--primary); font-weight: 650; }
.grade-btn .icon { color: var(--faint); }
.grade-btn.on .icon { color: var(--primary); }

/* ============================================================
   拍题首页
   ============================================================ */
.home-hero { padding: 22px 18px 4px; display: flex; align-items: flex-start; justify-content: space-between; }
.home-hero h1 { margin: 0 0 2px; font-size: 23px; font-weight: 700; }
.home-hero p { margin: 0; font-size: 14px; color: var(--muted); }

.shoot-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  margin: 18px 14px 12px;
  padding: 40px 20px;
  background: linear-gradient(160deg, #2f6ff0 0%, #2563eb 55%, #1d55c8 100%);
  border-radius: 20px;
  border: none;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .28);
}
.shoot-card .icon { width: 46px; height: 46px; }
.shoot-card .big { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.shoot-card .sub { font-size: 13.5px; opacity: .9; }

.album-row { display: flex; justify-content: center; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; padding: 8px 12px;
  color: var(--muted); font-size: 14px; font-family: inherit;
  cursor: pointer;
}
.link-btn .icon { width: 18px; height: 18px; }

.mini-list-row {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 28px);
  margin: 0 14px; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card);
  font-size: 15px; font-family: inherit; color: var(--text);
  cursor: pointer;
}
.mini-list-row .icon { color: var(--primary); }
.mini-list-row .grow { flex: 1; text-align: left; }
.mini-list-row .count { font-size: 13px; color: var(--faint); }

/* ============================================================
   取景页（深色）
   ============================================================ */
.capture-screen {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  max-width: var(--device-w); margin: 0 auto;
  background: #101318; color: #fff;
}
.cap-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
}
.cap-top button {
  border: none; background: rgba(255,255,255,.12); color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cap-mode {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.12); font-size: 13px;
}
.cap-view { flex: 1 1 auto; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 8px 0; }
.cap-frame {
  position: relative;
  /* 高度优先、宽度封顶：宽屏下框不再无限变高把快门挤出视口（contain 效果） */
  height: 100%;
  width: auto;
  max-width: 78%;
  aspect-ratio: 3 / 3.6;
  border-radius: 14px;
  margin: auto;
}
.cap-frame::before, .cap-frame::after {
  content: ""; position: absolute; width: 26px; height: 26px;
  border: 3px solid #fff;
}
.cap-frame::before { top: -3px; left: -3px; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.cap-frame::after { bottom: -3px; right: -3px; border-left: none; border-top: none; border-radius: 0 0 8px 0; }
.cap-corner-tr, .cap-corner-bl { position: absolute; width: 26px; height: 26px; border: 3px solid #fff; }
.cap-corner-tr { top: -3px; right: -3px; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.cap-corner-bl { bottom: -3px; left: -3px; border-right: none; border-top: none; border-radius: 0 0 0 8px; }
.cap-hint {
  position: absolute; bottom: 18px; left: 0; right: 0;
  text-align: center; font-size: 13.5px; color: rgba(255,255,255,.75);
}
.cap-bottom {
  flex: none;
  display: flex; align-items: center; justify-content: space-around;
  padding: 16px 28px calc(env(safe-area-inset-bottom, 0px) + 22px);
}
.cap-album {
  width: 46px; height: 46px; border-radius: 12px;
  border: none; background: rgba(255,255,255,.18); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.shutter {
  width: 72px; height: 72px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.85);
  background: #fff;
  cursor: pointer;
}
.shutter:active { background: #d8dde6; }
.cap-side {
  width: 46px; height: 46px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.18); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ============================================================
   等待页
   ============================================================ */
.waiting {
  min-height: 90dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 30px; text-align: center;
}
.pulse-ring {
  position: relative;
  width: 92px; height: 92px;
  display: flex; align-items: center; justify-content: center;
}
.pulse-ring::before, .pulse-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--primary-soft);
  animation: pulse 1.8s ease-out infinite;
}
.pulse-ring::after { animation-delay: .9s; }
.pulse-ring .core {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
@keyframes pulse {
  0% { transform: scale(.75); opacity: .9; }
  100% { transform: scale(1.45); opacity: 0; }
}
.waiting h2 { margin: 0; font-size: 19px; }
.waiting p { margin: 0; font-size: 14.5px; color: var(--muted); max-width: 280px; }
.fallback-note {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--warn-weak); color: var(--warn);
  font-size: 13px;
}

/* ============================================================
   结果页（两步式：先确认转录，再展开讲解）
   ============================================================ */
.trans-item { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.trans-item:last-of-type { border-bottom: none; }
.trans-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin-bottom: 4px;
}
.trans-text { font-size: 16.5px; }
.formula { font-family: "Cambria Math", "Times New Roman", serif; font-style: italic; }
.trans-edit { display: none; width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; font-family: inherit; }
.trans-item.editing .trans-edit { display: block; }

.confirm-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.confirm-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card);
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.confirm-chip.done { background: var(--success-weak); border-color: #b9e6c9; color: var(--success); font-weight: 600; }
.confirm-chip .icon { width: 15px; height: 15px; }

/* 判定横幅 */
.verdict {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin: 12px 14px 0;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--card);
}
.verdict.good { background: var(--success-weak); border-color: #cdeeda; }
.verdict.rethink { background: var(--warn-weak); border-color: #f6dfb8; }
.verdict .v-icon { flex: none; }
.verdict.good .v-icon { color: var(--success); }
.verdict.rethink .v-icon { color: var(--warn); }
.verdict .v-main { font-size: 15.5px; font-weight: 650; }
.verdict .v-sub { font-size: 13px; color: var(--muted); }

/* 步骤卡 */
.steps { margin: 10px 14px 0; display: flex; flex-direction: column; gap: 10px; }
.step-card {
  display: flex; gap: 12px;
  padding: 13px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card);
  text-align: left; width: 100%;
  font-family: inherit; font-size: 15.5px; color: var(--text);
  cursor: pointer;
}
.step-card.bad { border-color: #f0c98a; background: var(--warn-weak); }
.step-no {
  flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-weak); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.step-card.bad .step-no { background: var(--warn); color: #fff; }
.step-hint { font-size: 12.5px; color: var(--faint); margin-top: 3px; }
.step-card .icon { width: 17px; height: 17px; color: var(--faint); margin-left: auto; align-self: center; }

/* 步骤浮现契约：JS 只负责 #explainZone.show；位移与延迟阶梯全部在此定义 */
#explainZone.show .step-card { animation: stepIn .42s cubic-bezier(.22, .61, .36, 1) both; }
#explainZone.show .step-card:nth-child(1) { animation-delay: .02s; }
#explainZone.show .step-card:nth-child(2) { animation-delay: .14s; }
#explainZone.show .step-card:nth-child(3) { animation-delay: .26s; }
#explainZone.show .step-card:nth-child(4) { animation-delay: .38s; }
#explainZone.show .step-card:nth-child(5) { animation-delay: .50s; }
#explainZone.show .step-card:nth-child(6) { animation-delay: .62s; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 新版逐步展开：每步出现时有动画 */
#explainZone .step-card { animation: stepIn .35s ease both; }
#explainZone .step-card.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }

/* 讲解态：题干卡收起确认操作，题干成为讲解的一部分，注解紧贴题干 */
#qCard.explaining { padding-bottom: 14px; }
#qCard.explaining .trans-head,
#qCard.explaining .trans-label,
#qCard.explaining .confirm-row,
#qCard.explaining .topic-line { display: none; }
#qCard.explaining .trans-item { padding: 0; border-bottom: none; }
#markInline .mark-say { margin-top: 12px; }
#markInline .mark-recall:first-child { margin-top: 12px; }
#markInline .mark-recall:last-child { margin-bottom: 0; }

/* 多问题目：未选问时的大号选择卡 */
.ask-card p { margin: 0 0 14px; }
.qpick {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin: 0 0 10px; padding: 15px 16px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  font-family: inherit; color: var(--text); text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.qpick:last-child { margin-bottom: 0; }
.qpick:active { border-color: var(--primary); background: var(--primary-weak); }
.qpick-no {
  flex: none; min-width: 40px;
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 18px; font-weight: 700; color: var(--primary);
}
.qpick-t { flex: 1; font-size: 16px; font-weight: 600; }
.qpick .icon { flex: none; color: var(--faint); }

/* 圈重点：粉笔圈直接标在题干文字上 */
.trans-text.q-on { padding-top: 9px; }
.qmark {
  position: relative;
  display: inline-block;
  margin: 0 1px;
  padding: 0 5px;
  border: 2px solid var(--primary);
  border-radius: 9px 11px 8px 10px;   /* 不规则圆角，像手圈的 */
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: chalkIn .45s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i) * .45s);
  transition: background .2s ease, box-shadow .2s ease;
}
.qmark.active {
  background: var(--primary-weak);
  box-shadow: 0 0 0 3px var(--primary-weak);
}
.trans-text.settled .qmark { cursor: pointer; }
.qmark-badge {
  position: absolute; top: -10px; right: -10px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--primary); color: #fff;
  font: 700 10.5px/17px -apple-system, "PingFang SC", sans-serif;
  text-align: center;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .4);
}
@keyframes chalkIn {
  0% { opacity: 0; transform: scale(.5) rotate(-8deg); }
  60% { opacity: 1; transform: scale(1.1) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(-1.5deg); }
}

/* 圈重点卡片：注解便签 + 回忆条 */
.marks-card .marks-lead { margin: 0 0 10px; }
.mark-say {
  display: none;
  align-items: flex-start; gap: 9px;
  margin: 0 0 10px; padding: 11px 13px;
  background: var(--warn-weak);
  border: 1px solid #f3e0bd;
  border-radius: var(--r-sm);
  font-size: 14.5px; line-height: 1.55;
}
.mark-say.show { display: flex; animation: sayIn .3s ease both; }
.say-badge {
  flex: none;
  width: 21px; height: 21px; margin-top: 1px;
  border-radius: 50%;
  background: var(--primary); color: #fff;
  font: 700 12px/21px -apple-system, "PingFang SC", sans-serif;
  text-align: center;
}
.say-text { flex: 1; }
@keyframes sayIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.mark-recall {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 10px; padding: 10px 12px;
  background: var(--primary-weak);
  border: 1px dashed var(--primary-soft);
  border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.55;
}
.mark-recall .icon { flex: none; width: 17px; height: 17px; margin-top: 2px; color: var(--warn); }
.recall-tag {
  display: inline-block; margin-right: 6px;
  padding: 1px 7px; border-radius: 999px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 600;
}
.marks-tap-hint { margin: 9px 0 0; text-align: center; font-size: 12.5px; }

/* 先想想 */
.hint-card { border: 1px dashed var(--primary-soft); }
.hint-text { font-size: 15.5px; margin: 0; }

/* 追问 */
.qa-box {
  margin: 6px 14px 0;
  padding: 12px 14px;
  background: var(--primary-weak);
  border: 1px solid var(--primary-soft);
  border-radius: var(--r-card);
  font-size: 14.5px;
}
.qa-box .qa-q { display: flex; gap: 7px; color: var(--primary); font-weight: 600; margin-bottom: 5px; }
.qa-box .qa-a { color: var(--text); }

.alt-box {
  margin: 10px 14px 0; padding: 13px 14px;
  background: var(--card); border: 1px dashed var(--primary-soft);
  border-radius: var(--r-card); font-size: 14.5px;
}
.alt-box .alt-title { display: flex; gap: 6px; align-items: center; color: var(--primary); font-weight: 600; margin-bottom: 5px; font-size: 13.5px; }

.verify-line {
  display: flex; align-items: center; gap: 7px;
  margin: 12px 14px 0; font-size: 14px; color: var(--muted);
}
.verify-line .icon { width: 18px; height: 18px; color: var(--success); }

.result-actions {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--device-w);
  display: flex; gap: 10px; padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: linear-gradient(transparent, var(--bg) 30%);
}
.result-actions .btn { flex: 1; }

/* ============================================================
   题目配图（SVG 示意图：图1 数轴 / 图2 刻度尺）
   圈重点和解题步骤通过 .fig-hl.active 联动高亮
   ============================================================ */
.q-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.qfig {
  position: relative;
  display: flex; flex-direction: column;
  padding: 10px 10px 7px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, background .15s ease;
}
.qfig:active { border-color: var(--primary); background: var(--primary-weak); }
.qfig .figsvg { display: block; width: 100%; height: auto; }
.qfig-zoom {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  margin-top: 2px;
  font-size: 11.5px; color: var(--faint);
}
.qfig-zoom .icon { width: 13px; height: 13px; }

/* 真实照片配图（拍题所得）：单列铺满；讲解联动时整图呼吸（蓝色覆盖层明暗） */
.q-photo-fig { grid-template-columns: 1fr; }
.qfig-photo { padding: 6px; overflow: hidden; }
.qfig-photo img {
  display: block; width: 100%; border-radius: 8px;
}
.qfig-photo::after {
  content: ''; position: absolute; inset: 6px;
  border-radius: 8px; pointer-events: none;
  background: color-mix(in srgb, var(--primary) 42%, transparent);
  opacity: 0; transition: opacity .25s ease;
}
.q-photo-fig.breathe .qfig-photo { border-color: var(--primary); }
.q-photo-fig.breathe .qfig-photo::after {
  animation: photoBreathe 1.6s ease-in-out infinite;
}
@keyframes photoBreathe {
  0%, 100% { opacity: .12; }
  50% { opacity: .5; }
}

/* 多配图切换（一张照片里含多个数学图形：图1/图2） */
.qfig-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 2px;
}
.qfig-tab {
  padding: 5px 14px;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.qfig-tab:active { opacity: .75; }
.qfig-tab.on {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

/* SVG 图元基础配色 */
.figsvg { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.fig-axis { stroke: #374151; stroke-width: 1.6; }
.fig-axis-fill { fill: #374151; }
.fig-ruler { fill: #fbfcfe; stroke: #374151; stroke-width: 1.4; }
.fig-minor { stroke: #9aa1ad; stroke-width: .8; }
.fig-major { stroke: #374151; stroke-width: 1.3; }
.fig-num { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.fig-tick { stroke: #374151; stroke-width: 1.3; transition: stroke .2s ease; }
.fig-dot {
  fill: #fff; stroke: #374151; stroke-width: 1.5;
  transition: fill .2s ease, stroke .2s ease;
}
.fig-lab {
  font-size: 12px; font-weight: 700; fill: var(--text);
  text-anchor: middle;
  transition: fill .2s ease;
}
.fig-cap { font-size: 11px; fill: var(--faint); text-anchor: middle; }
/* 区间 / 测量线段：默认淡灰提示几何范围，激活变主色蓝并轻微呼吸 */
.fig-seg {
  stroke: #c3c9d3; stroke-width: 3.5; stroke-linecap: round;
  opacity: .7;
  transition: stroke .2s ease, stroke-width .2s ease, opacity .2s ease;
}
.fig-hl.active .fig-tick { stroke: var(--primary); stroke-width: 2.2; }
.fig-hl.active .fig-dot {
  fill: var(--primary); stroke: var(--primary);
  animation: figPulse 1.5s ease-in-out infinite;
}
.fig-hl.active .fig-lab { fill: var(--primary); }
.fig-seg.fig-hl.active {
  stroke: var(--primary); stroke-width: 4.5; opacity: 1;
  animation: figPulse 1.5s ease-in-out infinite;
}
@keyframes figPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* 配图放大弹窗（lightbox） */
.fig-mask { z-index: 70; padding: 18px; }
.fig-dialog {
  width: 100%;
  max-width: min(var(--device-w), 520px);
  background: var(--card);
  border-radius: 18px;
  padding: 12px 14px 16px;
  box-shadow: var(--shadow-pop);
}
.fig-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fig-tab {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 13px; color: var(--muted);
  cursor: pointer; font-family: inherit;
}
.fig-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.fig-close {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.fig-close:active { background: var(--border); }
.fig-close .icon { width: 18px; height: 18px; }
.fig-stage { padding: 6px 4px 2px; }
.fig-stage .figsvg { width: 100%; height: auto; }
.fig-tip { margin: 4px 0 0; text-align: center; font-size: 12.5px; color: var(--faint); }

/* ============================================================
   专题
   ============================================================ */
.topic-row {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 14px; padding: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card);
  width: calc(100% - 28px);
  font-family: inherit; text-align: left; cursor: pointer;
  color: var(--text);
}
.topic-ico {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary-weak); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.topic-main { flex: 1; min-width: 0; }
.topic-name { font-size: 15.5px; font-weight: 600; }
.topic-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.topic-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); }
.topic-meta .icon { width: 17px; height: 17px; }
.topic-meta .mini-marks { display: flex; gap: 3px; }
.mark-dot { width: 8px; height: 8px; border-radius: 50%; }
.mark-dot.good { background: var(--success); }
.mark-dot.bad { background: var(--warn); }

/* 概念卡 */
.concept-gen {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 0 4px; text-align: center;
}
.concept-gen .icon { color: var(--primary); }
.concept-body { font-size: 15px; }
.concept-body p { margin: 0 0 8px; }
.concept-body p:last-child { margin-bottom: 0; }
.cached-note { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--success); }
.cached-note .icon { width: 14px; height: 14px; }

/* 题时间线 */
.prob-item {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  width: 100%;
  border-left: none; border-right: none; border-top: none;
  background: none;
  font-family: inherit; font-size: 15px; color: var(--text); text-align: left;
  cursor: pointer;
}
.prob-item:last-child { border-bottom: none; }
.prob-item .p-ico { flex: none; color: var(--success); }
.prob-item.bad .p-ico { color: var(--warn); }
.prob-item .p-date { font-size: 12px; color: var(--faint); margin-left: auto; }

.practice-card { text-align: center; }
.practice-q { font-size: 18px; margin: 6px 0 4px; }
.practice-tip { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

/* 空状态 */
.empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 70px 40px; text-align: center;
}
.empty .e-ico {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--primary-weak); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.empty h3 { margin: 6px 0 0; font-size: 17px; }
.empty p { margin: 0; font-size: 14px; color: var(--muted); max-width: 260px; }

/* ============================================================
   设置 / 历史 / 异常态走查
   ============================================================ */
.list-group { margin: 12px 14px; border-radius: var(--r-card); overflow: hidden; background: var(--card); border: 1px solid var(--border); }
.list-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 14px 15px;
  border: none; border-bottom: 1px solid var(--border);
  background: var(--card);
  font-family: inherit; font-size: 15px; color: var(--text); text-align: left;
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .icon { color: var(--faint); width: 20px; height: 20px; }
.list-item .grow { flex: 1; }
.list-item .val { font-size: 13.5px; color: var(--faint); }

/* Dialog / Toast */
.mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 18, 25, .48);
  display: flex; align-items: flex-end; justify-content: center;
}
.mask.center { align-items: center; padding: 24px; }
.dialog {
  width: 100%; max-width: var(--device-w);
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
}
.mask.center .dialog { border-radius: 20px; max-width: 360px; text-align: center; }
.dialog .d-ico {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.d-ico.blur { background: var(--warn-weak); color: var(--warn); }
.d-ico.quota { background: var(--primary-weak); color: var(--primary); }
.d-ico.net { background: var(--danger-weak); color: var(--danger); }
.dialog h3 { margin: 0 0 6px; font-size: 18px; }
.dialog p { margin: 0 0 16px; font-size: 14.5px; color: var(--muted); }
.dialog .btn-block + .btn-block { margin-top: 10px; }

/* 自评确认弹窗 */
.verdict-mask .dialog { position: relative; }
.verdict-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.verdict-close:active { background: var(--border); }
.verdict-close .icon { width: 16px; height: 16px; }
.d-ico.got-it { background: var(--success-weak); color: var(--success); }
.d-ico.not-yet { background: var(--warn-weak); color: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 80;
  background: rgba(20, 24, 33, .92); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; max-width: 340px; text-align: center;
}

.state-demo {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 28px); margin: 10px 14px; padding: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card);
  font-family: inherit; font-size: 15px; color: var(--text); text-align: left; cursor: pointer;
}
.state-demo .icon { color: var(--warn); }

/* ============================================================
   平板 / 大屏：放大单列版心（布局逻辑不变，只放宽 + 字号升档）
   手机 ≤559：430 满宽（默认）
   ============================================================ */

/* 大屏手机 / 小平板竖屏 */
@media (min-width: 560px) {
  :root { --device-w: 560px; }
}

/* 平板竖屏（iPad mini/标准 iPad 竖屏 768~） */
@media (min-width: 834px) {
  :root { --device-w: 680px; }
  body { background: #e2e5ea; }
  .topbar { min-height: 54px; }
  .topbar .title { font-size: 18px; }
  .page-head h1 { font-size: 25px; }
  .home-hero h1 { font-size: 26px; }
  .trans-text { font-size: 17.5px; }
  .card h2 { font-size: 17px; }
  .hint-text, .step-card, .mark-say, .mark-recall,
  .prob-item, .topic-name, .concept-body, .practice-q { font-size: 16.5px; }
  .section-label { font-size: 14px; }
  .chip { font-size: 14px; padding: 8px 15px; }
  .btn { font-size: 16px; }
  .shoot-card .big { font-size: 22px; }
  .qpick-t { font-size: 17px; }
  .qpick-no { font-size: 19px; }
  .qmark-badge { min-width: 18px; height: 18px; font-size: 11px; line-height: 18px; }
  .q-figures { gap: 12px; }
  .fig-num { font-size: 12px; }
  .fig-lab { font-size: 13px; }
  .fig-cap { font-size: 12px; }
  .fig-dialog { max-width: 620px; }
}

/* 平板横屏 / 笔记本 / 桌面（viewport ≥1000px 时触发双栏） */
@media (min-width: 1000px) {
  :root { --device-w: 800px; }
  body { background: #dfe3e9; }
  .card { padding: 20px 22px; }
  .trans-text { font-size: 19px; }
  .card h2 { font-size: 18.5px; }
  .hint-text, .step-card, .mark-say, .mark-recall,
  .prob-item, .topic-name, .concept-body { font-size: 17.5px; }
  .home-hero h1, .page-head h1 { font-size: 28px; }
  .qpick { padding: 17px 18px; }
  .qpick-t { font-size: 18px; }
  .qpick-no { font-size: 20px; min-width: 46px; }
  .btn { padding: 13px 20px; }
  .shoot-card { padding: 48px 20px; }
  .fig-dialog { max-width: 720px; }

  /* —— 宽屏双栏：题干左常驻 · 讲解右滚动 ——
     仅在讲解进行中（#qCard.explaining 且 #explainZone 可见）生效，
     确认阶段仍单列。用 :has() 免改 JS。 */
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) {
    max-width: var(--device-w);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "topbar topbar"
      "left  right"
      "spacer spacer";
    column-gap: 18px;
    align-items: start;
  }
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) > .topbar {
    grid-area: topbar;
  }
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) > #qCard {
    grid-area: left;
    position: sticky;
    top: 60px;
    max-height: calc(100dvh - 60px - 84px);
    overflow-y: auto;
    margin: 0;
    align-self: start;
    /* sticky 内部自己撑开，不再用 card 的外边距 */
    padding: 16px 20px;
  }
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) > #explainZone {
    grid-area: right;
    margin: 0 14px 0 0;
  }
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) > #explainSpacer {
    grid-area: spacer;
  }
  /* 双栏态：讲解区内部各卡片不再受 14px 外边距限制，右侧自适应 */
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) #explainZone .card {
    margin-left: 0;
    margin-right: 0;
  }
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) #explainZone .steps {
    margin-left: 0;
    margin-right: 0;
  }
  .app:has(#qCard.explaining):has(#explainZone:not([hidden])) #explainZone .section-label {
    margin-left: 4px;
  }
}
