/* ============ 基础 ============ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-bg: #eff6ff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-dark: #15803d;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --gray-1: #f8fafc;
  --gray-2: #f1f5f9;
  --gray-3: #e2e8f0;
  --gray-4: #cbd5e1;
  --gray-5: #94a3b8;
  --gray-6: #475569;
  --text: #1e293b;
  --text-light: #64748b;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--gray-1);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============ 头部 ============ */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-3);
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  cursor: pointer;
}

.brand:hover { background: var(--gray-1); }
.brand:hover .brand-title { color: var(--primary); }
.brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.brand-icon { width: 34px; height: 34px; color: var(--primary); }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--text-light); }

.server-date { font-size: 13px; color: var(--text-light); white-space: nowrap; }

/* ============ 主体 ============ */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
}

.app-footer {
  border-top: 1px solid var(--gray-3);
  padding: 12px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-5);
  background: #fff;
}
/* ICP 备案号(工信部备案系统链接,新标签页打开) */
.app-footer .footer-icp {
  margin-left: 14px;
  color: var(--gray-5);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
.app-footer .footer-icp:hover { color: var(--primary); border-bottom-color: var(--primary); }

.loading-block {
  text-align: center;
  color: var(--text-light);
  padding: 60px 0;
}

/* ============ 通用组件 ============ */
.card {
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title .spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 9px 16px;
  min-height: 44px;
  min-width: 44px;
  line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  user-select: none;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
}

.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--gray-4);
}
.btn.secondary:hover { background: var(--gray-2); }

.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn.ghost:hover { background: var(--primary-bg); }

.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }

.btn.danger-outline { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger-outline:hover { background: var(--danger-bg); }

.btn.success { background: var(--success); }
.btn.success:hover { background: var(--success-dark); }

.btn.sm { padding: 5px 10px; min-height: 36px; min-width: 36px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 16px; min-height: 52px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-6); margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--text-light); font-weight: 400; margin-top: 3px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="search"], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--gray-4);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  min-height: 44px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

textarea { min-height: 80px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.form-grid .field { margin-bottom: 0; }

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  line-height: 1.6;
  white-space: nowrap;
}

.badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.badge.green { background: var(--success-bg); color: var(--success-dark); }
.badge.yellow { background: var(--warn-bg); color: var(--warn); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.gray { background: var(--gray-2); color: var(--gray-6); }
.badge.purple { background: #ede9fe; color: #6d28d9; }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); background: #fff; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th, table.data td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-2);
  white-space: nowrap;
}

table.data th {
  background: var(--gray-1);
  font-size: 13px;
  color: var(--gray-6);
  font-weight: 600;
  position: sticky;
  top: 0;
}

table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--gray-1); }

.table-empty { padding: 30px; text-align: center; color: var(--text-light); font-size: 14px; }

/* 作业分析看板:题干列超长省略(悬停看全文),列头排序提示 */
.analysis-stem { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.sortable-th:hover { color: var(--primary); }

/* 作业分析看板:逐题名单贴片(flex 换行,防止表格被拉长) */
.analysis-detail { padding: 8px 0; }
.analysis-detail-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 4px 0; }
.analysis-detail-row > span:first-child { flex: none; padding-top: 4px; color: var(--text-light); }
.analysis-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.analysis-chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 13px; line-height: 1.5; }
.analysis-chip.ok { background: var(--success-bg); color: var(--success-dark); }
.analysis-chip.no { background: var(--danger-bg); color: var(--danger); }

/* 进度条 */
.progress {
  background: var(--gray-3);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  min-width: 90px;
}
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.progress.green > span { background: var(--success); }

/* Toast */
.toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .25s, transform .25s;
  word-break: break-all;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success-dark); }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }

/* 模态 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1150; /* 高于宠物中心弹层(1100),低于课堂抢答(1200)与 toast(1300) */
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(94vw, 460px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modal-in .18s ease-out;
}

@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-head { padding: 16px 20px 0; font-size: 16px; font-weight: 700; }
.modal-body { padding: 12px 20px 4px; font-size: 14px; color: var(--gray-6); overflow-y: auto; }
.modal-body p { margin-bottom: 8px; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

.modal-body ul { padding-left: 20px; }

/* ============ 作业文件在线预览 ============ */
.modal.preview {
  width: min(1040px, 95vw);
  max-height: 90vh;
  height: 88vh;
}

.modal-head .modal-close {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--gray-5);
  cursor: pointer;
  padding: 0 2px;
  min-height: 32px;
  min-width: 32px;
}
.modal-head .modal-close:hover { color: var(--text); }

.modal-head.preview-head { display: flex; align-items: center; padding: 12px 20px 8px; }

.preview-meta {
  padding: 0 20px 10px;
  font-size: 13px;
  color: var(--text-light);
  border-bottom: 1px solid var(--gray-3);
}

.preview-body {
  flex: 1;
  overflow: auto;
  padding: 14px 18px;
  background: var(--gray-1);
}

.preview-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--gray-3);
  flex-wrap: wrap;
}
.preview-foot input[type="number"] { width: 90px; }
.preview-foot input[type="text"] { flex: 1; min-width: 160px; }

.preview-text {
  white-space: pre-wrap;
  word-break: break-all;
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #fff;
  padding: 12px 14px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-sm);
  margin: 0;
}

.preview-iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.preview-img { max-width: 100%; display: block; margin: 0 auto; }

/* docx 渲染 */
.docx-p { margin: 0 0 8px; line-height: 1.75; }
.docx-p.docx-blank { min-height: 1.75em; }
.docx-p.docx-li { padding-left: 1.2em; }
.docx-h { margin: 16px 0 8px; line-height: 1.4; }
.docx-tbl {
  border-collapse: collapse;
  margin: 8px 0;
  background: #fff;
}
.docx-tbl td {
  border: 1px solid var(--gray-4);
  padding: 4px 10px;
  vertical-align: top;
}
.docx-tbl td .docx-p { margin: 0; }

/* xlsx 渲染 */
.xlsx-wrap { display: flex; flex-direction: column; gap: 10px; }
.xlsx-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.xlsx-tab {
  border: 1px solid var(--gray-4);
  background: #fff;
  color: var(--gray-6);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  min-height: 32px;
}
.xlsx-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.xlsx-tbl { border-collapse: collapse; background: #fff; }
.xlsx-tbl td, .xlsx-tbl th {
  border: 1px solid var(--gray-3);
  padding: 3px 9px;
  font-size: 13px;
  min-width: 42px;
  height: 26px;
  text-align: left;
  font-weight: 400;
  white-space: nowrap;
}
.xlsx-tbl th.row-no {
  background: var(--gray-2);
  color: var(--gray-5);
  font-size: 12px;
  min-width: 34px;
  text-align: center;
}

/* ============ 首页角色选择 ============ */
.home-hero { text-align: center; padding: 34px 0 14px; }
.home-hero h1 { font-size: 26px; margin-bottom: 6px; }
.home-hero p { color: var(--text-light); font-size: 14px; }

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 26px;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 24px;
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  text-decoration: none;
  color: inherit;
}

.role-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.role-card .role-icon {
  width: 62px; height: 62px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}

.role-card .role-icon svg { width: 32px; height: 32px; }

.role-card.student .role-icon { background: var(--primary-bg); color: var(--primary); }
.role-card.teacher .role-icon { background: var(--success-bg); color: var(--success-dark); }

.role-card .role-name { font-size: 18px; font-weight: 700; }
.role-card .role-desc { font-size: 13px; color: var(--text-light); text-align: center; }

/* ============ 学生签到页 ============ */
.signin-flow { display: grid; gap: 16px; }

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.class-tile {
  border: 1.5px solid var(--gray-3);
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .15s, background .15s;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.class-tile:hover { border-color: var(--primary); background: var(--primary-bg); }
.class-tile small { color: var(--text-light); font-weight: 400; font-size: 12px; }

.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.student-tile {
  border: 1.5px solid var(--gray-3);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  transition: border-color .15s, background .15s;
}

.student-tile:hover { border-color: var(--primary); background: var(--primary-bg); }
.student-tile .stu-number { font-size: 12px; color: var(--text-light); font-weight: 400; }
.student-tile .stu-flag { font-size: 12px; color: var(--success-dark); font-weight: 600; }
.student-tile .stu-hw { font-size: 12px; font-weight: 600; }
.student-tile .stu-hw.ok { color: var(--success-dark); }
.student-tile .stu-hw.no { color: var(--warn); }
.student-tile .stu-hw.none { color: var(--text-light); font-weight: 400; }

.student-tile.signed { border-color: var(--success); background: var(--success-bg); }
.student-tile.signed:hover { background: #d1fae5; }

/* ============ 签到 IP 异常高亮(实时看板贴片 + 签到历史表格) ============ */

/* 同一节课多人同 IP 签到:橙色(疑似一人代多人签) */
.student-tile.ip-dup { border-color: #f59e0b; background: #fffbeb; }
.student-tile.ip-dup:hover { background: #fef3c7; }
/* 签到 IP 与上机号预设 IP 不符:红色(非本人电脑代签) */
.student-tile.ip-mismatch { border-color: var(--danger); background: #fef2f2; }
.student-tile.ip-mismatch:hover { background: #fee2e2; }

/* 贴片内的警示小标签 */
.stu-ip-flags { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
.stu-flag.ip-flag-dup { color: #b45309; }
.stu-flag.ip-flag-mismatch { color: var(--danger); }

/* 签到历史表格:IP 单元格高亮(单元格背景覆盖行悬停灰底;写在无效行之后,同命中时 IP 高亮优先) */
.ip-cell { font-family: var(--mono-font, monospace); font-size: 12px; }
tr.att-invalid td { background: #fff5f5; color: var(--text-light); }
tr.att-invalid:hover td { background: #ffecec; }
.att-invalid-time { color: var(--danger); text-decoration: line-through; }
td.ip-dup, table.data td.ip-dup { background: #fff7e0; color: #92400e; font-weight: 600; }
td.ip-mismatch, table.data td.ip-mismatch { background: #fee2e2; color: #b91c1c; font-weight: 600; }

/* IP 高亮图例(看板名单网格内 / 签到历史表格上方) */
.ip-legend {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-light);
}
.ip-legend-chip {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.ip-legend-chip.dup { background: #fff7e0; color: #92400e; border: 1px solid #f59e0b; }
.ip-legend-chip.mismatch { background: #fee2e2; color: #b91c1c; border: 1px solid var(--danger); }

/* 签到历史表头排序(沿用作业分析 sortable-th) */
table.data th.sortable-th { cursor: pointer; user-select: none; }

/* ============ 学生作业面板 ============ */
.session-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--primary-bg), #eef2ff);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.session-bar .who { display: flex; flex-direction: column; }
.session-bar .who .name { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.session-bar .who .meta { font-size: 12px; color: var(--text-light); }
.session-bar .spacer { flex: 1; }

.hw-card { display: flex; flex-direction: column; gap: 12px; }
.hw-card.deadline-passed { border-color: var(--warn); }

.hw-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.hw-head .hw-title { font-size: 16px; font-weight: 700; flex: 1; min-width: 200px; }
.hw-desc { color: var(--gray-6); font-size: 14px; white-space: pre-wrap; }

.hw-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text-light); align-items: center; }

.hw-templates { display: flex; flex-wrap: wrap; gap: 8px; }

.tpl-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 7px 12px;
  min-height: 38px;
  border: 1px solid var(--gray-4);
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
}
.tpl-link:hover { background: var(--primary-bg); border-color: var(--primary); }

.my-submission {
  border-top: 1px dashed var(--gray-3);
  padding-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.my-submission .file-info { font-size: 13px; color: var(--gray-6); flex: 1; min-width: 220px; }
.my-submission .file-info .fname { font-weight: 600; color: var(--text); word-break: break-all; }

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  min-height: 44px;
  font-size: 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
}
.file-label:hover { background: var(--primary-dark); }
.file-label input[type="file"] { display: none; }

/* 签到页「正常签到 ↔ 作业补交」切换链接 */
.toggle-link { color: var(--primary); font-size: 13.5px; text-decoration: none; }
.toggle-link:hover { text-decoration: underline; }

/* 补交模式横幅 */
.makeup-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--warn-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
  color: #92400e;
}
.makeup-banner .mb-icon { font-size: 17px; line-height: 1.4; }
.makeup-banner b { margin-right: 6px; }
.makeup-banner span { color: #92400e; }

/* 教师评分/批注展示(学生端作业卡与课堂记录) */
.my-submission .grade-box { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.grade-comment {
  font-size: 13px;
  color: var(--gray-6);
  background: var(--gray-1);
  border: 1px dashed var(--gray-3);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  word-break: break-all;
  white-space: normal;
}
.grade-comment .gc-label { color: var(--text-light); }

/* ============ 教师工作台 ============ */
.teacher-login-wrap { max-width: 420px; margin: 48px auto 0; }

.login-card { padding: 30px 26px; }
.login-card h2 { font-size: 20px; margin-bottom: 6px; }
.login-card .sub { color: var(--text-light); font-size: 13px; margin-bottom: 18px; }
.login-icon {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--success-bg); color: var(--success-dark);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-3);
  margin-bottom: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-bar .tab {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-light);
  padding: 11px 14px;
  min-height: 48px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}

.tab-bar .tab:hover { color: var(--primary); }
.tab-bar .tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}

.toolbar .field { margin-bottom: 0; min-width: 150px; }
.toolbar .field.grow { flex: 1; min-width: 200px; }

/* 看板 */
.course-card { padding: 16px 18px; }
.course-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.course-head .time { font-weight: 700; font-size: 15px; }
.course-head .subject { color: var(--primary-dark); font-weight: 600; }
.course-head .spacer { flex: 1; }
.course-stats { display: flex; gap: 18px; align-items: center; margin-top: 10px; flex-wrap: wrap; font-size: 13px; color: var(--gray-6); }
.course-stats b { color: var(--success-dark); font-size: 16px; }

.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); display: inline-block; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* 名册 */
.roster-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }

.class-list { display: flex; flex-direction: column; gap: 8px; }

.class-item {
  border: 1.5px solid var(--gray-3);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  min-height: 50px;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.class-item:hover { border-color: var(--primary); }
.class-item.active { border-color: var(--primary); background: var(--primary-bg); font-weight: 600; }
.class-item .cnt { font-size: 12px; color: var(--text-light); font-weight: 400; }

/* 周课表 */
.week-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.week-col { background: #fff; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); padding: 10px; min-height: 100px; }
.week-col h4 { font-size: 13px; color: var(--gray-6); text-align: center; padding-bottom: 8px; border-bottom: 1px solid var(--gray-2); margin-bottom: 8px; }
.week-col.today h4 { color: var(--primary); font-weight: 700; }

/* 周课表各列下一次上课日的智能跳过标记:节假日停课(红)/学期外(灰)/正常(浅灰) */
.week-col-sub {
  font-size: 11px;
  line-height: 1.5;
  color: var(--gray-5, #6b7280);
  text-align: center;
  background: var(--gray-2);
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px 0 8px;
}
.week-col-sub.is-holiday { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.week-col-sub.is-out { background: var(--gray-2); color: var(--gray-6); }

.lesson-block {
  border: 1px solid var(--primary-light);
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.lesson-block b { display: block; font-size: 13px; color: var(--primary-dark); }
.lesson-block .lesson-sub { display: block; color: var(--text-light); }
.lesson-acts { display: flex; gap: 6px; margin-top: 8px; }
.lesson-act {
  flex: 1;
  border: 1px solid var(--gray-3);
  background: #fff;
  color: var(--gray-6);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 6px;
  min-height: 28px;
  border-radius: var(--radius-sm);
}
.lesson-act.edit:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-bg); }
.lesson-act.del:hover { color: var(--danger); border-color: var(--danger); }
/* 周课表中的临时调整:加课卡片(橙色虚线)与常规课上的改时段/停课标注 */
.lesson-block.lesson-ov { border: 1px dashed var(--warn); background: var(--warn-bg); }
.lesson-ov .lesson-ov-tag { display: block; font-size: 12px; color: var(--warn); font-weight: 600; margin-top: 2px; }
.lesson-sub.lesson-ov-note { display: block; color: var(--warn); font-weight: 600; }
.lesson-sub.lesson-ov-note.is-cancel { color: var(--danger); }

/* 作业卡片 */
.asg-card .hw-head .hw-title { font-size: 16px; }
.asg-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.active-lesson-ctl { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 4px 8px; background: var(--gray-2); border-radius: var(--radius-sm); }
.active-lesson-ctl select { padding: 6px 8px; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); font-family: inherit; font-size: 13px; min-height: 32px; background: #fff; }

/* 快捷设置当堂课(布置作业上方的横条) */
.quick-lesson { border-left: 3px solid var(--primary); }
.quick-lesson-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quick-lesson-row .ql-label { font-size: 13px; font-weight: 600; color: var(--gray-6); white-space: nowrap; }
.quick-lesson-row select {
  flex: 1; min-width: 180px; max-width: 420px; padding: 7px 8px;
  border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; min-height: 36px; background: #fff;
}
.quick-lesson-row select option:disabled { color: var(--gray-4); }

.sub-list-wrap { border-top: 1px dashed var(--gray-3); padding-top: 12px; }
.sub-group-head {
  margin: 14px 0 6px; font-weight: 600; font-size: 14px; color: var(--gray-6);
  display: flex; align-items: center; gap: 8px;
}
.sub-group-head::before {
  content: ''; display: inline-block; width: 4px; height: 16px;
  background: var(--primary); border-radius: 2px;
}

/* 统计视角切换 */
.stat-views { display: flex; gap: 6px; background: var(--gray-2); padding: 4px; border-radius: var(--radius-sm); width: fit-content; margin-bottom: 14px; }
.stat-views button {
  border: none; background: none; font-family: inherit;
  padding: 8px 16px; min-height: 40px; font-size: 14px; font-weight: 600;
  color: var(--gray-6); border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.stat-views button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

.rate-cell { display: flex; align-items: center; gap: 8px; }

/* 学生分组统计行 */
.stu-group td { background: var(--gray-1); font-weight: 600; }
.stu-detail-row td { color: var(--gray-6); white-space: normal; }
.missing-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 3px 0; }
.missing-class { font-size: 13px; font-weight: 600; color: var(--text-light); }
.missing-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.missing-tags .mtag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.5;
}

/* 统计-按班级 学生明细行 */
.stat-sub-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 3px 0; }
.stat-sub-row .sub-no { font-size: 12px; color: var(--text-light); min-width: 46px; }
.stat-sub-row .sub-name { font-weight: 600; }
.stat-sub-row .sub-time { font-size: 12px; color: var(--text-light); }
.stat-sub-row .sub-file { font-size: 12.5px; word-break: break-all; }
.file-cell { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* 课程进度 */
.prog-subject {
  margin: 14px 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  padding: 4px 10px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
}
.prog-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--gray-3);
  flex-wrap: wrap;
}
.prog-row:last-child { border-bottom: none; }
.prog-row .idx { color: var(--text-light); font-size: 12px; min-width: 24px; }
.prog-row .prog-title { flex: 1; min-width: 120px; font-size: 14.5px; }
.prog-hws { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.prog-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--gray-2);
  overflow: hidden;
  margin-top: 6px;
  min-width: 80px;
  max-width: 160px;
}
.prog-bar i { display: block; height: 100%; background: var(--success); border-radius: 999px; }

/* 学生端-我的课堂记录 */
.hist-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.hist-sub-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.hist-scroll {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-sm);
  background: #fff;
}

.kv { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.kv .k { font-size: 12px; color: var(--text-light); }
.kv .v { font-weight: 700; }

.notice {
  background: var(--warn-bg);
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.notice.blue { background: var(--primary-bg); border-color: var(--primary-light); color: var(--primary-dark); }
.notice.danger { background: var(--danger-bg); border-color: #fecaca; color: var(--danger); }

.muted { color: var(--text-light); font-size: 13px; }

.divider { border: none; border-top: 1px dashed var(--gray-3); margin: 14px 0; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checkbox-group label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 14px; min-height: 38px; cursor: pointer; user-select: none;
}
.checkbox-group input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

.empty-tip { text-align: center; color: var(--text-light); padding: 34px 10px; }
.empty-tip svg { width: 44px; height: 44px; color: var(--gray-4); margin-bottom: 8px; }
.empty-tip p { font-size: 14px; }

.collapse-head { cursor: pointer; user-select: none; }
.collapse-head:hover { color: var(--primary); }

/* ============ 在线测试(选择题) ============ */

/* 教师端:作业形式切换 */
.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }

.radio-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; min-height: 42px;
  border: 1.5px solid var(--gray-4); border-radius: var(--radius);
  background: #fff; cursor: pointer; user-select: none;
  font-size: 14px; transition: border-color .15s, background .15s;
}
.radio-pill:hover { border-color: var(--primary); background: var(--primary-bg); }
.radio-pill.active { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-dark); font-weight: 600; }
.radio-pill input[type="radio"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.radio-pill:has(input:disabled) { cursor: default; opacity: .75; background: var(--gray-1); }

/* 教师端:题库编辑器 */
.quiz-editor { display: flex; flex-direction: column; gap: 14px; }

.quiz-q {
  border: 1px solid var(--gray-3); border-radius: var(--radius);
  padding: 14px; background: var(--gray-1);
  display: flex; flex-direction: column; gap: 10px;
}

.quiz-q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quiz-q-head .spacer { flex: 1; }

.quiz-opts { display: flex; flex-direction: column; gap: 8px; }

.quiz-opt { display: flex; align-items: center; gap: 8px; }
.quiz-opt input[type="radio"] { width: 17px; height: 17px; accent-color: var(--success); cursor: pointer; margin: 0; flex-shrink: 0; }
.quiz-opt input[type="text"] { flex: 1; }
.quiz-opt-del { flex-shrink: 0; min-height: 34px; }

.quiz-opt-letter {
  width: 24px; height: 24px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gray-2); border: 1px solid var(--gray-3);
  border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--gray-6);
}

/* 学生端:作答选项 */
.quiz-take-q {
  border: 1px solid var(--gray-3); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; background: #fff;
  display: flex; flex-direction: column; gap: 10px;
}

.quiz-take-stem { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; line-height: 1.7; white-space: pre-wrap; }
.quiz-take-opts { display: flex; flex-direction: column; gap: 8px; }

/* 教师开启「插入解析」:学生作答时题下直接显示的解析提示框(琥珀色,区别于交卷后的蓝色解析) */
.quiz-take-analysis {
  background: var(--warn-bg); border: 1px dashed var(--warn);
  border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--gray-6); font-size: 14px; line-height: 1.7; font-weight: 400;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.quiz-take-analysis b { color: var(--warn); font-weight: 700; }

.quiz-answer {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; min-height: 46px;
  border: 1.5px solid var(--gray-3); border-radius: var(--radius);
  background: var(--gray-1); cursor: pointer; user-select: none;
  transition: border-color .12s, background .12s;
}
.quiz-answer:hover { border-color: var(--primary); background: var(--primary-bg); }
.quiz-answer input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; flex-shrink: 0; }
.quiz-answer:has(input:checked) { border-color: var(--primary); background: var(--primary-bg); }

.quiz-answer-text { flex: 1; line-height: 1.6; white-space: pre-wrap; }

/* ---- 题目配图(题干/选项,教师布置与学生作答通用) ---- */
.quiz-stem-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.quiz-image {
  display: block; width: auto; height: auto;
  max-width: min(440px, 100%); max-height: 320px;
  border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  background: #fff; object-fit: contain;
}
.quiz-image-sm { max-width: min(260px, 100%); max-height: 140px; }
.quiz-answer-text:has(> img) { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; white-space: normal; }
.quiz-review-stem > img, .exam-view-stem > img, .analysis-q-stem > img { margin-top: 8px; }
.quiz-review-opt .quiz-answer-text { flex: 1; }

/* 教师端:编辑器配图控件 */
.qimg-row { margin-top: 8px; }
.qimg-picker { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qimg-thumb {
  width: 46px; height: 34px; object-fit: cover;
  border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer;
}
.qimg-picker .btn { flex-shrink: 0; }
.bank-thumb {
  height: 30px; max-width: 48px; object-fit: cover;
  border: 1px solid var(--gray-3); border-radius: 3px;
  vertical-align: middle; margin-right: 6px;
}

/* 学生端:成绩横幅 */
.quiz-score-banner {
  display: flex; align-items: center; gap: 18px;
  padding: 16px; border-radius: var(--radius);
  background: var(--gray-1); border: 1px solid var(--gray-3);
}

.quiz-score-num {
  font-size: 44px; font-weight: 800; line-height: 1;
  min-width: 96px; text-align: center; padding: 14px 10px;
  border-radius: var(--radius); background: #fff;
  border: 2px solid var(--gray-3);
}
.quiz-score-num.green { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.quiz-score-num.red { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

/* 学生端:逐题解析 */
.quiz-review-q {
  border: 1px solid var(--gray-3); border-left-width: 4px; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fff;
}
.quiz-review-q.ok { border-left-color: var(--success); }
.quiz-review-q.bad { border-left-color: var(--danger); }

.quiz-review-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quiz-review-head .spacer { flex: 1; }

.quiz-review-stem { font-weight: 600; line-height: 1.7; white-space: pre-wrap; }
.quiz-review-opts { display: flex; flex-direction: column; gap: 6px; }

.quiz-review-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-3); background: var(--gray-1);
}
.quiz-review-opt.right { border-color: var(--success); background: var(--success-bg); }
.quiz-review-opt.wrong { border-color: var(--danger); background: var(--danger-bg); }
.quiz-review-opt .badge { flex-shrink: 0; }
.quiz-review-opt .quiz-answer-text { flex: 1; }

.quiz-review-analysis {
  background: var(--primary-bg); border: 1px dashed var(--primary-light);
  border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--gray-6); font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.quiz-review-analysis b { color: var(--primary-dark); }

/* ============ 操作日志(审计) ============ */

.audit-log-lines {
  max-height: 420px; overflow-y: auto;
  border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  background: var(--gray-1); padding: 8px 0;
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.65;
}
.audit-line { padding: 1px 12px; white-space: pre-wrap; word-break: break-all; color: var(--gray-6); }
.audit-line.audit-teacher { color: var(--danger); }
.audit-line.audit-student { color: var(--success-dark); }
.audit-line.audit-system { color: var(--primary-dark); }

/* ============ 代码填空(Python)编辑器 ============ */

.code-editor {
  border: 1px solid var(--gray-3); border-radius: var(--radius);
  background: #fbfbfd; padding: 14px 16px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14.5px; line-height: 1.9;
  overflow-x: auto;
}

.code-line {
  display: flex; align-items: flex-start; gap: 0;
  white-space: pre; min-height: 1.9em;
  padding: 1px 4px;
}
.code-line .code-txt { white-space: pre; }

.code-blank-input {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14.5px; line-height: 1.5;
  padding: 2px 6px; margin: 0 2px;
  min-width: 56px; max-width: 280px;
  border: 1.5px dashed var(--primary);
  border-radius: 6px; background: #fff;
  color: var(--primary-dark);
}
.code-blank-input:focus { outline: none; border-style: solid; box-shadow: 0 0 0 3px var(--primary-bg); }
.code-blank-input::placeholder { color: #b9bec7; }

.code-blank-textarea {
  display: block; flex: 1; min-width: 0;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14.5px; line-height: 1.6;
  padding: 4px 8px; margin: 2px 0;
  min-height: 32px; resize: vertical;
  border: 1.5px dashed var(--primary);
  border-radius: 6px; background: #fff;
  color: var(--primary-dark);
}
.code-blank-textarea:focus { outline: none; border-style: solid; box-shadow: 0 0 0 3px var(--primary-bg); }
.code-blank-textarea::placeholder { color: #b9bec7; }

/* 调试运行输出区 */
.code-run-box {
  border: 1px solid var(--gray-3); border-radius: var(--radius);
  padding: 12px 14px; background: #0f172a; color: #e2e8f0;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
  max-height: 320px; overflow: auto;
}
.code-run-box.ok { border-color: var(--success); }
.code-run-box.bad { border-color: var(--danger); }
.code-run-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.code-run-title .spacer { flex: 1; }

/* 提交结果:逐空解析 */
.code-review-blank {
  border: 1px solid var(--gray-3); border-left-width: 4px; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; background: #fff;
  display: flex; flex-direction: column; gap: 8px;
}
.code-review-blank.ok { border-left-color: var(--success); }
.code-review-blank.bad { border-left-color: var(--danger); }
.code-review-blank pre {
  margin: 0; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--gray-1); border: 1px solid var(--gray-3);
  font-family: Consolas, 'Courier New', monospace; font-size: 13.5px;
  white-space: pre-wrap; word-break: break-all; line-height: 1.7;
}
.code-review-blank pre.mine { border-color: var(--gray-4); }
.code-review-blank pre.right { border-color: var(--success); background: var(--success-bg); }

/* 教师端:代码填空模板编辑器 */
.code-tpl-input {
  width: 100%;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14.5px; line-height: 1.75;
  padding: 10px 12px;
  border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  background: #fbfbfd; color: var(--text);
  resize: vertical; min-height: 220px;
}
.code-tpl-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.code-tpl-input::placeholder { color: #b9bec7; }

.code-ans-input {
  width: 100%;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px; line-height: 1.6;
  padding: 6px 10px;
  border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  resize: vertical;
}
.code-ans-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

/* 教师端:学生提交代码查看 */
.code-view-src {
  margin: 0; padding: 12px 14px;
  border: 1px solid var(--gray-3); border-radius: var(--radius);
  background: #fbfbfd;
  font-family: Consolas, 'Courier New', monospace; font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
  max-height: 340px; overflow: auto;
}

/* ============ 作业分析:题目讲解弹窗 ============ */
.modal.analysis-modal { width: min(94vw, 780px); }
.analysis-view-link { color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.analysis-q-stem { font-size: 15px; color: var(--text); font-weight: 600; margin-bottom: 10px; white-space: pre-wrap; overflow-wrap: break-word; }
.analysis-q-opt { padding: 7px 12px; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.analysis-q-opt.ok { background: var(--success-bg); border-color: var(--success); color: var(--success-dark); font-weight: 600; }
.analysis-opt-count { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--text-light); background: var(--gray-2); border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.analysis-q-opt.ok .analysis-opt-count { background: rgba(22, 163, 74, .12); color: var(--success-dark); }
.analysis-q-analysis { margin-top: 12px; background: var(--gray-1); border-radius: var(--radius-sm); padding: 10px 12px; }
.analysis-q-k { color: var(--text-light); margin-right: 6px; }
.analysis-q-v { white-space: pre-wrap; overflow-wrap: break-word; }
.analysis-template .blank-mark { color: var(--primary); font-weight: 700; }
.analysis-template .blank-mark.focus { background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 0 3px; }
.analysis-code-answer { margin-bottom: 8px; }
.analysis-code-answer.focus .analysis-q-k { color: var(--warn); font-weight: 600; }
.analysis-code-answer-text { margin: 4px 0 0; background: var(--gray-1); border-radius: var(--radius-sm); padding: 8px 10px; white-space: pre-wrap; overflow-wrap: break-word; font-size: 13px; font-family: Consolas, 'Courier New', monospace; }
.analysis-run-row { display: flex; gap: 10px; margin: 10px 0; align-items: flex-start; }
.analysis-run-row .analysis-stdin { flex: 1; }

/* ============ 题库组卷 ============ */
/* 题库导出卡片:知识点按主题分组多选 */
.bank-export-list { border: 1px solid var(--gray-3); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 300px; overflow: auto; background: var(--gray-1); }
.bank-export-group { margin-bottom: 10px; }
.bank-export-group:last-child { margin-bottom: 0; }
.bank-export-topic { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13.5px; cursor: pointer; }
.bank-export-topic input { width: 15px; height: 15px; cursor: pointer; }
.bank-export-ks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0 4px 22px; }
.bank-export-k { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; cursor: pointer; }
.bank-export-k input { width: 14px; height: 14px; cursor: pointer; }
.bank-topic-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bank-topic-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--primary-bg); color: var(--primary);
  font-size: 13px; font-weight: 600; cursor: default;
}
.bank-topic-empty { background: var(--gray-1); color: var(--text-light); font-weight: 400; }
.bank-format-help { border: 1px dashed var(--gray-3); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; background: var(--gray-1); }
.bank-format-help summary { cursor: pointer; font-weight: 600; color: var(--text); }
.bank-format-example {
  margin: 8px 0 0; padding: 10px 12px;
  background: #fbfbfd; border: 1px solid var(--gray-3); border-radius: var(--radius-sm);
  font-family: Consolas, 'Courier New', monospace; font-size: 12.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-all;
  max-height: 320px; overflow: auto;
}
.bank-import-input { font-family: Consolas, 'Courier New', monospace; font-size: 13px; }
.bank-table { width: 100%; }
.bank-table .bank-stem-cell { max-width: 380px; white-space: normal; overflow-wrap: anywhere; }
.bank-table .bank-know-cell { max-width: 220px; font-size: 13px; color: var(--text-light); }
.bank-mode-row { margin-bottom: 2px; }
.bank-mode-row label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.bank-mode-row input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--text); }
.inline-ctl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.inline-ctl input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ============ 学业测试整卷查看(讲评弹窗) ============ */
.exam-view-q { padding: 14px 0; border-bottom: 1px solid var(--gray-2); }
.exam-view-q:last-child { border-bottom: none; }
.exam-view-qhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.exam-view-stem { font-size: 15px; color: var(--text); font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 8px; }
.exam-view-opts { display: flex; flex-direction: column; gap: 6px; }
.exam-view-opt { padding: 7px 12px; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); }
.exam-view-opt.correct { background: var(--success-bg); border-color: var(--success); color: var(--success-dark); font-weight: 600; }
.exam-view-analysis { margin-top: 10px; background: var(--gray-1); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ============ 响应式(窄屏自动重排) ============ */
@media (max-width: 960px) {
  .roster-layout { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .app-main { padding: 14px; }
  .app-header-inner { padding: 8px 14px; }
  .brand-sub { display: none; }
  .server-date { display: none; }

  .role-cards { grid-template-columns: 1fr; }
  .student-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .class-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  .week-grid { grid-template-columns: 1fr; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .field { min-width: 0; }

  .my-submission { flex-direction: column; align-items: flex-start; }

  .session-bar { padding: 12px 14px; }

  table.data th, table.data td { padding: 8px 8px; font-size: 13px; }

  .stat-views { width: 100%; }
  .stat-views button { flex: 1; }
}

@media (max-width: 420px) {
  .student-grid { grid-template-columns: repeat(2, 1fr); }
  .class-grid { grid-template-columns: 1fr 1fr; }
}

/* 打印隐藏交互元素 */
@media print {
  .app-header, .app-footer, .btn, .tab-bar, .toolbar, .toast-wrap { display: none !important; }
  .card { box-shadow: none; }
}

/* ============ 教学课件 ============ */

/* 教师端:上传表单与课件列表 */
.cw-upload-row { display: flex; gap: 18px; flex-wrap: wrap; }
.cw-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 240px; flex: 1; }
.cw-field input[type='text'],
.cw-field input[type='file'],
.cw-field select { padding: 8px 10px; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); font-size: 14px; background: #fff; }
.cw-cur-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.cw-cur-check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--gray-6); cursor: pointer; }
.cw-active-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cw-set-inline { display: inline-flex; align-items: center; gap: 6px; }
.cw-set-inline select { padding: 4px 6px; border: 1px solid var(--gray-3); border-radius: var(--radius-sm); font-size: 13px; background: #fff; }
.cw-unset-btn { border: none; background: none; color: inherit; cursor: pointer; font-size: 11px; line-height: 1; padding: 0 1px 0 5px; opacity: .75; }
.cw-unset-btn:hover { opacity: 1; color: var(--danger); }

/* 学生端:当堂课课件卡片 */
.cw-student-card { border-left: 4px solid var(--primary); }
.cw-student-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--gray-2); }
.cw-student-item:first-of-type { border-top: none; }
.cw-student-info { flex: 1; min-width: 0; }

/* 师生共用:全屏课件查看器 */
.cw-viewer-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .72);
  display: flex;
  flex-direction: column;
  padding: 20px;
  z-index: 950; /* 全屏查看器:低于宠物中心(1100)、普通模态(1150)、抢答(1200)、toast(1300) */
}
.cw-viewer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex: none; }
.cw-viewer-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; color: #fff; }
.cw-viewer-title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-viewer-sub { font-size: 13px; color: rgba(255, 255, 255, .75); white-space: nowrap; }
.cw-viewer { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* PPT 幻灯片预览 */
.cw-slide { flex: 1; min-height: 0; overflow-y: auto; padding: 34px 44px; max-width: 1020px; width: 100%; margin: 0 auto; }
.cw-slide-title { font-size: 26px; font-weight: 700; color: var(--text); margin-bottom: 18px; line-height: 1.35; }
.cw-slide-text { font-size: 18px; color: var(--gray-6); line-height: 1.75; margin-bottom: 12px; white-space: pre-wrap; word-break: break-word; }
.cw-slide-img { display: block; max-width: 100%; max-height: 52vh; margin: 6px auto 14px; border: 1px solid var(--gray-2); border-radius: var(--radius-sm); background: #fff; }
.cw-slide-empty { text-align: center; padding: 60px 0; font-size: 14px; }
.cw-slide-nav { flex: none; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 10px; border-top: 1px solid var(--gray-2); background: #fafafa; }
.cw-page-label { font-size: 14px; color: var(--gray-5); min-width: 72px; text-align: center; }

/* 视频与网页课件 */
.cw-video { flex: 1; min-height: 0; width: 100%; height: 100%; background: #000; display: block; }
.cw-frame { flex: 1; min-height: 0; width: 100%; border: none; background: #fff; }

@media (max-width: 640px) {
  .cw-viewer-mask { padding: 8px; }
  .cw-slide { padding: 18px 16px; }
  .cw-slide-title { font-size: 20px; }
  .cw-slide-text { font-size: 15px; }
  .cw-student-item { flex-wrap: wrap; }
}

/* ============ 随机点名 ============ */
.rollcall-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-6);
  cursor: pointer;
  user-select: none;
  margin: 2px 0 4px;
}
.rollcall-mode input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.rollcall-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  border: 1px dashed var(--gray-3);
  border-radius: var(--radius);
  background: var(--gray-1);
  padding: 20px;
  margin: 10px 0;
  gap: 6px;
}
.rollcall-stage-name {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.25;
  color: var(--primary);
}
.rollcall-stage-name.is-rolling { color: var(--gray-5); font-weight: 600; }
.rollcall-stage-sub { font-size: 14px; color: var(--text-light); }
.rollcall-stage.done { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.rollcall-stage.done .rollcall-stage-name { color: var(--success-dark); }
.rollcall-stage-name.pop { animation: rollcallPop .45s ease; }
@keyframes rollcallPop {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}
.rollcall-called { display: flex; flex-wrap: wrap; gap: 6px; }
.rollcall-called .rc-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.6;
  background: var(--gray-2);
  color: var(--text);
}
.rollcall-called .rc-chip.latest { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.rollcall-called .rc-chip .num { color: var(--gray-5); margin-right: 4px; font-size: 12px; }
.rollcall-called .rc-chip.latest .num { color: var(--primary); }

/* ---- 答题确认(点名/抢答点到不直接加分,教师确认后入账) ---- */
.ans-list { display: flex; flex-direction: column; gap: 8px; }
.ans-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-2);
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.ans-item:hover { border-color: var(--primary-light); box-shadow: 0 3px 10px rgba(37, 99, 235, .08); }
.ans-kind {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.ans-kind.buzz { background: #ffedd5; color: #b45309; }
.ans-stu { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ans-stu b { font-size: 15px; color: var(--text); }
.ans-meta { font-size: 12px; color: var(--gray-5); }
.ans-ops { flex: none; display: flex; gap: 6px; }
.ans-btn { padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.ans-empty {
  text-align: center;
  color: var(--gray-5);
  font-size: 13.5px;
  padding: 22px 10px;
  border: 1px dashed var(--gray-3);
  border-radius: 10px;
  background: var(--gray-1);
}
/* 已确认答题记录折叠区(默认收起,点标题行展开) */
.ans-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  margin-top: 10px;
  border: 1px solid var(--gray-2);
  border-radius: 10px;
  background: var(--gray-1);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s;
}
.ans-toggle:hover { border-color: var(--primary); }
.ans-toggle-arrow {
  display: inline-block;
  color: var(--primary);
  font-weight: 700;
  transition: transform .15s;
}
.ans-toggle-arrow.open { transform: rotate(90deg); }
.ans-history { margin-top: 8px; }
.ans-item.done { background: var(--gray-1); border-style: dashed; }
.ans-item.done:hover { border-color: var(--gray-3); box-shadow: none; }
.ans-done { flex: none; }

/* ============ 电子宠物系统(学生端挂件/宠物中心 + 教师端宠物中心) ============ */

/* ---- 学生端:右下角宠物挂件 ---- */
.pet-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(24px) scale(.85);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.pet-widget.show { opacity: 1; transform: none; pointer-events: auto; }
.pet-img-wrap { position: relative; line-height: 0; }
.pet-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  cursor: pointer;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, .18));
  transition: transform .2s;
}
.pet-img:hover { transform: scale(1.07); }
.pet-img.wiggle { animation: petWiggle .65s ease; }
@keyframes petWiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-10deg) scale(1.08); }
  40% { transform: rotate(8deg) scale(1.05); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}
.pet-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--gray-3);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  line-height: 1.6;
  white-space: nowrap;
}
.pet-pts { color: var(--warn); }
.pet-open-btn {
  border: 1px solid var(--primary);
  background: var(--primary-bg);
  color: var(--primary-dark);
  padding: 5px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, transform .15s;
}
.pet-open-btn:hover { background: var(--primary-light); transform: translateY(-1px); }

/* 宠物气泡(挂件上方) */
.pet-bubble {
  position: absolute; /* 脱离挂件布局流:不撑宽挂件,宠物图片位置不再随气泡文字长短移动 */
  right: 0;          /* 右缘与挂件右缘对齐,长文字只向左伸展,不会超出屏幕右缘 */
  bottom: calc(100% + 6px); /* 底部固定悬于宠物图片上方,多行文字只向上生长 */
  width: max-content;
  max-width: 250px;
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transform-origin: 100% 100%;
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.pet-bubble.show { opacity: 1; transform: none; }
.pet-bubble::after {
  content: '';
  position: absolute;
  right: 34px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid var(--gray-3);
  border-bottom: 1px solid var(--gray-3);
  transform: rotate(45deg);
}

/* 宠物等级徽章(Lv.0 ~ Lv.8 + 毕业) */
.pet-lv-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
  white-space: nowrap;
}
.pet-lv-badge.lv0 { background: var(--gray-2); color: var(--gray-6); }
.pet-lv-badge.lv1 { background: #dbeafe; color: #1d4ed8; }
.pet-lv-badge.lv2 { background: #dcfce7; color: #15803d; }
.pet-lv-badge.lv3 { background: #ccfbf1; color: #0f766e; }
.pet-lv-badge.lv4 { background: #fef9c3; color: #a16207; }
.pet-lv-badge.lv5 { background: #ffedd5; color: #c2410c; }
.pet-lv-badge.lv6 { background: #fce7f3; color: #be185d; }
.pet-lv-badge.lv7 { background: #ede9fe; color: #6d28d9; }
.pet-lv-badge.lv8 { background: #e9d5ff; color: #7e22ce; box-shadow: 0 0 0 2px #f3e8ff; }
.pet-lv-badge.grad {
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  color: #78350f;
  box-shadow: 0 2px 8px rgba(251, 191, 36, .5);
}

/* ---- 学生端:课堂抢答弹窗 ---- */
.buzz-mask {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: petFadeIn .2s ease;
}
.buzz-card {
  width: min(480px, 92vw);
  background: linear-gradient(165deg, #fff 55%, #eff6ff);
  border-radius: 18px;
  padding: 24px 22px 18px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: buzzIn .32s cubic-bezier(.34, 1.56, .64, 1);
}
.buzz-title { font-size: 21px; font-weight: 800; color: var(--primary-dark); margin-bottom: 10px; }
.buzz-sub { font-size: 14px; color: var(--text-light); margin-bottom: 16px; line-height: 1.65; }
.buzz-press-btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  animation: buzzPulse 1.2s ease-in-out infinite;
  transition: transform .1s;
}
.buzz-press-btn:active { transform: scale(.96); }
.buzz-dismiss { margin-top: 12px; }
@keyframes buzzPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(239, 68, 68, .35); }
  50% { box-shadow: 0 8px 28px rgba(239, 68, 68, .6); }
}
@keyframes buzzIn {
  from { transform: scale(.65) translateY(20px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes petFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- 宠物中心弹层(学生端) ---- */
.pc-mask {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: petFadeIn .2s ease;
}
.pc-shell {
  width: min(880px, 94vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: buzzIn .28s ease;
}
.pc-head {
  display: flex;
  flex: none; /* 内容超高时头部行不被 flex 收缩压扁 */
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-3);
  background: linear-gradient(135deg, var(--primary-bg), #fff);
}
.pc-title { font-size: 17px; font-weight: 800; }
.pc-tabs {
  display: flex;
  flex: none; /* 标签行保持自然高度,切到宠物库/排行榜等高内容页时不被挤窄 */
  gap: 4px;
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--gray-3);
  background: var(--gray-1);
  overflow-x: auto;
}
.pc-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-light);
  border-radius: 9px 9px 0 0;
  white-space: nowrap;
  font-family: inherit;
}
.pc-tab:hover { color: var(--primary-dark); }
.pc-tab.active { background: #fff; color: var(--primary-dark); font-weight: 700; }
.pc-body { padding: 18px; overflow-y: auto; flex: 1; min-height: 0; /* 超高内容由本区滚动,不挤压头部/标签行 */ }

/* 我的宠物 */
.pc-home-top {
  display: flex;
  gap: 20px;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-bg), #fff);
  border: 1px solid var(--gray-3);
  border-radius: 14px;
  padding: 16px;
}
.pc-pet-big {
  width: 132px;
  height: 132px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, .16));
}
.pc-home-meta { flex: 1; min-width: 0; }
.pc-pet-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-pts-big { font-size: 30px; font-weight: 800; color: var(--warn); margin: 2px 0 6px; line-height: 1.2; }
.pc-progress-bar { height: 10px; background: var(--gray-3); border-radius: 999px; overflow: hidden; }
.pc-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #22c55e);
  transition: width .5s;
}
.pc-progress-text { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.pc-humor {
  font-size: 13.5px;
  color: var(--gray-6);
  background: var(--warn-bg);
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 8px;
  line-height: 1.55;
}
.pc-sec-title { font-size: 14.5px; font-weight: 700; margin: 18px 0 8px; }
.pc-events { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.pc-event {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: 8px;
  padding: 7px 10px;
}
.pc-event-date { flex: none; color: var(--gray-5); font-size: 12.5px; }
.pc-event-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-event-pts { flex: none; font-weight: 700; }
.pc-event-pts.plus { color: var(--success-dark); }
.pc-event-pts.minus { color: var(--danger); }

/* 宠物库(更换形象) */
.pc-shop-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pc-shop-toolbar .pc-search { width: 220px; flex: none; }
.pc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-chip {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--gray-3);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-6);
  font-family: inherit;
  transition: all .15s;
}
.pc-chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.pc-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pc-shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; }
.pc-pet-card {
  border: 1px solid var(--gray-3);
  border-radius: 10px;
  background: #fff;
  padding: 8px 4px 6px;
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  font-family: inherit;
}
.pc-pet-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.pc-pet-card.cur { border-color: var(--success); background: var(--success-bg); }
.pc-pet-card img { width: 100%; height: 64px; object-fit: contain; display: block; }
.pc-pet-card-name {
  font-size: 12.5px;
  color: var(--gray-6);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-pet-card.cur .pc-pet-card-name { color: var(--success-dark); font-weight: 700; }
.pc-pet-card-tag {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 11px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.pc-preview-strip { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.pc-preview-item {
  text-align: center;
  padding: 6px 2px;
  border-radius: 8px;
  border: 1px solid var(--gray-2);
  background: var(--gray-1);
  cursor: zoom-in;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pc-preview-item:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 4px 10px rgba(37, 99, 235, .12); }
.pc-preview-item:focus { outline: 2px solid var(--primary-light); outline-offset: 1px; }
.pc-preview-item.cur { border-color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 2px var(--primary-light); }
.pc-preview-item img { width: 100%; height: 52px; object-fit: contain; display: block; }
.pc-preview-lv { display: block; font-size: 11.5px; color: var(--gray-5); margin-top: 2px; }
.pc-preview-item.cur .pc-preview-lv { color: var(--primary-dark); font-weight: 700; }

/* ---- 宠物等级形态大图查看器(宠物图鉴内点击等级图片弹出) ---- */
.pet-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1250;
  background: rgba(15, 23, 42, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: petLbFade .18s ease;
}
@keyframes petLbFade { from { opacity: 0; } }
.pet-lightbox-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  padding: 14px 16px 12px;
  max-width: min(94vw, 420px);
  animation: petLbPop .22s cubic-bezier(.2, .9, .3, 1.25);
}
@keyframes petLbPop { from { opacity: 0; transform: scale(.9); } }
.pet-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 15px;
  color: var(--gray-6);
  padding: 2px 2px 8px;
}
.pet-lightbox-x {
  border: none;
  background: var(--gray-1);
  color: var(--gray-5);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  transition: background .15s, color .15s;
}
.pet-lightbox-x:hover { background: #fee2e2; color: #b91c1c; }
.pet-lightbox-stage { display: flex; align-items: center; gap: 6px; }
.pet-lightbox-img-wrap { flex: 1; min-width: 0; text-align: center; }
.pet-lightbox-img {
  width: 252px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: linear-gradient(160deg, #f8fafc, #eef2f7);
  filter: drop-shadow(0 8px 16px rgba(15, 23, 42, .18));
}
.pet-lightbox-img.in { animation: petLbImg .3s ease; }
@keyframes petLbImg { from { opacity: .15; transform: scale(.97); } }
.pet-lightbox-nav {
  flex: none;
  width: 36px;
  height: 44px;
  border: 1px solid var(--gray-2);
  background: #fff;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  color: var(--gray-6);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.pet-lightbox-nav:hover { background: var(--primary-bg); color: var(--primary-dark); border-color: var(--primary); }
.pet-lightbox-cap {
  margin-top: 8px;
  font-size: 15px;
  color: var(--gray-6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pet-lightbox-mine {
  font-size: 11.5px;
  color: var(--success-dark);
  background: var(--success-bg);
  border: 1px solid var(--success);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.pet-lightbox-dots { display: flex; justify-content: center; gap: 5px; padding: 10px 0 4px; }
.pet-lightbox-dot {
  min-width: 26px;
  padding: 3px 0;
  border: 1px solid var(--gray-2);
  background: var(--gray-1);
  color: var(--gray-5);
  font-size: 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pet-lightbox-dot:hover { border-color: var(--primary); color: var(--primary-dark); }
.pet-lightbox-dot.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.pet-lightbox-dot.mine { border-color: var(--success); color: var(--success-dark); }
.pet-lightbox-dot.mine.cur { background: var(--success); border-color: var(--success); color: #fff; }
.pet-lightbox-hint { text-align: center; font-size: 12px; color: var(--gray-5); padding-top: 4px; }

/* 排行榜(领奖台 + 列表) */
.pc-podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 14px 0 18px; }
.pc-podium-item {
  flex: 1;
  max-width: 160px;
  text-align: center;
  background: linear-gradient(180deg, #fff, var(--gray-1));
  border: 1px solid var(--gray-3);
  border-radius: 12px;
  padding: 12px 8px;
  min-height: 130px;
}
.pc-podium-item.p1 {
  border-color: #fbbf24;
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  transform: scale(1.07);
  box-shadow: 0 10px 24px rgba(251, 191, 36, .25);
  order: 2;
  min-height: 160px;
}
.pc-podium-item.p2 { border-color: var(--gray-4); order: 1; }
.pc-podium-item.p3 { border-color: #d97706; background: linear-gradient(180deg, #fff, #fff7ed); order: 3; }
.pc-podium-item.empty {
  opacity: .55;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-5);
  font-size: 13px;
}
.pc-podium-item.me { outline: 2px solid var(--primary); outline-offset: 2px; }
.pc-podium-medal { font-size: 27px; }
.pc-podium-img { width: 74px; height: 74px; object-fit: contain; margin: 4px 0; }
.pc-podium-name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-podium-pts { color: var(--warn); font-weight: 800; font-size: 16px; margin-top: 2px; }
.pc-podium-lv { font-size: 12.5px; color: var(--text-light); margin-top: 2px; }
.pc-rank-list { display: flex; flex-direction: column; gap: 6px; }
.pc-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: 10px;
  font-size: 14px;
}
.pc-rank-row.me { border-color: var(--primary); background: var(--primary-bg); }
.pc-rank-no { flex: none; width: 30px; text-align: center; font-weight: 800; color: var(--gray-5); }
.pc-rank-img { flex: none; width: 34px; height: 34px; object-fit: contain; }
.pc-rank-name { flex: none; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-rank-class { flex: 1; min-width: 0; color: var(--text-light); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-rank-pts { flex: none; font-weight: 800; color: var(--warn); }
.pc-my-rank {
  margin-top: 12px;
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  color: var(--success-dark);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.65;
}

/* 积分规则 */
.pc-rules-card {
  background: var(--gray-1);
  border: 1px solid var(--gray-3);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.pc-rules-card .pc-sec-title { margin-top: 0; }
.pc-rules { margin-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--gray-6); line-height: 1.7; }
.pc-lv-table { display: flex; flex-direction: column; gap: 6px; }
.pc-lv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: 8px;
  padding: 6px 10px;
  width: fit-content;
  min-width: 270px;
}
.pc-lv-cost { color: var(--warn); font-weight: 700; }

/* ---- 教师端:宠物中心 ---- */
.tp-pet-cell img { width: 44px; height: 44px; object-fit: contain; display: block; }
.tp-rank-no { font-weight: 700; color: var(--gray-6); }
.tp-rank-no.top { font-size: 18px; }
.tp-pts { font-weight: 800; color: var(--warn); }
.tp-pts.neg { color: var(--danger); }

/* 宠物功能开关(按班级/按学生) */
.pet-switch { display: inline-flex; align-items: center; cursor: pointer; flex: none; outline: none; }
.pet-switch .track {
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--gray-4); position: relative; transition: background .18s;
}
.pet-switch .knob {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .18s;
}
.pet-switch.on .track { background: var(--success); }
.pet-switch.on .knob { left: 18px; }
.pet-switch.busy { opacity: .55; pointer-events: none; }
.pet-switch:focus-visible .track { box-shadow: 0 0 0 3px var(--primary-light); }
.tp-switch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 4px; border-bottom: 1px dashed var(--gray-3); font-size: 14px;
}
.tp-switch-row:last-child { border-bottom: none; }
.tp-switch-name { font-weight: 600; flex: none; }
.tp-switch-hint { color: var(--gray-5); font-size: 12.5px; flex: 1; }
.tp-row-off td { opacity: .55; }
.tp-row-off .tp-pet-cell img { filter: grayscale(1); }
.tp-off-tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; white-space: nowrap; background: var(--danger-bg); color: var(--danger);
}
.tp-pet-td { white-space: nowrap; }
.tp-man-list { display: flex; flex-direction: column; gap: 6px; }
.tp-man-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border: 1px solid var(--gray-2);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
}
.tp-man-pts { font-weight: 800; flex: none; }
.tp-man-pts.pos { color: var(--success-dark); }
.tp-man-pts.neg { color: var(--danger); }
.tp-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.tp-quick button {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--gray-3);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  transition: all .12s;
}
.tp-quick button.neg { color: var(--danger); border-color: #fecaca; background: var(--danger-bg); }
.tp-quick button.pos { color: var(--success-dark); border-color: #bbf7d0; background: var(--success-bg); }
.tp-quick button:hover { transform: translateY(-1px); }
.tp-quick button.sel { outline: 2px solid var(--primary); outline-offset: 1px; }
.tp-detail-modal { width: min(640px, 94vw); }
