/* 答题卡智能批改：模板框选、扫一扫、待确认 */

.seg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg3 button { font-size: 12.5px; padding: 0 2px; }

/* ---------- 模板列表 ---------- */

.tpl-list { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }

.tpl-card {
  display: flex;
  gap: 11px;
  align-items: stretch;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  font: inherit;
  color: inherit;
}
.tpl-card:active { transform: scale(0.995); }
.tpl-card .tpl-thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 78px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--line2);
  border: 1px solid var(--line2);
}
.tpl-card .tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-card .tpl-thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--ink3); }
.tpl-card .tpl-thumb.empty svg { width: 20px; height: 20px; }
.tpl-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.tpl-card .nm { font-size: 14.5px; font-weight: 600; letter-spacing: -0.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-card .meta { font-size: 11.5px; color: var(--ink3); display: flex; gap: 7px; flex-wrap: wrap; }
.tpl-card .meta b { font-weight: 600; color: var(--ink2); }
.tpl-card .chev { align-self: center; color: var(--ink3); width: 16px; flex: 0 0 auto; }
.tpl-card .chev svg { width: 16px; height: 16px; }

.tpl-warn {
  display: flex;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--half-ink);
  background: var(--half-bg);
  border: 1px solid var(--half-line);
  border-radius: 10px;
  padding: 9px 11px;
  margin-top: 9px;
}

/* ---------- 模板框选 ---------- */

.tpl-stage {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  margin-top: 8px;
}
.tpl-stage canvas { display: block; width: 100%; height: auto; }
.tpl-stage.armed { cursor: crosshair; }

.tpl-stage-tip {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  font-size: 11px;
  line-height: 1.5;
  color: #fff;
  background: rgba(28, 26, 22, 0.62);
  border-radius: 7px;
  padding: 5px 8px;
  pointer-events: none;
  max-width: 78%;
}

.region-tabs { display: flex; gap: 8px; margin-top: 10px; }
.region-tab {
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font: inherit;
  font-size: 13px;
  color: var(--ink2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.region-tab .dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.region-tab .st { font-size: 10.5px; color: var(--ink3); }
.region-tab.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.region-tab.on .st { color: var(--accent); opacity: .8; }

.region-tab.name .dot { background: var(--accent); }
.region-tab.sid .dot { background: var(--peach-ink); }

.grid-preview {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 10px;
}
.grid-preview .gp-head { font-size: 11.5px; color: var(--ink3); margin-bottom: 7px; }
.gp-grid { display: flex; gap: 8px; }
.gp-col { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.gp-cell { height: 13px; border-radius: 3px; background: var(--line2); display: flex; align-items: center; justify-content: center; font-size: 8.5px; color: var(--ink3); }
.gp-cell.on { background: var(--accent); color: #fff; }

/* ---------- 扫一扫 ---------- */

.scan-hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px 18px;
  text-align: center;
  margin-top: 10px;
}
.scan-shutter {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(47, 95, 158, 0.28);
  transition: transform .12s ease;
}
.scan-shutter svg { width: 32px; height: 32px; }
.scan-shutter:active { transform: scale(0.94); }
.scan-hero .st { font-size: 15px; font-weight: 600; margin-top: 12px; }
.scan-hero .sub { font-size: 12px; color: var(--ink3); margin-top: 5px; line-height: 1.6; }

.scan-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.scan-toggle .k { font-size: 13.5px; }
.scan-toggle .d { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }
.scan-toggle .sw {
  margin-left: auto;
  width: 44px;
  height: 26px;
  border-radius: 14px;
  background: var(--line2);
  border: 0;
  position: relative;
  flex: 0 0 auto;
  transition: background .16s ease;
}
.scan-toggle .sw::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform .16s ease;
}
.scan-toggle .sw.on { background: var(--accent); }
.scan-toggle .sw.on::after { transform: translateX(18px); }

.scan-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink2);
  margin-top: 9px;
  text-align: left;
}
.scan-pick .v { margin-left: auto; font-size: 12px; color: var(--ink3); display: flex; align-items: center; gap: 4px; }
.scan-pick .v svg { width: 14px; height: 14px; }

.scan-log { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.scan-log-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  color: inherit;
  width: 100%;
  text-align: left;
}
.scan-log-row .nm { font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-log-row .sc { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.scan-log-row .st { font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--ok-bg); color: var(--ok-ink); flex: 0 0 auto; }
.scan-log-row .st.wait { background: var(--half-bg); color: var(--half-ink); }
.scan-log-row .st.bad { background: var(--bad-bg); color: var(--bad-ink); }

/* ---------- 识别中遮罩 ---------- */

.scan-busy {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(28, 26, 22, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}
.scan-busy-card {
  background: var(--card);
  border-radius: 16px;
  padding: 22px 20px 20px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}
.scan-busy-card .ttl { font-size: 15px; font-weight: 600; margin-top: 14px; }
.scan-busy-card .sub { font-size: 12px; color: var(--ink3); margin-top: 6px; line-height: 1.6; min-height: 34px; }
.spin {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid var(--line2);
  border-top-color: var(--accent);
  animation: scan-spin 0.9s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }

/* ---------- 结果确认 ---------- */

.res-ident {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 4px;
}
.res-ident .who { flex: 1; min-width: 0; }
.res-ident .nm { font-size: 15px; font-weight: 600; }
.res-ident .meta { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }
.res-ident .badge { font-size: 10.5px; padding: 2px 6px; border-radius: 5px; flex: 0 0 auto; }
.res-ident .badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.res-ident .badge.wait { background: var(--half-bg); color: var(--half-ink); }

.mark-edit { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mark-edit button {
  min-width: 40px;
  height: 36px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font: inherit;
  font-size: 12px;
  color: var(--ink2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-variant-numeric: tabular-nums;
}
.mark-edit button .k { font-size: 12px; font-weight: 600; line-height: 1.1; }
.mark-edit button .s { font-size: 9.5px; color: var(--ink3); line-height: 1.2; }
.mark-edit button.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.mark-edit button.ok .s { color: var(--ok-ink2); }
.mark-edit button.half { background: var(--half-bg); border-color: var(--half-line); color: var(--half-ink); }
.mark-edit button.half .s { color: var(--half-ink2); }
.mark-edit button.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.mark-edit button.bad .s { color: var(--bad-ink2); }

.res-note {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink3);
  margin-top: 9px;
}
.res-note b { color: var(--ink2); font-weight: 600; }

/* ---------- 待确认 ---------- */

.pending-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pending-row {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  font: inherit;
  color: inherit;
}
.pending-row img { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; background: var(--line2); flex: 0 0 auto; }
.pending-row .body { flex: 1; min-width: 0; }
.pending-row .nm { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-row .meta { font-size: 11.5px; color: var(--ink3); margin-top: 3px; line-height: 1.5; }

/* ---------- 设置里的百度配置 ---------- */

.ai-card { padding: 14px 15px; }
.ai-state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink3);
  padding: 2px 0 10px;
}
.ai-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink3); flex: 0 0 auto; }
.ai-state.on .dot { background: var(--mint); }
.ai-state.warn .dot { background: var(--butter); }
.ai-state b { color: var(--ink2); font-weight: 600; }

.ai-actions { display: flex; gap: 8px; margin-top: 4px; }
.ai-actions .btn { flex: 1; }

.safe-note {
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink3);
  margin-top: 8px;
  padding: 10px 12px;
  background: #F5F6F9;
  border: 1px solid var(--line2);
  border-radius: 10px;
}

@media (max-width: 360px) {
  .tpl-card .tpl-thumb { width: 50px; height: 68px; }
  .scan-shutter { width: 72px; height: 72px; }
}


.scan-alt { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.scan-alt button {
  border: 0; background: none; padding: 4px 2px;
  font-size: 12.5px; color: var(--ink2);
  border-bottom: 1px dashed var(--line);
}
.scan-alt i { width: 1px; height: 11px; background: var(--line); }

/* ---------- 取景框（直接调用手机摄像头） ---------- */

.cam {
  position: fixed; inset: 0; z-index: 95;
  background: #0c0c0c;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: cam-in .18s ease-out;
}
@keyframes cam-in { from { opacity: 0; } to { opacity: 1; } }
.cam video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #111;
}
.cam .guide {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 76%; max-width: 340px;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .46);
  pointer-events: none;
}
.cam .guide i {
  position: absolute; width: 30px; height: 30px;
  border: 3px solid rgba(255, 255, 255, .92);
  border-radius: 3px;
}
.cam .guide i:nth-child(1) { left: -1px; top: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.cam .guide i:nth-child(2) { right: -1px; top: -1px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.cam .guide i:nth-child(3) { left: -1px; bottom: -1px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.cam .guide i:nth-child(4) { right: -1px; bottom: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }

.cam .tip {
  position: absolute; left: 22px; right: 22px;
  top: calc(50% - 34vh);
  text-align: center;
  color: #fff; font-size: 13px; line-height: 1.65;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
  pointer-events: none;
}
.cam .tip b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 3px; letter-spacing: .02em; }
.cam .tip span { opacity: .82; font-size: 12px; }

.cam .bar {
  position: absolute; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex; align-items: center; justify-content: center; gap: 44px;
}
.cam .shoot {
  width: 70px; height: 70px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .38);
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
  transition: transform .12s;
}
.cam .shoot:active { transform: scale(.93); }
.cam .rnd {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, .17);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.cam .rnd svg { width: 20px; height: 20px; }
.cam .rnd.on { background: rgba(255, 255, 255, .34); }

.cam .cam-close {
  position: absolute;
  left: 16px; top: calc(env(safe-area-inset-top, 0px) + 14px);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0, 0, 0, .38);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.cam .cam-close svg { width: 18px; height: 18px; }

.cam .cam-err {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 78%; max-width: 300px;
  background: rgba(24, 24, 24, .92);
  color: #F3F5F8;
  border-radius: 14px;
  padding: 20px 18px;
  font-size: 13px; line-height: 1.8;
  text-align: center;
}
.cam .cam-err b { display: block; font-size: 14.5px; margin-bottom: 6px; }
.cam .cam-err button {
  margin-top: 14px; width: 100%; height: 40px;
  border-radius: 10px; border: 0;
  background: #F3F5F8; color: #232A35; font-size: 14px; font-weight: 600;
}

.cam .cap { position: absolute; inset: 0; background: #000; }
.cam .cap .flash {
  position: absolute; inset: 0; background: #fff;
  animation: flash .32s ease-out forwards;
  pointer-events: none;
}
@keyframes flash { from { opacity: .85; } to { opacity: 0; } }

/* 待确认：候选学生直接点 */
.scan-cand {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  margin: 10px 0 2px;
}
.scan-cand .lb { font-size: 12px; color: var(--ink3); margin-right: 1px; }
.scan-cand .cand {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--ink2);
  line-height: 1.3;
  transition: background .12s, border-color .12s, color .12s;
}
.scan-cand .cand.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
