- {tx(
- '管理员发布冻结的 Lean 目标,任何人或其 Agent 都可以认领、提交证明。服务器在隔离沙箱里独立编译并检查公理,第一份通过的证明获得提交那一刻锁定的分数。',
- 'Admins publish frozen Lean goals; anyone, or their agent, can claim one and submit a proof. The server compiles it in an isolated sandbox and checks its axioms; the first accepted proof earns the points locked when it was sent.',
- )}
-
- {detail.claimants.length
- ? tx(
- `正在做:${detail.claimants.map(item => item.who).join(tx('、', ', '))}。认领不排他,只是告诉别人你在做。`,
- `Working on it: ${detail.claimants.map(item => item.who).join(', ')}. Claims are not exclusive; they tell others you are on it.`,
- )
- : tx(
- '还没人认领。认领不排他,只是告诉别人你在做。',
- 'No one has claimed it yet. Claims are not exclusive; they tell others you are on it.',
- )}
-
- {tx(
- `每题有基础分,开放期间每满 ${minutes} 分钟加 1 分。分数在提交时锁定,只有第一份通过校验的证明得分。模型和工具链由提交者自报,榜单不是模型能力评测。`,
- `Each problem starts at its base points and gains 1 point every ${minutes} minutes it stays open. Points lock at submission, and only the first accepted proof scores. Models and harnesses are self-reported, so these boards are not a model benchmark.`,
- )}
-
-
-
-
-
-
-
- #{boards.people.length + 1}
-
- {tx('下一个上榜的可以是你', 'The next name here could be yours')}
-
- {tx('第一份通过校验的证明就会记入榜单。', 'Your first accepted proof puts you on the board.')}
-
- ))}
-
- )}
- {pages > 1 && (
-
- )}
-
- );
-}
-
-function Steps({ tx, signedIn, browse }: { tx: Tx; signedIn: boolean; browse: () => void }) {
- const [note, setNote] = useState('');
- const copy = () =>
- navigator.clipboard?.writeText(agentPrompt(location.origin, tx)).then(
- () => setNote(tx('已复制。', 'Copied.')),
- () => setNote(tx('复制失败,请在“参与”页手动选中复制。', 'Copy failed; select it by hand on the Join tab.')),
- );
- // Open for visitors on wide screens; on a phone the three cards would push the problem list below the fold.
- const [wide] = useState(() => matchMedia('(min-width: 821px)').matches);
- return (
-
- {tx('三步参与', 'Join in three steps')}
-
-
- {tx('选一道开放题', 'Pick an open problem')}
-
- {tx(
- '看冻结的 Lean 命题、当前分数和谁在做。浏览不需要登录。',
- 'Read the frozen Lean goal, its current points and who is working on it. Browsing needs no account.',
- )}
-
-
-
-
-
-
- {tx('生成 Agent 令牌', 'Issue an agent token')}
-
- {tx(
- '登录并设置公开名称后,在“参与”页生成。令牌只能认领、放弃和提交。',
- 'Sign in and set a public handle, then issue one on the Join tab. A token can only claim, release and submit.',
- )}
-
- {tx('把说明交给 Agent', 'Hand the instructions to your agent')}
-
- {tx(
- '粘贴到 Codex、Claude Code 或 Cursor,由 Agent 认领题目、提交证明并跟踪校验结果。',
- 'Paste them into Codex, Claude Code or Cursor; the agent claims a problem, submits a proof and follows the check.',
- )}
-
-
-
-
- {note}
-
-
-
-
-
- );
-}
-
-function agentPrompt(origin: string, tx: Tx) {
- return [
- tx(
- '你在 TheoremOS 社区开放解题板上做题。所有请求都带上:',
- 'You are working on the TheoremOS community open-problem board. Send this header with every request:',
- ),
- ' Authorization: Bearer $THEOREMOS_COMMUNITY_TOKEN',
- '',
- tx('1. 列出题目(找 status 为 open 的):', '1. List problems (pick one whose status is open):'),
- ` curl -s ${origin}/api/community/overview`,
- tx(
- '2. 读题目模块(task.source 是冻结的 Lean 文件,目标是 .Goal):',
- '2. Read the frozen module (task.source); the goal is .Goal:',
- ),
- ` curl -s ${origin}/api/community/tasks/T1`,
- tx('3. 认领(不排他,48 小时有效,可续期):', '3. Claim it (not exclusive, lasts 48 hours, renewable):'),
- ` curl -s -X POST -H "Authorization: Bearer $THEOREMOS_COMMUNITY_TOKEN" -H 'Content-Type: application/json' -d '{}' ${origin}/api/community/tasks/T1/claim`,
- tx(
- '4. 本地写好证明。文件必须 import 题目模块,并在顶层声明 theorem solution : .Goal。不允许 sorry、axiom、native_decide、#eval、宏和语法扩展。',
- '4. Write the proof locally. It must import the problem module and declare a top-level theorem solution : .Goal. sorry, axiom, native_decide, #eval, macros and syntax extensions are rejected.',
- ),
- tx('5. 提交(返回 202 和 submission.id):', '5. Submit (returns 202 and submission.id):'),
- ` jq -n --rawfile source Solution.lean '{taskId:"T1", source:$source, model:"", harness:""}' | \\`,
- ` curl -s -X POST -H "Authorization: Bearer $THEOREMOS_COMMUNITY_TOKEN" -H 'Content-Type: application/json' -d @- ${origin}/api/community/submissions`,
- tx(
- '6. 轮询结果,直到 status 为 accepted、rejected 或 late;rejected 时 reason 给出 Lean 报错:',
- '6. Poll until status is accepted, rejected or late; on rejected, reason carries the Lean error:',
- ),
- ` curl -s -H "Authorization: Bearer $THEOREMOS_COMMUNITY_TOKEN" ${origin}/api/community/submissions/`,
- '',
- tx(
- '每人最多同时 2 份等待校验、每小时 20 份。只有第一份通过的证明得分。',
- 'At most 2 pending and 20 per hour. Only the first accepted proof scores.',
- ),
- ].join('\n');
-}
-
-function Join({
- tx,
- me,
- signedIn,
- changed,
- language,
-}: {
- tx: Tx;
- me?: Me;
- signedIn: boolean;
- changed: () => Promise;
- language: string;
-}) {
- const [handle, setHandle] = useState(me?.profile?.handle ?? '');
- useEffect(() => {
- if (me?.profile?.handle) setHandle(me.profile.handle);
- }, [me?.profile?.handle]);
- type Spot = 'handle' | 'token' | 'prompt' | 'publish';
- const [token, setToken] = useState(''),
- [note, setNote] = useState<{ text: string; at: Spot }>(),
- [busy, setBusy] = useState(false);
- const status = useStatusFocus(note?.text);
- const say = (at: Spot) =>
- note?.at === at && (
-
- {tx(
- '登录后可以设置公开名称、领取Agent 令牌并参与解题。浏览题目和排行榜不需要登录。',
- 'Sign in to set a public handle, get an agent token and take part. Browsing needs no account.',
- )}
-
- {tx(
- '令牌只能认领、放弃和提交,不能改名称、发令牌或发布题目。它只显示一次;重新生成会让旧令牌失效。',
- 'A token can claim, release and submit only. It cannot change your handle, mint tokens or publish. It is shown once; issuing a new one revokes the old one.',
- )}
- {me.profile.token && me.profile.tokenCreatedAt
- ? tx(
- ` 当前令牌生成于 ${when(me.profile.tokenCreatedAt, language)}。`,
- ` Current token issued ${when(me.profile.tokenCreatedAt, language)}.`,
- )
- : ''}
-
-
-
- {me.profile.token && (
-
- )}
-
- {token && (
-
- {token}
-
-
- )}
- {say('token')}
-
{tx('给 Agent 的说明', 'Instructions for your agent')}
-
- {tx(
- '把令牌放进环境变量 THEOREMOS_COMMUNITY_TOKEN,再把下面这段交给你的 Agent。',
- 'Put the token in THEOREMOS_COMMUNITY_TOKEN, then hand this to your agent.',
- )}
-
- {tx(
- '题目写成一个 Prop。发布前服务器会先编译题目模块,编译不过不会开放。发布后题目冻结,不能修改,只能撤下。',
- 'State the goal as a Prop. The server compiles the module before opening it. A published problem is frozen; it can only be withdrawn.',
- )}
-
- {tx(
- '改计划、给指导,再对照证明路线和检查依据。',
- 'Change a plan, give guidance, then connect the proof route to its evidence.',
- )}
-
-
- {onExit && (
-
- )}
-
-
-
-
- {tx('无需 Key。', 'No API key needed.')}{' '}
- {tx(
- '选择会切换研究路线,并显示对应的检查回执。',
- 'Choices switch the research route and show the matching receipts.',
- )}
-
-
-
-
{tx('自然数加零', 'Adding zero to a natural number')}
-
- {tx(
- '对任意自然数 n,左右加零都不改变结果。两个目标都属于原题。',
- 'For every natural number n, adding zero on either side leaves n unchanged. Both goals belong to the original problem.',
- )}
-
-
-
- Tutorial.add_zero
-
-
-
- Tutorial.zero_add
-
-
-
-
-
-
- {panel === 'plan' && (
-
-
{tx('这条路线怎样推进', 'Choose how to approach the problem')}
-
-
- {tx(
- '修改已批准的计划后,需要重新批准;后续指导与回执会绑定到新版本。',
- 'Changing an approved plan requires a new approval. Subsequent guidance and receipt references belong to that version.',
- )}
-
-
- )}
- {panel === 'right' && (
-
-
{tx('同一种写法,两个结果', 'One tactic, two different results')}
-
-
-
- n + 0 = n
-
-
- {tx(
- '自然数加法对第二个参数递归定义;第二项是零时,表达式按定义化简为 n,因此 rfl 可以完成目标。',
- 'Natural-number addition recurses on its second argument. With zero as that argument, the expression reduces to n, so rfl closes the goal.',
- )}
-
-
-
-
- 0 + n = n
-
-
- {tx(
- '这里第二项是任意 n,不能直接按定义化简。rfl 无法完成这个目标,需要已有引理或归纳证明。',
- 'Here the second argument is an arbitrary n, so definition reduction alone does not close the goal. rfl cannot finish it; a lemma or induction is needed.',
- )}
-
-
-
-
- {tx('查看失败的候选', 'Inspect the failed candidate')}
-
- {practiceFailedSource}
-
-
-
-
- )}
- {panel === 'left' && (
-
-
{tx('你的指导会改变哪一步', 'See what your guidance changes')}
-
- {tx(
- `计划 v${state.revision} 保留原题的两个目标。右加零已有可用证明;左加零仍需要修复。`,
- `Plan v${state.revision} keeps both original goals. Right addition already has a valid proof; left addition still needs a repair.`,
- )}
-
- {item.accepted
- ? tx(
- '保留 add_zero,用 Nat.zero_add n 补全左加零。后续路线改为“修复左加零 → 核对两个目标的检查回执”。',
- 'Keep add_zero and complete left addition with Nat.zero_add n. The route now continues through the left-addition repair to the check receipts for both goals.',
- )
- : tx(
- '只提交 add_zero 会漏掉原题中的 zero_add。不能用删去目标的方式完成原题;路线保留在左加零修复,等待新的指导。',
- 'Submitting only add_zero would omit the original zero_add goal. Dropping a goal does not solve the original problem. The route stays at the repair and awaits further guidance.',
- )}
-
- {tx(
- '两个目标各有一次 Lean 内核检查。检查对象是保存的源码,不包括你在这次练习里写的计划和备注。',
- 'Each goal has its own Lean kernel check. It covers the saved source, not the plan or notes you wrote in this exercise.',
- )}
-
- {tx(
- `关联练习计划 v${state.savedReceipt.revision}`,
- `Linked to exercise plan v${state.savedReceipt.revision}`,
- )}{' '}
- · {date(state.savedReceipt.at)}
-
- )}
-
-
{tx('准备自己的题目', 'Prepare your own problem')}
-
- {tx(
- '带入自然数加零模板后,可以改成自己的题目。真实提交前再配置模型和预算。',
- 'Start from the addition-by-zero template and replace it with your own problem. Configure a model and budget before making a real submission.',
- )}
-
- {tx(
- '练习仅保存在此浏览器;不会进入真实研究、Library 或账号通知。',
- 'The exercise stays in this browser. It does not create a real research run, a Library asset or an account notification.',
- )}
-
- {tx('讲解覆盖 ', 'The explanation covers ')}
- {document.metrics.explainedLines}/{document.metrics.proofLines}
- {tx(' 行证明;其余部分可对照源码。', ' proof lines. Consult the source for the remaining lines.')}
-
- )}
-
- ) : (
-
-
- {reading?.tasks.length
- ? tx(
- '下面是这次研究保存的任务与推导思路。',
- 'These tasks and reasoning notes were recorded during the research.',
- )
- : tx(
- '这份快照未附逐步讲解,可从路线图阅读源码中的声明,再对照验收证明。',
- 'This snapshot has no recorded step-by-step explanation. The route map shows source declarations alongside the accepted proof.',
- )}
-
-
- {tx('查看将复制的原题源码', 'Preview the original source to copy')}
-
- {share.source}
-
-
-
- {tx(
- '只复制公开的原题、研究任务和环境;模型、预算由你设置。新尝试需要重新检查与验收。',
- 'Copy the public problem, task and environment. Choose your own model and budget. Your new attempt needs its own checks and acceptance.',
- )}
-
-
-
-
- )}
- >
- )}
-
- );
-}
diff --git a/apps/web/client/activityReader.tsx b/apps/web/client/activityReader.tsx
deleted file mode 100644
index ef669352..00000000
--- a/apps/web/client/activityReader.tsx
+++ /dev/null
@@ -1,482 +0,0 @@
-import type { WebEvent, WebRun } from '../shared';
-import { render } from 'preact';
-import { Icon } from './ui/Icon';
-import { localeTag, localizeText, t } from '../i18n';
-
-type ActivityRun = Pick;
-type ReadingAnchor = { sequence: number; offset: number };
-/** The local calendar day of an event time; times that do not parse share one empty day. */
-const day = (at?: string) => {
- const date = new Date(at ?? '');
- return Number.isFinite(date.getTime()) ? date.toDateString() : '';
-};
-const dayLabel = (at: string) =>
- new Intl.DateTimeFormat(localeTag, { month: '2-digit', day: '2-digit' }).format(new Date(at));
-/** The server appends " · workerId" to a progress message; a reader sees the Agent's name there instead. */
-export function readableMessage(event: WebEvent, names: ReadonlyMap) {
- const message = localizeText(event.message),
- worker = event.details?.workerId,
- name = worker && names.get(worker);
- return name && message.endsWith(` · ${worker}`) ? `${message.slice(0, -worker.length)}${name}` : message;
-}
-/** An event type as its message reads, without the Agent; long free-form messages are cut for the filter list. */
-function typeLabel(event: WebEvent) {
- const worker = event.details?.workerId,
- message = localizeText(event.message).split('\n', 1)[0]!;
- const base = worker && message.endsWith(` · ${worker}`) ? message.slice(0, -worker.length - 3) : message;
- return base.length > 40 ? `${base.slice(0, 39)}…` : base || event.type;
-}
-function Scaffold() {
- return (
- <>
-
-
-
{t('活动记录')}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {t('正在阅读的活动已超出保留范围,已定位到仍可查看的记录。')}
-
-
-
-
{t('活动记录,最新在前')}
-
-
-
{t('时间')}
-
{t('记录')}
-
-
-
-
-
-
-
-
-
-
- >
- );
-}
-
-// One run's local reading state. Event content never becomes markup or leaves the browser.
-export class ActivityReader {
- private root?: HTMLElement;
- private identity = '';
- private events: WebEvent[] = [];
- private shown: WebEvent[] = [];
- private query = '';
- private type = '';
- private following = true;
- private seenSequence = 0;
- private anchor?: ReadingAnchor;
- /** The scroller width the anchor was recorded at; rows rewrap at any other width. */
- private anchorWidth = 0;
- private resized?: ResizeObserver;
- private top = 0;
- private left = 0;
- private restorePending = false;
- private readingLost = false;
- private rows = new Map();
- private mounted = new WeakSet();
- private names: ReadonlyMap = new Map();
-
- constructor(
- private readonly timestamp: (at: string) => string,
- private readonly download: (filename: string, text: string) => void,
- ) {}
-
- /** `names` are what the reader calls each Agent (see workerNames); unnamed Agents keep their id. */
- update(root?: HTMLElement, run?: ActivityRun, names: ReadonlyMap = new Map()) {
- if (root !== this.root && this.root) this.remember();
- if (this.identity !== (run?.id ?? '')) {
- this.identity = run?.id ?? '';
- this.events = [];
- this.shown = [];
- this.query = '';
- this.type = '';
- this.following = true;
- this.seenSequence = 0;
- this.anchor = undefined;
- this.top = this.left = 0;
- this.restorePending = false;
- this.readingLost = false;
- }
- if (!root || !run) {
- this.root = undefined;
- this.rows.clear();
- this.resized?.disconnect();
- return;
- }
- const changedRoot = this.root !== root;
- this.root = root;
- if (!this.mounted.has(root)) {
- this.mount(root);
- this.mounted.add(root);
- }
- if (changedRoot) {
- this.rows.clear();
- this.restorePending = true;
- this.observe();
- }
- // A hidden mobile pane has no useful geometry. Refresh it when it becomes visible.
- if (!root.getClientRects().length) return;
- this.events = run.events;
- this.names = names;
- this.render();
- }
-
- remember() {
- if (!this.root?.getClientRects().length) return;
- this.capture();
- this.restorePending = true;
- }
-
- /** Folding the history or crossing to a phone layout rewraps the rows; the reader returns to the row it was on. */
- private observe() {
- this.resized ??= new ResizeObserver(() => {
- const width = this.root?.querySelector('.activity-scroll')?.clientWidth;
- if (!width || !this.anchorWidth || width === this.anchorWidth) return;
- this.restorePending = true;
- this.render();
- });
- this.resized.disconnect();
- this.resized.observe(this.get('.activity-scroll'));
- }
-
- private get(selector: string) {
- return this.root!.querySelector(selector)!;
- }
-
- private mount(root: HTMLElement) {
- // The scaffold is rendered once; the reader then updates its nodes and keyed rows in place.
- root.textContent = '';
- render(, root);
- root.addEventListener('input', event => {
- if ((event.target as HTMLElement).id !== 'activity-search') return;
- this.query = (event.target as HTMLInputElement).value;
- this.changeFilters();
- });
- root.addEventListener('change', event => {
- if ((event.target as HTMLElement).id !== 'activity-type') return;
- this.type = (event.target as HTMLSelectElement).value;
- this.changeFilters();
- });
- root.addEventListener('click', event => {
- const id = (event.target as Element).closest('button')?.id;
- if (id === 'clear-activity-search' || id === 'clear-activity-filters') {
- this.query = '';
- if (id === 'clear-activity-filters') this.type = '';
- this.changeFilters();
- this.get('#activity-search').focus({ preventScroll: true });
- }
- if (id === 'activity-follow') {
- this.following = !this.following;
- this.seenSequence = this.events.at(-1)?.sequence ?? 0;
- if (this.following) this.returnToLatest();
- else this.renderControls();
- }
- if (id === 'activity-latest') this.returnToLatest();
- if (id === 'download-activity' && this.shown.length) this.export();
- });
- this.get('.activity-scroll').addEventListener(
- 'scroll',
- () => {
- if (!this.root?.getClientRects().length) return;
- if (this.following && this.get('.activity-scroll').scrollTop > 24) {
- this.following = false;
- this.seenSequence = this.events.at(-1)?.sequence ?? 0;
- this.renderControls();
- }
- this.capture();
- },
- { passive: true },
- );
- }
-
- private changeFilters() {
- this.anchor = undefined;
- this.top = this.left = 0;
- this.restorePending = true;
- this.readingLost = false;
- this.seenSequence = this.events.at(-1)?.sequence ?? 0;
- this.render(true);
- }
-
- private returnToLatest() {
- this.following = true;
- this.readingLost = false;
- this.seenSequence = this.events.at(-1)?.sequence ?? 0;
- this.get('.activity-scroll').scrollTo({ top: 0, left: this.left, behavior: 'instant' });
- this.capture(true);
- this.renderControls();
- }
-
- private capture(fresh = false) {
- const scroll = this.get('.activity-scroll');
- // Scrolling caused by a width change keeps the anchor from before it, for the resize to restore.
- if (!fresh && this.anchor && this.anchorWidth && scroll.clientWidth && scroll.clientWidth !== this.anchorWidth)
- return;
- this.top = scroll.scrollTop;
- this.left = scroll.scrollLeft;
- if (scroll.hidden) return;
- const frame = scroll.getBoundingClientRect();
- const headerBottom = this.get('thead th').getBoundingClientRect().bottom;
- const row = Array.from(this.get('tbody').children).find(row => {
- const bounds = row.getBoundingClientRect();
- return bounds.bottom > headerBottom + 1 && bounds.top < frame.bottom;
- }) as HTMLTableRowElement | undefined;
- this.anchor = row
- ? { sequence: Number(row.dataset.sequence), offset: row.getBoundingClientRect().top - frame.top }
- : undefined;
- this.anchorWidth = scroll.clientWidth;
- }
-
- private render(reset = false) {
- if (!this.restorePending && !reset) this.capture();
- const anchor = this.anchor;
- const query = this.query.trim().toLowerCase();
- this.shown = this.events
- .filter(
- event =>
- (!this.type || event.type === this.type) &&
- (!query || `${event.type}\n${event.message}\n${localizeText(event.message)}`.toLowerCase().includes(query)),
- )
- .reverse();
- const retained = new Set(this.events.map(event => event.sequence));
- for (const [sequence, row] of this.rows) {
- if (!retained.has(sequence)) {
- row.remove();
- this.rows.delete(sequence);
- }
- }
- const visible = new Set(this.shown.map(event => event.sequence));
- for (const [sequence, row] of this.rows) if (!visible.has(sequence)) row.remove();
- const body = this.get('tbody');
- // Times alone repeat across days: a log reaching past one local day dates the newest row of each day (newest first).
- const dated = day(this.events[0]?.at) !== day(this.events.at(-1)?.at);
- // A run of the same line from the same Agent is one row with a count. The newest row of the run stays visible
- // and carries the total; the older rows stay keyed but hidden, so sequence lookups and exports keep working.
- const totals = new Map(),
- hidden = new Set();
- let leader = this.shown[0]?.sequence,
- count = 1,
- lastKey: string | undefined;
- for (const [index, event] of this.shown.entries()) {
- const key = `${event.type}\u0000${readableMessage(event, this.names)}`;
- if (index) {
- if (key === lastKey) {
- count++;
- hidden.add(event.sequence);
- } else {
- totals.set(leader!, count);
- leader = event.sequence;
- count = 1;
- }
- }
- lastKey = key;
- }
- if (leader !== undefined) totals.set(leader, count);
- for (const [sequence, total] of totals) if (total < 2) totals.delete(sequence);
- let cursor = body.firstElementChild,
- previous: string | undefined;
- for (const event of this.shown) {
- let row = this.rows.get(event.sequence);
- if (!row) {
- row = document.createElement('tr');
- row.dataset.sequence = String(event.sequence);
- const time = document.createElement('td'),
- date = document.createElement('span');
- date.className = 'activity-date';
- date.hidden = true;
- time.append(date, document.createElement('time'));
- row.append(time, document.createElement('td'));
- this.rows.set(event.sequence, row);
- }
- const total = totals.get(event.sequence);
- row.hidden = hidden.has(event.sequence);
- if (total) row.cells[1]!.dataset.repeats = String(total);
- else delete row.cells[1]!.dataset.repeats;
- const time = row.querySelector('time')!,
- date = row.querySelector('.activity-date')!,
- today = day(event.at);
- const label = dated && today !== previous ? dayLabel(event.at) : '';
- previous = today;
- this.text(date, label);
- if (date.hidden !== !label) date.hidden = !label;
- time.dateTime = event.at;
- row.cells[0]!.title = event.at;
- this.text(time, this.timestamp(event.at));
- // The event code stays in the tooltip, for reports and for matching the downloaded JSON.
- this.text(row.cells[1]!, readableMessage(event, this.names));
- if (row.cells[1]!.title !== event.type) row.cells[1]!.title = event.type;
- if (row === cursor) cursor = cursor.nextElementSibling;
- else body.insertBefore(row, cursor);
- }
- // The count is drawn by CSS from the data attribute, so the cell's text stays exactly the message text.
- if (this.following) this.seenSequence = this.events.at(-1)?.sequence ?? 0;
- if (!this.following && anchor && !retained.has(anchor.sequence) && !reset) this.readingLost = true;
- this.renderControls();
- const scroll = this.get('.activity-scroll');
- scroll.hidden = !this.shown.length;
- if (this.following || reset) scroll.scrollTop = 0;
- else if (anchor) {
- // A folded duplicate has no box; its run's newest row stands in for it.
- const row = this.rows.get(anchor.sequence);
- const target =
- row && row.parentElement === body && !row.hidden
- ? row
- : this.rows.get(
- (this.shown.find(event => event.sequence < anchor.sequence) ?? this.shown.at(-1))?.sequence ?? -1,
- );
- if (target)
- scroll.scrollTop += target.getBoundingClientRect().top - scroll.getBoundingClientRect().top - anchor.offset;
- else scroll.scrollTop = this.top;
- } else scroll.scrollTop = this.top;
- scroll.scrollLeft = this.left;
- this.restorePending = false;
- this.capture(true);
- }
-
- private text(target: Element, value: string) {
- if (target.textContent !== value) target.textContent = value;
- }
-
- private renderControls() {
- const input = this.get('#activity-search');
- if (input.value !== this.query) input.value = this.query;
- this.get('#clear-activity-search').hidden = !this.query;
- const types = new Map();
- for (const event of this.events)
- types.set(event.type, {
- count: (types.get(event.type)?.count ?? 0) + 1,
- label: types.get(event.type)?.label ?? typeLabel(event),
- });
- if (this.type && !types.has(this.type)) types.set(this.type, { count: 0, label: this.type });
- const select = this.get('#activity-type');
- const options = [
- ['', t('全部事件')],
- ...Array.from(types)
- .sort(([, a], [, b]) => a.label.localeCompare(b.label, localeTag))
- .map(([type, { count, label }]) => [type, `${label} (${count})`]),
- ];
- for (const option of Array.from(select.options))
- if (!options.some(([value]) => value === option.value)) option.remove();
- for (const [value, label] of options) {
- let option = Array.from(select.options).find(option => option.value === value);
- if (!option) {
- option = document.createElement('option');
- option.value = value;
- select.append(option);
- }
- this.text(option, label!);
- }
- if (select.value !== this.type) select.value = this.type;
- const filtered = Boolean(this.query.trim() || this.type);
- this.text(
- this.get('#activity-count'),
- filtered ? t('{0} / {1} 条', this.shown.length, this.events.length) : t('{0} 条', this.events.length),
- );
- this.get('#activity-follow').setAttribute('aria-pressed', String(this.following));
- this.get('#activity-follow').title = this.following
- ? t('正在跟随最新活动;向下阅读时自动暂停')
- : t('跟随已暂停,点击返回最新活动');
- const unread = this.shown.filter(event => event.sequence > this.seenSequence).length;
- const latest = this.get('#activity-latest');
- latest.hidden = this.following || !this.shown.length;
- this.text(latest, unread ? t('返回最新 · {0} 条新活动', unread) : t('返回最新'));
- this.text(
- this.get('#activity-retention'),
- (this.events[0]?.sequence ?? 1) > 1
- ? t('最新在前 · 仅保留最近 200 条,更早活动已移出')
- : t('最新在前 · 最多保留 200 条活动'),
- );
- const notice = this.get('#activity-reading-notice');
- notice.hidden = !this.readingLost;
- this.text(
- notice,
- this.shown.length
- ? t('正在阅读的活动已超出保留范围,已定位到仍可查看的记录。')
- : t('正在阅读的活动已超出保留范围;可清除筛选查看仍保留的记录。'),
- );
- this.get('#download-activity').disabled = !this.shown.length;
- const empty = this.get('.activity-empty');
- empty.hidden = Boolean(this.shown.length);
- this.text(empty.querySelector('p')!, filtered ? t('没有匹配的活动') : t('暂无活动记录'));
- this.get('#clear-activity-filters').hidden = !filtered;
- }
-
- private export() {
- const snapshot = {
- format: 'theoremos-activity',
- version: 1,
- runId: this.identity,
- exportedAt: new Date().toISOString(),
- order: 'newest-first',
- filters: { query: this.query, type: this.type || null },
- retention: {
- limit: 200,
- retainedCount: this.events.length,
- firstSequence: this.events[0]?.sequence ?? null,
- lastSequence: this.events.at(-1)?.sequence ?? null,
- earlierEventsOmitted: (this.events[0]?.sequence ?? 1) > 1,
- },
- matchedCount: this.shown.length,
- events: this.shown.map(({ sequence, at, type, message }) => ({ sequence, at, type, message })),
- };
- this.download(`${this.identity}-activity.json`, JSON.stringify(snapshot, null, 2) + '\n');
- }
-}
diff --git a/apps/web/client/agentActivity.ts b/apps/web/client/agentActivity.ts
deleted file mode 100644
index a32e1fb7..00000000
--- a/apps/web/client/agentActivity.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import { webAgentActionLimits, type WebAgentAction, type WebEvent, type WebRun } from '../shared';
-import { agentRoutes, mergeAgentActions, type AgentRoute } from './agentRoute';
-
-type Api = (url: string) => Promise;
-type Entry = {
- run: WebRun;
- /** Events older than the run's own window, read once from the server, oldest first and without gaps. */ history: WebEvent[];
- /** Every action report read so far, in sequence order. */ actions: WebAgentAction[];
- dropped: number;
- version: number;
- busy: boolean;
- failed?: string;
- retryAt?: number;
- routes?: { key: string; value: AgentRoute[] };
-};
-export type AgentActivityState = { loading: boolean; failed?: string; dropped: number; version: number };
-
-/**
- * What each Agent did in a run, for the route map: the run carries its last 200 events, so the older ones are read once
- * from /events, and the Agents' actions are read from /actions after the last one seen. One store serves both views,
- * so a run is read once.
- */
-export class AgentActivity {
- private entries = new Map();
- private listeners = new Set<(runId: string) => void>();
- constructor(private api: Api) {}
-
- subscribe(listener: (runId: string) => void) {
- this.listeners.add(listener);
- return () => {
- this.listeners.delete(listener);
- };
- }
-
- /** Reads what `run` does not carry yet; `poll` also asks for new actions of a running run, whose count is saved only now and then. */
- sync(run: WebRun, poll = false) {
- let entry = this.entries.get(run.id);
- if (!entry) {
- entry = { run, history: [], actions: [], dropped: 0, version: 0, busy: false };
- this.entries.set(run.id, entry);
- }
- entry.run = run;
- if (entry.busy || (entry.retryAt && Date.now() < entry.retryAt) || !this.missing(entry, poll)) return;
- entry.busy = true;
- // A read that ends with something still missing (a record the server cannot read yet) waits before trying again.
- void this.load(entry)
- .then(
- () => {
- entry.failed = undefined;
- entry.retryAt = this.missing(entry, false) ? Date.now() + 5_000 : undefined;
- },
- (error: unknown) => {
- entry.failed = error instanceof Error ? error.message : String(error);
- entry.retryAt = Date.now() + 10_000;
- },
- )
- .finally(() => {
- entry.busy = false;
- entry.version++;
- this.changed(run.id);
- });
- }
- /** Tries a failed read again now. */
- retry(run: WebRun) {
- const entry = this.entries.get(run.id);
- if (entry) entry.retryAt = undefined;
- this.sync(run, true);
- }
-
- state(runId: string): AgentActivityState {
- const entry = this.entries.get(runId);
- return {
- loading: Boolean(entry?.busy),
- failed: entry?.failed,
- dropped: entry?.dropped ?? 0,
- version: entry?.version ?? 0,
- };
- }
-
- /** The route map of `run` with every event and action read so far; computed again only when one of them changed. */
- routes(run: WebRun, lead?: string): AgentRoute[] {
- const entry = this.entries.get(run.id),
- last = run.events.at(-1)?.sequence ?? 0;
- const key = [entry?.version ?? 0, run.events.length, last, lead ?? ''].join('|');
- if (entry?.routes?.key === key) return entry.routes.value;
- const { events, actions } = this.records(run);
- const value = agentRoutes(events, { actions, lead });
- if (entry) entry.routes = { key, value };
- return value;
- }
- /** Every event of `run` read so far, oldest first, and its Agents' actions with started and completed reports merged. */
- records(run: WebRun): { events: readonly WebEvent[]; actions: readonly WebAgentAction[] } {
- const entry = this.entries.get(run.id),
- known = entry?.history.at(-1)?.sequence ?? 0;
- const events = entry?.history.length
- ? [...entry.history, ...run.events.filter(event => event.sequence > known)]
- : run.events;
- return { events, actions: mergeAgentActions(entry?.actions ?? []) };
- }
-
- private missing(entry: Entry, poll: boolean) {
- const first = entry.run.events[0]?.sequence ?? 1,
- known = entry.history.at(-1)?.sequence ?? 0;
- const count = entry.run.actions?.count ?? 0,
- seen = entry.actions.at(-1)?.sequence ?? 0;
- return first > known + 1 || count > seen || (poll && entry.run.status === 'running');
- }
- private async load(entry: Entry) {
- const id = encodeURIComponent(entry.run.id);
- // A long run's earlier events, until they meet the run's window; the window moves on while this reads.
- for (let pages = 0; pages < 400; pages++) {
- const known = entry.history.at(-1)?.sequence ?? 0;
- if ((entry.run.events[0]?.sequence ?? 1) <= known + 1) break;
- const page = await this.api<{ events: WebEvent[] }>(`/api/runs/${id}/events?after=${known}`);
- const fresh = page.events.filter(event => event.sequence > known);
- if (!fresh.length) break;
- entry.history.push(...fresh);
- entry.version++;
- this.changed(entry.run.id);
- }
- for (let pages = 0; pages < 20; pages++) {
- const seen = entry.actions.at(-1)?.sequence ?? 0;
- const page = await this.api<{ actions: WebAgentAction[]; dropped: number }>(
- `/api/runs/${id}/actions?after=${seen}`,
- );
- const fresh = page.actions.filter(action => action.sequence > seen);
- entry.dropped = page.dropped;
- if (!fresh.length) break;
- entry.actions.push(...fresh);
- entry.version++;
- this.changed(entry.run.id);
- if (fresh.length < webAgentActionLimits.page) break;
- }
- }
- private changed(runId: string) {
- for (const listener of this.listeners) listener(runId);
- }
-}
diff --git a/apps/web/client/agentRoute.ts b/apps/web/client/agentRoute.ts
deleted file mode 100644
index 705c44ec..00000000
--- a/apps/web/client/agentRoute.ts
+++ /dev/null
@@ -1,250 +0,0 @@
-import type { WebAgentAction, WebEvent } from '../shared';
-import { t } from '../i18n';
-
-export type RouteStepKind = 'read' | 'write' | 'check' | 'deliver' | 'accept' | 'stop';
-/** What happened inside a step, in time order: the host's events for the Agent and the Agent's own actions. */
-export type RouteItem = { type: 'event'; event: WebEvent } | { type: 'action'; action: WebAgentAction };
-export type RouteStep = {
- kind: RouteStepKind;
- at: string;
- count: number;
- outcome?: 'passed' | 'failed';
- taskId?: string;
- reviewing?: boolean;
- /** A Lead turn in which the research plan changed. */ planning?: boolean;
- /** The work was for an assignment a later plan replaced (the host superseded its delivery). */ superseded?: boolean;
- /** Taking a task this Agent already had: the plan was revised and the task handed out again. */ again?: boolean;
- items: RouteItem[];
-};
-export type AgentRoute = { workerId: string; steps: RouteStep[] };
-
-/** Event types that start or extend one route step; anything else (heartbeats, host bookkeeping) is not a step. */
-const stepKinds: Record = {
- research_action: 'read',
- context_compiled: 'read',
- context_restarted: 'read',
- task_assigned: 'read',
- review_assigned: 'read',
- statement_review_assigned: 'read',
- turn_started: 'write',
- proof_check_started: 'check',
- proof_checked: 'check',
- assembly_started: 'check',
- task_checked: 'check',
- task_check_reused: 'check',
- task_recheck_started: 'check',
- task_recheck_finished: 'check',
- proof_ready_checked: 'check',
- lemma_checked: 'check',
- task_integrated: 'deliver',
- delivery_published: 'deliver',
- research_delivered: 'deliver',
- review_completed: 'deliver',
- statement_review_completed: 'deliver',
- candidate_selected: 'accept',
- evaluation_started: 'accept',
- evaluation_finished: 'accept',
- worker_failed: 'stop',
- turn_failed: 'stop',
-};
-// Events that close one occurrence of a step, so merged repeats are counted (two Lean checks read "×2").
-const closing = new Set([
- 'proof_checked',
- 'task_checked',
- 'task_check_reused',
- 'task_recheck_finished',
- 'proof_ready_checked',
- 'lemma_checked',
- 'turn_started',
-]);
-// Heartbeats say only that a session is alive; every other event about an Agent is shown inside its current step.
-const quiet = new Set(['worker_activity']);
-const humanEdits = new Set(['human_edit_queued', 'edit_received', 'edit_applied']);
-// The host replaced the Agent's assignment or delivery with a newer version of the plan.
-const superseding = new Set(['task_delivery_superseded', 'assignment_superseded']);
-const verdict = (event: WebEvent): RouteStep['outcome'] => {
- const details = event.details;
- if (event.type === 'evaluation_finished') return details?.status === 'passed' ? 'passed' : 'failed';
- if (typeof details?.passed === 'boolean') return details.passed ? 'passed' : 'failed';
- return undefined;
-};
-
-/**
- * One entry per Agent action: a completed report replaces its started one but keeps the started time and place,
- * so a long command stays where it began.
- */
-export function mergeAgentActions(actions: readonly WebAgentAction[]): WebAgentAction[] {
- const merged = new Map();
- for (const action of actions) {
- const key = `${action.workerId}\u0000${action.itemId}`,
- first = merged.get(key);
- merged.set(key, first ? { ...action, sequence: first.sequence, at: first.at } : action);
- }
- return [...merged.values()];
-}
-
-/**
- * Each Agent's path through the run, read from the recorded progress events: reading the task, writing a candidate,
- * Lean checks, deliveries and the final acceptance. Consecutive events of one kind merge into one step.
- * Events without an Agent go to the Agent that owns their task, or to the one running the acceptance.
- * `actions` (see mergeAgentActions) join the Agent's step at their time; one after a check or a delivery starts a
- * new writing step. `lead` is the Agent whose turn a plan change belongs to.
- */
-export function agentRoutes(
- events: readonly WebEvent[],
- options: { actions?: readonly WebAgentAction[]; lead?: string } = {},
-): AgentRoute[] {
- const routes = new Map(),
- owners = new Map(),
- reviewing = new Set();
- const taken = new Map>();
- let accepting: string | undefined;
- const routeOf = (workerId: string) => {
- let route = routes.get(workerId);
- if (!route) {
- route = { workerId, steps: [] };
- routes.set(workerId, route);
- }
- return route;
- };
- // A plan change after a person's plan edit, before the Lead's next turn, is that edit and not the Lead's work.
- let edited = '';
- const turns = new Map();
- const record = (event: WebEvent) => {
- const kind = stepKinds[event.type],
- details = event.details ?? {};
- if (event.type === 'turn_started' && details.workerId) turns.set(details.workerId, event.at);
- if (!kind) {
- if (humanEdits.has(event.type)) edited = event.at;
- const workerId = event.type === 'plan_updated' ? options.lead : details.workerId;
- const step = workerId ? routes.get(workerId)?.steps.at(-1) : undefined;
- if (!step || quiet.has(event.type) || (event.type === 'plan_updated' && (turns.get(workerId!) ?? '') < edited))
- return;
- step.items.push({ type: 'event', event });
- if (superseding.has(event.type)) step.superseded = true;
- if (event.type === 'plan_updated' && step.kind === 'write') step.planning = true;
- return;
- }
- const workerId =
- details.workerId ??
- (details.taskId ? owners.get(details.taskId) : undefined) ??
- (kind === 'accept' ? accepting : undefined);
- if (!workerId) return;
- if (event.type === 'task_assigned' && details.taskId) {
- owners.set(details.taskId, workerId);
- reviewing.delete(workerId);
- }
- if (event.type === 'review_assigned' || event.type === 'statement_review_assigned') reviewing.add(workerId);
- if (kind === 'accept') accepting = workerId;
- const route = routeOf(workerId);
- const last = route.steps.at(-1),
- outcome = verdict(event);
- const step: RouteStep =
- last?.kind === kind
- ? last
- : {
- kind,
- at: event.at,
- count: 0,
- items: [],
- ...((kind === 'write' || kind === 'read') && reviewing.has(workerId) ? { reviewing: true } : {}),
- };
- if (step !== last) route.steps.push(step);
- if (event.type === 'task_assigned') delete step.reviewing;
- if (event.type === 'review_assigned' || event.type === 'statement_review_assigned') step.reviewing = true;
- if (event.type === 'task_assigned' && details.taskId) {
- const tasks = taken.get(workerId) ?? new Set();
- if (tasks.has(details.taskId)) step.again = true;
- tasks.add(details.taskId);
- taken.set(workerId, tasks);
- }
- step.items.push({ type: 'event', event });
- if (closing.has(event.type)) step.count++;
- if (outcome) step.outcome = outcome;
- if (details.taskId && (kind === 'read' || kind === 'deliver' || !step.taskId)) step.taskId = details.taskId;
- };
- const act = (action: WebAgentAction) => {
- const route = routeOf(action.workerId),
- last = route.steps.at(-1);
- // Reading the task and writing are the Agent's own steps; after the host has checked or taken its work, it is writing again.
- const step =
- last && (last.kind === 'read' || last.kind === 'write')
- ? last
- : {
- kind: 'write' as const,
- at: action.at,
- count: 0,
- items: [],
- ...(reviewing.has(action.workerId) ? { reviewing: true } : {}),
- };
- if (step !== last) route.steps.push(step);
- step.items.push({ type: 'action', action });
- };
- // Both lists are in server time order; at the same instant the event goes first, since it opens the step an action belongs to.
- const actions = options.actions ?? [];
- for (let e = 0, a = 0; e < events.length || a < actions.length;) {
- if (a >= actions.length || (e < events.length && events[e]!.at <= actions[a]!.at)) record(events[e++]!);
- else act(actions[a++]!);
- }
- for (const route of routes.values()) for (const step of route.steps) step.count = Math.max(1, step.count);
- return [...routes.values()];
-}
-
-/**
- * What a reader calls each Agent: its role, numbered only when several Agents share it ("Researcher 1", "Researcher 2").
- * Agents without a known role keep their id.
- */
-export function agentNames(workers: readonly { id: string; role?: string }[]): Map {
- const shared = new Map();
- for (const worker of workers) if (worker.role) shared.set(worker.role, (shared.get(worker.role) ?? 0) + 1);
- const seen = new Map(),
- names = new Map();
- for (const worker of workers) {
- if (!worker.role) continue;
- const index = (seen.get(worker.role) ?? 0) + 1;
- seen.set(worker.role, index);
- names.set(worker.id, shared.get(worker.role)! > 1 ? `${worker.role} ${index}` : worker.role);
- }
- return names;
-}
-
-/** A step as its chip reads: what the Agent did, with the task's short name. */
-export function routeStepLabel(step: RouteStep, tasks: ReadonlyMap) {
- const task = step.taskId && tasks.get(step.taskId) ? ` ${tasks.get(step.taskId)}` : '';
- switch (step.kind) {
- case 'read':
- return step.reviewing
- ? t('接审阅')
- : step.taskId
- ? step.again
- ? t('重新接任务{0}', task)
- : t('接任务{0}', task)
- : t('读题');
- case 'write':
- return step.reviewing
- ? t('审阅候选')
- : step.planning
- ? t('制定计划')
- : step.count > 1
- ? t('写证明 ×{0}', step.count)
- : t('写证明');
- case 'check':
- return step.count > 1 ? t('Lean 检查 ×{0}', step.count) : t('Lean 检查');
- case 'deliver':
- return t('交付{0}', task);
- case 'accept':
- return t('独立验收');
- case 'stop':
- return t('会话停止');
- }
-}
-/** The file an Agent's `check-lean` command checked; undefined for any other command, '' when it named none. */
-export function checkLeanFile(action: WebAgentAction): string | undefined {
- const command = action.kind === 'command' ? (action.command ?? '') : '';
- if (!/\bcheck-lean\b/u.test(command)) return;
- return /--file\s+'?([^\s']+)/u.exec(command)?.[1] ?? '';
-}
-
-/** A task as a reader knows it: the last part of its theorem's name (Tutorial.add_zero → add_zero). */
-export const taskNames = (tasks: readonly { id: string; theorem?: string }[]) =>
- new Map(tasks.flatMap(task => (task.theorem ? [[task.id, task.theorem.split('.').at(-1)!] as const] : [])));
diff --git a/apps/web/client/app.css b/apps/web/client/app.css
deleted file mode 100644
index 3d64dd42..00000000
--- a/apps/web/client/app.css
+++ /dev/null
@@ -1,3613 +0,0 @@
-@font-face{font-family:Geist;src:url("assets/fonts/Geist-latin.woff2") format("woff2");font-style:normal;font-weight:100 900;font-display:swap}
-/* Interface text is drawn from -ui and -ui-extra (tests/webFonts.test.ts keeps it there); -common, the rest of GB2312 level 1, loads only for content. */
-@font-face{font-family:"TheoremOS Sans SC";src:url("assets/fonts/NotoSansSC-ui.woff2") format("woff2");font-weight:400 600;font-display:swap;unicode-range:U+3000-303F,U+4E00,U+4E09-4E0B,U+4E0D-4E0E,U+4E13-4E14,U+4E22,U+4E24,U+4E2A,U+4E34,U+4E3A-4E3B,U+4E45,U+4E48-4E49,U+4E4B,U+4E5F,U+4E86,U+4E8B,U+4E8E,U+4E94,U+4E9B,U+4EA4,U+4EA7,U+4EAB,U+4EBA,U+4EC0,U+4EC5,U+4ECB,U+4ECD-4ECE,U+4ED6,U+4ED8,U+4EE3-4EE5,U+4EEC,U+4EF6-4EF7,U+4EFB,U+4EFD,U+4F18,U+4F1A,U+4F20,U+4F4D,U+4F53,U+4F55,U+4F59,U+4F5C,U+4F60,U+4F7F,U+4F8B,U+4F9B,U+4F9D,U+4FA7,U+4FDD,U+4FE1,U+4FEE,U+5019,U+503C,U+5047,U+505A,U+505C,U+50A8,U+50CF,U+5141,U+5145,U+5148,U+5165,U+5168,U+516C,U+5171,U+5173,U+5176-5177,U+517C,U+5185,U+518C-518D,U+5199,U+51B2-51B3,U+51C6,U+51CF,U+51E0-51E1,U+51ED,U+51FA-51FB,U+51FD,U+5206-5207,U+5212,U+5217,U+5219,U+521B,U+521D,U+5220,U+5224,U+5230,U+5236-5237,U+524D,U+5269-526A,U+526F,U+529B,U+529F-52A1,U+52A8-52A9,U+52FF,U+5305,U+5316,U+5339-533A,U+534A,U+534F,U+5355,U+5357,U+5360,U+5373,U+5386,U+538B,U+539F,U+53C2,U+53CA,U+53CC-53CD,U+53D1,U+53D6-53D8,U+53E0,U+53E3,U+53E5-53E6,U+53EA,U+53EF-53F0,U+53F2-53F3,U+53F7,U+5404,U+5408,U+540C-540E,U+5411,U+5417,U+5426,U+542B,U+542F,U+544A,U+547D,U+548C,U+54A8,U+54C1,U+54C8,U+54CD,U+54EA,U+5546,U+5668,U+56DB,U+56DE,U+56E0,U+56F4,U+56FA,U+56FE,U+5728,U+5730,U+573A,U+5740,U+5747,U+5757,U+578B,U+57DF,U+57FA,U+585E,U+586B,U+5883,U+589E,U+58F0,U+5904,U+5907,U+590D,U+5916,U+591A,U+5927,U+5931,U+5934,U+5939,U+597D,U+5982,U+59CB,U+5B57-5B58,U+5B66,U+5B83,U+5B89,U+5B8C,U+5B98,U+5B9A,U+5B9E,U+5BA1,U+5BB9,U+5BBD,U+5BC6,U+5BDF,U+5BF9,U+5BFC,U+5C06,U+5C0F,U+5C11,U+5C1A,U+5C1D,U+5C31,U+5C3E,U+5C40,U+5C42,U+5C55,U+5C5E,U+5DE5-5DE6,U+5DEE,U+5DF1-5DF2,U+5E03,U+5E0C,U+5E26,U+5E38,U+5E72-5E73,U+5E76,U+5E8F,U+5E93-5E94,U+5EA6,U+5EF6,U+5EFA,U+5F00,U+5F02-5F03,U+5F0F,U+5F15,U+5F20,U+5F3A,U+5F52-5F53,U+5F55,U+5F62,U+5F71,U+5F80,U+5F84-5F85,U+5F97,U+5FAA,U+5FAE,U+5FC3,U+5FC5,U+5FEB,U+5FFD,U+6001,U+601D,U+6027,U+603B,U+6062,U+606F,U+60AC,U+60C5,U+60F3,U+610F,U+611F,U+6210-6211,U+6216,U+622A,U+6237,U+6240,U+624B,U+624D,U+6253,U+6267,U+6269,U+627E,U+628A,U+6295,U+6298,U+62A5,U+62D2,U+62D6,U+62E9,U+62EC,U+6301,U+6307,U+6309,U+6320,U+6355,U+6362,U+636E,U+6392,U+63A2,U+63A5,U+63A8,U+63CF-63D0,U+641C,U+6458,U+64A4,U+64AD,U+64CD,U+652F,U+6536,U+6539,U+653E,U+6545,U+6548,U+654F,U+6563,U+6570,U+6574,U+6599,U+65AD,U+65B0,U+65B9,U+65CF,U+65E0,U+65E5,U+65E7,U+65E9,U+65F6,U+660E,U+662F,U+663E,U+666E-666F,U+6682,U+66F4,U+66FC,U+66FF-6700,U+6709,U+670D,U+671B,U+671F,U+672A-672C,U+673A,U+6743,U+6750,U+675F,U+6761,U+6765,U+677F,U+6784,U+6790,U+679C,U+67E5,U+6807,U+680F,U+6821,U+6838-6839,U+683C,U+6846,U+6848,U+6863,U+68C0,U+6982,U+69DB,U+6A21,U+6B21,U+6B62-6B65,U+6BB5,U+6BCD,U+6BCF,U+6BD4,U+6C42,U+6CA1,U+6CBF,U+6CD5,U+6CDB,U+6CE8,U+6D3B,U+6D41,U+6D4B,U+6D4F,U+6D88,U+6DFB,U+6E05,U+6E10,U+6E38,U+6E90,U+6EAF,U+6ED1,U+6EDA,U+6EDE,U+6EE1,U+70B9,U+7136,U+7167,U+7247-7248,U+724C,U+7269,U+72B6,U+72EC,U+731C,U+7387,U+73AF-73B0,U+7406,U+751F,U+7528,U+7531,U+753B,U+754C,U+7559,U+7565,U+7591,U+767B,U+7684,U+76D6,U+76D8,U+76EE,U+76F4,U+76F8,U+770B,U+771F,U+77E5,U+77ED,U+7801,U+7814,U+786E,U+78C1,U+793A,U+79BB,U+79CD,U+79D2,U+79F0,U+79FB,U+7A0B,U+7A0D,U+7A3F,U+7A76,U+7A7A,U+7A81,U+7A97,U+7ACB,U+7AD9,U+7AE0,U+7B26,U+7B2C,U+7B49,U+7B56,U+7B5B,U+7B7E,U+7B80,U+7B97,U+7C7B,U+7C98,U+7CBE,U+7CFB,U+7D22,U+7D2F,U+7E41,U+7EA6-7EA7,U+7EB3,U+7EBF,U+7EC4,U+7EC6-7EC8,U+7ECF,U+7ED1,U+7ED3,U+7ED9,U+7EDC-7EDD,U+7EDF,U+7EE7,U+7EEA,U+7EED,U+7F13,U+7F16,U+7F29,U+7F3A,U+7F51,U+7F6E,U+7F72,U+7FA4,U+8003,U+8005,U+8017,U+8054,U+80FD,U+811A,U+81EA,U+81F3-81F4,U+822A,U+8272,U+8282,U+82F1,U+8303,U+8349,U+83B7,U+85CF,U+884C,U+8865,U+8868,U+88AB,U+88C5,U+8981,U+8986,U+89C1-89C2,U+89C4,U+89C6,U+89C8,U+89D2,U+89E3,U+8BA1,U+8BA4,U+8BA8-8BA9,U+8BAE,U+8BB0,U+8BB2,U+8BB8,U+8BBA,U+8BBE-8BBF,U+8BC1,U+8BC6,U+8BC9-8BCA,U+8BCD,U+8BD1,U+8BD5,U+8BDD,U+8BE2,U+8BE5-8BE6,U+8BED,U+8BEF,U+8BF4,U+8BF7,U+8BFB,U+8C03,U+8C31,U+8C61,U+8D1F,U+8D23,U+8D25-8D26,U+8D28,U+8D34,U+8D39,U+8D44,U+8D56,U+8D77,U+8D85,U+8DB3,U+8DD1,U+8DDF,U+8DE8,U+8DEF,U+8DF3,U+8EAB,U+8F6C,U+8F6E,U+8F7D,U+8F83,U+8F85,U+8F91,U+8F93,U+8FBE,U+8FC1,U+8FC7,U+8FD0-8FD1,U+8FD4,U+8FD8-8FD9,U+8FDB,U+8FDE,U+8FF0,U+8FFD,U+9000-9002,U+9009,U+9010,U+9012,U+9017,U+901A,U+9020,U+903B,U+9047,U+9053,U+90E8,U+90FD,U+914D,U+9192,U+91C7,U+91CA,U+91CC-91CD,U+91CF,U+94A5,U+94FE,U+9500,U+9519,U+952E,U+955C,U+957F,U+95E8,U+95ED-95EE,U+95F2,U+95F4,U+9605,U+9608,U+961F,U+9636,U+963B,U+9644-9645,U+9650,U+9664,U+968F-9690,U+9694,U+969C,U+96C6,U+96F6,U+9700,U+9759,U+975E,U+9762,U+9875,U+9879-987B,U+9884,U+9886,U+9891,U+9898,U+989D,U+9988,U+9996,U+9A8C,U+9AA4,U+9AD8,U+9ECE,U+9ED8,U+FF01-FF5E}
-@font-face{font-family:"TheoremOS Sans SC";src:url("assets/fonts/NotoSansSC-ui-extra.woff2") format("woff2");font-weight:400 600;font-display:swap;unicode-range:U+4E07,U+4E1A,U+4E2D,U+4E88,U+4E8C,U+4E91,U+4ECA,U+4F30,U+4F46,U+4F4E-4F4F,U+4FB5,U+504F,U+514D,U+5178,U+51BB,U+51C0,U+521A,U+5229,U+522B,U+523B,U+529E,U+52FE,U+533F,U+5341,U+5361,U+53C8,U+5458,U+552F,U+56E2,U+591C,U+5929-592A,U+5B50,U+5B8F,U+5BB6,U+5BBF,U+5C01,U+5C14,U+5C3D,U+5E01,U+5E2E,U+5F39,U+5F88,U+5F8B,U+5FD7-5FD9,U+5FE0,U+600E,U+6070,U+6162,U+61C2,U+6258,U+6270,U+6279,U+627F-6280,U+62A4,U+62C5-62C6,U+62DF,U+62FF,U+635F,U+6377,U+6388-6389,U+63A7,U+642C,U+643A,U+64B0,U+653B,U+653F,U+6559,U+6587,U+6597,U+65BD,U+65C1,U+665A,U+672F,U+6746,U+677E,U+67D0,U+67EF,U+6837,U+684C,U+695A,U+699C,U+6B3E,U+6B67,U+6C47,U+6C99,U+6D01,U+6D1E,U+6D3E,U+6D45,U+6D89,U+6DF1,U+6F0F,U+72AF,U+732E,U+74E6,U+7533,U+7535,U+767D-767E,U+76F2,U+7740,U+7840,U+788D,U+793E,U+79C1,U+7A77,U+7AEF,U+7B54,U+7B79,U+7BA1,U+7BB1,U+7D20,U+7EAF,U+7ED5,U+7EF4,U+7EFC,U+7FFB,U+800C,U+8111,U+8212,U+82E5,U+8328,U+83DC,U+8425,U+8651,U+865A,U+897F,U+8A00,U+8B66,U+8BA2,U+8BC4,U+8BFA,U+8C01,U+8D21,U+8D70,U+8E2A,U+8F66,U+8F68,U+8FB9,U+8FDC-8FDD,U+8FF9,U+9014,U+904D,U+907F-9080,U+90A3,U+90AE,U+91D1,U+9488,U+949F,U+94AE,U+9501,U+9632,U+963F,U+9648,U+9876,U+9F50}
-@font-face{font-family:"TheoremOS Sans SC";src:url("assets/fonts/NotoSansSC-common.woff2") format("woff2");font-weight:400 600;font-display:swap;unicode-range:U+4E01,U+4E03,U+4E08,U+4E11,U+4E16,U+4E18-4E19,U+4E1B-4E1D,U+4E25,U+4E27,U+4E2B,U+4E30,U+4E32,U+4E38-4E39,U+4E3D-4E3E,U+4E43,U+4E4C-4E50,U+4E52-4E54,U+4E56,U+4E58-4E59,U+4E5D-4E5E,U+4E60-4E61,U+4E66,U+4E70-4E71,U+4E73,U+4E7E,U+4E89,U+4E8F,U+4E92,U+4E95,U+4E9A,U+4EA1-4EA2,U+4EA5-4EA6,U+4EA8-4EA9,U+4EAC-4EAE,U+4EB2,U+4EBF,U+4EC1,U+4EC6-4EC7,U+4ED1,U+4ED3-4ED5,U+4ED7,U+4ED9,U+4EDF,U+4EEA,U+4EF0,U+4EF2,U+4EFF,U+4F01,U+4F0A,U+4F0D-4F11,U+4F17,U+4F19,U+4F1E-4F1F,U+4F24,U+4F26,U+4F2A,U+4F2F,U+4F34,U+4F36,U+4F38,U+4F3A,U+4F3C,U+4F43,U+4F50-4F51,U+4F5B,U+4F63,U+4F69,U+4F6C,U+4F6F-4F70,U+4F73,U+4F84,U+4F88,U+4F8D,U+4F97,U+4FA0,U+4FA3,U+4FA5-4FA6,U+4FA8-4FA9,U+4FAE-4FAF,U+4FBF,U+4FC3-4FC4,U+4FCA,U+4FCF-4FD0,U+4FD7-4FD8,U+4FDE,U+4FE9,U+4FED,U+4FEF,U+4FF1,U+4FFA,U+500D,U+5012,U+5014,U+5018,U+501A,U+501F,U+5021,U+5026,U+502A,U+503A,U+503E,U+5065,U+5076-5077,U+507F-5080,U+5085,U+5088,U+508D,U+50A3,U+50AC,U+50B2,U+50BB,U+50DA,U+50E7,U+50F3,U+50F5,U+50FB,U+5112,U+5121,U+513F,U+5143-5144,U+5146,U+5149,U+514B,U+5151,U+5154,U+515A,U+515C,U+5162,U+516B,U+516D,U+5170,U+5174-5175,U+5179,U+517B,U+517D,U+5180,U+5188-5189,U+5192,U+5195,U+5197,U+519B-519C,U+51A0,U+51A4,U+51AC,U+51AF-51B0,U+51B5-51B7,U+51C4,U+51C9,U+51CB-51CC,U+51D1,U+51DB,U+51DD,U+51E4,U+51EF-51F0,U+51F3,U+51F6,U+51F8-51F9,U+51FF-5201,U+5203,U+520A,U+5211,U+5218,U+5228,U+522E,U+5238-523A,U+523D,U+5241-5243,U+524A,U+5250-5251,U+5254,U+5256,U+5265,U+5267,U+5272,U+527F,U+5288,U+529D,U+52A3,U+52AA-52AB,U+52B1-52B3,U+52BF,U+52C3,U+52C7,U+52C9,U+52CB,U+52D2,U+52D8,U+52DF,U+52E4,U+52FA,U+5300,U+5306,U+5308,U+5317,U+5319,U+531D,U+5320-5321,U+5323,U+532A,U+533B,U+5343,U+5347-5349,U+534E,U+5351-5353,U+5356,U+535A,U+535C,U+535E,U+5362,U+5364,U+5367,U+536B,U+536F-5371,U+5374-5375,U+5377-5378,U+537F,U+5382,U+5384-5385,U+5389,U+538C,U+5395,U+5398,U+539A,U+53A2,U+53A6,U+53A8-53A9,U+53BB,U+53BF,U+53C1,U+53C9,U+53CB,U+53D4,U+53D9,U+53DB,U+53E4,U+53EB-53EE,U+53F6,U+53F8-53F9,U+53FC,U+5401,U+5403,U+5409-540A,U+540F-5410,U+5413,U+5415,U+541B,U+541D-5420,U+5427-5429,U+542C-542E,U+5431,U+5434-5435,U+5438-5439,U+543B-543C,U+543E,U+5440,U+5446,U+5448,U+5450,U+5455,U+545B-545C,U+5462,U+5468,U+5473,U+5475,U+5478,U+547B-547C,U+5480,U+5486,U+548B,U+548E-5490,U+5492,U+5495-5496,U+5499,U+54AC,U+54AF,U+54B1,U+54B3,U+54B8,U+54BD,U+54C0,U+54C4,U+54C6-54C7,U+54C9,U+54CE,U+54D1,U+54D7,U+54DF,U+54E5-54E6,U+54E8-54E9,U+54ED-54EE,U+54F2,U+54FA,U+54FC,U+5501,U+5506-5507,U+5509,U+5510,U+5524,U+552C,U+552E,U+5531,U+553E,U+5543-5544,U+554A,U+5561,U+5564-5566,U+556A,U+556E,U+5578,U+557C,U+5580,U+5582,U+5584,U+5587,U+5589-558A,U+5598,U+559C-559D,U+55A7,U+55B3,U+55B7,U+55BB,U+55C5,U+55D3,U+55DC,U+55E1,U+55E3,U+55FD,U+5609,U+560E,U+5618,U+561B,U+5631-5632,U+5634,U+5636,U+563B,U+563F,U+564E,U+566A,U+566C,U+5676,U+568E-568F,U+56A3,U+56B7,U+56BC,U+56CA,U+56DA,U+56E4,U+56ED,U+56F0-56F1,U+56FD,U+5703,U+5706,U+5708,U+571F,U+5723,U+572D,U+573E,U+574A,U+574D-5751,U+575A-575B,U+575D-5761,U+5764,U+5766,U+576A,U+576F,U+5777,U+5782-5784,U+5792,U+579B,U+57A2-57A3,U+57A6,U+57AB,U+57AE,U+57C2-57C3,U+57CB,U+57CE,U+57D4,U+57E0,U+57F9,U+5802,U+5806,U+5811,U+5815,U+5821,U+5824,U+582A,U+5830,U+5835,U+584C,U+5851,U+5854,U+5858,U+5885,U+5892-5893,U+5899,U+589F,U+58A8-58A9,U+58C1,U+58D5,U+58E4,U+58EB-58EC,U+58EE,U+58F3,U+58F6,U+58F9,U+590F,U+5915,U+591F,U+592B,U+592E-592F,U+5937-5938,U+593A,U+5944,U+5947-5949,U+594B,U+594E-594F,U+5951,U+5954,U+5956-5957,U+5960,U+5962,U+5965,U+5973-5974,U+5976,U+5978-5979,U+5984,U+5986-5988,U+598A,U+5992-5993,U+5996,U+5999,U+59A5,U+59A8,U+59AE,U+59B9,U+59BB,U+59C6,U+59D0-59D1,U+59D3-59D4,U+59DA,U+59DC,U+59E5,U+59E8,U+59EC,U+59FB,U+59FF,U+5A01,U+5A03-5A04,U+5A07,U+5A18,U+5A1C,U+5A1F-5A20,U+5A25,U+5A29,U+5A31,U+5A36,U+5A46,U+5A49,U+5A5A,U+5A6A,U+5A74,U+5A76,U+5A7F,U+5A92,U+5A9A,U+5AB3,U+5AC1-5AC2,U+5AC9,U+5ACC,U+5AE1,U+5AE9,U+5B54-5B55,U+5B59,U+5B5C-5B5D,U+5B5F,U+5B63-5B64,U+5B69-5B6A,U+5B70,U+5B75,U+5B7A,U+5B7D,U+5B81,U+5B85,U+5B87-5B88,U+5B8B,U+5B97,U+5B99,U+5B9B-5B9D,U+5BA0,U+5BA2-5BA4,U+5BA6,U+5BAA-5BAB,U+5BB0,U+5BB3-5BB5,U+5BBE,U+5BC2,U+5BC4-5BC5,U+5BC7,U+5BCC,U+5BD0,U+5BD2-5BD3,U+5BDD-5BDE,U+5BE1,U+5BE5,U+5BE8,U+5BF8,U+5BFA-5BFB,U+5BFF,U+5C04,U+5C09-5C0A,U+5C16,U+5C18,U+5C24,U+5C27,U+5C38-5C3A,U+5C3C,U+5C3F,U+5C41,U+5C45,U+5C48-5C4B,U+5C4E-5C4F,U+5C51,U+5C60-5C61,U+5C65,U+5C6F,U+5C71,U+5C79,U+5C7F,U+5C81-5C82,U+5C94,U+5C97,U+5C9B,U+5CA9,U+5CAD,U+5CB3,U+5CB8,U+5CBF,U+5CD9,U+5CE1,U+5CE6,U+5CE8,U+5CEA,U+5CED,U+5CF0,U+5CFB,U+5D07,U+5D0E,U+5D14,U+5D16,U+5D29,U+5D2D,U+5D4C,U+5DCD,U+5DDD-5DDE,U+5DE1-5DE2,U+5DE7-5DE9,U+5DEB,U+5DF3-5DF4,U+5DF7,U+5DFE,U+5E02,U+5E05-5E06,U+5E08,U+5E10,U+5E15-5E16,U+5E18,U+5E1A-5E1D,U+5E27,U+5E2D,U+5E3D,U+5E42,U+5E45,U+5E4C,U+5E55,U+5E62,U+5E74,U+5E78,U+5E7B-5E7D,U+5E7F,U+5E84,U+5E86-5E87,U+5E8A,U+5E90,U+5E95,U+5E97,U+5E99-5E9A,U+5E9C,U+5E9E-5E9F,U+5EA7,U+5EAD,U+5EB6-5EB8,U+5EC9-5ECA,U+5ED3,U+5ED6,U+5EF7,U+5F04,U+5F0A,U+5F13,U+5F17-5F18,U+5F1B,U+5F1F,U+5F25-5F27,U+5F2F,U+5F31,U+5F5D,U+5F64,U+5F66,U+5F69-5F6A,U+5F6C-5F6D,U+5F70,U+5F79,U+5F7B-5F7C,U+5F81,U+5F8A,U+5F90,U+5F92,U+5F98,U+5FA1,U+5FB7,U+5FBD,U+5FC6,U+5FCC-5FCD,U+5FE7,U+5FF1,U+5FF5,U+5FFB,U+5FFF-6000,U+6002,U+6012,U+6014-6016,U+601C,U+6020,U+6025,U+6028,U+602A,U+602F,U+6043,U+604B,U+604D,U+6050,U+6052,U+6055,U+6064,U+6068-6069,U+606B-606D,U+6073,U+6076,U+607C,U+607F,U+6084,U+6089,U+608D,U+6094,U+609F-60A0,U+60A3,U+60A6,U+60A8,U+60AF,U+60B2,U+60B8,U+60BC,U+60CA-60CB,U+60D1,U+60D5,U+60DC,U+60DF-60E0,U+60E6-60E9,U+60EB,U+60ED-60F0,U+60F6,U+60F9-60FA,U+6101,U+6108-6109,U+611A,U+6124,U+6127,U+613F,U+6148,U+614C,U+614E,U+6151,U+6155,U+6167-6168,U+6170,U+6177,U+618B,U+618E,U+61A8,U+61BE,U+61C8,U+61CA,U+61D2,U+61E6,U+6208,U+620A,U+620C-620F,U+6212,U+6218,U+621A,U+622E,U+6233-6234,U+623F,U+6241,U+6247,U+624E,U+6251-6252,U+6254,U+625B,U+6263,U+6266,U+626B-626F,U+6273,U+6276,U+627C,U+6284,U+6289,U+6291-6293,U+6296-6297,U+629A-629B,U+62A0-62A2,U+62A8,U+62AB-62AC,U+62B1,U+62B5,U+62B9,U+62BC-62BD,U+62BF,U+62C2,U+62C4,U+62C7-62C9,U+62CC-62CE,U+62D0,U+62D3-62D4,U+62D8-62D9,U+62DB-62DC,U+62E2-62E3,U+62E5-62E8,U+62ED,U+62EF,U+62F1,U+62F3-62F4,U+62F7,U+62FC-62FE,U+6302,U+630E,U+6311,U+6316,U+631A-631B,U+631D-631F,U+6321,U+6323-6325,U+6328,U+632A-632B,U+632F,U+633A,U+633D,U+6342,U+6345-6346,U+6349,U+634C-6350,U+635E,U+6361,U+6363,U+6367,U+6376,U+637B,U+6380,U+6382,U+6387,U+638C,U+638F-6390,U+6396,U+6398,U+63A0,U+63A3,U+63A9-63AA,U+63B3,U+63B7-63B8,U+63BA,U+63C9,U+63CD,U+63D2,U+63D6,U+63E1,U+63E3,U+63E9-63EA,U+63ED,U+63F4,U+63FD,U+6400-6402,U+6405,U+640F-6410,U+6413-6414,U+641E,U+642A,U+642D,U+643D,U+6444,U+6446-6448,U+644A,U+6454,U+6467,U+6469,U+6478-6479,U+6482,U+6485,U+6487,U+6491-6492,U+6495,U+649E,U+64A9,U+64AC,U+64AE,U+64B5,U+64BC,U+64C2,U+64C5,U+64CE,U+64D2,U+64DE,U+64E6,U+6500,U+6512,U+6518,U+652B,U+654C,U+6551,U+6556,U+655B,U+655D-655E,U+6562,U+6566,U+656C,U+6572,U+6577,U+658B-658C,U+6591,U+659C,U+659F,U+65A1,U+65A4-65A5,U+65A7,U+65A9,U+65AF,U+65C5,U+65CB,U+65D7,U+65E2,U+65E6,U+65E8,U+65EC-65ED,U+65F1,U+65F7,U+65FA,U+6602,U+6606,U+660C,U+660F,U+6613-6614,U+661F-6620,U+6625,U+6627-6628,U+662D,U+663C,U+6643,U+664B-664C,U+6652-6653,U+6655,U+6664,U+6666,U+6668,U+6670,U+6674,U+6676,U+667A,U+667E,U+6687,U+6691,U+6696-6697,U+66AE,U+66B4,U+66D9,U+66DD,U+66F0,U+66F2-66F3,U+66F9,U+66FE,U+6708,U+670B,U+6714,U+6717,U+671D,U+6728,U+672D,U+6731,U+6734-6735,U+673D,U+6740,U+6742,U+6749,U+674E-674F,U+6751,U+6756,U+675C,U+6760,U+6768,U+676D,U+676F-6770,U+6781,U+6789,U+6795,U+6797,U+679A,U+679D,U+67A2-67A3,U+67AA-67AB,U+67AF,U+67B6-67B7,U+67C4,U+67CF,U+67D1-67D4,U+67DC,U+67DE,U+67E0,U+67EC,U+67F1,U+67F3-67F4,U+67FF,U+6805,U+6808,U+680B,U+6811,U+6813,U+6816-6817,U+682A,U+683D,U+6842-6843,U+6845,U+6850-6851,U+6853-6854,U+6865,U+6868-6869,U+6876,U+6881,U+6885-6886,U+6897,U+68A2,U+68A6-68A8,U+68AD,U+68AF-68B0,U+68B3,U+68C9,U+68CB,U+68CD,U+68D2,U+68D5,U+68D8,U+68DA,U+68E0,U+68EE,U+68F1,U+68F5,U+68FA,U+6905,U+690D-690E,U+6912,U+692D,U+6930,U+693D,U+693F,U+6954,U+695E,U+6977,U+697C,U+6986,U+6994,U+69A8,U+69B4,U+69B7,U+69D0,U+69FD,U+6A0A,U+6A1F,U+6A2A,U+6A31,U+6A47,U+6A59,U+6A61,U+6A71,U+6A80,U+6A84,U+6AAC,U+6B20,U+6B22-6B23,U+6B27,U+6B32,U+6B3A,U+6B47,U+6B49,U+6B4C,U+6B66,U+6B6A,U+6B79,U+6B7B-6B7C,U+6B83,U+6B86,U+6B89-6B8B,U+6B96,U+6BB4,U+6BB7,U+6BBF,U+6BC1,U+6BC5,U+6BCB,U+6BD2,U+6BD5-6BD7,U+6BD9,U+6BDB,U+6BE1,U+6BEB,U+6BEF,U+6C0F,U+6C11,U+6C13-6C14,U+6C16,U+6C1B,U+6C1F,U+6C22,U+6C26-6C28,U+6C2E-6C30,U+6C34,U+6C38,U+6C40-6C41,U+6C49,U+6C50,U+6C55,U+6C57,U+6C5B,U+6C5D-6C61,U+6C64,U+6C6A,U+6C70,U+6C72,U+6C79,U+6C7D-6C7E,U+6C81-6C83,U+6C88-6C89,U+6C8F,U+6C9B,U+6C9F,U+6CA4-6CA7,U+6CAA-6CAB,U+6CAE,U+6CB3,U+6CB8-6CB9,U+6CBB-6CBE,U+6CC4-6CC5,U+6CC9-6CCA,U+6CCC,U+6CDE,U+6CE1-6CE3,U+6CE5,U+6CEA,U+6CF0,U+6CF3,U+6CF5,U+6CFB-6CFD,U+6D0B,U+6D12,U+6D17,U+6D1B,U+6D25,U+6D2A,U+6D31-6D32,U+6D3C-6D3D,U+6D46-6D47,U+6D4A,U+6D4E,U+6D51,U+6D53,U+6D59-6D5A,U+6D66,U+6D69-6D6A,U+6D6E,U+6D74,U+6D77-6D78,U+6D82,U+6D85,U+6D8C,U+6D8E,U+6D95,U+6D9B,U+6D9D,U+6D9F,U+6DA1,U+6DA3-6DA4,U+6DA6-6DAA,U+6DAF,U+6DB2,U+6DB5,U+6DB8,U+6DC0,U+6DC4,U+6DC6,U+6DCB-6DCC,U+6DD1,U+6DD6,U+6DD8,U+6DE1,U+6DE4,U+6DEB-6DEC,U+6DEE,U+6DF3,U+6DF7,U+6DF9,U+6E0A,U+6E0D,U+6E14,U+6E17,U+6E1D,U+6E20-6E21,U+6E23-6E24,U+6E29,U+6E2D,U+6E2F,U+6E34,U+6E3A,U+6E43,U+6E4D,U+6E56,U+6E58,U+6E5B,U+6E7E-6E7F,U+6E83,U+6E85,U+6E89,U+6E9C,U+6EA2,U+6EAA,U+6EB6,U+6EBA,U+6EC1,U+6EC7,U+6ECB,U+6ED3-6ED4,U+6EE4-6EE6,U+6EE8-6EE9,U+6EF4,U+6F02,U+6F06,U+6F13-6F14,U+6F20,U+6F2B,U+6F31,U+6F33,U+6F3E,U+6F4D,U+6F58,U+6F5C,U+6F5E,U+6F66,U+6F6D-6F6E,U+6F84,U+6F88,U+6F8E,U+6F9C,U+6FA1,U+6FB3,U+6FC0,U+6FD2,U+7011,U+704C,U+706B,U+706D,U+706F-7070,U+7075-7076,U+7078,U+707C,U+707E-707F,U+7089-708A,U+708E,U+7092,U+7094-7095,U+7099,U+70AC-70AF,U+70B3,U+70B8,U+70BC-70BD,U+70C1-70C3,U+70C8,U+70D8-70D9,U+70DB,U+70DF,U+70E4,U+70E6-70E7,U+70E9,U+70EB-70ED,U+70EF,U+70F7,U+70F9,U+70FD,U+7109-710A,U+7115,U+7119-711A,U+7126,U+7130,U+714C,U+714E,U+715E,U+7164,U+716E,U+717D,U+7184,U+718A,U+718F,U+7194,U+7199,U+719F,U+71AC,U+71C3,U+71CE,U+71D5,U+71E5,U+7206,U+722A,U+722C,U+7231,U+7235-7239,U+723D,U+7259,U+725B,U+725F,U+7261-7262,U+7267,U+7272,U+7275,U+7279-727A,U+7280-7281,U+728A,U+72AC,U+72B9,U+72C2,U+72C4,U+72C8,U+72D0,U+72D7,U+72D9,U+72DE,U+72E0-72E1,U+72ED-72EE,U+72F0-72F1,U+72F8,U+72FC,U+730E,U+7316,U+731B,U+7329-732B,U+7334,U+733E-733F,U+736D,U+7384,U+7389,U+738B,U+7396,U+739B,U+73A9,U+73AB,U+73B2,U+73BB,U+73CA,U+73CD,U+73D0,U+73E0,U+73ED,U+7403,U+7405,U+7409,U+7410,U+7422,U+7433-7436,U+743C,U+745A,U+745E-745F,U+7470,U+7476,U+7483,U+74DC,U+74E2-74E4,U+74EE,U+74F6-74F7,U+7504,U+7518,U+751A,U+751C,U+7525,U+7529,U+752B,U+752D,U+7530,U+7532,U+7537-7538,U+7545,U+754F,U+7554,U+755C,U+7566,U+756A,U+7574,U+7578,U+7586,U+758F,U+7597,U+7599-759A,U+759F,U+75A1,U+75A4-75A5,U+75AB,U+75AE-75AF,U+75B2,U+75B5,U+75B9,U+75BC-75BE,U+75C5,U+75C7-75CA,U+75D2,U+75D4-75D5,U+75D8,U+75DB,U+75DE,U+75E2,U+75EA,U+75F0,U+75F4,U+75F9,U+7601,U+761F,U+7624,U+7626,U+7629-762B,U+7634,U+7638,U+764C,U+7663,U+7678,U+7682,U+7686-7687,U+768B,U+7691,U+7696,U+76AE,U+76B1,U+76BF,U+76C2,U+76C5-76C6,U+76C8,U+76CA,U+76CE-76D2,U+76D4,U+76D7,U+76DB,U+76DF,U+76EF,U+76FC,U+76FE,U+7701,U+7709,U+7720,U+7728-7729,U+772F,U+7736-7737,U+773A,U+773C,U+7741,U+775B,U+7761,U+7763,U+7766,U+776B-776C,U+7779,U+7784-7785,U+778E,U+7792,U+77A5,U+77A7,U+77A9-77AA,U+77AC,U+77B3,U+77BB,U+77D7,U+77DB,U+77E2-77E3,U+77E9,U+77EB,U+77EE,U+77F3,U+77FD-77FF,U+7802,U+780C-780D,U+7812,U+7816,U+781A,U+7827,U+7830,U+7834,U+7837-7838,U+783E,U+7845,U+7852,U+7855,U+785D,U+786B-786C,U+7877,U+787C,U+7889,U+788C,U+788E,U+7891,U+7897-7898,U+789F,U+78A7,U+78B0-78B1,U+78B3-78B4,U+78BE,U+78C5,U+78CA-78CB,U+78D0,U+78D5,U+78E8,U+78F7,U+78FA,U+7901,U+793C,U+7941,U+7948,U+7956,U+795D-795F,U+7965,U+7968,U+796D,U+7977-7978,U+7981,U+7984,U+798F,U+79B9,U+79BD-79BE,U+79C0,U+79C3,U+79C6,U+79C9,U+79CB,U+79D1,U+79D8,U+79DF,U+79E4,U+79E6-79E7,U+79E9,U+79EF,U+79F8,U+79FD,U+7A00,U+7A0E,U+7A17,U+7A1A,U+7A20,U+7A33,U+7A3B-7A3D,U+7A46,U+7A57,U+7A74,U+7A7F,U+7A83-7A84,U+7A8D,U+7A91-7A92,U+7A96,U+7A98,U+7A9C-7A9D,U+7A9F,U+7AA5,U+7ABF,U+7AD6,U+7ADE-7ADF,U+7AE3,U+7AE5,U+7AED,U+7AF9,U+7AFF,U+7B06,U+7B0B,U+7B11,U+7B14,U+7B1B,U+7B28,U+7B3A,U+7B3C,U+7B4B,U+7B4F-7B52,U+7B77,U+7B8D,U+7B94-7B95,U+7BA9,U+7BAD,U+7BC6-7BC7,U+7BD3,U+7BD9,U+7BE1,U+7BEE,U+7BF1,U+7BF7,U+7C07,U+7C27,U+7C3F,U+7C4D,U+7C73,U+7C7D,U+7C89,U+7C92,U+7C95,U+7C97,U+7C9F,U+7CA4-7CA5,U+7CAA,U+7CAE,U+7CB1,U+7CB3,U+7CB9,U+7CCA,U+7CD5-7CD6,U+7CD9,U+7CDC,U+7CDF-7CE0,U+7CEF,U+7D0A,U+7D27,U+7D2B,U+7D6E,U+7E82,U+7EA0,U+7EA2,U+7EA4,U+7EAA-7EAC,U+7EB1-7EB2,U+7EB5-7EBA,U+7EBD,U+7EC3,U+7EC5,U+7ECA,U+7ECD-7ECE,U+7ED2,U+7ED8,U+7EDA,U+7EDE,U+7EE2-7EE3,U+7EE5-7EE6,U+7EE9,U+7EF0,U+7EF3,U+7EF5,U+7EF7-7EF8,U+7EFD,U+7EFF-7F00,U+7F04-7F06,U+7F09,U+7F0E,U+7F14-7F15,U+7F18,U+7F1A,U+7F1D,U+7F20,U+7F28,U+7F2E,U+7F34,U+7F38,U+7F50,U+7F55,U+7F57,U+7F5A,U+7F62,U+7F69-7F6A,U+7F8A,U+7F8C,U+7F8E,U+7F94,U+7F9A,U+7F9E,U+7FA1,U+7FB9,U+7FBD,U+7FC1,U+7FC5,U+7FCC,U+7FD4,U+7FD8,U+7FDF-7FE0,U+7FF0-7FF1,U+7FFC,U+8000-8001,U+800D,U+8010,U+8015,U+8018-8019,U+802A,U+8033,U+8036,U+8038,U+803B,U+803D,U+803F,U+8042,U+804A-804C,U+8058,U+805A,U+806A,U+8083-8084,U+8086-8087,U+8089,U+808B-808C,U+8096,U+8098,U+809A-809B,U+809D,U+80A0-80A2,U+80A4-80A5,U+80A9-80AA,U+80AE-80AF,U+80B2,U+80BA,U+80BE-80C1,U+80C3,U+80C6,U+80CC,U+80CE,U+80D6,U+80DA,U+80DC,U+80DE,U+80E1,U+80EF-80F0,U+80F3,U+80F6,U+80F8,U+80FA,U+8102,U+8106,U+8109-810A,U+810F-8110,U+8113,U+8116,U+812F,U+8131,U+8138,U+813E,U+8146,U+814A-814B,U+8150-8151,U+8154-8155,U+8165,U+816E,U+8170,U+8179-817B,U+817E-8180,U+818A,U+818F,U+8198,U+819B-819D,U+81A8,U+81B3,U+81C0,U+81C2-81C3,U+81C6,U+81E3,U+81ED,U+81FB-81FC,U+8200,U+8205-8206,U+820C-820D,U+8214,U+821C,U+821E-821F,U+822C,U+8230-8231,U+8235-8237,U+8239,U+8247,U+8258,U+826F-8270,U+8273,U+827A,U+827E,U+828B,U+828D,U+8292,U+829C-829D,U+82A5-82A6,U+82AC-82AD,U+82AF,U+82B1,U+82B3,U+82B9,U+82BD,U+82C7,U+82CD,U+82CF,U+82D1,U+82D4,U+82D7,U+82DB,U+82DE-82DF,U+82E6,U+82EB,U+82EF,U+82F9,U+8301-8302,U+8304-8305,U+830E,U+8327,U+832B-832C,U+8335-8336,U+8338-8339,U+8346,U+8350,U+8352,U+8354,U+835A,U+8361,U+8363-8364,U+8367,U+836B,U+836F,U+8377,U+8386,U+8389,U+838E,U+83AB,U+83B1-83B2,U+83B9,U+83BD,U+83C7,U+83CA,U+83CC,U+83CF,U+83E0,U+83E9,U+83F1-83F2,U+8404,U+840C-840E,U+841D,U+8424,U+8427-8428,U+843D,U+8457,U+845B,U+8461,U+8463,U+846B-846C,U+8471,U+8475,U+8482,U+848B,U+8499,U+849C,U+84B2,U+84B8,U+84C4,U+84C9,U+84D1,U+84D6,U+84DD,U+84DF,U+84EC,U+8511,U+8513,U+8517,U+851A,U+8521,U+852B-852C,U+8537,U+853C-853D,U+8549-854A,U+8574,U+857E,U+8584,U+859B,U+85AA,U+85AF,U+85C9,U+85D0,U+85D5,U+85E4,U+85E9,U+85FB,U+8611,U+8638,U+864E-8650,U+865E,U+866B,U+8671,U+8679,U+867D-867E,U+8680-8682,U+868A,U+868C,U+8695,U+869C,U+86A4,U+86C0,U+86C6-86C7,U+86CA-86CB,U+86D4,U+86D9,U+86DB,U+86E4,U+86EE,U+86F0,U+86F9,U+86FE,U+8700,U+8702,U+8712,U+8715,U+8717-8718,U+871C,U+8721,U+8747,U+8749,U+874E,U+8757,U+8774,U+8776,U+878D,U+879F,U+87BA,U+87F9,U+8815,U+8822,U+8840,U+8845,U+884D,U+8854,U+8857,U+8859,U+8861,U+8863,U+886B-886C,U+8870,U+8877,U+8881,U+8884,U+888B,U+888D,U+8892,U+8896,U+889C,U+88AD,U+88B1,U+88C1-88C2,U+88D4-88D5,U+88D9,U+88E4,U+88F3-88F4,U+88F8-88F9,U+8902,U+8910,U+8912,U+8925,U+892A,U+8944,U+895F,U+89C5,U+89C9,U+89E6,U+8A79,U+8A89-8A8A,U+8A93,U+8B6C,U+8BA3,U+8BA5,U+8BAB,U+8BAD,U+8BAF,U+8BB3,U+8BB6,U+8BB9,U+8BBC-8BBD,U+8BC0,U+8BC5,U+8BC8,U+8BCC,U+8BD7,U+8BDA-8BDB,U+8BDE,U+8BE1,U+8BE3,U+8BE7,U+8BEB-8BEC,U+8BF1-8BF2,U+8BF5,U+8BF8,U+8BFD-8BFE,U+8C05-8C06,U+8C08,U+8C0A-8C0B,U+8C0D-8C0E,U+8C10,U+8C13,U+8C17,U+8C1A,U+8C1C,U+8C22-8C24,U+8C26,U+8C28-8C29,U+8C2C-8C2D,U+8C30,U+8C34,U+8C37,U+8C41,U+8C46,U+8C4C,U+8C62,U+8C6A-8C6B,U+8C79-8C7A,U+8C89,U+8C8C,U+8D1D-8D1E,U+8D22,U+8D24,U+8D27,U+8D29-8D31,U+8D35,U+8D37-8D38,U+8D3A,U+8D3C,U+8D3E-8D3F,U+8D41-8D43,U+8D4A-8D4C,U+8D4E-8D50,U+8D54,U+8D58,U+8D5A-8D5B,U+8D5E,U+8D60-8D64,U+8D66,U+8D6B,U+8D74-8D76,U+8D81,U+8D8A-8D8B,U+8D9F,U+8DA3,U+8DB4,U+8DBE,U+8DC3,U+8DCB-8DCC,U+8DDD,U+8DEA,U+8DF5,U+8DFA,U+8E0A,U+8E0C,U+8E0F,U+8E1E,U+8E22,U+8E29,U+8E44,U+8E48,U+8E4B,U+8E66,U+8E6C-8E6D,U+8E72,U+8E7F,U+8E81,U+8E87,U+8EAC,U+8EAF,U+8EB2,U+8EBA,U+8F67,U+8F69,U+8F6F-8F70,U+8F74,U+8F7B,U+8F7F,U+8F86,U+8F88-8F8A,U+8F90,U+8F95-8F97,U+8F99,U+8F9B-8F9C,U+8F9E-8F9F,U+8FA3,U+8FA8-8FA9,U+8FAB,U+8FB0-8FB1,U+8FBD,U+8FC2,U+8FC4-8FC5,U+8FC8,U+8FCE,U+8FDF,U+8FE2,U+8FEA-8FEB,U+8FED,U+8FF7-8FF8,U+9003,U+9006,U+900A,U+900F,U+901B,U+901D-901F,U+9022,U+902E,U+9038,U+903C,U+903E,U+9041-9042,U+904F,U+9057,U+9063,U+9065,U+906D-906E,U+9075,U+9091,U+9093,U+90A2,U+90A6,U+90AA,U+90AF,U+90B1,U+90B5,U+90B9,U+90BB,U+90C1,U+90CA,U+90CE,U+90D1,U+90DD,U+90E1,U+90E7,U+90ED,U+90F4,U+90F8,U+9102,U+9119,U+9149,U+914B-914C,U+9152,U+9157,U+915A,U+915D-915E,U+9163,U+9165,U+916A,U+916C,U+916E,U+9171,U+9175-9178,U+917F,U+9187,U+9189,U+918B,U+919A-919B,U+91C9,U+91CE,U+91DC,U+9274,U+9489,U+948E,U+9492-9493,U+9499,U+949D-949E,U+94A0-94A2,U+94A6-94A9,U+94B1,U+94B3,U+94B5,U+94BB,U+94BE,U+94C0-94C3,U+94C5-94C6,U+94DC-94DD,U+94E1,U+94E3,U+94EC-94ED,U+94F0-94F2,U+94F6,U+94F8,U+94FA,U+9504-9505,U+9508,U+950B-950C,U+9510-9511,U+9517,U+951A,U+9521,U+9523-9526,U+9528,U+952D,U+952F-9530,U+9539,U+953B,U+9540-9541,U+9547,U+954A,U+954D,U+9550-9551,U+9563,U+956D,U+9570,U+9576,U+95EA,U+95EF-95F0,U+95F7-95FB,U+95FD,U+9600-9602,U+9609,U+960E,U+9610-9611,U+9614,U+961C,U+962E,U+9633-9635,U+9640,U+9646-9647,U+964B-964D,U+9655,U+965B,U+9661-9662,U+9668-966A,U+9675-9677,U+9685-9686,U+968B,U+9698-9699,U+96A7,U+96B6,U+96BE,U+96C0-96C1,U+96C4-96C5,U+96C7,U+96CC-96CD,U+96CF,U+96D5,U+96E8,U+96EA,U+96F7,U+96F9,U+96FE,U+9704,U+9707,U+9709,U+970D,U+9713,U+9716,U+971C,U+971E,U+9732,U+9738-9739,U+9752,U+9756,U+975B,U+9760-9761,U+9769,U+9773-9774,U+9776,U+978B,U+978D,U+9798,U+97A0,U+97AD,U+97E6-97E7,U+97E9,U+97ED,U+97F3,U+97F5-97F6,U+9877,U+987D-987F,U+9881-9882,U+9885,U+9887-9888,U+988A,U+9890,U+9893,U+9896-9897,U+989C,U+98A0,U+98A4,U+98A7,U+98CE,U+98D8,U+98DE-98DF,U+9910,U+9965,U+996D-9972,U+9975-9976,U+997A,U+997C,U+997F,U+9981,U+9985-9986,U+998B,U+998F,U+9992,U+9999,U+9A6C-9A71,U+9A73-9A74,U+9A76,U+9A79,U+9A7B-9A7C,U+9A7E,U+9A82,U+9A84,U+9A86-9A87,U+9A8B,U+9A8F,U+9A91,U+9A97,U+9A9A,U+9AA1,U+9AA8,U+9AB8,U+9AD3,U+9B03,U+9B3C,U+9B41-9B42,U+9B44,U+9B4F,U+9B54,U+9C7C,U+9C81,U+9C8D,U+9C9C,U+9CA4,U+9CB8,U+9CC3,U+9CD6,U+9CDE,U+9E1F,U+9E21,U+9E23,U+9E25-9E26,U+9E2D,U+9E2F,U+9E33,U+9E35,U+9E3D,U+9E3F,U+9E43,U+9E45,U+9E4A,U+9E4F,U+9E64,U+9E70,U+9E7F,U+9E93,U+9EA6,U+9EBB,U+9EC4,U+9ECD,U+9ED1,U+9ED4,U+9F0E,U+9F13,U+9F20,U+9F3B,U+9F7F,U+9F84,U+9F8B,U+9F99-9F9A,U+9F9F}
-@font-face{font-family:"TheoremOS Serif Latin";src:url("assets/fonts/TheoremOSSerif-latin.woff2") format("woff2");font-style:normal;font-weight:400 700;font-display:swap}
-@font-face{font-family:"JetBrains Mono";src:url("assets/fonts/JetBrainsMono.woff2") format("woff2");font-style:normal;font-weight:400 700;font-display:swap}
-/* Noto Serif SC 600 for headings, split so pages only fetch the rarer GB2312 characters when a heading uses them. */
-@font-face{font-family:"TheoremOS Serif SC";src:url("assets/fonts/NotoSerifSC-ui.woff2") format("woff2");font-weight:400 700;font-display:swap;unicode-range:U+3000-303F,U+4E00,U+4E09-4E0B,U+4E0D-4E0E,U+4E13-4E14,U+4E22,U+4E24,U+4E2A,U+4E2D,U+4E34,U+4E3A-4E3B,U+4E45,U+4E48-4E49,U+4E4B,U+4E5F,U+4E86,U+4E8B,U+4E8E,U+4E94,U+4E9B,U+4EA4,U+4EA7,U+4EAB,U+4EBA,U+4EC0,U+4EC5,U+4ECB,U+4ECD-4ECE,U+4ED6,U+4ED8,U+4EE3-4EE5,U+4EEC,U+4EF6-4EF7,U+4EFB,U+4EFD,U+4F18,U+4F1A,U+4F20,U+4F4D,U+4F53,U+4F55,U+4F59,U+4F5C,U+4F60,U+4F7F,U+4F8B,U+4F9B,U+4F9D,U+4FA7,U+4FDD,U+4FE1,U+4FEE,U+5019,U+503C,U+5047,U+505A,U+505C,U+50A8,U+50CF,U+5141,U+5145,U+5148,U+5165,U+5168,U+516C,U+5171,U+5173,U+5176-5177,U+517C,U+5185,U+518C-518D,U+5199,U+51B2-51B3,U+51C6,U+51CF,U+51E0-51E1,U+51ED,U+51FA-51FB,U+51FD,U+5206-5207,U+5212,U+5217,U+5219,U+521B,U+521D,U+5220,U+5224,U+5230,U+5236-5237,U+524D,U+5269-526A,U+526F,U+529B,U+529F-52A1,U+52A8-52A9,U+52FF,U+5305,U+5316,U+5339-533A,U+534A,U+534F,U+5355,U+5357,U+5360,U+5373,U+5386,U+538B,U+539F,U+53C2,U+53CA,U+53CC-53CD,U+53D1,U+53D6-53D8,U+53E0,U+53E3,U+53E5-53E6,U+53EA,U+53EF-53F0,U+53F2-53F3,U+53F7,U+5404,U+5408,U+540C-540E,U+5411,U+5417,U+5426,U+542B,U+542F,U+544A,U+547D,U+548C,U+54A8,U+54C1,U+54C8,U+54CD,U+54EA,U+5546,U+5668,U+56DB,U+56DE,U+56E0,U+56F4,U+56FA,U+56FE,U+5728,U+5730,U+573A,U+5740,U+5747,U+5757,U+578B,U+57DF,U+57FA,U+585E,U+586B,U+5883,U+589E,U+58F0,U+5904,U+5907,U+590D,U+5916,U+591A,U+5927,U+5931,U+5934,U+5939,U+597D,U+5982,U+59CB,U+5B57-5B58,U+5B66,U+5B83,U+5B89,U+5B8C,U+5B98,U+5B9A,U+5B9E,U+5BA1,U+5BB9,U+5BBD,U+5BC6,U+5BDF,U+5BF9,U+5BFC,U+5C06,U+5C0F,U+5C11,U+5C1A,U+5C1D,U+5C31,U+5C3E,U+5C40,U+5C42,U+5C55,U+5C5E,U+5DE5-5DE6,U+5DEE,U+5DF1-5DF2,U+5E03,U+5E0C,U+5E26,U+5E38,U+5E72-5E73,U+5E76,U+5E8F,U+5E93-5E94,U+5EA6,U+5EF6,U+5EFA,U+5F00,U+5F02-5F03,U+5F0F,U+5F15,U+5F20,U+5F3A,U+5F52-5F53,U+5F55,U+5F62,U+5F71,U+5F80,U+5F84-5F85,U+5F97,U+5FAA,U+5FAE,U+5FC3,U+5FC5,U+5FEB,U+5FFD,U+6001,U+601D,U+6027,U+603B,U+6062,U+606F,U+60AC,U+60C5,U+60F3,U+610F,U+611F,U+6210-6211,U+6216,U+622A,U+6237,U+6240,U+624B,U+624D,U+6253,U+6267,U+6269,U+627E,U+628A,U+6295,U+6298,U+62A5,U+62D2,U+62D6,U+62E9,U+62EC,U+6301,U+6307,U+6309,U+6320,U+6355,U+6362,U+636E,U+6392,U+63A2,U+63A5,U+63A8,U+63CF-63D0,U+641C,U+6458,U+64A4,U+64AD,U+64CD,U+652F,U+6536,U+6539,U+653E,U+6545,U+6548,U+654F,U+6563,U+6570,U+6574,U+6587,U+6599,U+65AD,U+65B0,U+65B9,U+65CF,U+65E0,U+65E5,U+65E7,U+65E9,U+65F6,U+660E,U+662F,U+663E,U+666E-666F,U+6682,U+66F4,U+66FC,U+66FF-6700,U+6709,U+670D,U+671B,U+671F,U+672A-672C,U+673A,U+6743,U+6750,U+675F,U+6761,U+6765,U+677F,U+6784,U+6790,U+679C,U+67E5,U+6807,U+680F,U+6821,U+6838-6839,U+683C,U+6846,U+6848,U+6863,U+68C0,U+6982,U+69DB,U+6A21,U+6B21,U+6B62-6B65,U+6BB5,U+6BCD,U+6BCF,U+6BD4,U+6C42,U+6CA1,U+6CBF,U+6CD5,U+6CDB,U+6CE8,U+6D3B,U+6D41,U+6D4B,U+6D4F,U+6D88,U+6DFB,U+6E05,U+6E10,U+6E38,U+6E90,U+6EAF,U+6ED1,U+6EDA,U+6EDE,U+6EE1,U+70B9,U+7136,U+7167,U+7247-7248,U+724C,U+7269,U+72B6,U+72EC,U+731C,U+7387,U+73AF-73B0,U+7406,U+751F,U+7528,U+7531,U+753B,U+754C,U+7559,U+7565,U+7591,U+767B,U+7684,U+76D6,U+76D8,U+76EE,U+76F4,U+76F8,U+770B,U+771F,U+77E5,U+77ED,U+7801,U+7814,U+786E,U+78C1,U+793A,U+79BB,U+79CD,U+79D2,U+79F0,U+79FB,U+7A0B,U+7A0D,U+7A3F,U+7A76,U+7A7A,U+7A81,U+7A97,U+7ACB,U+7AD9,U+7AE0,U+7B26,U+7B2C,U+7B49,U+7B56,U+7B5B,U+7B7E,U+7B80,U+7B97,U+7C7B,U+7C98,U+7CBE,U+7CFB,U+7D22,U+7D2F,U+7E41,U+7EA6-7EA7,U+7EB3,U+7EBF,U+7EC4,U+7EC6-7EC8,U+7ECF,U+7ED1,U+7ED3,U+7ED9,U+7EDC-7EDD,U+7EDF,U+7EE7,U+7EEA,U+7EED,U+7F13,U+7F16,U+7F29,U+7F3A,U+7F51,U+7F6E,U+7F72,U+7FA4,U+8003,U+8005,U+8017,U+8054,U+80FD,U+811A,U+81EA,U+81F3-81F4,U+822A,U+8272,U+8282,U+82F1,U+8303,U+8349,U+83B7,U+85CF,U+884C,U+8865,U+8868,U+88AB,U+88C5,U+8981,U+8986,U+89C1-89C2,U+89C4,U+89C6,U+89C8,U+89D2,U+89E3,U+8BA1,U+8BA4,U+8BA8-8BA9,U+8BAE,U+8BB0,U+8BB2,U+8BB8,U+8BBA,U+8BBE-8BBF,U+8BC1,U+8BC6,U+8BC9-8BCA,U+8BCD,U+8BD1,U+8BD5,U+8BDD,U+8BE2,U+8BE5-8BE6,U+8BED,U+8BEF,U+8BF4,U+8BF7,U+8BFB,U+8C03,U+8C31,U+8C61,U+8D1F,U+8D23,U+8D25-8D26,U+8D28,U+8D34,U+8D39,U+8D44,U+8D56,U+8D77,U+8D85,U+8DB3,U+8DD1,U+8DDF,U+8DE8,U+8DEF,U+8DF3,U+8EAB,U+8F6C,U+8F6E,U+8F7D,U+8F83,U+8F85,U+8F91,U+8F93,U+8FBE,U+8FC1,U+8FC7,U+8FD0-8FD1,U+8FD4,U+8FD8-8FD9,U+8FDB,U+8FDE,U+8FF0,U+8FFD,U+9000-9002,U+9009,U+9010,U+9012,U+9017,U+901A,U+9020,U+903B,U+9047,U+9053,U+90E8,U+90FD,U+914D,U+9192,U+91C7,U+91CA,U+91CC-91CD,U+91CF,U+94A5,U+94FE,U+9500,U+9519,U+952E,U+955C,U+957F,U+95E8,U+95ED-95EE,U+95F2,U+95F4,U+9605,U+9608,U+961F,U+9636,U+963B,U+9644-9645,U+9650,U+9664,U+968F-9690,U+9694,U+969C,U+96C6,U+96F6,U+9700,U+9759,U+975E,U+9762,U+9875,U+9879-987B,U+9884,U+9886,U+9891,U+9898,U+989D,U+9988,U+9996,U+9A8C,U+9AA4,U+9AD8,U+9ECE,U+9ED8,U+FF01-FF5E}
-@font-face{font-family:"TheoremOS Serif SC";src:url("assets/fonts/NotoSerifSC-ui-extra.woff2") format("woff2");font-weight:400 700;font-display:swap;unicode-range:U+4E07,U+4E1A,U+4E88,U+4E8C,U+4E91,U+4ECA,U+4F30,U+4F46,U+4F4E-4F4F,U+4FB5,U+504F,U+514D,U+5178,U+51BB,U+51C0,U+521A,U+5229,U+522B,U+523B,U+529E,U+52FE,U+533F,U+5341,U+5361,U+53C8,U+5458,U+552F,U+56E2,U+591C,U+5929-592A,U+5B50,U+5B8F,U+5BB6,U+5BBF,U+5C01,U+5C14,U+5C3D,U+5E2E,U+5F39,U+5F88,U+5F8B,U+5FD7-5FD9,U+5FE0,U+600E,U+6070,U+6162,U+61C2,U+6258,U+6270,U+6279,U+627F-6280,U+62A4,U+62C5-62C6,U+62DF,U+62FF,U+635F,U+6377,U+6388-6389,U+63A7,U+642C,U+643A,U+64B0,U+653B,U+653F,U+6559,U+6597,U+65BD,U+65C1,U+665A,U+672F,U+6746,U+677E,U+67D0,U+67EF,U+6837,U+684C,U+695A,U+699C,U+6B3E,U+6B67,U+6C47,U+6C99,U+6D01,U+6D1E,U+6D3E,U+6D45,U+6D89,U+6DF1,U+6F0F,U+72AF,U+732E,U+74E6,U+7533,U+7535,U+767D,U+76F2,U+7740,U+7840,U+788D,U+793E,U+79C1,U+7A77,U+7AEF,U+7B54,U+7B79,U+7BA1,U+7BB1,U+7D20,U+7EAF,U+7ED5,U+7EF4,U+7FFB,U+800C,U+8111,U+8212,U+82E5,U+8328,U+8425,U+8651,U+865A,U+897F,U+8A00,U+8B66,U+8BA2,U+8BC4,U+8BFA,U+8C01,U+8D21,U+8D70,U+8E2A,U+8F66,U+8F68,U+8FB9,U+8FDC-8FDD,U+8FF9,U+9014,U+904D,U+907F-9080,U+90A3,U+90AE,U+91D1,U+9488,U+949F,U+94AE,U+9501,U+9632,U+963F,U+9648,U+9876,U+9F50}
-@font-face{font-family:"TheoremOS Serif SC";src:url("assets/fonts/NotoSerifSC-common.woff2") format("woff2");font-weight:400 700;font-display:swap;unicode-range:U+4E01,U+4E03,U+4E08,U+4E11,U+4E16,U+4E18-4E19,U+4E1B-4E1D,U+4E25,U+4E27,U+4E2B,U+4E30,U+4E32,U+4E38-4E39,U+4E3D-4E3E,U+4E43,U+4E4C-4E50,U+4E52-4E54,U+4E56,U+4E58-4E59,U+4E5D-4E5E,U+4E60-4E61,U+4E66,U+4E70-4E71,U+4E73,U+4E7E,U+4E89,U+4E8F,U+4E92,U+4E95,U+4E9A,U+4EA1-4EA2,U+4EA5-4EA6,U+4EA8-4EA9,U+4EAC-4EAE,U+4EB2,U+4EBF,U+4EC1,U+4EC6-4EC7,U+4ED1,U+4ED3-4ED5,U+4ED7,U+4ED9,U+4EDF,U+4EEA,U+4EF0,U+4EF2,U+4EFF,U+4F01,U+4F0A,U+4F0D-4F11,U+4F17,U+4F19,U+4F1E-4F1F,U+4F24,U+4F26,U+4F2A,U+4F2F,U+4F34,U+4F36,U+4F38,U+4F3A,U+4F3C,U+4F43,U+4F50-4F51,U+4F5B,U+4F63,U+4F69,U+4F6C,U+4F6F-4F70,U+4F73,U+4F84,U+4F88,U+4F8D,U+4F97,U+4FA0,U+4FA3,U+4FA5-4FA6,U+4FA8-4FA9,U+4FAE-4FAF,U+4FBF,U+4FC3-4FC4,U+4FCA,U+4FCF-4FD0,U+4FD7-4FD8,U+4FDE,U+4FE9,U+4FED,U+4FEF,U+4FF1,U+4FFA,U+500D,U+5012,U+5014,U+5018,U+501A,U+501F,U+5021,U+5026,U+502A,U+503A,U+503E,U+5065,U+5076-5077,U+507F-5080,U+5085,U+5088,U+508D,U+50A3,U+50AC,U+50B2,U+50BB,U+50DA,U+50E7,U+50F3,U+50F5,U+50FB,U+5112,U+5121,U+513F,U+5143-5144,U+5146,U+5149,U+514B,U+5151,U+5154,U+515A,U+515C,U+5162,U+516B,U+516D,U+5170,U+5174-5175,U+5179,U+517B,U+517D,U+5180,U+5188-5189,U+5192,U+5195,U+5197,U+519B-519C,U+51A0,U+51A4,U+51AC,U+51AF-51B0,U+51B5-51B7,U+51C4,U+51C9,U+51CB-51CC,U+51D1,U+51DB,U+51DD,U+51E4,U+51EF-51F0,U+51F3,U+51F6,U+51F8-51F9,U+51FF-5201,U+5203,U+520A,U+5211,U+5218,U+5228,U+522E,U+5238-523A,U+523D,U+5241-5243,U+524A,U+5250-5251,U+5254,U+5256,U+5265,U+5267,U+5272,U+527F,U+5288,U+529D,U+52A3,U+52AA-52AB,U+52B1-52B3,U+52BF,U+52C3,U+52C7,U+52C9,U+52CB,U+52D2,U+52D8,U+52DF,U+52E4,U+52FA,U+5300,U+5306,U+5308,U+5317,U+5319,U+531D,U+5320-5321,U+5323,U+532A,U+533B,U+5343,U+5347-5349,U+534E,U+5351-5353,U+5356,U+535A,U+535C,U+535E,U+5362,U+5364,U+5367,U+536B,U+536F-5371,U+5374-5375,U+5377-5378,U+537F,U+5382,U+5384-5385,U+5389,U+538C,U+5395,U+5398,U+539A,U+53A2,U+53A6,U+53A8-53A9,U+53BB,U+53BF,U+53C1,U+53C9,U+53CB,U+53D4,U+53D9,U+53DB,U+53E4,U+53EB-53EE,U+53F6,U+53F8-53F9,U+53FC,U+5401,U+5403,U+5409-540A,U+540F-5410,U+5413,U+5415,U+541B,U+541D-5420,U+5427-5429,U+542C-542E,U+5431,U+5434-5435,U+5438-5439,U+543B-543C,U+543E,U+5440,U+5446,U+5448,U+5450,U+5455,U+545B-545C,U+5462,U+5468,U+5473,U+5475,U+5478,U+547B-547C,U+5480,U+5486,U+548B,U+548E-5490,U+5492,U+5495-5496,U+5499,U+54AC,U+54AF,U+54B1,U+54B3,U+54B8,U+54BD,U+54C0,U+54C4,U+54C6-54C7,U+54C9,U+54CE,U+54D1,U+54D7,U+54DF,U+54E5-54E6,U+54E8-54E9,U+54ED-54EE,U+54F2,U+54FA,U+54FC,U+5501,U+5506-5507,U+5509,U+5510,U+5524,U+552C,U+552E,U+5531,U+553E,U+5543-5544,U+554A,U+5561,U+5564-5566,U+556A,U+556E,U+5578,U+557C,U+5580,U+5582,U+5584,U+5587,U+5589-558A,U+5598,U+559C-559D,U+55A7,U+55B3,U+55B7,U+55BB,U+55C5,U+55D3,U+55DC,U+55E1,U+55E3,U+55FD,U+5609,U+560E,U+5618,U+561B,U+5631-5632,U+5634,U+5636,U+563B,U+563F,U+564E,U+566A,U+566C,U+5676,U+568E-568F,U+56A3,U+56B7,U+56BC,U+56CA,U+56DA,U+56E4,U+56ED,U+56F0-56F1,U+56FD,U+5703,U+5706,U+5708,U+571F,U+5723,U+572D,U+573E,U+574A,U+574D-5751,U+575A-575B,U+575D-5761,U+5764,U+5766,U+576A,U+576F,U+5777,U+5782-5784,U+5792,U+579B,U+57A2-57A3,U+57A6,U+57AB,U+57AE,U+57C2-57C3,U+57CB,U+57CE,U+57D4,U+57E0,U+57F9,U+5802,U+5806,U+5811,U+5815,U+5821,U+5824,U+582A,U+5830,U+5835,U+584C,U+5851,U+5854,U+5858,U+5885,U+5892-5893,U+5899,U+589F,U+58A8-58A9,U+58C1,U+58D5,U+58E4,U+58EB-58EC,U+58EE,U+58F3,U+58F6,U+58F9,U+590F,U+5915,U+591F,U+592B,U+592E-592F,U+5937-5938,U+593A,U+5944,U+5947-5949,U+594B,U+594E-594F,U+5951,U+5954,U+5956-5957,U+5960,U+5962,U+5965,U+5973-5974,U+5976,U+5978-5979,U+5984,U+5986-5988,U+598A,U+5992-5993,U+5996,U+5999,U+59A5,U+59A8,U+59AE,U+59B9,U+59BB,U+59C6,U+59D0-59D1,U+59D3-59D4,U+59DA,U+59DC,U+59E5,U+59E8,U+59EC,U+59FB,U+59FF,U+5A01,U+5A03-5A04,U+5A07,U+5A18,U+5A1C,U+5A1F-5A20,U+5A25,U+5A29,U+5A31,U+5A36,U+5A46,U+5A49,U+5A5A,U+5A6A,U+5A74,U+5A76,U+5A7F,U+5A92,U+5A9A,U+5AB3,U+5AC1-5AC2,U+5AC9,U+5ACC,U+5AE1,U+5AE9,U+5B54-5B55,U+5B59,U+5B5C-5B5D,U+5B5F,U+5B63-5B64,U+5B69-5B6A,U+5B70,U+5B75,U+5B7A,U+5B7D,U+5B81,U+5B85,U+5B87-5B88,U+5B8B,U+5B97,U+5B99,U+5B9B-5B9D,U+5BA0,U+5BA2-5BA4,U+5BA6,U+5BAA-5BAB,U+5BB0,U+5BB3-5BB5,U+5BBE,U+5BC2,U+5BC4-5BC5,U+5BC7,U+5BCC,U+5BD0,U+5BD2-5BD3,U+5BDD-5BDE,U+5BE1,U+5BE5,U+5BE8,U+5BF8,U+5BFA-5BFB,U+5BFF,U+5C04,U+5C09-5C0A,U+5C16,U+5C18,U+5C24,U+5C27,U+5C38-5C3A,U+5C3C,U+5C3F,U+5C41,U+5C45,U+5C48-5C4B,U+5C4E-5C4F,U+5C51,U+5C60-5C61,U+5C65,U+5C6F,U+5C71,U+5C79,U+5C7F,U+5C81-5C82,U+5C94,U+5C97,U+5C9B,U+5CA9,U+5CAD,U+5CB3,U+5CB8,U+5CBF,U+5CD9,U+5CE1,U+5CE6,U+5CE8,U+5CEA,U+5CED,U+5CF0,U+5CFB,U+5D07,U+5D0E,U+5D14,U+5D16,U+5D29,U+5D2D,U+5D4C,U+5DCD,U+5DDD-5DDE,U+5DE1-5DE2,U+5DE7-5DE9,U+5DEB,U+5DF3-5DF4,U+5DF7,U+5DFE,U+5E01-5E02,U+5E05-5E06,U+5E08,U+5E10,U+5E15-5E16,U+5E18,U+5E1A-5E1D,U+5E27,U+5E2D,U+5E3D,U+5E42,U+5E45,U+5E4C,U+5E55,U+5E62,U+5E74,U+5E78,U+5E7B-5E7D,U+5E7F,U+5E84,U+5E86-5E87,U+5E8A,U+5E90,U+5E95,U+5E97,U+5E99-5E9A,U+5E9C,U+5E9E-5E9F,U+5EA7,U+5EAD,U+5EB6-5EB8,U+5EC9-5ECA,U+5ED3,U+5ED6,U+5EF7,U+5F04,U+5F0A,U+5F13,U+5F17-5F18,U+5F1B,U+5F1F,U+5F25-5F27,U+5F2F,U+5F31,U+5F5D,U+5F64,U+5F66,U+5F69-5F6A,U+5F6C-5F6D,U+5F70,U+5F79,U+5F7B-5F7C,U+5F81,U+5F8A,U+5F90,U+5F92,U+5F98,U+5FA1,U+5FB7,U+5FBD,U+5FC6,U+5FCC-5FCD,U+5FE7,U+5FF1,U+5FF5,U+5FFB,U+5FFF-6000,U+6002,U+6012,U+6014-6016,U+601C,U+6020,U+6025,U+6028,U+602A,U+602F,U+6043,U+604B,U+604D,U+6050,U+6052,U+6055,U+6064,U+6068-6069,U+606B-606D,U+6073,U+6076,U+607C,U+607F,U+6084,U+6089,U+608D,U+6094,U+609F-60A0,U+60A3,U+60A6,U+60A8,U+60AF,U+60B2,U+60B8,U+60BC,U+60CA-60CB,U+60D1,U+60D5,U+60DC,U+60DF-60E0,U+60E6-60E9,U+60EB,U+60ED-60F0,U+60F6,U+60F9-60FA,U+6101,U+6108-6109,U+611A,U+6124,U+6127,U+613F,U+6148,U+614C,U+614E,U+6151,U+6155,U+6167-6168,U+6170,U+6177,U+618B,U+618E,U+61A8,U+61BE,U+61C8,U+61CA,U+61D2,U+61E6,U+6208,U+620A,U+620C-620F,U+6212,U+6218,U+621A,U+622E,U+6233-6234,U+623F,U+6241,U+6247,U+624E,U+6251-6252,U+6254,U+625B,U+6263,U+6266,U+626B-626F,U+6273,U+6276,U+627C,U+6284,U+6289,U+6291-6293,U+6296-6297,U+629A-629B,U+62A0-62A2,U+62A8,U+62AB-62AC,U+62B1,U+62B5,U+62B9,U+62BC-62BD,U+62BF,U+62C2,U+62C4,U+62C7-62C9,U+62CC-62CE,U+62D0,U+62D3-62D4,U+62D8-62D9,U+62DB-62DC,U+62E2-62E3,U+62E5-62E8,U+62ED,U+62EF,U+62F1,U+62F3-62F4,U+62F7,U+62FC-62FE,U+6302,U+630E,U+6311,U+6316,U+631A-631B,U+631D-631F,U+6321,U+6323-6325,U+6328,U+632A-632B,U+632F,U+633A,U+633D,U+6342,U+6345-6346,U+6349,U+634C-6350,U+635E,U+6361,U+6363,U+6367,U+6376,U+637B,U+6380,U+6382,U+6387,U+638C,U+638F-6390,U+6396,U+6398,U+63A0,U+63A3,U+63A9-63AA,U+63B3,U+63B7-63B8,U+63BA,U+63C9,U+63CD,U+63D2,U+63D6,U+63E1,U+63E3,U+63E9-63EA,U+63ED,U+63F4,U+63FD,U+6400-6402,U+6405,U+640F-6410,U+6413-6414,U+641E,U+642A,U+642D,U+643D,U+6444,U+6446-6448,U+644A,U+6454,U+6467,U+6469,U+6478-6479,U+6482,U+6485,U+6487,U+6491-6492,U+6495,U+649E,U+64A9,U+64AC,U+64AE,U+64B5,U+64BC,U+64C2,U+64C5,U+64CE,U+64D2,U+64DE,U+64E6,U+6500,U+6512,U+6518,U+652B,U+654C,U+6551,U+6556,U+655B,U+655D-655E,U+6562,U+6566,U+656C,U+6572,U+6577,U+658B-658C,U+6591,U+659C,U+659F,U+65A1,U+65A4-65A5,U+65A7,U+65A9,U+65AF,U+65C5,U+65CB,U+65D7,U+65E2,U+65E6,U+65E8,U+65EC-65ED,U+65F1,U+65F7,U+65FA,U+6602,U+6606,U+660C,U+660F,U+6613-6614,U+661F-6620,U+6625,U+6627-6628,U+662D,U+663C,U+6643,U+664B-664C,U+6652-6653,U+6655,U+6664,U+6666,U+6668,U+6670,U+6674,U+6676,U+667A,U+667E,U+6687,U+6691,U+6696-6697,U+66AE,U+66B4,U+66D9,U+66DD,U+66F0,U+66F2-66F3,U+66F9,U+66FE,U+6708,U+670B,U+6714,U+6717,U+671D,U+6728,U+672D,U+6731,U+6734-6735,U+673D,U+6740,U+6742,U+6749,U+674E-674F,U+6751,U+6756,U+675C,U+6760,U+6768,U+676D,U+676F-6770,U+6781,U+6789,U+6795,U+6797,U+679A,U+679D,U+67A2-67A3,U+67AA-67AB,U+67AF,U+67B6-67B7,U+67C4,U+67CF,U+67D1-67D4,U+67DC,U+67DE,U+67E0,U+67EC,U+67F1,U+67F3-67F4,U+67FF,U+6805,U+6808,U+680B,U+6811,U+6813,U+6816-6817,U+682A,U+683D,U+6842-6843,U+6845,U+6850-6851,U+6853-6854,U+6865,U+6868-6869,U+6876,U+6881,U+6885-6886,U+6897,U+68A2,U+68A6-68A8,U+68AD,U+68AF-68B0,U+68B3,U+68C9,U+68CB,U+68CD,U+68D2,U+68D5,U+68D8,U+68DA,U+68E0,U+68EE,U+68F1,U+68F5,U+68FA,U+6905,U+690D-690E,U+6912,U+692D,U+6930,U+693D,U+693F,U+6954,U+695E,U+6977,U+697C,U+6986,U+6994,U+69A8,U+69B4,U+69B7,U+69D0,U+69FD,U+6A0A,U+6A1F,U+6A2A,U+6A31,U+6A47,U+6A59,U+6A61,U+6A71,U+6A80,U+6A84,U+6AAC,U+6B20,U+6B22-6B23,U+6B27,U+6B32,U+6B3A,U+6B47,U+6B49,U+6B4C,U+6B66,U+6B6A,U+6B79,U+6B7B-6B7C,U+6B83,U+6B86,U+6B89-6B8B,U+6B96,U+6BB4,U+6BB7,U+6BBF,U+6BC1,U+6BC5,U+6BCB,U+6BD2,U+6BD5-6BD7,U+6BD9,U+6BDB,U+6BE1,U+6BEB,U+6BEF,U+6C0F,U+6C11,U+6C13-6C14,U+6C16,U+6C1B,U+6C1F,U+6C22,U+6C26-6C28,U+6C2E-6C30,U+6C34,U+6C38,U+6C40-6C41,U+6C49,U+6C50,U+6C55,U+6C57,U+6C5B,U+6C5D-6C61,U+6C64,U+6C6A,U+6C70,U+6C72,U+6C79,U+6C7D-6C7E,U+6C81-6C83,U+6C88-6C89,U+6C8F,U+6C9B,U+6C9F,U+6CA4-6CA7,U+6CAA-6CAB,U+6CAE,U+6CB3,U+6CB8-6CB9,U+6CBB-6CBE,U+6CC4-6CC5,U+6CC9-6CCA,U+6CCC,U+6CDE,U+6CE1-6CE3,U+6CE5,U+6CEA,U+6CF0,U+6CF3,U+6CF5,U+6CFB-6CFD,U+6D0B,U+6D12,U+6D17,U+6D1B,U+6D25,U+6D2A,U+6D31-6D32,U+6D3C-6D3D,U+6D46-6D47,U+6D4A,U+6D4E,U+6D51,U+6D53,U+6D59-6D5A,U+6D66,U+6D69-6D6A,U+6D6E,U+6D74,U+6D77-6D78,U+6D82,U+6D85,U+6D8C,U+6D8E,U+6D95,U+6D9B,U+6D9D,U+6D9F,U+6DA1,U+6DA3-6DA4,U+6DA6-6DAA,U+6DAF,U+6DB2,U+6DB5,U+6DB8,U+6DC0,U+6DC4,U+6DC6,U+6DCB-6DCC,U+6DD1,U+6DD6,U+6DD8,U+6DE1,U+6DE4,U+6DEB-6DEC,U+6DEE,U+6DF3,U+6DF7,U+6DF9,U+6E0A,U+6E0D,U+6E14,U+6E17,U+6E1D,U+6E20-6E21,U+6E23-6E24,U+6E29,U+6E2D,U+6E2F,U+6E34,U+6E3A,U+6E43,U+6E4D,U+6E56,U+6E58,U+6E5B,U+6E7E-6E7F,U+6E83,U+6E85,U+6E89,U+6E9C,U+6EA2,U+6EAA,U+6EB6,U+6EBA,U+6EC1,U+6EC7,U+6ECB,U+6ED3-6ED4,U+6EE4-6EE6,U+6EE8-6EE9,U+6EF4,U+6F02,U+6F06,U+6F13-6F14,U+6F20,U+6F2B,U+6F31,U+6F33,U+6F3E,U+6F4D,U+6F58,U+6F5C,U+6F5E,U+6F66,U+6F6D-6F6E,U+6F84,U+6F88,U+6F8E,U+6F9C,U+6FA1,U+6FB3,U+6FC0,U+6FD2,U+7011,U+704C,U+706B,U+706D,U+706F-7070,U+7075-7076,U+7078,U+707C,U+707E-707F,U+7089-708A,U+708E,U+7092,U+7094-7095,U+7099,U+70AC-70AF,U+70B3,U+70B8,U+70BC-70BD,U+70C1-70C3,U+70C8,U+70D8-70D9,U+70DB,U+70DF,U+70E4,U+70E6-70E7,U+70E9,U+70EB-70ED,U+70EF,U+70F7,U+70F9,U+70FD,U+7109-710A,U+7115,U+7119-711A,U+7126,U+7130,U+714C,U+714E,U+715E,U+7164,U+716E,U+717D,U+7184,U+718A,U+718F,U+7194,U+7199,U+719F,U+71AC,U+71C3,U+71CE,U+71D5,U+71E5,U+7206,U+722A,U+722C,U+7231,U+7235-7239,U+723D,U+7259,U+725B,U+725F,U+7261-7262,U+7267,U+7272,U+7275,U+7279-727A,U+7280-7281,U+728A,U+72AC,U+72B9,U+72C2,U+72C4,U+72C8,U+72D0,U+72D7,U+72D9,U+72DE,U+72E0-72E1,U+72ED-72EE,U+72F0-72F1,U+72F8,U+72FC,U+730E,U+7316,U+731B,U+7329-732B,U+7334,U+733E-733F,U+736D,U+7384,U+7389,U+738B,U+7396,U+739B,U+73A9,U+73AB,U+73B2,U+73BB,U+73CA,U+73CD,U+73D0,U+73E0,U+73ED,U+7403,U+7405,U+7409,U+7410,U+7422,U+7433-7436,U+743C,U+745A,U+745E-745F,U+7470,U+7476,U+7483,U+74DC,U+74E2-74E4,U+74EE,U+74F6-74F7,U+7504,U+7518,U+751A,U+751C,U+7525,U+7529,U+752B,U+752D,U+7530,U+7532,U+7537-7538,U+7545,U+754F,U+7554,U+755C,U+7566,U+756A,U+7574,U+7578,U+7586,U+758F,U+7597,U+7599-759A,U+759F,U+75A1,U+75A4-75A5,U+75AB,U+75AE-75AF,U+75B2,U+75B5,U+75B9,U+75BC-75BE,U+75C5,U+75C7-75CA,U+75D2,U+75D4-75D5,U+75D8,U+75DB,U+75DE,U+75E2,U+75EA,U+75F0,U+75F4,U+75F9,U+7601,U+761F,U+7624,U+7626,U+7629-762B,U+7634,U+7638,U+764C,U+7663,U+7678,U+767E,U+7682,U+7686-7687,U+768B,U+7691,U+7696,U+76AE,U+76B1,U+76BF,U+76C2,U+76C5-76C6,U+76C8,U+76CA,U+76CE-76D2,U+76D4,U+76D7,U+76DB,U+76DF,U+76EF,U+76FC,U+76FE,U+7701,U+7709,U+7720,U+7728-7729,U+772F,U+7736-7737,U+773A,U+773C,U+7741,U+775B,U+7761,U+7763,U+7766,U+776B-776C,U+7779,U+7784-7785,U+778E,U+7792,U+77A5,U+77A7,U+77A9-77AA,U+77AC,U+77B3,U+77BB,U+77D7,U+77DB,U+77E2-77E3,U+77E9,U+77EB,U+77EE,U+77F3,U+77FD-77FF,U+7802,U+780C-780D,U+7812,U+7816,U+781A,U+7827,U+7830,U+7834,U+7837-7838,U+783E,U+7845,U+7852,U+7855,U+785D,U+786B-786C,U+7877,U+787C,U+7889,U+788C,U+788E,U+7891,U+7897-7898,U+789F,U+78A7,U+78B0-78B1,U+78B3-78B4,U+78BE,U+78C5,U+78CA-78CB,U+78D0,U+78D5,U+78E8,U+78F7,U+78FA,U+7901,U+793C,U+7941,U+7948,U+7956,U+795D-795F,U+7965,U+7968,U+796D,U+7977-7978,U+7981,U+7984,U+798F,U+79B9,U+79BD-79BE,U+79C0,U+79C3,U+79C6,U+79C9,U+79CB,U+79D1,U+79D8,U+79DF,U+79E4,U+79E6-79E7,U+79E9,U+79EF,U+79F8,U+79FD,U+7A00,U+7A0E,U+7A17,U+7A1A,U+7A20,U+7A33,U+7A3B-7A3D,U+7A46,U+7A57,U+7A74,U+7A7F,U+7A83-7A84,U+7A8D,U+7A91-7A92,U+7A96,U+7A98,U+7A9C-7A9D,U+7A9F,U+7AA5,U+7ABF,U+7AD6,U+7ADE-7ADF,U+7AE3,U+7AE5,U+7AED,U+7AF9,U+7AFF,U+7B06,U+7B0B,U+7B11,U+7B14,U+7B1B,U+7B28,U+7B3A,U+7B3C,U+7B4B,U+7B4F-7B52,U+7B77,U+7B8D,U+7B94-7B95,U+7BA9,U+7BAD,U+7BC6-7BC7,U+7BD3,U+7BD9,U+7BE1,U+7BEE,U+7BF1,U+7BF7,U+7C07,U+7C27,U+7C3F,U+7C4D,U+7C73,U+7C7D,U+7C89,U+7C92,U+7C95,U+7C97,U+7C9F,U+7CA4-7CA5,U+7CAA,U+7CAE,U+7CB1,U+7CB3,U+7CB9,U+7CCA,U+7CD5-7CD6,U+7CD9,U+7CDC,U+7CDF-7CE0,U+7CEF,U+7D0A,U+7D27,U+7D2B,U+7D6E,U+7E82,U+7EA0,U+7EA2,U+7EA4,U+7EAA-7EAC,U+7EB1-7EB2,U+7EB5-7EBA,U+7EBD,U+7EC3,U+7EC5,U+7ECA,U+7ECD-7ECE,U+7ED2,U+7ED8,U+7EDA,U+7EDE,U+7EE2-7EE3,U+7EE5-7EE6,U+7EE9,U+7EF0,U+7EF3,U+7EF5,U+7EF7-7EF8,U+7EFC-7EFD,U+7EFF-7F00,U+7F04-7F06,U+7F09,U+7F0E,U+7F14-7F15,U+7F18,U+7F1A,U+7F1D,U+7F20,U+7F28,U+7F2E,U+7F34,U+7F38,U+7F50,U+7F55,U+7F57,U+7F5A,U+7F62,U+7F69-7F6A,U+7F8A,U+7F8C,U+7F8E,U+7F94,U+7F9A,U+7F9E,U+7FA1,U+7FB9,U+7FBD,U+7FC1,U+7FC5,U+7FCC,U+7FD4,U+7FD8,U+7FDF-7FE0,U+7FF0-7FF1,U+7FFC,U+8000-8001,U+800D,U+8010,U+8015,U+8018-8019,U+802A,U+8033,U+8036,U+8038,U+803B,U+803D,U+803F,U+8042,U+804A-804C,U+8058,U+805A,U+806A,U+8083-8084,U+8086-8087,U+8089,U+808B-808C,U+8096,U+8098,U+809A-809B,U+809D,U+80A0-80A2,U+80A4-80A5,U+80A9-80AA,U+80AE-80AF,U+80B2,U+80BA,U+80BE-80C1,U+80C3,U+80C6,U+80CC,U+80CE,U+80D6,U+80DA,U+80DC,U+80DE,U+80E1,U+80EF-80F0,U+80F3,U+80F6,U+80F8,U+80FA,U+8102,U+8106,U+8109-810A,U+810F-8110,U+8113,U+8116,U+812F,U+8131,U+8138,U+813E,U+8146,U+814A-814B,U+8150-8151,U+8154-8155,U+8165,U+816E,U+8170,U+8179-817B,U+817E-8180,U+818A,U+818F,U+8198,U+819B-819D,U+81A8,U+81B3,U+81C0,U+81C2-81C3,U+81C6,U+81E3,U+81ED,U+81FB-81FC,U+8200,U+8205-8206,U+820C-820D,U+8214,U+821C,U+821E-821F,U+822C,U+8230-8231,U+8235-8237,U+8239,U+8247,U+8258,U+826F-8270,U+8273,U+827A,U+827E,U+828B,U+828D,U+8292,U+829C-829D,U+82A5-82A6,U+82AC-82AD,U+82AF,U+82B1,U+82B3,U+82B9,U+82BD,U+82C7,U+82CD,U+82CF,U+82D1,U+82D4,U+82D7,U+82DB,U+82DE-82DF,U+82E6,U+82EB,U+82EF,U+82F9,U+8301-8302,U+8304-8305,U+830E,U+8327,U+832B-832C,U+8335-8336,U+8338-8339,U+8346,U+8350,U+8352,U+8354,U+835A,U+8361,U+8363-8364,U+8367,U+836B,U+836F,U+8377,U+8386,U+8389,U+838E,U+83AB,U+83B1-83B2,U+83B9,U+83BD,U+83C7,U+83CA,U+83CC,U+83CF,U+83DC,U+83E0,U+83E9,U+83F1-83F2,U+8404,U+840C-840E,U+841D,U+8424,U+8427-8428,U+843D,U+8457,U+845B,U+8461,U+8463,U+846B-846C,U+8471,U+8475,U+8482,U+848B,U+8499,U+849C,U+84B2,U+84B8,U+84C4,U+84C9,U+84D1,U+84D6,U+84DD,U+84DF,U+84EC,U+8511,U+8513,U+8517,U+851A,U+8521,U+852B-852C,U+8537,U+853C-853D,U+8549-854A,U+8574,U+857E,U+8584,U+859B,U+85AA,U+85AF,U+85C9,U+85D0,U+85D5,U+85E4,U+85E9,U+85FB,U+8611,U+8638,U+864E-8650,U+865E,U+866B,U+8671,U+8679,U+867D-867E,U+8680-8682,U+868A,U+868C,U+8695,U+869C,U+86A4,U+86C0,U+86C6-86C7,U+86CA-86CB,U+86D4,U+86D9,U+86DB,U+86E4,U+86EE,U+86F0,U+86F9,U+86FE,U+8700,U+8702,U+8712,U+8715,U+8717-8718,U+871C,U+8721,U+8747,U+8749,U+874E,U+8757,U+8774,U+8776,U+878D,U+879F,U+87BA,U+87F9,U+8815,U+8822,U+8840,U+8845,U+884D,U+8854,U+8857,U+8859,U+8861,U+8863,U+886B-886C,U+8870,U+8877,U+8881,U+8884,U+888B,U+888D,U+8892,U+8896,U+889C,U+88AD,U+88B1,U+88C1-88C2,U+88D4-88D5,U+88D9,U+88E4,U+88F3-88F4,U+88F8-88F9,U+8902,U+8910,U+8912,U+8925,U+892A,U+8944,U+895F,U+89C5,U+89C9,U+89E6,U+8A79,U+8A89-8A8A,U+8A93,U+8B6C,U+8BA3,U+8BA5,U+8BAB,U+8BAD,U+8BAF,U+8BB3,U+8BB6,U+8BB9,U+8BBC-8BBD,U+8BC0,U+8BC5,U+8BC8,U+8BCC,U+8BD7,U+8BDA-8BDB,U+8BDE,U+8BE1,U+8BE3,U+8BE7,U+8BEB-8BEC,U+8BF1-8BF2,U+8BF5,U+8BF8,U+8BFD-8BFE,U+8C05-8C06,U+8C08,U+8C0A-8C0B,U+8C0D-8C0E,U+8C10,U+8C13,U+8C17,U+8C1A,U+8C1C,U+8C22-8C24,U+8C26,U+8C28-8C29,U+8C2C-8C2D,U+8C30,U+8C34,U+8C37,U+8C41,U+8C46,U+8C4C,U+8C62,U+8C6A-8C6B,U+8C79-8C7A,U+8C89,U+8C8C,U+8D1D-8D1E,U+8D22,U+8D24,U+8D27,U+8D29-8D31,U+8D35,U+8D37-8D38,U+8D3A,U+8D3C,U+8D3E-8D3F,U+8D41-8D43,U+8D4A-8D4C,U+8D4E-8D50,U+8D54,U+8D58,U+8D5A-8D5B,U+8D5E,U+8D60-8D64,U+8D66,U+8D6B,U+8D74-8D76,U+8D81,U+8D8A-8D8B,U+8D9F,U+8DA3,U+8DB4,U+8DBE,U+8DC3,U+8DCB-8DCC,U+8DDD,U+8DEA,U+8DF5,U+8DFA,U+8E0A,U+8E0C,U+8E0F,U+8E1E,U+8E22,U+8E29,U+8E44,U+8E48,U+8E4B,U+8E66,U+8E6C-8E6D,U+8E72,U+8E7F,U+8E81,U+8E87,U+8EAC,U+8EAF,U+8EB2,U+8EBA,U+8F67,U+8F69,U+8F6F-8F70,U+8F74,U+8F7B,U+8F7F,U+8F86,U+8F88-8F8A,U+8F90,U+8F95-8F97,U+8F99,U+8F9B-8F9C,U+8F9E-8F9F,U+8FA3,U+8FA8-8FA9,U+8FAB,U+8FB0-8FB1,U+8FBD,U+8FC2,U+8FC4-8FC5,U+8FC8,U+8FCE,U+8FDF,U+8FE2,U+8FEA-8FEB,U+8FED,U+8FF7-8FF8,U+9003,U+9006,U+900A,U+900F,U+901B,U+901D-901F,U+9022,U+902E,U+9038,U+903C,U+903E,U+9041-9042,U+904F,U+9057,U+9063,U+9065,U+906D-906E,U+9075,U+9091,U+9093,U+90A2,U+90A6,U+90AA,U+90AF,U+90B1,U+90B5,U+90B9,U+90BB,U+90C1,U+90CA,U+90CE,U+90D1,U+90DD,U+90E1,U+90E7,U+90ED,U+90F4,U+90F8,U+9102,U+9119,U+9149,U+914B-914C,U+9152,U+9157,U+915A,U+915D-915E,U+9163,U+9165,U+916A,U+916C,U+916E,U+9171,U+9175-9178,U+917F,U+9187,U+9189,U+918B,U+919A-919B,U+91C9,U+91CE,U+91DC,U+9274,U+9489,U+948E,U+9492-9493,U+9499,U+949D-949E,U+94A0-94A2,U+94A6-94A9,U+94B1,U+94B3,U+94B5,U+94BB,U+94BE,U+94C0-94C3,U+94C5-94C6,U+94DC-94DD,U+94E1,U+94E3,U+94EC-94ED,U+94F0-94F2,U+94F6,U+94F8,U+94FA,U+9504-9505,U+9508,U+950B-950C,U+9510-9511,U+9517,U+951A,U+9521,U+9523-9526,U+9528,U+952D,U+952F-9530,U+9539,U+953B,U+9540-9541,U+9547,U+954A,U+954D,U+9550-9551,U+9563,U+956D,U+9570,U+9576,U+95EA,U+95EF-95F0,U+95F7-95FB,U+95FD,U+9600-9602,U+9609,U+960E,U+9610-9611,U+9614,U+961C,U+962E,U+9633-9635,U+9640,U+9646-9647,U+964B-964D,U+9655,U+965B,U+9661-9662,U+9668-966A,U+9675-9677,U+9685-9686,U+968B,U+9698-9699,U+96A7,U+96B6,U+96BE,U+96C0-96C1,U+96C4-96C5,U+96C7,U+96CC-96CD,U+96CF,U+96D5,U+96E8,U+96EA,U+96F7,U+96F9,U+96FE,U+9704,U+9707,U+9709,U+970D,U+9713,U+9716,U+971C,U+971E,U+9732,U+9738-9739,U+9752,U+9756,U+975B,U+9760-9761,U+9769,U+9773-9774,U+9776,U+978B,U+978D,U+9798,U+97A0,U+97AD,U+97E6-97E7,U+97E9,U+97ED,U+97F3,U+97F5-97F6,U+9877,U+987D-987F,U+9881-9882,U+9885,U+9887-9888,U+988A,U+9890,U+9893,U+9896-9897,U+989C,U+98A0,U+98A4,U+98A7,U+98CE,U+98D8,U+98DE-98DF,U+9910,U+9965,U+996D-9972,U+9975-9976,U+997A,U+997C,U+997F,U+9981,U+9985-9986,U+998B,U+998F,U+9992,U+9999,U+9A6C-9A71,U+9A73-9A74,U+9A76,U+9A79,U+9A7B-9A7C,U+9A7E,U+9A82,U+9A84,U+9A86-9A87,U+9A8B,U+9A8F,U+9A91,U+9A97,U+9A9A,U+9AA1,U+9AA8,U+9AB8,U+9AD3,U+9B03,U+9B3C,U+9B41-9B42,U+9B44,U+9B4F,U+9B54,U+9C7C,U+9C81,U+9C8D,U+9C9C,U+9CA4,U+9CB8,U+9CC3,U+9CD6,U+9CDE,U+9E1F,U+9E21,U+9E23,U+9E25-9E26,U+9E2D,U+9E2F,U+9E33,U+9E35,U+9E3D,U+9E3F,U+9E43,U+9E45,U+9E4A,U+9E4F,U+9E64,U+9E70,U+9E7F,U+9E93,U+9EA6,U+9EBB,U+9EC4,U+9ECD,U+9ED1,U+9ED4,U+9F0E,U+9F13,U+9F20,U+9F3B,U+9F7F,U+9F84,U+9F8B,U+9F99-9F9A,U+9F9F}
-:root{font-family:var(--sans);color:var(--gray-800);background:var(--paper);font-synthesis:none;color-scheme:light;--chat-width:40%;--sans:Geist,"TheoremOS Sans SC",-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei","Noto Sans CJK SC","WenQuanYi Micro Hei",sans-serif;--serif:"TheoremOS Serif Latin","TheoremOS Serif SC","Songti SC","Noto Serif CJK SC","Source Han Serif SC",Georgia,serif;--mono:"JetBrains Mono","SFMono-Regular",Consolas,"Liberation Mono",monospace;--paper:#f5f4ee;--card:#fdfcf9;--gray-0:#fdfcf9;--gray-25:#faf9f5;--gray-50:#f3f1ea;--gray-100:#ebe9e0;--gray-150:#e3e0d5;--gray-200:#d6d2c5;--gray-300:#bfbaab;--gray-400:#8f8a7e;--gray-500:#6c685d;--gray-600:#56534a;--gray-700:#3f3d37;--gray-800:#292824;--gray-900:#141413;--blue-50:#f9efe6;--blue-100:#f3e0d0;--blue-200:#ecc3b1;--blue-300:#e09f85;--blue-500:#d97757;--blue-600:#ad5033;--blue-700:#93452d;--green-50:#f1f3ea;--green-100:#e3e8d6;--green-200:#ccd5b5;--green-300:#a9b78a;--green-500:#788c5d;--green-600:#5d7046;--green-700:#475636;--red-50:#fbeeef;--red-100:#f5dcdf;--red-200:#e9bcc2;--red-300:#d6919b;--red-500:#b9505f;--red-600:#9e3b4b;--red-700:#7d2e3b;--amber-50:#fbf4e4;--amber-100:#f5e7c6;--amber-200:#e8d09a;--amber-300:#d3b066;--amber-500:#b28530;--amber-600:#82591f;--amber-700:#6b4e1f;--sky-500:#6a9bcc;--sky-50:#eef3f9;--text-xs:12px;--text-sm:13px;--text-base:14px;--text-md:16px;--text-lg:18px;--text-xl:20px;--text-2xl:24px;--text-3xl:30px;--radius-sm:6px;--radius-md:10px;--radius-lg:14px;--radius-xl:18px;--line:var(--gray-150);--muted:var(--gray-500);--blue:var(--blue-600);--green:var(--green-600);--ink:var(--gray-900);--surface:var(--gray-50);--accent-soft:var(--blue-50);--shade:#292824;--shadow-sm:0 1px 2px rgb(20 20 19/.05),0 2px 6px -2px rgb(20 20 19/.05);--shadow-md:0 1px 2px rgb(20 20 19/.05),0 10px 26px -10px rgb(20 20 19/.12);--ease-out:cubic-bezier(.22,1,.36,1);--ease-expo:cubic-bezier(.16,1,.3,1);--ease-spring:cubic-bezier(.34,1.4,.64,1);--ease-in:cubic-bezier(.4,0,1,1);--on-ink:#fff;--on-ink-faint:color-mix(in srgb,var(--on-ink) 33%,transparent);--code-comment:var(--gray-500);--code-keyword:#8a4a78;--code-tactic:var(--green-600);--code-placeholder:#b85a3c;--code-string:#9b623d;--code-number:#3f6d99;--find-match:#f9e8ab;--find-match-ink:#51431f;--find-current:#f2c96a;--find-current-ink:#33270f;--find-line:#e9ecdc;--shadow-panel:0 1px 2px rgb(20 20 19/.04),0 14px 36px -18px rgb(20 20 19/.18);--shadow-card:0 2px 6px rgb(20 20 19/.05),0 24px 52px -26px rgb(20 20 19/.22);--select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%236c685d' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")}
-/* Dark tokens on screens only: a page prints in the light ones, which read on paper with or without background graphics. */
-@media screen{
-:root[data-theme=dark]{color-scheme:dark;
---paper:#1b1a18;--card:#22211e;--gray-0:#22211e;--gray-25:#262522;--gray-50:#2a2926;--gray-100:#302f2b;--gray-150:#383732;--gray-200:#45433d;
---gray-300:#5a5850;--gray-400:#8f8b80;--gray-500:#a19d91;--gray-600:#bab6aa;--gray-700:#d0ccc1;--gray-800:#e3e0d6;--gray-900:#f2f0e9;
---blue-50:#33251f;--blue-100:#432e24;--blue-200:#5e3c2e;--blue-300:#8f5a43;--blue-500:#e08a6b;--blue-600:#eb9c7e;--blue-700:#f2b39a;
---green-50:#252a20;--green-100:#2f3628;--green-200:#435036;--green-300:#66784f;--green-500:#97ad78;--green-600:#a9bd8b;--green-700:#c0d0a6;
---red-50:#33201f;--red-100:#432a2a;--red-200:#5f3a3c;--red-300:#8e535a;--red-500:#e07a87;--red-600:#ea8f9a;--red-700:#f2aab2;
---amber-50:#302816;--amber-100:#40341b;--amber-200:#5c4a24;--amber-300:#8a6d33;--amber-500:#d4a54e;--amber-600:#e2b866;--amber-700:#ebc985;
---sky-500:#8bb4dd;--sky-50:#1f2730;
---on-ink:#1b1a18;--shade:#000;
---shadow-sm:0 1px 2px rgb(0 0 0/.3),0 1px 1px rgb(0 0 0/.2);--shadow-md:0 2px 6px -1px rgb(0 0 0/.35),0 8px 24px -8px rgb(0 0 0/.45);
---shadow-panel:0 1px 2px rgb(0 0 0/.25),0 12px 32px -18px rgb(0 0 0/.55);--shadow-card:0 2px 4px rgb(0 0 0/.25),0 24px 48px -28px rgb(0 0 0/.6);
---code-comment:var(--gray-500);--code-keyword:#d79ac6;--code-placeholder:#e8987c;--code-string:#ddae84;--code-number:#8fb6dd;
---find-match:#5a4a1f;--find-match-ink:#f7e4a8;--find-current:#8a6a24;--find-current-ink:#fff4d6;--find-line:#2b3024;--select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%23a19d91' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")}
-}
-*{box-sizing:border-box;letter-spacing:0}
-html{height:100%;overflow:hidden}
-body{margin:0;font-size:var(--text-base);line-height:1.6;height:100dvh;display:flex;flex-direction:column;overflow:hidden;background:var(--paper);font-optical-sizing:auto;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
-button,input,select,textarea{font:inherit;color:inherit}
-button,a,input,select,textarea,summary{-webkit-tap-highlight-color:transparent}
-button,a{touch-action:manipulation}
-button{cursor:pointer}
-button:disabled{cursor:not-allowed;opacity:.5}
-a{color:inherit;text-decoration:none}
-button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--blue);outline-offset:3px}
-/* Scroll areas that fill a clipped panel edge to edge draw their focus ring inside. */
-:is(.chat-scroll,.collab-graph-scroll,.collab-task-list):focus-visible{outline-offset:-2px}
-/* Focus that scrolls a control into a panel leaves room for its ring; not in sticky bars, which a margin would make scroll the panel. */
-:where(.detail-panel,.settings-content,.run-list,.chat-scroll) :is(button,a,summary,input,select,textarea,[tabindex="0"]):not(:where(.collab-navigation,.side-viewer,.module-plan-deletion,.collab-inspector>.collab-section-heading,.trajectory-latest) *){scroll-margin-block:8px}
-::placeholder{color:var(--gray-500);opacity:1}
-[hidden]{display:none!important}
-svg.lucide{width:16px;height:16px;flex-shrink:0;stroke-width:1.65}
-/* Type: Geist for Latin, Noto Sans SC (as "TheoremOS Sans SC") for CJK, weights 400/500/600 only, nothing below 12px.
- Serif only for the brand and document titles: the welcome greeting, a run or draft title and the result verdict. */
-h1,h2,h3,p{margin:0}
-h1,h2,h3{font-weight:600}
-h1,h2,h3,h4{text-wrap:balance}
-.mono,pre,code{font-family:var(--mono);font-variant-ligatures:none;font-feature-settings:"zero" 0}
-.skip-link{position:fixed;left:12px;top:8px;z-index:100;background:var(--gray-800);color:var(--on-ink);padding:8px 12px;transform:translateY(-150%)}
-.skip-link:focus{transform:translateY(0)}
-.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
-.topbar{height:56px;flex-shrink:0;display:flex;align-items:center;gap:14px;padding:0 20px;background:color-mix(in srgb,var(--paper) 90%,transparent);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);box-shadow:inset 0 -1px 0 var(--gray-150)}
-.brand{display:inline-flex;align-items:center;gap:9px;font-family:var(--serif);font-size:23px;font-weight:500;line-height:1;letter-spacing:-.025em;white-space:nowrap}
-.brand img{width:26px;height:26px}
-.brand-os{color:var(--blue-500);font-weight:500}
-:root[data-theme=dark] .brand-os{color:var(--blue-600)}
-:root[data-theme=dark] :is(.brand img,.chat-welcome>img,.chat-start-emblem>img,.research-conversation-byline>img){filter:invert(.94) hue-rotate(180deg) saturate(1.18) brightness(1.06)}
-.topbar-actions{display:flex;align-items:center;gap:7px;min-width:0;flex-shrink:0;margin-left:auto}
-.workbench-entrypoints{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-width:0;margin-right:auto}
-body>.workbench-entrypoints{display:none}
-.workbench-entrypoints>a,.workbench-entrypoints>button{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:5px 10px;color:var(--muted);font-size:var(--text-sm);background:transparent;border:0;line-height:1.6;text-align:left;white-space:nowrap}
-.workbench-entrypoints svg{width:16px;height:16px;flex-shrink:0}
-.workbench-entrypoints>a:hover,.workbench-entrypoints>button:hover{background:var(--gray-100)}
-.workbench-entrypoints :is(#open-natural-language,#entry-lean){border-radius:4px;color:var(--muted)}
-.workbench-entrypoints [aria-pressed=true]{background:var(--gray-100);color:var(--gray-900)}
-.workbench-entrypoints #open-research-examples{font-size:var(--text-xs)}
-body[data-entry=natural] #open-research-examples{display:none}
-@media(max-width:600px){.workbench-entrypoints{gap:2px}.workbench-entrypoints>button{padding-inline:8px}}
-body[data-view=draft][data-entry=natural] .workspace{display:flex}
-body[data-view=draft][data-entry=natural] :is(.composer,.pane-resizer,.runs-workspace,.mobile-switch){display:none}
-#natural-research{flex:1;min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;max-width:none;margin:0}
-.classics-link{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:32px;min-height:32px;padding:0 7px;color:var(--gray-700);font-size:var(--text-xs);white-space:nowrap;flex-shrink:0}
-.classics-link>svg{width:16px;height:16px}
-@media(max-width:760px){.classics-link{padding:0}.classics-link>span{display:none}}
-.model-menu{display:inline-flex;align-items:center;gap:8px;max-width:250px;min-height:34px;padding:5px 10px;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--card);color:var(--gray-600);font-size:var(--text-xs)}
-.model-menu:hover{background:var(--surface);border-color:var(--gray-300)}
-.model-menu>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.model-menu>svg{width:14px;height:14px;flex-shrink:0}
-.model-menu>svg:last-child{width:12px;height:12px;color:var(--gray-400)}
-.connection-status{display:flex;align-items:center;gap:7px;min-height:30px;padding:3px 10px;font-size:var(--text-xs);color:var(--muted);white-space:nowrap}
-.status-dot{width:6px;height:6px;display:inline-block;border-radius:50%;background:var(--gray-400);flex-shrink:0}
-.connection-status.ready .status-dot{background:var(--green-500)}
-.connection-status.ready{color:var(--green-600)}
-.connection-status.offline{color:var(--amber-600)}
-.connection-status.offline .status-dot{background:var(--amber-500)}
-.icon-button{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;flex-shrink:0;padding:0;border:1px solid transparent;border-radius:var(--radius-md);background:transparent;color:var(--gray-500)}
-.icon-button:hover:not(:disabled){background:var(--gray-100);color:var(--gray-800)}
-.icon-button.danger:hover{background:var(--red-50);color:var(--red-600)}
-.button{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid var(--gray-200);border-radius:9999px;background:var(--card);color:var(--gray-700);min-height:38px;padding:8px 15px;white-space:nowrap;font-size:var(--text-sm);font-weight:500;box-shadow:0 1px 2px rgb(20 20 19/.04)}
-.button:hover:not(:disabled){background:var(--gray-25);border-color:var(--gray-300);box-shadow:var(--shadow-sm);transform:translateY(-1px)}
-.button-primary{background:var(--gray-900);border-color:var(--gray-900);color:var(--gray-25)}
-.button-primary:hover:not(:disabled){background:var(--gray-800);border-color:var(--gray-800)}
-.button-primary:disabled{opacity:1;background:var(--gray-150);border-color:var(--gray-200);color:var(--gray-500)}
-:root[data-theme=dark] .button-primary{background:#d97757;border-color:#d97757;color:#141413}
-:root[data-theme=dark] .button-primary:hover:not(:disabled){background:var(--blue-500);border-color:var(--blue-500)}
-:root[data-theme=dark] .button-primary:disabled{background:var(--gray-150);border-color:var(--gray-200);color:var(--gray-500)}
-.button-danger{color:var(--red-600);border-color:var(--red-200)}
-.button-danger:hover:not(:disabled){background:var(--red-50);border-color:var(--red-300)}
-.button-destructive{background:var(--red-600);border-color:var(--red-600);color:var(--on-ink)}
-.button-destructive:hover:not(:disabled){background:var(--red-600);border-color:var(--red-600)}
-.button-destructive .spinner{border-color:var(--on-ink-faint);border-top-color:var(--on-ink)}
-:root[data-theme=dark] .button-destructive{background:#a8434f;border-color:#a8434f;color:#fbf3f1}
-:root[data-theme=dark] .button-destructive:hover:not(:disabled){background:#b54b58;border-color:#b54b58}
-:root[data-theme=dark] .button-destructive .spinner{border-color:rgb(251 243 241/.35);border-top-color:#fbf3f1}
-.text-button{display:inline-flex;align-items:center;justify-content:center;gap:5px;padding:3px 0;border:0;background:transparent;color:var(--blue);font-size:var(--text-xs)}
-.text-button:hover{color:var(--blue-700)}
-.button,.icon-button,.text-button,.model-menu,.template-suggestion{transition:background-color .18s,border-color .18s,color .18s,box-shadow .18s,transform .12s var(--ease-out)}
-.button:active:not(:disabled),.icon-button:active:not(:disabled),.model-menu:active{transform:scale(.97)}
-main{display:flex;flex-direction:column;flex:1;min-height:0;outline:none}
-.global-notice{display:flex;align-items:center;gap:10px;flex-shrink:0;padding:10px 20px;border-bottom:1px solid var(--amber-200);background:var(--amber-50);color:var(--amber-700);font-size:var(--text-xs)}
-.global-notice>span{flex:1;min-width:0;overflow-wrap:anywhere}
-.global-notice .text-button{flex-shrink:0}
-.run-monitor{display:flex;align-items:center;gap:14px;height:50px;flex-shrink:0;padding:6px 18px;background:var(--paper);box-shadow:inset 0 -1px 0 var(--gray-150);min-width:0}
-.run-monitor-summary{flex:0 0 auto;min-width:70px;white-space:pre;font-family:var(--sans);font-size:var(--text-xs);font-weight:500;line-height:1.6;color:var(--gray-600);font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
-.run-monitor-list{display:flex;align-items:center;gap:8px;min-width:0;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;scrollbar-color:var(--gray-200) transparent;padding:1px 2px}
-.run-monitor-entry{display:flex;align-items:center;flex:0 0 236px;min-width:0;height:38px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--card);box-shadow:var(--shadow-sm)}
-/* English states such as "Original problem accepted" run longer than the Chinese the width was set for. */
-:root:lang(en) .run-monitor-entry{flex-basis:300px}
-.run-monitor-entry:hover{border-color:var(--gray-300)}
-.run-monitor-entry:has([aria-current=true]){border-color:var(--blue-200);background:var(--card);box-shadow:0 0 0 3px var(--blue-50)}
-.run-monitor-open{display:flex;align-items:center;gap:9px;flex:1;min-width:0;height:36px;border:0;border-radius:4px;background:transparent;padding:2px 8px 2px 10px;text-align:left}
-.run-monitor-open:focus-visible,.run-monitor-dismiss:focus-visible{outline-offset:-2px}
-.run-monitor-open>svg{width:12px;height:12px;color:var(--gray-400)}
-.run-monitor-icon{display:flex;align-items:center;justify-content:center;flex:0 0 14px;color:var(--green-600)}
-.run-monitor-icon>svg,.run-monitor-icon>.spinner{width:13px;height:13px}
-.run-monitor-copy{display:flex;flex-direction:column;flex:1;min-width:0}
-.run-monitor-title,.run-monitor-state{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.run-monitor-title{font-size:var(--text-xs);font-weight:500;line-height:1.4;color:var(--gray-800)}
-.run-monitor-state{font-size:var(--text-xs);line-height:1.4;color:var(--gray-500)}
-.run-monitor-entry[data-tone=passed] .run-monitor-icon{color:var(--green-600)}
-.run-monitor-entry[data-tone=failed] .run-monitor-icon{color:var(--red-600)}
-.run-monitor-entry[data-tone=warning] .run-monitor-icon{color:var(--amber-600)}
-.run-monitor .run-monitor-dismiss{width:24px;height:30px;margin-right:2px}
-.run-monitor-dismiss>svg{width:12px;height:12px}
-.run-monitor[data-stale=true] .run-monitor-state{color:var(--amber-600)}
-.run-monitor-entry[data-tone=running] .run-monitor-icon,.run-monitor-entry[data-tone=""] .run-monitor-icon{color:var(--blue-600)}
-.run-monitor-entry[data-tone=running] .run-monitor-icon>svg{animation:spin 2.4s linear infinite}
-.run-monitor-stages{display:flex;gap:2px;flex-shrink:0}
-.run-monitor-stages>i{width:9px;height:4px;border-radius:2px;background:var(--gray-150)}
-.run-monitor-stages>i[data-stage=done]{background:var(--gray-400)}
-.run-monitor-stages>i[data-stage=active]{background:var(--blue-500);animation:stage-pulse 1.6s ease-in-out infinite}
-.run-monitor-stages>i[data-stage=error]{background:var(--red-500)}
-.run-monitor-stages>i[data-stage=stopped]{background:var(--amber-500)}
-@keyframes stage-pulse{50%{opacity:.45}}
-/* Workbench layout: the docked history list, then either the new-research page (composer and preview) or one run document. */
-.workbench{--sidebar-width:clamp(232px,19vw,280px);display:flex;flex:1;min-width:0;min-height:0}
-.history-sidebar{display:flex;flex:0 0 var(--sidebar-width);width:var(--sidebar-width);min-width:0;min-height:0;border-right:1px solid var(--gray-150);background:var(--paper)}
-.history-sidebar:empty,:root[data-history-collapsed=true] .history-sidebar,body[data-history-collapsed=true] .history-sidebar{display:none}
-.workspace{display:grid;grid-template-columns:clamp(300px,var(--chat-width),calc(100% - 307px)) 7px minmax(300px,1fr);flex:1;min-width:0;min-height:0;overflow:hidden}
-body[data-view=run] .workspace{display:flex}
-body[data-view=run] :is(.composer,.pane-resizer,.mobile-switch){display:none}
-body[data-view=run] .runs-workspace{flex:1}
-@media(max-width:850px){.history-sidebar{display:none}}
-.composer{display:flex;flex-direction:column;position:relative;background:var(--paper);min-width:0;min-height:0;overflow:hidden}
-.pane-resizer{position:relative;cursor:col-resize;touch-action:none;border:0;background:transparent}
-.pane-resizer::after{content:"";position:absolute;top:50%;left:50%;width:3px;height:36px;margin:-18px 0 0 -1.5px;border-radius:2px;background:var(--gray-200);transition:background-color .15s,height .15s}
-.pane-resizer:hover::after,.pane-resizer:focus-visible::after,body.resizing .pane-resizer::after{background:var(--blue-300);height:56px;margin-top:-28px}
-.pane-resizer:focus-visible{outline-offset:-2px}
-.pane-resizer:focus-visible::after{width:4px;margin-left:-2px;height:72px;margin-top:-36px;background:var(--blue)}
-body.resizing{cursor:col-resize;user-select:none}
-.pane-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:56px;flex-shrink:0;padding:11px 20px;border-bottom:1px solid var(--line)}
-.pane-heading h1,.pane-heading h2{font-size:var(--text-base);font-weight:600;color:var(--gray-800);display:flex;align-items:center;gap:8px}
-.composer-heading{min-height:62px;border-bottom:0;padding:13px 24px}
-.composer-title{display:flex;align-items:center;gap:5px;min-width:0}
-.composer-actions{display:flex;align-items:center;gap:2px;flex-shrink:0}
-.composer-actions .draft-preview-toggle{display:inline-flex;align-items:center;justify-content:center;height:30px;margin:0 6px 0 0;padding:0 10px;border:1px solid var(--line);border-radius:var(--radius-md);background:transparent;color:var(--gray-700);font-size:var(--text-xs);text-decoration:none}
-.composer-actions .draft-preview-toggle:hover{background:var(--gray-100);color:var(--ink);text-decoration:none}
-.draft-status{display:block;min-height:18px;font-size:var(--text-xs);color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.draft-status.warning{color:var(--amber-600)}
-.draft-error{margin:10px 16px 0;flex-shrink:0}
-.count{font-size:var(--text-xs);font-weight:500;line-height:20px;min-width:20px;padding:0 5px;text-align:center;border-radius:var(--radius-sm);background:var(--gray-100);color:var(--gray-500);font-variant-numeric:tabular-nums}
-fieldset{border:0;padding:0;margin:0;min-width:0}
-.chat-scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:18px 32px 26px;scrollbar-width:thin;scrollbar-color:var(--gray-200) transparent;overscroll-behavior:contain;mask-image:linear-gradient(to bottom,#000 calc(100% - 24px),transparent)}
-.chat-scroll:focus-visible{mask-image:none}
-.chat-thread{min-height:100%;display:flex;flex-direction:column;gap:25px;max-width:660px;margin-inline:auto}
-.chat-welcome{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;flex:1;min-height:300px;padding:24px 0 38px}
-.chat-welcome>img{width:42px;height:42px;margin-bottom:22px}
-.chat-welcome h2{font-family:var(--serif);font-size:var(--text-3xl);font-weight:400;line-height:1.3;letter-spacing:-.005em;color:var(--gray-900)}
-.chat-suggestions{display:grid;grid-template-columns:1fr;gap:9px;width:100%;margin-top:30px}
-.research-examples{width:100%;margin-top:28px}
-.research-examples h3{font-size:var(--text-sm);font-weight:600;margin-bottom:8px}
-.research-examples>.field-note{line-height:1.8;margin-bottom:8px}
-.research-example{padding:20px 0;border-bottom:1px solid var(--line)}
-.research-example-copy h4{font-size:var(--text-sm);font-weight:600;line-height:1.6}
-.research-example-copy p{font-size:var(--text-xs);color:var(--muted);line-height:1.8;margin-top:6px;overflow-wrap:anywhere}
-.research-example-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:12px}
-.research-example-actions .button{font-size:var(--text-xs);white-space:normal;text-align:left}
-.research-example-actions [aria-pressed=true]{border-color:var(--blue);color:var(--blue)}
-.suggestions-label{font-size:var(--text-xs);color:var(--muted);margin-bottom:2px}
-.template-suggestion{display:flex;align-items:center;gap:12px;min-height:57px;padding:10px 13px;border:1px solid var(--gray-150);border-radius:var(--radius-lg);background:var(--card);text-align:left;font-size:var(--text-sm);color:var(--gray-600);min-width:0;box-shadow:var(--shadow-sm)}
-.template-suggestion:hover:not(:disabled){background:var(--card);border-color:var(--gray-300);color:var(--gray-900);box-shadow:var(--shadow-md)}
-.template-suggestion[aria-pressed=true]{border-color:var(--gray-400);background:var(--card);color:var(--gray-900)}
-.template-suggestion[aria-pressed=true]>svg:first-child{color:var(--gray-800);background:var(--gray-100)}
-.template-suggestion>svg{color:var(--gray-500);flex-shrink:0;width:30px;height:30px;padding:7px;border-radius:var(--radius-md);background:var(--gray-50)}
-/* The environment sits at the right end of the name's line; when both do not fit (English in a narrow column) it moves under the name. */
-.template-suggestion>.suggestion-copy{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;column-gap:12px;flex:1;min-width:0}
-.suggestion-copy>span{min-width:0;overflow-wrap:anywhere}
-.template-suggestion>svg:last-child{width:13px;height:13px;padding:0;background:transparent;margin-left:1px;color:var(--gray-400)}
-.template-suggestion .suggestion-environment{font-size:var(--text-xs);line-height:1.6;color:var(--gray-500)}
-.candidate-notice{display:block;margin-top:10px;font-size:var(--text-xs);color:var(--amber-600)}
-#run-form{position:relative;flex-shrink:0;padding:0 24px 18px;min-width:0}
-#form-fields{min-width:0}
-.submission-readiness{display:flex;align-items:center;gap:10px;min-width:0;margin-bottom:10px;padding:8px 12px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25);color:var(--gray-500);transition:background-color .2s,border-color .2s}
-.readiness-icon{display:flex;align-items:center;justify-content:center;align-self:flex-start;padding-top:3px;flex:0 0 16px;color:var(--gray-400)}
-.readiness-icon svg{width:15px;height:15px}
-.readiness-icon .spinner{width:13px;height:13px}
-.readiness-copy{flex:1;min-width:0;font-size:var(--text-xs);line-height:1.65;overflow-wrap:anywhere}
-#readiness-title{font-weight:500;color:var(--gray-600)}
-#readiness-detail{margin-top:2px;font-size:var(--text-xs);color:var(--gray-500)}
-.readiness-action{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;min-height:30px;max-width:43%;padding:4px 0 4px 7px;border:0;background:transparent;font-size:var(--text-xs);font-weight:500;color:var(--blue);text-align:right}
-.readiness-action svg{width:12px;height:12px}
-.readiness-action:hover:not(:disabled){color:var(--blue-700)}
-.submission-readiness[data-state=ready] .readiness-icon{color:var(--green-600)}
-.submission-readiness[data-state=offline] .readiness-icon{color:var(--amber-600)}
-.submission-readiness:is([data-state=missing],[data-state=full]){border-color:var(--amber-200);background:var(--amber-50)}
-.submission-readiness:is([data-state=missing],[data-state=full]) .readiness-icon{color:var(--amber-600)}
-.submission-readiness[data-state=missing][data-quiet]{border-color:var(--gray-150);background:var(--gray-25)}
-.submission-readiness[data-state=missing][data-quiet] .readiness-icon{color:var(--gray-500)}
-/* Ready is the quiet state: the check mark says it, the bar keeps its neutral paper. A statement with nothing left to prove is worth a look. */
-.submission-readiness[data-state=ready][data-settled]{border-color:var(--amber-200);background:var(--amber-50)}
-.submission-readiness[data-state=ready][data-settled] .readiness-icon{color:var(--amber-600)}
-.submission-readiness[data-state=offline]{border-color:var(--amber-200);background:var(--amber-50)}
-.draft-recovery{display:flex;align-items:center;gap:5px;min-width:0;margin:0 0 6px;padding:3px 0 5px;border-bottom:1px solid var(--gray-150)}
-/* What changed and that the old draft is kept read as one line beside the undo button; a narrow column wraps them. */
-.draft-recovery-copy{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;flex:1;min-width:0;overflow-wrap:anywhere;font-size:var(--text-xs);line-height:1.6;color:var(--gray-500)}
-.draft-recovery-copy>p:first-child{font-weight:500}
-.draft-recovery-copy>p+p{font-size:var(--text-xs);color:var(--gray-500)}
-.draft-recovery .icon-button{flex-shrink:0;width:31px;height:32px}
-.draft-recovery .icon-button svg{width:14px;height:14px}
-.draft-recovery #restore-draft{color:var(--blue-600);border-color:var(--gray-200)}
-.draft-recovery #restore-draft:hover:not(:disabled){color:var(--blue-700);border-color:var(--gray-300)}
-.chat-input-shell{border:1px solid var(--gray-200);border-radius:var(--radius-xl);background:var(--card);overflow:hidden;box-shadow:var(--shadow-md);transition:border-color .15s,box-shadow .15s}
-.chat-input-shell:focus-within{border-color:var(--blue-300);box-shadow:var(--shadow-md),0 0 0 4px color-mix(in srgb,var(--blue-500) 12%,transparent)}
-.file-drop-hint{position:fixed;inset:10px;z-index:80;display:grid;place-items:center;border:2px dashed var(--blue-500);border-radius:var(--radius-xl);background:color-mix(in srgb,var(--paper) 82%,transparent);pointer-events:none;opacity:0;visibility:hidden;transition:opacity .12s,visibility 0s .12s}
-body[data-file-drag] .file-drop-hint{opacity:1;visibility:visible;transition:opacity .12s}
-.file-drop-card{display:grid;justify-items:center;gap:6px;max-width:min(360px,calc(100% - 48px));padding:22px 26px;background:var(--card);border:1px solid var(--gray-150);border-radius:var(--radius-lg);box-shadow:var(--shadow-card);text-align:center}
-.file-drop-card svg{width:22px;height:22px;color:var(--blue-600)}
-.file-drop-title{font-size:var(--text-base);font-weight:600;color:var(--gray-900)}
-.file-drop-detail{font-size:var(--text-xs);line-height:1.6;color:var(--gray-500)}
-/* With the settings dialog open the page hint sits under the modal; the source field shows where the file goes. */
-body[data-file-drag] #run-settings[open] #source{outline:2px dashed var(--blue-500);outline-offset:2px}
-/* When the chips leave no room (English in a narrow column), the draft state moves to a line of its own instead of cutting them short. */
-.composer-source-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 10px;min-height:42px;padding:9px 12px 0}
-.source-attachment{display:inline-flex;align-items:center;gap:6px;min-height:28px;max-width:70%;padding:3px 7px;background:var(--gray-50);border:1px solid var(--gray-150);border-radius:var(--radius-sm);color:var(--gray-500);font-size:var(--text-xs);white-space:nowrap;min-width:0}
-.source-attachment>span{min-width:0;overflow:hidden;text-overflow:ellipsis}
-.source-attachment svg{width:12px;height:12px}
-.source-attachment:hover:not(:disabled){background:var(--accent-soft);color:var(--blue)}
-.composer-source-row .draft-status{margin-left:auto;min-width:0;max-width:100%}
-.composer-task-note{margin:0;padding:0 16px 12px;line-height:1.65}
-.creation-path{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:0 12px 14px;font-size:var(--text-xs);color:var(--gray-500)}
-.creation-path>a{color:var(--blue-600);padding:4px 0;line-height:1.6}
-.composer-continuation{display:flex;min-width:0;padding:6px 12px 0}
-.composer-continuation>.continuation-attachment{max-width:100%;padding-inline-end:2px;color:var(--gray-600)}
-.continuation-clear{display:inline-grid;place-items:center;flex-shrink:0;width:22px;height:22px;padding:0;border:0;border-radius:var(--radius-sm);background:transparent;color:var(--gray-500)}
-.continuation-clear:hover{background:var(--gray-100);color:var(--gray-800)}
-.continuation-clear:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
-textarea.chat-input{border:0;border-radius:0;min-height:81px;height:94px;max-height:180px;padding:13px 16px 7px;background:transparent;resize:none;font-size:var(--text-base);line-height:1.85;scrollbar-width:thin}
-textarea.chat-input:focus-visible{outline-offset:-2px}
-textarea.chat-input:disabled{background:transparent}
-.composer-tools{display:flex;align-items:center;gap:3px;min-height:49px;padding:3px 10px 10px}
-.composer-tools>.icon-button{width:34px;height:34px;color:var(--gray-500)}
-.composer-environment{display:inline-flex;align-items:center;gap:6px;flex:1;min-width:0;margin-left:3px;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.composer-environment svg{width:12px;height:12px;flex-shrink:0}
-.composer-environment>span{overflow:hidden;text-overflow:ellipsis}
-.composer-tools>.field-count{font-size:var(--text-xs);flex-shrink:0;margin-inline:4px}
-.composer-send{display:inline-flex;align-items:center;justify-content:center;gap:5px;margin-left:auto;min-height:34px;flex:0 0 auto}
-.composer-send .icon-button{width:36px;height:36px;border:1px solid var(--blue-600);border-radius:4px;background:var(--blue-600);color:var(--on-ink);transition:background-color .18s,transform .18s var(--ease-spring)}
-.composer-send .icon-button:hover:not(:disabled){background:var(--blue-700);border-color:var(--blue-700);color:var(--on-ink);transform:translateY(-1px)}
-.composer-send .icon-button:disabled{background:var(--gray-200);border-color:var(--gray-200);color:var(--on-ink)}
-.composer-send .icon-button:not(:disabled):active{transform:scale(.95)}
-.composer-send svg{width:17px;height:17px;stroke-width:1.8}
-.composer-send .spinner{border-color:var(--on-ink-faint);border-top-color:var(--on-ink)}
-.form-section{padding:24px;border-bottom:1px solid var(--line);scroll-margin-block:0}
-.inline-problem{padding:8px 0 24px;margin-bottom:24px}
-.inline-problem .section-heading{margin-bottom:20px}
-.inline-problem textarea.source-input{height:164px;min-height:140px;font-size:var(--text-sm)}
-.confirmed-original{padding:8px 0 24px;border-bottom:1px solid var(--line);margin-bottom:20px}
-.confirmed-original h2{font-size:var(--text-sm);margin-bottom:12px}
-.confirmed-original p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.8;margin-bottom:12px}
-.proof-instructions>summary{padding:12px 16px;cursor:pointer;font-size:var(--text-sm);color:var(--gray-600)}
-.proof-instructions>.text-button{margin:0 16px 12px;white-space:normal;text-align:left}
-body[data-file-drag] .inline-problem #source{outline:2px dashed var(--blue-500);outline-offset:2px}
-.section-heading{display:flex;align-items:center;gap:7px;margin-bottom:15px}
-.section-heading>svg{width:17px;height:17px;color:var(--blue-600)}
-.research-section .section-heading>svg{color:var(--blue)}
-.section-heading h2{font-size:var(--text-md);color:var(--gray-800);font-weight:600}
-.field-note{font-size:var(--text-xs);line-height:1.8;color:var(--gray-500);margin-bottom:15px;overflow-wrap:anywhere}
-.environment-details{margin-top:5px}
-:is(#native-team-profiles,#native-team-personal-experts){margin:10px 0 16px;font-size:var(--text-sm)}
-:is(#native-team-profiles,#native-team-personal-experts) summary{cursor:pointer;color:var(--gray-700)}
-:is(#native-team-profiles,#native-team-personal-experts) summary small{margin-inline-start:8px;color:var(--muted);overflow-wrap:anywhere}
-:is(#native-team-profiles,#native-team-personal-experts) .field-note{margin:6px 0 9px}
-:is(#native-team-profiles,#native-team-personal-experts) .profile-options{max-height:15rem;overflow:auto;scrollbar-width:thin}
-:is(#native-team-profiles,#native-team-personal-experts) fieldset{border:0;margin:8px 0;padding:0}
-:is(#native-team-profiles,#native-team-personal-experts) fieldset label{display:flex;align-items:center;gap:7px;cursor:pointer;min-height:26px;margin:0}
-:is(#native-team-profiles,#native-team-personal-experts) input[type=checkbox]{width:16px;height:16px;flex:none}
-:is(#native-team-profiles,#native-team-personal-experts) label small{color:var(--muted);overflow-wrap:anywhere}
-label,legend{display:block;font-size:var(--text-xs);font-weight:500;color:var(--gray-600);margin-bottom:7px}
-input:not([type=radio]),select,textarea{display:block;width:100%;min-width:0;border:1px solid var(--gray-200);border-radius:var(--radius-md);background-color:var(--card);padding:9px 11px;font-size:var(--text-sm);line-height:1.55}
-input:not([type=radio]),select{height:40px}
-select{appearance:none;-webkit-appearance:none;line-height:1.35;padding-right:32px;background-image:var(--select-chevron);background-repeat:no-repeat;background-position:right 10px center;background-size:14px 14px}
-select::picker-icon{display:none}
-@media(forced-colors:active){select{appearance:auto;-webkit-appearance:auto;padding-right:11px;background-image:none}}
-input:disabled,select:disabled,textarea:disabled{background-color:var(--gray-50);color:var(--gray-500)}
-textarea{resize:vertical;min-height:85px}
-textarea.source-input{font-size:var(--text-xs);line-height:1.85;height:224px;min-height:192px;tab-size:2;background:var(--gray-25);border-color:var(--gray-200)}
-.provider-address{font-size:var(--text-xs);line-height:1.8;color:var(--gray-500);overflow-wrap:anywhere;min-height:23px;margin:3px 0 11px}
-.credential-label{margin-top:15px}
-.connection-section .field-note:last-child{margin-bottom:0}
-.password-field{position:relative;margin-bottom:6px}
-.password-field input{padding-right:36px}
-.password-field .icon-button{position:absolute;right:2px;top:3px;width:31px;height:31px}
-.field-grid{display:grid;gap:11px;min-width:0}
-.field-grid>div{min-width:0}
-.model-grid{grid-template-columns:minmax(0,1fr) 98px}
-.limits-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
-.label-line{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:13px}
-.label-line label{margin-bottom:6px}
-.field-count{font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.field-count.over-limit{color:var(--red-600)}
-.source-label{margin-top:11px;margin-bottom:4px}
-.source-label label{margin:0}
-.editor-actions{display:flex;align-items:center;gap:3px}
-.editor-actions .icon-button{width:28px;height:28px}
-.editor-actions svg{width:14px;height:14px}
-.source-meta{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:26px}
-.source-meta .field-count{font-size:var(--text-xs)}
-#source-error{margin:2px 0 0}
-.token-cap{margin-top:13px;display:grid;grid-template-columns:minmax(0,1fr);align-items:start}
-.token-cap>label{grid-column:1/-1}
-.token-cap>input{grid-column:1;max-width:240px}
-.token-cap>.field-validation{grid-column:1/-1;grid-row:3}
-.budget-estimate{grid-column:1/-1;margin:8px 0 0;padding:7px 10px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--gray-50);font-size:var(--text-xs);color:var(--gray-600)}
-.coordination{margin-top:15px}
-.coordination legend{float:left;padding:0;margin-bottom:7px}
-.coordination>.term-hint{margin-top:-1px;vertical-align:top}
-.coordination>.segmented{clear:both}
-.plan-approval-option{margin-top:14px}
-.plan-approval-option .field-note{margin:4px 0 0}
-.plan-approval-option:has(input:disabled) .checkbox-option{color:var(--muted);cursor:default}
-.segmented{display:grid;grid-template-columns:1fr 1fr;gap:3px;padding:4px;background:var(--gray-100);border-radius:var(--radius-md)}
-.segmented label{margin:0;position:relative;min-width:0}
-.segmented input{position:absolute;opacity:0;width:1px;height:1px}
-.segmented span{display:flex;align-items:center;justify-content:center;gap:6px;min-height:34px;border-radius:var(--radius-sm);color:var(--gray-500);font-weight:500;font-size:var(--text-xs)}
-.segmented input:checked+span{background:var(--card);color:var(--blue-700);box-shadow:0 1px 3px color-mix(in srgb,var(--shade) 8%,transparent)}
-.segmented input:focus-visible+span{outline:2px solid var(--blue);outline-offset:1px}
-.segmented svg{width:14px;height:14px}
-.module-plan-section{min-width:0}
-.module-plan-heading{gap:7px}
-.module-plan-heading>svg{color:var(--blue)}
-.module-plan-count{margin-left:auto;color:var(--gray-500);font-size:var(--text-xs);font-weight:400;white-space:nowrap}
-.module-plan-view-actions{display:flex;gap:2px;flex-shrink:0}
-.module-plan-view-actions .icon-button{width:30px;height:30px}
-.module-plan-view-actions svg{width:14px;height:14px}
-.module-library{min-width:0;margin:0 0 20px;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
-.module-library>summary{display:flex;align-items:center;gap:8px;min-height:47px;min-width:0;cursor:pointer;list-style:none;color:var(--blue-700);font-size:var(--text-sm);font-weight:500}
-.module-library>summary::-webkit-details-marker{display:none}
-.module-library>summary>svg{width:16px;height:16px;flex-shrink:0;color:var(--blue-600)}
-.module-library>summary>svg:last-child{width:12px;height:12px;transition:transform .15s}
-.module-library[open]>summary>svg:last-child{transform:rotate(180deg)}
-.module-library>summary>.mono{color:var(--gray-500);font-size:var(--text-xs);font-weight:400;white-space:nowrap}
-.module-library-local{margin-left:auto;color:var(--gray-500);font-size:var(--text-xs);font-weight:400;white-space:nowrap}
-.module-library-content{min-width:0;padding:4px 0 17px}
-.module-library-content label{font-size:var(--text-xs);color:var(--gray-500)}
-.module-library-content input,.module-library-content select{height:40px;min-width:0;border-color:var(--gray-200);font-size:var(--text-sm)}
-.module-library-selection{display:grid;grid-template-columns:minmax(0,1fr) 32px 32px;align-items:center;gap:4px;min-width:0}
-.module-library .icon-button{width:32px;height:32px;flex-shrink:0}
-.module-library .icon-button>svg,.module-library .text-button>svg{width:14px;height:14px}
-.module-library-summary{margin:7px 0 4px;font-size:var(--text-xs);line-height:1.8;color:var(--gray-500);overflow-wrap:anywhere}
-.module-library-actions{display:flex;align-items:center;gap:7px;min-height:40px;margin-top:10px}
-.module-library-actions .button{min-height:34px;font-size:var(--text-xs);background:var(--ink);border-color:var(--ink);color:var(--on-ink)}
-.module-library-actions .button:hover:not(:disabled){background:var(--gray-900)}
-.module-library-actions .button:disabled{opacity:1;background:var(--gray-150);border-color:var(--gray-150);color:var(--gray-500)}
-.module-library-selection+.module-library-summary+label{margin-top:14px}
-.module-library-undo{margin-left:auto;color:var(--green-600)}
-.module-library-notice{margin-top:7px;font-size:var(--text-xs);line-height:1.8;color:var(--blue-600);overflow-wrap:anywhere}
-.module-library-notice[data-error=true]{color:var(--red-600)}
-.module-library [data-module-library-delete]:hover:not(:disabled){color:var(--red-600);background:var(--red-50)}
-.module-plan-builtins{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;min-width:0}
-.module-plan-builtins>div{min-width:0}
-.module-plan-builtins label,.module-plan-fields label,.module-plan-rule-heading label{font-size:var(--text-xs);color:var(--gray-500)}
-.module-plan-builtins select,.module-plan-fields input,.module-plan-fields select,.module-plan-instructions-field textarea{border-color:var(--gray-200);font-size:var(--text-sm)}
-.module-plan-fixed{display:flex;align-items:center;gap:7px;margin-top:15px;color:var(--gray-500);font-size:var(--text-xs);line-height:20px;flex-wrap:wrap}
-.module-plan-fixed>svg{width:14px;height:14px;color:var(--green-600)}
-.module-plan-fixed>span:last-child{margin-left:auto;color:var(--gray-500)}
-.module-plan-list{min-width:0;margin-top:15px}
-.module-plan-row{min-width:0;padding:18px 0 21px;border-top:1px solid var(--line)}
-.module-plan-row-heading{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:8px 10px;min-height:36px;min-width:0}
-.module-plan-disclosure{display:flex;align-items:flex-start;gap:7px;min-width:0;padding:4px 0;border:0;border-radius:var(--radius-sm);background:transparent;text-align:left}
-.module-plan-disclosure:hover .module-plan-summary-name{color:var(--blue)}
-.module-plan-disclosure>svg{width:13px;height:13px;margin-top:3px;color:var(--gray-400)}
-.module-plan-row[data-expanded=false] .module-plan-disclosure>svg{transform:rotate(-90deg)}
-.module-plan-summary-copy{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 8px;min-width:0}
-.module-plan-summary-name{font-size:var(--text-sm);font-weight:600;line-height:1.6;color:var(--gray-700);overflow-wrap:anywhere}
-.module-plan-summary-meta{grid-column:1/-1;font-size:var(--text-xs);line-height:1.7;color:var(--gray-500);overflow-wrap:anywhere}
-.module-plan-row-actions{display:flex;align-items:center;gap:2px;min-width:0}
-.module-plan-row-body{margin-top:12px}
-.module-plan-row-index{color:var(--gray-500);font-size:var(--text-xs);white-space:nowrap}
-.module-plan-toggle{display:inline-flex;align-items:center;gap:7px;margin:0;color:var(--gray-500);font-size:var(--text-xs);cursor:pointer;white-space:nowrap}
-.module-plan-toggle input[type=checkbox]{appearance:none;position:relative;display:inline-block;width:29px;height:17px;min-width:29px;margin:0;padding:0;border:1px solid var(--gray-300);border-radius:var(--radius-lg);background:var(--gray-200);cursor:inherit}
-.module-plan-toggle input[type=checkbox]::before{content:"";position:absolute;left:2px;top:2px;width:11px;height:11px;border-radius:50%;background:var(--card);transition:transform .15s}
-.module-plan-toggle input[type=checkbox]:checked{background:var(--blue);border-color:var(--blue)}
-.module-plan-toggle input[type=checkbox]:checked::before{transform:translateX(12px)}
-.module-plan-move,.module-plan-duplicate,.module-plan-delete{width:30px;height:30px;color:var(--gray-500)}
-.module-plan-move>svg,.module-plan-duplicate>svg,.module-plan-delete>svg{width:14px;height:14px}
-.module-plan-move:hover:not(:disabled),.module-plan-duplicate:hover:not(:disabled){color:var(--green-600);background:var(--green-50)}
-.module-plan-delete:hover:not(:disabled){color:var(--red-600);background:var(--red-50)}
-.module-plan-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;min-width:0}
-.module-plan-fields>div{min-width:0}
-.module-plan-fields input,.module-plan-fields select{height:40px}
-.module-plan-instructions-field{min-width:0;margin-top:12px}
-.module-plan-rule-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;margin-bottom:6px}
-.module-plan-rule-heading label{margin:0}
-.module-plan-rule-bytes,.module-plan-bytes{color:var(--gray-500);font-size:var(--text-xs);line-height:18px;white-space:nowrap;font-variant-numeric:tabular-nums}
-.module-plan-rule-bytes[data-over-limit=true],.module-plan-bytes[data-over-limit=true]{color:var(--red-600)}
-.module-plan-instructions-field textarea{min-height:100px;max-height:360px;line-height:1.8;overflow-wrap:anywhere;background:var(--gray-25)}
-.module-plan-row[data-enabled=false] .module-plan-row-index{color:var(--gray-500)}
-.module-plan-row[data-enabled=false] .module-plan-summary-name{color:var(--gray-500)}
-.module-plan-row[data-invalid=true] .module-plan-summary-name{color:var(--red-600)}
-.module-plan-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:34px;min-width:0}
-.module-plan-add{min-height:36px;font-size:var(--text-xs)}
-.module-plan-add>svg{width:14px;height:14px}
-.module-plan-deletion{position:sticky;bottom:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;min-height:42px;margin-top:8px;padding:6px 8px;border-top:1px solid var(--gray-150);border-bottom:1px solid var(--gray-150);background:var(--gray-50)}
-.module-plan-deletion p{min-width:0;font-size:var(--text-xs);line-height:1.6;color:var(--gray-600);overflow-wrap:anywhere}
-.module-plan-deletion .icon-button{flex-shrink:0;width:30px;height:30px;color:var(--green-600)}
-.module-plan-deletion .icon-button>svg{width:15px;height:15px}
-.module-plan-error{margin-top:9px;padding-left:9px;border-left:2px solid var(--red-500);color:var(--red-600);font-size:var(--text-xs);line-height:1.8;overflow-wrap:anywhere}
-@media(max-width:560px){
- .module-plan-row-heading{grid-template-columns:minmax(0,1fr) auto}
- .module-plan-disclosure{grid-column:1/-1}
- .module-plan-toggle{padding-left:20px}
-}
-@media(max-width:380px){
- .module-plan-builtins{grid-template-columns:minmax(0,1fr);gap:11px}
- .module-plan-fields{grid-template-columns:minmax(0,1fr);gap:10px}
- .module-plan-footer{gap:8px;flex-wrap:wrap}
-}
-.form-submit{padding:0;background:transparent}
-.form-submit .inline-error{margin:9px 0 0}
-.runtime-note{display:block;margin-top:10px;font-size:var(--text-xs);line-height:1.6;color:var(--gray-500);overflow-wrap:anywhere;text-align:center}
-.inline-error{border-left:2px solid var(--red-500);padding:7px 9px;margin-bottom:12px;color:var(--red-600);background:var(--red-50);font-size:var(--text-xs);overflow-wrap:anywhere}
-.field-validation{margin-top:6px;font-size:var(--text-xs);line-height:1.7;color:var(--red-600);overflow-wrap:anywhere}
-.task-validation{padding:0 14px 5px;margin:0}
-input[aria-invalid=true],select[aria-invalid=true],textarea[aria-invalid=true]{border-color:var(--red-500)}
-.chat-input-shell:has(#task[aria-invalid=true]){border-color:var(--red-500)}
-.runs-workspace{display:flex;min-width:0;min-height:0;overflow:hidden}
-/* On wide screens the run or draft preview floats as one card on the paper. */
-@media(min-width:851px){
- .runs-workspace{padding:10px 10px 10px 0}
- body[data-view=run] .runs-workspace{padding-left:10px}
- .runs-workspace>.run-detail{border:1px solid var(--gray-150);border-radius:12px;box-shadow:var(--shadow-panel)}
-}
-.run-history{display:flex;flex-direction:column;min-width:0;min-height:0;flex:1;background:transparent;overflow:hidden}
-.run-history .pane-heading{min-height:40px;padding:6px 10px 2px 16px;border-bottom:0;background:transparent}
-.run-history .pane-heading h2{font-size:var(--text-xs);font-weight:500;color:var(--gray-500)}
-.history-sidebar #close-history{display:none}
-.open-draft{flex-shrink:0;justify-content:flex-start;gap:9px;margin:10px 10px 4px;min-height:36px;padding:7px 11px;border-color:var(--gray-200);border-radius:9px;background:var(--card);color:var(--ink);font-size:var(--text-sm);box-shadow:var(--shadow-sm);transition:background-color .15s,border-color .15s,box-shadow .15s}
-.open-draft:hover:not(:disabled){background:var(--gray-50);border-color:var(--gray-300)}
-body[data-view=draft] .open-draft{background:var(--card);border-color:var(--blue-300);box-shadow:inset 3px 0 0 var(--blue-600),var(--shadow-sm)}
-.open-draft>svg{color:var(--blue-600)}
-.history-tools{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;padding:4px 10px 8px;flex-shrink:0}
-.history-search{position:relative;min-width:0}
-.history-search>svg{position:absolute;left:9px;top:10px;width:14px;height:14px;color:var(--gray-400);pointer-events:none}
-.history-search input{height:34px;padding:6px 30px 6px 29px;font-size:var(--text-xs);background:var(--card)}
-.history-search input::-webkit-search-cancel-button{display:none}
-/* No room is kept for the clear button while it is hidden. */
-.history-search:has(>.icon-button[hidden]) input{padding-right:9px}
-.history-search .icon-button{position:absolute;top:3px;right:3px;width:28px;height:28px}
-.history-search .icon-button svg{width:13px;height:13px}
-.history-tools select{width:auto;max-width:118px;height:34px;padding:4px 26px 4px 10px;font-size:var(--text-xs);background-color:var(--card);background-position:right 8px center}
-.run-list{position:relative;isolation:isolate;min-height:0;flex:1;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;overflow-anchor:none;overscroll-behavior:contain;padding:5px 8px 12px}
-.run-row{display:block;width:100%;text-align:left;border:1px solid transparent;border-radius:8px;background:transparent;padding:9px 10px;position:relative;min-width:0}
-.run-list>[role=listitem]+[role=listitem]{margin-top:2px}
-.history-group{display:flex;align-items:center;gap:6px;padding:10px 10px 4px;font-size:var(--text-xs);font-weight:500;color:var(--gray-500)}
-.history-group:first-child{padding-top:4px}
-.history-group[data-history-group=waiting]{color:var(--amber-700)}
-.history-group[data-history-group=waiting] .count{background:var(--amber-50);color:var(--amber-700)}
-.run-row:hover{background:var(--gray-100)}
-.run-row.selected{background:var(--card);border-color:var(--gray-150)}
-.run-row-title{display:block;font-size:var(--text-sm);font-weight:500;color:var(--gray-800);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.run-row-meta{display:flex;align-items:center;gap:7px;margin-top:4px;min-width:0}
-.run-row-model{display:block;min-width:0;flex:1;font-size:var(--text-xs);color:var(--gray-500);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.run-environment{flex-shrink:0;font-size:var(--text-xs);color:var(--gray-500)}
-/* A long status (English "Original problem accepted") pushes the date to its own line rather than past the row. */
-.run-row-bottom{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 5px;margin-top:6px}
-.history-sidebar .run-row-meta,.run-list[data-uniform] .run-row-meta{display:none}
-.run-row time{font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.badge{display:inline-flex;align-items:center;gap:5px;min-height:20px;padding:2px 8px;border-radius:999px;font-size:var(--text-xs);font-weight:500;background:var(--gray-100);color:var(--gray-500);white-space:nowrap}
-.badge svg{width:11px;height:11px}
-.badge.running{color:var(--blue-600);background:var(--blue-50)}
-.badge.passed{color:var(--green-600);background:var(--green-50)}
-.badge.failed{color:var(--red-600);background:var(--red-50)}
-.badge.warning{color:var(--amber-600);background:var(--amber-50)}
-.history-error{padding:10px 15px;border-bottom:1px solid var(--line);color:var(--amber-600);font-size:var(--text-xs);overflow-wrap:anywhere}
-/* Run document: a one-line heading (title, status, time, actions behind ⋯), the stage track, then the tabs. */
-.run-detail{--detail-inset:22px;display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;overflow:hidden;background:var(--card)}
-.detail-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0;min-height:60px;padding:12px var(--detail-inset) 10px;background:linear-gradient(180deg,var(--gray-25),var(--card));border-bottom:1px solid color-mix(in srgb,var(--line) 55%,transparent)}
-.detail-heading-text{display:flex;align-items:center;flex-wrap:wrap;gap:4px 12px;flex:1;min-width:0}
-.detail-heading h2{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--serif);font-size:var(--text-xl);font-weight:400;line-height:1.35;letter-spacing:-.005em;color:var(--gray-900)}
-.detail-heading h2 .katex{font-size:.95em}
-@media(min-width:561px){.detail-heading h2:has(.katex){white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;line-height:1.5}}
-.detail-statusline{display:flex;align-items:center;gap:10px;flex-shrink:0;font-size:var(--text-xs);color:var(--gray-500)}
-.detail-elapsed{display:inline-flex;align-items:center;gap:5px}
-.detail-elapsed>svg{width:13px;height:13px}
-.detail-elapsed>.mono{font-family:var(--sans);font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
-.detail-actions{display:flex;align-items:center;gap:4px;flex-shrink:0}
-.detail-actions>.button{min-height:34px;padding:6px 12px}
-.run-menu{position:relative}
-.run-menu>summary{list-style:none}
-.run-menu>summary::-webkit-details-marker{display:none}
-.run-menu>summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
-.run-menu[open]>summary{background:var(--gray-100);color:var(--gray-800)}
-.run-menu-panel{position:absolute;right:0;top:calc(100% + 6px);z-index:30;display:grid;gap:2px;width:240px;max-width:calc(100vw - 24px);padding:6px;border:1px solid var(--gray-150);border-radius:var(--radius-lg);background:var(--card);box-shadow:var(--shadow-md)}
-.run-menu-item{display:flex;align-items:center;gap:9px;width:100%;min-height:34px;padding:6px 8px;border:0;border-radius:var(--radius-md);background:transparent;color:var(--gray-700);font-size:var(--text-sm);text-align:left}
-.run-menu-item>svg{width:15px;height:15px;color:var(--gray-500)}
-.run-menu-item:hover:not(:disabled){background:var(--gray-100);color:var(--gray-900)}
-.run-menu-item.danger,.run-menu-item.danger>svg{color:var(--red-600)}
-.run-menu-item.danger:hover:not(:disabled){background:var(--red-50);color:var(--red-600)}
-.run-continuation{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;flex-shrink:0;margin:0 var(--detail-inset) 10px;color:var(--gray-600);font-size:var(--text-xs);line-height:1.6}
-.run-continuation>svg{width:13px;height:13px;flex-shrink:0;color:var(--gray-500)}
-.run-continuation>span{flex:1 1 220px;min-width:0;overflow-wrap:anywhere}
-.run-continuation>.text-button{flex-shrink:0}
-.run-detail>.inline-error{margin:0 var(--detail-inset) 10px}
-.run-stall{display:flex;align-items:center;flex-wrap:wrap;gap:4px 10px;flex-shrink:0;margin:0 var(--detail-inset) 10px;padding:7px 10px 7px 12px;border:1px solid var(--amber-200);border-radius:8px;background:var(--amber-50);color:var(--amber-700);font-size:var(--text-xs);line-height:1.6}
-.run-stall>svg{width:14px;height:14px;flex-shrink:0}
-.run-stall>p{flex:1 1 220px;min-width:0;overflow-wrap:anywhere}
-.run-stall>.text-button{flex-shrink:0;color:var(--amber-700);font-weight:500}
-.run-approval{display:grid;grid-template-columns:18px minmax(0,1fr);gap:10px;flex-shrink:0;margin:0 var(--detail-inset) 12px;padding:12px 14px;border:1px solid var(--amber-200);border-radius:10px;background:var(--amber-50);color:var(--gray-700)}
-.run-approval>svg{width:18px;height:18px;margin-top:2px;color:var(--amber-600)}
-.run-approval h3{font-size:var(--text-base);color:var(--gray-900)}
-.run-approval-copy{display:grid;gap:4px;min-width:0;font-size:var(--text-sm);line-height:1.6}
-.run-approval-note{color:var(--gray-500);font-size:var(--text-xs)}
-.run-approval-error{color:var(--red-600);font-size:var(--text-xs)}
-.run-approval-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin-top:6px}
-.run-approval-actions>.button{min-height:32px;padding:5px 12px}
-.artifact-progress{flex-shrink:0;padding:2px var(--detail-inset) 12px}
-.artifact-stages{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:0;padding:0;list-style:none}
-.artifact-stages li{position:relative;display:flex;align-items:center;gap:6px;min-width:0;padding-top:9px;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.artifact-stages li::before,.artifact-stages li::after{content:"";position:absolute;inset:0 0 auto;height:3px;border-radius:2px;background:var(--gray-150)}
-/* The fill grows into a stage as it starts and takes its outcome's colour when it ends. */
-.artifact-stages li::after{background-color:var(--blue-500);transform:scaleX(0);transform-origin:left;transition:transform .6s var(--ease-expo),background-color .4s}
-.artifact-stages li:is(.done,.error,.stopped,.active)::after{transform:none}
-.artifact-stages li.done{color:var(--gray-600)}
-.artifact-stages li.done::after{background-color:var(--gray-300)}
-.artifact-stages li.error{color:var(--red-600)}
-.artifact-stages li.error::after{background-color:var(--red-500)}
-.artifact-stages li.stopped{color:var(--amber-700)}
-.artifact-stages li.stopped::after{background-color:var(--amber-500)}
-.artifact-stages li.active{color:var(--blue-700);font-weight:500}
-.artifact-stages li.active::after{background-image:linear-gradient(90deg,transparent 0 38%,color-mix(in srgb,var(--blue-200) 85%,transparent) 50%,transparent 62% 100%);background-size:260% 100%;background-repeat:no-repeat;animation:stage-sheen 2.6s cubic-bezier(.45,0,.25,1) infinite}
-@keyframes stage-sheen{0%{background-position:130% 0}62%,100%{background-position:-30% 0}}
-.stage-marker{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;border-radius:50%;border:1.5px solid var(--gray-200)}
-.stage-marker>svg{width:9px;height:9px;stroke-width:3}
-li.done>.stage-marker{border-color:var(--green-500);color:var(--green-600)}
-li.error>.stage-marker{border-color:var(--red-500);background:var(--red-500);color:var(--on-ink)}
-li.stopped>.stage-marker{border-color:var(--amber-500);color:var(--amber-600)}
-li.active>.stage-marker{border-color:var(--blue-500);box-shadow:inset 0 0 0 2.5px var(--card),inset 0 0 0 7px var(--blue-500)}
-.stage-copy{display:flex;align-items:baseline;gap:6px;min-width:0}
-.stage-label{overflow:hidden;text-overflow:ellipsis}
-.stage-clock{color:var(--gray-500);font-family:var(--sans);font-weight:400;font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
-li.active .stage-clock{color:var(--blue-600)}
-.detail-tabs{position:relative;isolation:isolate;display:flex;align-items:center;gap:4px;flex-shrink:0;min-width:0;padding-inline:calc(var(--detail-inset) - 10px);border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none}
-.detail-tabs::-webkit-scrollbar{display:none}
-.detail-tabs button{position:relative;min-height:42px;padding:10px;border:0;background:transparent;color:var(--gray-500);font-size:var(--text-sm);font-weight:500;white-space:nowrap;transition:color .15s}
-.detail-tabs button::before{content:"";position:absolute;inset:6px 2px;z-index:-1;border-radius:var(--radius-md);background:var(--gray-100);opacity:0;transition:opacity .15s}
-.detail-tabs button:hover::before{opacity:1}
-.detail-tabs button:hover{color:var(--gray-800)}
-.detail-tabs button[aria-selected=true]{color:var(--gray-900);font-weight:600}
-.detail-tabs button:focus-visible{outline-offset:-4px}
-.detail-tab-indicator{position:absolute;left:0;bottom:0;width:0;height:2.5px;border-radius:2px 2px 0 0;background:var(--blue-600);pointer-events:none}
-.detail-tab-indicator[data-ready]{transition:transform .38s var(--ease-out),width .38s var(--ease-out)}
-.detail-panel{flex:1;min-width:0;min-height:0;padding:20px var(--detail-inset) 24px;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--gray-200) transparent;overscroll-behavior:contain}
-.detail-panel:focus-visible{outline-offset:-3px}
-@media(min-width:1550px){.run-detail{--detail-inset:28px}}
-@media(max-width:1150px){.run-detail{--detail-inset:18px}}
-@media(max-width:560px){
- .run-detail{--detail-inset:14px}
- .detail-heading{flex-wrap:wrap;gap:8px;min-height:0;padding-top:10px}
- .detail-heading-text{flex-basis:200px}
- /* Status, 示例 · 只读 and the clock wrap rather than clip on a 320 px screen, as the English labels need. */
- .detail-statusline{flex-wrap:wrap;flex-shrink:1;gap:6px 10px;min-width:0}
- /* A long task as the title gets two lines on a phone instead of a few words and an ellipsis. */
- .detail-heading h2{font-size:var(--text-md);white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2}
- .artifact-stages{display:flex}
- .artifact-stages li{flex:1 1 0;gap:4px;overflow:visible}
- .artifact-stages li[aria-current=step]{flex:2.4 1 auto}
- .artifact-stages:not([data-ended]) li:not([aria-current=step])>.stage-copy{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
- /* Ended: every label under its marker. A column is never narrower than its longest word, so long English labels wrap between words. */
- .artifact-stages[data-ended]{display:grid;grid-template-columns:repeat(4,minmax(min-content,1fr))}
- .artifact-stages[data-ended] li{align-items:flex-start;flex-direction:column;white-space:normal}
- .artifact-stages[data-ended] .stage-copy{line-height:1.35}
- .detail-tabs button{min-height:40px;padding-inline:9px}
- .detail-panel{padding-block:15px 20px}
-}
-.panel-topline h3{font-size:var(--text-xs);font-weight:600;color:var(--gray-600)}
-.task-content{white-space:pre-wrap;font-size:var(--text-xs);color:var(--gray-600);line-height:1.9;overflow-wrap:anywhere;margin-top:10px}
-#share-confirmation{margin:12px 0;font-size:var(--text-xs);line-height:1.8;color:var(--muted)}
-#share-review{margin-top:20px;border-top:1px solid var(--line);padding-top:16px;font-size:var(--text-xs);line-height:1.8}
-#share-review>summary{cursor:pointer;color:var(--gray-700);font-weight:500}
-#share-review h3{margin:18px 0 8px;font-size:var(--text-xs);font-weight:600}
-#share-correspondences article{padding:14px 0;border-bottom:1px solid var(--line);min-width:0}
-#share-correspondences blockquote{margin:8px 0;padding-left:12px;border-left:2px solid var(--line);white-space:pre-wrap;overflow-wrap:anywhere}
-#share-correspondences pre{margin:8px 0;padding:12px;background:var(--gray-50);border:1px solid var(--line);border-radius:var(--radius-sm);font:12px/1.8 var(--mono);white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto}
-#share-correspondences p{margin-top:8px;color:var(--muted);white-space:pre-wrap;overflow-wrap:anywhere}
-.facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 25px;margin:17px 0 0}
-.facts>div{min-width:0}
-.facts dt{color:var(--gray-500);font-size:var(--text-xs)}
-.facts dd{margin:5px 0 0;font-size:var(--text-xs);font-weight:500;color:var(--gray-800);overflow-wrap:anywhere}
-.facts dd.mono,.preview-facts dd.mono,.report-metrics dd.mono,.field-count.mono{font-family:var(--sans);font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
-.panel-topline{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:13px}
-.panel-topline .button{min-height:31px;font-size:var(--text-xs);padding:5px 9px}
-.source-topline{flex-wrap:wrap}
-.source-switch{display:inline-flex;align-items:center;padding:3px;background:var(--gray-100);border-radius:var(--radius-md);gap:3px}
-.source-switch button{padding:5px 9px;min-height:32px;border:0;background:transparent;border-radius:var(--radius-sm);color:var(--gray-500);font-size:var(--text-xs)}
-.source-switch button[aria-pressed=true]{background:var(--card);color:var(--gray-600);box-shadow:0 1px 3px color-mix(in srgb,var(--shade) 8%,transparent)}
-.source-actions{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-left:auto}
-.code-scroll{margin:0;max-height:580px;overflow:auto;border:1px solid var(--gray-200);border-radius:10px;background:var(--gray-50);color:var(--gray-700);font:var(--text-xs)/1.85 var(--mono);padding:17px 18px;tab-size:2;scrollbar-width:thin;white-space:pre}
-.code-scroll.report{font-size:var(--text-xs);line-height:1.85}
-.detail-panel[data-tab=source]{display:flex;flex-direction:column;overflow:hidden;padding-bottom:20px}
-.detail-panel[data-tab=source]>.panel-topline{flex-shrink:0}
-.source-status{display:flex;align-items:center;gap:8px;flex-shrink:0;min-height:32px;padding:0 1px 11px;font-size:var(--text-xs);line-height:1.7;color:var(--gray-500);flex-wrap:wrap}
-.source-status>span{display:inline-flex;align-items:center;gap:6px;min-width:0}
-.source-status>span>svg{width:12px;height:12px;flex-shrink:0}
-.source-status>.source-origin{margin-left:auto;font-size:var(--text-xs);color:var(--gray-500);overflow-wrap:anywhere}
-.source-status.verified>span:first-child{color:var(--green-600)}
-.source-status.candidate>span:first-child{color:var(--amber-600)}
-.source-status>svg{width:13px;height:13px;color:var(--green-600)}
-.source-status .badge{font-size:var(--text-xs)}
-.source-status time{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--gray-500)}
-.source-status.warning,.source-status[data-tone=warning]{color:var(--amber-600)}
-.source-code-grid{display:flex;align-items:flex-start;flex:1;min-height:160px;max-height:none;padding:0;border-color:var(--gray-150);background:var(--gray-25);border-radius:var(--radius-sm)}
-.source-code-grid pre{min-height:100%;margin:0;padding:16px 15px;font:var(--text-xs)/1.9 var(--mono);tab-size:2;white-space:pre}
-.source-code-grid .source-line-numbers{position:sticky;left:0;z-index:1;flex:0 0 44px;padding-inline:10px;text-align:right;color:var(--gray-500);background:var(--gray-50);border-right:1px solid var(--gray-150);user-select:none;font-variant-numeric:tabular-nums}
-.source-code-grid .source-code{flex:1;min-width:max-content;color:var(--gray-600)}
-.source-reader{flex-shrink:0;min-width:0}
-.source-reader-tools{display:flex;align-items:center;justify-content:flex-end;gap:8px;min-height:30px}
-#source-find-location{margin-right:auto;min-width:0;font-size:var(--text-xs);color:var(--gray-500);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.source-find-toggle{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;min-height:29px;border:0;background:transparent;padding:3px 5px;color:var(--gray-500);font-size:var(--text-xs)}
-.source-find-toggle svg{width:12px;height:12px}
-.source-find-toggle:hover{color:var(--green-700)}
-.source-line-toggle{flex-shrink:0;width:27px;height:29px;border:0;background:transparent;color:var(--gray-500)}
-.source-line-toggle svg{width:14px;height:14px}
-.source-line-toggle[aria-expanded=true]{background:var(--green-100);color:var(--green-700)}
-.source-line{display:flex;align-items:center;gap:6px;margin:2px 0 9px;min-width:0}
-.source-line-entry{display:flex;align-items:center;flex:1;gap:8px;min-width:0;border:1px solid var(--gray-200);border-radius:var(--radius-sm);background:var(--card);padding-inline:8px}
-.source-line-entry:focus-within{border-color:var(--green-500);box-shadow:0 0 0 1px color-mix(in srgb,var(--green-500) 19%,transparent)}
-.source-line-entry label{flex-shrink:0;font-size:var(--text-xs);color:var(--gray-500);margin:0}
-.source-line-entry input{width:7ch;flex:1;min-width:0;height:32px;padding:5px 0;border:0;background:transparent;font:var(--text-xs) var(--mono)}
-.source-line-entry input:focus-visible{outline-offset:1px}
-#source-line-range{flex-shrink:0;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.source-line-error{margin:0 0 8px;font-size:var(--text-xs);line-height:1.7;color:var(--red-600);overflow-wrap:anywhere}
-.source-find{display:flex;align-items:center;gap:6px;margin:2px 0 9px;min-width:0}
-.source-find-entry{display:flex;align-items:center;flex:1;min-width:0;border:1px solid var(--gray-200);border-radius:var(--radius-sm);background:var(--card);overflow:hidden}
-.source-find-entry:focus-within{border-color:var(--green-500);box-shadow:0 0 0 1px color-mix(in srgb,var(--green-500) 19%,transparent)}
-.source-find-entry input{flex:1;min-width:0;height:32px;padding:5px 8px;border:0;font-size:var(--text-xs);background:transparent}
-.source-find-entry input:focus-visible{outline-offset:-2px}
-#source-find-position{flex-shrink:0;padding-inline:6px;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.source-find-actions{display:flex;align-items:center;gap:1px;flex-shrink:0}
-.source-find-actions .icon-button{width:27px;height:30px}
-.source-find-actions svg{width:14px;height:14px}
-.source-find-case{font:var(--text-xs) var(--mono);letter-spacing:-1px}
-.source-find-case[aria-pressed=true]{background:var(--green-100);color:var(--green-700);border-color:var(--green-200)}
-.source-find-scope{font-size:var(--text-xs);line-height:1.7;color:var(--amber-600);margin-bottom:8px}
-.preview-source>.source-reader{padding:0 11px;border-bottom:1px solid var(--gray-150);background:var(--gray-25)}
-.preview-source>.source-reader .source-reader-tools>button:focus-visible{outline-offset:-2px}
-.source-reader-tools>button{border-radius:var(--radius-sm)}
-.preview-source:has(.source-find:not([hidden]),.source-line:not([hidden])){min-height:230px}
-::highlight(lean-comment){color:var(--code-comment);font-style:italic}
-::highlight(lean-keyword){color:var(--code-keyword)}
-::highlight(lean-tactic){color:var(--code-tactic)}
-::highlight(lean-placeholder){color:var(--code-placeholder);text-decoration:underline;text-decoration-style:dotted}
-::highlight(lean-string){color:var(--code-string)}
-::highlight(lean-number){color:var(--code-number)}
-::highlight(source-matches){background-color:var(--find-match);color:var(--find-match-ink)}
-::highlight(source-current){background-color:var(--find-current);color:var(--find-current-ink);text-decoration:underline}
-::highlight(source-line){background-color:var(--find-line)}
-.detail-panel[data-tab=source] .diff-scroll{flex:1;min-height:150px;max-height:none}
-.detail-panel[data-tab=source] .diff-toolbar,.detail-panel[data-tab=source] .diff-heading{flex-shrink:0}
-.diff-heading{display:flex;align-items:center;gap:8px;font-size:var(--text-xs);color:var(--gray-500);min-height:22px}
-.diff-heading svg{width:12px;height:12px}
-.diff-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:9px 0 12px}
-.diff-counts{display:flex;align-items:center;gap:8px;font:var(--text-xs) var(--mono);font-variant-numeric:tabular-nums}
-.diff-count-added{color:var(--green-600)}
-.diff-count-removed{color:var(--red-600)}
-.diff-toggle{display:flex;align-items:center;gap:6px;font-size:var(--text-xs);font-weight:400;margin:0 0 0 auto;color:var(--gray-500);min-height:32px;cursor:pointer}
-.diff-toggle input[type=checkbox]{display:inline-block;width:13px;height:13px;min-width:13px;margin:0;padding:0;accent-color:var(--blue)}
-.diff-navigation{display:flex;align-items:center;gap:1px}
-.diff-navigation .icon-button{width:32px;height:32px}
-.diff-scroll-hint{display:none;align-items:center;gap:5px;color:var(--gray-500);font-size:var(--text-xs);line-height:1.5;white-space:nowrap}
-.diff-scroll-hint>svg{width:12px;height:12px;flex-shrink:0}
-#diff-position{min-width:42px;text-align:center;font-size:var(--text-xs);white-space:nowrap;font-variant-numeric:tabular-nums;color:var(--gray-500)}
-.diff-scroll{max-height:580px;max-width:100%;overflow:auto;border:1px solid var(--gray-150);border-radius:var(--radius-sm);background:var(--gray-25);scrollbar-width:thin}
-.diff-table{width:100%;border-collapse:separate;border-spacing:0;font:var(--text-xs)/1.85 var(--mono);color:var(--gray-700);tab-size:2}
-.diff-table th{position:sticky;top:0;z-index:1;background:var(--gray-50);border-bottom:1px solid var(--gray-150);padding:7px 8px;font:var(--text-xs)/1.5 Geist,"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",sans-serif;font-weight:400;text-align:left;color:var(--gray-500);white-space:nowrap}
-.diff-table th:nth-child(-n+2),.diff-line-no{width:5ch;min-width:5ch;text-align:right}
-.diff-line-no{padding:1px 6px;vertical-align:top;border-right:1px solid var(--gray-150);font-size:var(--text-xs);color:var(--gray-500);user-select:none;font-variant-numeric:tabular-nums}
-.diff-code{padding:1px 12px 1px 6px;white-space:pre;vertical-align:top}
-.diff-marker{display:inline-block;width:18px;user-select:none}
-.diff-added{background:var(--green-50)}
-.diff-added .diff-line-no{color:var(--green-600);border-right-color:var(--gray-150)}
-.diff-added .diff-marker{color:var(--green-600)}
-.diff-removed{background:var(--red-50)}
-.diff-removed .diff-line-no{color:var(--red-600);border-right-color:var(--gray-150)}
-.diff-removed .diff-marker{color:var(--red-600)}
-.diff-change-current .diff-line-no:first-child{box-shadow:inset 2px 0 var(--blue-500)}
-.diff-gap td{padding:7px 10px;background:var(--gray-100);font:var(--text-xs)/1.6 Geist,"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",sans-serif;color:var(--gray-500);border-block:1px solid var(--gray-150)}
-.diff-no-newline{display:block;padding-left:18px;font:var(--text-xs)/1.8 Geist,"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",sans-serif;color:var(--amber-600);white-space:normal}
-.diff-truncated{font-size:var(--text-xs);color:var(--amber-600);padding-top:9px;overflow-wrap:anywhere}
-.report-topline{flex-wrap:wrap}
-.report-actions{display:flex;align-items:center;gap:6px;margin-left:auto}
-.report-summary{min-width:0}
-.report-section{padding:20px 0;border-bottom:1px solid var(--line);min-width:0}
-.report-section:last-child{border-bottom:0}
-.report-section h3{font-size:var(--text-xs);color:var(--gray-600);font-weight:600}
-.report-library code{font-size:var(--text-xs);overflow-wrap:anywhere}
-.report-library li+li{margin-top:10px}
-.report-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px;padding:19px 0;margin:0;border-bottom:1px solid var(--line)}
-.report-metrics>div{min-width:0}
-.report-metrics dt{font-size:var(--text-xs);color:var(--gray-500)}
-.report-metrics dd{margin:5px 0 0;font-size:var(--text-lg);line-height:1.5;color:var(--gray-700);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
-.report-check-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
-.report-method{font-size:var(--text-xs);color:var(--gray-500);overflow-wrap:anywhere;margin-top:6px}
-.report-reason p,.report-reason-text{font-size:var(--text-xs);line-height:1.85;color:var(--amber-600);margin-top:7px;overflow-wrap:anywhere;white-space:pre-wrap}
-.verification-targets{list-style:none;padding:0;margin:13px 0 0}
-.verification-target{padding:13px 0;border-top:1px solid var(--gray-100);min-width:0}
-.verification-target:last-child{padding-bottom:0}
-.target-heading,.item-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;min-width:0}
-.target-heading code,.item-heading>code{font-size:var(--text-xs);line-height:1.8;min-width:0;overflow-wrap:anywhere;white-space:pre-wrap}
-.target-heading .badge,.item-heading .badge{flex-shrink:0}
-.goal-row .item-heading>.badge,.report-check-heading>.badge{padding:0;background:transparent}
-.target-counts{font-size:var(--text-xs);color:var(--gray-500);margin-top:4px;font-family:var(--sans);font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
-.target-diagnostics{margin-top:10px;min-width:0}
-.target-diagnostics>summary{cursor:pointer;font-size:var(--text-xs);color:var(--gray-500);padding:3px 0;min-height:27px;overflow-wrap:anywhere}
-/* Disclosure rows draw the same small chevron as the module-plan folds instead of the browser's black triangle; rows that carry their own icons keep them. */
-:is(.target-diagnostics,.collab-detail,.preview-task)>summary:not(:has(svg)){list-style:none}
-:is(.target-diagnostics,.collab-detail,.preview-task)>summary:not(:has(svg))::-webkit-details-marker{display:none}
-:is(.target-diagnostics,.collab-detail,.preview-task)>summary:not(:has(svg))::before{content:"";display:inline-block;width:5px;height:5px;margin:0 8px 0 2px;border:solid currentColor;border-width:0 1.5px 1.5px 0;opacity:.7;transform:translateY(-2px) rotate(-45deg);transition:transform .15s}
-:is(.target-diagnostics,.collab-detail,.preview-task)[open]>summary:not(:has(svg))::before{transform:translateY(-3px) rotate(45deg)}
-@media(prefers-reduced-motion:reduce){:is(.target-diagnostics,.collab-detail,.preview-task)>summary::before{transition:none}}
-.target-diagnostics>summary .field-count{margin-left:6px}
-.diagnostic-entry{margin-top:9px;min-width:0}
-.diagnostic-entry h4{font-size:var(--text-xs);font-weight:500;color:var(--gray-500);margin:0 0 5px}
-.diagnostic-output{font:var(--text-xs)/1.8 var(--mono);margin:10px 0 0;background:var(--gray-50);border-left:2px solid var(--gray-200);padding:12px 14px;max-height:260px;min-width:0;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--gray-600);tab-size:2;scrollbar-width:thin}
-.diagnostic-entry .diagnostic-output{margin-top:0}
-.diagnostic-limit{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:3px 12px;margin:6px 0 0;font-size:var(--text-xs);color:var(--amber-600)}
-.report-detail-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:3px 0;border:0;background:transparent;color:var(--blue-600);font-size:var(--text-xs)}
-.report-detail-link svg{width:12px;height:12px;flex-shrink:0}
-.report-detail-link:hover{text-decoration:underline}
-.report-credentials{margin-top:16px}
-.report-more>.report-metrics,.report-more>.report-section{margin-top:12px}
-.report-identity{margin-top:10px}
-.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:var(--gray-500);padding:35px 18px;gap:10px}
-.empty-state>svg{width:27px;height:27px;color:var(--gray-400);stroke-width:1.25}
-.empty-state h2{font-size:var(--text-base);font-weight:500;color:var(--gray-500)}
-.empty-state p{font-size:var(--text-xs)}
-.empty-state.compact{min-height:130px;padding-inline:12px}
-.detail-empty{flex:1;min-height:0}
-.detail-empty.draft-preview{display:flex;flex-direction:column;flex:1;align-items:stretch;height:auto;min-height:0;max-width:none;padding:0;margin:0;text-align:left;overflow-y:auto;scrollbar-width:thin}
-.preview-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-shrink:0;min-height:74px;padding:12px 24px;border-bottom:1px solid var(--line);background:var(--card)}
-.preview-eyebrow{display:block;font-size:var(--text-xs);color:var(--gray-500);margin-bottom:3px}
-.preview-heading h2{font-family:var(--serif);font-size:var(--text-xl);font-weight:400;line-height:1.4;letter-spacing:-.005em;overflow-wrap:anywhere;color:var(--gray-900)}
-.preview-status{flex-shrink:0;padding:4px 8px;color:var(--gray-500);background:var(--gray-50);border:1px solid var(--gray-150);font-size:var(--text-xs)}
-.preview-facts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;flex-shrink:0;margin:0;padding:15px 24px 13px;background:var(--gray-25)}
-.preview-facts>div{min-width:0}
-.preview-facts dt{font-size:var(--text-xs);color:var(--gray-500)}
-/* One line each, so typing a long model name never shifts the source below. */
-.preview-facts dd{margin:4px 0 0;font-size:var(--text-sm);font-weight:500;color:var(--gray-800);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.preview-facts dd.mono{font-size:var(--text-xs);font-weight:400}
-.preview-source{display:flex;flex-direction:column;flex:1;min-height:212px;min-width:0;overflow:hidden;border:1px solid var(--gray-150);border-radius:var(--radius-md);margin-inline:22px;margin-top:17px}
-.preview-source-heading{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:12px;min-height:41px;padding:9px 14px;background:var(--gray-50);border-bottom:1px solid var(--gray-150)}
-.preview-source-heading h3{display:flex;align-items:center;gap:8px;font-size:var(--text-xs);font-weight:500;color:var(--blue-600)}
-.preview-source-heading h3 svg{width:15px;height:15px;color:var(--blue-600)}
-.preview-source-heading>span{font:var(--text-xs) var(--mono);color:var(--gray-500);white-space:nowrap}
-.draft-source-scroll{display:flex;align-items:flex-start;flex:1;height:auto;min-height:130px;max-height:none;overflow:auto;background:var(--card);scrollbar-width:thin}
-.draft-source-scroll:focus-visible{outline-offset:-2px}
-.draft-source-scroll pre{min-height:100%;margin:0;padding:20px 18px;font:var(--text-sm)/1.95 var(--mono);white-space:pre;tab-size:2;color:var(--gray-700)}
-.draft-source-scroll .preview-line-numbers{position:sticky;left:0;z-index:1;flex:0 0 46px;padding-inline:12px;text-align:right;color:var(--gray-500);background:var(--gray-25);border-right:1px solid var(--gray-100);user-select:none}
-#draft-preview-code{flex:1;min-width:max-content}
-.preview-task{padding:16px 22px 19px;min-width:0;flex-shrink:0}
-.preview-task>summary{cursor:pointer;min-height:23px;color:var(--gray-500);font-size:var(--text-xs)}
-.preview-task>summary:hover{color:var(--blue)}
-.preview-task h3{font-size:var(--text-xs);font-weight:600;color:var(--gray-600)}
-.preview-task .task-content{margin-top:7px;max-height:100px;overflow:auto;color:var(--gray-500);font-size:var(--text-sm)}
-.preview-view-tabs{display:flex;align-items:center;gap:25px;margin:0;padding-inline:24px;border-bottom:1px solid var(--line);flex-shrink:0}
-.preview-view-tabs button{display:inline-flex;align-items:center;gap:8px;min-height:45px;padding:8px 0;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--gray-500);font-size:var(--text-xs)}
-.preview-view-tabs button[aria-selected=true]{color:var(--blue);border-bottom-color:var(--blue);font-weight:500}
-.preview-view-tabs button>svg{width:15px;height:15px}
-.draft-module-panel{padding:23px 24px 28px;min-width:0;flex-shrink:0}
-.module-workspace{container-type:inline-size;min-width:0}
-.module-view-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:18px;min-width:0}
-.module-view-heading>div{flex:1;min-width:0}
-.module-view-heading h3{font-size:var(--text-md);font-weight:600;color:var(--gray-700)}
-.module-view-heading p{margin-top:5px;font-size:var(--text-xs);color:var(--gray-500);overflow-wrap:anywhere}
-.module-observation{flex:0 0 124px;max-width:44%;min-height:32px;line-height:18px;padding-top:2px;text-align:right;color:var(--gray-500);font-size:var(--text-xs);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
-.module-live{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;padding:10px 0 13px;margin:-7px 0 21px;border-block:1px solid var(--line);min-width:0}
-.module-live-heading{display:flex;align-items:center;gap:9px;min-width:0;color:var(--gray-500);font-size:var(--text-xs)}
-.module-live-heading time{color:var(--gray-500);font-size:var(--text-xs);font-variant-numeric:tabular-nums}
-.module-live-controls{display:flex;align-items:center;gap:10px}
-.module-follow{display:inline-flex;align-items:center;gap:6px;min-height:30px;color:var(--gray-500);font-size:var(--text-xs);cursor:pointer;white-space:nowrap}
-.module-follow input[type=checkbox]{display:inline-block;width:13px;height:13px;min-width:13px;margin:0;padding:0;accent-color:var(--green-600)}
-.module-follow:has(:disabled){color:var(--gray-500);cursor:default}
-.module-live-controls .icon-button{width:30px;height:30px}
-.module-live-controls .icon-button>svg{width:14px;height:14px}
-.module-live-event{grid-column:1/-1;min-width:0;height:36px;font-size:var(--text-xs);line-height:18px;color:var(--gray-500);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
-.module-live-event strong{margin-right:10px;font-weight:500;color:var(--gray-600)}
-.module-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:25px;align-items:start}
-.module-graph{min-width:0;--module-gap:30px;--module-inset:12px}
-.module-node{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:16px minmax(24px,auto) minmax(18px,auto) minmax(18px,auto);gap:1px 6px;width:100%;min-width:0;min-height:103px;padding:10px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--card);text-align:left;box-shadow:0 2px 5px color-mix(in srgb,var(--shade) 2%,transparent);transition:background-color .18s,border-color .18s,box-shadow .18s,color .18s}
-.module-node:hover{border-color:var(--blue-300);background:var(--gray-25)}
-.module-node-top{display:contents}
-.module-code{grid-row:1;grid-column:1;display:inline-flex;align-items:center;line-height:16px;color:var(--gray-500)}
-.module-code>svg{width:14px;height:14px}
-.module-node-selected{display:none;grid-row:1;grid-column:2;justify-self:end;align-items:center;gap:3px;color:var(--green-600);font-size:var(--text-xs);line-height:16px;white-space:nowrap}
-.module-node-selected>svg{width:11px;height:11px}
-.module-node-name{grid-row:2;grid-column:1/-1;font-size:var(--text-sm);line-height:24px;font-weight:600;color:var(--gray-700);overflow-wrap:anywhere}
-.module-node-subject{grid-row:3;grid-column:1/-1;font-size:var(--text-xs);line-height:18px;color:var(--gray-500);overflow-wrap:anywhere}
-.module-node-state{grid-row:4;grid-column:1/-1;display:inline-flex;align-items:center;gap:5px;min-width:0;font-size:var(--text-xs);line-height:18px;color:var(--gray-500);overflow-wrap:anywhere}
-.module-state-dot{flex:0 0 5px;width:5px;height:5px;border-radius:50%;background:var(--gray-300);transition:background-color .18s,box-shadow .18s}
-.module-node[data-tone=active]{border-color:var(--green-300);background:var(--gray-50)}
-.module-node[data-tone=active] .module-node-state{color:var(--green-600)}
-.module-node[data-tone=active] .module-state-dot{background:var(--green-500);animation:module-activity-pulse 1.8s ease-in-out infinite}
-.module-node[data-tone=observed] .module-state-dot{background:var(--gray-400)}
-.module-node[data-tone=feedback] .module-node-state,.module-node[data-tone=stopped] .module-node-state{color:var(--amber-600)}
-.module-node[data-tone=feedback] .module-state-dot,.module-node[data-tone=stopped] .module-state-dot{background:var(--amber-500)}
-.module-node[data-tone=passed]{border-color:var(--green-300);background:var(--green-50)}
-.module-node[data-tone=passed] .module-node-state{color:var(--green-600)}
-.module-node[data-tone=passed] .module-state-dot{background:var(--green-600)}
-.module-node[data-tone=failed]{border-color:var(--red-300);background:var(--gray-25)}
-.module-node[data-tone=failed] .module-node-state{color:var(--red-600)}
-.module-node[data-tone=failed] .module-state-dot{background:var(--red-500)}
-.module-node[data-recent=true]{box-shadow:inset 3px 0 var(--green-500),0 2px 3px color-mix(in srgb,var(--shade) 2%,transparent)}
-.module-node[data-module-id=M3] .module-code{color:var(--amber-600)}
-.module-node[data-module-id=M4] .module-code{color:var(--gray-500)}
-.module-node[data-module-id=M1] .module-code{color:var(--green-600)}
-.module-node[data-module-id=M2] .module-code{color:var(--green-600)}
-.module-node[aria-pressed=true]{border-color:var(--blue-200);background:var(--blue-50);box-shadow:inset 3px 0 var(--blue)}
-.module-node[aria-pressed=true][data-recent=true]{box-shadow:inset 3px 0 var(--green-500),0 2px 5px color-mix(in srgb,var(--shade) 4%,transparent)}
-.module-node[aria-pressed=true] .module-code{color:var(--blue-600)}
-.module-node[aria-pressed=true] .module-node-selected{display:inline-flex}
-.module-node[aria-pressed=true] .module-node-selected{color:var(--blue-600)}
-.module-node[aria-pressed=true] .module-node-name{color:var(--blue-700)}
-.module-node[aria-pressed=true] .module-node-subject{color:var(--blue-600)}
-.module-node[aria-pressed=true] .module-node-state{color:var(--blue-600)}
-.module-node[aria-pressed=true] .module-state-dot{background:var(--blue-300)}
-.module-node[aria-pressed=true][data-tone=active] .module-node-state,.module-node[aria-pressed=true][data-tone=passed] .module-node-state{color:var(--green-600)}
-.module-node[aria-pressed=true][data-tone=active] .module-state-dot,.module-node[aria-pressed=true][data-tone=passed] .module-state-dot{background:var(--green-500)}
-.module-node[aria-pressed=true][data-tone=feedback] .module-node-state,.module-node[aria-pressed=true][data-tone=stopped] .module-node-state{color:var(--amber-600)}
-.module-node[aria-pressed=true][data-tone=feedback] .module-state-dot,.module-node[aria-pressed=true][data-tone=stopped] .module-state-dot{background:var(--amber-500)}
-.module-node[aria-pressed=true][data-tone=failed] .module-node-state{color:var(--red-600)}
-.module-node[aria-pressed=true][data-tone=failed] .module-state-dot{background:var(--red-500)}
-.module-graph>.module-node{grid-template-columns:26px minmax(0,1fr) auto;grid-template-rows:minmax(22px,auto) minmax(18px,auto);min-height:64px;gap:1px 8px}
-.module-graph>.module-node .module-code{grid-row:1/3;align-self:center;justify-content:center}
-.module-graph>.module-node .module-code>svg{width:16px;height:16px}
-.module-graph>.module-node .module-node-name{grid-row:1;grid-column:2}
-.module-graph>.module-node .module-node-subject{grid-row:2;grid-column:2}
-.module-graph>.module-node .module-node-selected{grid-column:3}
-.module-graph>.module-node .module-node-state{grid-row:2;grid-column:3;justify-self:end}
-.module-research{padding:var(--module-inset);border:1px solid transparent;background:transparent}
-.module-cycle{display:grid;grid-template-columns:minmax(0,1fr) var(--module-gap) minmax(0,1fr);grid-template-rows:minmax(103px,auto) 36px minmax(103px,auto);min-width:0}
-.module-cycle>[data-module-id=M3]{grid-area:1/1/2/2}
-.module-cycle>[data-module-id=M4]{grid-area:1/3/2/4}
-.module-cycle>[data-module-id=M2]{grid-area:3/1/4/2}
-.module-cycle>[data-module-id=M1]{grid-area:3/3/4/4}
-.module-edge{position:relative;display:block;min-width:0;color:var(--gray-500);pointer-events:none;transition:color .18s}
-.module-edge::before,.module-edge::after{content:"";position:absolute}
-.module-edge::before{background:currentColor}
-.module-edge::after{width:5px;height:5px;border:solid currentColor;border-width:0 1px 1px 0}
-.module-edge[data-direction=right]::before,.module-edge[data-direction=left]::before{top:50%;left:0;right:0;height:1px}
-.module-edge[data-direction=right]::after{top:calc(50% - 2px);right:2px;transform:rotate(-45deg)}
-.module-edge[data-direction=left]::after{top:calc(50% - 2px);left:2px;transform:rotate(135deg)}
-.module-edge[data-direction=down]::before,.module-edge[data-direction=up]::before{left:50%;top:0;bottom:0;width:1px}
-.module-edge[data-direction=down]::after{left:calc(50% - 2px);bottom:2px;transform:rotate(45deg)}
-.module-edge[data-direction=up]::after{left:calc(50% - 2px);top:2px;transform:rotate(225deg)}
-.module-edge[data-selected=true]{color:var(--blue-600)}
-.module-edge[data-selected=true][data-direction=right]::before,.module-edge[data-selected=true][data-direction=left]::before{height:2px}
-.module-edge[data-selected=true][data-direction=down]::before,.module-edge[data-selected=true][data-direction=up]::before{width:2px}
-.module-edge[data-selected=true]::after{border-width:0 2px 2px 0}
-.module-coordination-edge{height:22px}
-.module-edge-context{grid-area:1/2/2/3}
-.module-edge-retry{grid-area:2/1/3/2}
-.module-edge-construction{grid-area:2/3/3/4}
-.module-edge-feedback{grid-area:3/2/4/3}
-.module-cycle-label{grid-area:2/1/3/4;align-self:center;justify-self:center;display:inline-flex;align-items:center;gap:5px;padding:0 8px;font-size:var(--text-xs);color:var(--gray-500);pointer-events:none}
-.module-cycle-label>svg{width:11px;height:11px}
-.module-acceptance-edge{display:flex;align-items:center;gap:8px;height:34px;margin-left:calc((100% - var(--module-gap) + 2*var(--module-inset) + 2px)/4 - 8px);color:var(--gray-500);font-size:var(--text-xs)}
-.module-acceptance-edge>.module-edge{flex:0 0 16px;height:100%}
-.module-acceptance-edge>.module-edge::before{top:calc(-1px - var(--module-inset))}
-.module-legend{display:flex;align-items:center;justify-content:center;gap:12px;margin-top:16px;color:var(--gray-500);font-size:var(--text-xs);flex-wrap:wrap}
-.module-legend>span{display:inline-flex;align-items:center;gap:5px}
-.module-legend i{width:5px;height:5px;border-radius:50%;background:var(--gray-300)}
-.module-legend .module-selected-key{width:7px;height:7px;border-radius:2px;background:var(--blue)}
-.module-legend .module-recent-key{width:10px;height:6px;border-radius:1px;background:var(--green-500)}
-.module-legend [data-tone=active]{background:var(--green-500)}
-.module-legend [data-tone=observed]{background:var(--gray-400)}
-.module-graph-note{margin-top:8px;text-align:center;color:var(--gray-500);font-size:var(--text-xs);line-height:18px}
-.module-view-heading h3{display:flex;align-items:center;gap:7px}
-.module-configure.icon-button{width:32px;height:32px}
-.module-configure>svg{width:13px;height:13px}
-.module-customizations{margin-top:18px;border-top:1px solid var(--line);padding-top:13px;min-width:0}
-.module-customizations>header{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:7px}
-.module-customizations h4{font-size:var(--text-xs);font-weight:500;color:var(--gray-600)}
-.module-customizations [data-module-custom-count]{font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.module-customizations ol{list-style:none;margin:0;padding:0}
-.module-customization-row{display:flex;align-items:center;gap:3px;min-width:0;border-bottom:1px solid var(--gray-150)}
-.module-customization-row[data-selected=true]{background:var(--gray-100);box-shadow:inset 2px 0 var(--green-600)}
-.module-custom-toggle{display:flex;align-items:center;justify-content:center;flex:0 0 30px;min-height:36px;margin:0;cursor:pointer}
-.module-custom-toggle input[type=checkbox]{display:inline-block;width:15px;height:15px;min-width:15px;margin:0;padding:0;accent-color:var(--green-600)}
-.module-customization{display:grid;grid-template-columns:minmax(0,1fr) 16px;gap:2px 6px;flex:1;width:100%;min-width:0;padding:9px 6px;border:0;border-radius:0;background:transparent;text-align:left}
-.module-customization:hover{background:var(--gray-50)}
-.module-custom-name{grid-column:1;grid-row:1;font-size:var(--text-xs);font-weight:500;color:var(--gray-600);overflow-wrap:anywhere}
-.module-custom-mode{grid-column:1;grid-row:2;font-size:var(--text-xs);color:var(--gray-500)}
-.module-customization [data-module-custom-state]{grid-column:1;grid-row:3;font-size:var(--text-xs);color:var(--gray-500)}
-.module-customization>svg{grid-column:2;grid-row:1/4;align-self:center;width:13px;height:13px;color:var(--gray-400)}
-.module-customization[data-enabled=false] .module-custom-name,.module-customization[data-enabled=false] [data-module-custom-state]{color:var(--gray-500)}
-.module-policies{margin-top:16px;min-width:0}
-.module-policies details{border-top:1px solid var(--gray-150);padding:9px 0;min-width:0}
-.module-policies summary{display:grid;grid-template-columns:minmax(0,1fr) auto 12px;gap:5px;align-items:center;list-style:none;cursor:pointer}
-.module-policies summary::-webkit-details-marker{display:none}
-.module-policies summary>svg{width:12px;height:12px;color:var(--gray-500)}
-.module-policies details[open] summary>svg{transform:rotate(180deg)}
-.module-policies details[data-selected=true]{border-top-color:var(--gray-400)}
-.module-policies details[data-selected=true] .module-policy-name{color:var(--green-700)}
-.module-policy-name{font-size:var(--text-xs);font-weight:500;color:var(--gray-600);overflow-wrap:anywhere}
-.module-policy-state{font-size:var(--text-xs);color:var(--gray-500)}
-.module-policy-mode{font-size:var(--text-xs);color:var(--gray-500);margin-top:7px}
-.module-policy-tools{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;margin-top:7px}
-.module-policy-tools .module-policy-mode{margin:0;overflow-wrap:anywhere}
-.module-policy-edit.icon-button,.module-policy-add.icon-button{width:25px;height:25px}
-.module-policy-edit>svg,.module-policy-add>svg{width:13px;height:13px}
-.module-policy-instructions{margin-top:6px;max-height:180px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--text-xs);line-height:1.8;color:var(--gray-600);scrollbar-width:thin}
-@keyframes module-activity-pulse{0%,100%{box-shadow:0 0 0 0 color-mix(in srgb,var(--green-500) 0%,transparent)}50%{box-shadow:0 0 0 4px color-mix(in srgb,var(--green-500) 14%,transparent)}}
-.module-inspector{min-width:0;border-top:1px solid var(--line);padding-top:19px}
-.module-inspector>header{display:flex;align-items:center;gap:7px;min-height:23px;flex-wrap:wrap}
-.module-inspector h4{margin:0;font-size:var(--text-base);font-weight:600;color:var(--gray-700)}
-.module-inspector-state{font-size:var(--text-xs);color:var(--gray-500);margin-left:auto}
-.module-graph-return.icon-button{width:25px;height:25px;margin-left:3px}
-.module-graph-return>svg{width:13px;height:13px}
-.module-inspector[data-tone=feedback] .module-inspector-state,.module-inspector[data-tone=stopped] .module-inspector-state{color:var(--amber-600)}
-.module-inspector[data-tone=failed] .module-inspector-state{color:var(--red-600)}
-.module-inspector[data-tone=passed] .module-inspector-state{color:var(--green-600)}
-.module-output{font-size:var(--text-xs);color:var(--gray-500);margin-top:8px;overflow-wrap:anywhere}
-.module-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px 18px;margin:20px 0}
-.module-facts>div{min-width:0}
-.module-facts dt{font-size:var(--text-xs);color:var(--gray-500)}
-.module-facts dd{font-size:var(--text-sm);color:var(--gray-600);margin:5px 0 0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
-.module-workers{margin:0 0 18px;min-width:0}
-.module-workers>header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
-.module-workers h4{font-size:var(--text-xs);color:var(--gray-500);font-weight:400}
-.module-workers [data-module-worker-count]{font-size:var(--text-xs);color:var(--gray-500);font-variant-numeric:tabular-nums}
-.module-workers ul{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px;list-style:none;padding:0;margin:0}
-.module-workers li{display:flex;align-items:center;gap:6px;min-width:0;color:var(--green-600);font-size:var(--text-xs);line-height:18px}
-.module-workers li>span{flex:0 0 5px;height:5px;border-radius:50%;background:var(--green-500)}
-.module-workers code{min-width:0;font-family:var(--mono);overflow-wrap:anywhere}
-.module-verification-note{padding-left:10px;border-left:2px solid var(--blue-100);color:var(--gray-500);font-size:var(--text-xs);line-height:1.8;overflow-wrap:anywhere}
-.module-history-heading{display:flex;justify-content:space-between;align-items:center;margin-top:19px}
-.module-history-heading h4{font-size:var(--text-xs)}
-.module-history-heading .icon-button{width:27px;height:27px}
-.module-history-heading .icon-button>svg{width:13px;height:13px}
-.module-retention{font-size:var(--text-xs);color:var(--gray-500);min-height:16px;margin:1px 0 9px}
-.module-events{list-style:none;padding:0;margin:0}
-.module-events li{display:grid;grid-template-columns:52px minmax(0,1fr);gap:9px;border-top:1px solid var(--gray-100);padding:10px 0;min-width:0}
-.module-events time{font-size:var(--text-xs);color:var(--gray-500);line-height:1.9;font-variant-numeric:tabular-nums}
-.module-events p{font-size:var(--text-xs);color:var(--gray-500);line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere;max-height:90px;overflow:auto;scrollbar-width:thin}
-.module-events-empty{font-size:var(--text-xs);color:var(--gray-500);line-height:1.8;padding:12px 0;white-space:pre-wrap;overflow-wrap:anywhere;max-height:140px;overflow:auto}
-.module-destination{margin-top:14px;font-size:var(--text-xs)}
-.module-destination>svg{width:13px;height:13px}
-.module-workspace[data-stale=true] .module-observation{color:var(--amber-600)}
-.module-workspace[data-stale=true] .module-node[data-tone=active]{border-style:dashed}
-.module-workspace[data-stale=true] .module-workers li{color:var(--gray-500)}
-.module-workspace[data-stale=true] .module-workers li>span{background:var(--amber-500)}
-@container (min-width:650px){
- .module-live{grid-template-columns:82px minmax(0,1fr) auto;gap:10px;align-items:center;padding-block:8px;margin-bottom:18px}
- .module-live-heading{flex-direction:column;align-items:flex-start;gap:0}
- .module-live-controls{grid-column:3;grid-row:1}
- .module-live-event{grid-column:2;grid-row:1}
- .module-layout{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:26px}
- .module-inspector{border-top:0;border-left:1px solid var(--line);padding-top:0;padding-left:25px}
- .module-graph-return{display:none}
-}
-@container (max-width:479px){
- .module-view-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 8px;margin-bottom:12px}
- .module-view-heading>div{display:contents}
- .module-view-heading h3{grid-column:1;grid-row:1}
- .module-view-heading p{grid-column:1/-1;grid-row:2;margin-top:0;line-height:18px}
- .module-observation{grid-column:2;grid-row:1;min-height:0;max-width:none;padding-top:3px;font-size:var(--text-xs);line-height:18px}
- .module-live{padding:7px 0 9px;margin:0 0 15px;gap:3px 8px}
- .module-live-event{height:34px;line-height:17px}
- .module-graph{--module-inset:10px;--module-gap:28px}
-}
-@media(max-width:560px){
- .preview-view-tabs{padding-inline:15px}
- .draft-module-panel{padding-inline:15px}
- .module-node{padding:10px 9px}
- .module-inspector-state{font-size:var(--text-xs)}
-}
-.detail-panel[data-tab=events]{display:flex;flex-direction:column;overflow:hidden}
-.activity-workspace{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0}
-.activity-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:32px;margin-bottom:12px;flex-shrink:0}
-.activity-heading>div{display:flex;align-items:center;gap:9px;min-width:0}
-.activity-heading h3{font-size:var(--text-xs);font-weight:600;white-space:nowrap}
-.activity-heading .field-count{white-space:nowrap;font-size:var(--text-xs)}
-.activity-actions{gap:11px!important;flex-shrink:0}
-.activity-actions .text-button{display:inline-flex;align-items:center;gap:4px;font-size:var(--text-xs);white-space:nowrap;min-height:30px}
-.activity-actions svg{width:12px;height:12px}
-#activity-follow[aria-pressed=false]{color:var(--gray-500)}
-.activity-filters{display:flex;align-items:center;gap:8px;margin-bottom:9px;flex-shrink:0;min-width:0}
-.activity-search{display:flex;align-items:center;flex:1;min-width:0;border:1px solid var(--gray-200);border-radius:var(--radius-sm);background:var(--card);padding-left:9px}
-.activity-search>svg{width:13px;height:13px;flex-shrink:0;color:var(--gray-400)}
-.activity-search:focus-within{border-color:var(--green-500);box-shadow:0 0 0 1px color-mix(in srgb,var(--green-500) 19%,transparent)}
-.activity-search input{flex:1;min-width:0;height:34px;padding:6px 7px;border:0;background:transparent;font-size:var(--text-xs)}
-.activity-search input:focus-visible{outline-offset:-2px}
-.activity-search input::-webkit-search-cancel-button{display:none}
-.activity-search .icon-button{width:28px;height:30px;flex-shrink:0;border:0}
-.activity-search .icon-button svg{width:12px;height:12px}
-#activity-type{flex:0 1 150px;max-width:43%;min-width:0;height:36px;font-size:var(--text-xs);padding-inline:8px;text-overflow:ellipsis}
-.activity-context{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:25px;margin-bottom:7px;flex-shrink:0}
-#activity-retention{font-size:var(--text-xs);line-height:1.6;color:var(--gray-500)}
-#activity-latest{flex-shrink:0;font-size:var(--text-xs);min-height:25px;white-space:nowrap}
-.activity-reading-notice{font-size:var(--text-xs);line-height:1.7;color:var(--amber-600);margin:0 0 9px;flex-shrink:0}
-.activity-scroll{flex:1;min-height:0;overflow:auto;border-radius:var(--radius-sm);scrollbar-width:thin;overflow-anchor:none;overscroll-behavior:contain}
-.activity-empty{flex:1;min-height:100px}
-.activity-table{width:100%;border-collapse:collapse;text-align:left;table-layout:fixed;font-size:var(--text-xs)}
-.activity-table th{font-weight:500;color:var(--gray-500);background:var(--card);font-size:var(--text-xs);padding:10px 9px;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1}
-.activity-table td{padding:11px 9px;border-bottom:1px solid var(--gray-100);vertical-align:top;color:var(--gray-500);overflow-wrap:anywhere;white-space:pre-wrap}
-.activity-table th:first-child{width:80px}
-.activity-table td:first-child{font-size:var(--text-xs);color:var(--gray-500)}
-.activity-date{display:block;font-weight:500;color:var(--gray-700)}
-.spinner{width:16px;height:16px;display:inline-block;border:2px solid var(--gray-200);border-top-color:var(--blue-500);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}
-@keyframes spin{to{transform:rotate(360deg)}}
-.toast{position:fixed;z-index:90;inset:auto auto 23px 50%;margin:0;transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);padding:9px 15px;background:var(--gray-900);color:var(--on-ink);border:1px solid var(--gray-700);border-radius:4px;font-size:var(--text-xs);overflow-wrap:anywhere;box-shadow:var(--shadow-md)}
-/* Over an open dialog the toast moves to the top edge, so it never sits on the dialog's own buttons at the bottom. */
-body:has(dialog:modal)>.toast{top:12px;bottom:auto}
-.mobile-switch{display:none}
-.no-script{position:fixed;inset:65px 0 auto;background:var(--amber-50);color:var(--amber-700);padding:20px;text-align:center;border-bottom:1px solid var(--amber-200)}
-.source-editor{width:calc(100% - 40px);max-width:1040px;height:min(760px,88dvh);max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--gray-300);border-radius:var(--radius-md);box-shadow:0 20px 80px color-mix(in srgb,var(--shade) 19%,transparent);overflow:hidden;background:var(--card);color:inherit}
-.source-editor[open]{display:flex;flex-direction:column}
-.source-editor::backdrop{background:color-mix(in srgb,var(--shade) 40%,transparent)}
-.editor-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;border-bottom:1px solid var(--line);flex-shrink:0}
-.editor-heading h2{font-size:var(--text-base);line-height:1.5}
-.editor-heading span{display:block;font-size:var(--text-xs);color:var(--gray-500);margin-top:3px}
-.editor-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0;height:44px;padding:4px 20px;border-bottom:1px solid var(--line);background:var(--gray-25)}
-.editor-tools{display:flex;align-items:center;gap:8px;flex-shrink:0}
-.editor-indent-tools{display:flex;align-items:center;gap:4px;flex-shrink:0}
-.editor-locate-tools{display:flex;align-items:center;gap:4px;padding-left:8px;border-left:1px solid var(--line)}
-.editor-tools .icon-button{width:32px;height:32px}
-.editor-tools svg{width:16px;height:16px}
-.editor-locate-tools [aria-expanded=true]{background:var(--green-100);color:var(--green-700)}
-#editor-position{min-width:0;color:var(--gray-500);font-size:var(--text-xs);line-height:1.5;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
-.editor-navigation{flex-shrink:0;min-width:0;padding:8px 20px;border-bottom:1px solid var(--line);background:var(--gray-25)}
-.editor-navigation .source-find,.editor-navigation .source-line{margin:0}
-#editor-replace-toggle svg{transform:rotate(-90deg)}
-#editor-replace-toggle[aria-expanded=true]{background:var(--green-100);color:var(--green-700)}
-#editor-replace-toggle[aria-expanded=true] svg{transform:none}
-.editor-navigation .editor-replace{margin-top:6px}
-.editor-replace-actions{display:flex;gap:4px;flex-shrink:0}
-.editor-replace .button{min-height:32px;padding:5px 8px;font-size:var(--text-xs);white-space:nowrap}
-.editor-replace-status{margin:6px 0 0;color:var(--gray-500);font-size:var(--text-xs);line-height:1.7;overflow-wrap:anywhere}
-.editor-replace-status.error{color:var(--red-600)}
-#editor-find-position{flex-shrink:0;padding-inline:6px;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap;font-variant-numeric:tabular-nums}
-#editor-line-range{flex-shrink:0;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.editor-navigation .source-line-error{margin:6px 0 0}
-.editor-source-surface{position:relative;flex:1;min-height:0;overflow:hidden}
-textarea.expanded-source{display:block;width:100%;height:100%;min-height:0;resize:none;border:0;border-radius:0;padding:20px 24px;font:var(--text-sm)/1.85 var(--mono);tab-size:2;background:var(--gray-25);scrollbar-width:thin;outline-offset:-3px}
-/* The editor is focused the whole time it is open: a hairline on the pane's own edge, not a second frame inside it. */
-textarea.expanded-source:focus-visible{outline-width:1px;outline-offset:-1px}
-#editor-match-overlay{position:absolute;inset:0;overflow:hidden;pointer-events:none}
-.editor-match-mark{position:absolute;background:color-mix(in srgb,var(--green-500) 24%,transparent);box-shadow:inset 0 -1px color-mix(in srgb,var(--green-500) 50%,transparent);border-radius:2px}
-.editor-review{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;padding:14px 20px 16px;overflow:hidden;background:var(--gray-25)}
-.editor-review-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;flex-shrink:0}
-.editor-review-heading h3{font-size:var(--text-xs);line-height:1.7;color:var(--gray-700);font-weight:600}
-.editor-review-heading p{margin:3px 0 0;font-size:var(--text-xs);line-height:1.7;color:var(--gray-500);overflow-wrap:anywhere}
-.editor-review-target{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;min-width:0}
-.editor-review-target span{font-size:var(--text-xs);line-height:1.7;color:var(--gray-500);font-variant-numeric:tabular-nums}
-.editor-review-target .button{min-height:34px;font-size:var(--text-xs);white-space:nowrap}
-.editor-review .diff-toolbar{flex-shrink:0}
-.editor-review .diff-scroll{flex:1;min-height:0;max-height:none;width:100%}
-.editor-review .diff-truncated{flex-shrink:0;margin:0}
-.editor-review-empty{margin:0;flex:1;min-height:0;overflow:auto;display:grid;place-content:center;text-align:center;padding:24px 16px;border:1px solid var(--gray-150);border-radius:var(--radius-sm);background:var(--gray-50);font-size:var(--text-xs);line-height:1.9;color:var(--gray-500);overflow-wrap:anywhere}
-#editor-review-position{min-width:42px;text-align:center;font-size:var(--text-xs);white-space:nowrap;font-variant-numeric:tabular-nums;color:var(--gray-500)}
-.source-editor .inline-error{flex-shrink:0;margin:0;padding:9px 20px;border-bottom:1px solid var(--gray-200)}
-.editor-footer{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:13px 20px;border-top:1px solid var(--line);flex-shrink:0;background:var(--card)}
-.editor-footer .field-count{font-size:var(--text-xs)}
-.editor-metadata{display:flex;flex-direction:column;gap:3px;min-width:0}
-.editor-change-row{display:flex;align-items:center;flex-wrap:wrap;gap:2px 10px;min-width:0}
-.editor-review-toggle{min-height:28px;padding:3px 0;background:none;border:0;border-radius:2px;font-size:var(--text-xs);line-height:1.5;color:var(--blue-600);cursor:pointer;text-decoration:underline;text-underline-offset:3px;white-space:nowrap}
-.editor-review-toggle:hover{color:var(--blue-700)}
-#editor-change-status{font-size:var(--text-xs);line-height:1.5;color:var(--gray-500);min-height:15px}
-#editor-change-status.modified{color:var(--amber-700)}
-.editor-footer-actions{display:flex;gap:8px;flex-shrink:0}
-.confirm-dialog{width:calc(100% - 32px);max-width:440px;max-height:calc(100dvh - 32px);border:1px solid var(--gray-200);border-radius:12px;padding:0;background:var(--card);color:inherit;box-shadow:0 16px 70px color-mix(in srgb,var(--shade) 19%,transparent);overflow:auto}
-.confirm-dialog::backdrop{background:color-mix(in srgb,var(--shade) 40%,transparent)}
-.confirm-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 18px;border-bottom:1px solid var(--line)}
-.confirm-heading h2{font-size:var(--text-base)}
-.confirm-content{padding:17px 20px 20px;min-width:0}
-.confirm-title{font-size:var(--text-sm);font-weight:500;overflow-wrap:anywhere;white-space:pre-wrap;margin-bottom:7px}
-#delete-description,#editor-discard-description,#cancel-run-description,.confirmation-notice{font-size:var(--text-xs);color:var(--gray-500);line-height:1.85;overflow-wrap:anywhere}
-#delete-download{margin-top:14px;font-size:var(--text-xs);min-height:32px}
-.confirmation-notice{margin-top:14px;color:var(--amber-600)}
-/* When the link was made is a fact, not a warning; the amber stays for notices that block the action. */
-#share-notice{color:var(--gray-500)}
-.confirm-content .inline-error{margin:14px 0 0}
-.confirm-footer{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:13px 20px;border-top:1px solid var(--line)}
-.confirm-footer .button{min-width:78px}
-#stop-share{margin-right:auto}
-.import-dialog{max-width:680px;overflow:hidden}
-.import-dialog[open]{display:flex;flex-direction:column}
-.import-dialog .confirm-heading,.import-dialog .confirm-footer{flex-shrink:0}
-.import-content{padding:18px 20px;min-height:0;overflow-y:auto;scrollbar-width:thin}
-.import-filename{font-size:var(--text-xs);color:var(--gray-600);overflow-wrap:anywhere}
-.import-description{font-size:var(--text-xs);color:var(--gray-500);margin-top:7px}
-.import-facts{margin-top:18px;padding-bottom:18px;border-bottom:1px solid var(--line)}
-.import-preview{padding-top:16px;min-width:0}
-.import-preview h3{font-size:var(--text-xs);color:var(--gray-500);margin-bottom:8px}
-.import-preview .task-content{max-height:110px;overflow:auto;font-size:var(--text-xs)}
-.import-preview .code-scroll{max-height:210px;font-size:var(--text-xs);padding:12px 14px}
-.settings-dialog{width:calc(100% - 48px);max-width:880px;height:min(820px,90dvh);max-height:calc(100dvh - 32px);border:1px solid var(--gray-200);border-radius:14px;padding:0;background:var(--card);color:inherit;overflow:hidden;box-shadow:0 24px 90px color-mix(in srgb,var(--shade) 16%,transparent)}
-.settings-dialog[open]{display:flex;flex-direction:column}
-.settings-dialog::backdrop,.history-dialog::backdrop{background:color-mix(in srgb,var(--shade) 30%,transparent)}
-.settings-dialog::backdrop,.history-dialog::backdrop,.confirm-dialog::backdrop,.source-editor::backdrop,.command-palette::backdrop{backdrop-filter:blur(4px)}
-.settings-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:65px;padding:14px 24px;border-bottom:1px solid var(--line);flex-shrink:0}
-.settings-heading h2{font-size:var(--text-md);font-weight:600}
-.settings-body{display:grid;grid-template-columns:190px minmax(0,1fr);flex:1;min-height:0;overflow:hidden}
-.settings-nav{display:flex;flex-direction:column;gap:5px;min-width:0;padding:20px 10px;border-right:1px solid var(--line);background:var(--gray-50)}
-.settings-nav button{display:flex;align-items:center;gap:9px;min-width:0;min-height:42px;padding:9px 12px;border:0;border-radius:var(--radius-md);background:transparent;color:var(--gray-500);font-size:var(--text-xs);text-align:left}
-.settings-nav button>svg{width:16px;height:16px;flex-shrink:0}
-.settings-nav button:hover{background:var(--gray-100);color:var(--gray-700)}
-.settings-nav button[aria-current]{background:var(--blue-50);color:var(--blue-600);font-weight:500}
-.settings-content{position:relative;min-width:0;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--gray-200) transparent;overscroll-behavior:contain}
-.settings-content .form-section{padding:20px 28px 22px}
-.settings-content .form-section:focus-visible{outline-offset:-2px}
-.settings-content .form-section:last-child{border-bottom:0;min-height:100%}
-.settings-content .section-heading{margin-bottom:16px}
-.settings-content textarea.source-input{height:190px;min-height:140px;background:var(--gray-25);font-size:var(--text-sm)}
-.settings-content .model-grid{grid-template-columns:minmax(0,1fr) 130px}
-.settings-footer{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:14px 24px;border-top:1px solid var(--line);flex-shrink:0;background:var(--card)}
-.settings-footer>div{display:flex;align-items:center;gap:8px}
-.settings-footer .text-button{font-size:var(--text-xs);color:var(--gray-500)}
-.history-dialog{position:fixed;inset:0 auto 0 0;margin:0;width:min(340px,calc(100% - 34px));max-width:none;height:100dvh;max-height:100dvh;padding:0;border:0;border-right:1px solid var(--line);border-radius:0;background:var(--paper);color:inherit;overflow:hidden;box-shadow:8px 0 45px color-mix(in srgb,var(--shade) 10%,transparent)}
-.history-dialog[open]{display:flex}
-.history-dialog .run-list>.empty-state{min-height:200px}
-@media(min-width:1550px){
- .chat-scroll{padding-inline:35px}
- #run-form{padding-inline:32px;padding-bottom:20px}
- .composer-heading{padding-inline:32px}
- .preview-heading,.preview-facts,.preview-task{padding-inline:28px}
- .preview-source{margin-inline:28px}
-}
-@media(min-width:851px) and (max-width:1150px){
- .chat-scroll{padding-inline:20px}
- #run-form{padding-inline:17px}
- .composer-heading{padding-inline:17px}
- .chat-welcome h2{font-size:var(--text-2xl)}
- .detail-actions .button{font-size:var(--text-xs);padding-inline:9px}
- .preview-facts{grid-template-columns:repeat(2,minmax(0,1fr));padding-inline:17px;gap:14px 20px}
- .preview-heading,.preview-task{padding-inline:17px}
- .preview-source{margin-inline:17px}
- .source-switch button{padding-inline:8px;font-size:var(--text-xs)}
- .source-actions{gap:3px}
-}
-@media(max-width:850px){
- .topbar-actions{gap:5px}
- .icon-button{width:36px;height:36px}
- .connection-status{font-size:var(--text-xs);padding-inline:5px}
- .model-menu{max-width:210px;min-height:36px}
- .mobile-switch{display:flex;flex-shrink:0;align-items:center;border-bottom:1px solid var(--line);background:var(--card);padding-inline:20px;gap:27px;z-index:5}
- .mobile-switch>button{display:flex;align-items:center;justify-content:center;gap:7px;min-height:45px;padding:9px 0;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--gray-500);font-size:var(--text-sm)}
- .mobile-switch>button[aria-selected=true]{color:var(--blue);border-bottom-color:var(--blue);font-weight:500}
- .mobile-switch svg{width:15px;height:15px}
- .workspace{display:flex;min-height:0;flex:1}
- .pane-resizer{display:none}
- .composer,.runs-workspace{flex:1;width:100%;height:100%}
- body[data-mobile-view=compose] .runs-workspace,body[data-mobile-view=runs] .composer{display:none}
- .composer-heading{min-height:48px;padding:6px 20px}
- .chat-scroll{padding:15px 24px 24px}
- .chat-thread{max-width:640px}
- .chat-welcome{min-height:230px;padding-block:22px 25px}
- .chat-welcome h2{font-size:var(--text-2xl)}
- .chat-suggestions{margin-top:25px}
- .template-suggestion{min-height:54px}
- #run-form{width:100%;max-width:690px;align-self:center;padding:0 20px 14px}
- .composer-tools>.icon-button{width:36px;height:36px}
- .composer-send .icon-button{width:36px;height:36px}
- .composer-send{min-height:36px}
- .composer-send{margin-right:1px}
- .source-attachment{min-height:30px}
- .composer-source-row{min-height:41px}
- .composer-tools{min-height:47px;padding-top:1px}
- .source-actions .icon-button,.report-actions .icon-button{width:36px;height:36px}
- .preview-heading,.preview-facts,.preview-task{padding-inline:20px}
- .preview-facts{gap:15px 20px}
- .preview-source{margin-inline:20px}
- .global-notice{padding-inline:18px;align-items:flex-start}
- .global-notice>svg{margin-top:2px}
- .global-notice .text-button{font-size:var(--text-xs);min-height:28px}
- .history-search input{height:38px}
- .history-search>svg{top:12px}
- .history-search .icon-button{width:32px;height:32px}
- .history-tools select{height:36px}
- .settings-content .editor-actions .icon-button{width:32px;height:32px}
- .editor-footer .button,.settings-footer .button,.confirm-footer .button{min-height:38px}
-}
-@media(max-width:560px){
- .brand{font-size:16px;gap:6px}
- .brand img{width:23px;height:23px}
- .model-menu{max-width:144px;font-size:var(--text-xs);gap:5px;padding-inline:6px}
- /* Only the model name is left on a phone: the button still opens the settings, and the name reads in full. */
- .model-menu>svg{display:none}
- /* The status keeps only its dot (the label stays in the title and for screen readers), so the model name has room. */
- .connection-status{font-size:0;padding-inline:4px;gap:0}
- .status-dot{width:5px;height:5px}
- .topbar-actions{gap:1px}
- .topbar .palette-trigger{width:30px;height:32px}
- .mobile-switch{padding-inline:18px;gap:26px}
- .composer-heading{padding-inline:17px}
- .composer-heading h1{font-size:var(--text-sm)}
- .chat-scroll{padding:10px 20px 22px}
- .chat-thread{gap:22px}
- .chat-welcome{min-height:190px;padding-block:8px 18px}
- .chat-welcome>img{display:none}
- .chat-welcome h2{font-size:var(--text-2xl)}
- .chat-suggestions{margin-top:22px;gap:7px}
- .template-suggestion{font-size:var(--text-sm);min-height:50px;padding-block:9px}
- #run-form{padding-inline:13px;padding-bottom:12px}
- textarea.chat-input{font-size:var(--text-base);min-height:76px;height:80px;padding-inline:12px}
- .composer-tools{padding-inline:7px}
- .composer-environment{font-size:var(--text-xs);margin-left:2px}
- .composer-tools>.field-count{font-size:var(--text-xs);margin-inline:2px}
- .source-attachment{max-width:68%;font-size:var(--text-xs)}
- .composer-source-row{gap:6px;padding-inline:9px}
- .composer-continuation{padding-inline:9px}
- .draft-status{font-size:var(--text-xs)}
- .runtime-note{font-size:var(--text-xs);margin-top:7px}
- .submission-readiness{padding:7px 10px}
- .detail-actions .button{font-size:var(--text-xs);min-height:34px;padding:6px 8px}
- .detail-actions .button svg{width:13px;height:13px}
- .detail-actions .icon-button{width:34px;height:34px}
- .detail-panel[data-tab=source]{padding-bottom:15px}
- .source-status{font-size:var(--text-xs);gap:5px}
- .source-switch button{min-height:36px;padding-inline:8px;font-size:var(--text-xs)}
- .source-actions{gap:4px}
- .source-actions .icon-button,.report-actions .icon-button{width:34px;height:36px}
- .source-code-grid pre{font-size:var(--text-xs);padding:14px 12px}
- .source-code-grid .source-line-numbers{flex-basis:34px;padding-inline:8px}
- .preview-heading{padding:13px 15px;min-height:75px;gap:9px}
- .preview-heading h2{font-size:var(--text-md)}
- .preview-eyebrow{font-size:var(--text-xs);margin-bottom:3px}
- .preview-status{padding:3px 6px;font-size:var(--text-xs)}
- .preview-facts{grid-template-columns:repeat(2,minmax(0,1fr));padding:14px 15px;gap:12px 17px}
- .preview-facts dt{font-size:var(--text-xs)}
- .preview-facts dd,.preview-facts dd.mono{font-size:var(--text-xs)}
- .preview-source{margin-inline:15px}
- .preview-source-heading{gap:7px;padding-inline:10px}
- .preview-source-heading>span{font-size:var(--text-xs)}
- .draft-source-scroll pre{font-size:var(--text-xs);padding:16px 12px}
- .draft-source-scroll .preview-line-numbers{flex-basis:34px;padding-inline:8px}
- .preview-task{padding:17px 15px 20px}
- .preview-task .task-content{font-size:var(--text-xs);max-height:76px}
- .facts{column-gap:17px}
- .code-scroll:not(.source-code-grid,.result-proof-code){font-size:var(--text-xs);padding:13px 12px}
- .activity-table th:first-child{width:64px}
- .activity-table th,.activity-table td{padding-inline:6px}
- .activity-table{font-size:var(--text-xs)}
- .activity-table td:first-child{font-size:var(--text-xs)}
- .diff-navigation .icon-button{width:36px;height:38px}
- .diff-toggle{min-height:38px}
- .diff-toggle input[type=checkbox]{width:15px;height:15px;min-width:15px}
- .diff-toolbar{gap:7px;padding-top:5px;padding-bottom:9px}
- .diff-scroll-hint{display:inline-flex;flex:1 1 100%;order:4;padding-top:1px}
- .diff-table th:nth-child(-n+2),.diff-line-no{width:4ch;min-width:4ch;padding-inline:5px}
- .diff-code{padding-right:9px}
- .diff-marker{width:15px}
- /* Keep long Lean lines readable on a phone;
- desktop keeps the precise
- single-line diff view and its horizontal scroll affordance. */
- .editor-review .diff-table{table-layout:fixed}
- .editor-review .diff-table th:nth-child(-n+2){width:4ch}
- .editor-review .diff-code{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
- .report-metrics{gap:10px}
- .report-metrics dd{font-size:var(--text-md)}
- .target-heading{flex-wrap:wrap;gap:6px}
- .target-heading code{flex-basis:100%}
- .diagnostic-output{font-size:var(--text-xs);padding:10px}
- .report-actions{gap:4px}
- .settings-dialog{width:calc(100% - 20px);max-height:calc(100dvh - 20px);height:calc(100dvh - 30px);border-radius:var(--radius-md)}
- .settings-heading{padding-inline:16px;min-height:56px}
- .settings-body{display:flex;flex-direction:column}
- .settings-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;flex-shrink:0;padding:0 8px;border-right:0;border-bottom:1px solid var(--line);background:var(--gray-25)}
- .settings-nav button{flex-direction:column;justify-content:center;gap:3px;min-height:61px;padding:7px 2px;border-bottom:2px solid transparent;border-radius:0;text-align:center;font-size:var(--text-xs)}
- .settings-nav button[aria-current]{background:transparent;border-bottom-color:var(--blue)}
- .settings-nav button:focus-visible{outline-offset:-3px}
- .settings-nav button>svg{width:15px;height:15px}
- .settings-content{flex:1}
- .settings-content .form-section{padding:23px 16px 25px}
- .settings-content .model-grid{grid-template-columns:minmax(0,1fr) 105px}
- .limits-grid{gap:9px}
- .settings-footer{padding:12px 14px;gap:8px}
- .settings-footer>div{gap:6px}
- .settings-footer .button{font-size:var(--text-xs);padding-inline:9px}
- .settings-footer .text-button{font-size:var(--text-xs)}
- .source-editor{width:calc(100% - 16px);height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);border-radius:var(--radius-md)}
- .editor-heading{padding:12px 14px}
- textarea.expanded-source{font-size:var(--text-xs);padding:14px}
- .editor-toolbar,.editor-navigation{padding-inline:14px}
- .editor-review{padding:12px 14px}
- .editor-review-target{width:100%}
- .editor-review-target .button{min-height:38px}
- .editor-review-toggle{min-height:36px}
- .editor-toolbar{gap:8px}
- .editor-tools{gap:4px}
- .editor-locate-tools{padding-left:4px}
- .editor-footer{padding:12px 14px;gap:9px;flex-wrap:wrap}
- .editor-footer .field-count{white-space:normal}
- .editor-footer-actions{margin-left:auto}
- .editor-footer .button{padding-inline:11px}
- .source-editor .inline-error{padding-inline:14px}
- .confirm-heading{padding-inline:14px}
- .confirm-content{padding-inline:16px}
- .confirm-footer{padding-inline:16px}
- .toast{font-size:var(--text-xs);bottom:16px}
- .global-notice{display:grid;grid-template-columns:16px minmax(0,1fr) 30px;gap:7px;align-items:center;padding:8px 14px;font-size:var(--text-xs)}
- .global-notice>svg{margin:0}
- .global-notice .text-button{min-height:30px;margin:0;padding:0}
- .global-notice .text-button>span{display:none}
-}
-@media(min-width:851px) and (max-height:820px){
- .chat-welcome{padding-block:12px 28px}
- .chat-welcome>img{display:none}
-}
-@media(max-height:650px){
- .chat-welcome{min-height:160px;padding-block:7px 15px}
- .chat-welcome>img{width:28px;height:28px;margin-bottom:10px}
- .chat-welcome h2{font-size:var(--text-xl)}
- .chat-suggestions{margin-top:16px;gap:6px}
- .template-suggestion{min-height:39px;padding-block:8px}
- textarea.chat-input{min-height:65px;height:65px}
-}
-/*
- * A phone held sideways: the fixed bars above the content leave too little height. The live strip goes (the top bar's
- * progress pill opens the same run), and each pane scrolls as one page, so the send button and the result stay reachable.
- */
-@media(max-height:480px){
- .run-monitor{display:none}
- /* Find/replace and the footer must not collapse the code to a clipped padding strip. */
- .source-editor{overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
- .source-editor .editor-source-surface{flex:1 0 132px;min-height:132px}
- .source-editor .editor-review{flex:1 0 auto}
- .source-editor .editor-review .diff-scroll{flex:0 0 132px;min-height:132px}
- .composer{overflow-y:auto}
- .composer>.chat-scroll{flex:none;overflow:visible;mask-image:none}
- .run-detail{overflow-y:auto}
- .run-detail>.detail-tabs{position:sticky;top:0;z-index:2;background:var(--card)}
- .run-detail>.detail-panel{flex:none;min-height:calc(100dvh - 140px);overflow:visible}
-}
-@media(max-width:380px){
- .brand{font-size:var(--text-md);gap:5px}
- .brand img{width:21px;height:21px}
- .model-menu{max-width:120px;padding-inline:6px}
- .connection-status{font-size:0;padding-inline:4px;gap:0}
- .template-suggestion{gap:8px}
- .composer-environment{max-width:86px}
- .settings-footer{flex-wrap:wrap}
- .settings-footer>div{margin-left:auto}
-}
-@media(pointer:coarse){
- .module-configure.icon-button,.module-graph-return.icon-button,.module-policy-add.icon-button,.module-policy-edit.icon-button{width:38px;height:38px}
- .module-plan-view-actions .icon-button,.module-plan-move,.module-plan-duplicate,.module-plan-delete{width:36px;height:36px}
- .module-library-selection{grid-template-columns:minmax(0,1fr) 36px 36px}
- .module-library .icon-button{width:36px;height:36px}
- .module-plan-toggle{min-height:36px}
-}
-@media(prefers-reduced-motion:reduce){
- *,*::before,*::after{animation:none!important;scroll-behavior:auto!important;transition:none!important}
- .spinner{border-color:var(--green-200);border-top-color:var(--green-600)}
-}
-/* Research collaboration uses runtime observations and keeps its editors mounted. */
-.collaboration-workspace{min-height:100%;background:var(--surface,var(--card))}
-.collab-surface{padding:22px;max-width:1500px;margin:0 auto;color:var(--text,var(--gray-800));font-size:var(--text-sm);line-height:1.6;overflow-wrap:anywhere}
-.detail-panel[data-tab=collaboration]{padding:0}
-.collab-navigation{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:8px;min-width:0;padding:7px 0;margin:0 0 14px;background:var(--card);border-bottom:1px solid var(--gray-150)}
-.collab-nav-links{display:flex;align-items:center;gap:1px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:thin}
-.collab-nav-links button{display:flex;align-items:center;justify-content:center;gap:4px;flex-shrink:0;min-height:34px;padding:6px 5.5px;border:0;border-bottom:2px solid transparent;border-radius:4px 4px 0 0;background:transparent;color:var(--gray-500);font:inherit;font-size:var(--text-xs);white-space:nowrap;cursor:pointer}
-.collab-nav-links button:hover{background:var(--gray-50);color:var(--gray-700)}
-.collab-nav-links button:focus-visible{outline-offset:-2px}
-.collab-nav-links button[aria-current]{color:var(--green-700);border-bottom-color:var(--green-600);background:var(--green-50);font-weight:600}
-.collab-nav-links small{font-size:var(--text-xs);color:var(--gray-500);font-variant-numeric:tabular-nums;font-weight:400}
-.collab-nav-picker{display:none}
-.collab-sync{flex-shrink:0;font-size:var(--text-xs);white-space:nowrap;color:var(--gray-500)}
-.collab-sync[data-connected=false]{color:var(--amber-600)}
-.collab-navigation>[data-collab-nav-guide]{flex-shrink:0;white-space:nowrap;min-height:32px;padding:4px 10px;font-size:var(--text-xs)}
-.collab-surface [data-collab-section]{scroll-margin-top:64px}
-.collab-surface [data-collab-section-heading]:focus-visible,.collab-surface [data-collab-artifact-heading]:focus-visible{outline:2px solid var(--green-600);outline-offset:3px;border-radius:2px}
-.collab-operation-status:empty{display:none}
-.collab-research-overview[data-empty=true] .collab-research-blocker-heading,.collab-research-overview[data-empty=true] [data-research-blockers]{display:none}
-.collab-operation-status{padding:8px 10px;border-left:2px solid var(--green-300);background:var(--gray-50)}
-.collab-operation-status .text-button{font-size:inherit;padding:0 4px;min-height:26px}
-.collab-guidance-meta{display:flex;align-items:flex-start;gap:12px;margin-top:7px}
-.collab-guidance-meta .collab-help{margin:0}
-.collab-guidance-meta [data-guidance-count]{order:2;white-space:nowrap;flex-shrink:0;font-variant-numeric:tabular-nums}
-.collab-guidance-meta [data-guidance-availability]{flex:1}
-@media(max-width:1440px){
- body[data-output-open=true]:not([data-results-expanded=true]) .collab-sync{display:none}
-}
-@media(max-width:1150px){
- .collab-sync{display:none}
-}
-@media(max-width:850px){
- .collab-navigation{gap:8px;padding:6px 0;min-height:46px;margin-bottom:12px}
- .collab-nav-links{display:none}
- .collab-nav-picker{display:block;flex:1;min-width:0}
- .collab-nav-picker select{width:100%;height:34px;padding:4px 28px 4px 10px;background-position:right 8px center}
- .collab-navigation>[data-collab-nav-guide]{min-height:34px}
- .collab-surface [data-collab-section]{scroll-margin-top:56px}
- .collab-guidance .collab-section-heading{flex-wrap:wrap;gap:5px}
- .collab-guidance .collab-section-heading .text-button{font-size:var(--text-xs);min-height:30px;padding:3px 0}
-}
-.collab-heading,.collab-section-heading,.collab-form-footer,.collab-dialog-heading,.collab-dialog-footer{display:flex;align-items:center;justify-content:space-between;gap:12px}
-.collab-heading{flex-wrap:wrap;margin-bottom:10px;min-height:34px}
-.collab-heading>.collab-observation-line{min-width:0;flex:1 1 320px}
-.collab-eyebrow{text-transform:uppercase;color:var(--muted,var(--gray-500));font-size:var(--text-xs);font-weight:600;letter-spacing:.09em}
-.collab-heading-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
-.collab-heading .button,.collab-surface .button,.collab-plan-dialog .button,.server-module-plans .button{font-size:var(--text-xs);min-height:30px;padding:5px 10px;white-space:normal;height:auto;line-height:1.4}
-.collab-metrics{display:grid;grid-template-columns:1fr 1fr 1.4fr;border:1px solid var(--border,var(--gray-200));border-radius:var(--radius-lg);background:var(--card);box-shadow:var(--shadow-sm);margin-bottom:14px;overflow:hidden}
-.collab-metrics>div{padding:16px 20px;min-width:0}
-.collab-metrics>div+div{border-left:1px solid var(--border,var(--gray-150))}
-.collab-metrics span,.collab-metrics small{display:block;color:var(--muted,var(--gray-500));font-size:var(--text-xs)}
-.collab-metrics strong{font-size:var(--text-xl);letter-spacing:-.02em;display:block;font-weight:500;line-height:1.45;margin-top:2px;color:var(--ink)}
-.collab-metrics .collab-accepted,.collab-review-verdict.collab-accepted{color:var(--green-700)}
-.collab-metrics .collab-rejected,.collab-review-verdict.collab-rejected{color:var(--red-600)}
-.collab-meter{display:flex;gap:2px;height:6px;margin:9px 0 6px;border-radius:3px;overflow:hidden;background:var(--gray-100)}
-.collab-meter-legend{display:flex;flex-wrap:wrap;gap:2px 10px;margin:0;padding:0;list-style:none;font-size:var(--text-xs);color:var(--gray-600)}
-.collab-meter-legend li{display:flex;align-items:center;gap:5px;white-space:nowrap}
-.collab-meter-legend li::before{content:"";width:7px;height:7px;border-radius:2px;background:var(--meter)}
-.collab-meter>span{flex:0 1 0;min-width:4px;background:var(--meter)}
-.collab-meter-checked,.collab-meter-working{--meter:var(--green-500)}
-.collab-meter-conditional,.collab-meter-preparing{--meter:var(--amber-300)}
-.collab-meter-running{--meter:var(--blue-500)}
-.collab-meter-blocked,.collab-meter-stopping{--meter:var(--red-300)}
-.collab-meter-pending,.collab-meter-idle,.collab-meter-unscheduled{--meter:var(--gray-300)}
-.collab-meter-stopped{--meter:var(--gray-500)}
-.collab-help{font-size:var(--text-xs);color:var(--muted,var(--gray-500));margin:6px 0 12px;line-height:1.6}
-.collab-error{color:var(--red-600);font-size:var(--text-xs);white-space:pre-wrap}
-.collab-notice{padding:10px;background:var(--gray-50);border:1px solid var(--gray-200);border-radius:var(--radius-md)}
-.collab-empty{padding:28px;background:var(--gray-50);border:1px dashed var(--gray-200);border-radius:var(--radius-lg);color:var(--gray-500)}
-.collab-layout{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(240px,1fr);border:1px solid var(--border,var(--gray-200));border-radius:var(--radius-lg);background:var(--card);box-shadow:var(--shadow-panel);overflow:hidden;margin-top:18px}
-.collab-map{min-width:0;background:var(--gray-25)}
-.collab-section-heading{padding:14px 18px;border-bottom:1px solid var(--border,var(--gray-150))}
-.collab-section-heading h3,.collab-section-heading h4{margin:0;font-size:var(--text-base);letter-spacing:-.01em;font-weight:600;color:var(--ink)}
-.collab-section-heading .collab-help{margin:0;font-size:var(--text-xs)}
-.collab-map .collab-section-heading{flex-wrap:wrap;gap:4px}
-.collab-map-tools{display:flex;gap:8px;padding:12px}
-.collab-map-tools select{max-width:48%}
-.collab-map-tools input{min-width:0;flex:1}
-.collab-surface input,.collab-surface select,.collab-surface textarea,.collab-plan-dialog input,.collab-plan-dialog select,.collab-plan-dialog textarea,.server-module-plans input,.server-module-plans select{font:inherit;font-size:var(--text-xs);border:1px solid var(--border,var(--gray-200));border-radius:var(--radius-md);background-color:var(--surface,var(--card));color:inherit;padding:7px 9px;max-width:100%;min-width:0}
-:is(.collab-surface,.collab-plan-dialog,.server-module-plans) select{padding-right:30px;line-height:1.35;background-position:right 9px center}
-.collab-route-summary{padding:0 12px 10px;display:grid;gap:5px;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-route-summary strong{color:var(--gray-600);font-size:var(--text-xs)}
-.collab-graph-scroll{overflow:auto;max-height:455px;min-height:260px;cursor:grab;background-color:var(--gray-25);background-image:radial-gradient(var(--gray-200) 1px,transparent 1px);background-size:20px 20px}
-.collab-graph{position:relative;min-width:100%}
-.collab-graph-scroll.panning{cursor:grabbing;user-select:none}
-.collab-edges{position:absolute;inset:0;overflow:visible;pointer-events:none}
-.collab-edges path{fill:none;stroke-width:1.5;transition:opacity .15s}
-.collab-edges.has-selection path:not(.related){opacity:.35}
-.collab-edges path.related{stroke-width:2.2}
-.collab-and-edge.related{stroke:var(--green-600)}
-.collab-and-edge{stroke:var(--gray-500)}
-.collab-or-edge{stroke:var(--amber-600);stroke-dasharray:5 4}
-.collab-task{position:absolute;text-align:left;padding:11px 13px;width:218px;height:104px;overflow:hidden;background:var(--card);border:1px solid var(--gray-200);border-radius:var(--radius-md);color:inherit;box-shadow:var(--shadow-sm);font:inherit;cursor:pointer;transition:border-color .16s var(--ease-out),background .16s var(--ease-out),box-shadow .18s var(--ease-out),transform .16s var(--ease-out)}
-.collab-task:hover{border-color:var(--gray-300);box-shadow:var(--shadow-md);transform:translateY(-1px)}
-.collab-task-top{display:flex;justify-content:space-between;color:var(--gray-500);font-size:var(--text-xs);gap:8px}
-.collab-task-kind{display:inline-flex;align-items:center;gap:5px;min-width:0}
-.collab-task-feedback{font-size:10px;line-height:1.4;white-space:nowrap;color:var(--blue-600);background:var(--accent-soft);padding:1px 4px;border-radius:3px}
-.collab-task-feedback[data-feedback-attention=true]{color:var(--amber-700);background:var(--amber-50)}
-.collab-task strong{display:block;font-size:var(--text-xs);font-weight:600}
-.collab-task-objective{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs)}
-.collab-task small{font-size:var(--text-xs);color:var(--gray-500)}
-.collab-task-list{display:none}
-.collab-inspector{min-width:0;border-left:1px solid var(--border,var(--gray-150));background:var(--card);max-height:650px;overflow:auto;border-radius:0 var(--radius-lg) var(--radius-lg) 0}
-.collab-inspector>.collab-section-heading{position:sticky;top:0;background:var(--card);z-index:2}
-.collab-inspector>[data-collab-inspector],.collab-artifact{padding:16px 20px}
-.collab-inspector h4{margin:0 0 10px;font-family:var(--serif);font-size:var(--text-lg);font-weight:500;letter-spacing:-.015em;color:var(--ink)}
-.collab-inspector h5{margin:14px 0 6px;font-size:var(--text-xs);font-weight:600;color:var(--gray-600)}
-.collab-inspector p{margin:4px 0 10px}
-.collab-facts{margin:10px 0;display:grid;gap:6px;font-size:var(--text-xs)}
-.collab-facts>div{display:grid;grid-template-columns:85px minmax(0,1fr);gap:8px}
-.collab-facts dt{color:var(--gray-500)}
-.collab-facts dd{margin:0;overflow-wrap:anywhere;font-family:inherit}
-.collab-code{font-family:var(--mono);font-size:12.5px;line-height:1.72;background:var(--paper);border:1px solid var(--gray-200);border-radius:var(--radius-md);padding:12px 14px;margin:8px 0;white-space:pre-wrap;overflow-wrap:anywhere;max-height:340px;overflow:auto;color:var(--gray-800)}
-.collab-detail{margin:9px 0;border:1px solid var(--gray-200);border-radius:var(--radius-md);padding:8px 11px;background:var(--gray-25);min-width:0}
-.collab-detail>summary{font-size:var(--text-xs);cursor:pointer;color:var(--gray-700);font-weight:500}
-.collab-detail .collab-code{max-height:280px}
-.collab-artifact:empty{display:none}
-.collab-artifact{border-top:1px solid var(--gray-150);background:var(--gray-25)}
-.collab-artifact-links{display:flex;flex-wrap:wrap;gap:6px}
-.collab-agents,.collab-guidance,.collab-edit-records,.collab-knowledge{border:1px solid var(--border,var(--gray-200));border-radius:var(--radius-lg);background:var(--card);box-shadow:var(--shadow-sm);margin-top:18px;overflow:hidden;min-width:0}
-.collab-agent-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1px;background:var(--gray-150)}
-.collab-agent{padding:10px 12px;background:var(--surface,var(--card));min-width:0}
-.collab-agent .collab-section-heading{border:0;padding:0;margin:0 0 4px}
-.collab-agent .collab-facts>div{grid-template-columns:64px minmax(0,1fr)}
-.collab-agent .collab-help{margin-bottom:0}
-.collab-guidance form{padding:12px 14px}
-.collab-guidance-target{display:flex;gap:10px;margin-bottom:8px}
-.collab-guidance-target label{display:flex;align-items:center;gap:7px;font-size:var(--text-xs);white-space:nowrap}
-.collab-guidance textarea{display:block;width:100%;resize:vertical}
-.collab-form-footer{align-items:flex-start;margin-top:9px}
-.collab-form-footer p{margin:0;flex:1}
-.collab-guidance-record{padding:10px 14px;border-top:1px solid var(--gray-150);font-size:var(--text-xs)}
-.collab-guidance-record>div{display:flex;justify-content:space-between;gap:10px}
-.collab-guidance-record p{white-space:pre-wrap;margin:4px 0}
-.collab-guidance-record small{color:var(--gray-500);overflow-wrap:anywhere}
-.collab-edit{padding:12px 14px;border-bottom:1px solid var(--gray-150)}
-.collab-edit:last-child{border:0}
-.collab-edit-records>[data-collab-edits]>.collab-help{padding:0 14px}
-.collab-knowledge>.collab-help,.collab-knowledge>p{padding:0 14px}
-.collab-knowledge-search{display:flex;gap:8px;padding:0 14px 8px;flex-wrap:wrap}
-.collab-knowledge-search input{flex:1;min-width:120px}
-.collab-knowledge-search select{max-width:200px}
-.collab-knowledge-results{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:8px;padding:0 14px}
-.collab-knowledge-hit{text-align:left;display:grid;gap:5px;border:1px solid var(--gray-150);background:var(--gray-25);border-radius:var(--radius-md);padding:10px;min-width:0;font:inherit;cursor:pointer;color:inherit}
-.collab-knowledge-hit code{font-size:var(--text-xs);white-space:pre-wrap;overflow-wrap:anywhere;max-height:70px;overflow:hidden}
-.collab-knowledge-hit small{font-size:var(--text-xs);color:var(--gray-500)}
-.collab-knowledge-detail{padding:0 14px 12px}
-.collab-knowledge-detail>.collab-section-heading{padding-left:0;padding-right:0;margin-top:12px}
-.collab-knowledge-field h5{margin:12px 0 4px;font-size:var(--text-xs)}
-.collab-knowledge-field .collab-code{margin-top:0}
-.collab-plan-dialog{border:1px solid var(--green-200);border-radius:14px;width:min(900px,calc(100vw - 32px));max-height:calc(100dvh - 40px);padding:0;background:var(--surface,var(--card));color:var(--text,var(--gray-800))}
-.collab-plan-dialog::backdrop{background:color-mix(in srgb,var(--shade) 50%,transparent)}
-.collab-dialog-heading{padding:18px 22px;border-bottom:1px solid var(--gray-200)}
-.collab-dialog-heading h2{font-size:var(--text-xl);margin:0}
-.collab-plan-content{padding:16px 22px;max-height:calc(100dvh - 215px);overflow:auto}
-.collab-plan-common{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:12px}
-.collab-plan-common label{display:grid;gap:5px;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-span-all{grid-column:1/-1}
-.collab-plan-common textarea{resize:vertical}
-.collab-plan-common .button{justify-self:start}
-.collab-plan-json{width:100%;min-height:330px;resize:vertical;line-height:1.6}
-.collab-plan-version{font-size:var(--text-xs);display:grid;gap:5px;margin-bottom:14px;overflow-wrap:anywhere}
-.collab-plan-version strong{font-weight:500;color:var(--amber-600)}
-.collab-dialog-footer{padding:14px 22px;border-top:1px solid var(--gray-200);flex-wrap:wrap;justify-content:flex-end}
-.server-module-plans{margin-bottom:15px}
-.server-module-plans{margin-bottom:0}
-.server-module-plans>.collab-detail{margin:0 0 18px;padding:0;border:0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);border-radius:0;background:transparent}
-.server-module-plans>.collab-detail>summary{display:flex;align-items:center;gap:8px;min-height:47px;list-style:none;color:var(--blue-700);font-size:var(--text-sm);font-weight:500}
-.server-module-plans>.collab-detail>summary::-webkit-details-marker{display:none}
-.server-module-plans>.collab-detail>summary>svg{width:16px;height:16px;flex-shrink:0;color:var(--blue-600)}
-.server-module-plans>.collab-detail>summary>svg:last-child{width:12px;height:12px;margin-left:auto;transition:transform .15s}
-.server-module-plans>.collab-detail[open]>summary>svg:last-child{transform:rotate(180deg)}
-.server-plan-content{padding:0 0 17px}
-.server-plan-content .collab-detail{background:var(--gray-50);padding:10px 12px}
-.server-module-plans input,.server-module-plans select{background-color:var(--card);padding:9px 11px;font-size:var(--text-sm)}
-.server-module-plans select{padding:8px 32px 8px 11px;background-position:right 10px center}
-.server-module-plans .collab-catalog-label{color:var(--gray-600);font-weight:500}
-.server-plan-content>label{display:grid;gap:5px;margin:10px 0;font-size:var(--text-xs)}
-.server-plan-selection{display:flex;align-items:flex-end;gap:8px}
-.server-plan-selection label{flex:1;display:grid;gap:5px;margin-bottom:0;font-size:var(--text-xs);min-width:0}
-.server-plan-selection>.button{min-height:40px}
-.server-plan-actions{display:flex;gap:8px}
-.collab-registry-entry{padding:9px 0;border-bottom:1px solid var(--gray-150);display:grid;gap:3px;font-size:var(--text-xs)}
-.collab-registry-entry code,.collab-registry-entry small{overflow-wrap:anywhere;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-catalog-label{display:grid;gap:6px;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-catalog-label select{width:100%}
-@media(min-width:851px) and (max-width:1150px){
- .collab-layout{grid-template-columns:1fr}
- .collab-inspector{border-left:0;border-top:1px solid var(--gray-200);max-height:450px}
- .collab-surface{padding:16px}
-}
-@media(max-width:850px){
- .collab-surface{padding:14px}
- .collab-layout{grid-template-columns:1fr}
- .collab-inspector{border-left:0;border-top:1px solid var(--gray-200);max-height:none}
- .collab-heading{gap:10px}
- .collab-heading-actions{justify-content:flex-start}
- .collab-metrics>div{padding:9px}
- .collab-metrics strong{font-size:var(--text-md)}
- .collab-metrics small{font-size:var(--text-xs)}
- .collab-metrics span{font-size:var(--text-xs)}
- .collab-graph-scroll{display:none}
- .collab-task-list{display:block;padding:0 12px 10px}
- .collab-task-list .collab-task{position:relative;display:block;width:100%;height:auto;max-height:none;min-height:90px}
- .collab-list-deps{font-size:var(--text-xs);color:var(--gray-500);margin:3px 2px 10px}
- .collab-agent-list{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))}
- .collab-plan-common{grid-template-columns:1fr 1fr}
- .collab-plan-common>label:first-child{grid-column:1/-1}
- .collab-plan-content{padding:12px 14px}
- .collab-dialog-heading{padding:12px 14px}
- .collab-dialog-footer{padding:10px 14px;gap:7px}
- .collab-plan-dialog{width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}
- .collab-plan-content{max-height:calc(100dvh - 205px)}
- .collab-guidance-target{flex-wrap:wrap}
- .collab-knowledge-search select{max-width:100%}
- .collab-knowledge-results{grid-template-columns:1fr}
- .collab-facts>div{grid-template-columns:78px minmax(0,1fr)}
- .collab-plan-common .mono{font-size:var(--text-xs)}
- .collab-knowledge-hit{font-size:var(--text-xs)}
-}
-@media(prefers-reduced-motion:reduce){
- .collab-task{transition:none}
-}
-.collab-map-tools>select{flex:0 1 48%;width:48%;max-width:48%}
-.collab-map-tools>input{width:0;flex:1 1 0;min-width:80px}
-.collab-task-view{display:flex;gap:2px;padding:2px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--green-50)}
-.collab-task-view button{border:0;border-radius:var(--radius-sm);background:transparent;padding:4px 8px;min-height:28px;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.collab-task-view button[aria-pressed=true]{background:var(--card);color:var(--green-700);box-shadow:0 1px 3px color-mix(in srgb,var(--shade) 7%,transparent)}
-.collab-map .collab-map-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-bottom:6px}
-.collab-map .collab-map-tools>input{grid-column:1/-1;width:100%;min-width:0}
-.collab-map .collab-map-tools>select{width:100%;max-width:100%}
-.collab-task-result{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:30px;padding:0 12px 8px;color:var(--gray-500);font-size:var(--text-xs)}
-.collab-task-result .text-button{font-size:var(--text-xs);min-height:28px;padding:0 3px}
-.collab-task-selection{margin:0 12px 10px;padding:8px 10px;border-left:2px solid var(--green-300);background:var(--green-50);color:var(--gray-500);font-size:var(--text-xs)}
-.collab-task-selection p{margin:0}
-.collab-task-selection>div{display:flex;gap:10px;flex-wrap:wrap}
-.collab-task-selection .text-button{font-size:var(--text-xs);padding:2px 0;min-height:28px}
-.collab-task-empty{padding:22px 14px 28px;color:var(--gray-500);font-size:var(--text-xs)}
-.collab-task-empty strong{font-size:var(--text-xs);font-weight:500;color:var(--gray-600)}
-.collab-task-empty p{margin-top:6px}
-.collab-map[data-task-empty=true] .collab-graph-scroll,.collab-map[data-task-empty=true] .collab-task-list,.collab-map[data-task-empty=true] .collab-graph-legend{display:none}
-.collab-map>.collab-graph-legend{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;margin:0;padding:0 12px 9px}
-.collab-graph-legend>.collab-help{margin:0}
-.collab-graph-zoom{display:flex;gap:2px;padding:2px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--gray-50)}
-.collab-graph-zoom button{border:0;border-radius:var(--radius-sm);background:transparent;min-width:28px;min-height:28px;padding:0 6px;font:inherit;font-size:var(--text-xs);color:var(--gray-600);cursor:pointer}
-.collab-graph-zoom button:hover:not(:disabled){background:var(--card);color:var(--gray-800)}
-.collab-graph-zoom button:disabled{color:var(--gray-300);cursor:default}
-.collab-graph-zoom [data-collab-graph-zoom-level]{min-width:46px;font-variant-numeric:tabular-nums}
-.collab-map[data-task-view=list] .collab-graph-scroll,.collab-map[data-task-view=list] .collab-graph-legend{display:none}
-.collab-map[data-task-view=list]:not([data-task-empty=true]) .collab-task-list{display:block}
-.collab-task-list{padding:0 12px 10px;max-height:455px;overflow:auto;scrollbar-width:thin}
-.collab-task-list .collab-task{position:relative;display:block;width:100%;height:auto;max-height:none;min-height:90px}
-.collab-task-list .collab-task-objective{white-space:normal;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
-.collab-list-deps{font-size:var(--text-xs);color:var(--gray-500);margin:3px 2px 10px}
-.collab-inspector-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
-.collab-inspector-actions .text-button{font-size:var(--text-xs);padding:2px 0;min-height:28px}
-@media(max-width:850px){
- .collab-task-view,.collab-map>.collab-graph-legend{display:none}
- .collab-task-list{max-height:none;overflow:visible}
- .collab-inspector>.collab-section-heading{flex-wrap:wrap;gap:4px}
- .collab-inspector-actions{gap:12px}
- .collab-task-selection{font-size:var(--text-xs)}
- .collab-task-result{font-size:var(--text-xs)}
-}
-@media(max-width:850px){
- .collab-guidance-target{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
- .collab-guidance-target label{display:grid;gap:4px;min-width:0}
- .collab-guidance-target select{width:100%}
-}
-.server-plan-actions{flex-wrap:wrap}
-.server-plan-deletion{margin-top:10px}
-.server-plan-deletion p{margin:0 0 8px;overflow-wrap:anywhere}
-.collab-task-source{min-width:0}
-.collab-task-source>.collab-section-heading{padding:0;border:0;flex-wrap:wrap;margin-bottom:8px}
-.collab-task-source .source-switch{max-width:100%;flex-wrap:wrap}
-.collab-task-source .source-switch button{font-size:var(--text-xs)}
-.collab-task-source .source-switch button:disabled{opacity:.5;cursor:default}
-.collab-source-comparison-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0}
-.collab-source-comparison-controls>label{display:grid;gap:4px;min-width:0;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-source-comparison-controls select{width:100%}
-.collab-source-identities{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));gap:8px}
-.collab-source-identity{min-width:0;padding:9px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-50)}
-.collab-source-identity h5{margin:0 0 7px}
-.collab-source-identity .collab-facts>div{grid-template-columns:70px minmax(0,1fr)}
-.collab-task-source [data-task-source-body]{min-width:0;max-width:100%}
-.collab-task-source .diff-table{font-size:var(--text-xs)}
-.collab-task-source .diff-toolbar{flex-wrap:wrap}
-.collab-plan-dialog[open]{display:flex;flex-direction:column;overflow:hidden}
-.collab-plan-dialog>.collab-dialog-heading,.collab-plan-dialog>.collab-dialog-footer{flex:none}
-.collab-plan-dialog>.collab-plan-content{flex:1 1 auto;min-height:0;max-height:none}
-.collab-plan-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:12px 0 4px}
-.collab-plan-fields label,.collab-plan-actions label,.collab-plan-picker{display:grid;gap:5px;min-width:0;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-plan-fields textarea{resize:vertical;width:100%}
-.collab-plan-fields input:not([type=checkbox]),.collab-plan-fields select,.collab-plan-picker select{width:100%}
-.collab-plan-fields .collab-plan-check{display:flex;align-items:center;gap:8px}
-.collab-plan-check input{margin:0;flex:none}
-.collab-plan-actions{display:flex;align-items:flex-end;gap:9px;flex-wrap:wrap;margin:12px 0}
-.collab-plan-picker{margin-top:12px}
-.collab-plan-dialog [data-plan-task-note]{margin:10px 0}
-.collab-plan-dialog [data-plan-remove-task],.collab-plan-dialog [data-plan-remove-route],.collab-plan-dialog [data-plan-remove-group]{color:var(--amber-700)}
-.collab-plan-dialog :disabled{opacity:.65}
-.collab-plan-dialog [hidden]{display:none!important}
-@media(max-width:560px){
- .collab-plan-fields{grid-template-columns:minmax(0,1fr)}
- .collab-plan-common{grid-template-columns:minmax(0,1fr)}
- .collab-plan-actions{align-items:stretch}
- .collab-plan-actions>label{flex:1 1 100%}
- .collab-plan-actions>.button{flex:1}
- .collab-plan-dialog .collab-detail{padding-left:10px;padding-right:10px}
- .collab-plan-content>.collab-detail>summary{overflow-wrap:anywhere}
-}
-.collab-source-diff{max-height:340px;max-width:100%;overflow:auto;border:1px solid var(--gray-150);border-radius:var(--radius-sm);background:var(--gray-25);scrollbar-width:thin}
-@media(max-width:560px){
- .collab-source-comparison-controls{grid-template-columns:1fr}
-}
-.collab-reviews{min-width:0;margin:16px 0;border:1px solid var(--border,var(--gray-150));border-radius:var(--radius-lg);overflow:hidden;background:var(--surface,var(--card))}
-.collab-reviews>.collab-section-heading{flex-wrap:wrap}
-.collab-review-verdicts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border-bottom:1px solid var(--gray-200)}
-.collab-review-verdicts>article{min-width:0;padding:12px;font-size:var(--text-xs);overflow-wrap:anywhere}
-.collab-review-verdicts>article+article{border-left:1px solid var(--gray-200)}
-.collab-reviews h4{font-size:var(--text-sm);margin:0 0 10px}
-.collab-reviews h5{font-size:var(--text-xs);margin:12px 0 6px}
-.collab-review-verdict{display:block;margin:8px 0;font-size:var(--text-md);line-height:1.5}
-.collab-review-statements{padding:12px 12px 0}
-.collab-review-statements h4{margin-bottom:6px}
-.collab-review-statements .collab-help{margin-bottom:0}
-.collab-review-filters{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px;padding:12px}
-.collab-review-filters label{display:grid;gap:5px;flex:1 1 120px;min-width:0;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-review-filters label:last-of-type{flex:2 1 160px}
-.collab-review-filters input,.collab-review-filters select{width:100%;min-width:0}
-.collab-review-filters .button{flex:none}
-.collab-review-layout{display:grid;grid-template-columns:minmax(155px,28%) minmax(0,1fr);border-top:1px solid var(--gray-150);min-width:0}
-.collab-review-list{min-width:0;max-height:630px;overflow:auto;border-right:1px solid var(--gray-150);padding:8px;scrollbar-width:thin}
-.collab-review-choice{display:grid;gap:6px;width:100%;min-width:0;text-align:left;border:1px solid var(--gray-150);background:var(--gray-25);border-radius:var(--radius-md);padding:10px;margin:0 0 8px;color:var(--gray-700);cursor:pointer;overflow-wrap:anywhere}
-.collab-review-choice.selected{border-color:var(--green-500);background:var(--green-50)}
-.collab-review-choice:focus-visible{outline:2px solid var(--green-600);outline-offset:1px}
-.collab-review-choice span,.collab-review-choice small,.collab-review-choice code{font-size:var(--text-xs);color:var(--gray-500)}
-.collab-review-choice strong{font-size:var(--text-xs)}
-.collab-review-choice small{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
-.collab-review-detail{min-width:0;max-height:630px;overflow:auto;padding:12px;font-size:var(--text-xs);scrollbar-width:thin}
-.collab-review-task-ref{display:grid;gap:4px;margin:6px 0;overflow-wrap:anywhere}
-.collab-review-task-ref code{font-size:var(--text-xs);color:var(--gray-500)}
-.collab-review-comparison{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
-.collab-review-comparison>div{min-width:0}
-.collab-reviews .collab-code{max-height:240px;white-space:pre-wrap;overflow-wrap:anywhere}
-.collab-review-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 12px;border-top:1px solid var(--gray-150)}
-.collab-review-actions .collab-help{margin:0}
-@media(max-width:850px){
- .collab-review-verdicts,.collab-review-layout,.collab-review-comparison{grid-template-columns:minmax(0,1fr)}
- .collab-review-verdicts>article+article{border-left:0;border-top:1px solid var(--gray-150)}
- .collab-review-list{max-height:240px;border-right:0;border-bottom:1px solid var(--gray-150)}
- .collab-review-detail{max-height:560px}
- .collab-review-filters label,.collab-review-filters label:last-of-type{flex:1 1 calc(50% - 8px)}
- .collab-review-filters label:last-of-type{flex-basis:100%}
-}
-@media(max-width:560px){
- .collab-metrics{grid-template-columns:1fr 1fr}
- .collab-metrics>div:last-child{grid-column:1/-1;border-left:0;border-top:1px solid var(--border,var(--gray-150))}
-}
-.collab-guidance-recovery{display:flex;flex-wrap:wrap;gap:8px;margin-top:9px}
-.collab-guidance-recovery:has(>button:not([hidden])){padding-top:2px}
-.collab-guidance [data-guidance-context]{margin-bottom:8px;min-width:0}
-.collab-guidance [data-guidance-context]:empty{display:none}
-.collab-guidance [data-guidance-confirm-version]{margin-bottom:8px}
-.collab-guidance [data-guidance-pending]{overflow-wrap:anywhere}
-.collab-guidance-target label{min-width:0;max-width:100%}
-.collab-guidance-target select{min-width:0;max-width:100%}
-.collab-guidance-record>div{flex-wrap:wrap}
-.collab-guidance-record strong{overflow-wrap:anywhere;min-width:0}
-.collab-research-overview,.collab-deliveries{min-width:0;margin:16px 0;border:1px solid var(--border,var(--gray-150));border-radius:var(--radius-lg);overflow:hidden;background:var(--surface,var(--card))}
-.collab-research-overview>.collab-section-heading,.collab-deliveries>.collab-section-heading{flex-wrap:wrap}
-.collab-frontier-list,.collab-blocker-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(230px,100%),1fr));gap:10px;padding:12px;max-height:360px;overflow:auto}
-.collab-frontier-list>.collab-help,.collab-blocker-list>.collab-help{margin:0}
-.collab-frontier-goal,.collab-research-blocker{min-width:0;padding:10px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25);font-size:var(--text-xs);overflow-wrap:anywhere}
-.collab-frontier-goal>.collab-section-heading,.collab-research-blocker>.collab-section-heading{padding:0 0 7px;margin:0;border:0;flex-wrap:wrap}
-.collab-frontier-route{border-left:2px solid var(--gray-200);padding:6px 0 6px 9px;margin-top:7px}
-.collab-frontier-route p{margin:5px 0 0;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-route-steps{display:grid;gap:4px;margin:7px 0 8px;padding:0;list-style:none}
-.collab-route-steps li{position:relative;display:flex;flex-wrap:wrap;gap:0 8px;padding-left:18px;color:var(--gray-600)}
-.collab-route-steps li::before{content:"";position:absolute;left:2px;top:4px;width:8px;height:8px;border-radius:50%;border:1.5px solid var(--gray-400);background:var(--card)}
-.collab-route-steps li+li::after{content:"";position:absolute;left:6px;top:-6px;height:9px;border-left:1.5px solid var(--gray-200)}
-.collab-route-steps li[data-step-state=done]::before{border-color:var(--green-600);background:var(--green-500)}
-.collab-route-steps li[data-step-state=partial]::before{border-color:var(--amber-600);background:var(--amber-200)}
-.collab-route-steps strong{font-weight:500;color:var(--gray-800)}
-.collab-reference-caption{color:var(--gray-500)}
-.collab-blocker-mechanism{font-size:var(--text-xs);padding:1px 5px;border-radius:var(--radius-sm);background:var(--gray-100);color:var(--gray-800);overflow-wrap:anywhere}
-.collab-reference-list{display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center}
-.collab-reference{font-size:var(--text-xs);overflow-wrap:anywhere;max-width:100%;text-align:left}
-.collab-research-waiting{padding:10px 14px;background:var(--amber-50);border-top:1px solid var(--gray-200);font-size:var(--text-xs);overflow-wrap:anywhere}
-.collab-research-waiting p{margin:5px 0}
-.collab-delivery-intro{margin:0;padding:10px 14px 0}
-.collab-delivery-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;padding:10px 14px 12px}
-.collab-delivery-filters label{display:grid;gap:4px;min-width:0;flex:1 1 120px;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-delivery-filters select,.collab-delivery-filters input{width:100%;min-width:0}
-.collab-delivery-filters label:has(input){flex:2 1 170px}
-.collab-delivery-layout{display:grid;grid-template-columns:minmax(180px,.8fr) minmax(0,1.4fr);border-top:1px solid var(--gray-150)}
-.collab-delivery-list{min-width:0;max-height:580px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;overflow-anchor:none}
-.collab-delivery-list>.collab-help{padding:10px 14px}
-.collab-delivery-row{border-bottom:1px solid var(--gray-150)}
-.collab-delivery-choice{display:grid;width:100%;min-width:0;padding:12px;text-align:left;font:inherit;color:inherit;background:transparent;border:0;cursor:pointer;gap:7px}
-.collab-delivery-choice:hover{background:var(--gray-50)}
-.collab-delivery-choice.selected{background:var(--green-50);box-shadow:inset 3px 0 var(--gray-400)}
-.collab-delivery-choice:focus-visible{outline:2px solid var(--green-500);outline-offset:-3px}
-.collab-delivery-meta{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:5px;font-size:var(--text-xs);overflow-wrap:anywhere}
-.collab-delivery-meta>span,.collab-delivery-choice small{font-size:var(--text-xs);color:var(--gray-500)}
-.collab-delivery-summary{font-size:var(--text-xs);line-height:1.6;max-height:5em;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap}
-.collab-delivery-detail{min-width:0;padding:12px 14px;border-left:1px solid var(--gray-150);max-height:580px;overflow:auto;overscroll-behavior:contain}
-.collab-delivery-detail h4{margin:0 0 8px;font-size:var(--text-sm);overflow-wrap:anywhere}
-.collab-delivery-detail h5{margin:14px 0 6px;font-size:var(--text-xs)}
-.collab-delivery-detail .collab-facts>div{grid-template-columns:74px minmax(0,1fr)}
-.collab-delivery-text{white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--text-xs);line-height:1.7}
-.collab-inspected-version{display:grid;gap:4px;font-size:var(--text-xs);margin:10px 0;overflow-wrap:anywhere}
-.collab-inspected-version>span{color:var(--gray-500)}
-.collab-agent-actions{display:flex;gap:10px;flex-wrap:wrap}
-.collab-inspector [data-task-history-notice]{overflow-wrap:anywhere}
-@media(max-width:850px){
- .collab-delivery-layout{grid-template-columns:1fr}
- .collab-delivery-list{max-height:320px}
- .collab-delivery-detail{border-left:0;border-top:1px solid var(--gray-150);max-height:none}
- .collab-frontier-list,.collab-blocker-list{grid-template-columns:1fr;max-height:360px}
- .collab-delivery-filters{padding:10px 12px}
- .collab-delivery-filters .button{font-size:var(--text-xs)}
- .collab-delivery-detail{padding:12px}
- .collab-research-overview .collab-section-heading>.collab-help{font-size:var(--text-xs)}
-}
-.collab-agent-assignment{display:flex;align-items:center;gap:8px;font-size:var(--text-xs);margin:6px 0}
-.collab-agent-assignment>span:first-child{color:var(--gray-500);min-width:64px}
-.collab-agent-assignment .text-button{font-size:var(--text-xs)}
-.collab-archives{border:1px solid var(--border,var(--gray-150));border-radius:var(--radius-lg);margin-top:16px;overflow:hidden}
-.collab-archive{padding:10px 14px;border-bottom:1px solid var(--gray-150)}
-.collab-archive:last-child{border-bottom:0}
-.collab-archive>.collab-section-heading{padding:0;border:0;font-size:var(--text-xs)}
-.collab-archives>[data-collab-archives]>.collab-help{padding:0 14px}
-.collab-math-changes{min-width:0;margin-top:16px;border:1px solid var(--border,var(--gray-150));border-radius:var(--radius-lg);overflow:hidden;background:var(--surface,var(--card))}
-.collab-math-changes>.collab-section-heading{flex-wrap:wrap}
-.collab-math-coverage{padding:10px 14px 0;margin:0}
-.collab-math-filters{display:flex;align-items:flex-end;flex-wrap:wrap;gap:8px;padding:10px 14px 12px}
-.collab-math-filters label{display:grid;gap:4px;min-width:0;flex:1 1 120px;font-size:var(--text-xs);color:var(--gray-500)}
-.collab-math-filters label:has(input){flex:2 1 170px}
-.collab-math-filters select,.collab-math-filters input{width:100%;min-width:0}
-.collab-math-layout{display:grid;grid-template-columns:minmax(160px,.7fr) minmax(0,1.6fr);border-top:1px solid var(--gray-150)}
-.collab-math-list{min-width:0;max-height:610px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;overflow-anchor:none}
-.collab-math-list>.collab-help{padding:10px 14px}
-.collab-math-row{border-bottom:1px solid var(--gray-150)}
-.collab-math-choice{display:grid;gap:8px;width:100%;min-width:0;padding:12px;text-align:left;font:inherit;font-size:var(--text-xs);color:inherit;background:transparent;border:0;cursor:pointer;overflow-wrap:anywhere}
-.collab-math-choice:hover{background:var(--gray-50)}
-.collab-math-choice.selected{background:var(--green-50);box-shadow:inset 3px 0 var(--gray-400)}
-.collab-math-choice:focus-visible{outline:2px solid var(--green-500);outline-offset:-3px}
-.collab-math-choice>strong{font-weight:500}
-.collab-math-choice>small,.collab-math-meta{color:var(--gray-500);font-size:var(--text-xs)}
-.collab-math-meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:5px}
-.collab-math-detail{min-width:0;max-height:610px;overflow:auto;overscroll-behavior:contain;padding:12px 14px;border-left:1px solid var(--gray-150);font-size:var(--text-xs)}
-.collab-math-detail h4{font-size:var(--text-sm);margin:0 0 8px}
-.collab-math-detail h5{font-size:var(--text-xs);margin:18px 0 7px}
-.collab-math-detail h6{font-size:var(--text-xs);color:var(--gray-500);margin:0 0 7px;font-weight:500}
-.collab-math-delta{border:1px solid var(--gray-150);border-radius:var(--radius-md);padding:9px;margin:8px 0;background:var(--gray-25)}
-.collab-math-delta>strong{font-size:var(--text-xs);font-weight:500}
-.collab-math-sides{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:10px}
-.collab-math-sides>div{min-width:0}
-.collab-math-sides>div+div{border-left:1px solid var(--gray-150);padding-left:12px}
-.collab-math-reference{min-width:0;max-width:100%;margin-bottom:6px}
-.collab-math-reference>code{display:block;color:var(--gray-500);font-size:var(--text-xs);overflow-wrap:anywhere;margin-top:3px}
-.collab-math-delta .collab-facts>div{grid-template-columns:68px minmax(0,1fr);gap:6px}
-.collab-math-delta .collab-help{font-size:var(--text-xs);margin-bottom:6px}
-.collab-math-actions{padding:10px 14px;border-top:1px solid var(--gray-150);display:flex;align-items:center;flex-wrap:wrap;gap:8px}
-.collab-math-actions .collab-help{flex:1 1 160px;margin:0}
-.collab-math-actions button:disabled{opacity:.5;cursor:default}
-@media(max-width:1150px){
- .collab-math-sides{grid-template-columns:1fr}
- .collab-math-sides>div+div{border-left:0;padding-left:0;border-top:1px solid var(--gray-150);padding-top:10px}
-}
-@media(max-width:850px){
- .collab-math-layout{grid-template-columns:1fr}
- .collab-math-list{max-height:300px}
- .collab-math-detail{max-height:none;border-left:0;border-top:1px solid var(--gray-150);padding:12px}
- .collab-math-filters,.collab-math-actions{padding:10px 12px}
- .collab-math-coverage{padding:10px 12px 0}
-}
-/* Top bar extras and the command palette (Preact components in ui/). */
-.live-pill{display:inline-flex;align-items:center;gap:7px;min-width:0;max-width:300px;height:28px;padding:0 11px 0 9px;border:1px solid var(--blue-100);border-radius:999px;background:var(--blue-50);color:var(--blue-700);font-size:var(--text-xs);font-weight:500;white-space:nowrap;box-shadow:var(--shadow-sm);transition:background .15s,border-color .15s}
-.live-pill:hover{background:var(--blue-100);border-color:var(--blue-200)}
-.live-pill-dot{position:relative;width:7px;height:7px;flex-shrink:0;border-radius:50%;background:var(--blue-500)}
-.live-pill-dot::after{content:"";position:absolute;inset:-3px;border-radius:50%;border:1.5px solid var(--blue-300);animation:live-ring 1.8s ease-out infinite}
-.live-pill-label{overflow:hidden;text-overflow:ellipsis}
-.live-pill-detail{color:var(--blue-600);font-family:var(--sans);font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
-.live-pill-detail:empty{display:none}
-@keyframes live-ring{0%{opacity:.9;transform:scale(.6)}80%,100%{opacity:0;transform:scale(1.6)}}
-@media(min-width:851px){
- .topbar .model-menu{height:32px;min-height:32px;border-radius:999px;border-color:var(--gray-200);background:var(--card);padding-inline:12px 10px}
- .connection-status{height:32px;min-height:32px;padding-inline:8px 4px}
-}
-kbd{display:inline-flex;align-items:center;height:20px;padding:0 5px;border:1px solid var(--gray-200);border-bottom-width:2px;border-radius:4px;background:var(--card);color:var(--gray-500);font:500 var(--text-xs)/1 var(--mono)}
-.topbar .model-menu{min-height:32px}
-
-.command-palette{width:min(620px,calc(100% - 24px));max-width:none;margin:12vh auto auto;padding:0;border:1px solid var(--gray-200);border-radius:12px;background:var(--card);color:inherit;overflow:hidden;box-shadow:0 24px 60px -12px color-mix(in srgb,var(--shade) 28%,transparent),0 2px 6px color-mix(in srgb,var(--shade) 8%,transparent)}
-.command-palette::backdrop{background:color-mix(in srgb,var(--shade) 36%,transparent);backdrop-filter:blur(6px)}
-.palette-search{display:flex;align-items:center;gap:10px;height:52px;padding:0 14px;border-bottom:1px solid var(--line);color:var(--gray-400)}
-.palette-search input{flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font-size:var(--text-md);color:var(--gray-900)}
-.palette-options{max-height:min(420px,56vh);overflow-y:auto;margin:0;padding:6px;list-style:none;scrollbar-width:thin}
-.palette-group{padding:10px 10px 4px;font-size:12px;font-weight:500;color:var(--gray-500)}
-.palette-options button{display:flex;align-items:center;gap:10px;width:100%;min-height:38px;padding:7px 10px;border:0;border-radius:var(--radius-md);background:transparent;color:var(--gray-700);font-size:var(--text-sm);text-align:left}
-.palette-options button>svg{width:15px;height:15px;color:var(--gray-400)}
-.palette-options button[aria-selected=true]{background:var(--gray-100);color:var(--gray-900)}
-.palette-options button[aria-selected=true]>svg{color:var(--gray-600)}
-.palette-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.palette-label .katex{font-size:.95em}
-.palette-label:has(.katex){white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;line-height:1.5}
-.palette-hint{flex-shrink:0;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);color:var(--gray-500)}
-/* On a phone the hint is a second line under the label, so neither is cut off; the icons stay centred on both lines. */
-@media(max-width:560px){.palette-options button:has(>.palette-hint){display:grid;grid-template-columns:15px minmax(0,1fr) auto;column-gap:10px;row-gap:1px}
- .palette-options button:has(>.palette-hint)>svg:first-child{grid-column:1;grid-row:1/3}
- .palette-options button:has(>.palette-hint)>.palette-label{grid-column:2;grid-row:1}
- .palette-options button:has(>.palette-hint)>.palette-hint{grid-column:2;grid-row:2;max-width:none;white-space:normal;line-height:1.4}
- .palette-options button:has(>.palette-hint)>svg:last-child:not(:first-child){grid-column:3;grid-row:1/3}}
-.palette-empty{padding:28px 10px;text-align:center;color:var(--gray-500);font-size:var(--text-sm)}
-
-@media(max-width:850px){
- .topbar{height:54px;gap:10px;padding-inline:12px}
- .run-monitor{padding-inline:12px}
- .run-monitor-entry{flex-basis:220px}
-}
-@media(max-width:560px){
- .live-pill{display:none}
- .command-palette{margin-top:8vh}
-}
-/* Collaboration board: task graph/list cards, agents and progress meters (ui/TaskBoard, ui/AgentCards, ui/ProgressSummary). */
-.collab-meter>span{flex:0 0 auto;min-width:4px;transition:width .45s cubic-bezier(.3,.7,.2,1)}
-.collab-meter{gap:0}
-.collab-meter>span+span{box-shadow:inset 2px 0 0 var(--gray-25)}
-.collab-metrics{background:var(--card)}
-.collab-metrics strong{font-variant-numeric:tabular-nums;color:var(--gray-900)}
-
-.collab-graph-scroll{max-height:560px;padding-bottom:52px;background-color:var(--gray-25);background-image:radial-gradient(var(--gray-200) .8px,transparent .8px);background-size:18px 18px}
-.collab-task{--task-tone:var(--gray-300);border-left:3px solid var(--task-tone);border-radius:4px;padding-left:11px;box-shadow:var(--shadow-sm);transition:box-shadow .2s,border-color .2s,opacity .25s,background-color .2s}
-.collab-graph .collab-task{transition:border-color .15s,background .15s,box-shadow .15s,opacity .2s,left .35s cubic-bezier(.3,.7,.2,1),top .35s cubic-bezier(.3,.7,.2,1)}
-.collab-task:hover{border-color:var(--gray-300);border-left-color:var(--task-tone);box-shadow:var(--shadow-md)}
-.collab-task[data-task-state=running],.collab-task[data-task-state=delivered],.collab-task[data-task-state=integrated]{--task-tone:var(--blue-500)}
-.collab-task[data-task-state=blocked],.collab-task[data-task-state=stopped]{--task-tone:var(--red-300)}
-.collab-task[data-task-state=paused],.collab-task[data-task-state=conditional]{--task-tone:var(--amber-300)}
-.collab-task[data-task-proof=conditional]{--task-tone:var(--amber-500)}
-.collab-task[data-task-proof=checked],.collab-task[data-task-state=completed]{--task-tone:var(--green-500)}
-/* One mark for the inspected task, the ink border the sample cards use; keyboard focus keeps the global outline. */
-.collab-task.selected{border-color:var(--task-tone,var(--blue-600));border-left-color:var(--task-tone,var(--blue-600));background:var(--card);box-shadow:var(--shadow-md),0 0 0 3px color-mix(in srgb,var(--task-tone,var(--blue-500)) 16%,transparent)}
-.collab-task.dimmed{opacity:.32}
-.collab-task[data-changed]{animation:task-settled .9s var(--ease-out)}
-@keyframes task-settled{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--green-500) 55%,transparent),var(--shadow-sm)}100%{box-shadow:0 0 0 14px color-mix(in srgb,var(--green-500) 0%,transparent),var(--shadow-sm)}}
-.collab-task-top>span:first-child{text-transform:none;letter-spacing:0}
-.collab-task-state{display:inline-flex;align-items:center;gap:5px}
-.collab-task-state::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--task-tone)}
-.collab-task[data-task-state=running] .collab-task-state{color:var(--blue-600)}
-.collab-task[data-task-state=running] .collab-task-state::before{animation:stage-pulse 1.4s ease-in-out infinite}
-.collab-task strong{font-size:var(--text-sm);color:var(--gray-900);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.collab-task-objective{color:var(--gray-600)}
-.collab-edges path{transition:stroke .25s,opacity .25s,stroke-width .25s}
-.collab-edges.tracing path:not(.related){opacity:.12}
-.collab-edges.tracing path.related{stroke-width:2.4}
-.collab-edges.tracing .collab-and-edge.related{stroke:var(--gray-800)}
-.collab-and-edge.related{stroke:var(--gray-800)}
-.collab-or-edge.related{stroke:var(--amber-600)}
-.collab-task-list .collab-task{border-left-width:3px}
-
-.collab-agent-list{grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px;padding:12px;background:var(--gray-25)}
-.collab-agent{--agent-tone:var(--gray-300);border:1px solid var(--gray-150);border-radius:var(--radius-lg);padding:12px 14px;transition:border-color .15s,box-shadow .15s}
-.collab-agent:hover{border-color:var(--gray-300)}
-.collab-agent[data-agent-state=working]{--agent-tone:var(--green-500)}
-.collab-agent[data-agent-state=preparing]{--agent-tone:var(--amber-500)}
-.collab-agent[data-agent-state=stopping]{--agent-tone:var(--red-300)}
-.collab-agent[data-agent-state=stopped]{--agent-tone:var(--gray-500)}
-.collab-agent .collab-section-heading strong{display:inline-flex;align-items:center;gap:8px;font-size:var(--text-sm);color:var(--gray-900)}
-.collab-agent-dot{position:relative;width:8px;height:8px;border-radius:50%;background:var(--agent-tone)}
-.collab-agent[data-agent-state=working] .collab-agent-dot::after{content:"";position:absolute;inset:-3px;border-radius:50%;border:1.5px solid var(--green-300);animation:live-ring 1.8s ease-out infinite}
-.collab-agent .collab-eyebrow{text-transform:none;letter-spacing:0;color:var(--gray-500);font-weight:500}
-.collab-agent .collab-facts{margin-top:8px}
-.collab-agent-assignment{margin-top:8px;padding-top:8px;border-top:1px dashed var(--gray-150)}
-.collab-agent-idle{color:var(--gray-500)}
-@media(max-width:560px){
- .collab-agent-list{padding:8px;gap:8px;grid-template-columns:1fr}
-}
-@media(prefers-reduced-motion:reduce){
- .collab-graph .collab-task{transition:none}
-}
-.collab-map .collab-section-heading{padding-block:10px}
-@media(min-width:1151px){
- .collab-map .collab-map-tools{grid-template-columns:minmax(0,1fr) minmax(0,150px) minmax(0,130px);padding:10px 12px 6px}
- .collab-map .collab-map-tools>input{grid-column:auto}
-}
-.collab-map .collab-map-tools>input,.collab-map .collab-map-tools>select{min-height:34px;font-size:var(--text-sm)}
-.collab-task-result{min-height:26px;padding-bottom:4px}
-.collab-graph-frame{position:relative;border-top:1px solid var(--gray-150)}
-.collab-graph-frame[data-expanded=true]{position:fixed;inset:14px;z-index:1300;display:flex;flex-direction:column;border:1px solid var(--gray-200);border-radius:16px;background:var(--card);box-shadow:0 0 0 40px rgb(20 20 19/.52);overflow:hidden}
-.collab-graph-frame[data-expanded=true]>.collab-graph-scroll{flex:1;max-height:none;height:100%}
-.collab-graph-zoom .collab-graph-expand{margin-left:3px;padding:0 9px;background:#141413;color:#f5f4ee;font-weight:600}
-.collab-graph-zoom .collab-graph-expand:hover{background:#2d2c28;color:#f5f4ee}
-:root[data-theme=dark] .collab-graph-zoom .collab-graph-expand{background:#e8e5dc;color:#141413}
-.collab-graph-frame>.collab-graph-legend{position:absolute;left:10px;right:10px;bottom:10px;display:flex;align-items:flex-end;justify-content:space-between;gap:8px;margin:0;padding:0;pointer-events:none}
-.collab-graph-frame>.collab-graph-legend>*{pointer-events:auto}
-.collab-graph-frame .collab-graph-legend>.collab-help{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;padding:4px 9px;border:1px solid var(--gray-150);border-radius:4px;background:color-mix(in srgb,var(--card) 90%,transparent);backdrop-filter:blur(4px);font-size:12px}
-.collab-legend-and::before,.collab-legend-or::before{content:"";display:inline-block;width:16px;margin-right:5px;vertical-align:middle;border-top:1.5px solid var(--gray-500)}
-.collab-legend-or::before{border-top:1.5px dashed var(--amber-600)}
-.collab-graph-frame[data-edgeless=true] :is(.collab-legend-and,.collab-legend-or){display:none}
-.collab-graph-frame[data-edgeless=true] .collab-graph-scroll{min-height:200px}
-.collab-graph-frame .collab-graph-zoom{background:color-mix(in srgb,var(--card) 90%,transparent);border-radius:4px;backdrop-filter:blur(4px);box-shadow:0 2px 6px -2px color-mix(in srgb,var(--shade) 15%,transparent)}
-.collab-map[data-task-view=list] .collab-graph-frame,.collab-map[data-task-empty=true] .collab-graph-frame{display:none}
-@media(max-width:850px){.collab-graph-frame{display:none}}
-.collab-graph-frame .collab-graph-zoom{flex-shrink:0;white-space:nowrap}
-.collab-graph-frame .collab-graph-legend>.collab-help{min-width:0}
-.collab-map{container-type:inline-size}
-@container (max-width:620px){.collab-graph-legend>.collab-help>span:last-child{display:none}}
-@media(min-width:1151px){.collab-layout{grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr)}}
-/* Task inspector: title with live state, emphasised objective, compact facts and artifact buttons. */
-.collab-inspected-title{--task-tone:var(--gray-300);display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding-left:10px;border-left:3px solid var(--task-tone)}
-.collab-inspected-title[data-task-state=running],.collab-inspected-title[data-task-state=delivered],.collab-inspected-title[data-task-state=integrated]{--task-tone:var(--blue-500)}
-.collab-inspected-title[data-task-state=blocked],.collab-inspected-title[data-task-state=stopped]{--task-tone:var(--red-300)}
-.collab-inspected-title[data-task-state=paused],.collab-inspected-title[data-task-state=conditional]{--task-tone:var(--amber-300)}
-.collab-inspected-title[data-task-proof=conditional]{--task-tone:var(--amber-500)}
-.collab-inspected-title[data-task-proof=checked],.collab-inspected-title[data-task-state=completed]{--task-tone:var(--green-500)}
-.collab-inspected-title h4{margin:0;min-width:0;overflow-wrap:anywhere;line-height:1.5;font-size:var(--text-md)}
-.collab-inspected-title h4:focus-visible{outline:2px solid var(--blue-500);outline-offset:2px;border-radius:2px}
-.collab-inspected-state{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;padding:1px 7px;border-radius:var(--radius-sm);background:var(--gray-100);color:var(--gray-600);font-size:var(--text-xs);white-space:nowrap}
-.collab-inspected-state::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--task-tone)}
-.collab-inspected-title[data-task-state=running] .collab-inspected-state{background:var(--blue-50);color:var(--blue-600)}
-.collab-inspected-title[data-task-state=running] .collab-inspected-state::before{animation:stage-pulse 1.4s ease-in-out infinite}
-.collab-inspector .collab-inspected-objective{margin:10px 0 12px;padding:9px 11px;border-radius:var(--radius-md);background:var(--gray-50);color:var(--gray-700);font-size:var(--text-sm);line-height:1.7;overflow-wrap:anywhere}
-.collab-inspector [data-collab-inspector]>.collab-facts{padding:8px 0;border-block:1px solid var(--gray-100)}
-.collab-inspector [data-collab-inspector]>.collab-facts>div{align-items:baseline}
-.collab-inspector [data-collab-inspector]>.collab-facts dd{color:var(--gray-700)}
-.collab-inspector [data-collab-inspector]>.collab-artifact-links:first-of-type{margin:8px 0 4px;gap:4px 14px}
-.collab-inspector h5{color:var(--gray-600);font-weight:600}
-.collab-inspector .collab-detail{margin-top:6px}
-/* Activity log: one-line event names, denser rows, readable records. */
-.activity-table td{padding-block:8px;line-height:1.6}
-.activity-table td:last-child{color:var(--gray-700)}
-/* A folded run of identical lines: the newest row stands for the rest, with how many it stands for. */
-.activity-table td[data-repeats]::after{content:" ×" attr(data-repeats);color:var(--gray-500);font-variant-numeric:tabular-nums;white-space:nowrap}
-.activity-table tbody tr:hover td{background:var(--gray-25)}
-.activity-table tbody tr:last-child td{border-bottom:0}
-/* Large plans: compact graph cards keep kind, state and name; the tooltip, list and inspector keep the rest. */
-.collab-graph[data-density=compact] .collab-task{width:184px;height:54px;padding:6px 9px 6px 10px}
-.collab-graph[data-density=compact] .collab-task-objective,.collab-graph[data-density=compact] .collab-task small{display:none}
-.collab-graph[data-density=compact] .collab-task strong{margin-top:1px}
-.collab-graph-caption{position:absolute;margin:0;font-size:var(--text-sm);color:var(--gray-500)}
-.collab-inspector .collab-inspected-objective[data-clamped]{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;overflow:hidden;margin-bottom:4px}
-.collab-objective-toggle{display:block;margin:0 0 12px auto;font-size:var(--text-xs)}
-
-/* Task token usage: a hairline meter along the card's bottom edge, relative to the task with the most tokens, and the count beside owner and proof. */
-.collab-task-tokens{position:absolute;right:12px;bottom:9px;color:var(--gray-600);font-size:var(--text-xs);font-weight:500;font-variant-numeric:tabular-nums}
-.collab-task:has(.collab-task-tokens) small{display:block;padding-right:48px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.collab-task-usage{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--gray-100)}
-.collab-task-usage>span{display:block;height:100%;background:color-mix(in srgb,var(--blue-500) 70%,var(--gray-300));border-radius:0 2px 2px 0}
-.collab-graph[data-density=compact] .collab-task-tokens{display:none}
-.collab-legend-usage:not([hidden]){display:inline-flex;flex-wrap:wrap;align-items:center;gap:0 6px}
-.collab-legend-usage>span{white-space:nowrap}
-.collab-legend-usage>span+span::before{content:"·";margin-right:6px}
-.collab-legend-usage::before{content:"";display:inline-block;width:16px;height:3px;margin-right:5px;vertical-align:middle;border-radius:2px;background:color-mix(in srgb,var(--blue-500) 70%,var(--gray-300))}
-
-/* Email login: one narrow card on the same paper as the workbench. */
-body.login-page{overflow:auto}
-.login-shell{flex:none;width:min(100% - 32px,420px);margin:auto;padding:32px 0 6vh;display:flex;flex-direction:column;gap:22px}
-.login-shell>.brand{align-self:flex-start}
-.login-card{border:1px solid var(--gray-200);border-radius:14px;background:var(--card);padding:30px 28px 28px;box-shadow:var(--shadow-card)}
-.login-card h1{font-family:var(--serif);font-weight:400;font-size:var(--text-2xl);line-height:1.3;letter-spacing:-.005em;color:var(--gray-900)}
-.login-lead{margin:8px 0 20px;color:var(--gray-600);font-size:var(--text-sm)}
-.login-access{display:flex;flex-wrap:wrap;align-items:center;gap:0 8px;margin:-8px 0 20px;font-size:var(--text-sm);color:var(--gray-700)}
-.login-access a{font-size:inherit;min-height:28px;text-decoration:underline;text-underline-offset:3px}
-.login-terms{margin-bottom:16px}
-.login-form input{margin-bottom:16px;border-radius:8px}
-.login-captcha-row{display:flex;align-items:center;gap:8px;margin-bottom:6px}
-.login-captcha-row input{margin-bottom:0;flex:1}
-.login-captcha-row img{width:150px;height:45px;border:1px solid var(--line);border-radius:8px;flex:none;background:var(--gray-50)}
-/* The server draws the captcha on light paper; inverted and turned back to the warm hue it reads as dark paper. */
-:root[data-theme=dark] .login-captcha-row img{filter:invert(.9) hue-rotate(180deg)}
-.login-submit{width:100%;min-height:42px}
-.login-sent{margin-bottom:16px;font-size:var(--text-sm);color:var(--gray-700);overflow-wrap:anywhere}
-.login-code{font-size:20px;letter-spacing:.4em;text-align:center}
-.login-secondary{display:flex;justify-content:space-between;margin-top:14px}
-.login-footer{font-size:var(--text-xs);color:var(--gray-500)}
-.login-footer a{color:var(--gray-700);text-decoration:underline;text-decoration-color:var(--gray-300);text-underline-offset:3px;transition:text-decoration-color .15s}
-.login-footer a:hover{text-decoration-color:currentColor}
-.account-trigger{display:inline-flex;align-items:center;gap:6px;max-width:220px;min-height:34px;padding:5px 10px;border:1px solid var(--gray-200);border-radius:8px;background:var(--card);color:var(--gray-700);font-size:var(--text-xs)}
-.account-trigger span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-/* The address is what gives way when the top bar is full: it truncates, and every other control keeps its size. */
-.topbar-actions:has(.account-trigger){flex-shrink:1}
-.topbar-actions>:not(.account-trigger){flex-shrink:0}
-.topbar .account-trigger{min-width:34px}
-.account-trigger:hover{background:var(--gray-50)}
-.account-email{font-weight:500;overflow-wrap:anywhere;margin-bottom:14px}
-.account-password{border-top:1px solid var(--line);margin:16px 0;padding-top:16px}
-.account-password h3{font-size:var(--text-sm);margin-bottom:6px}
-.account-password form,.account-password #account-current-wrap{display:grid;gap:8px}
-.account-password #account-current-wrap[hidden]{display:none}
-.account-password form{margin-top:12px}
-.account-password input{width:100%}
-.account-password .inline-error{margin:0}
-.account-password button{justify-self:start}
-.theme-choice{margin:0 0 16px}
-.theme-choice legend{margin-bottom:7px}
-.theme-choice .segmented{grid-template-columns:repeat(3,1fr)}
-.completion-email{margin:0 0 16px}
-.completion-email .field-note{margin:4px 0 0}
-.account-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px}
-/* Admin dialog: beta totals, the allowlist with its sources, and accounts with their first-login and milestone times. */
-.admin-dialog{max-width:720px}
-.admin-content section+section{margin-top:22px}
-.admin-content h3{margin:0 0 8px;font-size:var(--text-sm);font-weight:600;color:var(--gray-800)}
-.admin-funnel{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;margin:0}
-.admin-funnel>div{padding:10px 12px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--gray-25)}
-.admin-funnel dt{font-size:var(--text-xs);color:var(--gray-500)}
-.admin-funnel dd{display:flex;align-items:baseline;gap:8px;margin:4px 0 0;font-size:var(--text-lg);font-weight:600;color:var(--gray-800)}
-.admin-share{font-size:var(--text-xs);font-weight:500;color:var(--gray-500)}
-.admin-add{display:flex;gap:8px;margin-bottom:12px}
-.admin-add input{flex:1;min-width:0}
-.admin-add .button{flex-shrink:0}
-.admin-list{list-style:none;margin:0;padding:0;border:1px solid var(--gray-200);border-radius:var(--radius-md)}
-.admin-list li{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-height:44px;padding:8px 12px}
-.admin-list li+li{border-top:1px solid var(--line)}
-.admin-email{flex:1 1 180px;min-width:0;font-size:var(--text-sm);overflow-wrap:anywhere}
-.admin-state{font-size:var(--text-xs);color:var(--gray-500)}
-.admin-confirm{display:inline-flex;align-items:center;gap:10px}
-.admin-confirm .button{min-height:30px;padding:4px 10px}
-.admin-remove{color:var(--red-600)}
-.admin-remove:hover{color:var(--red-600);text-decoration:underline}
-.badge[data-source=admin]{color:var(--blue-700);background:var(--blue-50)}
-.admin-table-scroll{overflow-x:auto;border:1px solid var(--gray-200);border-radius:var(--radius-md)}
-.admin-table{width:100%;border-collapse:collapse;font-size:var(--text-xs)}
-.admin-table th,.admin-table td{padding:8px 12px;text-align:left;white-space:nowrap;color:var(--gray-600)}
-.admin-table thead th{font-weight:500;color:var(--gray-500);background:var(--gray-25);border-bottom:1px solid var(--line)}
-.admin-table tbody tr+tr>*{border-top:1px solid var(--line)}
-.admin-table tbody th{font-weight:500;color:var(--gray-800)}
-.admin-table tbody th .badge{margin-left:6px}
-.admin-scope{margin:10px 0 0}
-@media(max-width:600px){.admin-add{flex-direction:column}}
-.glossary-feedback{margin-top:16px;padding-top:14px;border-top:1px solid var(--line);font-size:var(--text-xs);color:var(--gray-600)}
-.account-danger{border-top:1px solid var(--line);margin-top:16px;padding-top:16px}
-.account-danger h3{font-size:var(--text-sm);margin-bottom:6px}
-.account-danger p{font-size:var(--text-xs);color:var(--gray-600);margin-bottom:12px}
-.account-danger input{margin-bottom:12px}
-@media (max-width:600px){.login-card{padding:22px 18px}.login-captcha-row img{width:120px;height:36px}.account-trigger span{display:none}}
-
-/* Public share page: a read-only snapshot on the same paper, readable without signing in. */
-html.share-root{height:auto;overflow:auto}
-body.share-page{height:auto;min-height:100dvh;overflow:visible}
-.share-shell{width:min(100% - 32px,920px);margin:0 auto;padding:32px 0 48px;display:flex;flex-direction:column;gap:18px}
-.share-top{display:flex;align-items:center;justify-content:space-between;gap:12px}
-.share-kind{font-size:var(--text-xs);color:var(--gray-500);border:1px solid var(--gray-200);border-radius:999px;padding:3px 10px;background:var(--card)}
-.share-state{color:var(--gray-600);font-size:var(--text-sm)}
-/* The shared result reads as one document, like the result tab: its parts divided by hairlines, not separate cards. */
-.share-content{display:flex;flex-direction:column;border:1px solid var(--gray-150);border-radius:4px;background:var(--card);box-shadow:var(--shadow-panel)}
-.share-content>.share-card{padding:26px 30px;border:0;border-radius:0;background:transparent}
-.share-content>.share-card+.share-card{border-top:1px solid var(--gray-150)}
-.share-card{border:1px solid var(--gray-150);border-radius:var(--radius-lg);background:var(--card);padding:22px 24px}
-.share-card h2{font-size:var(--text-md);line-height:1.4}
-.share-state-card h1{font-family:var(--serif);font-weight:400;font-size:var(--text-2xl);margin-bottom:8px}
-.share-state-card p{color:var(--gray-600);font-size:var(--text-sm)}
-.share-heading{display:flex;flex-direction:column;align-items:flex-start;gap:10px}
-.share-heading h1{font-family:var(--serif);font-weight:400;font-size:26px;line-height:1.3;overflow-wrap:anywhere}
-.share-heading .badge{white-space:normal;max-width:100%;min-height:0;padding:0;background:transparent;line-height:1.4}
-.share-heading .badge svg{width:13px;height:13px}
-.share-content>.share-heading{padding-block:30px 28px}
-.share-facts{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px 20px;width:100%;margin-top:10px}
-.share-source-top{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;margin-bottom:12px}
-.share-content .code-scroll.share-code{max-height:640px}
-.share-checks{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column}
-.share-checks>li{padding:14px 0}
-.share-checks>li+li{border-top:1px solid var(--gray-100)}
-.share-check-heading>.badge{padding:0;background:transparent}
-.share-check-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:var(--text-sm)}
-.share-check-method{margin-top:6px;font-size:var(--text-xs);color:var(--gray-600)}
-.share-targets{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:var(--text-xs)}
-.share-targets li{display:flex;justify-content:space-between;gap:12px;min-width:0}
-.share-targets code{overflow-wrap:anywhere;color:var(--gray-700)}
-.share-target-status{flex:none;color:var(--gray-600)}
-.share-target-status.passed{color:var(--green-600)}
-.share-target-status.failed{color:var(--red-600)}
-.share-target-status.warning{color:var(--amber-600)}
-.share-credentials{margin-top:8px}
-.share-credentials>summary{cursor:pointer;min-height:27px;padding:3px 0;font-size:var(--text-xs);color:var(--gray-500)}
-.share-identity{margin-top:10px}
-.share-identity dd{word-break:break-all}
-.share-note{margin:0;padding:16px 30px 18px;border-top:1px solid var(--gray-150);font-size:var(--text-xs);color:var(--gray-500);line-height:1.8}
-.share-dialog-url{display:flex;gap:8px;align-items:center;margin-top:16px}
-.share-dialog-url input{flex:1;min-width:0;font-family:var(--mono);font-size:var(--text-xs)}
-.share-scope{margin:12px 0 0;padding-left:18px;font-size:var(--text-xs);color:var(--gray-600);line-height:1.8}
-/* Usage guide: the share page's paper and cards, with a table of contents, numbered steps and term lists. */
-.guide-page .share-top{flex-wrap:wrap}
-.guide-content{display:flex;flex-direction:column;border:1px solid var(--gray-150);border-radius:4px;background:var(--card);box-shadow:var(--shadow-panel);outline:none}
-.guide-content>.share-card{padding:26px 30px;border:0;border-radius:0;background:transparent}
-.guide-content>.share-card+.share-card{border-top:1px solid var(--gray-150)}
-.guide-content>.guide-heading{padding-block:30px 28px}
-.guide-heading h1{font-family:var(--serif);font-weight:400;font-size:26px;line-height:1.3}
-.guide-heading>p{margin-top:10px;font-size:var(--text-sm);line-height:1.8;color:var(--gray-700)}
-.guide-toc{display:flex;flex-wrap:wrap;gap:6px 18px;margin:16px 0 0;padding:0;list-style:none;font-size:var(--text-sm)}
-.guide-toc a{color:var(--blue)}
-.guide-content section{scroll-margin-top:16px}
-.guide-lead,.guide-note{font-size:var(--text-sm);line-height:1.8;color:var(--gray-600)}
-.guide-lead{margin-top:8px}
-.guide-note{margin-top:14px;font-size:var(--text-xs);color:var(--gray-500)}
-.guide-steps{counter-reset:guide;display:grid;gap:14px;margin:14px 0 0;padding:0;list-style:none}
-.guide-steps li{counter-increment:guide;position:relative;padding-left:34px}
-.guide-steps li::before{content:counter(guide);position:absolute;left:0;top:0;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:999px;background:var(--blue-50);color:var(--blue-700);font:600 var(--text-xs)/1 var(--mono)}
-.guide-steps strong{font-size:var(--text-sm);font-weight:600;color:var(--gray-800)}
-.guide-steps p{margin-top:2px;font-size:var(--text-sm);line-height:1.8;color:var(--gray-600)}
-.guide-terms{display:grid;gap:12px;margin:14px 0 0}
-.guide-terms>div{display:grid;grid-template-columns:132px minmax(0,1fr);gap:4px 16px;align-items:baseline}
-.guide-terms dt{font-size:var(--text-sm);font-weight:600;color:var(--gray-800)}
-.guide-terms dd{font-size:var(--text-sm);line-height:1.8;color:var(--gray-600);overflow-wrap:anywhere}
-.guide-keys dt{display:flex;flex-wrap:wrap;gap:4px}
-@media(max-width:600px){.guide-terms>div{grid-template-columns:minmax(0,1fr)}.guide-page .guide-content>.share-card{padding:20px 18px}.guide-page .guide-content>.guide-heading{padding-block:22px 20px}}
-.glossary-guide{margin-top:16px;font-size:var(--text-xs)}
-.glossary-guide+.glossary-feedback{margin-top:10px}
-.share-scope-heading{margin-top:12px;font-size:var(--text-xs);font-weight:600;color:var(--gray-700)}
-@media (max-width:600px){.share-card{padding:18px 16px}.share-heading h1{font-size:21px}.share-shell{padding-top:20px}
- .share-content>.share-card{padding:20px 18px}.share-content>.share-heading{padding-block:22px 20px}.share-note{padding-inline:18px}
- .share-facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px}}
-/* A run without an observation has nothing to show below its status line. */
-.collab-surface[data-observed=false]>:not(.collab-heading):not([data-collab-summary]):not(.collab-operation-status){display:none}
-/* First-run guide, sample run and term hints. */
-.welcome-steps{display:grid;gap:10px;width:100%;margin:20px 0 0;padding:0;list-style:none}
-.welcome-steps li{display:flex;align-items:flex-start;gap:11px;min-width:0}
-.welcome-steps strong{display:block;font-size:var(--text-sm);font-weight:600;color:var(--gray-800)}
-.welcome-steps p{margin:1px 0 0;font-size:var(--text-xs);line-height:1.7;color:var(--gray-500);overflow-wrap:anywhere}
-.welcome-step-index{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:22px;height:22px;border-radius:999px;background:var(--blue-50);color:var(--blue-700);font-size:var(--text-xs);font-weight:600}
-.welcome-sample{display:flex;align-items:center;gap:12px;width:100%;min-height:57px;margin-top:18px;padding:10px 13px;border:1px solid var(--blue-200);border-radius:var(--radius-lg);background:var(--blue-50);color:var(--blue-700);text-align:left;transition:background-color .15s,border-color .15s}
-.welcome-sample:hover{background:var(--blue-100);border-color:var(--blue-300)}
-.welcome-sample>svg{flex-shrink:0}
-.welcome-sample>svg:first-child{width:30px;height:30px;padding:7px;border-radius:var(--radius-md);background:var(--card);color:var(--blue)}
-.welcome-sample>span{display:flex;flex-direction:column;flex:1;min-width:0}
-.welcome-sample strong{font-size:var(--text-sm);font-weight:600}
-.welcome-sample strong+span{font-size:var(--text-xs);color:var(--blue-600);overflow-wrap:anywhere}
-.chat-welcome[data-first-run=true] .chat-suggestions{margin-top:18px}
-.welcome-help{display:flex;flex-wrap:wrap;gap:6px 18px;margin-top:14px}
-.sample-badge{color:var(--blue-700);background:var(--blue-50)}
-.sample-note{margin:0 0 10px;padding:1px 0 1px 12px;border-left:2px solid var(--blue-200);color:var(--gray-600);font-size:var(--text-xs);line-height:1.7}
-.term-hint{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:18px;height:18px;margin-inline-start:4px;padding:0;border:1px solid var(--gray-200);border-radius:999px;background:var(--card);color:var(--gray-500);font-size:var(--text-xs);font-weight:600;line-height:1;vertical-align:middle;cursor:help}
-.term-hint:hover,.term-hint[aria-expanded=true]{border-color:var(--blue-300);background:var(--blue-50);color:var(--blue-700)}
-.term-hint-sample{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:1px solid var(--gray-200);border-radius:999px;font-size:var(--text-xs);line-height:1}
-.term-tip{position:fixed;inset:auto;margin:0;width:min(300px,calc(100vw - 16px));padding:11px 13px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--card);color:var(--gray-700);box-shadow:var(--shadow-md);font-size:var(--text-xs);line-height:1.7;z-index:60}
-.term-tip strong{display:block;font-size:var(--text-sm);font-weight:600;color:var(--gray-900)}
-.term-tip p{margin:3px 0 6px}
-.glossary-dialog{max-width:560px}
-/* The heading and close button stay put; only the term list scrolls. */
-.glossary-dialog[open]{display:flex;flex-direction:column;overflow:hidden}
-.glossary-content{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:17px 20px 20px}
-.glossary-content section+section{margin-top:16px}
-.glossary-content h3{margin:0 0 6px;font-size:var(--text-xs);font-weight:600;color:var(--gray-500)}
-.glossary-content dl{margin:0;display:grid;gap:2px}
-.glossary-content dl>div{padding:8px 10px;border-radius:var(--radius-sm)}
-.glossary-content dl>div[data-current]{background:var(--blue-50)}
-.glossary-content dt{font-size:var(--text-sm);font-weight:600;color:var(--gray-800)}
-.glossary-content dd{margin:2px 0 0;font-size:var(--text-xs);line-height:1.7;color:var(--gray-600)}
-.glossary-content .term-detail{margin-top:3px;color:var(--gray-500)}
-.term-heading{display:inline-flex;align-items:center;gap:2px;min-width:0}
-/* Phone top bars have no room; the search button (command palette), the welcome link and every term tip still open the glossary. */
-@media(max-width:560px){#open-glossary{display:none}}
-/* Language switch: names the other language; below 760px only the icon shows and the label stays the accessible name. */
-.topbar-locale{display:inline-flex;align-items:center;gap:6px;height:32px;flex-shrink:0;padding:0 10px;border:0;border-radius:999px;background:transparent;color:var(--gray-600);font-size:var(--text-xs);white-space:nowrap}
-.topbar-locale:hover{background:var(--gray-100);color:var(--gray-800)}
-.topbar-locale svg{width:15px;height:15px}
-/* The home link is a 32px target at every width. Phones keep the mark and lose the wordmark, so the search button,
- settings, language and account all keep their size. */
-.topbar .brand{min-height:32px}
-@media(max-width:420px){.topbar .brand>span{display:none}.topbar .brand{min-width:32px;justify-content:center}}
-@media(max-width:760px){.topbar-locale{width:32px;padding:0;justify-content:center}.topbar-locale .locale-switch-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}}
-.share-top-actions{display:flex;align-items:center;gap:12px}
-@media(max-width:420px){.share-top .brand>span{display:none}}
-.locale-switch-separator:has(+.locale-switch[hidden]){display:none}
-:is(.share-top-actions,.formalize-page .topbar-actions,.practice-page>.topbar) .locale-switch{display:inline-flex;align-items:center;justify-content:center;min-height:34px;padding:6px 12px;border:1px solid var(--line);border-radius:var(--radius-md);background:transparent;color:var(--gray-700);font-size:var(--text-xs);font-weight:500;text-decoration:none;white-space:nowrap}
-:is(.share-top-actions,.formalize-page .topbar-actions,.practice-page>.topbar) .locale-switch:hover{background:var(--gray-100);color:var(--ink);text-decoration:none}
-.login-footer .locale-switch{display:inline-flex;align-items:center;padding:3px 9px;border:1px solid var(--line);border-radius:999px;background:transparent;font-size:var(--text-xs);color:var(--gray-600);text-decoration:none;white-space:nowrap}
-.login-footer .locale-switch:hover{background:var(--gray-100);color:var(--ink);text-decoration:none}
-/* Statement check: a compact status in the composer, the full list under the source field in settings. */
-.source-check-status{display:contents}
-.composer-source-row .source-check-chip{margin-left:auto}
-.composer-source-row .source-check-chip~.draft-status{margin-left:0}
-.source-check-chip{display:inline-flex;align-items:center;gap:5px;flex-shrink:0;min-height:28px;padding:3px 8px;border:1px solid var(--gray-150);border-radius:999px;background:var(--gray-25);color:var(--gray-600);font-size:var(--text-xs);white-space:nowrap}
-.source-check-chip svg{width:12px;height:12px}
-.source-check-chip .spinner{width:11px;height:11px;border-width:1.5px}
-.source-check-chip:hover{border-color:var(--blue-200);color:var(--blue)}
-.source-check-chip[data-tone=good]{color:var(--green-700);border-color:var(--green-100);background:var(--green-50)}
-.source-check-chip[data-tone=bad]{color:var(--red-700);border-color:var(--red-200);background:var(--red-50)}
-.source-check-chip[data-tone=warn]{color:var(--amber-700);border-color:var(--amber-200);background:var(--amber-50)}
-.source-check-root:empty{display:none}
-.source-check{margin-top:8px;padding:9px 11px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25);font-size:var(--text-xs);line-height:1.65;color:var(--gray-600)}
-.source-check[data-tone=good]{border-color:var(--green-100);background:var(--green-50)}
-.source-check[data-tone=bad]{border-color:var(--red-200);background:var(--red-50)}
-.source-check[data-tone=warn]{border-color:var(--amber-200);background:var(--amber-50)}
-.source-check-head{display:flex;align-items:flex-start;gap:8px;min-width:0}
-.source-check-icon{display:flex;flex:0 0 15px;padding-top:3px;color:var(--gray-400)}
-.source-check-icon svg{width:14px;height:14px}
-.source-check-icon .spinner{width:13px;height:13px}
-.source-check[data-tone=good] .source-check-icon{color:var(--green-600)}
-.source-check[data-tone=bad] .source-check-icon{color:var(--red-600)}
-.source-check[data-tone=warn] .source-check-icon{color:var(--amber-600)}
-.source-check-copy{flex:1;min-width:0;overflow-wrap:anywhere}
-.source-check-copy>p:first-child{font-weight:500;color:var(--gray-700)}
-.source-check-copy>p+p{color:var(--gray-500)}
-.source-check-head .text-button{flex-shrink:0;min-height:28px}
-.source-check-head .text-button svg{width:12px;height:12px}
-.source-check-list{list-style:none;margin:7px 0 0;padding:0;display:grid;gap:2px;max-height:220px;overflow:auto}
-.source-check[data-stale=true] .source-check-list{opacity:.6}
-.source-check-item{display:grid;grid-template-columns:auto auto minmax(0,1fr);align-items:baseline;gap:8px;width:100%;padding:5px 6px;border:0;border-radius:var(--radius-sm);background:transparent;text-align:left;color:var(--gray-700);font-size:var(--text-xs)}
-.source-check-item:hover{background:var(--gray-0)}
-.source-check-line{color:var(--gray-500);white-space:nowrap;font-variant-numeric:tabular-nums}
-.source-check-severity{font-weight:500;white-space:nowrap}
-[data-severity=error] .source-check-severity{color:var(--red-600)}
-[data-severity=warning] .source-check-severity{color:var(--amber-700)}
-.source-check-message{min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
-.source-check-dismiss{margin-top:6px}
-/* On a phone the check status takes the draft state's place; the draft state stays readable to screen readers. */
-@media(max-width:400px){.composer-source-row:has(.source-check-chip) .draft-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}}
-.report-stuck .report-check-heading,.report-outline .report-check-heading{flex-wrap:wrap}
-.stuck-tasks{list-style:none;padding:0;margin:13px 0 0}
-.stuck-task,.outline-item{padding:13px 0;border-top:1px solid var(--gray-100);min-width:0}
-.stuck-name{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 8px;min-width:0}
-.stuck-name code{font-size:var(--text-xs);line-height:1.8;min-width:0;overflow-wrap:anywhere}
-.stuck-kind{font-size:var(--text-xs);color:var(--blue-600);font-weight:500;white-space:nowrap}
-.stuck-type{font:var(--text-xs)/1.8 var(--mono);margin:8px 0 0;padding:8px 12px;background:var(--gray-50);border-radius:var(--radius-sm);color:var(--gray-700);white-space:pre-wrap;overflow-wrap:anywhere;max-height:180px;overflow:auto;scrollbar-width:thin}
-.stuck-facts,.outline-uses{font-size:var(--text-xs);line-height:1.8;color:var(--gray-500);margin-top:6px;overflow-wrap:anywhere}
-.outline-uses code{font-size:var(--text-xs);color:var(--gray-700)}
-.outline-warning{display:block;color:var(--amber-600)}
-.stuck-blockers{list-style:none;padding:0;margin:6px 0 0;display:grid;gap:4px}
-.stuck-blockers li{display:flex;align-items:flex-start;gap:6px;font-size:var(--text-xs);line-height:1.8;color:var(--amber-600);overflow-wrap:anywhere;min-width:0}
-.stuck-blockers svg{width:13px;height:13px;flex-shrink:0;margin-top:4px}
-.stuck-task .report-detail-link{margin-top:4px}
-.outline-heading{font-size:var(--text-xs);font-weight:500;color:var(--gray-500);margin:16px 0 0}
-.outline-body .report-method .spinner{width:12px;height:12px;margin-right:6px;vertical-align:-1px}
-.local-check{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;margin-top:18px}
-.local-check .report-method{margin-top:0}
-.local-check-steps{margin:8px 0 0;padding-left:20px;display:grid;gap:5px;font-size:var(--text-xs);line-height:1.8;color:var(--gray-600)}
-.local-check-steps code{font-size:var(--text-xs);color:var(--gray-800);overflow-wrap:anywhere}
-/* The simple layer keeps navigation and commands visible; longer reading sections expand when opened. */
-.collab-detail-toggle{display:flex;gap:2px;padding:2px;border:1px solid var(--gray-200);border-radius:var(--radius-md);background:var(--gray-50)}
-.collab-detail-toggle button{border:0;border-radius:var(--radius-sm);background:transparent;padding:4px 10px;min-height:28px;font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.collab-detail-toggle button[aria-pressed=true]{background:var(--card);color:var(--gray-800);box-shadow:0 1px 3px color-mix(in srgb,var(--shade) 7%,transparent)}
-.collab-surface[data-detail=simple] :is(.collab-research-overview,.collab-layout,.collab-reviews,.collab-math-changes,.collab-agents,.collab-deliveries,[data-collab-records],.collab-knowledge){display:none}
-.collab-surface[data-research-mode=skill][data-detail=simple] .collab-research-overview{display:block}
-.collab-surface[data-detail=full] :is(.collab-now,.collab-expand,.collab-focus){display:none}
-/* The simple layer's lead: where the proof is stuck, and what comes next. */
-.collab-focus{display:grid;gap:0;margin:0 0 8px;min-width:0}
-.collab-focus-stuck{padding:10px 12px;border-radius:var(--radius-md,8px);background:var(--amber-50);font-size:var(--text-xs);line-height:1.8;min-width:0}
-.collab-focus-stuck>strong{display:block;color:var(--amber-700,var(--gray-600));font-weight:600;margin-bottom:2px}
-.collab-focus-stuck p,.collab-focus-stuck ul{margin:0}
-.collab-focus-stuck code{overflow-wrap:anywhere}
-.collab-focus-blocked{list-style:none;padding:0;display:grid;gap:2px}
-.collab-focus-blocked li{display:flex;flex-wrap:wrap;gap:2px 8px;min-width:0}
-.collab-focus-blocked li>span{color:var(--gray-600);overflow-wrap:anywhere}
-.collab-focus-next{margin:8px 0 0;font-size:var(--text-xs);line-height:1.8;color:var(--muted,var(--gray-500))}
-.collab-surface[data-observed=false] .collab-now{display:none}
-.collab-now{border:1px solid var(--border,var(--gray-150));border-radius:var(--radius-lg);margin-top:16px;overflow:hidden;min-width:0}
-.collab-now [data-collab-now]{padding:12px 14px;display:grid;gap:10px}
-.collab-now [data-collab-now]>p{margin:0}
-.collab-now-ended{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline;font-size:var(--text-sm)}
-.collab-now-waiting{padding:10px 12px;border-radius:var(--radius-md);background:var(--amber-50);font-size:var(--text-xs);overflow-wrap:anywhere}
-.collab-now-waiting p{margin:5px 0 0}
-.collab-now-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}
-.collab-now-worker{--agent-tone:var(--green-500);display:grid;grid-template-columns:minmax(120px,200px) minmax(0,1fr);gap:4px 12px;align-items:baseline;min-width:0}
-.collab-now-who{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-weight:600;font-size:var(--text-sm);min-width:0}
-.collab-now-who small{font-weight:400;color:var(--gray-500);font-size:var(--text-xs)}
-.collab-now-task{display:grid;gap:2px;min-width:0}
-.collab-now-task .text-button{justify-self:start;overflow-wrap:anywhere;text-align:left}
-.collab-now-objective{color:var(--gray-600);font-size:var(--text-xs);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
-.collab-expand{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline;margin:16px 0 0}
-@media (max-width:560px){.collab-now-worker{grid-template-columns:minmax(0,1fr)}}
-/* The simple layer: the route map, the dependency graph without its tools when there is a plan, and nothing that only matters while running once the run ends. */
-.collab-surface[data-detail=simple][data-tasks=true] .collab-layout{display:grid;grid-template-columns:minmax(0,1fr)}
-.collab-surface[data-detail=simple] :is(.collab-inspector,.collab-map-tools,.collab-task-result,.collab-task-view,.collab-task-selection,.collab-route-summary,.collab-observation-line,.collab-expert-term){display:none}
-.collab-surface[data-detail=simple][data-ended=true] :is(.collab-now,.collab-guidance,[data-collab-refresh]){display:none}
-.collab-agent-route{border:1px solid var(--border,var(--gray-150));border-radius:var(--radius-lg);margin-top:16px;overflow:hidden;min-width:0}
-.collab-agent-route [data-agent-route]{padding:12px 14px;display:grid;gap:12px}
-.collab-agent-route [data-agent-route]>p{margin:0}
-.agent-route-lanes{list-style:none;margin:0;padding:0;display:grid;gap:12px}
-.agent-route-lane{--agent-tone:var(--gray-400);display:grid;grid-template-columns:minmax(110px,160px) minmax(0,1fr);gap:6px 12px;align-items:start;min-width:0}
-.agent-route-who{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-weight:600;font-size:var(--text-sm);min-width:0;padding-top:2px;overflow-wrap:anywhere}
-.agent-route-steps{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:8px 0;min-width:0}
-.agent-route-step{position:relative;display:grid;gap:2px;align-content:start;font-size:var(--text-xs);color:var(--gray-700);min-width:0}
-.agent-route-step+.agent-route-step{padding-left:22px}
-.agent-route-step+.agent-route-step::before{content:'';position:absolute;left:4px;top:12px;width:14px;height:1px;background:var(--gray-200)}
-.agent-route-label{display:inline-flex;align-items:center;gap:5px;white-space:nowrap;padding:3px 9px;border:1px solid transparent;border-radius:999px;background:color-mix(in srgb,var(--gray-500) 7%,transparent)}
-.agent-route-label .spinner{width:10px;height:10px;border-width:1.5px}
-.agent-route-mark{width:6px;height:6px;border-radius:50%;background:var(--gray-400);flex-shrink:0}
-.agent-route-step[data-outcome=passed] .agent-route-mark{background:var(--green-500)}
-.agent-route-step[data-outcome=failed] .agent-route-mark{background:var(--red-500)}
-.agent-route-step[data-kind=accept][data-outcome=passed] .agent-route-label{border-color:var(--green-200);background:var(--green-50)}
-.agent-route-step[data-kind=stop] .agent-route-label,.agent-route-step[data-kind=accept][data-outcome=failed] .agent-route-label{border-color:var(--red-200);background:var(--red-50)}
-.agent-route-step[data-current] .agent-route-label{border-color:var(--gray-400)}
-.agent-route-outcome{color:var(--gray-500)}
-.agent-route-step[data-outcome=passed] .agent-route-outcome{color:var(--green-700)}
-.agent-route-step[data-outcome=failed] .agent-route-outcome{color:var(--red-700)}
-.agent-route-step .agent-route-superseded{color:var(--gray-500)}
-.agent-route-step[data-superseded] .agent-route-label{border-style:dashed;border-color:var(--gray-300)}
-.agent-route-step[data-superseded] .agent-route-label:not(:hover){background:transparent}
-.agent-route-more{color:var(--gray-500);padding-top:4px}
-@media (max-width:560px){.agent-route-lane{grid-template-columns:minmax(0,1fr)}}
-button.agent-route-label{cursor:pointer;font-size:inherit;color:inherit;line-height:inherit;transition:border-color .15s,background-color .15s}
-button.agent-route-label:hover{background:color-mix(in srgb,var(--gray-500) 13%,transparent)}
-button.agent-route-label:focus-visible{outline-offset:2px}
-button.agent-route-label[data-selected]{border-color:var(--gray-800);background:var(--card);box-shadow:0 0 0 1px var(--gray-800)}
-.agent-route-count{min-width:16px;padding:0 2px;color:var(--gray-500);font-size:var(--text-xs);line-height:16px;text-align:center;font-variant-numeric:tabular-nums}
-.agent-route-more .text-button{padding:3px 0;white-space:nowrap}
-.agent-route-now{grid-column:2;margin:0;display:flex;align-items:center;gap:6px;font-size:var(--text-xs);color:var(--gray-600);min-width:0}
-.agent-route-now>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
-.agent-route-now .spinner,.agent-route-state .spinner,.agent-route-reading .spinner,.route-item-icon .spinner{width:10px;height:10px;border-width:1.5px}
-.agent-route-reading{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
-.agent-route-state{margin:0;display:flex;align-items:center;gap:8px;font-size:var(--text-xs);color:var(--gray-600)}
-.route-inspector{grid-column:1/-1;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--card);min-width:0;overflow:hidden}
-.route-inspector-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px 12px;flex-wrap:wrap;padding:10px 12px 8px;border-bottom:1px solid var(--line)}
-.route-inspector-heading{min-width:0}
-.route-inspector-head h4{margin:0;font-size:var(--text-sm);font-weight:600;color:var(--gray-800);overflow-wrap:anywhere}
-.route-inspector-meta{margin:2px 0 0;font-size:var(--text-xs);color:var(--muted);font-variant-numeric:tabular-nums}
-.route-inspector-tools{display:flex;align-items:center;gap:4px 10px;flex-wrap:wrap}
-.route-inspector-tools .icon-button{width:28px;height:28px}
-.route-inspector-tools .icon-button:disabled{opacity:.35;cursor:default}
-.route-inspector-tools .text-button[aria-pressed=true]{color:var(--gray-800);font-weight:600}
-.route-filters{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px;border-bottom:1px solid var(--line)}
-.route-filter{display:inline-flex;align-items:center;gap:5px;padding:2px 9px;border:1px solid var(--gray-200);border-radius:999px;background:transparent;font-size:var(--text-xs);color:var(--gray-600);cursor:pointer}
-.route-filter>span{color:var(--gray-400);font-variant-numeric:tabular-nums}
-.route-filter[aria-pressed=true]{border-color:var(--gray-700);background:var(--gray-800);color:var(--gray-0)}
-.route-filter[aria-pressed=true]>span{color:var(--gray-300)}
-.route-items{list-style:none;margin:0;padding:4px 0;max-height:min(520px,60vh);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
-.route-item+.route-item{border-top:1px solid var(--gray-100)}
-.route-item>details>summary{list-style:none;cursor:pointer}
-.route-item>details>summary::-webkit-details-marker{display:none}
-.route-item-head{display:grid;grid-template-columns:20px minmax(0,1fr) auto;align-items:start;gap:8px;padding:6px 12px;font-size:var(--text-xs);color:var(--gray-700)}
-summary.route-item-head:hover{background:var(--gray-25)}
-summary.route-item-head:focus-visible{outline-offset:-2px}
-.route-item-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:18px;color:var(--gray-500)}
-.route-item-icon .lucide{width:14px;height:14px}
-.route-item-icon[data-group=think]{color:var(--sky-500)}
-.route-item-icon[data-group=edit]{color:var(--blue-600)}
-.route-item-icon[data-group=lean]{color:var(--green-600)}
-.route-item-icon[data-group=host]{color:var(--gray-400)}
-.route-item[data-kind=event] .route-item-label{color:var(--gray-500)}
-.route-item-title{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 6px;min-width:0;line-height:18px}
-.route-item-label{overflow-wrap:anywhere}
-.route-item-title code{font-family:var(--mono);font-size:11.5px;color:var(--gray-600);overflow-wrap:anywhere;min-width:0}
-.route-item-meta{display:flex;align-items:center;gap:8px;line-height:18px;color:var(--gray-400);white-space:nowrap;font-variant-numeric:tabular-nums}
-.route-item-outcome{color:var(--gray-500)}
-.route-item-outcome[data-tone=passed]{color:var(--green-700)}
-.route-item-outcome[data-tone=failed]{color:var(--red-700)}
-.route-item-body{padding:2px 12px 10px 40px;display:grid;gap:8px;min-width:0}
-.route-item-body pre{margin:0;font-family:var(--mono);font-size:11.5px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}
-.route-command{padding:6px 8px;border-radius:var(--radius-sm);background:var(--gray-50);color:var(--gray-800)}
-.route-output{max-height:280px;overflow:auto;padding:6px 8px;border:1px solid var(--line);border-radius:var(--radius-sm);color:var(--gray-700);scrollbar-width:thin}
-.route-text{font-size:var(--text-xs);line-height:1.65;color:var(--gray-700);white-space:pre-wrap;overflow-wrap:anywhere}
-.route-item-note{margin:0;padding:0 12px;font-size:var(--text-xs);color:var(--muted);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
-.route-item-body .route-item-note,.route-lean .route-item-note{padding:0}
-.route-inspector>.route-item-note{padding:8px 12px}
-.route-change{display:grid;gap:4px;min-width:0}
-.route-change-path{margin:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;font-size:var(--text-xs);color:var(--gray-500)}
-.route-change-path code{font-family:var(--mono);font-size:11.5px;color:var(--gray-800);overflow-wrap:anywhere}
-.route-diff{max-height:320px;overflow:auto;border:1px solid var(--line);border-radius:var(--radius-sm);padding:4px 0;scrollbar-width:thin}
-.route-diff-line{display:block;padding:0 8px 0 22px;position:relative}
-.route-diff-line::before{position:absolute;left:8px;color:var(--gray-400)}
-.route-diff-line[data-line=add]{background:var(--green-50)}
-.route-diff-line[data-line=add]::before{content:'+';color:var(--green-600)}
-.route-diff-line[data-line=del]{background:var(--red-50)}
-.route-diff-line[data-line=del]::before{content:'−';color:var(--red-600)}
-.route-diff-line[data-line=hunk],.route-diff-line[data-line=meta]{color:var(--gray-500);background:var(--gray-25)}
-.route-lean ul,.route-found{list-style:none;margin:0;padding:0;display:grid;gap:6px}
-.route-lean li{display:grid;gap:2px;padding-left:8px;border-left:2px solid var(--gray-200)}
-.route-lean li[data-severity=error]{border-left-color:var(--red-300)}
-.route-lean li[data-severity=warning]{border-left-color:var(--amber-300)}
-.route-lean-where{font-size:var(--text-xs);color:var(--gray-500);font-variant-numeric:tabular-nums}
-.route-found li{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;font-size:var(--text-xs)}
-.route-found-query{font-family:var(--mono);font-size:11.5px;color:var(--gray-800)}
-.route-found-total{color:var(--gray-500)}
-.route-found-names{display:flex;flex-wrap:wrap;gap:4px;flex-basis:100%}
-.route-found-names code{font-family:var(--mono);font-size:var(--text-xs);padding:0 5px;border-radius:4px;background:var(--gray-50);color:var(--gray-700)}
-.route-library{display:grid;gap:8px;min-width:0}
-.route-library .route-found-query{overflow-wrap:anywhere;min-width:0}
-.route-link{margin:0}
-.route-link code{font-family:var(--mono);font-size:11.5px;overflow-wrap:anywhere}
-@media (max-width:560px){.agent-route-now{grid-column:1}.route-item-head{grid-template-columns:18px minmax(0,1fr)}.route-item-meta{grid-column:2;justify-content:flex-start}.route-item-body{padding-left:12px}}
-@media(prefers-reduced-motion:reduce){button.agent-route-label{transition:none}}
-/* Opt-in, tab-only API Key memory. */
-.key-memory{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 12px;margin-top:8px}
-.key-memory-option,.checkbox-option{display:inline-flex;align-items:center;gap:6px;margin:0;font-size:var(--text-sm);color:var(--gray-700);cursor:pointer}
-.key-memory-option input[type=checkbox],.checkbox-option input[type=checkbox]{display:inline-block;width:14px;height:14px;min-width:14px;margin:0;padding:0;accent-color:var(--blue)}
-#key-memory-note{margin-top:4px}
-/*
- * Result tab: a tinted verdict, then the proof, the Agent route map, the acceptance report and the task as one document divided by hairlines.
- * On a wide screen it keeps a reading width, left-aligned like the trajectory, so a goal's name and its state stay in one glance.
- */
-.result-document{container-type:inline-size;display:grid;gap:0;min-width:0;max-width:1080px}
-.result-verdict{display:grid;grid-template-columns:38px minmax(0,1fr);gap:6px 16px;align-items:start;padding:22px 24px;border:1px solid var(--gray-200);border-radius:var(--radius-lg);background:var(--gray-50);box-shadow:var(--shadow-sm)}
-.result-verdict.running{border-color:var(--blue-200);background:var(--blue-50)}
-.result-verdict.passed{border-color:var(--green-200);background:var(--green-50);box-shadow:inset 0 1px 0 color-mix(in srgb,var(--card) 55%,transparent),var(--shadow-sm)}
-.result-verdict.failed{border-color:var(--red-200);background:var(--red-50)}
-.result-verdict.warning{border-color:var(--amber-200);background:var(--amber-50)}
-.result-verdict-mark{position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border:1px solid color-mix(in srgb,currentColor 18%,var(--line));border-radius:50%;background:var(--card);color:var(--gray-500);box-shadow:var(--shadow-sm)}
-.result-verdict-mark>svg{width:19px;height:19px}
-.result-verdict-mark>.pulse-dot{width:10px;height:10px}
-.result-verdict.running .result-verdict-mark{color:var(--blue-600)}
-.result-verdict.passed .result-verdict-mark{color:var(--green-600)}
-.result-verdict.failed .result-verdict-mark{color:var(--red-600)}
-.result-verdict.warning .result-verdict-mark{color:var(--amber-600)}
-.result-verdict-copy{min-width:0}
-.result-verdict-copy h3{font-family:var(--serif);font-size:var(--text-xl);font-weight:400;line-height:1.35;letter-spacing:-.02em;color:var(--gray-900);overflow-wrap:anywhere}
-.result-verdict-copy>p{margin-top:3px;font-size:var(--text-sm);line-height:1.7;color:var(--gray-700);overflow-wrap:anywhere}
-.result-verdict-copy>p>.term-hint{vertical-align:-3px}
-.result-verdict-copy>.result-latest{display:flex;align-items:baseline;gap:8px;margin-top:8px;font-size:var(--text-xs);color:var(--gray-600)}
-.result-latest>time{flex-shrink:0;color:var(--gray-500);font-variant-numeric:tabular-nums}
-.result-latest>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.result-verdict-copy>.candidate-notice{margin-top:6px}
-.result-verdict-copy>.result-away{margin-top:6px;font-size:var(--text-xs);line-height:1.7;color:var(--gray-500)}
-.result-verdict-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-top:12px}
-.result-verdict-actions .button{min-height:34px;padding:6px 12px}
-@media screen{
- /* Signature Carbon-Emerald Kernel Receipt on screens (prints cleanly on warm paper). */
- .result-verdict.passed{border-color:#3d5443;background-color:#18201b;background-image:linear-gradient(155deg,#1f2822 0%,#161c18 100%);color:#f2f0e9;box-shadow:inset 0 1px 0 rgb(169 189 139/.12),var(--shadow-card)}
- .result-verdict.passed .result-verdict-mark{background:#121714;border-color:rgb(169 189 139/.42);color:#a9bd8b;box-shadow:0 2px 10px rgb(0 0 0/.35)}
- .result-verdict.passed .result-verdict-copy h3{color:#a9bd8b;font-weight:500}
- .result-verdict.passed .result-verdict-copy>p{color:#e6e4dc}
- .result-verdict.passed .result-verdict-copy :is(.result-latest,.result-away,.result-latest>time){color:#9fb0a3}
- .result-verdict.passed .result-verdict-actions .button{background:rgb(255 255 255/.08);border-color:rgb(169 189 139/.32);color:#f2f0e9;box-shadow:none}
- .result-verdict.passed .result-verdict-actions .button:hover:not(:disabled){background:rgb(169 189 139/.16);border-color:rgb(169 189 139/.58)}
- .result-verdict.passed .result-verdict-actions .button-primary{background:#a9bd8b;border-color:#a9bd8b;color:#141413}
- .result-verdict.passed .result-verdict-actions .button-primary:hover:not(:disabled){background:#bdd09f;border-color:#bdd09f}
- .result-verdict.passed .text-button{color:#a9bd8b}
- .result-verdict.passed .text-button:hover{color:#c5d8a8}
- .result-verdict.passed .badge{background:rgb(169 189 139/.14);border-color:rgb(169 189 139/.3);color:#a9bd8b}
- .result-verdict.passed .term-hint{background:rgb(169 189 139/.14);border-color:rgb(169 189 139/.38);color:#c5d8a8}
- .result-verdict.passed .term-hint:hover,.result-verdict.passed .term-hint[aria-expanded=true]{background:rgb(169 189 139/.26);border-color:rgb(169 189 139/.62);color:#f2f0e9}
-}
-.result-section{min-width:0;padding:22px 0;border-top:1px solid var(--gray-150)}
-.result-verdict+.result-section{border-top:0}
-.result-section:last-child{padding-bottom:4px}
-.result-section-heading{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;min-width:0;margin-bottom:12px}
-.result-diagnostics{padding-block:10px}
-.result-later .result-section-heading{margin-bottom:6px}
-.result-later-list{list-style:none;margin:0;padding:0;display:grid;gap:2px}
-.result-later-list>li{display:flex;align-items:center;gap:4px 8px;min-width:0}
-.result-later-list>li>.result-later-row{flex:1;min-width:0}
-.result-later-compare{flex-shrink:0;padding:4px 8px;border-radius:var(--radius-sm);white-space:nowrap}
-.result-later-compare svg{width:13px;height:13px}
-.result-later-compare[aria-pressed=true]{background:var(--blue-50);color:var(--blue-700)}
-.result-later-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:6px 12px;width:100%;min-height:36px;padding:6px 8px;border:0;border-radius:var(--radius-md);background:transparent;text-align:left;font-size:var(--text-sm);color:var(--gray-800)}
-.result-later-row:hover{background:var(--gray-50)}
-.result-later-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.result-later-row>time{font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap;font-variant-numeric:tabular-nums}
-/* A narrow result column (a phone, or beside an open viewer) gives each later run's label its own line. */
-@container (max-width:640px){.result-later-list>li{flex-wrap:wrap}.result-later-list>li>.result-later-row{flex-basis:100%}.result-later-compare{margin-left:2px}.result-later-row{grid-template-columns:minmax(0,1fr) auto}.result-later-label{grid-column:1 / -1;white-space:normal;overflow-wrap:anywhere}.result-later-row>.badge{justify-self:start}}
-.result-diagnostics>.target-diagnostics{margin-top:0}
-.result-section>h3,.result-section-heading>h3,.result-task h3{display:inline-flex;align-items:center;gap:7px;font-size:var(--text-sm);font-weight:600;color:var(--gray-800)}
-.result-section-heading>h3>svg{width:15px;height:15px}
-.result-section-heading>h3>.badge{margin-left:2px}
-.result-section-heading>.text-button,.result-proof-actions,.result-section-heading>.report-actions{margin-left:auto}
-.result-proof.verified .result-section-heading>h3>svg{color:var(--green-600)}
-.result-proof.candidate .result-section-heading>h3>svg{color:var(--amber-600)}
-.result-proof-actions{display:flex;align-items:center;flex-wrap:wrap;gap:2px}
-.result-proof-actions>.text-button{margin-left:8px}
-.code-scroll.result-proof-code{display:flex;align-items:flex-start;max-height:440px;padding:0;border-color:transparent;background:var(--gray-50);border-radius:var(--radius-md)}
-.result-proof-code pre{margin:0;padding:14px 15px;font:var(--text-xs)/1.9 var(--mono);tab-size:2;white-space:pre}
-.result-proof-code .source-line-numbers{position:sticky;left:0;z-index:1;flex:0 0 44px;padding-inline:10px;text-align:right;color:var(--gray-500);background:var(--gray-50);border-right:1px solid var(--gray-100);user-select:none;font-variant-numeric:tabular-nums}
-.result-proof-text{flex:1;min-width:max-content;color:var(--gray-600)}
-.lean-comment{color:var(--code-comment);font-style:italic}
-.lean-keyword{color:var(--code-keyword)}
-.lean-tactic{color:var(--code-tactic)}
-.lean-placeholder{color:var(--code-placeholder);text-decoration:underline dotted}
-.lean-string{color:var(--code-string)}
-.lean-number{color:var(--code-number)}
-.result-note{margin-top:10px;font-size:var(--text-xs);line-height:1.7;color:var(--gray-500)}
-.result-goals .result-section-heading>.report-method{margin:0}
-.result-goals>[data-goal-unaccepted]{margin:-4px 0 12px;line-height:1.6}
-.goal-list{list-style:none;margin:0;padding:0}
-.goal-legend>[data-goal-count]::before{content:"";display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:5px;vertical-align:0;background:var(--gray-200)}
-.goal-legend>[data-goal-count="proved"]::before{background:var(--green-600)}
-.goal-legend>[data-goal-count="checked"]::before{background:var(--green-300)}
-.goal-legend>[data-goal-count="conditional"]::before{background:var(--amber-300)}
-.result-goals:has(.goal-bar.ended) .goal-legend>[data-goal-count="open"]::before{background:var(--red-200)}
-.goal-bar{display:flex;height:4px;margin:-4px 0 14px;border-radius:999px;overflow:hidden;background:var(--gray-150)}
-.goal-bar.ended{background:var(--red-200)}
-.goal-bar>span{flex:none;height:100%;box-shadow:inset -2px 0 0 var(--card)}
-.goal-bar>[data-goal-segment="proved"]{background:var(--green-600)}
-.goal-bar>[data-goal-segment="checked"]{background:var(--green-300)}
-.goal-bar>[data-goal-segment="conditional"]{background:var(--amber-300)}
-.goal-groups{display:grid;gap:4px}
-.goal-group+.goal-group{border-top:1px solid var(--gray-100);padding-top:4px}
-.goal-group>summary{display:flex;align-items:center;gap:6px;min-height:32px;cursor:pointer;list-style:none;font-size:var(--text-sm);font-weight:500;color:var(--gray-700)}
-.goal-group>summary::-webkit-details-marker{display:none}
-.goal-group>summary>svg{width:14px;height:14px;color:var(--gray-400);transition:transform .15s var(--ease-out)}
-.goal-group[open]>summary>svg{transform:rotate(90deg)}
-.goal-group>.goal-list{padding:0 0 6px 20px}
-.goal-row{display:grid;grid-template-columns:18px minmax(0,1fr);gap:10px;padding:11px 0;border-top:1px solid var(--gray-100);min-width:0}
-.goal-row:first-child{border-top:0;padding-top:2px}
-.goal-row:last-child{padding-bottom:0}
-.goal-copy{min-width:0}
-.goal-mark{display:inline-flex;color:var(--gray-400)}
-.goal-mark svg{width:16px;height:16px}
-.goal-row>.goal-mark{padding-top:4px}
-.goal-mark.passed{color:var(--green-600)}
-.goal-mark.warning{color:var(--amber-600)}
-.goal-mark.running{color:var(--blue-600)}
-.goal-mark.failed{color:var(--red-500)}
-.goal-detail{font-size:var(--text-xs);line-height:1.8;color:var(--gray-600);margin-top:4px;overflow-wrap:anywhere}
-.goal-detail code{font-size:var(--text-xs);color:var(--gray-800)}
-.goal-subgoals{margin-top:6px}
-.goal-subgoals ul{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:4px}
-.goal-subgoals li{display:flex;align-items:center;gap:7px;min-width:0;font-size:var(--text-xs)}
-.goal-subgoals li code{font-size:var(--text-xs);min-width:0;overflow-wrap:anywhere}
-.goal-subgoals .goal-mark svg{width:13px;height:13px}
-.goal-subgoal-status{margin-left:auto;flex-shrink:0;color:var(--gray-500)}
-.goal-row .report-detail-link{margin-top:2px}
-.agent-route{display:grid;gap:12px;min-width:0}
-.agent-route>.agent-route-summary{margin:0}
-.result-report .report-summary>.report-section:first-child{padding-top:4px}
-.result-report .report-summary>:last-child{padding-bottom:0;border-bottom:0}
-.result-report .code-scroll.report{max-height:480px}
-.result-task{display:grid;gap:6px}
-.result-task .task-content{max-height:260px;overflow:auto;font-size:var(--text-sm);line-height:1.8;color:var(--gray-700)}
-.result-task .facts{margin-top:12px;gap:14px 20px}
-.result-config{margin-top:4px}
-@media(max-width:560px){
- .result-verdict{padding:14px}
- .result-section{padding-block:18px}
- .result-verdict{grid-template-columns:30px minmax(0,1fr);gap:4px 10px}
- .result-verdict-mark{width:30px;height:30px}
- .result-proof-code pre{padding:12px}
- .result-proof-code .source-line-numbers{flex-basis:34px;padding-inline:8px}
-}
-/* Trajectory tab: the run as a vertical list of mathematical steps; a step's code, diff or Lean feedback opens below it. */
-.trajectory-workspace{container-type:inline-size;min-width:0}
-.trajectory{display:grid;gap:12px;min-width:0;max-width:920px}
-.trajectory-roadmap{max-width:none}
-.trajectory-roadmap .solution-route{margin-top:6px}
-.trajectory-heading-actions{justify-content:flex-end;margin-bottom:-4px}
-@media(max-width:640px){.trajectory-heading-actions{justify-content:flex-start;margin-bottom:0}}
-.trajectory-view-toggle{display:flex;align-items:center;gap:3px;margin-left:auto;padding:4px;border:1px solid var(--gray-200);border-radius:12px;background:var(--card);box-shadow:0 4px 12px -10px rgb(20 20 19/.2)}
-.trajectory-view-toggle>button{display:flex;align-items:center;gap:6px;min-height:30px;padding:5px 12px;border:0;border-radius:8px;background:transparent;color:var(--gray-600);font:inherit;font-size:var(--text-xs);font-weight:500;cursor:pointer}
-.trajectory-view-toggle>button>svg{width:14px;height:14px}
-.trajectory-view-toggle>button[aria-pressed=true]{background:#141413;color:#f5f4ee;font-weight:600}
-:root[data-theme=dark] .trajectory-view-toggle>button[aria-pressed=true]{background:#e8e5dc;color:#141413}
-.roadmap-host{min-width:0}
-.roadmap-host[data-expanded]{min-height:560px}
-.research-roadmap{min-width:0;overflow:hidden;border:1px solid var(--gray-150);border-radius:var(--radius-lg);background:var(--card)}
-.roadmap-dialog{position:fixed;inset:0;width:calc(100vw - 32px);height:calc(100dvh - 32px);max-width:none;max-height:none;margin:auto;padding:0;border:0;border-radius:var(--radius-lg);background:var(--card);color:var(--gray-800);box-shadow:var(--shadow-panel)}
-.roadmap-dialog[open]{display:flex}
-.roadmap-dialog::backdrop{background:color-mix(in srgb,var(--shade) 45%,transparent);backdrop-filter:blur(3px)}
-.roadmap-dialog>.research-roadmap{display:flex;flex:1;flex-direction:column;min-height:0}
-.roadmap-dialog .roadmap-viewport{flex:1;height:auto;min-height:0}
-.roadmap-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;min-height:50px;padding:8px 14px;border-bottom:1px solid var(--gray-150)}
-.roadmap-toolbar>p{display:flex;align-items:center;gap:8px;margin:0;font-size:var(--text-sm);color:var(--gray-600)}
-.roadmap-toolbar>p>svg{width:16px;height:16px;color:var(--green-600)}
-.roadmap-zoom{display:flex;align-items:center;gap:4px;font-size:var(--text-sm);color:var(--gray-600)}
-.roadmap-zoom>.icon-button{width:28px;height:28px;min-height:28px}
-.roadmap-zoom-reset{min-width:48px;padding:5px 4px;border:0;border-radius:4px;background:transparent;color:var(--gray-700);font:inherit;cursor:pointer;font-variant-numeric:tabular-nums}
-.roadmap-zoom-reset:hover{background:var(--gray-100)}
-.roadmap-expand{display:flex;align-items:center;gap:7px;min-height:32px;margin-left:8px;padding:5px 10px;border:1px solid var(--gray-200);border-radius:4px;background:var(--card);color:var(--gray-800);font:inherit;font-size:var(--text-xs);cursor:pointer}
-.roadmap-expand>svg{width:15px;height:15px}
-.roadmap-zoom>.text-button{margin-left:5px;padding:3px 6px;font-size:var(--text-xs)}
-.roadmap-viewport{height:clamp(560px,calc(100dvh - 330px),960px);overflow:auto;overscroll-behavior:contain;cursor:grab;touch-action:pan-x pan-y;background:var(--gray-25);scrollbar-width:thin}
-.roadmap-viewport[data-dragging]{cursor:grabbing;user-select:none}
-.roadmap-viewport:focus-visible{outline:2px solid var(--blue-500);outline-offset:-2px}
-.roadmap-space{position:relative}
-.roadmap-canvas{position:relative;transform-origin:0 0}
-.roadmap-stage{position:absolute;top:32px;display:flex;align-items:baseline;gap:12px;padding-bottom:16px;border-bottom:1px solid var(--gray-200);color:var(--gray-600);font-size:13px;line-height:1.4}
-.roadmap-stage>span{color:var(--gray-500);font-size:11px;font-variant-numeric:tabular-nums}
-.roadmap-stage>strong{font-weight:500;letter-spacing:.02em}
-.roadmap-connectors{position:absolute;inset:0;overflow:visible;pointer-events:none}
-.roadmap-connectors>path{fill:none;stroke:var(--gray-400);stroke-width:1.5;transition:stroke .18s}
-.roadmap-connectors>path[data-active=false]{stroke:var(--gray-300);stroke-dasharray:5 5}
-.roadmap-connectors>path[data-edge-kind=dependency]{stroke:var(--sky-500);stroke-dasharray:3 4}
-.roadmap-connectors>path[data-edge-kind=guidance]{stroke:var(--blue-500);stroke-dasharray:6 5}
-.roadmap-connectors>path[data-edge-kind=guidance][data-active=false]{stroke:var(--gray-300)}
-.roadmap-connectors>path[data-highlighted=true]{stroke:var(--green-600);stroke-width:2.5}
-.roadmap-connectors>path[data-edge-kind=guidance][data-highlighted=true]{stroke:var(--blue-600)}
-.roadmap-connectors>path[data-edge-kind=guidance][data-active=false][data-highlighted=true]{stroke:var(--gray-500)}
-.roadmap-connectors>path[data-active=false][data-highlighted=true]{stroke:var(--gray-500)}
-.roadmap-node{position:absolute;display:flex;flex-direction:column;align-items:stretch;gap:18px;min-height:128px;padding:22px;border:1px solid var(--gray-200);border-radius:4px;background:var(--card);color:var(--gray-800);text-align:left;font:inherit;cursor:pointer;transition:border-color .18s,box-shadow .18s}
-.roadmap-node[data-node-kind=task]{min-height:232px}
-.roadmap-node:hover{border-color:var(--gray-400);box-shadow:var(--shadow-sm)}
-.roadmap-node:focus-visible{outline:3px solid var(--blue-500);outline-offset:3px}
-.roadmap-node[aria-pressed=true]{border-color:var(--green-600);box-shadow:0 0 0 2px var(--green-200)}
-.roadmap-node[data-node-kind=guidance]{border-color:var(--blue-200);background:var(--blue-50)}
-.roadmap-node[data-status=pending],.roadmap-node[data-status=muted]{border-style:dashed}
-.roadmap-node-heading{display:flex;align-items:center;gap:10px;min-width:0;line-height:1.5}
-.roadmap-node-heading>strong{font-size:17px;font-weight:600;overflow-wrap:anywhere}
-.roadmap-node[data-node-kind=task] .roadmap-node-heading{flex-direction:column;align-items:stretch;gap:14px}
-.roadmap-node[data-node-kind=task] .roadmap-node-heading>strong{font-family:var(--mono)}
-.roadmap-node-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--gray-600)}
-.roadmap-node-meta>svg{flex:none;width:16px;height:16px;color:var(--gray-500)}
-.roadmap-node[data-node-kind=guidance] .roadmap-node-meta>svg{color:var(--blue-600)}
-.roadmap-task-kind{color:var(--gray-600)}
-.roadmap-node-content{display:grid;gap:14px;min-width:0;line-height:1.75}
-.roadmap-node-statement{font-size:16px;color:var(--gray-800);overflow-wrap:anywhere}
-.roadmap-node-type{display:block;padding:16px 0;border-block:1px solid var(--gray-150);color:var(--gray-900);font-family:var(--mono);font-size:15px;line-height:1.8;white-space:pre-line;overflow-wrap:anywhere}
-.roadmap-node-objective,.roadmap-guidance-text{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;color:var(--gray-700);font-size:15px;overflow-wrap:anywhere}
-.roadmap-guidance-text{-webkit-line-clamp:4}
-.roadmap-dependencies{display:flex;align-items:baseline;gap:5px;color:var(--sky-700);font-size:12px;overflow-wrap:anywhere}
-.roadmap-dependencies>svg{flex:none;width:12px;height:12px}
-.roadmap-node-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;min-width:0;margin-top:auto;padding-top:6px;font-size:13px;color:var(--gray-600)}
-.roadmap-node-owner{min-width:0;overflow-wrap:anywhere}
-.roadmap-node-detail{font-size:14px;color:var(--gray-600);overflow-wrap:anywhere}
-.roadmap-status{display:flex;align-items:center;justify-content:center;gap:4px;color:var(--gray-600);font-size:12px;line-height:1.4}
-.roadmap-status>svg{width:13px;height:13px}
-.roadmap-status-dot{width:4px;height:4px;border-radius:50%;background:currentColor}
-.roadmap-node[data-status=passed] .roadmap-status{color:var(--green-700)}
-.roadmap-node[data-status=failed] .roadmap-status{color:var(--red-700)}
-.roadmap-node[data-status=running] .roadmap-status{color:var(--green-600)}
-.roadmap-attempts{display:flex;align-items:center;gap:5px;min-width:0}
-.roadmap-attempt{display:flex;align-items:center;gap:5px}
-.roadmap-attempt>span:last-child{display:flex;align-items:center;gap:3px;color:var(--gray-600);font-variant-numeric:tabular-nums}
-.roadmap-attempt>span:last-child>svg{width:11px;height:11px}
-.roadmap-attempt[data-outcome=passed]>span:last-child{color:var(--green-700)}
-.roadmap-attempt[data-outcome=failed]>span:last-child{color:var(--red-700)}
-.roadmap-attempts[data-single] .roadmap-attempt>span:last-child{color:var(--gray-600)}
-.roadmap-attempt-link,.roadmap-attempt-more{color:var(--gray-500);font-size:11px}
-.roadmap-legend{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding:10px 14px;border-top:1px solid var(--gray-150);font-size:var(--text-xs);color:var(--gray-600)}
-.roadmap-legend>span{display:flex;align-items:center;gap:6px}
-.roadmap-legend i{display:block;width:20px;height:0;border-top:1.5px solid var(--gray-400)}
-.roadmap-legend .roadmap-legend-guidance{border-color:var(--blue-500);border-top-style:dashed}
-.roadmap-legend .roadmap-legend-dependency{border-color:var(--sky-500);border-top-style:dotted}
-.roadmap-legend>.roadmap-hint{margin-left:auto;color:var(--gray-500)}
-.research-roadmap>.trajectory-note{padding:0 14px 10px}
-.roadmap-detail{padding:20px 22px;border:1px solid var(--gray-200);border-radius:16px;background:var(--card);box-shadow:0 12px 26px -22px rgb(20 20 19/.24)}
-.roadmap-detail>header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}
-.roadmap-detail>header>div>span{font-size:var(--text-xs);color:var(--gray-500)}
-.roadmap-detail h4{margin:3px 0 0;font-size:var(--text-base);font-weight:600}
-.roadmap-detail-summary{display:grid;gap:12px;margin-bottom:20px;color:var(--gray-700);font-size:14px;line-height:1.6}
-.roadmap-detail-summary>p{margin:0;overflow-wrap:anywhere}
-.roadmap-detail-actions{display:flex;flex-wrap:wrap;gap:10px;margin:0 0 20px}
-.result-agent-actions{margin-top:12px}
-.result-agent-actions>summary{width:fit-content;color:var(--gray-600);font-size:var(--text-xs);cursor:pointer}
-.result-agent-actions[open]>.agent-route{margin-top:12px}
-.trajectory-layout[data-mode=roadmap]:has(>.side-viewer[open]:not(:modal)){grid-template-columns:minmax(0,1fr)}
-.trajectory-layout[data-mode=roadmap]>.side-viewer[open]:not(:modal){max-height:600px}
-@media(max-width:640px){.trajectory-view-toggle{margin-left:0}.roadmap-toolbar{padding-inline:10px}.roadmap-toolbar>p{flex:1 0 100%}.roadmap-zoom{flex-wrap:wrap}.roadmap-expand{margin-left:3px}.roadmap-legend{padding-inline:10px}.roadmap-legend>.roadmap-hint{margin-left:0;flex:1 0 100%}.roadmap-detail{padding:12px}.roadmap-viewport{min-height:400px}.roadmap-dialog{width:100vw;height:100dvh;border-radius:0}}
-@media(prefers-reduced-motion:reduce){.roadmap-connectors>path,.roadmap-node{transition:none}}
-.trajectory-heading{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px}
-.trajectory-heading>h3{font-family:var(--serif);font-size:var(--text-lg);font-weight:400;line-height:1.4;color:var(--gray-900)}
-.trajectory-summary{font-size:var(--text-xs);color:var(--gray-500);font-variant-numeric:tabular-nums}
-.trajectory-filter{display:flex;align-items:center;gap:8px;margin:0;font-size:var(--text-xs);font-weight:400;color:var(--gray-500)}
-.trajectory-filter select{width:auto;max-width:240px;height:32px;padding:4px 26px 4px 9px;font-size:var(--text-xs);background-color:var(--card);background-position:right 7px center}
-.trajectory-earlier{justify-self:start}
-.trajectory-steps{list-style:none;margin:0;padding:0;display:grid}
-.trajectory-step{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr);gap:0 12px;padding-bottom:16px;outline:none}
-.trajectory-step:not(:last-child)::before{content:"";position:absolute;left:11px;top:26px;bottom:2px;width:2px;border-radius:1px;background:var(--gray-150)}
-.trajectory-marker{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin-top:1px;border-radius:50%;border:1.5px solid var(--gray-200);background:var(--card);color:var(--gray-500)}
-.trajectory-marker>svg{width:13px;height:13px}
-.trajectory-marker>.pulse-dot{width:7px;height:7px}
-.trajectory-step[data-tone=plain]>.trajectory-marker:empty::after,.trajectory-step[data-tone=muted]>.trajectory-marker:empty::after{content:"";width:6px;height:6px;border-radius:50%;background:var(--gray-300)}
-.trajectory-step[data-tone=passed]>.trajectory-marker{border-color:var(--green-200);background:var(--green-50);color:var(--green-600)}
-.trajectory-step[data-tone=failed]>.trajectory-marker:empty::after{content:"";width:7px;height:7px;border-radius:50%;background:var(--red-500)}
-.trajectory-step[data-tone=warning]>.trajectory-marker{border-color:var(--amber-200);background:var(--amber-50);color:var(--amber-600)}
-.trajectory-step[data-tone=running]>.trajectory-marker{border-color:var(--blue-100);background:var(--blue-50);color:var(--blue-600)}
-.trajectory-step[data-tone=human]>.trajectory-marker{border-color:var(--blue-100);background:var(--blue-50);color:var(--blue-700)}
-.trajectory-step[data-kind=evaluation][data-tone=passed]{padding:16px 18px;margin-bottom:12px;border:1.5px solid #415946;border-radius:14px;background:linear-gradient(155deg,#141a17 0%,#1a261f 100%);color:#f5f4ee;box-shadow:0 16px 30px -22px rgb(14 20 17/.55)}
-.trajectory-step[data-kind=evaluation][data-tone=passed]::before{display:none}
-.trajectory-step[data-kind=evaluation][data-tone=passed]>.trajectory-marker{border-color:rgb(169 189 139/.45);background:rgb(169 189 139/.16);color:#a9bd8b}
-.trajectory-step[data-kind=evaluation][data-tone=passed] .trajectory-line>h4,
-.trajectory-step[data-kind=evaluation][data-tone=passed] .trajectory-fold{color:#f5f4ee}
-.trajectory-step[data-kind=evaluation][data-tone=passed] .trajectory-line>time{color:#a8b5ab}
-.trajectory-step[data-kind=evaluation][data-tone=passed] .trajectory-result.passed{color:#a9bd8b;font-weight:600}
-.trajectory-main{display:grid;gap:5px;min-width:0;padding-top:2px}
-.trajectory-line{display:flex;align-items:baseline;gap:4px 12px;min-width:0}
-.trajectory-line>h4{display:flex;align-items:baseline;flex-wrap:wrap;gap:3px 8px;flex:1;min-width:0;margin:0;font-size:var(--text-sm);font-weight:600;line-height:1.55;color:var(--gray-800);overflow-wrap:anywhere}
-.trajectory-line>h4>.badge{align-self:center;font-weight:500}
-.trajectory-step[data-tone=muted]>.trajectory-main>.trajectory-line>h4{font-weight:400;color:var(--gray-500)}
-.trajectory-line>time{flex-shrink:0;font:var(--text-xs) var(--mono);color:var(--gray-500);font-variant-numeric:tabular-nums}
-.trajectory-meta{font-size:var(--text-xs);font-weight:400;color:var(--gray-500)}
-.trajectory-meta+.trajectory-meta::before{content:"·";margin-right:8px;color:var(--gray-300)}
-.trajectory-task{font:600 var(--text-sm) var(--mono);color:var(--gray-900)}
-.trajectory-result{margin:0;font-size:var(--text-sm);line-height:1.65;color:var(--gray-700);overflow-wrap:anywhere}
-.trajectory-result.passed{color:var(--green-700)}
-.trajectory-result.warning{color:var(--amber-700)}
-.trajectory-result.running{color:var(--blue-700)}
-.trajectory-chips{display:inline-flex;flex-wrap:wrap;align-items:baseline;gap:4px;vertical-align:baseline}
-.trajectory-chip,.trajectory-plan code,.trajectory-rechecks code,.trajectory-live code,.trajectory-step[data-kind=notice] h4 code{padding:0 6px;border-radius:var(--radius-sm);background:var(--gray-100);font:var(--text-xs)/1.7 var(--mono);color:var(--gray-700)}
-.trajectory-more,.trajectory-note{font-size:var(--text-xs);color:var(--gray-500)}
-.trajectory-note{margin:0;line-height:1.6}
-.trajectory-plan,.trajectory-rechecks,.trajectory-live{list-style:none;margin:0;padding:0;display:grid;gap:6px}
-.trajectory-plan>li{min-width:0}
-.trajectory-plan-line{display:flex;align-items:baseline;flex-wrap:wrap;gap:3px 8px;font-size:var(--text-xs);color:var(--gray-600)}
-.trajectory-kind{color:var(--gray-500)}
-.trajectory-dependency,.trajectory-change{display:inline-flex;flex-wrap:wrap;align-items:baseline;gap:4px}
-.trajectory-change+.trajectory-change::before{content:"·";margin-right:4px;color:var(--gray-300)}
-.trajectory-objective{margin:2px 0 0;font-size:var(--text-xs);line-height:1.6;color:var(--gray-600);overflow-wrap:anywhere;white-space:pre-wrap}
-.trajectory-rest>summary{cursor:pointer;font-size:var(--text-xs);color:var(--blue)}
-.trajectory-rest>ul,.trajectory-rest>p{margin-top:6px}
-.trajectory-rechecks>li,.trajectory-live>li{display:flex;align-items:baseline;flex-wrap:wrap;gap:3px 8px;font-size:var(--text-xs);color:var(--gray-600)}
-.trajectory-rechecks>li>svg{width:12px;height:12px;align-self:center}
-.trajectory-rechecks>li.passed>svg{color:var(--green-600)}
-.trajectory-dot{width:6px;height:6px;flex-shrink:0;align-self:center;border-radius:50%;background:var(--red-500)}
-.trajectory-rechecks>li.warning>svg{color:var(--amber-600)}
-.trajectory-live>li>span:first-child{font-weight:500;color:var(--gray-700)}
-.trajectory-live-latest{display:flex;align-items:baseline;gap:8px;margin:0 0 2px;font-size:var(--text-sm);color:var(--blue-700)}
-.trajectory-live-latest>time{flex-shrink:0;font:var(--text-xs) var(--mono);color:var(--gray-500);font-variant-numeric:tabular-nums}
-.trajectory-live-latest>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.trajectory-quote{margin:0;padding:2px 0 2px 10px;border-left:2px solid var(--gray-200);font-size:var(--text-xs);line-height:1.7;color:var(--gray-600);white-space:pre-wrap;overflow-wrap:anywhere}
-.trajectory-finding{font-size:var(--text-xs);line-height:1.7;color:var(--gray-600);white-space:pre-wrap;overflow-wrap:anywhere}
-.trajectory-actions{display:flex;flex-wrap:wrap;align-items:center;gap:2px 16px}
-.trajectory-actions .text-button>svg{width:13px;height:13px}
-.trajectory-panel{display:grid;gap:8px;min-width:0;margin-top:4px}
-.trajectory-file{display:flex;align-items:center;gap:6px;margin:0;font:var(--text-xs) var(--mono);color:var(--gray-500);overflow-wrap:anywhere}
-.trajectory-file>svg{width:13px;height:13px;flex-shrink:0}
-.trajectory-code{display:flex;align-items:flex-start;max-height:420px;overflow:auto;border-radius:var(--radius-md);background:var(--gray-50);scrollbar-width:thin}
-.trajectory-code pre{margin:0;padding:12px 14px;font:var(--text-xs)/1.9 var(--mono);tab-size:2;white-space:pre}
-.trajectory-code .trajectory-line-numbers{position:sticky;left:0;z-index:1;flex:0 0 44px;padding-inline:10px;text-align:right;color:var(--gray-500);background:var(--gray-50);border-right:1px solid var(--gray-100);user-select:none;font-variant-numeric:tabular-nums}
-.trajectory-code-text{flex:1;min-width:max-content;color:var(--gray-600)}
-/* A failed step's code: Lean's messages under the lines they are about. Each row of a message is one line high and the
- number column has a blank row beside it, so the numbers stay level with their lines; a message never widens the code. */
-.trajectory-code .lean-line[data-marked]{display:block;min-height:calc(var(--text-xs) * 1.9);background:var(--red-50);box-shadow:-14px 0 0 var(--red-50),14px 0 0 var(--red-50)}
-.lean-marks{display:block;contain:inline-size;user-select:none}
-.lean-marks:focus-visible{outline:2px solid var(--blue-500);outline-offset:-2px}
-.lean-marks>.lean-mark{display:block;padding-inline:10px;border-left:2px solid var(--red-500);background:color-mix(in srgb,var(--red-50) 55%,var(--card))}
-.lean-marks>.lean-mark[data-severity="warning"]{border-left-color:var(--amber-500);background:color-mix(in srgb,var(--amber-50) 55%,var(--card))}
-.lean-mark-title,.lean-mark-row{display:block;height:calc(var(--text-xs) * 1.9);overflow:hidden;white-space:pre;text-overflow:ellipsis}
-.lean-mark-title{display:flex;align-items:center;gap:5px;font:500 var(--text-xs)/1.9 var(--sans);color:var(--red-700)}
-.lean-mark[data-severity="warning"] .lean-mark-title{color:var(--amber-700)}
-.lean-mark-title>svg{width:12px;height:12px;flex-shrink:0}
-.lean-mark-row{color:var(--gray-700)}
-.lean-mark-more{font-family:var(--sans);color:var(--gray-500)}
-.lean-mark-more>.text-button{padding:0;font:inherit;line-height:inherit}
-.trajectory-line-marked,.trajectory-gutter>[data-marked]{color:var(--red-600);font-weight:600}
-.trajectory-marks-summary{display:grid;gap:4px}
-.trajectory-marks-summary>p{display:flex;align-items:center;flex-wrap:wrap;gap:4px 10px;margin:0;font-size:var(--text-xs);color:var(--gray-600)}
-.trajectory-marks-summary>p>svg{width:13px;height:13px;flex-shrink:0;color:var(--red-600)}
-.trajectory-marks-summary .text-button{padding:0}
-.lean-location{display:inline;padding:0;border:0;background:none;font:inherit;color:var(--blue);text-decoration:underline;text-underline-offset:2px;cursor:pointer}
-.lean-location:hover{color:var(--blue-700)}
-.trajectory-panel>.diff-toolbar{padding:0}
-.trajectory-diff{max-height:420px;overflow:auto;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25);scrollbar-width:thin}
-.trajectory-feedback{display:grid;gap:8px;min-width:0}
-.trajectory-feedback>.diagnostic-entry{margin-top:0}
-.trajectory-feedback h5{font-size:var(--text-xs);font-weight:500;color:var(--gray-500);margin:0 0 5px}
-.trajectory-loading,.trajectory-error{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;margin:0;font-size:var(--text-xs);color:var(--gray-500)}
-.trajectory-error{color:var(--red-600)}
-.trajectory-tally{display:grid;gap:6px;padding:16px 0 0;border-top:1px solid var(--gray-150)}
-.trajectory-tally>h4{margin:0;font-size:var(--text-xs);font-weight:500;color:var(--gray-500)}
-.trajectory-tally-line{margin:0;font-size:var(--text-sm);font-weight:500;color:var(--gray-800);font-variant-numeric:tabular-nums}
-.trajectory-tally-agents{list-style:none;margin:0;padding:0;display:grid;gap:3px;font-size:var(--text-xs);color:var(--gray-600)}
-.trajectory-tally-agents>li{min-width:0;line-height:1.7;overflow-wrap:anywhere}
-.trajectory-tally-agents strong{margin-right:4px;font-weight:500;color:var(--gray-800)}
-.trajectory-tally-part{display:inline-block;max-width:100%}
-.trajectory-empty{margin:0;padding:24px;border:1px dashed var(--gray-200);border-radius:var(--radius-lg);background:var(--gray-50);font-size:var(--text-sm);color:var(--gray-500)}
-/* 问为什么: the reader's questions on the right, the model's answers as plain text, the box to ask below. */
-.trajectory-ask{display:grid;gap:14px;min-width:0}
-.trajectory-ask-cost{display:flex;align-items:flex-start;gap:8px;margin:0;padding:8px 11px;border-radius:var(--radius-md);background:var(--gray-50);font-size:var(--text-xs);line-height:1.65;color:var(--gray-600)}
-.trajectory-ask-cost>svg{flex-shrink:0;width:13px;height:13px;margin-top:3px;color:var(--gray-500)}
-.trajectory-ask-cost>span{flex:1;min-width:0;overflow-wrap:anywhere}
-.trajectory-ask-thread{display:grid;gap:16px;margin:0;padding:0;list-style:none}
-.trajectory-ask-turn{display:grid;gap:8px;min-width:0}
-.trajectory-ask-question{justify-self:end;max-width:85%;margin:0;padding:7px 12px;border-radius:var(--radius-md);background:var(--gray-100);font-size:var(--text-sm);line-height:1.65;color:var(--gray-800);white-space:pre-wrap;overflow-wrap:anywhere}
-.trajectory-ask-answer{display:grid;gap:8px;min-width:0;font-size:var(--text-sm);line-height:1.8;color:var(--gray-800);overflow-wrap:anywhere}
-.trajectory-ask-answer>p{margin:0;white-space:pre-wrap}
-.trajectory-ask-answer code{padding:1px 4px;border-radius:4px;background:var(--gray-50);font:.92em var(--mono)}
-.trajectory-ask-code{margin:0;padding:10px 12px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25);font:var(--text-xs)/1.8 var(--mono);color:var(--gray-600);white-space:pre;tab-size:2;overflow:auto;scrollbar-width:thin}
-.trajectory-ask-form{display:grid;gap:8px;min-width:0}
-.trajectory-ask-form textarea{min-height:76px;font-size:var(--text-sm)}
-.trajectory-ask-form textarea[readonly]{color:var(--gray-500)}
-.trajectory-ask-key{display:grid;gap:4px;font-size:var(--text-xs);color:var(--gray-600)}
-.trajectory-ask-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px}
-.trajectory-ask-hint{display:flex;align-items:center;flex-wrap:wrap;gap:4px 10px;margin:2px 0 0;font-size:var(--text-xs);color:var(--gray-500)}
-.trajectory-ask-hint .text-button>svg{width:13px;height:13px}
-@media(max-width:560px){
- .trajectory-step{grid-template-columns:22px minmax(0,1fr);gap:0 10px;padding-bottom:14px}
- .trajectory-step:not(:last-child)::before{left:10px;top:24px}
- .trajectory-marker{width:22px;height:22px}
- .trajectory-line{flex-wrap:wrap}
- .trajectory-filter select{max-width:100%;height:36px}
- .trajectory-code pre{padding:10px}
- .trajectory-code .trajectory-line-numbers{flex-basis:34px;padding-inline:8px}
- .trajectory-ask-question{max-width:100%}
-}
-/* A finished run's code on a phone: each line numbers itself and wraps under its number instead of running off the screen. */
-@media(max-width:560px){
- .lean-wrap>pre[aria-hidden]{display:none}
- .lean-wrap>pre:not([aria-hidden]){flex:1;min-width:0;padding-left:42px;white-space:pre-wrap;overflow-wrap:anywhere;counter-reset:lean-line;background:linear-gradient(90deg,var(--gray-50) 0 33px,var(--gray-150) 33px 34px,transparent 34px)}
- .lean-wrap .lean-line{position:relative;counter-increment:lean-line}
- .lean-wrap .lean-line::before{content:counter(lean-line);position:absolute;left:-40px;width:30px;text-align:right;color:var(--gray-500);user-select:none;font-variant-numeric:tabular-nums}
- .lean-wrap .lean-line[data-marked]{box-shadow:-8px 0 0 var(--red-50),10px 0 0 var(--red-50)}
- .lean-wrap .lean-line[data-marked]::before{color:var(--red-600);font-weight:600}
- .lean-wrap .lean-mark-title,.lean-wrap .lean-mark-row{height:auto;white-space:pre-wrap;overflow-wrap:anywhere}
-}
-/* Folding: a settled step is its title line; the whole line is the toggle. */
-.trajectory-heading>.trajectory-detail-toggle{margin-left:auto;align-self:center}
-.trajectory-body{display:grid;gap:5px;min-width:0}
-.trajectory-line>h4:has(>.trajectory-fold){display:block}
-.trajectory-fold{display:inline-flex;align-items:baseline;flex-wrap:wrap;gap:3px 8px;max-width:100%;min-height:24px;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;overflow-wrap:anywhere}
-.trajectory-fold:hover{color:var(--gray-900)}
-.trajectory-fold>.badge{align-self:center;font-weight:500}
-.trajectory-fold>svg{align-self:center;width:13px;height:13px;flex-shrink:0;color:var(--gray-400);transition:transform .15s var(--ease-out)}
-.trajectory-fold[aria-expanded=true]>svg{transform:rotate(90deg)}
-.trajectory-step[data-open=false]{padding-bottom:10px}
-/* 详细: a task's consecutive attempts under one line; each attempt is a smaller step of its own. */
-.trajectory-retries{margin-top:6px}
-.trajectory-retries>.trajectory-step{grid-template-columns:18px minmax(0,1fr);gap:0 10px;padding-bottom:10px}
-.trajectory-retries>.trajectory-step:last-child{padding-bottom:0}
-.trajectory-retries>.trajectory-step:not(:last-child)::before{left:8px;top:21px}
-.trajectory-retries>.trajectory-step>.trajectory-marker{width:18px;height:18px;margin-top:2px}
-.trajectory-retries>.trajectory-step>.trajectory-marker>svg{width:11px;height:11px}
-.trajectory-retries .trajectory-line>h4{font-size:var(--text-xs)}
-/* A running step's title line carries a slow sweep. */
-.trajectory-step[data-tone=running]>.trajectory-main>.trajectory-line{position:relative;isolation:isolate}
-.trajectory-step[data-tone=running]>.trajectory-main>.trajectory-line::after{content:"";position:absolute;inset:-2px -6px;z-index:-1;border-radius:var(--radius-sm);pointer-events:none;
- background:linear-gradient(90deg,transparent 35%,color-mix(in srgb,var(--blue-500) 13%,transparent) 50%,transparent 65%) no-repeat;background-size:250% 100%;animation:trajectory-sweep 2.2s linear infinite}
-@keyframes trajectory-sweep{from{background-position:150% 0}to{background-position:-50% 0}}
-@media(prefers-reduced-motion:reduce){.trajectory-step[data-tone=running]>.trajectory-main>.trajectory-line::after{display:none}}
-/* 回到最新 sits at the bottom of the panel while the reader is further up. */
-.trajectory-latest{position:sticky;bottom:12px;z-index:3;justify-self:center;display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:6px 14px;border:1px solid var(--gray-200);border-radius:999px;background:var(--card);box-shadow:var(--shadow-md);color:var(--gray-700);font-size:var(--text-xs);font-weight:500}
-.trajectory-latest:hover{color:var(--gray-900);border-color:var(--gray-300)}
-.trajectory-latest>svg{width:14px;height:14px}
-.trajectory-filters{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px}
-.trajectory-window{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px 8px;margin:0;padding:3px 10px;border:1px solid var(--blue-100);border-radius:var(--radius-md);background:var(--blue-50);font-size:var(--text-xs);color:var(--gray-700);font-variant-numeric:tabular-nums}
-.trajectory-window>svg{width:13px;height:13px;color:var(--blue-600)}
-/* The time overview: one lane per Agent, blocks at their real times. */
-.trajectory-overview{display:grid;gap:6px;margin:0;padding:10px 12px 8px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25)}
-.trajectory-overview>figcaption{display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 10px;font-size:var(--text-xs);font-weight:600;color:var(--gray-700)}
-.trajectory-overview>figcaption>.trajectory-note{font-weight:400}
-.trajectory-lanes{position:relative;display:grid;gap:4px;padding:2px 0;border-radius:var(--radius-sm);user-select:none;touch-action:pan-y;cursor:crosshair}
-.trajectory-lanes:focus-visible{outline:2px solid var(--blue-500);outline-offset:3px}
-.trajectory-lane,.trajectory-axis{display:grid;grid-template-columns:minmax(56px,96px) minmax(0,1fr);gap:8px;align-items:center}
-.trajectory-lane-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);color:var(--gray-600)}
-.trajectory-lane-track{position:relative;height:14px;border-radius:3px;background:var(--gray-100)}
-.trajectory-block{position:absolute;top:2px;bottom:2px;border-radius:2px;background:var(--gray-300);cursor:pointer}
-.trajectory-block.passed{background:var(--green-500)}
-.trajectory-block.failed{background:var(--red-300)}
-.trajectory-block.warning{background:var(--amber-300)}
-.trajectory-block.running{background:linear-gradient(90deg,var(--blue-300) 0 40%,var(--blue-100) 50%,var(--blue-300) 60% 100%);background-size:250% 100%;animation:stage-flow 1.8s linear infinite}
-.trajectory-block.cursor{outline:2px solid var(--gray-800);outline-offset:1px;z-index:1}
-.trajectory-axis-track{position:relative;display:flex;justify-content:space-between;height:16px;font:var(--text-xs)/16px var(--mono);color:var(--gray-500);font-variant-numeric:tabular-nums}
-.trajectory-overlay{position:absolute;inset:0 0 20px;display:grid;grid-template-columns:minmax(56px,96px) minmax(0,1fr);gap:8px;pointer-events:none}
-.trajectory-overlay-track{position:relative}
-.trajectory-brush,.trajectory-window-mark{position:absolute;top:0;bottom:0;border-radius:3px}
-.trajectory-brush{background:color-mix(in srgb,var(--blue-500) 16%,transparent);border:1px solid var(--blue-300)}
-.trajectory-brush[hidden]{display:none}
-.trajectory-window-mark{background:color-mix(in srgb,var(--blue-500) 9%,transparent);border-inline:2px solid var(--blue-500)}
-/* Line numbers as buttons while the run goes on: each adds its line to the guidance draft. */
-.trajectory-gutter{display:flex;flex-direction:column;align-items:stretch;margin:0;padding-block:12px}
-.trajectory-gutter>span{display:block;height:calc(var(--text-xs) * 1.9);padding-inline-end:1px;font:var(--text-xs)/1.9 var(--mono);text-align:right;font-variant-numeric:tabular-nums}
-.trajectory-gutter>button{display:block;min-height:0;height:calc(var(--text-xs) * 1.9);padding:0;border:0;border-radius:3px;background:none;color:inherit;font:var(--text-xs)/1.9 var(--mono);text-align:right;font-variant-numeric:tabular-nums;cursor:pointer}
-.trajectory-gutter>button:hover,.trajectory-gutter>button:focus-visible{background:var(--blue-50);color:var(--blue-700)}
-.trajectory-gutter>button:hover::before,.trajectory-gutter>button:focus-visible::before{content:"+ ";font-weight:600}
-.trajectory-gutter>button:focus-visible{outline:2px solid var(--blue-500);outline-offset:-2px}
-.trajectory-actions .text-button.active{color:var(--gray-900);font-weight:500}
-@media(max-width:560px){
- .trajectory-lane,.trajectory-axis,.trajectory-overlay{grid-template-columns:minmax(44px,64px) minmax(0,1fr)}
- .trajectory-latest{bottom:8px}
-}
-/* The side viewer: a sticky column of its host when that is wide (opened with show()), a full-screen dialog when not. */
-.side-viewer{flex-direction:column;min-width:0;padding:0;border:1px solid var(--gray-150);border-radius:var(--radius-lg);background:var(--card);color:inherit;overflow:hidden}
-.side-viewer[open]{display:flex}
-.side-viewer:not(:modal){position:sticky;top:0;inset-inline:auto;z-index:2;align-self:start;width:auto;height:auto;max-width:none;max-height:var(--viewer-height,70vh);margin:0;box-shadow:var(--shadow-panel)}
-.side-viewer:modal{position:fixed;inset:0;width:min(960px,calc(100vw - 32px));height:calc(100dvh - 32px);max-width:none;max-height:none;margin:auto;box-shadow:var(--shadow-card)}
-.side-viewer::backdrop{background:color-mix(in srgb,var(--shade) 40%,transparent)}
-@media(max-width:720px){.side-viewer:modal{width:100vw;height:100dvh;border:0;border-radius:0}}
-.side-viewer-heading{display:flex;align-items:center;gap:8px;padding:10px 10px 10px 16px;border-bottom:1px solid var(--gray-150)}
-.side-viewer-title{flex:1;min-width:0}
-.side-viewer-title>h4{margin:0;font-size:var(--text-sm);font-weight:600;line-height:1.5;color:var(--gray-900);overflow-wrap:anywhere}
-.side-viewer-title>p{margin:0;font-size:var(--text-xs);line-height:1.5;color:var(--gray-500);overflow-wrap:anywhere}
-.side-viewer-modes{align-self:flex-start;margin:10px 16px 0}
-.side-viewer-body{flex:1;min-height:0;overflow:auto;padding:12px 16px 16px;scrollbar-width:thin;overscroll-behavior:contain}
-.side-viewer-body .trajectory-code,.side-viewer-body .trajectory-diff{max-height:none}
-.side-viewer-body .result-proof-code,.side-viewer-body .diagnostic-output{max-height:none}
-/* Hosts: two columns while a non-modal viewer is open in them. */
-.trajectory-layout,.result-layout{min-width:0}
-.trajectory-layout:has(>.side-viewer[open]:not(:modal)),.result-layout:has(>.side-viewer[open]:not(:modal)){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:16px;align-items:start}
-.trajectory-layout:has(>.side-viewer[open]:not(:modal))>.trajectory{max-width:none}
-/* Motion: the status that changes in place, counts that roll, marks that breathe while work goes on, placeholders shaped like what loads. */
-.detail-statusline .badge{transition:background-color .4s,color .4s}
-.badge[data-rolling]{overflow:hidden}
-.badge-label{position:relative}
-/* While a status rolls, the old and new labels pass through the label's box; its own text stays the new label for readers. */
-.badge-label[data-roll-to]{-webkit-text-fill-color:transparent}
-.badge-label[data-roll-to]::before,.badge-label[data-roll-to]::after{position:absolute;inset:0;display:block;white-space:nowrap;-webkit-text-fill-color:currentColor;pointer-events:none}
-.badge-label[data-roll-to]::before{content:attr(data-roll-to)}
-.badge-label[data-roll-to]::after{content:attr(data-roll-from)}
-.ticker{white-space:nowrap}
-.ticker-digit{position:relative;display:inline-block;font-variant-numeric:tabular-nums}
-/* A rolling digit shows a column of 0–9 through its own box. */
-.ticker-digit[data-rolling]{-webkit-text-fill-color:transparent;clip-path:inset(0)}
-.ticker-digit[data-rolling]::before{content:"0\A 1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9";position:absolute;top:0;left:0;right:0;text-align:center;white-space:pre;-webkit-text-fill-color:currentColor}
-.pulse-dot{position:relative;display:block;width:8px;height:8px;border-radius:50%;background:currentColor;animation:pulse-breathe 2s ease-in-out infinite}
-.pulse-dot::after{content:"";position:absolute;inset:-4px;border-radius:50%;background:currentColor;opacity:.16;animation:pulse-halo 2s ease-in-out infinite}
-@keyframes pulse-breathe{0%,100%{opacity:.45;transform:scale(.94)}50%{opacity:1;transform:scale(1)}}
-@keyframes pulse-halo{0%,100%{transform:scale(.6);opacity:0}50%{transform:scale(1);opacity:.18}}
-.result-verdict-ring{position:absolute;inset:0;border-radius:50%;border:2px solid var(--green-500);pointer-events:none}
-/* Loading placeholders take the shape of what arrives: steps, code, lines of a structure. */
-.skeleton-block{display:grid;gap:10px;min-width:0}
-.skeleton-steps{list-style:none;margin:0;padding:4px 0;display:grid;gap:14px}
-.skeleton-steps>li{display:flex;align-items:center;gap:12px}
-.skeleton-steps i,.skeleton-code i,.skeleton-lines i{display:block;height:10px;border-radius:999px;background:linear-gradient(90deg,var(--gray-100) 0 40%,var(--gray-50) 50%,var(--gray-100) 60% 100%);background-size:300% 100%;animation:skeleton-sweep 1.9s cubic-bezier(.32,0,.16,1) infinite}
-.skeleton-steps i.skeleton-dot{flex-shrink:0;width:24px;height:24px;border-radius:50%}
-.skeleton-code{display:grid;gap:9px;padding:14px 15px;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--gray-25)}
-.skeleton-code i{height:9px}
-.skeleton-lines{display:grid;gap:9px;padding:10px 0 2px}
-@keyframes skeleton-sweep{0%{background-position:100% 0}70%,100%{background-position:0 0}}
-/* A declaration in the proof structure opens the source at its line. */
-.outline-jump{display:inline-flex;align-items:baseline;flex-wrap:wrap;gap:2px 8px;min-width:0;padding:0;border:0;background:none;color:inherit;text-align:left;cursor:pointer}
-.outline-jump>code{font-size:var(--text-xs);line-height:1.8;min-width:0;overflow-wrap:anywhere;white-space:pre-wrap;color:var(--gray-800);text-decoration:underline;text-decoration-color:var(--gray-200);text-underline-offset:3px;transition:color .18s,text-decoration-color .18s}
-.outline-jump>svg{width:12px;height:12px;align-self:center;color:var(--gray-400);transform:translate(-2px,2px);opacity:0;transition:opacity .18s,transform .3s var(--ease-expo)}
-.outline-jump:hover>code,.outline-jump:focus-visible>code{color:var(--blue-700);text-decoration-color:currentColor}
-.outline-jump:hover>svg,.outline-jump:focus-visible>svg{opacity:1;transform:none;color:var(--blue-600)}
-/* 目录: the declarations of the shown source, under its toolbar. */
-.source-outline-toggle .field-count{margin-left:1px}
-.source-outline-toggle[aria-expanded=true]{color:var(--green-700)}
-.source-outline{margin:2px 0 9px;max-height:260px;overflow:auto;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--card);scrollbar-width:thin;overscroll-behavior:contain}
-.source-outline:not([hidden]){animation:outline-open .32s var(--ease-expo)}
-@keyframes outline-open{from{opacity:0;transform:translateY(-4px)}}
-.source-outline-list{list-style:none;margin:0;padding:4px;display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;gap:1px 0}
-.source-outline-list>li{display:contents}
-.source-outline-item{display:grid;grid-column:1 / -1;grid-template-columns:subgrid;align-items:center;gap:0 10px;min-height:30px;padding:3px 8px;border:0;border-radius:var(--radius-sm);background:transparent;text-align:left;font-size:var(--text-xs);color:var(--gray-700)}
-.source-outline-item:hover{background:var(--gray-50)}
-.source-outline-item[aria-current=location]{background:var(--green-50);color:var(--green-700)}
-/* One row each, whatever the order of the parts in the item. */
-.source-outline-item>*{grid-row:1}
-.source-outline-item>code{grid-column:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs)}
-.source-outline-item>.badge{grid-column:2;min-height:18px;padding-block:0}
-.source-outline-kind{grid-column:3;color:var(--gray-500);white-space:nowrap}
-.source-outline-line{grid-column:4;min-width:3ch;text-align:right;color:var(--gray-500);font-variant-numeric:tabular-nums}
-@media(prefers-reduced-motion:reduce){
- .pulse-dot{opacity:1}
-}
-
-/* Motion, both ways: a surface leaves the way it came, quicker and accelerating; menus grow from their button, folds open
- to their height, the history's selection slides between rows, a new record unfolds, and a theme spreads from where it was chosen. */
-@media(prefers-reduced-motion:no-preference){
- /* Entrances use Web Animations (motion.ts). A closing dialog stays painted while it fades without taking clicks or focus. */
- :is(.confirm-dialog,.settings-dialog,.source-editor,.command-palette,.collab-plan-dialog):not([open]){opacity:0;scale:.98;pointer-events:none;
- transition:opacity .16s var(--ease-in),scale .16s var(--ease-in),overlay .16s allow-discrete,display .16s allow-discrete}
- :is(.confirm-dialog,.settings-dialog,.source-editor,.command-palette,.collab-plan-dialog,.history-dialog):not([open]){interactivity:inert}
- :is(.confirm-dialog,.settings-dialog,.source-editor,.command-palette,.collab-plan-dialog,.history-dialog)::backdrop{transition:opacity .28s var(--ease-out),overlay .28s allow-discrete,display .28s allow-discrete}
- @starting-style{:is(.confirm-dialog,.settings-dialog,.source-editor,.command-palette,.collab-plan-dialog,.history-dialog)[open]::backdrop{opacity:0}}
- :is(.confirm-dialog,.settings-dialog,.source-editor,.command-palette,.collab-plan-dialog,.history-dialog):not([open])::backdrop{opacity:0;pointer-events:none;
- transition:opacity .16s var(--ease-in),overlay .16s allow-discrete,display .16s allow-discrete}
- /* The plan dialog has no tween of its own. */
- @starting-style{.collab-plan-dialog[open]{opacity:0;scale:.98}}
- .collab-plan-dialog[open]{transition:opacity .32s var(--ease-expo),scale .32s var(--ease-expo)}
- /* The history drawer wipes back to the edge it opened from. */
- .history-dialog:not([open]){clip-path:inset(0 100% 0 0);pointer-events:none;
- transition:clip-path .24s var(--ease-in),overlay .24s allow-discrete,display .24s allow-discrete}
- .history-dialog:not([open])::backdrop{transition-duration:.24s}
- /* A notice rises into place and sinks away; over a dialog, at the top edge, it drops in from above. */
- .toast{transition:opacity .2s var(--ease-in),translate .2s var(--ease-in),scale .2s var(--ease-in),overlay .2s allow-discrete,display .2s allow-discrete}
- .toast:popover-open{transition-duration:.42s;transition-timing-function:var(--ease-expo)}
- .toast:not(:popover-open){opacity:0;translate:0 10px;scale:.96}
- @starting-style{.toast:popover-open{opacity:0;translate:0 14px;scale:.96}}
- body:has(dialog:modal)>.toast:not(:popover-open){translate:0 -10px}
- @starting-style{body:has(dialog:modal)>.toast:popover-open{translate:0 -14px}}
- /* clip-path from none does not interpolate; open, the clip leaves room for the drawer's shadow. */
- .history-dialog[open]{clip-path:inset(0 -60px 0 0)}
- /* Folds open to their content's height and close back to the summary. Opening, the content is there at once (focus, find
- and screen readers reach it while the height grows); closing, it stays painted until the fold has shut. */
- :is(.target-diagnostics,.goal-group,.collab-detail,.preview-task,.module-library,.trajectory-rest,.route-item>details){interpolate-size:allow-keywords}
- :is(.target-diagnostics,.goal-group,.collab-detail,.preview-task,.module-library,.trajectory-rest,.route-item>details)::details-content{block-size:0;overflow:clip;overflow-clip-margin:6px;
- transition:block-size .3s var(--ease-expo),content-visibility .3s allow-discrete}
- :is(.target-diagnostics,.goal-group,.collab-detail,.preview-task,.module-library,.trajectory-rest,.route-item>details)[open]::details-content{block-size:auto;
- transition:block-size .3s var(--ease-expo)}
- /* ⋯ grows from its button and shrinks back into it. Its items stay painted for the shrink only where they can be taken out
- of reach meanwhile; otherwise a dialog opened from one and dismissed at once would hand focus back to the vanishing item. */
- .run-menu-panel{transform-origin:calc(100% - 17px) -6px;transition:opacity .14s var(--ease-in),scale .14s var(--ease-in),translate .14s var(--ease-in)}
- .run-menu:not([open]) .run-menu-panel{opacity:0;scale:.94;translate:0 -4px;pointer-events:none;interactivity:inert}
- .run-menu[open] .run-menu-panel{transition-duration:.26s;transition-timing-function:var(--ease-expo)}
- @starting-style{.run-menu[open] .run-menu-panel{opacity:0;scale:.94;translate:0 -4px}}
- @supports(interactivity:inert){.run-menu:not([open])::details-content{transition:content-visibility .14s allow-discrete}}
- .run-menu-item{transition:background-color .15s,color .15s}
- /* Rows answer the pointer softly; a chosen row's own card appears at once, under the sliding one. */
- .run-row{transition:background-color .18s,border-color .18s}
- .run-row.selected{transition:none}
- .run-list[data-gliding]::before{content:"";position:absolute;top:0;left:0;z-index:-1;border:1px solid var(--gray-150);border-radius:var(--radius-md);background:var(--card);pointer-events:none}
- .run-list[data-gliding] .run-row.selected{background:transparent;border-color:transparent}
- /* The docked history folds shut and opens again beside the workspace (app.ts marks the change); its list keeps its width while the column narrows over it. */
- body[data-history-folding] .history-sidebar{overflow:hidden;transition:flex-basis .32s var(--ease-expo),width .32s var(--ease-expo),display .32s allow-discrete}
- body[data-history-folding] .history-sidebar>.run-history{flex:0 0 var(--sidebar-width);width:var(--sidebar-width)}
- body[data-history-folding][data-history-collapsed=true] .history-sidebar{flex-basis:0;width:0}
- @starting-style{body[data-history-folding]:not([data-history-collapsed]) .history-sidebar{flex-basis:0;width:0}}
- /* The theme spreads over the old one from where it was chosen (motion.ts); the page underneath stays clickable. */
- :root[data-theme-reveal]::view-transition-old(root),:root[data-theme-reveal]::view-transition-new(root){animation:none;mix-blend-mode:normal}
- :root[data-theme-reveal]::view-transition{pointer-events:none}
-}
-/* The proof document and its comparison panes. The formalization report shares the pane styles. */
-.explain-root{
- --proof-gutter:clamp(16px,2.4vw,48px);--reading-width:740px;--proof-shell-width:1240px
-}
-@media screen and (min-width:1024px){
- .explain-root{--proof-gutter:64px}
-}
-.explain-root .explain-topbar{padding-inline:0}
-.explain-topbar-inner,.explain-workspace{
- width:min(calc(100% - 2 * var(--proof-gutter)),var(--proof-shell-width));margin-inline:auto
-}
-.explain-topbar-inner{
- display:flex;align-items:center;gap:clamp(8px,1.2vw,14px);min-width:0;position:relative
-}
-.explain-topbar-inner .skip-link{
- position:absolute;inset-inline-start:0;inset-block-start:50%;transform:translateY(-50%);clip-path:inset(50%)
-}
-.explain-topbar-inner .skip-link:focus{clip-path:none}
-.explain-topbar-inner .workspace-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.explain-topbar .brand-os{color:var(--blue-700)}
-.explain-topbar .explain-kind{font-size:var(--text-sm);font-weight:500;color:var(--gray-700);white-space:nowrap}
-.explain-topbar .locale-switch{min-height:32px;padding:5px 10px;border:1px solid transparent;border-radius:var(--radius-md);font-size:var(--text-xs);color:var(--gray-700);text-decoration:none}
-.explain-topbar .locale-switch:hover{background:var(--gray-100);color:var(--ink);text-decoration:none}
-.explain-topbar #explain-back{min-height:32px;padding:5px 11px;font-size:var(--text-xs)}
-.explain-shell{flex:1;min-height:0;display:flex;flex-direction:column}
-.explain-shell:has(.explain-lead-title)>#explain-page-heading{display:none}
-.explain-state{padding:28px 24px;color:var(--gray-600);font-size:var(--text-sm);display:flex;align-items:center;gap:8px}
-.explain-missing{margin:32px auto;width:min(100% - 32px,560px)}
-.explain-content{flex:1;min-height:0;display:flex;flex-direction:column}
-.explain-workspace{display:flex;flex:1;min-height:0;flex-direction:column;padding-block-end:clamp(10px,4dvh,24px)}
-.explain-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;padding:10px 22px;border-bottom:1px solid var(--line);background:var(--card)}
-.explain-controls{flex:none;border-bottom:1px solid var(--line)}
-.explain-controls-inner{
- display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 14px;
- min-height:52px;padding-block:6px
-}
-#explain-toolbar{min-width:0;max-width:100%;padding:0;border:0;background:none;gap:6px 12px}
-#explain-prose-head{min-width:0;max-width:100%}
-#explain-prose-head:empty{display:none}
-.explain-target{display:flex;align-items:center;gap:8px;min-width:0;margin-right:auto}
-.explain-target label,.explain-target-label{margin:0;font-size:var(--text-xs);color:var(--gray-500);font-weight:500;white-space:nowrap}
-.explain-target select{height:32px;padding:4px 28px 4px 9px;font:var(--text-xs) var(--mono);line-height:1.35;background-position:right 8px center;max-width:min(52vw,420px)}
-.explain-target code{font-size:var(--text-sm);color:var(--gray-800);overflow-wrap:anywhere;text-wrap:balance}
-.explain-pane-switch,.explain-layout-switch{display:none}
-.explain-split{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
-.explain-pane{min-height:0;min-width:0;display:flex;flex-direction:column}
-.explain-pane-lean{border-right:1px solid var(--line);background:var(--gray-25)}
-.explain-pane-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px;padding:5px 12px 5px 18px;border-bottom:1px solid var(--line);background:var(--card)}
-.explain-pane-head :is(h2,.explain-pane-label){font-size:var(--text-sm);font-weight:600;color:var(--gray-700)}
-.explain-count{font-size:var(--text-xs);color:var(--gray-500)}
-.explain-head-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;max-width:100%;margin-left:auto}
-.explain-contents-button{width:auto;min-width:34px;gap:6px;padding-inline:8px;color:var(--gray-700);white-space:nowrap;font-size:var(--text-xs)}
-.explain-contents-button>svg{width:15px;height:15px;flex:none}
-@media screen and (max-width:370px){
- .explain-contents-button>span,.explain-topbar-inner .explain-kind{display:none}
-}
-.explain-unfold{margin-top:10px;font-size:var(--text-sm)}
-.explain-summary{margin:0 0 8px;color:var(--gray-700);font-size:var(--text-sm)}
-.explain-sync{display:inline-flex;align-items:center;gap:6px;margin:0 6px 0 0;font-size:var(--text-xs);font-weight:400;color:var(--gray-600);cursor:pointer;white-space:nowrap}
-.explain-sync input[type=checkbox]{display:inline-block;width:14px;height:14px;min-width:14px;margin:0;padding:0;accent-color:var(--blue)}
-.explain-return{margin-right:8px;white-space:nowrap}
-@media screen and (max-width:1100px){
- .explain-return{width:34px;height:34px;margin-right:0;border-radius:var(--radius-md)}
- .explain-return:hover{background:var(--gray-100)}
- .explain-return>span{display:none}
-}
-.explain-scroll{flex:1;min-height:0;overflow:auto;scrollbar-width:thin;position:relative}
-.explain-scroll:focus-visible{outline-offset:-2px}
-.lean-code{width:max-content;min-width:100%;padding:12px 0 45vh;font:var(--text-xs)/1.9 var(--mono);color:var(--gray-600);tab-size:2}
-.lean-row{display:flex;min-height:calc(var(--text-xs) * 1.9);cursor:pointer;border-left:3px solid transparent}
-.lean-line-number{position:sticky;left:0;z-index:1;flex:0 0 52px;padding:0 12px 0 8px;text-align:right;color:var(--gray-400);background:var(--gray-25);user-select:none;font-variant-numeric:tabular-nums}
-/* The margin beside the number: a step's number where its lines begin, a bar along them; a ring on a proof line no step quotes. */
-.lean-row>.lean-mark{position:sticky;left:52px;z-index:1;flex:0 0 22px;text-align:center;font-size:10px;font-weight:600;color:var(--blue-700);background:var(--gray-25);user-select:none;font-variant-numeric:tabular-nums}
-.lean-mark.is-step{box-shadow:inset 2px 0 var(--blue-300)}
-.lean-mark.is-statement{box-shadow:inset 2px 0 var(--green-300)}
-.lean-mark.is-unexplained::before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;border:1.5px solid var(--amber-500);vertical-align:middle}
-.lean-text{flex:1;padding:0 18px 0 8px;white-space:pre}
-.lean-row.is-quoted .lean-line-number{color:var(--gray-600)}
-.lean-row:hover{background:var(--gray-50)}
-.lean-row:hover :is(.lean-line-number,.lean-mark){background:var(--gray-50)}
-.lean-row.is-section{background:var(--gray-50)}
-.lean-row.is-section :is(.lean-line-number,.lean-mark){background:var(--gray-50)}
-.lean-row.is-hover{background:var(--find-line)}
-.lean-row.is-hover :is(.lean-line-number,.lean-mark){background:var(--find-line)}
-.lean-row.is-active{background:var(--amber-50);border-left-color:var(--amber-500)}
-.lean-row.is-active :is(.lean-line-number,.lean-mark){background:var(--amber-50)}
-.lean-row.is-active .lean-line-number{color:var(--amber-700)}
-.lean-row.is-use .lean-line-number{color:var(--amber-700);font-weight:600}
-::highlight(explain-use){background-color:var(--find-current);color:var(--find-current-ink)}
-.explain-legend{display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;margin:0;padding:5px 12px 5px 18px;border-bottom:1px solid var(--line);background:var(--card);font-size:var(--text-xs);color:var(--gray-600)}
-.explain-legend-item{display:inline-flex;align-items:center;gap:6px}
-.lean-mark-sample{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font:600 10px/1 var(--mono);color:var(--blue-700)}
-.lean-mark-sample.is-step{box-shadow:inset 2px 0 var(--blue-300)}
-.lean-mark-sample.is-statement{box-shadow:inset 2px 0 var(--green-300)}
-.lean-mark-sample.is-unexplained::before{content:"";width:7px;height:7px;border-radius:50%;border:1.5px solid var(--amber-500)}
-.lean-tok-comment{color:var(--code-comment);font-style:italic}
-.lean-tok-keyword{color:var(--code-keyword)}
-.lean-tok-tactic{color:var(--code-tactic)}
-.lean-tok-placeholder{color:var(--code-placeholder);text-decoration:underline dotted}
-/* A statement's `sorry` on a marked row: the placeholder hue, darker, to keep 4.5:1 on the tinted backgrounds. */
-.lean-row:is(:hover,.is-section,.is-hover,.is-active) .lean-tok-placeholder{color:var(--blue-700)}
-.lean-tok-string{color:var(--code-string)}
-.lean-tok-number{color:var(--code-number)}
-.explain-prose{padding:22px clamp(18px,2.4vw,36px) 45vh;background:var(--paper)}
-.explain-card{display:flex;flex-direction:column;align-items:flex-start;gap:10px;max-width:640px;border:1px solid var(--gray-200);border-radius:var(--radius-lg);background:var(--card);padding:18px 20px}
-.explain-card h2{font-size:var(--text-md)}
-.explain-card>p{font-size:var(--text-sm);color:var(--gray-600);line-height:1.8}
-.explain-card .result-banner{align-self:stretch}
-.explain-card .empty-state{align-self:stretch}
-.explain-estimate{font-size:var(--text-xs)!important;color:var(--gray-500)!important}
-.explain-progress{gap:18px;padding:22px 24px;border-color:var(--line)}
-.explain-progress-heading{display:flex;align-items:flex-start;gap:12px}
-.explain-progress-heading h2{font-family:var(--serif);font-size:var(--text-2xl);font-weight:400;line-height:1.3;color:var(--ink)}
-.explain-progress-heading p{margin-top:5px;font-size:var(--text-sm);line-height:1.65;color:var(--gray-600)}
-.explain-progress-icon{display:grid;place-items:center;flex:0 0 36px;height:36px;border-radius:var(--radius-md);background:var(--blue-50);color:var(--blue-700)}
-.explain-progress-icon svg{width:16px;height:16px}
-.explain-batch-progress{width:100%;font-size:var(--text-sm);color:var(--gray-700)}
-.explain-batch-progress>div{display:flex;justify-content:space-between;gap:12px;margin-bottom:7px}
-.explain-batch-progress label{margin:0;color:inherit}
-.explain-batch-progress progress{display:block;width:100%;height:6px;border:0;border-radius:6px;appearance:none;background:var(--gray-100);overflow:hidden;color:var(--green-600)}
-.explain-batch-progress progress::-webkit-progress-bar{background:var(--gray-100)}
-.explain-batch-progress progress::-webkit-progress-value{background:var(--green-600)}
-.explain-batch-progress progress::-moz-progress-bar{background:var(--green-600)}
-.explain-progress-actions{display:flex;align-items:flex-start;gap:12px;justify-content:space-between;width:100%;padding-top:10px;border-top:1px solid var(--line)}
-.explain-progress-actions>details{flex:1;min-width:0}
-.explain-progress-actions>button{flex:none}
-.explain-progress-actions .explain-facts{grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}
-.explain-facts{grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:12px 20px;margin:0;width:100%;line-height:1.6}
-.explain-facts dd{margin-top:4px}
-.explain-document{display:flex;flex-direction:column;gap:14px;max-width:760px;font-size:var(--text-base);line-height:1.85;color:var(--gray-800)}
-#explain-prose .explain-document{max-width:690px;margin-inline:auto;gap:24px;font-size:var(--text-md);line-height:1.8}
-.explain-lead-title{font-family:var(--serif);font-size:32px;font-weight:400;line-height:1.25;overflow-wrap:anywhere;color:var(--ink);text-wrap:pretty}
-.explain-lead-statement{margin-top:14px;color:var(--gray-800)}
-.explain-lead-jump{margin-top:14px;border-color:var(--blue-200);background:var(--blue-50);color:var(--blue-700);font-size:var(--text-sm)}
-.explain-lead-jump:hover:not(:disabled){border-color:var(--blue-300);background:var(--blue-100)}
-.explain-lead-jump svg{width:15px;height:15px}
-.explain-route{min-width:0}
-.explain-overview.explain-mainline-section{
- padding-block-start:16px;border-block-start:1px solid var(--line)
-}
-.explain-mainline{margin:10px 0 0;padding-inline-start:0;list-style-position:inside}
-.explain-mainline>li{min-width:0}
-.explain-mainline>li::marker{font-family:var(--mono);font-size:var(--text-sm);font-weight:600;color:var(--blue-700)}
-.explain-mainline>li+li{margin-top:8px;padding-top:8px;border-top:1px solid var(--line)}
-.explain-mainline-links{display:flex;flex-wrap:wrap;gap:0 14px;padding:0;margin:2px 0 0;list-style:none}
-.explain-mainline-links>li{max-width:100%}
-.explain-mainline-links button{
- display:inline-flex;align-items:center;gap:6px;max-width:100%;min-height:32px;text-align:start;overflow-wrap:anywhere;
- font-size:var(--text-sm);color:var(--blue-700)
-}
-.explain-mainline-links button>span{min-width:0}
-.explain-mainline-links button>svg{width:12px;height:12px;flex:none}
-.explain-mainline-links button:hover{text-decoration:underline;text-underline-offset:3px}
-.explain-mainline-declarations>summary{
- width:fit-content;min-height:32px;padding:4px 0;cursor:pointer;color:var(--blue-700);
- font-size:var(--text-sm);overflow-wrap:anywhere
-}
-.explain-mainline-declarations>summary:hover{text-decoration:underline;text-underline-offset:3px}
-.explain-overview-detail>p{margin-bottom:12px}
-.explain-disclosure{border-top:1px solid var(--line)}
-.explain-disclosure>summary{display:flex;align-items:center;gap:7px;min-height:36px;cursor:pointer;font-size:var(--text-sm);color:var(--gray-600);list-style:none}
-.explain-disclosure>summary::-webkit-details-marker{display:none}
-.explain-disclosure>summary::after{content:"";width:6px;height:6px;margin-left:3px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg)}
-.explain-disclosure[open]>summary::after{transform:rotate(45deg)}
-.explain-disclosure>summary svg{width:15px;height:15px}
-.explain-disclosure>summary:hover{color:var(--ink)}
-.explain-disclosure[open]>.explain-facts{margin-top:8px}
-.explain-reading-options{display:flex;flex-wrap:wrap;gap:0 18px;padding-block:3px;border-block:1px solid var(--line)}
-.explain-reading-options>.explain-disclosure{border:0;min-width:0;margin:0}
-.explain-reading-options>.explain-disclosure[open]{flex-basis:100%}
-.explain-disclosure.explain-provenance{margin-top:0}
-.explain-provenance p{padding:0 2px 7px;font-size:var(--text-sm)}
-.explain-provenance .explain-facts{margin:8px 0 15px}
-.explain-progress-actions>.explain-disclosure{border:0}
-.explain-notice{display:flex;gap:8px;align-items:flex-start;font-size:var(--text-xs);line-height:1.75;color:var(--amber-700);background:var(--amber-50);border:1px solid var(--amber-200);border-radius:var(--radius-md);padding:9px 12px}
-.explain-notice svg{margin-top:3px;width:14px;height:14px}
-.explain-overview h2,.explain-section :is(h2,h3){font-family:var(--serif);font-size:var(--text-xl);line-height:1.42;font-weight:400;color:var(--ink);overflow-wrap:anywhere}
-.explain-overview h2{margin-bottom:6px}
-.explain-rich{white-space:pre-line;overflow-wrap:break-word}
-.explain-section{min-width:0;border-top:1px solid transparent;padding:3px 0 0;scroll-margin-top:12px}
-.explain-section+.explain-section{padding-top:18px;border-top-color:var(--line)}
-.explain-section.is-active{border-top-color:var(--blue-500)}
-.explain-section-head{display:flex;flex-direction:column;gap:5px;margin-bottom:10px}
-.explain-section-meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 9px;color:var(--gray-600);font-size:var(--text-xs);line-height:1.5}
-[data-reading-section] .explain-section-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;column-gap:12px}
-[data-reading-section] .explain-section-head h2{justify-self:start;min-width:0}
-[data-reading-section] .explain-section-head>.explain-section-meta{grid-column:1/-1}
-.explain-section-meta code{min-width:0;overflow-wrap:anywhere}
-.explain-section-position{font-size:var(--text-xs);color:var(--gray-600);font-variant-numeric:tabular-nums}
-.explain-section-kind{font-weight:500}
-.explain-section.is-target .explain-section-kind{color:var(--blue-700)}
-.explain-section-next{
- display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px 16px;width:100%;min-height:44px;
- margin-top:14px;padding:10px 0 4px;border:0;border-top:1px solid var(--line);background:transparent;text-align:start;
- line-height:1.5;color:var(--blue-700)
-}
-.explain-next-label{grid-column:1;font-size:var(--text-xs);color:var(--gray-600)}
-.explain-next-title{grid-column:1;min-width:0;overflow-wrap:anywhere;font-size:var(--text-sm);font-weight:500}
-.explain-section-next>svg{grid-column:2;grid-row:1 / span 2;width:16px;height:16px}
-.explain-section-next:hover .explain-next-title{text-decoration:underline;text-underline-offset:3px}
-.explain-statement{color:var(--gray-700)}
-/* Heading and statement read as one block tied to the signature's lines; it is chosen like a step. */
-.explain-statement-block{margin:-6px -10px 0;padding:6px 10px 7px;border-radius:var(--radius-md);cursor:pointer;transition:background-color .15s}
-.explain-statement-block:hover{background:var(--gray-50)}
-.explain-statement-block.is-active{background:var(--amber-50);box-shadow:inset 3px 0 var(--amber-500)}
-.explain-reviews{margin-top:4px;font-size:var(--text-xs);line-height:1.75;color:var(--gray-600);cursor:auto}
-.explain-reviews:not(.explain-disclosure)>summary{
- display:inline-flex;align-items:center;gap:8px;min-height:28px;cursor:pointer;color:var(--gray-600);list-style:none
-}
-.explain-reviews:not(.explain-disclosure)>summary svg{width:13px;height:13px}
-.explain-reviews:not(.explain-disclosure)>summary:hover{color:var(--gray-700)}
-.explain-reviews:not(.explain-disclosure)>summary::-webkit-details-marker{display:none}
-.explain-reviews:not(.explain-disclosure)>summary::before{
- content:"";width:5px;height:5px;margin-inline:2px;border-block-start:1.5px solid currentColor;
- border-inline-end:1.5px solid currentColor;transform:rotate(45deg)
-}
-.explain-reviews[open]:not(.explain-disclosure)>summary::before{transform:rotate(135deg)}
-.explain-evidence-body{min-width:0;margin-block:3px 8px;padding:6px 0 2px 12px;border-inline-start:1px solid var(--gray-200)}
-.explain-statement-details .explain-statement{font-size:var(--text-base);line-height:1.75}
-.explain-evidence-label{color:var(--gray-700);font-weight:600}
-.explain-evidence-body>*+.explain-review-notes{margin-top:10px}
-.explain-reviews ul{margin:4px 0 2px;padding-left:18px;display:flex;flex-direction:column;gap:4px}
-/* Lean's goal states, as Lean printed them; long hypotheses scroll instead of wrapping. */
-.explain-goal-label{margin:6px 0 2px;color:var(--gray-500)}
-.explain-goal{margin:0 0 4px;max-height:16em;overflow:auto;padding:5px 9px;border:1px solid var(--gray-150);border-radius:var(--radius-sm);background:var(--gray-25);font:var(--text-xs)/1.7 var(--mono);color:var(--gray-700);white-space:pre;tab-size:2}
-.explain-goal-none{margin:0 0 4px;color:var(--gray-500)}
-.explain-gap-note{display:flex;gap:7px;align-items:flex-start;margin:10px 0 0;padding:7px 10px;border-radius:var(--radius-md);background:var(--amber-50);border:1px solid var(--amber-200);font-size:var(--text-xs);line-height:1.75;color:var(--amber-700)}
-.explain-gap-note svg{flex-shrink:0;margin-top:3px;width:13px;height:13px}
-.explain-steps{margin:12px 0 0;padding:0 0 0 24px;display:flex;flex-direction:column;gap:8px}
-.explain-steps>li{padding:7px 10px;margin-left:-10px;border-radius:var(--radius-md);cursor:pointer;transition:background-color .15s}
-.explain-steps>li::marker{color:var(--gray-500);font-variant-numeric:tabular-nums}
-.explain-steps>li:hover{background:var(--gray-50)}
-.explain-steps>li.is-active{background:var(--amber-50);box-shadow:inset 3px 0 var(--amber-500)}
-.explain-step-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin-top:4px;font-size:var(--text-xs);line-height:1.6}
-.explain-lines{border:1px solid transparent;border-radius:var(--radius-sm);background:var(--gray-100);padding:0 7px;font:var(--text-xs)/1.6 var(--mono);color:var(--gray-600);cursor:pointer;transition:background-color .15s,color .15s}
-.explain-lines:hover{background:var(--amber-100);color:var(--amber-700)}
-.explain-uses{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 6px;color:var(--gray-500)}
-.explain-use{border:1px solid transparent;border-radius:var(--radius-sm);padding:0 5px;background:var(--blue-50);color:var(--blue-700);font:var(--text-xs)/1.6 var(--mono);cursor:pointer;overflow-wrap:anywhere}
-.explain-use:hover{text-decoration:underline}
-.explain-use.external{background:var(--gray-100);color:var(--gray-600)}
-code.explain-use{cursor:default}
-code.explain-use:hover{text-decoration:none}
-/* Written nowhere in the source: used through notation or automation, so there is nothing to mark. */
-.explain-use.place-implicit{background:transparent;border-style:dashed;border-color:var(--gray-300)}
-.explain-use.place-implicit:not(.external){border-color:var(--blue-300)}
-.explain-code{font-size:.88em;background:var(--gray-100);border-radius:var(--radius-sm);padding:0 4px;overflow-wrap:anywhere}
-.explain-fact-wide{grid-column:1/-1}
-.explain-dialog{max-width:520px}
-.explain-dialog.is-contents{
- --contents-top:max(16px,calc((100dvh - 480px)/2));
- max-width:480px;max-height:min(620px,calc(100dvh - var(--contents-top) - 16px));
- margin-block:var(--contents-top) auto;overflow:hidden
-}
-.explain-dialog.is-contents[open]{display:flex}
-.explain-contents{display:flex;flex-direction:column;min-height:0;width:100%}
-.explain-contents>.confirm-heading,.explain-contents-search{flex:none}
-.explain-contents>.confirm-heading h2{font-family:var(--serif);font-size:var(--text-xl);font-weight:400}
-.explain-contents-search{display:flex;align-items:center;gap:8px;margin:12px 16px 4px;padding:0 10px;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--gray-25);color:var(--gray-600)}
-.explain-contents-search>svg{width:16px;height:16px;flex:none}
-.explain-contents-search input{width:100%;min-width:0;min-height:40px;border:0;background:transparent;padding:6px 0;color:var(--ink);font:inherit}
-.explain-contents-search input:focus-visible{outline-offset:-2px}
-.explain-contents-list{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:8px 16px 16px}
-.explain-contents-list section+section{margin-top:8px;border-top:1px solid var(--line);padding-top:6px}
-.explain-contents-list h3{margin:0;padding:7px 8px 4px;color:var(--gray-600);font-size:var(--text-xs);font-weight:500}
-.explain-contents-list ul{padding:0;margin:0;list-style:none}
-.explain-contents-list button{display:grid;grid-template-columns:max-content minmax(0,1fr) auto;align-items:baseline;gap:8px;width:100%;min-height:44px;padding:8px;border:0;border-radius:var(--radius-md);background:transparent;text-align:start;color:var(--ink)}
-.explain-contents-list button:hover{background:var(--gray-50)}
-.explain-contents-list button[aria-current]{background:var(--blue-50);color:var(--blue-700)}
-.explain-contents-list button:focus-visible{outline-offset:-2px}
-.explain-contents-list button>svg{align-self:center;width:15px;height:15px;color:var(--gray-600)}
-.explain-contents-number{min-width:3ch;font:var(--text-xs)/1.45 var(--mono);color:var(--gray-600)}
-.explain-contents-current{font-size:var(--text-xs);font-weight:500}
-.explain-contents-entry{display:grid;gap:2px;min-width:0;overflow-wrap:anywhere;font-size:var(--text-base);line-height:1.45}
-.explain-contents-entry code{color:var(--gray-600);font-size:var(--text-xs)}
-.explain-contents-empty{margin:10px 8px;color:var(--gray-600);font-size:var(--text-sm)}
-.explain-contents-rail{
- display:none;min-width:0;min-height:0;padding-block-start:30px;
- border-inline-start:1px solid var(--line);background:var(--gray-25)
-}
-.explain-rail-heading{margin:0 0 10px;padding-inline:11px;color:var(--gray-700);font-size:var(--text-sm);font-weight:600}
-.explain-rail-list{min-height:0;margin:0;padding:2px 3px 8px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;list-style:none}
-.explain-rail-list button{
- display:grid;grid-template-columns:2.6ch minmax(0,1fr);align-items:baseline;gap:2px 9px;
- width:100%;min-height:36px;padding:8px;border:0;border-radius:var(--radius-md);
- background:transparent;color:var(--gray-700);font:var(--text-sm)/1.45 var(--sans);text-align:start
-}
-.explain-rail-list button:hover{background:var(--gray-100);color:var(--ink)}
-.explain-rail-list button[aria-current]{background:var(--blue-50);color:var(--blue-700);box-shadow:inset 2px 0 var(--blue-500)}
-.explain-rail-list button:focus-visible{outline-offset:-2px}
-.explain-rail-number{font:var(--text-xs)/1.45 var(--mono);color:var(--gray-600)}
-.explain-rail-title{display:-webkit-box;overflow:hidden;overflow-wrap:anywhere;-webkit-box-orient:vertical;-webkit-line-clamp:2}
-.explain-rail-target{grid-column:2;color:var(--blue-700);font-size:var(--text-xs);font-weight:500}
-.explain-dialog-facts{grid-template-columns:repeat(2,minmax(0,1fr));margin:12px 0 10px}
-.explain-dialog-note{margin-bottom:12px}
-.explain-dialog label{margin-top:4px}
-/* Phrase alignment: a linked phrase, a matched fragment of the original problem, and the goals the auditors checked. */
-.explain-link{text-decoration:underline dotted var(--blue-300);text-decoration-thickness:1.5px;text-underline-offset:3px;cursor:pointer;border-radius:3px}
-.explain-link:hover,.explain-link:focus-visible{background:var(--blue-50);text-decoration-color:var(--blue-500)}
-.explain-link:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
-.explain-link.is-mismatch{text-decoration-color:var(--red-300)}
-.explain-link.is-unresolved{text-decoration-color:var(--amber-500)}
-/* The text the chosen pairs quote, in the tint of the chosen list item and Lean line, one step darker since inline text has no side bar; the fragments clicked are underlined solid. */
-mark.explain-chosen{background:var(--amber-100);color:inherit;border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
-.explain-link.is-active{text-decoration-style:solid}
-.explain-goal-checked{display:inline-flex;align-items:center;gap:3px;margin-left:8px;color:var(--green-600)}
-.explain-goal-checked svg{width:12px;height:12px}
-.formal-note{display:flex;gap:7px;align-items:flex-start;margin:8px 0 0;font-size:var(--text-xs);line-height:1.75;color:var(--gray-600)}
-.formal-note svg{flex-shrink:0;margin-top:3px;width:13px;height:13px;color:var(--gray-500)}
-.formal-original{font-family:var(--serif);color:var(--gray-800)}
-.formal-problem{border-color:var(--blue-200)}
-.formal-problem-details{margin-top:8px}
-.formal-correspondences{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:8px}
-.formal-correspondence{padding:8px 10px;border:1px solid var(--gray-150);border-left:3px solid transparent;border-radius:var(--radius-md);background:var(--card);font-size:var(--text-sm);line-height:1.75;scroll-margin-top:12px}
-.formal-correspondence.is-active{background:var(--amber-50);border-left-color:var(--amber-500)}
-.formal-correspondence-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 9px;margin-bottom:4px;font-size:var(--text-xs)}
-.formal-aspect{font-weight:600;color:var(--gray-700)}
-.formal-reviewers{color:var(--gray-500)}
-.formal-pair{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 10px;align-items:baseline}
-.formal-pair-label{font-size:var(--text-xs);color:var(--gray-500);white-space:nowrap}
-.formal-whole{font-size:var(--text-xs);color:var(--gray-600)}
-.formal-lean{display:inline;border:0;padding:0 4px;border-radius:var(--radius-sm);background:var(--blue-50);color:var(--blue-700);font:var(--text-xs)/1.7 var(--mono);text-align:left;white-space:pre-wrap;overflow-wrap:anywhere;cursor:pointer}
-.formal-lean:hover{text-decoration:underline}
-.formal-lean.is-unplaced{background:var(--gray-100);color:var(--gray-600);cursor:help}
-.formal-lean.is-unplaced:hover{text-decoration:none}
-/* A Lean fragment the source does not write: a note in words, and a long one (often an elaborated type) folded to its first line. */
-.formal-lean.is-block{display:block;width:fit-content;max-width:100%;padding:4px 8px}
-.formal-unplaced-note{margin-left:6px;font-size:var(--text-xs);color:var(--gray-500)}
-.formal-lean.is-block+.formal-unplaced-note{display:block;margin:2px 0 0}
-.formal-unplaced>summary{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px;cursor:pointer;list-style:none}
-.formal-unplaced>summary::-webkit-details-marker{display:none}
-.formal-lean.is-preview{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom;background:var(--gray-100);color:var(--gray-600)}
-.formal-unplaced[open] .formal-lean.is-preview{display:none}
-.formal-unplaced>summary .formal-unplaced-note{margin-left:0}
-.formal-unplaced-toggle{font-size:var(--text-xs);color:var(--blue-600)}
-.formal-unplaced>summary:hover .formal-unplaced-toggle{text-decoration:underline}
-.formal-unplaced-toggle>.is-open,.formal-unplaced[open] .formal-unplaced-toggle>.is-closed{display:none}
-.formal-unplaced[open] .formal-unplaced-toggle>.is-open{display:inline}
-.formal-unplaced>.formal-lean{margin-top:4px}
-/* A wrapped fragment's label sits by its first line, not its last. */
-button.formal-lean{vertical-align:top}
-/* Phone only: the original fragment whose Lean is marked, above the Lean, since the original is in the other pane. */
-.formal-chosen{display:none}
-.formal-chosen-label{font-size:var(--text-xs);color:var(--gray-500)}
-.formal-chosen-quote{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
-.formal-chosen-quote>.explain-rich{background:var(--amber-100);border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
-.formal-chosen-foot{grid-column:2;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 10px;font-size:var(--text-xs);color:var(--gray-600)}
-.formal-chosen-wider{margin-left:auto;white-space:nowrap}
-.formal-lead{font-size:var(--text-xs);line-height:1.7;color:var(--gray-500)}
-.formal-label{margin:10px 0 2px;font-size:var(--text-xs);font-weight:600;color:var(--gray-600)}
-.formal-list{margin:4px 0 0;padding-left:20px;display:flex;flex-direction:column;gap:6px;font-size:var(--text-sm);line-height:1.75}
-.formal-item{margin-top:8px}
-.formal-item>code,.formal-detail{font:var(--text-xs)/1.6 var(--mono);color:var(--gray-600);overflow-wrap:anywhere}
-.formal-detail{display:inline-block;margin-left:6px}
-.formal-quotes{margin:2px 0 0;padding-left:16px;font-size:var(--text-xs);color:var(--gray-600)}
-.formal-quote{margin:0 0 4px;padding:2px 0 2px 10px;border-left:2px solid var(--gray-200);color:var(--gray-700);font-family:var(--serif)}
-.formal-checks{list-style:none;margin:10px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:6px 14px;font-size:var(--text-xs)}
-.formal-checks li{display:flex;align-items:center;justify-content:space-between;gap:8px}
-.formal-matched-sample{font:var(--text-xs)/1 var(--mono);text-decoration:underline dotted var(--blue-500);text-underline-offset:3px}
-::highlight(formal-matched){text-decoration:underline dotted var(--blue-500);text-decoration-thickness:1.5px}
-@media screen{
- #explain-prose .explain-document .explain-rich{max-inline-size:var(--reading-width)}
-}
-@media screen and (width > 900px){
- #explain-split{grid-template-columns:minmax(0,42fr) minmax(0,58fr)}
- .explain-layout-switch{display:inline-flex;flex:none}
- .explain-layout-switch button{white-space:nowrap}
- #explain-split[data-layout=read]{grid-template-columns:minmax(0,1fr)}
- #explain-split[data-layout=read] .explain-pane-lean,.explain-content:has(#explain-split[data-layout=read]) .explain-sync{display:none}
- #explain-split[data-layout=read] #explain-prose{padding:28px 0 45vh}
- #explain-split[data-layout=read] .explain-document{max-width:none}
- #explain-split[data-layout=read] .explain-lead-title{font-size:clamp(32px,2.7vw,38px)}
- #explain-split[data-layout=read] :is(.explain-statement-block,.explain-steps>li){cursor:auto}
- #explain-split[data-layout=read] :is(.explain-statement-block,.explain-steps>li):not(.is-active):hover{background:transparent}
-}
-@media screen and (min-width:1160px){
- #explain-split[data-layout=read]:has(.explain-contents-rail:not([hidden])){
- grid-template-columns:repeat(12,minmax(0,1fr));column-gap:24px
- }
- #explain-split[data-layout=read]:has(.explain-contents-rail:not([hidden])) .explain-pane-prose{
- grid-area:1/1/2/10;background:var(--paper)
- }
- #explain-split[data-layout=read]:has(.explain-contents-rail:not([hidden])) #explain-prose{background:transparent}
- #explain-split[data-layout=read] .explain-contents-rail:not([hidden]){display:flex;flex-direction:column;grid-area:1/10/2/-1}
-}
-@media screen and (max-width:900px){
- .explain-split{grid-template-columns:minmax(0,1fr)}
- .explain-split[data-pane=prose] .explain-pane-lean,.explain-split[data-pane=lean] .explain-pane-prose{display:none}
- .explain-pane-lean{border-right:0}
- .explain-pane-switch{display:inline-flex}
- .explain-sync{display:none}
- .explain-content:has(#explain-split[data-pane=lean]) #explain-prose-head{display:none}
- .formal-chosen:not(:empty){display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 10px;align-items:baseline;padding:8px 14px;border-bottom:1px solid var(--line);background:var(--card)}
- .explain-toolbar{padding:8px 14px}
- .explain-prose{padding:16px 16px 45vh}
- #explain-prose:has(.explain-document){padding-inline:0}
- #explain-prose .explain-document{max-width:none}
- .explain-shell:has(#explain-split[data-pane=lean])>#explain-page-heading{display:block}
- .explain-topbar .workspace-name,.explain-topbar .topbar-divider{display:none}
-}
-@media screen{
- #explain-split[data-layout=read] #explain-prose :is(.explain-statement-block,.explain-steps>li){
- margin-inline:0;padding-inline:0
- }
- #explain-split[data-layout=read] #explain-prose .explain-steps{padding-inline:0;list-style-position:inside}
- #explain-split[data-layout=read] #explain-prose :is(.explain-statement-block,.explain-steps>li).is-active{box-shadow:none}
-}
-/* One pane at a time, or on paper, nothing scrolls together: a long Lean line wraps, hanging 4 characters inside its own indent. */
-@media (max-width:900px),print{
- .lean-code{width:auto}
- .lean-text{min-width:0;padding-left:calc(8px + (var(--indent, 0) + 4) * 1ch);text-indent:calc((var(--indent, 0) + 4) * -1ch);white-space:pre-wrap;overflow-wrap:anywhere}
-}
-@media (max-width:520px){.formal-page .explain-topbar .explain-kind{display:none}.explain-target{flex-basis:100%}.explain-target select{max-width:100%;flex:1}}
-@media screen and (max-width:520px){
- .explain-topbar-inner .brand>span{display:none}
- .explain-topbar-inner .explain-kind{white-space:normal;line-height:1.3}
- .explain-lead-title{font-size:26px}
- .explain-reading-options{gap:0 12px}
- .explain-controls-inner{gap:4px 8px}
- .explain-progress{padding:16px}
- .explain-contents-button{min-width:44px;min-height:44px}
- .explain-contents-search input{min-height:44px;font-size:16px}
- .explain-contents .confirm-heading .icon-button{width:44px;height:44px}
- .explain-lead-jump,.explain-disclosure>summary,.explain-progress-actions>button{min-height:44px}
- .explain-mainline-links button,.explain-mainline-declarations>summary{min-height:44px}
- .explain-reviews:not(.explain-disclosure)>summary{min-height:44px}
-}
-/*
- * One target name and the Lean/讲解 switch share the row on a phone; the name wraps after a `.` or `_` beside it. Below
- * 360 pixels that column is too narrow (a long name took five lines), so the name keeps a row of its own there.
- */
-@media (min-width:360px) and (max-width:520px){
- .explain-toolbar:not(:has(.explain-language-switch)) .explain-target:not(:has(code+code)){flex:1 1 0;align-items:baseline}
-}
-/* A phone held sideways: the bars above the panes are made shorter so the panes keep about two thirds of the height. */
-@media (max-height:480px){
- .explain-topbar{height:44px}
- .explain-toolbar{padding-block:4px}
- .explain-pane-head{min-height:38px;padding-block:2px}
- .explain-legend{padding-block:3px}
-}
-/*
- * Printing a proof page: one document instead of two scroll boxes. The explanation (or the original problem and reviews)
- * comes first and the whole Lean after it on a new page, wrapped; controls are dropped. Folds print as the reader left
- * them (opening all of them pushed a short proof's outline to page 4), so their summaries stay without the words to click.
- */
-@media print{
- html:has(.explain-page),.explain-page{height:auto;overflow:visible}
- .explain-page{display:block}
- .explain-page :is(.explain-shell,.explain-content,.explain-workspace,.explain-pane){display:block;min-height:0}
- .explain-workspace{width:100%;padding:0}
- .explain-split{display:flex;flex-direction:column}
- .explain-pane-prose{order:-1}
- .explain-pane-lean{break-before:page;border-right:0}
- .explain-scroll{overflow:visible;flex:none}
- .explain-page :is(.skip-link,.topbar-actions,.explain-controls,.source-switch,.explain-head-actions,.formal-chosen,.formal-unplaced-toggle,.toast,dialog){display:none}
- .explain-lead-jump,.explain-mainline-links,.explain-mainline-declarations,.explain-section-next{display:none}
- .explain-overview.explain-mainline-section{padding:0;border:0;background:transparent}
- .explain-prose{padding:12px 18px 0}
- .lean-code{padding-bottom:0}
- .explain-page :is(.lean-line-number,.lean-row>.lean-mark){position:static}
- .lean-row,.explain-steps>li,.explain-statement-block,.formal-correspondence,.explain-goal{break-inside:avoid}
- .explain-page :is(h1,h2,h3,.explain-pane-head){break-after:avoid}
- .explain-goal{max-height:none;overflow:visible;white-space:pre-wrap;overflow-wrap:anywhere}
-}
-/*
- * Forced colours (Windows high contrast) replace backgrounds, border colours and shadows with the system palette, so a
- * state shown only by those disappears. Selected, current, pressed and checked controls get an inset Highlight ring
- * instead; a focused one keeps its focus ring. The switch and the palette's active row are drawn in system colours, the row
- * without the Canvas backplate the browser would put behind its HighlightText label.
- */
-@media(forced-colors:active){
- :is([aria-current]:not([aria-current=false]),[aria-pressed=true],[aria-pressed=mixed],[aria-selected=true],.segmented input:checked+span,
- .run-row.selected,.collab-task.selected,.collab-review-choice.selected,.collab-delivery-choice.selected,.collab-math-choice.selected,
- .module-customization-row[data-selected=true],.module-policies details[data-selected=true],button.agent-route-label[data-selected],
- .glossary-content dl>div[data-current],.lean-row.is-active,.explain-section.is-active,.explain-statement-block.is-active,
- .explain-steps>li.is-active,.formal-correspondence.is-active):not(:focus-visible){outline:2px solid Highlight;outline-offset:-2px}
- .palette-options button[aria-selected=true]{forced-color-adjust:none;background:Highlight;color:HighlightText}
- .palette-options button[aria-selected=true] :is(svg,span,kbd){color:HighlightText}
- .module-plan-toggle input[type=checkbox]::before{background:CanvasText}
- .module-plan-toggle input[type=checkbox]:checked{background:Highlight;border-color:Highlight}
- .module-plan-toggle input[type=checkbox]:checked::before{background:HighlightText}
-}
-/* The current problem stays in view; other destinations and utilities open from one disclosure. */
-#topbar,.research-page .topbar.simple-topbar{height:auto;min-height:56px;flex-wrap:wrap;gap:10px;padding:8px 18px;overflow:visible}
-#topbar{position:relative;z-index:25}
-.topbar-primary,.research-page .simple-topbar .research-nav{display:flex;align-items:center;flex-wrap:nowrap;gap:4px;flex-basis:auto;order:0;min-width:0;margin:0;border:0;overflow:visible}
-.topbar-control,.navigation-menu>summary,.research-page .simple-topbar .research-nav a{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:36px;padding:6px 10px;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--gray-700);font-size:13px;line-height:1.5;white-space:nowrap;text-decoration:none}
-.topbar-control:hover,.navigation-menu>summary:hover,.research-page .simple-topbar .research-nav a:hover{background:var(--gray-100);color:var(--ink)}
-/* One quiet style in every state: a filled button next to 历史 read as a pressed tab while a chat was open. */
-.topbar-new{border-color:var(--line);background:var(--card);color:var(--ink)}
-.topbar-new:hover{background:var(--gray-100);color:var(--ink)}
-.topbar-statuses{display:flex;align-items:center;gap:8px;min-width:0;margin-left:6px}
-.topbar-statuses .live-pill{max-width:230px;box-shadow:none}
-.topbar-statuses .connection-status{height:auto;min-height:28px;padding:0;font-size:12px;gap:6px}
-.topbar-command{margin-left:auto;gap:8px;min-height:36px;padding:5px 10px 5px 11px;border-color:var(--line);border-radius:8px;background:var(--card);color:var(--gray-600)}
-.topbar-command:hover{background:var(--gray-50);border-color:var(--gray-300);color:var(--ink)}
-.topbar-command svg{width:14px;height:14px;flex-shrink:0;color:var(--gray-500)}
-.topbar-command kbd{margin-left:4px;font-size:11px;color:var(--gray-500)}
-.navigation-menu{position:relative;flex-shrink:0;margin-left:auto}
-@media(min-width:901px){.topbar-command+.navigation-menu{margin-left:0}}
-@media(max-width:900px){.topbar-command{display:none}}
-.navigation-menu>summary{list-style:none;cursor:pointer;user-select:none}
-.navigation-menu>summary::-webkit-details-marker{display:none}
-.navigation-menu[open]>summary{background:var(--gray-100);color:var(--ink)}
-.navigation-panel{position:absolute;z-index:30;right:0;top:calc(100% + 8px);width:min(300px,calc(100vw - 24px));max-height:calc(100dvh - 84px);overflow-y:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--line);border-radius:10px;background:var(--card);box-shadow:var(--shadow-md);text-align:left}
-.navigation-links,.navigation-actions{display:grid;gap:2px;margin:0;min-width:0}
-.navigation-links a,.navigation-panel .navigation-item{display:flex;align-items:center;justify-content:flex-start;gap:10px;width:100%;height:auto;min-height:40px;padding:8px 10px;border:0;border-radius:6px;background:transparent;color:var(--gray-700);font-size:13px;line-height:1.5;text-align:left;white-space:normal;text-decoration:none}
-.navigation-links a:hover,.navigation-panel .navigation-item:hover:not(:disabled){background:var(--gray-100);color:var(--ink)}
-.navigation-links a>svg{margin-left:auto;width:14px;height:14px}
-.navigation-actions{margin-top:6px;padding-top:6px;border-top:1px solid var(--line)}
-.navigation-item>span{flex:1;min-width:0}
-.navigation-item small{display:block;margin-top:2px;color:var(--muted);font-size:12px;overflow-wrap:anywhere}
-.navigation-item kbd{flex-shrink:0;margin-left:auto;font-size:11px}
-.navigation-current{min-width:0;max-width:230px;padding:0 10px;border-left:1px solid var(--line);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--muted)}
-#topbar #open-glossary{display:flex}
-.navigation-panel :is(button,a):focus-visible{outline-offset:-2px}
-@media(max-width:600px){
- #topbar,.research-page .topbar.simple-topbar{gap:6px;padding:7px 10px}
- .topbar-control,.navigation-menu>summary,.research-page .simple-topbar .research-nav a{min-height:40px;padding-inline:8px;gap:6px}
- #topbar>.topbar-statuses{order:3;flex-basis:100%;margin:0;padding:2px 2px 0;gap:12px}
- .topbar-statuses .live-pill{max-width:100%;height:28px}
- .navigation-current{max-width:135px;padding-inline:8px;font-size:12px}
- .navigation-panel{max-height:calc(100dvh - 76px)}
- .navigation-links a,.navigation-panel .navigation-item{min-height:44px}
-}
-@media(max-width:420px){.research-page .simple-topbar .research-nav{flex:1}.navigation-current{max-width:110px}.research-page .simple-topbar .brand{min-width:26px}.research-page .simple-topbar .research-nav a{gap:4px;padding-inline:4px}}
-.composer-research-selection { padding: 14px 18px; border-bottom: 1px solid var(--line, #dedfd5); background: var(--panel, #f2f3ed); font-size: 12px; }
-.composer-research-selection p { margin: 5px 0; }
-.composer-research-selection a { margin-right: 15px; }
-
-/* First research: the connection, decisions and two budgets sit beside the problem. */
-.first-research-start{margin:4px 12px 10px;padding-top:14px;border-top:1px solid var(--line);font-size:13px;line-height:1.7;text-align:left}
-.first-research-stages{margin:0 0 12px;color:var(--ink)}
-.first-research-budget-top{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:4px 12px;color:var(--muted)}
-.first-research-budget-top>div{display:flex;flex-wrap:wrap;gap:12px}.first-research-budget-top .text-button{min-height:36px}
-.first-research-budgets{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px 18px;margin:6px 0 10px}
-.first-research-budgets>div{min-width:0}.first-research-budgets dt{color:var(--muted);font-size:12px}.first-research-budgets dd{margin:2px 0;overflow-wrap:anywhere}
-.first-research-more{margin:2px 0 0;color:var(--muted);font-size:12px}.first-research-more>summary{padding:8px 0;cursor:pointer}.first-research-more[open]>summary{color:var(--ink)}
-.first-research-quota,.first-research-cost{margin:6px 0;color:var(--muted);font-size:12px;line-height:1.7}
-.chat-input-preview{margin:5px 5px 8px;padding:9px;min-height:92px;max-height:260px;overflow:auto;border-radius:8px;background:var(--gray-25);line-height:1.75;overflow-wrap:anywhere}.chat-input-preview .solution-route-prose{font-size:inherit}.chat-input-preview .solution-route-prose>p{white-space:pre-wrap}.chat-input-preview .katex-display{overflow-x:auto;overflow-y:hidden;padding:4px 0}
-.research-start-cost{margin:12px 0 6px;font-size:12px;line-height:1.7;text-align:left}.research-start-cost-summary>strong{font-weight:500}.research-start-cost-summary dl{display:flex;gap:24px;margin:8px 0}.research-start-cost-summary dl>div{display:grid;gap:2px}.research-start-cost-summary dt,.research-start-cost-note,.research-start-cost-model{color:var(--muted)}.research-start-cost-summary dd{margin:0;color:var(--ink)}.research-start-cost p{margin:6px 0}.research-start-cost summary{cursor:pointer;color:var(--ink);padding:5px 0}.research-start-cost-fields{display:grid;grid-template-columns:minmax(0,1fr) 90px;gap:12px;margin:8px 0}.research-start-cost-fields label{display:grid;gap:5px}.research-start-cost input,.research-start-cost select{width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:4px;color:var(--ink);background-color:var(--paper);font:inherit}.research-start-cost select{height:38px;padding:7px 30px 7px 9px;line-height:1.35;background-position:right 8px center}.research-start-cost button{font:inherit}.research-start-cost-model{overflow-wrap:anywhere}.research-start-cost-note{font-size:11px}.research-start-cost [role=alert]{color:var(--danger,#a33)}
-#research-run-cost{padding:0 12px}
-.first-research-connection{display:flex;align-items:center;justify-content:space-between;gap:12px;width:calc(100% - 24px);min-width:0;min-height:44px;margin:0 12px;padding:10px 0;border:0;border-top:1px solid var(--line);background:none;font:inherit;font-size:12px;text-align:left;color:var(--ink);cursor:pointer}
-.first-research-connection>span{min-width:0;overflow-wrap:anywhere}.first-research-connection>span:last-child{display:flex;align-items:center;gap:5px;color:var(--muted)}
-.first-research-connection svg{width:14px;height:14px;flex:none}.first-research-connection [data-status=error]{color:var(--red-700)!important}
-@media(max-width:480px){
- .first-research-budgets{grid-template-columns:1fr}
- .first-research-connection{align-items:flex-start;flex-direction:column;gap:2px}
-}
-
-/* Shared proofs read as mathematical notes before their source and receipts. */
-.share-reading-nav{display:flex;flex-wrap:wrap;gap:6px 18px}.share-reading-nav button,.share-reading-contents button{min-height:44px;padding:4px 0;border:0;background:none;color:var(--ink);font:inherit;font-size:13px;cursor:pointer;text-align:left}
-.share-research-info{width:100%;font-size:13px;color:var(--muted)}.share-research-info>summary{min-height:36px;padding-block:8px;cursor:pointer}
-.share-reading-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:14px;margin-bottom:20px}
-.share-reading{min-width:0;font-size:15px;line-height:1.9;overflow-wrap:anywhere}.share-reading h3{font-size:18px;line-height:1.5;margin:26px 0 12px;font-weight:600}.share-reading h4{font-size:14px;line-height:1.6;margin:16px 0 8px;font-weight:600}.share-reading h5{font-size:13px;margin:12px 0 8px}.share-reading p{margin:8px 0 14px}.share-reading ul{padding-left:22px}
-.share-reading-conditions{margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--line)}.share-reading-conditions>h3{margin-top:0}.share-reading-select{display:grid;gap:8px;font-size:13px;max-width:100%;margin:0 0 20px}.share-reading-select select{min-width:0;max-width:100%;font:inherit;line-height:1.35;padding:9px 32px 9px 11px;border:1px solid var(--line);border-radius:4px;background-color:var(--card);color:var(--ink)}
-.share-reading-contents{display:flex;flex-wrap:wrap;gap:4px 20px;margin:18px 0 22px;padding-block:10px;border-block:1px solid var(--line)}.share-reading-contents button{color:var(--gray-600)}
-.share-reading-declaration+.share-reading-declaration{margin-top:34px;padding-top:12px;border-top:1px solid var(--line)}.share-reading-statement{margin-bottom:20px}.share-reading-declaration:target{scroll-margin-top:20px}
-.share-derivations,.share-recorded-tasks{list-style:none;padding:0;margin:18px 0}.share-derivations>li{margin:0;padding:14px 0 20px}.share-derivations>li+li{border-top:1px solid var(--line)}.share-derivations>li>h4{margin-top:0;color:var(--muted);font-size:13px}.share-recorded-tasks>li+li{margin-top:30px;padding-top:8px;border-top:1px solid var(--line)}
-.share-step-uses{color:var(--muted);font-size:13px}.share-step-uses .text-button{font-size:inherit;text-align:left;white-space:normal}.share-step-uses code{overflow-wrap:anywhere}
-.share-step-evidence{margin-top:14px;min-width:0;color:var(--gray-600);font-size:13px}.share-step-evidence>summary{min-height:44px;padding:10px 0;cursor:pointer}.share-step-evidence pre{max-width:100%;max-height:420px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:16px;margin:10px 0 16px;background:var(--gray-50);border:1px solid var(--line);border-radius:4px;font:12px/1.9 var(--mono);color:var(--ink)}.share-step-evidence p code{font-size:11px;overflow-wrap:anywhere}
-.share-goal-changes{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px}.share-goal-changes>div{min-width:0}.share-reading-coverage{color:var(--muted);font-size:13px;line-height:1.8}.share-reading .solution-route{margin-inline:-12px}.share-reading .solution-route-heading h3{margin:0}
-@media(max-width:600px){.share-content>.share-reading-container{padding:22px 18px}.share-reading{font-size:14px}.share-reading-heading{align-items:flex-start}.share-reading-heading>.source-switch{width:100%;display:flex}.share-reading-heading>.source-switch button{flex:1;min-height:44px}.share-goal-changes{grid-template-columns:1fr}.share-reading-contents{gap:2px 16px}.share-reading .solution-route{margin-inline:-8px}}
-
-.chat-search-target{outline:2px solid var(--blue);outline-offset:7px;border-radius:4px}.chat-start-tools{font-size:12px;color:var(--muted);line-height:1.8}.chat-start-tools a{color:inherit}.frozen-task-dialog{width:min(960px,calc(100vw - 28px));max-height:90dvh;border:1px solid var(--line);border-radius:14px;background:var(--paper);color:var(--ink);padding:0}.frozen-task-view{padding:28px;overflow-wrap:anywhere}.frozen-task-view header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}.frozen-task-view h2{font-size:20px;margin:4px 0}.frozen-task-view header p,.frozen-task-view dt{font-size:12px;color:var(--muted)}.frozen-task-view dd{margin:8px 0 18px;font:11px var(--mono);overflow-wrap:anywhere}.frozen-task-view pre{max-height:50dvh;overflow:auto;padding:20px;background:var(--card);border:1px solid var(--line);font:12px/1.8 var(--mono)}.frozen-task-view .button{display:inline-flex}.frozen-task-view code{overflow-wrap:anywhere}@media(max-width:500px){.frozen-task-view{padding:18px}.frozen-task-view pre{padding:12px}}
-.product-status{min-width:0;max-width:100%;padding:28px;border:1px solid var(--line);border-radius:4px;background:var(--card);color:var(--ink)}.product-status h2{font:400 22px/1.5 var(--serif);margin:0 0 14px}.product-status>p{font-size:14px;line-height:1.8;color:var(--muted)}.product-status .research-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 32px;margin:24px 0}.product-status .research-facts>div{min-width:0;border-top:1px solid var(--line);padding-top:14px}.product-status dt{font-size:11px;color:var(--muted);margin-bottom:8px}.product-status dd{font-size:13px;margin:0;overflow-wrap:anywhere}.product-status .research-actions{display:flex;flex-wrap:wrap;gap:10px;margin:20px 0}.product-status details{border-top:1px solid var(--line);padding:16px 0;font-size:13px;line-height:1.8}.product-status summary{cursor:pointer;color:var(--muted)}.product-status pre{font:11px/1.8 var(--mono);white-space:pre-wrap;overflow-wrap:anywhere;padding:16px;background:var(--paper);max-height:360px;overflow:auto}.product-status ul{padding-left:20px}.product-status code{overflow-wrap:anywhere}.product-status>details button{margin-right:12px}.product-status>.text-button{font-size:12px}@media(max-width:600px){.product-status{padding:20px 16px}.product-status .research-facts{grid-template-columns:minmax(0,1fr);gap:16px}.product-status h2{font-size:20px}}
-.background-review-status .source-language{margin-left:8px;color:var(--muted);font-size:12px;font-weight:400}
diff --git a/apps/web/client/app.ts b/apps/web/client/app.ts
deleted file mode 100644
index a221b9e7..00000000
--- a/apps/web/client/app.ts
+++ /dev/null
@@ -1,8171 +0,0 @@
-import { webSkillWithoutCooperation } from '../researchMode';
-import { DEFAULT_TEAM_AGENTS } from '../../../src/solver/teamCapacity';
-import { renderPersonalExpertPicker, renderTeamProfilePicker } from './teamProfilePicker';
-import type { WebTeamProfile } from '../shared';
-import {
- createIcons,
- ArrowDown,
- ArrowDownToLine,
- ArrowLeft,
- ArrowRight,
- ArrowUp,
- BookOpen,
- ChevronDown,
- ChevronUp,
- CircleAlert,
- Copy,
- CopyPlus,
- CornerDownLeft,
- Cpu,
- Download,
- ExternalLink,
- Eye,
- FileCode2,
- FolderOpen,
- GitBranch,
- IndentDecrease,
- IndentIncrease,
- ListOrdered,
- Link2,
- Link2Off,
- Maximize2,
- MessageSquare,
- Minimize2,
- Monitor,
- Moon,
- Network,
- PanelRight,
- Paperclip,
- LogOut,
- Plus,
- RefreshCw,
- RotateCcw,
- Save,
- Search,
- ShieldCheck,
- SlidersHorizontal,
- Square,
- SquarePen,
- Sun,
- Trash2,
- TriangleAlert,
- Undo2,
- Upload,
- X,
-} from 'lucide';
-import type {
- WebAdminOverview,
- WebContinuation,
- WebCoordination,
- WebEffort,
- WebEnvironment,
- WebPrecheck,
- WebPrecheckDiagnostic,
- WebProofOutline,
- WebRun,
- WebRunRequest,
- WebSavedKey,
- WebSession,
-} from '../shared';
-import { accountLogin, loginHref, retiredResearchCoordinationCode } from '../shared';
-import { webTaskEnvironment } from '../environment';
-import { configurationRefs, ResearchSelection } from './researchSelection';
-import type { ResearchAsset } from '../researchAssetTypes';
-import type {
- ResearchLibraryAttemptPreparation,
- ResearchLibraryPersonalAttemptPreparation,
-} from '../researchLibraryTrialTypes';
-import { consumeResearchEntry, readResearchEntry } from './researchEntry';
-import { openFrozenTask } from './frozenTaskView';
-import { renderResearchBudgetDraft } from './researchBudgetDraft';
-import { renderResearchStartCost } from './researchStartCost';
-import type { WebExplainAnswer } from '../explain';
-import type { WebFormalization } from '../formalizationTypes';
-import type { WebShareLink } from '../shareTypes';
-import type { SharedProofPreparation, SharedProofReading } from '../sharedProofTypes';
-import { acceptedTitle, acceptedVerdict, isStatementReviewed, statementConfirmation } from '../presentation';
-import {
- checkReason,
- effortLabels,
- failureGuide,
- formatDuration,
- formatTokens,
- isAcceptedRun,
- isFaultedRun,
- isRejectedRun,
- planAwaitingApproval,
- planGated,
- readableDuration,
- readableMetric,
- reportReason,
- resultDescription,
- runProgress,
- runTokens,
- stalledMinutes,
- stoppedLabel,
- usageEstimate,
- type RecoveryAction,
-} from '../presentation';
-import { nextSteps, summarizeGoals, summarizeReport, summarizeStuck } from '../report';
-import { filterRuns, ownerFirst, type RunFilter } from './history';
-import { looksLikeLeanSource, readLeanFile } from './sourceFile';
-import { sourceIndentEdit, type IndentDirection } from './sourceIndent';
-import type { SourceSelection } from './sourceText';
-import { EditorNavigation, revealOffset } from './editorNavigation';
-import { diagnosticText, renderSourceCheck, SourceCheck, sourceOffset } from './sourceCheck';
-import { EditorReview } from './editorReview';
-import {
- decodeTaskDraft,
- editableTaskDraft,
- encodeTaskDraft,
- readTaskDraftFile,
- taskDraftStorageKey,
- type TaskDraft,
-} from './draft';
-import { compareSources, type SourceComparison } from './sourceDiff';
-import { submissionFields, submissionIssues, tokenCap, type SubmissionField, type SubmissionIssue } from './submission';
-import { SourceReader } from './sourceReader';
-import { readableMessage, type ActivityReader } from './activityReader';
-import type { ModuleView, ModuleViewInput } from './moduleView';
-import { ModulePlanEditor } from './modulePlanEditor';
-import type { CollaborationView } from './collaborationView';
-import type { CollaborationSection } from './collaborationNavigation';
-import type { TrajectoryView, ExplainKey } from './trajectoryView';
-import { RunUpdates } from './runUpdates';
-import { retainLatestRun } from './runSnapshot';
-import type { WebCommandResult, WebObservation } from '../collaboration';
-import { ServerModulePlans } from './serverModulePlans';
-import type { KnowledgeCatalog } from './knowledgeView';
-import { ModulePlanLibrary, modulePlanLibraryStorageKey } from './modulePlanLibrary';
-import { ModulePlanLibraryView } from './modulePlanLibraryView';
-import type { ResearchModuleSlot } from '../../../src/solver/modules/policy';
-import { MIN_TEAM_AGENTS } from '../../../src/solver/teamCapacity';
-import { draftOwnerStorageKey, OwnedDrafts, researchEntryStorageKey, webDraftOwner } from './ownedDrafts';
-import { SubmissionIdentity } from './submissionIdentity';
-import { automaticExplanationSettings } from './automaticExplanation';
-import { DraftRecovery, type ReplacementReason } from './draftRecovery';
-import {
- animateEntrance,
- arriveRow,
- finishHiddenMotion,
- finishMotion,
- glideSelection,
- revealTheme,
- selectionBox,
-} from './motion';
-import { renderTopbar } from './ui/Topbar';
-import { renderRunMonitor as drawRunMonitor, type MonitorItem } from './ui/RunMonitor';
-import { renderRunHeader as drawRunHeader, unmountRunHeader, type RunHeaderProps } from './ui/RunHeader';
-import { ChatSession } from './chatSession';
-import { leanProblemDraft, renderProblemDraftPanel } from './problemDrafts';
-import {
- clearProblemDraftTabMemory,
- captureProblemDraftSubmission,
- completeProblemDraftSubmission,
- resetProblemDraftBinding,
- syncProblemDraftSubmissions,
-} from './problemDraftLifecycle';
-import type { ProblemDraftValue } from '../problemDraftTypes';
-import {
- ChatArtifactNavigation,
- chatArtifactLine,
- chatArtifactTask,
- type ChatArtifactKind,
- type ChatArtifactTarget,
-} from './chatArtifactNavigation';
-import { createCommandPalette, type PaletteCommand } from './ui/CommandPalette';
-import {
- renderFacts,
- renderGlyph,
- renderGlyphLabel,
- renderHistoryEmpty,
- renderHistoryGroup,
- renderHistoryRow,
-} from './ui/Controls';
-import { renderConnecting, renderDraftPreview as drawDraftPreview } from './ui/DraftPreview';
-import { renderOptions } from './ui/Section';
-import type {
- CompareProps,
- OutlineState,
- ReportPanelProps,
- ResultPanelProps,
- SourcePanelProps,
-} from './ui/DetailPanel';
-import { leanFileName, leanOutline, writtenNames, type LeanHeading } from './leanOutline';
-import { renderConversation as drawConversation } from './ui/Conversation';
-import type { renderAgentRoute as RenderAgentRoute, unmountAgentRoute as UnmountAgentRoute } from './ui/AgentRoute';
-import { agentRoutes, taskNames } from './agentRoute';
-import { AgentActivity } from './agentActivity';
-import { FormalizationActivityStore } from './formalizationActivityStore';
-import { clockTime, commandId, workerNames } from './collaborationUi';
-import {
- documentTitle,
- finishedSince,
- newlyFinished,
- newlyWaiting,
- notifyStorageKey,
- readResume,
- saveResume,
- waitsForOwner,
-} from './runAwareness';
-import { browserNotificationState, notifyRunEvent } from './browserRunNotifications';
-import { forgetKey, hasRememberedKey, rememberKey, rememberedKey } from './keyMemory';
-import {
- applyTheme,
- followThemeChanges,
- readThemePreference,
- resolveTheme,
- saveThemePreference,
- type ThemePreference,
-} from './themePreference';
-import { installTermHints, renderGlossary } from './termHints';
-import { renderAdminPanel } from './ui/AdminPanel';
-import { feedbackUrl, localizeSiteLinks } from './feedback';
-import type { TermId } from './glossary';
-import {
- clause,
- locale,
- localeTag,
- localizeMessage,
- localizeText,
- otherLocale,
- sentences,
- switchLocale,
- t,
-} from '../i18n';
-import { tx } from './researchShared';
-import { historyStorageKey, markHistoryCollapsed, readHistoryCollapsed } from './historyPreference';
-import { detailLevel, onDetailLevel } from './detailLevel';
-import { classicLibraryUrl } from './classicLibrary';
-import { loadClassicPreparation, readClassicId } from './classicPreparation';
-import { renderContinuationPreview } from './productFlowView';
-import { relatedResearchRuns, type ContinuationPreview } from './productFlow';
-import type { InstalledLibraryDetail } from '../installedLibraryTypes';
-import { libraryReferenceKeys, readLibraryReference } from './installedLibraryReference';
-import { readEditedProblemId } from './chatDraft';
-import {
- clearResearchProblemDraft,
- loadResearchProblemDraft,
- readResearchProblemDraft,
- researchProblemDraftKeys,
-} from './researchProblemDraft';
-import { renderResearchProblemDraft } from './ui/ResearchProblemDraft';
-import {
- checkPersonalApproval,
- completePersonalApprovalReview,
- observedPersonalApproval,
- personalApprovalNeedsReview,
- personalApprovalSettled,
- readPersonalApproval,
- removePersonalApproval,
- requirePersonalApprovalReview,
- savePersonalApproval,
- type PersonalApprovalAttempt,
-} from './personalApprovalStore';
-
-const iconSet = {
- ArrowDown,
- ArrowDownToLine,
- ArrowLeft,
- ArrowRight,
- ArrowUp,
- BookOpen,
- ChevronDown,
- ChevronUp,
- CircleAlert,
- Copy,
- CopyPlus,
- CornerDownLeft,
- Cpu,
- Download,
- ExternalLink,
- Eye,
- FileCode2,
- FolderOpen,
- GitBranch,
- IndentDecrease,
- IndentIncrease,
- ListOrdered,
- Link2,
- Link2Off,
- Maximize2,
- MessageSquare,
- Minimize2,
- Monitor,
- Moon,
- Network,
- PanelRight,
- Paperclip,
- LogOut,
- Plus,
- RefreshCw,
- RotateCcw,
- Save,
- Search,
- ShieldCheck,
- SlidersHorizontal,
- Square,
- SquarePen,
- Sun,
- Trash2,
- TriangleAlert,
- Undo2,
- Upload,
- X,
-};
-function icons(root: Element | Document | DocumentFragment = document) {
- createIcons({ icons: iconSet, root, attrs: { 'aria-hidden': 'true' } });
- root.querySelectorAll('svg[data-lucide]').forEach(svg => svg.removeAttribute('data-lucide'));
-}
-function element(selector: string): T {
- const result = document.querySelector(selector);
- if (!result) throw new Error(`Missing workbench element: ${selector}`);
- return result;
-}
-function patchText(target: Element, value: string) {
- if (target.textContent !== value) target.textContent = value;
-}
-const field = (id: string) => element(`#${id}`);
-const activeRun = (run: WebRun) => run.status === 'queued' || run.status === 'running';
-const passed = isAcceptedRun;
-const timestamp = (value: string, timeOnly = false) => {
- const date = new Date(value);
- if (!Number.isFinite(date.getTime())) return value;
- return new Intl.DateTimeFormat(
- localeTag,
- timeOnly
- ? { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }
- : { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false },
- ).format(date);
-};
-const byteSize = (text: string) => new TextEncoder().encode(text).length;
-const byteLabel = (bytes: number) => (bytes >= 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${bytes} B`);
-type DetailTab = 'result' | 'trajectory' | 'collaboration' | 'source' | 'events' | 'modules';
-// The module plan is opened from the run menu; it joins the tabs only while it is the open one.
-const baseTabs = [
- ['result', t('结果')],
- ['trajectory', t('路线图')],
- ['collaboration', t('协作')],
- ['source', t('源码')],
- ['events', t('活动')],
-] as const;
-const detailTabs = (): readonly (readonly [DetailTab, string])[] =>
- state.tab === 'modules' ? [...baseTabs, ['modules', t('模块方案')]] : baseTabs;
-type PersonalApprovalView = {
- pending?: PersonalApprovalAttempt;
- receipt?: WebCommandResult;
- busy: boolean;
- checked: boolean;
- error?: string;
- storageError?: boolean;
- reviewRequired?: boolean;
- reviewedVersion?: string;
-};
-let personalApprovalIdentity: { session: WebSession; loading: boolean; owner?: string; error?: string } | undefined;
-const state = {
- session: undefined as WebSession | undefined,
- runs: [] as WebRun[],
- selectedId: '',
- selectedRun: undefined as WebRun | undefined,
- query: '',
- filter: 'all' as RunFilter,
- tab: 'result' as DetailTab,
- sourceView: 'proof' as 'proof' | 'input' | 'diff',
- submitting: false,
- cancelling: new Set(),
- draftView: 'source' as 'source' | 'modules',
- foldUnchanged: true,
- diffChange: 0,
- reportMode: 'summary' as 'summary' | 'json',
- deleting: new Set(),
- /** UI state only; unresolved approval identities are shared with the route page in owner/run storage. */
- approving: new Map(),
- /** The run whose 完整源码 is open beside its result. */ proofViewer: '',
- /** 对比代码 open beside a run's result: the run, and the later run compared with it. */ compare: undefined as
- { runId: string; laterId: string } | undefined,
- detailError: '',
- listGeneration: 0,
- runsEtag: '',
- listSignature: '',
- panelSignature: '',
- connected: false,
- refreshing: false,
- connectionEpoch: 0,
- /** The connection failed since the page loaded; until then, not being connected only means it is still connecting. */
- lost: false,
- composing: false,
- conversationSignature: '',
- finishedRuns: new Set(),
- /** Runs that ended while the tab was hidden; shown in the tab title until the tab is visible again. */
- unseenRuns: new Set(),
- resumed: false,
- /** The read-only sample run, fetched when first opened; it is never part of runs. */
- sample: undefined as WebRun | undefined,
-};
-const entryStorageKey = researchEntryStorageKey;
-const productEntrySearch = location.search,
- productEntry = readResearchEntry(productEntrySearch);
-const productTarget = new URLSearchParams(productEntrySearch);
-const problemDraftId = productTarget.get('accountDraft'),
- problemDraftVersion = productTarget.get('draftVersion');
-let problemDraftTarget =
- problemDraftId && /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u.test(problemDraftId)
- ? {
- id: problemDraftId,
- ...(problemDraftVersion && /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u.test(problemDraftVersion)
- ? { version: problemDraftVersion }
- : {}),
- }
- : undefined;
-function clearProblemDraftTarget(replaceAddress = true) {
- problemDraftTarget = undefined;
- productTarget.delete('accountDraft');
- productTarget.delete('draftVersion');
- if (!replaceAddress) return;
- const address = new URL(location.href);
- if (!address.searchParams.has('accountDraft') && !address.searchParams.has('draftVersion')) return;
- address.searchParams.delete('accountDraft');
- address.searchParams.delete('draftVersion');
- history.replaceState(null, '', address);
-}
-let productEntryHandled = false;
-let libraryProposalHandled = false;
-let libraryTrialHandled = false;
-let budgetDraftHandled = false;
-let sharedDraftHandled = false;
-let recoveryEntryHandled = false;
-function withAddressLanguage(search: string) {
- const language = new URLSearchParams(location.search).get('lang');
- const parameters = new URLSearchParams(search);
- if (language === 'zh' || language === 'en') parameters.set('lang', language);
- if (!search && problemDraftTarget) {
- parameters.set('accountDraft', problemDraftTarget.id);
- if (problemDraftTarget.version) parameters.set('draftVersion', problemDraftTarget.version);
- }
- const classic = readClassicId(new URLSearchParams(location.search)) ?? draftClassicOrigin?.id;
- if (classic && !parameters.has('run') && !parameters.has('chat') && !parameters.has('editProblem'))
- parameters.set('fromClassic', classic);
- return parameters.size ? `?${parameters}` : '';
-}
-let researchEntry: 'natural' | 'lean' = 'natural';
-// Fresh visits begin with a problem; same-owner drafts can resume their selected editor after loading.
-document.body.dataset.entry = researchEntry;
-let naturalPage: Promise | undefined;
-let chatWorkspace: ChatSession | undefined;
-const workbenchConnecting = element('#workbench-connecting');
-let linkedLibraryReference = readLibraryReference(new URLSearchParams(location.search));
-let linkedProblemDraft = readResearchProblemDraft(new URLSearchParams(location.search));
-let problemDraftRevision = 0;
-const chatArtifacts = new ChatArtifactNavigation(element('#research-chat-thread'));
-const chatArtifactIdentity = () => chatWorkspace?.id || currentRun()?.id || 'home';
-const outputWideQuery = window.matchMedia('(min-width:1101px)');
-function syncOutputControls() {
- const expanded = document.body.dataset.resultsExpanded === 'true';
- const close = element('#close-research-output'),
- resize = element('#expand-research-output');
- const closeLabel = !outputWideQuery.matches || expanded ? t('返回对话') : t('收起面板');
- close.title = closeLabel;
- close.setAttribute('aria-label', closeLabel);
- resize.title = expanded ? t('恢复分栏') : t('展开成果');
- resize.setAttribute('aria-pressed', String(expanded));
-}
-function placeInputMode() {
- const mode = currentRun() ? 'natural' : researchEntry;
- element('#research-input-mode').hidden = mode === 'natural';
- element('#open-natural-language').setAttribute('aria-pressed', String(mode === 'natural'));
- element('#entry-lean').setAttribute('aria-pressed', String(mode === 'lean'));
-}
-function chooseEntry(mode: 'natural' | 'lean') {
- closeSettings(false);
- document.body.dataset.draftPreview = 'false';
- element('#open-draft-preview').setAttribute('aria-expanded', 'false');
- researchEntry = mode;
- document.body.dataset.entry = mode;
- element('#open-natural-language').setAttribute('aria-pressed', String(mode === 'natural'));
- element('#entry-lean').setAttribute('aria-pressed', String(mode === 'lean'));
- placeInputMode();
- try {
- ownedDrafts.setItem(entryStorageKey, mode);
- } catch {
- /* Keep the choice for this page. */
- }
- syncNaturalResearch();
- renderRuntime();
- renderPreparation();
- renderShell();
-}
-async function loadNaturalResearch() {
- workbenchConnecting.remove();
- chatWorkspace = new ChatSession({
- request: api,
- session: () => state.session,
- runs: () => state.runs,
- onOpenRun: id => selectRun(id),
- connected: () => state.connected,
- draftScope: state.session ? ownerOfSession(state.session) : '',
- problemDraftTarget: () => problemDraftTarget,
- onRestoreProblemDraft: restoreProblemDraft,
- keyRequired: providerId =>
- !state.session?.account?.serverKeys?.includes(providerId) &&
- !state.session?.account?.savedKeys?.some(key => key.providerId === providerId),
- onNavigate: (id, mode, attached, editedProblem) => {
- chatArtifacts.clear();
- researchEntry = 'natural';
- document.body.dataset.entry = 'natural';
- placeInputMode();
- if (linkedLibraryReference && (mode === 'push' || linkedLibraryReference.chat !== id))
- linkedLibraryReference = undefined;
- if (linkedProblemDraft && (mode === 'push' || id)) dismissProblemDraft();
- const parameters = new URLSearchParams(id ? { chat: id } : {});
- if (editedProblem) parameters.set('editProblem', editedProblem);
- if (linkedLibraryReference && linkedLibraryReference.chat === id) {
- parameters.set('libraryModule', linkedLibraryReference.file);
- parameters.set('libraryCatalog', linkedLibraryReference.catalogDigest);
- parameters.set('libraryDeclaration', linkedLibraryReference.declaration);
- if (linkedLibraryReference.editedProblem) parameters.set('editProblem', linkedLibraryReference.editedProblem);
- }
- if (linkedProblemDraft) {
- const original = new URLSearchParams(location.search);
- for (const key of researchProblemDraftKeys) if (original.has(key)) parameters.set(key, original.get(key)!);
- }
- const search = withAddressLanguage(parameters.size ? `?${parameters}` : '');
- if (location.search !== search)
- history[mode === 'push' ? 'pushState' : 'replaceState'](null, '', location.pathname + search);
- // The live workspace belongs to the task, not to one of its stages: a task moving from its statement to its proof keeps it open.
- if (!id || document.body.dataset.chatArtifact !== 'live') {
- document.body.dataset.chatArtifact = '';
- document.body.dataset.outputOpen = 'false';
- document.body.dataset.resultsExpanded = 'false';
- syncOutputControls();
- }
- // Arrow keys in the phone history open each run in turn; its conversation arriving must not close the list.
- if (!attached) closeHistoryDialog();
- },
- onSelection: received => {
- const run =
- received &&
- retainLatestRun(
- received,
- state.runs.find(item => item.id === received.id),
- );
- const changed = currentRun()?.id !== run?.id;
- // A known run is refreshed where it stands, so the history keeps its order; a new one joins at the top.
- if (run)
- state.runs = state.runs.some(item => item.id === run.id)
- ? state.runs.map(item => (item.id === run.id ? run : item))
- : [run, ...state.runs];
- state.composing = !run;
- state.selectedId = run?.id ?? '';
- state.selectedRun = run;
- if (changed) {
- chatArtifacts.clear();
- state.tab = 'result';
- state.panelSignature = '';
- }
- renderRunList();
- renderDetail(changed);
- renderShell();
- // The live workspace follows whichever task the conversation shows; switching tasks redraws it in place.
- if (changed && document.body.dataset.chatArtifact !== 'live') setMobileView('compose');
- },
- onConversation: renderShell,
- onArtifact: openChatArtifact,
- onShare: run => void openSharing(run),
- onRecover: recoverRun,
- onKeysChanged: keys => {
- if (state.session?.account) state.session.account.savedKeys = keys;
- providerAddress();
- },
- onSample: () => void openSample(),
- onHistory: openHistory,
- agentActivity,
- formalizationActivity,
- onLean: () => {
- chooseEntry('lean');
- startDraft();
- },
- onGuidance: (run, text?: string, taskId?: string) => openGuidance(run, text, undefined, taskId),
- planApproval: approvalProps,
- onApprovePlan: run => void approvePlan(run),
- onPlan: async (run, edit) => {
- await openChatArtifact('plan');
- if (currentRun()?.id !== run.id || document.body.dataset.chatArtifact !== 'plan') return;
- if (edit && !collaborationView?.editPlan(run.id))
- element('#detail-tab-collaboration').focus({ preventScroll: true });
- },
- onCancelRun: openCancellation,
- isSample,
- });
- if (linkedProblemDraft) chatWorkspace.home(false);
- await chatWorkspace.start(linkedProblemDraft ? undefined : currentRun());
- if (linkedProblemDraft) void showProblemDraft();
- const reference = linkedLibraryReference,
- workspace = chatWorkspace,
- session = state.session;
- if (reference && reference.chat === workspace.id && reference.editedProblem === workspace.editingProblem) {
- try {
- const { item } = await api<{ item: InstalledLibraryDetail }>(
- `/api/research/library/installed/module?${new URLSearchParams({ file: reference.file, catalogDigest: reference.catalogDigest })}`,
- );
- const { libraryReference } = await import('./installedLibraryReferenceValue');
- if (
- !sameSession(session) ||
- workspace !== chatWorkspace ||
- workspace.id !== reference.chat ||
- workspace.editingProblem !== reference.editedProblem
- )
- return;
- if (!workspace.includeLibraryReference(libraryReference(item, reference.declaration)))
- throw new Error(t('暂时无法加入引用,原有输入已保留。请重新打开此接口。'));
- linkedLibraryReference = undefined;
- const next = new URL(location.href);
- for (const key of libraryReferenceKeys) next.searchParams.delete(key);
- history.replaceState(null, '', next);
- toast(t('已加入数学库参考,可继续补充题目或发送。'));
- } catch (error) {
- if (
- sameSession(session) &&
- workspace === chatWorkspace &&
- workspace.id === reference.chat &&
- workspace.editingProblem === reference.editedProblem
- )
- workspace.libraryReferenceFailed(t('引用数学库失败:{0}', message(error)));
- }
- }
-}
-function dismissProblemDraft() {
- linkedProblemDraft = undefined;
- problemDraftRevision++;
- renderResearchProblemDraft(element('#research-problem-draft'));
- const next = new URL(location.href);
- clearResearchProblemDraft(next.searchParams);
- history.replaceState(null, '', next);
-}
-async function showProblemDraft() {
- const reference = linkedProblemDraft,
- workspace = chatWorkspace,
- session = state.session;
- if (!reference || !workspace || workspace.id) return;
- const revision = ++problemDraftRevision;
- const current = () =>
- revision === problemDraftRevision &&
- linkedProblemDraft === reference &&
- workspace === chatWorkspace &&
- !workspace.id &&
- sameSession(session);
- const common = {
- onDismiss: dismissProblemDraft,
- onRetry: () => void showProblemDraft(),
- onInclude: () => {},
- onAppend: () => {},
- };
- renderResearchProblemDraft(element('#research-problem-draft'), { ...common, loading: true });
- try {
- const candidate = await loadResearchProblemDraft(reference, {
- json: api,
- currentHref: location.href,
- locale,
- text: async url => {
- const response = await fetch(url, {
- credentials: 'same-origin',
- cache: 'no-store',
- signal: readController.signal,
- });
- if (!response.ok) throw new Error(t('读取原题失败,请重试。'));
- return response.text();
- },
- });
- if (!current()) return;
- const include = (independent: boolean) => {
- if (!current()) return;
- if (
- !workspace.includeProblemDraft(
- candidate.text,
- candidate.environment,
- independent ? candidate.draftId : undefined,
- )
- ) {
- toast(t('暂时无法加入原题,现有草稿已保留。'));
- return;
- }
- dismissProblemDraft();
- toast(independent ? t('已打开独立研究草稿,可修改后发送。') : t('原题已追加到首页草稿,可修改后发送。'));
- };
- renderResearchProblemDraft(element('#research-problem-draft'), {
- ...common,
- candidate,
- onInclude: () => include(true),
- onAppend: () => include(false),
- });
- } catch (error) {
- if (current()) renderResearchProblemDraft(element('#research-problem-draft'), { ...common, error: message(error) });
- }
-}
-async function openChatArtifact(kind: ChatArtifactKind, target?: ChatArtifactTarget, auto = false) {
- const run = currentRun(),
- task = chatArtifactTask(run, target?.taskId);
- // The live workspace is there for a formalization too, before any run exists.
- if (kind !== 'original' && kind !== 'live' && !run) return;
- if (kind !== 'original' && kind !== 'live' && target?.taskId && !task) {
- toast(t('任务合同未保留'));
- return;
- }
- // The task opening its own workspace is not a place the reader came from; coming back still returns to their last one.
- if (!auto) chatArtifacts.remember(chatArtifactIdentity(), kind, target);
- document.body.dataset.chatArtifact = kind;
- document.body.dataset.outputOpen = 'true';
- syncOutputControls();
- if (kind === 'original') {
- element('#close-research-output').focus({ preventScroll: true });
- return;
- }
- // The live workspace replaces the run detail for the time it is open, on any screen size.
- if (kind === 'live') {
- if (!auto) element('#close-research-output').focus({ preventScroll: true });
- return;
- }
- state.tab =
- kind === 'result' ? 'result' : kind === 'roadmap' ? 'trajectory' : kind === 'plan' ? 'collaboration' : 'source';
- state.sourceView = 'proof';
- setMobileView('runs');
- renderDetail(true);
- if (kind === 'plan' || (task && kind === 'roadmap')) {
- await loadRunViews();
- if (currentRun()?.id !== run!.id || document.body.dataset.chatArtifact !== kind) return;
- }
- if (kind === 'plan') {
- collaborationView?.showSection(run!.id, 'tasks');
- return;
- }
- if (task && kind === 'roadmap') {
- element('#detail-tab-trajectory').focus({ preventScroll: true });
- void trajectoryView?.showTask(run!.id, task.id);
- return;
- }
- if (task && kind === 'source') {
- openTaskSource(run!, task.id);
- return;
- }
- element(`#detail-tab-${state.tab}`).focus({ preventScroll: true });
-}
-async function openTaskSource(run: WebRun, taskId: string) {
- const task = chatArtifactTask(run, taskId);
- if (!task) return;
- document.body.dataset.chatArtifact = 'source';
- state.proofViewer = '';
- state.compare = undefined;
- state.sourceView = 'proof';
- const line = chatArtifactLine(run, taskId, candidateSource(run));
- state.tab = line === undefined ? 'collaboration' : 'source';
- const tab = state.tab;
- setMobileView('runs');
- renderDetail(true);
- await loadRunViews();
- if (currentRun()?.id !== run.id || state.tab !== tab || document.body.dataset.chatArtifact !== 'source') return;
- if (line !== undefined) {
- sourceReader.goToLine(line);
- return;
- }
- // A lemma may only have its own recorded file before integration into the candidate.
- if (collaborationView?.showTask(run.id, taskId)) {
- document
- .querySelector(
- `[data-collab-source="${CSS.escape(taskId)}"][data-source-version="${CSS.escape(task.version)}"]`,
- )
- ?.click();
- }
-}
-function syncNaturalResearch() {
- const run = currentRun();
- const showing = Boolean(run) || researchEntry === 'natural';
- element('#research-conversation-panel').hidden = !showing;
- placeInputMode();
- if (showing && state.session && !naturalPage) naturalPage = Promise.resolve().then(loadNaturalResearch);
- if (run && chatWorkspace && chatWorkspace.runId !== run.id) void chatWorkspace.openRun(run);
-}
-async function openNaturalResearch(reset = false) {
- if (state.submitting) return;
- closeHistoryDialog();
- if (reset) {
- clearProblemDraftTarget(false);
- if (state.session) resetProblemDraftBinding(ownerOfSession(state.session), 'lean');
- }
- chooseEntry('natural');
- startDraft();
- await naturalPage;
- chatWorkspace?.home(reset);
- chatWorkspace?.focus();
-}
-const baseTitle = document.title;
-// A link from the completion mail or the address bar (/?run=) opens that run, also after the login page sends the reader back.
-// The address then follows the open run (syncAddress), so it can be bookmarked and Back returns to the run before.
-const runIdPattern = /^[a-f0-9-]{1,36}$/u;
-const linkedRun = new URLSearchParams(location.search).get('run');
-// The sample has an address of its own (/?sample), so Back from a run returns to it and a reload keeps it open.
-const sampleAddress = '?sample';
-const initialAddress = new URLSearchParams(location.search);
-initialAddress.delete('lang');
-let sampleLink = initialAddress.size === 1 && initialAddress.get('sample') === '';
-let formalizationLink = new URLSearchParams(location.search).get('formalization');
-// When the session ends, the login page keeps the run or conversation open now (login.html?run=, ?chat=) and
-// returns to it.
-const loginAddress = () => loginHref(location.pathname + location.search + location.hash);
-// The root address opens a new problem; explicit run and sample links still open their records.
-state.composing = !!linkedProblemDraft || (!linkedRun && !sampleLink);
-if (linkedRun !== null && runIdPattern.test(linkedRun))
- saveResume(() => localStorage, {
- selectedId: linkedRun,
- seenAt: readResume(() => localStorage)?.seenAt ?? new Date().toISOString(),
- });
-const notifyState = browserNotificationState;
-function announceRun(run: WebRun, kind: 'finished' | 'waiting', label: string) {
- if (!state.session) return;
- const owner = ownerOfSession(state.session);
- void notifyRunEvent({
- owner,
- run,
- kind,
- title: `TheoremOS · ${label}`,
- body: `${run.title}\n${resultDescription(run)}`,
- current: () => Boolean(state.session && ownerOfSession(state.session) === owner),
- activate: () => {
- selectRun(run.id);
- setMobileView('runs');
- },
- });
-}
-function announceFinished(run: WebRun) {
- if (!document.hidden) return;
- state.unseenRuns.add(run.id);
- announceRun(run, 'finished', status(run).label);
-}
-/** Nothing in a run with 先审计划 starts until its owner approves the plan, so its owner hears about it at once. */
-function announceWaiting(run: WebRun) {
- if (!document.hidden) {
- if (run.id !== state.selectedId) toast(t('「{0}」的研究计划等你批准', run.title));
- return;
- }
- announceRun(run, 'waiting', t('研究计划等你批准'));
-}
-async function toggleNotifications() {
- const current = notifyState();
- if (current === 'unsupported') {
- toast(t('这个浏览器不支持桌面通知'));
- return;
- }
- if (current === 'blocked') {
- toast(t('浏览器已阻止本站通知,请在地址栏的网站设置中允许'));
- return;
- }
- const remember = (value: string) => {
- try {
- localStorage.setItem(notifyStorageKey, value);
- } catch {
- /* Preference lasts for this page only. */
- }
- };
- if (current === 'on') {
- remember('off');
- toast(t('已关闭完成通知'));
- renderPanel(true);
- return;
- }
- const permission = Notification.permission === 'granted' ? 'granted' : await Notification.requestPermission();
- if (permission !== 'granted') {
- toast(t('没有获得通知权限,结束时只会在标签页标题上提示'));
- renderPanel(true);
- return;
- }
- remember('on');
- toast(t('研究结束或计划等你批准时会发送桌面通知'));
- renderPanel(true);
-}
-let pollTimer: ReturnType | undefined;
-let toastTimer: ReturnType | undefined;
-let clockTimer: ReturnType | undefined;
-let connectionRequest: Promise | undefined;
-let liveRefreshPending = false;
-let lastRunsReadAt = -Infinity;
-let runsReadRetryAt = 0;
-const liveRefreshIntervalMs = 750;
-let readController = new AbortController();
-let pageActive = true;
-let sourceRevision = 0;
-let editorRevision = 0;
-let editorInitialSource = '';
-let editorOpenedFromPreview = false;
-let editorClosePosition:
- { start: number; end: number; direction: 'forward' | 'backward' | 'none'; top: number; left: number } | undefined;
-let deletionTarget: { id: string; title: string; csrfToken: string } | undefined;
-/** The active run the cancel confirmation names; confirming acts on this id even if the selection moved meanwhile. */
-let cancellationTarget: { id: string; title: string; csrfToken: string } | undefined;
-let sharing: { id: string; link?: WebShareLink | null; busy: boolean } | undefined;
-let submissionSequence = 0;
-let draftReady = false;
-let draftDirty = false;
-let draftRevision = 0;
-let draftTimer: ReturnType | undefined;
-let latestDraft: TaskDraft | undefined;
-let draftAutoExplain: TaskDraft['autoExplain'] = true;
-let draftExplanationLanguage: TaskDraft['explanationLanguage'] = locale;
-let draftTeamProfiles: string[] = [];
-const loadTeamProfiles = async () => (await api<{ profiles: WebTeamProfile[] }>('/api/team-profiles')).profiles;
-const loadExpertAssets = async () =>
- (
- await Promise.all(
- ['agent', 'skill'].map(
- async type => (await api<{ items: ResearchAsset[] }>(`/api/research/library?type=${type}`)).items,
- ),
- )
- ).flat();
-function refreshPersonalExperts() {
- const session = state.session,
- owner = session ? webDraftOwner(session) : '';
- const selection = researchSelection.value();
- renderPersonalExpertPicker(element('#native-team-personal-experts'), {
- owner,
- load: loadExpertAssets,
- selected: [...(selection?.agent ? [selection.agent] : []), ...(selection?.skills ?? [])],
- choose: async ({ assetId, version, digest, type }) => {
- if (!session || state.submitting || field('research-mode').value !== 'native-team') return;
- const revision = draftRevision,
- environment = field('environment').value as WebEnvironment;
- const existing = researchSelection.value(),
- current = type === 'agent' ? existing?.agent : existing?.skills?.find(ref => ref.assetId === assetId);
- const chosen =
- current?.assetId === assetId && current.version === version ? undefined : { assetId, version, digest };
- const agent = type === 'agent' ? chosen : existing?.agent;
- const skills =
- type === 'agent'
- ? (existing?.skills ?? [])
- : [...(existing?.skills ?? []).filter(ref => ref.assetId !== assetId), ...(chosen ? [chosen] : [])];
- const refs = [...(agent ? [agent] : []), ...skills, ...(existing?.libraries ?? [])];
- const prepared = refs.length ? await researchSelection.prepare(refs, environment, true) : undefined;
- if (
- !state.session ||
- webDraftOwner(state.session) !== owner ||
- field('research-mode').value !== 'native-team' ||
- state.submitting ||
- draftRevision !== revision
- )
- throw new Error(t('读取期间原题已修改,请重新选择恢复。'));
- if (prepared) researchSelection.adopt(prepared);
- else researchSelection.clear();
- },
- });
-}
-function setDraftTeamProfiles(profiles: string[] = []) {
- draftTeamProfiles = [...new Set(profiles)].sort();
- renderTeamProfilePicker(element('#native-team-profiles'), {
- value: draftTeamProfiles,
- load: loadTeamProfiles,
- change: next => {
- setDraftTeamProfiles(next);
- draftChanged();
- },
- });
-}
-let replacingDraft = false;
-let restoringDraft = false;
-const ownedDrafts = new OwnedDrafts(() => sessionStorage);
-const submissionIdentity = new SubmissionIdentity(ownedDrafts);
-const draftRecovery = new DraftRecovery(() => ownedDrafts);
-const problemDraftHost = document.createElement('div');
-problemDraftHost.id = 'lean-problem-drafts';
-problemDraftHost.hidden = true;
-element('#run-form').after(problemDraftHost);
-const ownerOfSession = webDraftOwner;
-function clearOwnedDrafts() {
- state.approving.clear();
- personalApprovalIdentity = undefined;
- document.querySelector('[data-library-proposal-start]')?.remove();
- libraryProposalHandled = false;
- problemDraftRevision++;
- renderResearchProblemDraft(element('#research-problem-draft'));
- document.querySelector('[data-library-trial-start]')?.remove();
- libraryTrialHandled = false;
- document.querySelector('[data-budget-attempt-start]')?.remove();
- budgetDraftHandled = false;
- document.querySelector('[data-shared-proof-start]')?.remove();
- sharedDraftHandled = false;
- document.querySelector('[data-shared-proof-origin]')?.remove();
- draftSharedProofOrigin = undefined;
- sharedProofOriginRead = undefined;
- document.querySelector('[data-classic-origin]')?.remove();
- draftClassicOrigin = undefined;
- document.querySelector('[data-library-proposal-origin]')?.remove();
- draftLibraryProposalOrigin = undefined;
- libraryProposalOriginRead = undefined;
- recoveryEntryHandled = false;
- budgetDraftOrigin = undefined;
- chatWorkspace?.bindOwner('');
- renderProblemDraftPanel(problemDraftHost);
- problemDraftHost.hidden = true;
- researchSelection.reset();
- serverModulePlans.setKnowledgeCatalogs();
- collaborationView?.clearPlanDrafts();
- submissionSequence++;
- draftReady = false;
- draftDirty = false;
- clearTimeout(draftTimer);
- latestDraft = undefined;
- pendingImport = undefined;
- taskImportSequence++;
- draftAutoExplain = true;
- draftExplanationLanguage = locale;
- setDraftTeamProfiles();
- draftContinuation = undefined;
- submissionIdentity.clear();
- draftRecovery.clear();
- ownedDrafts.clear();
- forgetRememberedKey();
- clearProblemDraftTabMemory();
- try {
- for (const key of Object.keys(sessionStorage)) {
- if (
- key.startsWith('theorem-os.natural-research-draft.v1:') ||
- key.startsWith('theorem-os.chat-draft.') ||
- key.startsWith('theorem-os.chat-submission.') ||
- key.startsWith('theorem-os.chat-reading.') ||
- key.startsWith('theorem-os.problem-draft.') ||
- key.startsWith('theorem-os.problem-draft-pending.') ||
- key === entryStorageKey
- )
- sessionStorage.removeItem(key);
- }
- } catch {
- /* In-memory drafts are also cleared when browser storage is unavailable. */
- }
-}
-
-let taskImportSequence = 0;
-let pendingImport: { draft: TaskDraft; revision: number } | undefined;
-let sourceComparison:
- { runId: string; before: string; after: string; folded: boolean; result: SourceComparison } | undefined;
-/** 对比代码 between a run and a later one, kept while their code and the folding stay the same. */
-let runComparison: { before: string; after: string; folded: boolean; result: SourceComparison } | undefined;
-let proofHeadings: { source: string; headings: LeanHeading[] } | undefined;
-/** The declarations of the proof the result tab shows, read once per proof. */
-function headingsOf(source: string) {
- if (proofHeadings?.source !== source) proofHeadings = { source, headings: leanOutline(source) };
- return proofHeadings.headings;
-}
-let draftPreviewSignature = '';
-let draftSourceExpanded = false;
-/** The recorded version the next run starts from (「从这一版继续」); one submission uses it. */
-let draftContinuation: WebContinuation | undefined;
-let continuationPreview: ContinuationPreview | undefined;
-let budgetDraftOrigin: { runId: string; projectId?: string; source: string; environment: WebEnvironment } | undefined;
-let draftSharedProofOrigin: TaskDraft['sharedProofOrigin'];
-let draftClassicOrigin: TaskDraft['classicOrigin'];
-let draftLibraryProposalOrigin: TaskDraft['libraryProposalOrigin'];
-let sharedProofOriginRead: { key: string; status: 'loading' | 'available' | 'unavailable' } | undefined;
-let libraryProposalOriginRead: { key: string; status: 'loading' | 'available' | 'unavailable' } | undefined;
-let draftFormalization:
- | (NonNullable & { source: string; environment: WebEnvironment; original?: string })
- | undefined;
-let moduleSettingsPolicy: string | undefined;
-let settingsWorkspaceReturn: { focus?: HTMLElement; preview?: boolean } | undefined;
-const sourceReader = new SourceReader(() => {
- if (!currentRun() && !draftSourceExpanded) {
- draftSourceExpanded = true;
- renderDraftPreview();
- }
-});
-let activityReader: ActivityReader | undefined;
-let moduleView: ModuleView | undefined;
-let renderDetailPanel: typeof import('./ui/DetailPanel').renderDetailPanel | undefined;
-let renderAgentRoute: typeof RenderAgentRoute | undefined, unmountAgentRoute: typeof UnmountAgentRoute | undefined;
-const modulePlanEditor = new ModulePlanEditor(element('#module-plan'), icons, () => draftChanged());
-// Each run's events and Agent actions for the route maps of the result and collaboration tabs, read once for both.
-const agentActivity = new AgentActivity(url => api(url));
-const formalizationActivity = new FormalizationActivityStore(url => api(url));
-let collaborationView: CollaborationView | undefined;
-let trajectoryView: TrajectoryView | undefined;
-let runViewsLoading: Promise | undefined;
-let runViewsError = '';
-function loadRunViews() {
- return (runViewsLoading ??= import('./runViews')
- .then(views => {
- activityReader = new views.ActivityReader(
- at => timestamp(at, true),
- (filename, text) => download(filename, text, 'application/json'),
- );
- moduleView = new views.ModuleView();
- renderDetailPanel = views.renderDetailPanel;
- renderAgentRoute = views.renderAgentRoute;
- unmountAgentRoute = views.unmountAgentRoute;
- collaborationView = new views.CollaborationView(
- api,
- receiveRunObservation,
- () => {
- state.tab = 'result';
- renderDetail(true);
- document
- .querySelector('#detail-panel .result-report')
- ?.scrollIntoView({ block: 'start', behavior: 'instant' });
- document.getElementById('detail-tab-result')?.focus({ preventScroll: true });
- },
- agentActivity,
- );
- // The trajectory's line "+" adds that line to the run's guidance draft, addressed to the attempt's task, in 协作.
- trajectoryView = new views.TrajectoryView(
- api,
- (run, text, taskId) => openGuidance(run, text, t('代码行已加入本地指导草稿,尚未发送'), taskId),
- {
- allowed: run => !isSample(run),
- start: (run, from) => reuseRun(run, 'retry', from),
- explain: {
- key: explainKey,
- // A model answers in its own time; the server gives up after three minutes.
- ask: (run, request, signal) =>
- api(`/api/runs/${encodeURIComponent(run.id)}/explain`, {
- method: 'POST',
- signal,
- timeoutMs: 200_000,
- body: JSON.stringify(
- explainKey(run).source === 'remembered'
- ? { ...request, apiKey: rememberedKey(keyStorage, run.providerId, providerUrl(run.providerId)) }
- : request,
- ),
- }),
- },
- },
- );
- runViewsError = '';
- draftPreviewSignature = '';
- renderDetail(true);
- })
- .catch(error => {
- runViewsError = message(error);
- renderDetail(true);
- }));
-}
-function renderRunViewsLoading(panel: HTMLElement) {
- panel.replaceChildren();
- if (runViewsError) {
- const error = document.createElement('p');
- error.className = 'inline-error';
- error.setAttribute('role', 'alert');
- error.textContent = runViewsError;
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'button';
- retry.textContent = t('重试');
- retry.addEventListener('click', () => location.reload());
- panel.append(error, retry);
- } else {
- renderConnecting(panel);
- void loadRunViews();
- }
-}
-const runUpdates = new RunUpdates(version => {
- if (pageActive && state.connected && !document.hidden && version !== state.runsEtag) requestRunsRefresh();
-}, schedulePoll);
-const serverModulePlans = new ServerModulePlans(
- element('#module-plan'),
- element('#draft-knowledge-catalog'),
- api,
- () => modulePlanEditor.value(),
- plan => modulePlanEditor.setValue(plan),
- () => draftChanged(),
-);
-const modulePlanLibrary = new ModulePlanLibraryView(
- element('#module-plan-library'),
- new ModulePlanLibrary(() => localStorage),
- () => modulePlanEditor.value(),
- plan => {
- modulePlanEditor.setValue(plan);
- draftChanged();
- },
-);
-const editorNavigation = new EditorNavigation(
- element('#source-editor'),
- updateEditorPosition,
- updateEditorCount,
- () => state.session?.limits.maxSourceBytes ?? 0,
-);
-const editorReview = new EditorReview(
- element('#source-editor'),
- () => editorNavigation.close(),
- updateEditorPosition,
- position => editorNavigation.locate(position),
-);
-const validationShown = new Set();
-const checkScope = crypto.randomUUID();
-const sourceCheck = new SourceCheck({
- input: () => ({
- environment: field('environment').value as WebEnvironment,
- source: field('source').value,
- ...(researchSelection.value()
- ? {
- researchSelection: researchSelection.value(),
- ...(field('research-mode').value === 'native-team' ? { nativeTeam: true as const } : {}),
- }
- : {}),
- }),
- enabled: () =>
- Boolean(
- researchEntry === 'lean' &&
- state.session?.precheck &&
- state.connected &&
- state.session.runtime.ready &&
- new TextEncoder().encode(field('source').value).length <= state.session.limits.maxSourceBytes,
- ),
- post: async (input, signal) =>
- (
- await api<{ precheck: WebPrecheck }>('/api/precheck', {
- method: 'POST',
- body: JSON.stringify({ ...input, checkScope }),
- signal,
- timeoutMs: 120_000,
- })
- ).precheck,
- message: error => message(error),
- render: () => {
- renderSourceCheckView();
- renderPreparation();
- },
-});
-const researchSelection = new ResearchSelection(
- api,
- () => {
- refreshPersonalExperts();
- draftChanged();
- saveDraft();
- },
- ownedDrafts,
-);
-function renderSourceCheckView() {
- renderSourceCheck(element('#source-check'), element('#source-check-status'), {
- check: sourceCheck,
- onJump: jumpToSourceDiagnostic,
- onRecheck: () => {
- void sourceCheck.run();
- },
- onOpen: () => {
- const first = sourceCheck.blocking();
- if (first) {
- jumpToSourceDiagnostic(first);
- return;
- }
- openSettings('source');
- element('#source-check').scrollIntoView({ block: 'nearest', behavior: 'instant' });
- },
- });
-}
-/** Focuses the inline statement with the reported range selected and in view. */
-function jumpToSourceDiagnostic(diagnostic: WebPrecheckDiagnostic) {
- openSettings('source');
- const editor = element('#source');
- if (!editor.matches(':focus')) return;
- const start = sourceOffset(editor.value, diagnostic.line, diagnostic.column);
- const end =
- diagnostic.endLine === undefined
- ? start
- : Math.max(start, sourceOffset(editor.value, diagnostic.endLine, diagnostic.endColumn ?? 0));
- editor.setSelectionRange(start, end);
- revealOffset(editor, start);
- editor.scrollIntoView({ block: 'nearest', behavior: 'instant' });
-}
-let chatWidth = 40;
-const conversationScroll = { top: 0 };
-const historyQuery = window.matchMedia('(max-width:850px)');
-// A touch screen's keyboard covers half the page: focus moves into a text field only when the reader is about to type.
-const touchQuery = window.matchMedia('(pointer: coarse)');
-let historyCriteria = '';
-/** Runs that reached the list since it was last drawn (submitted here, or by another tab); they unfold into it. */
-const arrivals = new Set();
-let historyReading: { top: number; anchors: Array<{ id: string; offset: number }> } = { top: 0, anchors: [] };
-
-// Edge limits can apply to one route. The workbench's own address limit covers all API requests.
-const routeCooldowns = new Map();
-let addressCooldown: ApiError | undefined;
-function cooldownFor(route: string) {
- const local = routeCooldowns.get(route);
- return local && local.retryAt > (addressCooldown?.retryAt ?? 0) ? local : addressCooldown;
-}
-const retryAfterMs = (header: string | null, now: number) => {
- if (!header) return;
- const delay = /^\d+$/u.test(header) ? Number(header) * 1_000 : Date.parse(header) - now;
- if (Number.isFinite(delay)) return Math.max(0, delay);
-};
-const pause = (ms: number, signal: AbortSignal) =>
- new Promise((resolve, reject) => {
- if (signal.aborted) {
- reject(signal.reason);
- return;
- }
- const timer = setTimeout(() => {
- signal.removeEventListener('abort', stop);
- resolve();
- }, ms);
- const stop = () => {
- clearTimeout(timer);
- reject(signal.reason);
- };
- signal.addEventListener('abort', stop, { once: true });
- });
-/** `message` is what the reader sees; `reason` keeps the server's own text for checks such as sessionFailure. */
-class ApiError extends Error {
- constructor(
- readonly reason: string,
- readonly status: number,
- readonly retryAt = 0,
- readonly code?: string,
- ) {
- super(localizeMessage(reason));
- }
-}
-type ApiInit = RequestInit & { timeoutMs?: number; firstResponseTimeoutMs?: number };
-const sameSession = (session: WebSession | undefined) =>
- session?.draftOwner === state.session?.draftOwner && session?.csrfToken === state.session?.csrfToken;
-let keyChangeSession: WebSession | undefined,
- keyChangeTail: Promise = Promise.resolve();
-function api(url: string, init?: ApiInit): Promise;
-function api(url: string, init: ApiInit, etag: (value: string | null) => void): Promise;
-async function api(
- url: string,
- { timeoutMs = 15_000, firstResponseTimeoutMs, ...init }: ApiInit = {},
- etag?: (value: string | null) => void,
-): Promise {
- const requestSession = state.session,
- requestOwner = requestSession?.draftOwner;
- // Both input modes update the same saved-key metadata. Send their changes in order, including runs
- // whose response carries that metadata, so a slow deletion cannot replace a later saved key.
- const keyChange = Boolean(
- requestSession?.account?.keyVault &&
- ((url.startsWith('/api/auth/keys/') && (init.method === 'PUT' || init.method === 'DELETE')) ||
- (url === '/api/runs' && init.method === 'POST')),
- );
- let finishKeyChange: (() => void) | undefined;
- if (keyChange) {
- if (!sameSession(keyChangeSession)) {
- keyChangeSession = requestSession;
- keyChangeTail = Promise.resolve();
- }
- const previous = keyChangeTail;
- keyChangeTail = new Promise(resolve => {
- finishKeyChange = resolve;
- });
- await previous;
- }
- const method = init.method?.toUpperCase() ?? 'GET';
- const read = method === 'GET';
- const route = `${method} ${url.split('?', 1)[0]}`;
- const deadline = Date.now() + timeoutMs;
- const timeout = new AbortController();
- const transportError = (text: string) => (read ? new ApiError(text, 0) : new Error(text));
- const timedOut = () => transportError(t('请求超时,请重新连接'));
- const timer = setTimeout(() => timeout.abort(timedOut()), timeoutMs);
- const signals = [timeout.signal];
- if (read) signals.push(readController.signal);
- if (init.signal) signals.push(init.signal);
- try {
- // A queued change still belongs to the identity that requested it, even after another tab logs in.
- if (keyChange && !sameSession(requestSession)) throw new ApiError(t('会话校验失败,请刷新页面。'), 401);
- const signal = AbortSignal.any(signals);
- const retryDelay = 400;
- const canRetryRead = (attempt: number) =>
- read && attempt === 0 && navigator.onLine && Date.now() + retryDelay < deadline;
- const send = async (attempt: number) => {
- signal.throwIfAborted();
- if (read && !navigator.onLine) throw transportError(t('网络已断开'));
- let cooldown = cooldownFor(route);
- while (cooldown && cooldown.retryAt > Date.now()) {
- if (!read || cooldown.retryAt >= deadline) throw cooldown;
- await pause(cooldown.retryAt - Date.now(), signal);
- cooldown = cooldownFor(route);
- }
- routeCooldowns.delete(route);
- const request = (requestSignal: AbortSignal) =>
- fetch(url, {
- ...init,
- credentials: 'same-origin',
- cache: 'no-store',
- signal: requestSignal,
- headers: {
- Accept: 'application/json',
- ...(init.body ? { 'Content-Type': 'application/json' } : {}),
- ...(!read ? { 'X-CSRF-Token': state.session?.csrfToken ?? '' } : {}),
- ...init.headers,
- },
- });
- if (!read || attempt || !firstResponseTimeoutMs) return request(signal);
- // A stalled connection can recover within the original deadline. A response already downloading gets the full time.
- const firstResponse = new AbortController();
- const timer = setTimeout(() => firstResponse.abort(timedOut()), firstResponseTimeoutMs);
- try {
- return await request(AbortSignal.any([signal, firstResponse.signal]));
- } finally {
- clearTimeout(timer);
- }
- };
- for (let attempt = 0; ; attempt++) {
- let response: Response;
- try {
- response = await send(attempt);
- } catch (error) {
- signal.throwIfAborted();
- const failure = error instanceof TypeError ? transportError(t('无法连接服务器')) : error;
- if (!(failure instanceof ApiError && failure.status === 0 && canRetryRead(attempt))) throw failure;
- await pause(retryDelay, signal);
- continue;
- }
- const responseOwner = response.headers.get('X-Theoremos-Owner');
- if (
- !url.startsWith('/api/session') &&
- responseOwner &&
- state.session?.draftOwner &&
- responseOwner !== state.session.draftOwner
- ) {
- if (requestOwner === state.session.draftOwner) {
- clearOwnedDrafts();
- state.submitting = false;
- void initialize();
- }
- throw new ApiError(t('会话校验失败,请刷新页面。'), 401);
- }
- if (etag && response.status === 304) {
- if (!sameSession(requestSession)) throw new ApiError(t('会话校验失败,请刷新页面。'), 401);
- etag(response.headers.get('ETag'));
- return;
- }
-
- const challenged = response.headers.get('cf-mitigated') === 'challenge';
- const json = response.headers.get('Content-Type')?.includes('json');
- let payload: unknown;
- if (!challenged && (response.ok || json)) payload = await response.json().catch(() => undefined);
- else void response.body?.cancel().catch(() => undefined);
- signal.throwIfAborted();
- // The headers may have arrived before another tab's login; a slow body still belongs to its original session.
- if (!url.startsWith('/api/session') && !sameSession(requestSession))
- throw new ApiError(t('会话校验失败,请刷新页面。'), 401);
- if (!challenged && response.ok) {
- if (payload === undefined) {
- if (!json || !canRetryRead(attempt)) throw transportError(t('服务器返回了无法读取的响应'));
- await pause(retryDelay, signal);
- continue;
- }
- etag?.(response.headers.get('ETag'));
- return payload as T;
- }
-
- const body =
- payload && typeof payload === 'object'
- ? (payload as {
- error?: unknown;
- code?: unknown;
- cloudflare_error?: unknown;
- error_code?: unknown;
- retryable?: unknown;
- retry_after?: unknown;
- })
- : undefined;
- const cloudflare = body?.cloudflare_error === true ? body : undefined;
- const limited = response.status === 429 || cloudflare?.error_code === 1015;
- const gatewayFailure = !cloudflare && [502, 503, 504].includes(response.status);
- const retryable =
- !challenged && (cloudflare ? cloudflare.retryable === true : gatewayFailure || (!json && limited));
- const now = Date.now();
- const headerDelay = retryAfterMs(response.headers.get('Retry-After'), now);
- let delay = headerDelay;
- if (
- delay === undefined &&
- cloudflare?.retryable === true &&
- typeof cloudflare.retry_after === 'number' &&
- Number.isSafeInteger(cloudflare.retry_after) &&
- cloudflare.retry_after >= 0
- )
- delay = cloudflare.retry_after * 1_000;
- if (delay === undefined && (challenged || (cloudflare && limited))) delay = 30_000;
- if (delay === undefined && retryable && !gatewayFailure)
- delay = limited && attempt ? 5_000 : 1_500 * (attempt + 1);
- const retryAt = delay !== undefined && (limited || challenged || retryable) ? now + delay : 0;
- const limitMessage = t('请求太频繁,请稍后再试。');
- let reason = t('请求失败 ({0})', response.status);
- if (challenged) reason = t('Cloudflare 安全验证阻止了请求,请稍后重试');
- else if (!cloudflare && typeof body?.error === 'string') reason = body.error;
- else if (limited) reason = limitMessage;
- else if (retryable) reason = t('服务暂时不可用,请稍后重试');
- const code = !challenged && !cloudflare && typeof body?.code === 'string' ? body.code : undefined;
- const error = new ApiError(reason, limited && !challenged ? 429 : response.status, retryAt, code);
-
- if (retryAt > now) {
- if (!challenged && !cloudflare && limited && response.headers.get('X-Theoremos-Rate-Limit-Scope') === 'api') {
- if (retryAt > (addressCooldown?.retryAt ?? 0)) addressCooldown = new ApiError(limitMessage, 429, retryAt);
- } else if (retryAt > (routeCooldowns.get(route)?.retryAt ?? 0)) {
- for (const [key, previous] of routeCooldowns) if (previous.retryAt <= now) routeCooldowns.delete(key);
- routeCooldowns.set(route, error);
- }
- }
- if (!challenged && !cloudflare && response.status === 428) {
- saveDraft();
- draftReady = false;
- forgetKey(keyStorage);
- location.replace(loginAddress());
- }
- // Requests that change data are only retried by the reader. Longer waits remain in force for future reads.
- if (!read || !retryable || attempt >= (limited || gatewayFailure ? 1 : 2) || retryAt >= deadline) throw error;
- if (gatewayFailure && !retryAt) {
- if (!canRetryRead(attempt)) throw error;
- await pause(retryDelay, signal);
- }
- }
- } catch (error) {
- if (timeout.signal.aborted) throw timeout.signal.reason;
- throw error;
- } finally {
- clearTimeout(timer);
- finishKeyChange?.();
- }
-}
-const message = (error: unknown) => (error instanceof Error ? error.message : t('请求失败,请重试'));
-/** A manual popover, shown again each time so it lands in the top layer above any open dialog instead of under its backdrop. */
-function toast(text: string) {
- const target = element('#toast'),
- layered = 'showPopover' in target;
- if (layered && target.matches(':popover-open')) target.hidePopover();
- target.textContent = text;
- target.hidden = false;
- if (layered) target.showPopover();
- clearTimeout(toastTimer);
- toastTimer = setTimeout(() => {
- if (layered && target.matches(':popover-open')) target.hidePopover();
- target.hidden = true;
- }, 3000);
-}
-function setGlobalNotice(text: string) {
- element('#global-notice-text').textContent = text;
- const notice = element('#global-notice'),
- changed = notice.hidden !== !text;
- notice.hidden = !text;
- // The top bar's status steps aside while the notice says the same thing.
- if (changed) renderShell();
-}
-function setMobileView(view: 'compose' | 'runs', focus = false) {
- const changed = document.body.dataset.mobileView !== view;
- // Both panels belong to the task the conversation shows, so a task's own redraw keeps them; leaving the panel view
- // for the conversation closes them. A task still switching between its own stages does not.
- const panel = view === 'compose' && changed ? '' : document.body.dataset.chatArtifact;
- document.body.dataset.chatArtifact = panel;
- document.body.dataset.outputOpen = String(
- panel === 'live' || panel === 'original' || (view === 'runs' && Boolean(currentRun())),
- );
- syncOutputControls();
- rememberConversationScroll();
- if (changed) {
- activityReader?.remember();
- moduleView?.update();
- }
- document.body.dataset.mobileView = view;
- finishHiddenMotion();
- document.querySelectorAll('button[data-mobile-view]').forEach(button => {
- const selected = button.dataset.mobileView === view;
- button.setAttribute('aria-selected', String(selected));
- button.tabIndex = selected ? 0 : -1;
- if (selected && focus) button.focus();
- });
- if (view === 'runs') {
- renderDraftPreview(true);
- if (state.tab === 'events' || state.tab === 'modules') renderPanel(true);
- const list = element('#run-list');
- const selected = list.querySelector('.run-row.selected');
- if (selected && list.scrollWidth > list.clientWidth) {
- const bounds = list.getBoundingClientRect(),
- row = selected.getBoundingClientRect();
- if (row.left < bounds.left) list.scrollLeft += row.left - bounds.left;
- else if (row.right > bounds.right) list.scrollLeft += row.right - bounds.right;
- }
- }
- restoreConversationScroll();
- if (changed && window.matchMedia('(max-width:850px)').matches) {
- animateEntrance(
- element(view === 'compose' ? (currentRun() ? '#research-conversation-panel' : '.composer') : '#runs-panel'),
- 'workspace',
- );
- }
-}
-/** Focuses the first usable control in the order given (not the page's order, where the top bar comes first). */
-function focusFirst(selectors: readonly string[]) {
- for (const selector of selectors) {
- const control = Array.from(document.querySelectorAll(selector)).find(
- item => item.getClientRects().length && !item.matches(':disabled'),
- );
- if (control) {
- control.focus({ preventScroll: true });
- return;
- }
- }
-}
-function showDialog(dialog: HTMLDialogElement) {
- if (dialog.open) return;
- dialog.showModal();
- animateEntrance(dialog, 'dialog');
-}
-function syncSettingsNavigation() {
- const content = element('.settings-content');
- const top = content.getBoundingClientRect().top;
- const buttons = [...document.querySelectorAll('[data-settings-section]')].filter(
- button => !button.hidden,
- );
- let current = buttons[0];
- if (content.scrollTop > 4) {
- for (const button of buttons) {
- if (element(`#${button.dataset.settingsSection}`).getBoundingClientRect().top <= top + 88) current = button;
- }
- if (content.scrollHeight - content.clientHeight - content.scrollTop < 8) current = buttons.at(-1)!;
- }
- for (const button of buttons) {
- if (button === current) button.setAttribute('aria-current', 'location');
- else button.removeAttribute('aria-current');
- }
-}
-function openSettings(focusId?: string) {
- if (!state.session || state.submitting) return;
- if (researchEntry === 'natural' || (currentRun() && !focusId)) {
- if (currentRun() || chatWorkspace?.id) setMobileView('compose');
- // The statement may still be waiting for its owner, with a conversation but no proof run yet.
- void (naturalPage ?? openNaturalResearch()).then(() => {
- const settings = document.querySelector('#formalize-settings');
- if (settings) settings.open = true;
- const target = settings?.querySelector(focusId === 'api-key' ? '#formalize-key' : 'summary');
- target?.focus();
- target?.scrollIntoView({ block: 'nearest' });
- });
- return;
- }
- if (focusId && ['source', 'environment', 'template'].includes(focusId)) {
- closeSettings(false);
- chooseEntry('lean');
- startDraft();
- const options = field(focusId).closest('details');
- if (options) options.open = true;
- field(focusId).focus();
- field(focusId).scrollIntoView({ block: 'nearest', behavior: 'instant' });
- return;
- }
- // The configuration belongs to the next research, so it opens on the new-research page.
- if (currentRun()) startDraft();
- const dialog = element('#run-settings');
- // The preview replaces the composer that holds this dialog, so it closes first (otherwise the modal opens unseen) and
- // comes back when the dialog closes.
- const preview = document.body.dataset.draftPreview === 'true';
- if (preview) {
- document.body.dataset.draftPreview = 'false';
- element('#open-draft-preview').setAttribute('aria-expanded', 'false');
- }
- if (!dialog.open && (preview || document.body.dataset.mobileView === 'runs')) {
- settingsWorkspaceReturn = {
- focus: document.activeElement instanceof HTMLElement ? document.activeElement : undefined,
- preview,
- };
- setMobileView('compose');
- }
- showDialog(dialog);
- const session = state.session;
- if (session && state.connected)
- void api<{ catalogs: KnowledgeCatalog[] }>('/api/knowledge/catalogs')
- .then(({ catalogs }) => {
- if (sameSession(session)) serverModulePlans.setKnowledgeCatalogs(catalogs);
- })
- .catch(() => {
- /* Keep the selected digest and the default choices if catalogs are unavailable. */
- });
- if (focusId) {
- // The field's section starts at the top of the pane, so the end of the section above does not show over it.
- const control = element(`#${focusId}`),
- section = control.closest('.settings-content .form-section');
- section?.scrollIntoView({ block: 'start', behavior: 'instant' });
- control.focus({ preventScroll: Boolean(section) });
- const pane = element('.settings-content').getBoundingClientRect(),
- box = control.getBoundingClientRect();
- if (box.bottom > pane.bottom) control.scrollIntoView({ block: 'nearest', behavior: 'instant' });
- }
- syncSettingsNavigation();
-}
-function closeSettings(restoreWorkspace = true) {
- if (!restoreWorkspace) {
- moduleSettingsPolicy = undefined;
- settingsWorkspaceReturn = undefined;
- }
- element('#run-settings').close();
-}
-function clearValidation() {
- validationShown.clear();
- modulePlanEditor.showError();
- for (const id of submissionFields) {
- field(id).setCustomValidity('');
- field(id).removeAttribute('aria-invalid');
- element(`#${id}-validation`).hidden = true;
- }
-}
-function currentSubmissionIssues(): SubmissionIssue[] {
- if (!state.session) return [];
- const issues = submissionIssues(captureDraft(), field('api-key').value, state.session);
- const assets = researchSelection.value();
- if (
- field('research-mode').value === 'native-team' &&
- (assets?.agent || assets?.skills?.length) &&
- !state.session.runtime.nativeTeamExpertCards
- )
- issues.push({ field: 'provider', message: t('当前运行镜像不支持个人专家资料。请移除专家资产或更新运行镜像。') });
- const blocking = sourceCheck.blocking();
- // A failed compile is the source field's issue, in the source field's place, unless the field already has one.
- if (!blocking || issues.some(issue => issue.field === 'source')) return issues;
- const after = submissionFields.indexOf('source');
- const index = issues.findIndex(
- issue => issue.field !== 'module-plan' && submissionFields.indexOf(issue.field) > after,
- );
- const issue: SubmissionIssue = {
- field: 'source',
- check: true,
- message: t('原题第 {0} 行:{1}', blocking.line, diagnosticText(blocking).split('\n')[0].slice(0, 160)),
- };
- issues.splice(index < 0 ? issues.length : index, 0, issue);
- return issues;
-}
-const recordsFull = () => Boolean(state.session && state.runs.length >= state.session.limits.maxRuns);
-let readinessFull = false;
-function renderPreparation(issues?: SubmissionIssue[]) {
- element('#submission-readiness').hidden = researchEntry !== 'lean';
- if (researchEntry !== 'lean') {
- clearValidation();
- return;
- }
- issues ??= currentSubmissionIssues();
- for (const id of submissionFields) {
- const issue = issues.find(issue => issue.field === id);
- const visible = Boolean(issue && validationShown.has(id));
- const control = field(id),
- error = element(`#${id}-validation`);
- control.setCustomValidity(issue?.message ?? '');
- if (visible && control.getAttribute('aria-invalid') !== 'true') control.setAttribute('aria-invalid', 'true');
- else if (!visible && control.hasAttribute('aria-invalid')) control.removeAttribute('aria-invalid');
- patchText(error, visible ? issue!.message : '');
- if (error.hidden === visible) error.hidden = !visible;
- }
- const moduleIssue = issues.find(issue => issue.field === 'module-plan');
- modulePlanEditor.showError(validationShown.has('module-plan') ? moduleIssue?.message : undefined);
- const issue = issues[0];
- const labels: Record = {
- provider: t('选择服务商'),
- environment: t('选择环境'),
- source: t('编辑源码'),
- task: t('填写任务'),
- model: t('填写模型'),
- 'api-key': t('填写 API Key'),
- 'max-turns': t('调整轮次'),
- 'max-seconds': t('调整预算'),
- workers: t('调整 Agent'),
- 'max-tokens': t('调整用量上限'),
- 'module-plan': t('检查模块方案'),
- };
- // The first connection is still reading the records after the session arrived: that is loading, not a lost connection.
- const pending = !state.session || (!state.connected && !state.lost);
- const offline = !pending && !state.connected;
- const environmentReady = Boolean(state.session?.runtime.ready && state.session.providers.length);
- // An empty task nobody has tried to submit yet (a fresh page, or right after a submission) is the next step, not a fault.
- const composing = issue?.field === 'task' && !validationShown.has('task') && !field('task').value.trim();
- // At the record limit the server refuses any new run, so that comes before the draft's own gaps.
- const full = (readinessFull = recordsFull());
- const phase = state.submitting
- ? 'submitting'
- : pending
- ? 'pending'
- : offline || !environmentReady
- ? 'offline'
- : full
- ? 'full'
- : composing
- ? 'compose'
- : issue
- ? 'missing'
- : 'ready';
- const target = element('#submission-readiness');
- if (target.dataset.state !== phase) target.dataset.state = phase;
- // A Key nobody has been asked for yet is the next step, as an empty task is: one quiet line, the storage notes stay in the settings.
- const firstKey = phase === 'missing' && issue?.field === 'api-key' && !validationShown.has('api-key');
- target.toggleAttribute('data-quiet', firstKey);
- // Ready says what the run will work on; a statement Lean already accepts without sorry leaves the Agents nothing to prove.
- const checked = phase === 'ready' ? sourceCheck.current() : undefined,
- settled = checked?.status === 'complete';
- target.toggleAttribute('data-settled', settled);
- patchText(
- element('#readiness-title'),
- state.submitting
- ? t('正在提交研究')
- : pending
- ? t('正在读取提交配置')
- : offline
- ? t('连接中断,草稿可继续编辑')
- : !environmentReady
- ? t('运行环境未就绪')
- : full
- ? t('研究记录已满 {0} 条', state.session?.limits.maxRuns)
- : composing
- ? t('写下研究任务')
- : firstKey
- ? t('连接模型后即可提交')
- : (issue?.message ??
- (settled
- ? t('原题里没有 sorry')
- : checked?.status === 'ready'
- ? t('可以提交 · {0} 处 sorry 待证明', checked.sorries)
- : t('可以提交'))),
- );
- patchText(
- element('#readiness-detail'),
- state.submitting
- ? t('请稍候,提交结果将在对话中显示。')
- : pending
- ? state.session
- ? ''
- : t('连接后可编辑研究任务。')
- : // Offline, the notice at the top already says the draft is kept.
- offline
- ? ''
- : !environmentReady
- ? t('环境恢复后可提交,当前草稿会保留。')
- : full
- ? t('删除一条已结束的记录后才能提交新的研究;需要的档案请先下载。草稿会保留。')
- : firstKey
- ? ''
- : issue?.field === 'api-key'
- ? state.session?.account?.keyVault
- ? t('勾选「保存到我的账号」后,下次不用再填。')
- : t('每次提交后清空,不随草稿保存;可在设置里选择在此标签页记住。')
- : issue?.field === 'task'
- ? t('说明要证明的目标与约束。')
- : issue?.check
- ? t('原题需要先能编译;点「查看错误」定位到出错位置。')
- : issue?.field === 'source'
- ? t('添加原始 Lean 题目,可打开「预览」查看。')
- : issue
- ? t('补全配置后即可提交当前题目。')
- : settled
- ? t('提交只会验收现有证明;要让 Agent 研究,把待证部分写成 sorry。')
- : '',
- );
- patchText(
- element('#readiness-action'),
- full
- ? t('整理研究记录')
- : issue?.check
- ? t('查看错误')
- : issue
- ? labels[issue.field]
- : settled
- ? t('编辑源码')
- : t('查看配置'),
- );
- element('#readiness-detail').hidden = !element('#readiness-detail').textContent;
- renderGlyph(
- element('#readiness-icon'),
- state.submitting
- ? 'spinner'
- : phase === 'ready' && !settled
- ? 'circle-check'
- : phase === 'compose'
- ? 'square-pen'
- : firstKey
- ? 'key-round'
- : 'circle-alert',
- );
- const action = element('#prepare-run');
- if (action.disabled !== (pending || state.submitting)) action.disabled = pending || state.submitting;
- renderBudgetEstimate();
-}
-/** Time and turns are hard stops; tokens are estimated from this account's finished runs on the same model. */
-function renderBudgetEstimate() {
- const turns = Number(field('max-turns').value),
- seconds = Number(field('max-seconds').value),
- model = field('model').value.trim();
- if (!Number.isSafeInteger(turns) || turns < 0 || !Number.isSafeInteger(seconds) || seconds < 0) {
- patchText(element('#budget-estimate'), '');
- return;
- }
- const cap = state.session ? tokenCap(field('max-tokens').value, state.session.limits.maxTotalTokens) : undefined;
- const estimate = turns ? usageEstimate(state.runs, model, turns) : undefined;
- const limits = t(
- '解题时间:{0};研究轮次:{1}。',
- seconds ? t('{0} 分钟', Math.ceil(seconds / 60)) : t('不限'),
- turns || t('不限'),
- );
- const target = element('#budget-estimate');
- target.title = estimate
- ? t('根据最近 {0} 次 {1} 运行,预计约 {2} Token。', estimate.samples, model, formatTokens(estimate.ceiling))
- : '';
- patchText(
- target,
- sentences(
- limits,
- cap ? t('按已报告用量在 {0} Token 停止,在途请求可能超额;不代表金额封顶。', formatTokens(cap)) : '',
- ),
- );
-}
-function focusProofInstructions(preventScroll = false) {
- element('#proof-instructions').open = true;
- field('task').focus({ preventScroll });
-}
-function focusSubmissionIssue(issue: SubmissionIssue) {
- validationShown.add(issue.field);
- renderPreparation();
- const diagnostic = issue.check && sourceCheck.blocking();
- if (diagnostic) {
- jumpToSourceDiagnostic(diagnostic);
- return;
- }
- if (issue.field === 'module-plan') {
- openSettings('module-plan');
- modulePlanEditor.validate();
- element('#module-plan-error').scrollIntoView({ block: 'nearest', behavior: 'instant' });
- return;
- }
- if (issue.field === 'task') {
- closeSettings(false);
- setMobileView('compose');
- element('#proof-instructions').open = true;
- } else openSettings(issue.field);
- field(issue.field).focus();
- // Focus alone can leave the explanation underneath the fixed settings footer.
- if (issue.field !== 'task')
- element(`#${issue.field}-validation`).scrollIntoView({ block: 'nearest', behavior: 'instant' });
-}
-function renderTemplateSelection() {
- document.querySelectorAll('[data-chat-template]').forEach(button => {
- const selected = String(button.dataset.chatTemplate === field('template').value);
- if (button.getAttribute('aria-pressed') !== selected) button.setAttribute('aria-pressed', selected);
- });
-}
-function renderComposerSummary() {
- patchText(element('#composer-environment'), environmentName(field('environment').value));
- element('#draft-continuation').hidden = !draftContinuation;
- if (draftContinuation) patchText(element('#draft-continuation-label'), t('从「{0}」继续', draftContinuation.label));
- element('#settings-continuation').hidden = !draftContinuation;
- if (draftContinuation)
- patchText(
- element('#settings-continuation'),
- t('带入成果:{0}。原题保持不变,新运行仍需重新通过 Lean 检查与独立验收。', draftContinuation.label),
- );
- const origin = draftContinuation && state.runs.find(run => run.id === draftContinuation!.runId);
- const context: ContinuationPreview | undefined = continuationPreview
- ? { ...continuationPreview, from: draftContinuation }
- : origin
- ? {
- title: origin.title,
- runId: origin.id,
- from: draftContinuation,
- originalSeconds: origin.maxRunSeconds,
- originalTurns: origin.maxTurns,
- originalTokens: origin.maxTotalTokens,
- }
- : undefined;
- renderContinuationPreview(element('#research-continuation-preview'), context, {
- seconds: Number(field('max-seconds').value),
- turns: Number(field('max-turns').value),
- tokens: Number(field('max-tokens').value) * 10_000 || undefined,
- });
- const budgetOrigin =
- budgetDraftOrigin ??
- (origin && !isSample(origin)
- ? { runId: origin.id, source: origin.source, environment: origin.environment }
- : undefined);
- const matchingBudgetOrigin =
- budgetOrigin &&
- budgetOrigin.source === field('source').value &&
- budgetOrigin.environment === field('environment').value
- ? budgetOrigin
- : undefined;
- const budgetTokens = state.session
- ? tokenCap(field('max-tokens').value, state.session.limits.maxTotalTokens)
- : undefined;
- renderResearchBudgetDraft(
- element('#research-budget-draft'),
- matchingBudgetOrigin
- ? {
- runId: matchingBudgetOrigin.runId,
- projectId: matchingBudgetOrigin.projectId,
- tokens: budgetTokens ?? 0,
- providerId: field('provider').value,
- model: field('model').value.trim(),
- }
- : undefined,
- api,
- matchingBudgetOrigin?.projectId
- ? () => {
- if (state.submitting) return;
- budgetDraftOrigin = {
- runId: matchingBudgetOrigin.runId,
- source: field('source').value,
- environment: field('environment').value as WebEnvironment,
- };
- draftChanged();
- saveDraft();
- }
- : undefined,
- );
- renderResearchStartCost(
- element('#research-run-cost'),
- state.session && !matchingBudgetOrigin
- ? {
- owner: ownerOfSession(state.session),
- account: Boolean(state.session.account),
- request: api,
- providerId: field('provider').value,
- model: field('model').value.trim(),
- stages: [{ kind: 'proof', tokens: budgetTokens ?? 0 }],
- locked: state.submitting,
- onSetTokenLimit: () => openSettings('max-tokens'),
- }
- : undefined,
- );
- element('#draft-formalization').hidden = !draftFormalization;
- element('#confirmed-original').hidden = !draftFormalization;
- element('#creation-mode').textContent = draftFormalization ? t('已确认的自然语言原题') : t('已有 Lean 原题');
- element('#confirmed-original-text').textContent = draftFormalization?.original ?? t('正在加载…');
- if (draftFormalization)
- element('#draft-formalization-link').href =
- `formalize.html?id=${encodeURIComponent(draftFormalization.id)}`;
- renderPreparation();
- renderTemplateSelection();
- renderShell();
-}
-async function loadConfirmedOriginal() {
- const binding = draftFormalization;
- if (!binding) return;
- try {
- const { formalization } = await api<{ formalization: WebFormalization }>(
- `/api/formalizations/${encodeURIComponent(binding.id)}`,
- );
- if (draftFormalization !== binding) return;
- if (
- formalization.status !== 'confirmed' ||
- formalization.report?.evidenceSha256 !== binding.evidenceSha256 ||
- formalization.report.statement !== binding.source ||
- formalization.environment !== binding.environment
- )
- return;
- binding.original = formalization.original;
- renderComposerSummary();
- } catch (error) {
- if (draftFormalization === binding) element('#confirmed-original-text').textContent = message(error);
- }
-}
-function rememberConversationScroll() {
- const scroll = element('#conversation-scroll');
- // Hidden panes report zero geometry; keep their last visible reading state.
- if (scroll.clientHeight) conversationScroll.top = scroll.scrollTop;
-}
-function restoreConversationScroll() {
- const scroll = element('#conversation-scroll');
- if (scroll.clientHeight) scroll.scrollTop = conversationScroll.top;
-}
-/** The new-research page: the sample, the first-run steps and the example statements above the composer. */
-function renderConversation() {
- renderComposerSummary();
- renderAnnouncement();
- const signature = JSON.stringify([
- state.session?.templates,
- state.session?.sample,
- state.connected,
- state.runs.length > 0,
- ]);
- if (signature === state.conversationSignature) return;
- state.conversationSignature = signature;
- rememberConversationScroll();
- drawConversation(element('#conversation'), {
- templates: (state.session?.templates ?? []).map(template => ({
- id: template.id,
- name: template.name,
- environment: environmentName(template.environment),
- })),
- ...(state.session?.sample ? { sample: { title: state.session.sample.title } } : {}),
- firstRun: Boolean(state.session) && !state.runs.length,
- });
- renderTemplateSelection();
- restoreConversationScroll();
-}
-/** Screen readers hear the selected run's state and, while it works, its newest step. */
-function renderAnnouncement() {
- const run = currentRun();
- const announcement = run
- ? t(
- '{0}。{1}',
- status(run).label,
- activeRun(run) ? localizeText(run.events.at(-1)?.message ?? '') : resultDescription(run),
- )
- : '';
- patchText(element('#conversation-announcement'), announcement);
-}
-/** Where a provider's requests go, in a reader's terms: a public service by its host (the full address in the tooltip); the server's own gateway is not an address anyone can use. */
-function providerAddress() {
- const address = element('#provider-address'),
- baseUrl = state.session?.providers.find(provider => provider.id === field('provider').value)?.baseUrl;
- // The server only accepts absolute HTTPS addresses or its own gateway (config.ts).
- const host = baseUrl ? new URL(baseUrl).hostname : '',
- gateway = host === 'host.docker.internal';
- address.textContent = !baseUrl ? '' : gateway ? t('经工作台服务器转发') : host;
- address.title = baseUrl && !gateway ? baseUrl : '';
- syncResearchMode();
- restoreKey();
- // A key this account saved, or for an admin one the server holds, lets the field stay empty.
- const account = state.session?.account,
- providerId = field('provider').value,
- key = element('#api-key');
- const saved = account?.savedKeys?.find(item => item.providerId === providerId),
- held = !saved && Boolean(account?.serverKeys?.includes(providerId));
- key.required = !saved && !held;
- key.placeholder = saved ? t('已保存 ····{0},留空即使用', saved.ending) : held ? t('留空使用服务器保存的 Key') : '';
- element('#server-key-note').hidden = !held;
- const savedNote = element('#saved-key-note');
- savedNote.hidden = !saved;
- savedNote.textContent = saved ? t('已保存 Key · 末四位 {0}', saved.ending) : '';
- // With an account that can save keys, the tab-only memory gives way to saving on the server.
- const vault = Boolean(account?.keyVault);
- element('#key-save-row').hidden = !vault;
- element('#key-save-note').hidden = !vault;
- element('#delete-saved-key').hidden = !saved;
- element('#key-memory-row').hidden = vault;
- element('#key-memory-note').hidden = vault;
- key.setAttribute(
- 'aria-describedby',
- [
- 'credential-note',
- ...(saved ? ['saved-key-note'] : []),
- ...(held ? ['server-key-note'] : []),
- ...(vault ? ['key-save-note'] : []),
- 'api-key-validation',
- ].join(' '),
- );
-}
-/** The key a question about `run` would use, in the order the server takes them: typed, then saved, then the server's. */
-function explainKey(run: WebRun): ExplainKey {
- const account = state.session?.account,
- saved = account?.savedKeys?.find(item => item.providerId === run.providerId);
- if (saved) return { source: 'saved', ending: saved.ending };
- if (account?.serverKeys?.includes(run.providerId)) return { source: 'server' };
- return rememberedKey(keyStorage, run.providerId, providerUrl(run.providerId))
- ? { source: 'remembered' }
- : { source: 'none' };
-}
-function providerUrl(id: string) {
- return state.session?.providers.find(provider => provider.id === id)?.baseUrl ?? '';
-}
-// The key is cleared after every submission and on leaving; with "remember" on, this tab hands it back for the same provider address.
-const keyStorage = () => sessionStorage;
-const keyTarget = () => ({
- providerId: field('provider').value,
- baseUrl: state.session?.providers.find(provider => provider.id === field('provider').value)?.baseUrl ?? '',
-});
-let restoredKey = '';
-function restoreKey() {
- const target = keyTarget(),
- key = rememberedKey(keyStorage, target.providerId, target.baseUrl) ?? '';
- // A key the reader typed stays, with their choice of the box; only an empty field or one we filled is replaced.
- if (!field('api-key').value || field('api-key').value === restoredKey) {
- field('api-key').value = key;
- restoredKey = key;
- element('#remember-key').checked = Boolean(key);
- } else restoredKey = '';
- element('#forget-key').hidden = !hasRememberedKey(keyStorage);
-}
-// While "remember" is on, the stored key follows the field; an emptied field or an unticked box forgets it.
-function syncKeyMemory() {
- const key = field('api-key').value.trim(),
- remember = element('#remember-key');
- if (state.session?.account?.keyVault) remember.checked = false;
- if (remember.checked && key && !rememberKey(keyStorage, { ...keyTarget(), apiKey: key })) {
- remember.checked = false;
- toast(t('浏览器不允许保存,Key 只保留到这次提交'));
- }
- if (remember.checked && key) restoredKey = key;
- else {
- forgetKey(keyStorage);
- restoredKey = '';
- }
- element('#forget-key').hidden = !hasRememberedKey(keyStorage);
-}
-function forgetRememberedKey() {
- forgetKey(keyStorage);
- if (field('api-key').value === restoredKey) field('api-key').value = '';
- restoredKey = '';
- element('#remember-key').checked = false;
- element('#forget-key').hidden = true;
-}
-const environmentInfo = (id: WebEnvironment | string) =>
- state.session?.environments.find(environment => environment.id === id);
-const environmentName = (id: WebEnvironment | string) =>
- environmentInfo(id)?.name ?? (id === webTaskEnvironment ? t('TheoremOS 数学环境') : t('Lean 标准库'));
-const leanVersion = (toolchain: string) => toolchain.replace(/^leanprover\/lean4:/, '');
-function updateEnvironment() {
- const environment = environmentInfo(field('environment').value);
- const details = element('#environment-details');
- // What the environment offers; its exact versions are for reproducing a run, so they stay in the tooltip and the run's 全部配置.
- details.textContent = environment ? localizeText(environment.description) : t('请选择证明环境');
- details.title = environment
- ? `${localizeText(environment.description)} · Lean ${leanVersion(environment.toolchain)}${environment.mathlibRevision ? ` · Mathlib ${environment.mathlibRevision}` : ''}`
- : t('请选择证明环境');
- details.setAttribute('aria-label', details.title);
-}
-function renderTemplates(preferred = '', useFirst = false) {
- const templates =
- state.session?.templates.filter(template => template.environment === field('environment').value) ?? [];
- renderOptions(
- element('#template'),
- [...templates.map(template => [template.id, template.name] as const), ['', t('自定义 Lean')]],
- templates.some(template => template.id === preferred) ? preferred : useFirst ? (templates[0]?.id ?? '') : '',
- );
-}
-/** Sizes only matter near the limit; below it the counter stays empty. */
-const nearLimit = (count: number, limit?: number) => Boolean(limit && count >= limit * 0.8);
-function updateCounts() {
- for (const [id, limit] of [
- ['source', state.session?.limits.maxSourceBytes],
- ['task', state.session?.limits.maxTaskBytes],
- ] as const) {
- const count = byteSize(field(id).value);
- const target = element(`#${id}-count`);
- target.textContent = nearLimit(count, limit) ? `${byteLabel(count)} / ${byteLabel(limit!)}` : '';
- target.classList.toggle('over-limit', Boolean(limit && count > limit));
- }
- element('#source-lines').textContent = t('{0} 行', field('source').value.split(/\r\n|\r|\n/).length);
-}
-function sourceChanged() {
- sourceRevision++;
- element('#source-error').hidden = true;
- updateCounts();
- if (currentRun()) startDraft();
- draftChanged();
-}
-function captureDraft(): TaskDraft {
- // Retain a legacy draft's exact settings while its last submission is unresolved.
- const replayUncertain = submissionIdentity.unresolved;
- const modulePlan = replayUncertain ? modulePlanEditor.value() : undefined;
- const knowledgeDigest = serverModulePlans.knowledgeDigest();
- const nativeTeam = field('research-mode').value === 'native-team';
- const skillMode = nativeTeam || field('research-mode').value === 'skill';
- return {
- providerId: field('provider').value,
- model: field('model').value,
- ...(draftAutoExplain === undefined ? {} : { autoExplain: draftAutoExplain }),
- ...(draftExplanationLanguage === undefined ? {} : { explanationLanguage: draftExplanationLanguage }),
- effort: field('effort').value as WebEffort,
- environment: field('environment').value as WebEnvironment,
- source: field('source').value,
- task: field('task').value,
- templateId: field('template').value,
- maxTurns: field('max-turns').value,
- maxRunSeconds: field('max-seconds').value,
- workers: nativeTeam || !replayUncertain ? '1' : field('workers').value,
- ...(field('max-tokens').value ? { maxTotalTokens: field('max-tokens').value } : {}),
- coordination:
- nativeTeam || !replayUncertain
- ? 'independent'
- : (element('input[name="coordination"]:checked').value as WebCoordination),
- ...(nativeTeam ? { nativeTeamCapacity: Number(field('native-team-capacity').value) } : {}),
- ...(nativeTeam && draftTeamProfiles.length ? { nativeTeamPreferredProfiles: [...draftTeamProfiles] } : {}),
- ...(skillMode
- ? { researchMode: 'skill' as const, skillLoading: field('skill-loading').value as 'native' | 'file' }
- : {}),
- ...((nativeTeam || replayUncertain) && element('#plan-approval').checked
- ? { planApproval: true as const }
- : {}),
- ...(knowledgeDigest !== undefined ? { knowledgeDigest } : {}),
- ...(!nativeTeam &&
- modulePlan &&
- (modulePlan.custom.length || modulePlan.scheduler !== 'plan' || modulePlan.context !== 'full')
- ? { modulePlan }
- : {}),
- ...(draftContinuation ? { continueFrom: draftContinuation } : {}),
- ...(budgetDraftOrigin &&
- budgetDraftOrigin.source === field('source').value &&
- budgetDraftOrigin.environment === field('environment').value
- ? {
- problemBudget: {
- runId: budgetDraftOrigin.runId,
- ...(budgetDraftOrigin.projectId ? { projectId: budgetDraftOrigin.projectId } : {}),
- },
- }
- : {}),
- ...(draftFormalization
- ? { formalization: { id: draftFormalization.id, evidenceSha256: draftFormalization.evidenceSha256 } }
- : {}),
- ...(draftSharedProofOrigin ? { sharedProofOrigin: { ...draftSharedProofOrigin } } : {}),
- ...(draftClassicOrigin ? { classicOrigin: { ...draftClassicOrigin } } : {}),
- ...(draftLibraryProposalOrigin ? { libraryProposalOrigin: { ...draftLibraryProposalOrigin } } : {}),
- };
-}
-function selectedProblemLibraries() {
- const selection = researchSelection.value();
- return [
- ...(selection?.agent ? [selection.agent] : []),
- ...(selection?.skills ?? []),
- ...(selection?.libraries ?? []),
- ];
-}
-function renderAccountProblemDraft() {
- const session = state.session;
- const show = Boolean(
- session &&
- (session.account || problemDraftTarget) &&
- draftReady &&
- researchEntry === 'lean' &&
- state.composing &&
- !currentRun(),
- );
- problemDraftHost.hidden = !show;
- renderProblemDraftPanel(
- problemDraftHost,
- show && session
- ? {
- owner: ownerOfSession(session),
- account: Boolean(session.account),
- value: leanProblemDraft(captureDraft(), selectedProblemLibraries()),
- locked: state.submitting || submissionIdentity.unresolved,
- request: api,
- target: problemDraftTarget,
- onRestore: restoreProblemDraft,
- }
- : undefined,
- );
-}
-async function restoreProblemDraft(value: ProblemDraftValue, beforeApply: () => void) {
- if (!state.session || state.submitting) throw new Error(t('编辑器尚未就绪,请重新选择恢复。'));
- const owner = ownerOfSession(state.session),
- revision = draftRevision,
- entry = researchEntry;
- const original = JSON.stringify(chatWorkspace?.problemDraft());
- if (value.mode === 'lean')
- value = {
- ...value,
- draft: editableTaskDraft(
- value.draft,
- submissionIdentity.unresolved,
- value.libraries?.length ? value.draft.environment : undefined,
- ),
- };
- const selected =
- value.mode === 'lean' && value.libraries?.length
- ? await researchSelection.prepare(
- value.libraries,
- value.draft.environment,
- Boolean(value.draft.nativeTeamCapacity),
- )
- : undefined;
- if (value.mode === 'natural') {
- if (!naturalPage) naturalPage = Promise.resolve().then(loadNaturalResearch);
- await naturalPage;
- }
- if (
- !state.session ||
- ownerOfSession(state.session) !== owner ||
- state.submitting ||
- currentRun() ||
- draftRevision !== revision ||
- researchEntry !== entry ||
- (original !== undefined && original !== JSON.stringify(chatWorkspace?.problemDraft()))
- )
- throw new Error(t('读取期间原题已修改,请重新选择恢复。'));
- beforeApply();
- clearProblemDraftTarget();
- formalizationLink = null;
- if (value.mode === 'natural') {
- chooseEntry('natural');
- startDraft(false, 'replace');
- chatWorkspace!.restoreProblemDraft(value);
- } else {
- replaceDraft('import', () => applyTaskDraft(value.draft, selected?.configuration.environment));
- if (selected) researchSelection.adopt(selected);
- else researchSelection.clear();
- chooseEntry('lean');
- startDraft(false, 'replace');
- draftChanged();
- saveDraft();
- renderDraftRecovery();
- field('source').focus({ preventScroll: true });
- }
- renderAccountProblemDraft();
-}
-function setDraftStatus(text: string, warning = false) {
- element('#draft-status').textContent = text;
- element('#draft-status').classList.toggle('warning', warning);
-}
-function renderDraftRecovery() {
- const recovery = draftRecovery.current;
- element('#draft-recovery').hidden = !recovery;
- for (const id of ['restore-draft', 'restore-draft-settings']) {
- const button = element(`#${id}`);
- button.hidden = !recovery;
- button.disabled = state.submitting || restoringDraft;
- }
- if (!recovery) return;
- const labels: Record = {
- template: t('已切换示例'),
- reset: t('已重置草稿'),
- reuse: t('已复用任务'),
- import: t('已载入任务文件'),
- source: t('已导入 Lean 文件'),
- edit: t('已应用源码编辑'),
- paste: t('粘贴的 Lean 代码已设为原始题目'),
- };
- patchText(element('#draft-recovery-text'), labels[recovery.reason]);
- element('#draft-recovery-local').hidden = recovery.persisted;
-}
-function replaceDraft(reason: ReplacementReason, change: () => void) {
- const before = latestDraft ?? captureDraft();
- const libraries = selectedProblemLibraries();
- const track = draftReady && !replacingDraft;
- const nested = replacingDraft;
- replacingDraft = true;
- // Another problem or a fresh draft no longer continues the version; editing the statement or reusing a run keeps its own.
- if (reason !== 'edit' && reason !== 'reuse') draftContinuation = undefined;
- if (reason !== 'edit' && reason !== 'reuse') continuationPreview = undefined;
- if (reason !== 'edit' && reason !== 'reuse') budgetDraftOrigin = undefined;
- if (reason !== 'edit') draftFormalization = undefined;
- if (reason !== 'edit') {
- draftSharedProofOrigin = undefined;
- renderSharedProofOrigin();
- }
- if (reason !== 'edit') {
- draftLibraryProposalOrigin = undefined;
- renderLibraryProposalOrigin();
- }
- if (reason !== 'edit') {
- const clearAddress = draftReady || Boolean(draftClassicOrigin);
- draftClassicOrigin = undefined;
- document.querySelector('[data-classic-origin]')?.remove();
- if (clearAddress) {
- const address = new URL(location.href);
- address.searchParams.delete('fromClassic');
- history.replaceState(null, '', address);
- }
- }
- try {
- change();
- } finally {
- replacingDraft = nested;
- }
- if (track) {
- draftRecovery.remember(before, captureDraft(), reason, libraries);
- renderDraftRecovery();
- }
-}
-async function recoverDraft() {
- const tx = (zh: string, en: string) => (locale === 'en' ? en : zh);
- const recovery = draftRecovery.current;
- if (!recovery || !state.session || state.submitting || restoringDraft) return;
- const owner = ownerOfSession(state.session),
- revision = draftRevision,
- identity = JSON.stringify(recovery);
- const selectedId = state.selectedId,
- composing = state.composing,
- librariesBefore = JSON.stringify(selectedProblemLibraries());
- const fromSettings = element('#run-settings').open;
- restoringDraft = true;
- renderDraftRecovery();
- try {
- const draft = editableTaskDraft(
- recovery.draft,
- submissionIdentity.unresolved,
- recovery.libraries?.length ? recovery.draft.environment : undefined,
- );
- const selected = recovery.libraries?.length
- ? await researchSelection.prepare(recovery.libraries, draft.environment, Boolean(draft.nativeTeamCapacity))
- : undefined;
- if (
- !state.session ||
- ownerOfSession(state.session) !== owner ||
- state.submitting ||
- draftRevision !== revision ||
- selectedId !== state.selectedId ||
- composing !== state.composing ||
- librariesBefore !== JSON.stringify(selectedProblemLibraries()) ||
- identity !== JSON.stringify(draftRecovery.current)
- ) {
- toast(
- tx(
- '核对依赖期间草稿已变化,请重新选择撤销。',
- 'The draft changed while checking its dependencies. Choose Undo again.',
- ),
- );
- return;
- }
- draftRecovery.clear();
- document.querySelector('[data-classic-origin]')?.remove();
- const address = new URL(location.href);
- address.searchParams.delete('fromClassic');
- history.replaceState(null, '', address);
- applyTaskDraft(draft, selected?.configuration.environment);
- if (recovery.libraries) {
- if (selected) researchSelection.adopt(selected);
- else researchSelection.clear();
- }
- startDraft();
- draftChanged();
- saveDraft();
- if (fromSettings) openSettings('source');
- else focusProofInstructions(true);
- toast(t('已恢复替换前的草稿,请重新填写 API Key'));
- } catch (error) {
- toast(
- tx(
- '暂时无法恢复固定依赖,两份草稿均已保留,请重新撤销。',
- 'Could not restore the fixed dependencies. Your drafts are preserved; retry Undo. ',
- ) + message(error),
- );
- } finally {
- restoringDraft = false;
- renderDraftRecovery();
- }
-}
-const planApprovalAvailable = () =>
- field('research-mode').value === 'native-team' && Boolean(state.session?.runtime.nativeTeam);
-function usesNativeTeam(providerId: string) {
- const harness = state.session?.providers.find(item => item.id === providerId)?.harness;
- return !harness || harness === 'codex';
-}
-function syncResearchMode() {
- const provider = state.session?.providers.find(item => item.id === field('provider').value);
- const portable = !usesNativeTeam(field('provider').value);
- const mode = field('research-mode') as HTMLSelectElement,
- loading = field('skill-loading') as HTMLSelectElement;
- const teamAvailable = Boolean(provider && !portable && state.session?.runtime.nativeTeam);
- if (!submissionIdentity.unresolved) {
- mode.value = teamAvailable ? 'native-team' : 'skill';
- if (portable) loading.value = 'file';
- }
- const efforts = field('effort') as HTMLSelectElement;
- for (const option of efforts.options) {
- const supported =
- provider?.harness === 'cli'
- ? Boolean(provider.efforts?.includes(option.value as WebEffort))
- : option.value !== 'none';
- option.hidden = !supported;
- option.disabled = !supported;
- }
- if (Array.from(efforts.options).find(option => option.value === efforts.value)?.disabled)
- efforts.value = provider?.efforts?.[0] ?? 'high';
- const team = mode.value === 'native-team';
- field('workers').disabled = true;
- for (const radio of document.querySelectorAll('input[name="coordination"]')) radio.disabled = true;
- patchText(element('#current-research-mode'), team ? t('Codex 原生团队') : t('单 Agent 研究'));
- element('#native-team-field').hidden = !team;
- if (team) refreshPersonalExperts();
- element('#native-team-profiles').hidden = !state.session?.runtime.nativeTeamPreferences && !draftTeamProfiles.length;
- element('#native-team-unavailable').hidden = !team || teamAvailable;
- element('.plan-approval-option').hidden = !team;
-}
-function draftChanged(persist = true) {
- syncResearchMode();
- if (
- draftFormalization &&
- (field('source').value !== draftFormalization.source ||
- field('environment').value !== draftFormalization.environment)
- ) {
- draftFormalization = undefined;
- draftContinuation = undefined;
- toast(t('原题或环境已修改,当前草稿已转为普通 Lean 题目。'));
- }
- element('#plan-approval').disabled = !planApprovalAvailable();
- latestDraft = captureDraft();
- modulePlanLibrary.sync();
- draftRevision++;
- renderImportState();
- sourceCheck.schedule();
- renderSourceCheckView();
- renderComposerSummary();
- renderDraftPreview();
- renderAccountProblemDraft();
- if (!draftReady || !persist) return;
- draftDirty = true;
- setDraftStatus(t('草稿待保存'));
- clearTimeout(draftTimer);
- draftTimer = setTimeout(saveDraft, 250);
-}
-function saveDraft() {
- clearTimeout(draftTimer);
- if (!draftReady || !draftDirty) return;
- try {
- ownedDrafts.setItem(taskDraftStorageKey, encodeTaskDraft(captureDraft()));
- draftDirty = false;
- setDraftStatus(t('草稿已存于此标签页'));
- } catch {
- // Avoid restoring an older draft after the latest edits could not be saved.
- try {
- ownedDrafts.removeItem(taskDraftStorageKey);
- } catch {
- /* Storage can be unavailable. */
- }
- setDraftStatus(t('草稿未保存'), true);
- }
-}
-function applyTaskDraft(draft: TaskDraft, fixedEnvironment?: WebEnvironment) {
- draft = editableTaskDraft(draft, submissionIdentity.unresolved, fixedEnvironment);
- const explanation = automaticExplanationSettings(draft, locale, submissionIdentity.unresolved);
- draftAutoExplain = explanation.autoExplain;
- draftExplanationLanguage = explanation.explanationLanguage;
- continuationPreview = undefined;
- draftSharedProofOrigin = draft.sharedProofOrigin ? { ...draft.sharedProofOrigin } : undefined;
- draftClassicOrigin = draft.classicOrigin ? { ...draft.classicOrigin } : undefined;
- draftLibraryProposalOrigin = draft.libraryProposalOrigin ? { ...draft.libraryProposalOrigin } : undefined;
- renderLibraryProposalOrigin();
- if (draftClassicOrigin) showClassicOrigin();
- renderSharedProofOrigin();
- budgetDraftOrigin = draft.problemBudget
- ? { ...draft.problemBudget, source: draft.source, environment: draft.environment }
- : undefined;
- modulePlanLibrary.resetSelection();
- clearValidation();
- draftSourceExpanded = false;
- field('provider').value = state.session?.providers.some(provider => provider.id === draft.providerId)
- ? draft.providerId
- : '';
- field('environment').value = draft.environment;
- renderTemplates();
- for (const [id, value] of Object.entries({
- model: draft.model,
- effort: draft.effort,
- source: draft.source,
- task: draft.task,
- 'max-turns': draft.maxTurns === '0' ? '' : draft.maxTurns,
- 'max-seconds': draft.maxRunSeconds === '0' ? '' : draft.maxRunSeconds,
- workers: draft.workers,
- 'max-tokens': draft.maxTotalTokens === '0' ? '' : (draft.maxTotalTokens ?? ''),
- }))
- field(id).value = value;
- const template = state.session?.templates.find(
- template =>
- template.id === draft.templateId &&
- template.environment === draft.environment &&
- template.source === field('source').value &&
- template.task === field('task').value,
- );
- field('template').value = template?.id ?? '';
- element(`input[name="coordination"][value="${draft.coordination}"]`).checked = true;
- field('research-mode').value = draft.nativeTeamCapacity ? 'native-team' : (draft.researchMode ?? 'legacy');
- field('native-team-capacity').value = String(draft.nativeTeamCapacity ?? DEFAULT_TEAM_AGENTS);
- setDraftTeamProfiles(draft.nativeTeamPreferredProfiles);
- field('skill-loading').value = draft.skillLoading ?? 'native';
- element('#plan-approval').checked = Boolean(draft.planApproval);
- modulePlanEditor.setValue(draft.modulePlan);
- serverModulePlans.setKnowledgeDigest(draft.knowledgeDigest);
- draftContinuation = draft.continueFrom;
- draftFormalization = draft.formalization
- ? { ...draft.formalization, source: draft.source, environment: draft.environment }
- : undefined;
- void loadConfirmedOriginal();
- field('api-key').value = '';
- element('#api-key').type = 'password';
- updateKeyToggle();
- providerAddress();
- updateEnvironment();
- sourceChanged();
- element('#form-error').hidden = true;
- element('#draft-error').hidden = true;
-}
-function restoreDraft(): boolean {
- let stored: string | null;
- try {
- stored = ownedDrafts.getItem(taskDraftStorageKey);
- } catch {
- setDraftStatus(t('草稿保存不可用'), true);
- return false;
- }
- if (!stored) return false;
- try {
- applyTaskDraft(decodeTaskDraft(JSON.parse(stored)));
- setDraftStatus(t('已恢复草稿'));
- return true;
- } catch {
- try {
- ownedDrafts.removeItem(taskDraftStorageKey);
- } catch {
- /* Storage can be unavailable. */
- }
- setDraftStatus(t('草稿未恢复'), true);
- return false;
- }
-}
-function renderImportState() {
- if (!pendingImport) return;
- const notice =
- pendingImport.revision !== draftRevision
- ? t('草稿已变化,请重新选择文件。')
- : state.submitting
- ? t('正在提交任务,请稍后再载入。')
- : '';
- element('#import-notice').textContent = notice;
- element('#import-notice').hidden = !notice;
- element('#confirm-import').disabled = Boolean(notice) || !state.session;
-}
-async function importTaskFile(file: File) {
- if (!state.session || state.submitting) return;
- const sequence = ++taskImportSequence,
- revision = draftRevision;
- element('#draft-error').hidden = true;
- try {
- const fileDraft = await readTaskDraftFile(file);
- const unresolved = submissionIdentity.unresolved;
- const draft = editableTaskDraft(fileDraft, unresolved);
- if (sequence !== taskImportSequence) return;
- if (revision !== draftRevision || state.submitting) {
- toast(t('草稿已变化,未导入文件'));
- return;
- }
- pendingImport = { draft, revision };
- element('#import-filename').textContent = file.name;
- const provider = state.session?.providers.find(provider => provider.id === draft.providerId);
- const portable = Boolean(provider?.harness && provider.harness !== 'codex');
- const nativeTeam = unresolved
- ? Boolean(draft.nativeTeamCapacity)
- : Boolean(provider && !portable && state.session.runtime.nativeTeam);
- const teamSize = draft.nativeTeamCapacity ?? DEFAULT_TEAM_AGENTS;
- const workers = unresolved ? draft.workers : '1';
- const plan = draft.modulePlan;
- const schedulerLabels = {
- plan: t('按研究计划'),
- 'critical-path': t('优先关键路径'),
- continuation: t('延续证明前沿'),
- };
- const planSummary = [
- schedulerLabels[plan?.scheduler ?? 'plan'],
- plan?.context === 'essential' ? t('精简研究上下文') : t('完整研究上下文'),
- t('启用 {0} / {1} 条自定义规则', plan?.custom.filter(rule => rule.enabled).length ?? 0, plan?.custom.length ?? 0),
- ].join(' · ');
- renderFacts(element('#import-facts'), [
- [t('证明环境'), environmentName(draft.environment)],
- [t('服务商'), provider?.name ?? t('{0} · 当前不可用', draft.providerId || t('未选择'))],
- [t('模型'), draft.model || t('未填写'), true],
- [t('推理强度'), effortLabels[draft.effort] ?? draft.effort],
- [t('轮次上限'), Number(draft.maxTurns) ? draft.maxTurns : t('不限')],
- [t('解题预算 / 秒'), Number(draft.maxRunSeconds) ? draft.maxRunSeconds : t('不限')],
- [
- nativeTeam ? t('团队人数上限(含 Lead)') : t('Agent 数量'),
- nativeTeam ? String(teamSize) : workers || t('未填写'),
- ],
- ...(nativeTeam && draft.nativeTeamPreferredProfiles?.length
- ? [[t('角色偏好(可选)'), draft.nativeTeamPreferredProfiles.join(', ')] as [string, string]]
- : []),
- [t('用量上限 / 万 Token'), Number(draft.maxTotalTokens) ? draft.maxTotalTokens! : t('不限')],
- ...(!nativeTeam && unresolved && plan ? [[t('模块方案'), planSummary] as [string, string]] : []),
- [
- t('研究方式'),
- nativeTeam
- ? t('Codex 原生团队')
- : workers === '1'
- ? t('单 Agent 研究')
- : draft.coordination === 'cooperative'
- ? t('任务协作')
- : t('独立并行'),
- ],
- ...(draft.planApproval && (nativeTeam || unresolved)
- ? [[t('先审路线再开工'), t('开启')] as [string, string]]
- : []),
- ]);
- element('#import-task-preview').textContent = draft.task || t('未填写');
- element('#import-source-preview').textContent = draft.source || t('未填写');
- renderImportState();
- const dialog = element('#import-task-dialog');
- showDialog(dialog);
- element('#cancel-import').focus();
- } catch (error) {
- if (sequence !== taskImportSequence || revision !== draftRevision) return;
- element('#draft-error').textContent = message(error);
- element('#draft-error').hidden = false;
- }
-}
-function applyTemplate(id: string) {
- const template = state.session?.templates.find(
- item => item.id === id && item.environment === field('environment').value,
- );
- replaceDraft('template', () => {
- if (template) {
- field('source').value = template.source;
- field('task').value = template.task;
- }
- sourceChanged();
- });
-}
-function resetForm() {
- const session = state.session;
- if (!session || state.submitting) return;
- replaceDraft('reset', () => {
- clearValidation();
- draftSourceExpanded = false;
- const wasReady = draftReady;
- draftReady = false;
- clearTimeout(draftTimer);
- draftDirty = false;
- element('#run-form').reset();
- setDraftTeamProfiles();
- draftAutoExplain = true;
- draftExplanationLanguage = locale;
- modulePlanLibrary.resetSelection();
- modulePlanEditor.setValue();
- serverModulePlans.setKnowledgeDigest();
- field('api-key').value = '';
- element('#api-key').type = 'password';
- updateKeyToggle();
- for (const [id, value] of Object.entries({
- model: session.defaults.model,
- effort: session.defaults.effort,
- 'max-turns': session.defaults.maxTurns || '',
- 'max-seconds': session.defaults.maxRunSeconds || '',
- workers: session.defaults.workers,
- 'max-tokens': '',
- }))
- field(id).value = String(value);
- element(`input[name="coordination"][value="${session.defaults.coordination}"]`).checked = true;
- field('provider').value = session.providers[0]?.id ?? '';
- field('environment').value = session.defaults.environment;
- renderTemplates();
- field('source').value = '';
- field('task').value = t('保留原题声明,补全 Lean 证明并通过独立验收。');
- element('#proof-instructions').open = false;
- sourceChanged();
- providerAddress();
- updateEnvironment();
- element('#form-error').hidden = true;
- element('#draft-error').hidden = true;
- draftReady = wasReady;
- if (wasReady) {
- try {
- ownedDrafts.removeItem(taskDraftStorageKey);
- setDraftStatus(t('草稿已重置'));
- } catch {
- setDraftStatus(t('草稿保存不可用'), true);
- }
- }
- });
-}
-function setCustomSource(source: string) {
- if (field('template').value) field('task').value = t('保留原题声明,补全 Lean 证明并通过独立验收。');
- field('template').value = '';
- field('source').value = source;
- sourceChanged();
-}
-function updateEditorCount() {
- const source = field('expanded-source').value;
- const size = byteSize(source),
- limit = state.session?.limits.maxSourceBytes;
- const target = element('#editor-count');
- const lines = t('{0} 行', source.split(/\r\n|\r|\n/).length);
- target.textContent = nearLimit(size, limit) ? `${lines} · ${byteLabel(size)} / ${byteLabel(limit!)}` : lines;
- target.classList.toggle('over-limit', Boolean(limit && size > limit));
- const modified = source !== editorInitialSource;
- const changeStatus = element('#editor-change-status');
- patchText(changeStatus, modified ? t('修改尚未应用') : t('未修改'));
- changeStatus.classList.toggle('modified', modified);
- editorNavigation.updateSource();
- editorReview.updateSource();
- updateEditorPosition();
-}
-function updateEditorPosition() {
- const editor = element('#expanded-source');
- const caret = editor.selectionDirection === 'backward' ? editor.selectionStart : editor.selectionEnd;
- const prefix = editor.value.slice(0, caret);
- const line = prefix.split('\n').length;
- const column = Array.from(prefix.slice(prefix.lastIndexOf('\n') + 1)).length + 1;
- const position = t('第 {0} 行 · 第 {1} 列', line, column),
- target = element('#editor-position');
- patchText(target, position);
- if (target.title !== position) target.title = position;
- editorNavigation.updateSelection();
-}
-function indentEditor(direction: IndentDirection) {
- if (!element('#source-editor').open) return;
- const editor = element('#expanded-source');
- const { value, selectionStart, selectionEnd, selectionDirection, scrollTop, scrollLeft } = editor;
- const edit = sourceIndentEdit(value, selectionStart, selectionEnd, direction);
- editor.focus({ preventScroll: true });
- if (edit) {
- editor.setSelectionRange(edit.from, edit.to);
- // Use the browser's edit transaction to retain native undo and redo.
- try {
- document.execCommand('insertText', false, edit.text);
- } catch {}
- const applied = editor.value === value.slice(0, edit.from) + edit.text + value.slice(edit.to);
- editor.setSelectionRange(
- applied ? edit.selectionStart : selectionStart,
- applied ? edit.selectionEnd : selectionEnd,
- selectionDirection,
- );
- const error = element('#editor-error');
- error.hidden = applied;
- if (!applied) error.textContent = t('未能调整缩进,请直接编辑源码');
- updateEditorCount();
- }
- editor.scrollTop = scrollTop;
- editor.scrollLeft = scrollLeft;
- updateEditorPosition();
-}
-function openEditor(location?: { source: string; position: SourceSelection }) {
- const dialog = element('#source-editor');
- if (!state.session || state.submitting || dialog.open) return;
- editorOpenedFromPreview = Boolean(location || document.activeElement?.closest('#draft-preview'));
- // Keep the settings dialog underneath so native modal focus returns to its caller.
- editorRevision = sourceRevision;
- const source = field('source').value;
- // A new native buffer keeps multiline undo transactions from an earlier opening out of this editor.
- const previous = element('#expanded-source');
- const editor = previous.cloneNode(false) as HTMLTextAreaElement;
- editor.value = source;
- previous.replaceWith(editor);
- editorInitialSource = editor.value;
- editorClosePosition = undefined;
- editorNavigation.reset(editor);
- editorReview.reset(editor, editorInitialSource);
- editor.setSelectionRange(0, 0);
- const environment = environmentInfo(field('environment').value);
- element('#editor-environment').textContent = environment
- ? `${environment.name} · ${leanVersion(environment.toolchain)}`
- : '';
- element('#editor-error').hidden = true;
- updateEditorCount();
- showDialog(dialog);
- editor.focus();
- editor.scrollTop = 0;
- editor.scrollLeft = 0;
- if (location?.source === source) editorNavigation.locate(location.position);
-}
-function requestEditorClose() {
- const dialog = element('#source-editor');
- const confirmation = element('#editor-discard-dialog');
- if (!dialog.open || confirmation.open) return;
- editorReview.close();
- const editor = element('#expanded-source');
- if (editor.value === editorInitialSource) {
- dialog.close();
- return;
- }
- editorClosePosition = {
- start: editor.selectionStart,
- end: editor.selectionEnd,
- direction: editor.selectionDirection,
- top: editor.scrollTop,
- left: editor.scrollLeft,
- };
- showDialog(confirmation);
- element('#keep-editing').focus();
-}
-function keepEditing() {
- const confirmation = element('#editor-discard-dialog');
- if (!confirmation.open) return;
- confirmation.close();
- const position = editorClosePosition;
- editorClosePosition = undefined;
- if (!element('#source-editor').open) return;
- editorReview.close();
- const editor = element('#expanded-source');
- editor.focus({ preventScroll: true });
- if (position) {
- editor.setSelectionRange(position.start, position.end, position.direction);
- editor.scrollTop = position.top;
- editor.scrollLeft = position.left;
- }
- updateEditorPosition();
-}
-function discardEditorChanges() {
- element('#editor-discard-dialog').close();
- editorClosePosition = undefined;
- element('#source-editor').close();
-}
-function applyEditor() {
- const source = field('expanded-source').value;
- const error = !source.trim()
- ? t('Lean 源码不能为空')
- : source.includes('\0')
- ? t('源码包含无效字符')
- : byteSize(source) > (state.session?.limits.maxSourceBytes ?? 0)
- ? t('Lean 源码超出允许大小')
- : editorRevision !== sourceRevision
- ? t('原始草稿已变化,请重新打开编辑器后修改')
- : '';
- element('#editor-error').textContent = error;
- element('#editor-error').hidden = !error;
- if (error) {
- editorReview.close();
- return;
- }
- editorReview.close();
- if (source !== field('source').value) replaceDraft('edit', () => setCustomSource(source));
- element('#source-editor').close();
-}
-function updateKeyToggle() {
- const visible = element('#api-key').type === 'text';
- const button = element('#toggle-key');
- button.setAttribute('aria-label', visible ? t('隐藏 API Key') : t('显示 API Key'));
- button.setAttribute('title', visible ? t('隐藏 API Key') : t('显示 API Key'));
- button.setAttribute('aria-pressed', String(visible));
- renderGlyph(button, visible ? 'eye-off' : 'eye');
-}
-function renderRuntime() {
- const session = state.session;
- const ready = Boolean(state.connected && session?.runtime.ready && session.providers.length);
- element('#runtime-note').textContent = !state.connected
- ? state.lost
- ? t('连接恢复后可提交')
- : t('正在检查环境')
- : session
- ? !session.providers.length
- ? t('未配置可用服务商')
- : localizeText(session.runtime.message) || (ready ? t('环境就绪') : t('环境未就绪'))
- : t('等待连接');
- element('#submit-run').disabled = !ready || state.submitting || researchEntry !== 'lean';
- renderGlyph(element('#submit-run'), state.submitting ? 'spinner' : 'arrow-up');
- element('#submit-run').setAttribute('aria-label', state.submitting ? t('正在提交') : t('发送研究任务'));
- element('#submit-run').setAttribute(
- 'title',
- state.submitting
- ? t('正在提交')
- : touchQuery.matches
- ? t('发送研究任务')
- : t('发送研究任务(Enter;Shift+Enter 换行)'),
- );
- element('#settings-submit').disabled = !ready || state.submitting;
- element('#settings-submit').disabled ||= researchEntry !== 'lean';
- element('#settings-submit').hidden = researchEntry !== 'lean';
- element('#form-fields').disabled = !session || state.submitting;
- element('#inline-problem-fields').disabled =
- !session || state.submitting || researchEntry !== 'lean';
- element('#reset-form').disabled = !session || state.submitting;
- element('#import-task').disabled = !session || state.submitting;
- element('#export-draft').disabled = !session || state.submitting;
- element('#new-research').disabled = !session || state.submitting;
- renderDraftRecovery();
- renderRunMonitor();
- renderImportState();
- renderDeleteState();
- renderCancelState();
- renderConversation();
- if (state.draftView === 'modules') renderDraftPreview();
- // Connecting (or losing the connection) starts or stops the statement check.
- sourceCheck.schedule();
-}
-function status(run: WebRun) {
- if (passed(run)) return { label: acceptedTitle(run), tone: 'passed', symbol: 'circle-check' };
- if (run.status === 'queued')
- return {
- label: run.queue ? t('排队中 · 第 {0} 位', run.queue.position) : t('排队中'),
- tone: '',
- symbol: 'clock-3',
- };
- if (run.status === 'running')
- return planAwaitingApproval(run)
- ? { label: runProgress(run).phaseLabel, tone: 'warning', symbol: 'list-ordered' }
- : { label: runProgress(run).phaseLabel, tone: 'running', symbol: 'refresh-cw' };
- if (run.status === 'cancelled') return { label: t('已取消'), tone: '', symbol: 'square' };
- if (run.status === 'error') return { label: t('运行错误'), tone: 'failed', symbol: 'circle-alert' };
- // A stopped budget is an expected end; other classified failures need the user to act.
- if (isFaultedRun(run)) return { label: t('运行失败'), tone: 'failed', symbol: 'circle-alert' };
- if (isRejectedRun(run)) return { label: t('验收未通过'), tone: 'failed', symbol: 'circle-alert' };
- return { label: stoppedLabel(run), tone: 'warning', symbol: 'clock-3' };
-}
-function rememberFinishedRuns(previous: readonly WebRun[]) {
- const active = new Set(previous.filter(activeRun).map(run => run.id));
- for (const run of state.runs) {
- if (active.has(run.id) && !activeRun(run) && run.id !== state.selectedId) state.finishedRuns.add(run.id);
- }
-}
-function renderRunMonitor() {
- const root = element('#run-monitor'),
- list = element('#run-monitor-list');
- const available = new Set(state.runs.map(run => run.id));
- for (const id of state.finishedRuns) if (!available.has(id) || id === state.selectedId) state.finishedRuns.delete(id);
- const runs = state.runs.filter(run => activeRun(run) || state.finishedRuns.has(run.id)).toReversed();
- const active = runs.filter(activeRun).length,
- finished = runs.length - active;
- // One entry that is the run on screen repeats its status line; the strip appears once there is something else to watch.
- root.hidden = !runs.length || (runs.length === 1 && runs[0]!.id === state.selectedId);
- root.dataset.stale = String(!state.connected);
- patchText(
- element('#run-monitor-summary'),
- [active ? t('{0} 项进行中', active) : '', finished ? t('{0} 项已结束', finished) : ''].filter(Boolean).join('\n'),
- );
- const focused =
- document.activeElement instanceof HTMLElement && list.contains(document.activeElement)
- ? document.activeElement
- : undefined;
- const left = list.scrollLeft;
- drawRunMonitor(
- list,
- runs.map((run): MonitorItem => {
- const value = status(run),
- cancelling = activeRun(run) && state.cancelling.has(run.id),
- stalled = stalledMinutes(run);
- const label = cancelling
- ? t('正在取消')
- : stalled !== undefined
- ? t('{0} 分钟无新增通过检查或结果集成', stalled)
- : value.label;
- return {
- id: run.id,
- title: run.title,
- description: state.connected ? label : t('待同步 · {0}', label),
- tone: stalled !== undefined && !cancelling ? 'warning' : value.tone,
- symbol: stalled !== undefined && !cancelling ? 'hourglass' : value.symbol,
- current: run.id === state.selectedId,
- cancelling,
- active: activeRun(run),
- stages: runProgress(run).steps.map(step => step.state),
- };
- }),
- );
- list.scrollLeft = left;
- if (focused && !focused.isConnected && !document.querySelector('dialog[open]'))
- element('#open-history').focus({ preventScroll: true });
- renderShell();
-}
-function rememberHistoryScroll() {
- const list = element('#run-list');
- if (!list.getClientRects().length) return;
- const top = list.getBoundingClientRect().top + list.clientTop;
- const rows = Array.from(list.querySelectorAll(':scope > [data-history-id]'), row => {
- const bounds = row.getBoundingClientRect();
- return { id: row.dataset.historyId!, offset: bounds.top - top, bottom: bounds.bottom - top };
- });
- const firstVisible = rows.findIndex(row => row.bottom > 0);
- // Keep a surviving row at its previous offset when entries above it change.
- const ordered =
- firstVisible < 0 ? rows.toReversed() : [...rows.slice(firstVisible), ...rows.slice(0, firstVisible).reverse()];
- historyReading = { top: list.scrollTop, anchors: ordered.map(({ id, offset }) => ({ id, offset })) };
-}
-function restoreHistoryScroll() {
- const list = element('#run-list');
- if (!list.getClientRects().length) return;
- const rows = new Map(
- Array.from(list.querySelectorAll(':scope > [data-history-id]'), row => [row.dataset.historyId, row]),
- );
- const anchor = historyReading.anchors.find(anchor => rows.has(anchor.id));
- if (historyReading.top && anchor) {
- const top = list.getBoundingClientRect().top + list.clientTop;
- list.scrollTop += rows.get(anchor.id)!.getBoundingClientRect().top - top - anchor.offset;
- } else list.scrollTop = historyReading.top;
- rememberHistoryScroll();
-}
-function closeHistoryDialog() {
- rememberHistoryScroll();
- element('#history-dialog').close();
-}
-function renderRunList(force = false) {
- renderRunMonitor();
- chatWorkspace?.updateOverview();
- // The readiness line warns at the record limit, so it follows the record count too.
- if (recordsFull() !== readinessFull) renderPreparation();
- // Plans waiting for the owner's approval stand in their own group above the rest; nothing in them runs until approved.
- const groups = ownerFirst(filterRuns(state.runs, state.query, state.filter)),
- runs = [...groups.waiting, ...groups.others];
- const filtered = Boolean(state.query.trim() || state.filter !== 'all');
- const criteria = JSON.stringify([state.query, state.filter]);
- const signature = JSON.stringify([
- state.selectedId,
- criteria,
- groups.waiting.length,
- runs.map(run => [run.id, run.title, run.model, run.createdAt, environmentName(run.environment), status(run)]),
- ]);
- patchText(element('#run-count'), filtered ? `${runs.length}/${state.runs.length}` : String(state.runs.length));
- element('#clear-run-search').hidden = !state.query;
- // With no records at all there is nothing to search or filter; a search that matches nothing keeps its tools.
- element('.history-tools').hidden = !state.runs.length && !filtered;
- // The phone list repeats model and environment under every title; when every run used the same pair it says nothing.
- element('#run-list').toggleAttribute(
- 'data-uniform',
- new Set(state.runs.map(run => `${run.model}\n${run.environment}`)).size <= 1,
- );
- if (!force && signature === state.listSignature) return;
- state.listSignature = signature;
- const list = element('#run-list'),
- sameCriteria = criteria === historyCriteria;
- if (sameCriteria) rememberHistoryScroll();
- else historyReading = { top: 0, anchors: [] };
- historyCriteria = criteria;
- // Where the selection was, so it can slide to the row chosen now; a changed search or filter moves every row instead.
- const chosen = sameCriteria
- ? list.querySelector(':scope > [data-history-id] > .run-row.selected')
- : null;
- const chosenBox = selectionBox(chosen),
- chosenId = chosen?.dataset.runId;
- const focused =
- document.activeElement instanceof HTMLElement && list.contains(document.activeElement)
- ? document.activeElement
- : undefined;
- const rows = new Map(
- Array.from(list.querySelectorAll(':scope > [data-history-id]'), row => [row.dataset.historyId!, row]),
- );
- const focusedIndex = Array.from(rows.keys()).indexOf(focused?.dataset.runId ?? '');
- const ids = new Set(runs.map(run => run.id));
- const headed = groups.waiting.length > 0;
- const headings = new Map(
- Array.from(list.querySelectorAll(':scope > [data-history-group]'), row => [
- row.dataset.historyGroup!,
- row,
- ]),
- );
- for (const child of Array.from(list.children)) {
- const row = child as HTMLElement;
- if (
- row.hasAttribute('data-history-group')
- ? !headed || (row.dataset.historyGroup === 'others' && !groups.others.length)
- : !ids.has(row.dataset.historyId ?? '') && (runs.length || !row.hasAttribute('data-history-empty'))
- )
- row.remove();
- }
- let cursor = list.firstElementChild;
- const heading = (group: 'waiting' | 'others', label: string, count?: number) => {
- let row = headings.get(group);
- if (!row) {
- row = document.createElement('div');
- row.className = 'history-group';
- row.dataset.historyGroup = group;
- row.setAttribute('aria-hidden', 'true');
- }
- renderHistoryGroup(row, label, count);
- if (row !== cursor) list.insertBefore(row, cursor);
- cursor = row.nextElementSibling;
- };
- const tabbable = runs.some(run => run.id === state.selectedId) ? state.selectedId : runs[0]?.id;
- for (const run of runs) {
- // The headings only repeat what each row's badge says, so screen readers keep the plain list of runs.
- if (headed && run === groups.waiting[0]) heading('waiting', t('等你处理'), groups.waiting.length);
- if (headed && run === groups.others[0]) heading('others', t('其他运行'));
- let row = rows.get(run.id);
- if (!row) {
- row = document.createElement('div');
- row.setAttribute('role', 'listitem');
- row.dataset.historyId = run.id;
- rows.set(run.id, row);
- }
- const value = status(run);
- renderHistoryRow(row, {
- id: run.id,
- title: run.title,
- model: run.model,
- environment: environmentName(run.environment),
- selected: run.id === state.selectedId,
- tabbable: run.id === tabbable,
- tone: value.tone,
- symbol: value.symbol,
- label: value.label,
- createdAt: run.createdAt,
- time: timestamp(run.createdAt),
- });
- if (row !== cursor) list.insertBefore(row, cursor);
- cursor = row.nextElementSibling;
- }
- if (!runs.length) {
- let empty = list.querySelector('[data-history-empty]');
- if (!empty) {
- empty = document.createElement('div');
- empty.className = 'empty-state compact';
- empty.dataset.historyEmpty = '';
- empty.setAttribute('role', 'status');
- list.append(empty);
- }
- renderHistoryEmpty(empty, filtered);
- }
- restoreHistoryScroll();
- // A record that just arrived unfolds into a list read from its top; further down, rows stay where the reader left them.
- const unfolding = sameCriteria && list.scrollTop === 0 ? runs.filter(run => arrivals.has(run.id)) : [];
- arrivals.clear();
- for (const run of unfolding) arriveRow(rows.get(run.id)!);
- const selected = rows.get(state.selectedId)?.querySelector('.run-row');
- if (chosenBox && chosenId !== state.selectedId && selected && !unfolding.length)
- glideSelection(list, chosenBox, selected);
- if (focused && document.activeElement !== focused && list.getClientRects().length) {
- const fallback = rows
- .get(runs[Math.min(Math.max(focusedIndex, 0), runs.length - 1)]?.id ?? '')
- ?.querySelector('button');
- (focused.isConnected ? focused : (fallback ?? field('run-search'))).focus({ preventScroll: true });
- }
-}
-/** The runs the history lists, in its order: the group waiting for the owner first, so arrow keys follow the rows. */
-const visibleRuns = () => {
- const { waiting, others } = ownerFirst(filterRuns(state.runs, state.query, state.filter));
- return [...waiting, ...others];
-};
-function clearFilters() {
- state.query = '';
- state.filter = 'all';
- field('run-search').value = '';
- field('run-filter').value = 'all';
- renderRunList();
-}
-const isSample = (run?: WebRun) => Boolean(run && run.id === state.session?.sample?.id);
-const sampleSelected = () => Boolean(state.selectedId && state.selectedId === state.session?.sample?.id);
-const currentRun = () =>
- state.selectedRun?.id === state.selectedId
- ? state.selectedRun
- : sampleSelected()
- ? state.sample
- : state.runs.find(run => run.id === state.selectedId);
-const downloadUrl = (id: string) => `/api/runs/${encodeURIComponent(id)}/download`;
-/** A run keeps going on the server; say so, and how its end reaches the reader (the account's mail, else this list). */
-const awayNote = () =>
- state.session?.account?.email && state.session.account.completionEmail !== false
- ? t('可以关闭页面,运行会在服务器上继续;结束后会发邮件到 {0}。', state.session.account.email)
- : t('可以关闭页面,运行会在服务器上继续;结束后回到研究记录查看结果。');
-function resultTitle(run: WebRun) {
- const guide = failureGuide(run);
- if (guide) return guide.title;
- return passed(run)
- ? run.formalization
- ? acceptedTitle(run)
- : t('完整原题已通过独立验收')
- : activeRun(run)
- ? run.status === 'queued'
- ? t('任务已排队')
- : planGated(run)
- ? t('证明尚未开始')
- : t('研究正在运行')
- : run.status === 'cancelled'
- ? t('运行已取消')
- : run.status === 'error'
- ? t('运行发生错误')
- : isRejectedRun(run)
- ? t('完整原题验收未通过')
- : t('运行已结束,完整原题尚未验收通过');
-}
-/** The result tab of one run: verdict, proof, route, report, then the task and how it was run. */
-function resultProps(run: WebRun): ResultPanelProps {
- const progress = runProgress(run),
- value = status(run),
- working = activeRun(run),
- guide = failureGuide(run);
- const acceptance = passed(run) && !guide ? acceptedVerdict(run) : undefined;
- const provider = state.session?.providers.find(item => item.id === run.providerId);
- const environment = environmentInfo(run.environment);
- const item = (label: string, value: unknown, mono = false) => ({ label, value: String(value), mono });
- const latest = working ? run.events.at(-1) : undefined;
- const proof = candidateSource(run),
- goals = summarizeGoals(run),
- approval = planAwaitingApproval(run),
- later = relatedResearchRuns(state.runs, run);
- const compare = compareProps(run, later);
- return {
- // The plan waiting on its owner has nothing running: no spinner, unless the Lead is revising it from their note.
- verdict: {
- run: run.id,
- tone: value.tone,
- symbol: value.symbol,
- title: resultTitle(run),
- description: acceptance?.description ?? resultDescription(run),
- ...(run.formalization
- ? {
- meaning:
- acceptance?.meaning ??
- statementConfirmation(run.formalization.confirmation, false, run.formalization.reviewMode),
- }
- : {}),
- active: working && (!approval || approval.leadRevising),
- candidate: Boolean(run.artifact && working),
- ...(latest
- ? {
- latest: {
- at: latest.at,
- time: timestamp(latest.at, true),
- message: readableMessage(latest, workerNames(run.observation?.inspection.workers)),
- },
- }
- : {}),
- ...(run.status === 'running' && !planGated(run) && !isSample(run) ? { away: awayNote() } : {}),
- },
- recovery: isSample(run) ? [] : nextSteps(run, goals),
- ...(!isSample(run) ? { recoveryContext: { run, limits: state.session?.limits } } : {}),
- ...(working ? { notify: notifyState() } : {}),
- ...(!isSample(run) && passed(run)
- ? { saveLibrary: `library.html?${new URLSearchParams({ create: '1', fromRun: run.id })}` }
- : {}),
- ...(['environment', 'unknown', 'interrupted'].includes(guide?.kind ?? '')
- ? { feedback: feedbackUrl({ failure: guide!.kind }) }
- : {}),
- ...(proof
- ? {
- proof: {
- source: proof,
- verified: Boolean(run.result?.proof && passed(run)),
- rejected: isRejectedRun(run),
- ...(passed(run) && isStatementReviewed(run) && run.result?.proof ? { explainRun: run.id } : {}),
- },
- }
- : {}),
- ...(goals ? { goals } : {}),
- ...(proof && state.proofViewer === run.id ? { viewer: { onClose: closeProofViewer } } : {}),
- ...(later.length
- ? {
- later: later.map(item => ({
- id: item.id,
- label: item.continueFrom?.label ?? item.title,
- status: status(item),
- createdAt: item.createdAt,
- time: timestamp(item.createdAt),
- comparable: true,
- })),
- }
- : {}),
- ...(compare ? { compare } : {}),
- active: working,
- report: reportProps(run),
- task: run.formalization?.original ?? run.task,
- // Helpers are declared in the proof, the original targets in both; before a proof exists the problem names them.
- written: writtenNames(headingsOf(run.result?.proof ?? proof ?? run.source)),
- route:
- detailLevel() === 'full' &&
- (working ||
- (run.observation?.inspection.tasks.length ?? 0) > 0 ||
- Boolean(run.actions?.count) ||
- agentRoutes(run.events).length > 0),
- facts: [
- item(t('证明环境'), environmentName(run.environment)),
- item(t('模型'), run.model, true),
- run.finishedAt ? item(t('结束时间'), timestamp(run.finishedAt)) : item(t('创建时间'), timestamp(run.createdAt)),
- ],
- // Versions, limits and budgets matter for reproducing the run, not for reading its result.
- config: [
- item(t('服务商'), provider?.name ?? (isSample(run) ? t('离线示例') : run.providerId)),
- item(t('推理强度'), effortLabels[run.effort] ?? run.effort),
- ...(run.researchMode === 'skill'
- ? [
- item(t('研究方式'), t('项目技能')),
- item(t('技能加载'), run.skillLoading === 'file' ? t('读取固定文件') : t('原生加载')),
- ...(run.researchSkill ? [item(t('技能版本'), run.researchSkill.digest, true)] : []),
- ]
- : []),
- item(
- t('协作模式'),
- run.nativeTeamCapacity
- ? t('Codex 原生团队')
- : run.coordination === 'cooperative'
- ? t('任务协作')
- : t('独立并行'),
- ),
- item(
- run.nativeTeamCapacity ? t('团队人数上限(含 Lead)') : t('Agent 数量'),
- run.nativeTeamCapacity ?? run.workers,
- ),
- ...(run.nativeTeamPreferredProfiles?.length
- ? [item(t('角色偏好(可选)'), run.nativeTeamPreferredProfiles.join(', '))]
- : []),
- ...(run.planApproval ? [item(t('先审计划'), t('开启'))] : []),
- item(t('轮次上限'), run.maxTurns || t('不限')),
- item(t('解题预算'), run.maxRunSeconds ? readableDuration(run.maxRunSeconds * 1000) : t('不限')),
- item(t('用量上限'), run.maxTotalTokens ? `${formatTokens(run.maxTotalTokens)} Token` : t('不限')),
- ...(!working && progress.solvingElapsed !== null
- ? [item(t('研究用时'), readableDuration(progress.solvingElapsed))]
- : []),
- ...(run.finishedAt ? [item(t('创建时间'), timestamp(run.createdAt))] : []),
- ...(environment ? [item(t('Lean 版本'), environment.toolchain, true)] : []),
- ...(environment?.mathlibRevision ? [item(t('Mathlib 版本'), environment.mathlibRevision, true)] : []),
- ],
- };
-}
-/** 对比代码 for the later run the reader opened beside this one's result, while both still have code. */
-function compareProps(run: WebRun, later: readonly WebRun[]): CompareProps | undefined {
- const other = state.compare?.runId === run.id ? later.find(item => item.id === state.compare!.laterId) : undefined;
- const before = candidateSource(run),
- after = other ? candidateSource(other) : '';
- if (!other) return;
- if (
- before &&
- after &&
- (runComparison?.before !== before || runComparison.after !== after || runComparison.folded !== state.foldUnchanged)
- )
- runComparison = {
- before,
- after,
- folded: state.foldUnchanged,
- result: compareSources(before, after, state.foldUnchanged),
- };
- return {
- id: other.id,
- label: other.continueFrom?.label ?? other.title,
- ...(before && after ? { comparison: runComparison!.result } : {}),
- research: { before: run, after: other },
- folded: state.foldUnchanged,
- onClose: closeCompare,
- };
-}
-function closeCompare() {
- const id = state.compare?.laterId;
- state.compare = undefined;
- renderPanel(true);
- if (id)
- document
- .querySelector(`#detail-panel [data-action="compare-continued"][data-run-id="${CSS.escape(id)}"]`)
- ?.focus({ preventScroll: true });
-}
-let resultRouteHost: HTMLElement | undefined;
-/** The result's recorded roadmap shares its reader with the dedicated tab; the Agent action lanes open on demand. */
-function renderResultRoute(run: WebRun) {
- const roadmapHost = document.querySelector('#detail-panel [data-result-roadmap]');
- if (roadmapHost)
- trajectoryView?.update(roadmapHost, run, nodeId => {
- state.tab = 'trajectory';
- renderDetail(true);
- trajectoryView?.showNode(run.id, nodeId);
- });
- else trajectoryView?.update();
- const host = document.querySelector('#detail-panel [data-result-route]') ?? undefined;
- // A replaced host takes its map with it; unmounting stops that map's reading.
- if (resultRouteHost && resultRouteHost !== host) unmountAgentRoute?.(resultRouteHost);
- resultRouteHost = host;
- if (!host) return;
- const details = host.closest('details')!;
- const draw = () => {
- if (!details.open) {
- unmountAgentRoute?.(host);
- return;
- }
- const inspection = run.observation?.inspection;
- renderAgentRoute?.(host, {
- source: { store: agentActivity, run, lead: inspection?.workers.find(worker => worker.role === 'lead')?.id },
- names: workerNames(inspection?.workers),
- running: run.status === 'running',
- tasks: taskNames(inspection?.tasks ?? []),
- planned: inspection?.tasks.length ?? 0,
- graph: 'elsewhere',
- time: clockTime,
- });
- };
- details.ontoggle = draw;
- draw();
-}
-let stallSignature = '';
-function updateClocks() {
- if (document.hidden) return;
- // A run can become stuck without any new data; the monitor follows each minute that passes.
- const stalls = state.runs
- .filter(activeRun)
- .map(run => `${run.id}:${stalledMinutes(run) ?? ''}`)
- .join('|');
- if (stalls !== stallSignature) {
- stallSignature = stalls;
- renderRunMonitor();
- }
- const run = currentRun();
- if (!run || !activeRun(run)) return;
- renderRunHeader(run);
- renderShell();
-}
-const candidateSource = (run: WebRun) => run.result?.proof || run.artifact?.source || '';
-const displayedSource = (run: WebRun) =>
- state.sourceView !== 'input' && candidateSource(run) ? candidateSource(run) : run.source;
-function sourceContent(run: WebRun) {
- const hasProof = Boolean(candidateSource(run));
- const showingProof = hasProof && state.sourceView !== 'input';
- const verified = Boolean(run.result?.proof && passed(run));
- const proofLabel = verified ? t('验收证明') : t('候选源码');
- const source = displayedSource(run);
- const lineCount = source.split(/\r\n|\r|\n/).length;
- const author = showingProof && !run.result?.proof ? run.artifact?.workerId : undefined;
- const props: SourcePanelProps = {
- hasProof,
- proofLabel,
- view: state.sourceView,
- showingProof,
- verified,
- ...(verified && isStatementReviewed(run) ? { explainRun: run.id } : {}),
- status: showingProof
- ? verified
- ? run.formalization
- ? acceptedTitle(run)
- : t('完整原题已通过验收')
- : isRejectedRun(run)
- ? t('候选 · 验收未通过')
- : t('候选 · 尚未验收通过')
- : activeRun(run) && !hasProof
- ? t('原始题目 · 等待候选')
- : t('原始题目'),
- tone: showingProof ? (verified ? 'verified' : 'candidate') : '',
- ...(author
- ? { origin: t('来自 {0}', workerNames(run.observation?.inspection.workers).get(author) ?? author) }
- : {}),
- };
- return {
- props,
- diff: hasProof && state.sourceView === 'diff',
- source: source.replace(/\r\n?/g, '\n'),
- numbers: Array.from({ length: lineCount }, (_, index) => index + 1).join('\n'),
- };
-}
-function updateSourceReader() {
- const run = currentRun();
- if (!run && state.draftView === 'modules') {
- sourceReader.update();
- return;
- }
- const editableSource = !run ? field('source').value : undefined;
- const code = document.querySelector(
- run ? '#detail-panel .source-code code' : '#draft-preview-code code',
- );
- const scroll = document.querySelector(run ? '#detail-panel .source-code-grid' : '.draft-source-scroll');
- const toolbar = document.querySelector('#run-detail .source-reader');
- sourceReader.update(
- code && scroll && toolbar
- ? {
- id: run?.id ?? 'draft',
- code,
- scroll,
- toolbar,
- ...(editableSource === undefined
- ? {}
- : {
- edit: {
- source: editableSource,
- open: (position: SourceSelection) => openEditor({ source: editableSource, position }),
- },
- }),
- ...(!run && document.querySelector('.preview-source-heading>span[data-truncated]')
- ? { scope: t('仅查看当前预览的前 160 行;缩小源码至允许大小后可查看完整文件。') }
- : {}),
- }
- : undefined,
- );
-}
-function sourceDiff(run: WebRun): SourcePanelProps['diff'] {
- const before = run.source,
- after = candidateSource(run);
- const sourceChanged =
- sourceComparison?.runId !== run.id || sourceComparison.before !== before || sourceComparison.after !== after;
- if (sourceChanged || sourceComparison?.folded !== state.foldUnchanged) {
- sourceComparison = {
- runId: run.id,
- before,
- after,
- folded: state.foldUnchanged,
- result: compareSources(before, after, state.foldUnchanged, false),
- };
- if (sourceChanged) state.diffChange = 0;
- }
- return { comparison: sourceComparison!.result, folded: state.foldUnchanged, accepted: passed(run) };
-}
-function updateDiffNavigation(move = 0, align = false) {
- const scroll = document.querySelector('#detail-panel .diff-scroll');
- if (!scroll) return;
- const changes = Array.from(scroll.querySelectorAll('[data-change-start]'));
- state.diffChange = Math.max(0, Math.min(state.diffChange + move, changes.length - 1));
- element('[data-action="diff-prev"]').disabled = !changes.length || state.diffChange === 0;
- element('[data-action="diff-next"]').disabled = state.diffChange >= changes.length - 1;
- element('#diff-position').textContent = `${changes.length ? state.diffChange + 1 : 0}/${changes.length}`;
- changes.forEach((row, index) => row.classList.toggle('diff-change-current', index === state.diffChange));
- if ((move || align) && changes[state.diffChange]) {
- const headerHeight = scroll.querySelector('thead')?.getBoundingClientRect().height ?? 0;
- scroll.scrollTop +=
- changes[state.diffChange].getBoundingClientRect().top - scroll.getBoundingClientRect().top - headerHeight;
- }
-}
-function reportProps(run: WebRun): ReportPanelProps {
- if (!run.result)
- return run.error ? { kind: 'error', error: localizeMessage(run.error) } : { kind: 'empty', active: activeRun(run) };
- const stuck = summarizeStuck(run);
- const summary = summarizeReport(run),
- reason = reportReason(summary.reason);
- // A run stopped before any check (a refused Key, say) has nothing to summarize; the verdict says why, the raw report stays folded.
- if (
- !reason.text &&
- !reason.code &&
- !stuck &&
- !summary.checks.length &&
- !summary.metrics.length &&
- !summary.identity.length &&
- !summary.library &&
- !run.result.proof
- )
- return { kind: 'error', error: JSON.stringify(run.result.report, null, 2) };
- if (state.reportMode === 'json') return { kind: 'json', report: run.result.report };
- return {
- kind: 'summary',
- summary: {
- ...(reason.text ? { reason: reason.text } : {}),
- ...(reason.code ? { diagnostic: reason.code } : {}),
- checks: summary.checks.map(check => {
- const why = checkReason(check);
- return { ...check, ...(why ? { reason: why } : {}) };
- }),
- metrics: summary.metrics.map(readableMetric),
- identity: summary.identity,
- ...(summary.library ? { library: summary.library } : {}),
- },
- accepted: passed(run),
- ...(stuck ? { stuck } : {}),
- ...(run.result.proof
- ? {
- outline: {
- state: outlines.get(run.id),
- kitUrl: `/api/runs/${encodeURIComponent(run.id)}/verification-kit`,
- headings: headingsOf(run.result.proof),
- mathlib: Boolean(environmentInfo(run.environment)?.mathlibRevision ?? run.environment === 'mathlib'),
- ...(isAcceptedRun(run) && isStatementReviewed(run) ? { explainRun: run.id } : {}),
- },
- }
- : {}),
- };
-}
-const outlines = new Map();
-/** Starts loading the proof outline; the report re-renders when it arrives. Returns whether a request started. */
-function loadOutline(run: WebRun, retry = false) {
- if (!run.result?.proof || (outlines.has(run.id) && !retry)) return false;
- outlines.set(run.id, { status: 'loading' });
- void api<{ outline: WebProofOutline }>(`/api/runs/${encodeURIComponent(run.id)}/outline`)
- .then(({ outline }) => {
- outlines.set(run.id, { status: 'ready', outline });
- })
- .catch(error => {
- outlines.set(run.id, { status: 'failed', error: t('证明结构整理失败:{0}', message(error)) });
- })
- .finally(() => {
- if (currentRun()?.id === run.id && state.tab === 'result') renderPanel(true);
- });
- return true;
-}
-function renderPanel(force = false) {
- const run = currentRun();
- if (!run || !document.querySelector('#detail-panel')) return;
- if (!collaborationView || !trajectoryView) {
- renderRunViewsLoading(element('#detail-panel'));
- return;
- }
- if (state.tab === 'result' && state.reportMode === 'summary') loadOutline(run);
- const content = state.tab === 'source' ? sourceContent(run) : undefined;
- const signature = JSON.stringify([
- run.id,
- state.tab,
- content
- ? [state.foldUnchanged, content.source, content.props]
- : state.tab === 'result'
- ? [
- state.reportMode,
- detailLevel(),
- run,
- outlines.get(run.id),
- notifyState(),
- state.proofViewer === run.id,
- relatedResearchRuns(state.runs, run).map(item => [
- item.id,
- item.updatedAt,
- status(item),
- Boolean(candidateSource(item)),
- ]),
- state.compare?.runId === run.id
- ? [
- state.compare.laterId,
- state.foldUnchanged,
- candidateSource(state.runs.find(item => item.id === state.compare!.laterId) ?? run),
- ]
- : '',
- ]
- : state.tab === 'events'
- ? run.events
- : state.tab === 'modules'
- ? [run, state.connected]
- : run,
- ]);
- if (!force && signature === state.panelSignature) {
- if (state.tab === 'collaboration')
- collaborationView?.update(
- document.querySelector('.collaboration-workspace') ?? undefined,
- run,
- state.connected,
- isSample(run),
- );
- if (state.tab === 'trajectory')
- trajectoryView?.update(document.querySelector('.trajectory-workspace') ?? undefined, run);
- return;
- }
- state.panelSignature = signature;
- const panel = element('#detail-panel');
- const navigating =
- panel.dataset.renderRunId === run.id &&
- (panel.dataset.tab !== state.tab ||
- (state.tab === 'source' && panel.dataset.renderSourceView !== state.sourceView) ||
- (state.tab === 'result' && panel.dataset.renderReportMode !== state.reportMode));
- if (navigating) finishMotion(panel);
- const samePanel = panel.dataset.renderRunId === run.id && panel.dataset.tab === state.tab;
- // Switching the report between summary and JSON keeps the reader at the report, further down the result tab.
- const switchingReport = samePanel && state.tab === 'result' && panel.dataset.renderReportMode !== state.reportMode;
- // A tab opens at its top; the collaboration view restores its own reading position below.
- const switchingTab = panel.dataset.renderRunId === run.id && panel.dataset.tab !== state.tab;
- const sameView = samePanel && (state.tab !== 'source' || panel.dataset.renderSourceView === state.sourceView);
- const previousScroll = panel.querySelector('.code-scroll,.activity-scroll,.diff-scroll');
- const scrollTop = sameView ? (previousScroll?.scrollTop ?? 0) : 0;
- const scrollLeft = sameView ? (previousScroll?.scrollLeft ?? 0) : 0;
- const focused =
- document.activeElement instanceof HTMLElement && panel.contains(document.activeElement)
- ? document.activeElement
- : undefined;
- const action = focused?.dataset.action;
- const sourceMode = focused?.dataset.sourceView;
- const reportMode = focused?.dataset.reportView;
- const focusId = focused?.id;
- // Each tab mounts its own tree, so a workspace host is only reused within the same tab of the same run.
- if (!samePanel || state.tab !== 'events') activityReader?.update(undefined, run);
- if (!samePanel || state.tab !== 'modules') moduleView?.update(undefined, moduleInput(run));
- if (!samePanel || state.tab !== 'collaboration') collaborationView?.update();
- if (!samePanel || (state.tab !== 'trajectory' && state.tab !== 'result')) trajectoryView?.update();
- const tab = state.tab;
- renderDetailPanel!(
- panel,
- content
- ? { tab: 'source', source: content.diff ? { ...content.props, diff: sourceDiff(run) } : content.props }
- : tab === 'result'
- ? { tab, result: resultProps(run) }
- : { tab: tab as Exclude },
- );
- if (content && !content.diff) {
- patchText(panel.querySelector('.source-line-numbers')!, content.numbers);
- patchText(panel.querySelector('.source-code code')!, content.source);
- }
- panel.dataset.renderRunId = run.id;
- panel.dataset.tab = state.tab;
- panel.dataset.renderSourceView = state.sourceView;
- panel.dataset.renderReportMode = state.reportMode;
- if (switchingTab) {
- panel.scrollTop = 0;
- panel.scrollLeft = 0;
- }
- if (switchingReport) panel.querySelector('.result-report')?.scrollIntoView({ block: 'start', behavior: 'instant' });
- const scroll = panel.querySelector('.code-scroll,.activity-scroll,.diff-scroll');
- if (scroll && state.tab !== 'events') {
- scroll.scrollTop = scrollTop;
- scroll.scrollLeft = scrollLeft;
- }
- if (samePanel && action)
- panel.querySelector(`[data-action="${action}"]`)?.focus({ preventScroll: true });
- else if (samePanel && sourceMode)
- panel.querySelector(`[data-source-view="${sourceMode}"]`)?.focus({ preventScroll: true });
- else if (sameView && reportMode)
- panel.querySelector(`[data-report-view="${reportMode}"]`)?.focus({ preventScroll: true });
- else if (sameView && focused === previousScroll) scroll?.focus({ preventScroll: true });
- else if (samePanel && focusId) document.getElementById(focusId)?.focus({ preventScroll: true });
- if (state.tab === 'collaboration')
- collaborationView?.update(
- panel.querySelector('.collaboration-workspace')!,
- run,
- state.connected,
- isSample(run),
- );
- if (state.tab === 'events')
- activityReader?.update(
- panel.querySelector('.activity-workspace')!,
- run,
- workerNames(run.observation?.inspection.workers),
- );
- if (state.tab === 'trajectory')
- trajectoryView?.update(panel.querySelector('.trajectory-workspace')!, run);
- if (state.tab === 'modules')
- moduleView?.update(panel.querySelector('.module-workspace')!, moduleInput(run));
- if (state.tab === 'result') renderResultRoute(run);
- updateDiffNavigation(0, !sameView);
- // Only on arriving at the result tab: switching the report keeps the reader where they were.
- if (navigating) animateEntrance(panel, 'panel', switchingTab);
- updateSourceReader();
-}
-onDetailLevel(() => {
- if (state.tab === 'result') renderPanel(true);
-});
-function moduleInput(run?: WebRun): ModuleViewInput {
- const draft = run ? undefined : captureDraft();
- return {
- id: run?.id ?? 'draft',
- run,
- model: run?.model ?? field('model').value,
- researchMode: run ? run.researchMode : draft?.researchMode,
- nativeTeamCapacity: run ? run.nativeTeamCapacity : draft?.nativeTeamCapacity,
- workers: run?.workers ?? Number(draft?.workers),
- coordination: run?.coordination ?? draft?.coordination ?? 'independent',
- environment: environmentName(run?.environment ?? field('environment').value),
- connected: state.connected,
- editable: false,
- modulePlan: run ? run.modulePlan : draft?.modulePlan,
- };
-}
-function renderDraftPreview(force = false) {
- if (currentRun() || !state.session || opening()) return;
- const detail = element('#run-detail');
- // Hidden panes cannot restore scroll offsets; refresh them when they become visible.
- if (!detail.getClientRects().length) return;
- const source = field('source').value,
- task = field('task').value;
- const template = state.session.templates.find(
- item => item.id === field('template').value && item.environment === field('environment').value,
- );
- const environment = environmentInfo(field('environment').value);
- const numericLabel = (id: string, label: (value: number) => string) => {
- const value = Number(field(id).value);
- return field(id).value && Number.isSafeInteger(value) && value > 0 ? label(value) : t('未设置');
- };
- const facts = [
- ['environment', t('证明环境'), environment?.name ?? t('未选择'), false],
- ['model', t('模型'), field('model').value || t('未设置'), true],
- [
- 'budget',
- t('解题预算'),
- Number(field('max-seconds').value) === 0
- ? t('不限')
- : numericLabel('max-seconds', value => readableDuration(value * 1000)),
- false,
- ],
- [
- 'workers',
- field('research-mode').value === 'native-team' ? t('团队人数上限(含 Lead)') : t('Agent 数量'),
- numericLabel(field('research-mode').value === 'native-team' ? 'native-team-capacity' : 'workers', value =>
- t('{0} 个 Agent', value),
- ),
- false,
- ],
- ] as const;
- const title = template?.name ?? t('自定义研究');
- const signature = JSON.stringify([
- title,
- source,
- task,
- facts,
- draftSourceExpanded,
- state.draftView,
- state.connected,
- element('input[name="coordination"]:checked').value,
- captureDraft().modulePlan,
- field('research-mode').value,
- field('skill-loading').value,
- state.submitting,
- ]);
- if (!force && signature === draftPreviewSignature && document.querySelector('#draft-preview')) return;
- draftPreviewSignature = signature;
- const lines = source.replace(/\r\n?/g, '\n').split('\n');
- const shown =
- draftSourceExpanded && byteSize(source) <= state.session.limits.maxSourceBytes ? lines : lines.slice(0, 160);
- if (!detail.querySelector('#draft-preview')) {
- moduleView?.update();
- finishMotion(detail);
- unmountRunHeader(detail);
- detail.textContent = '';
- }
- const truncated = lines.length > shown.length;
- drawDraftPreview(detail, {
- title,
- facts,
- truncated,
- task: task || t('未填写'),
- view: state.draftView,
- size: t('{0} 行', truncated ? t('前 {0} / {1}', shown.length, lines.length) : lines.length),
- });
- patchText(detail.querySelector('.preview-line-numbers')!, shown.map((_, index) => index + 1).join('\n'));
- patchText(detail.querySelector('#draft-preview-code code')!, shown.join('\n'));
- const showingModules = state.draftView === 'modules';
- if (showingModules && !moduleView) renderRunViewsLoading(detail.querySelector('.module-workspace')!);
- if (!showingModules) moduleView?.update(undefined, moduleInput());
- if (showingModules) moduleView?.update(detail.querySelector('.module-workspace')!, moduleInput());
- updateSourceReader();
-}
-/**
- * Until the first records arrive the page does not know whether it opens a run (it does whenever the account has one)
- * or the new-research page, so the conversation shell shows a connection status until the composer mounts.
- * A failed connection, or the reader starting a draft, settles it on the new-research page.
- */
-function opening() {
- return (!state.resumed && !state.lost && !state.composing) || (sampleLink && !state.lost);
-}
-let viewSettled = false;
-/** A selected run fills the workspace as one document; without one the workspace is the new-research page. */
-function syncView() {
- const waiting = opening(),
- view = currentRun() || waiting ? 'run' : 'draft';
- const run = currentRun();
- element('#mobile-compose').setAttribute('aria-controls', run ? 'research-conversation-panel' : 'compose-panel');
- element('#mobile-compose').textContent = run ? t('原题与进展') : t('编写');
- element('#mobile-runs').textContent = run ? t('研究成果') : t('预览');
- // The page starts on the run layout; when it settles on the new-research page, a phone shows the composer.
- const settling = !waiting && !viewSettled;
- if (settling) viewSettled = true;
- if (document.body.dataset.view === view) {
- syncNaturalResearch();
- return;
- }
- rememberConversationScroll();
- document.body.dataset.view = view;
- syncNaturalResearch();
- if (view === 'run') setMobileView('compose');
- if (view === 'draft' && settling) setMobileView('compose');
- restoreConversationScroll();
-}
-function renderDetail(force = false) {
- syncView();
- syncAddress();
- renderConversation();
- const run = currentRun();
- const conversation = element('#research-conversation-panel');
- conversation.hidden = !run && researchEntry !== 'natural';
- if (sourceComparison && sourceComparison.runId !== run?.id) sourceComparison = undefined;
- if (!run) {
- collaborationView?.update();
- trajectoryView?.update();
- activityReader?.update();
- state.panelSignature = '';
- if (state.session && !opening()) renderDraftPreview();
- else if (!element('#run-detail').querySelector(':scope > .detail-connecting')) {
- const detail = element('#run-detail');
- unmountRunHeader(detail);
- detail.textContent = '';
- renderConnecting(detail);
- sourceReader.update();
- }
- return;
- }
- chatWorkspace?.observe(run);
- const detail = element('#run-detail');
- const focused =
- document.activeElement instanceof HTMLElement && detail.contains(document.activeElement)
- ? document.activeElement
- : undefined;
- const focusId = focused?.id;
- const focusAction = focused?.dataset.action;
- const newDetail = detail.dataset.renderRunId !== run.id || !detail.querySelector('#detail-panel');
- if (newDetail) {
- collaborationView?.update();
- moduleView?.update();
- finishMotion(detail);
- unmountRunHeader(detail);
- detail.textContent = '';
- renderRunHeader(run);
- const panel = document.createElement('div');
- panel.className = 'detail-panel';
- panel.id = 'detail-panel';
- panel.setAttribute('role', 'tabpanel');
- panel.tabIndex = 0;
- detail.append(panel);
- detail.dataset.renderRunId = run.id;
- state.panelSignature = '';
- } else renderRunHeader(run);
- element('#detail-panel').setAttribute('aria-labelledby', `detail-tab-${state.tab}`);
- renderPanel(force);
- if (focused?.isConnected) focused.focus({ preventScroll: true });
- else if (focusId) document.getElementById(focusId)?.focus({ preventScroll: true });
- else if (focusAction)
- detail.querySelector(`[data-action="${focusAction}"]`)?.focus({ preventScroll: true });
-}
-function renderRunHeader(run: WebRun) {
- const value = status(run),
- progress = runProgress(run),
- cancelling = state.cancelling.has(run.id);
- drawRunHeader(element('#run-detail'), {
- title: run.title,
- id: run.id,
- updated: run.updatedAt,
- error: state.detailError,
- status: { key: `${run.status}:${run.phase}:${value.label}`, ...value },
- stages: progress.steps.map(step => ({
- label: step.label,
- state: step.state,
- clock: step.elapsed === null ? '' : formatDuration(step.elapsed),
- ...(step.id === 'solving' && run.maxRunSeconds > 0 ? { budget: formatDuration(run.maxRunSeconds * 1000) } : {}),
- })),
- elapsed: formatDuration(progress.elapsed),
- tabs: detailTabs(),
- tab: state.tab,
- active: activeRun(run),
- cancelling,
- deleting: state.deleting.has(run.id),
- connected: state.connected,
- download: run.result || !activeRun(run) ? downloadUrl(run.id) : undefined,
- shareable: !isSample(run) && isAcceptedRun(run) && isStatementReviewed(run) && Boolean(run.result?.proof),
- sample: isSample(run),
- guidanceAvailable: !webSkillWithoutCooperation(run),
- ...(stalledMinutes(run) !== undefined ? { stalled: stalledMinutes(run)! } : {}),
- ...(run.formalizationId ? { formalizationId: run.formalizationId } : {}),
- ...(run.budgetOrigin && !isSample(run) ? { budgetAttempt: { run, request: api } } : {}),
- ...(run.libraryProposalOrigin && !isSample(run) ? { libraryProposalAttempt: { run, request: api } } : {}),
- // The sample's Agents were offline scripts; its recorded token counts would read as a real cost.
- ...(!isSample(run) && runTokens(run)
- ? {
- tokens: {
- used: formatTokens(runTokens(run)!),
- ...(run.maxTotalTokens ? { cap: formatTokens(run.maxTotalTokens) } : {}),
- },
- }
- : {}),
- ...(approvalProps(run) ? { approval: approvalProps(run)! } : {}),
- ...(run.continueFrom
- ? {
- continuation: {
- label: run.continueFrom.label,
- ...(state.runs.some(item => item.id === run.continueFrom!.runId) ? { runId: run.continueFrom.runId } : {}),
- },
- }
- : {}),
- });
-}
-const approvalErrors: Record = {
- math_plan_approval_version_conflict: t('批准没有生效:你批准之前计划又改过了。请看一遍新的计划再批准。'),
- math_plan_approval_plan_unavailable: t('批准没有生效:计划还没有拟好。'),
- math_plan_approval_already_approved: t('这份计划已经批准过了。'),
- math_plan_approval_run_inactive: t('批准没有生效:运行已经结束。'),
- math_plan_approval_limit: t('批准没有生效:这次运行的批准次数已用完。'),
-};
-const approvalError = (reason?: string) => approvalErrors[reason ?? ''] ?? t('批准没有生效,请刷新后再试。');
-/** Research pages already use this stable identity for their saved approvals, including anonymous sessions. */
-function personalApprovalOwner() {
- const session = state.session;
- if (!session) return;
- if (
- personalApprovalIdentity?.session !== session &&
- (!personalApprovalIdentity || !sameSession(personalApprovalIdentity.session))
- ) {
- const identity = { session, loading: true } as NonNullable;
- personalApprovalIdentity = identity;
- void api<{ authenticated: boolean; researcherId: string | null }>('/api/research/session')
- .then(result => {
- if (personalApprovalIdentity !== identity || !sameSession(session)) return;
- if (!result.authenticated || !result.researcherId)
- throw new Error(tx('请重新登录后核对原批准。', 'Sign in again to check the original approval.'));
- identity.owner = result.researcherId;
- })
- .catch(cause => {
- if (personalApprovalIdentity === identity && sameSession(session)) identity.error = message(cause);
- })
- .finally(() => {
- if (personalApprovalIdentity === identity && sameSession(session)) {
- identity.loading = false;
- renderDetail();
- }
- });
- }
- return personalApprovalIdentity;
-}
-const approvalViewKey = (owner: string, runId: string) => JSON.stringify([owner, runId]);
-function resolvePersonalApproval(
- owner: string,
- run: WebRun,
- view: PersonalApprovalView,
- attempt: PersonalApprovalAttempt,
- receipt: WebCommandResult,
-) {
- if (view.pending?.id !== attempt.id) return;
- const settled = personalApprovalSettled(attempt, receipt);
- view.receipt = receipt;
- if (settled) {
- if (receipt.status !== 'approved') requirePersonalApprovalReview(localStorage, owner, run.id);
- removePersonalApproval(localStorage, owner, run.id, attempt.id);
- view.pending = undefined;
- view.reviewRequired = receipt.status !== 'approved';
- view.reviewedVersion = undefined;
- view.error = receipt.status === 'approved' ? undefined : approvalError(receipt.reason);
- } else
- view.error =
- receipt.status === 'unknown'
- ? tx(
- '原批准结果尚未确认,请先核对这次决定。',
- 'The original approval is unconfirmed. Check its result before submitting another decision.',
- )
- : undefined;
-}
-function personalApprovalView(owner: string, run: WebRun) {
- const key = approvalViewKey(owner, run.id);
- let view = state.approving.get(key);
- if (!view) {
- view = { busy: false, checked: false };
- state.approving.set(key, view);
- }
- try {
- const original = readPersonalApproval(localStorage, owner, run.id);
- view.reviewRequired = personalApprovalNeedsReview(localStorage, owner, run.id);
- if (original && original.id !== view.pending?.id) {
- view.pending = original;
- view.receipt = undefined;
- view.checked = false;
- view.error = undefined;
- view.reviewedVersion = undefined;
- }
- view.storageError = false;
- if (view.pending) {
- const receipt = observedPersonalApproval(view.pending, run.observation);
- if (receipt) resolvePersonalApproval(owner, run, view, view.pending, receipt);
- }
- } catch {
- view.storageError = true;
- view.error = tx(
- '无法读取原批准记录,请恢复浏览器存储后重新核对。',
- 'The original approval record could not be read. Restore browser storage and check again.',
- );
- }
- if (view.pending && !view.checked && !view.busy && !view.storageError) {
- view.checked = true;
- queueMicrotask(() => {
- void checkWorkbenchApproval(run, false);
- });
- }
- return view;
-}
-/** Both entry points retain the same original command, even when the current plan has moved on. */
-async function checkWorkbenchApproval(run: WebRun, retry = true) {
- const identity = personalApprovalOwner();
- if (!identity?.owner) {
- if (identity && !identity.loading) {
- personalApprovalIdentity = undefined;
- personalApprovalOwner();
- renderDetail();
- }
- return;
- }
- const owner = identity.owner,
- session = state.session;
- const view = personalApprovalView(owner, run),
- attempt = view.pending;
- if (view.busy || view.storageError || !attempt) {
- renderDetail();
- return;
- }
- view.busy = true;
- view.error = undefined;
- renderDetail();
- try {
- const current = currentRun()?.id === run.id ? currentRun()! : run,
- pending = planAwaitingApproval(current);
- const receipt = await checkPersonalApproval({
- root: `/api/runs/${encodeURIComponent(run.id)}`,
- attempt,
- request: api,
- retry,
- currentPlanVersion:
- state.connected &&
- pending &&
- !pending.leadRevising &&
- current.observation?.plan?.baseVersion === pending.planVersion
- ? pending.planVersion
- : undefined,
- missing: cause => cause instanceof ApiError && cause.status === 404,
- });
- if (!sameSession(session) || personalApprovalIdentity !== identity) return;
- if (receipt) {
- resolvePersonalApproval(owner, current, view, attempt, receipt);
- if (receipt.observation) receiveRunObservation(receipt.observation);
- } else
- view.error = tx(
- '暂未找到原批准回执;原请求和计划版本仍已保留。',
- 'The original receipt is not available yet. Its request and plan version are retained.',
- );
- } catch (cause) {
- if (sameSession(session) && personalApprovalIdentity === identity) view.error = message(cause);
- } finally {
- view.busy = false;
- if (sameSession(session) && personalApprovalIdentity === identity) renderDetail();
- }
-}
-/** The banner also stays available to reconcile an older decision after the current plan changes. */
-function approvalProps(run: WebRun): RunHeaderProps['approval'] {
- if (!run.nativeTeamCapacity && webSkillWithoutCooperation(run)) return;
- const approval = planAwaitingApproval(run),
- observation = run.observation;
- if (
- !observation ||
- isSample(run) ||
- (!approval && !run.planApproval && !observation.inspection.planApproval?.required)
- )
- return;
- const identity = personalApprovalOwner(),
- view = identity?.owner ? personalApprovalView(identity.owner, run) : undefined;
- if (!approval && !view?.pending) return;
- const needsReview = Boolean(
- view?.reviewRequired || (view?.reviewedVersion && view.reviewedVersion !== approval?.planVersion),
- );
- const error = identity?.error ?? view?.error;
- return {
- tasks: observation.plan?.tasks.length ?? observation.inspection.tasks.length,
- nativeTeam: Boolean(run.nativeTeamCapacity),
- revising: approval?.leadRevising ?? false,
- busy: !identity?.owner || Boolean(view?.pending || view?.storageError || needsReview || view?.busy),
- checking: identity?.loading || view?.busy,
- reviewable: Boolean(
- approval &&
- observation.plan &&
- observation.plan.baseVersion === approval.planVersion &&
- observation.plan.baseVersion === observation.inspection.planVersion,
- ),
- ...(error ? { error } : {}),
- ...(view?.pending
- ? { original: { ...view.pending, ...(view.receipt ? { status: view.receipt.status } : {}) } }
- : {}),
- ...(view?.pending || view?.storageError || identity?.error
- ? {
- onCheck: () => {
- void checkWorkbenchApproval(run);
- },
- }
- : {}),
- ...(needsReview && !view?.pending && !view?.storageError && approval
- ? {
- onReviewCurrent: () => {
- try {
- completePersonalApprovalReview(localStorage, identity!.owner!, run.id);
- view!.reviewRequired = false;
- view!.reviewedVersion = approval.planVersion;
- view!.error = undefined;
- } catch {
- view!.storageError = true;
- view!.error = tx(
- '未能保存核对结果,请恢复浏览器存储后再试。',
- 'Your review could not be saved. Restore browser storage and check again.',
- );
- }
- renderDetail();
- },
- }
- : {}),
- };
-}
-/** Persist before sending; a failed response can only be reconciled under this original identity. */
-async function approvePlan(run: WebRun) {
- const identity = personalApprovalOwner(),
- owner = identity?.owner,
- session = state.session;
- if (!owner) return;
- const pending = planAwaitingApproval(run),
- planVersion = run.observation?.inspection.planVersion,
- view = personalApprovalView(owner, run);
- if (
- !state.connected ||
- !pending ||
- pending.leadRevising ||
- !planVersion ||
- view.busy ||
- view.pending ||
- view.storageError ||
- view.reviewRequired ||
- (view.reviewedVersion && view.reviewedVersion !== planVersion) ||
- run.observation?.plan?.baseVersion !== planVersion ||
- pending.planVersion !== planVersion
- )
- return;
- const attempt = { id: commandId(), planVersion };
- try {
- savePersonalApproval(localStorage, owner, run.id, attempt);
- } catch {
- view.storageError = true;
- view.error = tx(
- '无法保存批准记录,本次尚未发送。请恢复浏览器存储后再试。',
- 'The approval record could not be saved, so nothing was sent. Restore browser storage and try again.',
- );
- renderDetail();
- return;
- }
- view.pending = attempt;
- view.checked = true;
- view.busy = true;
- view.error = undefined;
- view.receipt = undefined;
- renderDetail();
- try {
- const { receipt } = await api<{ receipt: WebCommandResult }>(
- `/api/runs/${encodeURIComponent(run.id)}/plan-approval`,
- { method: 'POST', body: JSON.stringify(attempt) },
- );
- if (!sameSession(session) || personalApprovalIdentity !== identity) return;
- resolvePersonalApproval(owner, run, view, attempt, receipt);
- if (receipt.observation) receiveRunObservation(receipt.observation);
- if (receipt.status === 'queued') toast(t('批准已提交,运行确认后 Agent 就开始工作'));
- } catch (cause) {
- if (sameSession(session) && personalApprovalIdentity === identity) view.error = message(cause);
- } finally {
- view.busy = false;
- if (sameSession(session) && personalApprovalIdentity === identity) renderDetail();
- }
-}
-/** Opens the guidance composer in the collaboration tab, optionally with a line of text added to its draft. */
-function closeProofViewer() {
- state.proofViewer = '';
- renderPanel(true);
- document.querySelector('#detail-panel [data-action="view-proof"]')?.focus({ preventScroll: true });
-}
-function openGuidance(run: WebRun, text?: string, notice?: string, taskId?: string) {
- state.tab = 'collaboration';
- setMobileView('runs');
- renderDetail(true);
- if (!collaborationView?.guide(run.id, text, notice, taskId))
- element('#detail-tab-collaboration').focus({ preventScroll: true });
-}
-function openCollaborationSection(run: WebRun, section: CollaborationSection, taskId?: string) {
- state.tab = 'collaboration';
- setMobileView('runs');
- renderDetail(true);
- const shown =
- section === 'reviews'
- ? collaborationView?.showStatementReview(run.id, taskId)
- : collaborationView?.showSection(run.id, section);
- if (!shown) element('#detail-tab-collaboration').focus({ preventScroll: true });
-}
-/** How the next address change is recorded: a run the reader chose adds a history entry, anything automatic replaces it. */
-let addressMode: 'push' | 'replace' = 'replace';
-function syncAddress() {
- const mode = addressMode;
- addressMode = 'replace';
- // Until the first list arrives the selection is not known yet, and a ?run= or ?sample link must survive until it is.
- if (
- !state.resumed ||
- sampleLink ||
- formalizationLink ||
- linkedLibraryReference ||
- linkedProblemDraft ||
- chatWorkspace?.id ||
- chatWorkspace?.editingProblem ||
- ((new URLSearchParams(location.search).has('chat') || readEditedProblemId(new URLSearchParams(location.search))) &&
- !chatWorkspace)
- )
- return;
- const run = currentRun(),
- search = withAddressLanguage(!run ? '' : isSample(run) ? sampleAddress : `?run=${encodeURIComponent(run.id)}`);
- if (location.search === search) return;
- history[mode === 'push' ? 'pushState' : 'replaceState'](null, '', location.pathname + search + location.hash);
-}
-function selectRun(id: string, closeHistory = true, address: 'push' | 'replace' = 'push') {
- if (!state.runs.some(run => run.id === id)) return;
- // Opened deliberately (not browsed with the arrow keys or Back), another run's document is set down in place of the last.
- const switching = address === 'push' && (id !== state.selectedId || state.composing);
- addressMode = address;
- state.composing = false;
- state.selectedId = id;
- state.selectedRun = state.runs.find(run => run.id === id);
- saveResume(() => localStorage, { selectedId: id, seenAt: new Date().toISOString() });
- state.tab = 'result';
- state.sourceView = 'proof';
- state.reportMode = 'summary';
- state.detailError = '';
- state.panelSignature = '';
- state.diffChange = 0;
- state.compare = undefined;
- renderRunList();
- renderDetail(true);
- if (closeHistory) closeHistoryDialog();
- if (switching) setMobileView('compose');
- // Phones move between their own views.
- if (switching && !historyQuery.matches) animateEntrance(element('#run-detail'), 'panel', true);
-}
-/** The server names templates, environments and the sample in Chinese; known names are shown in the interface language. */
-function localizeSession(session: WebSession): WebSession {
- return {
- ...session,
- environments: session.environments.map(environment => ({
- ...environment,
- name: localizeText(environment.name),
- description: localizeText(environment.description),
- })),
- templates: session.templates.map(template => ({
- ...template,
- name: localizeText(template.name),
- task: localizeText(template.task),
- })),
- ...(session.sample ? { sample: { ...session.sample, title: localizeText(session.sample.title) } } : {}),
- };
-}
-/** Opens the recorded sample run; it needs no API key and does not change the saved position in the user's own runs. */
-async function openSample(address: 'push' | 'replace' = 'push') {
- const sample = state.session?.sample;
- if (!sample) return;
- if (!state.sample) {
- const before = [state.selectedId, state.composing];
- try {
- const run = (await api<{ run: WebRun }>(`/api/runs/${encodeURIComponent(sample.id)}`))?.run;
- state.sample = run && {
- ...run,
- title: localizeText(run.title),
- task: localizeText(run.task),
- model: localizeText(run.model),
- };
- } catch (error) {
- toast(t('无法打开示例运行:{0}', message(error)));
- return;
- }
- // An address the page followed by itself gives way to whatever the reader opened meanwhile.
- if (!state.sample || (address === 'replace' && (before[0] !== state.selectedId || before[1] !== state.composing)))
- return;
- }
- state.composing = false;
- addressMode = address;
- state.selectedId = sample.id;
- state.selectedRun = state.sample;
- state.tab = 'result';
- state.sourceView = 'proof';
- state.reportMode = 'summary';
- state.detailError = '';
- state.panelSignature = '';
- state.diffChange = 0;
- state.compare = undefined;
- renderRunList();
- renderDetail(true);
- renderShell();
- closeHistoryDialog();
- setMobileView('compose');
-}
-function startDraft(reset = false, address: 'push' | 'replace' = 'push') {
- chatWorkspace?.home(false);
- const leaving = !state.composing;
- state.composing = true;
- addressMode = address;
- state.selectedId = '';
- state.selectedRun = undefined;
- state.tab = 'source';
- state.sourceView = 'proof';
- state.detailError = '';
- state.draftView = 'source';
- document.body.dataset.draftPreview = 'false';
- element('#open-draft-preview').setAttribute('aria-expanded', 'false');
- moduleView?.update(undefined, moduleInput());
- state.panelSignature = '';
- draftPreviewSignature = '';
- if (reset) {
- clearProblemDraftTarget(false);
- if (state.session) resetProblemDraftBinding(ownerOfSession(state.session), 'lean');
- submissionIdentity.clear();
- resetForm();
- }
- renderRunList();
- renderDetail(true);
- setMobileView('compose');
- if (leaving && !historyQuery.matches) animateEntrance(element('.workspace'), 'workspace');
-}
-async function openFormalizedDraft(id: string) {
- const revision = draftRevision;
- try {
- const { formalization } = await api<{ formalization: WebFormalization }>(
- `/api/formalizations/${encodeURIComponent(id)}`,
- );
- if (formalization.status !== 'confirmed' || !formalization.report)
- throw new Error(t('请先审阅并确认这份形式化原题。'));
- if (draftRevision !== revision) throw new Error(t('草稿已变化,未载入形式化原题。请从形式化页面重新打开。'));
- const report = formalization.report;
- const draft: TaskDraft = {
- ...captureDraft(),
- source: report.statement,
- environment: report.environment,
- templateId: '',
- ...automaticExplanationSettings(formalization, locale),
- problemBudget: undefined,
- sharedProofOrigin: undefined,
- classicOrigin: undefined,
- libraryProposalOrigin: undefined,
- task: t('证明已确认原题中的全部目标,保留所有定义、假设与声明。'),
- formalization: { id: formalization.id, evidenceSha256: report.evidenceSha256 },
- };
- delete draft.continueFrom;
- replaceDraft('import', () => applyTaskDraft(draft));
- chooseEntry('lean');
- formalizationLink = null;
- startDraft(false, 'replace');
- saveDraft();
- renderDraftRecovery();
- toast(t('已载入确认后的 Lean 原题,配置模型后即可开始证明。'));
- } catch (error) {
- formalizationLink = null;
- toast(message(error));
- }
-}
-async function openLibraryProposalDraft() {
- const feedbackId = productTarget.get('libraryProposal'),
- projectId = productTarget.get('project');
- if (
- libraryProposalHandled ||
- !feedbackId ||
- !projectId ||
- !/^[A-Za-z0-9_-]{1,128}$/u.test(feedbackId) ||
- !/^[A-Za-z0-9_-]{1,128}$/u.test(projectId)
- )
- return;
- libraryProposalHandled = true;
- const panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.libraryProposalStart = '';
- const notice = document.createElement('p');
- notice.setAttribute('role', 'status');
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'button';
- retry.hidden = true;
- retry.textContent = t('重新准备候选草稿');
- retry.dataset.retryLibraryProposal = '';
- const back = document.createElement('a');
- back.href = `theorems.html?id=${encodeURIComponent(projectId)}#feedback-${encodeURIComponent(feedbackId)}`;
- back.textContent = t('查看已评审的任务提案');
- panel.append(notice, retry, back);
- element('#run-form').prepend(panel);
- const prepare = async () => {
- if (!state.session || state.submitting) return;
- const owner = ownerOfSession(state.session),
- revision = draftRevision;
- retry.disabled = true;
- retry.hidden = true;
- notice.textContent = t('正在准备候选与固定库版本…');
- try {
- const { item } = await api<{ item: ResearchLibraryAttemptPreparation }>(
- `/api/research/theorems/${encodeURIComponent(projectId)}/library-proposals/${encodeURIComponent(feedbackId)}/prepare`,
- );
- const selected = await researchSelection.prepare(item.refs, item.environment);
- if (!state.session || ownerOfSession(state.session) !== owner || draftRevision !== revision || state.submitting)
- throw new Error(t('草稿已变化,未载入候选。请核对后重新准备。'));
- const draft: TaskDraft = {
- ...captureDraft(),
- source: item.source,
- task: item.task,
- environment: item.environment,
- templateId: '',
- modulePlan: item.modulePlan,
- formalization: undefined,
- continueFrom: undefined,
- problemBudget: undefined,
- sharedProofOrigin: undefined,
- classicOrigin: undefined,
- libraryProposalOrigin: { projectId, feedbackId, trialDigest: item.trialDigest },
- };
- const contentIssue = submissionIssues(draft, field('api-key').value, state.session).find(
- issue => issue.field === 'source' || issue.field === 'task',
- );
- if (contentIssue) throw new Error(contentIssue.message);
- replaceDraft('reuse', () => applyTaskDraft(draft, selected.configuration.environment));
- researchSelection.adopt(selected);
- chooseEntry('lean');
- startDraft(false, 'replace');
- draftChanged();
- saveDraft();
- renderDraftRecovery();
- notice.textContent = t('候选与固定库版本已载入。核对源码、模型和预算后即可开始研究。');
- panel.dataset.libraryProposalReady = 'true';
- panel.remove();
- } catch (error) {
- notice.textContent = message(error);
- retry.hidden = false;
- } finally {
- retry.disabled = false;
- }
- };
- retry.addEventListener('click', () => void prepare());
- await prepare();
-}
-function renderLibraryProposalOrigin() {
- let panel = document.querySelector('[data-library-proposal-origin]');
- const origin = draftLibraryProposalOrigin;
- if (!origin) {
- panel?.remove();
- libraryProposalOriginRead = undefined;
- return;
- }
- const tx = (zh: string, en: string) => (locale === 'en' ? en : zh);
- if (!panel) {
- panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.libraryProposalOrigin = '';
- element('#run-form').prepend(panel);
- }
- const key = JSON.stringify([state.session && ownerOfSession(state.session), origin]);
- if (libraryProposalOriginRead?.key !== key) {
- const read = (libraryProposalOriginRead = { key, status: 'loading' });
- void api<{ item: ResearchLibraryAttemptPreparation }>(
- `/api/research/theorems/${encodeURIComponent(origin.projectId)}/library-proposals/${encodeURIComponent(origin.feedbackId)}/prepare`,
- )
- .then(({ item }) => {
- if (libraryProposalOriginRead !== read) return;
- libraryProposalOriginRead = {
- key,
- status: item.trialDigest === origin.trialDigest ? 'available' : 'unavailable',
- };
- renderLibraryProposalOrigin();
- })
- .catch(() => {
- if (libraryProposalOriginRead !== read) return;
- libraryProposalOriginRead = { key, status: 'unavailable' };
- renderLibraryProposalOrigin();
- });
- }
- panel.replaceChildren();
- panel.dataset.libraryProposalOriginStatus = libraryProposalOriginRead.status;
- panel.dataset.libraryProposalReady = String(libraryProposalOriginRead.status === 'available');
- const text = document.createElement('p');
- text.textContent = tx(
- '来自已评审的 Library 候选。草稿可继续修改,新尝试会重新检查。',
- 'Prepared from a reviewed Library candidate. You can edit this draft; the new attempt will be checked again.',
- );
- panel.append(text);
- if (libraryProposalOriginRead.status === 'available') {
- const back = document.createElement('a');
- back.href = `theorems.html?id=${encodeURIComponent(origin.projectId)}#feedback-${encodeURIComponent(origin.feedbackId)}`;
- back.textContent = tx('查看来源提案', 'View the source proposal');
- panel.append(back);
- } else {
- const status = document.createElement('p');
- status.setAttribute('role', 'status');
- status.textContent =
- libraryProposalOriginRead.status === 'loading'
- ? tx('正在核对提案来源…', 'Checking the source proposal…')
- : tx(
- '暂时无法打开来源提案,草稿已保留。重试核对后再提交,或另起个人研究。',
- 'The source proposal is unavailable. Your draft is preserved. Retry the check before submitting, or start an independent personal study.',
- );
- panel.append(status);
- if (libraryProposalOriginRead.status === 'unavailable') {
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'text-button';
- retry.dataset.retryLibraryProposalOrigin = '';
- retry.textContent = tx('重新核对提案来源', 'Check the source proposal again');
- retry.addEventListener('click', () => {
- libraryProposalOriginRead = undefined;
- renderLibraryProposalOrigin();
- });
- panel.append(retry);
- }
- }
- const detach = document.createElement('button');
- detach.type = 'button';
- detach.className = 'text-button';
- detach.dataset.detachLibraryProposalOrigin = '';
- detach.textContent = tx('另起独立个人研究', 'Start an independent personal study');
- detach.addEventListener('click', () => {
- if (state.submitting) return;
- draftLibraryProposalOrigin = undefined;
- renderLibraryProposalOrigin();
- draftChanged();
- saveDraft();
- });
- panel.append(detach);
-}
-function renderSharedProofOrigin() {
- let panel = document.querySelector('[data-shared-proof-origin]');
- const origin = draftSharedProofOrigin;
- if (!origin) {
- panel?.remove();
- sharedProofOriginRead = undefined;
- return;
- }
- const tx = (zh: string, en: string) => (locale === 'en' ? en : zh);
- if (!panel) {
- panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.sharedProofOrigin = '';
- element('#run-form').prepend(panel);
- }
- const notice = document.createElement('p');
- notice.textContent = t('已载入「{0}」的原题。核对模型与预算后开始自己的研究,结果会重新检查。', origin.title);
- const key = JSON.stringify([state.session && ownerOfSession(state.session), origin.readingId, origin.digest]);
- if (sharedProofOriginRead?.key !== key) {
- const reading = (sharedProofOriginRead = { key, status: 'loading' });
- void api<{ item: SharedProofReading }>(`/api/research/shared-proofs/${encodeURIComponent(origin.readingId)}`)
- .then(({ item }) => {
- if (sharedProofOriginRead !== reading) return;
- sharedProofOriginRead = { key, status: item.digest === origin.digest ? 'available' : 'unavailable' };
- renderSharedProofOrigin();
- })
- .catch(() => {
- if (sharedProofOriginRead !== reading) return;
- sharedProofOriginRead = { key, status: 'unavailable' };
- renderSharedProofOrigin();
- });
- }
- panel.replaceChildren(notice);
- panel.dataset.sharedProofReady = String(sharedProofOriginRead.status !== 'loading');
- panel.dataset.sharedProofStatus = sharedProofOriginRead.status;
- if (sharedProofOriginRead.status === 'available') {
- const source = document.createElement('a');
- source.href = `share.html?${new URLSearchParams({ reading: origin.readingId, lang: locale })}`;
- source.textContent = t('查看来源证明');
- panel.append(source);
- } else {
- const status = document.createElement('p');
- status.setAttribute('role', 'status');
- status.textContent =
- sharedProofOriginRead.status === 'loading'
- ? tx('正在核对来源证明…', 'Checking the source proof…')
- : tx(
- '暂时无法打开来源证明,已保存的原题仍可继续编辑。',
- 'The source proof is unavailable. You can continue editing your saved problem.',
- );
- panel.append(status);
- if (sharedProofOriginRead.status === 'unavailable') {
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'text-button';
- retry.dataset.retrySharedProofOrigin = '';
- retry.textContent = tx('重新核对来源', 'Check the source again');
- retry.addEventListener('click', () => {
- sharedProofOriginRead = undefined;
- renderSharedProofOrigin();
- });
- panel.append(retry);
- }
- }
-}
-async function openSharedProofDraft() {
- const id = productTarget.get('sharedDraft');
- if (sharedDraftHandled || !id || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u.test(id)) return;
- sharedDraftHandled = true;
- const panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.sharedProofStart = '';
- const notice = document.createElement('p');
- notice.setAttribute('role', 'status');
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'button';
- retry.hidden = true;
- retry.textContent = t('重新读取分享研究草稿');
- panel.append(notice, retry);
- element('#run-form').prepend(panel);
- const prepare = async () => {
- if (!state.session || state.submitting) return;
- const owner = ownerOfSession(state.session),
- revision = draftRevision;
- retry.disabled = true;
- retry.hidden = true;
- notice.textContent = t('正在读取分享的原题…');
- try {
- const { item } = await api<{ item: SharedProofPreparation }>(
- `/api/research/shared-proofs/preparations/${encodeURIComponent(id)}`,
- );
- if (!state.session || ownerOfSession(state.session) !== owner || draftRevision !== revision || state.submitting)
- throw new Error(t('草稿已变化,未载入分享原题。请核对后重新读取。'));
- const draft: TaskDraft = {
- ...captureDraft(),
- source: item.source,
- task: item.task,
- environment: item.environment,
- templateId: '',
- modulePlan: undefined,
- knowledgeDigest: undefined,
- formalization: undefined,
- continueFrom: undefined,
- problemBudget: undefined,
- libraryProposalOrigin: undefined,
- classicOrigin: undefined,
- sharedProofOrigin: { readingId: item.origin.readingId, title: item.origin.title, digest: item.origin.digest },
- };
- const contentIssue = submissionIssues(draft, field('api-key').value, state.session).find(
- issue => issue.field === 'source' || issue.field === 'task',
- );
- if (contentIssue) throw new Error(contentIssue.message);
- replaceDraft('reuse', () => applyTaskDraft(draft));
- researchSelection.clear();
- formalizationLink = null;
- chooseEntry('lean');
- startDraft(false, 'replace');
- draftChanged();
- saveDraft();
- renderDraftRecovery();
- panel.remove();
- // A refresh restores the edited draft; it must not import the original a second time.
- const cleaned = new URL(location.href);
- cleaned.searchParams.delete('sharedDraft');
- history.replaceState(null, '', cleaned);
- } catch (error) {
- notice.textContent = message(error);
- retry.hidden = false;
- } finally {
- retry.disabled = false;
- }
- };
- retry.addEventListener('click', () => void prepare());
- await prepare();
-}
-function showClassicOrigin() {
- const id = readClassicId(new URLSearchParams(location.search)) ?? draftClassicOrigin?.id;
- if (!id || !state.session) return;
- const existing = document.querySelector('[data-classic-origin]');
- if (existing?.dataset.classicOrigin === id) return;
- existing?.remove();
- const owner = ownerOfSession(state.session),
- tx = (zh: string, en: string) => (locale === 'en' ? en : zh);
- const panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.classicOrigin = '';
- panel.dataset.classicOrigin = id;
- const heading = document.createElement('strong');
- heading.textContent =
- draftClassicOrigin?.id === id
- ? draftClassicOrigin.title
- : tx('从经典题开始研究', 'Start research from a classic problem');
- const text = document.createElement('p');
- text.setAttribute('role', 'status');
- text.textContent = tx('正在读取原题…', 'Loading the original problem…');
- const back = document.createElement('a');
- back.href = `classics/${locale === 'en' ? 'en/' : ''}archive.html#${new URLSearchParams({ proof: id, tab: 'process' })}`;
- back.textContent = t('返回来源题目');
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'text-button';
- retry.hidden = true;
- retry.textContent = tx('重新读取原题', 'Load the original problem again');
- panel.append(heading, text, back, retry);
- element('.workbench').before(panel);
- const load = async () => {
- retry.hidden = true;
- retry.disabled = true;
- try {
- const prepared = await loadClassicPreparation(id, locale);
- if (!panel.isConnected || !state.session || ownerOfSession(state.session) !== owner) return;
- heading.textContent = prepared.origin.title;
- const applied = draftClassicOrigin?.id === id;
- panel.dataset.classicReady = String(applied);
- text.textContent = applied
- ? tx(
- '原题草稿已保留。核对模型与预算后开始研究。',
- 'Your problem draft is saved. Review the model and budget before starting research.',
- )
- : prepared.summary;
- const preview = document.createElement('details');
- preview.dataset.classicPreview = '';
- const summary = document.createElement('summary');
- summary.textContent = tx('预览原题与 Lean 声明', 'Preview the original problem and Lean statements');
- const source = document.createElement('pre');
- source.className = 'classic-preparation-source';
- source.textContent = prepared.source;
- const note = document.createElement('p');
- note.textContent = tx(
- '载入后可编辑,当前 Lean 草稿可撤销恢复。',
- 'You can edit after loading. Your current Lean draft can be restored with Undo.',
- );
- const confirm = document.createElement('button');
- confirm.type = 'button';
- confirm.className = 'button';
- confirm.dataset.classicConfirm = '';
- confirm.textContent = applied
- ? tx('重新载入原题草稿', 'Reload the original problem into a draft')
- : tx('载入原题草稿', 'Load the original problem into a draft');
- confirm.addEventListener('click', () => {
- if (!state.session || ownerOfSession(state.session) !== owner || state.submitting) return;
- const draft: TaskDraft = {
- ...captureDraft(),
- source: prepared.source,
- task: prepared.task,
- environment: 'mathlib',
- templateId: '',
- modulePlan: undefined,
- knowledgeDigest: undefined,
- formalization: undefined,
- continueFrom: undefined,
- problemBudget: undefined,
- sharedProofOrigin: undefined,
- libraryProposalOrigin: undefined,
- classicOrigin: prepared.origin,
- };
- replaceDraft('reuse', () => applyTaskDraft(draft));
- researchSelection.clear();
- formalizationLink = null;
- chooseEntry('lean');
- startDraft(false, 'replace');
- draftChanged();
- saveDraft();
- renderDraftRecovery();
- });
- preview.append(summary, source, note, confirm);
- panel.append(preview);
- } catch (error) {
- if (panel.isConnected) {
- text.textContent = message(error);
- retry.hidden = false;
- }
- } finally {
- retry.disabled = false;
- }
- };
- retry.addEventListener('click', () => void load());
- void load();
-}
-async function openRecoveryEntry() {
- const id = productTarget.get('run'),
- action = productTarget.get('recovery');
- if (
- recoveryEntryHandled ||
- !id ||
- !action ||
- !/^(?:continue-checked|ask-failed|key|retry|budget|tokens|turns|workers|source|task)$/u.test(action)
- )
- return;
- await naturalPage;
- const run = currentRun();
- if (!run || run.id !== id || isSample(run) || !state.runs.some(item => item.id === id)) return;
- recoveryEntryHandled = true;
- const cleaned = new URL(location.href);
- cleaned.searchParams.delete('recovery');
- history.replaceState(null, '', cleaned);
- if (!nextSteps(run, summarizeGoals(run)).some(item => item.id === action)) {
- toast(t('研究状态已更新,请查看当前可用的后续操作。'));
- return;
- }
- const button = document.createElement('button');
- await recoverRun(run, action, button);
-}
-async function openLibraryPersonalAttemptDraft() {
- const trialId = productTarget.get('libraryTrial'),
- digest = productTarget.get('trialDigest');
- if (
- libraryTrialHandled ||
- !trialId ||
- !/^[A-Za-z0-9_-]{1,128}$/u.test(trialId) ||
- !digest ||
- !/^[a-f0-9]{64}$/u.test(digest)
- )
- return;
- libraryTrialHandled = true;
- const panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.libraryTrialStart = '';
- const notice = document.createElement('p');
- notice.setAttribute('role', 'status');
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'button';
- retry.hidden = true;
- retry.textContent = t('重新准备试用草稿');
- retry.dataset.retryLibraryTrial = '';
- const back = document.createElement('a');
- back.href = `workspace.html?tab=trials&trial=${encodeURIComponent(trialId)}`;
- back.textContent = t('查看这次试用的固定记录');
- panel.append(notice, retry, back);
- element('#run-form').prepend(panel);
- const prepare = async () => {
- if (!state.session || state.submitting) return;
- const owner = ownerOfSession(state.session),
- revision = draftRevision;
- retry.disabled = true;
- retry.hidden = true;
- notice.textContent = t('正在准备候选与固定库版本…');
- try {
- const { item } = await api<{ item: ResearchLibraryPersonalAttemptPreparation }>(
- `/api/research/library-trials/${encodeURIComponent(trialId)}/prepare-attempt?digest=${encodeURIComponent(digest)}`,
- );
- const selected = await researchSelection.prepare(item.refs, item.environment);
- if (!state.session || ownerOfSession(state.session) !== owner || draftRevision !== revision || state.submitting)
- throw new Error(t('草稿已变化,未载入候选。请核对后重新准备。'));
- const draft: TaskDraft = {
- ...captureDraft(),
- source: item.source,
- task: item.task,
- environment: item.environment,
- templateId: '',
- modulePlan: item.modulePlan,
- formalization: undefined,
- continueFrom: undefined,
- problemBudget: undefined,
- libraryProposalOrigin: undefined,
- sharedProofOrigin: undefined,
- classicOrigin: undefined,
- };
- const contentIssue = submissionIssues(draft, field('api-key').value, state.session).find(
- issue => issue.field === 'source' || issue.field === 'task',
- );
- if (contentIssue) throw new Error(contentIssue.message);
- replaceDraft('reuse', () => applyTaskDraft(draft, selected.configuration.environment));
- researchSelection.adopt(selected);
- formalizationLink = null;
- chooseEntry('lean');
- startDraft(false, 'replace');
- draftChanged();
- saveDraft();
- renderDraftRecovery();
- notice.textContent = t('候选与固定库已载入新尝试草稿。核对模型和预算后,再发送研究任务;原题验收会重新进行。');
- panel.dataset.libraryTrialReady = 'true';
- } catch (error) {
- notice.textContent = message(error);
- retry.hidden = false;
- } finally {
- retry.disabled = false;
- }
- };
- retry.addEventListener('click', () => void prepare());
- await prepare();
-}
-async function openBudgetAttemptDraft() {
- const runId = productTarget.get('budgetRun'),
- projectId = productTarget.get('project') ?? undefined,
- tokens = Number(productTarget.get('budgetTokens'));
- if (
- budgetDraftHandled ||
- !runId ||
- !runIdPattern.test(runId) ||
- !Number.isSafeInteger(tokens) ||
- tokens < 10_000 ||
- tokens > 1e12
- )
- return;
- budgetDraftHandled = true;
- const panel = document.createElement('aside');
- panel.className = 'composer-research-selection';
- panel.dataset.budgetAttemptStart = '';
- const notice = document.createElement('p');
- notice.setAttribute('role', 'status');
- const retry = document.createElement('button');
- retry.type = 'button';
- retry.className = 'button';
- retry.hidden = true;
- retry.textContent = t('重新准备预算草稿');
- panel.append(notice, retry);
- element('#run-form').prepend(panel);
- const prepare = async () => {
- if (!state.session || state.submitting) return;
- const owner = ownerOfSession(state.session),
- revision = draftRevision;
- retry.disabled = true;
- retry.hidden = true;
- notice.textContent = t('正在读取原题与预算…');
- try {
- if (tokens > state.session.limits.maxTotalTokens)
- throw new Error(t('规划的 Token 超过本次运行上限,请返回题目页调整。'));
- await api(
- `/api/research/workspace/problem/${encodeURIComponent(runId)}/budget${projectId ? `?project=${encodeURIComponent(projectId)}` : ''}`,
- );
- let run: WebRun,
- own = true;
- try {
- run = (await api<{ run: WebRun }>(`/api/runs/${encodeURIComponent(runId)}`)).run;
- } catch (error) {
- if (!projectId || !(error instanceof ApiError) || ![403, 404].includes(error.status)) throw error;
- own = false;
- const result = await api<{ run?: WebRun }>(
- `/api/research/theorems/${encodeURIComponent(projectId)}/runs/${encodeURIComponent(runId)}`,
- );
- if (!result.run) throw new Error(t('研究记录不存在或不属于当前会话。'));
- run = { ...result.run, formalization: undefined, formalizationId: undefined };
- }
- const configuration = own ? run.researchConfiguration : undefined;
- const refs = configurationRefs(configuration);
- const selected = refs.length
- ? await researchSelection.prepare(
- refs,
- run.environment,
- usesNativeTeam(isSample(run) ? field('provider').value : run.providerId),
- )
- : undefined;
- if (!state.session || ownerOfSession(state.session) !== owner || draftRevision !== revision || state.submitting)
- throw new Error(t('草稿已变化,未载入预算规划。请核对后重新准备。'));
- const issue = submissionIssues({ ...captureDraft(), source: run.source, task: run.task }, '', state.session).find(
- issue => issue.field === 'source' || issue.field === 'task',
- );
- if (issue) throw new Error(issue.message);
- applyReusedRun(run);
- if (selected) researchSelection.adopt(selected);
- else researchSelection.clear();
- budgetDraftOrigin = { runId, projectId, source: run.source, environment: run.environment };
- field('max-tokens').value = String(tokens / 10_000);
- draftChanged();
- saveDraft();
- renderDraftRecovery();
- notice.textContent = projectId
- ? t('已将项目原题准备为个人尝试。核对模型、Library 和预算后可开始,随后可将新运行关联到项目。')
- : t('已准备原题、执行配置与本次预算。核对后即可发送研究任务。');
- panel.dataset.budgetAttemptReady = 'true';
- } catch (error) {
- notice.textContent = message(error);
- retry.hidden = false;
- } finally {
- retry.disabled = false;
- }
- };
- retry.addEventListener('click', () => void prepare());
- await prepare();
-}
-const currentConnection = (epoch: number) => pageActive && epoch === state.connectionEpoch;
-const sessionFailure = (error: unknown) =>
- error instanceof ApiError && (error.status === 401 || (error.status === 403 && error.reason.includes('会话校验')));
-function invalidateReads() {
- liveRefreshPending = false;
- lastRunsReadAt = -Infinity;
- runsReadRetryAt = 0;
- runUpdates.stop();
- clearTimeout(pollTimer);
- state.connectionEpoch++;
- state.listGeneration++;
- state.runsEtag = '';
- readController.abort();
- readController = new AbortController();
- state.refreshing = false;
-}
-function disconnected(text: string) {
- state.connected = false;
- state.lost = true;
- runUpdates.stop();
- liveRefreshPending = false;
- workbenchConnecting.hidden = true;
- setGlobalNotice(text);
- element('#runs-error').textContent = t('连接中断,记录可能不是最新状态');
- element('#runs-error').hidden = false;
- renderRuntime();
- renderDetail();
-}
-function receiveRunObservation(observation: WebObservation) {
- const previous = state.runs.find(run => run.id === observation.webRunId);
- const solverRunId = previous?.solverAttempt?.solverRunId ?? previous?.observation?.solverRunId;
- if (
- !previous ||
- (solverRunId && solverRunId !== observation.solverRunId) ||
- (previous.solverAttempt && observation.sequence < previous.solverAttempt.sequence) ||
- (previous.observation && previous.observation.sequence >= observation.sequence)
- )
- return;
- const run = {
- ...previous,
- observation,
- updatedAt: previous.updatedAt > observation.observedAt ? previous.updatedAt : observation.observedAt,
- };
- state.runs = state.runs.map(item => (item.id === run.id ? run : item));
- if (state.selectedId === run.id) state.selectedRun = run;
- // This observation may be the first to show the plan waiting; the next list read compares against it.
- for (const waiting of newlyWaiting([previous], [run])) announceWaiting(waiting);
- renderRunList();
- renderDetail();
-}
-/** `listed` is the list the session reply carried (first connection); without it the list is read, as a 304 when unchanged. */
-async function refreshRuns(epoch: number, force = false, listed?: WebSession['runs']) {
- const generation = ++state.listGeneration;
- let etag: string | null = listed?.version ?? null;
- if (!listed) lastRunsReadAt = Date.now();
- const result =
- listed ??
- (await api<{ runs: WebRun[] }>(
- '/api/runs',
- {
- headers: !force && state.runsEtag ? { 'If-None-Match': state.runsEtag } : {},
- },
- value => {
- etag = value;
- },
- ));
- if (generation !== state.listGeneration || !currentConnection(epoch)) return;
- state.runsEtag = etag ?? '';
- runsReadRetryAt = 0;
- element('#runs-error').hidden = true;
- if (!result) return;
- const previous = state.runs;
- const byId = new Map(previous.map(run => [run.id, run]));
- state.runs = result.runs
- .map(run => retainLatestRun(run, byId.get(run.id)))
- .sort((a, b) => b.createdAt.localeCompare(a.createdAt));
- // The first list is the history as it stands; only later ones bring arrivals.
- if (state.resumed) for (const run of state.runs) if (!byId.has(run.id)) arrivals.add(run.id);
- const resume = state.resumed ? undefined : readResume(() => localStorage);
- if (
- !state.resumed &&
- !state.composing &&
- !state.selectedId &&
- resume &&
- state.runs.some(run => run.id === resume.selectedId)
- ) {
- state.selectedId = resume.selectedId;
- state.tab = 'result';
- state.sourceView = 'proof';
- state.reportMode = 'summary';
- state.panelSignature = '';
- }
- if (
- !state.composing &&
- !sampleSelected() &&
- (!state.selectedId || !state.runs.some(run => run.id === state.selectedId))
- ) {
- state.selectedId = state.runs[0]?.id ?? '';
- state.tab = 'result';
- state.sourceView = 'proof';
- state.reportMode = 'summary';
- state.panelSignature = '';
- }
- state.selectedRun = sampleSelected() ? state.sample : state.runs.find(run => run.id === state.selectedId);
- // A run deleted elsewhere, or whose DELETE response was lost, leaves the list here.
- if (chatWorkspace?.runId && byId.has(chatWorkspace.runId)) leaveDeletedChat(chatWorkspace.runId);
- rememberFinishedRuns(previous);
- for (const run of newlyFinished(previous, state.runs)) announceFinished(run);
- for (const run of newlyWaiting(previous, state.runs)) announceWaiting(run);
- if (!state.resumed) {
- state.resumed = true;
- const away = resume ? finishedSince(state.runs, resume.seenAt) : [];
- for (const run of away) if (run.id !== state.selectedId) state.finishedRuns.add(run.id);
- // A ?run= address for a record this account does not have (deleted, or someone else's) opens the latest one instead.
- if (linkedRun && !state.runs.some(run => run.id === linkedRun)) toast(t('没有找到链接里的研究记录'));
- else if (away.length)
- toast(
- away.length === 1 ? t('离开期间「{0}」已结束', away[0].title) : t('离开期间有 {0} 项研究已结束', away.length),
- );
- // Until the sample has loaded, the page shows the run below it and keeps the sample's address.
- if (sampleLink && state.session?.sample)
- void openSample('replace').finally(() => {
- sampleLink = false;
- renderDetail();
- });
- else sampleLink = false;
- }
- // Nothing to resume until the account has a run; an empty history leaves storage untouched.
- // The sample is not a run to come back to; keep the last real selection but still record when the user was here.
- if (state.runs.length)
- saveResume(() => localStorage, {
- selectedId: sampleSelected()
- ? (readResume(() => localStorage)?.selectedId ?? state.runs[0].id)
- : state.selectedId,
- seenAt: new Date().toISOString(),
- });
- state.detailError = '';
- element('#runs-error').hidden = true;
- renderRunList();
- renderDetail();
- renderDeleteState();
- renderCancelState();
- renderBudgetEstimate();
-}
-async function poll(force = false) {
- if (!pageActive || !navigator.onLine) return;
- if (connectionRequest) return connectionRequest;
- if (!state.connected) return initialize();
- if (state.refreshing) return;
- if (!force && runsReadRetryAt > Date.now()) {
- schedulePoll();
- return;
- }
- const epoch = state.connectionEpoch;
- liveRefreshPending = false;
- state.refreshing = true;
- element('#refresh-runs').disabled = true;
- try {
- await refreshRuns(epoch, force);
- } catch (error) {
- if (!currentConnection(epoch)) return;
- if (sessionFailure(error)) {
- disconnected(t('{0}。未提交内容已保留。', clause(message(error))));
- await initialize();
- return;
- }
- // A failed list refresh leaves the last list and the open conversation usable.
- const cooldown = error instanceof ApiError ? error.retryAt : 0;
- const now = Date.now();
- const retryDelay = runsReadRetryAt ? 30_000 : document.hidden ? 15_000 : 5000;
- runsReadRetryAt = cooldown > now ? cooldown : now + retryDelay;
- const notice = element('#runs-error');
- notice.textContent =
- error instanceof ApiError && (error.status === 429 || cooldown) ? error.message : t('研究记录暂未更新');
- notice.hidden = false;
- } finally {
- if (currentConnection(epoch)) {
- state.refreshing = false;
- schedulePoll();
- }
- element('#refresh-runs').disabled =
- !pageActive || Boolean(connectionRequest) || state.refreshing;
- }
-}
-function requestRunsRefresh() {
- liveRefreshPending = true;
- schedulePoll();
-}
-function schedulePoll() {
- clearTimeout(pollTimer);
- if (!pageActive || !navigator.onLine || connectionRequest || state.refreshing) return;
- // A hidden tab keeps a slow poll while runs are active, so their end still reaches the title and notifications.
- const hidden = document.hidden;
- const active = state.connected && state.runs.some(activeRun);
- if (hidden && !active) return;
- const now = Date.now();
- const runsRetryAt = Math.max(runsReadRetryAt, cooldownFor('GET /api/runs')?.retryAt ?? 0);
- const sessionRetryAt = cooldownFor('GET /api/session')?.retryAt ?? 0;
- const retryAt = state.connected ? runsRetryAt : Math.max(sessionRetryAt, state.session ? runsRetryAt : 0);
- const live = !hidden && state.connected && liveRefreshPending;
- const interval = hidden ? 30_000 : runUpdates.connected ? 30_000 : active ? 3_000 : 12_000;
- // Give live updates a trailing refresh at a fixed interval. New events keep that deadline.
- const next = live ? lastRunsReadAt + liveRefreshIntervalMs : retryAt > now ? retryAt : now + interval;
- const delay = Math.max(next, retryAt) - now;
- if (delay <= 0) {
- void poll();
- return;
- }
- pollTimer = setTimeout(() => void poll(), Math.min(delay, 2_147_483_647));
-}
-function initialize(): Promise {
- if (connectionRequest) return connectionRequest;
- if (!pageActive) return Promise.resolve();
- const reconnecting = Boolean(state.session);
- invalidateReads();
- const epoch = state.connectionEpoch;
- state.connected = false;
- workbenchConnecting.hidden = false;
- element('#retry-connection').disabled = true;
- element('#refresh-runs').disabled = true;
- connectionRequest = (async () => {
- try {
- if (!navigator.onLine) throw new Error(t('网络已断开'));
- // The first connection takes the run list in the session reply, one round trip instead of two. A reconnect may bring
- // another session (and account), and reads the list itself, as a 304 when nothing changed.
- const { runs: listed, ...reply } = await api(state.session ? '/api/session' : '/api/session?runs', {
- firstResponseTimeoutMs: 6000,
- });
- const session = localizeSession(reply);
- if (!currentConnection(epoch)) return;
- if (session.auth === 'email' && (!session.account || session.termsRequired)) {
- saveDraft();
- draftReady = false;
- forgetKey(keyStorage);
- location.replace(loginAddress());
- return;
- }
- const ownerChanged = Boolean(state.session && ownerOfSession(state.session) !== ownerOfSession(session));
- const firstLoad = !state.session || ownerChanged;
- let storedOwnerChanged = false;
- if (!state.session) {
- try {
- storedOwnerChanged = sessionStorage.getItem(draftOwnerStorageKey) !== ownerOfSession(session);
- } catch {
- /* Unavailable storage cannot restore a previous owner's draft. */
- }
- // Only the signed-in account's former email scope identifies an owner; old anonymous keys are unbound.
- if (session.account?.email && !storedOwnerChanged)
- try {
- const previous = session.account.email,
- owner = ownerOfSession(session);
- for (const key of Object.keys(sessionStorage)) {
- const prefix = ['theorem-os.chat-draft.', 'theorem-os.chat-reading.'].find(value =>
- key.startsWith(`${value}${previous}.`),
- );
- const target = prefix
- ? `${prefix}${owner}.${key.slice(`${prefix}${previous}.`.length)}`
- : key === `theorem-os.chat-submission.v1.${previous}`
- ? `theorem-os.chat-submission.v1.${owner}`
- : undefined;
- if (target && target !== key) {
- if (sessionStorage.getItem(target) === null)
- sessionStorage.setItem(target, sessionStorage.getItem(key)!);
- sessionStorage.removeItem(key);
- }
- }
- } catch {
- /* The current owner can still start without browser storage. */
- }
- }
- if (ownerChanged || storedOwnerChanged) {
- clearOwnedDrafts();
- state.submitting = false;
- }
- ownedDrafts.bind(ownerOfSession(session));
- if (state.session && state.session.csrfToken !== session.csrfToken) {
- chatWorkspace?.clearRecentConversations();
- state.runs = [];
- state.selectedId = '';
- state.selectedRun = undefined;
- state.finishedRuns.clear();
- state.cancelling.clear();
- state.detailError = '';
- state.panelSignature = '';
- renderRunList();
- renderDetail();
- if (!ownerChanged) toast(t('会话已更新,未提交内容已保留'));
- }
- state.session = session;
- if (session.account) void syncProblemDraftSubmissions(ownerOfSession(session), api);
- chatWorkspace?.bindOwner(ownerOfSession(session));
- if (ownerChanged && linkedProblemDraft) void naturalPage?.then(() => showProblemDraft());
- const previousProvider = field('provider').value;
- const providers = session.providers.map(provider => [provider.id, provider.name] as const);
- const keepProvider = session.providers.some(provider => provider.id === previousProvider);
- // The first load starts on the first provider, as the browser would for fresh options.
- renderOptions(
- element('#provider'),
- providers.length ? providers : [['', t('无可用服务商')]],
- firstLoad ? (providers[0]?.[0] ?? '') : keepProvider ? previousProvider : '',
- );
- const previousEnvironment = field('environment').value;
- renderOptions(
- element('#environment'),
- session.environments.map(environment => [environment.id, environment.name] as const),
- session.environments.some(environment => environment.id === previousEnvironment)
- ? previousEnvironment
- : session.defaults.environment,
- );
- // Keep the legacy option addressable for restored evidence, without offering it for new tasks.
- for (const option of element('#environment').options)
- option.hidden = option.value !== webTaskEnvironment;
- renderTemplates(field('template').value);
- element('#max-turns').max = String(session.limits.maxTurns);
- element('#max-seconds').max = String(session.limits.maxRunSeconds);
- element('#workers').max = String(session.limits.maxWorkers);
- let restoredTaskDraft = false,
- resumeLeanDraft = false;
- if (firstLoad) {
- resetForm();
- restoredTaskDraft = restoreDraft();
- draftReady = true;
- draftRecovery.load();
- renderDraftRecovery();
- }
- if (restoredTaskDraft) {
- try {
- resumeLeanDraft = ownedDrafts.getItem(entryStorageKey) === 'lean';
- } catch {
- /* Unavailable storage keeps the normal entry. */
- }
- }
- providerAddress();
- updateEnvironment();
- updateCounts();
- renderRuntime();
- await refreshRuns(epoch, false, listed);
- if (!currentConnection(epoch)) return;
- state.connected = true;
- state.lost = false;
- if (formalizationLink) await openFormalizedDraft(formalizationLink);
- await researchSelection.load(
- (configuration, imports) => {
- field('environment').value = configuration.environment;
- const preferences = configuration.preferences;
- // A restored attempt already contains the user's execution choices, including Agent preference overrides.
- const keepSettings =
- restoredTaskDraft && !productTarget.has('researchAsset') && !productTarget.has('libraryReturn');
- if (!keepSettings && field('research-mode').value !== 'native-team') {
- if (preferences.providerId && session.providers.some(provider => provider.id === preferences.providerId))
- field('provider').value = preferences.providerId;
- if (preferences.model) field('model').value = preferences.model;
- if (preferences.effort) field('effort').value = preferences.effort;
- if (preferences.workers) field('workers').value = String(preferences.workers);
- if (preferences.coordination)
- element(`input[name="coordination"][value="${preferences.coordination}"]`).checked =
- true;
- if (configuration.agent) modulePlanEditor.setValue(undefined);
- }
- if (!draftFormalization && imports.length) {
- const source = field('source').value;
- const additions = [...new Set(imports)].filter(
- name => !source.split('\n').some(line => line.trim() === `import ${name}`),
- );
- if (additions.length)
- field('source').value = additions.map(name => `import ${name}`).join('\n') + '\n' + source;
- }
- providerAddress();
- updateEnvironment();
- updateCounts();
- },
- field('environment').value as WebEnvironment,
- () => {
- // Restoring Library choices prepares the composer without replacing an open research or conversation.
- if (!state.composing || chatWorkspace?.id || new URLSearchParams(location.search).has('chat')) return;
- chooseEntry('lean');
- startDraft(false, 'replace');
- },
- field('research-mode').value === 'native-team',
- );
- await openLibraryProposalDraft();
- await openLibraryPersonalAttemptDraft();
- await openBudgetAttemptDraft();
- await openSharedProofDraft();
- showClassicOrigin();
- await openRecoveryEntry();
- if (!productEntryHandled) {
- productEntryHandled = true;
- if (productEntry) {
- await naturalPage;
- consumeResearchEntry(productEntrySearch, session.templates, {
- statement: draft => {
- chooseEntry('natural');
- startDraft(false, 'replace');
- chatWorkspace?.prepareOriginal(draft.statement, draft.environment);
- },
- lean: draft => {
- chooseEntry('lean');
- startDraft(false, 'replace');
- field('environment').value = draft.environment;
- renderTemplates(draft.template);
- applyTemplate(draft.template);
- updateEnvironment();
- updateCounts();
- saveDraft();
- },
- });
- const cleaned = new URL(location.href);
- for (const key of ['entry', 'template', 'environment']) cleaned.searchParams.delete(key);
- cleaned.searchParams.set('lang', productEntry.language);
- history.replaceState(null, '', cleaned);
- } else if (productTarget.has('message') || productTarget.has('view') || productTarget.has('task')) {
- await naturalPage;
- const chat = productTarget.get('chat'),
- messageId = productTarget.get('message');
- if (chat && messageId && chatWorkspace?.id === chat) chatWorkspace.revealMessage(messageId);
- const run = currentRun(),
- taskId = productTarget.get('task'),
- version = productTarget.get('taskVersion'),
- commit = productTarget.get('commit');
- if (run && run.id === productTarget.get('run')) {
- if (taskId && version && commit) openFrozenTask(api, run.id, { taskId, version, commit });
- else if (
- taskId &&
- (!version ||
- run.observation?.inspection.tasks.some(task => task.id === taskId && task.version === version))
- )
- openChatArtifact('roadmap', { taskId });
- else if (taskId) toast(t('此任务版本已更新,可从资料夹打开保存的源码。'));
- else openChatArtifact(productTarget.get('view') === 'source' ? 'source' : 'roadmap');
- }
- }
- }
- if (
- firstLoad &&
- (budgetDraftOrigin || draftSharedProofOrigin || draftClassicOrigin || resumeLeanDraft) &&
- state.composing &&
- !productEntry &&
- !problemDraftTarget &&
- !readResearchProblemDraft(productTarget) &&
- !readLibraryReference(productTarget) &&
- !readEditedProblemId(productTarget) &&
- (!productTarget.has('fromClassic') || draftClassicOrigin?.id === readClassicId(productTarget)) &&
- !productTarget.has('chat') &&
- !linkedRun
- ) {
- await naturalPage;
- if (!currentConnection(epoch)) return;
- chooseEntry('lean');
- }
- setGlobalNotice(
- session.runtime.ready && session.providers.length
- ? ''
- : localizeText(session.runtime.message) || t('运行环境未就绪'),
- );
- } catch (error) {
- if (currentConnection(epoch)) {
- disconnected(t('{0}。未提交内容已保留。', clause(message(error))));
- if (!state.session) renderRunList(true);
- }
- }
- })().finally(() => {
- connectionRequest = undefined;
- element('#retry-connection').disabled = !pageActive;
- element('#refresh-runs').disabled = !pageActive;
- renderRuntime();
- renderDetail();
- if (pageActive && !clockTimer) clockTimer = setInterval(updateClocks, 1000);
- if (currentConnection(epoch) && state.connected) {
- if (!document.hidden) runUpdates.start();
- if (reconnecting) {
- trajectoryView?.resumeRead();
- void chatWorkspace?.refresh();
- }
- }
- schedulePoll();
- });
- renderRuntime();
- renderDetail();
- return connectionRequest;
-}
-const mac = /Mac|iPhone|iPad/.test(navigator.userAgent);
-function renderShell() {
- const classicPanel = document.querySelector('[data-classic-origin]');
- if (classicPanel) classicPanel.hidden = !state.composing || Boolean(currentRun());
- renderAccountProblemDraft();
- const session = state.session,
- ready = Boolean(state.connected && session?.runtime.ready && session.providers.length);
- const run = currentRun(),
- running = state.runs.filter(activeRun);
- const named = run?.title ?? (researchEntry === 'natural' ? chatWorkspace?.selected?.title : undefined);
- const title = documentTitle(
- baseTitle,
- running.length,
- state.unseenRuns.size,
- running.filter(waitsForOwner).length,
- named,
- );
- if (document.title !== title) document.title = title;
- // The open run already says where it is in its own status line; the pill points at research running elsewhere.
- const elsewhere = running.filter(item => item.id !== run?.id);
- const live = elsewhere.length
- ? { label: t('{0} 项研究进行中', elsewhere.length), detail: '', tone: 'running', count: elsewhere.length }
- : undefined;
- renderTopbar(element('#topbar'), {
- model: researchEntry === 'natural' && !run ? t('默认版配置') : field('model').value || t('模型配置'),
- mac,
- live,
- libraryHref: chatWorkspace?.id
- ? `library.html?${new URLSearchParams({ workbenchChat: chatWorkspace.id })}`
- : chatWorkspace?.editingProblem
- ? `library.html?${new URLSearchParams({ workbenchEdit: chatWorkspace.editingProblem })}`
- : 'library.html',
- history: { docked: historyDocked(), expanded: !historyCollapsed() },
- connection: {
- tone: ready ? 'ready' : 'offline',
- inNotice: !element('#global-notice').hidden,
- label: !state.connected
- ? connectionRequest
- ? t('连接中')
- : t('连接中断')
- : ready
- ? t('环境就绪')
- : t('环境未就绪'),
- },
- settingsDisabled: !session || state.submitting,
- account: session?.account && accountLogin(session.account),
- onAccount: openAccount,
- onHistory: toggleHistory,
- onHome: () => {
- void openNaturalResearch();
- },
- onDraft: openDraft,
- onSettings: () => openSettings(),
- onPalette: () => palette.open(),
- onGlossary: () => openGlossary(),
- onLocale: changeLocale,
- onLive: () => {
- const target = state.runs.filter(item => activeRun(item) && item.id !== run?.id).at(-1);
- if (!target) return;
- if (target.id !== state.selectedId) selectRun(target.id);
- // The status line opens the run's own detail, so whatever the conversation was showing steps aside.
- document.body.dataset.chatArtifact = '';
- setMobileView('runs');
- element(`#detail-tab-${state.tab}`).focus({ preventScroll: true });
- },
- });
-}
-/** Switching reloads the page; the draft is saved first, as on any page exit. The API key is never kept. */
-function changeLocale() {
- saveDraft();
- switchLocale(otherLocale.locale);
-}
-function openAccount() {
- element('#account-email').textContent = state.session?.account ? accountLogin(state.session.account) : '';
- // The allowance is only sent for signed-in accounts that are not admins; anything else leaves the line out.
- const quota = state.session?.quota,
- quotaLine = element('#account-quota');
- quotaLine.hidden = !quota;
- quotaLine.textContent = quota
- ? t(
- '本窗口还可开始 {0} 次研究、{1} 次形式化、{2} 份讲解;额度会在窗口结束后恢复。',
- Math.max(0, quota.runs.limit - quota.runs.used),
- Math.max(0, quota.formalizations.limit - quota.formalizations.used),
- Math.max(0, quota.explanations.limit - quota.explanations.used),
- )
- : '';
- element('#completion-email').checked = state.session?.account?.completionEmail !== false;
- element('.completion-email').hidden = !state.session?.account?.email;
- element('#open-admin').hidden = !state.session?.account?.admin;
- const account = state.session?.account,
- recentCode = account?.passwordResetAllowed;
- element('#account-current-wrap').hidden = !account?.passwordSet || Boolean(recentCode);
- element('#account-password-note').textContent = recentCode
- ? t('刚通过邮箱验证,可在 10 分钟内设置或重设密码。')
- : !account?.email
- ? t('输入当前密码和至少 12 位的新密码。忘记密码请联系管理员重置。')
- : account.passwordSet
- ? t('输入当前密码和至少 12 位的新密码。忘记密码请用邮箱验证码重新登录。')
- : t('请用邮箱验证码重新登录,在 10 分钟内设置至少 12 位的密码。');
- element('#save-password').textContent = account?.passwordSet ? t('修改密码') : t('设置密码');
- for (const id of ['account-current-password', 'account-new-password', 'account-repeat-password'])
- field(id).value = '';
- element('#account-password-error').hidden = true;
- field('account-confirm').value = '';
- element('#delete-account').disabled = true;
- element('#account-error').hidden = true;
- showDialog(element('#account-dialog'));
-}
-/** The allowlist and beta totals; the server refuses every admin route to other accounts. */
-const admin: { overview?: WebAdminOverview; error?: string; busy?: string } = {};
-function renderAdmin() {
- renderAdminPanel(element('#admin-content'), {
- ...admin,
- onAdd: email => changeAllowlist('POST', email),
- onRemove: email => void changeAllowlist('DELETE', email),
- onSuspend: (email, suspended) => void changeSuspended(email, suspended),
- });
-}
-async function changeSuspended(login: string, suspended: boolean) {
- admin.busy = login;
- admin.error = undefined;
- renderAdmin();
- try {
- admin.overview = await api('/api/admin/accounts', {
- method: 'PATCH',
- body: JSON.stringify({ login, suspended }),
- });
- toast(suspended ? t('账号已暂停') : t('账号已恢复'));
- } catch (error) {
- admin.error = message(error);
- } finally {
- admin.busy = undefined;
- renderAdmin();
- }
-}
-async function openAdmin() {
- const dialog = element('#account-dialog');
- if (dialog.open) dialog.close();
- admin.error = undefined;
- renderAdmin();
- showDialog(element('#admin-dialog'));
- try {
- admin.overview = await api('/api/admin/overview');
- } catch (error) {
- admin.error = message(error);
- }
- renderAdmin();
-}
-async function changeCompletionEmail(input: HTMLInputElement) {
- const wanted = input.checked,
- session = state.session;
- input.disabled = true;
- try {
- await api('/api/auth/account', { method: 'PATCH', body: JSON.stringify({ completionEmail: wanted }) });
- if (!sameSession(session)) return;
- if (state.session?.account) state.session.account.completionEmail = wanted;
- toast(wanted ? t('研究结束时会发邮件到登录邮箱') : t('已关闭结束邮件'));
- } catch (error) {
- if (sameSession(session)) {
- input.checked = !wanted;
- toast(message(error));
- }
- } finally {
- input.disabled = false;
- }
-}
-async function changePassword(event: Event) {
- event.preventDefault();
- const error = element('#account-password-error'),
- button = element('#save-password');
- const password = field('account-new-password').value,
- repeat = field('account-repeat-password').value,
- session = state.session;
- error.hidden = true;
- if (password.length < 12 || new TextEncoder().encode(password).length > 256) {
- error.textContent = t('密码至少 12 位且不超过 256 字节。');
- error.hidden = false;
- return;
- }
- if (password !== repeat) {
- error.textContent = t('两次输入的密码不一致。');
- error.hidden = false;
- return;
- }
- button.disabled = true;
- try {
- await api('/api/auth/password', {
- method: 'PATCH',
- body: JSON.stringify({ password, currentPassword: field('account-current-password').value }),
- });
- if (!sameSession(session)) return;
- if (state.session?.account) {
- state.session.account.passwordSet = true;
- state.session.account.passwordResetAllowed = false;
- }
- element('#account-current-wrap').hidden = false;
- element('#account-password-note').textContent = state.session?.account?.email
- ? t('输入当前密码和至少 12 位的新密码。忘记密码请用邮箱验证码重新登录。')
- : t('输入当前密码和至少 12 位的新密码。忘记密码请联系管理员重置。');
- button.textContent = t('修改密码');
- toast(t('密码已更新;其他设备需要重新登录'));
- } catch (cause) {
- if (sameSession(session)) {
- error.textContent = message(cause);
- error.hidden = false;
- }
- } finally {
- if (sameSession(session))
- for (const id of ['account-current-password', 'account-new-password', 'account-repeat-password'])
- field(id).value = '';
- button.disabled = false;
- }
-}
-async function changeAllowlist(method: 'POST' | 'DELETE', email: string): Promise {
- admin.busy = email;
- admin.error = undefined;
- renderAdmin();
- try {
- admin.overview = await api('/api/admin/allowlist', { method, body: JSON.stringify({ email }) });
- toast(method === 'POST' ? t('已加入白名单') : t('已移出白名单'));
- return true;
- } catch (error) {
- admin.error = message(error);
- return false;
- } finally {
- admin.busy = undefined;
- renderAdmin();
- }
-}
-async function leaveAccount(request: () => Promise, button: HTMLButtonElement) {
- const session = state.session;
- button.disabled = true;
- element('#account-error').hidden = true;
- try {
- await request();
- if (!sameSession(session)) return;
- try {
- localStorage.setItem(
- 'theorem-os.web-account-left.v1',
- JSON.stringify({ owner: state.session && ownerOfSession(state.session), nonce: crypto.randomUUID() }),
- );
- } catch {
- /* Other tabs also detect session changes on their next request. */
- }
- clearOwnedDrafts();
- location.replace('login.html');
- } catch (error) {
- if (!sameSession(session)) return;
- element('#account-error').textContent = message(error);
- element('#account-error').hidden = false;
- button.disabled = false;
- } finally {
- if (!sameSession(session)) button.disabled = false;
- }
-}
-/** The theme itself is applied by theme.js before the first paint; this page only offers the choice. */
-const themeLabels: Record = { system: t('跟随系统'), light: t('浅色'), dark: t('深色') };
-function showThemeChoice() {
- const preference = readThemePreference();
- document.querySelectorAll('input[name="theme"]').forEach(input => {
- input.checked = input.value === preference;
- });
-}
-/** Where the reader last chose something: the pointer, or the control a key was pressed in (the palette's search for its commands). */
-let chosenAt: { x: number; y: number } | Element | null = null;
-document.addEventListener(
- 'pointerdown',
- event => {
- chosenAt = { x: event.clientX, y: event.clientY };
- },
- { capture: true, passive: true },
-);
-// Measured only when a theme is chosen, so typing costs no layout.
-document.addEventListener(
- 'keydown',
- event => {
- chosenAt = event.target instanceof Element ? event.target : null;
- },
- { capture: true, passive: true },
-);
-function chooseTheme(preference: ThemePreference) {
- if (!saveThemePreference(() => localStorage, preference)) toast(t('浏览器不允许保存,外观只在此页面生效'));
- if (
- resolveTheme(preference, matchMedia('(prefers-color-scheme: dark)').matches) ===
- document.documentElement.dataset.theme
- )
- applyTheme(preference);
- else {
- const box =
- chosenAt instanceof Element && chosenAt !== document.body ? chosenAt.getBoundingClientRect() : undefined;
- const origin =
- chosenAt && !(chosenAt instanceof Element)
- ? chosenAt
- : box?.width
- ? { x: box.left + box.width / 2, y: box.top + box.height / 2 }
- : { x: innerWidth / 2, y: innerHeight / 2 };
- revealTheme(() => applyTheme(preference), origin.x, origin.y);
- }
- showThemeChoice();
-}
-followThemeChanges(showThemeChoice);
-showThemeChoice();
-document
- .querySelectorAll('input[name="theme"]')
- .forEach(input => input.addEventListener('change', () => chooseTheme(input.value as ThemePreference)));
-element('#completion-email').addEventListener(
- 'change',
- event => void changeCompletionEmail(event.currentTarget as HTMLInputElement),
-);
-element('#account-password-form').addEventListener('submit', event => void changePassword(event));
-function openGlossary(id?: TermId) {
- const dialog = element('#glossary-dialog');
- renderGlossary(dialog, id);
- showDialog(dialog);
-}
-installTermHints(openGlossary);
-/** Wide screens keep the history docked beside the workspace; narrow ones open the same list as a dialog. */
-function historyDocked() {
- return !historyQuery.matches;
-}
-function historyCollapsed() {
- return document.body.dataset.historyCollapsed === 'true';
-}
-function placeHistory() {
- const history = element('.run-history'),
- docked = historyDocked();
- const host = element(docked ? '#history-sidebar' : '#history-dialog');
- if (history.parentElement === host) return;
- rememberHistoryScroll();
- if (docked && element