/* ==========================================================================
   SimMath · 小学数学交互课件平台
   assets/style.css
   --------------------------------------------------------------------------
   配色：主色蓝（教学感）/ 页面浅灰白 / 卡片白 + 圆角 + 轻阴影
   字体：思源黑体（Source Han Sans / Noto Sans SC）优先，逐级降级到系统黑体
   结构：① 变量  ② 基础  ③ 顶栏  ④ 网格模式  ⑤ 雪花模式  ⑥ 详情页
        ⑦ 弹窗与提示  ⑧ 响应式
   ========================================================================== */

/* ------------------------------ ① 设计变量 ------------------------------ */
:root {
  /* 顶栏控件统一高度：搜索框 / 筛选 / 网格雪花 / 账号，四个一样高才齐整 */
  --ctl: 40px;

  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;

  --ink: #14213d;
  --ink-sub: #62718e;
  --ink-faint: #93a0b8;
  --line: #e4eaf5;
  --bg: #f6f8fc;
  --card: #ffffff;

  /* 四大板块各自的识别色 */
  --c-algebra: #2563eb;   /* 数与代数 */
  --c-geometry: #0d9488;  /* 图形与几何 */
  --c-stat: #7c3aed;      /* 统计与概率 */
  --c-practice: #d97706;  /* 综合与实践 */
  --c-game: #d4537e;      /* 游戏化（不分上下册，挂在臂尖末端） */

  --shadow-sm: 0 2px 8px rgba(23, 43, 84, .06);
  --shadow: 0 8px 24px rgba(23, 43, 84, .08), 0 2px 6px rgba(23, 43, 84, .04);
  --shadow-lg: 0 18px 44px rgba(23, 43, 84, .14), 0 4px 12px rgba(23, 43, 84, .06);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --top: 64px;
  --pad: 30px;
  --ease: cubic-bezier(.22, .68, .28, 1);
}

/* ------------------------------ ② 基础 ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: "Source Han Sans SC", "Source Han Sans CN", "Noto Sans SC",
               "思源黑体", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
               system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1000px 420px at 8% -10%, rgba(191, 219, 254, .55) 0%, rgba(191, 219, 254, 0) 68%),
    radial-gradient(900px 400px at 100% 0%, rgba(219, 234, 254, .6) 0%, rgba(219, 234, 254, 0) 66%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: .2px; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: .92em;
  background: var(--blue-50);
  color: var(--blue-deep);
  padding: 1px 6px;
  border-radius: 5px;
}
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* 通用按钮 */
.primary-btn {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, .34); }
.primary-btn:active { transform: translateY(0) scale(.98); }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-sub);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: .18s;
}
.ghost-btn:hover { color: var(--blue); border-color: var(--blue-200); background: var(--blue-50); }
.ghost-btn:disabled { opacity: .42; cursor: not-allowed; }
.ghost-btn:disabled:hover { color: var(--ink-sub); border-color: var(--line); background: #fff; }
.ghost-btn.sm { padding: 6px 12px; font-size: 12.5px; }

.link-btn {
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ------------------------------ ③ 顶栏 ------------------------------ */
/* 主题色定成「雪白」：顶栏做成近白 + 一丝冷蓝的渐变，靠一条细边和轻投影跟页面分开。
   不再用蓝色大色块 —— 蓝色留给按钮和封面，整页更干净，课件封面也更跳出来。
   顶栏上的控件（搜索 / 网格雪花 / 账号）统一成同一种「半透明浅蓝」质感。 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: 0 0 auto;
  /* 固定下限，不要用 var(--top)：--top 是 JS 按顶栏真实高度量出来回填的，
     两边互相引用会打架。顶栏真实高度由 app.js 的 syncTopH() 量。 */
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .70);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(37, 99, 235, .12);
  box-shadow: 0 4px 18px rgba(30, 64, 175, .07);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); flex: 0 0 auto; min-width: 0; }
.brand .logo {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .32);
  transition: transform .35s var(--ease);
}
.brand:hover .logo { transform: rotate(60deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 18.5px; letter-spacing: .6px; font-weight: 700; color: var(--ink); }
.brand-text small { font-size: 11.5px; color: var(--ink-faint); letter-spacing: 1.2px; }

.top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* 顶栏控件共用的「半透明浅蓝」底 */
.search,
.seg,
.icon-btn,
.auth-btn {
  background: rgba(37, 99, 235, .055);
  border: 1px solid rgba(37, 99, 235, .14);
  color: var(--ink-sub);
}

/* 搜索框 */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 262px;
  padding: 0 12px;
  height: var(--ctl);
  border-radius: 999px;
  transition: .22s;
}
.search:hover { background: rgba(37, 99, 235, .085); }
.search:focus-within {
  background: #fff;
  color: var(--blue);
  border-color: var(--blue-300);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
  width: 306px;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  color: var(--ink);
  font-size: 14px;
}
.search input::placeholder { color: var(--ink-faint); }
.search input::-webkit-search-cancel-button { display: none; }
.q-clear {
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  color: var(--ink-faint);
  background: rgba(37, 99, 235, .10);
  display: grid; place-items: center;
  transition: .18s;
}
.q-clear:hover { background: var(--blue-100); color: var(--blue-deep); }

/* 「收起」只在窄屏搜索展开时出现，其余场合一直藏着（宽屏搜索框本来就常开） */
.q-close { display: none; }

/* 模式切换：只放图标，不放文字 */
.seg {
  position: relative;
  display: flex;
  height: var(--ctl);
  padding: 4px;
  border-radius: 999px;
}
.seg-ind {
  position: absolute;
  top: 4px; left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(37, 99, 235, .14);
  box-shadow: 0 2px 8px rgba(30, 64, 175, .12);
  transition: transform .34s var(--ease);
}
/* 雪花在左（默认位），网格在右——选中网格时滑块右移一格 */
.seg[data-active="grid"] .seg-ind { transform: translateX(100%); }
.seg-btn {
  position: relative;
  z-index: 1;
  width: 46px;
  height: calc(var(--ctl) - 8px);
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink-faint);
  transition: color .24s;
}
.seg-btn:hover { color: var(--blue); }
.seg-btn.is-on { color: var(--blue-deep); }
.seg-btn svg { display: block; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 15px;
  transition: .2s;
}
.icon-btn:hover { background: rgba(37, 99, 235, .11); transform: translateY(-1px); }

/* ------------------------------ 视图容器 ------------------------------ */
main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.view { display: none; }
.view.is-on { display: block; }
#view-snow.is-on,
#view-course.is-on { display: flex; flex-direction: column; }
body.mode-snow .foot,
body.mode-course .foot { display: none; }

.foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: center;
  padding: 26px 24px 34px;
  color: var(--ink-faint);
  font-size: 12.5px;
}

/* ------------------------------ ④ 网格模式 ------------------------------ */
/* 筛选已经搬进顶栏（放在搜索框左边），不再是原来那条独立横杠 ——
   这样上边只占一行，网格能多出一整行的空间。
   为什么不用原生 <select>：它弹出来的那个列表是操作系统画的，CSS 管不到，
   永远是"原始 UI"。所以这里自己画一套：按钮 + 弹层。 */
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
}

.cs { position: relative; flex: 0 0 auto; }
.cs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctl);
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .055);
  border: 1px solid rgba(37, 99, 235, .14);
  color: var(--ink-sub);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: .18s;
}
.cs-btn:hover { background: rgba(37, 99, 235, .085); color: var(--blue-deep); }
.cs-btn[aria-expanded="true"] {
  background: #fff;
  border-color: var(--blue-300);
  color: var(--blue-deep);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}
.cs-lab { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.cs-val { color: inherit; }
.cs-caret { flex: 0 0 auto; opacity: .55; transition: transform .2s var(--ease); }
.cs-btn[aria-expanded="true"] .cs-caret { transform: rotate(180deg); opacity: .9; }
.cs-ico { display: none; place-items: center; }
/* 键盘操作时才显示焦点圈，鼠标点不显示 */
.cs-btn:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; }

/* 已经筛过（不是"全部"）时，按钮自己给个蓝框，缩成圆圈也看得出来 */
.cs-btn.is-set {
  background: rgba(37, 99, 235, .11);
  border-color: rgba(37, 99, 235, .32);
  color: var(--blue-deep);
}

/* 弹层 */
.cs-pop {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 70;
  min-width: 100%;
  max-width: calc(100vw - 28px);
  max-height: 300px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: csIn .14s var(--ease);
}
@keyframes csIn { from { opacity: 0; transform: translateY(-6px); } }
.cs-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: .14s;
}
.cs-opt:hover { background: var(--blue-50); color: var(--blue-deep); }
.cs-opt:focus-visible { background: var(--blue-50); color: var(--blue-deep); outline: 2px solid var(--blue-200); outline-offset: -2px; }
.cs-opt.is-sel { background: var(--blue-50); color: var(--blue-deep); }
.cs-opt.is-sel::after { content: "✓"; font-size: 13px; font-weight: 800; color: var(--blue); }
/* 板块前面点一个该板块的颜色小圆点，跟卡片上的标签对得上 */
.cs-opt .cs-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.cs-opt .cs-txt { flex: 1 1 auto; min-width: 0; }

/* 顶栏里的结果数和「重置筛选」：跟别的控件同一个调子 */
.result-count { font-size: 12.5px; color: var(--ink-sub); white-space: nowrap; }
.result-count b { color: var(--blue); font-size: 14px; }
.top-ghost {
  height: var(--ctl);
  padding: 0 12px;
  background: rgba(37, 99, 235, .055);
  border-color: rgba(37, 99, 235, .14);
  color: var(--blue-deep);
  box-shadow: none;
  font-size: 12.5px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.top-ghost:hover { background: rgba(37, 99, 235, .11); color: var(--blue); border-color: rgba(37, 99, 235, .22); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 20px;
  padding: 22px var(--pad) 46px;
  align-content: start;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  /* 玻璃感：半透明白（网格页背景是平色，模糊没有意义，省掉 backdrop 滤镜保滚动流畅） */
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(228, 234, 245, .95);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s;
  animation: cardIn .42s var(--ease) backwards;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--blue-200); }

.card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(140deg, #eef4ff, #e2ebfb);
  overflow: hidden;
}
.card-cover svg, .card-cover img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.card:hover .card-cover svg,
.card:hover .card-cover img { transform: scale(1.045); }

.card-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 2; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 33, 61, .1);
  backdrop-filter: blur(6px);
}
/* 左上角徽章：直接显示课件编号，底色用板块色（2026-09-24 定稿，替代原年级+板块双标签） */
.badge.code {
  color: #fff;
  background: var(--c-algebra);
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
}
.badge.code[data-cat="图形与几何"] { background: var(--c-geometry); }
.badge.code[data-cat="统计与概率"] { background: var(--c-stat); }
.badge.code[data-cat="综合与实践"] { background: var(--c-practice); }
.badge.code[data-cat="游戏化"] { background: var(--c-game); }

/* 卡片右上角：下载 + 分享（2026-09-24 下载从预览图右下角挪到分享左侧）。卡片本身点一下就是全屏看课件 */
.card { cursor: pointer; }
.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.card-share {
  position: absolute;
  top: 9px; right: 9px;
  z-index: 3;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--blue);
  display: grid; place-items: center;
  opacity: .82;
  transition: .22s;
  box-shadow: 0 3px 10px rgba(20, 33, 61, .14);
  backdrop-filter: blur(6px);
}
.card:hover .card-share { opacity: 1; }
.card-share:hover { background: var(--blue); color: #fff; transform: scale(1.08); }

.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; flex: 1; }
.card-name {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-sub);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px dashed var(--line);
}
.card-author {
  font-size: 12px; color: var(--ink-faint);
  white-space: nowrap;              /* 点赞数三位数也别把作者名挤成两行 */
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

/* 课件编号已移到卡片左上角徽章（板块色底，2026-09-24） */

/* 点赞：默认跟左边的"使用人数"一个样子 —— 灰底灰字，安安静静的。
   只有"我自己点过"的时候才亮起来（蓝底白字），这样还能一眼看出自己的那一票。 */
.like-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-sub);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  transition: .18s;
}
.like-pill svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .75; }
.like-pill .thumb-path { fill: currentColor; }
.like-pill:hover { background: var(--blue-50); color: var(--blue-deep); border-color: var(--blue-100); }
.like-pill:hover svg { opacity: 1; }
.like-pill.is-on {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  border-color: transparent;
  color: #fff;
}
.like-pill.is-on svg { opacity: 1; animation: pop .4s var(--ease); }
@keyframes pop { 40% { transform: scale(1.32) rotate(-8deg); } }

/* 空状态 */
.empty { padding: 60px 20px 90px; text-align: center; }
.empty-art { margin-bottom: 10px; animation: floaty 3.4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-9px); } }
.empty-title { font-size: 17px; font-weight: 700; }
.empty-sub { color: var(--ink-sub); font-size: 13.5px; margin: 6px 0 20px; }

/* 搜了一个编号但列表是空的：多半是这个号作废了 —— 把去向写清楚，别让人干瞪眼 */
.code-notice {
  margin: 0 auto 18px;
  max-width: 460px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  text-align: left;
}
.code-notice b { display: block; font-size: 14px; margin-bottom: 5px; }
.code-notice p { font-size: 12.5px; line-height: 1.7; color: #b45309; margin: 0; }
.code-go {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}
.code-go:hover { background: var(--blue-deep); }

/* 详情页顶栏那一行里的编号 */
.c-code { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* ------------------------------ ⑤ 雪花模式 ------------------------------ */
/* position:relative 给抽屉定位（抽屉是 #view-snow 的子元素，不是画布的子元素）；
   overflow:hidden 把"停在屏幕外面的抽屉"裁掉，免得它撑出滚动条 */
#view-snow.is-on {
  min-height: 0;
  position: relative;
  overflow: hidden;
  height: calc(100vh - var(--top));
  height: calc(100dvh - var(--top));
}

.snow-tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 12;
}
.snow-spacer { flex: 1; }
.snow-hint { font-size: 12px; color: var(--ink-faint); }

.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crumb {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-sub);
  transition: .18s;
}
.crumb::before { content: "›"; margin-right: 8px; color: var(--ink-faint); font-weight: 700; }
.crumb:first-child::before { display: none; }
.crumb:hover { background: var(--blue-50); color: var(--blue); }
.crumb.is-on { background: var(--blue); color: #fff; }

.zoom-btns { display: flex; gap: 6px; }
.zoom-btns button {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .70);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  color: var(--ink-sub);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: .18s;
}
.zoom-btns button:hover { color: var(--blue); border-color: var(--blue-200); background: var(--blue-50); }

.snow-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(560px 460px at 50% 48%, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(700px 520px at 50% 50%, rgba(219, 234, 254, .75) 0%, rgba(219, 234, 254, 0) 70%);
  background-color: #f8fbff;
}
.snow-stage.grabbing { cursor: grabbing; }

/* 画布：坐标原点在画面中心，所有节点用绝对坐标摆放 */
.tree {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  transform-origin: 0 0;
  transition: transform .82s var(--ease);
  will-change: transform;
  --ns: 1;
}
.tree.dragging { transition: none; }
.tree.no-anim, .tree.no-anim .node { transition: none !important; }

.edges {
  position: absolute;
  left: -2000px; top: -2000px;
  width: 4000px; height: 4000px;
  overflow: visible;
  pointer-events: none;
}
/* 连线：一条连接 = 底下一宽一细两层。
   宽的浅色线是"冰体"，细的深色线是"棱"，合起来才有真雪花那种半透明实体感，
   单靠一根均匀细线会显得单薄。stroke 用 non-scaling-stroke，
   所以不管镜头怎么缩放，线在屏幕上都是这么粗。 */
.edge {
  fill: none;
  opacity: 0;
  transition: opacity .42s ease;
}
.edge line {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
/* 单线体系（2026-09-20 用户拍板：去掉外层宽的透明"冰体"层，那是拼接感的来源）。
   颜色全部统一浅蓝，层级关系改由粗细表达：主干最粗、学期枝次之、侧枝更细。
   .s = 流光线：平时隐形，点花心/年级时沿枝条从内往外闪过去 */
.edge[data-lv="trunk"] .c { stroke: #a6c4ec; stroke-width: 6.2; }
.edge[data-lv="sem"]  .c { stroke: #a6c4ec; stroke-width: 4.6; }
.edge[data-lv="cat"]  .c { stroke: #a6c4ec; stroke-width: 3.6; }
.edge[data-lv="game"] .c { stroke: #a6c4ec; stroke-width: 3.8; }
.edge[data-lv="spur"] .c { stroke: #a6c4ec; stroke-width: 3.2; }
.edge[data-lv="chip"] .c { stroke: #a6c4ec; stroke-width: 2.2; }
.edge.on { opacity: 1; }
/* 聚焦/高亮不再换色（用户要求统一色），靠加粗表达 */
.edge.is-focus .c { stroke: #a6c4ec; stroke-width: 5.4; }
/* 高亮不能用 url(#edgeHot) 渐变：主干是竖直线，包围盒宽度为 0，
   objectBoundingBox 渐变会直接渲染成空白——这是历史上
   「点进年级后主干不见了」的真正原因。高亮一律用实色。 */
.edge.hot .c { stroke: #a6c4ec; stroke-width: 7.2; }

/* --- 彗星流光（点任何节点触发，2026-09-24 用户定稿）---
   用户要求：不要"一条线"的感觉，要有真正的拖尾。
   光是一个小"彗星"贴着枝条跑：头部一团白光最亮，
   往后沿运动方向亮度一路渐隐到透明（bmW/bmB 线性渐变，无任何硬边）；
   横截面再叠 5 层由窄到宽、由浓到淡的半透明光，把四周也化开。
   .beam 定位在线起点并旋到线方向；播放时 .beam-run 从 0 平移到 --len
   （沿局部 x 轴 = 沿线方向），播完自动摘 .wave。
   渐变全部画在有面积的矩形/圆上，不碰垂直线的包围盒
   （历史上 objectBoundingBox 渐变/滤镜在垂直线上会渲染成空白）。 */
.edge .beam { pointer-events: none; }
.edge .beam .bl { fill: url(#bmB); }
.edge .beam .bl0 { fill: url(#bmW); }
.edge .beam .bl1 { fill-opacity: .5; }
.edge .beam .bl2 { fill-opacity: .28; }
.edge .beam .bl3 { fill-opacity: .15; }
.edge .beam .bl4 { fill-opacity: .07; }
.edge .beam .bh { fill: url(#bmH); }
.edge .beam-run { opacity: 0; will-change: transform, opacity; }
.edge.wave .beam-run {
  animation: beamRun .6s cubic-bezier(.3, .5, .4, 1) both;
  animation-delay: var(--d, 0ms);
}
@keyframes beamRun {
  0%   { transform: translateX(0); opacity: 0; }
  12%  { opacity: 1; }
  70%  { opacity: .9; }
  100% { transform: translateX(var(--len, 60px)); opacity: 0; }
}

/* 节点
   位置由 JS 写成：translate(x,y) scale(反缩放) translate(-50%,-50%)
   反缩放让节点的视觉大小不随镜头缩放变化（像地图上的标记），文字始终清晰 */
.nodes { position: absolute; left: 0; top: 0; }
.node {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  transition: opacity .4s ease, transform .55s var(--ease);
  will-change: transform, opacity;
}
.node.off { opacity: 0; pointer-events: none; }
.node.behind { opacity: 0; pointer-events: none; }

.nbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid var(--blue-200);
  border-radius: 50%;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .13), 0 2px 6px rgba(23, 43, 84, .05);
  cursor: pointer;
  transition: transform .26s var(--ease), box-shadow .26s, border-color .26s, background .26s, color .26s;
  user-select: none;
}
/* 到站点亮（2026-09-24）：光束流到某个节点时 JS 加 .arrive，荡开一圈光晕。
   2026-09-24 二次调整（用户反馈"最外圈边框太明显"）：
   原来是一圈实心扩散环（0 0 0 12px，无模糊），外缘是一条清晰硬边；
   改成三层带模糊的光晕由浓到淡叠出去，最外圈直接化进背景，没有可见边界。 */
.node.arrive .nbox {
  animation: nodeArrive .7s ease-out both;
}
@keyframes nodeArrive {
  0% {
    box-shadow: 0 10px 26px rgba(37,99,235,.13), 0 2px 6px rgba(23,43,84,.05),
      0 0 0 0 rgba(166,196,236,0), 0 0 0 0 rgba(166,196,236,0), 0 0 0 0 rgba(166,196,236,0);
  }
  35% {
    box-shadow: 0 10px 26px rgba(37,99,235,.13), 0 2px 6px rgba(23,43,84,.05),
      0 0 12px 2px rgba(166,196,236,.42),
      0 0 26px 8px rgba(166,196,236,.22),
      0 0 44px 18px rgba(166,196,236,.10);
  }
  100% {
    box-shadow: 0 10px 26px rgba(37,99,235,.13), 0 2px 6px rgba(23,43,84,.05),
      0 0 20px 6px rgba(166,196,236,0),
      0 0 40px 14px rgba(166,196,236,0),
      0 0 64px 26px rgba(166,196,236,0);
  }
}
.nbox:hover {
  transform: translateY(-4px);
  border-color: var(--blue);
  box-shadow: 0 16px 34px rgba(37, 99, 235, .22);
}
.nbox b { font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.nbox small { font-size: 10.5px; color: var(--ink-faint); font-weight: 600; white-space: nowrap; }

/* 雪花正中间：跟左上角 logo 一模一样的那朵雪花（蓝底白花），
   相当于把 logo 裁一个圆放到花的中心 */
.lv-root .nbox {
  width: 94px; height: 94px;
  border: 0;
  background: linear-gradient(145deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  box-shadow: 0 16px 38px rgba(37, 99, 235, .34), 0 0 16px 7px rgba(37, 99, 235, .07);
  cursor: default;
}
.lv-root .nbox:hover { transform: none; border: 0; box-shadow: 0 16px 38px rgba(37, 99, 235, .34), 0 0 16px 7px rgba(37, 99, 235, .07); }
.root-mark { width: 60%; height: 60%; display: block; }

.lv-grade .nbox { width: 116px; height: 116px; }
.lv-grade .nbox b { font-size: 21px; color: var(--blue-deep); }
.lv-grade .nbox small { margin-top: -1px; }
.lv-grade .nbox:hover b { color: var(--blue); }

.lv-sem .nbox { width: 92px; height: 92px; }
.lv-sem .nbox b { font-size: 16px; color: var(--ink); }
.lv-sem .nbox small { margin-top: 1px; }

.lv-cat .nbox { width: 88px; height: 88px; border-width: 2px; }
.lv-cat .nbox b { font-size: 12.5px; line-height: 1.25; text-align: center; white-space: normal; padding: 0 4px; }
.lv-cat .nbox small { margin-top: 2px; }

/* 「游戏化」和板块一样大，只是它挂在臂尖末端、不分子册 */
.lv-game .nbox { width: 88px; height: 88px; border-width: 2px; }
.lv-game .nbox b { font-size: 12.5px; letter-spacing: 0; }
.lv-game .nbox small { margin-top: 2px; }

/* 缩得很小的时候（全览那一圈、窄屏上的"上册/下册"），
   字已经看不清了，就只留一个彩色的小圆点，免得糊成一团 */
.node.tiny .nbox { border-width: 3.4px; box-shadow: 0 4px 12px rgba(37, 99, 235, .12); }
.node.tiny .nbox b,
.node.tiny .nbox small { opacity: 0; }
.nbox b, .nbox small { transition: opacity .3s ease; }
/* 小圆点按板块上色，一眼能看出这一枝是哪一类 */
.node.tiny.cat-algebra .nbox { background: #e6eeff; }
.node.tiny.cat-geometry .nbox { background: #dff5f2; }
.node.tiny.cat-stat .nbox { background: #efe7fe; }
.node.tiny.cat-practice .nbox { background: #fdf0dd; }
.node.tiny.cat-game .nbox { background: #fdeaf2; }
.node.tiny.lv-sem .nbox { background: #eef4ff; border-color: var(--blue-200); }
/* 次级说明（"3 个课件"）在小尺寸下也先收掉，只留主标题 */
.node.sub-off .nbox small { opacity: 0; }

/* 缩写档（窄屏专用）：字放不下但不至于变圆点的时候——
   年级只剩「一」，上下册只剩「上/下」，板块只剩标志图形。
   .txt（完整字）与 .abbr（替身）二选一显示，由 JS 按屏幕实际尺寸切换 */
.node .abbr { display: none; }
.node.abbr .txt { display: none; }
/* 替身本身用 flex 居中：图标 svg 是行内元素，直接放在普通块里
   会贴基线偏下、又因 small 占位被顶得偏上——两边都不正 */
.node.abbr .abbr {
  display: flex;
  align-items: center;
  justify-content: center;
}
.node.abbr .nbox small { display: none; }
.lv-grade.abbr .nbox .abbr { font-size: 34px; }
.lv-sem.abbr .nbox .abbr { font-size: 26px; }
.lv-cat.abbr .nbox .ico,
.lv-game.abbr .nbox .ico { display: block; width: 46px; height: 46px; }

/* 课件卡片缩到很小（全览/年级视图）时收成一颗彩色圆点，
   点进板块镜头拉近后才展开成卡片。圆点颜色跟板块走。 */
.node.tiny .chip {
  width: 20px; height: 20px; min-width: 20px;
  padding: 0; gap: 0;
  border-radius: 50%;
  border: 2.5px solid #fff;
  border-left-width: 2.5px;
  background: #c7d9f5;
  box-shadow: 0 2px 8px rgba(23, 43, 84, .18);
  align-items: center; justify-content: center;
}
.node.tiny .chip b,
.node.tiny .chip .chip-meta { display: none; }
.node.tiny .chip[data-cat="数与代数"]   { background: var(--c-algebra); }
.node.tiny .chip[data-cat="图形与几何"] { background: var(--c-geometry); }
.node.tiny .chip[data-cat="统计与概率"] { background: var(--c-stat); }
.node.tiny .chip[data-cat="综合与实践"] { background: var(--c-practice); }
.node.tiny .chip[data-cat="游戏化"]     { background: var(--c-game); }

/* 类别色 */
.cat-algebra .nbox { border-color: #a9c6ff; }
.cat-algebra .nbox b { color: var(--c-algebra); }
.cat-geometry .nbox { border-color: #8fd9d0; }
.cat-geometry .nbox b { color: var(--c-geometry); }
.cat-stat .nbox { border-color: #c4b0f5; }
.cat-stat .nbox b { color: var(--c-stat); }
.cat-practice .nbox { border-color: #f3cd9a; }
.cat-practice .nbox b { color: var(--c-practice); }
.cat-game .nbox { border-color: #f0aec8; }
.cat-game .nbox b { color: var(--c-game); }

/* 选中态 */
.node.is-focus > .nbox,
.node.is-focus .nbox {
  background: linear-gradient(140deg, var(--blue) 0%, var(--blue-deep) 100%);
  border-color: var(--blue-dark);
  color: #fff;
  box-shadow: 0 18px 40px rgba(37, 99, 235, .34);
}
.node.is-focus .nbox b,
.node.is-focus .nbox small { color: #fff; }
.node.is-focus .nbox small { opacity: .82; }

/* 课件叶子 */
.chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 196px;
  padding: 11px 14px 11px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(23, 43, 84, .1);
  cursor: pointer;
  text-align: left;
  transition: transform .24s var(--ease), box-shadow .24s, border-color .24s;
}
.chip:hover { transform: translateY(-3px) scale(1.015); box-shadow: 0 16px 32px rgba(37, 99, 235, .2); }
.chip[data-cat="图形与几何"] { border-left-color: var(--c-geometry); }
.chip[data-cat="统计与概率"] { border-left-color: var(--c-stat); }
.chip[data-cat="综合与实践"] { border-left-color: var(--c-practice); }
.chip[data-cat="游戏化"] { border-left-color: var(--c-game); }
.chip b {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chip .chip-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-faint); }
.chip .chip-meta em { font-style: normal; color: var(--blue-deep); font-weight: 700; }
.chip.empty-chip { border-left-color: var(--ink-faint); cursor: default; opacity: .8; }
.chip.empty-chip:hover { transform: none; box-shadow: 0 8px 22px rgba(23, 43, 84, .1); }

.node.is-new .nbox,
.node.is-new .chip { animation: nodeIn .5s var(--ease) backwards; }
@keyframes nodeIn { from { opacity: 0; transform: translateY(10px) scale(.9); } }

.snow-tip {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  color: var(--ink-sub);
  font-size: 12.5px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .5s;
  pointer-events: none;
  white-space: nowrap;
}
.snow-tip.on { opacity: 1; }

/* ---------------------- ⑤-2 板块抽屉（点板块滑出课件清单） ----------------------
   2026-09-23：课件不再挂在雪花上，改成从这里看。
   电脑上从右侧滑出（画布右侧留一条半透明遮罩，提示"点外面也能关"），
   手机上从底部顶上来，占大半个屏幕，手指够得着。 */
.drawer-mask {
  position: absolute;
  inset: 0;
  z-index: 18;
  background: rgba(18, 32, 61, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.drawer-mask.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 19;
  width: min(392px, 90%);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .80);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-left: 1px solid var(--line);
  box-shadow: -22px 0 56px rgba(23, 43, 84, .16);
  transform: translateX(103%);
  transition: transform .38s var(--ease);
  will-change: transform;
}
.drawer.is-open { transform: none; }

.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 15px 14px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #ffffff 100%);
}
.drawer-ico {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--blue-50);
  color: var(--blue);
}
.drawer-ico .ico { display: block; width: 22px; height: 22px; }
/* 抽屉头部的图标底色跟着板块走，跟在雪花上点的那颗圆是同一色系，
   一眼能确认"我点开的正是这个板块" */
.drawer-ico[data-cat="数与代数"]   { background: #e8f0ff; color: var(--c-algebra); }
.drawer-ico[data-cat="图形与几何"] { background: #e2f5f2; color: var(--c-geometry); }
.drawer-ico[data-cat="统计与概率"] { background: #f2ebff; color: var(--c-stat); }
.drawer-ico[data-cat="综合与实践"] { background: #fdf0dd; color: var(--c-practice); }
.drawer-ico[data-cat="游戏化"]     { background: #fdeaf2; color: var(--c-game); }

.drawer-tt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drawer-tt b { font-size: 16px; font-weight: 800; color: var(--ink); }
.drawer-tt small { font-size: 12px; color: var(--ink-sub); }

.drawer-close {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--ink-sub);
  transition: .18s;
}
.drawer-close:hover { background: var(--blue-50); color: var(--blue); }

.drawer-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* 一行一个的课件小卡：抽屉窄，横排才装得下、翻得快 */
.drow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px 9px 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.drow:hover { transform: translateY(-2px); border-color: var(--blue-200); box-shadow: 0 12px 26px rgba(37, 99, 235, .15); }
.drow:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.drow-cover {
  flex: 0 0 auto;
  width: 80px; height: 58px;
  border-radius: 9px;
  overflow: hidden;
  background: linear-gradient(140deg, #eef4ff, #e2ebfb);
  border: 1px solid var(--line);
}
.drow-cover img, .drow-cover svg { width: 100%; height: 100%; display: block; object-fit: cover; }

.drow-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.drow-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.drow-sub { font-size: 11px; color: var(--ink-faint); }
.drow-foot { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-faint); }
.drow-author { flex: 1 1 auto; min-width: 0; color: var(--ink-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drawer-empty {
  padding: 46px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: center;
}
.drawer-empty b { font-size: 15px; color: var(--ink); }
.drawer-empty small { font-size: 12.5px; color: var(--ink-faint); }

/* 手机上改成"底部抽屉"：从下往上顶出大半个屏幕。
   竖屏拿在手里时，底部滑出比侧边滑出好按得多，也看得下更多条 */
@media (max-width: 700px) {
  .drawer {
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto;
    height: 72%;
    max-height: 620px;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 48px rgba(23, 43, 84, .18);
    transform: translateY(101%);
  }
  .drawer-head { padding: 12px 12px 12px 15px; border-radius: 20px 20px 0 0; }
  /* 顶部来个"抓手"横条，明确这是可以拉/关的抽屉 */
  .drawer-head::before {
    content: "";
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    width: 38px; height: 4px;
    border-radius: 999px;
    background: var(--line);
  }
  .drawer-head { position: relative; padding-top: 16px; }
  .drow-cover { width: 72px; height: 52px; }
}

/* ------------------------------ ⑥ 课件详情 ------------------------------ */
#view-course.is-on { min-height: 0; height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); }

.course-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .8);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 12;
}
.course-bar h1 {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-acts { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--blue-deep);
  font-weight: 700;
  font-size: 13.5px;
  transition: .2s;
}
.like-btn svg { transition: transform .24s var(--ease); }
.like-btn .thumb-path { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.like-btn:hover { background: var(--blue-100); border-color: var(--blue-200); }
.like-btn.is-on {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  border-color: var(--blue-dark);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .3);
}
.like-btn.is-on .thumb-path { fill: currentColor; stroke: none; }
.like-btn.is-on svg { animation: pop .45s var(--ease); }
.like-btn b { font-size: 15px; }
.like-txt { font-weight: 600; }

.frame-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 14px 18px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.frame-wrap iframe { display: block; width: 100%; height: 100%; border: 0; }
.frame-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: var(--ink-sub);
  font-size: 13.5px;
  z-index: 2;
  transition: opacity .3s;
}
.frame-loading.off { opacity: 0; pointer-events: none; }
.spin {
  width: 16px; height: 16px;
  border: 2px solid var(--blue-100);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.course-meta {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 4px 24px 18px;
  color: var(--ink-sub);
  font-size: 13px;
}
.course-meta .mi { display: inline-flex; align-items: center; gap: 6px; }
.course-meta .mi b { color: var(--ink); font-weight: 700; }
.course-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-300); }

/* ------------------------------ ⑦ 弹窗与提示 ------------------------------ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(18, 32, 61, .45); backdrop-filter: blur(3px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  margin: auto;                   /* flex 容器内：空间够时居中，超高时上下都能滚动到 */
  overflow-y: auto;
  /* 2026-09-24 全站玻璃化：弹窗统一近透明底 + 背景模糊 */
  background: rgba(255, 255, 255, .64);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--r-lg);
  padding: 26px 24px 22px;
  box-shadow: 0 30px 70px rgba(18, 32, 61, .24);
  text-align: center;
  animation: modalIn .32s var(--ease);
}
.modal-card.wide { max-width: 560px; text-align: left; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-faint);
  transition: .18s;
}
.modal-close:hover { background: var(--blue-50); color: var(--blue); }
.modal-card h3 { font-size: 18px; }
.share-sub { color: var(--ink-sub); font-size: 13px; margin-top: 6px; }
.qr-box {
  margin: 20px auto 10px;
  width: 226px; height: 226px;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.qr-box canvas { display: block; border-radius: 8px; }
.qr-tip { font-size: 12.5px; color: var(--ink-faint); }
.link-row { display: flex; gap: 8px; margin: 18px 0 12px; }
.link-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--blue-50);
  font-size: 12.5px;
  color: var(--ink-sub);
  outline: none;
}
.link-row input:focus { border-color: var(--blue-200); background: #fff; }
.link-row .primary-btn { padding: 10px 18px; font-size: 13.5px; flex: 0 0 auto; }
.share-foot { font-size: 12px; color: var(--ink-faint); }

.steps { margin: 18px 0 0; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; padding: 0 0 16px 42px; }
.steps li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: 0; top: 1px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.steps li b { display: block; font-size: 14.5px; }
.steps li span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-sub); line-height: 1.65; }
.help-note { margin-top: 6px; padding: 15px 17px; border-radius: var(--r); background: var(--blue-50); border: 1px solid var(--blue-100); }
.help-note b { font-size: 13.5px; color: var(--blue-deep); }
.help-note p { margin-top: 7px; font-size: 12.5px; color: var(--ink-sub); line-height: 1.7; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(20, 33, 61, .92);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(18, 32, 61, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s, transform .28s var(--ease);
  z-index: 200;
  max-width: 80vw;
  text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ ⑧ 响应式 ------------------------------ */
/* 顶栏的规矩：**永远一行**，靠"逐级缩小"来腾地方，而不是换行。
   ① >1320px：三个筛选都带"年级 / 板块 / 排序"小标题，搜索框宽 262px；
   ② ≤1320px：先把小标题收掉，搜索框缩到 206px；
   ③ ≤1040px：搜索框改成弹性（自己伸缩），"共 N 个课件"让位 —— 平板也是一行；
   ④ ≤860px：三个筛选缩成圆圈图标，"重置筛选"也缩成一个圆圈箭头；
   ⑤ ≤700px：连搜索框也收成圆圈（点开才展开成输入框），副标题收掉但保留 SimMath 字样；
   ⑥ ≤560px：连"SimMath"字样也收掉，只留 logo；
   ⑦ ≤420px：小屏手机实在挤不下，才退回两行，第二行仍是四个圆圈。
   滑块式设计的好处：宽度变化时是"平滑变窄"，不会在某个宽度突然多出一行。 */
@media (max-width: 1320px) {
  .cs-lab { display: none; }
  .brand-text small { display: none; }
  .search { width: 184px; }
  .search:focus-within { width: 232px; }
}

/* 四个筛选（年级 / 学期 / 板块 / 排序）在这一档就收成圆圈图标。
   原来只有三个筛选，一路到 860px 才收；加了一个之后，按老断点会在
   1100 出头就把搜索框挤出屏幕（实测溢出 13px），所以圆圈化提前到这里。 */
@media (max-width: 1220px) {
  .cs-btn { width: var(--ctl); padding: 0; justify-content: center; gap: 0; }
  .cs-val, .cs-caret { display: none; }
  .cs-ico { display: grid; }
}

@media (max-width: 1040px) {
  :root { --pad: 16px; }
  /* 平板也走一行：小标题已经收掉，搜索框让出弹性空间自己缩，绝不换行 */
  .topbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 16px;
    min-height: 0;
  }
  .brand { flex: 0 0 auto; }
  .brand-text b { font-size: 17px; }
  .top-right { display: flex; flex: 1 1 auto; min-width: 0; gap: 8px; align-items: center; justify-content: flex-end; }
  .filters { flex: 0 1 auto; min-width: 0; gap: 6px; }
  .result-count { display: none; }   /* 一行优先，课件总数让位 */
  .search { flex: 1 1 150px; width: auto; min-width: 84px; }
  .search:focus-within { flex: 1 1 220px; width: auto; }
  .seg { flex: 0 0 auto; }
  .auth-wrap { flex: 0 0 auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 16px var(--pad) 40px; }
  .snow-tools { padding: 9px 14px; gap: 8px; }
  .snow-hint { display: none; }
  .crumb { font-size: 12px; padding: 4px 9px; }
  .course-bar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .course-bar h1 { order: 3; flex: 1 0 100%; font-size: 16px; white-space: normal; }
  .like-txt { display: none; }
  .frame-wrap { margin: 10px; border-radius: var(--r); }
  .course-meta { padding: 0 16px 14px; gap: 8px 16px; font-size: 12.5px; }
  .lv-root .nbox { width: 92px; height: 92px; }
  .lv-grade .nbox { width: 92px; height: 92px; }
  .lv-grade .nbox b { font-size: 19px; }
  .lv-sem .nbox { width: 80px; height: 80px; }
  .lv-cat .nbox { width: 76px; height: 76px; }
  .lv-game .nbox { width: 76px; height: 76px; }
  .chip { width: 168px; padding: 9px 11px 9px 13px; }
}

/* 平板偏窄 / 大屏手机（≤860px）：三个筛选也缩成圆圈图标（只留图标），
   腾出的空间全给搜索框 —— 还是**一行**。
   筛选缩成圆圈后，"共 N 个课件"和"重置筛选"都改成不占地方的样子。 */
@media (max-width: 860px) {
  .cs-btn { width: var(--ctl); padding: 0; justify-content: center; gap: 0; }
  .cs-val, .cs-caret { display: none; }
  .cs-ico { display: grid; }
  .seg-btn { width: 40px; }
  /* 重置筛选缩成一个圆圈，里面一个回退箭头，不再占用一条文字 */
  #resetFilter {
    width: var(--ctl); height: var(--ctl);
    padding: 0; border-radius: 50%;
    font-size: 0;
    display: grid; place-items: center;
  }
  #resetFilter::before { content: '\21BA'; font-size: 16px; line-height: 1; }
}

/* 窄屏（≤700px）：连搜索框也收成圆形 —— 这时所有控件都成了一圈图标，
   顶栏就是**一行**：[logo] [年级] [板块] [排序] [搜索] [网格雪花] [账号]。
   点搜索那个圆圈，它就地展开成输入框（同行的其它控件让位），右侧「收起」返回。 */
@media (max-width: 700px) {
  :root { --ctl: 38px; }
  .topbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    min-height: 0;
  }
  .brand { flex: 0 0 auto; }
  .brand-text small { display: none; }      /* 副标题收掉；"SimMath"这几个字保留，放得下 */
  .top-right { display: flex; flex: 1 1 auto; min-width: 0; gap: 6px; align-items: center; justify-content: flex-end; }
  .filters { flex: 0 1 auto; min-width: 0; gap: 6px; }
  .seg { flex: 0 0 auto; padding: 3px; }
  .seg-btn { width: 34px; }

  /* 搜索：平时就是跟筛选一样的圆形按钮。
     放大镜靠左放（跟展开成输入框时的位置一致），不要居中。 */
  .search { flex: 0 0 auto; width: var(--ctl); padding: 0 0 0 6px; justify-content: flex-start; gap: 0; cursor: pointer; }
  .search input { display: none; }
  .q-clear { display: none; }
  .search.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
  .search.is-on:not(.is-open):hover { background: var(--blue-deep); }

  /* 点开之后：占满整行，其它控件让位 */
  .topbar.is-searching .brand,
  .topbar.is-searching .filters,
  .topbar.is-searching .seg,
  .topbar.is-searching .auth-wrap { display: none; }
  .search.is-open {
    flex: 1 1 auto;
    width: auto;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 7px 0 12px;
    cursor: text;
    background: #fff;
    color: var(--ink-sub);              /* 盖掉 .is-on 的白字，展开时要能看清输入 */
    border-color: var(--blue-300);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
  }
  .search.is-open input { display: block; flex: 1 1 auto; min-width: 0; }
  .search.is-open .q-close { display: grid; }
  /* 展开时把「清空」还给用户（[hidden] 带 !important，没字时它自己还是藏着） */
  .search.is-open .q-clear { display: grid; }
  .q-close {
    flex: 0 0 auto;
    height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .08);
    color: var(--blue-deep);
    font-size: 12px;
    font-weight: 700;
    place-items: center;
  }
  .q-close:hover { background: var(--blue-100); }
}

@media (max-width: 560px) {
  :root { --ctl: 36px; }
  .topbar { padding: 8px 12px; gap: 7px 8px; }
  .brand-text { display: none; }
  .auth-name { display: none; }
  .search { padding: 0 0 0 5px; }
  .search.is-open { padding: 0 7px 0 11px; }
  .seg { padding: 3px; }
  .seg-btn { width: 34px; }
  .grid { grid-template-columns: 1fr; }
  .zoom-btns { display: none; }
}

/* 真的挤不进一行了（小屏手机 ≤420px）：退回两行 ——
   第一行「logo + 网格雪花 + 账号」，第二行「三个筛选圆圈 …… 搜索圆圈」。
   展开搜索时它自己占满第二行。 */
@media (max-width: 420px) {
  .topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "brand seg auth"
      "filters filters search";
    align-items: center;
    gap: 7px 8px;
    padding: 8px 10px;
  }
  .topbar.is-searching .brand,
  .topbar.is-searching .seg,
  .topbar.is-searching .auth-wrap { display: flex; }
  .topbar.is-searching .filters { display: none; }
  .top-right { display: contents; }
  .brand { grid-area: brand; }
  .filters { grid-area: filters; justify-self: start; }
  .search { grid-area: search; justify-self: end; }
  .search.is-open { grid-column: 1 / -1; justify-self: stretch; }
  .seg { grid-area: seg; justify-self: end; }
  .auth-wrap { grid-area: auth; justify-self: end; }
}

/* ------------------------------ ⑨ 课件后台 ------------------------------ */

/* 顶栏的账号按钮：跟搜索框、网格/雪花按钮同一种半透明质感（不要白底） */
.top-admin {
  background: rgba(37, 99, 235, .055);
  border-color: rgba(37, 99, 235, .14);
  color: var(--blue-deep);
  box-shadow: none;
  flex: 0 0 auto;
}
.top-admin:hover { background: rgba(37, 99, 235, .11); color: var(--blue); border-color: rgba(37, 99, 235, .22); }
.top-admin.is-in { color: var(--ink); }
.top-admin.is-in:hover { color: var(--blue-deep); }

.modal-card.admin {
  max-width: 800px;
  text-align: left;
  padding: 22px 24px 20px;
  /* 管理面板文字密集，玻璃留一档较实的，保证可读 */
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
}
/* 头部右侧留出 42px，给右上角那个关闭「×」让位 ——
   不然它会和「添加课件 / 批量登记 / 管理课件」这几个标签压在一起。 */
.ad-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding-right: 42px;
}
.ad-head h3 { font-size: 19px; }
.ad-title-row { display: flex; align-items: center; gap: 8px; }
.ad-help {
  width: 21px; height: 21px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  line-height: 1;
  color: var(--blue-deep);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  transition: .18s;
}
.ad-help:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.ad-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }

.ad-tabs { display: flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--blue-50); border: 1px solid var(--blue-100); }
.ad-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-sub);
  transition: .18s;
}
.ad-tab:hover { color: var(--blue); }
.ad-tab.is-on { background: #fff; color: var(--blue-deep); box-shadow: var(--shadow-sm); }
.ad-tab b { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px; border-radius: 999px; background: var(--blue-100); color: var(--blue-deep); font-size: 11.5px; }

/* 写入通道状态条 */
.ad-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 13px;
  padding: 10px 15px;
  border-radius: var(--r);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
}
.ad-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 4px rgba(203, 213, 225, .3); }
.ad-dot.on { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .2); }
.ad-ch-text { flex: 1; min-width: 0; }
.ad-ch-text b { display: block; font-size: 13.5px; }
.ad-ch-text small { display: block; font-size: 12px; color: var(--ink-sub); line-height: 1.5; }
.ad-channel .primary-btn { padding: 8px 15px; font-size: 12.5px; flex: 0 0 auto; }

/* 拖入区 */
.ad-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 18px;
  border: 2px dashed var(--blue-200);
  border-radius: var(--r);
  background: linear-gradient(180deg, #fbfdff, var(--blue-50));
  color: var(--blue);
  cursor: pointer;
  text-align: center;
  transition: .2s;
}
.ad-drop:hover, .ad-drop.is-over { border-color: var(--blue); background: var(--blue-50); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(37, 99, 235, .12); }
.ad-drop b { font-size: 14.5px; color: var(--ink); }
.ad-drop span { font-size: 12.5px; color: var(--ink-sub); }

/* 队列 */
.ad-queue { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.ad-qitem {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 8px 7px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  cursor: pointer;
  transition: .18s;
}
.ad-qitem:hover { border-color: var(--blue-200); }
.ad-qitem.is-on { border-color: var(--blue); background: var(--blue-50); box-shadow: 0 4px 14px rgba(37, 99, 235, .16); }
.ad-qname { font-weight: 600; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-qsize { color: var(--ink-faint); font-size: 11.5px; }
.ad-qx { width: 20px; height: 20px; border-radius: 50%; color: var(--ink-faint); font-size: 15px; line-height: 1; display: grid; place-items: center; }
.ad-qx:hover { background: #fee2e2; color: #dc2626; }
.ad-qtip { flex: 1 0 100%; font-size: 12px; color: var(--ink-faint); }

/* 未登记 */
.ad-pending { margin-top: 11px; padding: 11px 14px; border-radius: var(--r); background: #fffbeb; border: 1px solid #fde68a; }
.ad-pend-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-pend-row b { font-size: 12.5px; color: #b45309; }
.ad-pend-tip { margin-top: 5px; font-size: 11.5px; color: #a16207; }
.ad-pend-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ad-pend {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 12.5px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: .18s;
}
.ad-pend:hover { background: #fef3c7; }

/* 表单 */
.ad-form { margin-top: 16px; }
.ad-editbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 15px;
  border-radius: var(--r);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  font-size: 13px;
  color: var(--blue-deep);
}
.ad-cols { display: grid; grid-template-columns: 1fr 210px; gap: 16px; align-items: start; }
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 12px; }
.ad-fld { display: flex; flex-direction: column; gap: 5px; }
.ad-fld.wide { grid-column: 1 / -1; }
.ad-fld > span { font-size: 12px; font-weight: 700; color: var(--ink-sub); }
.ad-fld input, .ad-fld select {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  outline: none;
  transition: .18s;
}
.ad-fld select { cursor: pointer; padding-right: 6px; }
.ad-fld input:focus, .ad-fld select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.ad-fld input:disabled { background: var(--blue-50); color: var(--ink-sub); cursor: not-allowed; }

.ad-cover { display: flex; flex-direction: column; gap: 7px; }
.ad-cover-box {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  background: linear-gradient(150deg, #fbfdff, #eef4ff);
  color: var(--ink-faint);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  transition: .2s;
}
.ad-cover-box:hover { border-color: var(--blue-200); color: var(--blue); }
.ad-cover-box.has { border-style: solid; border-color: var(--line); background: #fff; }
.ad-cover-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-cover-ph { font-size: 19px; font-weight: 700; line-height: 1.35; }
.ad-cover-ph small { font-size: 11.5px; font-weight: 600; }
.ad-cover-x {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #dc2626;
  font-size: 16px;
  line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(20, 33, 61, .16);
}
.ad-cover-tip { position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px; background: rgba(20, 33, 61, .62); color: #fff; font-size: 11.5px; }
.ad-cover-hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }

.ad-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.ad-actions .primary-btn { padding: 11px 26px; }
.ad-actions .primary-btn:disabled { filter: grayscale(.4); opacity: .75; cursor: progress; }
.ad-save-tip { font-size: 12px; color: var(--ink-faint); }

.ad-msg { margin-top: 14px; font-size: 12.5px; line-height: 1.6; border-radius: var(--r-sm); display: none; }
.ad-msg.on { display: block; padding: 10px 14px; background: var(--blue-50); border: 1px solid var(--blue-100); color: var(--blue-deep); }
.ad-msg.warn.on { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.ad-msg.err.on { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* 管理列表 */
.ad-mtools { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.ad-search { display: flex; align-items: center; gap: 8px; flex: 1; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-faint); }
.ad-search:focus-within { border-color: var(--blue-200); color: var(--blue); }
.ad-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 13.5px; color: var(--ink); }
.ad-search input::-webkit-search-cancel-button { display: none; }
.ad-mcount { font-size: 12.5px; color: var(--ink-sub); flex: 0 0 auto; }

.ad-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.ad-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: #fff;
  transition: .18s;
}
.ad-row:hover { border-color: var(--blue-200); box-shadow: var(--shadow-sm); }
.ad-row-main { flex: 1; min-width: 0; }
.ad-row-main b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-row-main span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-faint); }
.ad-row-main code { background: #f1f5fd; color: var(--ink-sub); font-size: 11px; padding: 1px 5px; }
/* 一行里要同时看清「编号」和「文件名」，两样最容易看混，所以分开摆：
   编号做成小印章（是学生老师搜的那个 6 位号），文件名是灰底等宽的 courses 文件名 */
.ad-row-files { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-row-code {
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--blue-deep);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 5px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.ad-row-code.none { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.ad-row-acts { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }

/* 历史存档面板：点某行的「历史」就在那一行下面撑开，不另开弹窗 */
.ad-hist {
  width: 100%;
  margin: 10px 0 2px;
  padding: 10px 12px 8px;
  border: 1px solid var(--blue-100);
  border-radius: 10px;
  background: #fbfdff;
}
.ad-hist-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 8px; margin-bottom: 6px;
  border-bottom: 1px dashed var(--blue-100);
}
.ad-hist-head b { font-size: 12.5px; color: var(--blue-deep); }
.ad-hist-head span { flex: 1; font-size: 11.5px; color: var(--ink-faint); }
.ad-hist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0;
}
.ad-hist-row span { font-size: 12px; color: var(--ink-sub); font-variant-numeric: tabular-nums; }
.ad-hist-row.is-now span { color: var(--blue-deep); font-weight: 600; }
.ad-hist-now {
  font-size: 11.5px;
  color: var(--blue-deep);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 5px;
  padding: 2px 8px;
}
.ad-hist-empty, .ad-hist-tip {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}
.ad-hist-tip { padding-top: 6px; border-top: 1px dashed var(--blue-100); }
.ghost-btn.on { color: var(--blue-deep); border-color: var(--blue-300); background: var(--blue-50); }

/* 编号工具条（补编号 / 清零） */
.ad-codetools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.ad-ct-info { font-size: 12.5px; color: var(--ink-sub); font-weight: 600; }
.ad-ct-tip { font-size: 11.5px; color: var(--ink-faint); }
.ghost-btn.sm.danger { padding: 5px 10px; }

/* 改课件时动了年级/册/板块：编号前三位会变，得说清走「迁移」 */
.ad-code-tip {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.65;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}
.ad-code-tip b { color: #92400e; }
.ghost-btn.danger { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.ghost-btn.danger:hover { color: #b91c1c; border-color: #fca5a5; background: #fee2e2; }
.ad-empty { padding: 26px 0; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* 整页拖拽提示 */
body.dragging-file::after {
  content: "松手就添加课件";
  position: fixed;
  inset: 14px;
  z-index: 300;
  display: grid;
  place-items: center;
  border: 3px dashed var(--blue);
  border-radius: var(--r-lg);
  background: rgba(239, 246, 255, .82);
  color: var(--blue-deep);
  font-size: 20px;
  font-weight: 700;
  pointer-events: none;
}

@media (max-width: 860px) {
  .modal-card.admin { padding: 18px 15px 16px; max-height: 92vh; }
  .ad-cols { grid-template-columns: 1fr; }
  .ad-cover { max-width: 260px; }
  .ad-head { gap: 10px; }
  .ad-tabs { width: 100%; }
  .ad-tab { flex: 1; }
  /* 顶栏账号按钮：窄屏现在是两行布局、位置够，不用再把图标藏起来 */
  .top-admin { font-size: 12.5px; }
}
@media (max-width: 560px) {
  .ad-grid { grid-template-columns: 1fr; }
  .ad-row { flex-wrap: wrap; }
  .ad-row-acts { width: 100%; justify-content: flex-end; }
}

/* 使用数据条（管理课件页顶部，只有超管看得见） */
.ad-stats {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 12px;
  border: 1px solid var(--blue-100); border-radius: var(--r);
  background: linear-gradient(180deg, #fbfdff, var(--blue-50));
}
.ad-stat { display: flex; flex-direction: column; line-height: 1.15; }
.ad-stat b { font-size: 21px; font-weight: 700; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.ad-stat span { font-size: 11.5px; color: var(--ink-sub); margin-top: 2px; }
.ad-stat-btns { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-sort {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 12.5px; color: var(--ink-sub); cursor: pointer;
}
.ad-sort:focus { outline: none; border-color: var(--blue-300); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.ad-stats-tip { font-size: 12px; color: var(--ink-faint); margin: -4px 0 10px 2px; }

/* 每行右边的用量小字 */
.ad-row-use { font-size: 12px; color: var(--ink-sub); white-space: nowrap; }

@media (max-width: 860px) {
  .ad-stats { gap: 14px; }
  .ad-stat-btns { margin-left: 0; width: 100%; }
}

/* ------------------------------ ⑨-b 批量登记 ------------------------------ *//* 一次拖一堆课件进来，每个自动生成一张「待确认卡」，改完一次写完 */

.ad-btop { display: grid; grid-template-columns: 1.05fr 1fr; gap: 12px; align-items: stretch; }
.ad-btop .ad-drop { padding: 16px 14px; }

.ad-bscan {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: #fff;
}
.ad-bscan b { font-size: 13.5px; }
.ad-bscan span { font-size: 12.5px; color: var(--ink-sub); line-height: 1.55; }
.ad-bscan code { font-size: 11.5px; }
.ad-bscan .ghost-btn { margin-top: auto; }
.ad-bscan small { font-size: 11.5px; color: var(--ink-faint); }

.ad-bhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 14px 0 9px; }
.ad-bhead b { font-size: 14px; }
.ad-bhead-tip { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-faint); }
.ad-bhead .link-btn { font-size: 12.5px; }

.ad-blist {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(332px, 1fr));
  gap: 11px;
  /* 留够高度给底部「全部登记」按钮，别把它挤到折叠线以下 */
  max-height: 36vh; overflow: auto;
  padding: 3px 4px 3px 2px;
}

/* 底部按钮常驻：内容再长也点得到 */
.modal-card.admin .ad-actions {
  position: sticky; bottom: -2px; z-index: 2;
  background: #fff;
  padding-top: 10px;
}

.ad-bcard {
  border: 1px solid var(--line); border-radius: 14px;
  background: #fff; padding: 11px 12px 10px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
}
.ad-bcard.has-err { border-color: #fecaca; background: #fffbfb; }
.ad-bcard.has-warn { border-color: #fde68a; background: #fffdf5; }

.ad-bc-head { display: flex; align-items: center; gap: 8px; }
.ad-bc-no {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: var(--blue-deep); background: var(--blue-50);
}
/* 卡片头上这枚是「登记后会发到几号」，让用户提前看见，不至于保存完才知道 */
.ad-bc-code {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  border-radius: 5px; padding: 1px 7px;
  color: var(--blue-deep); background: var(--blue-50); border: 1px solid var(--blue-100);
  font-variant-numeric: tabular-nums;
}
.ad-bc-src {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
  color: var(--ink-sub); background: #f1f5f9;
}
.ad-bc-src.drop { color: #1d4ed8; background: var(--blue-50); }
.ad-bc-x {
  margin-left: auto; flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 7px; line-height: 1;
  font-size: 15px; color: var(--ink-faint);
  transition: background .16s, color .16s;
}
.ad-bc-x:hover { background: #fef2f2; color: #dc2626; }

.ad-bc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 9px; }
.ad-bc-fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ad-bc-fld.wide { grid-column: 1 / -1; }
.ad-bc-fld > span { font-size: 11.5px; font-weight: 600; color: var(--ink-sub); }
.ad-bc-fld input, .ad-bc-fld select {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 13px; color: var(--ink);
  transition: border-color .16s, box-shadow .16s;
}
.ad-bc-fld input:focus, .ad-bc-fld select:focus {
  outline: none; border-color: var(--blue-300); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.ad-bc-fld input:read-only { background: #f8fafc; color: var(--ink-sub); }

.ad-bc-state { font-size: 12px; font-weight: 600; line-height: 1.5; display: flex; align-items: flex-start; gap: 5px; }
.ad-bc-state::before { content: "•"; flex: 0 0 auto; }
.ad-bc-state.ok { color: #047857; }
.ad-bc-state.warn { color: #b45309; }
.ad-bc-state.err { color: #dc2626; }

.ad-bempty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 20px; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--r);
  color: var(--ink-sub); margin-top: 14px;
}
.ad-bempty b { font-size: 14px; color: var(--ink); }
.ad-bempty span { font-size: 12.5px; line-height: 1.7; }

@media (max-width: 860px) {
  .ad-btop { grid-template-columns: 1fr; }
  .ad-blist { max-height: none; grid-template-columns: 1fr; }
}

/* ------------------------------ ⑩ 登录与权限 ------------------------------ */

.auth-wrap { position: relative; flex: 0 0 auto; }

/* 账号按钮：高度跟左边的网格/雪花控件对齐（都取 --ctl），不要比它矮一截 */
.auth-btn {
  gap: 6px;
  height: var(--ctl);
  padding: 0 13px;
}
.auth-btn.is-in { padding-left: 5px; padding-right: 11px; }
.auth-av {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff; font-size: 12px; font-weight: 700;
  overflow: hidden; flex: 0 0 auto;
}
.auth-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-name {
  max-width: 84px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 180px; z-index: 60;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg);
  padding: 6px;
  animation: umIn .16s var(--ease);
}
@keyframes umIn { from { opacity: 0; transform: translateY(-5px); } }
.um-head { padding: 8px 10px 9px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.um-head b { display: block; font-size: 13.5px; color: var(--ink); }
.um-head small { color: var(--blue-deep); font-size: 11.5px; font-weight: 700; }
.um-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink);
  cursor: pointer; transition: .15s;
}
.um-item:hover { background: var(--blue-50); color: var(--blue-deep); }
.um-item.danger:hover { background: #fef2f2; color: #b42318; }

.modal-card.login,
.modal-card.reg { max-width: 400px; text-align: left; }
/* grid 子项默认 min-width:auto，验证码行（输入框固有宽 + 120px 验证码图）会把整列
   撑到 320px，360px 左右的窄屏卡片里就出现横向滚动条；统一允许子项收缩（2026-09-24） */
.login-form > * { min-width: 0; }
@media (max-width: 480px) {
  .modal { padding: 14px; }
  .modal-card.login,
  .modal-card.reg { padding: 22px 18px 18px; }
  .captcha-box { width: 108px; }
}
/* 2026-09-24 用户定稿：登录/注册弹窗做"流光玻璃"——和顶栏筛选按钮同族的近透明质感：
   卡片半透明白 + backdrop 模糊 + 细白描边，遮罩调淡让玻璃感透出来 */
#loginModal .modal-mask,
#regModal .modal-mask { background: rgba(255, 255, 255, .24); backdrop-filter: blur(4px); }
.modal-card.login,
.modal-card.reg {
  background: rgba(255, 255, 255, .42);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: 0 30px 70px rgba(18, 32, 61, .20), inset 0 1px 0 rgba(255, 255, 255, .65);
  /* 玻璃层上浅灰文字会显淡，弹窗内整体调深一档 */
  --ink-faint:#6b7a8a;
}
/* 弹窗标题（登录/注册各自独立弹窗，不再用双 tab） */
.auth-title { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: 3px; text-align: center; color: var(--ink); }
.auth-sub { margin: 7px 0 0; font-size: 12.5px; letter-spacing: .5px; text-align: center; color: var(--ink-faint); }
/* 2026-09-24 用户定稿（参照飞书登录页）：账号密码不用方框，
   一行 = 小图标 + 输入框，只有底部一条细线，聚焦时线变蓝 */
.login-form { display: grid; gap: 8px; margin-top: 20px; }
.login-line {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line);
  transition: border-color .18s;
}
.login-line:focus-within { border-bottom-color: var(--blue); }
.login-line svg { flex: 0 0 auto; width: 17px; height: 17px; color: var(--ink-faint); }
.login-line input {
  flex: 1; min-width: 0; height: 46px; padding: 0;
  border: 0; outline: none; background: transparent;
  font-size: 14px; color: var(--ink);
}
.login-line input::placeholder { color: var(--ink-faint); }
/* 密码行右端的「眼睛」：点击在明文/密文间切换，默认密文 */
.login-eye {
  flex: 0 0 auto; width: 30px; height: 30px; margin-right: -6px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--ink-faint); cursor: pointer; padding: 0;
  transition: color .18s, background .18s;
}
.login-eye:hover, .login-eye:focus-visible { color: var(--blue); background: rgba(37, 99, 235, .08); outline: none; }
.login-eye svg { width: 18px; height: 18px; }
/* SVG 元素不认 HTML 的 hidden 属性，显隐交给 CSS 类（.eye-off 默认藏着） */
.login-eye .eye-off { display: none; }
.login-eye.is-showing .eye-on { display: none; }
.login-eye.is-showing .eye-off { display: block; }
.login-msg { min-height: 18px; margin: 0; font-size: 12.5px; color: var(--ink-sub); }
.login-msg.is-err { color: #b42318; font-weight: 700; }
/* 登录按钮：居中 + 通栏圆角长条（飞书式） */
.login-acts { display: flex; justify-content: center; margin-top: 18px; }
.login-acts .primary-btn { width: 100%; height: 46px; min-width: 0; border-radius: 999px; font-size: 15px; }
.login-acts .primary-btn[disabled] { opacity: .6; cursor: default; }

/* ---------- 登录 / 注册独立弹窗（2026-09-24 学生注册体系） ---------- */
.login-form[hidden] { display: none; }
.auth-note { margin: 14px 0 0; font-size: 12px; line-height: 1.7; color: var(--ink-faint); text-align: center; }
/* 登录按钮上方的「没有账号？点击注册」/「已有账号？去登录」互换入口 */
.auth-switch {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: .5px;
  color: var(--ink-sub);
}
.auth-link {
  border: 0; padding: 0; background: none;
  font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--blue); cursor: pointer;
  border-bottom: 1px solid rgba(37, 99, 235, .35);
  transition: color .18s, border-color .18s;
}
.auth-link:hover, .auth-link:focus-visible { color: var(--blue-deep); border-bottom-color: var(--blue-deep); outline: none; }
/* 验证码行：输入框 + 右侧 120×40 的 SVG 验证码（点击换一张） */
.captcha-row { display: flex; align-items: center; gap: 12px; }
.captcha-row input {
  flex: 1; min-width: 0; height: 46px; padding: 0;
  border: 0; border-bottom: 1px solid var(--line); outline: none; background: transparent;
  font-size: 14px; color: var(--ink); letter-spacing: 3px;
}
.captcha-row input:focus { border-bottom-color: var(--blue); }
.captcha-row input::placeholder { color: var(--ink-faint); letter-spacing: 0; }
.captcha-box {
  flex: 0 0 auto; width: 120px; height: 40px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; overflow: hidden; cursor: pointer;
  background: #f2f5fa; border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-faint);
}
.captcha-box svg { width: 100%; height: 100%; display: block; }
/* 协议勾选行 */
.agree-line {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 4px 0 0; font-size: 12px; line-height: 1.65; color: var(--ink-sub);
  cursor: pointer; user-select: none;
}
.agree-line input { margin: 3px 0 0; width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.agree-line b { color: var(--ink); }

/* ---------- 积分充值指引弹窗（2026-09-24） ---------- */
.modal-card.recharge { max-width: 460px; text-align: left; }
.rc-balance {
  margin: 10px 0 14px; padding: 10px 14px;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: #9a3412;
}
.rc-body { display: flex; gap: 16px; align-items: flex-start; }
.rc-qr {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.rc-qr img { width: 120px; height: 120px; object-fit: contain; }
.rc-qr span { font-size: 11.5px; color: var(--ink-sub); }
.rc-rules { flex: 1; min-width: 0; display: grid; gap: 6px; }
.rc-rules b { font-size: 13px; color: var(--ink); }
.rc-rules b::before { content: '· '; color: var(--blue); }
.rc-rules p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-sub); }
.rc-foot { margin: 14px 0 0; font-size: 12px; color: var(--ink-faint); }

/* 卡片上的下载按钮：右上角、分享按钮左侧（与分享同族圆形玻璃钮） */
.card-dl {
  position: absolute; top: 9px; right: 44px; z-index: 3;
  width: 30px; height: 30px; border: 0; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .92); color: var(--ink-sub);
  box-shadow: 0 3px 10px rgba(20, 33, 61, .14);
  backdrop-filter: blur(6px);
  cursor: pointer; opacity: .82;
  transition: opacity .18s, transform .18s, background .18s, color .18s;
}
.card:hover .card-dl { opacity: 1; }
.card-dl:hover, .card-dl:focus-visible { background: var(--blue); color: #fff; transform: scale(1.08); outline: none; }

@media (max-width: 860px) {
  .auth-wrap { position: static; }
  .user-menu { right: 10px; }
}

/* ------------------------------ ⑪ 使用人数 ------------------------------ */

.card-metrics { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* 使用人数：只显示数字，不可点，所以做成灰底 "安静" 的样子 */
.use-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--bg); color: var(--ink-sub);
  border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 700;
  cursor: default; white-space: nowrap;
}
.use-pill svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .75; }
.use-slot { display: inline-flex; align-items: center; }
.chip .chip-meta em.m-use { color: var(--ink-sub); }

/* 实时渲染封面：插画垫底，课件首屏淡入盖在上面（只做展示，不可点） */
.card-cover .cover-live {
  position: absolute; inset: 0; overflow: hidden;
  opacity: 0; transition: opacity .35s var(--ease);
}
.card-cover.is-live .cover-live { opacity: 1; }
.cover-live .cover-frame {
  position: absolute; left: 0; border: 0;
  transform-origin: 0 0;
  pointer-events: none;
  background: #fff;
}

/* ------------------------------ ⑫ 全屏播放浮层 ------------------------------ */
/* 打开课件时盖满整屏，但顶上有"退出全屏"按钮，按 Esc 也能退，不会像裸文件那样回不去 */
body.player-open { overflow: hidden; }

.player {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column;
  background: var(--bg);
  animation: playerIn .2s var(--ease);
}
/* 只淡入，不缩放：缩放会留下 transform，量尺寸和分层都不干净 */
@keyframes playerIn { from { opacity: 0; } to { opacity: 1; } }

/* 顶部柔光，和整站调性一致 */
.player::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 220px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(37, 99, 235, .07), transparent 70%);
  pointer-events: none;
}

.player-bar {
  position: relative; z-index: 2;
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 16px 0 14px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  animation: playerBarIn .26s var(--ease);
}
@keyframes playerBarIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.player-exit {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--blue-dark); cursor: pointer;
  background: var(--blue-50); border: 1px solid var(--blue-200);
  border-radius: 999px; padding: 7px 8px 7px 11px;
  transition: background .18s, border-color .18s, transform .18s;
}
.player-exit:hover { background: var(--blue-100); border-color: var(--blue-300); }
.player-exit:active { transform: scale(.97); }
/* 打开全屏时会把焦点放到这个按钮上（键盘用户按 Enter/Esc 都方便），
   所以给它一个柔和的光圈，别用系统那圈生硬的双线 */
.player-exit:focus { outline: none; }
.player-exit:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); }
.player-exit svg { flex: 0 0 auto; }
.player-exit kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--blue); background: #fff; border: 1px solid var(--blue-200);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
}

.player-ident { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.player-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.player-ident b {
  font-size: 15px; color: var(--ink); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-cat {
  flex: 0 0 auto;
  font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px;
  color: var(--blue-dark); background: var(--blue-50); border: 1px solid var(--blue-100);
}
.player-cat[data-cat="数与代数"]   { color: #1d4ed8; background: #eff6ff; border-color: #dbeafe; }
.player-cat[data-cat="图形与几何"] { color: #0f766e; background: #f0fdfa; border-color: #ccfbf1; }
.player-cat[data-cat="统计与概率"] { color: #6d28d9; background: #f5f3ff; border-color: #ede9fe; }
.player-cat[data-cat="综合与实践"] { color: #b45309; background: #fffbeb; border-color: #fef3c7; }
.player-cat[data-cat="游戏化"]   { color: #be185d; background: #fdf2f8; border-color: #fce7f3; }

.player-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.player-tool {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink-sub); text-decoration: none; cursor: pointer;
  background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 11px;
  transition: color .18s, border-color .18s, background .18s;
}
.player-tool:hover { color: var(--blue); border-color: var(--blue-200); background: var(--blue-50); }
/* 全屏播放条上的点赞：默认空心灰、点过亮成蓝底白字（和卡片点赞一个气质） */
.player-tool .thumb-path { fill: currentColor; }
.player-tool.is-on {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  border-color: transparent;
  color: #fff;
}
.player-tool.is-on:hover { color: #fff; }

.player-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.player-stage iframe {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%; border: 0; background: #fff;
}
.player-loading {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 13.5px; color: var(--ink-faint); background: var(--bg);
  transition: opacity .3s var(--ease);
}
.player-loading.off { opacity: 0; pointer-events: none; }

@media (max-width: 860px) {
  .player-bar { height: 52px; gap: 9px; padding: 0 10px; }
  .player-exit span, .player-exit kbd { display: none; }
  .player-exit { padding: 7px 10px; }
  .player-tool span { display: none; }
  .player-ident b { font-size: 14px; }
}

/* ------------------------------ ⑫-b 全屏画板 ------------------------------ */
/* 透明画布叠在课件上：不挡视线，只负责"接住笔"。
   is-capture 时才收点按（画笔/橡皮/图形模式），其余时候点击穿透回课件。 */
.board-canvas {
  position: absolute; inset: 0; z-index: 4;
  touch-action: none;
}
.board-canvas.is-capture { pointer-events: auto; cursor: crosshair; }
.board-canvas.is-hidden { visibility: hidden; }

/* 聚光灯：一圈亮、四周暗，纯展示层，不拦截任何点击（课件照常能操作） */
.board-spot {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
}

/* 竖向玻璃工具栏：默认贴右，也能按住顶部把手拖去贴左 */
.board {
  position: absolute; top: 18px; z-index: 5;
  width: 54px; max-height: calc(100% - 36px);
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 12px 32px rgba(23, 43, 84, .16), 0 2px 8px rgba(23, 43, 84, .08);
}
.board.dock-r { right: 12px; }
.board.dock-l { left: 12px; }
.board.is-open-r { animation: boardInR .22s var(--ease); }
.board.is-open-l { animation: boardInL .22s var(--ease); }
@keyframes boardInR { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes boardInL { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.board.is-drag {
  cursor: grabbing;
  box-shadow: 0 18px 44px rgba(23, 43, 84, .24), 0 4px 12px rgba(23, 43, 84, .12);
}

.board-scroll {
  width: 100%; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 0 2px;
  scrollbar-width: none;
}
.board-scroll::-webkit-scrollbar { display: none; }

.board-grip {
  flex: 0 0 auto; width: 100%; height: 22px;
  display: grid; place-items: center;
  color: var(--ink-faint); cursor: grab; touch-action: none;
  border-radius: 16px 16px 0 0;
}
.board-grip:hover { color: var(--ink-sub); }
.board.is-drag .board-grip { cursor: grabbing; }

.board-group { display: flex; flex-direction: column; gap: 4px; padding: 3px 0; }
.board-group + .board-group { border-top: 1px solid rgba(20, 33, 61, .07); }

.board-btn {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  font: inherit; color: var(--ink-sub); cursor: pointer;
  background: transparent; border: 0; border-radius: 11px;
  padding: 0;
  transition: background .16s, color .16s, transform .12s;
}
.board-btn:hover:not(:disabled) { background: rgba(37, 99, 235, .1); color: var(--blue); }
.board-btn:active:not(:disabled) { transform: scale(.94); }
/* 没东西可撤销/可重做时置灰，避免点了没反应 */
.board-btn:disabled { opacity: .32; cursor: default; }
.board-btn:disabled:hover { background: transparent; color: var(--ink-sub); }
.board-btn.is-on { background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff; }
.board-btn.is-on:hover { color: #fff; }
.board-btn-sm { width: 32px; height: 32px; border-radius: 9px; }

.board-colors {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 7px 0 5px; justify-items: center;
}
.board-color {
  width: 21px; height: 21px; border-radius: 50%; cursor: pointer;
  background: var(--c); border: 1px solid rgba(20, 33, 61, .18);
  padding: 0;
  transition: transform .14s, box-shadow .14s;
}
.board-color:hover { transform: scale(1.12); }
.board-color.is-on { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 4px var(--blue); }
/* 边框/填充色排的小标题（2026-09-25 填充色独立） */
.board-color-cap {
  grid-column: 1 / -1; text-align: center;
  font-size: 10px; line-height: 1; font-weight: 700; letter-spacing: 2px;
  color: var(--ink-sub); padding-top: 1px;
}
/* 一级工具栏的清空钮：红色悬停，与橡皮区分 */
.board-clear:hover { background: rgba(239, 68, 68, .12); color: #ef4444; }

/* 笔迹显隐：睁眼=点一下隐藏，闭眼=点一下显示（和登录密码眼睛同款做法） */
#boardEye .ic-eye-off { display: none; }
#boardEye.is-alt .ic-eye { display: none; }
#boardEye.is-alt .ic-eye-off { display: block; }

/* 暂存页：一行一个，小正方形标数字（1/2/3），有内容亮绿点 */
.board-slots {
  display: grid; grid-template-columns: 1fr; gap: 5px;
  padding: 8px 0 6px; justify-items: center;
}
.board-slot {
  position: relative; width: 26px; height: 26px;
  font: inherit; font-size: 12px; font-weight: 700;
  color: var(--ink-sub); cursor: pointer;
  background: rgba(255, 255, 255, .7); border: 1px solid rgba(20, 33, 61, .12);
  border-radius: 7px; padding: 0;
  transition: .16s;
}
.board-slot:hover { color: var(--blue); border-color: var(--blue-300); }
.board-slot.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.board-slot.has::after {
  content: ""; position: absolute; right: 3px; top: 3px;
  width: 5px; height: 5px; border-radius: 50%;
  background: #22c55e;
}
.board-slot.is-on.has::after { background: #fff; }

.board-close { margin-top: 2px; color: var(--ink-faint); }
.board-close:hover { color: var(--blue); }

/* 二级栏：画笔/图形模式下弹出（选图形/颜色/粗细）。
   工具栏贴右 → 二级栏在它左边；工具栏贴左 → 在它右边。 */
.board-sub {
  position: absolute; top: 18px; z-index: 5;
  width: 68px; max-height: calc(100% - 36px);
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 12px 32px rgba(23, 43, 84, .16), 0 2px 8px rgba(23, 43, 84, .08);
}
.board-sub[hidden] { display: none; }
.board-sub.sub-r { right: calc(12px + 54px + 8px); animation: subInR .2s var(--ease); }
.board-sub.sub-l { left: calc(12px + 54px + 8px); animation: subInL .2s var(--ease); }
@keyframes subInR { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@keyframes subInL { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.board-sub .board-scroll { gap: 4px; padding: 4px 2px 2px; }
.board-sub .board-btn-sm { width: 30px; height: 30px; }
.board-sub .board-btn-sm svg { width: 14px; height: 14px; }
/* 填充开关：开着=图形内部涂当前色 */
.board-sub .board-btn-sm.is-on { background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff; }

/* 粗细选择：圆点大小即笔迹粗细 */
.board-sizes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 7px 0 5px; justify-items: center;
}
.board-size {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 8px;
  cursor: pointer; padding: 0;
  transition: background .16s;
}
.board-size:hover { background: rgba(37, 99, 235, .1); }
.board-size i { display: block; border-radius: 50%; background: var(--ink-sub); }
.board-size.is-on { background: rgba(37, 99, 235, .13); box-shadow: inset 0 0 0 1.5px var(--blue); }
.board-size.is-on i { background: var(--blue); }

/* ------------------------------ ⑬ 带外壳的观看页 view.html ------------------------------ */
/* 分享出去的链接、手机扫码、以及「新标签页打开」都落到这一页：
   上面有一条 SimMath 顶栏，随时能「返回」，下面才是课件。 */
.shell-body { height: 100vh; overflow: hidden; }

.shell-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  height: 58px; padding: 0 16px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}

.shell-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 700; color: var(--blue-dark);
  background: var(--blue-50); border: 1px solid var(--blue-200);
  border-radius: 999px; padding: 7px 13px 7px 10px;
  transition: background .18s, border-color .18s;
}
.shell-back:hover { background: var(--blue-100); border-color: var(--blue-300); }

.shell-ident { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.shell-ident b {
  font-size: 16px; color: var(--ink); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shell-cat {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 2px 9px;
}
.shell-cat[data-cat="数与代数"]   { color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe; }
.shell-cat[data-cat="图形与几何"] { color: #0f766e; background: #f0fdfa; border: 1px solid #ccfbf1; }
.shell-cat[data-cat="统计与概率"] { color: #6d28d9; background: #f5f3ff; border: 1px solid #ede9fe; }
.shell-cat[data-cat="综合与实践"] { color: #b45309; background: #fffbeb; border: 1px solid #fef3c7; }
.shell-cat[data-cat="游戏化"]   { color: #be185d; background: #fdf2f8; border: 1px solid #fce7f3; }
.shell-meta { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shell-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.shell-tool {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-sub); cursor: pointer;
  background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 12px;
  transition: color .18s, border-color .18s, background .18s;
}
.shell-tool:hover { color: var(--blue); border-color: var(--blue-200); background: var(--blue-50); }

.shell-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.shell-stage iframe {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%; border: 0; background: #fff;
}
.shell-loading {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 13.5px; color: var(--ink-faint); background: var(--bg);
  transition: opacity .3s var(--ease);
}
.shell-loading.off { opacity: 0; pointer-events: none; }

/* 课件编号对不上时 */
.shell-miss {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 40px 20px;
}
.shell-miss h1 { font-size: 21px; }
.shell-miss p { font-size: 14px; color: var(--ink-sub); max-width: 460px; }
.shell-btn {
  margin-top: 8px;
  display: inline-block;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  border-radius: 999px; padding: 10px 22px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .26);
}

@media (max-width: 860px) {
  .shell-meta { display: none; }
  .shell-bar { height: 52px; gap: 9px; padding: 0 10px; }
  .shell-tool span { display: none; }
}

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