:root {
  --ivory: #FAF9F5;
  --slate: #141413;
  --muted: #5E5D59;
  --soft: #3D3D3A;
  --card: #FFFFFF;
  --chip: #F0EEE6;
  --line: #E8E6DC;
  --border: #DEDCD1;
  --clay: #D97757;
  --clay-text: #B5552F;
  --clay-deep: #8F3F22;
  --clay-tint: #F7E8E0;
  --urgent-bg: #F7E3D8;
  --urgent: #A0441F;
  --on-dark: #FAF9F5;      /* 深色按钮上的字 */
  --ask-bg: #141413;
  --ask-text: #C2C0B6;
  --grab: #D1CFC5;
  --ring-track: #E8E6DC;
  --ring-text: #3D3D3A;
  --shadow: rgba(20, 20, 19, 0.12);
  --sans: 'Anthropic Sans', 'DM Sans', 'Noto Sans SC', system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --serif: 'Anthropic Serif', 'Source Serif 4', 'Noto Serif SC', Georgia, 'Times New Roman', Times, serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
/* 深色：跟随系统，或在设置里手动选 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ivory: #1F1E1D; --slate: #F0EEE6; --muted: #A6A39A; --soft: #D1CFC5; --card: #2A2927; --chip: #34332F;
    --line: #3A3935; --border: #44433F; --clay-text: #E8916F; --clay-deep: #F0A584; --clay-tint: #4A2F24;
    --urgent-bg: #4A2F24; --urgent: #F0A584; --on-dark: #1F1E1D; --ask-bg: #F0EEE6; --ask-text: #5E5D59;
    --grab: #55534E; --ring-track: #44433F; --ring-text: #F0EEE6; --shadow: rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ivory: #1F1E1D; --slate: #F0EEE6; --muted: #A6A39A; --soft: #D1CFC5; --card: #2A2927; --chip: #34332F;
  --line: #3A3935; --border: #44433F; --clay-text: #E8916F; --clay-deep: #F0A584; --clay-tint: #4A2F24;
  --urgent-bg: #4A2F24; --urgent: #F0A584; --on-dark: #1F1E1D; --ask-bg: #F0EEE6; --ask-text: #5E5D59;
  --grab: #55534E; --ring-track: #44433F; --ring-text: #F0EEE6; --shadow: rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ivory); color: var(--slate); font-family: var(--sans);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--clay-text); text-decoration: none; }
.hidden { display: none !important; }
.screen { min-height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* 顶栏 */
.top { padding: calc(20px + var(--safe-top)) 20px 12px; display: flex; align-items: flex-end; justify-content: space-between; }
.top .date { font-size: 13px; color: var(--muted); }
.top h1 { margin: 4px 0 0; font-family: var(--serif); font-weight: 500; font-size: 28px; }
.bar { padding: calc(12px + var(--safe-top)) 8px 10px; display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--border); background: var(--ivory); position: sticky; top: 0; z-index: 5; }
.bar h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 20px; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 22px; display: flex;
  align-items: center; justify-content: center; cursor: pointer; flex: none; }
.iconbtn.round { background: var(--card); border: 1px solid var(--border); }
.iconbtn svg { width: 22px; height: 22px; stroke: var(--slate); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 卡片 */
.content { flex: 1; padding: 4px 16px calc(100px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 18px; }
.card .head { display: flex; justify-content: space-between; align-items: baseline; }
.sub { font-size: 13px; color: var(--muted); }
.cap { font-size: 12px; color: var(--muted); }
.divider { height: 1px; background: var(--line); }
.today { flex-direction: row; align-items: center; gap: 14px; }
.badge-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--clay-tint); display: flex; align-items: center; justify-content: center; flex: none; }
.badge-ico svg { width: 22px; height: 22px; stroke: var(--clay-text); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.big { font-size: 16px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 12px; }
.left { width: 54px; flex: none; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 10px; background: var(--chip); }
.left b { font-size: 17px; font-weight: 700; }
.left span { font-size: 11px; color: var(--muted); }
.left.urgent { background: var(--urgent-bg); }
.left.urgent b { color: var(--urgent); }
.left.urgent span { color: var(--clay-deep); }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.t15 { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--slate); border: 0; text-align: left; cursor: pointer; }
.tile .v { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.empty { font-size: 14px; color: var(--muted); }

/* 底部问助手 */
.ask { position: fixed; left: 50%; transform: translateX(-50%); width: min(528px, calc(100% - 32px));
  bottom: calc(20px + var(--safe-bottom)); height: 56px; border-radius: 28px; background: var(--ask-bg); color: var(--on-dark);
  display: flex; align-items: center; gap: 12px; padding: 0 8px 0 20px; border: 0; cursor: pointer; }
.ask span { flex: 1; text-align: left; font-size: 15px; color: var(--ask-text); }
.ask i, .send { width: 40px; height: 40px; border-radius: 20px; background: var(--clay); display: flex; align-items: center; justify-content: center; flex: none; }
.ask svg, .send svg { width: 18px; height: 18px; stroke: #FFFFFF; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 聊天 */
/* 聊天页固定占满一屏：只有消息区滚动，输入框始终贴在底部（键盘弹出时随可视区域上移） */
.chat { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; min-height: 0; max-width: 560px; margin: 0 auto; overflow: hidden; }
.chat .bar { position: static; flex: none; }
body.lock { overflow: hidden; position: fixed; inset: 0; }
.chat .msgs { min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat .composer { flex: none; border-top: 1px solid var(--line); }
.chat.kb .composer { padding-bottom: 8px; }
.chat .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat .who b { font-size: 16px; }
.chat .title { border: 0; background: transparent; padding: 0; text-align: left; font-size: 16px; font-weight: 700; color: var(--slate);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; cursor: pointer; }
/* 关掉双击缩放（保留系统级捏合缩放），只有打开课件时恢复 */
body:not(.pdfmode) { touch-action: manipulation; }
.chat .model { align-self: flex-start; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted);
  border: 0; background: transparent; padding: 4px 0; cursor: pointer; min-height: 28px; }
.chat .model svg { width: 12px; height: 12px; stroke: var(--muted); fill: none; stroke-width: 2.2; }
.ring { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 86%; padding: 10px 14px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--ask-bg); color: var(--on-dark); border-radius: 18px 18px 4px 18px; max-width: 78%; }
.bubble.ai { align-self: flex-start; background: var(--card); border-radius: 18px 18px 18px 4px; }
.bubble.err { color: var(--urgent); }
.bubble b { font-weight: 700; }
.bubble .code { font-family: 'DM Mono', 'SF Mono', Menlo, monospace; font-size: 13px; background: var(--chip); padding: 1px 5px; border-radius: 6px; }
.working { align-self: flex-start; display: flex; align-items: center; gap: 8px; background: var(--card); padding: 10px 14px; border-radius: 18px; font-size: 13px; color: var(--muted); }
.spin { width: 14px; height: 14px; border-radius: 7px; border: 2px solid var(--line); border-top-color: var(--clay); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.composer { padding: 8px 12px calc(14px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; background: var(--ivory); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--border); background: var(--card); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--slate); color: var(--on-dark); border-color: var(--slate); font-weight: 600; }
.inrow { display: flex; align-items: flex-end; gap: 8px; }
.inrow textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; border-radius: 22px; border: 1px solid var(--border);
  background: var(--card); padding: 11px 16px; font-size: 16px; line-height: 1.4; }
.inrow .send { width: 44px; height: 44px; border-radius: 22px; border: 0; cursor: pointer; }
.inrow .send:disabled { opacity: 0.45; }

/* 底部面板 */
.scrim { position: fixed; inset: 0; background: rgba(20, 20, 19, 0.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto; background: var(--ivory); border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; }
.grab { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--grab); }
.sheet h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 18px; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.opt { min-height: 52px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); padding: 0 16px; display: flex;
  align-items: center; justify-content: space-between; font-size: 15px; font-weight: 500; cursor: pointer; text-align: left; }
.opt.on { border: 1.5px solid var(--clay); }
.opt svg { width: 20px; height: 20px; stroke: var(--clay-text); fill: none; stroke-width: 2.2; }
.linkbtn { min-height: 44px; border: 0; background: transparent; color: var(--clay-text); font-size: 14px; text-align: left; padding: 0; cursor: pointer; }
.seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--chip); }
.seg button { height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; color: var(--soft); cursor: pointer; }
.seg button.on { background: var(--card); font-weight: 700; color: var(--slate); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .l { display: flex; justify-content: space-between; font-size: 13px; }
.track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.track i { display: block; height: 6px; background: var(--clay); }
.boxbtn { min-height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); display: flex; align-items: center;
  justify-content: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.boxbtn svg { width: 18px; height: 18px; stroke: var(--clay-text); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.convitem { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); text-align: left; cursor: pointer; }

/* 课程 */
.tabs { padding: 4px 16px 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv b { font-weight: 600; white-space: nowrap; }
.lecs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lec { height: 56px; border-radius: 12px; background: var(--chip); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--slate); font-weight: 700; font-size: 15px; }
.lec small { font-size: 11px; font-weight: 400; color: var(--muted); }
a.card.tap { color: var(--slate); }
.card.today .chev svg, .chev svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dayrow { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.dayrow:first-of-type { border-top: 0; }
.dayrow.today .dayname { color: var(--clay-text); font-weight: 700; }
.dayname { width: 36px; flex: none; font-size: 14px; padding-top: 8px; }
.dayrow .grow { gap: 6px; }
.slot { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 10px; background: var(--chip); color: var(--slate); font-size: 14px; }
.slot b { font-weight: 600; white-space: nowrap; }
.datehead { margin-top: 6px; }
.ann { gap: 6px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.annbody { font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
a.boxbtn { color: var(--slate); }
.lec { position: relative; }
.lec.saved::after { content: ''; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 4px; background: var(--clay); }
.bar h1.grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }
.iconbtn:disabled { opacity: 0.4; }
.pdfpages { flex: 1; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--chip); }
.pdfpage { width: 100%; max-width: 900px; background: #FFFFFF; box-shadow: 0 1px 3px var(--shadow); }
.pdfpage canvas { display: block; width: 100%; height: auto; }
.pdfstatus { padding: 24px 8px; text-align: center; }
.pill { padding: 4px 10px; border-radius: 10px; background: var(--urgent-bg); color: var(--clay-deep); font-size: 12px; font-weight: 500; white-space: nowrap; }

/* 登录 */
.login { justify-content: center; padding: 24px; gap: 20px; }
.login h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 30px; }
.login input { height: 52px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); padding: 0 16px; font-size: 16px; width: 100%; }
.login button { height: 52px; border-radius: 26px; border: 0; background: var(--slate); color: var(--on-dark); font-size: 16px; font-weight: 500; cursor: pointer; }
.login .msg { min-height: 20px; font-size: 14px; color: var(--urgent); }
.sr { position: absolute; left: -9999px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(16px + var(--safe-top)); background: var(--slate); color: var(--on-dark);
  padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 30; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.toastbtn { border: 0; background: transparent; color: var(--clay); font-weight: 700; font-size: 14px; padding: 0; cursor: pointer; }

/* 页面切换动画 */
/* 新页面一开始就基本可见，动画只是收个尾，点下去马上有反应 */
@keyframes in-fwd { from { opacity: 0.5; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes in-back { from { opacity: 0.5; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes in-fade { from { opacity: 0.6; } to { opacity: 1; } }
#app > .screen.anim-fwd > :not(.ask) { animation: in-fwd 0.16s cubic-bezier(0.2, 0.8, 0.2, 1); }
#app > .screen.anim-back > :not(.ask) { animation: in-back 0.16s cubic-bezier(0.2, 0.8, 0.2, 1); }
#app > .screen.anim-swap > :not(.ask) { animation: in-fade 0.12s ease-out; }
.scrim { animation: in-fade 0.18s ease-out; }
.scrim .sheet { animation: sheet-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #app > .screen.anim-fwd > *, #app > .screen.anim-back > *, #app > .screen.anim-swap > *, .scrim, .scrim .sheet { animation: none; }
}

/* 按下去立刻变色，手指一碰就有反馈 */
a.card.tap, .tile, .lec, .slot, .chip, .opt, .boxbtn, .convitem, .iconbtn, .ask, .check, .send {
  transition: transform 0.08s ease-out, background-color 0.08s ease-out; }
a.card.tap:active, .tile:active, .lec:active, .slot:active, .convitem:active, .boxbtn:active, .opt:active { transform: scale(0.98); background-color: var(--chip); }
.chip:active, .iconbtn:active, .check:active { transform: scale(0.94); }
.ask:active, .send:active { transform: translateX(-50%) scale(0.98); }
.send:active { transform: scale(0.94); }

/* 首页右上角两个按钮 */
.acts { display: flex; gap: 8px; }

/* 待办打勾 */
.check { width: 32px; height: 32px; flex: none; border-radius: 16px; border: 1.5px solid var(--border); background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.check svg { width: 16px; height: 16px; stroke: transparent; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.check.on { background: var(--clay); border-color: var(--clay); }
.check.on svg { stroke: #FFFFFF; }
.kv.todo { align-items: center; }
.kv.todo .grow { flex: 1; }
.kv.todo.done .grow, .kv.todo.done .pill { text-decoration: line-through; opacity: 0.5; }

/* 聊天附件 */
.inrow .attach { width: 44px; height: 44px; }
.tray { display: flex; gap: 8px; overflow-x: auto; }
.att { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 4px 0 6px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--border); font-size: 13px; flex: none; max-width: 220px; }
.att.up { opacity: 0.6; }
.att img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }
.att .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att button { width: 28px; height: 28px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.att button svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2.2; stroke-linecap: round; }

/* 讲义提问 */
.asktext { width: 100%; border-radius: 14px; border: 1px solid var(--border); background: var(--card); padding: 12px 14px; font-size: 16px; line-height: 1.5; resize: none; }
.boxbtn.primary { background: var(--slate); color: var(--on-dark); border-color: var(--slate); }

/* 设置 */
.seg.seg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cap.block { display: block; margin-top: 2px; font-weight: 400; }
.opt[role=switch] { padding: 10px 16px; gap: 12px; }
.opt:disabled { opacity: 0.6; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--border); position: relative; flex: none; transition: background-color 0.15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #FFFFFF; transition: transform 0.15s; }
.switch.on { background: var(--clay); }
.switch.on::after { transform: translateX(18px); }

/* 作业详情 */
a.row.tap { color: var(--slate); }
a.row.tap .chev svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a.kv.todo { color: var(--slate); }
.duetitle { font-size: 22px !important; line-height: 1.35; overflow-wrap: anywhere; }
.duetime { display: flex; align-items: center; gap: 12px; }
.kv .kvv { text-align: right; overflow-wrap: anywhere; min-width: 0; }
.boxbtn.primary svg { stroke: var(--on-dark); }
/* 转圈：交给合成层，主线程忙时也不卡 */
.spin { will-change: transform; }
/* 正在生成的回复末尾闪烁的光标 */
.bubble.streaming::after { content: ''; display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px;
  background: var(--clay); border-radius: 2px; animation: caret 1s steps(2, start) infinite; }
@keyframes caret { to { visibility: hidden; } }

/* 课件页码 */
.pagetag { position: fixed; right: 16px; bottom: calc(16px + var(--safe-bottom)); padding: 6px 12px; border-radius: 14px;
  background: rgba(20, 20, 19, 0.72); color: #FFFFFF; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; z-index: 6; pointer-events: none; }
.askpage { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.askmid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.askthumb { width: 160px; max-width: 100%; background: #FFFFFF; border-radius: 6px; box-shadow: 0 1px 4px var(--shadow); overflow: hidden; }
.askthumb canvas { display: block; width: 100%; height: auto; }
.asknum { font-size: 18px; font-variant-numeric: tabular-nums; }
.center { display: flex; justify-content: center; }
/* 聊天里的讲义页码标签 */
.bubble.withtag { display: flex; flex-direction: column; gap: 8px; }
.lectag { align-self: flex-start; display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 10px;
  background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; font-size: 13px; white-space: normal; }
.lectag i svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; display: block; }
.lectag b { color: var(--clay); }

/* 课件：每页标页码，当前页高亮 */
.pdfpages { gap: 16px; }
.pdfwrap { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 6px; }
.pdflabel { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 8px; transition: background-color 0.15s, color 0.15s; }
.pdfwrap.cur .pdflabel { background: var(--clay); color: #FFFFFF; }
.pdfwrap .pdfpage { outline: 2px solid transparent; outline-offset: 2px; transition: outline-color 0.15s; }
.pdfwrap.cur .pdfpage { outline-color: var(--clay); }
.pagetag { background: var(--clay); }
.askpill { flex: none; height: 36px; padding: 0 12px 0 10px; border-radius: 18px; border: 0; background: var(--clay); color: #FFFFFF;
  display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.askpill i svg { width: 16px; height: 16px; stroke: #FFFFFF; fill: none; stroke-width: 2; display: block; }
.askpill:active { transform: scale(0.96); }
/* 课件里允许双击缩放，但弹出的面板里不要 */
.scrim, .scrim * { touch-action: manipulation; }

/* 公式 */
.bubble .math { white-space: normal; }
.bubble .math.block { display: block; overflow-x: auto; overflow-y: hidden; padding: 6px 0; -webkit-overflow-scrolling: touch; }
.bubble .katex { font-size: 1.08em; }
.bubble.me .katex { color: inherit; }

/* Markdown */
.bubble.ai, .annbody { white-space: normal; }
.bubble.ai > :first-child, .annbody > :first-child { margin-top: 0; }
.bubble.ai > :last-child, .annbody > :last-child { margin-bottom: 0; }
.md-p { margin: 0 0 8px; }
.md-h { font-weight: 700; margin: 12px 0 6px; line-height: 1.4; }
.md-h1 { font-size: 18px; } .md-h2 { font-size: 17px; } .md-h3 { font-size: 15px; }
.md-list { margin: 0 0 8px; padding-left: 1.4em; }
.md-list li { margin: 2px 0; }
.md-list li::marker { color: var(--clay-text); }
.md-list .md-list { margin: 2px 0 0; }
.md-quote { margin: 0 0 8px; padding: 2px 0 2px 12px; border-left: 3px solid var(--border); color: var(--soft); }
.md-hr { border: 0; height: 1px; background: var(--line); margin: 12px 0; }
.codeblock { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--chip); overflow-x: auto; -webkit-overflow-scrolling: touch;
  font-family: 'DM Mono', 'SF Mono', Menlo, monospace; font-size: 13px; line-height: 1.5; white-space: pre; }
.md-table { margin: 0 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md-table table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
.md-table td { white-space: normal; min-width: 4em; }
.md-table th { background: var(--chip); font-weight: 600; }
.bubble.ai a, .annbody a { color: var(--clay-text); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.bubble.streaming::after { display: inline-block; }
