/* 期末救星 · 讲题工作台（2026-11 改版）
   方向：像 ChatGPT 一样干净——纯白主区、浅灰侧栏、没有底图；空白时输入框居中，开聊后沉到底部。
   配色：近黑墨色 + 中性灰阶为主，品牌蓝 #0066cc 只用在链接、当前项和图板；
         黑色圆形发送键；错题（暖橙）/ 笔记（青绿）两种语义色只出现在小标签上。
   右侧图板仍按桌面端预览窗：有图时自动展开。 */

@font-face {
  font-family: "Ma Shan Zheng";
  src: url("./assets/fonts/ma-shan-zheng.woff2?v=2026071648") format("woff2");
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --side: #f9f9f9;
  --hover: #efefef;
  --active: #e8e8e8;
  --line: #e5e5e5;
  --line-soft: #f0f0f0;
  --ink: #0d0d0d;
  --ink-soft: #3c3c3c;
  --muted: #676767;            /* 白底 5.6:1 */
  --faint: #8e8e8e;            /* 只用于占位符旁的辅助图形，不用于正文 */
  --bubble: #f4f4f4;
  --brand: #0066cc;
  --brand-tint: #eef4fb;
  --brand-line: #cfe0f3;
  --mint: #0f7b55;
  --mint-tint: #e8f5ef;
  --warn: #b4441b;
  --warn-tint: #fcf0ea;
  --send: #0d0d0d;
  --send-off: #d9d9d9;
  --shadow-composer: 0 0 0 1px rgba(0,0,0,.06), 0 4px 18px -6px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.04);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --brush: "Ma Shan Zheng", "Kaiti SC", "STKaiti", KaiTi, cursive;
  --mono: "SF Mono", "Roboto Mono", Menlo, ui-monospace, monospace;
  --side-w: 260px;
  --board-w: clamp(380px, 40vw, 620px);
  --col: 768px;
  --ease: cubic-bezier(.22,1,.36,1);
  /* z 轴：图板抽屉 < 侧栏遮罩 < 侧栏 < 登录门 < 拖放层 < 提示 */
  --z-board: 30; --z-scrim: 35; --z-side: 40; --z-gate: 50; --z-drop: 60; --z-toast: 80;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.fx {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 布局 ---------- */
.fx-app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.fx-app.has-board { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--board-w); }
.fx-app.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.fx-app.side-collapsed.has-board { grid-template-columns: 0 minmax(0, 1fr) var(--board-w); }
.fx-app.side-collapsed .fx-side { visibility: hidden; }

/* ---------- 侧栏 ---------- */
.fx-side {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--side);
  padding: 10px 10px 8px;
}
.fx-side__top { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 2px 0 8px; }
.fx-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); min-width: 0; flex: 1; }
.fx-brand img { flex: none; }
.fx-brand span { font-family: var(--brush); font-size: 22px; line-height: 1; letter-spacing: .02em; white-space: nowrap; }

.fx-icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px; padding: 0;
  border: 0; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.fx-icon-btn:hover { background: var(--hover); color: var(--ink); }
.fx-icon-btn svg { width: 19px; height: 19px; }

.fx-new {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 8px 0 2px; padding: 8px 10px; border-radius: 10px;
  border: 0; background: transparent; text-align: left;
  font-size: 14.5px; font-weight: 500; color: var(--ink);
  transition: background .15s;
}
.fx-new svg { width: 18px; height: 18px; flex: none; }
.fx-new:hover { background: var(--hover); }

.fx-course { display: grid; gap: 3px; margin: 6px 0 6px; padding: 0 10px; font-size: 12px; color: var(--muted); }
.fx-course select {
  width: 100%; padding: 6px 28px 6px 9px; border-radius: 8px;
  border: 1px solid var(--line); background-color: #fff; font-size: 13.5px; color: var(--ink);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}

.fx-nav { display: grid; gap: 1px; padding: 4px 0 8px; }
.fx-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); font-size: 14.5px; text-align: left;
  transition: background .15s;
}
.fx-nav button svg { width: 18px; height: 18px; flex: none; color: var(--ink-soft); }
.fx-nav button span { flex: 1; }
.fx-nav button em {
  font-style: normal; font-family: var(--mono); font-size: 11.5px;
  min-width: 20px; padding: 0 6px; border-radius: 9px; text-align: center; line-height: 18px;
  background: var(--active); color: var(--ink-soft);
}
.fx-nav button:hover { background: var(--hover); }
.fx-nav button.is-active { background: var(--active); font-weight: 600; }

.fx-threads { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: 10px; }
.fx-threads__head { padding: 0 10px 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.fx-threads__list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1px; }
.fx-thread {
  position: relative; display: flex; align-items: center; gap: 4px;
  border-radius: 10px; padding: 0 4px 0 0;
}
.fx-thread > button:first-child {
  flex: 1; min-width: 0; padding: 7px 10px; border: 0; background: transparent; text-align: left;
  font-size: 14px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fx-thread:hover { background: var(--hover); }
.fx-thread.is-active { background: var(--active); }
.fx-thread__del {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); opacity: 0;
}
.fx-thread__del svg { width: 14px; height: 14px; }
.fx-thread:hover .fx-thread__del, .fx-thread.is-active .fx-thread__del, .fx-thread__del:focus-visible { opacity: 1; }
.fx-thread__del:hover { background: #fff; color: var(--warn); }
.fx-threads__empty { padding: 4px 10px; font-size: 13px; color: var(--muted); }

.fx-side__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 6px; padding: 10px 10px 4px; border-top: 1px solid var(--line); font-size: 13px;
}
.fx-user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.fx-side__foot a { flex: none; color: var(--muted); }
.fx-side__foot a:hover { color: var(--ink); }

/* ---------- 主区 ---------- */
.fx-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.fx-top {
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 12px 0 16px; flex: none;
  background: var(--bg);
}
.fx-top__menu { display: none; }
.fx-app.side-collapsed .fx-top__menu { display: inline-grid; }
.fx-top__title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.fx-top__title strong { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-top__title span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.fx-board-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  transition: background .15s;
}
.fx-board-toggle:hover { background: var(--side); }
.fx-board-toggle svg { width: 16px; height: 16px; }
.fx-board-toggle em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--brand); }
.fx-board-toggle[aria-pressed="true"] { background: var(--brand-tint); border-color: var(--brand-line); color: var(--brand); }
.fx-board-toggle.has-new em::after { content: " 新"; }

.fx-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fx-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* ---------- 讲题：空白态（输入框居中） ---------- */
.fx-welcome { max-width: var(--col); margin: 0 auto; padding: 0 24px; text-align: center; }
.fx-welcome h1 {
  margin: 0; font-weight: 600; font-size: clamp(24px, 3vw, 30px); line-height: 1.3; letter-spacing: -.01em;
  color: var(--ink); text-wrap: balance;
}
.fx-welcome p { max-width: 34em; margin: 10px auto 0; color: var(--muted); font-size: 15px; text-wrap: balance; }

.fx-view[data-panel="chat"].is-empty { justify-content: center; padding-bottom: 8vh; }
.fx-view[data-panel="chat"].is-empty .fx-scroll { flex: 0 0 auto; overflow: visible; }
.fx-view[data-panel="chat"].is-empty .fx-welcome { padding-bottom: 26px; }
.fx-view[data-panel="chat"]:not(.is-empty) .fx-examples,
.fx-view[data-panel="chat"]:not(.is-empty) .fx-welcome { display: none; }

.fx-examples {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 16px auto 0; padding: 0 4px;
}
.fx-examples button {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-size: 13.5px;
  transition: background .15s, border-color .15s;
}
.fx-examples button b { font-weight: 600; color: var(--ink); }
.fx-examples button span { color: var(--muted); }
.fx-examples button:hover { background: var(--side); border-color: #d6d6d6; }

/* ---------- 消息 ---------- */
.fx-messages { max-width: var(--col); margin: 0 auto; padding: 12px 24px 24px; display: grid; gap: 26px; }
.fx-msg { min-width: 0; }
.fx-msg--user { justify-self: end; max-width: min(80%, 560px); display: grid; justify-items: end; gap: 6px; }
.fx-msg--user .fx-msg__body {
  padding: 10px 16px; border-radius: 20px;
  background: var(--bubble); color: var(--ink); white-space: pre-wrap; word-break: break-word;
}
.fx-msg__intent { font-size: 12px; color: var(--muted); padding: 0 6px; }
.fx-msg--bot .fx-msg__body { color: var(--ink); word-break: break-word; }
.fx-msg__body p { margin: 0 0 .8em; }
.fx-msg__body p:last-child { margin-bottom: 0; }
.fx-msg__body ul, .fx-msg__body ol { margin: 0 0 .8em; padding-left: 1.4em; }
.fx-msg__body li { margin: .2em 0; }
.fx-msg__body strong { font-weight: 650; }
.fx-msg__body code { font-family: var(--mono); font-size: .88em; padding: 1px 5px; border-radius: 5px; background: var(--bubble); }
.fx-msg__body .katex-display { margin: .7em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
/* “看到什么 → 想到什么”方向提示：灰底一整块，不用侧边色条 */
.fx-msg__body .fx-dir {
  display: block; margin: 0 0 .9em; padding: 10px 14px; border-radius: 12px;
  background: var(--side); color: var(--ink); border: 1px solid var(--line);
}
.fx-msg__body .fx-sum { display: block; margin: .9em 0 .3em; padding-top: .8em; border-top: 1px solid var(--line); }

.fx-msg__figs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fx-figchip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 7px 12px 7px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px;
  transition: background .15s, border-color .15s;
}
.fx-figchip svg { width: 16px; height: 16px; flex: none; color: var(--brand); }
.fx-figchip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-figchip:hover { background: var(--side); }
.fx-figchip.is-active { background: var(--brand-tint); border-color: var(--brand-line); }

.fx-msg__saved { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fx-saved {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 10px; border-radius: 8px; font-size: 12.5px;
}
.fx-saved--wrong { background: var(--warn-tint); color: #8a3414; }
.fx-saved--note { background: var(--mint-tint); color: #0b6044; }
.fx-saved button {
  border: 0; background: transparent; padding: 1px 6px; border-radius: 6px;
  color: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px;
}
.fx-saved button:hover { background: rgba(255,255,255,.7); }
.fx-saved.is-undone { opacity: .55; text-decoration: line-through; }
.fx-msg__src { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* 讲解下面的“有帮助 / 没有用” */
.fx-rate { margin-top: 6px; }
.fx-rate__btns { display: flex; gap: 2px; margin-left: -8px; }
.fx-rate__btns button {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--faint);
  transition: background .15s, color .15s;
}
.fx-rate__btns button:hover { background: var(--hover); color: var(--ink-soft); }
.fx-rate__btns button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.fx-rate__btns svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fx-rate__btns button[aria-pressed="true"] { color: var(--ink); }
.fx-rate__btns button[aria-pressed="true"] svg { fill: currentColor; }
.fx-rate__form { max-width: 520px; margin-top: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; }
.fx-rate__form p { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.fx-rate__reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.fx-rate__reasons button {
  min-height: 34px; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-soft); font-size: 13.5px;
}
.fx-rate__reasons button:hover { background: var(--side); }
.fx-rate__reasons button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.fx-rate__reasons button[aria-pressed="true"] { border-color: var(--brand-line); background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.fx-rate__form textarea {
  display: block; width: 100%; margin-top: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5; resize: vertical;
}
.fx-rate__form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.fx-rate__include { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; }
.fx-rate__include input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ink); }
.fx-rate__row { display: flex; gap: 8px; margin-top: 12px; }

/* 摸底题卡片（图片题先摸底再讲） */
.fx-quiz {
  margin-top: 14px; padding: 14px 16px 12px; border-radius: 16px;
  border: 1px solid var(--line); background: #fff;
}
.fx-quiz__head { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 10px; font-size: 12.5px; }
.fx-quiz__tag {
  flex: none; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand); font-weight: 600;
}
.fx-quiz__point { min-width: 0; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-quiz__state { flex: none; margin-left: auto; color: var(--muted); }
.fx-quiz--pending .fx-quiz__state { color: var(--ink); font-weight: 600; }
.fx-quiz__open { margin-top: 2px; }
.fx-quiz__act {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.fx-quiz__act p { flex: 1 1 200px; margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.fx-quiz__act button {
  flex: none; min-height: 34px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13.5px;
  transition: background .15s, border-color .15s;
}
.fx-quiz__act button:hover { background: var(--side); border-color: #d6d6d6; }
.fx-quiz__act button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fx-quiz--answered .fx-quiz__tag, .fx-quiz--skipped .fx-quiz__tag { background: var(--bubble); color: var(--muted); }
@media (max-width: 760px) {
  .fx-quiz { padding: 12px 13px 10px; }
  .fx-quiz__act p { flex-basis: 100%; }
}

/* 用户消息里的附件 */
.fx-msg__atts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.fx-msg__atts img { display: block; width: 132px; height: 132px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }

/* 思考中：布斯 B 磁流体动画 + 文字 */
.fx-thinking { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; color: var(--muted); font-size: 14px; }
.fx-thinking busi-thinking { width: 28px; height: 28px; flex: none; }
.fx-thinking span { background: linear-gradient(90deg, var(--muted) 0 40%, #b5b5b5 50%, var(--muted) 60% 100%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: fx-shine 2.4s linear infinite; }
@keyframes fx-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
.fx-thinking .fx-thinking__plain { background: none; color: var(--muted); animation: none; }
.fx-typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.fx-typing i { width: 6px; height: 6px; border-radius: 50%; background: #b5b5b5; animation: fx-dot 1.2s infinite ease-in-out; }
.fx-typing i:nth-child(2) { animation-delay: .15s; }
.fx-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes fx-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.fx-error { color: var(--warn); font-size: 14px; }
.fx-error button { margin-left: 8px; border: 0; background: transparent; color: var(--ink); text-decoration: underline; }

/* ---------- 输入框 ---------- */
.fx-composer-wrap { flex: none; max-width: var(--col); width: 100%; margin: 0 auto; padding: 4px 24px 12px; }
.fx-composer {
  position: relative; display: grid; gap: 2px;
  padding: 10px 10px 8px 12px; border-radius: 26px;
  background: #fff; box-shadow: var(--shadow-composer);
  transition: box-shadow .2s;
}
.fx-composer:focus-within { box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 6px 22px -6px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.05); }
.fx-composer textarea {
  width: 100%; min-height: 28px; max-height: 240px; resize: none; border: 0; outline: 0; background: transparent;
  padding: 4px 6px; line-height: 1.55; font-size: 15.5px;
}
.fx-composer textarea::placeholder { color: var(--muted); }
.fx-composer__bar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fx-attach-btn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 0;
  transition: background .15s;
}
.fx-attach-btn:hover { background: var(--side); }
.fx-attach-btn svg { width: 19px; height: 19px; }
.fx-intents { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.fx-intents::-webkit-scrollbar { display: none; }
.fx-intents button {
  flex: none; padding: 6px 11px; border-radius: 999px; font-size: 13px;
  border: 0; background: transparent; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.fx-intents button:hover { background: var(--hover); color: var(--ink); }
.fx-intents button.is-on { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.fx-send {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  color: #fff; background: var(--send);
  transition: background .15s, transform .15s;
}
.fx-send svg { width: 18px; height: 18px; stroke-width: 2.4; }
.fx-send:hover { background: #2f2f2f; }
.fx-send:active { transform: scale(.94); }
.fx-send:disabled { background: var(--send-off); cursor: default; transform: none; }
.fx-composer__note { margin: 8px 4px 0; font-size: 12px; color: var(--muted); text-align: center; }

/* 待发送附件 */
.fx-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 8px; }
.fx-att {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 240px;
  height: 56px; padding: 0 30px 0 8px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
}
.fx-att--img { width: 56px; padding: 0; overflow: hidden; }
.fx-att--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fx-att__icon { flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: #fff; font: 700 10.5px var(--sans); letter-spacing: .04em; }
.fx-att__icon--pdf { background: #e0473a; }
.fx-att__icon--docx { background: #2b6fd6; }
.fx-att__meta { display: grid; min-width: 0; line-height: 1.3; }
.fx-att__meta strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-att__meta span { font-size: 12px; color: var(--muted); }
.fx-att__x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; border: 0; background: var(--ink); color: #fff;
  box-shadow: 0 0 0 2px #fff;
}
.fx-att__x svg { width: 12px; height: 12px; stroke-width: 2.6; }
.fx-att.is-busy::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(255,255,255,.6); }

/* 拖文件进讲题区 */
.fx-dropzone {
  position: absolute; inset: 8px; z-index: var(--z-drop); display: grid; place-items: center; pointer-events: none;
  border-radius: 20px; border: 2px dashed #bdbdbd; background: rgba(255,255,255,.92);
  font-size: 16px; font-weight: 600; color: var(--ink);
}
.fx-dropzone small { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--muted); text-align: center; }

/* ---------- 通用页面（错题本/笔记/练习/材料） ---------- */
.fx-page { max-width: 920px; margin: 0 auto; padding: 24px 28px 48px; }
.fx-page--narrow { max-width: 720px; }
.fx-page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.fx-page__head h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.fx-page__head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.fx-page__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.fx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.fx-btn svg { width: 16px; height: 16px; }
.fx-btn:hover { background: var(--side); }
.fx-btn:active { transform: scale(.98); }
.fx-btn.is-primary { border-color: var(--send); background: var(--send); color: #fff; }
.fx-btn.is-primary:hover { background: #2f2f2f; color: #fff; }
.fx-btn--sm { min-height: 30px; padding: 4px 11px; font-size: 13px; }
.fx-btn--danger { color: var(--warn); }
.fx-btn--danger:hover { border-color: #ecc5b4; background: var(--warn-tint); color: var(--warn); }
.fx-btn:disabled { opacity: .5; cursor: default; }

.fx-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--side); border: 1px solid var(--line); }
.fx-seg button { border: 0; background: transparent; padding: 5px 13px; border-radius: 999px; font-size: 13px; color: var(--ink-soft); }
.fx-seg button.is-on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.fx-empty {
  padding: 48px 20px; text-align: center; color: var(--muted); font-size: 14px;
  border: 1px dashed var(--line); border-radius: 16px;
}

/* 错题 */
.fx-list { display: grid; gap: 12px; }
.fx-wrong { padding: 16px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.fx-wrong.is-done { background: #fcfcfc; }
.fx-wrong__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.fx-tag { padding: 1px 8px; border-radius: 6px; background: var(--warn-tint); color: #8a3414; font-size: 12px; font-weight: 600; }
.fx-wrong.is-done .fx-tag { background: var(--mint-tint); color: #0b6044; }
.fx-wrong__q { margin: 0 0 12px; font-size: 15px; font-weight: 600; white-space: pre-wrap; }
.fx-wrong__rows { display: grid; gap: 8px; margin: 0; }
.fx-wrong__rows div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.fx-wrong__rows dt { color: var(--muted); }
.fx-wrong__rows dd { margin: 0; white-space: pre-wrap; }
.fx-wrong__rows .is-mine dd { color: #8a3414; }
.fx-wrong__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* 笔记 */
.fx-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.fx-note { display: flex; flex-direction: column; padding: 16px 16px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.fx-note h3 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.fx-note__flow { display: grid; gap: 6px; margin: 0 0 10px; font-size: 14px; }
.fx-note__flow b { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.fx-note__arrow { color: var(--mint); font-size: 13px; line-height: 1; }
.fx-note p { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-soft); }
.fx-note p em { font-style: normal; color: var(--warn); }
.fx-note__foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.fx-note__foot button { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.fx-note__foot button:hover { color: var(--warn); }
.fx-note-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 18px; padding: 16px; border-radius: 16px; background: var(--side); border: 1px solid var(--line);
}
.fx-note-form label, .fx-dialog label, .fx-practice-start label { display: grid; gap: 5px; font-size: 13px; color: var(--ink-soft); }
.fx-note-form label:nth-child(4) { grid-column: 1 / -1; }
.fx-note-form input, .fx-note-form textarea, .fx-dialog input, .fx-dialog textarea, .fx-practice-start input, .fx-practice input {
  width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--ink);
}
.fx-note-form input:focus, .fx-note-form textarea:focus, .fx-dialog input:focus, .fx-dialog textarea:focus,
.fx-practice-start input:focus, .fx-practice input:focus { outline: 0; border-color: #a9a9a9; }
.fx-note-form textarea, .fx-dialog textarea { resize: vertical; }
.fx-note-form__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

/* 练习 */
.fx-practice-start { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.fx-practice { display: grid; gap: 14px; }
.fx-practice__meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.fx-practice__q { padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
.fx-practice__prompt { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.fx-practice__prompt p { margin: 0 0 .5em; }
.fx-wrong__q p { margin: 0 0 .4em; }
.fx-options { display: grid; gap: 8px; }
.fx-options button {
  display: flex; gap: 10px; padding: 10px 14px; border-radius: 12px; text-align: left;
  border: 1px solid var(--line); background: #fff; font-size: 14.5px;
}
.fx-options button b { color: var(--muted); }
.fx-options button:hover { background: var(--side); }
.fx-options button.is-picked { border-color: var(--ink); background: var(--side); }
.fx-options button.is-right { border-color: var(--mint); background: var(--mint-tint); }
.fx-options button.is-wrong { border-color: var(--warn); background: var(--warn-tint); }
.fx-result { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.fx-result.is-right { background: var(--mint-tint); color: #0b6044; }
.fx-result.is-wrong { background: var(--warn-tint); color: #7d2f12; }
.fx-practice__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 材料 */
.fx-drop {
  display: grid; justify-items: center; gap: 6px; padding: 30px 20px; text-align: center; cursor: pointer;
  border-radius: 16px; border: 1.5px dashed #cfcfcf; background: var(--side); color: var(--ink-soft);
  transition: background .15s, border-color .15s;
}
.fx-drop svg { width: 28px; height: 28px; color: var(--ink-soft); }
.fx-drop span { font-size: 13px; color: var(--muted); }
.fx-drop.is-over, .fx-drop:hover { background: #f2f2f2; border-color: #a9a9a9; }
.fx-files { display: grid; gap: 8px; margin-top: 16px; }
.fx-file {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 14px;
}
.fx-file strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-file span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.fx-file .is-bad { color: var(--warn); }

/* ---------- 右侧图板 ---------- */
.fx-board {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border-left: 1px solid var(--line); background: #fcfcfc;
}
.fx-board__head {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 8px 0 16px; flex: none;
  border-bottom: 1px solid var(--line-soft); background: #fff;
}
.fx-board__head > strong { font-size: 14px; font-weight: 600; flex: none; }
.fx-board__tabs { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0 4px; }
.fx-board__tabs::-webkit-scrollbar { display: none; }
.fx-board__tabs button {
  flex: none; max-width: 160px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid transparent; background: transparent; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fx-board__tabs button:hover { background: var(--side); }
.fx-board__tabs button[aria-selected="true"] { background: var(--brand-tint); border-color: var(--brand-line); color: var(--brand); font-weight: 600; }
.fx-board__body { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.fx-board__empty { margin: 30% auto 0; max-width: 260px; text-align: center; color: var(--muted); font-size: 14px; }
.fx-board__sources { flex: none; max-height: 30%; overflow: auto; padding: 10px 16px 14px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-soft); }
.fx-board__sources b { display: block; margin-bottom: 4px; color: var(--muted); font-weight: 600; }
.fx-board__sources p { margin: 0 0 6px; }

.fx-figure { border-radius: 16px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.fx-figure__title { padding: 12px 16px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--line-soft); }
.fx-figure__title small { margin-left: 8px; font-weight: 400; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.fx-figure__canvas { padding: 16px; display: grid; place-items: center; }
.fx-figure__canvas svg.fx-svg { width: 100%; height: auto; display: block; }
.fx-figure__canvas .fx-formula { width: 100%; display: grid; gap: 4px; overflow-x: auto; }
.fx-figure__canvas .fx-formula .katex-display { margin: .35em 0; }
.fx-figure__note { padding: 0 16px 14px; font-size: 12.5px; color: var(--muted); }
/* 图板里的摸底题题卡：试卷样式 */
.fx-figure__canvas .fx-paper { width: 100%; }
.fx-paper { display: grid; gap: 14px; color: var(--ink); }
.fx-paper__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.fx-paper__head strong { font-family: var(--brush); font-size: 24px; font-weight: 400; letter-spacing: .08em; }
.fx-paper__state { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.fx-paper--answered .fx-paper__state, .fx-paper--skipped .fx-paper__state { background: var(--bubble); color: var(--muted); }
.fx-paper__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.fx-paper__row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; }
.fx-paper__no { font-weight: 650; font-size: 16.5px; line-height: 1.7; }
.fx-paper__q { min-width: 0; font-size: 16.5px; line-height: 1.7; overflow-x: auto; }
.fx-paper__q p { margin: 0 0 .5em; }
.fx-paper__q p:last-child { margin-bottom: 0; }
.fx-paper__q .katex-display { margin: .4em 0; }
.fx-paper__area {
  position: relative; height: 150px; border-radius: 10px; border: 1px dashed #cfcfcf;
  background: repeating-linear-gradient(to bottom, transparent 0 35px, var(--line-soft) 35px 36px);
}
.fx-paper__area span { position: absolute; top: 8px; left: 12px; font-size: 12px; color: var(--muted); }
.fx-paper__tip { margin: 0; font-size: 13px; color: var(--ink-soft); }
.fx-figure__error { padding: 24px; color: var(--muted); font-size: 13.5px; text-align: center; }

/* SVG 里的元素 */
.fx-svg .w { stroke: #1a1a1a; stroke-width: 2; fill: none; }
.fx-svg .body { stroke: #1a1a1a; stroke-width: 2; fill: #fff; }
.fx-svg .fill { fill: #1a1a1a; stroke: none; }
.fx-svg .lbl { font: 600 14px var(--sans); fill: #1a1a1a; stroke: none; }
.fx-svg .lbl tspan.sub { font-size: 10.5px; }
.fx-svg .lbl-blue { fill: var(--brand); }
.fx-svg .flow { stroke: var(--brand); stroke-width: 2; fill: none; }
.fx-svg .flowfill { fill: var(--brand); stroke: none; }
.fx-svg .axis { stroke: #8a8a8a; stroke-width: 1.2; }
.fx-svg .grid { stroke: #efefef; stroke-width: 1; }
.fx-svg .tick { font: 11px var(--mono); fill: #767676; stroke: none; }
.fx-svg .fo { overflow: visible; }
.fx-svg .fo div { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #1a1a1a; white-space: nowrap; }
.fx-svg .fo .katex { font-size: 1.18em; }

/* ---------- 登录门 / 弹窗 / 提示 ---------- */
.fx-gate { position: fixed; inset: 0; z-index: var(--z-gate); display: grid; place-items: center; padding: 24px; background: rgba(255,255,255,.88); backdrop-filter: blur(6px); }
.fx-gate__card { max-width: 400px; text-align: center; padding: 32px 28px; border-radius: 20px; background: #fff; border: 1px solid var(--line); box-shadow: 0 24px 60px -30px rgba(0,0,0,.3); }
.fx-gate__card h1 { margin: 0; font-weight: 600; font-size: 24px; }
.fx-gate__card p { color: var(--muted); margin: 10px 0 22px; }
.fx-gate__card div { display: flex; justify-content: center; gap: 10px; }

.fx-dialog { width: min(440px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 80px -30px rgba(0,0,0,.4); }
.fx-dialog::backdrop { background: rgba(0,0,0,.28); }
.fx-dialog form { display: grid; gap: 14px; padding: 22px; }
.fx-dialog h2 { margin: 0; font-size: 18px; font-weight: 650; }
.fx-dialog__actions { display: flex; gap: 8px; align-items: center; }
.fx-dialog__actions span { flex: 1; }

.fx-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: var(--z-toast); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.2);
}
.fx-scrim { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  :root { --side-w: 240px; --board-w: clamp(340px, 42vw, 520px); }
}
/* 中屏：图板浮在主区上方（像桌面端窄窗时的预览抽屉） */
@media (max-width: 1020px) {
  .fx-app.has-board, .fx-app.side-collapsed.has-board { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .fx-app.side-collapsed.has-board { grid-template-columns: 0 minmax(0, 1fr); }
  .fx-board {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-board); width: min(560px, 92vw);
    box-shadow: -24px 0 60px -30px rgba(0,0,0,.35);
  }
}
/* 手机：侧栏抽屉，图板底部弹出；空白态输入框留在底部（拇指够得着） */
@media (max-width: 760px) {
  body.fx { font-size: 15.5px; }
  .fx-app, .fx-app.has-board, .fx-app.side-collapsed, .fx-app.side-collapsed.has-board { grid-template-columns: minmax(0, 1fr); }
  .fx-side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-side); width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .25s var(--ease), box-shadow .25s;
  }
  .fx-app.side-open .fx-side { transform: none; visibility: visible; box-shadow: 24px 0 60px -30px rgba(0,0,0,.35); }
  .fx-app.side-collapsed .fx-side { visibility: visible; }
  .fx-scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: rgba(0,0,0,.25); display: block; }
  .fx-top__menu { display: inline-grid; }
  .fx-top { padding: 0 8px; gap: 6px; }
  .fx-top__title span { display: none; }
  .fx-board-toggle span { display: none; }
  .fx-board {
    top: auto; left: 0; right: 0; width: auto; height: min(78vh, 640px);
    border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    box-shadow: 0 -24px 60px -30px rgba(0,0,0,.4);
  }
  .fx-board__head { border-radius: 18px 18px 0 0; }
  .fx-board__body { padding: 12px; }
  .fx-view[data-panel="chat"].is-empty { justify-content: flex-start; padding-bottom: 0; }
  .fx-view[data-panel="chat"].is-empty .fx-scroll { flex: 1 1 auto; display: grid; align-content: center; overflow: auto; }
  .fx-welcome { padding: 0 20px; }
  .fx-examples { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin: 0 0 8px; padding: 0 0 2px; scrollbar-width: none; }
  .fx-examples::-webkit-scrollbar { display: none; }
  .fx-examples button { flex: none; }
  .fx-view[data-panel="chat"].is-empty .fx-composer-wrap { display: flex; flex-direction: column-reverse; }
  .fx-messages { padding: 8px 16px 16px; gap: 22px; }
  .fx-msg--user { max-width: 88%; }
  .fx-composer-wrap { padding: 4px 10px calc(8px + env(safe-area-inset-bottom)); }
  .fx-composer { border-radius: 24px; }
  .fx-composer__note { display: none; }
  .fx-page { padding: 18px 16px 40px; }
  .fx-note-form { grid-template-columns: minmax(0, 1fr); }
  .fx-practice-start { grid-template-columns: minmax(0, 1fr); }
  .fx-wrong__rows div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fx-file { grid-template-columns: minmax(0, 1fr) auto; }
  .fx-file span:nth-of-type(1) { display: none; }
  .fx-msg__atts img { width: 104px; height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx-thinking span { color: var(--muted); background: none; }
}

/* ---------- 统一顶部导航适配（hbu-globalnav.js 提供 --gn-h） ---------- */
html.gn-on .fx-app { height: calc(100vh - var(--gn-h, 52px) - var(--gn-tab-h, 0px)); height: calc(100dvh - var(--gn-h, 52px) - var(--gn-tab-h, 0px)); }
/* 手机底部有标签栏时，安全区由标签栏让出，输入框不用再让一次 */
@media (max-width: 833px) { html.gn-tabs-on .fx-composer-wrap { padding-bottom: 8px; } }
html.gn-on .fx-gate { top: var(--gn-h, 52px); }
html.gn-on .fx-brand img { display: none; }
@media (max-width: 1020px) { html.gn-on .fx-board { top: var(--gn-h, 52px); } }
@media (max-width: 760px) {
  html.gn-on .fx-side, html.gn-on .fx-scrim { top: var(--gn-h, 52px); }
  html.gn-on .fx-board { top: auto; }
}

/* ---------- 摸底与计划 ---------- */
.fx-page--plan { max-width: 820px; }
.fx-plan-intro { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.fx-plan-intro h2 { margin: 0 0 10px; font-size: 26px; font-weight: 650; letter-spacing: -.01em; }
.fx-plan-intro p { margin: 0 0 22px; color: var(--ink-soft); font-size: 15px; line-height: 1.75; }
.fx-plan-intro .fx-btn { min-height: 44px; padding: 10px 22px; font-size: 15px; }
.fx-plan-intro__hint { margin-top: 14px !important; font-size: 13px !important; color: var(--muted) !important; }
.fx-plan-loading { display: grid; justify-items: center; gap: 10px; margin: 14vh auto 0; text-align: center; color: var(--muted); }
.fx-plan-loading busi-thinking { width: 40px; height: 40px; }
.fx-plan-loading strong { color: var(--ink); font-size: 17px; font-weight: 600; }
.fx-plan-date { display: flex; align-items: flex-end; justify-content: center; gap: 10px; flex-wrap: wrap; }
.fx-plan-date label { display: grid; gap: 5px; text-align: left; font-size: 13px; color: var(--ink-soft); }
.fx-plan-date input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* 试卷 */
.fx-exam { padding: 28px 32px 0; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.fx-exam__head { padding-bottom: 14px; margin-bottom: 8px; border-bottom: 2px solid var(--ink); }
.fx-exam__head h2 { margin: 0; font-family: var(--brush); font-size: 30px; font-weight: 400; letter-spacing: .1em; }
.fx-exam__head p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.fx-exam__head .fx-exam__tip { color: var(--ink-soft); }
.fx-exam__module { padding: 16px 0 6px; border-bottom: 1px solid var(--line-soft); }
.fx-exam__module h3 { margin: 0 0 10px; font-size: 16px; font-weight: 650; }
.fx-exam__module h3 span { color: var(--muted); font-weight: 500; }
.fx-exam__q { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px; padding: 8px 0 14px; }
.fx-exam__no { font-weight: 650; font-size: 15.5px; line-height: 1.65; }
.fx-exam__body { min-width: 0; }
.fx-exam__body > .fx-msg__body { font-size: 15.5px; overflow-x: auto; }
.fx-exam__ans { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--side); border: 1px solid var(--line-soft); font-size: 14.5px; }
.fx-exam__ans > b { display: block; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fx-exam__ans details { margin-top: 6px; }
.fx-exam__ans summary { cursor: pointer; font-size: 13px; color: var(--brand); }
.fx-mark { display: inline-flex; gap: 6px; margin-top: 10px; }
.fx-mark button {
  min-width: 64px; min-height: 34px; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-size: 14px;
  transition: background .15s, border-color .15s, color .15s;
}
.fx-mark button:hover { background: var(--side); }
.fx-mark button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fx-mark .fx-mark--right.is-on { background: var(--mint-tint); border-color: #a9d8c3; color: #0b6044; font-weight: 600; }
.fx-mark .fx-mark--half.is-on { background: #fdf6e3; border-color: #ead7a4; color: #7a5a0c; font-weight: 600; }
.fx-mark .fx-mark--wrong.is-on { background: var(--warn-tint); border-color: #ecc5b4; color: #8a3414; font-weight: 600; }
.fx-exam__foot {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  margin: 0 -32px; padding: 14px 32px; border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96); border-radius: 0 0 18px 18px; font-size: 13.5px; color: var(--muted);
}

/* 计划 */
.fx-plan { display: grid; gap: 22px; }
.fx-plan__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fx-plan__head h2 { margin: 0; font-size: 22px; font-weight: 650; }
.fx-plan__head p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.fx-plan h3 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.fx-plan__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fx-stat { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--side); border: 1px solid var(--line-soft); }
.fx-stat b { font-size: 22px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-stat b small { margin-left: 3px; font-size: 13px; font-weight: 500; color: var(--muted); }
.fx-stat span { font-size: 12.5px; color: var(--muted); }
.fx-stat em { font-style: normal; font-size: 12px; color: var(--mint); font-weight: 600; }
.fx-stat { position: relative; }
.fx-stat__edit {
  position: absolute; top: 8px; right: 8px; min-height: 32px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--brand); font-size: 13px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.fx-stat__edit::after { content: ""; position: absolute; inset: -6px; }   /* 触控区补到 44px */
.fx-stat__edit:hover, .fx-stat__edit[aria-expanded="true"] { background: var(--brand-tint); border-color: var(--brand-line); }
.fx-plan__dateedit {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -10px;
  padding: 12px 14px; border-radius: 14px; background: var(--brand-tint); border: 1px solid var(--brand-line);
}
.fx-plan__dateedit[hidden] { display: none; }
.fx-plan__dateedit label { font-size: 14px; font-weight: 500; color: var(--ink); }
.fx-plan__dateedit input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; }
.fx-plan__dateedit .fx-btn { min-height: 40px; }
.fx-plan__notice + .fx-plan__dateedit { margin-top: -10px; }
.fx-plan__notice { padding: 10px 14px; border-radius: 12px; background: #fdf6e3; border: 1px solid #f0e2b8; font-size: 13.5px; color: #6b4f0b; }
.fx-plan__notice p { margin: 0; }
.fx-plan__notice p + p { margin-top: 4px; }
.fx-plan__mods { display: grid; gap: 8px; }
.fx-plan__mod { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 34px 40px; align-items: center; gap: 10px; font-size: 14px; }
.fx-plan__mod-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-plan__bar { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.fx-plan__bar i { display: block; height: 100%; border-radius: inherit; background: var(--mint); }
.fx-plan__mod--weak .fx-plan__bar i { background: var(--warn); }
.fx-plan__mod--mid .fx-plan__bar i { background: #c99a1e; }
.fx-plan__mod b { text-align: right; font-variant-numeric: tabular-nums; }
.fx-plan__mod em { font-style: normal; font-size: 12px; color: var(--muted); }
.fx-plan__mod--weak em { color: var(--warn); font-weight: 600; }
.fx-phase { margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; vertical-align: 1px; background: var(--brand-tint); color: var(--brand); }
.fx-phase--review { background: #fdf6e3; color: #7a5a0c; }
.fx-phase--final { background: var(--mint-tint); color: #0b6044; }
.fx-plan__today { display: grid; gap: 10px; }
.fx-plan__today h3 { margin-bottom: 0; }
.fx-task { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.fx-task.is-done { background: #fcfcfc; }
.fx-task.is-done strong { color: var(--muted); text-decoration: line-through; text-decoration-color: #c4c4c4; }
.fx-task__main { min-width: 0; }
.fx-task__main strong { font-size: 15px; font-weight: 600; }
.fx-task__main p { margin: 4px 0 2px; font-size: 13.5px; color: var(--ink-soft); }
.fx-task__main small { font-size: 12px; color: var(--muted); }
.fx-task__act { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; max-width: 260px; }
.fx-task__state { font-size: 12.5px; color: var(--mint); }
.fx-task__act > button:not(.fx-btn) { border: 0; background: transparent; color: var(--muted); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.fx-plan__days { display: grid; gap: 0; }
.fx-plan__day { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.fx-plan__date { color: var(--ink-soft); white-space: nowrap; }
.fx-plan__day ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.fx-plan__day li small { color: var(--muted); font-size: 12px; }
.fx-plan__day li.is-done { color: var(--muted); text-decoration: line-through; }
.fx-plan__days > .fx-btn { justify-self: start; margin-top: 10px; }

@media (max-width: 760px) {
  .fx-plan-intro { margin-top: 4vh; }
  .fx-plan-intro h2 { font-size: 22px; }
  .fx-exam { padding: 20px 16px 0; border-radius: 14px; }
  .fx-exam__head h2 { font-size: 26px; }
  .fx-exam__foot { margin: 0 -16px; padding: 12px 16px; }
  .fx-plan__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-plan__dateedit input { flex: 1 1 150px; min-width: 0; height: 44px; }
  .fx-plan__dateedit .fx-btn { min-height: 44px; flex: 1 1 auto; }
  .fx-plan__dateedit label { flex: 1 0 100%; }
  .fx-plan__mod { grid-template-columns: minmax(0, 1fr) 70px 30px 36px; }
  .fx-task { flex-direction: column; }
  .fx-task__act { max-width: none; justify-content: flex-start; }
  .fx-plan__day { grid-template-columns: 1fr; gap: 4px; }
}
.fx-exam__fig { margin-top: 10px; max-width: 560px; }
.fx-exam__fig .fx-figure__title { padding: 8px 12px; font-size: 12.5px; }
.fx-exam__fig .fx-figure__canvas { padding: 10px; }
.fx-exam__fig .fx-stage { max-width: min(100%, 520px) !important; }
.fx-plan-loading em { font-style: normal; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 图的舞台：svg + 公式覆盖层（不用 foreignObject，Safari 缩放时位置才准）；图板里可缩放、拖动 */
.fx-stage { position: relative; width: 100%; margin: 0 auto; overflow: hidden; container-type: inline-size; border-radius: 8px; }
.fx-stage__inner { position: relative; transform-origin: 0 0; }   /* 不加 will-change：缩放后浏览器按新尺寸重绘矢量，不发糊 */
.fx-stage .tex-anchor { opacity: 0; }
.fx-tex-layer { position: absolute; inset: 0; pointer-events: none; color: #1a1a1a; }
.fx-tex { position: absolute; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: visible; }
.fx-tex--start { justify-content: flex-start; }
.fx-tex--end { justify-content: flex-end; }
.fx-tex .katex { font-size: 1.18em; }
.fx-stage.is-zoomable { touch-action: none; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.fx-stage.is-zoomable.is-zoomed { cursor: grab; }
.fx-stage.is-zoomable.is-dragging { cursor: grabbing; }
.fx-zoombar {
  position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; background: rgba(255,255,255,.94); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.08);
  opacity: .55; transition: opacity .15s;
}
.fx-stage:hover .fx-zoombar, .fx-zoombar:focus-within { opacity: 1; }
.fx-zoombar button { min-width: 28px; height: 26px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 13px; }
.fx-zoombar button:hover { background: var(--side); }
.fx-zoombar span { min-width: 40px; text-align: center; font: 12px var(--mono); color: var(--muted); }
@media (hover: none) { .fx-zoombar { opacity: 1; } }

/* 对话和图板之间的分界线：可拖动改宽度（桌面布局才有） */
.fx-board__resize {
  position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; z-index: 2; cursor: col-resize; touch-action: none;
}
.fx-board__resize::after { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .15s; }
.fx-board__resize:hover::after, .fx-board__resize.is-active::after, .fx-board__resize:focus-visible::after { background: var(--brand); }
.fx-board__resize:focus-visible { outline: none; }
.fx-app.is-resizing, .fx-app.is-resizing * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 1020px) { .fx-board__resize { display: none; } }
@media (min-width: 1021px) { .fx-board { position: relative; } }

/* ---------- 手机浏览器（iPhone / 鸿蒙）：顶栏照 App 的标题栏 ---------- */
@media (max-width: 833px) {
  html.gn-app .fx-top { height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  html.gn-app .fx-top__title strong { font-size: 17.5px; }
  html.gn-app .fx-top__title strong.is-brush { font-family: 'HBU Brush', 'Ma Shan Zheng', 'Kaiti SC', STKaiti, KaiTi, cursive; font-size: 26px; font-weight: 400; line-height: 1.15; }
}
