:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5; overscroll-behavior-y: none;
}
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; flex: 1; }
.icon-btn { width: 38px; height: 38px; border: none; background: var(--surface-2); border-radius: 10px;
  font-size: 20px; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:active { background: #e2e8f0; }

main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen { padding: 14px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 15px; }
.empty span { font-size: 13px; }

/* cards / lists */
.task-list { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); }
.card .row { display: flex; align-items: center; justify-content: space-between; }
.task-title { font-size: 17px; font-weight: 700; }
.task-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.task-stats { display: flex; gap: 16px; margin-top: 10px; }
.stat { text-align: center; }
.stat .n { font-size: 20px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

button.btn { border: none; border-radius: 10px; padding: 11px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--primary); color: #fff; }
button.btn:active { background: var(--primary-d); }
button.btn.block { width: 100%; }
button.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.btn.ghost:active { background: #e2e8f0; }
button.btn.sm { padding: 8px 12px; font-size: 13px; }
button.btn.green { background: var(--green); }
button.btn.red { background: var(--red); }
button.btn:disabled { opacity: .5; cursor: default; }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 16px; background: var(--surface); color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 11px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; font-size: 15px; cursor: pointer; }
.seg button.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* answer key entry */
.key-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.qnum { font-size: 22px; font-weight: 800; }
.key-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.opt-btn { aspect-ratio: 1.4; border: 2px solid var(--border); background: var(--surface);
  border-radius: 14px; font-size: 30px; font-weight: 800; cursor: pointer; color: var(--text);
  display: grid; place-items: center; }
.opt-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.opt-btn.blank { font-size: 18px; color: var(--muted); }
.key-nav { display: flex; gap: 10px; margin: 14px 0; }
.key-nav button { flex: 1; }
.mini-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.mini-grid .g { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 6px; font-size: 11px;
  display: grid; place-items: center; background: var(--surface); cursor: pointer; }
.mini-grid .g.set { background: #dbeafe; color: var(--primary-d); border-color: var(--primary); }
.mini-grid .g.cur { outline: 2px solid var(--primary); }

/* scan screen */
.capture { display: flex; flex-direction: column; gap: 10px; }
.student-input { display: flex; flex-direction: column; gap: 8px; }
.student-input input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; background: var(--surface); }
.stu-pick { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; background: var(--surface-2); color: var(--text); }
.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-top: 12px; box-shadow: var(--shadow); }
.score-big { font-size: 40px; font-weight: 800; color: var(--primary); text-align: center; }
.score-sub { text-align: center; color: var(--muted); font-size: 14px; margin-top: 2px; }
.thumb { width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; margin-top: 10px; }
.wrong-list { margin-top: 10px; }
.wrong-list .chip { display: inline-block; background: #fee2e2; color: var(--red); border-radius: 8px;
  padding: 4px 9px; font-size: 13px; margin: 3px 4px 0 0; }
.flag { color: var(--amber); font-size: 13px; margin-top: 8px; }

.sheet-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sheet-row img { width: 54px; height: 70px; object-fit: cover; border-radius: 6px; background: #eee; }
.sheet-row .info { flex: 1; }
.sheet-row .name { font-weight: 600; }
.sheet-row .sub { color: var(--muted); font-size: 13px; }

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 50; display: grid;
  place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; max-height: 92vh;
  overflow-y: auto; padding: 16px; }
.modal h3 { margin: 0 0 12px; }
.slider { margin: 10px 0; }
.slider label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.slider input { width: 100%; }
.warp-preview { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #0b1220; display: block; }

canvas.cornerCanvas { width: 100%; display: block; border-radius: 10px; touch-action: none; }
.handle { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: rgba(37,99,235,.85); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); z-index: 5; }
.handle::after { content: ""; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.cornerWrap { position: relative; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #0f172a;
  color: #fff; padding: 10px 18px; border-radius: 22px; font-size: 14px; z-index: 60; opacity: 0;
  transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: .95; }

.banner { background: #fef3c7; color: #92400e; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  margin-bottom: 12px; }

/* home guide entry — deliberately prominent: the full manual is one tap away */
.guide-entry { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box;
  text-align: left; margin-bottom: 12px; padding: 14px 16px; border: 0; border-radius: 14px;
  cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5 58%, #7c3aed);
  box-shadow: 0 6px 18px rgba(79, 70, 229, .32); }
.guide-entry:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(79,70,229,.3); }
.ge-ico { font-size: 27px; line-height: 1; flex-shrink: 0; }
.ge-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ge-txt b { font-size: 16px; letter-spacing: .5px; }
.ge-txt small { font-size: 12px; opacity: .88; }
.ge-go { font-size: 12px; white-space: nowrap; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,.2); }

/* full operator manual modal (content injected from js/guide.js) */
.modal.guide { max-width: 720px; padding: 0; display: flex; flex-direction: column; }
.guide-top { position: sticky; top: 0; z-index: 2; background: var(--surface);
  padding: 14px 18px 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.guide-top h3 { margin: 0 0 2px; font-size: 17px; }
.guide-top .hint { font-size: 12px; color: var(--muted); }
.guide-body { padding: 4px 18px 20px; flex: 1; }
.guide-title { font-size: 19px; font-weight: 800; margin: 12px 0 6px; }
.guide-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.guide-toc a { font-size: 12px; padding: 5px 11px; border-radius: 999px; text-decoration: none;
  background: #eff6ff; color: #1d4ed8; cursor: pointer; }
.guide-toc a:active { background: #dbeafe; }
.guide-sec { scroll-margin-top: 64px; margin: 0 0 18px; }
.guide-sec h3 { margin: 0 0 8px; font-size: 15px; color: var(--primary);
  border-left: 3px solid var(--primary); padding-left: 8px; }
.guide-sec h4 { margin: 10px 0 4px; font-size: 14px; }
.guide-body p, .guide-body li { font-size: 13px; line-height: 1.75; }
.guide-body p { margin: 6px 0; }
.guide-body ul, .guide-body ol { margin: 6px 0; padding-left: 20px; }
.guide-body li { margin: 3px 0; }
.guide-body hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.guide-body code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.guide-note { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 8px 10px;
  border-radius: 6px; color: #92400e; }
.guide-body .guide-warn { background: #fef2f2; border-left: 3px solid #dc2626; padding: 8px 10px;
  border-radius: 6px; color: #991b1b; font-weight: 500; }
.guide-body .guide-tip { background: #eff6ff; border-left: 3px solid #2563eb; padding: 8px 10px;
  border-radius: 6px; color: #1e40af; font-weight: 500; }
.guide-foot { position: sticky; bottom: 0; background: var(--surface); z-index: 2;
  border-top: 1px solid var(--border); padding: 10px 18px; display: flex; gap: 8px; }

.batch-progress { height: 10px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.batch-progress > div { height: 100%; width: 0; background: var(--green, #16a34a); transition: width .2s; }
.batch-progress .fail { background: #dc2626; }

.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; border: none;
  font-size: 28px; box-shadow: 0 4px 14px rgba(37,99,235,.5); display: grid; place-items: center; cursor: pointer; }
.fab:active { background: var(--primary-d); }

.help li { margin-bottom: 8px; }
.help code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* ===== questions / answers list screens ===== */
.link-btn { background: none; border: none; color: var(--primary); font-size: 13px; cursor: pointer; padding: 4px; }
.qsum-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qsum-bar > span:first-child { font-size: 17px; font-weight: 700; }
.qbar { display: flex; gap: 10px; margin-top: 14px; }
.qbar button { flex: 1; }
.qgroup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.qgroup-title { color: var(--muted); font-size: 13px; padding: 8px 0 4px; }
.qrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--surface-2); }
.qrow.sel { background: #eff6ff; }
.qrow .no { width: 26px; font-weight: 700; flex-shrink: 0; }
.qrow .pts { color: var(--muted); font-size: 12px; flex-shrink: 0; cursor: pointer; padding: 2px 4px; }
.badge { border: 1px solid var(--primary); color: var(--primary); font-size: 12px; border-radius: 999px;
  padding: 2px 8px; background: #eff6ff; flex-shrink: 0; cursor: pointer; white-space: nowrap; }
.qrow .opts-box { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.opt-sm { min-width: 34px; height: 34px; padding: 0 8px; border: 2px solid var(--border); background: var(--surface);
  border-radius: 9px; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer; }
.opt-sm.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.qrow input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }
.adm-list { display: flex; flex-direction: column; gap: 8px; }
.adm-row { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; }
.adm-row .name { font-weight: 600; flex: 1; }
.adm-row .date { color: var(--muted); font-size: 12px; }

/* ===== sheet editor (题目 / 类型 / 分值 / 答案) ===== */
.seg.sm button { padding: 7px 10px; font-size: 13px; }
.sh-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sh-tools .btn { flex: 1 1 auto; }
.qgroup-title { display: flex; align-items: center; justify-content: space-between; }
.qrow .no { width: 34px; flex-shrink: 0; border: none; background: none; padding: 4px 0;
  font-size: 16px; font-weight: 700; color: var(--text); text-align: left; cursor: pointer; }
.qrow .pts { border: none; background: var(--surface-2); border-radius: 8px; color: var(--muted);
  font-size: 12px; padding: 4px 8px; cursor: pointer; }
.qrow .pts:active { background: #e2e8f0; }
.badge.multi { border-color: var(--amber); color: var(--amber); background: #fffbeb; }
.qrow .opts-box { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end;
  margin-left: auto; row-gap: 4px; }
.qrow .opt-sm { min-width: 27px; height: 27px; padding: 0 6px; font-size: 12px; border-width: 1.5px; }

/* 模板视图：按答题卡版面排布 */
.tv { display: flex; flex-direction: column; gap: 12px; }
.tv-legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tv-legend .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--surface-2);
  border: 1px solid var(--border); display: inline-block; margin-left: 6px; }
.tv-legend .dot.set { background: #dbeafe; border-color: var(--primary); }
.tv-legend .dot.multi { background: #fef3c7; border-color: var(--amber); }
.tv-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; box-shadow: var(--shadow); display: flex; gap: 6px; overflow-x: auto; }
.tv-col { flex: 1 1 0; min-width: 56px; display: flex; flex-direction: column; gap: 4px; }
.tv-head { font-size: 10px; color: var(--muted); text-align: center; }
.tv-grid { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.tv-cell { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px;
  padding: 4px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tv-cell.set { background: #dbeafe; border-color: var(--primary); }
.tv-cell.multi.set { background: #fef3c7; border-color: var(--amber); }
.tv-q { font-size: 10px; color: var(--muted); line-height: 1; }
.tv-a { font-size: 15px; font-weight: 800; line-height: 1.2; }
.tv-p { font-size: 9px; color: var(--muted); line-height: 1; }

/* bottom sheets (per-question / batch editors) */
.ss-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 75;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.ss-sheet { background: var(--surface); width: 100%; max-width: 560px; border-radius: 18px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto;
  box-shadow: 0 6px 28px rgba(15,23,42,.28); }
.ss-sheet .btn-row { justify-content: center; }
.ss-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 17px; }
.ss-row { margin-bottom: 12px; }
.ss-row > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ss-row .seg button { padding: 9px; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px;
  padding: 8px 12px; font-size: 14px; cursor: pointer; }
.chips button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chips input { width: 78px; padding: 8px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; background: var(--surface); }
.ss-sheet .key-pad { grid-template-columns: repeat(4, 1fr); }
.ss-sheet .opt-btn { aspect-ratio: 1.35; font-size: 24px; }

/* ===== live camera ===== */
.cam-stage { position: relative; margin-top: 12px; border-radius: 14px; overflow: hidden;
  background: #0b1220; box-shadow: var(--shadow); }
.cam-stage video { width: 100%; max-height: 66vh; display: block; object-fit: contain; background: #000; }
.cam-frame { position: absolute; left: 5%; right: 5%; top: 6%; bottom: 22%;
  border: 2px dashed rgba(255,255,255,.45); border-radius: 12px; pointer-events: none; }
.cam-hud { position: absolute; left: 8px; right: 8px; top: 8px; }
.cam-hud .hud-card.compact { max-width: 420px; margin: 0 auto; width: fit-content; }
.hud-card { background: rgba(15,23,42,.86); color: #fff; border: 2px solid rgba(148,163,184,.5);
  border-radius: 12px; padding: 8px 10px; }
.hud-card.ok { border-color: #22c55e; }
.hud-card.bad { border-color: #f59e0b; }
.hud-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hud-name { font-size: 14px; font-weight: 700; }
.hud-score { font-size: 26px; font-weight: 800; line-height: 1; }
.hud-score.ok { color: #4ade80; }
.hud-score.bad { color: #fbbf24; }
.hud-sub { font-size: 12px; color: #cbd5e1; margin-top: 2px; }
.hud-wrong { font-size: 12px; color: #fecaca; margin-top: 4px; line-height: 1.7; }
.hud-wrong .chip { background: rgba(220,38,38,.9); color: #fff; border-radius: 6px;
  padding: 1px 6px; margin-right: 4px; display: inline-block; }
.hud-btns { margin-top: 6px; }
.hud-btns .hud-saved { font-size: 12px; color: #86efac; }
/* continuous auto-save flow: score only — keep it out of the viewfinder */
.hud-card.compact { background: none; border: 0; padding: 0; box-shadow: none; }
.cam-hud .hud-card.compact { margin: 0 auto; width: fit-content; }
.hud-card.compact .hud-line { justify-content: center; }
.hud-card.compact .hud-score {
  font-size: 44px; font-weight: 800; line-height: 1.1; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.95), 0 0 3px rgba(0,0,0,.9);
}
.hud-thumb { position: absolute; right: 10px; bottom: 10px; width: 52px; height: 68px;
  object-fit: cover; border-radius: 6px; border: 1px solid rgba(255,255,255,.5); }
.cam-status { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(15,23,42,.9); color: #fff; font-size: 13px; padding: 8px 14px; border-radius: 20px;
  white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.cam-status.bad { background: rgba(185,28,28,.95); }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 16px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px; }
.cam-btn { border: none; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600;
  background: rgba(15,23,42,.65); color: #fff; cursor: pointer; }
.cam-btn.ghost { background: rgba(15,23,42,.55); }
.cam-btn.shutter { width: 66px; height: 66px; border-radius: 50%; background: #fff;
  border: 5px solid rgba(255,255,255,.5); box-shadow: 0 0 0 4px rgba(0,0,0,.25); }
.cam-btn.shutter:active { background: #cbd5e1; }
/* 扫描设置：静态排在相机区域下方，白底深字，不再覆盖画面 */
.scan-settings { margin-top: 12px; padding: 10px 12px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 10px; }
.cam-opts { display: flex; gap: 10px 18px; justify-content: flex-start;
  flex-wrap: wrap; font-size: 13px; color: #334155; }
.cam-opts label { display: flex; align-items: center; gap: 5px; }
.cam-opts input { accent-color: var(--primary); }
/* 相机变焦：静态排在设置区，不覆盖取景画面 */
.cam-zoom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 9px; padding-top: 9px; border-top: 1px dashed #e2e8f0;
  font-size: 13px; color: #334155; }
.cam-zoom-label { font-weight: 600; }
.cam-zoom input[type=range] { flex: 1 1 120px; min-width: 90px; max-width: 260px;
  accent-color: var(--primary); }
.cam-zoom .btn.sm { padding: 5px 11px; min-width: 34px; }
.cam-zoom-val { min-width: 38px; text-align: center; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.cam-zoom-mode { font-size: 11px; color: #64748b; }
/* 数字变焦只放大画面、不改变布局尺寸（4:3 / max-height 均不受影响） */
.cam-stage video { transform-origin: center center; }
/* 放大后虚线取景框不再对应卡片边界，淡化避免误导 */
.cam-stage.zoomed .cam-frame { opacity: .18; }
/* 手机端暂存图片提示：排在相机区域之外，不遮挡取景框 */
.imgq-status { margin-top: 8px; padding: 6px 9px; font-size: 12px; color: #475569;
  background: #eef2f7; border-radius: 6px; }
.imgq-status.syncing { color: #0f6e56; background: #e1f5ee; }
/* 图片尚未合并到服务器时，结果页用占位块代替破图 */
.sheet-row .no-img { width: 54px; height: 70px; flex: 0 0 54px; border-radius: 6px;
  background: #eef2f7; color: #94a3b8; font-size: 11px; display: flex;
  align-items: center; justify-content: center; text-align: center; }

/* ===== template manager ===== */
.pack-item .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pack-item .badge { flex-shrink: 0; }
.pack-item .btn-row { margin-top: 10px; }
.pack-item .task-meta b { font-weight: 700; }
/* question rows that have no grid on the calibrated card */
.qrow.nocard { opacity: .55; }
.qrow.nocard .opt-sm { cursor: not-allowed; }
.nocard-tip { font-size: 11px; color: #b45309; background: #fffbeb; border: 1px solid #fcd34d;
  border-radius: 999px; padding: 2px 8px; white-space: nowrap; }

/* ---------- full-screen image viewer ---------- */
#imgViewer { position: fixed; inset: 0; z-index: 999; display: none;
  background: rgba(8,10,14,.94); }
#imgViewer.on { display: block; }
#imgViewer .iv-stage { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
#imgViewer img { max-width: 96vw; max-height: 92vh; user-select: none;
  -webkit-user-drag: none; transform-origin: center center;
  box-shadow: 0 8px 40px rgba(0,0,0,.6); border-radius: 4px; }
#imgViewer .iv-close { position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.16); color: #fff; font-size: 17px; }
#imgViewer .iv-close:active { background: rgba(255,255,255,.3); }
#imgViewer .iv-tip { position: absolute; left: 0; right: 0; bottom: 14px;
  text-align: center; color: rgba(255,255,255,.55); font-size: 12px;
  pointer-events: none; }
.sheet-row img { cursor: zoom-in; }
.thumb { cursor: zoom-in; }

/* ---------- results: batch delete ---------- */
.sheet-row.selected { background: #fef2f2; border-radius: 8px; }
.sheet-row .sheet-check { flex: 0 0 auto; display: flex; align-items: center;
  cursor: pointer; padding: 6px 2px; }
.sheet-row .sheet-check input { width: 20px; height: 20px; accent-color: var(--red);
  cursor: pointer; }
.batch-del-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15,23,42,.12); flex-wrap: wrap; }
.batch-del-bar .batch-all { display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer; }
.batch-del-bar .batch-all input { width: 20px; height: 20px; accent-color: var(--primary);
  cursor: pointer; }
.batch-del-bar .batch-count { flex: 1; color: var(--muted); font-size: 13px;
  white-space: nowrap; }
.batch-del-bar .btn { flex: 0 0 auto; }
#scr-results.batch-mode #sheetList { padding-bottom: 72px; }

/* ---------- teacher self-registration + admin approval ---------- */
.login-links { display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; gap: 10px; }
.reg-notice { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d;
  margin-bottom: 12px; line-height: 1.6; }
.banner.ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.adm-row.pending { flex-wrap: wrap; border-color: #fcd34d; background: #fffbeb; }
.adm-row .adm-info { flex: 1 1 100%; display: flex; flex-direction: column; gap: 2px; }
.adm-row .adm-info .name { font-size: 15px; }
.adm-row .adm-info .date { font-size: 12px; color: var(--muted); word-break: break-all; }
.adm-row .btn.sm { flex: 1; }
.badge.warn { border-color: var(--amber); color: var(--amber); background: #fffbeb; }
