.vex-element-layer { --em-line:var(--line,var(--border)); --em-bg:var(--surface,var(--panel)); --em-font:var(--font,"Segoe UI","Microsoft YaHei UI",sans-serif); position:fixed; inset:0; z-index:1100; font:14px/1.5 var(--em-font); color:var(--fg); letter-spacing:0; }
.vex-element-layer.vex-contained-overlay { position:absolute; }
.vex-element-menu { position:absolute; width:254px; max-width:calc(100% - 16px); max-height:calc(100% - 16px); overflow:auto; overscroll-behavior:contain; padding:6px; background:var(--em-bg); border:1px solid var(--em-line); border-radius:var(--vex-radius-md); box-shadow:var(--pop-shadow,var(--shadow-pop)); animation:vex-element-in var(--vex-fast) var(--vex-ease-enter); }
.vex-element-menu button { font:inherit; color:inherit; border:0; cursor:pointer; }
.vex-element-row { width:100%; min-height:36px; display:flex; gap:8px; align-items:center; text-align:left; padding:6px 10px; border-radius:var(--vex-radius-xs); background:transparent; }
.vex-element-row>span { flex:1; min-width:0; overflow-wrap:anywhere; }
.vex-element-row:hover,.vex-element-row:focus-visible { background:var(--accent-soft); color:var(--accent); outline:none; }
.vex-element-row:disabled,.vex-element-tools button:disabled { opacity:.38; cursor:not-allowed; background:transparent; color:var(--muted); }
.vex-element-row[aria-checked=true]::before { content:'✓'; width:16px; color:var(--accent); }
.vex-element-row.danger { color:var(--danger); }
.vex-element-icon { display:block; width:var(--vex-operation-icon-size,18px); height:var(--vex-operation-icon-size,18px); fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.vex-element-row>.vex-element-icon:last-child { margin-left:auto; }
.vex-element-row>.vex-expand-icon { color:var(--muted); }
.vex-element-rule { height:1px; background:var(--em-line); margin:5px 4px; }
.vex-element-caption { padding:5px 10px; color:var(--muted); font-size:12px; }
.vex-element-tools { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; margin:4px 0 6px; }
.vex-element-tools button { min-width:0; height:36px; border-radius:var(--vex-radius-xs); display:flex; align-items:center; justify-content:center; background:var(--panel); font-size:16px; }
.vex-element-tools button:hover,.vex-element-tools button:focus-visible { background:var(--accent-soft); color:var(--accent); }
.vex-element-menu header { display:flex; align-items:center; gap:8px; padding:5px; border-bottom:1px solid var(--em-line); margin-bottom:5px; }
.vex-element-menu header h2 { flex:1; font:600 16px/1.5 var(--em-font); margin:0; }
.vex-element-icon-button { width:32px; height:32px; border:0; border-radius:var(--vex-radius-xs); display:grid; place-items:center; background:transparent; color:var(--muted); cursor:pointer; flex-shrink:0; }
.vex-element-icon-button:hover { color:var(--accent); background:var(--accent-soft); }
.vex-element-sheet { background:#0004; display:flex; align-items:flex-end; }
.vex-element-sheet .vex-element-menu { position:relative; width:100%; max-width:100%; max-height:85%; border-radius:var(--vex-radius-md) var(--vex-radius-md) 0 0; padding:8px 12px max(12px,env(safe-area-inset-bottom)); display:flex; flex-direction:column; overflow:hidden; animation:vex-element-sheet-in var(--vex-duration) var(--vex-ease); }
.vex-element-sheet header { flex-shrink:0; }
.vex-element-sheet .vex-element-content { min-height:0; overflow:auto; overscroll-behavior:contain; }
.vex-element-content::-webkit-scrollbar,.vex-element-menu::-webkit-scrollbar { width:6px; height:6px; }
.vex-element-content::-webkit-scrollbar-thumb,.vex-element-menu::-webkit-scrollbar-thumb { background:var(--em-line); border-radius:var(--vex-radius-2xs); }
.vex-element-content::-webkit-scrollbar-button,.vex-element-menu::-webkit-scrollbar-button { display:none; }
.vex-element-sheet .vex-element-row { min-height:44px; }
.vex-element-sheet .vex-element-tools button { height:44px; }
.device-tablet .vex-element-sheet { justify-content:center; }
.device-tablet .vex-element-sheet .vex-element-menu { width:520px; max-width:calc(100% - 24px); }
.vex-element-dialog-layer { display:flex; align-items:center; justify-content:center; background:#0004; padding:20px; }
.vex-element-dialog { display:flex; flex-direction:column; width:520px; max-width:100%; max-height:100%; min-height:0; overflow:hidden; background:var(--em-bg); border:1px solid var(--em-line); border-radius:var(--vex-radius-md); box-shadow:var(--pop-shadow,var(--shadow-pop)); animation:vex-element-in var(--vex-exit) var(--vex-ease-enter); }
.vex-element-dialog header { display:flex; align-items:center; gap:12px; padding:14px 18px; border-bottom:1px solid var(--em-line); flex-shrink:0; }
.vex-element-dialog h2 { margin:0; font-size:16px; font-weight:600; flex:1; }
.vex-element-dialog-body { padding:18px; min-height:0; overflow:auto; overscroll-behavior:contain; }
.vex-element-dialog label { display:block; font-size:13px; margin:0 0 6px; }
.vex-element-dialog input,.vex-element-dialog textarea { font:inherit; display:block; width:100%; min-width:0; border:1px solid var(--control-border,var(--em-line)); border-radius:var(--vex-radius-pill); padding:9px 10px; color:var(--fg); background:transparent; margin-bottom:14px; }
.vex-element-dialog textarea { border-radius:var(--vex-radius-md); min-height:180px; resize:vertical; font:13px/1.7 var(--mono,Consolas,monospace); tab-size:2; }
.vex-element-dialog textarea[readonly] { min-height:100px; }
.vex-element-dialog footer { padding:12px 18px; border-top:1px solid var(--em-line); display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-shrink:0; }
.vex-element-dialog footer button { border:1px solid var(--em-line); border-radius:var(--vex-radius-xs); padding:8px 15px; background:var(--em-bg); color:var(--fg); font:inherit; cursor:pointer; }
.vex-element-dialog footer button.primary { background:var(--accent); color:var(--on-accent,var(--accent-fg)); border-color:var(--accent); }
.vex-element-error { color:var(--danger); margin:0; font-size:13px; }
.vex-element-preview { overflow:auto; max-width:100%; }
.vex-element-preview img { max-width:100%; display:block; margin:auto; }
.vex-element-entry { margin-left:8px; width:30px; height:28px; border:0; border-radius:var(--vex-radius-xs); padding:5px; background:transparent; color:var(--muted); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
.vex-element-entry:hover { color:var(--accent); background:var(--accent-soft); }
.device-phone .vex-element-entry,.device-tablet .vex-element-entry { width:44px; height:36px; }
.vex-element-layer[data-motion=false] *,.vex-element-layer[data-motion=off] * { animation:none!important; transition:none!important; }
.menu-item[aria-disabled=true] { opacity:.38; cursor:default; pointer-events:none; }
@keyframes vex-element-in { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
@keyframes vex-element-sheet-in { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }
@media(max-width:600px) { .vex-element-dialog-layer { padding:10px; } .vex-element-dialog-body { padding:14px; } .vex-element-dialog header,.vex-element-dialog footer { padding:12px 14px; } }
@media(prefers-reduced-motion:reduce) { .vex-element-layer * { animation:none!important; transition:none!important; } }

/* 选区浮动条（selection-menu）：选中文本后在选区上方弹出的横向格式条，令牌与元素菜单同源。 */
.vex-selection-layer { position:fixed; inset:0; z-index:1090; pointer-events:none; font:14px/1.5 var(--font,"Segoe UI","Microsoft YaHei UI",sans-serif); color:var(--fg); }
.vex-selection-layer.vex-contained-overlay { position:absolute; }
.vex-selection-bar { pointer-events:auto; position:absolute; display:flex; align-items:center; gap:1px; padding:3px; background:var(--surface,var(--panel)); border:1px solid var(--line,var(--border)); border-radius:var(--vex-radius-lg,var(--vex-radius-md)); box-shadow:var(--pop-shadow,var(--shadow-pop)); animation:vex-element-in var(--vex-fast) var(--vex-ease-enter); }
.vex-selection-bar>button { display:grid; place-items:center; width:30px; height:30px; border:0; border-radius:var(--vex-radius-xs); background:transparent; color:inherit; font:inherit; cursor:pointer; }
.vex-selection-bar>button:hover,.vex-selection-bar>button:focus-visible { background:var(--accent-soft); color:var(--accent); outline:none; }
.vex-selection-icon { display:block; width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.vex-selection-glyph { font-size:13px; font-weight:700; line-height:1; }
.vex-selection-glyph.strike { text-decoration:line-through; }
.vex-selection-glyph.fg { color:#1971c2; text-decoration:underline; text-underline-offset:2px; }
.vex-selection-glyph.bg { background:#fff3bf; border-radius:3px; padding:1px 3px; }
.vex-selection-bar button:has(.vex-selection-glyph) { width:auto; min-width:30px; padding:0 5px; gap:2px; display:flex; align-items:center; }
.vex-selection-rule { width:1px; height:18px; background:var(--line,var(--border)); margin:0 3px; }
.vex-selection-flyout { pointer-events:auto; position:absolute; top:calc(100% + 6px); min-width:150px; padding:8px; display:grid; grid-template-columns:repeat(6,26px); gap:5px; background:var(--surface,var(--panel)); border:1px solid var(--line,var(--border)); border-radius:var(--vex-radius-md); box-shadow:var(--pop-shadow,var(--shadow-pop)); animation:vex-element-in var(--vex-fast) var(--vex-ease-enter); }
.vex-selection-flyout:has(.vex-selection-size) { grid-template-columns:repeat(6,32px); }
.vex-selection-swatch { width:26px; height:26px; border:1px solid var(--line,var(--border)); border-radius:var(--vex-radius-xs); cursor:pointer; padding:0; }
.vex-selection-swatch:hover,.vex-selection-swatch:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.vex-selection-size { width:32px; height:26px; border:0; border-radius:var(--vex-radius-xs); background:transparent; color:inherit; font:inherit; font-size:12px; cursor:pointer; }
.vex-selection-size:hover,.vex-selection-size:focus-visible { background:var(--accent-soft); color:var(--accent); outline:none; }

/* 行内样式面板（Semi 风格色板）：浮动条与快捷工具条共用，浅档给背景、深档给文字。 */
.vex-span-panel { pointer-events:auto; position:absolute; display:flex; flex-direction:column; gap:7px; padding:10px; min-width:170px; background:var(--surface,var(--panel)); border:1px solid var(--line,var(--border)); border-radius:var(--vex-radius-md); box-shadow:var(--pop-shadow,var(--shadow-pop)); animation:vex-element-in var(--vex-fast) var(--vex-ease-enter); }
.vex-span-title { font-size:12px; color:var(--muted); }
.vex-span-grid { display:grid; grid-template-columns:repeat(9,22px); gap:5px; }
.vex-span-grid.sizes { grid-template-columns:repeat(6,30px); }
.vex-span-swatch { width:22px; height:22px; padding:0; border:1px solid var(--line,var(--border)); border-radius:5px; cursor:pointer; }
.vex-span-swatch:hover,.vex-span-swatch:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.vex-span-size { width:30px; height:26px; border:0; border-radius:var(--vex-radius-xs); background:transparent; color:inherit; font:inherit; font-size:12px; cursor:pointer; }
.vex-span-size:hover,.vex-span-size:focus-visible { background:var(--accent-soft); color:var(--accent); outline:none; }
.vex-span-clear { border:1px solid var(--line,var(--border)); border-radius:var(--vex-radius-xs); background:transparent; color:var(--muted); font:inherit; font-size:12px; padding:5px 8px; cursor:pointer; text-align:left; }
.vex-span-clear:hover,.vex-span-clear:focus-visible { color:var(--danger); border-color:var(--danger); background:var(--danger-soft); outline:none; }

/* Semi ColorPicker 式选色器：SV 方块 + 色相条 + Hex 行 + 快捷色板。 */
.vex-span-panel.color { width:236px; }
.vex-cp { display:flex; flex-direction:column; gap:8px; }
.vex-cp-sv { position:relative; height:132px; border-radius:6px; cursor:crosshair; background:linear-gradient(to top,#000,rgba(0,0,0,0)),linear-gradient(to right,#fff,#0ff); }
.vex-cp-dot { position:absolute; width:12px; height:12px; border:2px solid #fff; border-radius:50%; box-shadow:0 0 3px #00000066; transform:translate(-50%,-50%); pointer-events:none; }
.vex-cp-hue { -webkit-appearance:none; appearance:none; width:100%; height:10px; border-radius:5px; outline:none; background:linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00); cursor:pointer; }
.vex-cp-hue::-webkit-slider-thumb { -webkit-appearance:none; width:16px; height:16px; border-radius:50%; background:#fff; border:2px solid var(--accent,var(--primary,#4338CA)); box-shadow:0 1px 3px #0004; }
.vex-cp-row { display:flex; gap:8px; align-items:center; }
.vex-cp-preview { width:30px; height:24px; border-radius:5px; border:1px solid var(--line,var(--border)); flex-shrink:0; }
.vex-cp-hex { flex:1; min-width:0; font:12px/1.6 Consolas,monospace; padding:5px 9px; border:1px solid var(--control-border,var(--line,var(--border))); border-radius:var(--vex-radius-xs); background:transparent; color:var(--fg); }
.vex-cp-hex:focus { outline:none; border-color:var(--accent,var(--primary,#4338CA)); }

/* 快捷工具条上的行内样式按钮：A 字符号 + 下拉箭头。 */
.format-button .span-glyph { font-size:13px; font-weight:700; line-height:1; }
.format-button .span-glyph.fg { color:#0064FA; text-decoration:underline; text-underline-offset:2px; }
.format-button .span-glyph.bg { background:#FFF3BF; border-radius:3px; padding:1px 3px; }
.format-button .span-chevron { width:10px; height:10px; }
.format-button.span-tool { display:inline-flex; align-items:center; gap:2px; width:auto; padding:0 6px; }
