:root {
  --primary: #1e3a5f;
  --primary-2: #2563eb;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
  /* 主 tabs 下方页面顶端与筛选浮岛下方使用同一段灰色间距。 */
  --page-island-gap: 10px;
  /* 在线测评简答题的独立滚动区需避开约 52px 高的底部浮岛，并留出
     约 20px 呼吸空间。键盘抬起产生的额外遮挡在使用处另行叠加。 */
  --exam-dock-clearance: 72px;
  /* 在线测评与批改的题区顶部至少保留 20px 白色画板缓冲区。 */
  --focus-write-buffer-top: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app-loading {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.app-loading-card {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  color: var(--muted); font-size: 15px;
}
.app-loading-spinner {
  width: 20px; height: 20px; border: 2px solid #dbe3ed;
  border-top-color: var(--primary-2); border-radius: 50%;
  animation: app-loading-spin 0.8s linear infinite;
}
@keyframes app-loading-spin { to { transform: rotate(360deg); } }

/* 表单控件默认用浏览器自带字体（datetime-local 等尤其明显），统一继承站点字体 */
input, select, button, textarea { font-family: inherit; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; font-size: 13px; margin: 6px 0; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--primary-2); color: var(--primary-2); }
.btn.primary {
  background: var(--primary-2);
  border-color: var(--primary-2);
  color: #fff;
}
.btn.primary:hover { background: #1d4ed8; }
.btn.block { display: block; width: 100%; margin-top: 10px; }
.btn.link { border: none; background: none; color: var(--primary-2); padding: 4px 8px; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.orange {
  background: #ea580c; border-color: #ea580c; color: #fff;
}
.btn.orange:hover { background: #c2410c; border-color: #c2410c; color: #fff; }

input, select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid rgba(37, 99, 235, 0.3); border-color: var(--primary-2); }

/* ---------- 登录/注册/兑换 ---------- */
#view-auth, #view-redeem {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 45%, #f8fafc 100%);
}
#view-auth.hidden, #view-redeem.hidden { display: none; }
.auth-card {
  width: 380px; padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(30, 58, 138, 0.14);
  border: none;
}
.brand { color: var(--primary); margin: 0 0 4px; font-size: 24px; }
.auth-card > .muted { margin-top: 0; }
.tab-switch { display: flex; gap: 8px; margin: 18px 0 14px; }
.tab-switch .tab {
  flex: 1; padding: 8px; border: none; border-bottom: 2px solid var(--border);
  background: none; font-size: 15px; cursor: pointer; color: var(--muted);
}
.tab-switch .tab.active { color: var(--primary-2); border-bottom-color: var(--primary-2); font-weight: 600; }
#auth-form input, #redeem-form input { width: 100%; margin-bottom: 10px; }
.auth-forgot {
  display: block; margin: 14px auto 0; padding: 3px 8px;
  border: none; background: transparent; color: #94a3b8;
  font-size: 13px; cursor: pointer;
}
.auth-forgot:hover { color: #64748b; }
.account-email-modal-body { width: min(430px, calc(100vw - 28px)); }
.account-email-send-row { display: flex; align-items: center; gap: 8px; }
.account-email-send-row input { min-width: 0; flex: 1 1 auto; }
#forgot-verify-panel { display: grid; gap: 8px; margin-top: 10px; }
#forgot-status, #bind-email-status { margin-top: 10px; font-size: 12px; }
@media (max-width: 520px) {
  .account-email-send-row { align-items: stretch; flex-direction: column; }
}
.auth-beian {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 2;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
}
.auth-beian:hover { color: var(--primary-2); text-decoration: underline; }

/* Auth-only styling: keep redemption and in-app form controls unchanged. */
#view-auth {
  flex-direction: column; gap: 22px; padding: 32px 20px;
  min-height: 100svh;
  background: radial-gradient(ellipse at 15% 15%, #dceaff 0, transparent 55%),
              radial-gradient(ellipse at 90% 80%, #ede9fe 0, transparent 50%), #f6f8fc;
}
#view-auth .auth-card {
  width: min(100%, 470px); padding: 32px;
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 24px;
  box-shadow: 0 20px 64px rgba(30, 58, 95, .10), 0 2px 8px rgba(30, 58, 95, .04);
}
#view-auth .brand { text-align: center; font-size: 28px; letter-spacing: -.5px; margin-bottom: 12px; }
#view-auth .auth-features { text-align: center; font-size: 13px; line-height: 1.9; text-wrap: balance; margin-bottom: 14px; }
.auth-beta { display: flex; align-items: center; justify-content: center; gap: 7px; color: #2563a5; font-size: 12px; margin: 0 0 20px; }
.auth-beta > span { width: 6px; height: 6px; border-radius: 50%; background: #398d78; }
#view-auth .tab-switch { padding: 4px; gap: 4px; background: #f1f5f9; border-radius: 12px; margin: 0 0 22px; }
#view-auth .tab-switch .tab { min-height: 40px; border: 0; border-radius: 9px; }
#view-auth .tab-switch .tab.active { background: #fff; box-shadow: 0 2px 5px rgba(30, 58, 95, .08); }
#auth-form > input { min-height: 46px; border-radius: 10px; padding: 12px 14px; background: #fcfdff; }
#auth-form > input::placeholder { color: #8490a1; font-size: 13px; }
#auth-submit { min-height: 46px; border-radius: 10px; font-size: 15px; font-weight: 600; margin-top: 6px; }
#auth-submit:disabled { opacity: .65; cursor: wait; }
.auth-roles { display: flex; gap: 10px; border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.auth-roles legend { padding: 0 0 9px; color: #64748b; font-size: 12px; }
.auth-role { position: relative; flex: 1; min-width: 0; cursor: pointer; }
#auth-form .auth-role input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.auth-role > span { display: flex; flex-direction: column; gap: 6px; padding: 13px 12px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.auth-role strong { font-size: 14px; font-weight: 600; }
.auth-role small { color: #64748b; font-size: 11px; }
.auth-role input:checked + span { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #2563eb; }
.auth-role input:focus-visible + span { outline: 3px solid #93c5fd; outline-offset: 3px; }
.auth-testflight { display: block; margin: 24px 0 12px; text-align: center; font-size: 12px; font-weight: 600; line-height: 1.7; color: #2563eb; text-decoration: none; }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .auth-testflight { background: linear-gradient(100deg, #c43841, #9c6009, #247543, #187a87, #275fcb, #7547ba, #b53b80); background-clip: text; -webkit-background-clip: text; color: transparent; }
}
.auth-testflight:hover { text-decoration: underline; text-decoration-color: #7386be; text-underline-offset: 4px; }
#view-auth .btn.link { text-align: center; color: #718096; font-size: 12px; }
#view-auth .auth-beian { position: static; flex: 0 0 auto; text-align: center; }
@media (max-width: 520px) {
  #view-auth { padding: 24px 16px; gap: 18px; }
  #view-auth .auth-card { padding: 28px 22px; border-radius: 20px; }
  #view-auth .brand { font-size: 25px; }
}
@media (forced-colors: active) {
  .auth-testflight { background: none; color: LinkText; }
  .auth-role input:checked + span { outline: 2px solid Highlight; }
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); color: var(--text);
  padding: 0 20px; height: 56px;
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 17px; font-weight: 600; cursor: pointer; }
.logo-cjk { font-size: 16px; font-weight: 400; }
.brand-line { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.web-version {
  color: var(--muted); font-size: 10px; font-weight: 500;
  letter-spacing: .02em;
}
.web-version.stale { color: #b45309; }
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-left { min-width: 0; flex: 1 1 auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar-right .muted { color: var(--muted); }
#btn-profile { position: relative; }
#btn-profile.has-pending-invite::after {
  content: ""; position: absolute; top: -4px; right: -4px;
  width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 0 1px rgba(220, 38, 38, .08);
}
.topbar-right .btn {
  background: transparent; padding: 6px 12px; font-size: 12px;
}
.main-tabs {
  display: flex; gap: 4px; min-width: 0; overflow-x: auto;
  overscroll-behavior-x: contain; scrollbar-width: none;
}
.main-tabs::-webkit-scrollbar { display: none; }
.main-tab {
  border: none; background: none; color: var(--muted);
  padding: 8px 14px; cursor: pointer; font-size: 14px; border-radius: 6px;
  flex: 0 0 auto; white-space: nowrap;
}
.main-tab:hover { background: #f8fafc; color: var(--primary); }
.main-tab.active { background: #eef2f7; color: var(--primary); font-weight: 600; }
#tab-exam .resume-test-title {
  display: block; max-width: 12ch; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.teacher-tab-with-badge { position: relative; padding-right: 24px; }
.teacher-tab-with-badge .badge-num {
  position: absolute; top: 3px; right: 3px; margin: 0;
}

/* 空间不足时先隐藏次要的反馈入口，始终优先保留最右侧账号。 */
.topbar.feedback-overflow #btn-feedback { display: none; }
.topbar.brand-overflow .brand-line { display: none; }
@media (max-width: 1500px) {
  .topbar-left { gap: 14px; }
  .main-tab { padding-left: 10px; padding-right: 10px; }
}

/* 只有 JS 实测完整单行无法容纳时才进入两行；屏幕宽度本身不再是依据。
   第一行保留品牌和账号操作，第二行标签可横滑。 */
.topbar.two-row {
  display: grid; grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px; height: auto; min-height: 56px; padding: 7px 10px;
}
.topbar.two-row .topbar-left { display: contents; }
.topbar.two-row .brand-line {
  grid-row: 1; grid-column: 1; align-self: center; min-width: 0;
}
.topbar.two-row .topbar-right {
  grid-row: 1; grid-column: 2; min-width: 0;
  justify-content: flex-end; gap: 6px; overflow-x: auto;
  overscroll-behavior-x: contain; scrollbar-width: none;
}
.topbar.two-row .topbar-right::-webkit-scrollbar,
.topbar.two-row .main-tabs::-webkit-scrollbar { display: none; }
.topbar.two-row .topbar-right .btn:not(.btn-bell) {
  flex: 0 0 auto; white-space: nowrap; padding: 5px 9px;
}
.topbar.two-row .main-tabs {
  grid-row: 2; grid-column: 1 / -1; min-width: 0; width: 100%;
  gap: 3px; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; scroll-snap-type: x proximity;
}
.topbar.two-row .main-tab {
  flex: 0 0 auto; white-space: nowrap; padding: 7px 12px;
  scroll-snap-align: start;
}

/* ---------- 题库布局 ---------- */
.page { padding: var(--page-island-gap) 20px 16px; }
#page-bank {
  min-height: calc(100vh - 56px); height: auto; overflow: visible;
}
.bank-layout {
  display: flex; gap: 0; align-items: flex-start; height: auto; min-height: 0;
  position: relative;
}
.bank-main {
  flex: 1; min-width: 0; height: auto; overflow: visible;
  overscroll-behavior: auto; scrollbar-gutter: auto;
}

.bank-main, .table-card, #paper-list {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e5e7eb;
}
.bank-main::-webkit-scrollbar,
.table-card::-webkit-scrollbar,
#paper-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.bank-main::-webkit-scrollbar-track,
.table-card::-webkit-scrollbar-track,
#paper-list::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}
.bank-main::-webkit-scrollbar-thumb,
.table-card::-webkit-scrollbar-thumb,
#paper-list::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border: 2px solid #e5e7eb;
  border-radius: 999px;
}
.bank-main::-webkit-scrollbar-thumb:hover,
.table-card::-webkit-scrollbar-thumb:hover,
#paper-list::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.splitter {
  width: 7px; flex-shrink: 0; align-self: stretch;
  cursor: col-resize; position: relative;
}
.splitter::after {
  content: ''; position: absolute; left: 3px; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.splitter:hover::after, .splitter.dragging::after {
  width: 3px; left: 2px; background: var(--primary-2);
}
body.col-resizing { cursor: col-resize; user-select: none; }

.filter-bar {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  margin-bottom: var(--page-island-gap); padding: 12px 16px;
}
.filter-bar input[type="search"] { flex: 1 1 auto; min-width: 5em; }
.filter-bar > #f-paper-top { min-width: 0; }
.teacher-question-class-filter { flex: 0 0 auto; }
.teacher-question-class-filter > .msel-btn {
  height: 40px; min-width: 96px; max-width: 190px; padding: 7px 28px 7px 12px;
  position: relative;
}
.teacher-question-class-filter > .msel-btn::after {
  position: absolute; right: 10px;
}
.teacher-question-class-filter .msel-panel {
  min-width: 230px; max-width: min(320px, calc(100vw - 24px));
}
.teacher-class-filter-modes {
  display: grid; gap: 7px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.teacher-class-filter-list {
  display: grid; gap: 7px; padding-top: 2px;
}
.teacher-class-filter-empty { padding: 4px 0; font-size: 12px; }

/* 0.10.11：顶部三个筛选下拉（大纲/考试局/学科）去掉原生外观，
   macOS 上不再显示系统灰底双箭头，与 Windows 端渲染保持一致。 */
.filter-bar > select {
  flex: 0 0 auto; min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}
.filter-bar > select:disabled {
  background-color: #f3f4f6; color: #9ca3af; cursor: not-allowed;
}

/* 列设置菜单 */
.col-menu { position: relative; }
.col-menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(30, 58, 95, 0.18);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 6px;
  min-width: 130px;
}
.col-menu-panel label {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}

/* 多选勾选筛选下拉（章节/年份/场次/Paper） */
.msel { position: relative; }
.msel-btn {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; font-size: 13px; color: var(--text); cursor: pointer;
  max-width: 170px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.msel-btn::after { content: ' ▾'; color: var(--muted); }
.msel-btn.active {
  border-color: var(--primary); color: var(--primary);
  background: #eff6ff; font-weight: 600;
}
.msel-btn:disabled, .msel.disabled .msel-btn {
  cursor: not-allowed; color: #9ca3af; background: #f3f4f6;
  border-color: #e5e7eb;
}
.msel-panel {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(30, 58, 95, 0.18);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 6px;
  min-width: 150px; max-height: 320px; overflow-y: auto;
}
.msel-panel label {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.msel-clear-selection {
  align-self: flex-start; padding: 3px 0; border: 0; background: none;
  color: var(--primary-2); font: inherit; font-size: 12px; cursor: pointer;
}
.msel-clear-selection:hover { color: var(--primary); text-decoration: underline; }
.msel-panel label.msel-draggable {
  cursor: grab; padding: 2px 4px; border-radius: 4px;
}
.msel-panel label.msel-draggable:hover { background: #f0f5fb; }
.msel-panel label.msel-draggable.dragging { opacity: 0.4; }

/* 多选筛选器由表头按钮唤起；存储容器本身不占顶部工具栏空间。 */
#header-filter-store { height: 0; position: relative; z-index: 70; }
#header-filter-store > .msel { position: static; }
#header-filter-store > .msel > .msel-btn { display: none; }
#header-filter-store .msel-panel { z-index: 80; min-width: 220px; }

/* topic 下拉顶部的模式单选（包含/仅包含/仅包含选定以及之前） */
.msel-modes {
  display: flex; gap: 8px; padding-bottom: 8px; margin-bottom: 2px;
  border-bottom: 1px solid var(--border); flex-wrap: nowrap;
}
.msel-modes label {
  font-size: 12px; color: var(--muted); white-space: nowrap;
}

/* 0.10.11：章节/topics 的排序与改名改为「暂存 + 确认修改」提交，
   避免旧版依赖 item drop 事件在空白处落下时静默不保存。 */
.msel-confirm-bar {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px; margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.msel-confirm-bar .muted { font-size: 12px; }
/* 0.10.12：章节/topics 下拉底部的常驻操作条（升序/降序/保存修改） */
.msel-bottom-bar {
  display: flex; align-items: center; gap: 6px;
  padding-top: 8px; margin-top: 2px;
  border-top: 1px solid var(--border);
}
.msel-bottom-bar .btn.primary { margin-left: auto; }
.msel-renamable { cursor: text; border-bottom: 1px dashed transparent; }
.msel-renamable:hover { border-bottom-color: var(--muted); }
.msel-rename-input {
  width: 140px; padding: 2px 6px; font-size: 13px;
  border: 1px solid var(--primary-2); border-radius: 4px;
}

/* 搜索框 + 搜索按钮绑定为一组；其他筛选变宽时优先压缩搜索输入。 */
.search-group {
  display: flex; gap: 6px; flex: 1 1 380px;
  min-width: calc(5em + 62px);
}
.search-group input { flex: 1 1 auto; min-width: 5em; }
.search-scope-bar {
  display: flex; align-items: stretch; overflow-x: auto;
  margin-bottom: 10px; padding: 0; border-radius: 10px 10px 0 0;
  border-bottom: 1px solid var(--border); background: #f8fafc;
}
.search-scope-bar button {
  appearance: none; flex: 0 0 auto; padding: 10px 14px;
  border: 0; border-bottom: 3px solid transparent; background: transparent;
  color: #475569; font: inherit; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.search-scope-bar button:hover { background: #eef4fb; color: var(--primary); }
.search-scope-bar button.active {
  border-bottom-color: var(--primary); background: #fff; color: var(--primary);
}
.search-scope-bar button span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; margin-left: 4px; padding: 0 5px;
  border-radius: 10px; background: #e2e8f0; color: #475569;
  font-size: 11px; line-height: 1;
}
.search-scope-bar button.active span { background: #dbeafe; color: #1d4ed8; }

/* 反馈：管理员未读角标 + 反馈列表 */
.badge-num {
  display: inline-block; min-width: 17px; height: 17px; line-height: 17px;
  margin-left: 5px; padding: 0 4px; border-radius: 9px;
  background: #dc2626; color: #fff; font-size: 11px; font-weight: 700;
  text-align: center; vertical-align: 1px;
}
.feedback-list { list-style: none; margin: 0; padding: 0; }
.feedback-item {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; background: #fff;
}
.feedback-item.unread { border-color: #f59e0b; background: #fffbeb; }
.feedback-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.feedback-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.feedback-item .btn { margin-top: 6px; }
.badge-new {
  background: #dc2626; color: #fff; font-size: 11px; border-radius: 4px;
  padding: 1px 5px; margin-left: 4px;
}
#feedback-content {
  width: 100%; box-sizing: border-box; resize: vertical;
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  font-size: 13px; font-family: inherit;
}

/* 题库管理工具行 */
.manage-toolbar {
  display: flex; gap: 8px; padding: 10px 14px;
  margin-bottom: var(--page-island-gap);
  align-items: center; flex-wrap: wrap;
}
.answer-audit-filter {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; color: var(--muted); font-size: 13px;
  white-space: nowrap; cursor: pointer;
}
.answer-audit-filter input { margin: 0; }

/* 表头拖拽换列序 */
#q-table th.dragging { opacity: 0.4; }
#q-table th.drag-over { box-shadow: inset 3px 0 0 var(--primary-2); }

/* 题目详情弹窗 */
.view-image-wrap {
  margin-bottom: 12px; text-align: center;
  background: #f8fafc; border-radius: 8px; padding: 8px;
}
.view-image-wrap img {
  display: block; margin: 0 auto;
  max-width: 100%; max-height: 45vh; cursor: zoom-in;
}
.view-grid .view-value {
  display: block; padding: 6px 0; font-size: 13px; color: var(--text);
}

.table-card { padding: 0; overflow: visible; }
#q-table { border-collapse: collapse; table-layout: fixed; }
#q-table th, #q-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);   /* 列间竖线 */
  text-align: left; white-space: nowrap; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis;
}
#q-table td.col-metadata-editable { cursor: pointer; }
#q-table td.col-metadata-editable:hover { background: #eff6ff; }
#q-table .topic-cell,
#q-table .topic-cell-full,
#q-table .topic-cell-compact {
  display: block; min-width: 0; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
#q-table .topic-cell-compact { display: none; }
#q-table .topic-cell.compact .topic-cell-full { display: none; }
#q-table .topic-cell.compact .topic-cell-compact { display: block; }
#q-table th:last-child, #q-table td:last-child { border-right: none; }
#q-table thead th {
  background: #eef2f8; font-weight: 600; user-select: none;
  border-bottom: 2px solid #d5dce8; position: relative; overflow: visible;
}
#q-table th.sortable { cursor: pointer; }
#q-table th.sortable.filterable { cursor: default; }
#q-table th.sortable:hover { color: var(--primary-2); }
#q-table th.compact-col, #q-table td[data-col="year"],
#q-table td[data-col="session"], #q-table td[data-col="paper"],
#q-table td[data-col="q_number"], #q-table td[data-col="answer"] {
  padding-left: 5px; padding-right: 5px; text-align: center;
}
#q-table th.compact-col { text-align: left; padding-left: 3px; padding-right: 3px; }
#q-table th.compact-col .header-label,
#q-table th.compact-col .header-filter-btn {
  max-width: calc(100% - 26px); font-size: 12px;
}
#q-table .header-label, #q-table .header-filter-btn {
  display: inline-block; max-width: calc(100% - 24px); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
#q-table .header-filter-btn {
  border: 0; padding: 0; background: transparent; color: inherit;
  font: inherit; cursor: default; text-align: left;
}
#q-table .header-filter-btn.active { color: var(--primary-2); }
#q-table .header-filter-btn:disabled { color: #9ca3af; cursor: not-allowed; }
#q-table th[data-col="remark"] .header-label {
  display: inline-flex; align-items: baseline; gap: 4px;
  max-width: 100%; overflow: visible; line-height: 1.15;
}
#q-table .header-label em {
  color: #64748b; font-size: 10px; font-weight: 400;
  white-space: nowrap; flex: 0 0 auto;
}
#q-table .sort-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 24px; height: 28px;
  border: 0; border-radius: 4px; padding: 0; background: transparent; color: #94a3b8;
  cursor: pointer; font-size: 10px; line-height: 1;
}
#q-table .sort-toggle:hover, #q-table .sort-toggle.active {
  color: var(--primary-2); background: #e2eaff;
}
/* 答案列表头显隐开关：隐藏时半透明 */
#q-table .answer-eye {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; padding: 0 1px; line-height: 1; vertical-align: middle;
}
#q-table .answer-eye.off { opacity: 0.35; }
#q-table .answer-masked { color: var(--muted); font-weight: 400; }
#q-table tbody tr:hover { background: #f8fafc; }
#q-table tbody tr.selected { background: #eaf1fd; }
#q-table .col-check { text-align: center; padding-left: 4px; padding-right: 4px; }
#q-table .col-feedback { text-align: center; padding-left: 2px; padding-right: 2px; }
#q-table .col-check input[type="checkbox"],
.detail-footer-select input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  display: inline-grid; place-content: center;
  width: 15.6px; height: 15.6px; margin: 0; padding: 0;
  border: 1.44px solid #000; border-radius: 3px;
  background: #fff; cursor: pointer; vertical-align: middle;
  transition: background-color .12s, border-color .12s, transform .12s;
}
#q-table .col-check input[type="checkbox"]::before,
.detail-footer-select input[type="checkbox"]::before {
  content: ""; width: 10px; height: 8px; background: #fff;
  clip-path: polygon(5% 50%, 20% 34%, 42% 64%, 82% 5%, 98% 18%, 44% 96%);
  transform: scale(0); transform-origin: center;
}
#q-table .col-check input[type="checkbox"]:hover,
.detail-footer-select input[type="checkbox"]:hover { background: #f1f5f9; }
#q-table .col-check input[type="checkbox"]:focus-visible,
.detail-footer-select input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.3); outline-offset: 2px;
}
#q-table .col-check input[type="checkbox"]:checked,
#q-table .col-check input[type="checkbox"]:indeterminate,
.detail-footer-select input[type="checkbox"]:checked,
.detail-footer-select input[type="checkbox"]:indeterminate {
  border-color: var(--primary-2); background: var(--primary-2);
}
#q-table .col-check input[type="checkbox"]:checked::before,
.detail-footer-select input[type="checkbox"]:checked::before { transform: scale(1); }
#q-table .col-check input[type="checkbox"]:indeterminate::before {
  width: 9px; height: 2px; clip-path: none; transform: scale(1);
}
#q-table .col-check input[type="checkbox"]:checked:hover,
#q-table .col-check input[type="checkbox"]:indeterminate:hover,
.detail-footer-select input[type="checkbox"]:checked:hover,
.detail-footer-select input[type="checkbox"]:indeterminate:hover {
  border-color: #1d4ed8; background: #1d4ed8;
}
#q-table .col-favorite { text-align: left; padding: 8px 10px; }
#q-table th.col-favorite { padding-left: 4px; padding-right: 4px; }
#q-table th.col-favorite #q-favorite-all {
  position: relative; vertical-align: middle; margin-right: 0;
}
#q-table th.col-favorite .header-filter-btn { vertical-align: middle; font-size: 12px; max-width: calc(100% - 58px); }
#q-check-all { cursor: pointer; }
.favorite-star {
  position: relative; display: inline-grid; place-items: center;
  width: 30px; height: 30px; overflow: visible;
  border: 0; border-radius: 7px; background: transparent;
  color: #000; cursor: pointer; font-size: 0; line-height: 1; padding: 4px;
  transition: color .15s, background-color .15s, transform .15s;
}
body[data-active-page="bank"] .favorite-star.has-favorite-count::after,
body[data-active-page="favorites"] .favorite-star.has-favorite-count::after {
  content: attr(data-favorite-count); position: absolute; top: -4px; right: -6px;
  min-width: 14px; height: 14px; padding: 0 3px; box-sizing: border-box;
  border-radius: 999px; background: #fff7ed; color: #c2410c;
  box-shadow: 0 0 0 1px #fed7aa; font-size: 9px; font-weight: 800;
  line-height: 14px; text-align: center; white-space: nowrap;
}
.favorite-star::before {
  content: ""; display: block; width: 22px; height: 22px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.44' stroke-linejoin='round' d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 1.88-1.96 1.271L12 18.354l-4.373 2.671c-.996.608-2.231-.135-1.96-1.271l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.44' stroke-linejoin='round' d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 1.88-1.96 1.271L12 18.354l-4.373 2.671c-.996.608-2.231-.135-1.96-1.271l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.favorite-star:hover {
  color: #000; background: #f1f5f9; transform: scale(1.06);
}
.favorite-star.active { color: #f2b51d; }
.favorite-star.active::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 1.88-1.96 1.271L12 18.354l-4.373 2.671c-.996.608-2.231-.135-1.96-1.271l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 1.88-1.96 1.271L12 18.354l-4.373 2.671c-.996.608-2.231-.135-1.96-1.271l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.favorite-star.active:hover { color: #d99a00; background: #fff8df; }
.favorite-star:disabled { opacity: 0.38; cursor: default; transform: none; }
#q-table td[data-col="chapter"] { background: #f2f7ff; }
#q-table td[data-col="topic"] { background: #f7f3ff; }
#q-table td[data-col="note"] { background: #f2fbf7; }
.col-remark { cursor: text; background: #fffbea; }
.col-remark:hover { background: #fff4bf !important; }
.search-highlight {
  background: #fde047; color: inherit; padding: 0 1px;
  border-radius: 2px;
}
.cell-wrap {
  display: -webkit-box; white-space: normal; overflow: hidden;
  line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
}
.col-resizer {
  position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; z-index: 3;
  cursor: col-resize;
}
.col-resizer:hover, .col-resizer.dragging {
  background: rgba(37, 99, 235, 0.35);
}
.thumb {
  width: 120px; height: auto; max-height: 76px; object-fit: contain;
  border: 1px solid var(--border); border-radius: 4px; cursor: zoom-in;
  background: #fff;
}
#q-table td[data-col="image"] .thumb {
  display: block; width: 100%; height: auto; max-height: none; box-sizing: border-box;
}

/* ---------- 题目收藏 / 错题练习 ---------- */
#page-favorites { height: calc(100vh - 56px); overflow: hidden; }
.favorites-layout {
  display: grid; grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 12px; height: 100%; padding: 0;
}
.favorites-sidebar {
  min-height: 0; height: 100%; position: relative; overflow: hidden;
  --collection-deck-peek: 42px;
}
.collection-card {
  min-height: 0; display: flex; flex-direction: column; padding: 14px;
}
.collection-deck-card {
  position: absolute; inset: 0 var(--collection-deck-peek) 0 0;
  min-width: 0; width: auto; height: 100%; overflow: hidden;
  transform: translateX(0); transform-origin: center;
  will-change: transform; isolation: isolate;
}
.collection-deck-card.is-front {
  z-index: 2; transform: translateX(var(--collection-deck-peek));
  box-shadow: -12px 0 18px -12px rgba(15, 23, 42, .38);
}
.collection-deck-card.is-back {
  z-index: 1; transform: translateX(0);
  background: #eef2f7; filter: none;
  box-shadow: var(--shadow);
}
.collection-deck-card.is-back::after,
.collection-deck-card.is-returning::after {
  content: ""; position: absolute; inset: 0; z-index: 3;
  border-radius: inherit; background: rgba(15, 23, 42, .09);
  pointer-events: none;
}
.collection-deck-card.is-back.is-revealed {
  background: var(--card); filter: none; box-shadow: none;
}
.collection-deck-card.is-back.is-revealed::after { opacity: 0; }
.collection-card-deck.deck-revealing .collection-deck-card.is-front {
  transform: translateX(calc(100% + var(--collection-deck-peek)));
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.collection-deck-card.is-returning {
  z-index: 1; transform: translateX(calc(100% + var(--collection-deck-peek)));
  background: #eef2f7; filter: none;
}
.collection-deck-card.is-arriving {
  z-index: 2; transform: translateX(0);
  box-shadow: -12px 0 18px -12px rgba(15, 23, 42, .38);
}
.collection-card-deck.deck-returning .collection-deck-card.is-returning {
  transform: translateX(0);
  transition: transform .38s cubic-bezier(.2, .75, .25, 1);
}
.collection-card-deck.deck-returning .collection-deck-card.is-arriving {
  transform: translateX(var(--collection-deck-peek));
  transition: transform .24s cubic-bezier(.2, .75, .25, 1);
}
.collection-deck-switch {
  position: absolute; z-index: 4; left: 0; top: 12px; bottom: 12px;
  width: var(--collection-deck-peek); padding: 10px 8px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius) 0 0 var(--radius);
  background: transparent; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.collection-deck-switch:focus-visible {
  outline: 2px solid var(--primary-2); outline-offset: -4px;
}
.collection-card-deck.deck-switching .collection-deck-switch {
  pointer-events: none; opacity: .45;
}
@media (prefers-reduced-motion: reduce) {
  .collection-deck-card,
  .collection-deck-switch { transition: none !important; }
}
.favorite-card-head {
  min-height: 32px; display: flex; align-items: flex-start; gap: 6px;
}
.favorite-card-head .tests-col-title { margin-right: auto; }
.favorite-bulk-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  margin: -3px -3px 0 0;
}
.favorite-bulk-actions .btn { padding: 5px 7px; white-space: nowrap; }
.favorite-bulk-actions #favorite-save-selected,
.favorite-bulk-actions #mistake-save-selected {
  padding-inline: 9px; color: #173b6c; background: transparent;
}
.favorite-filter-row {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  align-items: center; gap: 6px; margin-bottom: 10px;
}
.favorite-filter-row > select { min-width: 0; width: 100%; }
.favorite-control-icon {
  width: 34px; height: 34px; padding: 5px; border: 0;
  border-radius: 0; background: transparent; color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.favorite-control-icon:hover { color: #0f172a; background: transparent; }
.favorite-control-icon:focus,
.favorite-control-icon:focus-visible { outline: 0; box-shadow: none; }
.favorite-control-icon.active,
.favorite-control-icon[aria-pressed="true"] {
  color: var(--primary-2); background: transparent;
}
.favorite-control-icon svg {
  width: 23px; height: 23px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.favorite-extra-filters {
  position: absolute; z-index: 8; top: calc(100% + 5px); right: 0;
  width: 100%; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}
.favorite-extra-filters label {
  display: grid; grid-template-columns: 42px minmax(0, 1fr);
  align-items: center; gap: 6px; margin-bottom: 8px;
  color: var(--muted); font-size: 12px;
}
.favorite-extra-filters select { min-width: 0; width: 100%; }
.favorite-extra-filters .btn { width: 100%; }
.favorite-chapter-filter {
  display: block; margin-bottom: 8px;
  color: var(--muted); font-size: 12px;
}
.favorite-chapter-filter > span { display: block; margin-bottom: 5px; }
.favorite-chapter-filter-body { min-width: 0; }
.favorite-chapter-filter .msel-modes {
  gap: 6px; padding-bottom: 7px; margin-bottom: 5px;
  flex-wrap: nowrap; overflow: visible;
}
.favorite-chapter-filter .msel-modes label {
  display: inline-flex; grid-template-columns: none; flex: 0 0 auto;
  align-items: center; gap: 4px; margin-bottom: 0;
}
.favorite-chapter-options {
  display: flex; flex-direction: column; gap: 5px;
  max-height: 145px; overflow-y: auto; padding: 2px 1px 3px;
}
.favorite-chapter-options label {
  display: flex; align-items: center; gap: 4px; color: var(--text);
  white-space: nowrap; cursor: pointer;
}
.collection-list {
  min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 0;
}
.collection-item {
  display: grid; grid-template-columns: 24px 76px minmax(0, 1fr) auto;
  align-items: center; gap: 8px; padding: 8px 4px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.collection-item.favorite-item {
  grid-template-columns: 0 76px minmax(0, 1fr) auto; column-gap: 0;
  transition: grid-template-columns .22s ease, column-gap .22s ease,
              background-color .15s ease;
}
.favorite-bulk-check {
  width: 22px; overflow: hidden; opacity: 0; transform: translateX(-26px);
  transition: transform .22s ease, opacity .16s ease;
}
.favorite-bulk-check input { display: block; width: 18px; height: 18px; margin: 0; }
#favorite-collection-card.bulk-selecting .favorite-item,
#mistake-collection-card.bulk-selecting .mistake-item {
  grid-template-columns: 30px 76px minmax(0, 1fr) auto; column-gap: 0;
}
#favorite-collection-card.bulk-selecting .favorite-bulk-check,
#mistake-collection-card.bulk-selecting .favorite-bulk-check {
  opacity: 1; transform: translateX(0);
}
.collection-item:hover, .collection-item.active { background: #eff6ff; }
.collection-item img {
  display: block; width: 76px; height: 52px; object-fit: contain;
  border: 1px solid var(--border); border-radius: 5px; background: #fff;
}
.collection-item-meta { min-width: 0; }
.favorite-item .collection-item-meta { margin-left: 1em; }
.collection-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-item-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.collection-item-source {
  margin-top: 4px; color: #475569; font-size: 12px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wrong-count {
  display: inline-block; margin-top: 4px; border-radius: 999px; padding: 2px 7px;
  color: #b91c1c; background: #fee2e2; font-size: 12px; font-weight: 700;
}
.collection-item .favorite-star {
  z-index: 1; width: 28px; height: 28px; margin-right: 9px;
}
.collection-item .favorite-star::before { width: 20px; height: 20px; }
.favorite-practice-card {
  min-width: 0; height: 100%; overflow: hidden; padding: 7px 16px 12px;
  display: flex; flex-direction: column;
}
.practice-star { flex: 0 0 auto; }
.practice-placeholder { padding: 80px 20px; text-align: center; }
#practice-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
#practice-body.mcq-practice {
  display: flex; flex-direction: column; overflow: hidden;
}
.practice-topline {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex: 0 0 auto;
  padding: 0 0 5px; border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
}
.practice-meta {
  min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; line-height: 1.4;
}
.practice-page-nav {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; flex: 0 0 auto;
}
.practice-page-nav #practice-pos { min-width: 92px; text-align: center; }
.view-zoom-controls { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.view-zoom-controls .btn {
  width: 27px; height: 27px; min-width: 27px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1;
}
.practice-question-scroll { min-height: 0; padding-top: 30px; }
/* 简答题练习不显示上方整题预览区（0.6.22），作答区内的 part 图保留 */
.saq-practice #practice-images { display: none; }
.mcq-practice .practice-question-scroll {
  flex: 1 1 auto; display: flex; flex-direction: column;
  overflow: auto; padding: 30px 0 5px;
}
.mcq-practice .practice-images {
  flex: 1 1 auto; min-height: 0; display: flex;
  align-items: flex-start; justify-content: flex-start;
}
.practice-images img {
  display: block; max-width: min(100%, 1040px); height: auto; margin: 0 auto 10px;
  border: 0; border-radius: 0; background: transparent;
}
.mcq-practice .practice-images img {
  /* margin auto 居中：图片比容器高时上边仍可滚动到达
     （flex 居中对齐会让溢出顶部的部分永远滚不到） */
  width: auto; max-width: min(100%, 1040px); max-height: 100%;
  object-fit: contain; margin: auto;
}
.practice-answer-dock { background: #fff; }
.mcq-practice .practice-answer-dock {
  position: sticky; bottom: 0; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 0 0; border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06); z-index: 4;
  overflow-x: auto;
}
.mcq-practice #practice-answer-area { min-width: 0; }
.mcq-practice .practice-choice-part,
.mcq-practice .practice-options,
.mcq-practice .practice-actions { margin: 0; }
.mcq-practice .practice-options { flex-wrap: nowrap; gap: 8px; }
.practice-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 16px 0; }
.practice-choice-part {
  margin: 12px 0; padding: 0; background: transparent;
}
.practice-choice-part .practice-options { margin: 4px 0; }
.practice-option { min-width: 54px; min-height: 42px; font-size: 17px; font-weight: 700; }
.practice-option.selected { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.practice-text-answer { width: 100%; min-height: 150px; resize: vertical; font: inherit; padding: 10px; }
.practice-part { margin-top: 14px; }
.practice-part img { display: block; max-width: 100%; margin-bottom: 8px; }
.practice-actions { display: flex; justify-content: center; margin: 10px 0 0; }
.practice-result { margin-top: 12px; }
.practice-result:empty { display: none; }
.practice-result.correct, .practice-result.wrong, .practice-result.reference {
  padding: 12px; border-radius: 8px;
}
.practice-result.correct { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.practice-result.wrong { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.practice-result.reference { background: #f8fafc; border: 1px solid var(--border); color: var(--text); }
.practice-answer-images img { display: block; max-width: 100%; margin: 10px 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.pagination {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; justify-content: flex-start;
}

/* 难度徽章 */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.easy { background: #dcfce7; color: #15803d; }
.badge.medium { background: #ffedd5; color: #c2410c; }
.badge.difficult { background: #fee2e2; color: #b91c1c; }
.badge.special { background: #f3e8ff; color: #7e22ce; }
.difficulty-values {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.performance-badge {
  display: inline-block; padding: 2px 8px; border: 1px solid
    hsl(var(--performance-hue) 58% 48%); border-radius: 999px;
  background: hsl(var(--performance-hue) 78% 92%);
  color: hsl(var(--performance-hue) 62% 27%);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}

/* ---------- 我的试卷浮岛 ---------- */
#compose-panel {
  width: min(400px, calc(100% - 24px));
  position: fixed; z-index: 30; right: 12px; bottom: 12px;
  user-select: none; -webkit-user-select: none;
}
#compose-panel.paper-dragging { z-index: 31; user-select: none; }
#compose-panel.paper-docked {
  width: min(280px, calc(100% - 24px));
  left: auto !important; top: auto !important;
  right: 12px !important; bottom: 12px !important;
}
#paper-panel {
  width: 100%; height: auto; max-height: calc(100vh - 88px);
  display: flex; flex-direction: column;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .12);
  padding: 20px 20px 12px;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; }
#paper-panel > .panel-header {
  margin: -20px -20px 0; padding: 10px 20px 2px;
  align-items: center; cursor: default; flex-shrink: 0;
}
#compose-panel.paper-docked #paper-panel > .panel-header { margin: 0; padding: 0; cursor: default; }
#compose-panel.paper-docked #panel-body { display: none; }
#compose-panel.paper-docked #paper-panel { max-height: none; padding: 12px 16px; }
.panel-header h2 { margin: 0; font-size: 16px; }
.paper-header-main {
  min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1;
}
.paper-panel-title { padding: 0; height: 36px; border: 0; background: transparent; color: var(--text); font-size: 16px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.paper-panel-title:hover { color: var(--primary-2); }
#paper-target-toggle { display: flex; flex: 1 1 140px; align-items: center; justify-content: center; gap: 8px; min-width: 0; max-width: 100%; }
#compose-panel.paper-docked #paper-target-toggle { display: none; }
#paper-target-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#paper-target-toggle svg { width: 18px; height: 1em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#paper-target-toggle, .btn.paper-randomise { height: 36px; padding: 7px 10px; font-size: 13px; }
.btn.paper-randomise { flex: 0 0 auto; white-space: nowrap; }
#paper-count { margin-top: 8px; font-size: 13px; }
#paper-count:empty { display: none; }
.paper-count-row { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.assigned-test-notice { color: var(--primary-2); font-size: 12px; }
#paper-assigned-notice { margin-top: 8px; }
#tests-assigned-notice { margin: 4px 0 10px; }
#paper-target-picker { position: absolute; bottom: calc(100% + 8px); left: 0; width: 100%; max-height: var(--paper-picker-height, 320px); padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: 0 10px 28px rgba(15,23,42,.14); display: flex; flex-direction: column; gap: 10px; }
#paper-target-picker.hidden { display: none; }
#compose-panel.paper-picker-compact #paper-panel { max-height: 45vh; }
#compose-panel.paper-picker-compact #panel-body { overflow-y: auto; }
#compose-panel.paper-picker-open .panel-header { flex-shrink: 0; }
#compose-panel.paper-picker-low { top: auto !important; bottom: 12px !important; }
#paper-target-picker { height: min(360px, var(--paper-picker-height, 360px)); animation: paper-picker-enter .14s ease-out; transform-origin: bottom center; }
@keyframes paper-picker-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { #paper-target-picker { animation: none; } }
.paper-picker-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
#paper-target-search { width: 100%; min-width: 0; flex-shrink: 0; }
#paper-target-list { overflow-y: auto; min-height: 0; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; }
.paper-target-card { display: block; width: 100%; flex-shrink: 0; text-align: left; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fff; color: var(--text); cursor: pointer; font: inherit; }
.paper-target-card:hover { background: #f8fafc; border-color: var(--primary-2); }
.paper-target-card.active { border-color: var(--primary-2); background: #eff6ff; }
.paper-target-card .test-title { display: block; overflow-wrap: anywhere; }
.paper-target-card .muted { display: block; margin-top: 5px; font-size: 13px; }
.paper-close {
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 22px; line-height: 1;
}
.paper-close:hover { background: #f1f5f9; color: var(--text); }
#compose-panel.paper-docked #paper-close { display: none; }
#paper-close { margin-left: 8px; }
#panel-body { min-height: 0; }
#compose-panel.paper-existing-target #panel-body { overflow-y: auto; }
#compose-panel.paper-existing-target #paper-list { max-height: max(72px, calc(100vh - 380px)); }
#paper-target-status { margin-top: 8px; font-size: 13px; }
#paper-target-status:empty { display: none; }
.paper-row-state { flex-shrink: 0; font-size: 11px; color: var(--muted); }
.paper-row-state.pending { color: var(--primary-2); }
#paper-list {
  list-style: none; margin: 12px 0; padding: 0;
  max-height: calc(100vh - 330px); overflow-y: auto;
  overscroll-behavior: contain; scrollbar-gutter: stable;
}
#paper-list:empty { display: none; }
#paper-list li {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px;
}
#paper-list li.dragging { opacity: 0.4; }
#paper-list li.drag-over { border-top: 2px solid var(--primary-2); }
#paper-list li .drag-handle { cursor: grab; color: var(--muted); }
#paper-list li .pl-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#paper-list li button { padding: 1px 6px; font-size: 12px; }
.paper-qtype {
  flex-shrink: 0; padding: 2px 7px; border-radius: 999px;
  background: #eef2ff; color: #4338ca; font-size: 11px; white-space: nowrap;
}
.field-label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.check-label {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 0 0; font-size: 13px; color: var(--text); cursor: pointer;
}
#paper-title { width: 100%; user-select: text; -webkit-user-select: text; }
.paper-title-actions {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0 8px;
}
.paper-title-actions #paper-title { flex: 1; min-width: 0; }
.paper-title-actions #paper-clear { flex-shrink: 0; }
#paper-save-test-msg:empty,
#paper-error:empty { min-height: 0; margin: 0; }
#paper-export { margin-top: 4px; }

/* ---------- 管理后台 ---------- */
.admin-grid {
  display: grid; grid-template-columns: minmax(360px, .8fr) minmax(620px, 1.2fr);
  gap: 16px; align-items: start;
}
.admin-grid > .card { grid-column: 1; }
.admin-grid > .admin-ai-provider-card {
  grid-column: 1 / -1;
  grid-row: 1;
}
.admin-grid > .admin-wide-card { grid-column: 1 / -1; }
.admin-grid h2 { margin-top: 0; font-size: 16px; }
.admin-grid .row { display: flex; gap: 8px; }
.key-new { margin-top: 14px; background: #f8fafc; border-radius: 6px; padding: 12px; }
.key-new pre { margin: 0 0 8px; font-size: 14px; line-height: 1.8; }
.mirror-question-id-filter {
  flex: 1 1 100%; display: grid; grid-template-columns: auto minmax(220px, 1fr);
  align-items: center; gap: 5px 9px;
}
.mirror-question-id-filter input { min-width: 220px; }
.mirror-question-id-filter small { grid-column: 1 / -1; font-weight: 400; }
.mirror-fixture-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.mirror-fixture-heading,
.mirror-fixture-card-head,
.mirror-fixture-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mirror-fixture-heading h3,
.mirror-fixture-heading p { margin: 0; }
.mirror-fixture-heading p { margin-top: 4px; }
.mirror-fixture-pull-row select { min-width: 180px; }
.mirror-fixture-pull-row #mirror-fixture-assignment {
  flex: 1 1 300px;
}
.mirror-fixture-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.mirror-fixture-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.mirror-fixture-card-title { font-weight: 700; }
.mirror-fixture-card-meta { margin-top: 4px; }
.mirror-fixture-card-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 10px;
}
.mirror-fixture-card-actions select { min-width: 170px; }
.mirror-fixture-result {
  margin-top: 8px;
  white-space: pre-wrap;
}
.admin-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.admin-table th, .admin-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px;
}
.admin-table thead th { background: #f8fafc; }
.admin-users-card { min-width: 0; }
.admin-users-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.admin-users-head h2 { margin-bottom: 4px; }
.admin-users-head p { margin: 0; }
.admin-users-search { width: min(420px, 42vw); min-width: 240px; }
.admin-users-scroll {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 8px;
}
.admin-users-table { min-width: 920px; margin-top: 0; }
.admin-users-table tbody tr:last-child td { border-bottom: none; }
.admin-users-empty { padding: 28px 12px !important; text-align: center !important; }
.admin-users-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px;
}
.admin-users-pagination { display: flex; gap: 8px; }
.admin-account { font-weight: 600; white-space: nowrap; }
.admin-account-email { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; }
.admin-user-actions { display: flex; gap: 6px; white-space: nowrap; }
.badge-admin {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: #dbeafe; color: #1d4ed8; font-size: 11px;
}
.status-ok { color: #15803d; }
.status-used { color: var(--muted); }
.status-revoked { color: var(--danger); }

@media (max-width: 1180px) {
  .admin-grid { display: flex; flex-direction: column; max-width: none; }
  .admin-grid > .admin-ai-provider-card { order: -2; width: 100%; }
}

/* 科目与考试局管理 */
.lookup-grid { display: flex; gap: 32px; flex-wrap: wrap; }
.lookup-grid > div { flex: 1; min-width: 220px; }
.lookup-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lookup-grid-3 > div { min-width: 0; }
.lookup-grid-3 .row { flex-wrap: wrap; }
.lookup-grid-3 .row input { flex: 1 1 0; min-width: 0; }
.lookup-grid-3 .lookup-hint { margin: 2px 0 6px; font-size: 12px; }

.lookup-title { margin: 4px 0 8px; font-size: 14px; }
.lookup-list { list-style: none; margin: 0 0 10px; padding: 0; }
.lookup-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.lookup-list.selectable li { cursor: pointer; border-radius: 6px; padding-left: 8px; }
.lookup-list.selectable li.selected { background: #eaf1fd; box-shadow: inset 3px 0 var(--primary-2); }
.lookup-select {
  flex: 1; border: 0; background: transparent; padding: 4px 0;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.lookup-hint { margin: -2px 0 8px; font-size: 12px; }
.lookup-disabled { opacity: 0.58; }
.lookup-disabled .lookup-list { min-height: 34px; }

/* 编辑题目弹窗 */
.edit-modal-body { width: min(720px, 94vw); max-height: 92vh; overflow-y: auto; }
.edit-assets-section {
  margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; background: #f8fafc;
}
.edit-assets-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 7px; font-size: 13px;
}
.edit-upload-btn { cursor: pointer; }
.edit-assets-grid {
  display: flex; gap: 8px; min-height: 92px; overflow-x: auto;
  padding-bottom: 3px;
}
.edit-asset-card {
  flex: 0 0 124px; display: grid; grid-template-columns: 1fr auto;
  gap: 5px; align-items: center; padding: 5px;
  border: 1px solid var(--border); border-radius: 7px; background: white;
}
.edit-asset-card img {
  grid-column: 1 / -1; width: 112px; height: 76px; object-fit: contain;
  background: white; cursor: pointer;
}
.edit-asset-card span { font-size: 11px; color: var(--muted); }
.edit-assets-empty { align-self: center; padding: 8px; }
.edit-answer-parts { display: grid; gap: 10px; }
.edit-answer-part {
  padding: 9px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff;
}
.edit-answer-part-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.edit-answer-part-head label {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 12px;
}
.edit-answer-part-label { width: 100px; }
.edit-answer-part-marks { width: 68px; }
.edit-answer-part-remove { margin-left: auto; }
.edit-answer-part-text {
  width: 100%; min-height: 60px; margin: 0 0 8px; resize: vertical;
}
.edit-answer-part .edit-assets-grid { min-height: 72px; }
.edit-answer-part-upload { margin-top: 7px; }
.remark-modal-body { width: min(560px, 92vw); }
#remark-text {
  width: 100%; resize: vertical; font: inherit; line-height: 1.6;
  border: 1px solid var(--border); border-radius: 6px; padding: 10px;
}
.edit-title { margin: 0 0 14px; font-size: 17px; }
.edit-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px;
}
.edit-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.edit-grid input, .edit-grid select { width: 100%; }
.edit-grid textarea { width: 100%; resize: vertical; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* 原始分辨率图片编辑器：必须压在“编辑题目”弹窗上方。 */
#img-modal { z-index: 130; }
#image-editor-modal { z-index: 140; }
.image-editor-body {
  width: min(1200px, 96vw); height: min(94vh, 960px); padding: 12px;
  overflow: hidden; display: flex; flex-direction: column;
}
.image-editor-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 2px 4px 0;
}
.image-editor-head .edit-title { margin-bottom: 9px; }
.image-editor-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 8px; border: 1px solid var(--border); border-radius: 8px;
  background: #f8fafc;
}
.image-editor-toolbar .btn.active {
  color: var(--primary); border-color: var(--primary);
  background: #eff6ff;
}
.image-editor-brush {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.image-editor-brush input { width: 130px; }
.image-editor-brush span { min-width: 24px; text-align: right; }
.image-editor-loading {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.image-editor-stage {
  flex: 1; min-height: 0; overflow: auto; margin-top: 8px; padding: 14px;
  border: 1px solid var(--border); border-radius: 8px; background: #dfe4ea;
  text-align: center;
}
.image-editor-stage canvas {
  display: block; width: auto; height: auto; max-width: 100%;
  max-height: 100%; margin: 0 auto; background: #fff;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.18);
  cursor: default; touch-action: none;
}
.image-editor-actions { margin-top: 9px; }

@media (max-width: 640px) {
  .image-editor-body { width: 98vw; height: 96vh; padding: 8px; }
  .image-editor-toolbar { gap: 5px; padding: 6px; }
  #image-editor-hint { flex-basis: 100%; }
  .image-editor-brush input { width: 90px; }
}

/* 导入冲突处理弹窗（仿 Windows 复制文件冲突对话框） */
.conflict-modal-body { width: min(980px, 94vw); max-height: 92vh; }
/* 「应用」固定在弹窗最右上角（0.7.2），批量按钮留在工具栏 */
.conflict-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.conflict-title-row .edit-title { margin: 0 0 14px; }
.conflict-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.conflict-toolbar .muted { margin-left: auto; }
.conflict-subject-rest {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px;
  user-select: none;
}
.conflict-run-progress {
  margin: 0 0 12px; padding: 10px 12px; border: 1px solid #bfdbfe;
  border-radius: 8px; background: #eff6ff;
}
.conflict-run-progress-copy {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 7px; color: #1e3a8a; font-size: 13px;
}
.conflict-run-track {
  height: 8px; overflow: hidden; border-radius: 999px; background: #dbeafe;
}
.conflict-run-track > span {
  display: block; width: 0; height: 100%; border-radius: inherit;
  background: var(--primary); transition: width 180ms ease;
}
.conflict-modal-body.conflict-processing #conflict-list {
  opacity: .55; pointer-events: none;
}
.conflict-item {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; margin-bottom: 12px;
}
.conflict-item-head { font-size: 14px; margin-bottom: 10px; }
.conflict-item-head .meta { color: var(--muted); font-size: 12px; margin-left: 8px; }
.conflict-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conflict-col { border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.conflict-choice {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13px; cursor: pointer; margin-bottom: 6px;
}
.conflict-thumb { max-height: 160px; cursor: zoom-in; margin: 0 auto; }
.conflict-noimg {
  height: 80px; display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.conflict-fields { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.conflict-fields th, .conflict-fields td {
  border: 1px solid var(--border); padding: 4px 8px;
  text-align: left; vertical-align: top; word-break: break-word;
}
.conflict-fields th { background: #f8fafc; white-space: nowrap; }
.conflict-fields td.conflict-diff, .conflict-fields th.conflict-diff { background: #fef3c7; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
/* 分享可从题目详情弹窗内打开；必须叠在详情层之上，不能被后置 DOM 遮住。 */
#share-modal { z-index: 120; }
#view-modal.shared-question-open {
  gap: 16px; padding: 16px;
}
#view-modal.shared-question-open .detail-modal-body {
  width: min(900px, calc(100vw - 390px));
}
.received-share-card {
  width: 330px; max-height: 72vh; padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.received-share-card h2 { margin: 0; }
.received-share-field { display: grid; gap: 6px; }
.received-share-field > span { font-size: 12px; }
.received-share-field p {
  margin: 0; min-height: 90px; padding: 12px; border-radius: 8px;
  background: #f8fafc; white-space: pre-wrap; overflow-wrap: anywhere;
}
.received-share-card > .btn { align-self: flex-end; }
@media (max-width: 900px) {
  #view-modal.shared-question-open {
    flex-direction: column; overflow-y: auto; justify-content: flex-start;
  }
  #view-modal.shared-question-open .detail-modal-body {
    width: min(94vw, 760px); height: 72vh; flex: none;
  }
  .received-share-card { width: min(94vw, 760px); flex: none; }
}

/* 顶部居中 toast 通知（约 3 秒自动消失） */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; background: var(--primary); color: #fff;
  padding: 10px 22px; border-radius: 8px; box-shadow: var(--shadow);
  font-size: 14px; pointer-events: none;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6); }
.modal-body {
  position: relative; background: #fff; border-radius: var(--radius);
  padding: 16px; max-width: 90vw; max-height: 90vh; overflow: auto;
}
.modal-body img { max-width: 100%; height: auto; display: block; }

/* 通用确认弹窗 */
.confirm-dialog { min-width: 300px; max-width: 420px; }
.confirm-msg { margin: 4px 0 16px; font-size: 15px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.lesson-exit-dialog { width: min(680px, calc(100vw - 32px)); min-width: 0; max-width: 680px; }
.lesson-exit-dialog .confirm-actions { flex-wrap: wrap; }
.ai-feedback-decline {
  background: #fff; border-color: #ef4444; color: #dc2626;
}
.ai-feedback-decline:hover { background: #fff5f5; color: #b91c1c; }

/* 题目/答案/ER 统一大预览 */
.detail-modal-body {
  width: min(1180px, 94vw); height: 92vh; padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
#view-modal:focus { outline: none; }
#view-modal.detail-keyboard-navigation,
#view-modal.detail-keyboard-navigation * { cursor: default !important; }
.detail-scroll-content {
  flex: 1 1 auto; min-width: 0; min-height: 0; overflow-x: hidden;
  overflow-y: auto; padding: 8px 16px 16px;
}
.detail-footer-actions {
  flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 10px 16px;
  border-top: 1px solid var(--border); background: #fff;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.08); z-index: 5;
}
.detail-footer-left, .detail-footer-state, .detail-footer-buttons,
.detail-question-navigation {
  display: flex; align-items: center; gap: 8px;
}
.detail-footer-left { min-width: 0; }
.detail-question-navigation .btn {
  min-width: 86px; padding: 7px 10px; border-radius: 9px;
  font-weight: 600; white-space: nowrap;
}
.detail-footer-select {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  cursor: pointer;
}
@media (max-width: 640px) {
  .detail-footer-actions { padding: 8px 10px; }
  .detail-footer-buttons { gap: 5px; }
  .detail-footer-state { display: none; }
  .detail-question-navigation { gap: 5px; }
  .detail-question-navigation .btn { min-width: 0; padding-inline: 7px; }
}
.detail-title-row {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 4px; background: #fff;
}
.detail-title-row .edit-title { margin: 0; }
.detail-title-row .edit-title { flex-shrink: 0; }
.detail-title-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; max-height: 58px; overflow-y: auto; }
.detail-title-tags .personal-tag-chip { max-width: 100%; }
.detail-title-row #view-close {
  margin-left: auto; flex-shrink: 0; padding: 5px 10px; min-height: 30px;
}
#view-back { flex-shrink: 0; }
.detail-asset { margin: 0 0 18px; }
.detail-asset h3 { margin: 6px 0; font-size: 15px; }
.detail-answer-heading {
  display: flex; align-items: center; gap: 8px;
}
.detail-answer-toggle {
  display: inline-grid; place-items: center; width: 30px; height: 26px;
  padding: 2px; border: 0; border-radius: 5px; color: var(--muted);
  background: transparent; cursor: pointer;
}
.detail-answer-toggle:hover { color: var(--primary-2); background: #eef4ff; }
.detail-answer-toggle svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.detail-answer-hidden { margin: 6px 0 12px; font-size: 13px; }
.detail-asset h3 .view-marks {
  font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px;
}
.view-grid label {
  color: var(--text); font-size: 15px; font-weight: 600;
}
.view-grid {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px;
  margin: 0 0 14px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: #f8fafc;
}
.view-grid label {
  display: inline-flex; flex-direction: row; align-items: baseline; gap: 5px;
  min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.35;
  white-space: nowrap;
}
.view-grid .view-value {
  display: inline-block; max-width: min(310px, 42vw); padding: 0;
  overflow: hidden; color: var(--text); font-size: 12px; font-weight: 500;
  text-overflow: ellipsis; vertical-align: bottom;
}
.view-grid .view-metadata-editable { cursor: pointer; }
.view-grid .view-metadata-editable:hover .view-value {
  color: var(--primary-2); text-decoration: underline;
}
.metadata-editor-popover {
  position: fixed; z-index: 160; width: min(320px, calc(100vw - 16px));
  padding: 12px; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; box-shadow: 0 12px 32px rgba(15, 23, 42, .22);
}
.metadata-editor-title { font-weight: 700; margin-bottom: 8px; }
.metadata-editor-title .muted { font-size: 12px; font-weight: 400; }
.metadata-editor-list {
  display: grid; gap: 5px; max-height: 230px; overflow-y: auto;
  padding: 4px 2px 7px;
}
.metadata-editor-option {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px;
  border-radius: 5px; cursor: pointer; font-size: 13px;
}
.metadata-editor-option:hover { background: #f1f5f9; }
.metadata-editor-option input { width: auto; margin: 0; }
.metadata-editor-custom { display: grid; gap: 4px; margin-top: 6px; font-size: 12px; }
.metadata-editor-custom input { width: 100%; padding: 7px 8px; }
.metadata-editor-error { min-height: 18px; margin-top: 4px; font-size: 12px; }
.metadata-editor-actions { display: flex; justify-content: flex-end; gap: 7px; }
.asset-nav {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center;
  justify-content: center; gap: 8px; padding: 6px; background: #fff;
  border: 1px solid var(--border); border-radius: 6px 6px 0 0;
}
.detail-preview-frame { position: relative; min-width: 0; }
.detail-resize-handle {
  position: absolute; right: 0; bottom: 0; z-index: 6; width: 22px; height: 22px;
  padding: 0; border: 0; border-radius: 0 0 6px 0; background: transparent;
  cursor: ns-resize; touch-action: none;
}
.detail-resize-handle::after {
  content: ''; position: absolute; right: 4px; bottom: 4px; width: 10px; height: 10px;
  background: repeating-linear-gradient(135deg, transparent 0 3px, #94a3b8 3px 4px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.detail-preview-dock {
  position: absolute; z-index: 4; right: 26px; bottom: 12px; top: auto;
  width: max-content; max-width: calc(100% - 24px); padding: 5px 7px;
  gap: 6px; border: 1px solid rgba(148, 163, 184, .42);
  border-radius: 12px; background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 18px rgba(15, 23, 42, .16);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.detail-preview-dock .btn { padding: 5px 8px; }
.detail-preview-dock span { white-space: nowrap; font-size: 12px; color: var(--muted); }
.detail-text-preview-frame .er-viewport,
.detail-text-preview-frame .comment-viewport { padding-bottom: 58px; }
.asset-viewport {
  height: 48vh; min-height: 140px; max-height: 65vh;
  overflow: auto; cursor: grab; resize: none; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 7px; background: #f8fafc;
  user-select: none;
  overscroll-behavior: contain; touch-action: pan-x pan-y;
}
#view-a-viewport { min-height: 56px; }
.asset-viewport.zoomed { touch-action: none; }
.asset-viewport.dragging { cursor: grabbing; }
.asset-viewport img {
  display: block; width: 100%; max-width: none; height: auto; margin: 0 auto;
  transform-origin: center center;
}
.asset-viewport.zoomed img { margin-left: 0; margin-right: 0; }
.answer-text {
  white-space: pre-wrap; padding: 18px; font-size: 15px; line-height: 1.7;
  user-select: text; background: #fff;
}
.answer-rich-line {
  min-height: 1.7em; white-space: pre-wrap; overflow-wrap: anywhere;
}
.answer-rich-blank { height: 1.15em; line-height: 1.15em; }
.answer-rich-line strong { font-weight: 700; }
.answer-rich-line u { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.er-viewport, .comment-viewport {
  height: 180px; max-height: 55vh; min-height: 52px;
  overflow: auto; resize: none; white-space: pre-wrap; box-sizing: border-box;
  padding: 14px; line-height: 1.65; border: 1px solid var(--border);
  background: #fff;
}
#view-er-text {
  height: calc(4 * 1.65em + 36px); max-height: none; overflow: hidden;
  overflow-wrap: anywhere; padding: 7px 14px 27px;
}
#view-er-text.expanded { height: auto; }
.detail-report-content { max-height: 6.6em; overflow: hidden; }
#view-er-text.expanded .detail-report-content { max-height: none; }
.detail-report-toggle {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  z-index: 5; border: 0; background: #fff; color: var(--primary);
  font: inherit; font-size: 13px; line-height: 20px; padding: 2px 8px; cursor: pointer;
}
#view-er-section .detail-preview-dock {
  right: 8px; bottom: 2px; height: 24px; box-sizing: border-box;
  padding: 1px 3px; gap: 4px; border-radius: 8px;
}
#view-er-section .detail-preview-dock .btn { padding: 0; width: 20px; height: 20px; min-height: 0; line-height: 18px; }
#view-er-section .detail-preview-dock span { font-size: 11px; }
.detail-empty-text {
  margin: 4px 0 14px; color: var(--muted); font-size: 14px;
}
.detail-remark {
  margin-bottom: 12px; padding: 9px 11px; border-left: 3px solid #f59e0b;
  border-radius: 0 7px 7px 0; background: #fffbeb;
}
.detail-remark h3 { margin: 0 0 4px; color: #92400e; font-size: 13px; }
.detail-remark-text {
  color: var(--text); font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* 题目公共评论：紧凑主评论 + 一层缩进回复，避免深层嵌套挤窄内容。 */
.question-discussion {
  min-width: 0; max-width: 100%; overflow-x: hidden;
  margin: 20px 0 6px; padding-top: 16px; border-top: 1px solid var(--border);
}
.question-discussion-heading {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.question-discussion-heading h3 { margin: 0; font-size: 17px; }
.question-discussion-heading h3 .muted {
  margin-left: 5px; font-size: 12px; font-weight: 400;
}
.comment-composer {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px;
  min-width: 0; max-width: 100%; margin-bottom: 6px;
}
.comment-composer-main { min-width: 0; max-width: 100%; overflow: hidden; }
.comment-avatar {
  display: grid; place-items: center; width: 34px; height: 34px;
  flex: 0 0 34px; border-radius: 50%; background: #e8eef9;
  color: #315b96; font-size: 14px; font-weight: 700; user-select: none;
}
.comment-composer-main textarea,
.comment-inline-composer textarea {
  display: block; width: 100%; min-width: 0; max-width: 100%;
  height: 35px; min-height: 35px; max-height: 55px;
  box-sizing: border-box; resize: none; overflow-x: hidden;
  padding: 8px 2px 7px; border: 0; border-bottom: 1px solid #cbd5e1;
  border-radius: 0; outline: none; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.5;
}
.comment-composer-main textarea:focus,
.comment-inline-composer textarea:focus { border-bottom-color: var(--primary); }
.comment-composer-actions,
.comment-inline-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-top: 6px;
}
.comment-composer-actions .muted { margin-right: auto; font-size: 11px; }
.comment-teacher-only,
.comment-student-only {
  display: inline-flex; align-items: center; gap: 5px; color: #475569;
  font-size: 12px; white-space: nowrap; cursor: pointer;
}
.comment-teacher-only input,
.comment-student-only input { margin: 0; }
.comment-teacher-badge {
  flex: 0 0 auto; padding: 1px 6px; border-radius: 999px;
  background: #fff7ed; color: #c2410c; font-size: 10px; font-weight: 600;
}
.comment-student-badge {
  flex: 0 0 auto; padding: 1px 6px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; font-size: 10px; font-weight: 600;
}
#view-discussion-error { min-height: 0; margin: 4px 0; }
.question-comment-list { margin-top: 8px; }
.question-comment-thread { padding: 8px 0 10px; }
.question-comment-thread + .question-comment-thread {
  border-top: 1px solid #eef2f7;
}
.question-comment {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px;
  padding: 5px 0;
}
.question-comment.is-reply {
  grid-template-columns: 28px minmax(0, 1fr); margin-left: 44px;
}
.question-comment.is-reply .comment-avatar {
  width: 28px; height: 28px; flex-basis: 28px; font-size: 12px;
  background: #f1f5f9; color: #526173;
}
.question-comment-body { min-width: 0; }
.question-comment-head {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
}
.question-comment-head strong {
  overflow: hidden; color: var(--text); font-size: 13px;
  text-overflow: ellipsis; white-space: nowrap;
}
.question-comment-head time {
  flex: 0 0 auto; color: var(--muted); font-size: 11px;
}
.question-comment-text {
  margin-top: 3px; color: var(--text); font-size: 13px; line-height: 1.58;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.comment-reply-target { color: #356fbf; }
.question-comment-actions {
  display: flex; align-items: center; gap: 15px; margin-top: 5px;
}
.comment-like,
.comment-action-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px;
  padding: 1px 0; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.comment-like:hover, .comment-action-link:hover { color: var(--text); }
.comment-like.active { color: var(--primary-2); }
.comment-like svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.comment-like.active svg { fill: #dbeafe; }
.comment-action-link.danger-text { color: #b91c1c; }
.comment-inline-composer {
  min-width: 0; max-width: 100%; overflow: hidden;
  margin-top: 7px; padding: 4px 8px 8px; border-radius: 7px;
  background: #f8fafc;
}
.comment-load-more { display: block; margin: 8px auto 0; }
.comment-empty { margin: 16px 0 10px 44px; font-size: 13px; }
@media (max-width: 640px) {
  .view-grid { gap: 5px 10px; }
  .view-grid .view-value { max-width: 58vw; }
  .question-comment.is-reply { margin-left: 20px; }
}

/* 成功提示（复用 .error 容器，绿色显示） */
.error.success { color: #15803d; }
.btn.success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.success:hover { background: #15803d; border-color: #15803d; }

/* 教师 My tests：总览 + 成绩名单合并弹窗 */
.btn.test-gradebook:not(:disabled) {
  background: #d85a00; border-color: #d85a00; color: #fff;
}
.btn.test-gradebook:not(:disabled):hover {
  background: #b64900; border-color: #b64900; color: #fff;
}
.btn.test-view-teacher-lesson {
  border: 2px solid #f59e0b; background: #fff; color: #b45309;
  font-weight: 700;
}
.btn.test-view-teacher-lesson:hover {
  border-color: #d97706; background: #fff7ed; color: #92400e;
}
.test-gradebook:disabled,
.test-gradebook:disabled:hover {
  background: #e5e7eb; border-color: #d1d5db; color: #9ca3af;
  cursor: not-allowed;
}
#teacher-gradebook-modal { z-index: 126; }
.teacher-gradebook-modal-body {
  width: min(1180px, calc(100vw - 32px));
  min-width: min(1180px, calc(100vw - 32px)); max-width: none;
  height: min(760px, 92vh); max-height: 92vh; flex: 0 0 auto;
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
}
.teacher-overview-lesson-entry {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  column-gap: 3px; row-gap: 1px;
  width: 100%; margin: 8px 0 10px; padding: 8px 10px;
  border: 2px solid #2563eb; border-radius: 8px; background: #fff;
  color: #1d4ed8; cursor: pointer;
}
.teacher-overview-lesson-entry strong,
.teacher-overview-lesson-entry small { white-space: nowrap; }
.teacher-overview-lesson-entry:hover:not(:disabled) { background: #eff6ff; }
.teacher-overview-lesson-entry small {
  color: #94a3b8; font-size: 10px; font-weight: 500;
}
.teacher-overview-lesson-entry:disabled {
  border-color: #cbd5e1; color: #94a3b8; cursor: not-allowed;
}
.teacher-gradebook-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.teacher-gradebook-head h2 {
  flex: 0 1 auto; min-width: 0; max-width: 38%; margin: 0;
  font-size: 20px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#teacher-gradebook-loading { padding: 16px; }
.teacher-review-layout {
  display: grid; grid-template-columns: minmax(220px, .42fr) minmax(0, 1.55fr);
  flex: 1; min-height: 0; overflow: hidden;
}
.teacher-review-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  padding: 0 12px 10px;
}
.teacher-review-overview-pane {
  border-right: 1px solid var(--border); background: #f8fafc;
}
#teacher-overview-content {
  min-height: 0; overflow: auto; padding: 10px 0 4px;
}
#teacher-overview-error:empty,
#teacher-gradebook-error:empty { min-height: 0; margin: 0; }
.teacher-overview-summary {
  margin-bottom: 8px; white-space: nowrap;
}
.teacher-overview-legend {
  display: flex; align-items: center; gap: 6px; margin-bottom: 9px;
  color: var(--muted); font-size: 12px;
}
.teacher-overview-gradient {
  display: grid; grid-template-columns: repeat(11, 1fr);
  flex: 1; min-width: 90px; height: 10px; overflow: hidden;
  border-radius: 999px;
}
.teacher-overview-gradient span { display: block; }
.teacher-overview-list { display: grid; gap: 6px; }
.teacher-overview-question {
  width: 100%; display: grid;
  grid-template-columns: 28px 50px minmax(0, 1fr);
  align-items: center; gap: 6px; padding: 7px 8px;
  border: 1px solid; border-radius: 8px; font: inherit; text-align: left;
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
  white-space: nowrap; overflow: hidden;
}
.teacher-overview-question:hover:not(:disabled) {
  transform: translateY(-1px); box-shadow: 0 5px 16px rgba(15, 23, 42, .16);
}
.teacher-overview-question:disabled { cursor: default; opacity: .8; }
.teacher-overview-question strong { overflow: hidden; text-overflow: ellipsis; }
.teacher-overview-number { font-size: 15px; font-weight: 800; }
.teacher-overview-type { font-size: 12px; font-weight: 700; }
.teacher-review-gradebook-pane { background: #fff; }
.teacher-gradebook-tabs {
  display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 6px;
  padding: 0; overflow-x: auto; border: 0; scrollbar-width: thin;
}
.teacher-gradebook-tab {
  display: inline-flex; align-items: center; gap: 7px;
  flex: 0 0 auto; min-width: 72px; max-width: 280px; padding: 7px 12px;
  border: 0; border-radius: 999px; outline: 0; box-shadow: none;
  background: #f1f5f9; color: #64748b; font: inherit; font-weight: 600;
  overflow: hidden; white-space: nowrap; cursor: pointer;
}
.teacher-gradebook-tab-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.teacher-gradebook-tab-meta {
  flex: 0 0 auto; font-size: 11px; font-weight: 500;
}
.teacher-gradebook-tab:hover { background: #e2e8f0; color: #334155; }
.teacher-gradebook-tab.active {
  border: 0; background: #dbeafe; color: var(--primary); box-shadow: none;
}
.teacher-gradebook-tab:focus-visible {
  box-shadow: 0 0 0 2px #93c5fd;
}
.teacher-gradebook-tab.published::after {
  content: ''; display: inline-block; width: 7px; height: 7px;
  margin-left: 6px; border-radius: 50%; background: #22c55e;
}
#teacher-gradebook-groups { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px 0 4px; }
#teacher-gradebook-empty { padding: 14px 0; }
.teacher-gradebook-publish {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end;
  gap: 10px; padding: 10px 0 0; border-top: 1px solid var(--border);
}
.teacher-gradebook-publish-option {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.teacher-gradebook-publish-option input { margin: 0; }
#teacher-gradebook-publish-state { margin-right: auto; font-size: 12px; }
.gradebook-group { margin-bottom: 14px; }
.gradebook-group:last-child { margin-bottom: 0; }
.gradebook-group-head {
  display: flex; align-items: center; gap: 6px; min-height: 30px;
  margin: 0 0 6px;
}
.gradebook-group-head h3 { margin: 0; font-size: 14px; }
.gradebook-table-wrap {
  width: 100%; overflow-x: auto; border: 1px solid var(--border);
  border-radius: 10px; background: #fff;
}
.gradebook-group-table {
  width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0;
  table-layout: fixed;
}
.gradebook-group-table th,
.gradebook-group-table td {
  padding: 6px; border: 0; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); text-align: left;
  overflow: hidden; text-overflow: ellipsis;
}
.gradebook-group-table th:last-child,
.gradebook-group-table td:last-child { border-right: 0; }
.gradebook-group-table tbody tr:last-child td { border-bottom: 0; }
.gradebook-group-table th {
  background: #f1f5f9; font-size: 12px; color: #475569;
}
.gradebook-group-table tbody tr:hover td { background: #f8fafc; }
.gradebook-group-table th:nth-child(1) { width: 13%; }
.gradebook-group-table th:nth-child(2) { width: 10%; }
.gradebook-group-table th:nth-child(3) { width: 13%; }
.gradebook-group-table th:nth-child(4) { width: 13%; }
.gradebook-group-table th:nth-child(5) { width: 22%; }
.gradebook-group-table th:nth-child(6) { width: 11%; }
.gradebook-group-table th:nth-child(7) { width: 18%; }
.gradebook-ai-all {
  height: 34px; min-height: 34px; box-sizing: border-box;
  white-space: nowrap;
}
.gradebook-thinking-option {
  display: inline-flex; align-items: center; gap: 4px; margin-left: auto;
  color: #475569; font-size: 12px; white-space: nowrap; cursor: pointer;
}
.gradebook-thinking-option input { margin: 0; }
.gradebook-ai-all-controls {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 2px;
  white-space: nowrap;
}
.gradebook-sort-head {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  white-space: nowrap;
}
.gradebook-sort-button {
  flex: none; width: 20px; height: 20px; padding: 0; border: 0;
  border-radius: 4px; background: transparent; color: #94a3b8;
  cursor: pointer; font-size: 10px; line-height: 20px;
}
.gradebook-sort-button:hover { background: #e2e8f0; color: #475569; }
.gradebook-sort-button.active { background: #dbeafe; color: #1d4ed8; }
.gradebook-manual-action-cell,
.gradebook-manual-score-cell,
.gradebook-ai-action-cell {
  vertical-align: middle; white-space: nowrap;
}
.gradebook-ai-action-cell {
  display: flex; align-items: center; gap: 4px;
}
.gradebook-manual-action-cell .btn,
.gradebook-ai-action-cell .btn { padding-left: 7px; padding-right: 7px; }
.gradebook-ai-model-select {
  -webkit-appearance: none; appearance: none;
  width: 108px; min-width: 0; height: 34px; padding: 6px 28px 6px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  background-size: 12px; color: var(--text); font: inherit; font-size: 12px;
}
.gradebook-manual-action-cell .btn + .btn { margin-left: 4px; }
.gradebook-ai-score-cell { white-space: nowrap; font-weight: 650; }
.ai-grade-progress {
  position: relative; width: 100%; min-width: 64px; height: 7px;
  overflow: hidden; border-radius: 999px; background: #e2e8f0;
}
.ai-grade-progress > span {
  display: block; height: 100%; border-radius: inherit;
  background: #2563eb; transition: width .2s ease;
}
.ai-grade-progress.indeterminate > span {
  width: 35%; animation: ai-grade-progress-slide 1s ease-in-out infinite;
}
.gradebook-ai-score-cell small {
  display: block; margin-top: 3px; color: #64748b; font-size: 10px;
  font-weight: 500; text-align: center;
}
@keyframes ai-grade-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.gradebook-score-input { width: 42px; padding: 4px; }
.gradebook-score-save-state { min-width: 0; font-size: 11px; }
.gradebook-history-button { flex: none; }
.gradebook-submitted-cell { white-space: nowrap; font-size: 12px; }
.grading-status {
  display: inline-flex; padding: 3px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.grading-status-not_graded { background: #f1f5f9; color: #64748b; }
.grading-status-unsubmitted { background: #f1f5f9; color: #64748b; }
.grading-status-pending { background: #fef3c7; color: #92400e; }
.grading-status-manual { background: #dcfce7; color: #166534; }
.grading-status-ai_only { background: #dbeafe; color: #1d4ed8; }
.grading-status-ai_human { background: #dcfce7; color: #166534; }
.history-grade-action { display: flex; align-items: center; gap: 6px; }
.ai-working-dots { display: inline-flex; width: 15px; }
.ai-working-dots i {
  opacity: 0; font-style: normal; animation: ai-working-dot 1.4s infinite;
}
.ai-working-dots i:nth-child(2) { animation-delay: .18s; }
.ai-working-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes ai-working-dot {
  0%, 14%, 72%, 100% { opacity: 0; }
  22%, 68% { opacity: 1; }
}

#teacher-attempt-history-modal { z-index: 132; }
.teacher-attempt-history-modal-body {
  width: min(760px, calc(100vw - 32px)); max-width: none;
  max-height: min(680px, calc(100vh - 32px)); padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
#teacher-attempt-history-loading,
#teacher-attempt-history-error { margin: 0; padding: 14px 16px; }
#teacher-attempt-history-error:empty { display: none; }
#teacher-attempt-history-content {
  min-height: 0; padding: 14px 16px 16px; overflow: auto;
}
.teacher-attempt-history-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.teacher-attempt-history-toolbar .btn { margin-left: auto; }
.teacher-attempt-history-table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 10px;
}
.teacher-attempt-history-table {
  width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0;
}
.teacher-attempt-history-table th,
.teacher-attempt-history-table td {
  padding: 9px 10px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.teacher-attempt-history-table th:last-child,
.teacher-attempt-history-table td:last-child { border-right: 0; }
.teacher-attempt-history-table tbody tr:last-child td { border-bottom: 0; }
.teacher-attempt-history-table th {
  background: #f1f5f9; color: #475569; font-size: 12px;
}
.teacher-attempt-history-table tr.counted td { background: #f0fdf4; }
.history-counted-badge { color: #15803d; font-weight: 700; }

#page-teacher-grading { height: calc(100vh - 56px); overflow: hidden; }
.teacher-grading-page {
  position: relative; height: 100%; overflow: hidden;
  display: flex; flex-direction: column; background: #fff;
}
.exam-topbar.teacher-grading-topbar {
  flex: 0 0 auto; margin-bottom: 0;
}
.teacher-grading-nav { flex: 1 1 auto; }
.teacher-grading-export-actions {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto;
}
#teacher-grading-zoom-controls .btn {
  width: 38px; min-width: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; font-size: 0;
}
.teacher-grading-score {
  color: var(--primary); font-weight: 700; white-space: nowrap;
}
.teacher-grading-score-stack {
  flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: flex-end; justify-content: center; gap: 1px;
  min-width: 78px; line-height: 1.15;
}
#teacher-grading-current-score,
#teacher-grading-score { font-size: 13px; }
.teacher-grading-content {
  flex: 1 1 auto; min-width: 0; min-height: 0; overflow-x: hidden;
  overflow-y: auto;
  padding: var(--focus-write-buffer-top) 0 92px;
  background: #fff; border-radius: 0;
}
.teacher-grading-content.teacher-grading-saq-mode {
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
}
.teacher-grading-content.teacher-grading-saq-mode > .teacher-grading-question {
  height: 100%; min-height: 0;
}
.teacher-grading-error {
  position: absolute; left: 18px; bottom: 72px; z-index: 5;
}
/* 0.11.2：去掉题卡灰框（阴影/圆角/内边距），白底融入页面，涂画画板更大 */
.teacher-grading-question {
  width: 100%; max-width: 1480px; min-width: 0; margin: 0 auto;
  padding: 0; background: #fff;
}
.teacher-grading-question-head {
  display: flex; justify-content: space-between; align-items: center;
  min-height: 18px; margin-bottom: 2px; font-size: 12px;
}
/* 0.11.3：取消题图下灰色分割线，分割线以下区域并入涂写锚定区 */
.teacher-grading-question-images {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 4px 0 14px;
}
.teacher-fit-pending .annot-wrap { visibility: hidden; }
.teacher-grading-question-images img {
  display: block; max-width: min(100%, 980px); max-height: 50vh;
  width: auto; height: auto; object-fit: contain;
}
/* 0.11.4：超长条图（高宽比 >2，JS 加 .tg-tall-image）取消高度收缩，
   保持显示宽度、超出部分随页面纵向滚动 */
.teacher-grading-question-images .tg-tall-image img,
.teacher-grading-overview-images .tg-tall-image img {
  max-height: none;
}
.teacher-grading-part {
  display: block; margin-top: 12px; padding: 12px 0 0;
  background: #fff;
}
/* 首小题得分栏到右栏顶端：8px 缓冲 + 4px margin + 4px padding =
   16px，正好是此前 32px 的一半；后续小题仍保留原有分隔距离。 */
.teacher-grading-answer-page > .teacher-grading-part:first-of-type {
  margin-top: 4px; padding-top: 4px;
}
.teacher-grading-part-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.teacher-grading-saq-split {
  height: 100%; min-height: 0; align-items: stretch; overflow: hidden;
}
.teacher-grading-saq-split .saq-left {
  position: relative; top: auto; align-self: stretch; min-height: 0;
  /* 与在线测评一致：滚动容器直接贴住分隔条，不在滚动条外再留一层空隙。 */
  padding-right: 0;
}
.teacher-grading-saq-split .teacher-grading-overview-images {
  height: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto;
  /* 与在线测评一样让滚动条覆盖在边缘，不为它永久预留横向槽位。 */
  overscroll-behavior: contain;
  padding: var(--focus-write-buffer-top) 10px 10px;
  box-sizing: border-box;
}
.teacher-grading-saq-split .teacher-grading-overview-images.teacher-overview-zoomed {
  overflow-x: auto;
}
.teacher-grading-overview-images .annot-wrap {
  width: 95%; margin-right: auto; margin-left: auto;
}
.teacher-grading-saq-split > .splitter {
  position: relative; z-index: 3; touch-action: none;
}
.teacher-grading-answer-column {
  flex: 1 1 0; min-width: 0; max-width: 100%; height: 100%;
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; scrollbar-gutter: stable;
  overflow-anchor: none;
  padding: 0 4px 0 7px;
  scroll-padding-bottom: calc(var(--teacher-grading-dock-clearance, 52px) + 10px);
}
.teacher-grading-answer-column.teacher-answer-page-zoomed { overflow-x: auto; }
.teacher-answer-page-zoom-stage {
  position: relative; min-width: 100%; max-width: none; overflow: visible;
}
.teacher-grading-answer-page {
  position: absolute; top: 0; left: 0; min-width: 0;
  transform-origin: top left; will-change: transform;
}
.teacher-grading-answer-page.teacher-lesson-right-canvas {
  /* 仅匿名题目讲解启用：顶层画布覆盖整张右页，跨小题连续书写。 */
  isolation: isolate;
}
.teacher-grading-answer-top-buffer {
  /* 右栏只需保留一小段可书写缓冲：8px = 原 20px 的 40%。 */
  width: 100%; height: 8px; min-height: 8px; background: #fff;
}
.teacher-grading-answer-bottom-buffer {
  width: 100%; min-height: calc(
    var(--teacher-grading-dock-clearance, 52px) + 10px);
  background: #fff;
}
/* 0.12.3：题目、学生答案、标准答案共用整题大画布。作答列不再整体
   压住 canvas；只有得分输入等控件单独置顶。标准答案起笔由 JS 拦截为
   积分操作，但从其他区域开始的笔画可借 pointer capture 贯穿该区域。 */
.teacher-grading-response-side {
  position: relative; min-width: 0; max-width: 100%; overflow-x: hidden;
  display: grid; grid-template-rows: auto auto minmax(0, auto); gap: 10px;
  align-content: start;
}
.teacher-answer-title {
  position: relative; z-index: 2; display: flex; align-items: center;
  justify-content: flex-start; gap: 10px; margin-bottom: 2px;
}
.teacher-standard-answer-head {
  display: flex; align-items: baseline; gap: 8px;
}
.teacher-response-section-title {
  display: flex; align-items: baseline; justify-content: flex-start;
  gap: 8px; margin: 0 0 6px; font-weight: 700;
}
.teacher-answer-hint { font-size: 12px; font-weight: 400; }
.teacher-response-card {
  min-width: 0; max-width: 100%; overflow: visible;
  padding: 0; border: 0; border-radius: 0; background: transparent;
}
.teacher-response-viewport {
  position: relative; width: 100%; min-width: 0; max-width: 100%;
  overflow-x: hidden; overflow-y: auto; contain: layout paint;
  overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom;
  overflow-anchor: none;
  scrollbar-gutter: stable; background: #fff;
  border: 1px solid var(--border); border-radius: 7px;
}
.teacher-response-viewport.teacher-response-zoomed { overflow-x: auto; }
.teacher-student-response-viewport {
  min-height: 72px; height: auto; max-height: min(38vh, 300px);
}
.teacher-standard-response-viewport {
  min-height: 120px; height: auto; max-height: min(58vh, 620px);
}
.teacher-response-zoom-stage {
  position: relative; min-width: 100%; max-width: none; overflow: visible;
}
.teacher-response-zoom-content {
  position: absolute; top: 0; left: 0; min-width: 0; width: 100%;
  padding: 10px 12px; box-sizing: border-box;
  transform-origin: top left; will-change: transform;
}
.teacher-student-answer {
  min-height: 60px; margin: 0; padding: 0; white-space: pre-wrap;
  overflow-wrap: anywhere; font: inherit; line-height: 1.65;
  background: transparent;
}
.teacher-student-ink-preview {
  display: block; width: 100%; height: auto; max-width: none;
  background: #fff;
}
.teacher-student-ink-content > .teacher-student-ink-preview,
.teacher-student-ink-content > .annot-wrap {
  width: calc(var(--teacher-student-ink-fit, 1) * 100%);
  margin-right: auto; margin-left: auto;
}
.teacher-student-response-viewport .annot-wrap {
  width: 100%; max-width: none;
}
.teacher-student-response-viewport .teacher-student-ink-content > .annot-wrap {
  width: calc(var(--teacher-student-ink-fit, 1) * 100%);
}
.teacher-student-response-viewport .annot-wrap img {
  display: block; width: 100%; height: auto; max-width: none;
}
.teacher-answer-images {
  display: grid; gap: 12px; width: 100%; min-width: 100%; padding: 2px 4px 8px;
  overflow: visible;
}
.teacher-answer-image-wrap {
  position: relative; width: 100%; max-width: none; cursor: crosshair;
  padding: 6px; border: 0; border-radius: 7px;
  overflow: visible;
  background: #fff; user-select: none;
}
.teacher-answer-image-wrap img {
  display: block; max-width: none; width: 100%; height: auto;
  pointer-events: none; border: 0;
}
.teacher-grade-marker {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  font-size: 28px; line-height: 1; font-weight: 800;
  cursor: pointer; filter: drop-shadow(0 1px 1px #fff);
}
.teacher-grading-dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) +
    var(--visual-viewport-bottom, 0px));
  display: flex; align-items: center; justify-content: center; gap: 8px;
  max-width: calc(100vw - 24px); flex-wrap: nowrap;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; box-shadow: 0 6px 24px rgba(15, 23, 42, .18);
  overflow: visible; white-space: nowrap;
  /* 0.11.3：整卡涂画画布 z-index:1 会盖过无层级的浮岛（positioned
     z-index:auto 按 0 层绘制），导致浮岛上能涂写；抬到与 exam-dock
     同级 90，浮岛及按钮不再响应涂写事件 */
  z-index: 90;
}
.teacher-grading-dock-spacer { width: 10px; }
.teacher-grading-readonly .teacher-grading-export-actions,
.teacher-grading-readonly .teacher-grading-student-switcher,
.teacher-grading-readonly .teacher-grading-saq-controls {
  display: none !important;
}
.teacher-grading-readonly .teacher-part-score-input {
  border-color: transparent; background: transparent; color: inherit;
  opacity: 1; width: 26px; padding-right: 0; padding-left: 0;
  appearance: textfield; -moz-appearance: textfield;
}
.teacher-grading-readonly .teacher-part-score-input::-webkit-inner-spin-button,
.teacher-grading-readonly .teacher-part-score-input::-webkit-outer-spin-button {
  margin: 0; appearance: none; -webkit-appearance: none;
}
.teacher-grading-readonly .teacher-part-score-wrap {
  gap: 3px;
}
.teacher-grading-readonly .teacher-part-score-wrap label {
  gap: 2px;
}
/* 0.11.2 浮岛分工：选择题时字母选项插槽（对错染色）放在翻页左侧，
   简答题时右侧显示标记/AI/保存控件组 */
.teacher-grading-options {
  position: relative; display: flex; align-items: center; gap: 8px;
}
.teacher-grading-options:empty { display: none; }
.teacher-grading-options .legacy-options { margin-top: 0; flex-wrap: nowrap; }
.teacher-grading-options .choice-part-options { margin: 0; }
.teacher-overview-option-row {
  display: inline-flex; align-items: center; gap: 6px;
}
.teacher-overview-option-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 34px;
  padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text);
}
.teacher-overview-option-pill.overview-option-correct {
  background: #16a34a; border-color: #16a34a; color: #fff;
}
.teacher-overview-option-count {
  min-width: 18px; padding: 1px 5px; border-radius: 999px;
  background: #e2e8f0; color: #64748b; font-size: 12px;
  font-variant-numeric: tabular-nums; text-align: center;
}
.teacher-overview-eye { flex: 0 0 auto; width: 34px; height: 34px; padding: 6px; }
.teacher-overview-eye svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.teacher-overview-option-menu {
  position: absolute; left: 0; bottom: calc(100% + 12px); z-index: 112;
  width: min(520px, calc(100vw - 24px)); max-height: min(52vh, 420px);
  overflow-y: auto; padding: 10px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; color: var(--text);
  box-shadow: 0 12px 36px rgba(15, 23, 42, .22); white-space: normal;
}
.teacher-overview-option-menu section + section {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.teacher-overview-option-menu h4 { margin: 0 0 7px; }
.teacher-overview-option-users {
  display: grid; grid-template-columns: 80px minmax(0, 1fr);
  gap: 9px; padding: 6px 5px; font-size: 13px;
}
.teacher-overview-option-users span { color: #475569; overflow-wrap: anywhere; }
.teacher-grading-student-switcher {
  position: relative; flex: 0 0 auto;
}
.teacher-grading-student-toggle {
  min-width: 108px; max-width: 160px; padding-right: 10px; padding-left: 10px;
  display: inline-flex;
  align-items: center; justify-content: center; gap: 7px; font-weight: 600;
}
.teacher-grading-student-toggle #teacher-grading-student {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.teacher-grading-student-chevron { color: var(--muted); font-size: 12px; }
.teacher-grading-student-menu {
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%); z-index: 110;
  width: min(390px, calc(100vw - 24px)); max-height: min(52vh, 420px);
  overflow-y: auto; padding: 7px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .2);
}
.teacher-grading-student-item {
  width: 100%; display: grid;
  grid-template-columns: minmax(120px, 1fr) 84px 64px;
  align-items: center; gap: 10px; padding: 9px 10px;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.teacher-grading-student-item:hover,
.teacher-grading-student-item.active { background: #eff6ff; }
.teacher-grading-student-item.active { color: var(--primary-2); }
.teacher-grading-lesson-return {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 5px; border-bottom: 1px solid var(--border);
  border-radius: 7px 7px 2px 2px; color: var(--primary-2);
}
.teacher-grading-lesson-return span {
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.teacher-grading-student-item:disabled {
  opacity: 1; color: var(--muted); cursor: default;
}
.teacher-student-username {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.teacher-student-score { color: var(--muted); text-align: right; }
.teacher-student-grade-status { font-size: 12px; text-align: right; }
.teacher-grading-student-item.graded .teacher-student-grade-status {
  color: #15803d; font-weight: 700;
}
.teacher-grading-student-item.not-graded .teacher-student-grade-status {
  color: #b45309; font-weight: 700;
}
.teacher-grading-student-empty { padding: 12px; text-align: center; }
.teacher-grading-unanswered {
  order: -1; flex: 0 0 auto; padding: 5px 9px; border-radius: 999px;
  background: #fef3c7; border: 1px solid #f59e0b; color: #92400e;
  font-weight: 700; white-space: nowrap;
}
.teacher-grading-saq-controls {
  display: inline-flex; align-items: center; gap: 8px;
}
.teacher-part-score-wrap {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.teacher-part-score-wrap label {
  display: inline-flex; align-items: center; gap: 5px;
}
.teacher-part-score-input {
  width: 58px; height: 32px; padding: 4px 7px; text-align: center;
}
.teacher-clear-part {
  height: 32px; min-height: 32px; padding-top: 0; padding-bottom: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.teacher-marker-control {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--muted);
}
.teacher-marker-control select { padding: 5px 7px; }
.teacher-marker-control input[type="color"] {
  width: 32px; height: 30px; padding: 2px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff;
}
.teacher-grading-dock > .btn,
.teacher-grading-student-toggle,
.teacher-grading-saq-controls > .btn,
.teacher-grading-dock .teacher-marker-control,
.teacher-grading-dock .teacher-marker-control select,
.teacher-grading-dock .teacher-marker-control input[type="color"] {
  height: 34px; box-sizing: border-box;
}

@media (max-width: 760px) {
  .teacher-gradebook-modal-body {
    width: calc(100vw - 16px); min-width: calc(100vw - 16px);
    height: 94vh; max-height: 94vh;
  }
  .teacher-review-layout { display: flex; flex-direction: column; overflow: auto; }
  .teacher-review-pane { flex: none; min-height: 280px; }
  .teacher-review-overview-pane {
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  #teacher-overview-content { max-height: 280px; }
  #teacher-gradebook-groups { overflow: visible; }
  .teacher-grading-saq-split { display: block; overflow-y: auto; }
  .teacher-grading-content.teacher-grading-saq-mode {
    padding-bottom: 0;
  }
  .teacher-grading-saq-split .saq-left,
  .teacher-grading-saq-split > .splitter { display: none; }
  .teacher-grading-answer-column {
    width: 100%; height: auto; overflow: visible; padding-left: 0;
  }
  .teacher-grading-topbar { flex-wrap: wrap; }
  .teacher-grading-export-actions { margin-left: auto; }
  .teacher-grading-content {
    padding: var(--focus-write-buffer-top) 0 100px;
  }
  .teacher-grading-content.teacher-grading-saq-mode { padding-top: 0; }
  .teacher-grading-dock { width: calc(100vw - 24px); flex-wrap: wrap; }
  .teacher-grading-dock-spacer { display: none; }
  .teacher-grading-part { padding: 10px 0 0; }
}

/* ---------- My tests 三栏 ---------- */
#page-tests { height: calc(100vh - 56px); overflow: hidden; padding: var(--page-island-gap); }
.tests-layout { display: flex; align-items: stretch; height: 100%; min-height: 0; }
.tests-col-title { margin: 0 0 10px; font-size: 16px; }
#tests-list-col {
  width: 25vw; min-width: 360px; flex-shrink: 0; overflow-y: auto; padding: 14px;
}
.tests-list-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.tests-filter-control { position: relative; flex: 1; min-width: 0; }
.tests-list-head select {
  min-width: 0; width: 100%; height: 40px; min-height: 40px;
  box-sizing: border-box; padding: 6px 8px;
}
.tests-teacher-filter {
  width: 100%; height: 40px; padding: 6px 31px 6px 10px;
  border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text); text-align: left;
  font: inherit; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: pointer;
}
.tests-teacher-filter::after {
  content: '⌄'; position: absolute; right: 11px; top: 8px;
  color: var(--muted); font-size: 18px; pointer-events: none;
}
.tests-teacher-filter-menu {
  position: fixed; z-index: 95;
  max-height: min(440px, 62vh); overflow-y: auto;
  padding: 6px; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; box-shadow: 0 10px 28px rgba(30, 41, 59, .16);
}
.tests-filter-option {
  display: block; width: 100%; min-height: 34px; padding: 7px 9px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--text); text-align: left; font: inherit; cursor: pointer;
}
.tests-filter-option:hover,
.tests-filter-option.active { background: #eef4ff; color: var(--primary); }
.tests-filter-option.class-option { padding-left: 25px; color: var(--muted); }
.tests-filter-option.class-option.active { color: var(--primary); }
.tests-filter-option.archived-option {
  margin-top: 5px; border-top: 1px solid var(--border); border-radius: 0;
}
.tests-list-head .btn {
  height: 40px; min-height: 40px; flex: 0 0 auto;
  box-sizing: border-box; white-space: nowrap;
}
#tests-edit-col {
  flex: 1; min-width: 300px; overflow: hidden; padding: 14px 14px 6px;
  display: flex; flex-direction: column;
}
#tests-edit-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
#tests-random-adjust {
  color: #c2410c; background: transparent; border-color: #fdba74;
}
#tests-random-adjust:hover { color: #9a3412; border-color: #f97316; }

/* My tests 随机组卷 */
.favorite-tag-cell { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; }
.question-tags { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.question-tag-list { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 100%; max-height: 108px; overflow: auto; }
.question-tag-list:empty { display: none; }
.question-tags .personal-tag-chip { flex: none; max-width: 100%; box-sizing: border-box; }
.personal-tag-chip { color: #1e40af; background: #eff6ff; border-radius: 4px; padding: 3px 6px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.question-tags-add { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 26px; border: 1px dashed var(--border); border-radius: 5px; background: transparent; color: var(--muted); padding: 3px 6px; cursor: pointer; }
.col-favorite:hover .question-tags-add, .question-tags-add:focus-visible { color: var(--primary-2); border-color: var(--primary-2); background: #eff6ff; }
.personal-tag-menu { position: fixed; z-index: 1300; box-sizing: border-box; width: min(290px, calc(100vw - 16px)); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px #0f172a20; font-size: 14px; }
.personal-tag-menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.personal-tag-menu button { cursor: pointer; }
.tag-create-toggle { border: 0; background: transparent; color: var(--muted); font-size: 24px; width: 28px; height: 28px; padding: 0; }
.tag-create-form { display: flex; border: 1px solid var(--primary); border-radius: 5px; margin-bottom: 8px; }
.tag-create-form input { min-width: 0; flex: 1; width: 0; border: 0; padding: 7px; background: transparent; }
.tag-create-form button { border: 0; background: transparent; color: var(--primary); width: 32px; }
.personal-tag-options { min-height: 0; overflow-y: auto; }
.personal-tag-options label, #original-classes label { display: flex; align-items: center; gap: 8px; padding: 9px 3px; cursor: pointer; }
.personal-tag-options label:hover { background: #f8fafc; }
.personal-tag-options input, #original-classes input, .original-exclusion input { width: 15px; height: 15px; min-height: 0; flex: none; margin: 0; accent-color: var(--primary); }
.personal-tag-options svg { width: 19px; height: 19px; flex: none; fill: #1677ff; }
.personal-tag-options span { overflow-wrap: anywhere; }
.personal-tag-menu .error:empty { display: none; }
.original-paper-button { flex: 0 0 auto; }
.original-paper-modal-body { width: min(860px, 94vw); height: min(760px, 90dvh); max-height: 90dvh; box-sizing: border-box; padding: 20px; display: flex; flex-direction: column; overflow: hidden; }
.original-paper-filters { flex: none; }
.original-paper-filters .randomised-test-grid { gap: 10px; margin-bottom: 10px; }
.original-exclusion { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.original-exclusion > label { display: flex; gap: 6px; align-items: center; }
.original-exclusion .msel { min-width: 100px; }
#original-classes { width: min(340px, 80vw); max-height: 230px; overflow-y: auto; z-index: 160; padding: 8px; }
.original-paper-hint { font-size: 12px; margin: 12px 0; }
.original-paper-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.original-paper-card { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.original-paper-card:hover { border-color: #93c5fd; background: #f8fbff; }
.original-paper-card:has(input:checked) { background: #eff6ff; border-color: var(--primary); }
.original-paper-card > input { width: 16px; height: 16px; min-height: 0; accent-color: var(--primary); flex: none; }
.original-paper-card > div { flex: 1; min-width: 0; }
.original-paper-card strong { display: block; font-size: 15px; }
.original-paper-card span { display: block; font-size: 12px; margin-top: 5px; overflow-wrap: anywhere; }
.original-paper-card > b { font-size: 13px; white-space: nowrap; color: var(--primary); }
.original-empty { margin: auto; padding: 30px 0; text-align: center; }
.original-empty span { display: block; font-size: 13px; margin-top: 8px; }
#original-paper-error:empty { display: none; }
.original-paper-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 6px; flex: none; }
.original-paper-footer > div { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.original-paper-footer .btn { white-space: nowrap; }
@media (max-width: 600px) {
  .original-paper-modal-body { padding: 12px; }
  .original-paper-filters .randomised-primary-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .original-paper-footer { gap: 4px; }
  .original-paper-footer > div { gap: 4px; }
  .original-paper-footer .btn { padding: 6px; font-size: 12px; }
}

.randomised-test-modal-body {
  width: min(900px, 94vw); max-height: 90vh; max-height: 90dvh;
  padding: 20px; overflow: hidden; box-sizing: border-box;
  display: flex; flex-direction: column;
}
.randomised-test-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.randomised-test-head h2 { margin: 0; }
.randomised-test-scroll {
  min-height: 0; overflow-x: hidden; overflow-y: auto;
  padding-right: 4px; overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.randomised-title-field {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px; color: var(--muted); font-size: 13px;
}
.randomised-title-field input {
  width: 100%; height: 40px; min-height: 40px; box-sizing: border-box;
}
.randomised-test-grid {
  display: grid; gap: 12px; margin-bottom: 16px;
}
.randomised-primary-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.randomised-scope-row {
  grid-template-columns: 126px repeat(3, minmax(0, 1fr));
}
.randomised-test-grid > label,
.randomised-menu-field,
.randomised-group-field {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0; color: var(--muted); font-size: 13px;
}
.randomised-test-grid > label > select,
.randomised-year-range input,
.randomised-group-field > select,
.randomised-group-field > input {
  width: 100%; height: 40px; min-height: 40px; box-sizing: border-box;
}
.randomised-year-range > span {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 7px;
}
.randomised-year-range input { padding: 0 5px; appearance: textfield; -moz-appearance: textfield; }
.randomised-year-range input::-webkit-inner-spin-button { -webkit-appearance: none; }
.randomised-scope-row .msel-btn { width: 100%; max-width: none; height: 40px; min-height: 40px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; text-align: left; }
.randomised-msel { width: 100%; min-width: 0; }
.randomised-msel .msel-btn {
  width: 100%; height: 40px; min-height: 40px; max-width: none;
  box-sizing: border-box; text-align: left;
}
.randomised-msel .msel-panel {
  width: min(320px, calc(100vw - 48px)); min-width: 100%;
  max-height: 350px; z-index: 130;
}
.randomised-msel .msel-panel input[type="radio"],
.randomised-msel .msel-panel input[type="checkbox"] {
  width: auto; flex: 0 0 auto;
}
.randomised-scope-row > .randomised-menu-field:last-child .msel-panel {
  right: 0; left: auto;
}
.randomised-groups-section {
  padding-top: 4px; border-top: 1px solid var(--border);
}
.randomised-groups-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 10px 0;
}
.randomised-groups-title-main {
  display: flex; align-items: center; gap: 18px; min-width: 0;
}
.randomised-groups-title h3 { margin: 0; font-size: 15px; }
.randomised-exclude-wrap {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--text); font-size: 13px; white-space: nowrap;
}
.randomised-exclude-check {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.randomised-exclude-check input,
.randomised-class-msel .msel-panel input[type="checkbox"] {
  width: auto; flex: 0 0 auto;
}
.randomised-class-msel { width: auto; min-width: 104px; }
.randomised-class-msel .msel-btn {
  width: auto; min-width: 104px; max-width: 190px; height: 32px;
  min-height: 32px; padding: 5px 28px 5px 10px; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.randomised-class-msel .msel-panel {
  left: 0; right: auto; width: max-content; min-width: 190px;
  max-width: 300px; max-height: 260px; z-index: 140;
}
.randomised-exclude-wrap.exclusion-disabled > span:last-child {
  color: var(--muted);
}
#randomised-add-group {
  width: 34px; height: 32px; padding: 0; font-size: 20px; line-height: 1;
}
.randomised-groups { display: flex; flex-direction: column; gap: 9px; }
.randomised-group-row {
  display: grid; grid-template-columns: 30px minmax(140px, 1fr)
    minmax(180px, 1fr) 34px;
  align-items: end; gap: 10px; padding: 10px;
  border: 1px solid var(--border); border-radius: 9px; background: #f8fafc;
}
.randomised-group-number {
  align-self: center; text-align: center; color: var(--muted); font-weight: 700;
}
.randomised-group-remove { width: 34px; height: 38px; padding: 0; }
.randomised-group-remove.placeholder { visibility: hidden; }
.randomised-test-actions {
  flex: 0 0 auto; display: flex; justify-content: flex-end;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  background: #fff;
}
.randomised-test-actions .btn { min-width: 110px; }

@media (max-width: 760px) {
  .randomised-test-modal-body {
    width: 96vw; max-height: 92vh; max-height: 92dvh;
  }
  .randomised-primary-row { grid-template-columns: 1fr; }
  .randomised-scope-row { grid-template-columns: 100px repeat(3, minmax(0, 1fr)); gap: 6px; }
  .randomised-msel .msel-panel { width: 100%; }
  .randomised-groups-title-main { align-items: flex-start; flex-direction: column; }
  .randomised-exclude-wrap { flex-wrap: wrap; }
}
#tests-preview-col {
  width: 520px; flex-shrink: 0; display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden;
  opacity: 1; transform: translateX(0);
  transition: width .28s ease, opacity .2s ease, transform .28s ease;
}
#tests-preview-col > * { min-width: 300px; }
#splitter-tests-preview {
  transition: width .28s ease, opacity .18s ease;
}
.tests-layout.preview-hidden #tests-preview-col {
  width: 0 !important; opacity: 0; transform: translateX(48px);
  pointer-events: none;
}
.tests-layout.preview-hidden #splitter-tests-preview {
  width: 0; opacity: 0; pointer-events: none; overflow: hidden;
}
.tests-preview-card {
  flex: 1; min-height: 140px; display: flex; flex-direction: column;
  padding: 14px; overflow: hidden;
}
.tests-preview-card iframe {
  flex: 1; width: 100%; min-height: 80px; margin-top: 10px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.tests-preview-card .preview-placeholder { padding: 30px 10px; }
.vsplitter { height: 7px; flex-shrink: 0; cursor: row-resize; position: relative; }
.vsplitter::after {
  content: ''; position: absolute; top: 3px; left: 0; right: 0;
  height: 1px; background: var(--border);
}
.vsplitter:hover::after, .vsplitter.dragging::after {
  height: 3px; top: 2px; background: var(--primary-2);
}

/* 左栏试卷列表 */
.tests-list { list-style: none; margin: 0; padding: 0; }
.tests-list li {
  padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; cursor: pointer;
}
.tests-list li:hover { border-color: var(--primary-2); }
.tests-list li.active {
  border-color: var(--primary-2); background: #eaf1fd;
}
.test-card-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
}
.test-row-main {
  display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1;
}
.test-title {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-progress {
  background: #dbeafe; color: #1d4ed8; font-size: 11px; border-radius: 4px;
  padding: 1px 6px; flex-shrink: 0;
}
.test-row-meta { font-size: 12px; margin: 4px 0; }
.test-course-meta {
  font-size: 12px; margin: 4px 0 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.test-row-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; row-gap: 6px;
}
.test-actions {
  display: inline-flex; align-items: center; gap: 6px;
  flex-wrap: wrap; margin-left: auto;
}
.badge-assigned {
  background: hsl(var(--assignment-hue) 78% 92%);
  color: hsl(var(--assignment-hue) 62% 28%);
  border: 1px solid hsl(var(--assignment-hue) 55% 68%);
  font-size: 11px; border-radius: 5px; padding: 2px 6px;
  flex-shrink: 0; cursor: pointer; white-space: nowrap;
}
.badge-assigned.published {
  --assignment-hue: 142 !important;
  background: #dcfce7; border-color: #86efac; color: #15803d;
}
.badge-publish-pending {
  display: inline-block; margin-right: 5px; color: #dc2626;
  font-style: normal; font-weight: 800;
}
.test-assigned-badges {
  display: flex; justify-content: flex-end; gap: 4px; flex-wrap: wrap;
  max-width: 48%; margin-left: auto;
}
.assign-edit-subtitle { font-size: 14px; margin: 16px 0 8px; }
.assign-edit-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.assign-edit-name { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.assignment-time-action:disabled {
  background: #e5e7eb; color: #9ca3af; cursor: not-allowed;
}
.assignment-time-action:not(:disabled) { background: #fff; color: var(--text); }
.assignment-exam-mode-option { grid-column: 1 / -1; }
.assignment-exam-mode-check {
  display: flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 8px 10px; border: 1px solid #f3c86a; border-radius: 7px;
  background: #fffaf0; color: #7c4a03; font-weight: 600;
}
.assignment-exam-mode-check input { width: auto; margin: 0; }
.assignment-exam-mode-check.is-active {
  background: #fff4d6; border-color: #d99a16;
}
.assignment-exam-mode-option select:disabled,
.assignment-exam-mode-option input:disabled { cursor: not-allowed; }
.assign-edit-time { width: 110px; }
.assign-edit-time-action { min-width: 172px; }
/* 列表只保留双击改名；布置弹窗标题另保留明确的铅笔入口。 */
.assign-modal-title-row { display: flex; align-items: center; gap: 6px; }
.assign-modal-title { min-width: 0; overflow-wrap: anywhere; }
.assign-title-edit {
  border: none; background: none; cursor: pointer; font-size: 13px;
  padding: 0 2px; opacity: 0.6; flex-shrink: 0;
}
.assign-title-edit:hover { opacity: 1; }
.assign-modal-title-input {
  min-width: 220px; max-width: min(480px, 60vw); font: inherit;
  border: 1px solid var(--primary-2); border-radius: 5px; padding: 2px 6px;
}
.test-title-input {
  flex: 1; min-width: 0; font: inherit; font-weight: 600;
  border: 1px solid var(--primary-2); border-radius: 4px; padding: 1px 4px;
}

/* 中栏调整试卷 */
.tests-edit-placeholder { padding: 40px 10px; text-align: center; }
.tests-exam-mode-notice {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 14px;
  padding: 12px 14px; border: 1px solid #e5b84d; border-radius: 8px;
  background: #fff8df; color: #704300;
}
.tests-exam-mode-notice strong { flex: none; }
.tests-edit-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.tests-edit-head .tests-col-title { margin: 0; }
.tests-sort-controls {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px; flex-wrap: wrap;
}
.tests-sort-controls .btn.active {
  color: var(--primary); border-color: var(--primary);
  background: #eff6ff;
}
#tests-question-list {
  list-style: none; margin: 12px 0 0; padding: 0 0 12px;
  flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto;
}
#tests-question-list li {
  display: flex; align-items: center; gap: 8px;
  height: 69px; min-height: 69px;
  padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px;
}
#tests-question-list li.dragging { opacity: 0.4; }
#tests-question-list li.drag-over { border-top: 2px solid var(--primary-2); }
#tests-question-list .drag-handle { cursor: grab; color: var(--muted); }
#tests-question-list .pl-title {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
#tests-question-list .pl-topic {
  flex: 1 1 auto; min-width: 0; max-width: none; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--muted);
}
#tests-question-list .thumb { width: 90px; height: 56px; max-height: 56px; object-fit: contain; flex: 0 0 90px; }
#tests-question-list li button { padding: 1px 6px; font-size: 12px; }
#tests-error:empty { min-height: 0; margin: 0; }
.tests-actions {
  position: sticky; bottom: 0; z-index: 3; flex: 0 0 auto;
  display: flex; gap: 10px; margin-top: auto; padding: 10px 0 0;
  border-top: 0; background: #fff;
  align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.tests-edit-actions,
.tests-run-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tests-run-actions { margin-left: auto; }
.tests-edit-actions .icon-btn {
  width: 38px; height: 38px; padding: 7px; display: inline-flex;
  align-items: center; justify-content: center;
}
.tests-edit-actions .icon-btn svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
#tests-delete {
  color: #991b1b; border-color: rgba(153, 27, 27, .28);
}
#tests-delete:hover {
  color: #7f1d1d; border-color: #991b1b; background: #fef2f2;
}
.export-modal-body { width: min(680px, 94vw); }
.export-options-grid { align-items: end; }
.export-check {
  min-height: 42px; flex-direction: row !important; align-items: center;
  align-self: end; color: var(--text) !important;
}
.export-check input { width: auto !important; }
.export-supplement-hint { margin: 12px 0 0; font-size: 12px; }
.export-modal-actions { flex-wrap: wrap; }

/* ---------- 在线测评 ---------- */
#page-exam { max-width: 1500px; margin: 0 auto; padding-bottom: 0; }
/* 测评期间禁止窗口本身继续滚动或发生 Safari 橡皮筋回弹。题图、全览和
   作答栏仍使用各自的滚动容器；外层固定为白色后，滚到内部边界也不会
   从题卡下方拉出会不断变大的灰色 body 背景。 */
body.exam-page-active {
  width: 100%; height: 100vh; height: 100dvh;
  overflow: hidden; overscroll-behavior: none; background: #fff;
}
body.exam-page-active #view-main {
  position: fixed; inset: 0; width: 100%; height: 100%; min-height: 0;
  overflow: hidden; overscroll-behavior: none; background: #fff;
}
body.exam-page-active #page-exam {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0; overflow: hidden; background: #fff;
}
body.exam-page-active #page-exam > .exam-topbar,
body.exam-page-active #page-exam > #exam-timer-panel {
  flex: 0 0 auto;
}
body.exam-page-active #exam-question-card:not(.hidden) {
  flex: 1 1 auto; min-height: 0; margin-bottom: 0;
}
body.exam-page-active #exam-question-card.mcq-exam-card {
  min-height: 0; overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; scrollbar-gutter: stable;
}
body.exam-page-active #exam-result:not(.hidden) {
  flex: 1 1 auto; min-height: 0; overflow: auto;
}
/* 顶栏合并为一行：返回 + 题号导航（占满中间）+ 全览/答题区/计时。
   与批改页统一为 18px 的题目区间距。 */
.exam-topbar {
  display: flex; align-items: center;
  padding: 6px 8px; margin-bottom: 4px; gap: 7px;
}
#view-main.exam-focus-mode > .topbar { display: none; }
.exam-resume-status { display: none; padding: 40px 20px; text-align: center; }
body.exam-account-locked #view-main:not(.exam-focus-mode) > .topbar,
body.exam-account-locked #view-main:not(.exam-focus-mode) > .page,
body.exam-account-locked #compose-panel { display: none !important; }
body.exam-account-locked #view-main:not(.exam-focus-mode) > .exam-resume-status {
  display: block;
}
#view-main.exam-focus-mode #page-exam,
#view-main.exam-focus-mode #page-teacher-grading {
  height: 100vh; padding-top: 0;
}
#view-main.exam-focus-mode #page-exam,
#view-main.exam-focus-mode #page-teacher-grading {
  width: 100%; max-width: none; margin: 0; padding: 0;
}
#view-main.exam-focus-mode #page-exam > .exam-topbar,
#view-main.exam-focus-mode .teacher-grading-topbar {
  position: sticky; top: 0; z-index: 80;
  border-radius: 0 0 var(--radius) var(--radius);
}
.exam-topbar #exam-back { flex-shrink: 0; }
.exam-topbar #exam-overview-toggle,
.exam-topbar #exam-answer-lines-toggle {
  flex: none; white-space: nowrap;
}
.exam-timer-area { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.exam-topbar #exam-submit { flex-shrink: 0; }
.exam-topbar .btn,
.exam-topbar .favorite-star {
  height: 38px; min-height: 38px; box-sizing: border-box;
}
.exam-topbar .btn { padding-right: 10px; padding-left: 10px; }
.exam-topbar .view-zoom-controls { gap: 2px; }
.exam-topbar .view-zoom-controls .btn {
  width: 38px; min-width: 38px; height: 38px; min-height: 38px;
  padding: 0; font-size: 19px;
}
.exam-topbar .favorite-star {
  position: relative; top: 1px; width: 38px; min-width: 38px;
}
/* Bare utility icons; retain the same hit area and keyboard focus indicator. */
.exam-topbar :is(#exam-overview-toggle, #teacher-grading-overview-toggle,
  #exam-answer-lines-toggle, #exam-timer-setup-btn,
  #exam-zoom-in, #exam-zoom-out, #teacher-grading-zoom-in, #teacher-grading-zoom-out) {
  border-color: transparent; background: transparent; box-shadow: none;
}
/* Measurement toolbar: icon-only at rest, readable progress while busy. */
.exam-topbar :is(#exam-timer-setup-btn, #exam-submit, #exam-answer-lines-toggle, #exam-result-export, #exam-result-annotation-export, #exam-grade-saq, #exam-overview-toggle, #teacher-grading-overview-toggle) {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; min-width: 38px; flex-shrink: 0; padding: 0;
  font-size: 0; gap: 0; line-height: 1;
}
.exam-topbar :is(#exam-timer-setup-btn, #exam-submit, #exam-answer-lines-toggle, #exam-result-export, #exam-result-annotation-export, #exam-grade-saq, #exam-overview-toggle, #teacher-grading-overview-toggle)::before {
  content: ""; display: block; flex: 0 0 var(--exam-icon-size, 24px);
  width: var(--exam-icon-size, 24px); height: var(--exam-icon-size, 24px);
  background-color: currentColor;
  -webkit-mask: var(--exam-control-icon) center / contain no-repeat;
  mask: var(--exam-control-icon) center / contain no-repeat;
}
#exam-overview-toggle, #teacher-grading-overview-toggle {
  --exam-control-icon: url("/static/icons/overview-close.png");
}
#exam-overview-toggle[data-collapsed="1"], #teacher-grading-overview-toggle[data-collapsed="1"] {
  --exam-control-icon: url("/static/icons/overview-open.png");
}
#exam-overview-toggle::before, #teacher-grading-overview-toggle::before { transform: rotate(180deg); }
#exam-timer-setup-btn { --exam-control-icon: url('/static/icons/stopwatch.png'); }
#exam-submit { --exam-control-icon: url('/static/icons/submit-paper.png'); }
#exam-submit::before { transform: translateY(1px); }
#exam-answer-lines-toggle { --exam-control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%204h16M4%2020h16M9%207l3%203%203-3M9%2017l3-3%203%203%22%2F%3E%3C%2Fsvg%3E"); }
#exam-result-export { --exam-control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%203v12m-4-4%204%204%204-4M4%2016v5h16v-5%22%2F%3E%3C%2Fsvg%3E"); }
#exam-result-annotation-export { --exam-control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m4%2016%2010-10%204%204L8%2020H4v-4Zm8-8%204%204M16%204l2-2%204%204-2%202%22%2F%3E%3C%2Fsvg%3E"); }
#exam-grade-saq { --exam-control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m12%203%202.5%206.5L21%2012l-6.5%202.5L12%2021l-2.5-6.5L3%2012l6.5-2.5L12%203Z%22%2F%3E%3C%2Fsvg%3E"); }

#exam-answer-lines-toggle { --exam-control-icon: url('/static/icons/fold-answer.svg'); }
#exam-answer-lines-toggle[data-collapsed="1"] { --exam-control-icon: url('/static/icons/unfold-answer.svg'); }
/* Match the visible artwork, compensating for each asset's transparent margins. */
#exam-submit { --exam-icon-size: 28px; }
#exam-answer-lines-toggle, #exam-result-export,
#exam-result-annotation-export, #exam-grade-saq { --exam-icon-size: 26px; }
.exam-topbar .favorite-star::before { width: 24px; height: 24px; }
.exam-topbar .view-zoom-controls .btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1; font-size: 0;
}
/* Shorten the previous minus by 10%; both signs now share that arm length. */
.exam-topbar .view-zoom-controls .btn::before {
  content: ''; display: block; width: 14.85px; height: 14.85px;
  background: linear-gradient(currentColor, currentColor) center / 14.85px 1.9px no-repeat;
}
.exam-topbar :is(#exam-zoom-in, #teacher-grading-zoom-in)::before {
  background: linear-gradient(currentColor, currentColor) center / 14.85px 1.9px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.9px 14.85px no-repeat;
}
.exam-topbar #exam-current-favorite { top: 0; align-self: center; }
.exam-topbar #exam-timer-setup-btn.timer-running {
  width: auto; min-width: 88px; padding: 0 8px;
  font-size: 18.4px; font-weight: 500; color: #007aff;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  transition: none;
}
#exam-timer-setup-btn.timer-running::before { display: none; }
.exam-topbar :is(#exam-submit, #exam-grade-saq, #exam-answer-lines-toggle):disabled {
  width: auto; padding: 0 10px; font-size: 12px; gap: 6px;
}
#exam-timer-setup-btn.timer-running.danger {
  color: var(--danger); border-color: rgba(220, 38, 38, .45);
  background: #fff5f5; font-weight: 700;
}
#exam-timer-panel {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 12px;
}
#exam-timer-panel .field-label { margin: 0 0 4px; }
#exam-timer-panel input { width: 110px; }
.exam-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.exam-nav .nav-box {
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text);
}
.exam-nav .nav-box.answered { background: #dcfce7; border-color: #15803d; color: #15803d; }
.exam-nav .nav-box.current { outline: 2px solid var(--primary-2); font-weight: 700; }
.exam-nav .nav-box.favorited-question {
  border-width: 1.5px; border-color: #f2b51d !important;
}
/* 吸底悬浮条：翻题 + 选择题字母选项 + 提交，始终居中可见。
   0.10.11 起 #exam-dock 挂在 body 层（见 index.html），fixed 的包含块恒为视口，
   不受任何祖先 transform/filter/contain 影响。 */
.exam-dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) +
    var(--visual-viewport-bottom, 0px));
  display: flex; align-items: center; justify-content: center; gap: 8px;
  max-width: calc(100vw - 24px); flex-wrap: nowrap; overflow-x: auto;
  /* 0.11.2：选项多时 flex 收缩会把「← 上一题」压成两行，
     按钮一律禁止收缩与文字换行，装不下改为浮岛横向滚动 */
  white-space: nowrap;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.18);
  z-index: 90;
}
.exam-dock .btn { flex-shrink: 0; }
.annot-grip.exam-dock-grip {
  align-self: stretch; flex: 0 0 18px; width: 18px; min-height: 32px;
  flex-direction: column; align-items: center; padding: 0 5px 0 0;
  border-right: 0; box-sizing: border-box;
}
.annot-grip.exam-dock-grip:focus-visible {
  outline: 2px solid var(--primary-2); outline-offset: 2px;
}
.exam-dock-options { display: flex; align-items: center; gap: 8px; }
.exam-dock-options:empty { display: none; }
.exam-dock-options .legacy-options { margin-top: 0; }
.exam-dock .choice-part-options { flex-wrap: nowrap; margin: 0; }
.exam-images img {
  display: block; max-width: 100%; margin: 0 auto 8px;
  border: 0; border-radius: 0; background: transparent;
}
/* 测评选择题占满剩余视口；图片仍按比例留出约 6% 呼吸空间。 */
#exam-question-card { padding-top: var(--focus-write-buffer-top); }
#page-exam.saq-exam-mode > .exam-topbar { margin-bottom: 0; }
#exam-question-card.saq-exam-card {
  width: 100%; min-height: 0; padding: 0; border-radius: 0;
  box-shadow: none; overflow: hidden;
}
#exam-question-card.saq-exam-card .saq-split {
  height: var(--exam-saq-workspace-height, calc(100vh - 54px));
  min-height: 0;
}
#exam-question-card.mcq-exam-card {
  width: 100%; min-height: calc(100vh - 122px);
  padding: var(--focus-write-buffer-top) 18px 0;
  border-radius: 0; box-shadow: none;
}
.mcq-exam-card #exam-question-body,
.mcq-exam-card .choice-part-block {
  min-height: calc(100vh - 181px); display: flex; flex-direction: column;
}
.mcq-exam-card .exam-images-mcq {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; overflow: auto;
}
.mcq-canvas-bottom-buffer {
  position: relative; flex: 0 0 auto;
  min-height: var(--mcq-dock-bottom-buffer, var(--exam-dock-clearance));
  width: 100%; background: #fff; pointer-events: none;
}
.exam-images-mcq.exam-fit-pending .annot-wrap { visibility: hidden; }
.exam-images-mcq img { max-width: none; }
.option-list { margin-top: 10px; }
.option-card {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  margin-bottom: 8px; background: #fff;
}
.option-card:hover { border-color: var(--primary-2); }
.option-card.selected {
  border-color: var(--primary-2); background: #eff6ff;
  outline: 2px solid rgba(37, 99, 235, 0.35);
}
.option-letter {
  flex-shrink: 0; width: 28px; height: 28px; line-height: 28px; text-align: center;
  border-radius: 50%; background: #eef2f8; font-weight: 700;
}
.option-card.selected .option-letter { background: var(--primary-2); color: #fff; }
.option-images img { display: block; max-width: 100%; height: auto; }
.legacy-options { display: flex; gap: 8px; margin-top: 10px; }
.legacy-options .btn { min-width: 48px; }
.legacy-options .btn.selected {
  background: var(--primary-2); border-color: var(--primary-2); color: #fff;
}
.choice-parts { display: grid; gap: 22px; }
.choice-part-block { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.choice-part-block:last-child { padding-bottom: 0; border-bottom: 0; }
.choice-part-block .exam-images-mcq .annot-wrap { max-width: none; }
.choice-part-options { justify-content: center; flex-wrap: wrap; }
.choice-part-options .btn { min-width: 64px; }
.part-block { margin-top: 14px; }
/* 小题标识只保留作答框旁的不显眼小字（截图本身已含小题号） */
.part-tag { font-size: 12px; color: var(--muted); margin-right: 6px; }
.part-answer-head {
  position: relative; z-index: 2; display: flex; align-items: center;
  gap: 6px; min-height: 30px; margin: 2px 0 4px;
}
.part-answer-head .part-tag {
  margin-right: 2px; color: var(--text); font-size: 17px; font-weight: 650;
}
.part-answer-head .part-marks { font-size: 15px; font-weight: 500; }
.answer-font-controls { display: inline-flex; align-items: center; gap: 3px; }
.answer-font-control {
  width: 27px; height: 27px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; font-size: 19px;
  line-height: 1; border-radius: 6px;
}
.exam-marks { font-size: 13px; margin-bottom: 6px; }
/* 小问层级（0.7.0 part_tree）：子级（罗马数字级）缩进；末级小问分数
   标在题号右侧（如 (c)(i) [3 分]） */
.part-depth-1 { margin-left: 22px; }
.part-marks { font-size: 12px; font-weight: 400; }
.practice-part-group { margin-top: 14px; }
.practice-part-group img { display: block; max-width: 100%; margin-bottom: 8px; }
.practice-part-head { margin-bottom: 2px; }
#view-parts .view-part { margin-bottom: 10px; }
#view-parts .view-part img {
  display: block; max-width: 100%; margin: 4px 0;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.part-block img {
  display: block; max-width: 100%; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.part-block textarea, .exam-text-answer {
  width: 100%; resize: vertical; font: inherit; line-height: 1.6;
  border: 1px solid var(--border); border-radius: 6px; padding: 10px;
  margin-top: 4px;
}

/* 简答题左右分栏：左栏整题图（可拖宽/缩放），右栏小问作答 */
.saq-split { display: flex; align-items: stretch; min-height: 200px; }
.saq-exam-card .saq-split { --saq-question-image-width: 90%; }
.saq-exam-card .saq-split.saq-collapsed {
  --saq-question-image-width: 70%;
}
/* 全览开关行（0.7.1）：左上角「关闭/打开全览」+ 总分 */
.saq-overview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.saq-overview-head .exam-marks { margin-bottom: 0; }
.saq-overview-toggle { flex: none; }
.saq-overview-marks {
  position: absolute; top: 8px; left: 12px; z-index: 5;
  padding: 4px 8px; border-radius: 6px;
  background: rgba(255, 255, 255, .92); color: var(--muted);
  font-size: 13px; font-weight: 650; line-height: 1.2;
  pointer-events: none;
}
/* 收起全览：左栏与分隔条隐藏，右侧答题区占据全部空间 */
.saq-split.saq-collapsed .saq-left,
.saq-split.saq-collapsed .splitter { display: none; }
/* 左栏加宽并 sticky 跟随滚动，方便对照整题作答 */
.saq-left {
  width: 55%; flex-shrink: 0; min-width: 160px;
  position: sticky; top: 12px; align-self: flex-start;
}
.saq-zoom-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.saq-zoom-label { font-size: 12px; color: var(--muted); }
/* 左栏题目预览与屏幕可视区域同高（sticky 定位后铺满视口），内部滚动 */
.saq-left-images { height: calc(100vh - 64px); overflow: auto; overscroll-behavior: contain; }
.saq-exam-card .saq-left,
.saq-exam-card .saq-left-images { height: 100%; min-height: 0; }
.saq-exam-card .saq-left-images {
  /* 缓冲留白属于可滚动、可涂写的画板本身，而不是卡片外层：题图缩放
     与平移时可使用这一区域，区域画布也会完整覆盖四周留白。 */
  padding: calc(var(--focus-write-buffer-top) + 15px) 10px 10px;
  box-sizing: border-box;
}
.saq-left-images img {
  display: block; margin: 0 0 8px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.saq-left-images.teacher-grading-overview-images img {
  border: 0; border-radius: 0;
}
.saq-split .splitter {
  align-self: stretch; z-index: 3; touch-action: none;
}
.saq-split .splitter::before {
  content: ''; position: absolute; top: 0; bottom: 0;
  left: -10px; right: -10px; z-index: 2; touch-action: none;
}
/* 右栏作答区同样限高自滚动；滚轮走滚动链：先滚区域、到底/到顶后
   交给整页（0.7.1 起，JS chainScrollWheel 手动转发）
   （.saq-split 前缀提高优先级，防 .annot-region 的 position:relative
   覆盖 sticky） */
.saq-split .saq-right {
  flex: 1; min-width: 0; padding-left: 12px;
  position: sticky; top: 12px; align-self: flex-start;
  /* 右栏自身滚动，#page-exam 的 padding-bottom 对它无效；若仍铺到视口
     底部，最后一道小题会被 fixed 的翻题浮岛盖住。直接把滚动区下沿
     收到浮岛上方，并同步避开移动端虚拟键盘。 */
  max-height: calc(100vh - 24px - var(--exam-dock-clearance) -
    env(safe-area-inset-bottom, 0px) - var(--visual-viewport-bottom, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-bottom: 12px;
}
.saq-exam-card .saq-right {
  --saq-question-left-inset: 7.5px;
  --saq-depth-one-question-left-inset: 24px;
  --saq-answer-center-axis: 47.5%;
  --saq-answer-box-width: 80%;
  --saq-answer-box-height: 132px;
  height: 100%; max-height: none;
  padding: 0;
  box-sizing: border-box;
  overflow-anchor: none;
  scroll-padding-bottom: calc(var(--exam-dock-clearance) + 12px);
}
.saq-exam-card .saq-right textarea {
  font-size: 16px;
  max-width: 80%;
}
.saq-right-zoom-stage {
  position: relative; min-width: 100%; max-width: none; overflow: visible;
}
.saq-right-content {
  position: absolute; top: 0; left: 0; min-width: 0; width: 100%;
  padding: 0;
  box-sizing: border-box; transform-origin: top left;
  overflow-anchor: none;
}
.part-answer-zone {
  position: relative; box-sizing: border-box;
  padding: 0 10px 0 var(--saq-question-left-inset);
  overflow: visible;
}
.part-answer-zone:first-child {
  padding-top: max(20px, var(--focus-write-buffer-top));
}
.saq-exam-card .part-answer-zone + .part-answer-zone {
  /* 原本下一小题自身有 14px 顶距；再加入 28px 可书写缓冲区，
     使答题框到下一小题的总距离达到原来的三倍。 */
  padding-top: 28px;
}
.saq-answer-bottom-buffer {
  position: relative; box-sizing: border-box;
  min-height: calc(var(--exam-dock-clearance) + 10px +
    env(safe-area-inset-bottom, 0px));
  background: #fff;
}
.saq-right .part-block:first-child { margin-top: 0; }
.saq-right .exam-text-answer { margin-top: 0; }
/* 同一道简答题内的题号栏和答题框使用同一套尺寸。JS 会在虚线识别
   完成后把它们精确平移到题内统一的左右边界；识别前或识别失败时，
   这里提供统一居中的稳定兜底。 */
.saq-exam-card .saq-right .part-answer-head,
.saq-exam-card .saq-right .answer-input-shell {
  margin-left: 0;
  margin-right: 0;
  position: relative;
  left: var(--saq-answer-center-axis);
  transform: translateX(-50%);
  width: var(--saq-answer-box-width);
}
.answer-input-shell {
  position: relative; z-index: 2;
}
.saq-exam-card .saq-right .answer-input-shell textarea {
  display: block; width: 100%; max-width: none;
  height: var(--saq-answer-box-height);
  min-height: var(--saq-answer-box-height);
  max-height: var(--saq-answer-box-height);
  resize: none;
  margin: 0; box-sizing: border-box;
  left: auto; transform: none;
}
.ink-answer-textarea:disabled {
  color: transparent; background: #e5e7eb; opacity: 1;
  -webkit-text-fill-color: transparent;
}
.ink-answer-status {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; font-weight: 700; pointer-events: none;
}
.answer-ink-toggle {
  min-width: 92px; color: #1e3a5f;
}
.answer-space-add {
  color: #1e3a5f; white-space: nowrap;
}
.answer-extra-space {
  position: relative; z-index: 0; width: 100%;
  min-height: 0; background: #fff;
}
.answer-ink-toggle.active {
  color: #9a3412; background: #fff7ed; border-color: #fdba74;
}
.whole-ink-source { display: none; }
.part-answer-zone.ink-answer-active .whole-ink-source { display: block; }
/* 右侧题图继续共用同一中线；全览打开时使用所在作答栏的 90%，
   全览关闭后使用完整作答栏的 70%。答题框仍保持独立的 80% 宽度。 */
.saq-exam-card .saq-right-content .part-block > .annot-wrap {
  margin-left: 0;
  margin-right: 0;
  position: relative;
  left: var(--saq-answer-center-axis);
  transform: translateX(-50%);
  width: var(--saq-question-image-width);
  max-width: none;
}
/* 第二层小题只让题图保留层级缩进。作答控件不能继承层级专属宽度；
   它们由题内统一边界定位，确保所有答题框等宽且左右对齐。 */
.saq-exam-card .saq-right .part-depth-1 {
  margin-left: 0;
}
.saq-exam-card .saq-right-content .part-depth-1 > .annot-wrap {
  margin-left: 0;
  left: var(--saq-answer-center-axis);
  width: var(--saq-question-image-width);
}

/* 测评结果 */
.exam-result-score { font-size: 26px; font-weight: 700; margin: 8px 0 16px; color: var(--primary); }
.exam-result-actions {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.annotation-export-capture {
  display: block !important; position: fixed !important;
  left: -20000px !important; top: 0 !important; width: 1200px !important;
  max-width: none !important; visibility: visible !important;
  pointer-events: none !important; z-index: -1 !important;
}
.saq-exam-card.annotation-export-capture .saq-split {
  height: auto !important; min-height: 200px !important;
}
.saq-exam-card.annotation-export-capture .saq-right-zoom-stage {
  width: 100% !important; height: auto !important;
}
.saq-exam-card.annotation-export-capture .saq-right-content {
  position: relative !important; left: 0 !important; width: 100% !important;
  transform: none !important;
}
/* 批改页离屏导出恢复完整高度并使用稳定双栏，不受当前滚动框影响。 */
.teacher-grading-content.annotation-export-capture .teacher-grading-saq-split {
  display: flex !important; height: auto !important; overflow: visible !important;
}
.teacher-grading-content.annotation-export-capture {
  min-height: var(--annotation-export-min-height, 1px) !important;
  height: auto !important; overflow: visible !important;
}
.teacher-grading-content.annotation-export-capture .teacher-grading-overview {
  width: 50% !important;
}
.teacher-grading-content.annotation-export-capture .teacher-grading-saq-split > .splitter {
  display: none !important;
}
.teacher-grading-content.annotation-export-capture .teacher-grading-answer-column,
.teacher-grading-content.annotation-export-capture .teacher-grading-overview-images {
  height: auto !important; overflow: visible !important;
}
.teacher-grading-content.annotation-export-capture .teacher-response-viewport {
  height: auto !important; min-height: 0 !important; overflow: visible !important;
}
.teacher-grading-content.annotation-export-capture .teacher-response-zoom-stage {
  width: 100% !important; height: auto !important;
}
.teacher-grading-content.annotation-export-capture .teacher-response-zoom-content {
  position: relative !important; width: 100% !important;
  transform: none !important; zoom: 1 !important;
}
.result-list { list-style: none; margin: 0 0 16px; padding: 0; }
.result-row {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; font-size: 13px;
}
.result-row.correct { background: #f0fdf4; border: 1px solid #bbf7d0; }
.result-row.correct .result-mark { color: #15803d; font-weight: 700; }
.result-row.wrong { background: #fef2f2; border: 1px solid #fecaca; }
.result-row.wrong .result-mark { color: var(--danger); font-weight: 700; }
.result-row.pending { background: #f8fafc; border: 1px solid var(--border); }
.result-row .result-text {
  width: 100%; margin: 4px 0 0; white-space: pre-wrap; font: inherit;
  background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px;
}
/* 复盘模式：结果页每行可点进复盘；题号导航与选项按判分标绿/红 */
.result-row { cursor: pointer; }
.result-row:hover { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3); }
.result-row .result-view {
  margin-left: auto; color: var(--primary-2); font-weight: 700; white-space: nowrap;
}
.exam-nav .nav-box.review-correct { background: #dcfce7; border-color: #15803d; color: #15803d; }
.exam-nav .nav-box.review-wrong { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.exam-nav .nav-box.review-saq { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.legacy-options .btn:disabled { cursor: default; }
.legacy-options .btn:disabled:hover { border-color: var(--border); color: var(--text); }
.legacy-options .btn.review-correct,
.legacy-options .btn.review-correct:hover {
  background: #16a34a; border-color: #16a34a; color: #fff;
}
.legacy-options .btn.review-wrong,
.legacy-options .btn.review-wrong:hover {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.legacy-options .btn.review-unanswered-correct,
.legacy-options .btn.review-unanswered-correct:hover {
  background: #facc15; border-color: #d97706; color: #713f12;
}
.option-card.locked { cursor: default; }
.option-card.locked:hover { border-color: var(--border); }
.option-card.review-correct { border-color: #15803d; background: #f0fdf4; }
.option-card.review-wrong { border-color: var(--danger); background: #fef2f2; }
/* 选择题单个字母答案：加粗加大（em 随答案区缩放联动） */
.mcq-answer { font-weight: 700; font-size: 1.7em; }

@media (max-width: 1000px) {
  #page-bank { height: auto; overflow: visible; }
  .bank-layout { flex-direction: column; height: auto; }
  .bank-main { height: auto; overflow: visible; }
  .splitter { display: none; }
  #paper-panel { height: auto; }
  #page-tests { height: auto; overflow: visible; }
  .tests-layout { flex-direction: column; height: auto; }
  #tests-list-col, #tests-edit-col, #tests-preview-col {
    width: 100% !important; height: auto; overflow: visible;
  }
  .tests-layout.preview-hidden #tests-preview-col {
    width: 0 !important; height: 0; overflow: hidden;
  }
  #tests-paper-card { height: auto !important; }
  .vsplitter { display: none; }
  #page-favorites { height: auto; overflow: visible; }
  .favorites-layout { grid-template-columns: 1fr; height: auto; }
  .favorites-sidebar {
    height: min(58vh, 560px); min-height: 380px;
  }
  .collection-card { max-height: none; }
  .favorite-practice-card {
    height: min(760px, calc(100vh - 92px)); min-height: 500px;
  }
}

@media (max-width: 640px) {
  .page { padding: var(--page-island-gap) 8px 10px; }
  .card { padding: 14px 12px; border-radius: 8px; }
  .filter-bar { padding: 10px; flex-wrap: wrap; }
  .filter-bar > select, .filter-bar > .search-group {
    flex: 1 1 100%; width: 100% !important; min-width: 0;
  }
  .search-group { min-width: 0; }
  .search-group input, .filter-bar input[type="search"] { min-width: 0; }
  .favorite-filters { grid-template-columns: 1fr; }
  .favorites-sidebar { --collection-deck-peek: 33px; min-height: 430px; }
  .collection-deck-switch { top: 8px; bottom: 8px; padding: 8px 5px; }
  .collection-title-row { flex-wrap: wrap; }
  .collection-title-row .tests-col-title { flex: 1 1 100%; }
  .practice-topline { gap: 8px; }
  .practice-page-nav { gap: 5px; }
  .practice-page-nav #practice-pos { min-width: 58px; }
  .exam-topbar { overflow-x: auto; }
  .collection-item, .collection-item.favorite-item {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }
  .collection-item:not(.favorite-item) {
    grid-template-columns: 22px 64px minmax(0, 1fr) auto;
  }
  .collection-item img { width: 64px; height: 46px; }
  .admin-grid .card { overflow-x: auto; }
  .admin-grid { display: flex; flex-direction: column; max-width: none; }
  .admin-grid > .admin-ai-provider-card { order: -2; width: 100%; }
  .admin-grid .row { flex-wrap: wrap; }
  .admin-users-head { flex-direction: column; align-items: stretch; }
  .admin-users-search { width: 100%; min-width: 0; }
  .admin-users-footer { flex-wrap: wrap; }
  .lookup-grid-3 { grid-template-columns: 1fr; }
  .lookup-grid > div { min-width: 0; }
}

/* ---------- 测评涂画批注 ---------- */
/* 图片容器相对定位，canvas 铺满图片显示区域；容器收缩贴合图片宽度。
   不带边框：图片和卡片白色背景融为一体，整个白色区域都可涂写 */
.annot-wrap {
  position: relative; width: fit-content; max-width: 100%;
  margin: 0 auto 8px; background: #fff;
  border: none; border-radius: 6px;
}
.annot-wrap > img.annot-img {
  display: block; width: 100%; max-width: none; margin: 0;
  border: none; border-radius: 6px;
}
/* 长虚线答题区折叠只改变显示切片；原图仍留在 DOM 中作为自然尺寸、
   导出和笔迹原始坐标的唯一依据。切片之间不留缝，折叠块只保留普通
   题目元素间距。 */
.annot-wrap.answer-lines-folded > img.answer-line-source { display: none; }
.answer-line-slices { display: flex; flex-direction: column; width: 100%; }
.answer-line-slice {
  position: relative; width: 100%; overflow: hidden; flex: none;
  background: #fff;
}
.answer-line-slice-image {
  display: block; position: absolute; top: 0; left: 0;
  width: 100%; max-width: none; height: auto; margin: 0;
  border: 0; border-radius: 0;
}
/* .part-block img 的通用题图边框优先级更高；折叠切片必须显式覆盖，
   否则折叠后会在本应连续的白色题图外多出一圈灰框。 */
.part-block img.answer-line-slice-image {
  border: 0; border-radius: 0;
}
/* 绘图面上的题图不可被框选、高亮、拖出或长按唤起图片菜单；作答输入框
   不在此选择器中，仍可正常选中文字和使用复制粘贴。 */
.annot-region {
  -webkit-touch-callout: none;
  user-select: none; -webkit-user-select: none;
}
.annot-region img, .annot-region > canvas.annot-canvas {
  user-select: none; -webkit-user-select: none;
  -webkit-user-drag: none; -webkit-touch-callout: none;
}
/* 作答文字框仍须正常选择、复制和粘贴；它们位于 canvas 上层，本身不是
   手写画板。 */
.annot-region textarea, .annot-region input, .annot-region select,
.annot-region [contenteditable="true"] {
  user-select: text; -webkit-user-select: text;
  -webkit-touch-callout: default;
}
/* 区域涂画画布：一张画布覆盖整个区域（图片 + 周边空白），
   层级压在图片上、作答框下 */
.annot-region { position: relative; }
.annot-region > canvas.annot-canvas {
  position: absolute; top: 0; left: 0; z-index: 1; touch-action: none;
}
.annot-region > canvas.annot-canvas.annot-canvas-readonly-layer {
  pointer-events: none;
}
.annot-lasso-menu {
  position: absolute; z-index: 8; display: block;
  border: 1px solid rgba(148, 163, 184, .5); border-radius: 10px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
  color: #1e293b; white-space: nowrap; user-select: none;
  -webkit-user-select: none; touch-action: manipulation;
}
.annot-lasso-menu::after {
  content: ''; position: absolute; left: 50%; width: 10px; height: 10px;
  background: rgba(255, 255, 255, .98); transform: translateX(-50%) rotate(45deg);
}
.annot-lasso-menu[data-placement="above"]::after {
  bottom: -6px; border-right: 1px solid rgba(148, 163, 184, .5);
  border-bottom: 1px solid rgba(148, 163, 184, .5);
}
.annot-lasso-menu[data-placement="below"]::after {
  top: -6px; border-left: 1px solid rgba(148, 163, 184, .5);
  border-top: 1px solid rgba(148, 163, 184, .5);
}
.annot-lasso-menu-primary,
.annot-lasso-menu-mirror { display: flex; align-items: stretch; }
.annot-lasso-menu button {
  position: relative; z-index: 1; min-width: 38px; height: 36px; padding: 0 12px;
  border: 0; border-right: 1px solid #e2e8f0; background: transparent;
  color: inherit; font: inherit; font-size: 14px; cursor: pointer;
}
.annot-lasso-menu button:first-child { border-radius: 9px 0 0 9px; }
.annot-lasso-menu button:last-child {
  border-right: 0; border-radius: 0 9px 9px 0;
}
.annot-lasso-menu button:hover { background: #f1f5f9; }
.annot-lasso-menu button:active { background: #e2e8f0; }
.annot-lasso-menu button.danger { color: #dc2626; }
.annot-region > canvas.annot-canvas.annot-hand-touch {
  touch-action: pan-x pan-y pinch-zoom;
}
#teacher-grading-content canvas.annot-canvas.annot-hand-touch[data-annot-key^="tg-"] {
  touch-action: none;
}
/* 批改答案框中，Pencil/鼠标继续由 canvas 处理；手指则交给浏览器滚动。
   pointer 轻点仍由 JS 解释为标准答案积分，滑动不会误加积分。 */
#teacher-grading-content canvas.annot-canvas[data-annot-key^="tg-student-"],
#teacher-grading-content canvas.annot-canvas[data-annot-key^="tg-standard-"] {
  touch-action: pan-x pan-y pinch-zoom;
}
.annot-region textarea { position: relative; z-index: 2; }
/* 选项图模式（当前关闭）若恢复，选项卡片也要压在画布之上 */
.annot-region .option-list { position: relative; z-index: 2; }
/* 选择题图由 JS 按视口与原始比例自适应；保留留白并允许局部缩放。 */
.exam-images-mcq .annot-wrap { max-width: none; }
/* 简答左栏图靠缩放百分比控宽（可溢出滚动），不收缩限宽 */
.saq-left-images .annot-wrap { max-width: none; margin: 0 0 8px; }
/* 通用左栏规则会把 margin 重置为左对齐；批改全览必须恢复双侧自动
   margin，使 95% 基准图在去掉分隔区冗余后真正处于栏中央。 */
.saq-left-images.teacher-grading-overview-images .annot-wrap {
  margin-right: auto; margin-left: auto;
}
.part-block .annot-wrap { margin: 0 0 8px; }

/* 题图局部缩放轨道：图片自己拥有水平滚动空间，右侧白色
   作答区不跟随变小。额外的对称轨道用于把鼠标下的内容点稳定
   在原位；缩小到默认倍率以下时 JS 会把轨道重新居中。 */
.exam-image-zoom-shell {
  display: block; position: relative; width: 100%; max-width: 100%;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  touch-action: pan-x pan-y pinch-zoom;
  scrollbar-width: none; margin: 0 0 8px;
}
.exam-image-zoom-shell.saq-overview-at-or-below-base,
.exam-image-zoom-shell.mcq-at-or-below-base {
  overflow-x: hidden;
}
.exam-image-zoom-shell::-webkit-scrollbar { display: none; }
.exam-image-zoom-track { position: relative; min-width: 100%; }
.exam-image-zoom-track > .annot-wrap {
  margin-left: auto !important; margin-right: auto !important;
  margin-bottom: 0 !important;
}

/* 竖直工具栏：默认固定视口左侧中部，层级低于吸底悬浮条（z-index 90） */
.annot-toolbar {
  position: fixed; left: 12px; right: auto; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  /* 只收窄两侧白框；按钮和图标保持原尺寸，避免可读性下降。 */
  padding: 8px 2px; box-shadow: 0 5px 19px rgba(15, 23, 42, 0.18);
  z-index: 80; user-select: none; max-height: calc(100vh - 8px);
  overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
  transition: gap .28s ease, padding .28s ease, box-shadow .28s ease;
}
.annot-toolbar.hidden { display: none; }
/* 0.11.4 分级收缩：子项禁止压缩（颜色不再被压成扁椭圆），
   按 JS 加的 stage 类逐级折叠，最后才出 overflow 滚动条 */
.annot-toolbar > * { flex-shrink: 0; max-height: 40px;
  transition: max-height .28s ease, opacity .18s ease,
    transform .28s ease, margin .28s ease, padding .28s ease,
    border-width .28s ease;
}
.annot-toolbar.annot-manual-collapsed {
  gap: 0; overflow-y: hidden; box-shadow: 0 4px 14px rgba(15, 23, 42, .14);
}
.annot-toolbar.annot-manual-collapsed >
  :not(.annot-grip):not(.annot-collapse-visible) {
  height: 0 !important; min-height: 0 !important; max-height: 0 !important;
  margin: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;
  border-top-width: 0 !important; border-bottom-width: 0 !important;
  opacity: 0; transform: translateY(-8px) scale(.88);
  overflow: hidden; pointer-events: none;
}
.annot-toolbar.annot-manual-collapsed > .annot-grip,
.annot-toolbar.annot-manual-collapsed > .annot-collapse-visible {
  margin-bottom: 5px;
}
.annot-toolbar.annot-manual-collapsed > .annot-collapse-visible:last-of-type {
  margin-bottom: 0;
}
.annot-toolbar.annot-tight-gap { gap: 2px; }
.annot-toolbar.annot-collapse-colors .annot-color:not(.selected) {
  display: none;
}
.annot-toolbar.annot-collapse-sizes .annot-size:not(.selected) {
  display: none;
}
.annot-grip {
  display: flex; gap: 3px; justify-content: center; width: 100%;
  padding: 0 0 3px; cursor: grab; touch-action: none;
}
.annot-toolbar > .annot-grip {
  position: relative;
  /* 原先圆点到第一项工具约 8px；额外留出 4px，增加 50%。 */
  margin-bottom: 4px;
}
/* 扩大拖拽柄的命中范围，但不改变圆点尺寸，也不遮挡下方工具。 */
.annot-toolbar > .annot-grip::before {
  content: ""; position: absolute; inset: -8px 0 -2px;
}
.annot-toolbar.annot-tight-gap > .annot-grip { margin-bottom: 2.5px; }
.annot-toolbar.annot-manual-collapsed > .annot-grip { margin-bottom: 9px; }
.annot-grip:active { cursor: grabbing; }
.annot-grip span {
  width: 4px; height: 4px; border-radius: 50%; background: var(--border);
}
.annot-grip:hover span { background: #94a3b8; }
.annot-divider { width: 24px; border-top: 1px solid var(--border); }
.annot-tool svg { display: block; }
.annot-tool {
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; line-height: 1;
  border: 1px solid transparent; border-radius: 6px;
  background: none; cursor: pointer; color: var(--text);
}
.annot-tool:hover { border-color: var(--border); }
.annot-tool.selected {
  border-color: var(--primary-2); background: #eff6ff;
  outline: 2px solid rgba(37, 99, 235, 0.35);
}
.annot-color {
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(15, 23, 42, 0.15); padding: 0;
}
.annot-color.selected { outline: 2px solid var(--primary-2); outline-offset: 2px; }
/* 双击色块的自定义调色盘弹窗 */
.annot-color-pop {
  position: fixed; z-index: 95; background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 5px 19px rgba(15, 23, 42, 0.18);
  padding: 8px; display: flex; flex-direction: column; gap: 5px;
  align-items: center;
}
.annot-color-pop input[type="color"] {
  width: 48px; height: 36px; border: none; background: none;
  padding: 0; cursor: pointer;
}
.annot-color-pop-hint { font-size: 12px; }
/* 单击粗细按钮的 slider 弹窗（复用调色盘弹层风格） */
.annot-size-pop input[type="range"] { width: 140px; cursor: pointer; }
/* 「图形」按键的标准图形弹层（复用调色盘弹层风格） */
.annot-shape-pop {
  gap: 2px; align-items: center; max-height: calc(100vh - 8px);
  overflow-y: auto; overflow-x: hidden; padding: 8px 2px;
  box-shadow: none;
}
.annot-shape-item {
  width: 32px; height: 32px; flex: 0 0 32px; padding: 3px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px; background: none;
  cursor: pointer; color: var(--text);
}
.annot-shape-item:hover { border-color: var(--border); }
.annot-shape-item.selected {
  border-color: var(--primary-2); background: #eff6ff;
}
.annot-shape-item svg { display: block; flex: 0 0 auto; width: 22px; height: 22px; }
.annot-shape-name { display: none; }
.annot-size {
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; border: 1px solid transparent; border-radius: 6px;
  background: none; cursor: pointer; color: var(--text); padding: 3px;
}
.annot-size:hover { border-color: var(--border); }
.annot-size-control.selected { border-color: transparent; background: none; }
.annot-size-control:hover { border-color: var(--border); }
.annot-size-control:disabled { opacity: .42; cursor: not-allowed; }
.annot-size-control svg { display: block; }
.annot-clear { white-space: nowrap; padding: 2px 6px; font-size: 11px; }

/* 自定义提示框：接管原生 title，fixed 定位在光标右上方 */
.qb-tip {
  position: fixed; z-index: 300; pointer-events: none;
  background: #1e293b; color: #fff; font-size: 12px; line-height: 1.45;
  padding: 5px 9px; border-radius: 6px; max-width: 300px;
  white-space: pre-wrap; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

/* ---------- 通知铃 / 通知面板 ---------- */
.topbar-right .btn-bell {
  position: relative; display: inline-flex; align-items: center;
  justify-content: center; width: 29px; height: 29px; padding: 4px;
  border: 0; border-radius: 50%; background: transparent; color: #111827;
}
.topbar-right .btn-bell:hover { background: #f3f5f9; color: #111827; }
.notif-bell-icon { display: block; width: 20px; height: 20px; }
.btn-bell .badge-num {
  position: absolute; top: -3px; right: -6px; margin: 0;
}
.notif-panel {
  position: fixed; top: 56px; right: 16px; z-index: 250;
  width: 340px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16); padding: 8px;
}
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px 8px; font-weight: 600;
}
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
  padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.5;
}
.notif-item.unread { background: #eff6ff; }
.notif-item.clickable { cursor: pointer; }
.notif-item.clickable:hover { background: #dbeafe; }
.notif-text { display: block; }
.notif-time { display: block; font-size: 11px; margin-top: 2px; }

/* ---------- 个人管理 ---------- */
.profile-field { margin: 6px 0; font-size: 14px; }
.profile-label {
  display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px;
}
.profile-sub { font-size: 14px; margin: 18px 0 8px; }
.profile-row {
  display: flex; align-items: center; gap: 10px; margin: 10px 0;
  font-size: 14px; min-height: 30px;
}
.profile-key { width: 56px; flex-shrink: 0; }
.profile-val { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.profile-row .profile-edit-btn { margin-left: auto; }
.profile-inline-input { width: 180px; min-width: 0; flex: 1 1 180px; margin: 0; }
.profile-row button { flex-shrink: 0; white-space: nowrap; }
.profile-account-actions { margin-top: 14px; flex-wrap: wrap; }
.profile-info-card { display: flex; flex-direction: column; align-self: start; }
.profile-info-card #profile-msg:empty, .profile-info-card #profile-error:empty { display: none; }
.profile-info-footer:not(:has(> button:not(.hidden))) { display: none; }
.profile-info-footer {
  display: flex; align-items: center; gap: 8px;
  margin-top: 0; padding-top: 10px;
}
.profile-more-wrap { position: relative; }
.profile-more-menu {
  position: absolute; left: 0; bottom: calc(100% + 7px); z-index: 5;
  min-width: 138px; padding: 9px;
  border: 1px solid var(--border); border-radius: 9px; background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
}
.profile-more-label {
  margin: 0 2px 7px; color: var(--muted); font-size: 11px;
}
.profile-more-menu .btn { width: 100%; }
.badge-role {
  background: #dcfce7; color: #15803d; font-size: 11px; border-radius: 4px;
  padding: 1px 6px; flex-shrink: 0;
}
.profile-class-overview {
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.profile-class-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px; margin-top: 12px;
}
.profile-class-card {
  min-width: 0; padding: 12px; border: 1px solid var(--border);
  border-radius: 9px; background: #fff; cursor: pointer; text-align: left;
  color: var(--text); font: inherit;
}
.profile-class-card:hover { border-color: #93c5fd; background: #f8fbff; }
.profile-class-card.active {
  border-color: var(--primary-2); background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .2);
}
.profile-class-invitation-section { margin-top: 18px; }
.profile-class-invitation-section > h3 {
  margin: 0; font-size: 15px; color: var(--text);
}
.profile-class-invitation-card { cursor: default; }
.profile-class-invitation-card:hover {
  border-color: var(--border); background: #fff;
}
.profile-class-invitation-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px;
}
.profile-class-course { display: block; font-weight: 700; }
.profile-class-name,
.profile-class-teacher {
  display: block; margin-top: 4px; color: var(--muted); font-size: 12px;
}
.profile-class-overview-actions {
  display: flex; justify-content: flex-end; margin-top: 12px;
}
.profile-student-gradebook { margin-top: 16px; }
.profile-student-gradebook h3 { margin: 0; font-size: 16px; }
.profile-class-modal-body { width: min(620px, calc(100vw - 28px)); }
.profile-class-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.profile-class-memberships { list-style: none; margin: 8px 0; padding: 0; }
.profile-class-membership {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 7px;
}
.profile-class-membership-main { min-width: 0; flex: 1 1 auto; }
.profile-class-membership-main b,
.profile-class-membership-main span { display: block; }
.profile-class-membership-main span { margin-top: 2px; font-size: 12px; }
.profile-class-code-row input { text-transform: uppercase; }

/* ---------- 课程管理（教师） ---------- */
.class-list { list-style: none; margin: 0; padding: 0; }
.class-item {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; font-size: 13px; cursor: pointer;
}
.class-item:hover { background: #f1f5f9; }
.class-item.active {
  border-color: var(--primary-2); background: #eaf1fd;
  box-shadow: inset 3px 0 var(--primary-2);
}
.assignment-list { list-style: none; margin: 0; padding: 0; }
.assignment-item {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; font-size: 13px;
}
.assignment-main {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.assignment-main .btn { margin-left: auto; }
.assignment-main .btn + .btn { margin-left: 6px; }
.grades-summary {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 4px 0 10px; font-size: 13px; color: var(--text);
}
.grades-summary b { font-size: 15px; }
.test-deadline.overdue,
.test-deadline.urgent { color: #b91c1c; font-weight: 700; }

/* 课程/班级/学生页（0.6.29）：左侧三级级联面板 + 右侧课程树；
   0.8.1：课程创建/编辑移入弹窗，班级与学生添加入口仍在面板底部；
   按钮统一中性 .btn 样式；添加学生错误在输入框旁行内红字（.member-add-error） */
.teacher-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 40%);
  gap: 14px;
  align-items: start;
}
#page-teacher .card { padding-top: 12px; }
#page-teacher .card h2 { font-size: 16px; margin-top: 0; }
#page-teacher .cascade-col > h3 { margin-top: 4px; }
.teacher-left,
.teacher-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.teacher-cascade {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.cascade-col { display: flex; flex-direction: column; }
.cascade-col h3 {
  display: flex; justify-content: space-between; align-items: center;
  min-height: 34px; margin: 0 0 8px;
}
.cascade-head-actions { display: inline-flex; align-items: center; gap: 5px; }
.cascade-list {
  list-style: none; margin: 0 0 8px; padding: 0;
  height: 240px; max-height: 240px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.cascade-list:empty { border: none; }
#member-list:empty { display: none; }
#member-empty {
  min-height: 34px; padding: 7px 10px; margin-bottom: 8px;
}
.cascade-item {
  position: relative; display: flex; justify-content: space-between; align-items: center;
  gap: 6px; padding: 7px 10px; cursor: pointer;
  font-size: 13px; border-bottom: 1px solid var(--border);
}
.cascade-item:last-child { border-bottom: none; }
.cascade-item:hover { background: #f1f5f9; }
.cascade-item.active {
  background: #dbeafe; color: #1d4ed8; font-weight: 600;
}
.cascade-item .cascade-item-sub {
  color: var(--muted); font-size: 11px; font-weight: 400;
}
.cascade-item.active .cascade-item-sub { color: #3b82f6; }
.cascade-item .btn { flex: none; }
.cascade-class-code { color: var(--muted); font-weight: 400; }
.cascade-item .class-request-badge {
  position: absolute; top: 5px; right: 5px; margin: 0;
}
.cascade-item.has-request-badge { padding-right: 34px; }
.join-request-item {
  cursor: default; flex-wrap: wrap; background: #fff7ed;
  box-shadow: inset 4px 0 #f59e0b;
}
.join-request-item:hover { background: #ffedd5; }
.join-request-user { min-width: 0; flex: 1 1 auto; }
.join-request-actions { display: inline-flex; gap: 5px; margin-left: auto; }
.cascade-name-input {
  flex: 1 1 0; min-width: 0; padding: 3px 6px; font: inherit;
}
.cascade-add { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.cascade-add input { flex: 1 1 0; min-width: 0; }
.cascade-col:first-child .cascade-add {
  flex-direction: column;
  align-items: stretch;
}
.cascade-add select { width: 100%; min-width: 0; }

.course-modal-body { width: min(520px, 92vw); }
.class-settings-modal-body { width: min(440px, 92vw); }
.class-settings-head { display: flex; align-items: center; gap: 10px; }
.class-settings-head .edit-title { margin: 0; }
.class-settings-name { width: min(240px, 60vw); }
.class-settings-head .icon-btn { width: 34px; height: 34px; }
.class-settings-head .icon-btn,
.class-settings-actions .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px;
}
.class-settings-head .icon-btn svg,
.class-settings-actions .icon-btn svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.class-settings-modal-body > .muted { min-height: 22px; margin: 15px 0; }
.class-settings-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 20px;
}
.class-settings-actions #class-settings-close { margin-left: auto; }
.cascade-item.class-archived .cascade-item-name { opacity: .65; }
.course-modal-fields { display: grid; gap: 11px; }
.course-modal-fields label {
  display: flex; flex-direction: column; gap: 5px;
  color: var(--muted); font-size: 13px;
}
.course-modal-fields select,
.course-modal-fields input { width: 100%; min-height: 42px; }
.course-modal-body > .muted { margin: 10px 0 0; font-size: 12px; }

.grading-prompt-panel { margin-top: 18px; }
.grading-prompt-panel {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.grading-prompt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.grading-prompt-head h2,
.grading-prompt-head h3,
.grading-prompt-head p { margin: 0 0 5px; }
.grading-prompt-panel textarea,
.teacher-grading-card textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
}
.teacher-grading-card > select {
  width: 100%;
  margin-bottom: 10px;
}
.ai-provider-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.ai-provider-slot {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}
.ai-provider-slot-head,
.ai-provider-slot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-provider-fields { display: grid; gap: 8px; margin: 10px 0; }
.ai-provider-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}
.ai-provider-fields input { width: 100%; }
.ai-provider-status { margin-top: 8px; min-height: 20px; }
.ai-provider-qwen { grid-column: 1 / -1; }
.ai-provider-qwen .ai-provider-fields {
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 1fr)
    minmax(170px, 1fr) minmax(110px, .55fr) minmax(110px, .55fr);
  align-items: end;
}
.teacher-ai-feedback {
  position: relative; z-index: 4;
  margin: 8px 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 9px 12px;
  background: #eff6ff;
  color: #1e3a5f;
}
.teacher-ai-feedback-head {
  position: relative; z-index: 1; display: flex; align-items: center;
  justify-content: flex-start; gap: 8px; flex-wrap: wrap;
}
.teacher-ai-feedback-title { font-weight: 650; }
.teacher-ai-reasoning-toggle { padding-block: 4px; }
.teacher-ai-feedback ul { margin: 8px 0 0; padding-left: 20px; }
.teacher-ai-feedback li {
  display: flex; align-items: flex-start; gap: 7px; margin: 6px 0;
  padding: 6px 7px; border-radius: 8px;
}
.ai-point-override-button { flex: 0 0 auto; margin-top: -2px; }
.ai-point-user-override {
  flex: 0 0 auto; padding: 2px 7px; border-radius: 999px;
  background: #b7791f; color: #fff8db; font-size: 11px; font-weight: 750;
}
.teacher-ai-feedback .ai-point-awarded { color: #166534; }
.teacher-ai-feedback .ai-point-missed { color: #9a3412; }
.teacher-ai-point-body { flex: 1 1 auto; min-width: 0; }
.teacher-ai-point-title { font-weight: 650; overflow-wrap: anywhere; }
.teacher-ai-point-decision {
  margin-top: 2px; color: #475569; font-size: 12px; line-height: 1.45;
  overflow-wrap: anywhere;
}
.ai-point-confidence {
  flex: 0 0 auto; padding: 2px 7px; border-radius: 999px;
  background: #dcfce7; color: #166534; font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.ai-point-confidence.low {
  background: #fef3c7; color: #92400e;
}
.teacher-ai-feedback li.ai-point-low-confidence {
  outline: 2px solid #f59e0b; background: #fffbeb;
}
.teacher-ai-reasoning {
  margin-top: 9px; padding: 9px 10px; border-top: 1px solid #bfdbfe;
  background: rgb(255 255 255 / 58%); border-radius: 0 0 7px 7px;
  color: #334155; font-size: 12px; line-height: 1.5;
}
.teacher-ai-reasoning-line { margin: 4px 0; white-space: pre-wrap; }
.teacher-ai-reasoning-line strong { margin-right: 4px; color: #1e3a5f; }
@media (max-width: 1100px) {
  .ai-provider-list { grid-template-columns: 1fr; }
  .ai-provider-qwen .ai-provider-fields { grid-template-columns: 1fr; }
}

.ai-grade-panel {
  margin: 8px 14px 14px;
  padding: 12px 14px;
  border: 1px solid #bfd4ff;
  border-radius: 10px;
  background: #f3f7ff;
  color: #253858;
  line-height: 1.55;
}
.ai-grade-panel p { margin: 6px 0; }
.ai-grade-title { font-weight: 700; }
.member-add-error { margin: 6px 0 0; }
.teacher-tree-card { position: static; }
.course-tree-wrap {
  overflow: auto; max-height: calc(100vh - 220px);
}
#course-tree { display: block; }
.ct-link { fill: none; stroke: #cbd5e1; stroke-width: 1.5; }
.ct-node circle {
  fill: #fff; stroke: #64748b; stroke-width: 1.5; cursor: pointer;
}
.ct-node text { font-size: 12px; fill: #334155; cursor: pointer; }
.ct-node.active circle { fill: #2563eb; stroke: #2563eb; }
.ct-node.active text { fill: #1d4ed8; font-weight: 600; }
.matrix-wrap { overflow-x: auto; margin-top: 10px; }
.matrix-table th, .matrix-table td { white-space: nowrap; }
.matrix-table th { vertical-align: top; }
.matrix-assignment { cursor: pointer; user-select: none; }
.matrix-assignment:hover { background: #eaf2ff; }
.matrix-assignment-head {
  min-height: 64px; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start; gap: 4px;
}
.matrix-title { font-weight: 700; }
.matrix-table td:first-child, .matrix-table th:first-child {
  position: sticky; left: 0; background: var(--card);
  box-shadow: 1px 0 0 var(--border);
}
.matrix-policy { font-weight: 400; font-size: 11px; }
.teacher-matrix-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.teacher-matrix-head h2 { margin: 0; }
#matrix-panel { min-width: 0; }

/* ---------- 分享 / 试卷标记 ---------- */
.share-modal-body { width: min(560px, 92vw); }
.share-recipient-form { display: grid; gap: 9px; }
.share-recipient-form select,
.share-recipient-form textarea { width: 100%; }
.share-recipient-form .btn { justify-self: end; }
.badge-shared {
  background: #fef3c7; color: #b45309; font-size: 11px; border-radius: 4px;
  padding: 1px 6px; flex-shrink: 0;
}
.badge-server-source {
  background: #fff7ed; color: #c2410c; border: 1px solid #fdba74;
  font-size: 11px; border-radius: 4px; padding: 1px 6px; flex-shrink: 0;
}
.badge-late {
  background: #fee2e2; color: #b91c1c; font-size: 11px; border-radius: 4px;
  padding: 1px 6px;
}
.badge-progress.exam-mode {
  background: #fff1c2; border: 1px solid #e5b84d; color: #7c4a03;
}
.test-deadline { color: #b45309; }

/* ---------- 相似题目 ---------- */
.similar-list {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px;
}
.similar-card {
  flex: 0 0 150px; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; cursor: pointer; background: #fff;
  display: flex; flex-direction: column; gap: 4px;
}
.similar-card:hover { border-color: var(--primary-2); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15); }
.similar-card img {
  width: 100%; height: 70px; object-fit: cover; object-position: top;
  border-radius: 4px; background: #f1f5f9;
}
.similar-noimg {
  width: 100%; height: 70px; display: flex; align-items: center;
  justify-content: center; background: #f1f5f9; border-radius: 4px; font-size: 12px;
}
.similar-meta { font-size: 12px; font-weight: 600; word-break: break-all; }
.similar-score { font-size: 11px; }
.similar-add { width: 100%; }
.profile-notify {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 13px; cursor: pointer;
}
.profile-notify input { width: auto; margin: 0; }

/* 个人管理页：紧凑双列，个人信息小卡居右 */
.profile-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px; width: 100%; max-width: none; align-items: start;
}
.profile-exam-lock-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 10px; border-color: #e5b84d;
  background: #fff8df; color: #704300;
}
.profile-exam-lock-banner.hidden { display: none; }
.profile-grid .card { padding: 18px 20px; }
.profile-grid > .card:nth-child(1) { grid-column: 2; grid-row: 1; }
.profile-grid > .card:nth-child(2) { grid-column: 1; grid-row: 1 / span 2; }
.profile-grid h2 { font-size: 15px; margin-bottom: 8px; }
.profile-grid .profile-sub { margin: 12px 0 6px; }
.profile-grid .profile-row { margin: 8px 0; }
.profile-grid.student-management-hidden {
  grid-template-columns: 320px; justify-content: end;
}
.profile-grid.student-management-hidden > .card:nth-child(1),
.profile-grid.student-management-hidden > .card:nth-child(2) {
  grid-column: 1; grid-row: auto;
}
@media (max-width: 860px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid > .card:nth-child(n) { grid-column: 1; grid-row: auto; }
}

/* 待处理反馈角标（题库管理页独立反馈列） */
.feedback-flag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin: 0; padding: 0;
  border: none; background: transparent; cursor: pointer;
  vertical-align: middle;
}
.feedback-flag:hover svg rect { fill: #ca8a04; }

/* 科目列显隐开关（管理后台科目列表每行） */
.subject-col-toggle {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 8px; font-size: 12px; color: #475569;
  cursor: pointer; white-space: nowrap;
}
.subject-col-toggle input { width: auto; margin: 0; }

/* 管理员题目反馈面板：独立浮层，z-index 高于所有 modal，
   与「编辑题目」弹窗并存以便一边看反馈一边改题 */
.qfeedback-panel {
  position: fixed; top: 64px; right: 16px; z-index: 150;
  width: 300px; background: #fff; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.25);
  border: 1px solid #e2e8f0; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.qfeedback-head {
  display: flex; align-items: center; gap: 8px;
}
.qfeedback-head strong { font-size: 14px; }
.qfeedback-head #qfeedback-pos { font-size: 12px; }
.qfeedback-head .btn { margin-left: auto; padding: 0 8px; }
/* 0.10.11：反馈面板改为多条列表，每批 5 条，上/下一批翻页 */
.qfeedback-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 420px; overflow-y: auto; min-height: 60px;
}
.qfeedback-item {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.qfeedback-item-meta { font-size: 12px; }
.qfeedback-text {
  font-size: 13px; line-height: 1.6; white-space: pre-wrap;
  word-break: break-word; max-height: 240px; overflow-y: auto;
}
.qfeedback-actions { display: flex; align-items: center; gap: 6px; }
.qfeedback-actions .btn + .btn { margin-left: auto; }
.qfeedback-item-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* 题目反馈提交弹窗的输入框 */
#qfeedback-modal textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  font: inherit; padding: 8px 10px;
  border: 1px solid #cbd5e1; border-radius: 8px;
}
.page.exam-completion-mode .exam-topbar {
  display: none;
}

.exam-completion {
  min-height: min(62vh, 620px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.exam-completion h2 {
  margin: 0;
}
/* Fixed option islands for multiple response, ordering and shared-stem parts. */
.response-controls { position: relative; z-index: 12; pointer-events: auto; }
.response-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.response-option { position: relative; min-width: 40px; min-height: 40px; touch-action: manipulation; }
.response-option[aria-pressed="true"] { background: #e7eefb; border-color: #527bbd; color: #17385e; }
.response-order { display: inline-flex; align-items: center; justify-content: center; margin-left: 7px; width: 19px; height: 19px; border-radius: 50%; background: #345c91; color: white; font-size: 11px; }
.response-status { font-size: 12px; line-height: 1.6; margin-top: 6px; }
.response-status:empty { display: none; }
.part-block > .response-controls, .practice-part > .response-controls { width: fit-content; max-width: 100%; margin: 12px 0 24px; padding: 12px 16px; border: 1px solid #dce3ed; border-radius: 18px; background: #fff; box-shadow: 0 6px 20px #19355412; }
.response-clear { margin-left: 4px; }
.sequence-title { padding-left: 80px !important; font-size: 17px; font-weight: 600; padding: 10px 16px; }
.practice-sequence-split { height: min(70vh, 900px); gap: 16px; margin-top: 12px; }
.practice-sequence-split .saq-left { width: 45%; }
.practice-sequence-split .saq-right { flex: 1; min-width: 0; position: static; height: 100%; overflow: auto; }
.practice-sequence-split .saq-left-images { height: 100%; overflow: auto; }
.practice-sequence-split img { display: block; width: 100%; height: auto; }
.response-part-editor { display: grid; grid-template-columns: minmax(70px, 1fr) 120px minmax(120px, 2fr) 65px minmax(100px, 2fr); gap: 8px; margin: 10px 0; align-items: center; }
@media (max-width: 640px) {
  .response-part-editor { grid-template-columns: 1fr 1fr; }
  .response-options { gap: 6px; }
  .part-block > .response-controls { padding: 10px; }
}
