/* ============================================================
   应子学习 · 主题 v3
   ------------------------------------------------------------
   这一层只做"视觉升级"，不改变任何布局结构：
   1. 先重定义设计变量（颜色、圆角、阴影、焦点环）
   2. 再逐组件打磨（按钮、卡片、表格、输入、侧边栏、聊天气泡）
   3. 登录页换成左右分栏
   放在 style.css 之后加载，同名规则后者生效，因此原文件保持不动、随时可回退。
   ============================================================ */

:root {
  /* 品牌：靛蓝 → 紫罗兰，点缀青绿 */
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --accent: #14b8a6;
  --ok: #10b981;
  --danger: #ef4444;

  /* 中性色（slate 系，比原来的蓝灰更沉稳） */
  --bg: #f5f7fc;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #4a5876;
  --ink-3: #93a0bb;
  --line: #e7ecf6;
  --soft: #f3f6fd;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;

  /* 分层阴影：近处一层很淡、远处一层扩散，比单一阴影更有质感 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 2px 6px rgba(15, 23, 42, .05), 0 14px 34px rgba(15, 23, 42, .07);
  --shadow-lg: 0 4px 14px rgba(15, 23, 42, .07), 0 28px 60px rgba(15, 23, 42, .13);
  --ring: 0 0 0 4px rgba(79, 70, 229, .14);
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 52%, #14b8a6 100%);
  --grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #ecfeff 100%);
}

[data-theme="dark"] {
  --brand: #818cf8;
  --brand-dark: #a5b4fc;
  --brand-soft: #1e1b4b;
  --accent: #2dd4bf;
  --ok: #34d399;
  --danger: #f87171;

  --bg: #0a0f1e;
  --panel: #131a2c;
  --ink: #e9eefb;
  --ink-2: #a2afcc;
  --ink-3: #6c7a9c;
  --line: #232c46;
  --soft: #171f36;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 8px rgba(0, 0, 0, .42), 0 18px 44px rgba(0, 0, 0, .34);
  --shadow-lg: 0 6px 18px rgba(0, 0, 0, .5), 0 32px 70px rgba(0, 0, 0, .45);
  --ring: 0 0 0 4px rgba(129, 140, 248, .22);
  --grad: linear-gradient(135deg, #4f46e5 0%, #6d28d9 55%, #0d9488 100%);
  --grad-soft: linear-gradient(135deg, #161c33 0%, #1a1b3a 50%, #10262c 100%);
}

/* ------------------------------------------------------------ 基础 ---- */
body {
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(99, 102, 241, .10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(20, 184, 166, .09), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: .1px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[data-theme="dark"] body {
  background:
    radial-gradient(1100px 620px at 10% -10%, rgba(99, 102, 241, .18), transparent 62%),
    radial-gradient(900px 520px at 100% 0%, rgba(13, 148, 136, .14), transparent 58%),
    var(--bg);
}

::selection { background: rgba(79, 70, 229, .18); }

/* 滚动条：细一点，不抢镜 */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .5) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .45); border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .7); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* -------------------------------------------------------- 侧边栏 ---- */
.rail {
  background: linear-gradient(180deg, #131a35 0%, #0d1226 55%, #0a0f1f 100%);
  border-right: 1px solid rgba(255, 255, 255, .05);
  box-shadow: 4px 0 26px rgba(10, 15, 31, .22);
}
.rail-brand .mark,
.rail-brand > span:first-child {
  background: var(--grad);
  box-shadow: 0 8px 22px rgba(79, 70, 229, .38);
}
.rail-name { font-size: 14px; letter-spacing: .5px; }
.rail-nav { gap: 8px; }
.rail-item {
  position: relative; border-radius: 13px; color: #a7b3d1;
  transition: color .18s, background .18s, transform .18s;
}
.rail-item svg { width: 25px; height: 25px; opacity: .9; }
.rail-item:hover { background: rgba(255, 255, 255, .07); color: #e8edfb; transform: translateY(-1px); }
.rail-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, .32), rgba(20, 184, 166, .22));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 8px 20px rgba(79, 70, 229, .25);
}
.rail-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.rail-user, .rail-theme {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  transition: background .18s, transform .18s;
}
.rail-user:hover, .rail-theme:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.rail-role.admin { color: #c4b5fd; }
.rail-role.teacher { color: #5eead4; }

/* -------------------------------------------------- 顶栏与底栏 ---- */
.topbar-mobile {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .topbar-mobile { background: rgba(19, 26, 44, .82); }
.tabbar {
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
}
[data-theme="dark"] .tabbar { background: rgba(19, 26, 44, .9); }

/* ---------------------------------------------------------- 按钮 ---- */
.primary-btn {
  position: relative;
  background: var(--grad);
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-weight: 500; letter-spacing: .3px;
  box-shadow: 0 2px 6px rgba(79, 70, 229, .28), 0 12px 26px rgba(79, 70, 229, .22);
  transition: transform .16s cubic-bezier(.2, .7, .3, 1), box-shadow .2s, filter .2s;
}
.primary-btn:hover:not(:disabled) { transform: translateY(-1.5px); box-shadow: 0 4px 12px rgba(79, 70, 229, .32), 0 18px 36px rgba(79, 70, 229, .26); filter: saturate(1.06); }
.primary-btn:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 6px rgba(79, 70, 229, .3); }
.primary-btn:disabled { opacity: .55; box-shadow: none; }

.ghost-btn, .mini-btn, .btn {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  transition: border-color .16s, color .16s, background .16s, transform .16s, box-shadow .16s;
}
.ghost-btn:hover, .mini-btn:hover:not(:disabled), .btn:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  color: var(--brand);
  box-shadow: 0 4px 12px rgba(79, 70, 229, .10);
  transform: translateY(-1px);
}
.mini-btn.danger:hover { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); box-shadow: 0 4px 12px rgba(239, 68, 68, .12); }

.icon-btn {
  border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color .16s, color .16s, transform .16s;
}
.icon-btn:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); color: var(--brand); transform: translateY(-1px); }

.send-btn {
  background: var(--grad); border: none;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .3);
  transition: transform .16s, box-shadow .2s, filter .2s;
}
.send-btn:hover { transform: translateY(-1px) scale(1.02); filter: saturate(1.08); }

/* ------------------------------------------------------ 卡片面板 ---- */
.panel, .card, .stat-card, .class-hero, .session-panel, .composer {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel { transition: box-shadow .22s, transform .22s; }
[data-theme="dark"] .panel, [data-theme="dark"] .card { background: var(--panel); }

.panel-title {
  font-size: 15px; font-weight: 600; letter-spacing: .2px;
  padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel-tip { font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.panel-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.card-value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; color: var(--ink); line-height: 1.2; }
.card-label { font-size: 12.5px; color: var(--ink-3); letter-spacing: .3px; }
.card-foot { font-size: 12px; color: var(--ink-3); }
.cards { gap: 16px; }
.cards .card { padding: 18px 20px; transition: transform .2s, box-shadow .2s; }
.cards .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* 首屏欢迎卡 */
.welcome {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--brand-soft) 45%, var(--panel)));
  box-shadow: var(--shadow);
}
.welcome-icon {
  background: var(--grad); color: #fff;
  box-shadow: 0 12px 30px rgba(79, 70, 229, .32);
  border-radius: 20px;
}
.suggest-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.suggest-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: 0 10px 26px rgba(79, 70, 229, .12);
}

/* --------------------------------------------------------- 表单 ---- */
input[type="text"], input[type="password"], input[type="search"], input[type="tel"],
input[type="number"], textarea, select, .text-input {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--soft) 60%, var(--panel));
  color: var(--ink);
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input:focus, textarea:focus, select:focus, .text-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand) 70%, var(--line));
  background: var(--panel);
  box-shadow: var(--ring);
}
label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; letter-spacing: .2px; }

.composer {
  border-radius: var(--radius);
  box-shadow: 0 -6px 24px rgba(15, 23, 42, .05);
}
.composer textarea, .composer input {
  border: none; background: transparent; box-shadow: none;
}
.composer textarea:focus, .composer input:focus { box-shadow: none; }

/* --------------------------------------------------------- 表格 ---- */
.data-table { border-collapse: separate; border-spacing: 0; }
.data-table th {
  font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: none;
  color: var(--ink-3);
  background: color-mix(in srgb, var(--soft) 75%, var(--panel));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.data-table td { border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.data-table tbody tr { transition: background .14s; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* --------------------------------------------------- 标签与徽章 ---- */
.tag, .pill-tag, .badge, .src-score {
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500; letter-spacing: .2px;
  padding: 2px 10px;
  border: 1px solid transparent;
}
.tag { background: color-mix(in srgb, var(--soft) 80%, var(--panel)); color: var(--ink-2); border-color: var(--line); }
.tag.admin { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.tag.teacher { background: rgba(20, 184, 166, .14); color: #0d9488; }
.tag.ok { background: rgba(16, 185, 129, .14); color: #059669; }
.tag.off { background: rgba(148, 163, 184, .18); color: var(--ink-3); }
[data-theme="dark"] .tag.admin { color: #c4b5fd; }
[data-theme="dark"] .tag.teacher { color: #5eead4; }
[data-theme="dark"] .tag.ok { color: #6ee7b7; }

.mode-pill {
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  transition: all .16s;
}
.mode-pill.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .28);
}

/* ----------------------------------------------------- 聊天气泡 ---- */
.bubble {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  line-height: 1.78;
}
.msg.assistant .bubble { border-top-left-radius: 6px; }
.msg.user .bubble {
  background: var(--grad); color: #fff; border: none;
  border-top-right-radius: 6px;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .26);
}
.msg.user .bubble a { color: #e0e7ff; }
.avatar {
  background: var(--grad); color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .26);
}
.src-item, .probe-item, .link-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 55%, var(--panel));
  transition: border-color .16s, transform .16s;
}
.link-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); transform: translateY(-1px); }
.think {
  border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 60%, var(--panel));
}

/* --------------------------------------------------- 弹窗与提示 ---- */
.modal-mask { background: rgba(15, 23, 42, .42); backdrop-filter: blur(6px); }
.modal, .modal-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.note, .muted { color: var(--ink-3); }
.panel-empty, .empty-row { color: var(--ink-3); }

/* 面板入场：轻微上浮，避免生硬 */
@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page > .panel, .page > .cards, .page > .class-hero { animation: riseIn .28s cubic-bezier(.2, .7, .3, 1) both; }
.page > *:nth-child(2) { animation-delay: .03s; }
.page > *:nth-child(3) { animation-delay: .06s; }
.page > *:nth-child(4) { animation-delay: .09s; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   登录页：左右分栏
   ============================================================ */
.auth-shell {
  /* #app 是 position:fixed + overflow:hidden（主界面各块自己管内滚），
     登录页也住在它里面，所以这里必须自己开一个滚动容器——
     否则手机上注册表单比屏幕高的时候，下面的按钮永远够不着。 */
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}
.auth-hero { display: none; }
.auth-panel {
  display: flex;
  justify-content: center;
  min-height: 100%;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
}
.auth-card {
  /* margin:auto 而不是 place-items:center——
     居中布局遇上溢出时会把顶部内容顶出可视区，够不着。
     用 auto 外边距：有空间就居中，没空间就从顶部开始，还能滚。 */
  margin: auto;
  width: 100%;
  max-width: 420px;
  padding: 30px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-size: 22px; font-weight: 600;
  box-shadow: 0 10px 24px rgba(79, 70, 229, .3);
}
.auth-brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.auth-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: 20px;
  background: color-mix(in srgb, var(--soft) 70%, var(--panel));
  border: 1px solid var(--line);
  border-radius: 13px;
}
.auth-tabs button {
  border: none; background: transparent; cursor: pointer;
  padding: 9px 0; border-radius: 10px;
  font-family: inherit; font-size: 14px; color: var(--ink-2);
  transition: background .18s, color .18s, box-shadow .18s;
}
.auth-tabs button.active {
  background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
  font-weight: 600;
}
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; }
.auth-form label:has(.lab) { gap: 0; }
.auth-form input { height: 46px; padding: 0 14px; font-size: 14.5px; }
.auth-form .primary-btn { height: 48px; margin-top: 4px; font-size: 15px; border-radius: 12px; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-tip, .auth-msg { font-size: 12.5px; color: var(--ink-3); text-align: center; margin: 2px 0 0; }
.auth-msg.error { color: var(--danger); }

@media (min-width: 900px) {
  .auth-shell { grid-template-columns: 1.05fr .95fr; }
  .auth-hero {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 54px 56px; color: #fff;
    background:
      radial-gradient(700px 420px at 18% 12%, rgba(255, 255, 255, .16), transparent 62%),
      radial-gradient(620px 420px at 88% 88%, rgba(20, 184, 166, .28), transparent 60%),
      linear-gradient(150deg, #312e81 0%, #4f46e5 42%, #0f766e 100%);
  }
  .auth-hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(70% 60% at 40% 30%, #000, transparent 78%);
  }
  .auth-hero { position: relative; overflow: hidden; }
  .auth-hero-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
  .auth-hero-top .mark-lg {
    width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .26);
    font-size: 27px; font-weight: 600; backdrop-filter: blur(6px);
  }
  .auth-hero-top h2 { margin: 0; font-size: 25px; letter-spacing: 1px; }
  .auth-hero-top p { margin: 3px 0 0; font-size: 13px; color: rgba(255, 255, 255, .8); }
  .auth-points { position: relative; z-index: 1; list-style: none; margin: 30px 0; padding: 0; display: grid; gap: 18px; }
  .auth-points li { display: flex; gap: 13px; align-items: flex-start; }
  .auth-points .pt-ico {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
  }
  .auth-points .pt-ico svg { width: 19px; height: 19px; }
  .auth-points b { display: block; font-size: 15px; font-weight: 600; }
  .auth-points small { color: rgba(255, 255, 255, .78); font-size: 13px; line-height: 1.65; }
  .auth-hero-foot { position: relative; z-index: 1; margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, .62); }
  .auth-card { max-width: 430px; padding: 36px 34px; }
}

@media (max-width: 899px) {
  .auth-card { border: none; box-shadow: none; background: transparent; padding: 18px 4px; }
  .auth-brand { justify-content: center; text-align: center; flex-direction: column; gap: 8px; }
  .auth-tabs { background: var(--panel); }
}

/* 品牌区里的文字必须是白色（否则会被全局标题色覆盖成深色） */
.auth-hero h2, .auth-hero h1, .auth-hero b, .auth-hero strong { color: #fff; }
.auth-hero p, .auth-hero small { color: rgba(255, 255, 255, .8); }
.auth-hero-foot { color: rgba(255, 255, 255, .62) !important; }

/* ============================================================
   侧边栏高度自适应
   ------------------------------------------------------------
   浏览器放大后可视高度会变小（200% 时 900px 只剩 450px），
   原来侧边栏内容比可视区高，下半部分会被裁掉且无法滚动。
   这里按高度分档收紧，最后再留一条滚动兜底。
   ============================================================ */
.rail {
  overflow: hidden;               /* 整栏不滚动，改由导航区滚 */
  overscroll-behavior: contain;
}
/* 导航区可滚动，底部操作区（用户/主题/知识网络/返回/退出）永远贴在下方可见 */
.rail-nav {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.rail-nav::-webkit-scrollbar { width: 0; height: 0; }
.rail-foot { flex: 0 0 auto; }
.rail-brand { flex: 0 0 auto; }

/* 一档：偏矮，收紧间距 */
@media (max-height: 860px) {
  .rail { gap: 14px; padding: 16px 8px; }
  .rail-item { padding: 10px 5px; }
  .rail-item svg { width: 23px; height: 23px; }
  .rail-kb { display: none; }
}

/* 二档：明显偏矮，图标与文字都缩小，藏掉次要信息 */
@media (max-height: 720px) {
  .rail { gap: 10px; padding: 12px 6px; }
  .rail-brand .rail-name { display: none; }
  .rail-item { padding: 8px 4px; }
  .rail-item svg { width: 21px; height: 21px; }
  .rail-item .rail-label { font-size: 11.5px; }
  .rail-user { padding: 6px 2px; }
  .rail-uname { font-size: 11.5px; max-width: 84px; }
  .rail-role { font-size: 10.5px; }
  .rail-theme { margin-top: 6px; padding: 7px 2px; font-size: 11.5px; }
  .rail-clock { display: none; }
  .graph-link { margin-top: 6px; padding: 7px 8px; font-size: 11.5px; }
  .graph-link svg { width: 16px; height: 16px; }
  .rail-link { margin-top: 4px; padding: 5px 0; font-size: 11.5px; }
  .rail-foot .mini-btn { min-height: 30px; font-size: 12px; }
}

/* 三档：极矮，只留图标（悬停有 title 提示，页面标题也在顶栏显示） */
@media (max-height: 560px) {
  .rail { gap: 6px; padding: 10px 6px; }
  .rail-brand .logo { width: 38px; height: 38px; font-size: 19px; }
  .rail-item { padding: 7px 4px; gap: 0; }
  .rail-item .rail-label { display: none; }
  .rail-item svg { width: 22px; height: 22px; }
  .rail-role { display: none; }
  .rail-theme span:not(.ico) { display: none; }
  .rail-theme { padding: 6px 2px; }
  .graph-link span:not(:first-child) { display: none; }
  .graph-link { justify-content: center; padding: 7px 0; }
  .rail-foot .mini-btn { min-height: 28px; }
}

/* 四档：再矮就只保证能滚到（比如笔记本 + 200% 缩放） */
@media (max-height: 460px) {
  .rail-brand { display: none; }
  .rail-link { display: none; }
  .rail-foot .mini-btn.logout { min-height: 26px; font-size: 11px; }
}

/* ============================================================
   对话小人
   ============================================================ */
.pet {
  position: absolute;
  right: 18px;
  bottom: 92px;
  width: 112px;
  height: 124px;
  pointer-events: none;
  z-index: 3;
  transition: transform .18s cubic-bezier(.2, .7, .3, 1);
  will-change: transform;
}
.pet-svg { width: 100%; height: 100%; overflow: visible; }
.pet-shadow { fill: rgba(15, 23, 42, .14); animation: petShadow 3.6s ease-in-out infinite; }
@keyframes petShadow {
  0%, 100% { transform: scaleX(1); opacity: .9; }
  50% { transform: scaleX(.86); opacity: .7; }
}
.pet-all { animation: petBreath 3.6s ease-in-out infinite; transform-origin: 60px 100px; }
@keyframes petBreath {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-1.6px) scaleY(1.018); }
}
.pet-blush { opacity: 0; transition: opacity .25s; }
.pet.mood-curious .pet-blush, .pet.mood-happy .pet-blush { opacity: 1; }
.pet-mouth.o, .pet-mouth.flat { opacity: 0; }
.pet.mood-thinking .pet-mouth.smile, .pet.mood-thinking .pet-mouth.flat { opacity: 0; }
.pet.mood-thinking .pet-mouth.o { opacity: 1; }
.pet.mood-idle .pet-mouth.smile { opacity: .55; }
.pet.blink .pet-eye, .pet.blink .pet-pupil { transform: scaleY(.12); transform-origin: 60px 60px; }
.pet-eye, .pet-pupil { transition: transform .09s; }
.pet-arm { transform-origin: 18px 65px; animation: petArmL 3.6s ease-in-out infinite; }
.pet-arm.right { transform-origin: 102px 65px; animation-name: petArmR; }
@keyframes petArmL { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-7deg); } }
@keyframes petArmR { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(7deg); } }
.pet.mood-thinking .pet-all { animation: petThink 1.5s ease-in-out infinite; }
@keyframes petThink {
  0%, 100% { transform: rotate(-2.4deg) translateY(-1px); }
  50% { transform: rotate(2.4deg) translateY(-3px); }
}
.pet-dots { opacity: 0; transition: opacity .25s; }
.pet.mood-thinking .pet-dots { opacity: 1; }
.pet.mood-thinking .pet-dots circle { animation: petDot .9s ease-in-out infinite; }
.pet.mood-thinking .pet-dots circle:nth-child(2) { animation-delay: .15s; }
.pet.mood-thinking .pet-dots circle:nth-child(3) { animation-delay: .3s; }
@keyframes petDot {
  0%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-5px); opacity: 1; }
}
.pet.mood-happy .pet-all { animation: petJoy .5s ease-out 2; }
@keyframes petJoy {
  0%, 100% { transform: translateY(0) scaleY(1); }
  40% { transform: translateY(-7px) scaleY(1.05); }
}
.pet.mood-curious .pet-eye { rx: 11.5; ry: 12.5; }
@media (hover: none) { .pet { display: none; } }
@media (max-width: 767px) { .pet { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .pet-all, .pet-shadow, .pet-arm, .pet-dots circle { animation: none !important; }
}

/* 「有新内容」浮出提示 */
.new-below {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 96px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: 999px;
  background: var(--panel);
  color: var(--brand);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(79, 70, 229, .18);
  animation: riseIn .22s cubic-bezier(.2, .7, .3, 1) both;
  transition: transform .16s, box-shadow .16s;
}
.new-below:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 12px 28px rgba(79, 70, 229, .26); }
.new-below .ico { display: inline-flex; }
.new-below svg { width: 14px; height: 14px; }

/* 对话区滚动时不要把页面的滚动也带着动 */
.chat { overscroll-behavior: contain; }

/* 小人头顶的对话气泡 */
.pet-bubble {
  position: absolute;
  right: 96px;
  bottom: 150px;
  max-width: 200px;
  padding: 7px 13px;
  border-radius: 13px 13px 4px 13px;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--brand) 32%, var(--line));
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 8px 22px rgba(79, 70, 229, .14);
  z-index: 4;
  pointer-events: none;
  animation: bubbleIn .22s cubic-bezier(.2, .7, .3, 1) both;
  white-space: nowrap;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(.94); }
  to { opacity: 1; transform: none; }
}

/* 说话时的嘴型：只在 talking 时显示，其它嘴型让位 */
.pet-mouth.talk-mouth, .pet-mouth.talk-tongue { opacity: 0; transition: opacity .12s; }
.pet.talking .pet-mouth.talk-mouth, .pet.talking .pet-mouth.talk-tongue { opacity: 1; }
.pet.talking .pet-mouth.smile,
.pet.talking .pet-mouth.o,
.pet.talking .pet-mouth.flat { opacity: 0; }

/* 说话时身体有轻微起伏，像在讲话 */
.pet.talking .pet-all { animation: petTalkBody .5s ease-in-out infinite; }
@keyframes petTalkBody {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-1.4px) rotate(-1deg); }
}
.pet.talking .pet-arm.left { animation-duration: 1.1s; }
.pet.talking .pet-arm.right { animation-duration: 1.1s; }

/* 朗读开关的选中态 */
.ghost-btn.on {
  border-color: var(--brand);
  color: var(--brand);
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--panel));
}

@media (max-width: 767px) { .pet-bubble { display: none; } }

/* 朗读音色选择 */
.voice-pick {
  height: 34px;
  max-width: 178px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.voice-pick:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); }

/* ---------- 人形角色的表情细节 ---------- */
.pet-eyes-happy { opacity: 0; transition: opacity .16s; }
.pet.mood-happy .pet-eyes-happy { opacity: 1; }
.pet.mood-happy .pet-eyes-open { opacity: 0; }
.pet-eyes-open { transition: opacity .16s; }

/* 呆毛会晃 */
.pet-ahoge { transform-origin: 70px 20px; animation: petAhoge 3.4s ease-in-out infinite; }
@keyframes petAhoge {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(-7deg); }
  70% { transform: rotate(5deg); }
}
.pet.mood-happy .pet-ahoge { animation-duration: .8s; }

/* 好奇：眼睛睁大一点 */
.pet.mood-curious .pet-eyes-open { transform: scale(1.06); transform-origin: 70px 66px; }

/* 思考：眼睛往上看 */
.pet.mood-thinking .pet-eyes-open { transform: translateY(-1.6px); }

/* 说话时身体起伏，幅度比原来小（人形更自然） */
.pet.talking .pet-all { animation: petTalkBody .42s ease-in-out infinite; }
@keyframes petTalkBody {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-1.1px) rotate(-.7deg); }
}

/* 说话与高兴时手臂抬一点，像在比划 */
.pet.talking .pet-arm.left, .pet.mood-happy .pet-arm.left { transform: rotate(-13deg); }
.pet.talking .pet-arm.right, .pet.mood-happy .pet-arm.right { transform: rotate(13deg); }
.pet-arm { transition: transform .25s cubic-bezier(.2,.7,.3,1); transform-origin: 36px 100px; }
.pet-arm.right { transform-origin: 104px 100px; }

/* 气泡位置跟着新角色上移 */
.pet-bubble { bottom: 168px; right: 104px; }

/* 眨眼：人形是整只眼睛压扁（含虹膜） */
.pet.blink .pet-eyes-open { transform: scaleY(.08); transform-origin: 70px 66px; }


/* ============================================================
   移动端与平板专项（≤1023px）
   ------------------------------------------------------------
   原来手机端把整个 .page-head 隐藏了，结果朗读、提示词、示例提问、
   导出记录、清空、音色选择全都没了。现在只收起标题，保留动作按钮。
   ============================================================ */

@media (max-width: 1023px) {
  /* 标题收起来（顶栏已有页面名），但动作按钮要留着 */
  .page-head { flex-wrap: wrap; gap: 8px; padding-bottom: 6px; }
  /* 只对对话页收起标题（顶栏已显示页面名）；其它页面的标题与说明要留着 */
  .page.chat-page > .page-head > div:first-child { display: none; }
  .head-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    width: 100%;
    padding: 2px 2px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .head-actions::-webkit-scrollbar { height: 0; }
  .head-actions > * { flex: 0 0 auto; }
  .ghost-btn { min-height: 38px; padding: 0 14px; white-space: nowrap; }
  .voice-pick { min-height: 38px; max-width: 150px; }

  /* 长文本一律允许换行，避免整页横向溢出 */
  .page-sub, .panel-tip, .note, .card-foot, .muted {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .kb-toolbar, .distill-picker, .toolbar, .panel-head, .batch-bar {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .dp-status { margin-left: 0; }
}

/* 平板：表格改成卡片式（原来 768~1023 沿用了桌面表格，被挤成一列） */
@media (max-width: 1023px) {
  .table-wrap { overflow-x: visible; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--panel);
  }
  .data-table tbody tr:hover { background: var(--panel); }
  .data-table td {
    border: none;
    padding: 5px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
  }
  .data-table td::before {
    content: attr(data-label);
    flex: 0 0 72px;
    color: var(--ink-3);
    font-size: 12.5px;
    line-height: 1.7;
  }
  .data-table td:not([data-label])::before { content: none; }
  .data-table td:not([data-label]) {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
  }
  .data-table td.empty-row { display: block; text-align: center; padding: 18px 0; }
  .data-table td.empty-row::before { content: none; }
  .data-table .q-cell { white-space: normal; max-width: none; }
  .data-table .mini-btn { min-height: 32px; padding: 0 12px; }
}

/* 手机：底部导航保证 5 个入口都点得到；触控目标不小于 40px */
@media (max-width: 767px) {
  .tabbar { overflow-x: auto; scrollbar-width: none; }
  .tabbar::-webkit-scrollbar { height: 0; }
  .tab-item { min-width: 64px; min-height: 52px; }
  .mini-btn { min-height: 32px; }
  .icon-btn { min-width: 40px; min-height: 40px; }

  /* 手机上也让角色出现（鼠标跟随用不上，但说话/表情动画照样有效） */
  .pet {
    display: block !important;
    width: 78px;
    height: 88px;
    right: 8px;
    bottom: calc(var(--tabbar-h) + 62px);
    opacity: .96;
  }
  .pet-bubble {
    display: block !important;
    right: 74px;
    bottom: calc(var(--tabbar-h) + 118px);
    max-width: 150px;
    font-size: 12px;
    padding: 6px 11px;
    white-space: normal;
  }
  /* 气泡在窄屏不要盖住输入框 */
  .chat { padding-bottom: 34px; }

  /* 知识库页在手机上的排布 */
  .kb-toolbar { gap: 8px; }
  .upload-zone { padding: 20px 14px; }
  .distill-picker { padding: 10px; gap: 8px; }
  .dp-tabs { width: 100%; }
  .dp-tabs button { flex: 1 1 auto; align-items: center; }
  .dp-tabs button em { display: none; }
}

/* 手机横屏：高度很矮时把角色收起来，别挡内容 */
@media (max-width: 767px) and (max-height: 520px) {
  .pet, .pet-bubble { display: none !important; }
}

/* 手机端动作按钮紧凑化：一行能多放几个，少占垂直空间 */
@media (max-width: 767px) {
  .head-actions { gap: 6px; padding-bottom: 4px; }
  .head-actions .ghost-btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
    gap: 4px;
  }
  .head-actions .ghost-btn .ico svg { width: 15px; height: 15px; }
  .head-actions .voice-pick { min-height: 34px; max-width: 128px; font-size: 12px; }
  /* 顶栏也收一点，把高度让给内容 */
  .topbar { height: 52px; }
}


/* ============================================================
   手机端：表格压紧
   ------------------------------------------------------------
   平板以下已经统一把表格改成卡片式，但「序号 / 问题 / 次数」和
   知识库的「选择」这类单元格会各占一整行，一张卡片动辄 200 多像素高，
   手机上滑一屏看不了几条。这两张表单独压紧。
   ============================================================ */
@media (max-width: 767px) {
  /* 常问问题：序号 + 问题 + 次数 挤成一行 */
  .data-table.rank-table tr {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 8px;
  }
  .data-table.rank-table td {
    display: block;
    padding: 0;
    min-width: 0;
  }
  .data-table.rank-table td::before { content: none; }
  .data-table.rank-table td.q-cell { white-space: normal; }
  .data-table.rank-table .rank { font-size: 12px; }
  .data-table.rank-table td:last-child {
    color: var(--brand);
    font-weight: 600;
    text-align: right;
  }

  /* 知识库：勾选框挪到卡片右上角，不再单独占一行 */
  .data-table.kb-table tr {
    position: relative;
  }
  /* 只给文件名那一行留出勾选框的位置。
     整个卡片都留 46px 的话，下面那排操作按钮会被挤窄，多折一行。 */
  .data-table.kb-table td[data-label="文件名"] { padding-right: 46px; }
  .data-table.kb-table td[data-label="选择"] {
    position: absolute;
    top: 10px;
    right: 12px;
    width: auto;
    padding: 0;
  }
  .data-table.kb-table td[data-label="选择"]::before { content: none; }
  .data-table.kb-table td:last-child { gap: 6px; padding-top: 8px; }
  .data-table.kb-table .mini-btn {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12.5px;
  }
  /* 勾选后整卡高亮，手机上看得更清楚 */
  .data-table.kb-table tr.picked { border-color: var(--brand); }
}


/* ============================================================
   手机端：两处收尾
   ------------------------------------------------------------
   1. 知识库卡片的操作按钮差一点放不下，会折成两行。按钮再紧一点就能一行放完，
      每张卡片少一行高度，23 份文档省下将近 1000 像素。
   2. 对话小人固定在右下角，会压住聊天区最后一条内容（示例问题、回答末尾）。
      给滚动区留出角色高度，滑到底时最后一条不会被挡住。
   ============================================================ */
@media (max-width: 767px) {
  .data-table.kb-table .mini-btn {
    min-height: 30px;
    padding: 0 7px;
    font-size: 12px;
    gap: 3px;
  }
  /* 这一排有 5 个按钮，间距压到 4px 才能一行放完；放不下会折行，很浪费高度 */
  .data-table.kb-table td:last-child { gap: 4px; }

  /* 角色高度约 88px，再留一点余量 */
  .chat { padding-bottom: 104px; }
}


/* ============================================================
   班级学情：展开班级后先看"卡在哪"，再看人名
   ============================================================ */
.class-insight {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--soft) 45%, var(--panel));
}
.insight-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.insight-stats b { color: var(--ink); font-size: 15px; margin-right: 2px; }
.insight-stats .warn b { color: #c2410c; }

.insight-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.insight-title {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: .3px;
}
.insight-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.insight-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.insight-count {
  flex: 0 0 auto;
  min-width: 26px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.insight-text { min-width: 0; overflow-wrap: anywhere; }
.insight-text[title] { cursor: pointer; }
.insight-text[title]:hover { color: var(--brand); }
.insight-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #c2410c;
}

/* 窄屏改成一列，两栏并排会把每栏挤到读不下去 */
@media (max-width: 767px) {
  .insight-cols { grid-template-columns: 1fr; gap: 12px; }
  .insight-stats { gap: 4px 14px; font-size: 12.5px; }
}


/* 测一测：题干、选项、判分结果 */
.quiz-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.quiz-topic {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--panel));
  padding: 3px 10px;
  border-radius: 8px;
}
.quiz-kind { font-size: 12px; color: var(--ink-3); }
.quiz-stem {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}
.quiz-options { display: grid; gap: 8px; margin-bottom: 14px; }
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color .15s, background .15s;
}
.quiz-option:hover { border-color: var(--brand); }
.quiz-option.picked {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
}
.quiz-option input { margin-top: 3px; flex: 0 0 auto; }
.quiz-input, .quiz-code {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14.5px;
}
.quiz-code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13.5px;
  line-height: 1.65;
  resize: vertical;
  margin-bottom: 12px;
}
.quiz-input { margin-bottom: 14px; }
.quiz-actions { display: flex; gap: 10px; align-items: center; }

.quiz-result {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 45%, var(--panel));
  font-size: 13.5px;
  line-height: 1.75;
}
.quiz-result.ok { border-color: #86efac; background: #f0fdf4; }
.quiz-verdict { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.quiz-verdict b { font-size: 15px; }
.quiz-result.ok .quiz-verdict b { color: #166534; }
.quiz-result p { margin: 6px 0 0; }
.quiz-result code {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.quiz-explain { color: var(--ink-2); }
.quiz-advice { color: #1d4ed8; }
.quiz-hint { color: #9a3412; }
.quiz-empty { display: grid; gap: 10px; justify-items: start; padding: 6px 0; }

@media (max-width: 767px) {
  .quiz-code { font-size: 13px; }
}


/* ============================================================
   老师综合页
   ============================================================ */
.ov-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 45%, var(--panel));
}
.ov-stats b { color: var(--ink); font-size: 15px; margin: 0 2px; }
.ov-table .warn { color: #c2410c; font-weight: 600; }

.blind-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.blind-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.blind-count {
  flex: 0 0 auto;
  min-width: 28px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 7px;
  background: #ffedd5;
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
}
.blind-name { min-width: 0; overflow-wrap: anywhere; }
.blind-list .muted { margin-left: auto; font-size: 12px; }

.field-input select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  width: 100%;
  cursor: pointer;
}

@media (max-width: 767px) {
  .blind-list .muted { display: none; }
  .ov-stats { gap: 6px 16px; font-size: 13px; }
}


/* ============================================================
   我的资料（个人学习天地）+ 母题题库
   ============================================================ */
.wb-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.wb-upload:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 4%, var(--panel)); }
.wb-hint { flex-basis: 100%; text-align: center; font-size: 12px; }

.wb-list { display: grid; gap: 10px; margin-top: 12px; }
.wb-item { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.wb-item-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  cursor: pointer;
  font-size: 13.5px;
}
.wb-item-head:hover { background: color-mix(in srgb, var(--soft) 45%, var(--panel)); }
.wb-item-head b { min-width: 0; overflow-wrap: anywhere; }
.wb-item-head .muted { margin-left: auto; font-size: 12px; flex: 0 0 auto; }
.wb-sections { padding: 4px 13px 12px; display: grid; gap: 6px; }
.wb-section {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--soft) 40%, var(--panel));
}
.wb-sec-title { font-weight: 500; }
.wb-sec-link { font-size: 12px; color: var(--brand); margin-left: auto; }
.wb-sec-link.none { color: var(--ink-3); }

.quiz-gen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.quiz-gen .field-input { flex: 1 1 260px; }
.quiz-gen-kind {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
}
.pending-list { margin-top: 14px; display: grid; gap: 12px; }
.pending-title { font-size: 13px; color: var(--ink-3); }
.pending-item {
  border: 1px solid var(--line);
  border-left: 3px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
}
.pending-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.pending-stem { margin: 0 0 8px; line-height: 1.7; white-space: pre-wrap; }
.pending-options { margin: 0 0 8px; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.pending-options li { padding: 3px 8px; border-radius: 6px; font-size: 13px; }
.pending-options li.right { background: #dcfce7; color: #166534; font-weight: 500; }
.pending-answer code, .pending-item code {
  background: var(--soft); border-radius: 5px; padding: 1px 6px; font-size: 12.5px;
}
.pending-actions { display: flex; gap: 8px; margin-top: 10px; }

@media (max-width: 767px) {
  .wb-sec-link { margin-left: 0; flex-basis: 100%; }
  .quiz-gen .field-input { flex-basis: 100%; }
}


/* ============================================================
   学习天地改版：总览卡 + 卡片网格
   ------------------------------------------------------------
   原来整页都是通栏白条往下堆，一条细进度线孤零零的，四个状态
   就是一串带点的文字。改成常见学习仪表盘的样子：
   一张总览卡（环形进度 + 数字块），下面卡片网格。
   ============================================================ */
.hero {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 20px 24px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 7%, var(--panel)),
    var(--panel) 62%);
  box-shadow: var(--shadow-sm);
}
.hero-ring { position: relative; flex: 0 0 auto; width: 124px; height: 124px; }
.hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  /* 底轨要看得见，否则只剩一段弧飘着，不像个进度环 */
  stroke: color-mix(in srgb, var(--ink-3) 20%, var(--panel));
  stroke-width: 9;
}
.ring-fg {
  fill: none;
  stroke: url(#none) var(--brand);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dasharray .6s ease;
}
.ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
}
.ring-text b { font-size: 27px; line-height: 1; color: var(--ink); letter-spacing: -.5px; }
.ring-text b i { font-size: 14px; font-style: normal; margin-left: 1px; color: var(--ink-3); }
.ring-text span { font-size: 11.5px; color: var(--ink-3); }

.hero-main { min-width: 0; flex: 1; }
.hero-main h3 { margin: 0 0 4px; font-size: 17px; }
.hero-sub { margin: 0 0 14px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
}
.stat b { display: block; font-size: 21px; line-height: 1.15; color: var(--ink); }
.stat span { font-size: 12px; color: var(--ink-3); }
.stat.mastered { border-left-color: #16a34a; }
.stat.struggling { border-left-color: #ea580c; }
.stat.studied { border-left-color: var(--brand); }
.stat.todo { border-left-color: #cbd5e1; }
.stat.mastered b { color: #15803d; }
.stat.struggling b { color: #c2410c; }
.stat.studied b { color: var(--brand); }

.next-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.next-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 10px;
  text-align: left;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.next-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.next-card:active { transform: translateY(0); }
.next-badge {
  grid-row: 1 / 3;
  align-self: start;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 7px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--soft) 80%, var(--panel));
  color: var(--ink-2);
}
.next-card.struggling .next-badge { background: #ffedd5; color: #9a3412; }
.next-card.mastered  .next-badge { background: #dcfce7; color: #166534; }
.next-card.studied   .next-badge { background: #dbeafe; color: #1e40af; }
.next-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.next-doc {
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.next-go {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--brand);
  opacity: 0;
  transition: opacity .15s;
}
.next-card:hover .next-go { opacity: 1; }

@media (max-width: 1023px) {
  .next-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .hero { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px; }
  .hero-ring { align-self: center; width: 108px; height: 108px; }
  .ring-text b { font-size: 24px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 19px; }
  .next-go { display: none; }
}


/* ============================================================
   对话附件
   ============================================================ */
.composer { position: relative; }
.attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 2px;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: 12.5px;
  max-width: 220px;
}
.attach-chip img {
  width: 34px; height: 34px;
  object-fit: cover;
  border-radius: 7px;
  flex: 0 0 auto;
}
.attach-chip.image { padding-left: 4px; }
.attach-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-x {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--soft) 80%, var(--panel));
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.attach-x:hover { background: #fee2e2; color: #b91c1c; }

.attach-btn {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  align-self: flex-end;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .15s, color .15s;
}
.attach-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.attach-btn:disabled { opacity: .4; cursor: default; }

@media (max-width: 767px) {
  .attach-btn { width: 38px; height: 38px; }
  .attach-chip { max-width: 150px; }
}


/* 对话里学生上传的图片/文件 */
.msg-attach { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg-attach img {
  width: 108px;
  max-height: 140px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.msg-attach-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px;
  background: var(--panel);
}
@media (max-width: 767px) {
  .msg-attach img { width: 88px; max-height: 116px; }
}

/* 对话方式那一行，样式跟回答模式共用，只是间距小一点 */
.mode-bar.teach-bar { margin-bottom: 6px; }

/* 回答下面的保存按钮，平时不抢眼 */
.save-row { display: flex; gap: 6px; margin-top: 8px; opacity: .55; transition: opacity .15s; }
.bubble:hover .save-row { opacity: 1; }
.save-row .mini-btn { min-height: 27px; padding: 0 9px; font-size: 12px; }


/* ============================================================
   注册表单：选填项折叠
   ------------------------------------------------------------
   电脑端屏幕大，一直展开；手机端收起来，只留必填的四项。
   手机号是必填的（后端要用它做唯一校验），收不了。
   ============================================================ */
.reg-more {
  display: none;                 /* 电脑端不显示这个开关 */
  align-items: center;
  gap: 6px;
  justify-content: center;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 10px;
  padding: 9px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.reg-more:hover { border-color: var(--brand); color: var(--brand); }
.reg-extra { display: grid; gap: 14px; }

@media (max-width: 899px) {
  .reg-more { display: flex; }
  .reg-extra { display: none; }
  .reg-extra.open { display: grid; }

  /* 手机上输入框大一点，手指好点 */
  .auth-form input { height: 50px; font-size: 16px; }   /* 16px 以上 iOS 才不会自动放大 */
  .auth-form .primary-btn { height: 52px; font-size: 16px; }
  .auth-form { gap: 16px; }
  .auth-form label { font-size: 13.5px; }
}

/* 个人资料里的退出登录 */
.logout-block { margin: 0; }   /* 挪到最上面了，不需要上边距 */
.logout-btn {
  width: 100%;
  height: 44px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.logout-btn:hover { background: #fee2e2; border-color: #fca5a5; }


/* ============================================================
   系统设置面板
   ============================================================ */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.set-item { display: grid; gap: 5px; min-width: 0; }
.set-label { font-size: 12.5px; color: var(--ink-2); }
.set-item input[type="text"],
.set-item input[type="number"] {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}
.set-item input[type="checkbox"] { width: 20px; height: 20px; margin: 9px 0; }
.set-range { font-size: 11.5px; color: var(--ink-3); }
.set-wide { margin-bottom: 14px; }
.set-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-save { width: auto; min-width: 130px; padding: 0 22px; height: 42px; }

@media (max-width: 767px) {
  .set-grid { grid-template-columns: 1fr; }
  .set-save { width: 100%; }
}


/* 开关项：一行一个，左边方框右边说明 */
.set-switches { display: grid; gap: 10px; margin-bottom: 14px; }
.set-switch {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}
.set-switch:hover { border-color: var(--brand); }
.set-switch input[type="checkbox"] {
  width: 19px; height: 19px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
}
.set-switch-text { display: grid; gap: 3px; min-width: 0; }
.set-switch-text b { font-size: 14px; font-weight: 500; }
.set-switch-text small { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; }


/* 手机端弹窗：底部留安全区，免得被 Home 条盖住 */
@media (max-width: 899px) {
  .modal { max-height: 88vh; max-height: 90dvh; }
  .modal-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}


/* 图片资料的缩略图 */
.wb-thumb {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}


/* 我的资料：网盘样子的文件行 */
.wb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.wb-item + .wb-item { margin-top: 8px; }
.wb-fileico { color: var(--ink-3); flex: 0 0 auto; }
.wb-meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wb-name {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wb-sub { font-size: 12px; color: var(--ink-3); }
.wb-ops { display: flex; gap: 6px; flex: 0 0 auto; }
.wb-thumb { width: 40px; height: 40px; cursor: zoom-in; }

@media (max-width: 767px) {
  .wb-item { flex-wrap: wrap; }
  .wb-ops { flex-basis: 100%; justify-content: flex-end; }
}

/* 朗读失败的提示条 */
.speak-err {
  margin: 0;
  padding: 8px 14px;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12.5px;
  cursor: pointer;
  text-align: center;
}


/* ============================================================
   这条回答可信吗
   ------------------------------------------------------------
   不是点赞组件：放在参考资料下面，学生先看到出处再判断。
   ============================================================ */
.trust-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}
.trust-ask { font-size: 12px; color: var(--ink-3); }
.trust-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.trust-btn:hover { border-color: var(--brand); color: var(--brand); }
.trust-btn .ico svg { width: 14px; height: 14px; }
.trust-btn.trust.picked { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.trust-btn.unsure.picked { border-color: #94a3b8; background: #f8fafc; color: #475569; }
.trust-btn.doubt.picked { border-color: #ea580c; background: #fff7ed; color: #c2410c; }
.trust-done { font-size: 12px; color: var(--ink-3); }


/* 自己发的问题下面：复制 / 再问。
   手机上一直显示——手机上本来就没有 hover。 */
.ask-again {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  opacity: .45;
  transition: opacity .15s;
}
.bubble:hover .ask-again { opacity: 1; }
.ask-again .mini-btn { min-height: 27px; padding: 0 9px; font-size: 12px; }
@media (hover: none) {
  .ask-again { opacity: .8; }
}


/* 语音输入 */
.mic-btn.on {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
  animation: mic-pulse 1.4s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .35); }
  50% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
}
.voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 4px;
  font-size: 13px;
  color: var(--ink-2);
}
.voice-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex: 0 0 auto;
  animation: mic-pulse 1.4s ease-in-out infinite;
}


/* 登录页的试用入口 */
.guest-entry {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.guest-line { font-size: 12.5px; color: var(--ink-3); }
.guest-btn { width: 100%; height: 46px; border-radius: 11px; font-size: 14.5px; }
.guest-note { font-size: 12px; color: var(--ink-3); }


/* ============================================================
   注册表单：身份选择、必填标记、字段提示
   ============================================================ */
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* 选择器要给足优先级：.auth-form label 是 display:grid，
   不加 .auth-form 前缀的话，单选钮和文字会被拆成上下两行 */
.auth-form label.role-opt {
  display: flex;
  /* 这一行不能省：style.css 里有一条 .auth-form label 设了
     flex-direction: column。CSS 的特异性是逐属性算的——
     我这条赢了 display，但 flex-direction 还是它的，结果还是竖排。 */
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
}
.auth-form label.role-opt input { margin: 0; }
.role-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 13px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.role-opt:hover { border-color: var(--brand); }
.role-opt.on {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
}
.role-opt input { margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--brand); }
.role-text { display: grid; gap: 2px; min-width: 0; }
.role-text b { font-size: 14px; font-weight: 500; }
.role-text small { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

/* 必填标记：红色星号 */
.req { color: #dc2626; font-style: normal; margin-left: 2px; font-weight: 600; }
.lab { display: block; margin-bottom: 5px; font-size: 12.5px; color: var(--ink-2); }
.opt {
  margin-left: 6px;
  font-size: 11px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
}
.field-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.req-note { margin: 0; font-size: 12px; color: var(--ink-3); }

@media (max-width: 767px) {
  .role-pick { grid-template-columns: 1fr; }
}

/* 管理端：注册时申请了教师身份的用户标记 */
.apply-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  cursor: help;
}


/* ============================================================
   实验台
   ------------------------------------------------------------
   终端要深色、等宽才算「像那么回事」，但整体还是跟着主题走，
   免得切到浅色主题时只有它一块黑的很突兀。
   ============================================================ */
.lab-page { padding-bottom: 20px; }
.lab-wrap {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 250px;
  gap: 14px;
  align-items: start;
}

/* 左：章节 */
.lab-side {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel);
}
.lab-chapter {
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.lab-lesson {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lab-lesson:hover { background: color-mix(in srgb, var(--soft) 60%, var(--panel)); }
.lab-lesson.on { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); color: var(--brand); font-weight: 500; }
.lab-lesson.done .lab-lesson-name { color: #15803d; }
.lab-lesson-name { flex: 1; min-width: 0; }
.lab-lesson-mark { color: #16a34a; flex: 0 0 auto; }

/* 中：任务 + 终端 */
.lab-main { display: grid; gap: 12px; min-width: 0; }
.lab-task {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--panel);
  font-size: 13.5px;
  line-height: 1.7;
}
.lab-task b { display: block; margin-bottom: 5px; font-size: 14.5px; }
.lab-task p { margin: 0; color: var(--ink-2); }
.lab-why {
  margin-top: 8px !important;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px !important;
  color: var(--ink-3) !important;
}
.lab-why .ico { margin-right: 5px; vertical-align: -3px; }

.term {
  background: #0f172a;
  border-radius: 12px;
  padding: 14px 16px;
  height: 440px;
  overflow-y: auto;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #d6e0f0;
  cursor: text;
}
.term-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-line.cmd { color: #7dd3fc; }
.term-line.sys { color: #94a3b8; }
.term-line.err { color: #fca5a5; }
.term-input-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.term-prompt { color: #4ade80; flex: 0 0 auto; }
.term-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #d6e0f0;
  font-family: inherit;
  font-size: 13px;
  caret-color: #4ade80;
}
.term-input::placeholder { color: #475569; }
.term-wait { color: #64748b; }

/* 右：检查点 */
.lab-checks {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  background: var(--panel);
  position: sticky;
  top: 10px;
}
.lab-checks-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.lab-score {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--soft) 80%, var(--panel));
  color: var(--ink-3);
}
.lab-score.all { background: #dcfce7; color: #15803d; }
.lab-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.lab-check-box {
  flex: 0 0 auto;
  width: 17px; height: 17px;
  margin-top: 1px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
}
.lab-check.ok .lab-check-box { background: #16a34a; border-color: #16a34a; }
.lab-check.ok .lab-check-label { color: var(--ink-3); text-decoration: line-through; }
.lab-all-done {
  margin-top: 10px;
  padding: 9px;
  border-radius: 9px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 13px;
  text-align: center;
}
.lab-help { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.lab-hints {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.lab-hints li { margin-bottom: 5px; }
.lab-answer {
  margin: 10px 0 0;
  padding: 10px;
  background: #0f172a;
  color: #d6e0f0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* vi 打开的编辑器 */
.editor-modal { max-width: 780px; }
.editor-actions { display: flex; align-items: center; gap: 8px; }
.editor-note { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.editor-area {
  width: 100%;
  min-height: 380px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f172a;
  color: #d6e0f0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
}

/* 右下角的小人助手 */
.lab-pet { position: fixed; right: 22px; bottom: 22px; z-index: 30; display: grid; justify-items: end; gap: 10px; }
.lab-pet-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
}
.lab-pet-btn .ico svg { width: 24px; height: 24px; }
.lab-pet-bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.lab-ask {
  width: 340px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.lab-ask-head {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}
.lab-ask-body { max-height: 320px; overflow-y: auto; padding: 12px 14px; display: grid; gap: 10px; }
.lab-ask-msg { font-size: 13.5px; line-height: 1.7; }
.lab-ask-msg.user {
  justify-self: end;
  max-width: 88%;
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  border-radius: 10px;
  padding: 7px 11px;
}
.lab-ask-input { display: flex; gap: 7px; padding: 10px 12px; border-top: 1px solid var(--line); }
.lab-ask-input input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  background: var(--panel);
  color: var(--ink);
}

/* 实验台只在电脑端出现。导航项已经按宽度过滤了，这里再兜一道，
   万一有别的路径切进来，也不会把手机页面挤乱。 */
@media (max-width: 1023px) {
  .lab-page { display: none !important; }
  .lab-pet { display: none !important; }
}


/* ============================================================
   实验台内容编辑
   ============================================================ */
.dirty-dot {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
}
.la-wrap {
  display: grid;
  grid-template-columns: 170px 200px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.la-col {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: var(--panel);
  min-width: 0;
}
.la-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.la-item {
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.la-item:hover { background: color-mix(in srgb, var(--soft) 60%, var(--panel)); }
.la-item.on { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); color: var(--brand); font-weight: 500; }

.la-edit { display: grid; gap: 10px; }
.la-chapter-fields {
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.la-field { display: grid; gap: 4px; }
.la-label { font-size: 12px; color: var(--ink-3); }
.la-field input, .la-field textarea, .la-arg input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  resize: vertical;
}
.la-checks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-3);
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.la-check {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 8px;
}
.la-check-row { display: flex; gap: 6px; align-items: center; }
.la-type {
  flex: 0 0 auto;
  max-width: 150px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
}
.la-check-label { flex: 1; min-width: 0; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; font-family: inherit;
  font-size: 13px; background: var(--panel); color: var(--ink); }
.la-check-args { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.la-arg { display: grid; gap: 3px; }
.la-arg span { font-size: 11.5px; color: var(--ink-3); }
.la-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.la-save { width: auto; min-width: 150px; padding: 0 22px; height: 42px; }
.la-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1023px) {
  .la-wrap { grid-template-columns: 1fr; }
}


/* ============================================================
   实验台进度圆环
   ============================================================ */
.ring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.ring-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 14px 13px;
  background: var(--panel);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
}
.ring-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.ring-card.open { border-color: var(--brand); }
.ring-svg { width: 108px; height: 108px; transform: rotate(-90deg); }
.ring-track {
  fill: none;
  stroke: color-mix(in srgb, var(--ink-3) 16%, var(--panel));
  stroke-width: 11;
}
.ring-arc {
  fill: none;
  stroke-width: 11;
  stroke-linecap: butt;
  transition: stroke-dasharray .5s ease, stroke-dashoffset .5s ease;
}
.ring-arc.done { stroke: #16a34a; }
.ring-arc.doing { stroke: var(--brand); }
.ring-arc.todo { stroke: color-mix(in srgb, var(--ink-3) 30%, var(--panel)); }
.ring-center {
  position: absolute;
  top: 16px; left: 0; right: 0;
  height: 108px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  pointer-events: none;
}
.ring-center b { font-size: 23px; line-height: 1; color: var(--ink); letter-spacing: -.5px; }
.ring-center b i { font-size: 12px; font-style: normal; color: var(--ink-3); margin-left: 1px; }
.ring-center span { font-size: 11px; color: var(--ink-3); }
.ring-title {
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.ring-legend {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.ring-legend .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}
.ring-legend .dot.done { background: #16a34a; }
.ring-legend .dot.doing { background: var(--brand); }
.ring-legend .dot.todo { background: color-mix(in srgb, var(--ink-3) 45%, var(--panel)); }

.ring-detail {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.ring-detail-title { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }

@media (max-width: 767px) {
  .ring-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ring-svg { width: 88px; height: 88px; }
  .ring-center { height: 88px; top: 14px; }
  .ring-center b { font-size: 19px; }
}


/* ============================================================
   积分
   ============================================================ */
.score-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  min-width: 260px;
}
.score-num { display: flex; align-items: baseline; gap: 3px; flex: 0 0 auto; }
.score-num b { font-size: 26px; line-height: 1; color: var(--ink); letter-spacing: -.5px; }
.score-num i { font-size: 12px; font-style: normal; color: var(--ink-3); }
.score-meta { display: grid; gap: 2px; flex: 1; min-width: 0; }
.score-band { font-size: 13px; font-weight: 500; }
.score-meta .muted { font-size: 11.5px; }
.score-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; border-radius: 0 0 12px 12px; overflow: hidden;
}
.score-chip { position: relative; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--brand); transition: width .5s; }

.band-优秀 .score-band, .band-优秀 .score-num b { color: #15803d; }
.band-良好 .score-band, .band-良好 .score-num b { color: #0369a1; }
.band-及格 .score-band, .band-及格 .score-num b { color: #b45309; }
.band-待提高 .score-band, .band-待提高 .score-num b { color: var(--ink-2); }

/* 班级分数榜 */
.score-board {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.score-summary { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.score-big { display: flex; align-items: baseline; gap: 6px; }
.score-big b { font-size: 30px; line-height: 1; color: var(--ink); letter-spacing: -1px; }
.score-big i { font-size: 12.5px; font-style: normal; color: var(--ink-3); }
.score-side { display: grid; gap: 3px; font-size: 12.5px; color: var(--ink-3); }
.score-rows { display: grid; gap: 7px; }
.score-row { display: flex; align-items: center; gap: 11px; font-size: 13px; }
.score-name {
  flex: 0 0 88px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-2);
}
.score-track {
  flex: 1; min-width: 0; height: 8px;
  background: color-mix(in srgb, var(--soft) 80%, var(--panel));
  border-radius: 5px; overflow: hidden;
}
.score-fill { display: block; height: 100%; background: var(--brand); border-radius: 5px; transition: width .5s; }
.score-fill.band-优秀 { background: #16a34a; }
.score-fill.band-良好 { background: #0284c7; }
.score-fill.band-及格 { background: #d97706; }
.score-val { flex: 0 0 42px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

@media (max-width: 767px) {
  .score-chip { min-width: 0; width: 100%; }
  .score-name { flex-basis: 64px; }
}


/* ============================================================
   开发日志
   ============================================================ */
.devlog-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.devlog-modal { max-width: 880px; }
.devlog-head-right { display: flex; align-items: center; gap: 10px; }
.devlog-body {
  max-height: 72vh;
  max-height: 72dvh;
  overflow-y: auto;
  padding: 16px 22px 22px;
}
/* 日志里 ### 段落多，收一收间距，不然翻起来很散 */
.devlog-md h1 { font-size: 20px; margin: 4px 0 12px; }
.devlog-md h2 {
  font-size: 15px; margin: 20px 0 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.devlog-md h3 {
  font-size: 13.5px; margin: 16px 0 6px;
  padding-left: 9px; border-left: 3px solid var(--brand);
}
.devlog-md blockquote {
  margin: 6px 0 6px 12px;
  padding-left: 11px;
  border-left: 2px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
}
.devlog-md code {
  background: color-mix(in srgb, var(--soft) 80%, var(--panel));
  padding: 1px 5px; border-radius: 5px; font-size: 12.5px;
}


/* ============================================================
   工具箱
   ============================================================ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.tool-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  background: var(--panel);
  display: grid;
  gap: 8px;
  align-content: start;
}
.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tool-head b { font-size: 13.5px; }
.tool-desc { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-3); }
.tool-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-list { display: grid; gap: 5px; }
.tool-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 3px 0;
}
.tool-dot {
  flex: 0 0 auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #16a34a;
}
.tool-dot.bad { background: #dc2626; }
.tool-label { flex: 0 0 96px; color: var(--ink-3); }
.tool-value {
  flex: 1; min-width: 0;
  color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}


/* ============================================================
   英语天地（全屏嵌入四级学堂）
   ============================================================ */
.en-entry { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)) !important; }
.en-entry:hover { border-color: var(--brand) !important; color: var(--brand); }

.en-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  /* dvh 而不是 vh：手机上 vh 算的是"地址栏收起时"的高度，
     用 vh 底部会被地址栏盖掉一截。做登录页时踩过这个坑。 */
  height: 100vh;
  height: 100dvh;
}
.en-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.en-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.en-title b { font-size: 15px; white-space: nowrap; }
.en-sub {
  font-size: 12.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.en-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.en-link { font-size: 12.5px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.en-link:hover { text-decoration: underline; }
.en-frame { flex: 1; width: 100%; border: 0; min-height: 0; display: block; }
.en-loading { flex: 1; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }

@media (max-width: 767px) {
  .en-sub, .en-link { display: none; }
  .en-bar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
}
