/* ═══════════════════════════════════════════════
   布局层：登录卡 / 侧边栏+主栏 / 悬浮窗 / 组件
   （沿用 1.x 毛玻璃美术，重排为侧边栏+主栏）
   ═══════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-main);
  font-size: var(--font-size);
  color: var(--text-main);
  overflow: hidden;
}
.hidden { display: none !important; }
.glass {
  background: var(--glass-bg);
  /* 把当前背景色淡淡压到面板上：否则 60% 白 + 模糊会把纯色背景洗成一片白 */
  background-image: linear-gradient(var(--glass-tint, transparent), var(--glass-tint, transparent));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── 登录视图 ── */
#login-view {
  position: relative; z-index: 2;
  height: 100vh; display: flex; justify-content: center; align-items: center;
}
.login-card { width: 360px; padding: 38px 34px; }
.login-card h1 { text-align: center; font-size: 22px; letter-spacing: 1px; }
.login-card .sub { text-align: center; color: var(--text-sub); font-size: 13px; margin: 6px 0 26px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,.55);
  font: inherit; color: var(--text-main); outline: none;
  transition: border .2s, box-shadow .2s;
}
body[data-theme="night"] .field input { background: rgba(10,14,28,.5); color: var(--text-main); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.err { color: #e05050; font-size: 13px; text-align: center; min-height: 18px; margin-top: 10px; }
.ver-foot { text-align: center; color: var(--text-sub); font-size: 12px; margin-top: 14px; }

/* ── 按钮 ── */
.btn {
  border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  padding: 10px 18px; font: inherit; color: var(--text-main);
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #fff));
  color: #fff; box-shadow: 0 8px 20px var(--accent-soft);
}
.btn.primary:hover { box-shadow: 0 10px 26px var(--accent-soft); transform: translateY(-1px); }
/* :not(.primary)：填题模式会把 #btn-fill 切成 primary，两条规则特异性相同，
   而 ghost 写在后面，会吃掉彩色底、只留白字——看起来就是白字配白底 */
.btn.ghost:not(.primary) {
  background: rgba(255,255,255,.35); border-color: var(--glass-border);
  backdrop-filter: blur(8px);
}
.btn.ghost:not(.primary):hover { background: var(--accent-soft); }
body[data-theme="night"] .btn.ghost:not(.primary) { background: rgba(255,255,255,.08); }
/* 玻璃层里不要再叠一层 backdrop-filter（docs/handoff.md 第 5 条坑）。
   侧栏、浮窗本身就是 .glass，里面的 ghost 按钮再模糊一次，Chrome 在别处
   重绘时会重新采样那一层，表现是「hover 右边元素时，左边这几个按钮浮出
   一块白光」——侧栏左下的上传 / 设置 / 登出就是这么出来的。
   内层去掉模糊，底色稍微提高一点不透明度补回来，视觉差别很小 */
.glass .btn.ghost:not(.primary) {
  background: rgba(255, 255, 255, .46);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.glass .btn.ghost:not(.primary):hover { background: var(--accent-soft); }
body[data-theme="night"] .glass .btn.ghost:not(.primary) {
  background: rgba(255, 255, 255, .1);
}

.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 主布局 ── */
#main-view {
  position: relative; z-index: 2;
  height: 100vh; display: flex; gap: 18px; padding: 20px;
}
/* ── 侧边栏：书签式窄栏（只放图标，宽度 236 → 84） ── */
#sidebar {
  width: 84px; flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; padding: 12px 8px 10px; overflow: hidden;
}
.sb-head {
  display: flex; align-items: center; justify-content: center;
  padding: 2px 0 10px; width: 100%; flex-shrink: 0;
}
.sb-logo {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff));
  color: #fff; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px var(--accent-soft); cursor: default;
}
.sb-user { display: none; }            /* 窄栏放不下姓名，改由 logo 的 title 提示 */

#sb-nav {
  flex: 1; width: calc(100% + 8px); min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center;
  /* 左内边距 + 负外边距 + 加宽：把滚动裁剪盒推到栏沿，签舌不被裁掉，
     同时图标仍居中于整条侧栏 */
  padding: 2px 0 2px 8px; margin-left: -8px;
  gap: 4px;
  scrollbar-width: none;
}
#sb-nav::-webkit-scrollbar { width: 0; height: 0; }

.nav-item {
  position: relative; width: 100%; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 13px; cursor: pointer;
  color: var(--text-sub); text-decoration: none;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item:hover { background: var(--accent-soft); color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
/* 书签签舌：贴在窄栏左沿的小竖条，选中时才出现 */
.nav-item::before {
  content: ""; position: absolute; left: -8px; top: 50%;
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--accent);
  transform: translateY(-50%) scaleY(0);
  transition: transform .2s ease;
}
.nav-item.active::before { transform: translateY(-50%) scaleY(1); }

.nav-ico {
  width: 24px; height: 24px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; color: inherit;
}
.nav-ico svg { width: 21px; height: 21px; display: block; }
/* 侧栏「文字」模式：汉字画在 SVG 里（charIcon），字形用内嵌圆体；
   两个字的（主页）按自然宽度画出去，允许溢出格子几个像素。
   字体栈兜底到系统圆体，再兜到正文族，免得字体没加载时一片空白 */
.nav-glyph text {
  font-family: "GlyphRound", "YouYuan", "Yuanti SC", var(--font-main);
  font-weight: 500;      /* 字库只有 Medium，写 500 防止浏览器再合成加粗 */
}
.nav-glyph.wide { overflow: visible; }
.nav-sep { width: 22px; height: 1px; background: var(--glass-border); margin: 2px auto; flex-shrink: 0; }
.nav-group-title { display: none; }

.sb-subjects { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }

.sb-foot {
  border-top: 1px solid var(--glass-border); padding-top: 8px;
  width: 100%; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.sb-foot .btn {
  width: 40px; height: 34px; padding: 0; font-size: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.sb-foot .btn svg { width: 17px; height: 17px; display: block; }
.sb-ver {
  color: var(--text-sub); font-size: 9.5px; letter-spacing: .2px;
  opacity: .7; margin-top: 2px; text-align: center; white-space: nowrap;
}

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── 左侧课程树面板 ── */
#tree-pane {
  width: 220px; flex-shrink: 0; display: flex; flex-direction: column;
  padding: 11px 8px 6px; overflow: hidden;
}
.tp-head {
  display: flex; align-items: center; gap: 4px; padding: 0 2px 8px;
  border-bottom: 1px solid var(--glass-border); margin-bottom: 4px; flex-shrink: 0;
}
.tp-head .btn.tiny { padding: 3px 7px; font-size: 11.5px; }
.tp-title {
  font-weight: 700; font-size: 15px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#tree-root { flex: 1; overflow-y: auto; padding-right: 2px; }

/* ── 右侧栏：课程列表（细边条，悬停向左浮出） ── */
#list-pane {
  width: 46px; flex-shrink: 0; position: relative; z-index: 4;
  display: flex; justify-content: flex-end;   /* 子卡片向左溢出，父宽恒为 46px */
}
/* 宽度只改卡片自己，父容器不变 → 悬停浮出时正文不会重排 */
.lp-card {
  width: 46px; flex: none;               /* 不参与 flex 收缩，才能向左溢出浮出 */
  height: 100%; display: flex; flex-direction: column;
  padding: 9px 5px; overflow: hidden;
  transition: width .18s ease, box-shadow .18s ease, padding .18s ease;
}
#list-pane:hover .lp-card, #list-pane:focus-within .lp-card {
  width: 244px; padding: 10px 9px;
  /* 浮层压在正文之上：用 --pane-solid（面板色压在当前背景上的实色，由
     applySettings 算好）。半透明会透出后面的面包屑文字，纯白又会丢掉背景染色 */
  background: var(--pane-solid, var(--glass-bg));
  box-shadow: var(--shadow-side);
}
.lp-head {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 16px; padding-bottom: 7px; margin-bottom: 6px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0; overflow: hidden;
}
#list-pane:hover .lp-head { justify-content: flex-start; padding-left: 3px; }
.lp-title {
  display: none; font-weight: 700; font-size: 13px;
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
#list-pane:hover .lp-title { display: block; }
.lp-count {
  font-size: 11px; color: var(--text-sub); flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.lp-scroll { flex: 1; overflow: hidden; }
#list-pane:hover .lp-scroll { overflow-y: auto; }
.course-mini { display: flex; flex-direction: column; gap: 3px; }
.cm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-radius: 10px; cursor: pointer;
  transition: background .15s; overflow: hidden;
}
#list-pane:hover .cm-item { padding: 8px 10px; }
.cm-item:hover { background: var(--accent-soft); }
/* 收起时只剩序号 */
.cm-idx {
  font-size: 12px; font-weight: 700; color: var(--text-sub);
  width: 100%; text-align: center; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
#list-pane:hover .cm-idx { width: 22px; text-align: left; }
.cm-info { display: none; flex: 1; min-width: 0; }
#list-pane:hover .cm-info { display: block; }
.cm-name { font-size: 13px; line-height: 1.45; word-break: break-all; }
.cm-meta { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.cm-item.active { background: var(--accent); }
.cm-item.active .cm-idx { color: #fff; }
.cm-item.active .cm-name { color: #fff; font-weight: 600; }
.cm-item.active .cm-meta { color: rgba(255, 255, 255, .78); }

/* ── 主栏顶部：返回 + 路径 ── */
.main-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 26px 8px; flex-shrink: 0;
}
.main-head .breadcrumb { padding: 0; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; }
/* 目录抽拉箭头：贴在目录栏右缘、垂直居中。收起后停在正文栏左缘 */
.tree-tab {
  position: absolute; z-index: 7; top: 50%; transform: translateY(-50%);
  width: 17px; height: 52px; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border); border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--glass-bg); color: var(--text-sub);
  transition: color .16s, background .16s;
}
.tree-tab:hover { color: var(--accent); }
.tree-tab svg { width: 13px; height: 13px; display: block; transition: transform .2s; transform: rotate(180deg); }
.tree-tab.flip svg { transform: rotate(0deg); }   /* flip = 已收起，箭头朝右 */
.tree-tab.hidden { display: none; }
#main-view.tree-off #tree-pane { display: none; }
#btn-back { flex-shrink: 0; }

/* ── 面包屑 + 页面区 ── */
.breadcrumb {
  padding: 18px 26px 10px; color: var(--text-sub); font-size: 13px; flex-shrink: 0;
}
.breadcrumb a { color: var(--accent); text-decoration: none; margin-right: 4px; }
.breadcrumb .crumb-sep { margin: 0 6px; opacity: .5; }
.breadcrumb .crumb-cur { color: var(--text-main); font-weight: 600; }
.page { flex: 1; overflow-y: auto; padding: 6px 26px 26px; }

/* ── 课程正文：直接铺开，不做成卡片 ── */
/* 文本 / 题目 / 附件按上游原始顺序依次排列：不分组、不加类型索引条，
   老师发布时是交错写的，按类型重排会打乱阅读顺序 */
.doc-flow { display: flex; flex-direction: column; gap: 22px; padding: 4px 6px 14px; }
.doc-flow > .atta-card, .doc-flow > .q-card { flex-shrink: 0; }
.doc-flow > .doc-sec { margin: 0; }
.doc-sec .text-block, .doc-sec .q-card, .doc-sec .atta-card { margin: 0; }
.tb-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; letter-spacing: .3px; }

/* ── 正文分节：一个标题牵着它下面的全部正文、题目、附件 ──
   点标题收起整节（官网上也是这个交互）。节与节之间留白大一点，
   同一节内部由 .doc-flow 的 gap 控制 */
.doc-sec { display: block; }
.sec-plain { display: flex; flex-direction: column; gap: 22px; }
.sec-head {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  margin: 0; padding: 6px 8px; border: 0; border-radius: 10px;
  background: none; color: var(--text-main); cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .3px;
  text-align: left; line-height: 1.5; user-select: none;
  transition: background .16s, color .16s;
}
.sec-head:hover { background: var(--accent-soft); color: var(--accent); }
.sec-head .chevs {
  width: 15px; height: 15px; flex: none; margin-top: 4px;
  color: var(--accent); transition: transform .18s;
  transform: rotate(90deg);          /* 展开：箭头朝下 */
}
.sec-head .chevs svg { display: block; width: 100%; height: 100%; }
.sec-title { flex: 1; min-width: 0; }
/* 标题直接来自正文时可能带 <p>/<strong>，按标题样式压平，别撑出一堆空行 */
.sec-title > * { margin: 0 !important; font-size: inherit; font-weight: inherit; display: inline; }
.sec-body {
  display: flex; flex-direction: column; gap: 22px;
  padding: 4px 0 0 31px;             /* = 内边距 8 + 箭头 15 + 间距 8 */
}
.doc-sec.folded .sec-head .chevs { transform: rotate(0deg); }   /* 收起：朝右 */
.doc-sec.folded .sec-body { display: none; }
.sec-empty {
  margin: 0; padding: 4px 0; color: var(--text-sub); font-size: 12.5px;
}
.tb-meta { font-size: 12px; color: var(--accent); margin-bottom: 8px; letter-spacing: .5px; }
.tb-body {
  white-space: pre-wrap; line-height: 1.95; word-break: break-word;
  font-size: calc(var(--font-size) + 1px); color: var(--text-main);
  letter-spacing: .2px;
}
.tb-empty { color: var(--text-sub); font-size: 13px; }
/* 上游若给的是富文本，清完样式后按结构排版 */
.tb-rich { white-space: normal; }
/* 夜空主题：上游正文常带「黑字 + 白底」的内联样式，在白底卡片上看还行，
   压到深色背景上就是一块刺眼的白斑。这里统一按主题走，字色跟随正文 */
body[data-theme="night"] .tb-rich { color: var(--text-main); }
/* 只把「黑字 / 白底」按主题改掉，老师特意用的彩色字保持原样——
   这一步在 content.js 的 _safeStyle 里按颜色深浅判断 */
.tb-rich p { margin: 0 0 .9em; }
.tb-rich p:last-child { margin-bottom: 0; }
.tb-rich ul, .tb-rich ol { margin: 0 0 .9em; padding-left: 1.5em; }
.tb-rich li { margin: .3em 0; }
.tb-rich h1, .tb-rich h2, .tb-rich h3, .tb-rich h4 { margin: 0 0 .5em; line-height: 1.5; }
.tb-rich table {
  border-collapse: collapse; margin: 0 0 1em; max-width: 100%;
  display: block; overflow-x: auto;      /* 上游表格常按 pt 写死宽度，窄栏里给横向滚动 */
}
.tb-rich td, .tb-rich th {
  border: 1px solid var(--glass-border); padding: 6px 10px; vertical-align: top;
}
.tb-rich .ql-align-center { text-align: center; }
.tb-rich .ql-align-right { text-align: right; }
.tb-rich .ql-align-justify { text-align: justify; }
.tb-rich a { color: var(--accent); }
/* 正文内联图片：走 /api/img 代理，等比缩放，点击放大 */
.tb-rich img, .tb-body img {
  display: block; max-width: 100%; height: auto; margin: 10px 0;
  border-radius: 10px; cursor: zoom-in;
}
/* 正文里的视频/音频：先放一个可点的占位，点了才真正去取文件——
   否则一进课程页，几 MB 的媒体会跟正文、图片抢带宽 */
.media-ph {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0; padding: 12px 15px; border-radius: 12px; cursor: pointer;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-main); font-size: 13.5px; letter-spacing: .2px;
  transition: border-color .18s, background .18s;
}
.media-ph:hover { border-color: var(--accent); background: var(--accent-soft); }
.media-ph .mp-ico {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.media-ph .mp-ico svg { width: 17px; height: 17px; }
.media-ph .mp-hint { margin-left: auto; color: var(--text-sub); font-size: 12px; }
.media-ph.bad { cursor: default; opacity: .6; }
.media-ph.bad:hover { border-color: var(--glass-border); background: var(--glass-bg); }
.tb-media {
  display: block; width: 100%; max-width: 100%; margin: 12px 0;
  border-radius: 12px; background: #000;
}
/* 二级内容：标题行点一下收起/展开（官网上也是这个交互） */
.sub-group { margin: 4px 0; }
.sub-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 0 0 6px; padding: 9px 12px; border: 0; border-radius: 10px;
  background: var(--accent-soft); color: var(--text-main); cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; text-align: left;
}
.sub-head:hover { filter: brightness(1.04); }
.sub-head .chevs { width: 15px; height: 15px; flex: none; color: var(--accent); transition: transform .18s; }
.sub-head .chevs svg { display: block; width: 100%; height: 100%; }
.sub-head .sub-count { margin-left: auto; color: var(--text-sub); font-size: 12px; font-weight: 400; }
.sub-head .chevs { transform: rotate(90deg); }
.sub-group.folded .sub-head .chevs { transform: rotate(0deg); }
.sub-group.folded .sub-body { display: none; }
.sub-body { padding-left: 2px; }
/* 加载失败的占位：宁可显示一行灰字，也不要留一片空白 */
.img-fail {
  margin: 10px 0; padding: 10px 14px; border-radius: 10px;
  border: 1px dashed var(--glass-border);
  color: var(--text-sub); font-size: 12.5px; line-height: 1.6;
  cursor: pointer;
}
.tb-rich blockquote { margin: 0 0 1em; padding-left: 12px; border-left: 3px solid var(--accent-soft); color: var(--text-sub); }

/* ── 题目卡片 ── */
.q-card {
  border: 1px solid var(--glass-border); border-radius: 16px;
  padding: 14px 16px 12px; background: rgba(255,255,255,.38);
}
body[data-theme="night"] .q-card { background: rgba(255,255,255,.05); }
.q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.q-no {
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px; padding: 2px 9px;
}
.q-meta { font-size: 12px; color: var(--text-sub); }
.q-toggle { margin-left: auto; }
.q-stem, .q-body { line-height: 1.9; word-break: break-word; }
.q-stem:not(.tb-rich), .q-body:not(.tb-rich) { white-space: pre-wrap; }
.q-extra { margin-top: 12px; border-top: 1px dashed var(--glass-border); padding-top: 6px; }
.q-label { font-size: 11.5px; color: var(--text-sub); letter-spacing: 1.5px; margin: 8px 0 3px; }
.q-answer { color: #b91c1c; }
body[data-theme="night"] .q-answer { color: #fca5a5; }
.q-mine { color: var(--accent); }
/* ── 完形填空这类：一个题干下挂多道小题 ── */
.q-kids { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.q-kid {
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .26); border: 1px solid var(--glass-border);
}
body[data-theme="night"] .q-kid { background: rgba(255, 255, 255, .04); }
.q-kid-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-kid-no { font-size: 12px; font-weight: 700; color: var(--accent); }
.q-kid-stem { margin-bottom: 8px; font-size: 13.5px; }
.q-kid .q-opts { margin-top: 0; }
.q-kid .q-input { margin-top: 0; }
.q-kid .q-hint { margin-top: 0; }

/* 大题拍照作答 */
.q-photo { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.q-photo input[type="file"] { display: none; }
.q-photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.q-thumb {
  width: 84px; height: 84px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--glass-border); cursor: zoom-in;
  background: rgba(255, 255, 255, .4);
}
body[data-theme="night"] .q-thumb { background: rgba(255, 255, 255, .06); }
.q-thumb-cell { position: relative; }
.q-thumb-del {
  position: absolute; right: -6px; top: -6px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; padding: 0;
  border: none; border-radius: 50%; cursor: pointer;
  background: rgba(15, 23, 42, .62); color: #fff; font-size: 14px; line-height: 1;
  transition: background .15s;
}
.q-thumb-del:hover { background: #e05050; }

/* ── 作答图片：暂存区 / 增强 / 拖框裁剪 ── */
.photo-win { width: min(560px, 94vw); }
.photo-sec {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.photo-sec-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--text-sub);
}
.photo-hint { font-size: 11.5px; color: var(--text-sub); }
.photo-tray {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}
.photo-empty {
  grid-column: 1 / -1; padding: 16px 2px; font-size: 12.5px; color: var(--text-sub);
  line-height: 1.7;
}
.photo-cell {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, .34);
}
body[data-theme="night"] .photo-cell { background: rgba(255, 255, 255, .05); }
.photo-cell.busy { opacity: .5; pointer-events: none; }
.photo-thumb {
  width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer;
}
.photo-del {
  position: absolute; right: 4px; top: 4px; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(15, 23, 42, .5); color: #fff; font-size: 14px; line-height: 1;
}
.photo-del:hover { background: #e05050; }
/* 暂存区右下角的「裁」：移动端没有 hover，必须一直可见 */
.photo-crop-btn {
  position: absolute; right: 4px; bottom: 4px; width: 26px; height: 22px;
  display: flex; align-items: center; justify-content: center; padding: 0;
  border: none; border-radius: 8px; cursor: pointer;
  background: rgba(15, 23, 42, .62); color: #fff; font-size: 11.5px; line-height: 1;
}
.photo-crop-btn:hover { background: var(--accent); }
.photo-add {
  width: 100%; margin-top: 12px; padding: 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed var(--glass-border); border-radius: 12px;
  background: transparent; color: var(--text-sub);
  font: inherit; font-size: 13px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.photo-add:hover { border-color: var(--accent); color: var(--accent); }
.photo-add-plus { font-size: 16px; font-weight: 700; }

.photo-stage {
  position: relative; width: fit-content; max-width: 100%; margin: 0 auto;
  border-radius: 12px; overflow: hidden;
  background: rgba(15, 23, 42, .06);
}
body[data-theme="night"] .photo-stage { background: rgba(0, 0, 0, .25); }
.photo-img {
  display: block; max-width: 100%; max-height: 54vh;
  user-select: none; -webkit-user-drag: none;
}
.photo-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px;
}
.photo-tip { font-size: 12px; color: var(--text-sub); min-height: 1em; }

/* 拖框裁剪：canvas 之外只画一个框 + 四周压暗 */
/* 裁剪时的「近全屏」：裁剪窗顶满视口，图片按视口算尺寸，
   底下一排工具（增强/退出裁剪/应用裁剪）——手机上一根手指也拖得准 */
#photo.cropping {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  border-radius: 0; border: 0; box-shadow: none;
  background: rgba(8, 12, 20, .96);
}
#photo.cropping .fw-head { display: none; }
#photo.cropping .fw-body {
  padding: 0; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
#photo.cropping #photo-editor {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
}
#photo.cropping .photo-stage {
  flex: 1 1 auto; min-height: 0; width: auto; max-width: none;
  display: flex; align-items: center; justify-content: center;
  margin: 0; border-radius: 0; background: transparent; overflow: hidden;
}
#photo.cropping .photo-img {
  max-width: 96vw; max-height: calc(100vh - 118px);
}
#photo.cropping .photo-tools {
  flex-shrink: 0; justify-content: center; margin: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(10, 14, 22, .72);
}
#photo.cropping .photo-tip { color: rgba(255, 255, 255, .82); }
#photo.cropping .dialog-foot { display: none; }

/* 裁剪遮罩套在图片外壳里：坐标按图片宽度换算，全屏后也不会错位 */
.crop-host { position: relative; display: inline-block; line-height: 0; }
.crop-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.crop-layer.hidden, .crop-box.hidden { display: none; }
.crop-tip {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px;
  font-size: 11.5px; border-radius: 8px; pointer-events: none;
  background: rgba(15, 23, 42, .55); color: #fff;
}
.crop-box {
  position: absolute; cursor: move;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 9999px rgba(10, 16, 30, .5);
}
.crop-box::after {
  content: ""; position: absolute; inset: 0;
  border: 1px solid var(--accent);
}
.crop-h {
  position: absolute; width: 12px; height: 12px; border-radius: 3px;
  background: #fff; border: 1px solid var(--accent);
}
.crop-h-tl { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-h-tr { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-h-bl { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-h-br { right: -7px; bottom: -7px; cursor: nwse-resize; }
/* 手指操作：四角抓手放大一倍多，否则按不住 */
@media (pointer: coarse) {
  .crop-h { width: 24px; height: 24px; border-radius: 7px; }
  .crop-h-tl { left: -12px; top: -12px; }
  .crop-h-tr { right: -12px; top: -12px; }
  .crop-h-bl { left: -12px; bottom: -12px; }
  .crop-h-br { right: -12px; bottom: -12px; }
}

/* ── 判题徽标 ── */
.q-judge {
  font-size: 11.5px; font-weight: 700; border-radius: 8px; padding: 2px 8px;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.q-judge.ok { background: #dcfce7; color: #15803d; }
.q-judge.bad { background: #fee2e2; color: #b91c1c; }
.q-judge.part { background: #fef3c7; color: #b45309; }
body[data-theme="night"] .q-judge.ok { background: rgba(16, 185, 129, .18); color: #6ee7b7; }
body[data-theme="night"] .q-judge.bad { background: rgba(239, 68, 68, .18); color: #fca5a5; }
body[data-theme="night"] .q-judge.part { background: rgba(245, 158, 11, .18); color: #fcd34d; }
/* 未提交 / 未作答 / 已作答：中性灰，不要和"答错"的红混在一起 */
.q-judge.none {
  background: rgba(120, 140, 170, .14); color: var(--text-sub); font-weight: 600;
}
body[data-theme="night"] .q-judge.none { background: rgba(255, 255, 255, .08); }

/* ── 作答区（选择 / 填空 / 提示） ── */
.q-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 2px; }
/* 带文字的选项（题干里写明了 A．xxx）：整块都能点。
   短选项并排（判断题那种），长句一个一行，见 .q-opts-rich */
.q-opts-word { align-items: stretch; }
.q-opts-rich { flex-direction: column; align-items: stretch; gap: 8px; }
.q-opt {
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .42);
  color: var(--text-main); font: inherit; font-weight: 700; font-size: 15px;
  transition: transform .12s, background .15s, border-color .15s, color .15s,
              box-shadow .15s;
}
body[data-theme="night"] .q-opt { background: rgba(255, 255, 255, .06); }
.q-opt-word {
  width: auto; height: auto; min-height: 42px; padding: 9px 13px;
  display: flex; align-items: flex-start; gap: 10px;
  text-align: left; font-weight: 400; font-size: 14.5px; line-height: 1.65;
  border-radius: 14px;
}
.q-opt-key { flex: 0 0 auto; font-weight: 700; min-width: 1.1em; }
.q-opt-text { flex: 1 1 auto; min-width: 0; }
/* 判断题：勾 / 叉两个方块。提交的答案仍是 A / B，只是不再把字母画给人看 */
.q-opt-mark {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
}
.q-opt-mark svg { width: 21px; height: 21px; stroke-width: 2.2; }
/* 悬停只铺一层淡色提示，不描边：描边看着像「已经选中」，和真正的选中态撞车。
   选择器多带一层 .q-opts 是为了压过夜间主题那条 .q-opt 的淡底（特异性更高） */
.q-opts .q-opt:hover {
  background: var(--accent-soft); border-color: transparent;
  color: var(--accent); transform: translateY(-1px);
}
/* 选中 = 整块换成强调色（文字选项同样整块变色），靠底色而不靠边框表达；
   光晕用主题派生的 --shadow-glow，切主题时一起变 */
.q-opts .q-opt.on {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: var(--shadow-glow); transform: translateY(-1px);
}
.q-opts .q-opt.on:hover { background: var(--accent); color: #fff; }
.q-save-tip { font-size: 12px; color: var(--text-sub); min-width: 3.2em; }
.q-input {
  width: 100%; margin: 12px 0 2px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .5);
  color: var(--text-main); font: inherit; line-height: 1.7; resize: vertical;
}
body[data-theme="night"] .q-input { background: rgba(10, 14, 28, .5); }
.q-input:focus { outline: none; border-color: var(--accent); }
.q-hint { margin: 10px 0 2px; font-size: 12.5px; color: var(--text-sub); }
.q-abandon { color: #d97706; }
.q-analysis { color: var(--text-sub); }

/* ── 顶栏胶囊（课程得分 / 考试状态共用一个） ── */
.head-pill {
  flex-shrink: 0; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .3px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.head-pill.clickable { cursor: pointer; transition: transform .14s, box-shadow .14s; }
.head-pill.clickable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
/* 考试条部分：状态圆点 + 倒计时，只有「进行中」跑动 */
.head-pill .hp-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.head-pill .hp-value { font-weight: 700; letter-spacing: .3px; }
.head-pill[data-state="running"] .hp-dot { animation: hp-pulse 1.6s ease-in-out infinite; }
.head-pill[data-state="ended"], .head-pill[data-state="upcoming"] { opacity: .72; }
@keyframes hp-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ── 答题卡 ── */
.sheet-win {
  width: min(520px, 94vw); max-height: 82vh;
  /* 底下的题干会透上来，把字糊在一起；答题卡要给一层实底
     （.glass 还带一层 background-image 渐变，得一起关掉） */
  background: rgba(252, 253, 255, .95);
  background-image: none;
  backdrop-filter: blur(18px) saturate(1.1);
}
body[data-theme="night"] .sheet-win { background: rgba(24, 28, 44, .95); background-image: none; }
/* 题目多时答题卡整体要滚，但不画那条灰色滚动条（压在毛玻璃上太扎眼）：
   滚轮、触屏、键盘照常能用，只是不再显示 bar */
#sheet-body { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
#sheet-body::-webkit-scrollbar { width: 0; height: 0; }
/* 合并大题 / 展开小题：两段小开关，放在图例上方 */
.sheet-modes {
  display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 10px;
  border-radius: 999px; background: rgba(20, 40, 80, .06);
}
body[data-theme="night"] .sheet-modes { background: rgba(255, 255, 255, .08); }
.sm-btn {
  border: 0; background: none; font: inherit; font-size: 12px;
  color: var(--text-sub); cursor: pointer;
  padding: 3px 12px; border-radius: 999px;
  transition: background .14s, color .14s;
}
.sm-btn:hover { color: var(--accent); }
.sm-btn.on { background: var(--accent); color: #fff; font-weight: 700; }

.sheet-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  margin-bottom: 14px; font-size: 12px; color: var(--text-sub);
}
.sl-item {
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  padding: 3px 7px; border-radius: 8px; transition: background .14s, opacity .14s;
}
.sl-item:hover { background: rgba(20, 40, 80, .07); }
.sl-item.off { opacity: .38; }
.sheet-empty { margin: 6px 2px; font-size: 12.5px; color: var(--text-sub); }
.sl-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
/* 五种状态：灰=没答，蓝=等分，绿=对，橙=半对，红=错 */
.sl-dot[data-st="todo"], .sheet-cell[data-st="todo"] { background: #eceff4; color: #94a3b8; }
.sl-dot[data-st="wait"], .sheet-cell[data-st="wait"] { background: var(--accent-soft); color: var(--accent); }
.sl-dot[data-st="ok"], .sheet-cell[data-st="ok"] { background: #dcfce7; color: #15803d; }
.sl-dot[data-st="part"], .sheet-cell[data-st="part"] { background: #fef3c7; color: #b45309; }
.sl-dot[data-st="bad"], .sheet-cell[data-st="bad"] { background: #fee2e2; color: #b91c1c; }
body[data-theme="night"] .sl-dot[data-st="todo"],
body[data-theme="night"] .sheet-cell[data-st="todo"] { background: rgba(255, 255, 255, .09); color: #94a3b8; }
body[data-theme="night"] .sl-dot[data-st="wait"],
body[data-theme="night"] .sheet-cell[data-st="wait"] { background: var(--accent-soft); color: var(--accent); }
body[data-theme="night"] .sl-dot[data-st="ok"],
body[data-theme="night"] .sheet-cell[data-st="ok"] { background: rgba(16, 185, 129, .18); color: #6ee7b7; }
body[data-theme="night"] .sl-dot[data-st="part"],
body[data-theme="night"] .sheet-cell[data-st="part"] { background: rgba(245, 158, 11, .18); color: #fcd34d; }
body[data-theme="night"] .sl-dot[data-st="bad"],
body[data-theme="night"] .sheet-cell[data-st="bad"] { background: rgba(239, 68, 68, .18); color: #fca5a5; }
.sheet-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
}
.sheet-cell {
  height: 42px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; overflow: hidden; text-overflow: ellipsis;
  transition: transform .13s, box-shadow .13s, border-color .13s;
  font-variant-numeric: tabular-nums;
}
.sheet-cell:hover {
  transform: translateY(-2px); border-color: currentColor;
  box-shadow: var(--shadow-soft);
}
/* 答题卡跳过去的那道题闪一下 */
@keyframes qFlash {
  0% { box-shadow: 0 0 0 0 var(--accent); }
  25% { box-shadow: 0 0 0 4px var(--accent-soft); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}
.q-card.q-flash, .q-kid.q-flash {
  animation: qFlash 1.4s ease-out 1;
  border-color: var(--accent);
}

/* ── 答题卡下方的成绩块（考试模式，可收起） ── */
.stat-panel {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid rgba(20, 40, 80, .09);
}
body[data-theme="night"] .stat-panel { border-top-color: rgba(255, 255, 255, .1); }
.stat-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: none; font: inherit; color: var(--text-main);
  padding: 2px 0; cursor: pointer; text-align: left;
}
.stat-title { font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.stat-brief {
  flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12px; color: var(--text-sub); font-variant-numeric: tabular-nums;
}
.stat-chev {
  flex: none; display: inline-flex; color: var(--text-sub);
  transform: rotate(90deg); transition: transform .18s;
}
.stat-chev svg { display: block; width: 13px; height: 13px; }
.stat-panel.folded .stat-chev { transform: rotate(0deg); }
.stat-panel.folded .stat-body { display: none; }
.stat-body { display: flex; flex-direction: column; gap: 12px; padding-top: 10px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 12px; background: var(--accent-soft);
}
.stat-card b {
  font-size: 16px; color: var(--accent);
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.stat-card span { font-size: 11px; color: var(--text-sub); white-space: nowrap; }
/* 前五名：横向铺开的胶囊，不是表格。尺寸压到五个能排一行 */
.stat-top { display: flex; flex-wrap: wrap; gap: 5px 6px; }
.st-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px;
  background: rgba(20, 40, 80, .05);
  font-size: 11.5px; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.st-item.me { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sr-rank { color: var(--text-sub); min-width: 8px; text-align: center; }
.st-item.me .sr-rank { color: var(--accent); }
.sr-name { max-width: 5em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sr-score { font-weight: 700; }

/* 五分一段的人数分布：横轴分数、纵轴人数 */
.stat-chart { display: flex; gap: 7px; height: 108px; margin-top: 10px; }
.sc-y {
  position: relative;
  width: 20px; flex: none; text-align: right;
  /* 底部让出横轴高度，刻度才与柱子对齐 */
  padding-bottom: 15px; box-sizing: border-box;
  font-size: 10px; color: var(--text-sub); font-variant-numeric: tabular-nums;
}
/* 刻度按真实人数比例定位（top 由 JS 给），不强行等分 */
.sc-y span { position: absolute; right: 0; transform: translateY(-50%); }
.sc-plot { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sc-cols {
  position: relative; flex: 1; display: flex; align-items: flex-end; gap: 1px;
  border-bottom: 1px solid rgba(20, 40, 80, .14);
}
/* 横向刻度线：与纵轴刻度同高（top 由 JS 给），压在柱子上面便于读数 */
.sc-line {
  position: absolute; left: 0; right: 0; height: 1px;
  background: rgba(20, 40, 80, .12); pointer-events: none;
}
.sc-col {
  flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end;
  cursor: pointer;
}
.sc-col i {
  display: block; width: 100%; border-radius: 2px 2px 0 0;
  background: var(--accent); opacity: .55;
  transition: opacity .14s;
}
.sc-col:hover i { opacity: 1; }
.sc-x {
  display: flex; justify-content: space-between; height: 15px;
  padding-top: 3px; font-size: 10px; color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}
/* 点柱子后浮在这一段上方的人数 */
.sc-tip {
  position: absolute; top: -2px; left: 50%;
  transform: translate(-50%, -100%);
  padding: 3px 8px; border-radius: 8px; white-space: nowrap;
  background: var(--accent); color: #fff; font-size: 11px;
  box-shadow: var(--shadow-soft);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.sc-tip.on { opacity: 1; }
body[data-theme="night"] .stat-card { background: rgba(255, 255, 255, .07); }
body[data-theme="night"] .st-item { background: rgba(255, 255, 255, .06); }
body[data-theme="night"] .st-item.me { background: var(--accent-soft); color: var(--accent); }
body[data-theme="night"] .sc-cols { border-bottom-color: rgba(255, 255, 255, .16); }
body[data-theme="night"] .sc-line { background: rgba(255, 255, 255, .14); }

/* ── 通用确认弹窗 ── */
.dialog { width: min(420px, 92vw); }
.dialog-text { font-size: 14px; line-height: 1.8; color: var(--text-main); white-space: pre-wrap; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px 16px; border-top: 1px solid var(--glass-border);
}
.dialog-foot .btn { min-width: 84px; }

/* ── 主站提示（3.1：只在非主站的部署上弹） ──
   整屏压住登录页与主界面，两个出口：跳主站 / 继续留在这里。
   卡片故意不用 .glass：外层遮罩已是 backdrop-filter 层，里面再套一层模糊，
   Chrome 在别处重绘时会重新采样那层模糊（侧栏 .mode-switch 就栽在这上面）。
   这里直接铺近不透明的实色，色源与右侧浮层一致（--pane-solid） */
#site-notice {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 42, .42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .2s ease;
}
.notice-card {
  width: min(440px, 100%);
  display: flex; flex-direction: column; gap: 12px;
  padding: 26px 24px 20px; border-radius: var(--radius);
  background: var(--pane-solid, #fbfcff);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-float);
  animation: pop .24s cubic-bezier(.2, 1.2, .3, 1);
}
.nt-kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  color: var(--accent);
}
.nt-title { font-size: 18.5px; font-weight: 600; line-height: 1.55; color: var(--text-main); }
.nt-title b { font-weight: 700; color: var(--accent); }
.nt-text { font-size: 13.5px; line-height: 1.85; color: var(--text-sub); }
.nt-text b { font-weight: 600; color: var(--text-main); }
.nt-acts { display: flex; gap: 10px; margin-top: 6px; }
.nt-acts .btn {
  flex: 1; min-height: 36px; display: flex; align-items: center;
  justify-content: center; text-align: center; text-decoration: none;
}
/* 「继续访问」是次要出口：白色玻璃在接近纯白的卡片上看不见边，
   改用强调色的淡底 + 无色描边，两个按钮一眼分得清主次 */
.nt-acts .btn.ghost:not(.primary) {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.nt-later {
  display: flex; align-items: center; gap: 7px; margin-top: 2px;
  font-size: 12.5px; color: var(--text-sub); cursor: pointer;
  user-select: none;
}
.nt-later input {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--accent);
}

/* ── 首页 ── */
.home-hero { padding: 30px 6px 24px; }
.home-hero.slim { padding: 18px 6px 14px; }
.home-hero h2 { font-size: 24px; letter-spacing: .5px; }
.home-hero p { color: var(--text-sub); margin-top: 8px; font-size: 14px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.subj-card {
  padding: 22px 20px; border-radius: 18px; cursor: pointer;
  background: rgba(255,255,255,.45); border: 1px solid var(--glass-border);
  transition: transform .2s, box-shadow .2s, background .2s;
}
body[data-theme="night"] .subj-card { background: rgba(255,255,255,.06); }
.subj-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px var(--accent-soft); background: var(--accent-soft); }
.subj-card .sc-name { font-size: 18px; font-weight: 700; }
.subj-card .sc-meta { color: var(--text-sub); font-size: 12.5px; margin-top: 6px; }

/* ── 目录树 ── */
.tree { display: flex; flex-direction: column; }
.tree-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 10px; gap: 12px;
}
.tree-tip { font-size: 12px; color: var(--text-sub); }
.hint-line { padding: 12px 6px; color: var(--text-sub); font-size: 13px; }
.branch { margin: 0; }
.branch-head {
  display: flex; align-items: center; gap: 6px; padding: 4px 7px;
  border-radius: 8px; cursor: pointer; transition: background .15s; user-select: none;
  line-height: 1.35;
}
.branch-head:hover { background: var(--accent-soft); }
.branch-arrow { width: 0; height: 0; border-left: 6px solid var(--text-sub);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .2s; flex-shrink: 0; }
.branch.open > .branch-head .branch-arrow { transform: rotate(90deg); }
.branch-name { font-size: 13px; word-break: break-all; }
.branch-badge {
  font-size: 11px; color: var(--accent); background: var(--accent-soft);
  border-radius: 8px; padding: 1px 8px; margin-left: auto; flex-shrink: 0;
}
.children { margin-left: 11px; border-left: 1px dashed var(--glass-border); padding-left: 5px; display: none; }
.branch.open > .children { display: block; }
.leaf {
  display: flex; align-items: center; gap: 6px; padding: 4px 7px;
  border-radius: 8px; cursor: pointer; transition: background .15s; line-height: 1.35;
}
.leaf:hover { background: var(--accent-soft); }
.leaf-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.leaf-name { font-size: 12.8px; word-break: break-all; }
.branch-head.focus { background: var(--accent-soft); font-weight: 700; }
.leaf.active { background: var(--accent); }
.leaf.active .leaf-name { color: #fff; font-weight: 600; }
.leaf.active .leaf-dot { background: #fff; }

/* ── 课程列表 ── */
.course-list { display: flex; flex-direction: column; gap: 12px; }
.course-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-radius: 16px; cursor: pointer;
  background: rgba(255,255,255,.45); border: 1px solid var(--glass-border);
  transition: transform .18s, box-shadow .2s;
}
body[data-theme="night"] .course-card { background: rgba(255,255,255,.06); }
.course-card:hover { transform: translateX(4px); box-shadow: 0 10px 24px var(--accent-soft); }
.course-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.course-info { flex: 1; min-width: 0; }
.course-name { font-weight: 600; font-size: 15px; word-break: break-all; }
.course-meta { color: var(--text-sub); font-size: 12px; margin-top: 4px; }
.tag {
  display: inline-block; font-size: 11px; border-radius: 8px;
  padding: 2px 9px; margin-left: 8px; vertical-align: 1px;
}
.tag.must { background: #fff1e0; color: #d97706; }
.tag.done { background: #dcfce7; color: #15803d; }

/* ── 内容列表 ── */
.atta-card {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-radius: 14px; background: rgba(255,255,255,.42);
  border: 1px solid var(--glass-border);
}
body[data-theme="night"] .atta-card { background: rgba(255,255,255,.05); }
.atta-ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.atta-info { flex: 1; min-width: 0; }
.atta-name { font-size: 14px; font-weight: 600; word-break: break-all; }
.atta-meta { color: var(--text-sub); font-size: 11.5px; margin-top: 3px; }
.atta-ops { display: flex; gap: 8px; flex-shrink: 0; }
.btn.tiny { padding: 5px 11px; font-size: 12px; border-radius: 9px; }

/* ── 悬浮窗 ── */
#float-layer {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 30, 50, .28); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.float-win {
  width: min(520px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .22s cubic-bezier(.2, 1.2, .3, 1);
}
@keyframes pop { from { transform: scale(.92) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.float-big { width: min(1360px, 97vw); height: 94vh; max-height: 94vh; }
/* 看图 / 看文件要尽量占满屏幕：头部和内容都只留一条窄边，
   省下来的高度全给正文（手机上一屏就能看完整张作业） */
#viewer .fw-head { padding: 8px 12px; }
#viewer .fw-head { border-bottom-color: transparent; }
#viewer .fw-body { padding: 6px 8px 8px; }
/* 看图 / 看文件时背景做实：玻璃透出来的正文会干扰视线 */
#viewer { background: rgba(252, 253, 255, .96); background-image: none; }
body[data-theme="night"] #viewer { background: rgba(22, 26, 42, .96); background-image: none; }
.fw-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--glass-border); flex-shrink: 0;
}
.fw-title { font-weight: 700; font-size: 15.5px; word-break: break-all; flex: 1; min-width: 0; }
.fw-actions { display: flex; gap: 8px; align-items: center; }
.fw-close {
  width: 30px; height: 30px; border-radius: 10px; border: none; cursor: pointer;
  background: rgba(0,0,0,.06); color: var(--text-main); font-size: 17px; line-height: 1;
}
.fw-close:hover { background: #e05050; color: #fff; }
body[data-theme="night"] .fw-close { background: rgba(255,255,255,.1); }
.fw-body { flex: 1; overflow: auto; padding: 16px 18px; }

/* ── 查看器 ── */
#viewer-body iframe { width: 100%; height: calc(94vh - 62px); border: none; border-radius: 10px; background: #fff; }
#viewer-body img.v-img {
  display: block; max-width: 100%; max-height: calc(94vh - 64px);
  width: auto; height: auto; margin: 0 auto; border-radius: 10px;
  background: repeating-conic-gradient(#f0f0f0 0 25%, #fafafa 0 50%) 0 0/22px 22px;
  cursor: zoom-in;
}
/* 点一下切成原始大小，细看笔迹；容器自己滚动 */
#viewer-body img.v-img.zoom {
  max-width: none; max-height: none; cursor: zoom-out;
}
body[data-theme="night"] #viewer-body img.v-img { background: #23283a; }
.v-tool {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 12px;
  background: rgba(255,255,255,.4); border: 1px solid var(--glass-border);
}
body[data-theme="night"] .v-tool { background: rgba(255,255,255,.06); }
.v-tool .hint { font-size: 12px; color: var(--text-sub); margin-left: auto; }
#viewer-body audio, #viewer-body video { width: 100%; border-radius: 12px; margin-top: 6px; }

/* ── 设置面板 ── */
.set-group { margin-bottom: 20px; }
.set-group h4 { font-size: 13px; color: var(--text-sub); letter-spacing: 1px; margin-bottom: 10px; }
/* 分组标题 + 恢复默认：只有一个刷新样子的图标，不带文字 */
.set-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.set-head h4 { margin-bottom: 0; }     /* 让图标紧贴标题，别甩到右边去 */
.set-reset {
  width: 22px; height: 22px; flex-shrink: 0; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-sub);
  transition: background .15s, color .15s, transform .3s;
}
.set-reset:hover { background: var(--accent-soft); color: var(--accent); }
.set-reset:active { transform: rotate(-90deg); }
.set-reset svg { width: 14px; height: 14px; display: block; }
/* 折叠标题上的那个也紧跟标题 */
.set-fold-head .set-reset { margin-left: 2px; }
/* 二级区块（主题 / 其他）：整条标题可点，箭头跟着展开 / 收起转 90°。
   默认展开，收起状态由 settings.js 记在 localStorage（xny.setFold.*） */
.set-fold { padding-top: 14px; margin-bottom: 4px; border-top: 1px dashed var(--glass-border); }
.set-fold:first-child { padding-top: 0; border-top: 0; }
.set-fold-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 2px 2px 0; margin-bottom: 14px;
  background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 14.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--text-main); text-align: left;
}
.set-fold-head:hover { color: var(--accent); }
.set-fold-head svg {
  width: 16px; height: 16px; flex-shrink: 0; display: block;
  color: var(--text-sub); transform: rotate(90deg);
  transition: transform .2s, color .15s;
}
.set-fold-head:hover svg { color: var(--accent); }
.set-fold.closed .set-fold-head svg { transform: rotate(0deg); }
.set-fold.closed .set-fold-body { display: none; }
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-chip {
  padding: 8px 16px; border-radius: 12px; cursor: pointer; font-size: 13px;
  font-family: inherit; letter-spacing: .5px;
  border: 2px solid var(--glass-border); color: var(--text-main);
  transition: border .15s, transform .15s, box-shadow .15s;
}
.theme-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
/* 色块是内联渐变，active 用描边表示，避免被内联 background 盖掉 */
.theme-chip.active {
  border-color: var(--accent); font-weight: 700;
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-soft);
}
.set-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.set-row label { width: 84px; flex-shrink: 0; font-size: 13.5px; color: var(--text-sub); }
.set-row input[type="color"] {
  width: 40px; height: 30px; border: none; border-radius: 8px; cursor: pointer; background: none; padding: 0;
}
/* ── 取色器：色块 + 弹出面板 ──
   原生 <input type="color"> 在平板 / 内嵌 WebView 上点开没反应，色板与滑杆
   都自己画；浮层挂 body、position:fixed 贴着色块，不占面板高度也不被滚动裁掉 */
.color-chip {
  width: 44px; height: 32px; border-radius: 10px; cursor: pointer; padding: 0;
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.color-pop {
  position: fixed; z-index: 260; width: 264px;
  padding: 10px 10px 8px; border-radius: 14px;
  background: var(--pane-solid, #fbfcff);
  /* 边界要看得出来：否则浮层压在设置面板上，后面那几行滑杆会像「漏出来」 */
  border: 1px solid var(--glass-border);
  border-color: color-mix(in srgb, var(--text-sub) 26%, transparent);
  box-shadow: var(--shadow-float);
  animation: pop .16s ease;
}
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.color-swatch {
  width: 30px; height: 30px; border-radius: 10px; cursor: pointer; padding: 0;
  border: 2px solid transparent;
}
.color-swatch.active {
  border-color: var(--text-main);
  box-shadow: 0 0 0 2px var(--glass-border);
}
/* 浮层里的标签比面板窄，别把滑杆挤没了 */
.color-pop .set-row { margin-bottom: 8px; }
.color-pop .set-row label { width: 46px; font-size: 12.5px; }
.color-pop .set-val { width: 38px; }
.color-foot { display: flex; align-items: center; gap: 8px; }
.color-native { width: 0; height: 0; padding: 0; border: 0; opacity: 0; }
.set-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.set-val { font-size: 12px; width: 40px; color: var(--text-sub); flex-shrink: 0; }
.set-row select, .set-row input[type="text"], .set-row input[type="url"] {
  flex: 1; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.5); font: inherit; color: var(--text-main); outline: none;
}
body[data-theme="night"] .set-row select, body[data-theme="night"] .set-row input {
  background: rgba(10,14,28,.5);
}
.seg { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--glass-border); }
.seg button {
  padding: 6px 14px; border: none; background: rgba(255,255,255,.4);
  font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text-main);
}
/* 夜间这条规则带 body[data-theme]，特异性 (0,2,2) 高于 .seg button.active
   的 (0,2,1)，会把选中态背景压成半透明白（只剩白字，看着像没高亮）。
   限定 :not(.active)，把选中态交还给下面那条。 */
body[data-theme="night"] .seg button:not(.active) { background: rgba(255,255,255,.07); }
.seg button.active { background: var(--accent); color: #fff; }
.set-foot { display: flex; gap: 10px; margin-top: 6px; }
.saved-tip { font-size: 12px; color: #10b981; margin-left: auto; align-self: center; opacity: 0; transition: opacity .3s; }
.saved-tip.show { opacity: 1; }

/* ── 提交窗口 ── */
.drop-zone {
  border: 2px dashed var(--glass-border); border-radius: 16px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  color: var(--text-sub); transition: border .2s, background .2s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone strong { color: var(--accent); }
.up-note { font-size: 12px; color: var(--text-sub); margin: 10px 2px 14px; line-height: 1.7; }
.up-list { display: flex; flex-direction: column; gap: 8px; }
.up-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 12px; background: rgba(255,255,255,.4); border: 1px solid var(--glass-border);
  flex-wrap: wrap;
}
/* 上传结果：附件 ID + 打开链接，摊在这一行下面 */
.up-result {
  flex-basis: 100%; display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-sub);
}
.up-link { color: var(--accent); text-decoration: none; }
.up-link:hover { text-decoration: underline; }
body[data-theme="night"] .up-item { background: rgba(255,255,255,.05); }
.up-name { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-all; }
.up-size { color: var(--text-sub); font-size: 12px; flex-shrink: 0; }
.up-bar {
  width: 120px; height: 6px; border-radius: 4px; flex-shrink: 0;
  background: rgba(0,0,0,.08); overflow: hidden;
}
.up-bar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .2s; }
.up-st { flex-shrink: 0; font-size: 12px; width: 52px; text-align: right; }
.up-st.ok { color: #10b981; } .up-st.bad { color: #e05050; } .up-st.ing { color: var(--accent); }

/* ── toast ── */
/* 放右下角：右上角是浮窗的关闭按钮，提示一弹出来就把它盖住，
   连着点几下很容易点错到提示条上 */
#toast-wrap {
  position: fixed; right: 22px; bottom: 22px; z-index: 99;
  display: flex; flex-direction: column-reverse; gap: 8px;
  align-items: flex-end;
}
.toast {
  padding: 12px 18px; border-radius: 14px; font-size: 13.5px; color: #fff;
  background: rgba(30, 40, 60, .85); backdrop-filter: blur(10px);
  animation: pop .2s ease; box-shadow: 0 10px 26px rgba(0,0,0,.2); max-width: 320px;
}
.toast.ok { background: rgba(16, 152, 108, .92); }
.toast.bad { background: rgba(210, 70, 70, .92); }

/* ── 滚动条 ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── 窄屏适配 ── */
@media (max-width: 1400px) {
  #tree-pane { width: 220px; }
}
@media (max-width: 1200px) {
  #main-view { gap: 12px; padding: 14px; }
  #tree-pane { width: 200px; }
}

/* 说明：稍窄的桌面窗口（>760px）目录树保持固定左栏，只收窄宽度，
   交互不变；只有真手机宽度（≤760px）才转成抽屉 */
@media (max-width: 1080px) {
  #tree-pane { width: 190px; }
}

@media (max-width: 760px) {
  #main-view { flex-direction: column; padding: 12px; }
  /* 手机宽度：目录树变抽屉，点顶栏「目录」滑出 */
  #tree-pane {
    position: absolute; left: 12px; top: 12px; bottom: 12px; z-index: 6;
    width: 262px; transform: translateX(calc(-100% - 20px));
    transition: transform .24s ease; box-shadow: var(--shadow-float);
  }
  #tree-pane.show { transform: translateX(0); }
  /* 竖栏在手机上转成底部一条图标横栏 */
  #sidebar {
    width: 100%; height: 58px; flex-direction: row; align-items: center;
    padding: 8px 10px; gap: 8px;
  }
  .sb-head { width: auto; padding: 0; flex-shrink: 0; }
  .sb-logo { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; }
  #sb-nav {
    flex-direction: row; width: auto; flex: 1; min-width: 0;
    overflow-x: auto; overflow-y: hidden; gap: 4px;
    padding: 0; margin-left: 0;
  }
  .sb-subjects { flex-direction: row; width: auto; gap: 4px; }
  .nav-sep, .nav-group-title { display: none; }
  .nav-item { width: 40px; height: 40px; flex-shrink: 0; }
  .nav-item::before { display: none; }
  .sb-foot {
    flex-direction: row; border-top: none; padding-top: 0; gap: 4px;
    width: auto; flex-shrink: 0; border-left: 1px solid var(--glass-border); padding-left: 8px;
  }
  .sb-foot .btn { width: 34px; height: 32px; }
  .sb-ver { display: none; }
  /* 手机上没有悬停：列表摊成正文下方一条紧凑的横向滑条（约 88px 高） */
  #list-pane { width: 100%; flex: 0 0 auto; max-height: 88px; display: block; }
  .lp-card, #list-pane:hover .lp-card {
    width: 100%; height: auto; max-height: 88px;
    padding: 8px 10px; box-shadow: none; flex: 0 0 auto;
  }
  .lp-head, #list-pane:hover .lp-head {
    justify-content: flex-start; padding: 0 2px 6px; height: auto; margin-bottom: 6px;
  }
  .lp-title { display: block; font-size: 12.5px; }
  .lp-count { font-size: 10.5px; }
  .lp-scroll, #list-pane:hover .lp-scroll { overflow-x: auto; overflow-y: hidden; }
  .course-mini { flex-direction: row; gap: 7px; }
  /* 每门课压成一行：序号 + 名称，长名省略 */
  .cm-item, #list-pane:hover .cm-item {
    flex-direction: row; align-items: center; gap: 5px;
    flex-shrink: 0; width: 190px; padding: 7px 9px; border-radius: 9px;
    background: rgba(255,255,255,.34);
  }
  body[data-theme="night"] .cm-item { background: rgba(255,255,255,.06); }
  .cm-item.active { background: var(--accent); }
  .cm-idx, #list-pane:hover .cm-idx {
    width: auto; text-align: left; font-size: 10.5px; opacity: .7;
  }
  .cm-item.active .cm-idx { opacity: .85; }
  .cm-info, #list-pane:hover .cm-info { display: block; width: 100%; min-width: 0; }
  .cm-name { font-size: 12.5px; line-height: 1.4; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }
  .cm-meta { display: none; }

  /* 顶栏与面包屑：手机上压成一行，超长横向滑动，别再占三行 */
  .main-head { padding: 10px 14px 6px; gap: 6px; }
  .main-head .btn.tiny { padding: 4px 8px; font-size: 11.5px; }
  .main-head .breadcrumb {
    flex-wrap: nowrap; overflow-x: auto; font-size: 12px;
    scrollbar-width: none; white-space: nowrap;
  }
  .main-head .breadcrumb::-webkit-scrollbar { height: 0; }
  .main-head .breadcrumb a, .main-head .breadcrumb .crumb-cur { flex-shrink: 0; }
  .page { padding: 4px 14px 18px; }
  .doc-flow { gap: 18px; padding: 2px 0 8px; }
  .float-big { width: 100%; height: 100dvh; border-radius: 0; max-height: none; }
}


/* ── 手写作答画板（全屏，白纸不随主题，工具栏随主题） ── */
.draw-layer {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: rgba(244, 246, 251, .97);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  touch-action: none; overscroll-behavior: none;
}
body[data-theme="night"] .draw-layer { background: rgba(13, 17, 30, .97); }
.draw-layer.hidden { display: none; }
.draw-bar {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--glass-border);
}
.draw-tools, .draw-colors, .draw-widths {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
}
.draw-flex { flex: 1; }
.draw-sep { width: 1px; height: 22px; background: var(--glass-border); }
.draw-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  padding: 0; border: 1px solid var(--glass-border); border-radius: 11px;
  background: rgba(255, 255, 255, .55); color: var(--text-main); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
body[data-theme="night"] .draw-btn { background: rgba(255, 255, 255, .08); }
.draw-btn svg { width: 20px; height: 20px; }
.draw-btn:hover { border-color: var(--accent); color: var(--accent); }
.draw-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.draw-done { flex-shrink: 0; }
.draw-dot {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid transparent; display: flex; align-items: center; justify-content: center;
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
/* 选中态要一眼看得出来：颜色点本身是有颜色的，只把边框染成主色根本分不清，
   改成外圈双环 + 轻微放大，深浅主题都显眼 */
.draw-color.on, .draw-width.on {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft);
  transform: scale(1.08);
}
.draw-color:hover, .draw-width:hover { transform: scale(1.12); }
.draw-width { background: rgba(255, 255, 255, .55); }
body[data-theme="night"] .draw-width { background: rgba(255, 255, 255, .08); }
.draw-width-dot { display: block; border-radius: 50%; background: var(--text-main); }
.draw-stage { flex: 1; position: relative; overflow: hidden; }
.draw-canvas { display: block; cursor: crosshair; touch-action: none; }

/* 批改模式下的自判分数条：靠右竖排、档位铺成网格、多小问分组可滚动。
   以前是底部一条横排，0~15 全档位或好几个小问会把画布下半屏全挡住 */
.draw-scores {
  position: absolute; right: 16px; top: 72px; bottom: 16px;
  left: auto; transform: none;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  width: min(286px, 34vw); max-width: none; max-height: none;
  padding: 12px; border-radius: 14px;
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(255, 255, 255, .96); border: 1px solid rgba(20, 40, 80, .12);
  box-shadow: var(--shadow-float); z-index: 6;
}
body[data-theme="night"] .draw-scores {
  background: rgba(20, 26, 44, .96); border-color: rgba(255, 255, 255, .14);
}
.ds-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 6px;
}
.ds-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding-bottom: 10px; border-bottom: 1px solid rgba(20, 40, 80, .10);
}
.ds-row:last-child { border-bottom: 0; padding-bottom: 0; }
.ds-label { font-size: 12.5px; font-weight: 700; color: #475569; margin-right: 2px; }
body[data-theme="night"] .ds-label { color: #b9c8e6; }
.ds-btn {
  position: relative;
  min-width: 0; padding: 6px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(20, 40, 80, .14); background: #fff;
  color: #1f2430; font: inherit; font-size: 13px;
  transition: transform .14s ease, background .14s, color .14s,
              border-color .14s, box-shadow .14s;
}
body[data-theme="night"] .ds-btn {
  background: rgba(255, 255, 255, .08); color: #e8edf7;
  border-color: rgba(255, 255, 255, .18);
}
.ds-btn:hover { border-color: var(--accent); color: var(--accent); }
/* 上面那条夜间规则带 body[data-theme]，特异性比 .ds-btn.on 高，会把选中态
   的实心强调色压成半透明白（夜里看起来像没点上）。这里显式补回选中态。 */
body[data-theme="night"] .ds-btn.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.ds-btn:active { transform: scale(.92); }
/* 选中态一眼可辨：放大、实心、右上角一个 CSS 画的小勾，再弹一下。
   点完 _paintScores 会重建按钮，新按钮带 .on 就会播动画——
   纯视觉反馈，不需要任何提示文案或额外按钮。 */
.ds-btn.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 700; transform: scale(1.09); z-index: 1;
  box-shadow: var(--shadow-glow),
              inset 0 0 0 2px rgba(255, 255, 255, .32);
  animation: ds-pick .2s ease-out;
}
.ds-btn.on::after {
  content: ""; position: absolute; top: 3px; right: 5px;
  width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
@keyframes ds-pick {
  0% { transform: scale(.88); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1.09); }
}
@media (max-width: 720px) {
  /* 窄屏右侧栏会压住画布，退回底部但限高、可滚动 */
  .draw-scores {
    right: 10px; left: 10px; width: auto; top: auto; bottom: 10px;
    max-height: 44vh;
  }
}
/* 文字工具的透明输入框：只负责收键盘/输入法内容，用户看到的文字
   直接渲染在画布上（所见即所得） */
.draw-hidden-input {
  position: absolute; z-index: 5; width: 1px; height: 24px;
  opacity: 0; border: 0; padding: 0; background: transparent; outline: none;
}

/* ── 更新历史（点版本号打开） ── */
.ver-link { cursor: pointer; }
.ver-link:hover { color: var(--accent); }
.ver-bar {
  display: flex; align-items: center; gap: 12px; padding: 0 2px 10px;
  border-bottom: 1px solid var(--glass-border); margin-bottom: 8px; flex-shrink: 0;
}
.ver-only {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-sub); cursor: pointer;
}
.ver-count { margin-left: auto; font-size: 12px; color: var(--text-sub); }
.ver-list { overflow-y: auto; flex: 1; padding-right: 4px; }
.ver-item { padding: 10px 2px 12px; border-bottom: 1px dashed var(--glass-border); }
.ver-item:last-child { border-bottom: 0; }
.ver-h { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 14px; }
.ver-v { font-weight: 700; color: var(--accent); }
.ver-name { font-weight: 600; }
.ver-date { margin-left: auto; font-size: 11.5px; color: var(--text-sub); white-space: nowrap; }
.ver-sec { margin: 8px 0 2px; font-size: 12px; color: var(--text-sub); font-weight: 600; }
.ver-lines {
  margin: 0 0 4px 18px; padding: 0;
  font-size: 12.5px; line-height: 1.75; color: var(--text-main);
}
.ver-lines li { margin: 1px 0; }
.ver-list.only-new .ver-item[data-keep="0"] { display: none; }

/* ── 上传记录（可绑到题目） ── */
.up-recent { margin-top: 16px; }
.up-recent-title {
  font-size: 12.5px; font-weight: 600; color: var(--text-sub);
  margin-bottom: 8px; letter-spacing: .2px;
}
.up-recent-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 6px; border-radius: 10px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,.28);
}
body[data-theme="night"] .up-recent-item { background: rgba(255,255,255,.05); }
.up-recent-item .up-name { flex: 1; min-width: 90px; font-size: 13px; }
.up-id { font-size: 11.5px; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.up-qsel {
  max-width: 190px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,.6);
  color: var(--text-main); font: inherit; font-size: 12px;
}
body[data-theme="night"] .up-qsel { background: rgba(10,14,28,.5); }

/* ── 新批语红点（在作答缩略图左上角） ── */
.q-thumb-dot {
  position: absolute; left: 4px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: #e05050; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .92);
}
body[data-theme="night"] .q-thumb-dot { box-shadow: 0 0 0 2px rgba(20, 24, 40, .9); }

/* ── 作答详情：我的作答 / 老师批改 / 批语 ── */
.ans-tabs {
  display: flex; gap: 6px; margin-bottom: 12px;
  border-bottom: 1px solid var(--glass-border); padding-bottom: 8px;
}
.ans-tab {
  padding: 6px 13px; border: 1px solid var(--glass-border); border-radius: 999px;
  background: rgba(255, 255, 255, .34); color: var(--text-sub);
  font: inherit; font-size: 12.5px; cursor: pointer;
  transition: color .16s, background .16s, border-color .16s;
}
body[data-theme="night"] .ans-tab { background: rgba(255, 255, 255, .06); }
.ans-tab:hover { color: var(--accent); }
.ans-tab.on {
  color: #fff; background: var(--accent); border-color: var(--accent);
}
.ans-pane { display: flex; flex-direction: column; gap: 12px; }
/* 作答详情：内容撑满，自判条压在底部，不跟着图片高度浮在中间 */
#viewer-body.ans-mode { display: flex; flex-direction: column; }
#viewer-body.ans-mode .ans-tabs { flex-shrink: 0; }
#viewer-body.ans-mode .ans-pane { flex: 1 1 auto; min-height: 0; }
.ans-note {
  padding: 14px 16px; border-radius: 12px; line-height: 1.9;
  background: var(--accent-soft); color: var(--text-main);
  font-size: calc(var(--font-size) + 1px); word-break: break-word;
}
.ans-note img { max-width: 100%; border-radius: 10px; }
.ans-tip {
  padding: 18px 16px; border-radius: 12px; text-align: center;
  color: var(--text-sub); font-size: 13px; line-height: 1.9;
  border: 1px dashed var(--glass-border);
}

/* ── 优秀作答 ── */
.share-view { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.share-bar { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.share-info {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-main);
}
.share-idx { color: var(--text-sub); font-variant-numeric: tabular-nums; }
.share-name { font-weight: 700; }
.share-score { color: var(--accent); font-weight: 700; }
.share-postil { font-size: 12px; color: var(--text-sub); }
.share-arrow {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .72);
  color: var(--text-main); font-size: 22px; line-height: 1; cursor: pointer;
  transition: background .14s, opacity .14s;
}
.share-arrow:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.share-arrow:disabled { opacity: .3; cursor: default; }
body[data-theme="night"] .share-arrow { background: rgba(255, 255, 255, .08); }
.share-stage {
  flex: 1; min-height: 0; overflow: auto;
  display: flex; align-items: center; justify-content: center;
}
.share-stage img.v-img { max-height: calc(94vh - 168px); }

/* 黑夜模式下图例的小圆点太暗，9px 根本看不出颜色：换成实色 + 一圈淡描边 */
body[data-theme="night"] .sl-dot { box-shadow: 0 0 0 1px rgba(255, 255, 255, .26); }
body[data-theme="night"] .sl-dot[data-st="todo"] { background: #6b7a90; }
body[data-theme="night"] .sl-dot[data-st="wait"] { background: var(--accent); }
body[data-theme="night"] .sl-dot[data-st="ok"] { background: #10b981; }
body[data-theme="night"] .sl-dot[data-st="part"] { background: #f59e0b; }
body[data-theme="night"] .sl-dot[data-st="bad"] { background: #ef4444; }

/* ── 填题模式：只留节标题与答题区，正文 / 题干 / 答案全藏起来 ── */
body.fill-mode .text-block,
body.fill-mode .atta-card,
body.fill-mode .sub-head,
body.fill-mode .sec-empty,
body.fill-mode .q-stem,
body.fill-mode .q-extra,
body.fill-mode .q-toggle { display: none !important; }

/* ── 多页批改：画板 / 查看浮层的数字页签 ──
   官网题目卡只显示第一张批改图，自阅弹窗才靠 itemList 翻页；
   这里两边都给一屏一页的切换，选中态仍只用放大 + 实心 + 光晕表达 */
.draw-pages {
  flex-shrink: 0; display: flex; justify-content: center; gap: 6px;
  padding: 7px 12px; border-bottom: 1px solid var(--glass-border);
}
.dp-btn, .ap-btn {
  min-width: 30px; height: 28px; padding: 0 8px; border-radius: 9px;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .45);
  color: var(--text-sub); font: inherit; font-size: 12.5px; cursor: pointer;
  transition: transform .14s, background .14s, color .14s, border-color .14s;
}
body[data-theme="night"] .dp-btn,
body[data-theme="night"] .ap-btn { background: rgba(255, 255, 255, .07); }
.dp-btn:hover, .ap-btn:hover { color: var(--accent); border-color: var(--accent); }
.dp-btn.on, .ap-btn.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 700; transform: scale(1.08); box-shadow: var(--shadow-glow);
}
.ans-imgs {
  flex: 1 1 auto; min-height: 0;
  display: flex; justify-content: center; align-items: flex-start;
}
.ans-imgs .v-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ans-pages { display: flex; justify-content: center; gap: 6px; flex-shrink: 0; }

/* 主观大题的小分栏：一张图对应多个小问，分数列在作答图左边 */
.ans-scores {
  flex: 0 0 132px; min-width: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 13px; border-radius: 16px;
  background: var(--accent-soft); border: 1px solid var(--glass-border);
  scrollbar-width: none;
}
.ans-scores::-webkit-scrollbar { width: 0; height: 0; }
.as-row { display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; font-size: 12.5px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.as-no { color: var(--text-sub); }
.as-score { font-weight: 700; color: var(--text-main); }
.ans-pane.has-scores { flex-direction: row; align-items: stretch; gap: 12px; }

/* 题目卡上的小分条（答题区下方）：号 + 得分/满分 */
.q-subs { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.qs-item {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 1px 7px; border-radius: 999px;
  background: rgba(20, 40, 80, .05);
  font-size: 11.5px; line-height: 1.6; font-variant-numeric: tabular-nums;
}
body[data-theme="night"] .qs-item { background: rgba(255, 255, 255, .06); }
.qs-no { color: var(--text-sub); }
.qs-score { font-weight: 700; }
/* 从答题卡跳到某个小问时，这一格闪一下 */
.qs-item.hl {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.qs-item.hl .qs-no, .qs-item.hl .qs-score { color: var(--accent); }

/* 老师在卷面上的批注：排在批改图右边一栏，图仍是主位。
   没有批改图时（只写了批注）这一栏独占整宽 */
.ans-main { flex: 1 1 auto; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 12px; }
.ans-pane.has-postils { flex-direction: row; align-items: stretch; gap: 14px; }
.ans-postils {
  flex: 0 0 280px; min-width: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; border-radius: 16px;
  background: var(--accent-soft); border: 1px solid var(--glass-border);
  scrollbar-width: none;
}
.ans-postils::-webkit-scrollbar { width: 0; height: 0; }
.ans-postil { font-size: calc(var(--font-size) - 1px); line-height: 1.85;
  color: var(--text-main); word-break: break-word; }
/* 只有批注、没有批改图：整块让给批注，别留一条 250px 的窄栏 + 一片空白 */
.ans-pane.only-postils { flex-direction: column; }
.ans-pane.only-postils .ans-main { display: none; }    /* 没有图就别占着高度 */
.ans-pane.only-postils .ans-postils { flex: 1 1 auto; }
.ans-pane.only-postils .ans-postil { font-size: var(--font-size); }
.ans-postil + .ans-postil { padding-top: 10px; border-top: 1px solid var(--glass-border); }
.ans-postil-img { display: block; max-width: 100%; border-radius: 10px;
  cursor: zoom-in; box-shadow: var(--shadow); }
/* 窄屏放一栏：左右并排会把两张图都压小 */
@media (max-width: 900px) {
  .ans-pane.has-postils, .ans-pane.has-scores { flex-direction: column; }
  .ans-postils { flex: 0 0 auto; max-height: 34vh; }
  .ans-scores { flex: 0 0 auto; max-height: 26vh; }
}

/* 卡片收紧一点，一屏能装下更多题 */
body.fill-mode .q-card { padding: 10px 14px; }
body.fill-mode .q-head { margin-bottom: 6px; }
body.fill-mode .sec-body { gap: 14px; }
body.fill-mode .doc-flow { gap: 14px; }

/* ══════════ 3.0.0 考试模式（方案 A：侧栏双段切换） ══════════ */
/* 课程 / 考试：滑块式切换。底板不要 backdrop-filter——侧栏本身已经是玻璃，
   再叠一层模糊会在别处重绘时「浮现」出背光（hover 右侧元素就会看到） */
.mode-switch {
  position: relative; display: flex; gap: 4px; width: 100%; flex-shrink: 0;
  padding: 4px; margin: 2px 0 8px;
  border: 1px solid var(--glass-border); border-radius: 12px;
  background: rgba(255, 255, 255, .16);
}
body[data-theme="night"] .mode-switch { background: rgba(255, 255, 255, .06); }
/* 滑块：两段等宽，translateX 走到第二段（宽 = 段宽 + gap） */
.ms-thumb {
  position: absolute; top: 4px; left: 4px; bottom: 4px;
  width: calc(50% - 6px); border-radius: 9px;
  background: var(--glass-bg);
  box-shadow: 0 3px 10px rgba(30, 60, 110, .12);
  transition: transform .26s cubic-bezier(.34, .72, .3, 1);
  pointer-events: none;
}
.mode-switch[data-mode="exam"] .ms-thumb { transform: translateX(calc(100% + 4px)); }
body[data-theme="night"] .ms-thumb { background: rgba(255, 255, 255, .14); }
.mode-btn {
  position: relative; z-index: 1;
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 6px 0; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-sub); cursor: pointer;
  transition: color .18s;
}
.mode-btn svg { display: block; width: 17px; height: 17px; }
.mode-btn:hover { color: var(--accent); }
.mode-btn.active { color: var(--accent); }
body[data-theme="night"] .mode-btn.active { color: #cfe0ff; }
/* 填题按钮：开 / 关只有配色变化，尺寸与形状保持一致（别切成 primary 的实心块） */
.btn.ghost.on {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent);
}

/* 考试不可作答：已交卷且无补交窗口、或倒计时归零时由 $content._lockExam 加上。
   只关答题交互，看批改图 / 播放媒体照旧 */
.exam-locked .q-opts,
.exam-locked .q-input,
.exam-locked .q-photo-thumbs button { pointer-events: none; opacity: .68; }
/* 已交卷 / 考试结束：交图与手写两个按钮直接收起来，留着只是让人白点 */
.exam-locked .q-photo-btn,
.exam-locked .q-draw-btn { display: none; }
