/* 尤丽雅 · 视觉规范
   颜色取 iOS 系统色；圆角四档 10 / 14 / 22 / 胶囊；字号按 iOS 字号阶梯 34 / 28 / 22 / 20 / 17 / 16 / 15 / 13 / 12。
   页面两层：浅灰底 + 白色内容；毛玻璃只用在导航、输入栏、工具栏这些浮在内容上的控件。 */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --ink: #000000;
  --ink-2: rgba(60, 60, 67, .6);
  --ink-3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .22);
  --fill: rgba(118, 118, 128, .12);
  --fill-strong: rgba(118, 118, 128, .2);
  --blue: #007aff;
  --blue-tint: rgba(0, 122, 255, .1);
  --red: #ff3b30;
  --red-tint: rgba(255, 59, 48, .12);
  --green: #34c759;
  --orange: #ff9500;
  --indigo: #5856d6;
  --gray: #8e8e93;
  --on-accent: #ffffff;
  --switch-off: #e9e9eb;
  --dot: #d1d1d6;
  --edge: #c7c7cc;
  --glass: rgba(255, 255, 255, .72);
  --glass-hi: rgba(255, 255, 255, .7);
  --menu: rgba(255, 255, 255, .86);
  --scrim: rgba(0, 0, 0, .22);
  --shadow-float: 0 8px 30px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .06);
  --shadow-sheet: 0 24px 70px rgba(0, 0, 0, .18);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 280px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tab-space: 0px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --ink: #ffffff;
    --ink-2: rgba(235, 235, 245, .6);
    --ink-3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .65);
    --fill: rgba(118, 118, 128, .24);
    --fill-strong: rgba(118, 118, 128, .36);
    --blue: #0a84ff;
    --blue-tint: rgba(10, 132, 255, .2);
    --red: #ff453a;
    --red-tint: rgba(255, 69, 58, .2);
    --green: #30d158;
    --orange: #ff9f0a;
    --indigo: #5e5ce6;
    --switch-off: #39393d;
    --dot: #2c2c2e;
    --edge: #48484a;
    --glass: rgba(44, 44, 46, .7);
    --glass-hi: rgba(255, 255, 255, .1);
    --menu: rgba(44, 44, 46, .9);
    --scrim: rgba(0, 0, 0, .5);
    --shadow-float: 0 8px 30px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(255, 255, 255, .08);
    --shadow-card: 0 0 0 .5px rgba(255, 255, 255, .06), 0 6px 20px rgba(0, 0, 0, .3);
    --shadow-sheet: 0 24px 70px rgba(0, 0, 0, .6);
  }
}

/* ———— 基础 ———— */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  accent-color: var(--blue);
  caret-color: var(--blue);
}
::selection { background: rgba(0, 122, 255, .25); }
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
* { scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }

/* ———— 通用控件 ———— */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-float), inset 0 .5px 0 var(--glass-hi);
}
.circle-button {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
  transition: transform .25s var(--ease), background-color .2s;
}
.circle-button svg.i { width: 20px; height: 20px; }
.pill-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; border: 0; border-radius: var(--r-pill);
  padding: 7px 14px;
  background: var(--fill); color: var(--blue);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: transform .25s var(--ease), background-color .2s;
}
.pill-button.tinted { background: var(--blue-tint); }
.pill-button.filled { background: var(--blue); color: var(--on-accent); }
.pill-button.danger, .pill-button.graph-node-delete { color: var(--red); }
.pill-button svg.i { width: 17px; height: 17px; }
.filled-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; border: 0; border-radius: var(--r-pill);
  padding: 12px 20px;
  background: var(--blue); color: var(--on-accent);
  font-size: 17px; font-weight: 600;
  transition: transform .25s var(--ease), opacity .2s;
}
.plain-button { border: 0; background: none; padding: 6px 4px; color: var(--blue); font-size: 15px; }
.circle-button:active, .pill-button:active, .filled-button:active, .tab:active, .send-button:active, .suggestion:active { transform: scale(.95); }

input[type="text"], input[type="number"], input[type="search"], input:not([type]) {
  min-width: 0;
  border: 0; border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--fill); color: var(--ink);
  font-size: 16px; outline: none;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="text"]:focus-visible, input[type="number"]:focus-visible, input:not([type]):focus-visible, select:focus-visible, .group-textarea:focus-visible { box-shadow: 0 0 0 3px var(--blue-tint); }
select {
  min-width: 0; max-width: 100%;
  appearance: none; -webkit-appearance: none;
  border: 0; border-radius: var(--r-sm);
  padding: 9px 30px 9px 12px;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4-4 4 4M8 14l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  color: var(--ink); font-size: 16px; outline: none;
}
input[type="file"] { min-width: 0; color: var(--ink-2); font-size: 14px; }
input[type="file"]::file-selector-button {
  margin-right: 10px; border: 0; border-radius: var(--r-pill);
  padding: 7px 14px; background: var(--blue-tint); color: var(--blue);
  font: inherit; font-weight: 600; cursor: pointer;
}
.switch {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 51px; height: 31px; margin: 0;
  border-radius: var(--r-pill);
  background: radial-gradient(circle, #fff 12.5px, transparent 13px) no-repeat 0 0 / 31px 31px, var(--switch-off);
  cursor: pointer;
  transition: background-position .3s var(--ease), background-color .3s var(--ease);
}
.switch:checked { background-color: var(--blue); background-position: 20px 0; }
.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.search-field {
  display: flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--fill); color: var(--ink-2);
}
.search-field svg.i { width: 18px; height: 18px; }
.search-field input { flex: 1; height: 100%; padding: 0; border-radius: 0; background: transparent; font-size: 16px; }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }

.group { position: relative; border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.group-row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 6px 16px;
  font-size: 16px;
}
.group-row > span { flex: 1; min-width: 0; }
.group > * + .group-row::before, .group-row + .group-row::before, .group-row + .exam-source-name::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep);
}
.section-label { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px 8px; }
.section-head h2, .section-head h3 { margin: 0; font-size: 20px; font-weight: 700; }
.large-title { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; }
.nav-title { min-width: 0; margin: 0; overflow: hidden; font-size: 17px; font-weight: 600; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.paper-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.hash { color: var(--blue); }

.menu-wrap { position: relative; }
.pop-menu, .conversation-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); right: 0;
  display: none; min-width: 180px; padding: 6px;
  border-radius: var(--r-md);
  background: var(--menu);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-sheet), 0 0 0 .5px var(--sep);
  transform-origin: top right;
}
.pop-menu.open, .conversation-menu.open { display: grid; animation: menu-in .22s var(--ease); }
.pop-menu button, .conversation-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 0; border-radius: 9px; padding: 10px 12px;
  background: transparent; color: var(--ink);
  font-size: 15px; text-align: left; white-space: nowrap;
}
.pop-menu button svg.i, .conversation-menu button svg.i { width: 18px; height: 18px; }
.pop-menu .danger, .conversation-menu .danger { color: var(--red); }
@keyframes menu-in { from { opacity: 0; transform: scale(.92); } }

.toast {
  position: fixed; z-index: 200;
  top: calc(12px + var(--safe-top)); left: 50%;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--menu);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-float);
  color: var(--ink); font-size: 14px; line-height: 1.4; text-align: center;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, -16px);
  transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

/* ———— 外框与侧栏 ———— */
.app-shell { height: 100dvh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  min-height: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding: calc(14px + var(--safe-top)) 12px calc(12px + var(--safe-bottom)) max(12px, var(--safe-left));
  background: var(--bg);
}
.side-nav { display: grid; gap: 2px; margin-bottom: 8px; }
.side-nav-item {
  display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: var(--r-sm); padding: 9px 10px;
  background: transparent; color: var(--ink);
  font-size: 15px; text-align: left;
}
.side-nav-item svg.i { width: 20px; height: 20px; color: var(--blue); }
.side-nav-item[aria-current="page"] { background: var(--blue-tint); font-weight: 600; }
.sidebar-search { margin: 0 2px 4px; }
.conversation-list { min-height: 0; flex: 1; overflow: auto; margin: 0 -4px; padding: 0 4px 8px; }
.conversation-group-title { margin: 14px 10px 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.conversation-empty { margin: 24px 10px; color: var(--ink-2); font-size: 14px; text-align: center; }
.conversation-item-row { position: relative; }
.conversation-item {
  width: 100%; display: block;
  border: 0; border-radius: var(--r-sm);
  padding: 9px 40px 9px 10px;
  background: transparent; color: var(--ink); text-align: left;
}
.conversation-item strong, .conversation-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item strong { font-size: 15px; font-weight: 600; }
.conversation-item span { margin-top: 2px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.conversation-item.active { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.conversation-more {
  position: absolute; top: 50%; right: 6px;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2);
  transform: translateY(-50%);
  opacity: 0; transition: opacity .2s;
}
.conversation-more svg.i { width: 18px; height: 18px; }
.conversation-item-row:hover .conversation-more, .conversation-item-row:focus-within .conversation-more, .conversation-item.active + .conversation-more { opacity: 1; }
.conversation-menu { top: calc(100% - 4px); right: 4px; }
.account-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; border: 0; border-radius: var(--r-md);
  padding: 10px 12px;
  background: var(--surface); color: var(--ink); text-align: left;
}
.avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--blue-tint); color: var(--blue); }
.avatar svg.i { width: 18px; height: 18px; }
.account-row-text { flex: 1; min-width: 0; }
.account-row-text strong, .account-row-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row-text strong { font-size: 15px; font-weight: 600; }
.account-row-text span { color: var(--ink-2); font-size: 12px; }
.account-row-text span:empty { display: none; }
.chev { color: var(--ink-3); width: 16px !important; height: 16px !important; stroke-width: 2.2 !important; }
.sidebar-scrim { display: none; }

/* ———— 对话 ———— */
.main-panel {
  position: relative; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  --content-pad: max(20px, calc((100% - 720px) / 2));
}
.chat-nav {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 12px;
  padding: calc(8px + var(--safe-top)) max(16px, var(--safe-right)) 8px max(16px, var(--safe-left));
  border-bottom: .5px solid transparent;
  transition: background-color .25s, border-color .25s;
}
.main-panel.scrolled .chat-nav {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom-color: var(--sep);
}
.main-panel.scrolled .chat-nav .circle-button { box-shadow: none; background: transparent; }
#menu-button { visibility: hidden; }

.empty-state {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  padding: 24px 24px 160px;
  pointer-events: none;
}
.empty-state > * { pointer-events: auto; }
.empty-title { margin: 0; color: var(--ink-2); font-size: 24px; font-weight: 600; text-align: center; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; }
.suggestion {
  border: 0; border-radius: var(--r-pill); padding: 9px 16px;
  background: var(--blue-tint); color: var(--blue);
  font-size: 15px; transition: transform .25s var(--ease);
}

.message-list {
  min-height: 0; flex: 1 1 auto; overflow: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: calc(72px + var(--safe-top)) var(--content-pad) calc(150px + var(--tab-space) + var(--safe-bottom));
  overscroll-behavior: contain;
}
.message { max-width: 100%; font-size: 16px; line-height: 1.75; white-space: normal; overflow-wrap: anywhere; }
.message.plain { white-space: pre-wrap; }
.message > :first-child { margin-top: 0; }
.message > :last-child { margin-bottom: 0; }
.message p { margin: .55em 0; }
.message h1, .message h2, .message h3, .message h4 { margin: 1em 0 .4em; font-weight: 600; line-height: 1.35; }
.message h1 { font-size: 1.4em; }
.message h2 { font-size: 1.22em; }
.message h3, .message h4 { font-size: 1.06em; }
.message ul, .message ol { margin: .55em 0; padding-left: 1.4em; }
.message li + li { margin-top: .25em; }
.message blockquote { margin: .8em 0; padding: 0 0 0 12px; border-left: 3px solid var(--fill-strong); color: var(--ink-2); }
.message hr { margin: 1em 0; border: 0; border-top: .5px solid var(--sep); }
.message code { padding: .12em .38em; border-radius: 6px; background: var(--fill); font-family: var(--mono); font-size: .88em; }
.message pre { max-width: 100%; overflow-x: auto; margin: .8em 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink); line-height: 1.55; }
.message pre code { padding: 0; background: transparent; font-size: .86em; }
.message table { display: block; max-width: 100%; overflow-x: auto; margin: .8em 0; border-collapse: collapse; }
.message th, .message td { padding: 7px 10px; border: .5px solid var(--sep); text-align: left; }
.message th { font-weight: 600; }
.message img { max-width: 100%; border-radius: 12px; }
.message .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.message .katex { font-size: 1.06em; }
.message.assistant { align-self: stretch; color: var(--ink); }
.message.user {
  align-self: flex-end; max-width: min(80%, 560px);
  padding: 9px 15px; border-radius: 20px;
  background: var(--blue); color: var(--on-accent); line-height: 1.5;
}
.message.user a { color: inherit; }
.message.user blockquote { color: rgba(255, 255, 255, .85); border-left-color: rgba(255, 255, 255, .5); }
.message.user code { background: rgba(255, 255, 255, .2); }
.message.user pre { background: rgba(0, 0, 0, .2); color: inherit; }
.message.user th, .message.user td { border-color: rgba(255, 255, 255, .35); }
.message.error { padding: 12px 14px; border-radius: var(--r-md); background: var(--red-tint); color: var(--red); }
.turn-rewind, .answer-actions button {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2);
}
.turn-rewind { align-self: flex-end; margin: -14px 2px -6px; }
.turn-rewind svg.i, .answer-actions svg.i { width: 17px; height: 17px; }
.answer-actions { display: flex; gap: 2px; margin: -12px 0 -4px -6px; }
.thinking { display: inline-flex; align-items: center; color: var(--ink-2); font-size: 15px; }
.thinking > span:first-child {
  background: linear-gradient(90deg, var(--ink-3) 0%, var(--blue) 50%, var(--ink-3) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: shimmer 1.6s linear infinite;
}
.thinking > span:first-child::after { content: "…"; }
.thinking-spinner { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.scroll-bottom-button {
  position: absolute; z-index: 6;
  right: max(16px, calc((100% - 760px) / 2));
  bottom: calc(84px + var(--tab-space) + var(--safe-bottom));
  transition: opacity .25s, transform .25s var(--ease);
}
.scroll-bottom-button.away { opacity: 0; transform: translateY(8px) scale(.9); pointer-events: none; }

.composer {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0;
  display: grid; gap: 8px;
  padding: 0 max(16px, calc((100% - 760px) / 2)) calc(16px + var(--tab-space) + var(--safe-bottom));
  pointer-events: none;
}
.composer > * { pointer-events: auto; }
.attachment-line {
  justify-self: start; max-width: 100%;
  display: flex; align-items: center; gap: 8px;
  margin-left: 54px; padding: 6px 6px 6px 12px;
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: var(--shadow-float);
  color: var(--ink); font-size: 13px;
}
.attachment-line svg.i { width: 16px; height: 16px; color: var(--blue); }
.attachment-line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-line button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--fill); color: var(--ink-2); }
.attachment-line button svg.i { width: 13px; height: 13px; stroke-width: 2.4; }
.composer-form { display: flex; align-items: flex-end; gap: 8px; }
.file-button { width: 46px; height: 46px; flex: none; cursor: pointer; }
.file-button input { display: none; }
.composer-field {
  flex: 1; min-width: 0;
  display: flex; align-items: flex-end; gap: 6px;
  min-height: 46px; padding: 5px 5px 5px 18px;
  border-radius: 23px;
}
.composer-field textarea {
  flex: 1; min-width: 0; min-height: 36px; max-height: 150px;
  border: 0; padding: 8px 0; resize: none;
  background: transparent; color: var(--ink);
  font-size: 16px; line-height: 1.4; outline: none;
}
.send-button {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--blue); color: var(--on-accent);
  transition: opacity .2s, transform .25s var(--ease);
}
.send-button svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.composer-field:has(textarea:placeholder-shown) .send-button { opacity: 0; transform: scale(.6); pointer-events: none; }

.tab-bar { display: none; }

/* ———— 全屏页面 ———— */
.screen {
  position: fixed; z-index: 40;
  top: 0; right: 0; bottom: 0; left: var(--sidebar-w);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
}
.screen.pushed { z-index: 80; background: var(--surface); animation: push-in .4s var(--ease); }
@keyframes push-in { from { transform: translateX(32px); opacity: 0; } }
.screen-nav {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
  padding: calc(10px + var(--safe-top)) max(20px, var(--safe-right)) 8px max(20px, var(--safe-left));
}
.screen-nav .graph-screen-actions { margin-left: auto; }
.graph-screen-actions { display: flex; align-items: center; gap: 8px; }
.drawer-scrim { display: none !important; }

/* ———— 错题本 ———— */
.wrongbook-drawer { opacity: 0; transform: translateX(16px); transition: opacity .3s var(--ease), transform .4s var(--ease); }
.wrongbook-drawer.open { opacity: 1; transform: none; }
.wrongbook-drawer { --wb-pad: max(16px, calc((100% - 980px) / 2)); }
.drawer-head { display: grid; gap: 2px; padding: calc(12px + var(--safe-top)) var(--wb-pad) 8px; }
.drawer-head .large-title { padding: 0 4px; }
.wrongbook-breadcrumb { display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; min-height: 36px; }
.wrongbook-breadcrumb:empty { display: none; }
.wrongbook-breadcrumb button { display: inline-flex; align-items: center; gap: 2px; border: 0; padding: 6px 4px; background: none; color: var(--blue); font-size: 16px; }
.wrongbook-breadcrumb button svg.i { width: 20px; height: 20px; stroke-width: 2.2; }
.wrongbook-breadcrumb .crumb-sep { color: var(--ink-3); }
.wrongbook-toolbar { display: flex; align-items: center; gap: 8px; padding: 4px var(--wb-pad) 14px; }
.wrongbook-toolbar .search-field { flex: 1; min-width: 0; }
.wrongbook-toolbar .circle-button { width: 38px; height: 38px; background: var(--fill); color: var(--blue); box-shadow: none; }
.wrongbook-content { min-height: 0; flex: 1; overflow: auto; padding: 0 var(--wb-pad) calc(40px + var(--tab-space) + var(--safe-bottom)); }
.wrongbook-content > * + * { margin-top: 22px; }
.wrongbook-empty { padding: 56px 16px; color: var(--ink-2); font-size: 15px; line-height: 1.6; text-align: center; }
.wb-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; }
.wb-tile {
  display: grid; gap: 6px;
  border: 0; border-radius: var(--r-md); padding: 10px 12px 11px;
  background: var(--surface); color: var(--ink); text-align: left;
  transition: transform .25s var(--ease);
}
.wb-tile:active { transform: scale(.97); }
.wb-tile-top { display: flex; align-items: center; justify-content: space-between; }
.wb-dot { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--on-accent); }
.wb-dot svg.i { width: 17px; height: 17px; stroke-width: 2; }
.wb-tile-count { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wb-tile-label { color: var(--ink-2); font-size: 15px; font-weight: 600; }
.wb-row-wrap { position: relative; display: flex; align-items: center; }
.wb-row-wrap + .wb-row-wrap::before, .wb-row-wrap + .wb-row::before, .wb-row + .wb-row::before, .wb-row + .wb-row-wrap::before {
  content: ""; position: absolute; top: 0; left: 50px; right: 0; border-top: .5px solid var(--sep);
}
.wb-row {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  min-height: 50px; border: 0; padding: 12px 14px;
  background: transparent; color: var(--ink);
  font-size: 16px; text-align: left;
}
.wb-row svg.i:first-child { color: var(--blue); }
.wb-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-row-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wb-row.add { color: var(--blue); }
.group > .wb-row { width: 100%; }
.wb-row-wrap .menu-wrap { flex: none; padding-right: 6px; }
.wb-row-wrap .circle-button { width: 32px; height: 32px; color: var(--ink-2); }
.wb-row-wrap .circle-button svg.i { width: 18px; height: 18px; }
.wrongbook-question-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 20px 14px; }
.wrongbook-note { position: relative; display: grid; gap: 8px; align-content: start; cursor: pointer; outline-offset: 4px; }
.note-paper {
  aspect-ratio: 3 / 4; max-width: 100%;
  overflow: hidden; padding: 12px 12px 0;
  border-radius: var(--r-md);
  background: var(--surface);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.wrongbook-note-preview {
  display: -webkit-box; margin: 0; overflow: hidden;
  color: var(--ink); opacity: .82;
  font-size: 12px; line-height: 1.6;
  -webkit-box-orient: vertical; -webkit-line-clamp: 11;
  overflow-wrap: anywhere;
}
.note-caption { min-width: 0; padding: 0 4px; }
.note-caption h3 { margin: 0; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wrongbook-note-meta { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px 8px; margin-top: 3px; overflow: hidden; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrongbook-note-meta > * { flex: none; }
.wrongbook-note-meta .hash { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: -3px; border-radius: 50%; background: var(--blue); }
.status-dot.extracted { background: var(--green); }
.status-dot.pending { background: var(--orange); }
.wrongbook-note-select {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 24px; height: 24px; margin: 0;
  appearance: none; -webkit-appearance: none;
  border: 1.5px solid var(--ink-3); border-radius: 50%;
  background: var(--surface) no-repeat center / 14px;
  cursor: pointer; opacity: 0;
  transition: opacity .2s, background-color .2s, border-color .2s;
}
.wrongbook-note-select:checked {
  border-color: var(--blue);
  background-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.wrongbook-note:hover .wrongbook-note-select, .wrongbook-note-select:focus-visible, .wrongbook-note-select:checked, .wrongbook-question-list.selecting .wrongbook-note-select { opacity: 1; }
.wrongbook-selected-bar {
  position: sticky; top: 0; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 8px 8px 16px; border-radius: var(--r-lg);
  background: var(--menu);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: var(--shadow-float);
  font-size: 15px; font-weight: 600;
}
.wrongbook-selected-bar > span { margin-right: auto; }
.wrongbook-selected-bar select { font-size: 15px; font-weight: 400; }
.wrongbook-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 8px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.wrongbook-add-form { display: grid; gap: 12px; max-width: 680px; }
.wrongbook-add-form textarea { width: 100%; min-height: 170px; border: 0; border-radius: var(--r-md); padding: 14px 16px; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.6; resize: vertical; outline: none; }
.wrongbook-add-form input[type="text"], .wrongbook-add-form select { width: 100%; background-color: var(--surface); }
.wrongbook-add-form > button { justify-self: start; }
.wrongbook-add-form [role="status"] { color: var(--ink-2); font-size: 14px; }
.wrongbook-add-form [role="status"]:empty { display: none; }

/* 错题详情：一张纸 */
.wrongbook-detail-screen-content { min-height: 0; flex: 1; overflow: auto; padding: 0 max(24px, calc((100% - 760px) / 2)) calc(110px + var(--safe-bottom)); }
.wrongbook-detail { display: grid; gap: 18px; }
.detail-stamp { color: var(--ink-2); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.detail-section { display: grid; gap: 8px; }
.wrongbook-detail-question { font-size: 17px; line-height: 1.75; overflow-wrap: anywhere; }
.wrongbook-detail-question p, .wrongbook-analysis p { margin: .5em 0; }
.wrongbook-detail-question > :first-child, .wrongbook-analysis > :first-child { margin-top: 0; }
.wrongbook-detail-question > :last-child, .wrongbook-analysis > :last-child { margin-bottom: 0; }
.wrongbook-detail-question ul, .wrongbook-detail-question ol, .wrongbook-analysis ul, .wrongbook-analysis ol { margin: .5em 0; padding-left: 1.4em; }
.wrongbook-detail-question h1, .wrongbook-detail-question h2, .wrongbook-detail-question h3, .wrongbook-analysis h1, .wrongbook-analysis h2, .wrongbook-analysis h3 { margin: .8em 0 .35em; font-size: 1.05em; font-weight: 600; line-height: 1.35; }
.wrongbook-detail-question pre, .wrongbook-analysis pre { max-width: 100%; overflow-x: auto; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.wrongbook-detail-question code, .wrongbook-analysis code { padding: .1em .35em; border-radius: 6px; background: var(--fill); font-family: var(--mono); font-size: .9em; }
.wrongbook-detail-question .katex-display, .wrongbook-analysis .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.wrongbook-detail-question img { display: block; max-width: 100%; max-height: min(42vh, 420px); margin: 4px 0 14px; border-radius: 12px; object-fit: contain; }
.wrongbook-image-viewer { overflow: hidden; border-radius: var(--r-md); background: var(--surface-2); }
.wrongbook-image-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px; }
.wrongbook-image-toolbar .pill-button { min-height: 30px; padding: 4px 12px; background: var(--surface); }
.wrongbook-image-scale { min-width: 48px; color: var(--ink-2); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.wrongbook-image-canvas { display: grid; min-height: 90px; place-items: center; overflow: auto; padding: 4px 10px 12px; }
.wrongbook-image-canvas img { max-width: 100%; max-height: min(42vh, 420px); border-radius: 8px; transform-origin: center top; transition: transform .2s var(--ease); }
.wrongbook-detail-file { display: inline-flex; align-items: center; gap: 6px; justify-self: start; border: 0; padding: 0; background: none; color: var(--blue); font-size: 15px; text-align: left; text-decoration: none; }
.wrongbook-detail-file.muted { color: var(--ink-2); }
.callout { display: grid; gap: 8px; padding: 12px 16px 14px; border-radius: var(--r-md); background: var(--blue-tint); }
.callout-head { display: flex; align-items: center; gap: 6px; color: var(--blue); font-size: 13px; font-weight: 600; }
.callout-head svg.i { width: 16px; height: 16px; }
.wrongbook-analysis { font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.wrongbook-analysis-section + .wrongbook-analysis-section { margin-top: 14px; }
.wrongbook-analysis-label { margin-bottom: 4px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.wrongbook-analysis-list { margin: 4px 0 0; padding-left: 1.3em; }
.detail-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 15px; }
.folder-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.folder-chip svg.i { width: 17px; height: 17px; }
.wrongbook-move-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wrongbook-move-row select { min-width: 0; flex: 0 1 260px; }
.floating-toolbar {
  position: absolute; z-index: 6; left: 50%; bottom: calc(18px + var(--safe-bottom));
  display: flex; align-items: center; gap: 2px;
  max-width: calc(100% - 32px);
  padding: 5px; border-radius: var(--r-pill);
  color: var(--ink-2); font-size: 14px; white-space: nowrap;
  transform: translateX(-50%);
}
.floating-toolbar:empty { display: none; }
.toolbar-button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; border: 0; border-radius: var(--r-pill); padding: 0 14px;
  background: transparent; color: var(--ink); font-size: 15px;
}
.toolbar-button svg.i { width: 20px; height: 20px; }
.toolbar-button.danger { color: var(--red); }

/* ———— 知识图谱 ———— */
.graph-screen { background: var(--bg); }
.graph-screen .screen-nav { position: relative; z-index: 5; }
.graph-workspace { position: relative; min-height: 0; flex: 1; display: flex; }
.graph-viewport {
  position: relative; min-width: 0; min-height: 0; flex: 1; overflow: hidden;
  cursor: grab; touch-action: none;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.4px);
  background-size: 24px 24px;
}
.graph-viewport.panning { cursor: grabbing; }
.graph-world { position: absolute; top: 0; left: 0; width: 3200px; height: 2200px; transform-origin: 0 0; will-change: transform; }
.graph-edge-layer { position: absolute; inset: 0; width: 3200px; height: 2200px; overflow: visible; pointer-events: none; }
.graph-tree-edge { fill: none; stroke: var(--edge); stroke-width: 2; stroke-linecap: round; }
.graph-link-edge { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 6 6; stroke-linecap: round; }
.graph-node-layer { position: absolute; inset: 0; }
.graph-node-card {
  position: absolute; width: 216px; min-height: 112px; padding: 14px;
  border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-card);
  cursor: grab; user-select: none; touch-action: none;
  transition: box-shadow .25s;
}
.graph-node-card:active { cursor: grabbing; box-shadow: var(--shadow-float); }
.graph-node-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.graph-node-card-head strong { min-width: 0; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.graph-node-card-actions { display: flex; flex: 0 0 auto; gap: 4px; opacity: 0; transition: opacity .2s; }
.graph-node-card:hover .graph-node-card-actions, .graph-node-card:focus-within .graph-node-card-actions { opacity: 1; }
.graph-node-card-actions .graph-node-edit, .graph-node-card-actions .graph-node-delete { border: 0; border-radius: var(--r-pill); padding: 3px 8px; background: var(--fill); color: var(--ink-2); font-size: 11px; }
.graph-node-card-actions .graph-node-delete { color: var(--red); }
.graph-node-card-summary { margin-top: 8px; display: -webkit-box; overflow: hidden; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.graph-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 24px; color: var(--ink-2); text-align: center; pointer-events: none; }
.graph-empty strong { color: var(--ink); font-size: 20px; font-weight: 600; }
.graph-empty span { font-size: 15px; }
.zoom-control {
  position: absolute; z-index: 4; left: 16px; bottom: calc(16px + var(--tab-space) + var(--safe-bottom));
  display: flex; align-items: center; padding: 3px; border-radius: var(--r-pill);
}
.zoom-control button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink); }
.zoom-control button svg.i { width: 18px; height: 18px; }
.zoom-control span { min-width: 44px; color: var(--ink-2); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.graph-agent-panel {
  position: absolute; z-index: 4; top: 4px; right: 16px;
  width: 320px; max-height: calc(100% - 24px); overflow: auto;
  display: grid; gap: 10px; align-content: start;
  padding: 14px 16px 16px; border-radius: var(--r-lg);
}
.graph-agent-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.graph-agent-head h2 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; }
.graph-agent-head h2 svg.i { width: 18px; height: 18px; color: var(--blue); }
.graph-agent-toggle { display: inline-flex; align-items: center; gap: 3px; border: 0; border-radius: var(--r-pill); padding: 5px 10px 5px 8px; background: var(--fill); color: var(--ink-2); font-size: 13px; }
.graph-agent-toggle svg.i { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.graph-agent-panel.collapsed { width: auto; padding: 8px 8px 8px 16px; }
.graph-agent-panel.collapsed .graph-agent-form, .graph-agent-panel.collapsed .graph-agent-status, .graph-agent-panel.collapsed .graph-agent-plan { display: none; }
.graph-agent-panel.collapsed .graph-agent-toggle svg.i { transform: rotate(180deg); }
.graph-agent-form { display: grid; gap: 8px; }
.graph-agent-form textarea { width: 100%; min-height: 96px; border: 0; border-radius: 12px; padding: 10px 12px; background: var(--fill); color: var(--ink); font-size: 15px; line-height: 1.55; resize: vertical; outline: none; }
.graph-agent-form .filled-button { min-height: 42px; font-size: 16px; }
.graph-agent-status { color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.graph-agent-status:empty { display: none; }
.graph-agent-plan { padding: 10px 12px; border-radius: 12px; background: var(--fill); color: var(--ink); font-size: 13px; line-height: 1.55; }
.graph-agent-plan strong { display: block; margin-bottom: 4px; }
.graph-agent-plan ul { margin: 4px 0 0; padding-left: 1.3em; }

/* 知识节点：一张纸 + 对话 */
.graph-node-page-content { min-height: 0; flex: 1; overflow: auto; display: grid; gap: 18px; align-content: start; padding: 0 max(24px, calc((100% - 760px) / 2)) calc(40px + var(--safe-bottom)); }
.graph-node-summary-card { display: grid; gap: 10px; }
.graph-node-section-label { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.graph-node-rendered { font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.graph-node-rendered h1, .graph-node-rendered h2, .graph-node-rendered h3 { margin: .9em 0 .4em; font-size: 1.08em; font-weight: 600; line-height: 1.35; }
.graph-node-rendered p { margin: .55em 0; }
.graph-node-rendered ul, .graph-node-rendered ol { padding-left: 1.4em; }
.graph-node-rendered pre { max-width: 100%; overflow-x: auto; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.graph-node-rendered .katex-display { max-width: 100%; overflow-x: auto; }
.graph-related-section { display: grid; gap: 6px; margin-top: 10px; }
.graph-related-section h3 { margin: 0 0 2px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.graph-related-question { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; line-height: 1.6; }
.graph-related-empty { margin: 0; color: var(--ink-2); font-size: 14px; }
.graph-parent-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; color: var(--ink-2); font-size: 14px; }
.graph-parent-editor select { flex: 0 1 240px; }
.graph-node-chat-card { display: grid; gap: 12px; margin-top: 10px; }
.graph-node-chat-messages { display: grid; gap: 14px; }
.graph-node-chat-messages:empty { display: none; }
.graph-node-chat-message { max-width: 100%; font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.graph-node-chat-message.user { justify-self: end; max-width: min(80%, 560px); padding: 9px 15px; border-radius: 20px; background: var(--blue); color: var(--on-accent); line-height: 1.5; }
.graph-node-chat-message.error { padding: 12px 14px; border-radius: var(--r-md); background: var(--red-tint); color: var(--red); }
.graph-node-chat-message p { margin: .5em 0; }
.graph-node-chat-message > :first-child { margin-top: 0; }
.graph-node-chat-message > :last-child { margin-bottom: 0; }
.graph-node-chat-form .composer-field { background: var(--fill); }

/* ———— 组卷 ———— */
.exam-workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.exam-chat-panel { min-height: 0; overflow: auto; display: grid; gap: 28px; align-content: start; padding: 4px 16px 32px max(20px, var(--safe-left)); }
.exam-form { display: grid; gap: 14px; }
.group-textarea { display: block; width: 100%; min-height: 130px; border: 0; padding: 14px 16px; background: transparent; color: var(--ink); font-size: 16px; line-height: 1.6; resize: none; outline: none; }
.group-row input[type="text"], .group-row input[type="number"] { width: 50%; padding: 4px 0; border-radius: 0; background: transparent; color: var(--ink-2); text-align: right; box-shadow: none; }
.group-row input[type="number"] { width: 84px; }
.group-row select { padding: 4px 24px 4px 0; background-color: transparent; background-position: right 0 center; color: var(--ink-2); text-align: right; text-align-last: right; }
.file-row { color: var(--blue); cursor: pointer; }
.file-row svg.i { width: 20px; height: 20px; }
.file-row input { display: none; }
.exam-source-name { position: relative; padding: 10px 16px 12px; color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
.exam-submit { width: 100%; }
.exam-history-list { display: grid; }
.exam-history-empty { padding: 18px 16px; color: var(--ink-2); font-size: 14px; text-align: center; }
.exam-history-item { position: relative; display: grid; gap: 3px; padding: 12px 16px; }
.exam-history-item + .exam-history-item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.exam-history-item strong { overflow: hidden; font-size: 16px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.exam-history-item > span { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.exam-history-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 4px; }
.exam-history-actions button, .exam-history-actions a { border: 0; padding: 2px 0; background: none; color: var(--blue); font-size: 14px; text-decoration: none; }
.exam-history-actions .exam-danger { color: var(--red); }
.exam-preview-panel { min-height: 0; overflow: auto; padding: 4px max(20px, calc((100% - 860px) / 2)) 40px; }
.exam-empty { display: grid; place-items: center; min-height: 260px; color: var(--ink-2); font-size: 15px; text-align: center; }
.exam-preview { display: grid; gap: 16px; }
.exam-preview-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.exam-preview-head h2 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.exam-preview-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.exam-downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.exam-downloads a { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); padding: 8px 14px; background: var(--blue-tint); color: var(--blue); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.exam-downloads a svg.i { width: 17px; height: 17px; }
.exam-question-list { display: grid; gap: 12px; }
.exam-question-card { padding: 16px 18px; border-radius: 18px; background: var(--surface); }
.exam-question-card-head { display: flex; align-items: center; gap: 8px; }
.exam-question-number { font-size: 15px; font-weight: 700; }
.exam-source-tag { padding: 2px 8px; border-radius: var(--r-pill); background: var(--fill); color: var(--ink-2); font-size: 12px; }
.exam-question-add { margin-left: auto; border: 0; border-radius: var(--r-pill); padding: 5px 12px; background: var(--blue-tint); color: var(--blue); font-size: 13px; font-weight: 600; }
.exam-question-text { margin-top: 8px; font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.exam-question-text p { margin: .5em 0; }
.exam-question-text pre { overflow-x: auto; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.exam-question-text .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.exam-question-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; color: var(--ink-2); font-size: 12px; }

.exam-progress-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--scrim); animation: fade-in .25s var(--ease); }
.exam-progress-card { width: min(560px, 100%); max-height: min(80dvh, 680px); display: flex; flex-direction: column; overflow: hidden; padding: 16px 20px 20px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-sheet); animation: sheet-in .45s var(--ease); }
.exam-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.exam-progress-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.exam-progress-card > p { margin: 10px 0 12px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.exam-progress-track { height: 6px; flex: none; overflow: hidden; border-radius: var(--r-pill); background: var(--fill); }
.exam-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .4s var(--ease); }
.exam-progress-log { min-height: 0; overflow: auto; margin-top: 14px; }
.exam-progress-line { position: relative; padding: 8px 0 8px 30px; font-size: 14px; line-height: 1.45; }
.exam-progress-line::before { content: ""; position: absolute; left: 0; top: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-tint); }
.exam-progress-line::after { content: ""; position: absolute; left: 7px; top: 12px; width: 5px; height: 9px; border: solid var(--blue); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.exam-progress-line:last-child::before { background: transparent; border: 2px solid var(--blue-tint); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.exam-progress-line:last-child::after { display: none; }
.exam-progress-retry { color: var(--orange); }
.exam-progress-error { color: var(--red); }
.exam-progress-error::before { background: var(--red-tint) !important; border: 0 !important; animation: none !important; }
.exam-progress-error::after { display: none; }
.sheet-grabber { display: none; width: 36px; height: 5px; flex: none; margin: -6px auto 10px; border-radius: var(--r-pill); background: var(--ink-3); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }

/* ———— 账户 ———— */
dialog.sheet-dialog {
  width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 48px);
  overflow: auto; border: 0; border-radius: 24px; padding: 16px 0 0;
  background: var(--bg); color: var(--ink);
  box-shadow: var(--shadow-sheet);
}
dialog.sheet-dialog[open] { animation: sheet-in .45s var(--ease); }
dialog::backdrop { background: var(--scrim); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 0 14px 8px 20px; }
.dialog-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.dialog-head .circle-button { width: 32px; height: 32px; background: var(--fill); color: var(--ink-2); }
.dialog-head .circle-button svg.i { width: 16px; height: 16px; stroke-width: 2.4; }
.dialog-content { display: grid; gap: 22px; padding: 6px 16px calc(20px + var(--safe-bottom)); line-height: 1.5; }
.dialog-content .section-label { padding: 0 16px 6px; }
.dialog-section { display: grid; }
.group-row .row-value { color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.group-row.stack { display: grid; gap: 8px; align-items: stretch; padding-block: 12px; }
.group-row.stack select { width: 100%; padding: 9px 30px 9px 12px; background-color: var(--fill); background-position: right 8px center; color: var(--ink); text-align: left; text-align-last: left; }
.settings-style-input { width: 100%; min-height: 84px; border: 0; border-radius: var(--r-sm); padding: 10px 12px; background: var(--fill); color: var(--ink); font-size: 15px; line-height: 1.55; resize: none; outline: none; }
.group-button { width: 100%; border: 0; background: transparent; color: var(--blue); text-align: left; }
.group-footer { display: flex; align-items: center; gap: 12px; padding: 8px 4px 0; }
.settings-status { color: var(--ink-2); font-size: 13px; }
.settings-status:empty { display: none; }
.secret-box { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.redeem-row input { flex: 1; padding: 4px 0; border-radius: 0; background: transparent; }
.field-error { color: var(--red); font-size: 14px; }

/* ———— 交互细节 ———— */
@media (hover: hover) {
  .side-nav-item:not([aria-current="page"]):hover, .conversation-item:not(.active):hover, .pop-menu button:hover, .conversation-menu button:hover, .wb-row:hover, .answer-actions button:hover, .turn-rewind:hover, .conversation-more:hover, .zoom-control button:hover, .toolbar-button:hover { background: var(--fill); }
  .wrongbook-note:hover .note-paper { transform: translateY(-2px); box-shadow: var(--shadow-card); }
  .graph-node-card:hover { box-shadow: var(--shadow-float); }
}
@media (hover: none) {
  .conversation-more { opacity: .7; }
  .graph-node-card-actions { opacity: 1; }
}

/* ———— 手机 ———— */
@media (max-width: 780px) {
  :root { --tab-space: 74px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 90; top: 0; bottom: 0; left: 0;
    width: min(86vw, 330px);
    padding-bottom: calc(14px + var(--safe-bottom));
    box-shadow: var(--shadow-sheet);
    transform: translateX(-105%);
    transition: transform .4s var(--ease);
  }
  .sidebar.open { transform: none; }
  .side-nav { display: none; }
  .sidebar-scrim { position: fixed; z-index: 85; inset: 0; display: block; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  .sidebar.open ~ .sidebar-scrim { opacity: 1; pointer-events: auto; }
  #menu-button { visibility: visible; }
  .tab-bar {
    position: fixed; z-index: 70;
    left: max(16px, var(--safe-left)); right: max(16px, var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
    height: 62px;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px; border-radius: var(--r-pill);
  }
  .tab {
    display: grid; justify-items: center; align-content: center; gap: 2px;
    border: 0; border-radius: var(--r-pill);
    background: transparent; color: var(--ink);
    font-size: 10px; font-weight: 500;
    transition: background-color .3s var(--ease), color .3s var(--ease), transform .25s var(--ease);
  }
  .tab[aria-current="page"] { background: var(--fill); color: var(--blue); }
  .screen { left: 0; }
  .message-list { padding-top: calc(64px + var(--safe-top)); }
  .composer { padding-bottom: calc(12px + var(--tab-space) + var(--safe-bottom)); }
  .message.user { max-width: 84%; }
  .large-title { font-size: 30px; }
  .wrongbook-question-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .wrongbook-detail-screen-content, .graph-node-page-content { padding-inline: 20px; }
  .paper-title { font-size: 24px; }
  .graph-screen .screen-nav { flex-wrap: wrap; }
  .graph-agent-panel { top: auto; left: 12px; right: 12px; bottom: calc(12px + var(--tab-space) + var(--safe-bottom)); width: auto; max-height: min(52dvh, 420px); }
  .graph-agent-panel.collapsed { left: auto; }
  .zoom-control { top: 4px; bottom: auto; left: 12px; }
  .graph-node-card { width: 216px; }
  .exam-workspace { display: block; overflow: auto; padding-bottom: calc(var(--tab-space) + var(--safe-bottom)); }
  .exam-chat-panel, .exam-preview-panel { overflow: visible; padding: 4px 16px 24px; }
  .exam-preview-panel:has(.exam-empty:not([hidden])) { display: none; }
  .exam-progress-modal { place-items: end stretch; padding: 0; }
  .exam-progress-card { width: 100%; max-height: 82dvh; border-radius: 24px 24px 0 0; padding-bottom: calc(20px + var(--safe-bottom)); }
  .sheet-grabber { display: block; }
  dialog.sheet-dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; padding-top: 12px; }
  dialog.sheet-dialog .sheet-grabber { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .thinking > span:first-child { color: var(--ink-2); background: none; }
}
.dialog-secrets { display: grid; gap: 10px; }
.dialog-secrets:empty { display: none; }
.exam-progress-line.exam-progress-done:last-child::before { border: 0; background: var(--blue-tint); animation: none; }
.exam-progress-line.exam-progress-done:last-child::after { display: block; }
