/* ---------- 拆镜表卡 (SC-Detect 场景检测) ---------- */
.card.storyboard { --tc: var(--c-note); --tc-rgb: var(--c-note-rgb); container-type: inline-size; }
.card.storyboard .sb-body { display: flex; flex-direction: column; gap: 8px; }
.card.storyboard .sb-meta {
  font-size: 12px; color: rgba(255, 255, 255, .65); padding: 0 2px;
}
.card.storyboard .sb-strip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
}
.card.storyboard .sb-cell {
  position: relative; flex: 0 0 auto; width: 128px; cursor: pointer;
  border-radius: 8px; overflow: hidden; background: #000;
  border: 1px solid rgba(var(--c-note-rgb), .25);
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.card.storyboard .sb-cell:hover {
  transform: translateY(-2px); border-color: rgba(var(--c-note-rgb), .8);
  box-shadow: 0 4px 14px rgba(var(--c-note-rgb), .25);
}
.card.storyboard .sb-cell img { width: 128px; height: 72px; object-fit: cover; display: block; }
.card.storyboard .sb-cell-dur {
  position: absolute; right: 4px; bottom: 4px; z-index: 1;
  padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 600;
  background: rgba(0, 0, 0, .62); color: #ffd;
}
.card.storyboard .sb-cell-ts {
  position: absolute; left: 4px; top: 4px; z-index: 1;
  padding: 1px 6px; border-radius: 8px; font-size: 10px;
  background: rgba(0, 0, 0, .62); color: rgba(255, 255, 255, .85);
}
.card.storyboard .btn-sb-expand {
  margin-top: 2px; width: 100%; padding: clamp(9px, 2cqw, 18px) 10px;
  border: 1px solid rgba(var(--c-note-rgb), .4); border-radius: 10px;
  background: rgba(var(--c-note-rgb), .08);
  color: #f5dfa0; font-size: clamp(14px, 2.7cqw, 22px); font-weight: 600;
  cursor: pointer; transition: background .15s, filter .15s, transform .06s;
}
.card.storyboard .btn-sb-expand:hover { background: rgba(var(--c-note-rgb), .18); filter: brightness(1.1); }
.card.storyboard .btn-sb-expand:active { transform: scale(.98); }
.card.storyboard .gen-progress { min-height: 90px; }

/* 提示词卡: 连入参考素材条 (全能参考垫图) — 缩略 + @名牌 + ❌移除 + 悬停放大 */
.card.prompt .linked-refs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 2px; padding: 6px 9px;
  border: 1px dashed rgba(var(--c-prompt-rgb), .3); border-radius: 10px;
  background: rgba(var(--c-prompt-rgb), .06);
}
/* 单个参考素材 (缩略 + @名牌 + ❌快速移除) */
.card.prompt .linked-refs .ref-item {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  width: 42px; cursor: pointer; user-select: none;
}
.card.prompt .linked-refs .ref-item .ref-thumb,
.card.prompt .linked-refs .ref-item .ref-thumb img {
  width: 40px; height: 40px;
}
.card.prompt .linked-refs .ref-item .ref-thumb {
  border-radius: 8px; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.card.prompt .linked-refs .ref-item:hover .ref-thumb {
  transform: scale(1.12); box-shadow: 0 4px 14px rgba(3,6,14,.6);
  z-index: 4; position: relative;
}
.card.prompt .linked-refs .ref-item b {
  margin-top: 2px; font-size: 9px; font-weight: 600; letter-spacing: .02em;
  color: var(--tx-3); white-space: nowrap;
}
.card.prompt .linked-refs .ref-item:hover b { color: var(--tx-2); }
.card.prompt .linked-refs .ref-unlink {
  position: absolute; top: -5px; right: 1px; z-index: 5;
  width: 15px; height: 15px; padding: 0; border: none; border-radius: 50%;
  background: rgba(120,130,150,.9); color: #fff;
  font-size: 9px; line-height: 15px; text-align: center; cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s, transform .12s;
}
.card.prompt .linked-refs .ref-item:hover .ref-unlink { opacity: 1; }
.card.prompt .linked-refs .ref-unlink:hover { background: #e5484d; transform: scale(1.2); }
/* 视频参考素材缩略: 带 ▶ 角标 (尺寸由上方 .ref-item .ref-thumb 统一控制) */
.card.prompt .linked-refs .ref-thumb {
  position: relative; border-radius: 8px; border: 1px solid #4a5a80;
  overflow: hidden; display: block; background: #0c0e14;
}
.card.prompt .linked-refs .ref-thumb img { object-fit: cover; display: block; }
.card.prompt .linked-refs .ref-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
.card.prompt .linked-refs .ref-thumb i {
  position: absolute; right: 2px; bottom: 2px; font-size: 9px; line-height: 1;
  color: #fff; background: rgba(20,25,35,.85); border-radius: 4px; padding: 2px 3px;
  font-style: normal;
}
.card.prompt .linked-refs span {
  font-size: 11px; color: #8fb0e8; letter-spacing: .02em;
}
.card.prompt .linked-refs-empty {
  border-color: #3a4050; background: transparent; justify-content: center;
}
.card.prompt .linked-refs-empty span, .card.prompt .linked-refs.linked-refs-empty {
  color: #6a7288; font-size: 11px;
}

/* 生成参数控制台: 彩色胶囊标签 (模式=紫 / 时长=琥珀 / 比例=青) + 贝壳徽章 */
.gen-params {
  display: flex; align-items: center; gap: 7px;
  margin: 8px 0 2px;
}
/* 模式专属参数模块框: 只装当前模式的参数, 各模式独立不互通 */
.gen-params .mode-params {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
  border: 1px solid rgba(var(--c-accent-rgb), .22);
  border-radius: 12px;
  background: rgba(91,140,255,.05);
  padding: 4px 7px;
}
.gen-params .mode-params .pill-ratio { flex: 1; }
/* 未接入模式 (M3/Q3): ---- 占位区 */
.gen-params .mode-params-empty {
  border-style: dashed; border-color: rgba(120,130,160,.3);
  background: rgba(120,130,160,.05);
}
.mode-params-empty .ph {
  color: #6a7288; font-size: 11.5px; white-space: nowrap;
  padding: 3px 8px; border-radius: 20px;
  border: 1px dashed rgba(120,130,160,.28);
  background: rgba(120,130,160,.07);
}
.mode-params-empty .ph-cost {
  color: #565e72; font-size: 11.5px; white-space: nowrap;
  margin-left: auto; padding-right: 2px;
}
.gen-params .pill {
  display: inline-flex; align-items: center; flex-shrink: 0;
  border-radius: 20px; border: 1px solid;
  transition: box-shadow .15s, filter .15s;
}
.gen-params .pill:hover { filter: brightness(1.2); }
.gen-params .pill select {
  appearance: none; -webkit-appearance: none;
  border: none; background: transparent; outline: none; cursor: pointer;
  font: inherit; color: inherit;
  padding: 4px 16px 4px 11px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2388909f'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.gen-params .pill select option { background: #1c2030; color: #cfd6e4; }
.pill-mode {
  border-color: rgba(139,92,246,.45) !important;
  background: rgba(139,92,246,.16); color: #d6ccff;
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
}
/* 模型后面的排序/切换手柄 */
.btn-mode-reorder {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 26px; border-radius: 8px; flex-shrink: 0;
  border: 1px solid rgba(139, 92, 246, .35);
  background: rgba(139, 92, 246, .12);
  color: #c4b5fd; font-size: 13px; line-height: 1;
  cursor: grab; user-select: none;
  transition: all .15s ease;
  padding: 0;
}
.btn-mode-reorder:hover {
  background: rgba(139, 92, 246, .3);
  border-color: rgba(167, 139, 250, .8);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(139, 92, 246, .45);
}
.btn-mode-reorder:active {
  cursor: grabbing;
  transform: scale(.95);
}

/* 模型顺序自定义悬浮面板 */
#mode-reorder-popup {
  position: fixed; z-index: 10000;
  background: #151824; border: 1px solid rgba(139, 92, 246, .45);
  border-radius: 12px; box-shadow: 0 12px 36px rgba(0,0,0,.75), 0 0 20px rgba(139,92,246,.25);
  padding: 10px; min-width: 270px;
  font-family: inherit; color: #e2e8f0;
  backdrop-filter: blur(16px);
  user-select: none;
}
#mode-reorder-popup .mr-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.08);
}
#mode-reorder-popup .mr-title {
  font-size: 12px; font-weight: 700; color: #c4b5fd; display: flex; align-items: center; gap: 5px;
}
#mode-reorder-popup .mr-reset {
  background: transparent; border: none; color: #94a3b8; font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
#mode-reorder-popup .mr-reset:hover { color: #f1f5f9; background: rgba(255,255,255,.08); }
#mode-reorder-popup .mr-list {
  display: flex; flex-direction: column; gap: 4px;
}
#mode-reorder-popup .mr-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; padding: 6px 10px;
  cursor: grab; transition: all .15s ease;
  font-size: 12.5px;
}
#mode-reorder-popup .mr-item:hover {
  background: rgba(139, 92, 246, .18); border-color: rgba(167, 139, 250, .5);
}
#mode-reorder-popup .mr-item.dragging {
  opacity: .35; background: rgba(139, 92, 246, .35); border-style: dashed;
}
#mode-reorder-popup .mr-item.drag-over {
  border-color: #38bdf8; box-shadow: 0 0 10px rgba(56,189,248,.4);
}
#mode-reorder-popup .mr-handle {
  color: #8b5cf6; cursor: grab; font-size: 14px;
}
#mode-reorder-popup .mr-name {
  font-weight: 700; color: #f8fafc;
}
#mode-reorder-popup .mr-tag {
  flex: 1; font-size: 11px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#mode-reorder-popup .mr-btns {
  display: flex; gap: 3px;
}
#mode-reorder-popup .mr-btn {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: #cbd5e1; border-radius: 4px; padding: 2px 6px; font-size: 10px; cursor: pointer;
}
#mode-reorder-popup .mr-btn:hover {
  background: rgba(139, 92, 246, .4); color: #fff; border-color: rgba(167, 139, 250, .6);
}
#mode-reorder-popup .mr-foot {
  margin-top: 8px; font-size: 10.5px; color: #64748b; text-align: center;
}
.pill-dur {
  border-color: rgba(251,191,36,.35) !important;
  background: rgba(251,191,36,.1); color: #ffd98a; font-size: 12px;
}
.pill-res {
  border-color: rgba(91,140,255,.4) !important;
  background: rgba(91,140,255,.12); color: #a8c2ff; font-size: 12px;
}
/* Q3 (Qwen) 专属胶囊: 绿色系, 与 H3 的蓝/琥珀区分 */
.pill-q3-kind {
  border-color: rgba(52,211,153,.45) !important;
  background: rgba(52,211,153,.12); color: #8ce8c3; font-size: 12px;
}
.pill-q3-quality {
  border-color: rgba(52,211,153,.3) !important;
  background: rgba(52,211,153,.08); color: #7fd4b2; font-size: 12px;
}
.pill-q3-ratio {
  flex: 1; min-width: 0;
  border-color: rgba(52,211,153,.3) !important;
  background: rgba(52,211,153,.08); color: #7fd4b2; font-size: 12px;
}
.pill-q3-ratio select { width: 100%; }
.pill-q3-qty {
  border-color: rgba(52,211,153,.45) !important;
  background: rgba(52,211,153,.12); color: #8ce8c3; font-size: 12px;
}
/* M3 (MiniMax Matrix) 专属胶囊: 紫色系, 与 H3 蓝 / Q3 绿区分 */
.pill-m3-mode {
  border-color: rgba(167,139,250,.45) !important;
  background: rgba(167,139,250,.12); color: #c4b5fd; font-size: 11.5px;
}
.pill-m3-mode select { padding: 3px 15px 3px 8px; }
.pill-m3-ratio {
  border-color: rgba(167,139,250,.45) !important;
  background: rgba(167,139,250,.12); color: #c4b5fd; font-size: 12px;
}
.pill-m3-res {
  border-color: rgba(167,139,250,.3) !important;
  background: rgba(167,139,250,.08); color: #b3a4f0; font-size: 12px;
}
.pill-m3-qty {
  border-color: rgba(167,139,250,.45) !important;
  background: rgba(167,139,250,.12); color: #c4b5fd; font-size: 12px;
}
/* D2 (灰豆 GPT-Image-2) 专属胶囊: 琥珀色系, 与 H3 蓝 / Q3 绿 / M3 紫区分 */
.pill-d2-ratio {
  border-color: rgba(251,191,36,.45) !important;
  background: rgba(251,191,36,.12); color: #fcd34d; font-size: 12px;
}
.pill-d2-res {
  border-color: rgba(251,191,36,.3) !important;
  background: rgba(251,191,36,.08); color: #fde68a; font-size: 12px;
}
.pill-d2-qty {
  border-color: rgba(251,191,36,.45) !important;
  background: rgba(251,191,36,.12); color: #fcd34d; font-size: 12px;
}
/* D2 手动补号按钮: 小号琥珀描边 */
.d2-register {
  border: 1px solid rgba(251,191,36,.5);
  background: rgba(251,191,36,.14); color: #fcd34d;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; line-height: 1;
  cursor: pointer; transition: background .15s, box-shadow .15s;
}
.d2-register:hover { background: rgba(251,191,36,.26); box-shadow: 0 0 10px rgba(251,191,36,.4); }
.d2-register:disabled { opacity: .5; cursor: default; box-shadow: none; }
/* 连线导航落地闪烁 (方案A): 青色光圈扩散两圈提示"就是这张" */
@keyframes navFlash {
  0% { box-shadow: 0 0 0 0 rgba(34,211,238,.75); }
  100% { box-shadow: 0 0 0 22px rgba(34,211,238,0); }
}
.card.nav-flash { animation: navFlash .9s ease-out 2; }
/* 单击参考小图锁定连线后的描边 (青色, 与 ↑/↓ 导航同色系) */
.ref-item.ref-locked {
  outline: 2px solid rgba(34,211,238,.9);
  outline-offset: 2px;
  border-radius: 8px;
}
/* 虚拟资产引用无缩略图时的占位块 */
.ref-thumb.ref-virt-ph {
  display: flex; align-items: center; justify-content: center;
  background: #1c2230; color: #8b94a8; font-size: 16px;
}
/* 布局下拉 (行列/横排): 中性石板色, 与各模型主题色区分 */
.pill-layout {
  border-color: rgba(148,163,184,.4) !important;
  background: rgba(148,163,184,.1); color: #b6c2d4; font-size: 11.5px;
}
.pill-layout select { padding: 3px 15px 3px 8px; }
/* @菜单底部: 跨画布资产落卡开关 */
.mention-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-top: 1px solid rgba(120,130,160,.25);
  font-size: 11.5px; color: #8b94a8;
}
.mention-footer button {
  border: 1px solid rgba(148,163,184,.45); border-radius: 12px;
  background: rgba(148,163,184,.12); color: #b6c2d4;
  padding: 2px 10px; font-size: 11.5px; cursor: pointer;
}
.mention-footer button:hover { background: rgba(148,163,184,.24); }
/* 「⇥剪映」已导入徽章: 绿色, 挂在用时徽章下方右上角, 单击显示导入详情 */
.card.video .capcut-badge {
  position: absolute; top: 34px; right: 6px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: rgba(22,101,52,.88); color: #bbf7d0;
  cursor: pointer; z-index: 2;
}
/* 视频对鼠标隐身: 点击物理上落不到视频, Chrome 原生"点画面=播放"不可能发生, 点卡片=纯选中 */
.card.video .img-holder video { pointer-events: none; }
/* 自定义播放/暂停键 (左下角, 图标随播放状态切换; 独立按钮无遮挡问题) */
.card.video .video-play-toggle {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(15,20,32,.82); color: #e8ecf4;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.card.video .video-play-toggle:hover { background: rgba(30,40,60,.92); }
/* 新H3 (Matrix MCP 代理 H3 视频) 专属胶囊: 青色系, 与 H3 蓝 / Q3 绿 / M3 紫 / D2 琥珀 / CHAIN 玫红区分 */

.gen-params .mode-params-nh3 {
  border-color: rgba(34,211,238,.28);
  background: rgba(34,211,238,.05);
}
.pill-nh3-submode {
  border-color: rgba(34,211,238,.45) !important;
  background: rgba(34,211,238,.12); color: #7dd3e8; font-size: 11.5px;
}
.pill-nh3-submode select { padding: 3px 15px 3px 8px; }
.pill-nh3-dur {
  border-color: rgba(34,211,238,.45) !important;
  background: rgba(34,211,238,.12); color: #7dd3e8; font-size: 12px;
}
.pill-nh3-res {
  border-color: rgba(34,211,238,.3) !important;
  background: rgba(34,211,238,.08); color: #67c8dd; font-size: 12px;
}
.pill-nh3-ratio {
  border-color: rgba(34,211,238,.3) !important;
  background: rgba(34,211,238,.08); color: #67c8dd; font-size: 12px;
}
/* CHAIN (导演台长视频) 专属胶囊: 玫红色系, 与 H3 蓝 / Q3 绿 / M3 紫 / D2 琥珀区分 */
.gen-params .mode-params-chain {
  flex-wrap: wrap;   /* 4 个胶囊 + 总时长徽章较宽, 允许换行 */
  border-color: rgba(244,63,94,.28);
  background: rgba(244,63,94,.05);
}
.pill-chain-segs {
  border-color: rgba(244,63,94,.45) !important;
  background: rgba(244,63,94,.14); color: #fda4af; font-size: 12px; font-weight: 700;
}
.pill-chain-dur {
  border-color: rgba(244,63,94,.3) !important;
  background: rgba(244,63,94,.09); color: #fda4af; font-size: 12px;
}
.pill-chain-ratio {
  border-color: rgba(244,63,94,.3) !important;
  background: rgba(244,63,94,.09); color: #fda4af; font-size: 12px;
}
.pill-chain-res {
  border-color: rgba(244,63,94,.3) !important;
  background: rgba(244,63,94,.09); color: #fda4af; font-size: 12px;
}
/* CHAIN 总时长 + 贝壳徽章: 玫红渐变 */
.gen-params .chain-total {
  flex-shrink: 0; padding: 4px 10px; border-radius: 20px; margin-left: auto;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: linear-gradient(135deg, rgba(244,63,94,.18), rgba(251,113,133,.14));
  border: 1px solid rgba(244,63,94,.45); color: #fecdd3;
}
/* CHAIN 生成按钮统一使用公共 H3 虚空雷暴样式 */
.pill-ratio {
  flex: 1; min-width: 0;
  border-color: rgba(45,212,191,.35) !important;
  background: rgba(45,212,191,.1); color: #8fe8db; font-size: 12px;
}
.pill-ratio select { width: 100%; }
/* 提示词优化开关 (✨): 开 = 紫蓝渐变发光, 关 = 灰暗; 点击切换 */
.gen-params .pill-optimize {
  border-color: rgba(120,130,160,.3);
  background: rgba(120,130,160,.08);
  cursor: pointer;
  transition: box-shadow .18s, background .18s, border-color .18s, filter .15s;
}
.gen-params .pill-optimize .gen-optimize {
  appearance: none; -webkit-appearance: none; border: none; background: transparent;
  cursor: pointer; font-size: 13px; line-height: 1; padding: 4px 9px;
  filter: grayscale(1) opacity(.5);
  transition: filter .18s, transform .12s;
}
.gen-params .pill-optimize.on {
  border-color: rgba(139,92,246,.55);
  background: linear-gradient(135deg, rgba(91,140,255,.16), rgba(167,92,246,.18));
  box-shadow: 0 0 12px rgba(139,92,246,.28);
}
.gen-params .pill-optimize.on .gen-optimize { filter: none; }
.gen-params .pill-optimize:hover .gen-optimize { transform: scale(1.2) rotate(8deg); }
/* 贝壳预估徽章 */
.gen-params .gen-cost {
  flex-shrink: 0; padding: 4px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: rgba(244,114,182,.12); border: 1px solid rgba(244,114,182,.35);
  color: #f9a8d4;
}

/* @ 引用菜单 - 三级级联展开架构 (Plan A) */
.mention-menu {
  position: fixed; z-index: 9999; min-width: 175px;
  background: rgba(18, 21, 32, .96); backdrop-filter: blur(16px);
  border: 1px solid rgba(236, 72, 153, .35); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .65), 0 0 20px rgba(236, 72, 153, .12);
  padding: 6px;
}
.mention-menu .mention-section-title {
  padding: 4px 8px; font-size: 11px; font-weight: 700; color: #818cf8;
  letter-spacing: .5px;
}
.mention-menu .mention-divider {
  height: 1px; margin: 4px 2px; background: rgba(255, 255, 255, .08);
}
.mention-menu .mention-item,
.mention-menu .mention-root-header,
.mention-menu .mention-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: 8px; cursor: pointer;
  color: #e2e8f0; font-size: 13px; font-weight: 500;
  position: relative; transition: background .12s, color .12s;
  user-select: none;
}
.mention-menu .mention-item:hover,
.mention-menu .mention-item.active,
.mention-menu .mention-root-header:hover,
.mention-menu .mention-sub-item:hover {
  background: rgba(45, 55, 75, .9);
  color: #fff;
}
.mention-menu .mention-arrow {
  margin-left: auto; font-size: 14px; font-weight: 700; color: #64748b;
}
.mention-menu .mention-sub-count {
  margin-left: auto; font-size: 10px; padding: 1px 5px; border-radius: 10px;
  background: rgba(255, 255, 255, .08); color: #94a3b8; font-weight: 600;
}
.mention-menu .mention-sub-item:hover .mention-arrow,
.mention-menu .mention-root-header:hover .mention-arrow {
  color: #f472b6;
}

/* 级联子菜单容器 */
.mention-item-has-sub {
  position: relative;
}
.mention-sub-menu {
  display: none; position: absolute; left: 100%; top: -6px; margin-left: 6px;
  background: rgba(18, 21, 32, .96); backdrop-filter: blur(16px);
  border: 1px solid rgba(236, 72, 153, .35); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .65);
  padding: 6px; z-index: 10000;
}
.mention-level-2 {
  min-width: 155px;
}
.mention-level-3 {
  min-width: 270px; max-width: 320px;
  max-height: 320px; overflow-y: auto;
}

/* 方案 1: 隐形安全吸附桥 (Safe Hover Bridge - 解决斜向滑动断触) */
.mention-sub-menu::before {
  content: '';
  position: absolute;
  top: -15px; bottom: -15px;
  left: -24px; width: 30px;
  background: transparent;
  pointer-events: auto;
  z-index: 1;
}

/* 悬停/防抖锁定展开逻辑 */
.mention-root-asset-item.is-open > .mention-level-2,
.mention-root-asset-item:hover > .mention-level-2 {
  display: flex; flex-direction: column; gap: 2px;
}
.mention-sub-item.is-open > .mention-level-3,
.mention-sub-item:hover > .mention-level-3 {
  display: flex; flex-direction: column; gap: 2px;
}

/* 展开中父级项锁定高亮 */
.mention-root-asset-item.is-open .mention-root-header,
.mention-sub-item.is-open {
  background: rgba(45, 55, 75, .9);
  color: #fff;
}
.mention-root-asset-item.is-open .mention-root-header .mention-arrow,
.mention-sub-item.is-open .mention-arrow {
  color: #f472b6;
}

/* 翻转到左侧展开 (避免屏幕右边缘溢出) */
.mention-menu.flip-left .mention-sub-menu {
  left: auto; right: 100%; margin-left: 0; margin-right: 6px;
}
.mention-menu.flip-left .mention-sub-menu::before {
  left: auto; right: -24px; width: 30px;
}

/* 资产详情卡片样式 */
.mention-menu .mention-asset-item {
  align-items: flex-start; gap: 10px; padding: 6px 8px;
}
.mention-menu .mention-asset-item img {
  width: 36px; height: 36px; object-fit: cover;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, .15);
  flex-shrink: 0;
}
.mention-menu .mention-ast-text {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.mention-menu .mention-ast-name-row {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
}
.mention-menu .mention-ast-name-row .mention-label {
  font-size: 13px; font-weight: 600; color: #f8fafc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mention-menu .mention-mode-tag {
  font-size: 8.5px; font-weight: 700; padding: 1px 4px; border-radius: 3px;
  background: rgba(234, 179, 8, .2); color: #fef08a; border: 1px solid rgba(234, 179, 8, .4);
}
.mention-menu .mention-ast-desc {
  font-size: 11px; color: #94a3b8; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* @ 引用菜单 - 方案 1 悬停大图预览浮窗 (Hover Preview Card) */
.mention-asset-preview-card {
  position: fixed;
  z-index: 100000;
  width: 240px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(236, 72, 153, 0.45);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(236, 72, 153, 0.2);
  pointer-events: none;
  overflow: hidden;
  animation: mapFadeIn .15s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity .15s ease, transform .15s ease;
}

@keyframes mapFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.map-card-inner {
  display: flex;
  flex-direction: column;
}

.map-img-box {
  width: 100%;
  height: 220px;
  position: relative;
  background: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.map-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.map-ph-emoji {
  font-size: 54px;
}

.map-cat-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  border: 1px solid;
}

.map-tag-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.9);
  color: #cbd5e1;
}

.map-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.map-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.map-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-mode-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(234, 179, 8, 0.2);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.map-prompt {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
  max-height: 62px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.mention-menu .mention-item img {
  width: 26px; height: 26px; object-fit: cover;
  border-radius: 5px; border: 1px solid #4a5a80;
}
.mention-menu .mention-item .mention-thumb {
  position: relative; width: 26px; height: 26px;
  border-radius: 5px; border: 1px solid #4a5a80; overflow: hidden;
  display: block; background: #0c0e14; flex-shrink: 0;
}
.mention-menu .mention-item .mention-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
.mention-menu .mention-item .mention-thumb i {
  position: absolute; right: 1px; bottom: 1px; font-size: 8px; line-height: 1;
  color: #fff; background: rgba(20,25,35,.85); border-radius: 3px; padding: 1px 2px;
  font-style: normal;
}
.mention-menu .mention-empty {
  padding: 8px 10px; color: #6a7288; font-size: 12px;
}

/* 生成计时: 进行中实时秒表 / 完成后总用时徽章 */
.card.video .gen-progress .gen-elapsed {
  font-size: 13px; font-weight: 600; color: #8fb0e8;
  font-variant-numeric: tabular-nums;
}
.card.video .gen-time-badge,
.card.image .gen-time-badge {
  position: absolute; top: 6px; right: 6px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: rgba(35,45,70,.88); color: #c8d4f0;
  pointer-events: none; z-index: 2;
}
/* 真正物理 3D 立体球体徽章 (True 3D Spherical Light Model - 纯球体光照/明暗交界/反光/零散发光) */
.card .mode-badge {
  position: absolute; top: 8px; left: 8px; bottom: auto; right: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  min-width: 28px; min-height: 28px;
  border-radius: 50% !important;
  font-size: 11px; font-weight: 900; letter-spacing: 0.2px;
  text-transform: uppercase;
  color: #ffffff;
  padding: 0 !important;
  box-sizing: border-box;
  pointer-events: none; z-index: 3;
  border: none !important;
}

/* CHAIN 模式 (5字母) 自适应微调 */
.card .mode-badge[data-mode="CHAIN"],
.card .mode-badge.mode-chain {
  width: 32px; height: 32px;
  min-width: 32px; min-height: 32px;
  font-size: 8px; font-weight: 900; letter-spacing: -0.3px;
}

/* 📋 视频/媒体左上角复制 ID 按钮 (并排在 3D 模式球右侧) */
.card .img-holder .btn-copy-vid-id {
  position: absolute; top: 8px; left: 42px; z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: all .15s ease;
}
.card .img-holder .btn-copy-vid-id:hover {
  background: rgba(15, 23, 42, 0.95);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}
.card .img-holder .btn-copy-vid-id:active {
  transform: scale(.95);
}

/* 各模型专属 3D 实体球体 (左上高光斑 · 弧面光影 · 右下背光暗区与环境反光) */
/* D2: 经典宝蓝 3D 球体 (Royal Blue 3D Sphere) */
.card .mode-badge[data-mode="D2"],
.card .mode-badge.mode-d2,
.mode-badge[data-mode="D2"] {
  background: radial-gradient(circle at 30% 24%, #ffffff 0%, rgba(255, 255, 255, 0.75) 12%, rgba(255, 255, 255, 0) 24%),
              radial-gradient(circle at 36% 34%, #60a5fa 0%, #2563eb 40%, #1e40af 70%, #0f172a 100%) !important;
  box-shadow: 0 5px 8px -1px rgba(0, 0, 0, 0.75),
              0 2px 4px rgba(0, 0, 0, 0.5),
              inset -3px -3px 5px rgba(0, 0, 0, 0.85),
              inset 2px 2px 3px rgba(255, 255, 255, 0.7),
              inset -1px -1px 2px rgba(147, 197, 253, 0.45) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

/* M3: 纯正亮紫 3D 球体 (Vibrant Royal Purple 3D Sphere) */
.card .mode-badge[data-mode="M3"],
.card .mode-badge.mode-m3,
.mode-badge[data-mode="M3"] {
  background: radial-gradient(circle at 30% 24%, #ffffff 0%, rgba(255, 255, 255, 0.75) 12%, rgba(255, 255, 255, 0) 24%),
              radial-gradient(circle at 36% 34%, #c084fc 0%, #9333ea 40%, #7e22ce 70%, #2e1065 100%) !important;
  box-shadow: 0 5px 8px -1px rgba(0, 0, 0, 0.75),
              0 2px 4px rgba(0, 0, 0, 0.5),
              inset -3px -3px 5px rgba(0, 0, 0, 0.85),
              inset 2px 2px 3px rgba(255, 255, 255, 0.7),
              inset -1px -1px 2px rgba(216, 180, 254, 0.45) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

/* Q3: 金黄色 3D 球体 (Imperial Gold 3D Sphere) */
.card .mode-badge[data-mode="Q3"],
.card .mode-badge.mode-q3,
.mode-badge[data-mode="Q3"] {
  background: radial-gradient(circle at 30% 24%, #ffffff 0%, rgba(255, 255, 255, 0.75) 12%, rgba(255, 255, 255, 0) 24%),
              radial-gradient(circle at 36% 34%, #fde047 0%, #eab308 40%, #ca8a04 70%, #422006 100%) !important;
  box-shadow: 0 5px 8px -1px rgba(0, 0, 0, 0.75),
              0 2px 4px rgba(0, 0, 0, 0.5),
              inset -3px -3px 5px rgba(0, 0, 0, 0.85),
              inset 2px 2px 3px rgba(255, 255, 255, 0.75),
              inset -1px -1px 2px rgba(254, 240, 138, 0.45) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

/* H3: 纯正大红 3D 球体 (Bold Crimson Red 3D Sphere) */
.card .mode-badge[data-mode="H3"],
.card .mode-badge.mode-h3,
.mode-badge[data-mode="H3"] {
  background: radial-gradient(circle at 30% 24%, #ffffff 0%, rgba(255, 255, 255, 0.75) 12%, rgba(255, 255, 255, 0) 24%),
              radial-gradient(circle at 36% 34%, #f87171 0%, #dc2626 40%, #991b1b 70%, #450a0a 100%) !important;
  box-shadow: 0 5px 8px -1px rgba(0, 0, 0, 0.75),
              0 2px 4px rgba(0, 0, 0, 0.5),
              inset -3px -3px 5px rgba(0, 0, 0, 0.85),
              inset 2px 2px 3px rgba(255, 255, 255, 0.7),
              inset -1px -1px 2px rgba(254, 202, 202, 0.45) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

/* CHAIN: 清爽电光青 3D 球体 (Cyan Teal 3D Sphere) */
.card .mode-badge[data-mode="CHAIN"],
.card .mode-badge.mode-chain,
.mode-badge[data-mode="CHAIN"] {
  background: radial-gradient(circle at 30% 24%, #ffffff 0%, rgba(255, 255, 255, 0.75) 12%, rgba(255, 255, 255, 0) 24%),
              radial-gradient(circle at 36% 34%, #22d3ee 0%, #0891b2 40%, #0e7490 70%, #083344 100%) !important;
  box-shadow: 0 5px 8px -1px rgba(0, 0, 0, 0.75),
              0 2px 4px rgba(0, 0, 0, 0.5),
              inset -3px -3px 5px rgba(0, 0, 0, 0.85),
              inset 2px 2px 3px rgba(255, 255, 255, 0.7),
              inset -1px -1px 2px rgba(165, 243, 252, 0.45) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

/* 多选悬浮「＋」: 新建提示词卡并自动连接 */
/* 多选悬浮操作条: ＋(连提示词) / ⿻ 编组 / 取消编组, 跟随选区右侧 */
#sel-float-bar {
  position: absolute; z-index: 70; display: none;
  align-items: center; gap: 6px;
}
#sel-float-bar.open { display: flex; }
/* 多选「＋」球: 「一个球」3D 虚空雷暴专属球体皮肤 (深邃暗星云 + 3D琉璃高光 + 悬停闪电撕裂) */
#multi-add-btn {
  position: relative; overflow: hidden;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(6, 182, 212, 0.75);
  background: radial-gradient(circle at 35% 30%, rgba(99, 102, 241, 0.5) 0%, rgba(147, 51, 234, 0.4) 40%, #05060b 80%, #020306 100%);
  color: #eaf8ff; font-size: 22px; font-weight: 800; line-height: 1;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.9), 0 0 18px rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.5), 0 0 32px rgba(147, 51, 234, 0.35),
              inset 0 0 12px rgba(6, 182, 212, 0.25);
  cursor: pointer; z-index: 0; flex-shrink: 0;
  transition: transform .15s, box-shadow .25s, border-color .25s;
}

/* 顶部 3D 琉璃球切面反光 */
#multi-add-btn::before {
  content: ''; position: absolute; top: 1px; left: 15%; right: 15%; height: 45%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.08) 70%, transparent 100%);
  pointer-events: none; z-index: 2;
}

/* 内部虚空雷暴与闪电电弧层 */
#multi-add-btn::after {
  content: ''; position: absolute; inset: 0;
  background: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2) 0%, rgba(59, 130, 246, 0.35) 20%, transparent 60%),
    linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.8) 48%, rgba(6, 182, 212, 0.9) 50%, rgba(255, 255, 255, 0.8) 52%, transparent 60%);
  background-size: 100% 100%, 200% 200%;
  background-position: center, -120% 0;
  opacity: .5; pointer-events: none; z-index: 1;
  transition: opacity .25s;
}

/* 悬停: 3D虚空雷暴爆发 + 闪电撕裂 */
#multi-add-btn:hover {
  transform: scale(1.12);
  border-color: rgba(6, 182, 212, 0.95);
  box-shadow: 0 0 22px rgba(59, 130, 246, 0.8), 0 0 45px rgba(147, 51, 234, 0.6),
              inset 0 0 18px rgba(6, 182, 212, 0.4);
}
#multi-add-btn:hover::after {
  opacity: 1;
  animation: void-lightning-strike 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
#multi-add-btn:active { transform: scale(.94); }

@media (prefers-reduced-motion: reduce) {
  #multi-add-btn:hover::after { animation: none; }
}
.sel-bar-btn {
  padding: 7px 11px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--panel-line);
  background: rgba(30,33,44,.94); backdrop-filter: blur(6px);
  color: var(--tx-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(3,6,14,.4);
  transition: background .12s, color .12s, transform .1s, border-color .12s;
}
.sel-bar-btn:hover { background: #2a2f3e; color: var(--tx); transform: translateY(-1px); border-color: rgba(var(--c-accent-rgb), .5); }
.sel-bar-btn:active { transform: scale(.96); }
.sel-bar-btn.hidden { display: none; }
.sel-bar-btn.busy { opacity: .55; pointer-events: none; }

/* iTouch 式悬浮球: 「一个球」紫晶虚空雷暴专属球体皮肤 */
#sel-ball-wrap { position: relative; flex-shrink: 0; }
#sel-ball {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid rgba(168, 85, 247, 0.6); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, rgba(168, 85, 247, 0.4) 0%, rgba(99, 102, 241, 0.25) 40%, #08030d 80%, #030105 100%);
  color: #f3e8ff; font-size: 15px; font-weight: 700; line-height: 1;
  letter-spacing: 1px;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.35), 0 0 24px rgba(99, 102, 241, 0.2), inset 0 0 10px rgba(168, 85, 247, 0.2);
  transition: transform .12s, color .12s, border-color .12s, box-shadow .2s;
}
#sel-ball:hover {
  transform: scale(1.12); color: #fff;
  border-color: rgba(192, 132, 252, 0.95);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.7), 0 0 35px rgba(99, 102, 241, 0.45);
}
#sel-ball.open {
  background: radial-gradient(circle at 35% 30%, rgba(6, 182, 212, 0.6) 0%, rgba(147, 51, 234, 0.5) 40%, #05060b 80%, #020306 100%);
  border-color: rgba(6, 182, 212, 0.95); color: #fff; transform: rotate(90deg) scale(1.08);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.8), 0 0 40px rgba(147, 51, 234, 0.6);
}
#sel-ball.hidden { display: none; }
#sel-ball-menu {
  position: absolute; left: 50%; top: calc(100% + 10px); transform: translateX(-50%);
  display: none; flex-direction: column; gap: 6px;
  min-width: 118px;
  background: rgba(24,27,36,.96); backdrop-filter: blur(8px);
  border: 1px solid var(--panel-line); border-radius: 12px; padding: 8px;
  box-shadow: 0 10px 30px rgba(3,6,14,.55);
  z-index: 80;
}
#sel-ball-menu.open { display: flex; }

/* 小地图 (左下角, M 键开关) */
#minimap {
  position: absolute; left: 16px; bottom: 44px; z-index: 15;
  background: rgba(20,22,28,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--panel-line); border-radius: 12px;
  padding: 6px; display: none;
  box-shadow: 0 8px 26px rgba(3,6,14,.5);
}
#minimap.open { display: block; }
#minimap canvas {
  display: block; border-radius: 6px; cursor: crosshair;
  background: #101218;
}
#minimap-close {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border: none; border-radius: 5px;
  background: rgba(40,44,56,.9); color: #8b94a8; font-size: 10px;
  cursor: pointer; line-height: 1;
}
#minimap-close:hover { background: #3a4050; color: #fff; }

