/* 试题库 · 视觉：暖白底 + 白卡片 + 紫色主操作（与设计稿同一语言） */

:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --line: #e8e6e1;
  --line-soft: #f0eeea;
  --text: #1f1e1c;
  --text-2: #6b6862;
  --text-3: #9b978e;
  --primary: #5046e5;
  --primary-soft: #eeedfb;
  --danger: #c0392b;
  --ok: #1f7a4d;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(247, 246, 243, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
  display: inline-block;
}

.tabs {
  display: flex;
  gap: 4px;
  background: #efedE8;
  padding: 3px;
  border-radius: 9px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  padding: 5px 16px;
  border-radius: 7px;
  cursor: pointer;
}

.tab.is-active {
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.counter {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ---------- 布局 ---------- */

.view { display: none; }
.view.is-active { display: block; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 120px;
}

.wrap.wide { max-width: 1120px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.hint {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
}

.howto {
  margin: 0 0 4px;
  padding-left: 20px;
  font-size: 13.5px;
  color: var(--text-2);
}

.howto li { margin-bottom: 6px; }
.howto b { color: var(--text); font-weight: 600; }

/* ---------- 手动录入入口 ---------- */

.manual-card {
  border: 1.5px dashed #c9c5f2;
  background: var(--primary-soft);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.manual-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.manual-txt { min-width: 0; }

.manual-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.manual-txt .hint { display: block; }

.manual-row .btn-primary { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 560px) {
  .manual-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .manual-row .btn-primary { width: 100%; }
}

/* ---------- 拍照区 ---------- */

.dropzone {
  display: block;
  border: 1.5px dashed #d9d6cf;
  border-radius: 10px;
  background: #fbfaf8;
  min-height: 168px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }

.dz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 34px 16px;
  text-align: center;
}

.dz-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1.6px solid var(--primary);
  position: relative;
}

.dz-icon::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1.6px solid var(--primary);
}

.dz-title { font-size: 14.5px; font-weight: 500; }
.dz-sub { font-size: 12.5px; color: var(--text-3); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ---------- 框选 ---------- */

.crop-wrap { margin-top: 4px; }

.crop-stage {
  position: relative;
  width: 100%;
  background: #f2f0ec;
  border-radius: 10px;
  line-height: 0;
}

.crop-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.crop-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  touch-action: none;
  cursor: crosshair;
  border-radius: 10px;
}

.crop-box {
  position: absolute;
  border: 2px solid var(--primary);
  background: rgba(80, 70, 229, 0.12);
  cursor: move;
  touch-action: none;
}

.crop-box .h { position: absolute; }

.crop-box .h.nw { left: -11px; top: -11px; width: 22px; height: 22px; cursor: nwse-resize; }
.crop-box .h.ne { right: -11px; top: -11px; width: 22px; height: 22px; cursor: nesw-resize; }
.crop-box .h.sw { left: -11px; bottom: -11px; width: 22px; height: 22px; cursor: nesw-resize; }
.crop-box .h.se { right: -11px; bottom: -11px; width: 22px; height: 22px; cursor: nwse-resize; }
.crop-box .h.n { left: 50%; margin-left: -24px; top: -11px; width: 48px; height: 22px; cursor: ns-resize; }
.crop-box .h.s { left: 50%; margin-left: -24px; bottom: -11px; width: 48px; height: 22px; cursor: ns-resize; }
.crop-box .h.w { top: 50%; margin-top: -24px; left: -11px; width: 22px; height: 48px; cursor: ew-resize; }
.crop-box .h.e { top: 50%; margin-top: -24px; right: -11px; width: 22px; height: 48px; cursor: ew-resize; }

/* 四角手柄：白色小方块 + 主题色描边，清楚可点 */
.crop-box .h.nw, .crop-box .h.ne, .crop-box .h.sw, .crop-box .h.se {
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
}

/* 四边手柄：半透明圆角小条 */
.crop-box .h.n, .crop-box .h.s, .crop-box .h.e, .crop-box .h.w {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(80, 70, 229, 0.55);
  border-radius: 4px;
  box-sizing: border-box;
}

/* 悬停时整框高亮，提示可拖动 */
.crop-box:hover { box-shadow: 0 0 0 1px rgba(80, 70, 229, 0.4), 0 2px 10px rgba(0, 0, 0, 0.12); }

.crop-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: stretch;
  font-size: 11px;
  line-height: 20px;
  color: #fff;
  z-index: 2;
}

.crop-tag b {
  background: var(--primary);
  font-weight: 600;
  padding: 0 6px;
  border-bottom-right-radius: 6px;
}

.crop-tag i {
  background: #26251f;
  font-style: normal;
  width: 22px;
  text-align: center;
  cursor: pointer;
  border-bottom-right-radius: 6px;
}

.crop-tip {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin-top: 8px;
}

/* ---------- 待确认卡片 ---------- */

.pending { display: flex; flex-direction: column; gap: 14px; }

.pcard {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fdfcfb;
}

.pcard.is-saved { background: #f5faf7; border-color: #d5e8de; }

.pcard-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pnum { font-size: 13.5px; font-weight: 600; }

.pstate { font-size: 12.5px; color: var(--ok); }

.pcard-right { margin-left: auto; display: flex; gap: 8px; }

.pthumb {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  background: #f2f0ec;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}

.pcard .field { margin-bottom: 12px; }

.pcard .preview-box { margin: -6px 0 12px; }

.pcard.is-saved textarea,
.pcard.is-saved input,
.pcard.is-saved select { background: #f6f5f2; color: var(--text-2); }

.pcard.is-collapsed { padding: 10px 12px; }
.pcard-summary {
  display: flex; gap: 12px; align-items: center;
  padding: 4px 2px; cursor: pointer; border-radius: 8px;
}
.pcard-summary:hover { background: rgba(0, 0, 0, 0.03); }
.pcard-summary:active { background: rgba(0, 0, 0, 0.06); }
.psum-thumb {
  width: 84px; height: 84px; object-fit: contain; flex: 0 0 auto;
  background: #f2f0ec; border: 1px solid var(--line); border-radius: 6px;
}
.psum-main { flex: 1 1 auto; min-width: 0; }
.psum-stem {
  font-size: 14px; color: var(--text); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.psum-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.psum-hint { font-size: 12px; color: var(--primary); flex: 0 0 auto; white-space: nowrap; }

/* ---- 录题卡片紧凑布局：选项收起 + 元信息四格 + 库组一行 ---- */
.pcard .field { margin-bottom: 10px; }
.pcard .preview-box { margin: -4px 0 10px; }

.opt-collapsed {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 10px;
  border: 1px dashed var(--line); border-radius: 8px;
  background: #faf9f7;
}
.opt-collapsed-txt { font-size: 12.5px; color: var(--text-3); }
.opt-collapsed .mini { margin-left: auto; }
.pcard.opt-hidden .opt-full { display: none; }
.pcard:not(.opt-hidden) .opt-collapsed { display: none; }

.meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
  margin-bottom: 10px;
}
.meta-cell { display: flex; align-items: center; gap: 7px; min-width: 0; }
/* 知识点这一格要摊开多个候选标签：横跨两列，候选区强制换到输入框下面占满宽度。
   不然它只有半列宽（258px），一行只放得下 3 个，知识点一多就得滚。 */
.meta-grid .meta-cell.kp-cell { grid-column: 1 / -1; flex-wrap: wrap; }
.qp-set-grid .field.kp-cell { grid-column: 1 / -1; }
.qp-set-grid .field.kp-cell .chip-pick { max-height: 128px; }
.meta-cell.kp-cell .kp-pick-box { flex: 1 1 100%; min-width: 0; }
.meta-cell.kp-cell .chip-pick { max-height: 128px; }
.mc-label { flex: 0 0 auto; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.meta-cell .pick-row { flex: 1 1 auto; min-width: 0; gap: 5px; }
.meta-cell select,
.meta-cell input { flex: 1 1 auto; min-width: 0; }
.meta-cell .mini { flex: 0 0 auto; padding: 4px 8px; font-size: 12px; }

.cat-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.cat-row .cat-path { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.cat-row .mini { flex: 0 0 auto; }
.cat-row .hint { flex: 0 0 auto; white-space: nowrap; }
.cat-row .mini { flex: 0 0 auto; white-space: nowrap; }

.card-err { font-size: 12.5px; color: var(--danger); margin-top: 2px; }

/* ---------- 表单 ---------- */

.field { display: block; margin-bottom: 14px; }

.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.label em {
  font-style: normal;
  color: var(--primary);
  font-size: 12px;
  margin-left: 4px;
}

textarea, input[type="text"], input[type="password"], input[type="search"], input[type="tel"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fdfcfb;
  border-radius: 9px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; line-height: 1.65; font-family: inherit; }

textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(80, 70, 229, 0.12);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- 预览 ---------- */

.preview-box {
  border: 1px solid var(--line-soft);
  background: #fbfaf8;
  border-radius: 9px;
  margin: -4px 0 16px;
}

.preview-head {
  font-size: 12px;
  color: var(--text-3);
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.preview-body {
  padding: 12px;
  font-size: 14.5px;
  min-height: 52px;
  overflow-x: auto;
}

.preview-body .placeholder { color: var(--text-3); font-size: 13px; }

/* ---------- 按钮 ---------- */

.btn-primary, .btn-ghost, .mini {
  font: inherit;
  cursor: pointer;
  border-radius: 9px;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn-primary {
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  padding: 10px 22px;
}

.btn-primary:hover { background: #4238cf; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.btn-ghost {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  padding: 9px 16px;
}

.btn-ghost:hover { border-color: #d5d2cb; color: var(--text); }

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 4px;
}

.status { font-size: 13px; color: var(--text-3); }
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

/* ---------- 工具栏 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .search { flex: 1 1 240px; min-width: 180px; }
.spacer { flex: 0 0 0; }

.list-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* ---------- 题库两栏 ---------- */

.bank-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
/* 列不设 minmax(0,1fr) 时，题卡里的超宽公式会把整列撑到屏幕外（页面能左右拖） */
.bank-layout > * { min-width: 0; }

.tree-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 10px 10px;
  position: sticky;
  top: 76px;
  /* 树已完整铺开（无内滚动条）：整块面板在页面里正常流下来，
     面板过高时也允许随页面滚到底，保证「未归类 / 标签」等底部内容可达 */
  align-self: start;
}

.tree-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}

.tree-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-right: auto; }

/* 树：不再内嵌滚动条，整棵树直接铺开（超出部分交给页面整体滚动） */
.tree { max-height: none; overflow: visible; }

/* ---------- 经典目录树（Windows 资源管理器风格） ---------- */

.tree {
  font-family: SimSun, "宋体", "NSimSun", serif;
  font-size: 12px;
  line-height: 1;
  padding: 4px 2px 6px;
  user-select: none;
  -webkit-user-select: none;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px 0 2px;
  height: 22px;
  color: #000;
  white-space: nowrap;
}

.tree-row:hover { background: #efeff6; }

/* 右键拖动排序：源行半透明，落点显示蓝色插入线 */
.tree-row.drag-src { opacity: 0.45; }
.tree-row.drop-above { box-shadow: inset 0 3px 0 var(--primary); }
.tree-row.drop-below { box-shadow: inset 0 -3px 0 var(--primary); }
#tree { user-select: none; }

/* 选中行：蓝底白字 */
.tree-row.is-active { background: #0a3fd6; color: #fff; }

/* +/- 展开框（白色小方框，经典样式） */
.tree-row .tw {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #7d7d7d;
  background: #fff;
  color: #000;
  font: 11px/11px Consolas, "Courier New", monospace;
  cursor: pointer;
  padding: 0;
}

.tree-row.is-active .tw { color: #000; }

/* 叶子节点：占位小方框，不带 +/- */
.tree-row .tw-leaf {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

/* 勾选框 */
.tree-row .wcb {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin: 0;
  padding: 0;
  accent-color: #0a3fd6;
  cursor: pointer;
}

/* 蓝色「库 / 题」标签 */
.tree-row .wtag {
  flex: 0 0 auto;
  color: #0000e0;
  font-weight: 700;
  padding: 0 1px;
}

.tree-row .tn {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  padding: 1px 1px;
}

/* 库名加粗黑字（题名普通） */
.tree-row.is-lib .tn { font-weight: 700; }

.tree-row .tc { flex: 0 0 auto; font-size: 11px; color: #808080; }
.tree-row.is-active .tc { color: #dce6ff; }

/* 悬停出现的 ＋ ✎ ✕ */
.tree-row .tbtns { flex: 1 0 auto; display: none; justify-content: flex-end; gap: 2px; }
.tree-row:hover .tbtns { display: inline-flex; }

.tree-row .tmini {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #444;
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1.4;
}

.tree-row .tmini:hover { color: #0a3fd6; }
.tree-row.is-active .tmini { color: #fff; }
.tree-row .tmini.tfull { opacity: 0.35; cursor: default; }

/* 就地改名的输入框 */
.wt-edit {
  font: 12px/16px SimSun, "宋体", serif;
  border: 1px solid #0a3fd6;
  padding: 0 2px;
  width: 100%;
  min-width: 90px;
  height: 16px;
  outline: none;
  background: #fff;
  color: #000;
}

/* 子层缩进：虚线竖线 + 每行一小段虚线横线 */
.wt-kids {
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px dotted #9a9a9a;
}

.wt-kids > .tree-row { position: relative; }

.wt-kids > .tree-row::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 12px;
  border-top: 1px dotted #9a9a9a;
}

/* 右键菜单 */
.wt-menu {
  position: fixed;
  z-index: 1200;
  min-width: 150px;
  background: #fff;
  border: 1px solid #9a9a9a;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
  padding: 2px;
  font: 12px/1.4 SimSun, "宋体", serif;
}

.wt-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 5px 12px;
  font: inherit;
  color: #000;
  cursor: pointer;
}

.wt-menu button:hover { background: #0a3fd6; color: #fff; }
.wt-menu button.danger { color: #c00000; }
.wt-menu button.danger:hover { background: #c00000; color: #fff; }

.tree-foot { padding: 8px 6px 2px; margin-top: 6px; border-top: 1px solid var(--line-soft); }

.tree-toggle { display: none; }

/* ---------- 题目列表 ---------- */

.list { display: flex; flex-direction: column; gap: 10px; }

/* 题目列表 + 右侧题型工具条 */
.list-body { display: flex; align-items: flex-start; gap: 12px; }
.list-body > .list { flex: 1 1 auto; min-width: 0; }
.qtype-rail {
  flex: 0 0 124px;
  width: 124px;
  position: sticky;
  top: 76px;
  padding: 9px 8px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(20, 40, 70, 0.05);
}
.qtype-rail[hidden] { display: none; }
.qr-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-2);
  padding: 0 4px 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.qr-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  margin: 1px 0;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.qr-item:hover { background: var(--hover, #eef4fb); }
.qr-item input { width: 13px; height: 13px; margin: 0; flex: 0 0 13px; accent-color: var(--primary); cursor: pointer; }
.qr-item span { overflow: hidden; text-overflow: ellipsis; }
.qr-item.is-on { background: rgba(0, 103, 192, 0.09); color: var(--primary); font-weight: 600; }
.qr-clear {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 5px 0;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: transparent;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
}
.qr-clear:hover { color: var(--primary); border-color: var(--primary); }

/* 窄屏没有这条工具条（题型筛选在「⋯」面板里） */
@media (max-width: 900px) {
  .list-body { display: block; }
  .qtype-rail { display: none !important; }
}

.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.badge {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: #4136c4;
}

.badge.gray { background: #f1efea; color: var(--text-2); }

/* 题库列表里可点击的题型徽章 + 快捷改题型的下拉 */
.badge-btn {
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
}
.badge-btn:hover { filter: brightness(0.95); box-shadow: 0 0 0 2px var(--primary-soft); }
.qt-select {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--primary, #5046e5);
  background: #fff;
  color: var(--text, #1f1e1c);
}

/* 题内插图 */
.inline-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 6px 0;
  border-radius: 8px;
  background: #f4f2ee;
  min-height: 24px;
}
.inline-img.is-loading { opacity: 0.4; }
.inline-img.is-broken {
  min-height: 34px;
  background: #f8ece9;
  border: 1px dashed #e2c0ba;
}
/* 列表 / 预览里当缩略图看，别撑太高 */
.q-stem .inline-img,
.qp-rich .inline-img,
.p-preview .inline-img,
.pick-stem .inline-img {
  width: auto;
  max-height: 240px;
}
/* 折叠摘要（逐题核对）/ 组卷题目行里的题内插图：做成行内小图，
   不要用默认的块级独占一行 —— 否则第一张图就把整行文字挤没了 */
.psum-stem .inline-img,
.sr-stem .inline-img {
  display: inline-block;
  vertical-align: middle;
  width: auto;
  margin: 0 4px;
  border-radius: 4px;
  background: transparent;
}
.psum-stem .inline-img { max-height: 34px; min-height: 0; }
.sr-stem .inline-img { max-height: 96px; }

/* 题内插图可以点开看大图（编辑预览里点图是换环绕/调大小，光标保持原样） */
.inline-img { cursor: zoom-in; }
.p-preview .inline-img { cursor: pointer; }

/* ===== 插图查看层（手机上看不清的线段图/表格在这里放大） ===== */
.imgv-mask {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  background: #0b0d11;
}
.imgv-mask[hidden] { display: none; }
.imgv-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  flex: 0 0 auto;
}
.imgv-name {
  margin-right: auto; color: #cfd6e2; font-size: 13px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.imgv-tip { color: #8d97a8; font-size: 12px; white-space: nowrap; }
.imgv-tip-m { display: none; }
.imgv-btn {
  appearance: none; flex: 0 0 auto; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .26); background: rgba(255, 255, 255, .08);
  color: #eef2f8; font-size: 13px; line-height: 1; padding: 8px 14px; border-radius: 999px;
}
.imgv-btn:hover { background: rgba(255, 255, 255, .16); }
.imgv-btn.primary { border-color: transparent; background: #2f6bd8; color: #fff; }
.imgv-stage { position: relative; flex: 1 1 auto; overflow: hidden; touch-action: none; cursor: grab; }
.imgv-stage:active { cursor: grabbing; }
.imgv-img {
  position: absolute; left: 50%; top: 50%;
  transform-origin: center center; transform: translate(-50%, -50%);
  max-width: none; max-height: none;
  user-select: none; -webkit-user-drag: none;
  background: #fff; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
}
@media (max-width: 820px) {
  .imgv-name { font-size: 12px; }
  .imgv-tip-d { display: none; }
  .imgv-tip-m { display: inline; }
  .imgv-btn { padding: 9px 13px; }
}
@media (max-width: 430px) {
  .imgv-tip { display: none; }
}

/* 文字环绕（仿 Word）：L=左环绕 R=右环绕，空=上下型（默认块级独占一行） */.inline-img.wrap-l { float: left; margin: 2px 12px 6px 0; }
.inline-img.wrap-r { float: right; margin: 2px 0 6px 12px; }
/* 可编辑预览里：图片包一层，右下角小方块按住拖动调大小 */
.img-rz-box { position: relative; display: inline-block; max-width: 100%; }
.img-rz-box.wrap-l { float: left; margin: 2px 12px 6px 0; }
.img-rz-box.wrap-r { float: right; margin: 2px 0 6px 12px; }
.img-rz-box .inline-img { margin: 0; vertical-align: top; }
.img-rz-box.wrap-l .inline-img, .img-rz-box.wrap-r .inline-img { float: none; }
.img-rz-handle {
  position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px;
  background: var(--primary); border: 2px solid #fff; border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3); cursor: nwse-resize;
  opacity: 0; transition: opacity .15s; z-index: 3; touch-action: none;
}
.img-rz-box:hover .img-rz-handle, .img-rz-box.resizing .img-rz-handle { opacity: 1; }
/* 右上角小剪刀：重新裁切这张图 */
.img-rz-crop {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .2);
  cursor: pointer;
  user-select: none;
  z-index: 4;
  opacity: 0;
  transition: opacity .15s;
}
.img-rz-box:hover .img-rz-crop { opacity: 1; }
@media (hover: none) {
  .img-rz-crop { opacity: 1; }  /* 手机上没法 hover，一直显示 */
}
.img-rz-badge {
  position: absolute; left: 0; top: 100%; margin-top: 4px; display: none;
  background: rgba(23, 43, 77, .88); color: #fff; font-size: 11px; line-height: 1.6;
  padding: 1px 7px; border-radius: 4px; pointer-events: none; white-space: nowrap; z-index: 3;
}
.img-rz-box.resizing .img-rz-badge { display: block; }
/* 含环绕图容器：清除浮动，避免文字溢出图片下方 */
.q-stem::after,
.qp-rich::after,
.p-preview::after,
.pick-stem::after,
.pv-q::after,
.pv-ans::after {
  content: '';
  display: block;
  clear: both;
}
.pv-q .inline-img,
.pv-ans .inline-img {
  margin: 5px 0;
  background: transparent;
}
.ins-img {
  margin-left: 8px;
  font-weight: 400;
}

/* 扫图识答案 / 解析 */
.scan-btn {
  margin-left: 8px;
  font-weight: 500;
  color: var(--primary);
  border-color: rgba(80, 70, 229, 0.35);
  background: rgba(80, 70, 229, 0.07);
}
.scan-btn:hover {
  background: rgba(80, 70, 229, 0.14);
  border-color: var(--primary);
  color: var(--primary);
}
.scan-btn:disabled { opacity: 0.6; cursor: default; }

.scan-status {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
  margin-top: 5px;
}
.scan-status:empty { display: none; }
.scan-status.is-ok { color: var(--ok); }
.scan-status.is-err { color: var(--danger); }

/* 答案窗：拍照识别答案 */
.qp-scan-sec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qp-scan-sec .scan-status { margin-top: 0; flex: 1 1 160px; min-width: 0; }
.qp-scan-sec .mini:disabled { opacity: 0.6; cursor: default; }
.qp-ans-ways { display: flex; gap: 8px; flex-wrap: wrap; }
.qp-ans-ways .mini { flex: 0 0 auto; }

/* 管理题型面板 */
.qt-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.qt-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 20px 16px;
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}
.qt-rows { margin: 12px 0 6px; }
.qt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.qt-row .qt-name {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--line, #e4e0d8);
  font-size: 14px;
}
.qt-row .qt-tag { flex: 0 0 auto; }
.qt-row .mini { flex: 0 0 auto; }
.qt-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 4px 0 14px;
}
.qt-add input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px dashed var(--line, #d9d4ca);
  font-size: 14px;
}

.item-img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* ---------- 题库紧凑卡片（按参考图：序号+路径+题型 / 题干 / 元信息+操作底行） ---------- */

.q-item { padding: 13px 18px 12px; }

.q-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  min-width: 0;
}

.q-no {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  background: #2e9e68;
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}

.q-crumb {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-qtype { flex: 0 0 auto; }

.q-stem {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
  border-radius: 6px;
}
.q-stem:hover { color: #35322c; }
/* 题干里的红字提醒（[[red:需插图]]）：标出这里缺图，录入时先占位 */
.q-red {
  color: #d93026;
  font-weight: 600;
  letter-spacing: 0.02em;
}
/* 收起态：3 行高度（用 max-height 而不是 line-clamp —— 公式算不准，会漏出来） */
.q-stem.clamped {
  max-height: calc(1.7em * 3);
  overflow: hidden;
}
/* 本来就不长（量出来没超出）：不加高度限制，也不显示展开按钮 */
.q-stem.clamped.is-short { max-height: none; }
/* 长公式比卡片宽：折叠时右侧渐隐，提示还有内容 */
.q-stem.clamped.has-x {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), rgba(0, 0, 0, 0.1) 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), rgba(0, 0, 0, 0.1) 100%);
}
/* 展开后：可以用手左右划看完整长公式 */
.q-stem.has-x:not(.clamped) {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: none;
  mask-image: none;
  padding-bottom: 2px;
}

/* 「展开全文 / 收起」小胶囊 */
.q-more {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  padding: 2px 10px;
  border: 1px solid #cfe0f2;
  border-radius: 999px;
  background: #f2f7fd;
  color: #0067c0;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.8;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.q-more[hidden] { display: none; }
.q-more:hover { background: #e5f0fb; }
.q-more:active { transform: translateY(1px); }
.q-more.is-on { background: #fff; color: #7a838d; border-color: #e3e7ec; }

/* 列表卡片里的选项区（选择题）：跟题干一起显示 */
.q-opts { margin-top: 9px; }
.q-opts:empty { display: none; }
.q-opts .opt-view { --opt-min: 0; }
.q-opts .opt-item { background: #f5f6f8; }

/* 底行：元信息在左（不换行、超出省略），操作在右 */
.q-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.q-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.q-meta b { font-weight: 500; color: var(--text-2); }
.q-meta span { flex: 0 0 auto; }

/* 难度五档色标：易→难 由绿到红 */
.q-meta .diff-tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 17px;
  font-weight: 600;
}
.q-meta .diff-tag[data-d="easy"] { color: #15803d; background: #dcfce7; }
.q-meta .diff-tag[data-d="easy2"] { color: #0f766e; background: #ccfbf1; }
.q-meta .diff-tag[data-d="medium"] { color: #1d4ed8; background: #dbeafe; }
.q-meta .diff-tag[data-d="hard2"] { color: #b45309; background: #fef3c7; }
.q-meta .diff-tag[data-d="hard"] { color: #b91c1c; background: #fee2e2; }

.q-acts {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.q-acts-links { display: flex; align-items: center; gap: 1px; }
.q-acts-cta { display: flex; align-items: center; gap: 6px; margin-left: 8px; }

.q-link {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: #4a6ea8;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.q-link:hover { background: rgba(74, 110, 168, 0.1); color: #33517d; }
.q-link.danger { color: #b05548; }
.q-link.danger:hover { background: rgba(192, 57, 43, 0.09); color: var(--danger); }

/* 还没填答案的题：「答案」两个字标红，方便一眼扫出待补的题 */
.q-link.noans { color: var(--danger); font-weight: 600; }
.q-link.noans:hover { background: rgba(192, 57, 43, 0.09); color: var(--danger); }

/* 入篮 = 描边按钮，加入试卷 = 蓝按钮（参考图里主操作是蓝底圆角方块） */
.q-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.q-btn:hover { border-color: #d5d2cb; color: var(--text); }
.q-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.q-btn.go { background: #2f6fd0; border-color: #2f6fd0; color: #fff; padding: 5px 14px; }
.q-btn.go:hover { background: #2861bb; border-color: #2861bb; color: #fff; }
/* 已在试卷中：白底红字，点一下移出 */
.q-btn.out { background: #fff; border-color: #e6bdb9; color: #d33a2c; padding: 5px 14px; }
.q-btn.out:hover { background: #fdf2f1; border-color: #d98a82; color: #bf2a1d; }

/* ---------- 题目悬浮窗（答案 / 属性 / 编辑） ---------- */

.qpop-mask {
  position: fixed;
  inset: 0;
  background: rgba(31, 30, 28, 0.45);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.qpop-card {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(31, 30, 28, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.qpop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.qpop-title { font-size: 15px; font-weight: 600; }

.qpop-x {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.qpop-x:hover { background: #f3f1ec; color: var(--text); }

.qpop-body {
  padding: 14px 16px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

.qpop-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.qpop-foot .qp-foot-hint {
  margin-right: auto;
  font-size: 12px;
  color: var(--text-3);
}

.qp-sec { margin-bottom: 14px; }
.qp-sec:last-child { margin-bottom: 2px; }
.qp-sec-t {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.qp-rich { color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* 选择题选项：一行 / 两行(AB|CD) / 四行，按容器宽度自动切换 */
.opt-view { display: block; }
.opt-item {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 5px 8px; border-radius: 7px; background: #f7f6f3;
  min-width: 0;
}
.opt-key {
  flex: 0 0 auto; font-weight: 600; color: var(--primary);
  min-width: 16px; text-align: center;
}
.opt-val { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.opt-val .inline-img { max-height: 84px; vertical-align: middle; }
/* 一行：全部横排，放得下才用 */
.opt-view.opt-1 { display: flex; flex-wrap: nowrap; gap: 10px; overflow: hidden; }
.opt-view.opt-1 .opt-item { flex: 0 0 auto; white-space: nowrap; background: transparent; padding: 2px 0; }
.opt-view.opt-1 .opt-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 两行：A B 一行，C D 一行 */
.opt-view.opt-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
/* 四行：各自一行 */
.opt-view.opt-4 { display: grid; grid-template-columns: 1fr; gap: 8px; }
.qp-orig {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f2ee;
}

/* 属性窗 = 设置面板 */
.qp-set-sec {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.4px;
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qp-set-sec:first-child { margin-top: 0; }
.qp-set-sec::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--line-soft);
}
.qp-set-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.qp-set-info {
  font-size: 12px;
  color: var(--text-3);
  background: #f7f6f3;
  border-radius: 8px;
  padding: 8px 11px;
  line-height: 1.8;
}
.qp-set-info b { font-weight: 500; color: var(--text-2); }
.qp-set-stem {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.qp-set-stem .qp-rich {
  font-size: 13.5px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qp-form .field { margin-bottom: 10px; }
.qp-edit-err {
  font-size: 12.5px;
  color: var(--danger);
  min-height: 18px;
  margin-top: 2px;
}

.mini {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  padding: 5px 12px;
}

.mini:hover { border-color: #d5d2cb; color: var(--text); }
.mini.danger:hover { border-color: #e4b4ad; color: var(--danger); }
.mini.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.mini.primary:hover { background: #4238cf; color: #fff; }
.mini:disabled { opacity: 0.5; cursor: default; }

.empty {
  text-align: center;
  color: var(--text-3);
  padding: 60px 20px;
  font-size: 14px;
}

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #26251f;
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 10px;
  z-index: 60;
  max-width: 88vw;
  text-align: center;
}

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(31, 30, 28, 0.42);
  /* 220：确认框永远压在最上层。原来 80 会被卷库整页(.pl-mask 126)、
     图片查看层(200)、处理层(140/150) 盖住，点「删除」看不到弹窗 */
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 40px rgba(31, 30, 28, 0.18);
}

.modal-title { font-size: 15.5px; font-weight: 600; margin-bottom: 8px; }

.modal-body {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 12px;
}

.modal-input { margin-bottom: 4px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-actions .btn-ghost, .modal-actions .btn-primary { flex: 0 0 auto; padding: 9px 20px; }

/* ---------- 通用 ---------- */

[hidden] { display: none !important; }

.btn-primary.block, .btn-ghost.block { display: block; width: 100%; text-align: center; }

.row-status { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.row-status.err { color: var(--danger); }
.row-status.ok { color: var(--ok); }

/* ---------- 启动与登录 ---------- */

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-3);
  font-size: 14px;
  padding: 0 24px;
  text-align: center;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid #e2dfd9;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px 60px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 22px 22px;
  box-shadow: 0 6px 24px rgba(31, 30, 28, 0.05);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.auth-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
  display: inline-block;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-3);
  margin: 6px 0 22px;
}

.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1 1 auto; min-width: 0; }
.code-row .btn-ghost { flex: 0 0 auto; white-space: nowrap; padding: 9px 14px; }

.field-err { display: block; font-size: 12px; color: var(--danger); margin-top: 5px; }

.auth-status {
  font-size: 13px;
  color: var(--text-3);
  min-height: 19px;
  margin-top: 10px;
  text-align: center;
}

.auth-status.err { color: var(--danger); }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text-3);
  font-size: 12px;
}

.divider::before, .divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

.auth-tip {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 16px 0 0;
  text-align: center;
}

/* ---------- 手机 ---------- */

@media (max-width: 880px) {
  .bank-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }

  .tree-panel {
    position: static;
    padding: 10px;
    display: none;
  }

  .tree-panel.is-open { display: block; }

  .tree-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 10px;
    padding: 10px 13px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 10px;
  }

  .tree-toggle .chev { margin-left: auto; color: var(--text-3); font-size: 12px; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 14px 12px 130px; }
  .grid2 { grid-template-columns: 1fr; }
  .counter { display: none; }
  .toolbar .search { flex-basis: 100%; }
  .btn-primary, .btn-ghost { flex: 1 1 auto; }
  .code-row .btn-ghost { flex: 0 0 auto; }
  .brand { font-size: 14px; }
  .tabs .tab { padding: 5px 12px; }
  .crop-box .h.nw, .crop-box .h.ne, .crop-box .h.sw, .crop-box .h.se { width: 26px; height: 26px; }
  .crop-box .h.nw { left: -13px; top: -13px; }
  .crop-box .h.ne { right: -13px; top: -13px; }
  .crop-box .h.sw { left: -13px; bottom: -13px; }
  .crop-box .h.se { right: -13px; bottom: -13px; }
}

/* ============ 库 / 组 / 标签 ============ */

.tree { max-height: none; }

.tree-empty {
  padding: 10px 8px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.65;
}

.side-sec {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 8px;
}

.side-head .tree-title { margin-right: auto; }

/* 经典树：库与题共用一行样式，层级缩进见 .wt-kids（上方「经典目录树」区块） */

.tree-empty {
  padding: 10px 8px;
  font-size: 12px;
  font-family: SimSun, "宋体", serif;
  color: var(--text-3);
  line-height: 1.8;
}

.tree-foot {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.tree-foot b { color: var(--text-2); font-weight: 600; }

.tree-foot b { color: var(--text-2); font-weight: 600; }

.cat-path {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 6px;
  word-break: break-all;
}

.cat-path .dim { color: var(--text-3); }

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 6px 2px;
  max-height: none;
  overflow: visible;
}

/* 列表顶部的标签 / 知识点筛选条（原侧栏标签区移到此处） */
.filter-strip {
  padding: 6px 10px 4px;
  border-bottom: 1px dashed var(--line, #e5e2db);
  background: #fbfaf7;
}
.filter-strip .fs-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 2px;
}
.filter-strip .fs-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2, #555);
}
.filter-strip .fs-title .soft { font-weight: 400; font-size: 11px; }
.filter-strip .hint { padding: 2px 6px; }
.filter-strip .tag-cloud { max-height: 118px; overflow-y: auto; }

/* 录题卡 / 属性窗里的知识点点选 */
.kp-pick-box .hint { font-size: 11.5px; }
.kp-pick-box .chip-pick { margin-top: 4px; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 12.5px;
  font-family: inherit;
  line-height: 1.7;
  background: #f1efea;
  color: var(--text-2);
  cursor: pointer;
  max-width: 100%;
}

.tag-chip b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag-chip .tc-n { font-size: 10.5px; opacity: 0.6; }

.tag-chip.is-on { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; font-weight: 600; }

.tag-chip .tmini { border: 0; background: transparent; color: inherit; font-size: 11px; cursor: pointer; padding: 0 2px; opacity: 0.75; }
.tag-chip .tmini:hover { opacity: 1; }

.tag-chip.c0 { background: #eef2ff; color: #3b4cca; }
.tag-chip.c1 { background: #ecfdf5; color: #0f7a55; }
.tag-chip.c2 { background: #fff7ed; color: #b45309; }
.tag-chip.c3 { background: #fef2f2; color: #b42318; }
.tag-chip.c4 { background: #f5f3ff; color: #6d28d9; }
.tag-chip.c5 { background: #eff6ff; color: #1d4ed8; }
.tag-chip.c6 { background: #fdf2f8; color: #be185d; }
.tag-chip.c7 { background: #f0fdfa; color: #0f766e; }

.tag-chip:disabled { cursor: default; opacity: 0.85; }

/* 题目列表里的标签 */
.mini-tag {
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: 20px;
  cursor: default;
}

/* 卡片里的标签快捷选择 */
.chip-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  max-height: 92px;
  overflow: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 20px;
  padding: 3px 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.chip i { font-style: normal; font-size: 10.5px; opacity: 0.55; }
.chip:hover { border-color: #d5d2cb; }

/* 属性窗：已有标签点选区 */
.tag-pick-box .chip-pick { margin-top: 6px; max-height: 132px; }
.tag-pick-box .hint { margin-top: 6px; font-size: 12px; }
.chip.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.is-on i { opacity: 0.8; }
.chip:disabled { opacity: 0.5; cursor: default; }

/* 库 / 组 两个下拉 */
.pick-row { display: flex; gap: 8px; }
.pick-row select { flex: 1 1 0; min-width: 0; }

/* 弹窗多字段表单 */
.modal-fields { margin-bottom: 4px; }
.modal-fields .field { margin-bottom: 11px; }
.modal-fields .field:last-child { margin-bottom: 6px; }
.modal-fields .label { font-size: 12.5px; }

.label em.soft {
  color: var(--text-3);
  font-size: 11.5px;
}

@media (max-width: 880px) {
  .tree { max-height: none; }
  .tag-cloud { max-height: none; }
}

@media (max-width: 640px) {
  .tree-row .tbtns { display: inline-flex; }
}

/* ============ 组卷台 ============ */

.paper-bar { flex-wrap: wrap; }

.paper-bar .btn-ghost,
.paper-bar .btn-primary { font-size: 13.5px; padding: 8px 13px; }

#paperDeleteBtn { color: var(--danger); }
#paperDeleteBtn:hover { border-color: #e4b4ad; background: #fef2f2; color: var(--danger); }

@media (min-width: 881px) {
  .toolbar .spacer { flex: 1 1 0; }
}

.paper-lib-label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }

/* 卷库入口（替代原来的下拉菜单，点开是整页的历史组卷） */
.paper-lib-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.paper-lib-btn:hover { border-color: var(--primary); color: var(--primary); }
.plb-ico { font-size: 14px; opacity: .65; }
.plb-n {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 19px;
  text-align: center;
}

.paper-save-state { font-size: 12px; color: var(--text-2); white-space: nowrap; padding-left: 2px; }
.paper-save-state.is-dirty { color: #b26a00; }
.paper-save-state.is-saving { color: var(--text-2); }
.paper-save-state.is-saved { color: #1f8a4c; }
.paper-save-state.is-fail { color: var(--danger); }

/* ---------- 卷库整页（历史组卷） ---------- */

body.pl-open { overflow: hidden; }

.pl-mask {
  position: fixed;
  inset: 0;
  /* 126：高于页面内容与工具栏，低于拍照页 .pp(130) / 处理层 .ps-mask(140) */
  z-index: 126;
  background: rgba(16, 20, 26, .42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pl-page {
  width: min(960px, 100%);
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(10, 14, 20, .28);
  overflow: hidden;
}
.pl-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.pl-bar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.pl-bar-hint { flex: 1; font-size: 12.5px; color: var(--text-2); }
.pl-bar-x {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
}
.pl-bar-x:hover { background: #f2f4f7; color: var(--text); }
.pl-tools { flex: 0 0 auto; display: flex; gap: 10px; padding: 12px 20px; }
.pl-search {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13.5px;
}
.pl-search:focus { outline: none; border-color: var(--primary); background: #fff; }
.pl-list {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 2px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pl-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.pl-card.is-cur { border-color: var(--primary); background: #f5f9ff; }
.pl-c-main { flex: 1; min-width: 0; }
.pl-c-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  word-break: break-word;
}
.pl-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 8px;
  background: #e8f2ff;
  color: #0067c0;
  white-space: nowrap;
}
.pl-badge.is-cur { background: #0067c0; color: #fff; }
.pl-badge.is-empty { background: #f1f3f5; color: #8a949f; }
.pl-c-sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-c-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 5px;
  display: flex;
  gap: 4px 12px;
  flex-wrap: wrap;
}
.pl-c-acts { display: flex; gap: 7px; flex: 0 0 auto; }
.pl-c-acts .mini { background: #fff; border: 1px solid #d9dce1; border-radius: 8px; padding: 6px 13px; }
.pl-c-acts .mini.danger { color: var(--danger); border-color: #f0d3cf; }
.pl-c-acts .mini.danger:hover { background: #fef2f2; border-color: #e4b4ad; }
.pl-empty {
  text-align: center;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 2;
  padding: 44px 12px;
}

.paper-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 5px 11px;
  white-space: nowrap;
}

/* 组卷台两栏（试卷 + 属性），挑题在题库页进行 */
#view-paper .wrap.wide { max-width: 1360px; }

.paper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 246px;
  gap: 16px;
  align-items: start;
}

.pick-panel,
.sheet-panel,
.meta-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title { font-size: 13px; font-weight: 600; }
.mini-count { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* ---- 左：挑题 ---- */

.pick-filters {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.pick-filters select,
.pick-filters input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
}

.pick-tags {
  max-height: 96px;
  overflow: auto;
  padding: 2px 0 0;
}

.pick-list {
  max-height: 58vh;
  overflow: auto;
  padding: 6px 8px 10px;
}

.pick-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line-soft);
}

.pick-item:last-child { border-bottom: 0; }
.pick-item.is-in { background: #f7f6ff; border-radius: 8px; }

.pick-main { flex: 1 1 auto; min-width: 0; }
.pick-stem {
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pick-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.pick-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
}
.pick-btn:hover { border-color: var(--primary); color: var(--primary); }
.pick-item.is-in .pick-btn[data-act="in"],
.pick-item.is-in .pick-btn[data-act="out"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.pick-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.pick-btn.basket.is-in { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- 中：试卷 ---- */

.sheet-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.sheet-title,
.sheet-sub {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 2px 0;
}
.sheet-title { font-size: 17px; font-weight: 600; text-align: center; }
.sheet-sub { font-size: 12.5px; color: var(--text-2); text-align: center; margin-top: 3px; }
.sheet-title:focus, .sheet-sub:focus { outline: 0; background: #fbfaf8; border-radius: 6px; }

.sheet-body { padding: 8px 10px 14px; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 13px 4px 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.sec-head .sec-score { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 400; }
.sec-head .sec-bulk {
  flex: 0 0 auto;
  margin-left: 2px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-family: inherit;
  line-height: 1.5;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.sec-head .sec-bulk:hover { border-color: var(--primary); background: #e6e3fa; }
@media (max-width: 640px) {
  /* 手机上手指点，按钮做大一点，但仍然不抢标题的宽度 */
  .sec-head { flex-wrap: wrap; }
  .sec-head .sec-bulk { padding: 4px 11px; font-size: 12px; }
}

/* ---- 组卷页 · 勾选题目 ---- */

.sheet-selbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 11px;
  border-bottom: 1px solid var(--line-soft);
  background: #fcfbf9;
  font-size: 12px;
  color: var(--text-3);
}
.ssb-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.ssb-sel { margin-left: auto; }
.sheet-selbar.has-sel .ssb-sel { color: var(--primary); font-weight: 600; }

.ssb-all input,
.sr-check,
.sec-all input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.sec-all {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.sr-check { flex: 0 0 auto; margin-top: 3px; }
.sheet-row.is-picked { background: #f7f6ff; }
.sheet-row.is-picked .sr-no { color: var(--primary); }

/* ---- 图片裁切（cx- 前缀，和拍题页的框选区域区分开） ---- */

.cx-mask {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: #14161c;
}
.cx-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px 9px;
  color: #fff;
}
.cx-title { font-size: 14px; font-weight: 600; }
.cx-hint { margin-left: auto; font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.cx-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  touch-action: none;
}
/* 图片尺寸由脚本按可用空间算好后写死在 img 上，
   frame 紧贴图片，选框就相对 frame 定位，坐标天然对齐 */
.cx-frame { position: relative; display: block; flex: 0 0 auto; line-height: 0; }
.cx-img { display: block; }
.cx-prev {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
/* 清晰化控制条 */
.cx-scan {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 16px 0;
  color: #e9e7e2;
}
.cx-seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(255, 255, 255, .07);
  border-radius: 8px;
}
.cx-seg button {
  font: inherit;
  font-size: 12.5px;
  color: #b8b6b2;
  background: none;
  border: 0;
  padding: 5px 13px;
  border-radius: 6px;
  cursor: pointer;
}
.cx-seg button.on {
  color: #fff;
  background: var(--primary);
}
.cx-rg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: rgba(233, 231, 226, .6);
}
.cx-rg input[type="range"] {
  width: 118px;
  accent-color: var(--primary);
}
.cx-rg span {
  width: 20px;
  color: #e9e7e2;
  font-variant-numeric: tabular-nums;
}
.cx-box {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(8, 10, 14, .6);
  cursor: move;
  touch-action: none;
}
.cx-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255, 255, 255, .35) calc(33.33% - .5px), rgba(255, 255, 255, .35) 33.33%, transparent 33.33%, transparent calc(66.66% - .5px), rgba(255, 255, 255, .35) calc(66.66% - .5px), rgba(255, 255, 255, .35) 66.66%, transparent 66.66%),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255, 255, 255, .35) calc(33.33% - .5px), rgba(255, 255, 255, .35) 33.33%, transparent 33.33%, transparent calc(66.66% - .5px), rgba(255, 255, 255, .35) calc(66.66% - .5px), rgba(255, 255, 255, .35) 66.66%, transparent 66.66%);
  pointer-events: none;
}
.cx-h {
  position: absolute;
  width: 28px;
  height: 28px;
  z-index: 2;
}
.cx-h::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
.cx-h[data-h="nw"] { left: -14px; top: -14px; cursor: nwse-resize; }
.cx-h[data-h="n"] { left: 50%; top: -14px; margin-left: -14px; cursor: ns-resize; }
.cx-h[data-h="ne"] { right: -14px; top: -14px; cursor: nesw-resize; }
.cx-h[data-h="e"] { right: -14px; top: 50%; margin-top: -14px; cursor: ew-resize; }
.cx-h[data-h="se"] { right: -14px; bottom: -14px; cursor: nwse-resize; }
.cx-h[data-h="s"] { left: 50%; bottom: -14px; margin-left: -14px; cursor: ns-resize; }
.cx-h[data-h="sw"] { left: -14px; bottom: -14px; cursor: nesw-resize; }
.cx-h[data-h="w"] { left: -14px; top: 50%; margin-top: -14px; cursor: ew-resize; }
.cx-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
}
.cx-btn {
  height: 38px;
  padding: 0 18px;
  font: inherit;
  font-size: 13.5px;
  color: #e9e7e2;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 9px;
  cursor: pointer;
}
.cx-btn:hover { background: rgba(255, 255, 255, .18); }
.cx-btn.primary {
  color: #fff;
  font-weight: 600;
  background: var(--primary);
  border-color: var(--primary);
}
.cx-btn.primary:hover { background: #4238cf; }

@media (max-width: 640px) {
  .cx-hint { display: none; }
  .cx-btn { height: 42px; flex: 1 1 0; }
  .cx-bar { padding: 12px 14px 8px; }
  .cx-foot { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
  .cx-scan { padding: 0 12px; gap: 8px; }
  .cx-seg { flex: 0 0 auto; }
  .cx-seg button { padding: 6px 11px; font-size: 12px; }
  .cx-rg { gap: 6px; font-size: 11.5px; }
  .cx-rg input[type="range"] { width: 74px; }
  .cx-rg span { width: 18px; }
}

/* ---- 图片裁切（结束） ---- */

/* 勾选后浮出的批量操作条 */
.sel-bar {
  position: fixed;
  left: 50%;
  bottom: 54px;   /* 桌面上要抬高，避开底部的悬浮状态栏 */
  transform: translateX(-50%);
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(20, 30, 50, .2);
}
.sel-bar .sel-n { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.sel-bar .btn-primary,
.sel-bar .btn-ghost { height: 32px; padding: 0 14px; font-size: 13px; }

@media (max-width: 900px) {
  /* 900 以下没有底部状态栏，条子可以贴底一点 */
  .sel-bar { bottom: 18px; }
}

@media (max-width: 640px) {
  .ssb-all input,
  .sr-check,
  .sec-all input { width: 18px; height: 18px; }
  .sheet-selbar { padding: 9px 12px; }
  .sel-bar {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: none;
    justify-content: space-between;
    border-radius: 14px;
  }
}

/* ---- 批量分值 ---- */

.bulk-mask {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(24, 28, 40, .42);
  backdrop-filter: blur(3px);
}
.bulk-box {
  width: 100%;
  max-width: 396px;
  padding: 15px 16px 13px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 52px rgba(20, 30, 50, .26);
}
.bulk-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bulk-head b { font-size: 14.5px; }
.bulk-meta { font-size: 12px; color: var(--text-3); }
.bulk-x {
  margin-left: auto;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.bulk-x:hover { color: var(--text); border-color: var(--text-3); }
.bulk-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bulk-lb { flex: 0 0 74px; font-size: 12.5px; color: var(--text-2); }
.bulk-in {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.bulk-in:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.bulk-unit { flex: 0 0 auto; font-size: 12px; color: var(--text-3); }
.bulk-go { flex: 0 0 auto; height: 34px; padding: 0 14px; font-size: 13px; }
.bulk-tip { margin-top: 3px; font-size: 11.5px; line-height: 1.65; color: var(--text-3); }

.sheet-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-row:last-child { border-bottom: 0; }

.sr-no {
  flex: 0 0 22px;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-3);
  padding-top: 2px;
}

.sr-main { flex: 1 1 auto; min-width: 0; }
.sr-stem {
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}
.sr-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.sr-acts {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sr-score {
  width: 52px;
  border: 1px solid var(--line);
  background: #fbfaf8;
  border-radius: 7px;
  padding: 4px 6px;
  font: inherit;
  font-size: 12.5px;
  text-align: center;
  color: var(--text);
}

.sr-mini {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.sr-mini:hover { border-color: #d5d2cb; color: var(--text); }
.sr-mini.danger:hover { border-color: #e4b4ad; color: var(--danger); }
.sr-mini:disabled { opacity: 0.35; cursor: default; }

/* ---- 右：属性 ---- */

.meta-panel { padding-bottom: 13px; }

.meta-field { display: block; padding: 11px 13px 0; }
.meta-field .label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.meta-field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
}

.meta-switches { padding: 13px 13px 0; display: flex; flex-direction: column; gap: 9px; }

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.switch-row input { margin: 3px 0 0; accent-color: var(--primary); flex: 0 0 auto; }

.meta-stat {
  margin: 14px 13px 0;
  padding: 9px 11px;
  background: #fbfaf8;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--text-2);
}
.meta-stat b { color: var(--text); }

.meta-tip { font-size: 11.5px; color: var(--text-3); margin: 11px 13px 0; line-height: 1.6; }

/* ---- 试卷预览 ---- */

.pv-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #35332f;
  display: flex;
  flex-direction: column;
}

.pv-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #26241f;
  color: #f2f0ec;
}
.pv-title { font-size: 13.5px; font-weight: 600; }
.pv-hint { font-size: 11.5px; color: #a5a19a; }
.pv-bar .btn-ghost { margin-left: auto; }

.pv-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 22px 16px 46px;
  display: flex;
  justify-content: center;
}

.a4 {
  width: 794px;
  max-width: 100%;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 54px 58px 64px;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 14px;
  line-height: 1.9;
  color: #111;
}
.a4 h1 { font-size: 20px; text-align: center; margin: 0 0 4px; letter-spacing: 2px; }
.a4 .pv-sub { text-align: center; font-size: 12px; color: #555; margin: 0 0 6px; }
.a4 .pv-line { text-align: center; font-size: 12.5px; color: #333; margin: 0 0 20px; }
.a4 .pv-line span { margin: 0 10px; }
.a4 .pv-sec { font-weight: bold; margin: 20px 0 8px; }
.a4 .pv-q { margin: 0 0 9px; word-break: break-word; }
.a4 .pv-q .pv-no { font-weight: bold; }
.a4 .pv-q .pv-score { float: right; color: #666; font-size: 12px; }
.a4 .pv-ans-title { font-weight: bold; margin: 26px 0 8px; }
.a4 .pv-ans { margin: 0 0 7px; font-size: 13px; color: #222; word-break: break-word; }
.a4 .pv-tex { font-family: Consolas, monospace; font-size: 12.5px; }
.a4 .pv-empty { text-align: center; color: #999; padding: 60px 0; }

/* 答题卡（预览里用虚线示意分页） */
.a4 .pv-pagebreak {
  border-top: 1px dashed #bbb;
  margin: 34px -20px 26px;
  position: relative;
}
.a4 .pv-pagebreak::after {
  content: "新 一 页";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 0 10px;
  font-size: 11px;
  color: #aaa;
  letter-spacing: 2px;
}
.a4 .pv-part {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 6px;
  margin: 0 0 12px;
}
.a4 .pv-grid {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0 18px;
}
.a4 .pv-grid th,
.a4 .pv-grid td {
  border: 1px solid #555;
  text-align: center;
  font-size: 12.5px;
}
.a4 .pv-grid th {
  background: #f0f0f0;
  font-weight: bold;
  padding: 3px 0;
}
.a4 .pv-grid td { height: 30px; }
.a4 .pv-box {
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 8px 12px 4px;
  margin: 0 0 14px;
}
.a4 .pv-box-head { font-weight: bold; font-size: 12.5px; margin-bottom: 4px; }
.a4 .pv-blank { border-bottom: 1px solid #c8c8c8; height: 24px; }

@media (max-width: 1100px) {
  .paper-layout { grid-template-columns: minmax(0, 1fr); }
  .meta-panel { grid-column: 1 / -1; }
}

/* 属性抽屉的边缘把手 / 遮罩：桌面端（两栏布局）不显示 */
.meta-tab, .meta-mask { display: none; }

/* ==================== 自动组卷 ==================== */
.auto-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.auto-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.auto-hint { font-size: 12px; color: var(--text-2); }

/* 自动组卷：左树（范围）+ 右条件表 两个独立版块 */
.auto-m { display: none; }   /* 手机端专属（≤900px 显示），桌面端隐藏 */
.auto-layout {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.auto-tree-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  padding-bottom: 0;
}
.auto-tree-body { max-height: 560px; overflow-y: auto; padding: 8px; }
.auto-tree-foot {
  border-top: 1px solid var(--line);
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text-2);
}
.auto-tree-foot b { color: #0067c0; }

@media (max-width: 1100px) {
  .auto-layout { grid-template-columns: minmax(0, 1fr); }
  .auto-tree-body { max-height: 300px; }
}

/* ---- 自动组卷 · 手机端（≤900px）：顶部下拉设置，下方整版显示卷子 ---- */
@media (max-width: 900px) {
  .auto-layout { display: none; }   /* 收起电脑端两栏 */
  .auto-m { display: block; }

  .auto-m-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 13px 13px;
  }
  .auto-m-head { font-weight: 600; font-size: 13.5px; margin-bottom: 9px; }
  .auto-m-scope {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font: inherit; font-size: 13.5px; color: var(--text);
    padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
    cursor: pointer; text-align: left;
  }
  .auto-m-scope:active { background: #f6f9fe; }
  .auto-m-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .auto-m-bar select, .auto-m-bar input {
    font: inherit; font-size: 13.5px; padding: 9px 10px;
    border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%;
  }
  .auto-m-basket { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
  .m-rule {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff;
  }
  .m-rule-txt { flex: 1; font-size: 12.5px; line-height: 1.6; }
  .m-rule-txt b { color: #0067c0; }
  .auto-m-gen { width: 100%; margin-top: 10px; padding: 11px 0; font-size: 15px; }
  .auto-m-note {
    margin-top: 10px; border: 1px dashed #bcd4ee; background: #f4f8fd; border-radius: 9px;
    padding: 9px 12px; font-size: 13px;
  }
  .auto-m-note .auto-miss { color: var(--danger); }
  .auto-m-go { margin-top: 10px; }
  .auto-m-go .btn-ghost { width: 100%; }
  .auto-m-paper { margin-top: 12px; box-shadow: 0 6px 24px rgba(20, 40, 70, 0.14); }
  .auto-m-empty { color: var(--text-2); font-size: 13px; text-align: center; padding: 30px 10px; }
}

/* 条件表格：像老题库系统的智能组卷，点格子出下拉 */
.auto-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.auto-table { border-collapse: collapse; width: 100%; min-width: 640px; background: #fff; }
.auto-table th {
  background: #e8f0fa; color: #33517d; font-size: 12.5px; font-weight: 600;
  padding: 8px 6px; border: 1px solid #d9e4f2; white-space: nowrap;
}
.auto-table th em { font-style: normal; font-size: 11px; color: #0067c0; margin-left: 3px; }
.auto-table td { border: 1px solid #e3eaf4; padding: 5px 6px; text-align: center; }
.at-c-no { width: 44px; color: var(--text-2); font-size: 12.5px; }
.at-c-count { width: 70px; }
.at-c-pool { width: 64px; }
.at-c-act { width: 64px; }
.at-pool { font-weight: 600; color: #0067c0; font-size: 13.5px; }
.ac-cell {
  border: 1px solid var(--line); background: #fff; font: inherit; font-size: 12.5px;
  color: var(--text); padding: 5px 8px; border-radius: 6px; cursor: pointer; max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-cell:hover { border-color: #9dbde4; background: #f6f9fe; }
.ac-cell.is-empty { color: #0067c0; }
.ac-caret { font-style: normal; color: #98a7bb; font-size: 10px; }
.ac-count {
  font: inherit; font-size: 13px; width: 56px; padding: 5px 6px;
  border: 1px solid var(--line); border-radius: 6px; text-align: center;
}

/* 点格子弹出的下拉浮层 */
.auto-dd {
  position: fixed; z-index: 95; min-width: 190px; max-width: 300px; max-height: 320px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px;
  box-shadow: 0 10px 30px rgba(20, 40, 70, 0.22);
}
.auto-dd[hidden] { display: none; }
.ad-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0;
  border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--text);
  padding: 7px 8px; border-radius: 6px; cursor: pointer; text-align: left;
}
.ad-item:hover { background: #f2f7fd; }
.ad-item.is-on { color: #0067c0; font-weight: 600; }
.ad-item input { accent-color: #0067c0; }
.ad-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 手机端级联下拉：名字自适应占满，题数靠右，避免名字被挤成 0 宽 */
.ad-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.ad-item .ad-n { flex: 0 0 auto; margin-left: auto; }
.ad-tip { font-size: 12px; color: var(--text-2); padding: 6px 8px; }
.ad-sep { font-size: 11.5px; color: var(--text-2); padding: 6px 8px 2px; border-top: 1px dashed var(--line); margin-top: 4px; }
/* 树形范围选择（库 → 组，可展开勾选） */
.ad-node { display: flex; align-items: center; }
.ad-tw {
  flex: none; width: 20px; height: 20px; margin: 0 2px;
  border: 0; background: transparent; font: inherit; font-size: 12px; line-height: 1;
  color: #0067c0; cursor: pointer; border-radius: 4px;
}
.ad-tw:hover { background: #eaf2fc; }
.ad-tw.is-leaf { cursor: default; }
.ad-node .ad-item { flex: 1; padding-left: 2px; }
.ad-n { font-style: normal; font-size: 11.5px; color: #98a7bb; margin-left: auto; padding-left: 8px; }

.auto-gen { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.auto-result { margin-top: 12px; border: 1px dashed #bcd4ee; background: #f4f8fd; border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.7; }
.auto-result .auto-miss { color: var(--danger); }
.auto-result .btn-primary { margin-top: 6px; }

@media (max-width: 1100px) {
  /* 属性已抽出为固定抽屉，网格只剩试卷一栏，铺满整行 */
  .paper-layout { grid-template-columns: minmax(0, 1fr); }

  /* ---- 试卷属性 → 贴边抽屉：不占试卷位置，点边缘把手拉出/收起 ---- */
  .meta-panel {
    position: fixed;
    top: 58px;
    right: 0;
    bottom: 0;
    width: min(330px, 88vw);
    margin: 0;
    border-radius: 14px 0 0 0;
    box-shadow: -12px 0 34px rgba(20, 40, 70, 0.22);
    transform: translateX(105%);
    transition: transform 0.24s ease;
    overflow-y: auto;
    z-index: 71;
  }
  .meta-panel.is-open { transform: none; }
  .meta-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 55, 0.28);
    z-index: 70;
  }
  .meta-mask[hidden] { display: none; }
  .meta-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: fixed;
    right: 0;
    top: 44%;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-right: 0;
    background: #0067c0;
    color: #fff;
    font: inherit;
    font-size: 12px;
    padding: 10px 5px;
    border-radius: 9px 0 0 9px;
    box-shadow: -4px 4px 14px rgba(20, 40, 70, 0.25);
    cursor: pointer;
    z-index: 72;
  }
  .meta-tab .mt-ico { font-style: normal; font-size: 11px; line-height: 1; transition: transform 0.24s ease; }
  .meta-tab.is-open .mt-ico { transform: rotate(180deg); }
  .meta-tab .mt-txt { writing-mode: vertical-rl; letter-spacing: 3px; }
}

@media (max-width: 880px) {
  .paper-layout { grid-template-columns: 1fr; }

  .a4 { padding: 30px 22px 40px; font-size: 13.5px; }
  .a4 h1 { font-size: 17px; }
}

@media (max-width: 640px) {
  .paper-lib-btn { flex: 1 1 100%; justify-content: center; }
  .paper-save-state { flex: 1 1 100%; text-align: center; }
  .paper-bar .btn-primary, .paper-bar .btn-ghost { flex: 1 1 auto; }
  .paper-total { flex: 1 1 100%; text-align: center; }
  .sheet-title { font-size: 15.5px; }
  .sr-score { width: 44px; }
  .pv-hint { display: none; }
}

/* ==========================================================
   Edge 亚克力外观（样板三 · 仅宽屏 ≥901px 生效，手机端不变）
   彩色渐变壁纸 + 半透明毛玻璃面板 + 蓝强调 #0067c0
   ========================================================== */

@media (min-width: 901px) {

  /* ---------- 壁纸与整体 ---------- */
  body {
    background:
      radial-gradient(640px 460px at 10% 6%, #7ec8f7 0%, transparent 58%),
      radial-gradient(560px 460px at 90% 12%, #b9a7f5 0%, transparent 60%),
      radial-gradient(680px 500px at 82% 94%, #8fd8c9 0%, transparent 58%),
      radial-gradient(560px 460px at 16% 92%, #f7c8d8 0%, transparent 56%),
      #dfe9f2;
    background-attachment: fixed;
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 13.5px;
    color: #1c2430;
  }

  /* 经典外壳：标题栏与菜单栏整体替换，工具条改造为玻璃命令栏 */
  .win-title, .menubar { display: none; }

  #appView { min-height: 100vh; display: flex; flex-direction: column; background: transparent; }

  main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  main > .view.is-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  main > .view.is-active > .wrap {
    flex: 1;
    max-width: 1240px;
    width: 100%;
    padding: 4px 16px 56px;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* ---------- 顶栏 = Edge 页签条 ---------- */
  .topbar {
    position: sticky;
    top: 10px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 16px 6px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(30, 50, 80, 0.10);
  }

  .brand { color: #1c2430; font-weight: 600; font-size: 14px; gap: 7px; }
  .brand .dot { background: #0067c0; border-radius: 50%; width: 9px; height: 9px; }

  .tabs { display: flex; gap: 4px; background: transparent; padding: 0; margin-left: 8px; }
  .tab {
    border: 0;
    background: transparent;
    color: #3c4654;
    font-size: 13px;
    padding: 6px 18px;
    border-radius: 8px;
    transition: background 0.12s;
  }
  .tab:hover { background: rgba(255, 255, 255, 0.55); }
  .tab.is-active {
    background: rgba(255, 255, 255, 0.92);
    color: #0067c0;
    font-weight: 600;
    box-shadow: 0 1px 5px rgba(30, 50, 80, 0.14);
  }

  .counter { color: #6d7684; font-size: 12.5px; }

  .topbar .mini {
    border: 0;
    background: transparent;
    color: #3c4654;
    font-size: 12.5px;
    padding: 5px 12px;
    border-radius: 8px;
  }
  .topbar .mini:hover { background: rgba(255, 255, 255, 0.6); }

  /* ---------- 玻璃命令栏（原经典工具条） ---------- */
  .classic-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    margin: 0 16px 10px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 12px;
    box-shadow: 0 1px 8px rgba(30, 50, 80, 0.07);
  }
  .ct-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #2b3a4d;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.12s;
  }
  .ct-btn .ico { font-size: 14px; line-height: 1; color: #0067c0; }
  .ct-btn:hover { background: rgba(255, 255, 255, 0.72); }
  .ct-btn:active { background: rgba(227, 238, 249, 0.9); }
  .ct-sep { width: 1px; height: 18px; background: rgba(40, 60, 90, 0.18); margin: 0 6px; }

  /* ---------- 状态栏 = 底部悬浮玻璃条 ---------- */
  .statusbar {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 16px;
    box-shadow: 0 3px 14px rgba(30, 50, 80, 0.14);
    max-width: calc(100vw - 40px);
  }
  .sb-cell {
    border: 0;
    background: transparent;
    padding: 2px 12px;
    font-size: 11.5px;
    color: #3c4654;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 10px;
  }
  .sb-cell + .sb-cell { border-left: 1px solid rgba(40, 60, 90, 0.12); border-radius: 0; }

  /* ---------- 毛玻璃面板通用 ---------- */
  .card,
  .tree-panel,
  .list-panel,
  .pick-panel,
  .sheet-panel,
  .meta-panel {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(30, 50, 80, 0.09);
  }
  .card { padding: 16px 18px; margin-bottom: 12px; }

  .card-head h2, .panel-title, .tree-title { color: #1c2430; font-size: 14px; font-weight: 600; }
  .card-head .hint, .hint, .meta-tip, .list-meta { color: #6d7684; }

  /* ---------- 按钮 ---------- */
  .btn-primary,
  .btn-ghost,
  .mini,
  .badge-btn {
    border-radius: 8px;
    font-family: inherit;
    font-size: 12.5px;
    padding: 6px 16px;
    transition: background 0.12s, box-shadow 0.12s;
  }
  .btn-primary {
    background: #0067c0;
    color: #fff;
    font-weight: 600;
    border: 0;
    box-shadow: 0 1px 6px rgba(0, 103, 192, 0.35);
  }
  .btn-primary:hover { background: #0078d4; }
  .btn-ghost, .badge-btn {
    background: rgba(255, 255, 255, 0.72);
    color: #2b3a4d;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 4px rgba(30, 50, 80, 0.08);
  }
  .btn-ghost:hover, .badge-btn:hover { background: #fff; }
  .mini {
    background: transparent;
    color: #3c4654;
    border: 0;
    padding: 4px 10px;
  }
  .mini:hover { background: rgba(255, 255, 255, 0.65); }

  /* ---------- 输入 ---------- */
  #appView input:not([type="checkbox"]):not([type="radio"]),
  #appView select,
  #appView textarea {
    background: rgba(255, 255, 255, 0.78);
    color: #1c2430;
    border: 1px solid rgba(120, 140, 165, 0.35);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    transition: border-color 0.12s, background 0.12s;
  }
  #appView input:focus, #appView select:focus, #appView textarea:focus {
    outline: none;
    border-color: #0067c0;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 103, 192, 0.18);
  }
  #appView input::placeholder { color: #8a93a0; }
  #appView input[type="checkbox"], #appView input[type="radio"] { accent-color: #0067c0; }

  /* ---------- 目录树 → Edge 圆角行 ---------- */
  .tree-row { border-radius: 7px; padding: 4px 6px; }
  .tree-row:hover { background: rgba(255, 255, 255, 0.72); }
  .tree-row.is-active {
    background: #e3eef9;
    color: #005ba1;
    font-weight: 600;
  }
  .tree-row .tw, .tree-row .tw-leaf { color: #6d7684; border-radius: 4px; }
  .tree-row .tw:hover { background: rgba(0, 103, 192, 0.12); }
  .tree-row.is-active .tw { color: #005ba1; background: transparent; }
  .tree-row .tc { color: #8a93a0; }
  .tree-row.is-active .tc { color: #005ba1; }
  .tree-row .wtag {
    background: rgba(0, 103, 192, 0.10);
    color: #0067c0;
    border-radius: 8px;
    font-size: 10.5px;
    padding: 0 7px;
  }
  .tree-row.is-active .wtag { background: rgba(0, 103, 192, 0.16); }
  .tree-row .tmini { border-radius: 5px; }
  .tree-row .tmini:hover { color: #0067c0; background: rgba(255, 255, 255, 0.85); }
  .tree-row.is-active .tmini { color: #005ba1; }
  .wt-kids > .tree-row::before { background: rgba(40, 60, 90, 0.14); }
  .wt-menu {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(30, 50, 80, 0.18);
    overflow: hidden;
  }
  .wt-menu button:hover { background: #e3eef9; color: #005ba1; }

  /* ---------- 题目卡片 ---------- */
  .item {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(30, 50, 80, 0.07);
    transition: box-shadow 0.15s, background 0.15s;
  }
  .item:hover { background: rgba(255, 255, 255, 0.9); box-shadow: 0 4px 16px rgba(30, 50, 80, 0.13); }

  .badge { background: #e3eef9; color: #0067c0; border-radius: 10px; }
  .badge.gray { background: rgba(255, 255, 255, 0.75); color: #6d7684; }
  .badge-btn:hover { box-shadow: 0 0 0 2px rgba(0, 103, 192, 0.18); }

  .tag-cloud button, .wtag {
    border-radius: 12px;
    border: 1px solid rgba(120, 140, 165, 0.3);
    background: rgba(255, 255, 255, 0.6);
    color: #3c4654;
  }
  .tag-cloud button:hover { background: rgba(255, 255, 255, 0.9); }
  .tag-cloud button.is-on, .wtag.is-on { background: #0067c0; border-color: #0067c0; color: #fff; }

  .dropzone {
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px dashed rgba(0, 103, 192, 0.35);
    border-radius: 12px;
  }
  .dropzone:hover { background: rgba(255, 255, 255, 0.8); border-color: #0067c0; }

  /* ---------- 弹窗 ---------- */
  .modal-mask { background: rgba(20, 35, 55, 0.35); backdrop-filter: blur(3px); }
  .modal-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(20, 40, 70, 0.25);
  }
  .qt-mask { background: rgba(20, 35, 55, 0.35); backdrop-filter: blur(3px); }
  .qt-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(20, 40, 70, 0.25);
  }
  .qt-tag { background: #e3eef9; color: #0067c0; border-radius: 8px; }

  .toast {
    background: rgba(255, 255, 255, 0.92);
    color: #1c2430;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(20, 40, 70, 0.2);
    backdrop-filter: blur(16px);
    font-family: inherit;
  }

  /* ---------- 试卷预览 ---------- */
  .pv-mask { background: rgba(30, 45, 70, 0.55); backdrop-filter: blur(6px); }
  .pv-bar {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(18px) saturate(1.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  }
  .pv-title { color: #1c2430; font-weight: 600; }

  /* ---------- 组卷三栏 ---------- */
  .pick-list, .list { scrollbar-width: thin; }
  .sheet-panel { overflow: hidden; }
  .paper-total { color: #0067c0; font-weight: 600; }

  /* ---------- 登录页 ---------- */
  .auth-card {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(20, 40, 70, 0.18);
  }

  /* ---------- 细滚动条 ---------- */
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-thumb {
    background: rgba(40, 60, 90, 0.22);
    border-radius: 6px;
    border: 3px solid transparent;
    background-clip: content-box;
  }
  *::-webkit-scrollbar-thumb:hover { background-color: rgba(40, 60, 90, 0.4); }
  *::-webkit-scrollbar-track { background: transparent; }

}

/* Edge 主题补充：目录树等处去宋体 */
@media (min-width: 901px) {
  .tree, .wt-edit, .wt-menu, .tree-empty, .tree-foot {
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  }
  .tree { font-size: 12.5px; }
  .wt-edit { font-size: 12.5px; border: 1px solid #0067c0; border-radius: 5px; }
  .wt-menu { font-size: 12.5px; }
  .tree-row { font-size: 12.5px; }
}

/* 登录页标签切换 */
.auth-tabs { display: flex; gap: 6px; margin: 2px 0 16px; background: rgba(15, 30, 55, .05); padding: 4px; border-radius: 11px; }
.auth-tab { flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 8px; font-size: 14px; color: #445; cursor: pointer; transition: all .15s; }
.auth-tab.is-active { background: #fff; color: #0067c0; font-weight: 600; box-shadow: 0 1px 4px rgba(0, 40, 90, .15); }
.auth-tab:hover:not(.is-active) { background: rgba(0, 103, 192, .06); }

/* 管理员标识 */
.role-badge { display: inline-block; background: #0067c0; color: #fff; font-size: 12px; line-height: 1; padding: 4px 9px; border-radius: 11px; margin-right: 8px; vertical-align: middle; }

/* 手机端专用元素：桌面端一律隐藏（显示规则见文末 ≤900px 媒体查询） */
.m-more, .m-sheet, .m-mask { display: none; }

/* ==========================================================
   手机端（≤900px）· 与电脑端同一视觉语言
   彩色渐变壁纸 + 毛玻璃面板 + 蓝强调 #0067c0
   经典外壳（标题栏/菜单栏/工具条）收起进「⋯」面板
   ========================================================== */
@media (max-width: 900px) {

  /* ---------- 壁纸 ---------- */
  body {
    background:
      radial-gradient(520px 380px at 10% 2%, #a8d4f5 0%, transparent 60%),
      radial-gradient(480px 360px at 92% 8%, #c3b6f7 0%, transparent 62%),
      radial-gradient(520px 420px at 86% 96%, #9adccd 0%, transparent 58%),
      radial-gradient(460px 360px at 10% 94%, #f6c9da 0%, transparent 56%),
      #e6eef6;
    background-attachment: fixed;
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14.5px;
    color: #1c2430;
    -webkit-tap-highlight-color: transparent;
  }

  /* ---------- 收起经典外壳与悬浮状态栏 ---------- */
  .win-chrome { display: none !important; }
  .statusbar { display: none !important; }

  #appView { min-height: 100vh; display: flex; flex-direction: column; }
  main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .view.is-active { display: block; }

  .wrap {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 10px 13px calc(30px + env(safe-area-inset-bottom));
  }
  .wrap.wide { max-width: 680px; }

  /* ---------- 顶栏：品牌 + 三段页签 + ⋯ ---------- */
  .topbar {
    position: sticky;
    top: env(safe-area-inset-top);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 12px;
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(30, 50, 80, 0.10);
  }
  .brand { font-size: 13.5px; font-weight: 600; color: #1c2430; gap: 6px; }
  .brand .dot { background: #0067c0; border-radius: 50%; width: 9px; height: 9px; }
  .counter, .role-badge, #signOutBtn { display: none !important; }
  .tabs {
    flex: 1 1 auto;
    display: flex;
    gap: 2px;
    min-width: 0;
    background: rgba(255, 255, 255, 0.45);
    padding: 3px;
    border-radius: 11px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 1 0 auto;
    border: 0;
    background: transparent;
    color: #3c4654;
    font: inherit;
    font-size: 12.5px;
    padding: 6px 7px;
    border-radius: 9px;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
  }
  .tab.is-active {
    background: #fff;
    color: #0067c0;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(30, 50, 80, 0.12);
  }

  .m-more {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    color: #2b3a4d;
    font-size: 17px;
    line-height: 1;
    padding: 0 0 2px;
    cursor: pointer;
  }
  .m-more:active { background: #e3eef9; }

  /* ---------- 毛玻璃面板 ---------- */
  .card,
  .tree-panel,
  .list-panel,
  .pick-panel,
  .sheet-panel,
  .meta-panel {
    background: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(30, 50, 80, 0.08);
  }
  .card { padding: 14px 13px; margin-bottom: 11px; }
  .card-head { margin-bottom: 10px; }
  .card-head h2 { color: #1c2430; font-size: 14.5px; font-weight: 600; }
  .card-head .hint, .hint, .meta-tip, .list-meta, .tree-foot { color: #6d7684; }
  .hint { font-size: 12px; }

  /* ---------- 按钮 ---------- */
  .btn-primary, .btn-ghost {
    border-radius: 10px;
    font-family: inherit;
    font-size: 13.5px;
    padding: 10px 14px;
    transition: background 0.12s, box-shadow 0.12s;
  }
  .btn-primary {
    background: #0067c0;
    color: #fff;
    font-weight: 600;
    border: 0;
    box-shadow: 0 1px 6px rgba(0, 103, 192, 0.32);
  }
  .btn-primary:active { background: #005ba1; }
  .btn-ghost {
    background: rgba(255, 255, 255, 0.78);
    color: #2b3a4d;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(30, 50, 80, 0.07);
  }
  .btn-ghost:active { background: #fff; }
  .mini {
    border-radius: 8px;
    font-family: inherit;
    font-size: 12.5px;
    padding: 6px 11px;
    background: transparent;
    color: #3c4654;
    border: 0;
  }
  .mini:active { background: rgba(0, 103, 192, 0.1); }
  .mini.primary { background: #0067c0; color: #fff; }
  .mini.primary:active { background: #005ba1; }
  .mini.danger { color: var(--danger); }

  /* ---------- 输入 ---------- */
  #appView input:not([type="checkbox"]):not([type="radio"]),
  #appView select,
  #appView textarea {
    background: rgba(255, 255, 255, 0.85);
    color: #1c2430;
    border: 1px solid rgba(120, 140, 165, 0.32);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    padding: 9px 11px;
  }
  #appView input:focus, #appView select:focus, #appView textarea:focus {
    outline: none;
    border-color: #0067c0;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 103, 192, 0.18);
  }
  #appView input::placeholder { color: #8a93a0; }
  #appView input[type="checkbox"] { accent-color: #0067c0; width: 17px; height: 17px; }
  .field .label { font-size: 12.5px; color: #3c4654; }

  /* ---------- 录题 ---------- */
  .dropzone {
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px dashed rgba(0, 103, 192, 0.35);
    border-radius: 14px;
    padding: 26px 14px;
  }
  .dropzone:active { background: rgba(255, 255, 255, 0.85); border-color: #0067c0; }
  .dz-title { font-size: 14.5px; font-weight: 600; color: #1c2430; }
  .dz-sub { font-size: 12px; color: #6d7684; }
  .crop-wrap .row { gap: 7px; }
  .crop-wrap .btn-primary, .crop-wrap .btn-ghost { font-size: 12.5px; padding: 8px 12px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .pick-row { flex-direction: column; gap: 8px; }
  .chip-pick { max-height: none; }

  /* 录题卡片 */
  .pcard { padding: 12px; border-radius: 12px; }
  .pcard-head { gap: 6px; margin-bottom: 8px; }
  .pcard-right { gap: 6px; }
  .pcard .mini { font-size: 12px; padding: 6px 10px; }
  .pthumb { max-height: 130px; }
  .psum-thumb { width: 64px; height: 64px; }
  .psum-stem { font-size: 13.5px; }
  .meta-grid { grid-template-columns: 1fr; gap: 8px; }
  .meta-cell .pick-row { flex-direction: row; gap: 6px; }
  .opt-collapsed { flex-wrap: wrap; }
  .actions { flex-direction: column; gap: 8px; }
  .actions .btn-primary, .actions .btn-ghost { width: 100%; }
  .actions .status { text-align: center; }
  .preview-box { border-radius: 10px; }

  /* ---------- 题库 ---------- */
  .toolbar { gap: 7px; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .toolbar .btn-ghost, .toolbar .btn-primary {
    flex: 1 1 auto;
    font-size: 12.5px;
    padding: 8px 10px;
    text-align: center;
  }
  .bank-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }

  .tree-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.66);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 11px 13px;
    font: inherit;
    font-size: 13.5px;
    color: #1c2430;
    cursor: pointer;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(30, 50, 80, 0.07);
  }
  .tree-toggle .chev { margin-left: auto; color: #6d7684; font-size: 12px; }

  /* 目录树 = 底部抽屉 */
  .tree-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: none;
    max-height: 76vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 8px 14px calc(20px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    box-shadow: 0 -6px 30px rgba(20, 40, 70, 0.22);
  }
  .tree-panel.is-open { display: block; }
  .tree { max-height: none; font-size: 13.5px; }
  .tree-row { padding: 7px 8px; border-radius: 8px; }
  .tree-row .tbtns { display: inline-flex; }
  .tag-cloud { max-height: none; }
  .tag-chip { font-size: 12.5px; padding: 4px 10px; }

  .list-meta { font-size: 12px; margin-bottom: 8px; }
  .list { gap: 9px; }
  .item {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(30, 50, 80, 0.06);
    padding: 12px 13px;
  }
  .badge { background: #e3eef9; color: #0067c0; border-radius: 10px; font-size: 11px; }
  .badge.gray { background: rgba(255, 255, 255, 0.8); color: #6d7684; }

  /* 紧凑卡片 + 悬浮窗（手机端） */
  /* 紧凑卡片（手机端排版：与桌面不同 —— 底行拆成 元信息/链接/全宽CTA 三行） */
  .q-item { padding: 11px 12px 10px; }
  .q-row1 { gap: 6px; }
  .q-stem { font-size: 14px; }
  .q-stem.clamped { max-height: calc(1.7em * 3); }
  .q-more { font-size: 12.5px; padding: 3px 12px; margin-top: 7px; }
  .q-bottom { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 9px; }
  .q-meta {
    flex-wrap: wrap;
    white-space: normal;
    gap: 4px 12px;
    font-size: 11.5px;
    line-height: 1.7;
  }
  .q-acts { flex-direction: column; align-items: stretch; gap: 8px; }
  .q-acts-links { justify-content: space-between; }
  .q-link { padding: 6px 6px; }
  .q-acts-cta { margin-left: 0; gap: 8px; }
  .q-acts-cta .q-btn {
    flex: 1 1 0;
    text-align: center;
    padding: 9px 10px;
    font-size: 13px;
  }
  .qpop-mask { padding: 0; align-items: flex-end; }
  .qpop-card {
    max-width: none;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 16px 16px 0 0;
  }
  .qp-set-grid { grid-template-columns: 1fr; }

  /* ---------- 组卷 ---------- */
  .paper-bar { gap: 7px; }
  .paper-lib-btn { flex: 1 1 100%; justify-content: center; font-size: 13px; }
  .paper-save-state { flex: 1 1 100%; text-align: center; }
  .paper-bar .btn-primary, .paper-bar .btn-ghost {
    flex: 1 1 auto;
    font-size: 12.5px;
    padding: 8px 10px;
    text-align: center;
  }
  #paperExportDoc, #paperExportMd, #paperDeleteBtn { display: none; }
  .paper-total { flex: 1 1 100%; text-align: center; font-size: 12.5px; }

  /* 卷库整页：手机上铺满整屏，卡片竖排 */
  .pl-mask { padding: 0; align-items: stretch; }
  .pl-page { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .pl-bar { padding: 13px 14px 10px; flex-wrap: wrap; gap: 4px 10px; }
  .pl-bar-title { flex: 1 1 auto; }
  .pl-bar-hint { flex-basis: 100%; order: 3; font-size: 12px; line-height: 1.5; }
  .pl-tools { padding: 8px 12px 10px; }
  .pl-tools .btn-primary { flex: 0 0 auto; font-size: 12.5px; padding: 8px 12px; }
  .pl-list { padding: 0 12px 28px; }
  .pl-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 11px 12px; }
  .pl-c-acts { justify-content: flex-end; }
  .pl-c-acts .mini { flex: 1; padding: 8px 0; text-align: center; }

  .paper-layout { grid-template-columns: 1fr; gap: 11px; }
  .pick-list { max-height: 42vh; }
  .pick-main { padding: 9px 10px; }
  .pick-btn { font-size: 12px; padding: 5px 12px; }

  .sheet-head { padding: 12px 13px; }
  .sheet-title { font-size: 15px; }
  .sheet-sub { font-size: 12px; }
  .sheet-body { padding: 12px 13px; }
  .sheet-row { gap: 8px; padding: 9px 0; }
  .sr-no { font-size: 12.5px; }
  .sr-stem { font-size: 13.5px; }
  .sr-meta { font-size: 11.5px; }
  .sr-score { width: 46px; }
  .sr-acts { gap: 4px; }
  .sr-mini { font-size: 12px; padding: 5px 8px; }

  .meta-panel { padding: 13px; }
  .meta-switches { gap: 4px; }
  .switch-row { font-size: 13px; padding: 7px 0; }
  .meta-stat { font-size: 12.5px; }
  .meta-tip { font-size: 11.5px; }

  /* ---------- 遮罩 + ⋯ 面板 ---------- */
  .m-mask {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(20, 35, 55, 0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
  }
  .m-mask.is-on { display: block; }

  .m-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    display: none;
    padding: 6px 14px calc(16px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(22px) saturate(1.6);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    box-shadow: 0 -6px 30px rgba(20, 40, 70, 0.24);
  }
  .m-sheet.is-open { display: block; }
  .m-sheet-grip {
    width: 38px;
    height: 4px;
    border-radius: 3px;
    background: rgba(40, 60, 90, 0.22);
    margin: 4px auto 8px;
  }
  .m-sheet-title {
    font-size: 13px;
    font-weight: 600;
    color: #1c2430;
    margin: 0 2px 10px;
  }
  /* 窄屏从列表区搬过来的「全选本页 / 题型筛选 / 页码」 */
  .m-sheet-list { margin: 0 0 10px; }
  .m-sheet-list:empty { display: none; }
  .m-sheet-list .list-head {
    margin: 0;
    padding: 8px 10px;
    gap: 8px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(40, 70, 110, 0.12);
  }
  .m-sheet-list .lh-check { font-size: 13px; }
  .m-sheet-list .lh-qtype { padding: 5px 12px; font-size: 12.5px; }
  .m-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .m-act {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 11px 4px 9px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 4px rgba(30, 50, 80, 0.07);
    font-family: inherit;
    cursor: pointer;
  }
  .m-act:active { background: #e3eef9; }
  .m-act-ico { font-size: 17px; line-height: 1; color: #0067c0; }
  .m-act-t { font-size: 11px; color: #2b3a4d; line-height: 1.25; text-align: center; }

  /* ---------- 弹窗 / 提示 ---------- */
  .modal-card {
    width: calc(100vw - 32px);
    max-width: 420px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 40px rgba(20, 40, 70, 0.25);
  }
  .modal-actions { gap: 8px; }
  .modal-actions .btn-ghost, .modal-actions .btn-primary { flex: 1 1 0; }
  .qt-card { width: calc(100vw - 32px); max-width: 420px; }
  .toast {
    bottom: calc(18px + env(safe-area-inset-bottom));
    border-radius: 12px;
    font-size: 13px;
  }

  /* ---------- 试卷预览 ---------- */
  .a4 { padding: 26px 16px 34px; font-size: 13px; }
  .a4 h1 { font-size: 16px; }
  .pv-hint { display: none; }
  .pv-bar { padding: 8px 12px; }

  /* ---------- 登录页 ---------- */
  .auth-card {
    width: calc(100vw - 32px);
    max-width: 420px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 40px rgba(20, 40, 70, 0.18);
  }
  .auth { padding: 24px 0; }

  /* 细滚动条 */
  *::-webkit-scrollbar { width: 8px; height: 8px; }
  *::-webkit-scrollbar-thumb {
    background: rgba(40, 60, 90, 0.22);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  *::-webkit-scrollbar-track { background: transparent; }
}

/* ==========================================================
   题目篮（购物车式攒题 → 组卷）
   ========================================================== */

.basket-fab, .bk-mask { display: none; }

.bf-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #0067c0;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}
.bf-ico.sm { width: 20px; height: 20px; font-size: 11px; border-radius: 6px; }

/* 悬浮入口 */
.basket-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 45;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 15px 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: 0 4px 18px rgba(30, 50, 80, 0.18);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #1c2430;
  cursor: pointer;
}
.basket-fab.is-show { display: flex; }
.basket-fab:hover { background: #fff; }
.basket-fab:active { transform: translateY(1px); }
.bf-n {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #0067c0;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}

/* 遮罩 */
.bk-mask {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(20, 35, 55, 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.bk-mask.is-on { display: block; }

/* 抽屉：桌面右侧滑出 */
.basket-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 56;
  width: 388px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  transform: translateX(103%);
  transition: transform 0.22s ease, visibility 0.22s;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border-left: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: -8px 0 32px rgba(20, 40, 70, 0.22);
}
.basket-drawer.is-open { visibility: visible; transform: translateX(0); }

.bk-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.bk-title { font-size: 14.5px; font-weight: 600; color: #1c2430; }
.bk-count { font-size: 12.5px; color: var(--text-3); }
.bk-grow { flex: 1 1 auto; }
.bk-head .mini { font-size: 12px; }

.bk-body {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 12px 12px;
}
.bk-empty {
  padding: 30px 14px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.9;
  text-align: center;
}
.bk-empty b { color: var(--text-2); }

.bk-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.bk-item:last-child { border-bottom: 0; }
.bk-main { flex: 1 1 auto; min-width: 0; }
.bk-stem {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.bk-acts { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.bk-acts .mini { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
/* 已加入试卷：按钮变灰、不可点 */
.bk-acts .mini[disabled] {
  background: #f2f3f5;
  border-color: #dcdfe4;
  color: #a2a9b3;
  opacity: 1;
  cursor: default;
}

.bk-foot {
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.55);
}
.bk-tip {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
  margin-bottom: 9px;
}
.bk-foot .btn-primary { width: 100%; }
.bk-foot .btn-primary:disabled { opacity: 0.5; cursor: default; }

/* 题目篮 · 手机端：右下角小胶囊 + 底部抽屉 */
@media (max-width: 900px) {
  .basket-fab {
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    padding: 8px 12px 8px 8px;
    font-size: 13px;
  }
  .basket-fab .bf-txt { display: none; }
  .basket-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 82vh;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px 18px 0 0;
    transform: translateY(103%);
    box-shadow: 0 -8px 32px rgba(20, 40, 70, 0.24);
  }
  .basket-drawer.is-open { transform: translateY(0); }
  .bk-acts { flex-direction: row; }
  .bk-stem { font-size: 13px; }
  .bk-head { padding-top: 10px; }
  .bk-head::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 6px;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 3px;
    background: rgba(40, 60, 90, 0.22);
  }
  .bk-head { position: relative; padding-top: 16px; }
}

/* 扫图按钮 · 手机端：标签行可换行，不挤压 */
@media (max-width: 900px) {
  .pcard .label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
  }
  .pcard .label .scan-btn,
  .pcard .label .ins-img { margin-left: 0; }
  .scan-status { font-size: 11.5px; margin-top: 4px; }
}

/* ==================== 批量工具（题库页） ==================== */

/* 卡片上的勾选框 */
.q-sel {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0 7px 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.batch-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 58;
  width: max-content;
  max-width: min(96vw, 940px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(20, 30, 50, .18);
  padding: 8px 10px;
}
.batch-bar[hidden] { display: none; }
.bb-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bb-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  padding: 0 3px;
}
.bb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 2px; }
/* 已选数量旁边的红叉：一键取消多选 */
.bb-x {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  color: #d33a2c;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.bb-x:hover { background: #fdf2f1; }
.bb-btn {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.bb-btn:hover:not(:disabled) { border-color: #d5d2cb; color: var(--text); }
.bb-btn:disabled { opacity: .4; cursor: default; }
.bb-btn.is-on { border-color: var(--primary); color: var(--primary); background: rgba(80, 70, 229, .07); }
.bb-btn.danger { color: #d33a2c; border-color: #e6bdb9; }
.bb-btn.danger:hover:not(:disabled) { background: #fdf2f1; border-color: #d98a82; }
.bb-btn.ghost { border-style: dashed; }
.bb-close {
  margin-left: 2px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 6px;
}
.bb-close:hover { background: #f2f3f5; color: var(--text); }
.bb-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--line);
  margin-top: 8px;
  padding-top: 9px;
}
.bb-panel[hidden] { display: none; }
.bp-label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.bp-input {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--text);
  min-width: 210px;
}
.bp-input:focus { outline: none; border-color: var(--primary); }
.bp-chip {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.bp-chip:hover { border-color: var(--primary); color: var(--primary); }
.bp-chip.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.bp-chip.primary:hover { color: #fff; filter: brightness(.94); }

@media (max-width: 640px) {
  .batch-bar {
    left: 8px;
    right: 8px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-width: none;
    padding: 8px;
  }
  .bb-btn { padding: 6px 8px; font-size: 12px; }
  .bp-input { min-width: 0; flex: 1 1 100%; }
}

/* ==================== 题库列表分页 + 全选行 ==================== */

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.lh-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.lh-check input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.lh-check b { color: var(--text); }
.lh-page { font-size: 12px; color: var(--text-2); white-space: nowrap; }

/* 题型多选筛选条（全选本页那行中间） */
.lh-qtypes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.lh-qtypes-k { font-size: 12px; color: var(--text-2); }
.lh-qtype {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.lh-qtype input { width: 13px; height: 13px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.lh-qtype.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.lh-qtype.is-on input { accent-color: #fff; }

.list-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 0 4px;
}
.list-pager .mini { min-width: 86px; }
.list-pager .mini:disabled { opacity: .4; cursor: default; }
.pg-info { font-size: 12.5px; color: var(--text-2); }

/* ==================== 录题卡片：操作按钮放到最下端 ==================== */

.pcard-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.pcard.is-collapsed .pcard-foot { border-top-color: transparent; padding-top: 0; margin-top: 8px; }
.pcard-right:empty { display: none; }

/* ---------- 插入公式面板 ---------- */

.math-pad {
  position: fixed;
  z-index: 96; /* 需高于题目弹窗 .qpop-mask(90) 与下拉层(95)，否则在弹窗内点"插公式"会被遮住 */
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(31, 30, 28, 0.18);
  max-height: min(62vh, 440px);
}
.math-pad[hidden] { display: none; }

.mp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.mp-title { font-weight: 600; color: var(--text-2); font-size: 13px; }
.mp-close {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 17px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.mp-close:hover { background: var(--line-soft); color: var(--text); }

.mp-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.mp-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: 999px;
  font-size: 12px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.mp-tab:hover { border-color: var(--primary); color: var(--primary); }
.mp-tab.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }

.mp-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  overflow: auto;
  padding: 2px;
  align-content: start;
}
.mp-item {
  border: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--text);
  border-radius: 9px;
  padding: 8px 4px;
  font-size: 12.5px;
  line-height: 1.25;
  min-height: 38px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.mp-item:active { transform: scale(0.98); }

.mp-tip { font-size: 11px; color: var(--text-3); line-height: 1.5; }

/* 填写答案弹窗 · 字段预览 */
.qp-preview {
  margin-top: 6px;
  border: 1px dashed #a9c3e0;
  background: #f4f8fd;
  border-radius: 9px;
  padding: 7px 10px 9px;
}
.qp-preview-t {
  font-size: 10.5px;
  color: #6d87a6;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}
.qp-preview .qp-preview-c { font-size: 14px; line-height: 1.7; word-break: break-word; }
.qp-preview .qp-preview-c img.inline-img { max-width: 100%; }
.ins-prev.is-on { background: #e3eefb; border-color: #7ea4cf; color: #2c5f9e; }

/* 当前条件可抽题量提示 */
.auto-m-avail {
  margin-top: 8px;
  border: 1px solid #cfe0f3;
  background: #f2f7fd;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #47627e;
}
.auto-m-avail b { color: #0067c0; font-size: 14px; font-weight: 700; }
.auto-m-avail.is-zero { border-color: #f0c9c4; background: #fdf4f2; color: #9c4a3f; }
.auto-m-avail.is-zero b { color: var(--danger); }

/* 手机端"库/组"：就地展开面板（不用浮动定位，避免遮挡与文字不渲染问题） */
.m-scope-dd {
  position: static;
  inset: auto;
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: 58vh;
  overflow-y: auto;
  margin-top: 8px;
  border-radius: 10px;
  box-shadow: none;
  padding: 4px 8px 6px;
}
/* 具体行样式见文件末尾的 .psc-*（手机端目录统一走那套纯文档流，
   这里不再对 .ad-* 做任何 float / flex 覆盖 —— 那正是 iOS 吞掉库名的原因） */
/* 数量超过可抽题量：红字 + 加粗（需压过 #appView input 的基础样式） */
#appView #mCount.is-over,
#appView input.ac-count.is-over,
#appView .m-rule .mr-count.is-over {
  color: var(--danger) !important;
  font-weight: 700 !important;
  border-color: #e0a9a0 !important;
  background: #fdf4f2 !important;
}
.m-rule.is-over .m-rule-txt { color: var(--danger); }
.m-rule .mr-over { color: var(--danger); font-style: normal; font-weight: 700; }
.m-rule .mr-count {
  width: 54px;
  padding: 2px 6px;
  font: inherit;
  font-size: 13px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

/* ---------- 试卷库 ---------- */
.plib-bar .plib-count { font-size: 13px; color: var(--text-2); }
.plib-main { min-width: 0; }
.plib-mobile-scope { display: none; }
.plib-list { display: flex; flex-direction: column; gap: 10px; }
.plib-empty {
  border: 1px dashed #cfd9e6;
  background: #f8fafc;
  border-radius: 12px;
  padding: 28px 18px;
  text-align: center;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.9;
}
.plib-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.pi-ico {
  flex: none;
  width: 56px;
  height: 44px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.pi-file { background: #eef2ff; color: #4353c9; }
.pi-made { background: #eaf7ef; color: #1f7a4d; }
.pi-main { flex: 1 1 auto; min-width: 0; }
.pi-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pi-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pi-acts { flex: none; display: flex; gap: 6px; }
.plib-tree-panel .ad-item { font-size: 13px; }

/* 导入待确认清单 */
.plib-stage {
  border: 1px solid #cfd9e6;
  background: #f7fbff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.ps-head { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.ps-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px dashed var(--line-soft); }
.ps-badge {
  flex: none; width: 48px; height: 34px; border-radius: 7px;
  background: #eef2ff; color: #4353c9; font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ps-fields { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ps-name {
  font: inherit; font-size: 13.5px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%;
}
.ps-line { display: flex; gap: 8px; align-items: center; }
.ps-tags {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 12.5px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.ps-cat {
  flex: 0 0 auto; max-width: 46%; font: inherit; font-size: 12.5px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.ps-foot { display: flex; gap: 10px; margin-top: 10px; }

/* 试卷库标签筛选条 */
.plib-tagbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.ptb-label { font-size: 12px; color: var(--text-3); }
.ptag {
  display: inline-flex; align-items: center; gap: 4px;
  font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: #3c4654; cursor: pointer;
}
.ptag em { font-style: normal; font-size: 11px; color: var(--text-3); }
.ptag.is-on { background: #eef2ff; border-color: #b9c4f2; color: #33409c; font-weight: 600; }
.pi-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.pi-tag {
  font-style: normal; font-size: 11.5px; padding: 1px 8px;
  border-radius: 999px; background: #eef2ff; color: #4a57b8;
}

@media (max-width: 900px) {
  .plib-mobile-scope { display: block; margin-bottom: 10px; }
  .plib-item { flex-wrap: wrap; align-items: flex-start; }
  .pi-acts { width: 100%; justify-content: flex-end; }
  .ps-line { flex-wrap: wrap; }
  .ps-cat { max-width: 100%; }
}

/* 窄屏：让页签放得下（品牌文字收起，只留圆点；页签本身可横向滑动） */
@media (max-width: 480px) {
  .topbar .brand { font-size: 0; gap: 0; }
}

@media (max-width: 640px) {
  .math-pad {
    left: 8px !important;
    right: 8px;
    width: auto !important;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom));
    max-height: 58vh;
  }
  .mp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ==========================================================
   悬浮「录题」按钮（替代原先塞在顶栏里的 ＋录题）
   常驻右下角；录题页里自动隐藏，避免自己挡自己
   ========================================================== */
.cap-fab {
  position: fixed;
  right: 22px;
  bottom: 54px;
  z-index: 47;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 50px;
  padding: 0 20px 0 15px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1c86dd 0%, #0067c0 62%, #005ba1 100%);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 103, 192, 0.36), 0 2px 6px rgba(0, 60, 120, 0.18);
  transition: transform .14s ease, box-shadow .14s ease;
  -webkit-tap-highlight-color: transparent;
}
.cap-fab .cf-ico {
  font-size: 21px;
  line-height: 1;
  font-weight: 400;
  margin-top: -1px;
}
.cap-fab:hover { box-shadow: 0 10px 26px rgba(0, 103, 192, 0.46); }
.cap-fab:active { transform: translateY(2px) scale(.985); box-shadow: 0 4px 14px rgba(0, 103, 192, 0.34); }
/* 已进入录题页 / 组卷页：藏起来（组卷页每行右侧有 ↑↓× 会被挡住） */
body.in-capture .cap-fab,
body.in-paper .cap-fab { display: none; }

/* 桌面端：让开底部状态栏，题目篮挪到录题按钮上方 */
@media (min-width: 901px) {
  .basket-fab { bottom: 114px; }
}

/* 手机端：更大更好点，题目篮叠在录题按钮上面 */
@media (max-width: 900px) {
  .cap-fab {
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    height: 48px;
    padding: 0 18px 0 13px;
    font-size: 14.5px;
    gap: 6px;
  }
  .cap-fab .cf-ico { font-size: 19px; }
  .basket-fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* 页面底部留出悬浮按钮的高度，别把最后一条内容挡住 */
  .wrap, .wrap.wide { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* 「更多」面板改成竖排菜单（条数不多，横排四宫格太空） */
@media (max-width: 900px) {
  .m-sheet-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .m-act {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 13px 14px;
    text-align: left;
  }
  .m-act-ico {
    width: 26px;
    flex: 0 0 26px;
    text-align: center;
    font-size: 16px;
  }
  .m-act-t { font-size: 14px; text-align: left; }
}

/* ==========================================================
   手机端试卷库「库 / 组」范围列表（.psc-*）
   刻意这里一行都不写 float / flex：
   iOS Safari 上 .ad-* 那套 flex+float 混排曾三次把库名、题数整段吞掉，
   页面上只剩一排 ＋。这里只用普通文档流 —— 行是 block，
   名字是行内文字（过长省略号），展开符号在行内最前，题数绝对定位靠右。
   ========================================================== */
.psc-tip {
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 8px 4px;
}
.psc-row {
  position: relative;
  display: block;
  width: auto;
  margin: 0;
  border: 0;
  background: transparent;
  padding: 8px 54px 8px 4px;
  border-bottom: 1px dashed var(--line-soft);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  color: #1f1e1c;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.psc-row:last-child { border-bottom: 0; }
.psc-row.is-on { color: #0067c0; font-weight: 600; }
.psc-row:active { background: #f4f8fd; }
.psc-row .psc-tw {
  display: inline-block;
  width: 22px;
  height: 20px;
  padding: 0;
  margin: 0 5px 0 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #0067c0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
}
.psc-row .psc-tw.is-leaf { visibility: hidden; }
.psc-row .psc-nm { vertical-align: middle; }
.psc-row .psc-ct {
  position: absolute;
  right: 9px;
  top: 50%;
  margin-top: -8px;
  height: 16px;
  line-height: 16px;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 400;
  color: #98a7bb;
}

/* ==========================================================
   题库题卡：展开后露出的「详细信息」（出处 / 知识点 等）
   折叠时不占空间，点题干或「展开全文」就出来
   ========================================================== */
.q-detail { display: none; }
.q-item.is-open .q-detail {
  display: block;
  margin: 3px 0 9px;
  padding: 9px 11px;
  border: 1px solid #e6eef8;
  border-radius: 9px;
  background: #f7fafd;
  font-size: 12.5px;
  line-height: 1.55;
}
.q-detail .qd-row {
  display: grid;
  grid-template-columns: 5.7em minmax(0, 1fr);
  gap: 2px 8px;
  padding: 1px 0;
}
.q-detail .qd-k { color: #8b95a3; }
.q-detail .qd-v {
  color: #2c2a26;
  min-width: 0;
  overflow-wrap: anywhere;
}
.q-detail .qd-v.is-empty { color: #a9b2bf; }
.q-crumb { cursor: pointer; }

/* 试卷库专属分组（只在试卷库出现的「期中 / 期末」这类） */
.ad-item.is-paper > .ad-name { color: #6f52c9; }
.ad-item.is-paper > .ad-name::after {
  content: '仅试卷';
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: #f1ecff;
  color: #6f52c9;
  font-size: 10px;
  font-style: normal;
  line-height: 15px;
  vertical-align: 1px;
}
.psc-row.is-paper > .psc-nm { color: #6f52c9; }

/* 危险按钮（删除分组等） */
.btn-ghost.danger { color: #c0392b; border-color: #e6c4bd; }
.btn-ghost.danger:hover { color: #a5301f; border-color: #d99c90; background: #fdf5f3; }

@media (max-width: 900px) {
  .q-detail { font-size: 12px; }
  .q-item.is-open .q-detail { padding: 8px 10px; }
  .q-detail .qd-row { grid-template-columns: 5.2em minmax(0, 1fr); }
}

/* 试卷库工具栏：手机上按钮不拉伸、紧凑一点（多了「新建分组」以后会换行） */
@media (max-width: 900px) {
  .plib-bar { gap: 8px; }
  .plib-bar .btn-primary,
  .plib-bar .btn-ghost {
    flex: 0 0 auto;
    padding: 9px 12px;
    font-size: 13px;
    width: auto;
  }
  .plib-bar .plib-count { flex: 0 0 auto; font-size: 12.5px; }
}

/* 手机上：操作按钮排一行，「共 N 份 / 刷新」另起一行（不然刷新孤零零掉到第三行） */
@media (max-width: 900px) {
  .plib-bar .spacer { flex: 0 0 100%; height: 0; margin: 0; }
  .plib-bar .plib-count { margin-right: auto; }
  .plib-bar #plibRefreshBtn { margin-left: auto; }
}

/* 手机上「＋ 导入 PDF / Word」缩成「＋ 导入」，工具栏就能排一行 */
@media (max-width: 640px) {
  .plib-bar .pb-lg { display: none; }
}

/* ==================== 协同录题：手机拍照 → 电脑接收 ==================== */

/* ---- 顶栏入口 ---- */
.pair-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.pair-btn:hover { background: #e2e0f8; }
.pair-btn .pb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}
.pair-btn.is-live { color: #fff; background: var(--primary); }
.pair-btn.is-live .pb-dot { background: #86f0b6; opacity: 1; animation: pbPulse 1.8s ease-in-out infinite; }
.pair-btn .pb-new {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10.5px;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: #d94b3d;
  border-radius: 999px;
}
@keyframes pbPulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ---- 电脑端面板 ---- */
.pair-mask {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 24, 30, .44);
}
.pair-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 418px;
  max-height: 88vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .26);
  overflow: hidden;
}
.pair-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 8px 18px;
}
.pair-title { font-size: 15px; font-weight: 600; }
.pair-x {
  width: 28px;
  height: 28px;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.pair-x:hover { background: var(--line-soft); color: var(--text); }
.pair-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 18px 18px;
  -webkit-overflow-scrolling: touch;
}
/* 操作按钮固定在底部：照片攒到上百张时，按钮也不会被顶到要滚半天才找得到 */
.pair-foot {
  flex: 0 0 auto;
  padding: 12px 18px 14px;
  background: var(--card);
  border-top: 1px solid var(--line-soft);
}
.pair-foot .pair-actions { margin-top: 0; }

.pair-lead {
  margin: 4px 0 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.pair-note {
  /* 必须是 block：这里会夹 <b>，用 flex 的话文本节点会被拆成几个 flex item，字序全乱 */
  display: block;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-2);
  background: #f8f7f4;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.pair-note b { color: var(--text); font-weight: 600; }
/* 「上次的照片还留着」这种提示要显眼一点，别让人以为数据没了 */
.pair-note.is-keep {
  color: var(--text);
  background: #fff8e6;
  border-color: #f0e2bd;
}

/* 连着的时候也把配对码亮出来：手机掉线了好照着输，不用切状态 */
.pair-code-mini {
  margin: 8px 0 10px;
  padding: 7px 10px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-3);
  text-align: center;
  background: #f8f7f4;
  border-radius: 8px;
}
.pair-code-mini b { color: var(--text); font-weight: 700; letter-spacing: 0.06em; }

.pair-code-lab {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}
.pair-code {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  margin: 2px 0 12px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.pair-code span { display: inline-block; }

.pair-wait {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pair-wait-txt { flex: 1 1 auto; min-width: 0; }
.pair-url {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
}
.pair-wait-hint { margin-top: 5px; font-size: 11.5px; line-height: 1.55; color: var(--text-3); }
.pair-timer { margin-top: 7px; font-size: 11.5px; color: var(--text-2); }
.pair-timer.is-warn { color: #c0392b; }
.pair-qr {
  flex: 0 0 auto;
  width: 118px;
  height: 118px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pair-qr svg { display: block; width: 100%; height: 100%; }
.pair-qr-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  color: var(--text-3);
}

.pair-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
/* 主操作通栏，取消/结束只是个低调的右对齐按钮（它不是主操作，不该占满一行） */
.pair-actions .btn-primary { flex: 1 1 0; }
.pair-actions .btn-ghost { flex: 0 0 auto; min-width: 92px; }
/* 面板里的次要按钮要有"能点"的样子，不然看着像一行字 */
.pair-actions .btn-ghost {
  color: var(--text-2);
  background: #f6f5f2;
  border: 1px solid var(--line);
}
.pair-actions .btn-ghost:hover { background: #efeeea; color: var(--text); }
/* 清空记录会删照片，跟「结束协同」必须一眼分得开，别手滑 */
.pair-actions .btn-ghost.pair-danger { color: #b3352a; border-color: #e8cecb; background: #fdf6f5; }
.pair-actions .btn-ghost.pair-danger:hover { background: #faeae7; color: #9c2b21; }

.pair-live {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  margin: 2px 0 14px;
  font-size: 13px;
  color: #1f7a4d;
  background: #eef8f2;
  border: 1px solid #d5ecdf;
  border-radius: 10px;
}
.pair-live-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #24b26b;
  box-shadow: 0 0 0 3px rgba(36, 178, 107, .16);
}
.pair-live .pair-live-dev { color: var(--text-2); font-size: 12px; margin-left: auto; }

.pair-sec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.pair-cnt {
  padding: 1px 8px;
  font-size: 11.5px;
  color: var(--text-2);
  background: rgba(0, 0, 0, .05);
  border-radius: 999px;
}

.pair-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pair-shot {
  position: relative;
  padding: 0;
  aspect-ratio: 3 / 4;
  background: #f0eeea;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}
.pair-shot:hover { border-color: var(--primary); }
.pair-shot:active { transform: scale(.985); }
.pair-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pair-shot-tag {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 7px;
  font-size: 10.5px;
  line-height: 1.6;
  color: #fff;
  background: rgba(22, 24, 30, .6);
  border-radius: 999px;
}
.pair-shot.is-done .pair-shot-tag { background: rgba(31, 122, 77, .86); }
.pair-shot.is-busy { pointer-events: none; opacity: .55; }

.pair-empty {
  padding: 30px 12px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.pair-foot-hint {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-3);
}

/* ---- 手机端拍照页 ---- */
.pp {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overscroll-behavior: contain;
}
.pp-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.pp-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfcdc7;
}
.pp-dot.is-on { background: #24b26b; box-shadow: 0 0 0 3px rgba(36, 178, 107, .16); }
.pp-dot.is-off { background: #d94b3d; box-shadow: 0 0 0 3px rgba(217, 75, 61, .14); }
.pp-status {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-x {
  margin-left: auto;
  flex: 0 0 auto;
  height: 26px;
  padding: 0 10px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.pp-x:active { background: var(--line-soft); }

.pp-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 16px calc(26px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.pp-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}
.pp-shot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 150px;
  height: 150px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(80, 70, 229, .32);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease;
}
.pp-shot:active { transform: scale(.955); }
.pp-shot-ico {
  position: relative;
  width: 34px;
  height: 26px;
  border: 2.5px solid #fff;
  border-radius: 6px;
}
.pp-shot-ico::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -6.5px 0 0 -6.5px;
  border: 2.5px solid #fff;
  border-radius: 50%;
}
.pp-shot-ico::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -6px;
  width: 12px;
  height: 4px;
  margin-left: -6px;
  background: #fff;
  border-radius: 2px 2px 0 0;
}
.pp-shot-t { font-size: 16.5px; font-weight: 700; letter-spacing: .5px; }
.pp-sub { font-size: 12.5px; color: var(--text-3); }

.pp-acts {
  display: flex;
  gap: 10px;
  margin: 20px 0 22px;
}
.pp-act {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pp-act:active { background: var(--line-soft); }

.pp-sec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 12.5px;
  color: var(--text-2);
}
.pp-cnt {
  padding: 1px 8px;
  font-size: 11.5px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
}
.pp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pp-cell {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #f0eeea;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.pp-cell img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pp-cell-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11.5px;
  color: var(--text-3);
}
.pp-badge {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  padding: 1px 6px;
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
  color: #fff;
  background: rgba(22, 24, 30, .58);
  border-radius: 999px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pp-cell.s-sending .pp-badge { background: rgba(80, 70, 229, .82); }
.pp-cell.s-done .pp-badge { background: rgba(31, 122, 77, .85); }
.pp-cell.s-fail .pp-badge { background: rgba(192, 57, 43, .85); }
.pp-empty {
  grid-column: 1 / -1;
  padding: 26px 14px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-3);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.pp-tip {
  margin: 18px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-3);
  text-align: center;
}

.pp-join {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 24px 24px calc(40px + env(safe-area-inset-bottom));
}
.pp-join-ico {
  width: 54px;
  height: 54px;
  margin-bottom: 4px;
  background: var(--primary-soft);
  border-radius: 16px;
  position: relative;
}
.pp-join-ico::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2.5px dashed var(--primary);
  border-radius: 5px;
}
.pp-join-t { font-size: 16px; font-weight: 600; color: var(--text); }
.pp-join-s { font-size: 12.5px; color: var(--text-3); text-align: center; line-height: 1.6; }
.pp-code {
  width: 100%;
  max-width: 260px;
  height: 58px;
  margin-top: 6px;
  padding: 0 14px;
  font: inherit;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 8px;
  text-align: center;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pp-code:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(80, 70, 229, .13); }
.pp-go {
  width: 100%;
  max-width: 260px;
  height: 46px;
  margin-top: 4px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.pp-go:active { background: #4238cf; }
.pp-go[disabled] { opacity: .55; }
.pp-err {
  font-size: 12.5px;
  line-height: 1.6;
  color: #c0392b;
  text-align: center;
  max-width: 280px;
}

/* 电脑上打开手机页：收成一条手机宽度，别拉得满屏 */
@media (min-width: 700px) {
  .pp {
    left: 0;
    right: 0;
    max-width: 460px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* 录题页虚线框：文件输入铺满整个框。
   关键（v131）：**opacity 必须保持 1**。
   安卓 + Chrome PWA 会把透明度极低的 file input 判定成「不可交互」，
   手感就是点上去毫无反应——浏览器里能弹、装成桌面图标就不弹。
   所以元素本身保持完全不透明，改用「文字透明 + 背景透明 + 去掉边框」把原生外观藏掉。
   绝对不能 display:none / 挪出视口 / pointer-events:none。 */
.file-over {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: transparent;
  border: 0;
  font-size: 16px;
  z-index: 2;
  cursor: pointer;
  /* 绝对不要写 -webkit-appearance:none / appearance:none：安卓内核一旦移除原生渲染，
     点击后就不再唤起选择器。 */
}

/* 安卓原生「选择文件」按钮默认只占左上角一小块，点别处等于没点。
   把按钮撑满整个 input，并且同样做成完全透明。 */
.file-over::file-selector-button {
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

/* 其余程序唤起的隐藏文件输入（插图、导入 PDF）：
   同样不能 display:none、不能挪到屏幕外，留在原地 1px 透明 */
.pp-file,
.file-hidden {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  border: 0;
  padding: 0;
  pointer-events: none;
}

/* 顶栏放不下时藏掉「协同」文字只留点（手机上统一藏，手机是拍照那一端） */
@media (max-width: 1024px) {
  .pair-btn .pb-txt { display: none; }
  .pair-btn { padding: 0 9px; }
}
@media (max-width: 640px) {
  .pair-btn { display: none; }
  .pair-mask { padding: 12px; align-items: flex-end; }
  .pair-card { max-height: 92vh; border-radius: 16px 16px 12px 12px; }
  .pair-code { font-size: 34px; gap: 12px; }
  .pair-qr { width: 104px; height: 104px; }
  .pair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair-actions .btn-primary,
  .pair-actions .btn-ghost { height: 42px; }
}

/* ==================== 协同照片：先裁切 / 清晰化再录题 ====================
   psMask 压在协同面板（95）之上、裁切层（97）之下：
   点「裁切 / 清晰化」时裁切层盖上来，用完退回这一层，照片已经是处理好的。 */
.ps-mask {
  position: fixed;
  inset: 0;
  /* 140：手机拍照页 .pp 是 130，手机上处理层要盖在它上面；
     裁切层再高一档（150），点「裁切 / 清晰化」时盖住这一层 */
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 24, 30, .5);
}
.ps-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  padding: 0 0 14px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.ps-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 14px 10px 18px;
}
.ps-title { font-size: 15px; font-weight: 600; }
.ps-x {
  width: 28px;
  height: 28px;
  font-size: 13px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.ps-x:hover { color: var(--text); background: rgba(0, 0, 0, .05); }
.ps-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 18px;
  padding: 8px;
  background: #f4f2ee;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.ps-img {
  display: block;
  max-width: 100%;
  max-height: min(58vh, 520px);
  object-fit: contain;
  border-radius: 6px;
}
.ps-meta {
  flex: 0 0 auto;
  padding: 7px 18px 0;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: right;
}
.ps-acts {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px 0;
}
.ps-btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  height: 42px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.ps-btn:hover { border-color: var(--primary); color: var(--primary); }
.ps-btn.primary {
  flex: 1 1 100%;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
.ps-btn.primary:hover { background: #4238cf; color: #fff; }
.ps-btn[disabled] { opacity: .55; cursor: default; }
.ps-tip {
  flex: 0 0 auto;
  padding: 10px 18px 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-3);
}

/* ==================== 插入图片：先选图片来源 ==================== */
.src-mask {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 24, 30, .46);
}
.src-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  max-height: 86vh;
  padding: 0 0 16px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .26);
  overflow: hidden;
}
.src-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 14px 11px 18px;
}
.src-title { font-size: 15px; font-weight: 600; }
.src-x {
  width: 28px;
  height: 28px;
  font-size: 13px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.src-x:hover { color: var(--text); background: rgba(0, 0, 0, .05); }

.src-local {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 18px;
  padding: 13px 14px;
  font: inherit;
  text-align: left;
  background: rgba(80, 70, 229, .06);
  border: 1px solid rgba(80, 70, 229, .22);
  border-radius: 12px;
  cursor: pointer;
}
.src-local:hover { background: rgba(80, 70, 229, .1); }
.src-local-ico {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 9px;
}
.src-local-ico::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
}
.src-local-ico::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 10px;
  margin: -8px 0 0 -1px;
  background: #fff;
  border-radius: 2px;
}
.src-local-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.src-local-t b { font-size: 14px; font-weight: 600; color: var(--text); }
.src-local-t em { font-size: 11.5px; font-style: normal; color: var(--text-3); }

.src-sec {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 18px 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.src-cnt {
  padding: 1px 8px;
  font-size: 11.5px;
  color: var(--text-2);
  background: rgba(0, 0, 0, .05);
  border-radius: 999px;
}
.src-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin: 0 18px;
  overflow-y: auto;
}
.src-cell {
  position: relative;
  padding: 0;
  aspect-ratio: 3 / 4;
  background: #f0eeea;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}
.src-cell:hover { border-color: var(--primary); }
.src-cell:active { transform: scale(.985); }
.src-cell img { display: block; width: 100%; height: 100%; object-fit: cover; }
.src-cell .sc-new {
  position: absolute;
  left: 5px;
  top: 5px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 1.7;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
}
.src-cell.is-busy { pointer-events: none; opacity: .5; }
.src-empty {
  flex: 0 0 auto;
  margin: 16px 18px 0;
  padding: 18px 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-3);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

@media (max-width: 640px) {
  .ps-mask, .src-mask { padding: 12px; align-items: flex-end; }
  .ps-card, .src-card { max-height: 92vh; border-radius: 16px 16px 12px 12px; }
  .ps-img { max-height: 52vh; }
  .src-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* ==================== 登录页：手机当拍照器（连到电脑） ====================
   手机直接打开网站时，只看得到登录框，不知道扫码/配对码这回事。
   这里给它一个不用登录的入口，点开就是输 6 位数字的界面。 */
.auth-pair {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin: 18px 0 0;
  padding: 11px 12px;
  font: inherit;
  text-align: left;
  background: rgba(80, 70, 229, .055);
  border: 1px dashed rgba(80, 70, 229, .38);
  border-radius: 12px;
  cursor: pointer;
}
.auth-pair:hover { background: rgba(80, 70, 229, .1); border-color: var(--primary); }
.auth-pair:active { transform: scale(.99); }
.ap-ico {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 9px;
}
.ap-ico::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 18px;
  margin: -9px 0 0 -5.5px;
  border: 1.8px solid #fff;
  border-radius: 3px;
}
.ap-ico::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 5px;
  height: 1.8px;
  margin-left: -2.5px;
  background: #fff;
  border-radius: 1px;
}
.ap-t { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ap-t b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ap-t em { font-size: 11.5px; font-style: normal; color: var(--text-3); }
.ap-arrow { flex: 0 0 auto; font-size: 17px; line-height: 1; color: var(--primary); }

/* 这个入口只对手机/平板有意义（电脑上自己去点顶栏「协同」发起），
   桌面上藏掉，登录页保持原样不显乱 */
@media (min-width: 821px) {
  .auth-pair { display: none; }
}

/* ==================== 使用说明（弹层） ====================
   原来它占着录题页一整块卡片，现在收进菜单里点开看。 */
.help-mask {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 24, 30, .5);
}
.help-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.help-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 10px 20px;
}
.help-title { font-size: 16px; font-weight: 600; color: var(--text); }
.help-x {
  width: 28px;
  height: 28px;
  font-size: 13px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.help-x:hover { color: var(--text); background: rgba(0, 0, 0, .05); }
.help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 20px 6px;
  overscroll-behavior: contain;
}
.help-body .howto {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
}
.help-body .howto li { margin-bottom: 8px; }
/* 使用说明里的「额度」小课堂 */
.help-quota {
  margin: 14px 0 4px;
  padding: 12px 14px 13px;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid #ffe3ac;
}
.help-quota-h {
  font-size: 13px;
  font-weight: 700;
  color: #8a5a00;
  margin-bottom: 7px;
}
.help-quota p {
  margin: 0 0 7px;
  font-size: 12.5px;
  line-height: 1.72;
  color: #5a4526;
}
.help-quota b { color: #3d2f14; font-weight: 600; }
.help-quota-sub {
  font-weight: 600;
  color: #8a5a00 !important;
  margin-top: 9px !important;
}
.help-quota ul {
  margin: 0 0 7px;
  padding-left: 17px;
  font-size: 12.5px;
  line-height: 1.72;
  color: #5a4526;
}
.help-quota li { margin-bottom: 4px; }
.help-quota a { color: #1a6fe0; text-decoration: underline; }
.help-quota-tip {
  margin: 8px 0 0 !important;
  color: #8a7550 !important;
  font-size: 12px !important;
}
.help-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px 16px;
}
.help-foot .btn-primary { min-width: 96px; }

@media (max-width: 640px) {
  .help-mask { padding: 12px; align-items: flex-end; }
  .help-card { max-height: 88vh; border-radius: 16px 16px 12px 12px; }
  .help-body { padding: 0 16px 4px; }
  .help-body .howto { font-size: 12.5px; line-height: 1.72; }
  .help-head { padding: 14px 12px 8px 16px; }
  .help-foot { padding: 10px 16px 14px; }
  .help-foot .btn-primary { flex: 1 1 100%; }
}

/* ==========================================================
   录题页「✍ 手动录入」入口 —— 压过亚克力/玻璃主题对 .card 的覆盖
   （.card.manual-card 特异性 0,2,0，排在文件末尾，任何断点都稳定生效）
   ========================================================== */
.card.manual-card {
  border-width: 2px !important;
  border-style: dashed !important;
  border-color: #7f75e3 !important;
  background: rgba(236, 234, 252, 0.95);
  box-shadow: 0 2px 10px rgba(80, 70, 229, 0.1);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.card.manual-card:hover {
  border-color: var(--primary) !important;
  background: rgba(229, 226, 252, 0.98);
  box-shadow: 0 3px 14px rgba(80, 70, 229, 0.18);
}
.card.manual-card .manual-title { color: #2f2a86; }

@media (max-width: 560px) {
  .manual-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .manual-row .btn-primary { width: 100%; }
}

/* 录题虚线框下方的诊断提示（只有「相册没弹出来」时才显示） */
.dz-tip {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff4e5;
  border: 1px solid #f0c48a;
  color: #8a4b00;
  font-size: 12.5px;
  line-height: 1.5;
}
.dz-tip[hidden] { display: none; }

/* 临时诊断行（v130）：定位安卓点击到底落在哪个元素上，用完撤掉 */
.dz-dbg {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef3ff;
  border: 1px solid #c7d4ef;
  color: #2b3f66;
  font-size: 11.5px;
  line-height: 1.45;
  word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
}
.dz-dbg[hidden] { display: none; }

/* ===== 摄像头直拍入口（v131）=====
   桌面图标外壳不实现「选择文件」时的备用通路，入口常显在虚线框下面。 */
.cam-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed #c9b6e8;
  border-radius: 12px;
  background: #faf7ff;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.cam-entry:active { background: #f1ebff; }
.cam-entry-ico { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.cam-entry-txt { display: block; min-width: 0; }
.cam-entry-txt b { display: block; font-size: 13.5px; color: #4a2f7a; font-weight: 700; }
.cam-entry-txt i { display: block; font-style: normal; font-size: 11.5px; color: #8c86a0; margin-top: 2px; }
.cam-entry.pulse { animation: camPulse 1.1s ease-in-out 3; border-color: #7c4ddb; }
@keyframes camPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,77,219,0); }
  50% { box-shadow: 0 0 0 4px rgba(124,77,219,.25); }
}

/* ===== 摄像头直拍浮层 ===== */
.cam-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
}
.cam-mask[hidden] { display: none; }
.cam-video {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  object-fit: contain;
  background: #000;
}
.cam-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
}
.cam-x {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 15px;
  line-height: 1;
}
.cam-title {
  color: #fff;
  font-size: 12.5px;
  opacity: .9;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.cam-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(0,0,0,.72), rgba(0,0,0,0));
}
.cam-side {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.4);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 13px;
}
.cam-shoot {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.9);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,0,0,.35);
}
.cam-shoot:active { transform: scale(.94); background: #e9e9e9; }
.cam-hint {
  position: absolute;
  left: 50%;
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: 84%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  white-space: pre-wrap;
}
.cam-hint:empty { display: none; }

/* ===== 外壳不支持拍照时的兜底面板（v133） ===== */
.shell-help {
  margin-top: 10px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid #f0c48a;
  background: #fff8ee;
}
.shell-help[hidden] { display: none; }
.shell-help-t { font-size: 14px; font-weight: 700; color: #8a4b00; }
.shell-help-s { margin-top: 5px; font-size: 12.5px; line-height: 1.55; color: #7a5a2a; }
.shell-help .btn-primary { width: 100%; margin-top: 10px; }
.shell-help-u { margin-top: 8px; font-size: 12px; color: #8c8070; }
.shell-help-u b { color: #4a3a20; }

/* ===== 扫码打开（v135）：电脑/平板上摊开二维码，手机扫一下就进 ===== */
.qr-mask {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(24, 20, 36, .52);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.qr-mask[hidden] { display: none; }
.qr-card {
  width: 100%;
  max-width: 360px;
  box-sizing: border-box;
  padding: 14px 16px 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
.qr-head { display: flex; align-items: center; gap: 8px; }
.qr-title { flex: 1 1 auto; font-size: 15.5px; font-weight: 700; color: #241c33; }
.qr-x {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #f2eefb;
  color: #6d6485;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.qr-imgwrap {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 6px;
  border-radius: 12px;
  background: #fbfaff;
  border: 1px solid #eee6fb;
}
.qr-img { display: block; width: 100%; max-width: 232px; height: auto; image-rendering: pixelated; }
.qr-img[hidden] { display: none; }
.qr-err { font-size: 12.5px; line-height: 1.6; color: #a03b2a; text-align: center; }
.qr-err[hidden] { display: none; }
.qr-url {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f5f2fc;
  color: #4a3f66;
  font-size: 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
  text-align: center;
}
.qr-tip { margin-top: 10px; font-size: 12.5px; line-height: 1.6; color: #6b6480; }
.qr-tip b { color: #4a2f7a; }
.qr-acts { display: flex; gap: 10px; margin-top: 12px; }
.qr-acts > button { flex: 1 1 0; min-width: 0; }
.qr-foot { margin-top: 9px; font-size: 11.5px; line-height: 1.55; color: #9a94a8; text-align: center; }

/* ===== 微信内置浏览器提示（v135） ===== */
.wx-mask {
  position: fixed;
  inset: 0;
  z-index: 291;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 20, 36, .52);
}
.wx-mask[hidden] { display: none; }
.wx-card {
  width: 100%;
  max-width: 330px;
  box-sizing: border-box;
  padding: 18px 18px 15px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  text-align: center;
}
.wx-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #eaf7e6;
  color: #3aa845;
  font-size: 22px;
  font-weight: 700;
}
.wx-title { font-size: 15.5px; font-weight: 700; color: #241c33; }
.wx-body { margin-top: 8px; font-size: 12.5px; line-height: 1.65; color: #625b74; text-align: left; }
.wx-body b { color: #b3452f; }
.wx-step {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #f6f4fb;
  font-size: 13px;
  color: #413a55;
  text-align: left;
}
.wx-step i {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #7c4ddb;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  line-height: 19px;
  text-align: center;
}
.wx-step b { color: #4a2f7a; }
.wx-acts { display: flex; gap: 10px; margin-top: 14px; }
.wx-acts > button { flex: 1 1 0; min-width: 0; }
.wx-foot { margin-top: 10px; font-size: 11.5px; line-height: 1.5; color: #9a94a8; }

/* 浮层里的次级按钮：卡片底色写死浅色，别跟着深色主题变黑 */
.qr-card .btn-ghost,
.wx-card .btn-ghost {
  background: #fff;
  border-color: #e3dcf2;
  color: #5b5375;
}
.qr-card .btn-ghost:hover,
.wx-card .btn-ghost:hover { border-color: #c9b6e8; color: #3b3350; }
