:root {
  --bg: #fff7f0;
  --card: #ffffff;
  --primary: #ff8a5b;
  --primary-dark: #f76c3c;
  --accent: #ffd166;
  --text: #4a3b32;
  --muted: #9b8579;
  --line: #f0e2d6;
  --green: #4caf7d;
  --red: #e8604c;
  --shadow: 0 6px 20px rgba(255, 138, 91, 0.12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ===== 知识点选择性打印 ===== */
.kb-modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:flex-start;justify-content:center;z-index:9999;padding:24px 12px;overflow:auto}
.kb-modal-box{background:#fff;color:#222;border-radius:14px;width:min(640px,100%);max-height:90vh;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.kb-modal-head{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid #eee}
.kb-x{border:none;background:#f2f2f2;border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:15px}
.kb-modal-tools{display:flex;gap:8px;align-items:center;padding:10px 16px;border-bottom:1px solid #f0f0f0}
.kb-modal-body{padding:10px 16px;overflow:auto}
.kb-modal-foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid #eee}
.kb-grp{margin:8px 0;padding:8px;border:1px solid #eee;border-radius:10px}
.kb-grp-h{font-size:15px;display:block;cursor:pointer;margin-bottom:4px}
.kb-grp2{margin:6px 0 6px 14px}
.kb-grp2-h{display:block;cursor:pointer}
.kb-grp3{margin:4px 0 4px 14px}
.kb-grp3-h{display:block;cursor:pointer}
.kb-item{display:block;margin:3px 0 3px 14px;font-size:14px}

.kb-preview{position:fixed;inset:0;background:#fff;z-index:10000;overflow:auto;color:#111}
.print-toolbar{position:sticky;top:0;background:#2d2438;color:#fff;display:flex;align-items:center;gap:10px;padding:10px 16px;flex-wrap:wrap;z-index:1}
.print-body{padding:24px 28px;max-width:820px;margin:0 auto}
.pp-subj{font-size:22px;border-bottom:3px solid #2d2438;padding-bottom:6px;margin:18px 0 10px}
.pp-cat{font-size:18px;color:#7a4b2b;margin:14px 0 6px}
.pp-sub{font-size:15px;color:#555;margin:10px 0 4px}
.pp-item{border:1px solid #e3e3e3;border-radius:10px;padding:10px 14px;margin:8px 0}
.pp-item h4{margin:0 0 6px;font-size:15px}
.pp-img{max-width:100%;border-radius:8px;margin:6px 0;display:block}
.pp-point{margin:2px 0 2px 4px;font-size:14px}
.pp-link{font-size:12px;color:#888;margin-top:4px}

@media print{
  body>*:not(#kb-print-preview){display:none !important}
  #kb-print-preview{position:static !important;inset:auto !important;background:#fff !important;overflow:visible !important}
  .print-toolbar{display:none !important}
  .print-body{padding:0 !important;max-width:none !important}
  .pp-item{break-inside:avoid}
  .pp-subj,.pp-cat,.pp-sub{page-break-after:avoid}
}

body {
  margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
}
a { color: var(--primary-dark); }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.hidden { display: none !important; }

/* 顶部条 */
.topbar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; padding: 18px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar .who { font-size: 13px; opacity: .95; }
.btn-ghost {
  background: rgba(255,255,255,.22); color: #fff; border: none; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer;
}

/* 卡片 */
.card {
  background: var(--card); border-radius: 16px; padding: 16px; margin: 12px 0;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card .desc { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px;
  background: #fff0e6; color: var(--primary-dark); margin-right: 6px;
}

/* 按钮 */
.btn {
  background: var(--primary); color: #fff; border: none; border-radius: 12px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
  box-shadow: var(--shadow);
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--primary-dark); border: 1.5px solid var(--primary); box-shadow: none; }

/* 登录 */
.login-box { max-width: 360px; margin: 8vh auto; }
.login-box h2 { text-align: center; color: var(--primary-dark); }
input, select, textarea {
  width: 100%; padding: 12px; margin: 8px 0; border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 15px; background: #fffdfb; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea.drag-over { border-color: var(--primary); border-style: dashed; background: #fff3ea; box-shadow: 0 0 0 3px rgba(255,138,91,.18); }

/* tabs */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.tab {
  flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; background: #fff;
  border: 1.5px solid var(--line); font-size: 14px; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 题目 */
.q { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.q:last-child { border-bottom: none; }
.q .stem { font-weight: 600; margin-bottom: 8px; white-space: pre-wrap; }
.q .idx { color: var(--primary-dark); }
.opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 6px 0;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fffdfb;
}
.opt.sel { border-color: var(--primary); background: #fff3ea; }
.opt .mark { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); flex: 0 0 auto; }
.opt.sel .mark { background: var(--primary); color: #fff; border-color: var(--primary); }
.opt > div:not(.mark) { white-space: pre-wrap; flex: 1; min-width: 0; }
.opt .code-block { margin: 0; width: 100%; box-sizing: border-box; }
.judge-row { display: flex; gap: 10px; }
.judge-row .opt { flex: 1; justify-content: center; }

/* 批改结果 */
.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 700; }
.badge.ok { background: #e3f6ec; color: var(--green); }
.badge.no { background: #fde6e2; color: var(--red); }
.badge.pending { background: #fff4e0; color: #d97706; }
.badge.na { background: #eef0f2; color: var(--muted); }
.answer-line { font-size: 13px; margin: 6px 0; }
.answer-line .k { color: var(--muted); }
.explain { font-size: 13px; background: #fffaf2; border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 8px; margin-top: 6px; white-space: pre-wrap; }
pre.code { background: #2d2438; color: #ffe; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
/* 代码块 / 行内代码 / 题目图片 */
.code-block {
  background: #2d2438; color: #ffe9d6; border-radius: 10px; padding: 12px 14px; margin: 8px 0;
  overflow-x: auto; white-space: pre; word-break: keep-all;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "Courier New", monospace;
  font-size: 13px; line-height: 1.8;
}
.code-block code { font-family: inherit; white-space: pre; }
.program-blank-code { padding: 14px 16px; }
.prog-blank-input {
  display: inline-block; min-width: 80px; width: auto; max-width: 100%;
  background: #fff; color: #2d2438; border: 1.5px solid var(--primary);
  border-radius: 6px; padding: 2px 8px; margin: 0 2px; font-family: inherit;
  font-size: 13px; line-height: 1.6; vertical-align: middle;
}
.prog-blank-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
/* 题干式填空（Python 三级及以上）：输入框直接嵌在题面代码里 */
.stem-blank-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; min-width: 96px; }
.blank-results { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.blank-result { font-size: 13px; }
.blank-result code { background: #f3ece6; color: #c0392b; border-radius: 5px; padding: 1px 6px; }
.blank-placeholder { color: #f59e0b; font-weight: 700; }
.inline-code {
  background: #f3ece6; color: #c0392b; border-radius: 6px; padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 12.5px;
}
.q-img { max-width: 100%; border-radius: 10px; margin: 6px 0; border: 1px solid var(--line); display: block; }

/* 管理端表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.row-actions { display: flex; gap: 6px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.score-big { font-size: 40px; font-weight: 800; color: var(--primary-dark); text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(74,59,50,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 99; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.kpoint { background: #fffaf2; border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.stat-row:last-child { border-bottom: none; }
.stat-row .k { color: var(--muted); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .report-grid { grid-template-columns: 1fr; } }
.btn.small, .btn-ghost.small { width: auto; padding: 6px 14px; font-size: 13px; }

.row { display: flex; gap: 8px; }

/* 知识点三级分组 */
.kn-subj { margin: 10px 0; }
.kn-subj h4 { margin: 10px 0 4px; color: var(--primary-dark); }
.kn-cat { font-weight: 700; color: var(--primary-dark); margin: 10px 0 2px; }
.kn-sub { color: var(--muted); margin: 5px 0 2px 12px; font-size: 13px; }
.tag .x { cursor: pointer; color: var(--red); margin-left: 4px; font-weight: 700; }
.tag .x:hover { opacity: .7; }
.fmt { background: #2d2438; color: #ffe9d6; border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.7; white-space: pre; }

/* 选项图片（学生端） */
.opt-img-wrap { margin-top: 6px; }
.opt-img { max-width: 100%; max-height: 240px; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* 教师端：选项编辑行 */
.opt-area { margin: 8px 0; }
.opt-area.review-opts .opt { cursor: default; }
.opt.right { border-color: var(--green); background: #e3f6e9; }
.opt.wrong { border-color: var(--red); background: #ffe5e5; }
.opt-rows { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border: 1px dashed var(--line); border-radius: 12px; background: #fffdfb; }
.opt-letter { font-weight: 800; color: var(--primary-dark); width: 20px; text-align: center; flex: 0 0 auto; }
.opt-text { flex: 1 1 180px; min-width: 120px; width: auto; margin: 0; min-height: 52px; resize: vertical; font-family: inherit; line-height: 1.5; }
.opt-judge-text { font-weight: 600; }
.ans-lbl { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.opt-row input[type=radio], .opt-row input[type=checkbox] { width: auto; margin: 0; flex: 0 0 auto; }
.ans-lbl input { width: auto; margin: 0; }
.opt-img-slot { display: flex; align-items: center; gap: 6px; }
.opt-img-prev { max-width: 130px; max-height: 92px; border-radius: 8px; border: 1px solid var(--line); display: block; }

/* 试卷批改：列表表格 / 筛选 / 判分按钮 */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: #faf7f2; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tbl tbody tr:hover { background: #fbf9f5; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-row .inp { width: auto; }
.tag.warn { background: #fff4e0; color: #d97706; }
.tag.ok { background: #e3f6ec; color: var(--green); }
.grade-ctrl { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gbtn { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 10px; padding: 5px 12px; font-size: 13px; cursor: pointer; transition: all .12s; }
.gbtn:hover { border-color: var(--primary); }
.gbtn.g-ok.active { background: #e3f6e9; border-color: var(--green); color: var(--green); font-weight: 700; }
.gbtn.g-no.active { background: #ffe5e5; border-color: var(--red); color: var(--red); font-weight: 700; }
.grade-prog { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-score { width: 92px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; text-align: center; background: #fff; color: var(--text); }
.g-score:focus { outline: none; border-color: var(--primary); }

/* ========== 新版登录页（左右分栏） ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: #f7f5ef;
}
.login-brand {
  flex: 1.1;
  position: relative;
  overflow: hidden;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.brand-bg { position: absolute; inset: 0; z-index: 0; }
.brand-bg svg { width: 100%; height: 100%; display: block; }
.brand-content {
  position: relative; z-index: 1;
  max-width: 460px;
  display: flex; flex-direction: column; gap: 26px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.brand-logo { display: flex; align-items: center; gap: 14px; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub  { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.brand-slogan { font-size: 44px; font-weight: 700; line-height: 1.25; margin: 18px 0 8px; }
.brand-feats { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 12px; font-size: 16px; opacity: 0.95; }
.login-form-wrap {
  flex: 0.9;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px;
  background: #f7f5ef;
  position: relative;
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff;
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: 0 12px 40px rgba(60, 30, 90, 0.10), 0 2px 6px rgba(60,30,90,0.04);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card-title { font-size: 22px; font-weight: 700; color: #2a2540; }
.login-card-sub   { font-size: 13px; color: #8a83a3; margin-bottom: 6px; }
.lf-field { display: flex; flex-direction: column; gap: 6px; }
.lf-field span { font-size: 12px; color: #6b6486; }
.lf-field input {
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid #e6e1f0;
  background: #fafaf6;
  padding: 0 14px;
  font-size: 15px;
  color: #2a2540;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.lf-field input:focus { border-color: #a06cd5; background: #fff; }
.btn-login {
  height: 46px;
  margin-top: 8px;
  border: 0; outline: 0; cursor: pointer;
  background: linear-gradient(135deg, #ffb86b 0%, #a06cd5 60%, #6f4ed8 100%);
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 4px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(160, 108, 213, 0.32);
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(160, 108, 213, 0.42); }
.btn-login:active { transform: translateY(0); }
.login-err { color: #e25555; font-size: 13px; text-align: center; margin: 0; min-height: 18px; }
.login-foot { text-align: center; margin-top: 10px; color: #8a83a3; }
.login-foot a { color: #a06cd5; text-decoration: none; margin: 0 4px; }
.login-foot a:hover { text-decoration: underline; }
.login-copy { position: absolute; bottom: 18px; right: 24px; color: #a39db5; }

@media (max-width: 860px) {
  .login-page { flex-direction: column; }
  .login-brand { min-height: 280px; padding: 28px 20px; }
  .brand-slogan { font-size: 30px; }
  .brand-feats { font-size: 14px; gap: 8px; }
  .login-form-wrap { padding: 28px 18px; }
}
@media (max-width: 480px) {
  .brand-slogan { font-size: 24px; }
  .brand-name { font-size: 18px; }
  .login-card { padding: 24px 20px; border-radius: 16px; }
}

/* ========== 新版顶栏（仿芒果风格） ========== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #efeae0;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
}
.topbar-logo {
  display: flex; align-items: center; gap: 8px; text-decoration: none; color: #2a2540;
  font-weight: 700;
}
.logo-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #ffb86b, #a06cd5);
  color: #fff; font-weight: 800; font-size: 14px; letter-spacing: 0;
}
.logo-text { font-size: 17px; font-weight: 700; }
.topbar-nav { flex: 1; display: flex; gap: 4px; flex-wrap: wrap; }
.topbar-nav .nav-item {
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: #4a4459; transition: background 0.15s, color 0.15s;
}
.topbar-nav .nav-item:hover { background: #faf7f2; color: #2a2540; }
.topbar-nav .nav-item.active { background: linear-gradient(135deg,#fff3e0,#f3eaff); color: #6f4ed8; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #6b6486; }

/* 学生端顶栏移动端适配 */
@media (max-width: 720px) {
  .topbar-inner { position: relative; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px; }
  .topbar-logo { align-self: flex-start; }
  .logo-text { font-size: 15px; }
  .topbar-user { position: absolute; top: 10px; right: 14px; }
  .topbar-nav { flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-nav .nav-item { white-space: nowrap; padding: 8px 10px; font-size: 13px; }
  .side-tools { display: none; }
  .wrap { padding: 10px 14px 60px; }
}

/* 学生端默认 wrap 宽度 */
.wrap { max-width: 1240px; margin: 0 auto; padding: 16px 18px 80px; }

/* 侧边悬浮工具栏（仿芒果"我的作业/已做试卷/错题本"）
   默认收起为右侧窄边，hover 展开 */
.side-tools {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 40;
  width: 14px; padding: 10px 0; overflow: hidden;
  background: rgba(255,255,255,0.92); border: 1px solid #efeae0; border-right: 0;
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 4px 14px rgba(60,30,90,0.08);
  transition: width 0.25s ease, padding 0.25s ease, box-shadow 0.25s ease;
}
.side-tools::before {
  content: '⋮'; position: absolute; left: 5px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: #a99fb8; opacity: 1; transition: opacity 0.2s;
  pointer-events: none;
}
.side-tools:hover { width: 64px; padding: 10px 6px; box-shadow: -6px 6px 20px rgba(60,30,90,0.15); }
.side-tools:hover::before { opacity: 0; }
.side-tool {
  width: 52px; padding: 10px 6px; flex-shrink: 0;
  background: #fff; border: 1px solid #efeae0; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; transition: opacity 0.2s, transform 0.12s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(60,30,90,0.06);
  color: #4a4459; font-size: 12px; text-align: center;
  opacity: 0;
}
.side-tools:hover .side-tool { opacity: 1; }
.side-tool:hover { transform: translateX(-3px); box-shadow: 0 6px 20px rgba(60,30,90,0.12); color: #6f4ed8; }
.side-tool .ic { font-size: 20px; }

/* 学生端首页 Banner + 试卷库网格 */
.home-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 24px 28px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffb86b 0%, #a06cd5 55%, #6f4ed8 100%);
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 12px 30px rgba(160, 108, 213, 0.25);
  flex-wrap: wrap;
}
.home-banner-left { flex: 1; min-width: 200px; }
.banner-eyebrow { font-size: 12px; opacity: 0.85; letter-spacing: 2px; }
.banner-title { font-size: 28px; font-weight: 800; line-height: 1.2; margin: 6px 0 4px; }
.banner-sub { font-size: 13px; opacity: 0.9; }
.home-banner-right { display: flex; gap: 8px; flex-wrap: wrap; }
.home-banner-right .btn { background: rgba(255,255,255,0.96); color: #6f4ed8; border: 0; }
.home-banner-right .btn:hover { background: #fff; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.papercard { display: flex; flex-direction: column; }
.papercard h3 { font-size: 15px; margin: 6px 0 4px; }
.papercard .desc { font-size: 12px; color: #8a83a3; margin: 0 0 8px; min-height: 32px; }
.papercard-top { display: flex; gap: 6px; flex-wrap: wrap; }
.papercard-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

@media (max-width: 720px) {
  .banner-title { font-size: 22px; }
  .home-banner { padding: 18px 20px; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ========== 管理端新版（侧栏 + 主区） ========== */
.admin-layout {
  display: flex; min-height: 100vh; background: #f7f5ef;
}
.admin-side {
  width: 230px; flex: 0 0 230px;
  background: #fff;
  border-right: 1px solid #efeae0;
  display: flex; flex-direction: column;
  padding: 14px 10px 10px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.side-logo { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.side-name { font-size: 16px; font-weight: 700; color: #2a2540; }
.side-sub { font-size: 11px; }
.side-user { padding: 12px; margin-bottom: 10px; background: #faf7f2; border: 1px solid #efeae0; }
.side-user-name { font-weight: 600; font-size: 14px; }
.side-user-meta { font-size: 11px; margin-top: 2px; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.side-group { font-size: 11px; color: #a39db5; padding: 10px 8px 4px; letter-spacing: 1px; }
.side-nav .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: #4a4459;
  transition: background 0.15s, color 0.15s;
}
.side-nav .nav-item:hover { background: #faf7f2; color: #2a2540; }
.side-nav .nav-item.active {
  background: linear-gradient(135deg,#fff3e0,#f3eaff);
  color: #6f4ed8; font-weight: 600;
}
.side-nav .ic { width: 18px; text-align: center; }
.side-foot {
  border-top: 1px dashed #efeae0; margin-top: 8px; padding-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
  flex-shrink: 0;
}
.side-foot-link {
  display: block; text-align: center; font-size: 12px; color: #a06cd5;
  text-decoration: none; padding: 6px 10px; border-radius: 8px;
  background: #faf7f2;
}
.side-foot-link:hover { background: #f3eaff; }
.side-foot .btn-ghost { width: 100%; padding: 6px 0; }

/* 顶栏显眼的"退出"按钮（红色高亮，避免找不到退出入口） */
.btn-logout {
  border: 0; cursor: pointer;
  background: linear-gradient(135deg, #ff6b6b, #e25555);
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(226, 85, 85, 0.30);
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn-logout:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(226, 85, 85, 0.45); }
.btn-logout:active { transform: translateY(0); }

/* 用户菜单（点击用户名/▾ 弹出的下拉） */
.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 180px; background: #fff; border: 1px solid #efeae0;
  border-radius: 12px; box-shadow: 0 10px 30px rgba(60,30,90,0.16), 0 2px 6px rgba(60,30,90,0.06);
  padding: 6px; z-index: 200;
}
.um-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: #2a2540; display: flex; align-items: center; gap: 6px;
  transition: background 0.12s;
}
.um-item:hover { background: #faf7f2; }
.um-item.um-logout { color: #e25555; }
.um-item.um-logout:hover { background: #ffe5e5; }
#who:hover, .topbar-user #who:hover { background: #f3eaff !important; }

.admin-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
}
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #efeae0;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 30;
}
.admin-topbar #admin-topbar-title { font-size: 18px; font-weight: 700; color: #2a2540; flex: 1; }
.admin-topbar .who { font-size: 13px; color: #6b6486; }
.admin-content { padding: 18px 22px 80px; flex: 1; min-height: 0; }

.dash-banner {
  background: linear-gradient(135deg, #ffb86b 0%, #a06cd5 55%, #6f4ed8 100%);
  color: #fff;
  border-radius: 16px; padding: 20px 24px; margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(160,108,213,0.22);
}
.dash-banner-eyebrow { font-size: 12px; opacity: 0.85; letter-spacing: 1.5px; }
.dash-banner-title { font-size: 22px; font-weight: 800; margin: 6px 0 4px; }
.dash-banner-sub { font-size: 13px; opacity: 0.92; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border: 1px solid #efeae0; border-radius: 14px;
  padding: 16px 18px; cursor: pointer; transition: transform 0.12s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(60,30,90,0.10); }
.stat-num { font-size: 28px; font-weight: 800; }
.stat-lbl { margin-top: 4px; }

.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.dash-shortcut {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border-radius: 12px; background: #faf7f2; cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}
.dash-shortcut:hover { transform: translateY(-2px); background: #fff3e0; }
.dash-sc-ic {
  width: 48px; height: 48px; border-radius: 14px; display: flex;
  align-items: center; justify-content: center; font-size: 24px;
  background: linear-gradient(135deg,#fff3e0,#f3eaff);
}
.dash-sc-label { font-size: 12px; color: #4a4459; }

@media (max-width: 900px) {
  .admin-side { width: 200px; flex-basis: 200px; }
  .side-name { font-size: 14px; }
}
@media (max-width: 720px) {
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .side-logo, .side-user { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex: 0 0 100%; }
  .side-group { display: none; }
  .side-foot { flex-direction: row; flex: 0 0 100%; border-top: 0; }
}

/* 隐藏老的顶部小标题与 who 行（新顶栏已整合） */
.topbar h1 { display: none; }
.topbar .who { display: none; }

/* 老师微信二维码弹窗 */
.qr-modal { display: none; position: fixed; inset: 0; z-index: 2000; background: rgba(42,37,64,0.55); backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: 20px; }
.qr-modal.show { display: flex; }
.qr-card { position: relative; background: #fff; border-radius: 20px; padding: 28px 24px 24px; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 24px 60px rgba(42,37,64,0.25); animation: qrPop 0.25s ease; }
@keyframes qrPop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.qr-close { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border: none; background: #f4f1eb; border-radius: 50%; font-size: 16px; color: #6b6575; cursor: pointer; }
.qr-close:hover { background: #ebe6de; }
.qr-title { font-size: 20px; font-weight: 700; color: #2a2540; margin-bottom: 6px; }
.qr-sub { font-size: 13px; color: #6b6575; margin-bottom: 18px; }
.qr-grid { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.qr-cell { display: flex; flex-direction: column; align-items: center; }
.qr-img { width: 150px; height: 150px; object-fit: contain; border-radius: 12px; border: 1px solid #ece7df; }
.qr-label { margin-top: 8px; font-size: 13px; font-weight: 600; color: #2a2540; }
.qr-tip { margin-top: 16px; font-size: 12px; color: #8e8798; line-height: 1.5; }
@media (max-width: 480px) {
  .qr-card { padding: 22px 18px 18px; }
  .qr-img { width: 130px; height: 130px; }
}

/* 分享链接弹窗（转发到微信） */
.share-link-input {
  width: 100%; box-sizing: border-box; margin: 4px 0 14px;
  padding: 12px 14px; font-size: 13px; line-height: 1.5; color: #2a2540;
  background: #f7f5ef; border: 1px solid #e6e0d6; border-radius: 12px;
  word-break: break-all; user-select: all; -webkit-user-select: all;
}
.share-link-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.share-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.share-actions .btn { width: auto; padding: 9px 18px; margin: 0; }

/* 学生端顶栏：教师/校区/总账号可见的「后台管理」入口 */
.topbar-admin-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 14px; border-radius: 999px;
  background: linear-gradient(135deg, #6f4ed8, #3a6ee0);
  color: #fff !important; font-size: 13px; font-weight: 700;
  text-decoration: none; box-shadow: 0 2px 8px rgba(111, 78, 216, 0.25);
  transition: transform .12s ease, box-shadow .12s ease;
  white-space: nowrap; margin: 0 8px 0 0;
}
.topbar-admin-link:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(111, 78, 216, 0.35); color: #fff !important; }
.topbar-admin-link:active { transform: translateY(0); }

/* ===== 商城 ===== */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 6px; }
.shop-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.shop-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(255,138,91,.18); }
.shop-cover { width: 100%; height: 150px; object-fit: cover; background: #f3f1ee; display: block; }
.shop-card-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.shop-title { font-weight: 700; font-size: 15px; color: var(--text); margin: 4px 0; line-height: 1.35; }
.shop-price { margin-top: auto; font-weight: 800; color: #e0532f; font-size: 17px; }
.shop-price s { color: #bbb; font-weight: 400; font-size: 12px; margin-left: 4px; }
@media (max-width: 600px) {
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .shop-cover { height: 120px; }
}

/* ===== AI创作课堂 ===== */
.ai-page { background: #fbf8ff; color: #30264d; min-height: 100vh; }
.ai-join-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; background: radial-gradient(circle at 10% 10%, #fff0d2 0, transparent 32%), radial-gradient(circle at 90% 80%, #e8dcff 0, transparent 36%), #fbf8ff; }
.ai-join-card { width: min(520px, 100%); background: #fff; border: 1px solid #eadffb; border-radius: 26px; padding: 30px; box-shadow: 0 20px 60px rgba(84,55,130,.14); position: relative; z-index: 1; }
.ai-back { text-decoration: none; color: #7b62c7; font-size: 13px; }
.ai-kicker { margin-top: 26px; color: #7b62c7; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.ai-join-card h1 { margin: 8px 0 10px; font-size: 30px; line-height: 1.25; color: #30264d; }
.ai-lead { color: #776d8d; font-size: 15px; line-height: 1.7; }
.ai-field { display: block; margin-top: 16px; font-size: 13px; color: #5c5274; font-weight: 600; }
.ai-field input { display: block; width: 100%; margin-top: 7px; border: 1px solid #ded5ef; border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none; background: #fdfcff; }
.ai-field input:focus { border-color: #8c6de5; box-shadow: 0 0 0 3px #8c6de522; }
.ai-primary-btn { margin-top: 20px; background: linear-gradient(135deg,#8b6ce5,#6e4fd0); }
.ai-safety-note { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: #fff8e9; border: 1px solid #f4e4bd; color: #8a6c39; font-size: 12px; line-height: 1.65; }
.ai-join-orbit { position: absolute; right: 12%; top: 12%; width: 110px; height: 110px; border: 2px dashed #cbb6f5; border-radius: 50%; display: grid; place-items: center; color: #8c6de5; font-size: 30px; font-weight: 800; transform: rotate(-15deg); }
.ai-topbar { background: #fff; border-bottom: 1px solid #eadffb; padding: 13px 22px; display: flex; justify-content: space-between; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 10; }
.ai-brand { color: #30264d; font-weight: 800; text-decoration: none; font-size: 19px; }
.ai-class-pill { margin-left: 10px; padding: 4px 10px; background: #f0e9ff; color: #7251c8; border-radius: 99px; font-size: 12px; }
.ai-top-actions { display: flex; align-items: center; gap: 10px; }
.ai-session-tip { color: #9b91ae; font-size: 12px; }
.ai-workspace { max-width: 1440px; margin: 0 auto; padding: 22px; display: grid; grid-template-columns: minmax(340px, .85fr) minmax(420px, 1.15fr); gap: 18px; min-height: calc(100vh - 70px); }
.ai-chat-panel, .ai-project-panel { background: #fff; border: 1px solid #eadffb; border-radius: 20px; box-shadow: 0 8px 28px rgba(84,55,130,.08); min-height: 650px; display: flex; flex-direction: column; overflow: hidden; }
.ai-panel-title { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 20px 20px 14px; border-bottom: 1px solid #f0eafa; }
.ai-panel-title h2 { margin: 0; font-size: 18px; color: #30264d; }
.ai-panel-title p { margin: 4px 0 0; color: #9186a7; font-size: 12px; }
.ai-status-dot { white-space: nowrap; font-size: 12px; color: #31865b; background: #e8f8ee; padding: 5px 9px; border-radius: 99px; }
.ai-mode-row { display: flex; gap: 7px; padding: 13px 20px 0; }
.ai-mode { border: 1px solid #e0d7f0; background: #fff; color: #72668b; border-radius: 99px; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.ai-mode.active { background: #7d5bd7; border-color: #7d5bd7; color: #fff; }
.ai-messages { flex: 1; overflow: auto; padding: 16px 20px; min-height: 280px; }
.ai-welcome, .ai-message { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 14px; }
.ai-bot-face, .ai-msg-avatar { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(135deg,#9c7bf0,#6e4fd0); font-size: 11px; font-weight: 800; }
.user-avatar { background: #f09b5c; }
.ai-welcome p { margin: 5px 0 0; color: #766b8d; font-size: 13px; line-height: 1.6; }
.ai-msg-bubble { max-width: 88%; background: #f7f3ff; border-radius: 4px 14px 14px 14px; padding: 10px 12px; font-size: 13px; line-height: 1.6; white-space: normal; }
.ai-message.user { flex-direction: row-reverse; }
.ai-message.user .ai-msg-bubble { background: #fff1e4; border-radius: 14px 4px 14px 14px; }
.ai-msg-bubble pre { max-width: 100%; overflow: auto; background: #2b2340; color: #f9e9ff; border-radius: 8px; padding: 9px; font-size: 11px; white-space: pre-wrap; }
.ai-quick-prompts { display: flex; gap: 7px; padding: 0 20px 12px; flex-wrap: wrap; }
.ai-quick-prompts button { border: 1px solid #eadffb; color: #7355c4; background: #fbf9ff; border-radius: 99px; padding: 6px 9px; cursor: pointer; font-size: 12px; }
.ai-composer { padding: 12px 20px 18px; border-top: 1px solid #f0eafa; }
.ai-composer textarea { width: 100%; resize: vertical; border: 1px solid #ded5ef; border-radius: 12px; padding: 11px; outline: none; font: inherit; font-size: 13px; min-height: 78px; }
.ai-composer textarea:focus { border-color: #8c6de5; box-shadow: 0 0 0 3px #8c6de522; }
.ai-compose-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.ai-send-btn { width: auto; background: #7d5bd7; padding: 9px 14px; }
.ai-preview-actions { display: flex; gap: 6px; }
.ai-preview { margin: 16px 20px; width: calc(100% - 40px); flex: 1; min-height: 310px; border: 1px solid #e8e0f3; border-radius: 12px; background: #fff; }
.ai-code-wrap { margin: 0 20px 14px; border: 1px solid #e8e0f3; border-radius: 12px; overflow: hidden; }
.ai-code-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #faf8fe; color: #675a80; font-size: 12px; }
.ai-code-wrap textarea { display: block; width: 100%; min-height: 150px; border: 0; border-top: 1px solid #eee8f7; padding: 10px; resize: vertical; font: 12px/1.5 Consolas, monospace; color: #352b4f; outline: none; }
.ai-project-tip { margin: 0 20px 18px; padding: 10px 12px; background: #f8f5ff; border-radius: 10px; color: #766b8d; font-size: 12px; line-height: 1.6; }
@media (max-width: 900px) { .ai-workspace { grid-template-columns: 1fr; padding: 12px; } .ai-chat-panel, .ai-project-panel { min-height: 620px; } }
@media (max-width: 600px) { .ai-join-card { padding: 23px 18px; border-radius: 20px; } .ai-join-card h1 { font-size: 25px; } .ai-join-orbit { display: none; } .ai-topbar { padding: 11px 14px; align-items: flex-start; } .ai-session-tip { display: none; } .ai-class-pill { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; } .ai-panel-title { padding: 16px 14px 12px; } .ai-panel-title h2 { font-size: 16px; } .ai-mode-row, .ai-messages, .ai-quick-prompts, .ai-composer { padding-left: 14px; padding-right: 14px; } .ai-preview { margin-left: 14px; margin-right: 14px; width: calc(100% - 28px); } .ai-code-wrap, .ai-project-tip { margin-left: 14px; margin-right: 14px; } .ai-preview-actions .btn { padding: 5px 7px; font-size: 11px; } }

/* ===== 题目分值输入（教师端题目编辑器） ===== */
.q-points-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.q-points-row label { margin: 0; white-space: nowrap; }
.q-points-row .q-points { width: 110px; margin: 0; }
.q-points-row .q-points-hint { flex: 1; min-width: 180px; }

/* ===== 机器人实操题：三部分作答（接线图 / 流程图 / 程序截图） ===== */
.op-answer { margin-top: 6px; }
.op-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0; }
.op-cell { border: 1px solid var(--line, #e6e6e6); border-radius: 10px; padding: 10px; background: #fffdf9; display: flex; flex-direction: column; gap: 6px; }
.op-cell-title { font-size: 13px; font-weight: 600; color: var(--text, #333); }
.op-cell-tip { line-height: 1.4; }
.op-cell-prev { min-height: 96px; display: flex; align-items: center; justify-content: center; }
.op-img { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; border: 1px solid var(--line, #e6e6e6); background: #fff; }
.op-img-empty { width: 100%; min-height: 92px; border: 1px dashed var(--line, #ddd); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted, #999); font-size: 12px; background: #fff; }
.q-pt-tag { margin-left: 6px; background: #fdf0e2; color: #a5601c; }
@media (max-width: 700px) { .op-grid { grid-template-columns: 1fr; } .op-img { max-height: 260px; } }

/* ===== 在线课堂 ===== */
.live-card { border: 1px solid var(--line, #e6e6e6); margin: 10px 0; }
.live-card.live-now { border-color: #ffb86b; background: linear-gradient(135deg, #fff8f0, #fff); }
.live-meet { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; padding: 8px 10px; background: var(--bg-2, #faf7f2); border-radius: 8px; font-size: 13px; }

/* ===== 游戏天地 ===== */
.game-filter { display: flex; gap: 12px; flex-wrap: wrap; }
.game-filter > div { min-width: 130px; flex: 1; }
.game-filter label { display: block; margin: 0 0 2px; }
.game-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.game-mode-tab { border: 1px solid var(--line, #e6e6e6); border-radius: 10px; padding: 10px; cursor: pointer; background: #fff; display: flex; flex-direction: column; gap: 2px; transition: .15s; }
.game-mode-tab:hover { border-color: var(--primary, #a06cd5); }
.game-mode-tab.active { border-color: var(--primary, #a06cd5); background: linear-gradient(135deg, #f6f0ff, #fff); box-shadow: 0 2px 8px rgba(160, 108, 213, .15); }
.game-mode-tab .ic { font-size: 20px; }
.game-mode-tab .muted { line-height: 1.35; }
.game-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 12px; }
.game-node { border: 1px solid var(--line, #e6e6e6); border-radius: 12px; padding: 10px 6px; text-align: center; cursor: pointer; background: #fff; transition: .15s; }
.game-node:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.game-node.cleared { background: linear-gradient(135deg, #fff6e5, #fff); border-color: #ffd08a; }
.game-node.locked { opacity: .55; cursor: not-allowed; }
.game-node-no { font-size: 20px; font-weight: 700; color: var(--primary-dark, #7a4fb0); }
.game-node-stars { font-size: 12px; letter-spacing: 1px; }
.game-node-sub { font-size: 11px; color: var(--muted, #999); }
.game-progress { height: 6px; background: #f0eef5; border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.game-progress-bar { height: 100%; background: linear-gradient(90deg, #ffb86b, #a06cd5); transition: width .3s; }
.game-dots { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.game-dot { width: 24px; height: 24px; line-height: 24px; border-radius: 50%; font-size: 12px; color: #fff; }
.game-dot.ok { background: var(--green, #43a047); }
.game-dot.no { background: var(--red, #e53935); }
.rush-timer { font-size: 20px; font-weight: 700; color: var(--red, #e53935); min-width: 40px; text-align: right; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-card { border: 1px solid var(--line, #e6e6e6); border-radius: 10px; padding: 10px; cursor: pointer; background: #fff; font-size: 13px; line-height: 1.4; transition: .12s; }
.match-card:hover { border-color: var(--primary, #a06cd5); }
.match-card.sel { border-color: var(--primary, #a06cd5); background: #f6f0ff; box-shadow: 0 2px 8px rgba(160, 108, 213, .18); }
.match-card.done { opacity: .45; border-style: dashed; }
.puzzle-ans { border: 1px dashed var(--line, #ddd); border-radius: 10px; padding: 8px; background: #fffdf9; min-height: 60px; display: flex; flex-direction: column; gap: 6px; }
.puzzle-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line, #eee); border-radius: 8px; padding: 6px 8px; }
.puzzle-row code { flex: 1; min-width: 0; font-size: 12px; overflow-x: auto; white-space: pre; }
.puzzle-no { width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; background: var(--primary, #a06cd5); color: #fff; font-size: 11px; }
.puzzle-btns { display: flex; gap: 2px; }
.puzzle-btns .btn { width: auto; padding: 2px 7px; }
.puzzle-pool { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.puzzle-block { border: 1px solid var(--line, #e6e6e6); border-radius: 8px; padding: 8px; cursor: pointer; background: #fff; transition: .12s; }
.puzzle-block:hover { border-color: var(--primary, #a06cd5); background: #faf7ff; }
.puzzle-block code { font-size: 12px; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 700px) {
  .game-modes { grid-template-columns: 1fr 1fr; }
  .match-grid { grid-template-columns: 1fr; }
  .game-map { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}

/* ===== 视频学习 ===== */
.vid-filter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.vid-filter label { display: block; margin: 0 0 2px; }
.vid-card { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; border: 1px solid var(--line, #e6e6e6); margin: 10px 0; }
.vid-card:hover { border-color: var(--primary, #a06cd5); }
.vid-thumb { position: relative; width: 148px; min-width: 148px; height: 86px; border-radius: 8px; background: linear-gradient(135deg, #2f2a3d, #5b4a7a); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; overflow: hidden; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vid-dur { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: 4px; }
.vid-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vid-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 1px 0 2px; }
.vid-tag { display: inline-block; font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px; font-weight: 600; }
.vid-tag.link { background: #e8f1ff; color: #1a6fd6; border: 1px solid #bcd9ff; }
.vid-tag.vis { background: #fdeaf3; color: #c2186a; border: 1px solid #f5c6df; }
.vid-prog { height: 4px; background: #f0eef5; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.vid-prog > div { height: 100%; background: linear-gradient(90deg, #66bb6a, #43a047); }
.vid-player { width: 100%; max-height: 62vh; background: #000; border-radius: 10px; }
.vid-embed { text-align: center; padding: 18px 0; }
@media (max-width: 700px) {
  .vid-filter { grid-template-columns: 1fr 1fr; }
  .vid-card { flex-direction: column; }
  .vid-thumb { width: 100%; min-width: 0; height: 170px; }
}

/* ===== 教师端：在线课堂 / 视频 / 游戏进度 ===== */
.adm-live-card { border: 1px solid var(--line, #e6e6e6); border-radius: 10px; padding: 10px; margin: 8px 0; }

/* ===== 谈天说地：匿名身份标签（保护学生 / 教师 / 校区隐私） ===== */
.anon-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #f1eef7; color: #7a6a99; font-size: 12px; border: 1px dashed #cfc4e4; }
.real-name { color: var(--text, #333); }
.com-img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; margin-bottom: 8px; background: #f3f1ee; cursor: zoom-in; display: block; }
@media (max-width: 720px) { .com-img { max-height: 320px; } }
.img-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.86);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out;
}
.img-lightbox img {
  max-width: 100%; max-height: 92vh;
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.img-lightbox .close-x {
  position: absolute; top: 16px; right: 20px;
  color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
  text-shadow: 0 2px 6px rgba(0,0,0,.5);
}

/* ===== 试卷批改画笔（标注层） ===== */
#pen-wrap {
  position: fixed; right: 22px; bottom: 22px; z-index: 1200;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
#pen-fab {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #ff8a65, #e53935); color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); user-select: none; transition: transform .15s;
}
#pen-fab:hover { transform: scale(1.08); }
#pen-panel {
  width: 240px; background: #fff;
  border: 1px solid var(--line, #e6e6e6); border-radius: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.18);
  padding: 10px 12px; display: none; flex-direction: column; gap: 8px;
}
#pen-panel.open { display: flex; }
.pen-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pen-row > b { font-size: 13px; }
.pen-btn {
  flex: 1 1 auto; border: 1px solid var(--line, #e6e6e6); background: #f7f7f9; border-radius: 8px;
  padding: 7px 8px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.pen-btn:hover { background: #ffece6; border-color: #ffab91; }
.pen-btn.ghost { background: #fff; color: #c0392b; }
.pen-row label { display: inline-flex; align-items: center; gap: 4px; }
#pen-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }
