/* ============================================================
   作业星球 · 样式表（手机优先）
   ============================================================ */
:root {
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --indigo-soft: #eef2ff;
  --violet: #8b5cf6;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --bg: #f9fafb;
  --card: #ffffff;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --sh-sm: 0 1px 3px rgba(17,24,39,.08);
  --sh-md: 0 4px 16px -4px rgba(17,24,39,.12);
  --sh-lg: 0 12px 32px -8px rgba(17,24,39,.18);
  --sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }
img { display: block; max-width: 100%; }

/* ============ 顶部栏 ============ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: none;
}
.topbar.show { display: block; }
.topbar-inner {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 14px;
  max-width: 720px; margin: 0 auto;
}
.tb-back, .tb-logout {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .18s;
  flex-shrink: 0;
}
.tb-back:hover, .tb-logout:hover { background: var(--bg); }
.tb-title {
  flex: 1; font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============ 屏幕容器 ============ */
.screen {
  display: none;
  min-height: 100vh;
  padding: 72px 14px 32px;
  max-width: 720px;
  margin: 0 auto;
}
.screen.is-active, .screen.active { display: block; animation: fadeIn .22s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.screen.no-topbar { padding-top: 14px; }
.screen.has-topbar { padding-top: 72px; }
.app.has-topbar { padding-top: 0; }

/* ============ 首页 ============ */
#screenHome { padding: 0; display: none; }
#screenHome.is-active, #screenHome.active { display: flex; align-items: center; justify-content: center; }
.home-wrap {
  width: 100%; max-width: 420px; padding: 32px 24px;
  text-align: center;
}
.home-logo { width: 84px; height: 84px; margin: 0 auto 22px; }
.home-logo svg { width: 100%; height: 100%; }
.home-title { font-size: 30px; font-weight: 900; letter-spacing: -.02em; margin-bottom: 8px; }
.home-sub { font-size: 14.5px; color: var(--ink-3); margin-bottom: 34px; }

.role-cards { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.role-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 22px 22px; border-radius: var(--r-lg);
  background: var(--card); border: 1.5px solid var(--line);
  text-align: left; transition: all .2s;
  box-shadow: var(--sh-sm);
}
.role-card:active { transform: scale(.98); }
.role-card.teacher:hover { border-color: var(--indigo); box-shadow: 0 8px 24px -8px rgba(79,70,229,.3); }
.role-card.student:hover { border-color: var(--green); box-shadow: 0 8px 24px -8px rgba(16,185,129,.3); }
.rc-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 10px;
}
.rc-icon svg { width: 24px; height: 24px; }
.role-card.teacher .rc-icon { background: var(--indigo-soft); color: var(--indigo); }
.role-card.student .rc-icon { background: var(--green-soft); color: var(--green); }
.rc-title { font-size: 18px; font-weight: 800; }
.rc-desc { font-size: 13.5px; color: var(--ink-3); }
.rc-enter {
  margin-top: 10px; font-size: 13px; font-weight: 700;
  opacity: 0; transform: translateX(-4px); transition: all .2s;
}
.role-card.teacher .rc-enter { color: var(--indigo); }
.role-card.student .rc-enter { color: var(--green); }
.role-card:hover .rc-enter { opacity: 1; transform: none; }
.home-tip { font-size: 12.5px; color: var(--ink-4); }

/* ============ 顶栏身份标识 ============ */
.tb-role {
  flex-shrink: 0; font-size: 11.5px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .04em;
}
.tb-role.teacher { background: var(--indigo-soft); color: var(--indigo); }
.tb-role.student { background: var(--green-soft); color: var(--green); }

/* 顶栏主题色：老师=靖蓝，学生=青绿 */
.topbar.role-teacher { border-bottom-color: rgba(79,70,229,.28); }
.topbar.role-teacher .tb-title { color: var(--indigo); }
.topbar.role-student { border-bottom-color: rgba(16,185,129,.28); }
.topbar.role-student .tb-title { color: var(--green); }

/* ============ 表单页 ============ */
.form-wrap { max-width: 440px; margin: 0 auto; padding-top: 20px; }
.page-title { font-size: 24px; font-weight: 900; margin-bottom: 6px; }
.page-sub { font-size: 14px; color: var(--ink-3); margin-bottom: 24px; line-height: 1.6; }

.tabs { display: flex; gap: 8px; margin-bottom: 22px; background: var(--line); padding: 4px; border-radius: 12px; }
.tab {
  flex: 1; padding: 10px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: var(--ink-3);
  transition: all .2s;
}
.tab.is-active { background: var(--card); color: var(--indigo); box-shadow: var(--sh-sm); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.err { display: block; font-size: 12.5px; color: var(--red); margin-top: 5px; min-height: 0; }
.field.has-error input, .field.has-error textarea { border-color: var(--red); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 22px; border-radius: 12px;
  font-size: 15px; font-weight: 700;
  transition: all .18s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; border-radius: 10px; }

.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 4px 14px -4px rgba(79,70,229,.5); }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-primary:disabled { background: var(--line-2); box-shadow: none; cursor: not-allowed; }

.btn-ghost { background: var(--card); color: var(--ink-2); border: 1.5px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--indigo); color: var(--indigo); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }

.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }

.btn-row { display: flex; gap: 10px; margin-top: 22px; }
.btn-row .btn { flex: 1; }

/* ============ 找到班级卡片 ============ */
.class-found {
  margin-top: 22px; padding: 20px;
  background: var(--card); border: 1.5px solid var(--green);
  border-radius: var(--r-md); animation: fadeIn .25s ease both;
}
.cf-name { font-size: 18px; font-weight: 800; margin-bottom: 3px; }
.cf-teacher { font-size: 13.5px; color: var(--ink-3); }

/* ============ 工作台 ============ */
.dash-head {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
  color: #fff; border-radius: var(--r-lg);
  padding: 22px 20px; margin-bottom: 18px;
}
.dh-name { font-size: 20px; font-weight: 900; margin-bottom: 6px; }
.dh-code { font-size: 13.5px; color: rgba(255,255,255,.85); display: flex; align-items: center; gap: 7px; }
.dh-code b { font-size: 17px; letter-spacing: .12em; color: #fff; }
.copy-btn {
  width: 26px; height: 26px; border-radius: 7px;
  background: rgba(255,255,255,.2); color: #fff;
  display: grid; place-items: center;
}
.copy-btn:hover { background: rgba(255,255,255,.32); }

.dash-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 18px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 10px; text-align: center;
}
.stat b { display: block; font-size: 24px; font-weight: 900; color: var(--indigo); line-height: 1.2; }
.stat span { font-size: 12px; color: var(--ink-3); }

.dash-actions { margin-bottom: 24px; }

.section-label {
  font-size: 13px; font-weight: 800; color: var(--ink-3);
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.count-badge {
  background: var(--indigo-soft); color: var(--indigo);
  font-size: 11.5px; font-weight: 800;
  padding: 2px 9px; border-radius: 100px;
}

/* ============ 列表 ============ */
.list { display: flex; flex-direction: column; gap: 10px; }
.empty {
  text-align: center; padding: 34px 16px;
  color: var(--ink-4); font-size: 14px;
  background: var(--card); border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
}

.card-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  transition: all .18s;
}
.card-item.clickable { cursor: pointer; }
.card-item.clickable:active { transform: scale(.99); background: var(--bg); }
.ci-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ci-title { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.ci-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.ci-badge {
  font-size: 11.5px; font-weight: 800; padding: 4px 10px;
  border-radius: 100px; white-space: nowrap; flex-shrink: 0;
}

/* ============ 作業卡片操作列（編輯 / 刪除） ============ */
.ci-actions {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 11px; border-top: 1px dashed var(--line);
}
.ci-act {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 700; font-family: inherit;
  padding: 6px 13px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); cursor: pointer;
  transition: all .16s; -webkit-tap-highlight-color: transparent;
}
.ci-act svg { flex-shrink: 0; }
.ci-act:active { transform: scale(.96); }
.ci-act.ci-edit:hover,
.ci-act.ci-edit:focus-visible {
  border-color: var(--indigo); color: var(--indigo);
  background: var(--indigo-soft);
}
.ci-act.ci-del:hover,
.ci-act.ci-del:focus-visible {
  border-color: var(--red); color: var(--red);
  background: var(--red-soft);
}
/* 觸控裝置上放大可點區域 */
@media (pointer: coarse) {
  .ci-act { padding: 8px 15px; font-size: 13px; }
}
.badge-pending { background: var(--amber-soft); color: #b45309; }
.badge-done { background: var(--green-soft); color: #047857; }
.badge-todo { background: var(--indigo-soft); color: var(--indigo); }
.badge-overdue { background: var(--red-soft); color: var(--red); }
.badge-score { background: var(--indigo-soft); color: var(--indigo); font-size: 15px; padding: 5px 12px; }

/* ============ 作业构建器 ============ */
.pad { max-width: 620px; margin: 0 auto; }
.pad-title { font-size: 20px; font-weight: 900; margin-bottom: 16px; }

.q-builder { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }

.q-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  animation: fadeIn .2s ease both;
}
.q-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px;
}
.q-type {
  font-size: 11.5px; font-weight: 800; padding: 3px 10px;
  border-radius: 100px; background: var(--indigo-soft); color: var(--indigo);
}
.q-type.judge { background: var(--amber-soft); color: #b45309; }
.q-type.text { background: var(--green-soft); color: #047857; }
.q-del {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--ink-4);
}
.q-del:hover { background: var(--red-soft); color: var(--red); }

.q-label { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }

.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opt-key {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--indigo-soft); color: var(--indigo);
  font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center; flex-shrink: 0;
  cursor: pointer; transition: all .15s;
}
.opt-key.is-correct { background: var(--green); color: #fff; }
.opt-row input {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--line-2);
  border-radius: 8px; font-size: 14px;
}
.opt-row input:focus { outline: none; border-color: var(--indigo); }

.add-q-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.add-q-row .btn { flex: 1; min-width: 110px; font-size: 14px; padding: 11px 14px; }

/* 拍照上传题目扫描条 */
.q-scan-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--indigo-soft); border: 1.5px dashed rgba(79,70,229,.45);
  border-radius: var(--r-md);
}
.btn-scan {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
  background: var(--indigo); color: #fff; font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: 10px; border: none;
  transition: transform .15s, box-shadow .18s;
}
.btn-scan:hover { box-shadow: 0 6px 18px -6px rgba(79,70,229,.5); }
.btn-scan:active { transform: scale(.97); }
.btn-scan:disabled { opacity: .6; cursor: not-allowed; }
.q-scan-hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }

/* 识别中的题目卡片 */
.q-card.scanning { border-color: var(--indigo); background: linear-gradient(180deg, rgba(79,70,229,.05), transparent); }
.q-scan-img { width: 100%; border-radius: 10px; margin-top: 8px; border: 1px solid var(--line); }
.q-scan-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  background: var(--indigo-soft); color: var(--indigo);
}

/* ============ 批改 ============ */
.grade-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grade-answer-row { flex-shrink: 0; }
.grading-summary {
  display: flex; gap: 18px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 18px;
  font-size: 13.5px; color: var(--ink-3);
}
.grading-summary b { color: var(--indigo); font-size: 17px; font-weight: 900; margin-left: 4px; }

.sub-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.sub-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; cursor: pointer; gap: 10px;
}
.sub-name { font-size: 15px; font-weight: 700; }
.sub-meta { font-size: 12.5px; color: var(--ink-3); }
.sub-expand { color: var(--ink-4); transition: transform .2s; flex-shrink: 0; }
.sub-item.is-open .sub-expand { transform: rotate(180deg); }

.sub-body { display: none; padding: 0 16px 16px; border-top: 1px solid var(--line); }
.sub-item.is-open .sub-body { display: block; }

.ans-review { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.ans-review:last-child { border-bottom: none; }
.ar-q { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.ar-ans { font-size: 13.5px; padding: 8px 12px; border-radius: 8px; background: var(--bg); }
.ar-ans.is-right { background: var(--green-soft); color: #047857; }
.ar-ans.is-wrong { background: var(--red-soft); color: #b91c1c; }
.ar-ans.is-auto { background: var(--amber-soft); color: #b45309; }
.ar-ans img { max-width: 100%; border-radius: 8px; margin-top: 6px; }

.grade-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.grade-score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.grade-score-row label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); flex-shrink: 0; }
.grade-score-row input {
  width: 90px; padding: 10px 12px; border: 1.5px solid var(--line-2);
  border-radius: 8px; font-size: 17px; font-weight: 800; text-align: center;
}
.grade-score-row input:focus { outline: none; border-color: var(--indigo); }
.grade-comment textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line-2);
  border-radius: 8px; font-size: 14px; resize: vertical; min-height: 70px;
}
.grade-comment textarea:focus { outline: none; border-color: var(--indigo); }

/* ============ 答题 ============ */
.answer-head {
  position: sticky; top: 56px; z-index: 50;
  background: var(--bg); padding: 12px 0 10px; margin-bottom: 8px;
}
.ah-title { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.ah-progress { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.ah-progress b { color: var(--indigo); font-size: 15px; font-weight: 900; }
.ah-bar { height: 4px; background: var(--line); border-radius: 100px; overflow: hidden; }
.ah-bar span { display: block; height: 100%; width: 0; background: var(--indigo); border-radius: 100px; transition: width .3s; }

.answer-body { min-height: 62vh; }
.q-block {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 20px 18px;
  animation: fadeIn .2s ease both;
}
.qb-type { font-size: 11.5px; font-weight: 800; color: var(--indigo); background: var(--indigo-soft); display: inline-block; padding: 3px 10px; border-radius: 100px; margin-bottom: 12px; }
.qb-text { font-size: 16.5px; font-weight: 600; line-height: 1.65; margin-bottom: 20px; }

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border: 1.5px solid var(--line-2);
  border-radius: 12px; background: var(--card);
  text-align: left; transition: all .18s; font-size: 15px; line-height: 1.55;
}
.opt:active { transform: scale(.99); }
.opt.is-selected { border-color: var(--indigo); background: var(--indigo-soft); }
.opt-key-badge {
  width: 24px; height: 24px; border-radius: 7px;
  border: 1.5px solid var(--line-2);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; color: var(--ink-3);
  flex-shrink: 0; transition: all .18s;
}
.opt.is-selected .opt-key-badge { background: var(--indigo); border-color: var(--indigo); color: #fff; }

.judge-opts { display: flex; gap: 12px; }
.judge-btn {
  flex: 1; padding: 18px; border: 1.5px solid var(--line-2);
  border-radius: 12px; font-size: 17px; font-weight: 800; color: var(--ink-2);
  transition: all .18s;
}
.judge-btn.is-yes { }
.judge-btn.is-selected { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); }

.text-tools { display: flex; flex-direction: column; gap: 12px; }
.tool-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border: 1.5px dashed var(--line-2);
  border-radius: 12px; font-size: 14.5px; font-weight: 700; color: var(--ink-2);
  background: var(--card); transition: all .18s;
}
.tool-btn:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-soft); }
.tool-btn svg { flex-shrink: 0; }

.attachments { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.attach-preview {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg);
}
.attach-preview img { width: 100%; display: block; }
.attach-del {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(17,24,39,.7); color: #fff;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
}
.attach-label { font-size: 12px; color: var(--ink-3); padding: 6px 10px; background: var(--card); }

.answer-nav { display: flex; gap: 10px; padding: 16px 0 8px; }
.answer-nav .btn { flex: 1; padding: 15px; }

/* ============ 提交摘要 ============ */
.submit-summary {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 18px; margin-bottom: 22px;
}
.ss-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.ss-row:last-child { border-bottom: none; }
.ss-row b.miss { color: var(--red); }
.ss-row b.done { color: var(--green); }

/* ============ 结果 ============ */
.result-wrap { max-width: 560px; margin: 0 auto; text-align: center; padding-top: 16px; }
.result-score { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin-bottom: 10px; }
.rs-num { font-size: 64px; font-weight: 900; color: var(--indigo); line-height: 1; }
.rs-den { font-size: 20px; color: var(--ink-4); }
.result-title { font-size: 21px; font-weight: 900; margin-bottom: 6px; }
.result-sub { font-size: 14px; color: var(--ink-3); margin-bottom: 24px; }

.result-comment {
  background: var(--amber-soft); border: 1px solid #fcd34d;
  border-radius: var(--r-md); padding: 16px; text-align: left; margin-bottom: 24px;
}
.rc-label { font-size: 12px; font-weight: 800; color: #b45309; margin-bottom: 6px; }
.rc-text { font-size: 14.5px; color: #78350f; line-height: 1.7; white-space: pre-wrap; }

.review-list { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.rv-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 15px 16px; }
.rv-q { font-size: 14px; font-weight: 600; margin-bottom: 9px; }
.rv-line { font-size: 13.5px; padding: 7px 11px; border-radius: 8px; margin-bottom: 6px; }
.rv-line.ok { background: var(--green-soft); color: #047857; }
.rv-line.no { background: var(--red-soft); color: #b91c1c; }
.rv-line.ans { background: var(--bg); color: var(--ink-2); }
.rv-line img { max-width: 100%; border-radius: 6px; margin-top: 6px; }

/* ============ 白板 ============ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(17,24,39,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 14px; animation: fadeIn .2s ease both;
}
.modal-box {
  background: var(--card); border-radius: var(--r-lg);
  width: 100%; max-width: 640px;
  box-shadow: var(--sh-lg);
  animation: popIn .24s cubic-bezier(.22,1,.36,1) both;
  display: flex; flex-direction: column;
  max-height: 92vh;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.wb-box { overflow: hidden; }
.wb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 800;
}
.wb-tools { display: flex; gap: 5px; }
.wb-tool {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; color: var(--ink-2);
  background: var(--bg); transition: all .15s;
}
.wb-tool:hover { background: var(--line); }
.wb-tool.is-active { background: var(--indigo); color: #fff; }
.wb-close { background: transparent; }
.wb-close:hover { background: var(--red-soft); color: var(--red); }

.wb-canvas {
  width: 100%; flex: 1; min-height: 320px;
  background: #fff; touch-action: none; cursor: crosshair;
  display: block;
}
.wb-foot { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.wb-foot .btn { flex: 1; }

/* 图片预览 */
.modal-img { position: relative; max-width: 92vw; max-height: 88vh; }
.modal-img img { max-width: 100%; max-height: 88vh; border-radius: 12px; }
.modal-img-close {
  position: absolute; top: -14px; right: -14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--ink);
  display: grid; place-items: center;
  box-shadow: var(--sh-md);
}

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 30px;
  transform: translateX(-50%) translateY(14px);
  z-index: 300; background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 12px 22px; border-radius: 100px;
  box-shadow: var(--sh-lg); opacity: 0;
  transition: opacity .24s, transform .24s;
  pointer-events: none; max-width: 88vw; text-align: center;
}
.toast.is-show, .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 加载 ============ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(249,250,251,.85);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--indigo);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--ink-3); font-weight: 600; }

/* ============ 桌面适配 ============ */
@media (min-width: 768px) {
  .screen { padding: 84px 24px 40px; }
  .role-cards { flex-direction: row; }
  .role-card { flex: 1; }
  .home-wrap { max-width: 560px; }
  .answer-body { min-height: 56vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ============================================================
   ▼▼▼ 兼容層：app.js 動態生成的 class（與上方靜態 HTML class 對齊）
   ============================================================ */

/* ---- 列表項（通用） ---- */
.list-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 15px 16px;
  transition: all .18s;
}
.li-idx {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--indigo-soft); color: var(--indigo);
  font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center; flex-shrink: 0;
}
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 15.5px; font-weight: 700; margin-bottom: 3px; word-break: break-word; }
.li-sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; }
.li-sub.dim { color: var(--ink-4); }
.li-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.assign-item { align-items: center; }

/* ---- 徽章 ---- */
.badge {
  font-size: 11.5px; font-weight: 800; padding: 4px 10px;
  border-radius: 100px; white-space: nowrap;
}
.badge-pending { background: var(--amber-soft); color: #b45309; }
.badge-done { background: var(--green-soft); color: #047857; }

/* ---- 題目構建器（app.js） ---- */
.qb-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  animation: fadeIn .2s ease both;
}
.qb-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.qb-no { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
.qb-type {
  font-size: 11.5px; font-weight: 800; padding: 3px 10px;
  border-radius: 100px; background: var(--indigo-soft); color: var(--indigo);
}
.qb-del {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--ink-4);
}
.qb-del:hover { background: var(--red-soft); color: var(--red); }
.qb-input {
  width: 100%; padding: 11px 13px; margin-bottom: 9px;
  border: 1.5px solid var(--line-2); border-radius: 9px;
  font-size: 14.5px; background: var(--card); color: var(--ink);
  transition: border-color .18s;
}
.qb-input:focus { outline: none; border-color: var(--indigo); }
.qb-opt-row { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.qb-opt-row input[type="radio"] {
  width: 18px; height: 18px; flex-shrink: 0;
  accent-color: var(--indigo); cursor: pointer;
}
.qb-opt-lb {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: var(--indigo-soft); color: var(--indigo);
  font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center;
}
.qb-opt-row .qb-input { margin-bottom: 0; }
.qb-judge { display: flex; gap: 10px; }
.qb-hint { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.qb-text { font-size: 15.5px; font-weight: 600; line-height: 1.65; margin-bottom: 14px; color: var(--ink); }

.judge-btn {
  flex: 1; padding: 14px; border: 1.5px solid var(--line-2);
  border-radius: 11px; font-size: 15px; font-weight: 800;
  color: var(--ink-2); background: var(--card); transition: all .18s;
}
.judge-btn.is-on, .judge-btn.is-selected {
  border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo);
}

/* ---- 批改：提交詳情 ---- */
.sub-detail {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.sub-q {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13.5px; padding: 6px 0; line-height: 1.6;
}
.sq-no { font-weight: 800; color: var(--ink-2); flex-shrink: 0; }
.sq-ans { flex: 1; color: var(--ink-2); word-break: break-word; }
.mk { font-weight: 900; flex-shrink: 0; }
.mk.ok { color: var(--green); }
.mk.no { color: var(--red); }
.mk.na { color: var(--amber); }
.an-img { color: var(--indigo); font-weight: 700; }

.grade-row {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.grade-score {
  width: 78px; flex-shrink: 0; margin-bottom: 0;
  text-align: center; font-weight: 800; font-size: 16px;
}
.grade-comment { flex: 1; min-width: 130px; margin-bottom: 0; }
.grade-row .btn { flex-shrink: 0; }

/* ---- 錄入答案 ---- */
.ak-opts { display: flex; flex-direction: column; }
.ak-opt-text { font-size: 14.5px; color: var(--ink-2); flex: 1; }

/* ---- 答題頁（app.js） ---- */
.q-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.q-no { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
.q-text { font-size: 16.5px; font-weight: 600; line-height: 1.65; margin-bottom: 20px; }

.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1.5px solid var(--line-2);
  border-radius: 12px; background: var(--card);
  text-align: left; transition: all .18s; font-size: 15px; line-height: 1.55;
}
.opt-item:active { transform: scale(.99); }
.opt-item.is-sel { border-color: var(--indigo); background: var(--indigo-soft); }
.opt-lb {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  border: 1.5px solid var(--line-2);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; color: var(--ink-3);
  transition: all .18s;
}
.opt-item.is-sel .opt-lb { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.opt-tx { flex: 1; }

.judge-big { display: flex; gap: 12px; }
.judge-big .judge-btn { padding: 18px; font-size: 17px; }

.q-textarea {
  width: 100%; min-height: 130px; padding: 14px;
  border: 1.5px solid var(--line-2); border-radius: 12px;
  font-size: 15px; line-height: 1.7; resize: vertical;
  background: var(--card); color: var(--ink);
}
.q-textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

.photo-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.photo-row .btn { flex: 1; min-width: 120px; }
.photo-preview {
  position: relative; margin-top: 12px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.photo-preview img { width: 100%; display: block; }
.photo-del {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(17,24,39,.7); color: #fff;
  display: grid; place-items: center;
}

/* ---- 提交摘要（app.js） ---- */
.sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: 14.5px;
  border-bottom: 1px dashed var(--line);
}
.sum-row:last-child { border-bottom: none; }
.sum-row b { font-weight: 900; color: var(--ink); }
.sum-row b.warn { color: var(--red); }

/* ---- 結果逐題回顧（app.js） ---- */
.rv-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.rv-mine {
  font-size: 13.5px; padding: 8px 12px; border-radius: 8px;
  background: var(--bg); color: var(--ink-2); word-break: break-word;
}
.rv-correct {
  font-size: 13px; padding: 7px 11px; border-radius: 8px; margin-top: 6px;
  background: var(--green-soft); color: #047857; font-weight: 600;
}
.rv-img { margin-top: 8px; }
.rv-img img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }

/* ---- 錯題本（app.js） ---- */
.wr-item { align-items: flex-start; }
.wr-line {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13.5px; margin-top: 7px; line-height: 1.6;
  word-break: break-word;
}
.wr-lb {
  font-size: 11px; font-weight: 800; padding: 2px 8px;
  border-radius: 100px; flex-shrink: 0;
}
.wr-lb.no { background: var(--red-soft); color: var(--red); }
.wr-lb.ok { background: var(--green-soft); color: #047857; }

/* ============================================================
   批改作業 / 錯題本 / 補充元件
   ============================================================ */

/* --- 標籤 tag --- */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tag.ok   { background: rgba(34, 211, 122, .14); color: #15803d; }
.tag.warn { background: rgba(255, 179, 64, .16); color: #b45309; }
.tag.err  { background: rgba(239, 68, 68, .13); color: #b91c1c; }

/* --- 線框小按鈕 --- */
.btn-line {
  background: #fff;
  color: var(--c-primary, #4f46e5);
  border: 1.5px solid var(--c-primary, #4f46e5);
}
.btn-line:active { background: rgba(79, 70, 229, .08); }

/* --- 批改頁頭 --- */
.grade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.grade-answer-row { display: flex; gap: 8px; }

/* --- 批改統計條 --- */
.grading-summary {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}
.grading-summary > span {
  flex: 1;
  text-align: center;
  background: #fff;
  border-radius: 14px;
  padding: 12px 6px;
  font-size: 13px;
  color: #64748b;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
}
.grading-summary > span b {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

/* --- 列表項 --- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}
.li-main { flex: 1; min-width: 0; }
.li-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
}
.li-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* --- 批改詳情卡 --- */
.grade-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .07);
}
.grade-student {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}
.grade-sub {
  margin: 4px 0 16px;
  font-size: 12px;
  color: #94a3b8;
}

/* --- 單題批改塊 --- */
.grade-q {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fbfcfe;
}
.grade-q.right { border-color: rgba(34, 211, 122, .55); background: rgba(34, 211, 122, .05); }
.grade-q.wrong { border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .04); }

.gq-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
}
.gq-text {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.6;
  margin-bottom: 10px;
}
.gq-line {
  font-size: 13px;
  color: #64748b;
  line-height: 1.9;
}
.gq-line b { color: #0f172a; font-weight: 700; }

.gq-score-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.gq-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.grade-input {
  width: 74px;
  padding: 8px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: #0f172a;
  background: #fff;
}
.grade-input:focus {
  outline: none;
  border-color: var(--c-primary, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}

/* --- 錯題本 --- */
.wrong-count {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 10px;
  padding-left: 2px;
}
.wrong-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid #ef4444;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}
.q-text-show {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.6;
  margin-bottom: 10px;
}
.rv-ans {
  font-size: 13px;
  color: #64748b;
  line-height: 1.9;
}
.rv-ans b { font-weight: 700; }
.rv-ans.wrong b { color: #b91c1c; }
.rv-ans.right b { color: #15803d; }
.wrong-date {
  margin-top: 8px;
  font-size: 11.5px;
  color: #b6c2d1;
  text-align: right;
}

/* ============================================================
   答題 / 結果 / 檢討 / 出題 / 拍照元件
   ============================================================ */

/* --- 通用卡片 --- */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}

/* --- 徽章 --- */
.badge-blue   { background: rgba(59, 130, 246, .14); color: #1d4ed8; }
.badge-green  { background: rgba(34, 211, 122, .14); color: #15803d; }
.badge-orange { background: rgba(255, 179, 64, .18); color: #b45309; }
.badge-red    { background: rgba(239, 68, 68, .13); color: #b91c1c; }

/* --- 答題頁 --- */
.q-row {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}
.q-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.q-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
}
.q-score-tag {
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  background: rgba(255, 179, 64, .18);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.q-score-line {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 8px;
}
.q-score {
  font-weight: 800;
  color: #0f172a;
}

/* --- 選項 --- */
.opt-line {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt-line:active { background: #f8fafc; }
.opt-line.checked {
  border-color: var(--c-primary, #4f46e5);
  background: rgba(79, 70, 229, .06);
}
.opt-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
  position: relative;
}
.opt-line.checked .opt-check {
  background: var(--c-primary, #4f46e5);
  border-color: var(--c-primary, #4f46e5);
}
.opt-line.checked .opt-check::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.opt-text {
  font-size: 15px;
  color: #1e293b;
  line-height: 1.55;
}
.opt-input {
  flex: 1;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 15px;
  color: #0f172a;
}
.opt-input:focus { outline: none; border-color: var(--c-primary, #4f46e5); }
.opt-edit {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #475569;
}
.opt-edit.on { border-color: #15803d; color: #15803d; background: rgba(34,211,122,.1); }

/* --- 填空題提示 --- */
.q-hint-box {
  background: rgba(255, 179, 64, .1);
  border-left: 3px solid #ffb340;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
}
.q-hint { font-size: 13px; color: #92400e; line-height: 1.7; }

/* --- 參考答案 --- */
.ref-answer {
  background: rgba(34, 211, 122, .07);
  border-left: 3px solid #22d37a;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 13.5px;
  color: #166534;
  line-height: 1.75;
}
.answer-text { font-weight: 700; }

/* --- 拍照上傳 --- */
.photo-box {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  background: #f8fafc;
}
.photo-input { display: none; }
.photo-tip {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.8;
}
.q-photo-preview {
  margin-top: 10px;
  border: 1.5px dashed rgba(148,163,184,.5);
  border-radius: 10px;
  padding: 8px;
  background: #f8fafc;
}
.q-photo-preview img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  margin: 0 auto;
}

/* --- 提交確認 --- */
.confirm-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.confirm-row .btn { flex: 1; }
.pending-big {
  font-size: 44px;
  font-weight: 900;
  color: #0f172a;
  text-align: center;
  line-height: 1.2;
}
.warn-tip {
  margin-top: 12px;
  font-size: 13.5px;
  color: #b45309;
  background: rgba(255, 179, 64, .12);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.7;
}
.comment-box {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
  font-size: 14px;
  color: #334155;
  line-height: 1.75;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}

/* --- 結果頁 --- */
.result-card {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  color: #fff;
  box-shadow: 0 8px 28px rgba(79, 70, 229, .3);
}
.score-big {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}
.result-meta {
  margin-top: 10px;
  font-size: 14px;
  opacity: .88;
}

/* --- 檢討卡 --- */
.review-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid #94a3b8;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}
.review-card.right { border-left-color: #22d37a; }
.review-card.wrong { border-left-color: #ef4444; }
.review-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
}

/* ===== 布置作业：正确答案录入区 ===== */
.ans-editor {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f7f9fc;
  border: 1px dashed #c9d6e8;
  border-radius: 8px;
}
.ans-editor-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4a6fa5;
  margin-bottom: 6px;
}
.ans-answer-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccd6e0;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: #222;
}
.ans-answer-text {
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid #ccd6e0;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}
.ans-editor-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #8a9bb0;
}

/* ===== 学生答题页：题目原图（老师拍照上传的题目） ===== */
.ans-qimg-wrap {
  margin: 10px 0 14px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  text-align: center;
}
.ans-qimg {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 6px;
  margin: 0 auto;
  cursor: zoom-in;
}

/* ===== 作业历史：操作栏 ===== */
.history-bar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.history-bar .btn {
  flex: 1;
  min-width: 130px;
  font-size: 13.5px;
}
.btn-danger-soft {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.btn-danger-soft:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* ===== 作业历史：分组标题 ===== */
.history-group-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  padding: 14px 2px 8px;
  letter-spacing: .02em;
}
.history-group-label.danger {
  color: #b91c1c;
}

/* ===== 作业历史：旧作业卡片 ===== */
.card-item.is-old {
  opacity: .78;
  border-style: dashed;
}
.tag-old {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ===== 作业列表：更多提示 ===== */
.list-more-hint {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  text-align: center;
}

/* ===== 班级码输入行 ===== */
.code-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.code-input-row input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  font-weight: 600;
}
.code-input-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 14px;
}

/* 字段标签旁的小提示 */
.label-tip {
  font-size: 11.5px;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 4px;
}

/* 字段下方说明文字 */
.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.5;
}

/* ===== 密码输入行 ===== */
.pwd-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.pwd-input-row input {
  flex: 1;
  min-width: 0;
}
.pwd-eye {
  flex-shrink: 0;
  width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  opacity: .65;
}
.pwd-eye:hover { opacity: 1; }

/* ===== 班级设置卡片 ===== */
.settings-card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 14px;
  padding: 20px 18px;
  margin-top: 8px;
}
.settings-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line, #eef2f7);
}
.settings-icon {
  font-size: 26px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--indigo-soft, #eef2ff);
  flex-shrink: 0;
}
.settings-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-1, #1e293b);
  margin-bottom: 4px;
}
.settings-sub {
  font-size: 13px;
  color: var(--ink-3, #64748b);
}
.settings-sub.ok { color: #059669; font-weight: 600; }
.settings-sub.warn { color: #d97706; font-weight: 600; }

.settings-note {
  margin-top: 18px;
  padding: 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

/* ============================================================
   學生答題對話框 · 完整樣式（原缺失，本次補齊）
   ============================================================ */

/* --- 題目文字 --- */
.ans-qtext {
  font-size: 17px;
  line-height: 1.75;
  font-weight: 600;
  color: var(--ink);
  padding: 16px 18px;
  background: #fff;
  border-left: 4px solid var(--indigo);
  border-radius: 12px;
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--sh-sm);
}

/* --- 選項卡片 --- */
.ans-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 17px;
  margin-bottom: 11px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
  transition: border-color .16s, background .16s, box-shadow .16s;
  -webkit-user-select: none;
  user-select: none;
}
.ans-opt:hover { border-color: #c7d2fe; background: #fbfcff; }
.ans-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.ans-opt > span {
  flex: 1;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-2);
  word-break: break-word;
}
/* 自訂圓形勾選指示器 */
.ans-opt::before {
  content: '';
  flex: 0 0 auto;
  width: 21px; height: 21px;
  margin-top: 1px;
  border: 2px solid var(--line-2);
  border-radius: 50%;
  background: #fff;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.ans-opt.picked {
  border-color: var(--indigo);
  background: var(--indigo-soft);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.ans-opt.picked::before {
  border-color: var(--indigo);
  background: var(--indigo);
  box-shadow: inset 0 0 0 4px #fff;
}
.ans-opt.picked > span { color: var(--indigo-dark); font-weight: 600; }

/* --- 書寫題 textarea --- */
.ans-textarea {
  width: 100%;
  padding: 15px 16px;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-2);
  border-radius: 13px;
  resize: vertical;
  min-height: 130px;
  transition: border-color .16s, box-shadow .16s;
}
.ans-textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.ans-textarea::placeholder { color: var(--ink-4); }

/* --- 手寫 / 拍照作答區 --- */
.ans-photo-wrap {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--sh-sm);
}
.ans-photo-tip {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 9px;
  margin-bottom: 14px;
}
.ans-photo-preview {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg);
  margin-bottom: 14px;
  cursor: zoom-in;
}
.ans-photo-actions {
  display: flex;
  gap: 11px;
}
.ans-photo-actions .btn-outline {
  flex: 1;
}

/* --- 描邊按鈕（手寫 / 拍照）--- */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--indigo);
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
}
.btn-outline:hover {
  background: var(--indigo-soft);
  border-color: var(--indigo);
}
.btn-outline:active { transform: scale(.97); }

/* ============================================================
   作業列表行（學生端 / 老師端共用）
   ============================================================ */
.asg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  margin-bottom: 11px;
  box-shadow: var(--sh-sm);
  transition: border-color .16s, box-shadow .16s;
}
.asg-row:hover { border-color: #c7d2fe; box-shadow: var(--sh-md); }
.asg-info { flex: 1; min-width: 0; }
.asg-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.asg-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.5;
}
.asg-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

/* ============================================================
   ★ 醒目按鈕 A：作業列表「查看 / 作答」按鈕
   ============================================================ */
.btn-sm.asg-action-btn,
.asg-right .btn-sm {
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border: none;
  border-radius: 11px;
  box-shadow: 0 4px 14px -3px rgba(79,70,229,.55);
  cursor: pointer;
  transition: all .16s;
  letter-spacing: .3px;
}
.asg-right .btn-sm:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  box-shadow: 0 6px 18px -3px rgba(79,70,229,.7);
  transform: translateY(-1px);
}
.asg-right .btn-sm:active { transform: scale(.96); }

/* ============================================================
   ★ 醒目按鈕 B：學生寫作業「手寫 / 拍照」開始按鈕
   ============================================================ */
.ans-photo-actions .btn-outline {
  padding: 16px 20px;
  font-size: 15.5px;
  font-weight: 800;
  border-width: 2px;
  border-color: var(--indigo);
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 5px 16px -3px rgba(79,70,229,.5);
  letter-spacing: .3px;
}
.ans-photo-actions .btn-outline:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  box-shadow: 0 7px 20px -3px rgba(79,70,229,.68);
  transform: translateY(-1px);
}
.ans-photo-actions .btn-outline:active { transform: scale(.96); }

/* 第二個按鈕（拍照上傳）改為次要視覺，避免兩個都太搶 */
.ans-photo-actions #btnAnsPhoto {
  background: #fff;
  color: var(--indigo);
  border-color: #c7d2fe;
  box-shadow: none;
}
.ans-photo-actions #btnAnsPhoto:hover {
  background: var(--indigo-soft);
  border-color: var(--indigo);
  box-shadow: 0 2px 8px -2px rgba(79,70,229,.3);
}

/* ============================================================
   文檔上傳區（老師布置作業 / 學生交作業共用）
   ============================================================ */
.doc-upload-section {
  margin-top: 22px;
  padding: 16px;
  background: #fff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
}
.doc-upload-hint {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.65;
  margin-bottom: 13px;
}
.btn-doc-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--indigo);
  background: var(--indigo-soft);
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  cursor: pointer;
  transition: all .16s;
}
.btn-doc-add:hover {
  background: #e0e7ff;
  border-color: var(--indigo);
}
.btn-doc-add:active { transform: scale(.98); }

.doc-list { display: flex; flex-direction: column; gap: 9px; margin-top: 13px; }
.doc-list:empty { margin-top: 0; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.doc-icon {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .3px;
}
.doc-icon.pdf  { background: #dc2626; }
.doc-icon.doc  { background: #2563eb; }
.doc-icon.xls  { background: #16a34a; }
.doc-icon.ppt  { background: #ea580c; }
.doc-icon.img  { background: #7c3aed; }
.doc-icon.zip  { background: #ca8a04; }
.doc-icon.txt  { background: #64748b; }
.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-size { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.doc-del {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: none;
  background: #fff;
  color: var(--ink-4);
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .15s;
}
.doc-del:hover { color: var(--red); border-color: #fecaca; background: var(--red-soft); }

/* 老師端 / 學生端作業附件下載區 */
.doc-download-list { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.doc-download-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.doc-item a.doc-open {
  flex: 0 0 auto;
  padding: 8px 15px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--indigo);
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: 9px;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.doc-item a.doc-open:hover {
  background: var(--indigo-soft);
  border-color: var(--indigo);
}
