/* ahaslope-main.css
 * AhaSlope 主样式表
 * 包含：设计系统 tokens、组件样式、响应式布局
 * 修改时同步更新 Vercel 部署
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 */

/* ════════════════════════════════════════════════════════════════
   DESIGN SYSTEM — Modern soft (2026 重构，Light-first)
   Inter 单字面 · 8-16px 圆润圆角 · 品牌蓝主按钮 · 弥散柔和阴影 ·
   宽绰留白 · mono 仅保留给 code 与数据展示
   （旧 Together AI 风格已废除：mono-caps 按钮 / 4px 锐角 / 纯黑主按钮）
   ════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Core Palette (clean light) ───────────────────────────── */
  --bg:           #FFFFFF;
  --bg-2:         #FAFAFA;
  --bg-3:         #F4F4F3;
  --surface:      #FFFFFF;
  --surface-2:    #F7F7F6;
  --surface-3:    #EFEFEE;

  --border:       #EBEBEB;   /* Together "hairline" token */
  --border-s:     #D8D8D8;

  /* ── Ink (near-black) ──────────────────────────────────────── */
  --ink:          #000000;   /* Together {colors.primary} — pure black */
  --ink-soft:     #1A1A1A;

  /* ── Dark surfaces (used sparingly: code blocks, rare accents) ── */
  --canvas-dark:      #0B0B14;
  --surface-dark-soft:#26263A;
  --on-dark:          #FFFFFF;

  /* ── Accent — kept as a calm blue for interactive states,
     Together's gradient is reserved for the hero-band only ───── */
  --pri:          #2563EB;
  --pri-hover:    #1D4ED8;
  --pri-light:    #EFF4FE;
  --pri-glow:     rgba(37,99,235,.15);

  /* ── Brand gradient (Together signature — hero-scale only,
     never miniaturised, never reordered) ─────────────────────── */
  --grad-orange:      #FC4C02;
  --grad-magenta:     #EF2CC1;
  --grad-periwinkle:  #BDBBFF;
  --grad-mint:        #C8F6F9;
  --brand-gradient: linear-gradient(100deg, var(--grad-orange), var(--grad-magenta), var(--grad-periwinkle));

  /* ── Semantic ─────────────────────────────────────────────── */
  --amber:        #C2740A;
  --amber-light:  #FBF3E4;
  --green:        #0A8754;
  --green-light:  #E8F6EF;
  --red:          #D6453D;

  /* ── Text ─────────────────────────────────────────────────── */
  --text-1:       #000000;
  --text-2:       #6B6B68;
  --text-3:       #999999;  /* Together "body" secondary token */

  /* ── Shadow — hairlines do most of the elevation work;
     soft shadow reserved for floating elements only ──────────── */
  --sh-xs: 0 1px 2px rgba(0,0,0,.04);
  --sh-sm: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --sh-md: 0 8px 32px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.03);
  --sh-lg: 0 24px 64px rgba(0,0,0,.10), 0 8px 20px rgba(0,0,0,.05);
  --sh-float: 0px 4px 14px 0px rgba(1,1,32,.08);
  --sh-ring: 0 0 0 3px var(--pri-glow);   /* focus 态光环 */

  /* ── Type — twin-face system ──────────────────────────────────
     Display sans (Inter, ss01) carries every headline / body / link.
     Uppercase mono (JetBrains Mono) carries every label / button /
     eyebrow / table header. Never mix the two roles. ──────────── */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ── Type scale — 2026 放大版（正文 16px 基准）──
     To adjust globally: edit ONLY these tokens.
     Every font-size in the codebase references one of these. ── */
  --text-10:  11px;    /* micro: section eyebrows, small labels     */
  --text-11:  12px;    /* mini:  badges, timestamps, tag chips      */
  --text-12:  13px;    /* small: meta info, secondary labels        */
  --text-13:  15px;    /* sub:   sidebar items, captions            */
  --text-14:  16px;    /* body:  primary content, buttons           */
  --text-15:  17px;    /* lead:  card titles, insight text          */
  --text-16:  18px;    /* h4:    section headings                   */
  --text-17:  19px;    /* h3:    panel titles                       */
  --text-18:  20px;    /* h3+:   report section headings            */
  --text-20:  22px;    /* h2:    view titles                        */
  --text-22:  25px;    /* h1:    large headings                     */
  --text-24:  28px;    /* display-sm                                */
  --text-28:  32px;
  --text-32:  36px;
  --text-40:  44px;

  /* ── Semantic aliases (use these in components) ── */
  --text-label:   var(--text-10);  /* ALL CAPS section labels        */
  --text-badge:   var(--text-11);  /* badges, chips, tags            */
  --text-meta:    var(--text-12);  /* timestamps, meta info          */
  --text-caption: var(--text-13);  /* captions, sidebar, secondary   */
  --text-body:    var(--text-14);  /* primary reading text           */
  --text-ui:      var(--text-13);  /* UI controls, inputs, selects   */
  --text-card:    var(--text-15);  /* card / panel titles            */
  --text-section: var(--text-16);  /* section headings               */
  --text-page:    var(--text-22);  /* page / view titles（25px，拉开层级）*/

  /* ── Tracking：标签轻微正字距，展示级负字距 ── */
  --tracking-mono:    0.01em;   /* legacy alias，仅剩零星引用 */
  --tracking-display: -0.01em;

  /* ── Radius — 圆润现代（2026）：按钮/输入 8px，卡片 10-12px，
     模态等大容器 16px。--r-pill 仍只给悬浮圆形元素。 ──────────── */
  --r-xs:   6px;    /* 微元素：小标签、迷你芯片                    */
  --r-sm:   8px;    /* 按钮、badge、输入框                          */
  --r-md:   10px;   /* 列表项、小卡片                               */
  --r-lg:   12px;   /* 卡片、面板                                   */
  --r-xl:   16px;   /* 模态、大容器                                 */
  --r-2xl:  20px;   /* hero 级容器                                  */
  --r-full: 10px;   /* legacy alias                                 */
  --r-pill: 999px;  /* reserved: chat-launcher orb, avatars only    */

  /* ── Layout ───────────────────────────────────────────────── */
  --sidebar-w: 272px;
  --max-w: 1440px;
  --min-w: 1280px;

  /* ── Spacing tokens（放宽留白）────────────────────────────── */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  20px;
  --sp-lg:  32px;
  --sp-xl:  48px;
  --sp-2xl: 64px;

  /* ── Motion tokens ────────────────────────────────────────── */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: .15s;
  --dur-base: .25s;

  font-family: var(--font);
  font-feature-settings: "ss01" 1;
  font-size: var(--text-14);   /* = 16px — primary body */
  color: var(--text-1);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: var(--tracking-display);
}

/* ── 标签工具类（原 mono-caps，技术腔已废）：eyebrow / 表头 / badge ── */
.mono-caps {
  font-family: var(--font);
  letter-spacing: .01em;
  font-weight: 600;
}

/* body 不锁 min-width，让首页和登录页可以完全响应式 */
html, body { height: 100%; background: var(--bg-2); }
body:has(#auth-screen) { overflow: hidden; }

/* ════ APP SHELL ════════════════════════════════════════════════ */
/* .app 只用于 learn/dashboard，才需要 min-width 保护三栏布局 */
.app {
  display: flex; height: 100vh;
  width: 100%; min-width: var(--min-w);
  overflow: hidden;
  background: var(--bg);
}
/* 首页和生成页：解除 min-width，允许真正响应式 */
.app.view-home, .app.view-generating {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex-direction: column;
}
.app.view-home .main,
.app.view-generating .main {
  min-width: 0;
  overflow: visible;
  height: auto;
}

/* ════ SIDEBAR ══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: none;
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 11px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 28px; height: 28px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 22px; height: 22px; }
.logo-text { font-size: var(--text-card); font-weight: 700; letter-spacing: -.4px; color: var(--text-1); }
.logo-sub  { font-size: var(--text-badge); color: var(--text-3); margin-top: 2px; }

.sidebar-scroll {
  flex: 1; overflow-y: auto; padding: 12px 10px;
  scrollbar-width: none;          /* Firefox: 隐藏 */
}
.sidebar-scroll::-webkit-scrollbar { width: 0; background: transparent; }
.sidebar-scroll:hover { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.15) transparent; }
.sidebar-scroll:hover::-webkit-scrollbar { width: 3px; }
.sidebar-scroll:hover::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }

.sb-label {
  font-family: var(--font); font-size: var(--text-label); font-weight: 600; color: var(--text-3);
  letter-spacing: .01em;
  padding: 10px 10px 6px;
}

/* Course items */
.sb-course {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  cursor: pointer; user-select: none; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  margin-bottom: 2px; border: 1px solid transparent;
}
.sb-course:hover { background: var(--surface-2); }
.sb-course.active {
  background: var(--surface-2);
  border-color: var(--border);
}
.sb-course-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}
.sb-course-info { flex: 1; min-width: 0; }
.sb-course-name {
  font-size: var(--text-13); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-2); line-height: 1.35;
}
.sb-course.active .sb-course-name { color: var(--text-1); font-weight: 600; }
.sb-course-meta { font-size: var(--text-badge); color: var(--text-3); margin-top: 2px; }

/* Sub-nav */
.sb-subnav { padding: 2px 0 4px 18px; }
.sb-subnav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; font-size: var(--text-13); color: var(--text-3);
  transition: background .12s var(--ease-out), color .12s var(--ease-out), border-color .12s var(--ease-out), transform .12s var(--ease-out); user-select: none; margin-bottom: 1px;
}
.sb-subnav-item:hover { background: var(--surface-2); color: var(--text-1); }
/* 激活态只靠底色 + 字重 + 图标变色，不加左侧竖线，保持干净 */
.sb-subnav-item.active {
  color: var(--ink); font-weight: 600;
  background: var(--surface-2);
}
/* 线性 SVG 图标：尺寸在此控制，颜色经 currentColor 继承 .sb-subnav-item 的状态色 */
.sb-subnav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.sb-subnav-icon svg { width: 18px; height: 18px; display: block; }

.sb-divider { height: 1px; background: var(--border); margin: 8px 6px; }

/* ── 侧边栏收起（学习页）：68px 图标轨 ─────────────────────────
   展开态：logo 行 hover 时右侧浮现 panel 收起钮；
   收起态：wordmark 太长不显示，顶部只留一个较大的 panel 展开钮，
   下方是当前课程的视图图标 + New Course / History；课程行整体隐藏。
   宽度带缓动动画，收合优雅过渡。 */
.sidebar { transition: width .3s var(--ease-out); }
.sb-collapse-btn {
  width: 34px; height: 34px; border: none; background: transparent;
  border-radius: var(--r-sm); color: var(--text-3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0;
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  transition: opacity var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.sb-collapse-btn svg { width: 20px; height: 20px; }  /* 比 18px 的导航图标大一号 */
.sidebar-logo:hover .sb-collapse-btn { opacity: 1; background: var(--surface-2); }
.sb-collapse-btn:hover { color: var(--text-1); }

/* 固定底部导航：New Course / History 贴底，不随课程列表滚动 */
.sidebar-bottomnav {
  flex-shrink: 0; padding: 8px 10px;
  border-top: 1px solid var(--border);
}

/* width/img 用 !important：侧栏可拖拽调宽会写内联 width，logo img 自带
   内联 display:block——内联样式压过类规则，此处必须强制 */
.sidebar.collapsed { width: 68px !important; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 0 12px; }
.sidebar.collapsed .sidebar-logo img { display: none !important; }
/* 收起态：展开钮常驻居中（不再依赖 hover），就是顶部唯一的元素 */
.sidebar.collapsed .sb-collapse-btn {
  opacity: 1; position: static; transform: none;
}
.sidebar.collapsed .sb-collapse-btn:hover { background: var(--surface-2); color: var(--text-1); }
.sidebar.collapsed .sidebar-scroll { padding: 10px 8px; }
.sidebar.collapsed .sb-label { display: none; }
.sidebar.collapsed .sb-course { display: none; }   /* 课程行（含圆点）整体不展示 */
.sidebar.collapsed .sb-subnav { padding: 2px 0 4px; }
/* 文本是裸文本节点，用 font-size:0 隐藏；图标尺寸是固定 px 不受影响 */
.sidebar.collapsed .sb-subnav-item,
.sidebar.collapsed .sb-nav-item { justify-content: center; gap: 0; font-size: 0; padding: 10px 0; }
.sidebar.collapsed .sidebar-bottomnav { padding: 8px 7px; }
/* 收起态 footer：只留用户头像贴底居中，其余（进度/统计/额度）隐藏 */
.sidebar.collapsed .sidebar-footer { padding: 10px 0 14px; border-top: none; }
.sidebar.collapsed .sidebar-footer > *:not(.user-chip) { display: none; }
.sidebar.collapsed .user-chip { justify-content: center; padding: 0; background: transparent; border: none; margin: 0; }
.sidebar.collapsed .user-chip .user-email,
.sidebar.collapsed .user-chip .user-logout { display: none; }

.sb-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-md);
  cursor: pointer; font-size: var(--text-13); font-weight: 500;
  color: var(--text-2); transition: background .12s var(--ease-out), color .12s var(--ease-out), border-color .12s var(--ease-out), transform .12s var(--ease-out); user-select: none;
  margin-bottom: 2px;
}
.sb-nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.sb-nav-item.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
/* 线性 SVG 图标：颜色经 currentColor 继承（New Course 蓝 --pri / History 灰 --text-2） */
.sb-nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.sb-nav-icon svg { width: 18px; height: 18px; display: block; }

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-stats { display: flex; gap: 6px; margin-bottom: 12px; }
.sb-stat {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 4px; text-align: center;
}
.sb-stat-v { font-size: var(--text-body); font-weight: 700; line-height: 1; color: var(--text-1); }
.sb-stat-l { font-size: var(--text-label); color: var(--text-3); margin-top: 3px; }
.sb-provider {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.sb-provider-badge {
  font-family: var(--font); font-size: var(--text-badge); font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  border-radius: var(--r-sm); padding: 3px 10px;
  transition: opacity .12s; border: 1px solid var(--border);
}
.sb-provider-badge:hover { opacity: .8; }
.prog-label { font-size: var(--text-badge); color: var(--text-3); margin-bottom: 6px; }
.prog-bar { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--pri); border-radius: 2px; transition: width .5s; }

/* ════ MAIN ══════════════════════════════════════════════════════ */
.main { flex: 1; overflow: auto; background: var(--bg); display: flex; flex-direction: column; min-width: 0; }

/* ════ PRIMITIVES ════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--sh-xs);
}

.badge {
  display: inline-flex; align-items: center;
  border-radius: var(--r-sm); padding: 3px 10px;
  font-family: var(--font); font-size: var(--text-badge); font-weight: 600;
  letter-spacing: .01em;
}
.badge-pri   { background: var(--pri-light); color: var(--pri); border: 1px solid rgba(37,99,235,.25); }
.badge-aha   { background: var(--amber-light); color: var(--amber); border: 1px solid rgba(194,116,10,.2); }
.badge-gr    { background: var(--green-light); color: var(--green); border: 1px solid rgba(10,135,84,.2); }
.badge-gray  { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* ── Buttons（2026：Inter 正常大小写，品牌蓝主按钮，圆润）── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; border-radius: var(--r-sm);
  padding: 10px 22px;
  font-family: var(--font); font-size: var(--text-13); font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  line-height: 1.3; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
/* Primary: black（品牌蓝按钮试过太跳跃、抢内容——主按钮一律黑）*/
.btn-pri {
  background: var(--ink); color: #FFFFFF;
  box-shadow: none;
}
.btn-pri:hover { background: var(--ink-soft); box-shadow: var(--sh-sm); transform: translateY(-1px); }

/* CTA: same treatment as primary */
.btn-cta {
  background: var(--ink); color: #FFFFFF;
  box-shadow: none;
}
.btn-cta:hover { background: var(--ink-soft); box-shadow: var(--sh-md); transform: translateY(-1px); }

/* Ghost / secondary: outlined */
.btn-sec {
  background: transparent; color: var(--ink);
  border: 1px solid var(--border-s);
}
.btn-sec:hover { border-color: var(--ink); background: var(--surface-2); }

/* Ghost — quieter, body font (not a labeled action) */
.btn-ghost {
  background: transparent; color: var(--text-2); border: none;
  font-family: var(--font); text-transform: none; letter-spacing: var(--tracking-display);
  font-weight: 500; font-size: var(--text-13);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn:disabled { opacity: .35; cursor: default; pointer-events: none; }

/* ── Concept rows ─────────────────────────────────────────────── */
.concept-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface);
  border-radius: var(--r-lg); border: 1px solid var(--border);
  cursor: pointer; margin-bottom: 8px; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.concept-row:hover { border-color: var(--border-s); box-shadow: var(--sh-sm); transform: translateX(2px); }
.concept-row.locked { opacity: .4; cursor: default; }
.concept-icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: var(--text-body); flex-shrink: 0; }

/* ════ HOME ══════════════════════════════════════════════════════ */
.home-topbar {
  max-width: var(--max-w); margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px; box-sizing: border-box;
}
.home-brand { display: flex; align-items: center; gap: 9px; }
.home-brand-name { font-size: 19px; font-weight: 600; letter-spacing: -.3px; color: var(--ink); font-family: var(--font); }

/* hero 装饰背景图：桌面端按宽度等比缩放铺满 */
.home-hero-bg {
  position: absolute; top: 0; left: 0; right: 0; z-index: 0;
  pointer-events: none;
}
.home-hero-bg-img {
  position: absolute; top: 0; left: 0;
  width: 100%; height: auto;
  pointer-events: none; z-index: 0; display: block;
}
.home-wrap {
  max-width: 1440px; margin: 0 auto;
  padding: 64px 48px 56px;
  width: 100%;
  box-sizing: border-box;
  animation: fadeUp .35s ease;
}
/* hero 内容区单独限宽，居中对齐 */
.home-hero {
  text-align: center; margin-bottom: 48px;
  max-width: 900px; width: 100%;
  margin-left: auto; margin-right: auto;
}
.home-input-wrap {
  max-width: 900px; width: 100%;
  margin: 0 auto 16px;
}
.home-title {
  font-size: clamp(46px, 6vw, 66px); font-weight: 500;
  letter-spacing: -1.6px; line-height: 1.06;
  color: var(--ink); margin-bottom: 18px;
}
.home-title span { color: var(--pri); }
.home-sub {
  font-size: var(--text-16); color: var(--text-2);
  line-height: 1.75; max-width: 560px; margin: 0 auto;
}

/* Input bar — hairline surface, 4px radius (was glass-blur pill) */
.input-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-xl); padding: 14px 18px;
  box-shadow: var(--sh-xs);
  margin-bottom: 16px;
  transition: border .15s, box-shadow .15s;
}
.input-bar:focus-within {
  border-color: var(--pri);
  box-shadow: var(--sh-ring);
}
.input-icon { color: var(--text-3); flex-shrink: 0; }

/* 附件 + 按钮 */
.attach-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s; user-select: none;
}
.attach-btn:hover { background: var(--surface-2); }
.attach-btn.active { background: var(--surface-2); }

/* 来源预览标签 */
.source-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--text-meta); color: var(--text-2); margin-bottom: 10px;
  animation: fadeUp .2s ease;
}
.source-chip-icon { font-size: var(--text-body); }
.source-chip-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.source-chip-remove { cursor: pointer; color: var(--text-3); font-size: var(--text-caption); padding: 0 2px; border-radius: 3px; }
.source-chip-remove:hover { color: var(--red); background: var(--surface-3); }

/* 附件菜单 */
.attach-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-md);
  width: 220px; z-index: 100; overflow: hidden;
  animation: fadeUp .15s ease;
}
.attach-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer; font-size: var(--text-body);
  color: var(--text-1); transition: background .1s;
}
.attach-menu-item:hover { background: var(--surface-2); }
.attach-menu-item-icon { font-size: var(--text-section); width: 20px; text-align: center; flex-shrink: 0; }
.attach-menu-item-sub { font-size: var(--text-badge); color: var(--text-3); margin-top: 1px; }
.home-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: var(--text-16); font-family: var(--font); color: var(--text-1);
}
.home-input::placeholder { color: var(--text-3); }

/* 历史课程主题下拉（替代浏览器自己瞎猜的账号密码自动填充） */
.topic-history-menu {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-md);
  z-index: 100; overflow: hidden;
  animation: fadeUp .15s ease;
}
.topic-history-label {
  padding: 9px 14px 5px; font-size: var(--text-badge);
  color: var(--text-3); font-weight: 600; letter-spacing: .3px;
}
.topic-history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; font-size: var(--text-body);
  color: var(--text-1); transition: background .1s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topic-history-item:hover { background: var(--surface-2); }
.topic-history-item-icon { color: var(--text-3); flex-shrink: 0; }

/* Chips — single-row infinite scroll marquee (hairline outline, 4px radius) */
.chips-wrap {
  max-width: 900px; width: 100%;
  margin: 0 auto 8px;
  /* 容器宽度与输入框对齐(900px)，轨道内容用遮罩在左右边缘渐隐，
     视觉上形成"无限延伸"的跑马灯效果，而不需要打破整体居中布局 */
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
}
.chips-track {
  display: flex; gap: 8px; flex-wrap: nowrap; width: max-content;
  animation: chipsScroll 32s linear infinite;
}
.chips-wrap:hover .chips-track { animation-play-state: paused; }
@keyframes chipsScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.chip {
  background: var(--surface);
  border: 1px solid var(--border-s);
  border-radius: var(--r-sm); padding: 7px 16px;
  font-size: var(--text-13); color: var(--text-2);
  cursor: pointer; user-select: none; transition: background .15s, color .15s, border-color .15s;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
  white-space: nowrap; flex-shrink: 0;
}
.chip:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Protocol warning */
.proto-warn {
  background: var(--amber-light);
  border: 1px solid rgba(194,116,10,.2);
  border-left: 3px solid var(--amber);
  border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 24px; text-align: left;
}

/* ── Recent courses grid ─────────────────────────────────────── */
.recent-label {
  font-family: var(--font); font-size: var(--text-11); font-weight: 600; color: var(--text-3);
  letter-spacing: .01em;
  margin-bottom: 16px; padding-top: 40px;
}
.courses-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 4px; }

/* Course card — 悬停轻浮起 + 弥散阴影（2026 柔和质感）*/
.course-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); overflow: hidden;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
  box-shadow: none; position: relative;
}
.course-card:hover { box-shadow: var(--sh-md); border-color: var(--border-s); transform: translateY(-2px); }
.course-card-header {
  height: 116px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.course-card-mark {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  background: rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.course-card-body { padding: 18px 20px 20px; }
.cc-subject { font-size: var(--text-15); font-weight: 700; margin-bottom: 5px; color: var(--text-1); line-height: 1.3; }
.cc-desc { font-size: var(--text-13); color: var(--text-2); line-height: 1.5; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-footer { display: flex; align-items: center; justify-content: space-between; }
.cc-prog-wrap { flex: 1; margin-right: 10px; }
.cc-prog-bar { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.cc-prog-fill { height: 100%; background: var(--ink); border-radius: 2px; }
.cc-pct { font-size: var(--text-badge); color: var(--text-3); white-space: nowrap; font-weight: 600; }
.cc-aha { font-size: var(--text-badge); color: var(--amber); font-weight: 600; margin-top: 6px; }

/* Features row */
.features-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px;
  transition: border .15s;
}
.feature-card:hover { border-color: var(--border-s); }
.feature-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.feature-icon svg { width: 40px; height: 40px; }
.feature-title { font-size: var(--text-15); font-weight: 700; margin-bottom: 7px; color: var(--text-1); }
.feature-desc { font-size: var(--text-13); color: var(--text-2); line-height: 1.65; }

/* ════ GENERATING ════════════════════════════════════════════════ */
.gen-wrap { max-width: 520px; margin: 80px auto 0; padding: 0 32px; animation: fadeUp .3s ease; }
.gen-step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; font-size: var(--text-body); color: var(--text-3);
  line-height: 1.5; border-bottom: 1px solid var(--border);
}
.gen-step:last-child { border-bottom: none; }
.gen-step.done  { color: var(--green); }
.gen-step.active{ color: var(--text-1); font-weight: 500; }
.sd { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sd.done   { background: var(--green); }
.sd.active { background: var(--ink); animation: pulse 1s infinite; }
.sd.wait   { background: var(--surface-3); }

/* ════ DASHBOARD ════════════════════════════════════════════════ */
.dash-wrap { padding: 0 40px 36px; max-width: 1080px; margin: 0 auto; width: 100%; }
.dash-header { margin-bottom: 24px; padding-top: 4px; }
.dash-title { font-size: var(--text-24); font-weight: 700; letter-spacing: -.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-1); }
.dash-desc { font-size: var(--text-15); color: var(--text-2); line-height: 1.7; margin-bottom: 20px; }
/* 内联编辑：空值时显示 placeholder */
.dash-desc[data-empty="1"]::before,
.dash-desc:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  pointer-events: none;
}
/* 编辑提示光标 */
[contenteditable="true"]:hover { cursor: text; }
[contenteditable="true"]:focus { cursor: text; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 20px; box-shadow: var(--sh-xs);
  display: flex; gap: 16px; align-items: center;
}
.metric-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.metric-icon svg { width: 22px; height: 22px; }
.metric-val { font-size: var(--text-24); font-weight: 800; line-height: 1; }
.metric-sub { font-size: var(--text-12); color: var(--text-3); margin-top: 3px; }

.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }

/* ════ LEARN ════════════════════════════════════════════════════ */
.learn-layout { display: flex; height: 100%; overflow: hidden; }
.lesson-area { flex: 1; padding: 40px 44px; overflow-y: auto; }
.lesson-inner { max-width: 680px; }  /* 字号放大后同步放宽，保持 ~68ch 舒适行宽 */

.insight-box {
  background: var(--amber-light);
  border: 1px solid rgba(194,116,10,.18);
  border-left: 3px solid var(--amber);
  border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 18px;
}
.insight-label { font-family: var(--font); font-size: var(--text-label); font-weight: 600; color: var(--amber); margin-bottom: 8px; letter-spacing: .01em; }
.insight-text  { font-size: var(--text-15); color: var(--text-2); line-height: 1.9; }

.project-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink);
  border-radius: var(--r-md); padding: 16px 18px;
}
.project-label { font-family: var(--font); font-size: var(--text-label); font-weight: 600; color: var(--ink); margin-bottom: 8px; letter-spacing: .01em; }
.project-text  { font-size: var(--text-15); color: var(--text-2); line-height: 1.85; margin-bottom: 14px; }

.code-preview { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 18px; box-shadow: var(--sh-xs); }
.code-preview-bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.traffic-dot { width: 10px; height: 10px; border-radius: 50%; }
.code-preview-body { padding: 14px 18px; overflow-y: auto; overflow-x: auto; max-height: 92px; }
pre.code-block { font-family: var(--mono); font-size: var(--text-caption); line-height: 1.75; white-space: pre; }

/* ── Chat panel ─────────────────────────────────────────────── */
.chat-panel {
  width: var(--chat-w, 360px);
  min-width: 360px;
  max-width: 600px;
  background: var(--bg-2);
  border-left: none;
  display: flex; flex-direction: column;
  flex-shrink: 0;
  position: relative;
}
.chat-panel::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  cursor: col-resize; z-index: 10;
  background: var(--border);
  transition: background .12s;
}
.chat-panel:hover::before { background: var(--border-s); }
.chat-panel.chat-resizing::before { background: var(--pri); opacity: .6; }
#sandbox-chat { height: 100%; }
#sandbox-chat .chat-panel { height: 100%; border-left: none; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; background: var(--surface); }
.chat-body { flex: 1; padding: 16px; overflow-y: auto; }
.chat-body::-webkit-scrollbar { width: 0; background: transparent; }
.chat-body:hover { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.12) transparent; }
.chat-body:hover::-webkit-scrollbar { width: 3px; }
.chat-body:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }
/* ── 聊天消息（Notion 风格，2026-07）──────────────────────────
   AI 回复不装气泡：无底无框、左右撑满，只保留行距呼吸感；
   用户消息保留气泡但改白底深字；AI 头像整体隐藏（无需改渲染 JS）。 */
.msg { margin-bottom: 18px; }
.msg-u { display: flex; justify-content: flex-end; }
.msg-a { display: flex; align-items: flex-start; }
.msg-a > div:last-child { flex: 1; min-width: 0; }
/* 用户气泡：浅蓝底（与课程页 Build Steps 卡同源），和白底 AI 正文/选项按钮明确区分 */
.bub-u { background: var(--pri-light); border: 1px solid rgba(37,99,235,.14); border-radius: var(--r-lg); padding: 11px 16px; font-size: var(--text-13); line-height: 1.8; max-width: 80%; color: var(--text-1); }
.bub-a { background: transparent; border: none; border-radius: 0; padding: 0; font-size: var(--text-13); line-height: 1.85; max-width: 100%; width: 100%; color: var(--text-1); box-shadow: none; }
.ai-av { display: none; }
.chat-foot { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.hint-bar { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.hint { font-family: var(--font); font-size: var(--text-10); font-weight: 600; letter-spacing: .01em; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 11px; color: var(--text-2); cursor: pointer; transition: background .12s var(--ease-out), color .12s var(--ease-out), border-color .12s var(--ease-out), transform .12s var(--ease-out); user-select: none; }
.hint:hover { border-color: var(--ink); color: var(--ink); }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-ta {
  flex: 1; background: var(--surface); border: 1px solid var(--border-s);
  border-radius: var(--r-lg); padding: 10px 13px;
  font-size: var(--text-13); font-family: var(--font);
  resize: none; outline: none; line-height: 1.7;
  min-height: 76px; max-height: 200px; overflow-y: auto;
  transition: border .12s; color: var(--text-1);
}
.chat-ta:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0,0,0,.04); }
.chat-send { align-self: flex-end; width: 40px; height: 40px; padding: 0; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-md) !important; }

/* ════ PRACTICE ═════════════════════════════════════════════════ */
.practice-layout { display: flex; height: 100%; overflow: hidden; }
.task-col { width: 260px; background: var(--bg-2); border-right: 1px solid var(--border); padding: 20px; overflow-y: auto; flex-shrink: 0; }
.editor-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.code-editor { flex: 1; background: var(--bg-2); border: none; color: var(--text-1); font-size: var(--text-body); line-height: 1.8; padding: 18px 20px; resize: none; outline: none; font-family: var(--mono); min-height: 0; tab-size: 4; }
.text-editor { flex: 1; background: var(--surface); border: none; font-size: var(--text-15); line-height: 1.9; padding: 28px 32px; resize: none; outline: none; font-family: var(--font); min-height: 0; color: var(--text-1); }
.terminal { height: 200px; background: var(--bg-2); border-top: 1px solid var(--border); display: flex; flex-direction: column; }
.term-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.term-out { flex: 1; margin: 0; padding: 12px 18px; font-size: var(--text-caption); color: var(--green); line-height: 1.7; overflow-y: auto; font-family: var(--mono); white-space: pre-wrap; word-break: break-word; }
.term-out.idle { color: var(--text-3); }
.term-out.err  { color: var(--red); }

/* Lang selector */
/* ── Interactive Explorer ── */
.interactive-frame { width: 100%; border: none; border-radius: var(--r-md); background: #fff; display: block; }
.interactive-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 16px; box-shadow: var(--sh-xs); }
.interactive-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ix-feedback { background: var(--pri-light); border: 1px solid rgba(37,99,235,.2); border-left: 3px solid var(--pri); border-radius: var(--r-md); padding: 14px 18px; margin: 0 0 14px; font-size: var(--text-caption); line-height: 1.75; color: var(--text-1); }
.ix-feedback-label { font-size: var(--text-label); font-weight: 700; color: var(--pri); margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }

/* ════ COVER IMAGE ═══════════════════════════════════════════ */
.cover-wrap {
  position: relative; width: 100%; height: 220px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden; margin-bottom: 28px;
  background: var(--surface-2); cursor: default;
}
.cover-overlay {
  position: absolute; inset: 0; pointer-events: none;
}
.cover-overlay button,
.cover-overlay a { pointer-events: auto; }
.cover-empty {
  width: 100%; height: 56px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(135deg, var(--pri-light), var(--surface-2));
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 16px; margin-bottom: 20px;
}
.ix-feedback-label { font-size: var(--text-label); font-weight: 700; color: var(--pri); margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }

/* ════ TEACHING STATE CLASSES ════════════════════════════════ */
/* 教学状态语义 class — 全局复用，不用内联 color */
.state-mastered  { color: var(--green); }
.state-inprogress{ color: var(--pri); }
.state-aha       { color: var(--amber); }
.state-locked    { color: var(--text-3); }

/* ════ LESSON CONTENT BLOCKS ═════════════════════════════════ */
/* 三层表达 + 顿悟 + 为什么 的统一区块样式，替代 renderLearn 里的内联样式 */

/* 直觉层 — 温暖琥珀色，直觉感知 */
.lesson-block {
  border-radius: var(--r-md);
  padding: var(--sp-md) 18px;
  margin-bottom: var(--sp-md);
  border-left: 3px solid transparent;
}
.lesson-block--label {
  font-family: var(--font); font-size: var(--text-label); font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: var(--sp-sm);
}
.lesson-block--text {
  font-size: var(--text-15); line-height: 1.9; /* lesson body — max readability */
}

/* 直觉层 */
.lesson-block--intuition {
  background: var(--amber-light);
  border-color: var(--amber);
  border: 1px solid rgba(194,116,10,.18);
  border-left: 3px solid var(--amber);
}
.lesson-block--intuition .lesson-block--label { color: var(--amber); }
.lesson-block--intuition .lesson-block--text  { color: #5c5c6e; }

/* 机制层 */
.lesson-block--mechanism {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink);
}
.lesson-block--mechanism .lesson-block--label { color: var(--ink); }
.lesson-block--mechanism .lesson-block--text  { color: var(--text-2); font-size: var(--text-15); }

/* 为什么需要它 */
.lesson-block--why {
  background: var(--amber-light);
  border-left: 3px solid var(--amber);
}
.lesson-block--why .lesson-block--label { color: var(--amber); }
.lesson-block--why .lesson-block--text  { color: var(--text-2); font-size: var(--text-15); }

/* 顿悟问题 */
.lesson-block--aha {
  background: linear-gradient(135deg, var(--amber-light) 0%, var(--pri-light) 100%);
  border: 1px solid rgba(37,99,235,.15);
  border-left: 3px solid var(--pri);
}
.lesson-block--aha .lesson-block--label { color: var(--pri); }
.lesson-block--aha .lesson-block--text  { color: var(--text-1); font-size: var(--text-15); font-weight: 500; line-height: 1.7; }

/* 动手构建 */
.lesson-block--build {
  background: var(--pri-light);
  border: 1px solid rgba(37,99,235,.2);
  border-left: 3px solid var(--pri);
}
.lesson-block--build .lesson-block--label { color: var(--pri); }
.lesson-block--build .lesson-block--text  { color: var(--text-2); }

/* 构建步骤列表 */
.build-steps { margin: var(--sp-sm) 0 var(--sp-md); }
.build-step  { display: flex; gap: 10px; align-items: flex-start; margin-bottom: var(--sp-sm); }
.build-step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pri); color: #fff;
  font-size: var(--text-badge); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.build-step-text { font-size: var(--text-body); color: var(--text-2); line-height: 1.65; }

/* ════ FINAL PROJECT BANNER ══════════════════════════════════ */
/* 终点作品牵引 banner — Dashboard 顶部 */
.fp-banner {
  background: linear-gradient(135deg, var(--pri-light) 0%, #f0f9ff 100%);
  border: 1px solid rgba(37,99,235,.3);
  border-radius: var(--r-lg);
  padding: var(--sp-md) 20px;
  margin-bottom: var(--sp-md);
  display: flex; align-items: flex-start; gap: 14px;
}
.fp-banner-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: rgba(37,99,235,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-20); flex-shrink: 0;
}
.fp-banner-label {
  font-family: var(--font); font-size: var(--text-label); font-weight: 600; color: var(--pri);
  letter-spacing: .01em; margin-bottom: 4px;
}
.fp-banner-title {
  font-size: var(--text-15); font-weight: 700;
  color: var(--text-1); line-height: 1.3; margin-bottom: 6px;
}
.fp-banner-items {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.fp-banner-item {
  font-size: var(--text-badge); color: var(--pri);
  background: rgba(43,108,176,.1);
  border-radius: var(--r-sm);
  padding: 2px 10px;
}

/* ════ GEN PHASES ════════════════════════════════════════════ */
/* 两阶段生成进度 */
.gen-phase {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: var(--text-caption); color: var(--text-3); margin-bottom: 4px;
}
.gen-phase.done   { color: var(--green); background: var(--green-light); }
.gen-phase.active { color: var(--pri);   background: var(--pri-light);   font-weight: 500; }
.gen-phase.wait   { color: var(--text-3); }
.gen-phase-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: currentColor; }

/* 精品课标签筛选 */
.featured-tag-chip {
  font-size: var(--text-meta); padding: 5px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-s); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); font-family: var(--font);
}
.featured-tag-chip:hover { border-color: var(--text-2); color: var(--text-1); }
.featured-tag-chip.active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}

/* 费曼测试模式样式 */

/* ════ CHAT CHOICE OPTIONS ═══════════════════════════════════ */
.chat-choice-group { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-choice-hint  { font-size: var(--text-badge); color: var(--text-3); margin-bottom: 2px; }
/* 选项（Notion 风）：淡边框 + 柔和阴影，hover 只轻抬不泼色 */
.chat-choice-btn   {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-1);
  font-size: var(--text-caption); text-align: left; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.chat-choice-btn:hover { border-color: var(--border-s); background: var(--surface-2); box-shadow: 0 2px 6px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04); }
.chat-choice-btn.selected { border-color: var(--pri); background: var(--pri-light); color: var(--pri); font-weight: 500; }
.chat-choice-key   {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-badge); font-weight: 600; flex-shrink: 0;
  color: var(--text-2);
}

/* ════ RESIZE HANDLES ════════════════════════════════════════ */
.resize-handle {
  width: 1px; flex-shrink: 0; cursor: col-resize;
  background: var(--border); position: relative;
  z-index: 10; transition: background .15s; user-select: none; overflow: visible;
}
.resize-handle::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: -5px; right: -5px; cursor: col-resize;
}
.rh-dot { display: none; }
.resize-handle:hover  { background: var(--border-s); }
.resize-handle.dragging { background: var(--border-s); }

.chat-panel::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
  cursor: col-resize; z-index: 10; background: var(--border); transition: background .15s;
}
.chat-panel:hover::before       { background: var(--border-s); }
.chat-panel.chat-resizing::before { background: var(--border-s); }
/* ── Sandbox Extras ── */
.lang-select { background: var(--surface); border: 1px solid var(--border-s); border-radius: var(--r-sm); padding: 4px 10px; font-size: var(--text-12); font-family: var(--font); outline: none; cursor: pointer; color: var(--text-1); }
.lang-select:focus { border-color: var(--ink); }
.lang-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-sm); padding: 3px 10px; font-family: var(--font); font-size: var(--text-badge); font-weight: 600; letter-spacing: .01em; }
.exec-notice { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 16px; margin: 0 0 1px; font-size: var(--text-13); line-height: 1.55; color: var(--text-2); }

/* ════ MAP ══════════════════════════════════════════════════════ */
.map-wrap { padding: 36px 40px; display: flex; flex-direction: column; align-items: center; }

/* ════ HISTORY ══════════════════════════════════════════════════ */
.history-wrap { padding: 36px 40px; max-width: 900px; margin: 0 auto; width: 100%; }

/* ════ REPORT ═══════════════════════════════════════════════════ */
.report-wrap { padding: 36px 40px; max-width: 860px; margin: 0 auto; width: 100%; }
.report-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 36px 40px; box-shadow: var(--sh-sm); line-height: 1.9; color: var(--text-2); font-size: var(--text-body); }
.report-body h1 { font-size: var(--text-24); font-weight: 700; letter-spacing: -.4px; color: var(--text-1); margin: 0 0 6px; }
.report-body h2 { font-size: var(--text-18); font-weight: 700; color: var(--text-1); margin: 32px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.report-body h3 { font-size: var(--text-16); font-weight: 600; color: var(--text-1); margin: 22px 0 10px; }
.report-body p  { margin: 0 0 16px; }
.report-body ul, .report-body ol { padding-left: 22px; margin: 0 0 16px; }
.report-body li { margin-bottom: 7px; }
.report-body blockquote { border-left: 3px solid var(--ink); padding: 10px 18px; margin: 16px 0; background: var(--surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; font-style: italic; }
.report-body strong { color: var(--text-1); font-weight: 600; }
.report-body hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.report-body code { font-family: var(--mono); font-size: var(--text-meta); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 6px; }
.aha-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--amber-light); border: 1px solid rgba(194,116,10,.2); border-radius: var(--r-sm); padding: 4px 12px; font-family: var(--font); font-size: var(--text-10); font-weight: 600; letter-spacing: .01em; color: var(--amber); margin: 4px 4px 4px 0; }

/* ════ REPORT COMPONENTS ════════════════════════════════════════ */
/* 统计卡片 [STATS] */
.rpt-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin: 18px 0 28px;
}
.rpt-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px;
}
.rpt-stat-label {
  font-family: var(--font); font-size: var(--text-badge); font-weight: 600; color: var(--text-3);
  letter-spacing: .01em; margin-bottom: 6px;
}
.rpt-stat-value {
  font-size: var(--text-22); font-weight: 700; color: var(--text-1);
  line-height: 1.2; margin-bottom: 4px; letter-spacing: -.3px;
}
.rpt-stat-sub {
  font-size: var(--text-badge); color: var(--text-3); line-height: 1.5;
}

/* 顿悟卡片 [AHA] */
.rpt-aha {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 18px 22px; margin: 16px 0;
}
.rpt-aha-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.rpt-aha-icon {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  background: var(--amber-light); color: var(--amber);
  border-radius: 6px; font-size: var(--text-caption); flex-shrink: 0;
}
.rpt-aha-title {
  font-size: var(--text-16); font-weight: 600; color: var(--text-1);
}
.rpt-aha-quote {
  font-size: var(--text-card); font-style: italic; color: var(--text-1);
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: 10px 14px; margin-bottom: 12px; line-height: 1.6;
}
.rpt-aha-why, .rpt-aha-impl {
  font-size: var(--text-body); color: var(--text-2); line-height: 1.7;
  margin-bottom: 8px;
}
.rpt-aha-why:last-child, .rpt-aha-impl:last-child { margin-bottom: 0; }
.rpt-label {
  display: inline-block; font-family: var(--font); font-size: var(--text-label); font-weight: 600;
  color: var(--text-3); letter-spacing: .01em;
  margin-right: 8px;
}

/* 洞见卡片 [INSIGHT] */
.rpt-insight {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--pri);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 16px 20px; margin: 14px 0;
}
.rpt-insight-num {
  font-family: var(--font); font-size: var(--text-label); font-weight: 600; color: var(--pri);
  letter-spacing: .01em; margin-bottom: 5px;
}
.rpt-insight-title {
  font-size: var(--text-16); font-weight: 600; color: var(--text-1);
  margin-bottom: 8px; line-height: 1.4;
}
.rpt-insight-body {
  font-size: var(--text-body); color: var(--text-2); line-height: 1.75;
}

/* ════ TOAST ════════════════════════════════════════════════════ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  background: var(--surface); border: 1px solid rgba(194,116,10,.25);
  border-left: 3px solid var(--amber); border-radius: var(--r-xl);
  padding: 16px 18px; max-width: 320px; box-shadow: var(--sh-lg);
  animation: slideIn .25s ease;
}

/* ════ SETTINGS MODAL ═══════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s var(--ease-out); backdrop-filter: blur(4px);
}
.settings-modal {
  background: var(--surface); border-radius: var(--r-xl);
  width: 580px; max-width: 96vw; max-height: 92vh;
  overflow-y: auto; box-shadow: var(--sh-lg);
  border: 1px solid var(--border);
  padding: 24px;
  animation: scaleIn .2s var(--ease-out);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-body { padding: 28px; }
.provider-card {
  border: 1.5px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 18px; margin-bottom: 10px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); position: relative; background: var(--surface);
}
.provider-card:hover { border-color: var(--border-s); background: var(--surface-2); }
.provider-card.selected { border-color: var(--pri); background: var(--pri-light); }
.provider-card .sel-dot { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-s); transition: background .12s var(--ease-out), color .12s var(--ease-out), border-color .12s var(--ease-out), transform .12s var(--ease-out); }
.provider-card.selected .sel-dot { background: var(--pri); border-color: var(--pri); }
.field-label { font-size: var(--text-13); font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: block; }
.field-input { width: 100%; background: var(--surface); border: 1.5px solid var(--border-s); border-radius: var(--r-md); padding: 10px 14px; font-size: var(--text-13); font-family: var(--font); outline: none; color: var(--text-1); }
.field-input:focus { border-color: var(--pri); box-shadow: var(--sh-ring); }
.model-select { width: 100%; background: var(--surface); border: 1.5px solid var(--border-s); border-radius: var(--r-md); padding: 10px 14px; font-size: var(--text-13); font-family: var(--font); outline: none; color: var(--text-1); cursor: pointer; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* FAB */
.fab { position: fixed; bottom: 24px; right: 24px; z-index: 800; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); border: none; box-shadow: var(--sh-md); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.fab:hover { box-shadow: var(--sh-lg); transform: translateY(-2px); }
.fab svg { stroke: #fff; }
.pvd-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-sm); padding: 3px 10px; font-family: var(--font); font-size: var(--text-badge); font-weight: 600; letter-spacing: .01em; cursor: pointer; }

/* Inline code */
code { font-family: var(--mono); font-size: var(--text-meta); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 6px; color: var(--pri); }

/* ════ 加载状态组件（批次3）══════════════════════════════════════
   .spinner  — 圆环旋转，跟随 currentColor，文案前缀用
   .dots-pulse — 三点呼吸，聊天等待回复
   .skeleton — 扫光占位条，列表加载用（配 .skeleton-card 组卡片）*/
.spinner {
  display: inline-block; width: 1em; height: 1em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -.15em;
  animation: spin .7s linear infinite; opacity: .75;
}
.dots-pulse { display: inline-flex; gap: 4px; align-items: center; }
.dots-pulse i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); animation: dotPulse 1.2s ease-in-out infinite;
}
.dots-pulse i:nth-child(2) { animation-delay: .18s; }
.dots-pulse i:nth-child(3) { animation-delay: .36s; }
@keyframes dotPulse { 0%,100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-3); border-radius: var(--r-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}

/* 动效可及性：用户偏好减少动画时全局关闭 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ════ ANIMATIONS ════════════════════════════════════════════════ */
@keyframes slideIn  { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }

/* ════ 庆祝动画（费曼测试通过弹窗）═════════════════════════════════ */
.celebrate-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 允许彩带飞溅到容器外，不被裁剪 */
  overflow: visible;
}
.celebrate-wrap .grad-cap {
  animation: capPop .7s cubic-bezier(.34, 1.56, .64, 1) .1s both;
  position: relative;
  z-index: 2;
}
@keyframes capPop {
  0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(8deg); opacity: 1; }
  80%  { transform: scale(.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

/* 彩带粒子基础样式（大小、动画曲线） */
.confetti {
  position: absolute;
  top: 50%; left: 50%;
  width: 14px;
  height: 5px;
  border-radius: 1.5px;
  opacity: 0;
  pointer-events: none;
  animation-name: confettiFly;
  animation-timing-function: cubic-bezier(.2, .6, .35, 1);
  animation-fill-mode: forwards;
  z-index: 1;
}
@keyframes confettiFly {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(.4); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); }
}

/* 12 片彩带：360° 均匀分布 + 每片独立的距离/大小/速度/延迟，制造自然爆发感 */
.confetti.c1  { background:#F5A623; --dx:   0px; --dy:-135px; --rot:285deg;  width:16px; animation-duration:1.6s; animation-delay:0.22s; }
.confetti.c2  { background:#2B8FD9; --dx:  68px; --dy:-115px; --rot:155deg;             animation-duration:1.3s; animation-delay:0.38s; }
.confetti.c3  { background:#5A8F3A; --dx: 118px; --dy: -68px; --rot:215deg;  width:13px; animation-duration:1.8s; animation-delay:0.28s; }
.confetti.c4  { background:#F5A623; --dx: 138px; --dy:   8px; --rot:-45deg;             animation-duration:1.45s; animation-delay:0.42s; }
.confetti.c5  { background:#2B8FD9; --dx: 108px; --dy:  72px; --rot:95deg;   width:17px; animation-duration:1.55s; animation-delay:0.3s; }
.confetti.c6  { background:#5A8F3A; --dx:  52px; --dy: 115px; --rot:-95deg;             animation-duration:1.25s; animation-delay:0.48s; }
.confetti.c7  { background:#F5A623; --dx:   8px; --dy: 140px; --rot:215deg;  width:14px; animation-duration:1.75s; animation-delay:0.26s; }
.confetti.c8  { background:#2B8FD9; --dx: -58px; --dy: 108px; --rot:-215deg;            animation-duration:1.4s; animation-delay:0.52s; }
.confetti.c9  { background:#5A8F3A; --dx:-122px; --dy:  62px; --rot:325deg;  width:15px; animation-duration:1.3s; animation-delay:0.36s; }
.confetti.c10 { background:#F5A623; --dx:-138px; --dy: -16px; --rot:65deg;              animation-duration:1.9s; animation-delay:0.22s; }
.confetti.c11 { background:#2B8FD9; --dx:-112px; --dy: -78px; --rot:-65deg;  width:13px; animation-duration:1.5s; animation-delay:0.4s; }
.confetti.c12 { background:#5A8F3A; --dx: -58px; --dy:-118px; --rot:-325deg;            animation-duration:1.65s; animation-delay:0.32s; }

/* ════ SCROLLBAR ════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-s); border-radius: 4px; }

/* ════ RESPONSIVE ════════════════════════════════════════════════ */
@media (max-width: 1400px) {
  :root { --sidebar-w: 248px; }
  .courses-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1280px) {
  .courses-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr 300px; }
  .chat-panel { width: 320px; }
}
@media (max-width: 900px) {
  .courses-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .home-wrap { padding: 36px 24px 40px; }
  .home-input-wrap, .chips-wrap { max-width: 100%; }
  .app.view-home .main, .app.view-generating .main { width: 100%; }
}
@media (max-width: 600px) {
  /* hero 背景图：手机端整体放大并居中（水平+垂直），
     上下留出呼吸空间，允许图形与标题自然重叠，无需刻意避让 */
  .home-hero-bg { height: 100vw; overflow: hidden; }
  .home-hero-bg-img { width: 130%; left: 50%; top: 50%; transform: translate(-50%, -50%); }

  .courses-grid { grid-template-columns: 1fr; gap: 12px; }
  .home-wrap { padding: 28px 16px 32px; }
  .home-title { font-size: clamp(32px, 9vw, 46px); }
  .home-sub { font-size: var(--text-14); }
  .chips-track { gap: 6px; }
  .chip { font-size: var(--text-meta); padding: 6px 12px; }
  .home-topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .recent-label { padding-top: 28px; }
  .features-row { grid-template-columns: 1fr; gap: 12px; }
  .input-bar { padding: 10px 14px; flex-wrap: wrap; }
  .home-input { font-size: var(--text-14); min-width: 0; }
  /* 生成按钮已改为 42px 图标方钮，窄屏下与输入框同行不再溢出，无需强制独占一行 */
}

/* ── Auth / Login Screen ── */
.auth-screen {
  position: fixed; inset: 0; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  z-index: 5000; padding: 20px;
  /* 登录页独立适配，不受 body min-width 影响 */
  min-width: 0 !important;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  width: 100%; max-width: 400px; padding: 40px 36px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 8px; }
.auth-logo-name { font-size: var(--text-22); font-weight: 700; letter-spacing: -.5px; color: var(--ink); }
.auth-sub { text-align: center; font-size: var(--text-13); color: var(--text-2); margin-bottom: 28px; line-height: 1.6; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; margin-bottom: 22px; }
.auth-tab { flex: 1; text-align: center; padding: 9px; border-radius: var(--r-sm); font-size: var(--text-13); font-weight: 600; cursor: pointer; color: var(--text-2); transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); user-select: none; }
.auth-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-xs); }
.auth-field { margin-bottom: 14px; }
.auth-label { font-size: var(--text-12); font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: block; }
.auth-input { width: 100%; background: var(--surface); border: 1.5px solid var(--border-s); border-radius: var(--r-md); padding: 11px 14px; font-size: var(--text-14); font-family: var(--font); outline: none; color: var(--text-1); transition: border .12s; }
.auth-input:focus { border-color: var(--pri); box-shadow: var(--sh-ring); }
.auth-btn { width: 100%; background: var(--ink); color: #fff; border: none; border-radius: var(--r-sm); padding: 13px; font-family: var(--font); font-size: var(--text-13); font-weight: 600; letter-spacing: .01em; cursor: pointer; margin-top: 8px; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.auth-btn:hover { background: var(--pri-hover); }
.auth-btn:disabled { opacity: .5; cursor: default; }
.auth-msg { font-size: var(--text-12); text-align: center; margin-top: 14px; line-height: 1.5; min-height: 16px; }
.auth-msg.err { color: var(--red); }
.auth-msg.ok { color: var(--green); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-3); font-size: var(--text-12); }

/* ── 登录页移动端适配 ─────────────────────────────────────────── */
@media (max-width: 480px) {
  /* 卡片从底部弹出（sheet 模式），更符合手机交互习惯） */
  .auth-screen { padding: 0; align-items: flex-end; }
  .auth-card {
    max-width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 32px 24px max(40px, env(safe-area-inset-bottom));
    box-shadow: var(--sh-lg);
    border-bottom: none;
  }
  /* 防止 iOS Safari 输入框自动缩放（字号需 ≥ 16px）*/
  .auth-input { font-size: 16px; padding: 13px 14px; } /* intentional: ≥16px prevents iOS auto-zoom */
  .auth-logo-name { font-size: var(--text-20); }
  .auth-sub { font-size: var(--text-meta); margin-bottom: 20px; }
  .auth-tab { font-size: var(--text-meta); padding: 8px; }
  .auth-btn { padding: 14px; font-size: var(--text-card); }
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-oauth { width: 100%; background: var(--surface); color: var(--text-1); border: 1px solid var(--border-s); border-radius: var(--r-sm); padding: 11px; font-size: var(--text-14); font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); font-family: var(--font); }
.auth-oauth:hover { border-color: var(--ink); background: var(--surface-2); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 10px; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--text-meta); font-weight: 700; flex-shrink: 0; }
.user-email { flex: 1; font-size: var(--text-12); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-logout { font-size: var(--text-badge); color: var(--text-3); cursor: pointer; padding: 3px 8px; border-radius: var(--r-sm); }
.user-logout:hover { color: var(--red); background: var(--surface-3); }

/* ── Account Menu (always visible) ── */
.acct-btn { position: fixed; top: 16px; right: 20px; z-index: 900; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: #fff; border: 2px solid var(--surface); box-shadow: var(--sh-md); display: flex; align-items: center; justify-content: center; font-size: var(--text-body); font-weight: 700; cursor: pointer; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.acct-btn:hover { box-shadow: var(--sh-lg); }
.acct-menu { position: fixed; top: 62px; right: 20px; z-index: 901; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 260px; overflow: hidden; animation: fadeUp .15s ease; }
.acct-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 11px; }
.acct-head-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--text-card); font-weight: 700; flex-shrink: 0; }
.acct-head-info { min-width: 0; }
.acct-head-email { font-size: var(--text-13); font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head-label { font-family: var(--font); font-size: var(--text-badge); font-weight: 600; letter-spacing: .01em; color: var(--text-3); margin-top: 1px; }
.acct-item { display: flex; align-items: center; gap: 10px; padding: 11px 18px; font-size: var(--text-13); color: var(--text-1); cursor: pointer; transition: background .12s; }
.acct-item:hover { background: var(--surface-2); }
.acct-item.danger:hover { color: var(--red); }
.acct-item-icon { width: 16px; text-align: center; color: var(--text-3); }
