/* quiz.css —— 知识闯关（2026-11-02）
 *
 * 独立成文件而不是塞进 style.css：闯关是一套完整的自包含 UI（覆盖层 + 状态机），
 * 混进 5000+ 行的主样式里既难找也容易和对话流的类名撞车。
 * 配色全部走主样式里的 CSS 变量（--brand / --panel / --ink / --muted / --border），
 * 深色主题自动跟随，不另写一套。
 */

.qz-overlay {
  position: fixed; top: 0; left: 0; right: 0; height: var(--vh); box-sizing: border-box; z-index: 9600;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, .58);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.qz-overlay[hidden] { display: none !important; }
body.qz-open { overflow: hidden; }

.qz-panel {
  position: relative;
  display: flex; flex-direction: column;
  width: min(760px, 100%);
  max-height: min(720px, calc(var(--vh) - 40px));
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
  overflow: hidden;
}

/* ── 顶部：一条细的关卡色带 + HUD ───────────────────────────── */
.qz-head {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--brand-soft), transparent 120%);
  flex: 0 0 auto;
}
.qz-head::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #2f6df6, #7aa7ff 45%, #f5a623);
}
.qz-headline { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.qz-kicker {
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  color: #fff; background: var(--brand);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.qz-sec {
  font-size: 13px; color: var(--muted); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qz-hud { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.qz-hearts { letter-spacing: 2px; color: #e5484d; font-size: 15px; }
.qz-combo { color: var(--muted); font-weight: 600; }
.qz-combo.on { color: #e07b00; }
.qz-score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); }
.qz-close {
  width: 30px; height: 30px; flex: 0 0 auto;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.qz-close:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }

.qz-body { flex: 1 1 auto; overflow-y: auto; padding: 18px 18px 20px; }
@media (max-width: 560px) {
  .qz-overlay { padding: 0; }
  .qz-panel { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }
  .qz-body { padding: 14px 14px 18px; }
  /* 窄屏头部折两行：第一行「标签 + 节名 + ×」，第二行整行放 HUD。
     不折的话「连对 3 ×1.5 / 552 分」会被挤成两行断在半截，比不显示还乱。 */
  .qz-head { flex-wrap: wrap; row-gap: 6px; padding-bottom: 10px; }
  .qz-headline { order: 1; flex: 1 1 auto; }
  .qz-close { order: 2; }
  .qz-hud { order: 3; flex: 0 0 100%; margin-left: 0; justify-content: flex-start; gap: 10px; }
  /* HUD 第二行仍嫌挤时，先牺牲「连对」文案（分数增长本身就是连对的回声） */
}

/* ── 加载 ─────────────────────────────────────────────────────── */
.qz-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 54px 10px; }
.qz-ring {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  animation: qzSpin .9s linear infinite;
}
@keyframes qzSpin { to { transform: rotate(360deg); } }
.qz-load-msg { font-size: 14px; font-weight: 600; }
.qz-load-tip { font-size: 12px; color: var(--muted); text-align: center; max-width: 380px; line-height: 1.6; }

/* ── 出错 ─────────────────────────────────────────────────────── */
.qz-err { text-align: center; padding: 40px 12px; }
.qz-err-ico { font-size: 26px; }
.qz-err-msg { margin: 10px 0 18px; font-size: 14px; color: var(--ink); line-height: 1.65; }

/* ── 封面 ─────────────────────────────────────────────────────── */
.qz-intro { padding: 6px 2px; }
.qz-intro-title { font-size: 21px; font-weight: 700; letter-spacing: .2px; }
.qz-intro-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.qz-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 14px; }
@media (max-width: 560px) { .qz-tiers { grid-template-columns: 1fr; } }
.qz-tcard {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--chat-bg, #fcfcfc);
}
.qz-tcard-ico { font-size: 18px; line-height: 1.2; }
.qz-tcard-name { font-size: 13px; font-weight: 700; }
.qz-tcard-hint { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.5; }
/* 每关时限不同，写在卡片上学生才知道"下一关更慢"不是错觉 */
.qz-tcard-time { margin-top: 5px; font-size: 11px; font-weight: 600; color: var(--brand); }
.qz-rules {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: 12px; color: var(--muted); margin-bottom: 18px;
}
.qz-foot-note { margin-top: 12px; font-size: 12px; color: var(--muted); }

/* ── 答题 ─────────────────────────────────────────────────────── */
.qz-q-top { display: flex; align-items: center; gap: 10px; }
.qz-tier-tag {
  font-size: 12px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.qz-dots { display: flex; gap: 3px; flex: 1 1 auto; flex-wrap: wrap; }
.qz-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  transition: background .2s ease, box-shadow .2s ease;
}
.qz-dot.ok { background: #18a058; }
.qz-dot.bad { background: #e5484d; }
.qz-dot.cur { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qz-qno { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.qz-timer {
  height: 4px; border-radius: 3px; background: var(--border);
  margin: 10px 0 16px; overflow: hidden;
}
.qz-timer > i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #2f6df6, #7aa7ff);
  transition: width .1s linear;
}
.qz-timer > i.urgent { background: linear-gradient(90deg, #e5484d, #ff8f6b); }

.qz-stem {
  font-size: 17px; font-weight: 600; line-height: 1.7;
  margin-bottom: 16px; letter-spacing: .1px;
}
.qz-opts { display: flex; flex-direction: column; gap: 9px; }
.qz-opt {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%; text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); color: var(--ink);
  font-size: 15px; line-height: 1.55; cursor: pointer;
  transition: transform .1s ease, border-color .15s ease, background .15s ease,
              box-shadow .15s ease;
}
.qz-opt:hover:not(:disabled) {
  border-color: var(--brand); transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(47, 109, 246, .13);
}
.qz-opt:disabled { cursor: default; }
.qz-opt-l {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 700;
}
.qz-opt-t { flex: 1 1 auto; }
.qz-opt.right { border-color: #18a058; background: #eafaf0; }
.qz-opt.right .qz-opt-l { background: #18a058; color: #fff; }
.qz-opt.wrong { border-color: #e5484d; background: #fdeeee; }
.qz-opt.wrong .qz-opt-l { background: #e5484d; color: #fff; }
.qz-opt.gone { opacity: .38; text-decoration: line-through; }
.qz-opt.shake { animation: qzShake .32s ease; }
@keyframes qzShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.qz-tip { margin-top: 12px; font-size: 12px; color: var(--muted); }
.qz-bar { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.qz-hint-kbd { margin-left: auto; font-size: 11px; color: var(--muted); }
@media (max-width: 560px) { .qz-hint-kbd { display: none; } }

/* 解析卡 */
.qz-explain {
  margin-top: 14px; padding: 12px 14px;
  border-left: 3px solid var(--brand);
  background: var(--chat-bg, #fcfcfc);
  border-radius: 0 12px 12px 0;
}
.qz-explain-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.qz-explain-h .ok { color: #18a058; font-weight: 700; }
.qz-explain-h .bad { color: #e5484d; font-weight: 700; }
.qz-explain-h .ans { color: var(--muted); }
.qz-explain-h .pt { font-size: 12px; color: var(--muted); }
.qz-explain-b { margin-top: 7px; font-size: 13.5px; line-height: 1.7; }
.qz-explain-t { margin-top: 6px; font-size: 12.5px; color: #b4451f; line-height: 1.6; }
.qz-explain .qz-actions { margin-top: 12px; }

/* ── 按钮 ─────────────────────────────────────────────────────── */
.qz-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.qz-btn {
  padding: 9px 18px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink);
  font-size: 14px; font-weight: 600;
  transition: transform .1s ease, box-shadow .15s ease;
}
.qz-btn:hover:not(:disabled) { transform: translateY(-1px); }
.qz-btn:disabled { opacity: .5; cursor: default; }
.qz-btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(47, 109, 246, .28);
}
.qz-btn.primary.big { padding: 12px 26px; font-size: 15px; }
.qz-btn.ghost { background: transparent; color: var(--muted); }
.qz-btn.ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--brand); }

/* ── 结算 ─────────────────────────────────────────────────────── */
.qz-result { text-align: center; padding: 8px 2px 4px; }
.qz-grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 50%;
  font-size: 40px; font-weight: 800; letter-spacing: -1px;
  color: #fff; background: var(--brand);
  box-shadow: 0 10px 26px rgba(47, 109, 246, .3);
  animation: qzPop .34s cubic-bezier(.2, 1.4, .4, 1);
}
.qz-grade.gS { background: linear-gradient(135deg, #f5a623, #ff7a45); box-shadow: 0 10px 26px rgba(245, 166, 35, .34); }
.qz-grade.gA { background: linear-gradient(135deg, #2f6df6, #5b9bff); }
.qz-grade.gB { background: linear-gradient(135deg, #6b7785, #95a1ae); }
.qz-grade.gC { background: linear-gradient(135deg, #b0b8c4, #cdd4dd); }
@keyframes qzPop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.qz-stars { margin: 8px 0 4px; font-size: 20px; letter-spacing: 4px; color: var(--border); }
.qz-star.on { color: #f5a623; animation: qzStar .42s ease both; }
.qz-star.on:nth-child(2) { animation-delay: .1s; }
.qz-star.on:nth-child(3) { animation-delay: .2s; }
@keyframes qzStar { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.qz-result-sub { font-size: 13px; color: var(--muted); line-height: 1.8; }
.qz-result-sub b { color: var(--ink); font-size: 14px; }

.qz-tierbox {
  margin: 16px 0 6px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; text-align: left;
}
.qz-tierrow { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.qz-tierrow-n { flex: 0 0 116px; font-size: 12.5px; font-weight: 600; }
.qz-tierrow-bar { flex: 1 1 auto; height: 7px; border-radius: 4px; background: var(--border); overflow: hidden; }
.qz-tierrow-bar > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width .5s ease; }
.qz-tierrow-bar > i.mid { background: #f5a623; }
.qz-tierrow-bar > i.low { background: #e5484d; }
.qz-tierrow-v { flex: 0 0 34px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.qz-wrong { margin: 12px 0 0; text-align: left; }
.qz-wrong-h { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
/* 错题行：标签 + 题干 + 右侧「拆开这道题」。题干可换行但不挤掉按钮，
   所以用 grid 而不是 inline 流（长题干时按钮会被顶到下一行的诡异位置）。 */
.qz-wrong-i {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: baseline; gap: 0 6px;
  font-size: 12.5px; color: var(--ink); line-height: 1.65;
  padding: 6px 0; border-top: 1px dashed var(--border);
}
.qz-wrong-i:first-of-type { border-top: 0; }
.qz-wrong-t { min-width: 0; }
.qz-wrong-go {
  align-self: center;
  padding: 4px 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  color: var(--brand); background: var(--brand-soft);
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
}
.qz-wrong-go:hover { border-color: var(--brand); }
.qz-wrong-pt {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 600;
}
.qz-allright {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 12px;
  background: #eafaf0; color: #0f7a44; font-size: 13px; font-weight: 600;
}
.qz-result .qz-actions { justify-content: center; }

/* 深色主题下的浅底色块（eafaf0 / fdeeee / 白字按钮）要压暗，否则刺眼 */
html[data-theme="dark"] .qz-opt.right { background: rgba(24, 160, 88, .18); }
html[data-theme="dark"] .qz-opt.wrong { background: rgba(229, 72, 77, .18); }
html[data-theme="dark"] .qz-allright { background: rgba(24, 160, 88, .16); color: #6fdc9e; }
html[data-theme="dark"] .qz-explain { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .qz-tcard { background: rgba(255, 255, 255, .04); }
html[data-theme="dark"] .qz-close:hover { background: rgba(255, 255, 255, .1); }

/* ── 关卡过场横幅 ─────────────────────────────────────────────── */
/* 横幅从**顶部滑入**，不压住题干和选项：
   早先做成全屏居中，正好盖死中间两个选项 —— 过场只有 1.5 秒，但学生那一秒
   会以为"题还没出来"，反而更乱。放顶部是"关卡抬头"的语义，也更像游戏。
   top 取头部高度（约 56px）之下、进度点那一行上：挡住的是圆点，不是内容。 */
/* top 由 JS 按**实测的头部高度**写入：头部在窄屏会折成两行（80px）、宽屏只有一行（55px），
   写死任何一个值都会在另一个断点上压住 HUD。
   （曾经把它写进 @media，而那段排在本规则之前 → 被这里的 top:58px 覆盖，
   表现就是手机上横幅盖住"连对/分数"那一行。） */
.qz-gate {
  position: absolute; left: 0; right: 0; top: 58px; z-index: 6;
  display: flex; justify-content: center;
  pointer-events: none;
}
.qz-gate > span {
  font-size: 18px; font-weight: 800; letter-spacing: .5px;
  color: #fff; background: rgba(47, 109, 246, .95);
  padding: 8px 22px; border-radius: 12px;
  box-shadow: 0 10px 28px rgba(47, 109, 246, .38);
  animation: qzGate 1.55s cubic-bezier(.2, .9, .3, 1) forwards;
}
@keyframes qzGate {
  0%   { transform: translateY(-14px) scale(.96); opacity: 0; }
  16%  { transform: translateY(0)     scale(1);   opacity: 1; }
  74%  { transform: translateY(0)     scale(1);   opacity: 1; }
  100% { transform: translateY(-8px)  scale(1);   opacity: 0; }
}
@media (max-width: 560px) {
  .qz-gate > span { font-size: 16px; padding: 7px 16px; }
}
/* 窄屏下 HUD 不挤：分数字号略小、连对文案缩短靠 CSS 不换行 */
@media (max-width: 420px) {
  .qz-hud { font-size: 12px; gap: 7px; }
  .qz-hearts { letter-spacing: 1px; }
}

/* ── 历史战绩 ───────────────────────────────────────────────────
   没有对比，评级只是个孤零零的字母：A 到底算好还是不好？
   所以封面给"已玩 N 次 / 最佳 / 上次"，结算给"比上次多对几题"。 */

.qz-g {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 3px;
  border-radius: 5px; font-size: 11px; font-weight: 800; font-style: normal;
  color: #fff; background: var(--muted); vertical-align: 1px;
}
.qz-g.gS { background: linear-gradient(135deg, #f5a623, #ff8f2e); }
.qz-g.gA { background: var(--brand); }
.qz-g.gB { background: #8b95a3; }
.qz-g.gC { background: #c3cad4; }

.qz-hist {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 14px;
  margin: 14px 0 4px; padding: 9px 12px;
  border: 1px dashed var(--border); border-radius: 12px;
  background: var(--chat-bg, #fcfcfc);
}
.qz-hist-l { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.qz-hist-l b { color: var(--ink); }
.qz-hist-n b { font-size: 14px; color: var(--brand); }
.qz-ago { font-style: normal; opacity: .75; margin-left: 4px; }
.qz-hist-r { display: flex; align-items: center; gap: 4px; }
.qz-hist-cap { font-size: 11px; color: var(--muted); margin-right: 2px; }

/* ── 结算里的"比上次" ───────────────────────────────────────── */
.qz-compare {
  display: flex; align-items: baseline; justify-content: center; gap: 12px;
  flex-wrap: wrap; margin-top: 8px;
  font-size: 13px;
}
.qz-cmp-main { font-weight: 700; color: var(--ink); }
.qz-cmp-ref { font-size: 12px; color: var(--muted); }
.qz-newrec {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: linear-gradient(135deg, #f5a623, #ff8f2e); color: #fff;
  font-size: 11px; font-weight: 800; margin-right: 4px;
}
html[data-theme="dark"] .qz-hist { background: rgba(255, 255, 255, .04); }

/* ── 历史列表（点「查看全部」展开）───────────────────────────── */
.qz-hist-all {
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--brand); font-size: 11px; font-weight: 700; cursor: pointer;
}
.qz-hist-all:hover { border-color: var(--brand); }

.qz-histlist {
  margin: 0 0 4px; padding: 6px 10px;
  border: 1px dashed var(--border); border-top: 0; border-radius: 0 0 12px 12px;
  max-height: 190px; overflow-y: auto;
}
.qz-hrow {
  display: grid; grid-template-columns: 130px 34px 52px 1fr;
  align-items: center; gap: 8px;
  padding: 4px 0; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.qz-hrow:last-child { border-bottom: 0; }
.qz-hrow-head { font-size: 11px; font-weight: 700; color: var(--muted); }
.qz-hrow-t { font-variant-numeric: tabular-nums; }
.qz-hrow-v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .qz-hrow { grid-template-columns: 104px 30px 46px 1fr; gap: 6px; font-size: 11.5px; }
}

/* ── 错题回炉 ─────────────────────────────────────────────────── */
.qz-wnote {
  margin: 12px 0 2px; padding: 8px 12px;
  border-radius: 10px; font-size: 12.5px;
  background: #fff4e5; color: #8a5300;
  border: 1px solid #f3d3a6;
}
.qz-wnote b { font-size: 14px; }
.qz-wtag {
  display: inline-block; margin-bottom: 8px; padding: 3px 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: #fff1e0; color: #a35b00; border: 1px solid #f0cf9f;
}
html[data-theme="dark"] .qz-wnote { background: rgba(245, 166, 35, .14); color: #f0b463; border-color: rgba(245, 166, 35, .3); }
html[data-theme="dark"] .qz-wtag { background: rgba(245, 166, 35, .16); color: #f0b463; border-color: rgba(245, 166, 35, .3); }

/* ══════════════════════════════════════════════════════════════
 * 三种动手题：连线配对 / 步骤排序 / 拖拽分类（2026-11-03）
 *
 * 共同约定：
 * · 全区域 user-select:none —— 拖动时选中文字会让卡片"变蓝"，
 *   看起来像被浏览器接管了（白板上已经吃过这个亏）。
 * · 可拖元素一律 touch-action:none —— 否则手指一按，页面先滚一下，拖拽起手就丢。
 * · 状态色只用三档：默认（可操作）/ 绿（对）/ 红（错），不引入新配色。
 * ══════════════════════════════════════════════════════════════ */

.qz-ktag {
  display: inline-block; margin: 2px 0 8px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  color: var(--brand); background: var(--brand-soft);
  border: 1px solid rgba(47, 109, 246, .22);
}
.qz-frozen { pointer-events: none; opacity: .9; }

/* ── ① 连线配对 ─────────────────────────────────────────────── */
.qz-match {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px 64px;
  -webkit-user-select: none; user-select: none;
}
.qz-msvg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1; overflow: visible;
}
.qz-mline { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; }
.qz-mline.ok { stroke: #18a058; }
.qz-mcol { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 8px; }
.qz-mitem {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 44px; padding: 8px 10px;
  text-align: left; font-size: 13.5px; line-height: 1.45;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; touch-action: none;
  transition: border-color .14s ease, background .14s ease, transform .1s ease;
}
.qz-mitem:hover { border-color: var(--brand); }
.qz-mitem.on {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, .16);
}
.qz-mitem.linked { border-color: rgba(47, 109, 246, .55); }
.qz-mitem.ok { border-color: #18a058; background: #eafaf0; }
.qz-mitem.bad { border-color: #e5484d; background: #fdeeee; }
.qz-mlab {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-style: normal; font-weight: 700;
  color: var(--muted); background: var(--chat-bg, #f3f5f8);
}
.qz-mitem.on .qz-mlab, .qz-mitem.linked .qz-mlab { background: var(--brand); color: #fff; }
.qz-mitem.ok .qz-mlab { background: #18a058; color: #fff; }
.qz-mitem.bad .qz-mlab { background: #e5484d; color: #fff; }
.qz-mtxt { flex: 1 1 auto; min-width: 0; }

/* ── ② 步骤排序 ─────────────────────────────────────────────── */
.qz-order {
  display: flex; flex-direction: column; gap: 8px;
  -webkit-user-select: none; user-select: none;
}
.qz-orow {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 10px;
  padding: 9px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  cursor: grab; touch-action: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.qz-orow:hover { border-color: var(--brand); }
.qz-onum {
  width: 24px; height: 24px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--brand);
}
.qz-otxt { font-size: 13.5px; line-height: 1.5; }
.qz-obtns { display: flex; flex-direction: column; gap: 2px; }
.qz-mv {
  /* 26x20 在 iPad 上用手指按是偏小的（两个按钮还挤在一列），
     但拖拽才是主入口，这两个只是"手指滑不动时的保底"，所以放大到 30x21 即可。 */
  width: 30px; height: 21px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--muted);
  background: var(--chat-bg, #f3f5f8); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
}
.qz-mv:hover { color: var(--brand); border-color: var(--brand); }
.qz-orow.qz-dragging {
  cursor: grabbing; opacity: .96;
  box-shadow: 0 12px 28px rgba(17, 24, 39, .22);
  border-color: var(--brand);
  transition: none;            /* 见 .qz-chip.qz-dragging：拖动期间不许有过渡 */
  will-change: transform;
}
/* 拖动时提示"会插到这一行之前"：只画一条线，不真的挪 DOM ——
   边拖边换位会让被拖的那行在手指下反复跳，很难对准。 */
.qz-orow.qz-gap { box-shadow: inset 0 3px 0 -1px var(--brand); border-color: var(--brand); }
.qz-orow.ok { border-color: #18a058; background: #eafaf0; }
.qz-orow.ok .qz-onum { background: #18a058; }
.qz-orow.bad { border-color: #e5484d; background: #fdeeee; }
.qz-orow.bad .qz-onum { background: #e5484d; }

/* ── ③ 拖拽分类 ─────────────────────────────────────────────── */
.qz-sort { -webkit-user-select: none; user-select: none; }
.qz-tray {
  position: relative;
  padding: 8px 10px 10px; margin-bottom: 10px;
  border: 1.5px dashed var(--border); border-radius: 12px;
  background: var(--chat-bg, #fbfcfd);
  transition: border-color .14s ease, background .14s ease;
  /* 筐自己也要 touch-action:none：拖动中被拖标签是 pointer-events:none，
     指针这时命中的是筐；筐若允许手势，iPad 会把这段位移当成滚动，
     一边派 pointercancel 一边滚页面 —— 表现就是"拖到筐附近开始抖/飘"。 */
  touch-action: none;
}
.qz-tray.qz-empty { border-style: solid; border-color: rgba(24, 160, 88, .45); }
.qz-blabel {
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  color: var(--muted); margin-bottom: 6px;
}
.qz-schips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.qz-trayhint { font-size: 12px; color: #18a058; font-weight: 600; }
.qz-buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qz-bucket {
  position: relative;
  padding: 8px 10px 10px; min-height: 96px;
  border: 1.5px dashed var(--border); border-radius: 12px;
  background: var(--chat-bg, #fbfcfd);
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
  touch-action: none;          /* 同 .qz-tray：拖到筐上方时别让浏览器接管成滚动 */
}
.qz-bucket.qz-has { border-style: solid; border-color: rgba(47, 109, 246, .45); }
/* 拖到筐里 → 整筐高亮，并在右上角挂"松手放入"。
   三条约束都是为了**不改排版**（一改就跟着抖）：
   ① 只把 border-style 从 dashed 改 solid，不动宽度；② 不碰 padding；
   ③ 提示走 absolute 的 ::after，绝不用行内元素 —— 行内元素会把筐里的标签顶下去 2px。 */
.qz-bucket.over, .qz-tray.over { border-style: solid; }
.qz-bucket.over {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, .18), 0 8px 20px rgba(47, 109, 246, .16);
}
.qz-tray.over {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, .14);
}
.qz-bucket::after, .qz-tray::after {
  content: "松手放入";
  position: absolute; top: -10px; right: 10px;
  padding: 0 8px; height: 19px; line-height: 19px; border-radius: 999px;
  background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .5px; white-space: nowrap;
  opacity: 0; transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.qz-bucket.over::after, .qz-tray.over::after { opacity: 1; transform: translateY(0); }
.qz-chip {
  display: inline-flex; align-items: center;
  max-width: 100%; padding: 6px 11px;
  font-size: 12.5px; line-height: 1.4; text-align: left;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: grab; touch-action: none;
  transition: border-color .12s ease, background .12s ease, transform .1s ease;
}
.qz-chip:hover { border-color: var(--brand); }
.qz-chip.sel {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, .16);
}
.qz-chip.qz-dragging {
  cursor: grabbing; z-index: 8; position: relative;
  box-shadow: 0 10px 24px rgba(17, 24, 39, .22); border-color: var(--brand);
  /* 【抖动元凶】上面那条规则里的 `transform .1s ease` 是给点击态用的，
     拖动时每帧都会重新起跑，标签看着像"追不上手指"。这里必须整条掐掉，
     并显式声明 will-change 让它上独立合成层（否则 iPad 每帧重绘阴影更抖）。 */
  transition: none;
  will-change: transform;
}
.qz-chip.ok { border-color: #18a058; background: #eafaf0; }
.qz-chip.bad { border-color: #e5484d; background: #fdeeee; }

/* ── 封面上的题型图例 ───────────────────────────────────────── */
.qz-klegend {
  margin: 10px 0 2px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.qz-klegend-i {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--chat-bg, #f3f5f8); border: 1px solid var(--border);
  color: var(--ink); font-weight: 600;
}

/* ── 窄屏：连线两列会挤成一团，收紧间距并缩字号 ─────────────── */
@media (max-width: 560px) {
  .qz-match { gap: 8px 30px; }
  .qz-mitem { min-height: 40px; padding: 6px 8px; font-size: 12.5px; }
  .qz-mlab { width: 19px; height: 19px; font-size: 11px; }
  .qz-otxt { font-size: 12.5px; }
  .qz-buckets { grid-template-columns: 1fr; }
  .qz-bucket { min-height: 76px; }
  .qz-orow { grid-template-columns: 24px 1fr auto; gap: 8px; padding: 8px; }
  .qz-chip { font-size: 12px; padding: 5px 9px; }
}

/* ── 深色主题 ───────────────────────────────────────────────── */
html[data-theme="dark"] .qz-mitem,
html[data-theme="dark"] .qz-orow,
html[data-theme="dark"] .qz-chip { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .qz-mitem.ok,
html[data-theme="dark"] .qz-orow.ok,
html[data-theme="dark"] .qz-chip.ok { background: rgba(24, 160, 88, .18); }
html[data-theme="dark"] .qz-mitem.bad,
html[data-theme="dark"] .qz-orow.bad,
html[data-theme="dark"] .qz-chip.bad { background: rgba(229, 72, 77, .16); }
html[data-theme="dark"] .qz-tray,
html[data-theme="dark"] .qz-bucket { background: rgba(255, 255, 255, .03); }
/* ⚠️ 深色下必须**再写一遍** over：上面那条 `html[data-theme] .qz-bucket`（0,2,1）
   权重比 `.qz-bucket.over`（0,2,0）高，不补就会被它压成"只有边框变蓝、底没变"，
   暗色里几乎看不出高亮。 */
html[data-theme="dark"] .qz-bucket.over,
html[data-theme="dark"] .qz-tray.over {
  background: rgba(47, 109, 246, .28);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, .30), 0 8px 20px rgba(47, 109, 246, .26);
}

/* 加载超过 12 秒才出现的等待说明（见 quiz.js 的 qzLoadWait） */
.qz-load-wait { margin-top: 6px; font-size: 12px; color: var(--brand); font-weight: 600; }
.qz-load-wait:empty { display: none; }
