/* =====================================================================
   YMeta 设计 Token 与基础组件 · v5（数据空间）
   规则：一种字体、一个强调色（也给 AI）、界面浮在点阵画布上、状态只用圆点加文字、
   依据写成句子、只标异常、动效必须有含义、装饰来自数据本身。
   数据状态（文件和记录）：已关联、待登记、需要确认、未能归档，颜色见 --st-*。
   兼容：面向国产浏览器的旧 Chromium 内核，不用 color-mix、:has、CSS 嵌套。
   ===================================================================== */

:root {
  /* 纸与墨 */
  --paper: #F5F6F8;          /* 页面底色 */
  --sheet: #FFFFFF;          /* 卡片、图纸面 */
  --sheet-2: #F7F8FA;        /* 悬停、输入框底、次级面 */
  --ink: #0F1B2D;            /* 主文字 */
  --ink-2: #465266;          /* 次文字 */
  --ink-3: #637084;          /* 说明文字 */
  --line: #E3E7ED;           /* 分隔线 */
  --line-2: #C9D0DA;         /* 控件边框 */
  --pencil: #9AA5B5;         /* 草稿虚线：铅笔的石墨灰 */
  --scrim: rgba(15, 27, 45, .36);

  /* 品牌：晒图蓝，只给主按钮、链接、选中态和首屏 */
  --blueprint: #133C8F;
  --on-bp: #F3F7FF;
  --on-bp-2: #C9D8F7;
  --bp-line: rgba(208, 224, 255, .10);
  --bp-rule: rgba(208, 224, 255, .30);
  --accent: #1F57D6;
  --accent-hover: #1848B5;
  --accent-weak: #EDF2FD;
  --on-accent: #FFFFFF;

  /* 状态：只以圆点和少量文字出现，不做色块 */
  --ok: #17784A;
  --ok-weak: #EAF6EF;
  --warn: #9A5B00;
  --warn-dot: #D9982A;
  --warn-weak: #FFF6E5;
  --stop: #BF2E28;

  /* 数据状态：状态条和状态点共用。深色模式的红色单独调过，和黄色相邻时色弱用户也能分清 */
  --st-ok: #17784A;          /* 已关联 */
  --st-draft: #9AA5B5;       /* 待登记：AI 整理出来、还没登记的记录，和草稿一样用铅笔灰 */
  --st-warn: #D9982A;        /* 需要确认 */
  --st-stop: #BF2E28;        /* 未能归档 */
  --st-proc: #E3E7ED;        /* 处理中（条的底色） */

  /* 等轴测零件着色 */
  --iso-1: #FFFFFF;
  --iso-2: #E6EAF0;
  --iso-3: #CFD6E0;
  --iso-4: #8E9AAE;
  --v3-part: #F2F4F7;        /* 3D：自制件 */
  --v3-soft: #E1E6ED;        /* 3D：底板等大件 */
  --v3-std: #BCC4D0;         /* 3D：外购件、标准件 */
  --v3-dark: #5E6A7C;        /* 3D：电机等外购总成 */
  --v3-line: #0F1B2D;        /* 3D：边线 */
  --grid-dot: #D3D9E2;       /* 画布点阵 */
  --ai-1: #2A78D6;           /* 特征：通孔（色弱校验过，和状态色不重叠） */
  --ai-2: #4A3AA7;           /* 特征：中心孔 */
  --ai-3: #1BAF7A;           /* 特征：螺纹孔 */
  --ai-4: #637084;           /* 特征：槽和其它 */
  --ai-glow: rgba(42, 120, 214, .38);
  --shadow-float: 0 1px 2px rgba(15, 27, 45, .06), 0 10px 28px -14px rgba(15, 27, 45, .22);

  /* 代码 */
  --code-bg: #0F1B2D;
  --code-fg: #DCE6F5;
  --code-2: #8FA3C0;
  --code-key: #9CC2FF;
  --code-str: #F2C27B;
  --code-num: #9FE0B8;

  /* 字体：只用系统字体，不加载网络字体（境内网络、离线一体机都能正常显示） */
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-drawing: FangSong, STFangsong, "FangSong_GB2312", "仿宋", "仿宋_GB2312", "PingFang SC", "Microsoft YaHei", serif;

  /* 形状 */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 12px;
  --shadow-pop: 0 12px 32px -12px rgba(15, 27, 45, .25), 0 2px 6px rgba(15, 27, 45, .06);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0C121C;
    --sheet: #121A27;
    --sheet-2: #172131;
    --ink: #E6EBF2;
    --ink-2: #AAB4C4;
    --ink-3: #8691A3;
    --line: #222D3E;
    --line-2: #334058;
    --pencil: #5B6980;
    --scrim: rgba(0, 0, 0, .55);
    --blueprint: #0F2B69;
    --on-bp: #EEF3FF;
    --on-bp-2: #B8CAF0;
    --bp-line: rgba(180, 205, 255, .08);
    --bp-rule: rgba(180, 205, 255, .24);
    --accent: #6F9BFF;
    --accent-hover: #8DB0FF;
    --accent-weak: #172A4F;
    --on-accent: #0C121C;
    --ok: #56C98F;
    --ok-weak: #12291E;
    --warn: #F0B54A;
    --warn-dot: #D9A03A;
    --warn-weak: #2A2112;
    --stop: #FF7A70;
    --st-ok: #56C98F;
    --st-draft: #5B6980;
    --st-warn: #D9A03A;
    --st-stop: #E5484D;
    --st-proc: #222D3E;
    --iso-1: #223049;
    --iso-2: #18233A;
    --iso-3: #121B2D;
    --iso-4: #070C15;
    --v3-part: #2B3A55;
    --v3-soft: #223049;
    --v3-std: #3B4862;
    --v3-dark: #4D5A72;
    --v3-line: #C9D6EA;
    --grid-dot: #1C2636;
    --ai-1: #5594EC;
    --ai-2: #6B4DD6;
    --ai-3: #1F9F77;
    --ai-4: #8691A3;
    --ai-glow: rgba(85, 148, 236, .5);
    --shadow-float: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -14px rgba(0, 0, 0, .7);
    --code-bg: #070C15;
    --shadow-pop: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0C121C;
  --sheet: #121A27;
  --sheet-2: #172131;
  --ink: #E6EBF2;
  --ink-2: #AAB4C4;
  --ink-3: #8691A3;
  --line: #222D3E;
  --line-2: #334058;
  --pencil: #5B6980;
  --scrim: rgba(0, 0, 0, .55);
  --blueprint: #0F2B69;
  --on-bp: #EEF3FF;
  --on-bp-2: #B8CAF0;
  --bp-line: rgba(180, 205, 255, .08);
  --bp-rule: rgba(180, 205, 255, .24);
  --accent: #6F9BFF;
  --accent-hover: #8DB0FF;
  --accent-weak: #172A4F;
  --on-accent: #0C121C;
  --ok: #56C98F;
  --ok-weak: #12291E;
  --warn: #F0B54A;
  --warn-dot: #D9A03A;
  --warn-weak: #2A2112;
  --stop: #FF7A70;
  --st-ok: #56C98F;
  --st-draft: #5B6980;
  --st-warn: #D9A03A;
  --st-stop: #E5484D;
  --st-proc: #222D3E;
  --iso-1: #223049;
  --iso-2: #18233A;
  --iso-3: #121B2D;
  --iso-4: #070C15;
  --v3-part: #2B3A55;
  --v3-soft: #223049;
  --v3-std: #3B4862;
  --v3-dark: #4D5A72;
  --v3-line: #C9D6EA;
  --grid-dot: #1C2636;
  --ai-1: #5594EC;
  --ai-2: #6B4DD6;
  --ai-3: #1F9F77;
  --ai-4: #8691A3;
  --ai-glow: rgba(85, 148, 236, .5);
  --shadow-float: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -14px rgba(0, 0, 0, .7);
  --code-bg: #070C15;
  --shadow-pop: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-weak); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 图标与 Logo ---------- */
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ic--sm { width: 15px; height: 15px; vertical-align: -2px; }
/* Logo 是纯墨色：浅色主题为近黑，深色主题为近白，与 YMake 的纯黑 / 纯白一致 */
.ym-logo { display: block; flex: none; color: var(--ink); }
/* 图文组合按 YMake 的页头样式排：标志 --s，间距 --s × 10/36；字标行高 1，字距已排进路径；副标字距 .32em、左缩 .1em */
/* 字标大写高度 = 标志的一半（.ym-wm 的 viewBox 正好是大写高度）；副标字号 = 标志 × .34、行高 1；
   两行之间 = 标志 × .16，于是字标顶对齐标志顶、副标底对齐标志底 */
.ym-lockup { display: inline-flex; align-items: center; gap: calc(var(--s, 36px) * .28); flex: none; color: var(--ink); line-height: 1; text-decoration: none; }
.ym-lockup .ym-logo { width: var(--s, 36px); height: var(--s, 36px); color: inherit; }
.ym-word { display: flex; flex-direction: column; gap: calc(var(--s, 36px) * .16); min-width: 0; }
.ym-wm { display: block; height: calc(var(--s, 36px) * .5); width: auto; color: inherit; }
.ym-lockup small { display: block; font-family: var(--font-sans); font-size: calc(var(--s, 36px) * .34); font-weight: 500; letter-spacing: .3em; line-height: 1; padding-left: .1em; color: var(--ink-3); white-space: nowrap; }
.ym-logo--light, .ym-lockup--light { color: var(--on-bp); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-2);
  border: 1px solid var(--line-2); background: var(--sheet); color: var(--ink);
  font-size: 13.5px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
  text-decoration: none; transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--sheet-2); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--quiet:hover { background: var(--sheet-2); color: var(--ink); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn--lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 状态：圆点 + 文字 ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status--ok::before { background: var(--ok); }
.status--warn::before { background: var(--warn-dot); }
.status--stop::before { background: var(--stop); }
.status--accent::before { background: var(--accent); }
.status--draft::before { background: transparent; border: 1.5px dashed var(--ink-3); width: 8px; height: 8px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-1); background: var(--sheet-2); color: var(--ink-2); font-size: 12px; white-space: nowrap; }

/* 结果分级：用形状区分 */
.tier { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tier::before { content: ""; width: 10px; height: 10px; flex: none; border: 1.5px solid var(--accent); background: transparent; }
.tier--same::before { background: var(--accent); }
.tier--family::before { background: linear-gradient(135deg, var(--accent) 0, var(--accent) 50%, transparent 50%, transparent 100%); }

/* 依据：写成句子，符号开头 */
.fact { display: flex; gap: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.fact i { font-style: normal; font-weight: 600; width: 1em; text-align: center; flex: none; color: var(--ink-3); }
.fact--match i { color: var(--ok); }
.fact--diff i { color: var(--warn-dot); }
.fact--stop, .fact--stop i { color: var(--stop); }

/* ---------- 数据状态 ---------- */
/* 状态条：一段一种状态，段与段之间留 2px 缝；旁边的图例写出数量，不只靠颜色 */
.sbar { display: flex; gap: 2px; height: 12px; }
.sbar i { position: relative; display: block; height: 100%; min-width: 3px; background: var(--st-ok); transition: flex-grow .35s ease-out; }
.sbar i::after { content: ""; position: absolute; left: 0; right: 0; top: -8px; bottom: -8px; }
.sbar i:first-child { border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
.sbar i:last-child { border-top-right-radius: 3px; border-bottom-right-radius: 3px; }
.sbar .s-draft { background: var(--st-draft); }
.sbar .s-warn { background: var(--st-warn); }
.sbar .s-stop { background: var(--st-stop); }
.sbar .s-proc { background: var(--st-proc); }
.sbar--sm { height: 6px; }
.sbar--sm i::after { top: -6px; bottom: -6px; }
.slegend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 12px 0 0; padding: 0; }
.slegend li { display: inline-flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.slegend li::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--st-ok); flex: none; transform: translateY(1px); }
.slegend .l-draft::before { background: var(--st-draft); }
.slegend .l-warn::before { background: var(--st-warn); }
.slegend .l-stop::before { background: var(--st-stop); }
.slegend .l-proc::before { background: var(--st-proc); }
.slegend b { color: var(--ink); font-weight: 600; }

/* ---------- 容器 ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-3); }
.draft { background: var(--sheet); border: 1.5px dashed var(--pencil); border-radius: var(--r-3); }
.inked { background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-3); }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--r-3); background: var(--sheet-2); color: var(--ink); font-size: 13.5px; }
.notice .ic { margin-top: 2px; color: var(--ink-3); }
.notice--warn { background: var(--warn-weak); }
.notice--warn .ic { color: var(--warn); }
.notice--ok { background: var(--ok-weak); }
.notice--ok .ic { color: var(--ok); }

/* ---------- 表单 ---------- */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-2);
  background: var(--sheet); color: var(--ink); font: inherit; font-size: 14px;
}
.textarea { height: auto; min-height: 84px; padding: 9px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; color: var(--ink-2); }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-2); background: var(--sheet-2); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-1); background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 27, 45, .12); }

/* ---------- 表格与代码 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.code { margin: 0; padding: 16px 18px; overflow-x: auto; background: var(--code-bg); color: var(--code-fg); border-radius: var(--r-3); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; }
.code .k { color: var(--code-key); }
.code .s { color: var(--code-str); }
.code .n { color: var(--code-num); }
.code .c { color: var(--code-2); }

/* ---------- 零件图纸（SVG） ---------- */
.dw { display: block; width: 100%; height: auto; max-width: 100%; --dw-ink: var(--ink); --dw-thin: var(--ink-3); --dw-fill: var(--sheet); }
.dw * { vector-effect: non-scaling-stroke; }
.dw--bp { --dw-ink: var(--on-bp); --dw-thin: var(--on-bp-2); --dw-fill: transparent; }
.dw-frame { fill: var(--dw-fill); stroke: var(--dw-ink); stroke-width: 1.1; }
.dw-o { fill: none; stroke: var(--dw-ink); stroke-width: 1.4; }
.dw-t { fill: none; stroke: var(--dw-thin); stroke-width: .75; }
.dw-c { fill: none; stroke: var(--dw-thin); stroke-width: .7; stroke-dasharray: 9 2.5 1.5 2.5; }
.dw-h { fill: none; stroke: var(--dw-thin); stroke-width: .75; stroke-dasharray: 3.5 2.5; }
.dw-ah { fill: var(--dw-thin); stroke: none; }
.dw-txt { fill: var(--dw-ink); font-family: var(--font-drawing); font-size: 3.6px; }
.dw-txt--lg { font-size: 6px; font-weight: 600; }
.dw-txt--k { fill: var(--dw-thin); font-size: 2.9px; }
.dw-dim { fill: var(--dw-ink); font-family: var(--font-sans); font-size: 3.7px; font-weight: 500; }
.dw-mk { fill: none; stroke-width: 1.6; stroke: var(--warn-dot); }
.dw-mk--miss { stroke-dasharray: 4 3; }
.dw-mk--stop { stroke: var(--stop); }
.dw-mk--ok { stroke: var(--ok); }
.dw-mk--src { stroke: var(--accent); }
.dw-src { fill: var(--accent-weak); stroke: var(--accent); stroke-width: 1.3; }
.dw-src--miss { fill: none; stroke-dasharray: 3 2; }
.dw-flag rect { fill: var(--warn-weak); stroke: var(--warn-dot); stroke-width: .9; }
.dw-flag text { fill: var(--warn); font-family: var(--font-sans); font-size: 4.3px; font-weight: 600; }
.dw-flag--stop rect { fill: var(--sheet); stroke: var(--stop); }
.dw-flag--stop text { fill: var(--stop); }
.dw-layer-a .dw-o, .dw-layer-a .dw-t { stroke: var(--ink-3); }
.dw-layer-a .dw-o { stroke-dasharray: 4 2.5; }
.dw-layer-b .dw-o { stroke: var(--accent); }
.dw-layer-b .dw-t, .dw-layer-b .dw-c { stroke: var(--accent); opacity: .7; }
.iso-top { fill: var(--iso-1); stroke: var(--dw-ink); stroke-width: 1.1; stroke-linejoin: round; }
.iso-l { fill: var(--iso-2); stroke: var(--dw-ink); stroke-width: 1.1; stroke-linejoin: round; }
.iso-r { fill: var(--iso-3); stroke: var(--dw-ink); stroke-width: 1.1; stroke-linejoin: round; }
.iso-hole { fill: var(--iso-4); stroke: var(--dw-ink); stroke-width: .9; }
.iso-mk { fill: none; stroke: var(--warn-dot); stroke-width: 1.6; }

/* ---------- 轻量查看器（assets/ymeta-view.js） ---------- */
.v2d { position: relative; overflow: hidden; touch-action: none; }
.v2d-stage { position: absolute; inset: 0; cursor: grab; }
.v2d-stage:active { cursor: grabbing; }
.v2d.is-measure .v2d-stage { cursor: crosshair; }
.v2d-stage .dw { width: 100%; height: 100%; }
/* 扫描件：微微歪、发黄、有扫描纹路。识别率低是这类图的常态，界面照常可用 */
.v2d.is-scan .v2d-stage .dw { filter: contrast(.86) sepia(.22) brightness(.985); transform: rotate(-.35deg) scale(1.008); }
.v2d.is-scan .v2d-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; background: repeating-linear-gradient(0deg, rgba(30, 22, 0, .035) 0 1px, transparent 1px 3px), radial-gradient(ellipse at 28% 18%, transparent 52%, rgba(30, 22, 0, .09)); }
.v2d.is-scan .v2d-read { color: var(--ink-2); }
.v2d-read { position: absolute; left: 12px; bottom: 10px; font-size: 12.5px; color: var(--ink-2); pointer-events: none; }
.hide-dims .dw-g-dims, .hide-cl .dw-c, .hide-cl .dw-h, .hide-ai .dw-g-ai { display: none; }
.dw-pin { cursor: pointer; }
.dw-pin circle { fill: var(--accent); stroke: var(--sheet); stroke-width: .8; }
.dw-pin text { fill: var(--on-accent); font-family: var(--font-sans); font-size: 3.6px; font-weight: 700; pointer-events: none; }
.dw-pin--warn circle { fill: var(--warn-dot); }
.dw-pin--stop circle { fill: var(--stop); }
.dw-pin--nil circle { fill: var(--sheet); stroke: var(--ink-3); stroke-dasharray: 1.2 1; }
.dw-pin--nil text { fill: var(--ink-3); }
.dw-pin.is-on circle, .dw-pin:hover circle, .dw-pin:focus circle { stroke: var(--ink); stroke-width: 1; }
.dw-pin:focus { outline: none; }
.dw-meas { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 3 2; }
.dw-meas-pt { fill: var(--accent); }
.dw-meas-t rect { fill: var(--accent); }
.dw-meas-t text { fill: var(--on-accent); font-family: var(--font-sans); font-weight: 700; }
.v3d-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.v3d-canvas:active { cursor: grabbing; }
.v3d-fallback { display: grid; place-items: center; gap: 8px; height: 100%; padding: 16px; text-align: center; font-size: 13px; color: var(--ink-3); }
.v3d-fallback .dw { max-width: 420px; }

/* ---------- AI 透视：版面分析找到的区域和特征（ymeta-view.js 的 xray 图层） ---------- */
.dw-g-xray { display: none; }
.show-xray .dw-g-xray { display: inline; }
.xr .xb { fill: var(--accent); fill-opacity: .06; stroke: var(--accent); stroke-width: .7; stroke-dasharray: 2.4 1.4; }
.xr .xt rect { fill: var(--accent); }
.xr .xt text { fill: var(--on-accent); font-family: var(--font-sans); font-size: 3.5px; font-weight: 700; }
.xr.f1 .xb, .xr.f2 .xb, .xr.f3 .xb, .xr.f4 .xb { stroke-dasharray: none; stroke-width: .8; fill-opacity: .1; }
.xr.f1 .xb { stroke: var(--ai-1); fill: var(--ai-1); }
.xr.f1 .xt rect { fill: var(--ai-1); }
.xr.f2 .xb { stroke: var(--ai-2); fill: var(--ai-2); }
.xr.f2 .xt rect { fill: var(--ai-2); }
.xr.f2 .xt text { fill: #FFFFFF; }
.xr.f3 .xb { stroke: var(--ai-3); fill: var(--ai-3); }
.xr.f3 .xt rect { fill: var(--ai-3); }
.xr.f3 .xt text { fill: #03261A; }
.xr.f4 .xb { stroke: var(--ai-4); fill: var(--ai-4); }
.xr.f4 .xt rect { fill: var(--ai-4); }
.xr.f4 .xt text { fill: var(--paper); }
.show-xray .xr { animation: xrIn .5s ease-out both; animation-delay: calc(var(--i) * 80ms); }
@keyframes xrIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 对照：图纸上的特征 ↔ 3D 上的特征（YM.Pair） ---------- */
.pair { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.pair-a, .pair-b { position: relative; min-width: 0; min-height: 0; border-radius: 14px; background: var(--sheet); box-shadow: var(--shadow-float); overflow: hidden; }
.pair-a { background: var(--sheet); }
.pair-ov { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 3; filter: drop-shadow(0 0 3px var(--ai-glow)); }
@media (max-width: 760px) { .pair { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); } }
.pl { color: var(--ai-1); }
.pl-bore { color: var(--ai-2); }
.pl-taps { color: var(--ai-3); }
.pl-slots { color: var(--ai-4); }
.pl-ne, .pl-miss { color: var(--stop); }
.pl .ln { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.pl-miss .ln { stroke-dasharray: .018 .014; }
.pl .ea, .pl .eb circle { fill: currentColor; stroke: var(--sheet); stroke-width: 1.5; }
.pl .eb path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.pl .tg rect { fill: var(--sheet); stroke: currentColor; stroke-width: 1; }
.pl .tg text { fill: currentColor; font-family: var(--font-sans); font-size: 11.5px; font-weight: 600; }
.pl.in .ln { stroke-dasharray: 1; stroke-dashoffset: 1; animation: plDraw .8s cubic-bezier(.3, .6, .2, 1) forwards; animation-delay: var(--d); }
.pl-miss.in .ln { stroke-dasharray: .018 .014; stroke-dashoffset: 0; animation: plFade .6s ease-out both; animation-delay: var(--d); }
.pl.in .ea, .pl.in .eb, .pl.in .tg { animation: plFade .4s ease-out both; animation-delay: calc(var(--d) + .55s); }
.pl.is-on .ln { stroke-width: 3; }
.pl.is-dim { opacity: .22; }
@keyframes plDraw { to { stroke-dashoffset: 0; } }
@keyframes plFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 流水线（YM.Flow） ---------- */
.flow { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
.fl-track { stroke: var(--line-2); stroke-width: 2; }
.fl-done { stroke: var(--accent); stroke-width: 2; }
.fl-node { fill: var(--sheet); stroke: var(--line-2); stroke-width: 2; }
.fl-st.is-on .fl-node { fill: var(--accent); stroke: var(--accent); }
.flow.is-busy .fl-st.is-on .fl-node { filter: drop-shadow(0 0 4px var(--ai-glow)); }
.fl-name { fill: var(--ink); font-size: 13px; font-weight: 600; }
.fl-n { fill: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.fl-sub { fill: var(--ink-3); font-size: 11px; }
.fl-out { fill: none; opacity: .5; }
.fl-out.ok, .fl-p.ok { stroke: var(--st-ok); fill: var(--st-ok); }
.fl-out.draft, .fl-p.draft { stroke: var(--st-draft); fill: var(--st-draft); }
.fl-out.warn, .fl-p.warn { stroke: var(--st-warn); fill: var(--st-warn); }
.fl-out.stop, .fl-p.stop { stroke: var(--st-stop); fill: var(--st-stop); }
.fl-out { fill: none !important; }
.fl-bar.ok { fill: var(--st-ok); }
.fl-bar.draft { fill: var(--st-draft); }
.fl-bar.warn { fill: var(--st-warn); }
.fl-bar.stop { fill: var(--st-stop); }
.fl-on { fill: var(--ink-2); font-size: 12.5px; }
.fl-oc { fill: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.fl-p { fill: var(--accent); stroke: none; }

@media (prefers-reduced-motion: reduce) {
  .show-xray .xr, .pl.in .ln, .pl-miss.in .ln, .pl.in .ea, .pl.in .eb, .pl.in .tg { animation: none; stroke-dashoffset: 0; }
}
