/* ════════════════════════════════════════════════════════════════
   StudyTeacher — Mature Learning V2 · shared visual foundation

   ── 这个文件是什么 ──
   V2 全部应用页共用的**唯一**设计令牌与组件层（Figma「44 — Visual System」的落地面）。
   页面只允许用这里的变量与类，不许各自再复制一套颜色 / 圆角 / 阴影。
   旧 styles.css 仍被登录 / 找回 / 定价等页与 teacher 页里的遗留弹层引用；
   两者共存时以本文件为准（本文件在后加载，且所有类都带 st- 前缀，不会互相污染）。

   ── 视觉令牌（FIGMA → BROWSER IMPLEMENTATION HANDOFF · 151:8，Owner 冻结）──
   页面底色 #F3F5F8 → 白色主卡 #FFFFFF（1px #D7DEE8 边框 · 0 4px 14px rgba(27,36,48,.06) 阴影）→ 卡内辅助面（浅蓝 / 浅绿 / 浅黄）。
   三层必须一眼分得开：不许米色贴米色、灰贴灰。主 CTA 一律深色底 + #FFFFFF 字（--st-cta）；森林绿只做品牌 / 状态 / 链接色。
   字体沿用（Literata 标题 / Nunito Sans 正文，中文单独指定字体栈，见 CLAUDE.md「设计调性」）。
   ⚠ Figma 文件本轮仍不可达（登录墙），以上取值来自 Owner 交接文本；令牌集中在 :root 一处，改值页面零改动。

   ── 断点 ──
   mobile  < 768      底部导航 + 单列 + 老师面板做成底部抽屉
   tablet  768–1099   顶部导航 + 两列自适应
   desktop ≥ 1100     顶部导航 + 阅读区 / 老师面板并排
   ════════════════════════════════════════════════════════════════ */
:root{
  --st-bg:#F3F5F8;
  --st-surface:#FFFFFF;
  --st-surface-2:#EEF3F9;
  --st-surface-3:#E1E8F1;
  --st-border:#D7DEE8;
  --st-border-strong:#BFC9D6;
  --st-ink:#1B2430;
  --st-text:#334155;
  --st-muted:#5B6675;
  --st-faint:#8A94A3;
  --st-primary:#2f6b47;
  --st-primary-600:#275a3c;
  --st-primary-soft:#E6F4EA;
  --st-primary-soft-2:#D2EBDA;
  --st-on-primary:#ffffff;
  --st-cta:#1B2430;
  --st-cta-hover:#0F1620;
  --st-on-cta:#FFFFFF;
  --st-accent:#b8892b;
  --st-accent-soft:#FFF6D6;
  --st-danger:#b3261e;
  --st-danger-soft:#fde7e5;
  --st-warn:#8a6d1f;
  --st-warn-soft:#FFF6D6;
  --st-info:#3b5f8a;
  --st-info-soft:#E8F0FA;
  --st-highlight:#f8e0a8;
  --st-focus:#3B4A5C;
  --st-font-body:"Nunito Sans","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",system-ui,-apple-system,sans-serif;
  --st-font-head:"Literata","Songti SC","Noto Serif SC","SimSun",serif;
  --st-font-zh-head:"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif;
  --st-radius-sm:8px;
  --st-radius:12px;
  --st-radius-lg:18px;
  --st-radius-pill:999px;
  --st-shadow-soft:0 4px 14px rgba(27,36,48,.06);
  --st-shadow-lift:0 14px 40px rgba(27,36,48,.10);
  --st-sidebar-w:88px;
  --st-mobilebar-h:54px;
  --st-bottomnav-h:62px;
  --st-max:1280px;
  --st-gutter:24px;
  --st-transition:.16s ease;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body.st-body{margin:0;min-height:100vh;background:var(--st-bg);color:var(--st-text);font-family:var(--st-font-body);font-size:15px;line-height:1.6;-webkit-font-smoothing:antialiased;overflow-x:hidden}
body.st-body h1,body.st-body h2,body.st-body h3,body.st-body h4{color:var(--st-ink);font-family:var(--st-font-head);font-weight:700;line-height:1.25;margin:0}
body.st-body:lang(zh-CN) h1,body.st-body:lang(zh-CN) h2,body.st-body:lang(zh-CN) h3,body.st-body:lang(zh-CN) h4{font-family:var(--st-font-zh-head);letter-spacing:.01em}
body.st-body a{color:inherit}
body.st-body button,body.st-body input,body.st-body select,body.st-body textarea{font-family:inherit;font-size:inherit}
body.st-body .material-symbols-outlined{font-size:20px;line-height:1;font-variation-settings:"FILL" 0,"wght" 400,"GRAD" 0,"opsz" 24;vertical-align:middle}
body.st-body .material-symbols-outlined.fill{font-variation-settings:"FILL" 1,"wght" 500,"GRAD" 0,"opsz" 24}
body.st-body [hidden]{display:none!important}
.st-hidden{display:none!important}
.st-sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* 焦点：键盘用户必须看得见；两条规则（outline + box-shadow）一起管，只关一条等于没关。 */
body.st-body :focus{outline:none}
body.st-body :focus-visible{outline:2px solid var(--st-focus);outline-offset:2px;box-shadow:none}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* ---------- Typography ---------- */
.st-h1{font-size:28px}
.st-h2{font-size:22px}
.st-h3{font-size:17px}
.st-h4{font-size:15px}
.st-lead{font-size:15px;color:var(--st-muted);margin:6px 0 0}
.st-muted{color:var(--st-muted)}
.st-faint{color:var(--st-faint)}
.st-small{font-size:13px}
.st-tiny{font-size:12px}
.st-strong{font-weight:800;color:var(--st-ink)}
.st-eyebrow{font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--st-primary)}
.st-mono{font-variant-numeric:tabular-nums}
.st-en{font-family:var(--st-font-body)}
.st-serif{font-family:var(--st-font-head)}

/* ---------- Layout ---------- */
.st-app{min-height:100vh;display:flex;flex-direction:column}
.st-main{flex:1;width:100%;max-width:var(--st-max);margin:0 auto;padding:22px var(--st-gutter) 40px}
.st-main.st-wide{max-width:none}
.st-main.st-narrow{max-width:860px}
.st-page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:18px}
.st-page-head .st-lead{margin-top:4px}
.st-grid{display:grid;gap:18px}
.st-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.st-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.st-grid-main{grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr)}
.st-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.st-col{display:flex;flex-direction:column;gap:10px}
.st-between{justify-content:space-between}
.st-gap-sm{gap:6px}
.st-gap-lg{gap:18px}
.st-wrap{flex-wrap:wrap}
.st-grow{flex:1;min-width:0}
.st-divider{height:1px;background:var(--st-border);margin:12px 0}
.st-stack>*+*{margin-top:14px}

/* ---------- 左侧 sidebar（Owner A · Figma 152:2 / 137:2 / 147 / 148 系列）----------
   一份标记，三种形态 —— 不是三套 DOM（三套 DOM 就会有三份 #accountChip / #langSelect 与三处失配）：

     · 紧凑 88px（**基态**）：平板 768–1199，以及任何调用 mountShell({layout:'rail'}) 的
       工作区页（阅读页要把宽度留给三列工作区）。图标在上、文字在下。
     · 展开 248px：≥1200 且没有要求紧凑的页面。图标 + 文字横排，并显示当前备考项目。
     · 手机 ≤767：同一个 <aside> 横过来当顶部条，只留品牌 / 页名 / 语言 / 账号，
       主导航交给底部导航（.st-bottomnav）。

   ⚠ 为什么把紧凑当基态：紧凑既可能来自视口（媒体查询），也可能来自页面自己的声明
   （body.st-sidebar-compact）。媒体查询没法给 body 加类名，所以「展开」写成
   `@media (min-width:1200px) body:not(.st-sidebar-compact)` 这一处条件，
   紧凑规则就只需要写一遍 —— 上一版把紧凑写在媒体查询里，阅读页在 1440 下
   拿到了 88px 的宽度却吃的是横排样式，导航文字被挤成单字。 */
.st-sidebar{position:fixed;left:0;top:0;bottom:0;width:var(--st-sidebar-w);z-index:70;display:flex;flex-direction:column;gap:8px;padding:12px 6px 10px;background:var(--st-surface);border-right:1px solid var(--st-border);overflow-y:auto;overscroll-behavior:contain}
.st-has-sidebar .st-app{padding-left:var(--st-sidebar-w)}
.st-sidebar-top{display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}
.st-sidebar .st-brand{flex:none;justify-content:center;min-width:0}
.st-sidebar .st-brand-text{display:none}
.st-sidebar .st-brand b,.st-sidebar .st-brand small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.st-sidebar-nav{display:flex;flex-direction:column;gap:2px;min-width:0}
.st-navitem{display:flex;flex-direction:column;align-items:center;gap:3px;padding:8px 2px;border-radius:12px;text-decoration:none;color:var(--st-text);font-weight:700;font-size:11px;line-height:1.15;text-align:center;transition:background var(--st-transition),color var(--st-transition)}
.st-navitem .material-symbols-outlined{font-size:22px;color:var(--st-muted);flex:none}
.st-navlabel{max-width:72px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.st-navitem:hover{background:var(--st-surface-3)}
.st-navitem.active{background:var(--st-primary-soft);color:var(--st-primary)}
.st-navitem.active .material-symbols-outlined{color:var(--st-primary);font-variation-settings:"FILL" 1,"wght" 500,"GRAD" 0,"opsz" 24}
/* 当前备考项目：紧凑形态下没有它的位置（88px 里塞不下考试名 + 日期 + 语言而不变成一列碎字），
   所以只在展开形态显示。手机上同理隐藏 —— 那一档的主导航本来就在底部。 */
.st-sidebar-ctx{display:none;min-width:0}
.st-sidebar-foot{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:10px;border-top:1px solid var(--st-border);min-width:0}
.st-sidebar-foot .st-chip{max-width:74px;height:auto;min-height:26px;padding:3px 6px;font-size:10px;white-space:normal;line-height:1.2;text-align:center;justify-content:center}
.st-sidebar-foot .st-langswitch{width:40px;height:40px;padding:0;justify-content:center;border-radius:50%;position:relative;overflow:hidden}
.st-sidebar-foot .st-langswitch>.material-symbols-outlined{font-size:20px}
.st-sidebar-foot .st-langswitch>select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;padding:0;max-width:none}
.st-sidebar-foot .st-avatar{width:40px;height:40px;padding:0;justify-content:center;border-radius:50%}
.st-sidebar-foot .st-avatar .st-avatar-name{display:none}

/* 侧栏里的「当前备考项目 / 考试」块（与页面内的上下文栏同一份实现，见 project-context.js） */
.projCtxSide{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:10px;border-radius:12px;background:var(--st-surface-2);border:1px solid var(--st-border);font-size:12.5px;line-height:1.45;min-width:0;width:100%}
.projCtxSide .projCtxIcon{font-size:19px;color:var(--st-primary)}
.projCtxSide .projCtxName{font-weight:800;color:var(--st-ink);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.projCtxSide .projCtxSep{display:none}
.projCtxSide .projCtxMeta{color:var(--st-muted);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.projCtxSide .projCtxLabel{color:var(--st-faint)}
.projCtxSide .projCtxEmptyText{color:var(--st-muted)}
.projCtxSide .projCtxCta{margin-top:2px;color:var(--st-primary);font-weight:800;text-decoration:none}
.projCtxSide .projCtxCta:hover{text-decoration:underline}

/* 展开形态：桌面 ≥1200，且这一页没有自己声明要紧凑 */
@media (min-width:1200px){
  body.st-body:not(.st-sidebar-compact){--st-sidebar-w:248px}
  body.st-body:not(.st-sidebar-compact) .st-sidebar{gap:10px;padding:14px 12px 12px}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-top{flex-direction:row;align-items:center;gap:8px}
  body.st-body:not(.st-sidebar-compact) .st-sidebar .st-brand{flex:1 1 auto;justify-content:flex-start}
  body.st-body:not(.st-sidebar-compact) .st-sidebar .st-brand-text{display:block;min-width:0;overflow:hidden}
  body.st-body:not(.st-sidebar-compact) .st-sidebar .st-brand b{font-size:16px;display:block}
  body.st-body:not(.st-sidebar-compact) .st-navitem{flex-direction:row;align-items:center;gap:12px;min-height:42px;padding:0 12px;font-size:14px;text-align:left}
  body.st-body:not(.st-sidebar-compact) .st-navitem .material-symbols-outlined{font-size:21px}
  body.st-body:not(.st-sidebar-compact) .st-navlabel{max-width:none}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-ctx{display:block}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-foot{align-items:stretch}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-foot .st-chip{max-width:none;height:34px;min-height:0;padding:0 12px;font-size:13px;white-space:nowrap}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-foot .st-langswitch{width:auto;height:34px;padding:0 4px 0 10px;border-radius:var(--st-radius-pill);justify-content:space-between;overflow:visible}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-foot .st-langswitch>select{position:static;width:auto;height:30px;opacity:1;padding:0 4px;flex:1}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-foot .st-avatar{width:auto;height:40px;padding:0 12px 0 5px;border-radius:var(--st-radius-pill);max-width:none;justify-content:flex-start}
  body.st-body:not(.st-sidebar-compact) .st-sidebar-foot .st-avatar .st-avatar-name{display:inline}
}

.st-brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--st-ink);font-weight:800;white-space:nowrap;flex:none}
.st-brand-mark{width:34px;height:34px;border-radius:10px;background:var(--st-primary);color:var(--st-on-primary);display:grid;place-items:center;box-shadow:var(--st-shadow-soft);flex:none}
.st-brand-mark .material-symbols-outlined{font-size:20px}
.st-brand b{font-family:var(--st-font-head);font-size:17px;display:block}
.st-brand small{display:block;font-size:11px;color:var(--st-muted);font-weight:600;margin-top:-2px}
.st-page-title{font-family:var(--st-font-head);font-weight:700;font-size:16px;color:var(--st-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.st-back{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:50%;color:var(--st-text);text-decoration:none;background:transparent;border:0;cursor:pointer;flex:none}
.st-back:hover{background:var(--st-surface-3)}

/* streak / account / language chips */
.st-chip{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border-radius:var(--st-radius-pill);background:var(--st-surface);border:1px solid var(--st-border);color:var(--st-text);font-size:13px;font-weight:700;white-space:nowrap;text-decoration:none;cursor:pointer}
.st-chip .material-symbols-outlined{font-size:18px}
.st-chip.st-streak{color:var(--st-accent);border-color:rgba(184,137,43,.3);background:var(--st-accent-soft)}
.st-chip.st-streak .material-symbols-outlined{color:var(--st-accent)}
.st-chip.st-quota.low{background:var(--st-warn-soft);color:var(--st-warn);border-color:transparent}
.st-chip.st-quota.out{background:var(--st-danger-soft);color:var(--st-danger);border-color:transparent}
.st-avatar{display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 12px 0 4px;border-radius:var(--st-radius-pill);background:var(--st-surface);border:1px solid var(--st-border);text-decoration:none;color:var(--st-ink);font-weight:700;font-size:13px;max-width:180px;min-width:0;white-space:nowrap;overflow:hidden}
.st-avatar-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.st-avatar-initial{width:28px;height:28px;border-radius:50%;background:var(--st-primary);color:var(--st-on-primary);display:grid;place-items:center;font-weight:800;font-size:13px;flex:none}
.st-avatar.guest .st-avatar-initial{background:var(--st-surface-3);color:var(--st-muted)}
.st-langswitch{display:inline-flex;align-items:center;gap:2px;height:34px;padding:0 4px 0 10px;border-radius:var(--st-radius-pill);background:var(--st-surface);border:1px solid var(--st-border);color:var(--st-muted)}
.st-langswitch>.material-symbols-outlined{font-size:18px}
.st-langswitch>select{height:30px;border:0;background:transparent;color:var(--st-ink);font-weight:700;font-size:13px;padding:0 4px;max-width:104px;cursor:pointer}
.st-langswitch>select:focus{box-shadow:none}

/* 阅读页 / 工作区页用 mountShell({layout:'rail'}) 在 body 上加 .st-sidebar-compact，
   于是 ≥1200 的展开规则不生效，侧栏保持 88px 基态，宽度留给页面自己的多列工作区。 */

/* ---------- Bottom nav (mobile) ---------- */
.st-bottomnav{display:none;position:fixed;left:0;right:0;bottom:0;z-index:60;height:calc(var(--st-bottomnav-h) + env(safe-area-inset-bottom,0px));padding-bottom:env(safe-area-inset-bottom,0px);background:rgba(255,255,255,.96);backdrop-filter:blur(14px);border-top:1px solid var(--st-border);grid-template-columns:repeat(5,1fr)}
.st-bottomnav a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;text-decoration:none;color:var(--st-muted);font-size:11px;font-weight:700;min-height:44px}
.st-bottomnav a .material-symbols-outlined{font-size:22px}
.st-bottomnav a.active{color:var(--st-primary)}
.st-bottomnav a.active .material-symbols-outlined{font-variation-settings:"FILL" 1,"wght" 500,"GRAD" 0,"opsz" 24}

/* ---------- Buttons ---------- */
.st-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:0 16px;border-radius:var(--st-radius);border:1px solid transparent;background:var(--st-cta);color:var(--st-on-cta);font-weight:800;font-size:14px;line-height:1;cursor:pointer;text-decoration:none;white-space:nowrap;transition:background var(--st-transition),border-color var(--st-transition),transform var(--st-transition)}
.st-btn:hover{background:var(--st-cta-hover)}
.st-btn:active{transform:scale(.985)}
.st-btn:disabled,.st-btn[aria-disabled="true"]{opacity:.5;cursor:not-allowed}
.st-btn .material-symbols-outlined,.st-empty .st-btn .material-symbols-outlined{font-size:19px;color:inherit}
.st-btn.secondary{background:var(--st-surface);color:var(--st-ink);border-color:var(--st-border-strong)}
.st-btn.secondary:hover{background:var(--st-surface-2);border-color:var(--st-ink)}
.st-btn.ghost{background:transparent;color:var(--st-primary);border-color:transparent}
.st-btn.ghost:hover{background:var(--st-primary-soft)}
.st-btn.subtle{background:var(--st-surface-2);color:var(--st-text);border-color:transparent}
.st-btn.subtle:hover{background:var(--st-surface-3)}
.st-btn.danger{background:var(--st-danger-soft);color:var(--st-danger);border-color:transparent}
.st-btn.danger:hover{background:#f9d5d1}
.st-btn.accent{background:var(--st-accent-soft);color:var(--st-warn);border-color:rgba(184,137,43,.3)}
.st-btn.small{min-height:32px;padding:0 12px;font-size:13px;border-radius:9px}
.st-btn.small .material-symbols-outlined{font-size:17px}
.st-btn.large{min-height:48px;padding:0 22px;font-size:15px;border-radius:14px}
.st-btn.block{width:100%}
.st-btn.icon{width:40px;min-width:40px;padding:0;border-radius:50%}
.st-btn.icon.small{width:32px;min-width:32px}
.st-btn.on{background:var(--st-cta);color:var(--st-on-cta);border-color:var(--st-cta)}
/* <a class="st-btn"> 的文字色：body.st-body a{color:inherit}（0,1,2）压得过 .st-btn（0,1,0）——首页空态的「上传教材」就是这样变成绿底灰字（实测对比度 1.14）、
   图标又被 .st-empty .material-symbols-outlined 染成绿色（对比度 1.0）。这里按变体逐条压回去，任何页面里的 <a> 按钮都不再靠父级颜色碰运气。 */
body.st-body a.st-btn{color:var(--st-on-cta)}
body.st-body a.st-btn.secondary{color:var(--st-ink)}
body.st-body a.st-btn.ghost{color:var(--st-primary)}
body.st-body a.st-btn.subtle{color:var(--st-text)}
body.st-body a.st-btn.danger{color:var(--st-danger)}
body.st-body a.st-btn.accent{color:var(--st-warn)}
.st-iconbtn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;border:0;background:transparent;color:var(--st-text);cursor:pointer}
.st-iconbtn:hover{background:var(--st-surface-3)}
.st-iconbtn.on{background:var(--st-primary-soft);color:var(--st-primary)}
.st-link{background:none;border:0;padding:0;color:var(--st-primary);font-weight:800;cursor:pointer;text-decoration:none}
.st-link:hover{text-decoration:underline}

/* ---------- Pills / status chips ---------- */
.st-pill{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:var(--st-radius-pill);background:var(--st-surface-2);color:var(--st-text);font-size:12px;font-weight:800;white-space:nowrap;line-height:1}
.st-pill .material-symbols-outlined{font-size:15px}
.st-pill.ok{background:var(--st-primary-soft);color:var(--st-primary)}
.st-pill.warn{background:var(--st-warn-soft);color:var(--st-warn)}
.st-pill.danger{background:var(--st-danger-soft);color:var(--st-danger)}
.st-pill.info{background:var(--st-info-soft);color:var(--st-info)}
.st-pill.accent{background:var(--st-accent-soft);color:var(--st-warn)}
.st-pill.outline{background:transparent;border:1px solid var(--st-border-strong)}
.st-pill.source{background:var(--st-primary-soft);color:var(--st-primary);border:1px solid rgba(47,107,71,.25)}
.st-pill.ai{background:var(--st-info-soft);color:var(--st-info);border:1px solid rgba(59,95,138,.22)}
.st-pill.unverified{background:var(--st-warn-soft);color:var(--st-warn);border:1px dashed rgba(138,109,31,.4)}

/* ---------- Cards ---------- */
.st-card{background:var(--st-surface);border:1px solid var(--st-border);border-radius:var(--st-radius-lg);padding:18px 20px;box-shadow:var(--st-shadow-soft)}
.st-card.flat{box-shadow:none;background:var(--st-surface-2);border-color:transparent}
.st-card.tight{padding:14px 16px}
.st-card.clickable{cursor:pointer;transition:border-color var(--st-transition),transform var(--st-transition),box-shadow var(--st-transition)}
.st-card.clickable:hover{border-color:rgba(47,107,71,.35);transform:translateY(-1px);box-shadow:var(--st-shadow-lift)}
.st-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;flex-wrap:wrap}
.st-card-head h2,.st-card-head h3{font-size:17px}
.st-card-foot{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:14px}
.st-kv{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;font-size:13px}
.st-kv dt{color:var(--st-muted);font-weight:700}
.st-kv dd{margin:0;color:var(--st-ink)}
.st-list{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none}
.st-list-item{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--st-border);border-radius:var(--st-radius);background:var(--st-surface);text-decoration:none;color:inherit;cursor:pointer;transition:border-color var(--st-transition),background var(--st-transition)}
.st-list-item:hover{border-color:rgba(47,107,71,.35);background:var(--st-primary-soft)}
.st-list-item .st-list-main{flex:1;min-width:0}
.st-list-item .st-list-title{font-weight:800;color:var(--st-ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.st-list-item .st-list-sub{font-size:12.5px;color:var(--st-muted);margin-top:2px}
.st-list-item .material-symbols-outlined.lead{color:var(--st-primary);font-size:22px;flex:none}

/* book cards */
.st-bookgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:16px}
.st-bookcard{position:relative;display:flex;flex-direction:column;border:1px solid var(--st-border);border-radius:var(--st-radius-lg);background:var(--st-surface);box-shadow:var(--st-shadow-soft);overflow:hidden;cursor:pointer;text-decoration:none;color:inherit;transition:border-color var(--st-transition),transform var(--st-transition),box-shadow var(--st-transition)}
.st-bookcard:hover{border-color:rgba(47,107,71,.4);transform:translateY(-2px);box-shadow:var(--st-shadow-lift)}
.st-bookcover{position:relative;aspect-ratio:16/9;display:flex;align-items:flex-end;padding:14px;color:#fff;overflow:hidden}
.st-bookcover::after{content:"";position:absolute;inset:0;background:radial-gradient(120% 90% at 15% 0,rgba(255,255,255,.28),transparent 55%)}
.st-bookcover .glyph{position:absolute;right:-8px;top:-12px;font-size:96px;opacity:.22;font-variation-settings:"FILL" 1}
.st-bookcover .name{position:relative;z-index:2;font-family:var(--st-font-head);font-weight:700;font-size:16px;line-height:1.25;text-shadow:0 1px 8px rgba(0,0,0,.25);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.st-bookcover .badge{position:absolute;top:10px;right:10px;z-index:2;background:rgba(255,255,255,.88);color:#3d4a3f;font-size:11px;font-weight:900;padding:3px 8px;border-radius:7px}
.st-cover-0{background:linear-gradient(140deg,#5a8f68,#33573e)}
.st-cover-1{background:linear-gradient(140deg,#b0904e,#6d5626)}
.st-cover-2{background:linear-gradient(140deg,#7d9b8a,#456b57)}
.st-cover-3{background:linear-gradient(140deg,#b58a68,#7a4f38)}
.st-cover-4{background:linear-gradient(140deg,#6f93a3,#3f6373)}
.st-cover-5{background:linear-gradient(140deg,#9a7aa0,#5f4468)}
.st-bookbody{padding:14px 16px;display:flex;flex-direction:column;gap:8px;flex:1}
.st-bookbody h2,.st-bookbody h3,.st-bookbody h4{font-size:16px;line-height:1.3;margin:0}
.st-bookbody p{margin:0;font-size:13px;color:var(--st-muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
/* 卡片底部的一排控件（开始学习 / 加入·移出项目 / 详情）。
   ⚠ 这里**必须**能换行（Owner 复审 M-B）：.st-bookcard 是 overflow:hidden，一行放不下时超出的部分被直接裁掉 ——
     裁掉不是「难看」，是既看不见也点不到，功能当场不可达。
     实测（当前项目激活、卡片底部三个控件时）：390 宽「加入项目」被切掉 56px、详情按钮整个消失；
     820 宽详情越界 20px；连 1440 桌面都越界 37px，elementFromPoint 打不到它。
   不给 .st-btn 加 min-width:0：按钮文字是 nowrap 的，压到 min-content 以下只会让字溢出按钮框，
   宁可让整个按钮换到下一行 —— 换行是老实的，裁切不是。 */
.st-bookfoot{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:auto}
.st-bookfoot>*{max-width:100%}
.st-bookfoot .st-btn{flex:1 1 auto}                        /* 文字按钮平分整行；放不下就整颗换行 */
.st-bookfoot .st-iconbtn{flex:0 0 auto;margin-left:auto}   /* 图标按钮不参与压缩，且在所在那一行永远靠右 */
.st-bookcard.noText{border-color:rgba(179,38,30,.35)}
.st-bookcard.noText .st-bookcover{filter:grayscale(.55) opacity(.75)}

/* ---------- Progress ---------- */
.st-progress{position:relative;height:8px;border-radius:var(--st-radius-pill);background:var(--st-surface-3);overflow:hidden}
.st-progress>span{position:absolute;left:0;top:0;bottom:0;border-radius:inherit;background:var(--st-primary);transition:width .3s ease}
.st-progress.accent>span{background:var(--st-accent)}
.st-progress.thin{height:5px}
.st-progress-row{display:flex;align-items:center;gap:10px;font-size:12.5px;color:var(--st-muted)}
.st-progress-row .st-progress{flex:1}
.st-ring{--v:0;width:52px;height:52px;border-radius:50%;background:conic-gradient(var(--st-primary) calc(var(--v)*1%),var(--st-surface-3) 0);display:grid;place-items:center;flex:none}
.st-ring>b{width:40px;height:40px;border-radius:50%;background:var(--st-surface);display:grid;place-items:center;font-size:12px;font-weight:800;color:var(--st-ink)}

/* ---------- Inputs ---------- */
.st-field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:800;color:var(--st-ink)}
.st-field .hint{font-weight:500;color:var(--st-muted);font-size:12.5px}
.st-input,.st-select,.st-textarea{width:100%;min-height:42px;padding:0 12px;border:1px solid var(--st-border-strong);border-radius:var(--st-radius);background:var(--st-surface);color:var(--st-ink);font-size:14px;font-weight:500}
.st-textarea{padding:10px 12px;min-height:88px;resize:vertical;line-height:1.55}
.st-input:focus-visible,.st-select:focus-visible,.st-textarea:focus-visible{outline:2px solid var(--st-focus);outline-offset:1px;border-color:var(--st-primary)}
.st-input::placeholder,.st-textarea::placeholder{color:var(--st-faint)}
.st-search{display:flex;align-items:center;gap:8px;height:42px;padding:0 8px 0 14px;border:1px solid var(--st-border-strong);border-radius:var(--st-radius-pill);background:var(--st-surface);color:var(--st-muted)}
.st-search input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--st-ink);font-size:14px}
.st-search input:focus,.st-search input:focus-visible{outline:none;box-shadow:none}
.st-search:focus-within{border-color:var(--st-focus)}
.st-checkbox{display:flex;align-items:flex-start;gap:9px;font-weight:600;color:var(--st-text);font-size:13.5px;cursor:pointer}
.st-checkbox input{margin-top:3px;width:16px;height:16px;accent-color:var(--st-primary)}

/* ---------- Tabs / segmented ---------- */
.st-tabs{display:flex;gap:2px;border-bottom:1px solid var(--st-border);overflow-x:auto;scrollbar-width:none}
.st-tabs::-webkit-scrollbar{display:none}
.st-tab{border:0;background:transparent;padding:10px 14px;font-weight:800;color:var(--st-muted);cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap;font-size:14px}
.st-tab.active{color:var(--st-primary);border-bottom-color:var(--st-primary)}
.st-segment{display:inline-flex;background:var(--st-surface-2);border:1px solid var(--st-border);border-radius:12px;padding:3px;gap:3px;max-width:100%}
.st-segment button{border:0;background:transparent;min-height:32px;padding:0 12px;border-radius:9px;font-weight:800;font-size:13px;color:var(--st-muted);cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
.st-segment button .material-symbols-outlined{font-size:17px}
.st-segment button.on{background:var(--st-surface);color:var(--st-primary);box-shadow:var(--st-shadow-soft)}
.st-segment button:disabled{opacity:.45;cursor:not-allowed}

/* ---------- Empty / loading / error surfaces ---------- */
.st-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;padding:36px 20px;border:1px dashed var(--st-border-strong);border-radius:var(--st-radius-lg);background:var(--st-surface);color:var(--st-muted)}
.st-empty .material-symbols-outlined{font-size:40px;color:var(--st-primary)}
.st-empty b{color:var(--st-ink);font-size:16px;font-family:var(--st-font-head)}
.st-empty p{margin:0;max-width:520px;line-height:1.6}
.st-empty .st-row{justify-content:center}
.st-loading{display:flex;align-items:center;gap:10px;color:var(--st-muted);font-size:13.5px;padding:14px 0}
.st-spinner{width:18px;height:18px;border-radius:50%;border:2px solid var(--st-border-strong);border-top-color:var(--st-primary);animation:st-spin .8s linear infinite;flex:none}
@keyframes st-spin{to{transform:rotate(360deg)}}
.st-skeleton{position:relative;overflow:hidden;background:var(--st-surface-3);border-radius:8px;min-height:14px}
.st-skeleton::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);animation:st-shimmer 1.2s infinite}
@keyframes st-shimmer{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
.st-error{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:var(--st-radius);background:var(--st-danger-soft);color:var(--st-danger);border:1px solid rgba(179,38,30,.18);font-size:13.5px;line-height:1.5}
.st-error:empty{display:none}
.st-error .material-symbols-outlined{flex:none;font-size:20px}
.st-notice{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:var(--st-radius);background:var(--st-warn-soft);color:var(--st-warn);border:1px solid rgba(138,109,31,.18);font-size:13.5px;line-height:1.5}
.st-notice.info{background:var(--st-info-soft);color:var(--st-info);border-color:rgba(59,95,138,.18)}
.st-notice.ok{background:var(--st-primary-soft);color:var(--st-primary);border-color:rgba(47,107,71,.2)}
.st-notice .material-symbols-outlined{flex:none;font-size:20px}

/* ---------- Sheet (mobile bottom / desktop side) & modal & toast ---------- */
.st-overlay{position:fixed;inset:0;z-index:900;background:rgba(31,42,36,.42);backdrop-filter:blur(3px);display:flex;align-items:flex-end;justify-content:center;padding:0}
.st-overlay.center{align-items:center;padding:20px}
.st-overlay[hidden]{display:none}
.st-sheet{width:100%;max-height:88vh;background:var(--st-surface);border-radius:22px 22px 0 0;box-shadow:var(--st-shadow-lift);display:flex;flex-direction:column;overflow:hidden;animation:st-up .2s ease}
.st-sheet-grip{width:44px;height:5px;border-radius:999px;background:var(--st-border-strong);margin:10px auto 2px}
.st-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 18px 12px;border-bottom:1px solid var(--st-border)}
.st-sheet-head h3{font-size:16px}
.st-sheet-body{padding:16px 18px;overflow:auto;flex:1;min-height:0}
.st-sheet-foot{padding:12px 18px calc(12px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--st-border);display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
@keyframes st-up{from{transform:translateY(24px);opacity:.5}to{transform:none;opacity:1}}
.st-modal{width:min(560px,100%);max-height:88vh;background:var(--st-surface);border-radius:var(--st-radius-lg);box-shadow:var(--st-shadow-lift);display:flex;flex-direction:column;overflow:hidden;animation:st-up .18s ease}
.st-modal.wide{width:min(860px,100%)}
/* ── 项目上下文条（project-context.js 渲染；教材库 / 阅读页 / 备考页同一模块）── */
.projCtx{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 14px;border-radius:var(--st-radius);background:var(--st-surface-2);font-size:12.5px;color:var(--st-muted);margin-bottom:10px}
.projCtx[hidden]{display:none!important}
.projCtxName{font-weight:800;color:var(--st-ink)}
.projCtxCta{margin-left:auto;color:var(--st-primary);font-weight:800;text-decoration:none}

.st-toast-host{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:1200;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;width:min(520px,calc(100vw - 32px))}
.st-toast{pointer-events:auto;display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:var(--st-radius);background:var(--st-ink);color:#fff;font-size:13.5px;font-weight:600;box-shadow:var(--st-shadow-lift);max-width:100%;animation:st-up .18s ease}
.st-toast.ok{background:var(--st-primary)}
.st-toast.warn{background:var(--st-warn)}
.st-toast.danger{background:var(--st-danger)}
.st-toast .material-symbols-outlined{font-size:18px}

/* ---------- AI teacher header ---------- */
.st-teacher-head{display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:var(--st-radius-lg);background:linear-gradient(135deg,var(--st-primary-soft),var(--st-accent-soft));border:1px solid rgba(47,107,71,.16)}
.st-teacher-orb{width:40px;height:40px;border-radius:50%;background:var(--st-primary);color:#fff;display:grid;place-items:center;flex:none;box-shadow:var(--st-shadow-soft)}
.st-teacher-orb .material-symbols-outlined{font-size:22px;font-variation-settings:"FILL" 1}
.st-teacher-head b{display:block;font-family:var(--st-font-head);font-size:15px;color:var(--st-ink)}
.st-teacher-head span{display:block;font-size:12.5px;color:var(--st-muted);line-height:1.4}

/* ---------- Utilities ---------- */
.st-hide-mobile{display:initial}
.st-hide-desktop{display:none}
.st-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.st-nowrap{white-space:nowrap}
.st-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.st-badge-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--st-accent);margin-left:4px;vertical-align:middle}
.st-scroll-x{overflow-x:auto;-webkit-overflow-scrolling:touch}
.st-mt{margin-top:14px}
.st-mb{margin-bottom:14px}
.st-center{text-align:center}
.st-footer{padding:18px var(--st-gutter) calc(18px + env(safe-area-inset-bottom,0px));text-align:center;font-size:12px;color:var(--st-faint);line-height:1.6}
.st-footer a{color:var(--st-muted);text-decoration:none;margin:0 6px}

/* ---------- Responsive ---------- */
/* Figma 平板 / 手机 = 重排，不是缩小：全程没有 transform:scale。
   侧栏的紧凑形态是**基态**（见上面 sidebar 那一段），所以这里不再重复它的排版规则，
   只处理与侧栏无关的栅格收敛，以及 ≤767 把侧栏横过来当顶部条。 */
@media (max-width:1199px){
  .st-grid-main{grid-template-columns:1fr}
  .st-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
  :root{--st-gutter:18px}
}
@media (max-width:767px){
  :root{--st-gutter:14px}
  body.st-body{--st-sidebar-w:0px}
  .st-has-sidebar .st-app{padding-left:0}
  .st-sidebar{position:sticky;left:auto;right:auto;bottom:auto;top:0;width:auto;height:var(--st-mobilebar-h);flex-direction:row;align-items:center;gap:10px;padding:0 var(--st-gutter);border-right:0;border-bottom:1px solid var(--st-border);background:rgba(255,255,255,.96);backdrop-filter:blur(14px);overflow:visible}
  .st-sidebar-nav,.st-sidebar-ctx{display:none}
  .st-sidebar-top{flex:0 1 auto;flex-direction:row;gap:8px;min-width:0}
  .st-sidebar .st-brand{flex:0 1 auto;min-width:0;justify-content:flex-start}
  .st-sidebar .st-brand-text{display:block;min-width:0;overflow:hidden}
  .st-sidebar .st-brand b{font-size:15px;display:block}
  .st-sidebar .st-brand small{display:none}
  .st-sidebar-foot{margin-top:0;margin-left:auto;flex:0 1 auto;flex-direction:row;align-items:center;gap:6px;padding-top:0;border-top:0;min-width:0}
  .st-sidebar-foot .st-chip.st-quota,.st-sidebar-foot .st-langswitch{display:none}
  .st-sidebar-foot .st-chip.st-streak{max-width:none;height:34px;min-height:0;padding:0 10px;font-size:13px;white-space:nowrap}
  .st-sidebar-foot .st-avatar{width:auto;height:36px;padding:0 12px 0 4px;border-radius:var(--st-radius-pill);max-width:min(180px,40vw);justify-content:flex-start}
  .st-sidebar-foot .st-avatar .st-avatar-name{display:inline}
  .st-bottomnav{display:grid}
  .st-main{padding-bottom:calc(var(--st-bottomnav-h) + 24px + env(safe-area-inset-bottom,0px))}
  .st-footer{padding-bottom:calc(var(--st-bottomnav-h) + 14px + env(safe-area-inset-bottom,0px))}
  .st-grid-2,.st-grid-3{grid-template-columns:1fr}
  .st-hide-mobile{display:none!important}
  .st-hide-desktop{display:initial}
  .st-h1{font-size:23px}
  .st-h2{font-size:19px}
  .st-card{padding:14px 16px;border-radius:14px}
  .st-bookgrid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
  .st-bookcover .name{font-size:14px}
  .st-page-head{flex-direction:column;align-items:stretch}
  .st-toast-host{bottom:calc(var(--st-bottomnav-h) + 12px + env(safe-area-inset-bottom,0px))}
}

/* 手机竖屏的教材库收成一列：两列时每张卡只剩 ~140px 正文宽，底部三个控件要挤成三行，
   卡片高得离谱还不好按。一列 ~330px 正好一行放得下（Owner 复审 M-B 明确允许「必要时收成一列」）。
   只收教材库这一个网格：首页的教材条也用 .st-bookgrid，那里没有底部控件，不该跟着变。 */
@media (max-width:479px){
  #libGrid{grid-template-columns:1fr}
}
@media (min-width:768px){
  .st-overlay{align-items:center;padding:20px}
  .st-sheet{width:min(720px,100%);border-radius:var(--st-radius-lg);max-height:86vh}
  .st-sheet-grip{display:none}
}
