/* nvwa · 设计令牌
 *
 * 数值 1:1 取自 Cursor 3.19.19 解析冻结（references/cursor-frontend）：
 *   颜色  current/theme-modules.json  cursor-light / cursor-dark（dark 缺项取同包 `dark` 基色）
 *   尺寸  frozen-3.19.19/cursor-ui.md §2–§7、§15–§17
 * 组件只用 --nv-* 语义变量，不直接写颜色或魔法尺寸。
 */

/* 界面字 nvwafont：随包自带，Mac / Windows 同一套字形，不依赖系统装了什么。
 *   中文 + 中文标点  nvwafont-han    文鼎楷体（AR PL UKai）改：字面变方、加粗；标点挪到大陆位置并带 halt，
 *                                    Chromium 的 text-spacing-trim 自动挤压相邻标点（要求页面 lang=zh-CN）；
 *                                    汉字整体下移千分之七十，和西文的重心对齐
 *   西文 / 数字 / 弯引号  nvwafont-latin  Newsreader（报刊正文体）常规粗细、小字号那档字形，字形位置不动
 *                                    （tools/build-nvwafont-latin.py）；字面和楷体一样高，不用 size-adjust；
 *                                    一行字放多高由它的上下高度决定，已调成字落在行的正中
 * 两个文件授权不同（Arphic 公共授权 / SIL OFL，见同目录 LICENSE-*），不能合并成一个字体文件，只能在这里拼。
 * 西文那条必须写在后面：码位重叠时后声明的优先。 */
@font-face {
  font-family: "nvwafont";
  src: url("./fonts/nvwafont/nvwafont-han.woff2") format("woff2");
  font-display: block;
}
@font-face {
  font-family: "nvwafont";
  src: url("./fonts/nvwafont/nvwafont-latin.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-2019, U+201C-201D, U+20AC;
  font-display: block;
}

:root {
  /* 字 */
  /* 界面字：nvwafont（见上）。字体文件万一没加载出来，回落系统楷体：
   *   Mac Kaiti SC；Windows 华文楷体 STKaiti（随 Office）或系统自带 KaiTi；再不行回落系统无衬线。
   * 代码字（--nv-font-mono）保持默认等宽栈。 */
  --nv-font-sans: "nvwafont", "Kaiti SC", "STKaiti", "华文楷体", "KaiTi", "楷体", -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --nv-font-mono: Menlo, Monaco, "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  /* ── 尺寸阶梯 ────────────────────────────────────────────────────────
   * 界面尺寸只用这些档（见 docs/DESIGN-SIZES.md）。令牌名里的数字就是标准档的像素值，
   * 实际显示 = 值 × 字号档位（0.9 / 1 / 1.1）。要新档先改文档，不在组件里写数。
   * 组件角色值（§8）只引用这些档；不落在档上的图形 / 布局值在文档 §9 逐条登记。 */

  /* 字号：11 / 12 / 13 / 14 / 15 / 16 / 18 / 20 / 24 / 28 / 32 / 36 */
  --nv-font-size-11: 11px;
  --nv-font-size-12: 12px;
  --nv-font-size-13: 13px;
  --nv-font-size-14: 14px;
  --nv-font-size-15: 15px;
  --nv-font-size-16: 16px;
  --nv-font-size-18: 18px;
  --nv-font-size-20: 20px;
  --nv-font-size-24: 24px;
  --nv-font-size-28: 28px;
  --nv-font-size-32: 32px;
  --nv-font-size-36: 36px;

  /* 行高：16 / 20 / 24 / 28 / 32 / 36 / 40 */
  --nv-line-height-16: 16px;
  --nv-line-height-20: 20px;
  --nv-line-height-24: 24px;
  --nv-line-height-28: 28px;
  --nv-line-height-32: 32px;
  --nv-line-height-36: 36px;
  --nv-line-height-40: 40px;

  /* 对话正文与代码：引用阶梯，不另设数值 */
  --nv-conversation-font-size: var(--nv-font-size-15);
  --nv-conversation-line-height: var(--nv-line-height-24);
  /* 对话里的代码（代码块 / 命令 / 输出 / diff / 源码）统一一档：楷体视觉偏小，
     等宽再大就压过正文 */
  --nv-code-font-size: var(--nv-font-size-13);
  --nv-code-line-height: var(--nv-line-height-20);

  /* 间距：2 / 4 / 8 / 12 / 16 / 20 / 24 / 32 / 40 / 48 / 56 */
  --nv-space-2: 2px;
  --nv-space-4: 4px;
  --nv-space-8: 8px;
  --nv-space-12: 12px;
  --nv-space-16: 16px;
  --nv-space-20: 20px;
  --nv-space-24: 24px;
  --nv-space-32: 32px;
  --nv-space-40: 40px;
  --nv-space-48: 48px;
  --nv-space-56: 56px;

  /* 圆角：4 / 8 / 12 / 16 / 20 / 24 / 全圆 */
  --nv-radius-4: 4px;
  --nv-radius-8: 8px;
  --nv-radius-12: 12px;
  --nv-radius-16: 16px;
  --nv-radius-20: 20px;
  --nv-radius-24: 24px;
  --nv-radius-full: 9999px;

  /* 图标：值是画出来的盒子（不是 font-size）。.nv-icon 用「盒子 ÷ --nv-icon-scale」
     算 font-size，见 ui/primitives.css；组件只写盒子。
     盒子：12 / 14 / 16 / 20 / 24 / 32 / 40 */
  --nv-icon-12: 12px;
  --nv-icon-14: 14px;
  --nv-icon-16: 16px;
  --nv-icon-20: 20px;
  --nv-icon-24: 24px;
  --nv-icon-32: 32px;
  --nv-icon-40: 40px;

  /* 控件高度：24 / 28 / 32 / 36 / 40 / 44（按钮 / 输入框 / 分段滑钮共用） */
  --nv-control-height-24: 24px;
  --nv-control-height-28: 28px;
  --nv-control-height-32: 32px;
  --nv-control-height-36: 36px;
  --nv-control-height-40: 40px;
  --nv-control-height-44: 44px;

  /* 圆钮直径：20 / 24 / 28 / 32 / 36 / 44 */
  --nv-round-btn-20: 20px;
  --nv-round-btn-24: 24px;
  --nv-round-btn-28: 28px;
  --nv-round-btn-32: 32px;
  --nv-round-btn-36: 36px;
  --nv-round-btn-44: 44px;

  /* 列表行：桌面 32 / 40 / 56 / 48；手机统一 48（见文末 :root[data-compact]） */
  --nv-list-row-32: 32px;
  /* 手机抽屉的会话行 / 项目行：两档手机值都不改它，压到 40 才够密 */
  --nv-list-row-40: 40px;
  --nv-list-row-56: 56px;
  --nv-list-row-48: 48px;

  /* 移动端页边距 */
  --nv-gutter-compact: var(--nv-space-16);

  /* 标题栏 */
  --nv-titlebar-height: 40px;
  /* 桌面端 macOS 红绿灯占的宽度（trafficLightPosition x=14 + 三个按钮 52 = 66，再空 22 给折叠钮） */
  --nv-traffic-light-inset: 97px;

  /* 时长与缓动 */
  --nv-duration-instant: 50ms;
  --nv-duration-fast: 100ms;
  --nv-duration-normal: 150ms;
  --nv-duration-slow: 200ms;
  --nv-duration-slower: 300ms;
  --nv-ease-out-strong: cubic-bezier(0.165, 0.84, 0.44, 1);
  --nv-ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);

  /* 层 */
  --nv-z-overlay: 1000;
  --nv-z-modal: 3000;
  --nv-z-popover: 4000;
  --nv-z-tooltip: 100000;

  /* 布局（cursor-ui.md §10、§15、§16） */
  /* 左栏默认宽对照 Cursor：300，但不超过窗口的 1/4（与 Sidebar.tsx 的 defaultWidth 一致） */
  --nv-sidebar-width: min(330px, 25vw);
  --nv-chat-max-width: 876px; /* 780 + 滚条槽 8×2 */
  /* 工具行 / 思考行 / 折叠组表头的行高 */
  --nv-row-height: var(--nv-control-height-28);
  /*
   * 对话列的「元素单元」间距：每种单元上下对称，相邻两个单元之间取两者较大值（外边距折叠）。
   * 同种单元挨着 = 它自己的值；不同种挨着 = 较大者。只在这里调。
   */
  --nv-unit-row: 0px; /* 执行（工具行）、思考、折叠组、「正在工作」 */
  --nv-unit-text: var(--nv-space-8); /* 正文（助手回复） */
  --nv-unit-plan: var(--nv-space-12); /* 计划卡片 */
  --nv-unit-user: var(--nv-space-24); /* 人泡：一问一答之间的分隔 */
  --nv-unit-turn-end: var(--nv-space-4); /* 回合收尾（耗时 / 复制 / 错误提示） */

  /* ── 组件令牌（DESIGN-SIZES §8）──────────────────────────────────────
   * 同一角色在桌面 / 手机各一值；手机值只在文件末尾的 :root[data-compact] 改。
   * 组件 CSS 只读这里的令牌，不再在 [data-compact] 里逐个写尺寸。 */
  --nv-pane-head-height: var(--nv-titlebar-height);
  --nv-chrome-btn-size: var(--nv-round-btn-44); /* 只在手机出现 */
  --nv-chrome-inset: var(--nv-space-16);
  --nv-chrome-gap: var(--nv-space-8);
  --nv-sidebar-drawer-width: 352px; /* 布局宽度，§9 */
  --nv-sidebar-footer-height: var(--nv-list-row-56);
  --nv-avatar-sm: var(--nv-round-btn-24);
  --nv-avatar-md: var(--nv-round-btn-32);
  --nv-avatar-lg: var(--nv-list-row-48);
  --nv-account-avatar-size: var(--nv-round-btn-32); /* 左栏底栏 / 抽屉里的头像本体 */
  --nv-sidebar-new-height: var(--nv-control-height-36);
  --nv-launcher-size: var(--nv-control-height-28);
  --nv-settings-action-height: var(--nv-control-height-24);
  --nv-input-height: var(--nv-control-height-32);
  --nv-settings-input-height: var(--nv-control-height-36);
  --nv-login-input-font: var(--nv-font-size-15);
  --nv-input-font-min: 0px; /* 桌面不设下限 */
  --nv-bubble-radius: var(--nv-radius-16);
  --nv-bubble-pad-block: var(--nv-space-12);
  --nv-bubble-clip-pad: var(--nv-space-12); /* 收起时预留的那一截（max-height / 底部渐隐），不随手机内边距变 */
  --nv-transcript-gutter: 0px;
  --nv-composer-control: var(--nv-control-height-32);
  --nv-composer-pill-height: 0px;
  --nv-composer-card-radius: var(--nv-radius-20);
  --nv-composer-input-min: var(--nv-control-height-40);
  --nv-composer-input-max: 220px; /* 内容高度上限，§9 */
  --nv-composer-input-pad-block: var(--nv-space-8);
  --nv-composer-input-font: var(--nv-font-size-15);
  --nv-composer-input-line: var(--nv-line-height-24);
  --nv-composer-model-height: var(--nv-control-height-24);
  --nv-composer-chip-height: var(--nv-control-height-32);
  --nv-composer-status-height: var(--nv-control-height-32);
  --nv-composer-status-button-height: var(--nv-control-height-28);
  --nv-composer-queue-height: var(--nv-control-height-28);
  --nv-composer-context-size: var(--nv-control-height-28);
  --nv-composer-min-height: var(--nv-composer-input-min);
  --nv-composer-max-height: var(--nv-composer-input-max);

  /* 开关：轨道 + 滑块，比例固定（32×20、滑块 16） */
  --nv-switch-width: var(--nv-space-32);
  --nv-switch-height: var(--nv-space-20);
  --nv-switch-thumb: var(--nv-space-16);
}

/* 设置 · 偏好 · 字体（theme/fonts.ts 写 data-font）。默认 = nvwafont，见上面 --nv-font-sans。
 * 楷体 / 宋体用系统的华文字体：
 *   Mac  楷体-简 Kaiti SC、宋体-简 Songti SC（华文出品，是 STKaiti / STSong 的新版，同一个字体文件里）。
 *        宋体系统自带；楷体是「可下载字体」，没在字体册里下载过就没有 → 回落自带的 nvwafont。
 *   Windows 不自带华文字体（随 Office 装）：没有就用系统自带的楷体 KaiTi、宋体 SimSun。 */
:root[data-font="kai"] {
  --nv-font-sans: "Kaiti SC", "楷体-简", "STKaiti", "华文楷体", "KaiTi", "楷体", "nvwafont", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

:root[data-font="song"] {
  --nv-font-sans: "Songti SC", "宋体-简", "STSong", "华文宋体", "SimSun", "宋体", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

/* ── 浅色：cursor-light ─────────────────────────────────────────────── */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --nv-fg: oklch(0.191 0 0 / 0.922);
  --nv-fg-secondary: oklch(0.191 0 0 / 0.702);
  --nv-fg-tertiary: oklch(0.191 0 0 / 0.478);
  --nv-fg-quaternary: oklch(0.191 0 0 / 0.322);
  --nv-bg-editor: oklch(0.991 0 0);
  --nv-bg-chrome: oklch(0.991 0 0);
  --nv-bg-sidebar: oklch(0.964 0 0);
  --nv-bg-elevated: oklch(0.991 0 0);
  --nv-bg-input: oklch(0.991 0 0);
  --nv-fill-primary: oklch(0.191 0 0 / 0.2);
  --nv-fill-secondary: oklch(0.191 0 0 / 0.141);
  --nv-fill-tertiary: oklch(0.191 0 0 / 0.078);
  --nv-fill-quaternary: oklch(0.191 0 0 / 0.039);
  --nv-stroke-primary: oklch(0.191 0 0 / 0.2);
  --nv-stroke-secondary: oklch(0.191 0 0 / 0.122);
  --nv-stroke-tertiary: oklch(0.191 0 0 / 0.051);
  /* 配色规则：灰阶是底与主体；点缀色只落在少数有状态含义的点上——
     蓝 = 开关开 / 进度条 / 「卡片」的当前选中边框；绿橙红 = 真实状态（小点、小徽标、错误与危险文字）。
     fill 作填充（小点、进度条、开关底、卡片边），ink 作文字（保证 ≥ 4.5）；
     --nv-success / --nv-warn / --nv-danger 保留改前的值给设置以外用，设置页取 -fill / -ink。
     点缀色只在设置页使用；设置以外的区域仍是灰阶，可操作性的「重」用 --nv-emphasis（与改前的 --nv-accent 同值）。 */
  --nv-accent: oklch(0.64 0.15 259);
  --nv-on: oklch(0.64 0.15 259);
  --nv-on-thumb: oklch(1 0 0);
  --nv-link: oklch(0.64 0.15 259);
  --nv-emphasis: oklch(0.45 0 0);
  --nv-brand: oklch(0.35 0 0);
  /* 状态色保持改前的值：对话区、侧栏、登录页都在用，换掉就会跟着变 */
  --nv-success: oklch(0.565 0.11 164.499);
  --nv-warn: oklch(0.5 0 0);
  --nv-danger: oklch(0.566 0.197 12.263);
  /* 设置页专用：填充（小点、进度条）用浅档，文字用 -ink 档（≥ 4.5） */
  --nv-success-fill: oklch(0.67 0.13 152);
  --nv-success-ink: oklch(0.48 0.12 152);
  --nv-warn-fill: oklch(0.75 0.13 68);
  --nv-warn-ink: oklch(0.5 0.11 62);
  --nv-danger-fill: oklch(0.67 0.16 25);
  --nv-danger-ink: oklch(0.52 0.17 26);
  /* 设置页不用 info：取 fg-secondary 的灰阶值，免得将来被当成装饰色 */
  --nv-info: oklch(0.191 0 0 / 0.702);
  --nv-merged: oklch(0.66 0.13 296);
  --nv-added: oklch(0.565 0.11 164.499);
  --nv-removed: oklch(0.566 0.197 12.263);
  --nv-diff-inserted: oklch(0.565 0.11 164.499 / 0.122);
  --nv-diff-removed: oklch(0.566 0.197 12.263 / 0.078);
  --nv-focus-border: oklch(0.191 0 0 / 0.149);
  --nv-list-active: oklch(0.191 0 0 / 0.078);
  --nv-shadow: oklch(0.191 0 0 / 0.118);
  --nv-button-bg: oklch(0.18 0 0);
  --nv-button-fg: oklch(0.985 0 0);
  /* 勾选框/自绘勾的色：data-URI 里读不了变量，按主题整段换（勾色 = --nv-button-fg） */
  --nv-check-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5.2 4.2 7.4 8 2.8'/%3E%3C/svg%3E");
  --nv-button-bg-hover: oklch(0.3 0 0);
  --nv-button-secondary-bg: oklch(0.191 0 0 / 0.118);
  --nv-button-secondary-fg: oklch(0.191 0 0 / 0.922);
  --nv-button-secondary-bg-hover: oklch(0.191 0 0 / 0.188);

  --nv-syntax-fg: oklch(0.191 0 0 / 0.922);
  --nv-syntax-keyword: oklch(0.488 0.195 13.082);
  --nv-syntax-string: oklch(0.7 0.095 290.796);
  --nv-syntax-function: oklch(0.662 0.144 39.487);
  --nv-syntax-number: oklch(0.567 0.168 346.061);
  --nv-syntax-comment: oklch(0.191 0 0 / 0.678);
  --nv-syntax-constant: oklch(0.488 0.102 243.616);
  --nv-syntax-parameter: oklch(0.191 0 0 / 0.922);
  --nv-syntax-punctuation: oklch(0.191 0 0 / 0.922);
  --nv-syntax-link: oklch(0.488 0.102 243.616);

  --nv-shadow-popup: 0 9px 26px oklch(0.191 0 0 / 0.1), 0 6px 11px oklch(0.191 0 0 / 0.06),
    0 1px 2px oklch(0.191 0 0 / 0.08);
  --nv-shadow-composer: 0 2px 9px oklch(0.191 0 0 / 0.06);
  /* 弹窗背后的暗底（看图弹窗）：压暗整个窗口，让图成为唯一焦点 */
  --nv-scrim: oklch(0 0 0 / 0.55);

  /* 文件家族色：FileIcon 的字形与缎带用（features/files/fileType.ts 的 FileFamily 一一对应）。
     文件图标是「类型身份」不是装饰——缎带上写扩展名，颜色是它在小尺寸下唯一的可辨信号。 */
  --nv-file-doc: #5b8dd9;
  --nv-file-json: #c9a227;
  --nv-file-code: #8a8a8a;
  --nv-file-image: #3db39e;
  --nv-file-pdf: #d9574f;
  --nv-file-sheet: #4ca06b;
  --nv-file-slides: #d97742;
  --nv-file-audio: #a06cc9;
  --nv-file-video: #8b6fd8;
  --nv-file-archive: #b58a4a;
  --nv-file-ebook: #4aa6b5;
  --nv-file-font: #7a86d9;
  --nv-file-generic: #8a8a8a;
  --nv-file-folder: #4a9eda;
}

/* ── 深色：cursor-dark ──────────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --nv-fg: oklch(0.919 0 0 / 0.922);
  --nv-fg-secondary: oklch(0.919 0 0 / 0.553);
  --nv-fg-tertiary: oklch(0.919 0 0 / 0.369);
  --nv-fg-quaternary: oklch(0.919 0 0 / 0.259);
  --nv-bg-editor: oklch(0.209 0 0);
  --nv-bg-chrome: oklch(0.191 0 0);
  --nv-bg-sidebar: oklch(0.191 0 0);
  --nv-bg-elevated: oklch(0.209 0 0);
  --nv-bg-input: oklch(0.919 0 0 / 0.039);
  --nv-fill-primary: oklch(0.919 0 0 / 0.188);
  --nv-fill-secondary: oklch(0.919 0 0 / 0.118);
  --nv-fill-tertiary: oklch(0.919 0 0 / 0.067);
  --nv-fill-quaternary: oklch(0.919 0 0 / 0.039);
  --nv-stroke-primary: oklch(0.919 0 0 / 0.149);
  --nv-stroke-secondary: oklch(0.919 0 0 / 0.094);
  --nv-stroke-tertiary: oklch(0.919 0 0 / 0.039);
  --nv-accent: oklch(0.72 0.12 259);
  --nv-on: oklch(0.72 0.12 259);
  /* 深色下开关的圆点用深色：浅蓝底上的白点只有 2.5:1，换成深点 7.7:1 */
  --nv-on-thumb: oklch(0.19 0 0);
  --nv-link: oklch(0.72 0.12 259);
  --nv-emphasis: oklch(0.85 0 0);
  --nv-brand: oklch(0.9 0 0);
  --nv-success: oklch(0.638 0.129 153.739);
  --nv-warn: oklch(0.78 0 0);
  --nv-danger: oklch(0.628 0.194 8.387);
  --nv-success-fill: oklch(0.76 0.12 152);
  --nv-success-ink: oklch(0.8 0.12 152);
  --nv-warn-fill: oklch(0.8 0.12 70);
  --nv-warn-ink: oklch(0.82 0.12 70);
  --nv-danger-fill: oklch(0.72 0.14 25);
  --nv-danger-ink: oklch(0.76 0.13 25);
  --nv-info: oklch(0.919 0 0 / 0.553);
  --nv-merged: oklch(0.74 0.11 296);
  --nv-added: oklch(0.713 0.094 155.438);
  --nv-removed: oklch(0.712 0.177 12.651);
  --nv-diff-inserted: oklch(0.638 0.129 153.739 / 0.2);
  --nv-diff-removed: oklch(0.5 0.2 9.842 / 0.2);
  --nv-focus-border: oklch(0.919 0 0 / 0.149);
  --nv-list-active: oklch(0.919 0 0 / 0.118);
  --nv-shadow: oklch(0 0 0 / 0.4);
  --nv-button-bg: oklch(0.94 0 0);
  --nv-button-fg: oklch(0.165 0 0);
  /* 勾色跟随 --nv-button-fg：深色底是浅盒，勾换深色 */
  --nv-check-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%231e1e1e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5.2 4.2 7.4 8 2.8'/%3E%3C/svg%3E");
  --nv-button-bg-hover: oklch(1 0 0);
  --nv-button-secondary-bg: oklch(0.919 0 0 / 0.118);
  --nv-button-secondary-fg: oklch(0.919 0 0 / 0.922);
  --nv-button-secondary-bg-hover: oklch(0.919 0 0 / 0.188);

  --nv-syntax-fg: oklch(0.919 0 0 / 0.922);
  --nv-syntax-keyword: oklch(0.811 0.079 191.639);
  --nv-syntax-string: oklch(0.769 0.132 329.919);
  --nv-syntax-function: oklch(0.805 0.097 58.138);
  --nv-syntax-number: oklch(0.849 0.086 80.222);
  --nv-syntax-comment: oklch(0.919 0 0 / 0.369);
  --nv-syntax-constant: oklch(0.75 0.128 287.99);
  --nv-syntax-parameter: oklch(0.878 0.01 286.202);
  --nv-syntax-punctuation: oklch(0.878 0.01 286.202);
  --nv-syntax-link: oklch(0.799 0.106 249.274);

  --nv-shadow-popup: 0 9px 26px oklch(0 0 0 / 0.45), 0 6px 11px oklch(0 0 0 / 0.3), 0 1px 2px oklch(0 0 0 / 0.4);
  --nv-shadow-composer: 0 2px 9px oklch(0 0 0 / 0.3);
  --nv-scrim: oklch(0 0 0 / 0.65);

  /* 文件家族色（浅色块的暗色变体：深底下提亮一档保持可辨） */
  --nv-file-doc: #7ba7e3;
  --nv-file-json: #dcb53f;
  --nv-file-code: #9a9a9a;
  --nv-file-image: #5cc9b5;
  --nv-file-pdf: #e4706a;
  --nv-file-sheet: #66b985;
  --nv-file-slides: #e39363;
  --nv-file-audio: #b98ade;
  --nv-file-video: #a68ce4;
  --nv-file-archive: #cca465;
  --nv-file-ebook: #68bdca;
  --nv-file-font: #97a1e4;
  --nv-file-generic: #9a9a9a;
  --nv-file-folder: #6db3e8;
}

/* shiki css-variables 主题 → Cursor 语法色 */
:root {
  --shiki-foreground: var(--nv-syntax-fg);
  --shiki-background: transparent;
  --shiki-token-keyword: var(--nv-syntax-keyword);
  --shiki-token-string: var(--nv-syntax-string);
  --shiki-token-string-expression: var(--nv-syntax-string);
  --shiki-token-function: var(--nv-syntax-function);
  --shiki-token-constant: var(--nv-syntax-constant);
  --shiki-token-parameter: var(--nv-syntax-parameter);
  --shiki-token-punctuation: var(--nv-syntax-punctuation);
  --shiki-token-comment: var(--nv-syntax-comment);
  --shiki-token-link: var(--nv-syntax-link);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --nv-duration-instant: 0.01ms;
    --nv-duration-fast: 0.01ms;
    --nv-duration-normal: 0.01ms;
    --nv-duration-slow: 0.01ms;
    --nv-duration-slower: 0.01ms;
  }
}

/* 触控目标：桌面沿用 28，手机抬到 44（WCAG / Material 的最小可点尺寸）。
   这是「手指能点到」的物理下限，不跟着界面 zoom 放大；控件本体另按各自尺寸。
   放在令牌里而不是 app.css：分享页只带令牌和组件样式，原来在那里取不到，「回到底部」圆钮被压成扁的。 */
:root {
  --nv-touch-target: 28px;
}

/* 手机宽度：尺寸标准里唯一改手机值的地方（DESIGN-SIZES §8）。
   组件 CSS 不要另写 [data-compact] 尺寸；要新值先加到这里，再改文档。 */
:root[data-compact] {
  --nv-touch-target: 44px;

  --nv-pane-head-height: var(--nv-space-48);
  /* 64 = 44 头像 + 上下各 10，用阶梯值拼出来 */
  --nv-sidebar-footer-height: calc(var(--nv-space-48) + var(--nv-space-16));
  --nv-account-avatar-size: var(--nv-round-btn-36);
  --nv-sidebar-new-height: var(--nv-round-btn-44);
  --nv-launcher-size: var(--nv-control-height-40);
  --nv-settings-action-height: var(--nv-control-height-28);
  --nv-input-height: var(--nv-control-height-44);
  --nv-settings-input-height: var(--nv-control-height-44);
  --nv-login-input-font: var(--nv-font-size-18);
  /* 手机上所有输入框的字号下限：iOS 遇到 <16px 的输入框一聚焦就把整页放大；最小字号档 0.9 × 18 = 16.2 仍过线 */
  --nv-input-font-min: var(--nv-font-size-18);
  --nv-bubble-radius: var(--nv-radius-24);
  --nv-bubble-pad-block: var(--nv-space-8);
  --nv-transcript-gutter: var(--nv-space-20);

  /* 手机列表行统一 48（Claude 实测约 50） */
  --nv-list-row-32: var(--nv-space-48);
  --nv-list-row-56: var(--nv-space-48);

  /* 底部停靠的公共内边距：空闲输入胶囊、起始页输入卡、抽屉底栏共用一条底边（20 + 底安全区） */
  --nv-compact-dock-inset: calc(var(--nv-space-20) + env(safe-area-inset-bottom, 0px));

  /* 输入框：空闲 52 胶囊，聚焦 / 有字展开成两层卡（见 compactComposer.css） */
  --nv-composer-control: var(--nv-round-btn-36);
  --nv-composer-pill-height: 52px; /* 手机专用，§9 */
  --nv-composer-card-radius: var(--nv-radius-24);
  --nv-composer-input-min: var(--nv-control-height-28);
  --nv-composer-input-max: 145px; /* 内容高度上限，§9 */
  --nv-composer-input-pad-block: var(--nv-space-12);
  --nv-composer-input-font: var(--nv-font-size-18);
  --nv-composer-input-line: var(--nv-line-height-28);
  --nv-composer-model-height: var(--nv-control-height-32);
  --nv-composer-chip-height: var(--nv-control-height-28);
  --nv-composer-status-height: var(--nv-control-height-32);
  --nv-composer-status-button-height: var(--nv-control-height-32);
  --nv-composer-queue-height: var(--nv-control-height-28);
  --nv-composer-context-size: var(--nv-control-height-32);
}

/* 软键盘开着（或聚焦前预抬，app/keyboard.ts）：底下是键盘不是 home 指示条，
   输入卡贴着键盘只留 8，不再垫 20 + 底安全区（iPhone 上那一段有 54） */
:root[data-compact][data-keyboard] {
  --nv-compact-dock-inset: var(--nv-space-8);
}
