/* 参考素材：倾斜叠放缩略卡 + 全屏 Lightbox + 图片编辑器（1:1 参考站） */

/* ===== 输入框内：缩略卡摞（1:1 参考站 lk888.ai：白边斜卡 52×66，旋转 -10/+14/-18，hover 扇形+青色描边）===== */
#attachmentList.sp-stack { position: relative; display: block; flex: 0 0 auto; width: 55px; height: 70px; padding: 0; margin: 6px 0 2px; min-height: 0; overflow: visible; }
#attachmentList.sp-stack.hidden { display: none; }
#attachmentList.sp-stack .sp-stack-card {
  position: absolute; left: 0; top: 0; width: 52px; height: 66px; flex: none; border-radius: 3px; overflow: hidden;
  border: 1.5px solid #fff; background: #2d2f35; cursor: zoom-in;
  /* 回归修复：作曲器容器 #wsComposer 整体 pointer-events:none（交互子元素各自 auto），
     v34 重写斜卡牌堆时漏了给卡片恢复 pointer-events:auto，导致真实鼠标点击穿透卡片、
     closest([data-preview-file]) 取不到卡片，灯箱打不开。这里显式恢复可点（对齐参考站 zoom-in）。 */
  pointer-events: auto;
  transform: rotate(var(--sr, 0deg)) translateZ(0); transform-origin: 50% 50%;
  transition: transform .4s cubic-bezier(.4,0,.2,1), box-shadow .4s cubic-bezier(.4,0,.2,1), border-color .2s;
  box-shadow: rgba(0,0,0,.3) 0 3.8px 11.4px;
}
/* 右上角总数角标：参考站把计数放在「+」圆里，这里不再显示 */
#attachmentList.sp-stack[data-count]::after { content: none !important; }
/* 鼠标进入附件摞：手牌式水平扇形展开（兄弟卡每张右移 50px、收到 ±8° 小角） */
#attachmentList.sp-stack:hover .sp-stack-card:not(:hover) {
  transform: translateX(calc(var(--i, 0) * 50px)) rotate(var(--hr, 0deg)) scale(1);
}
/* 单张悬停：放大 1.24、上浮 11px、保留倾角、青色选中描边 + 光晕、置顶 */
#attachmentList.sp-stack:hover .sp-stack-card:hover {
  transform: translateX(calc(var(--i, 0) * 50px)) translateY(-11px) rotate(var(--sr, 0deg)) scale(1.24);
  z-index: 1000 !important; border-color: #22d3ee;
  box-shadow: 0 0 0 2px rgba(34,211,238,.55), rgba(0,0,0,.45) 0 10px 22px;
}
/* 展开时把后面的「+号」槽位平滑推到扇形末尾 */
.cp-refs { align-items: center; gap: 6px; }
.cp-frames { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; transition: margin .4s cubic-bezier(.4,0,.2,1); }
#attachmentList.sp-stack:hover ~ .cp-frames { margin-left: calc((var(--span, 1) - 1) * 50px + 8px); }
.sp-stack-card img, .sp-stack-card video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; border-radius: 7px; }
/* 可拖拽排序：静滞 grab、拖拽中抓取 grabbing */
#attachmentList.sp-stack .sp-stack-card { cursor: grab; }
#attachmentList.sp-stack .sp-stack-card.dragging { cursor: grabbing; opacity: .55; z-index: 1001 !important; }
#attachmentList.sp-stack .sp-stack-card.drop-before::before,
#attachmentList.sp-stack .sp-stack-card.drop-after::after {
  content: ""; position: absolute; top: -6px; bottom: -6px; width: 2.5px; border-radius: 2px;
  background: #22d3ee; box-shadow: 0 0 8px rgba(34,211,238,.8); z-index: 1002; pointer-events: none;
}
#attachmentList.sp-stack .sp-stack-card.drop-before::before { left: -7px; }
#attachmentList.sp-stack .sp-stack-card.drop-after::after { right: -7px; }
.sp-stack-card .sp-file-ic { display: grid; place-items: center; width: 100%; height: 100%; font-size: 26px; }
.sp-stack-card .sp-play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 22px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.sp-stack-card .sp-play::after { content: "▶"; background: rgba(0,0,0,.4); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; padding-left: 2px; }
.sp-stack-card .sp-x {
  position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: #333; font-size: 13px; line-height: 1; font-weight: 700; display: none; place-items: center; z-index: 1000;
  box-shadow: 0 3px 10px rgba(0,0,0,.4);
}
.sp-stack-card:hover .sp-x { display: grid; }
/* 文件名 + 大小气泡：默认隐藏，悬停该张时在其上方浮出 */
.sp-stack-card .sp-name {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%);
  flex-direction: column; align-items: center; gap: 1px; z-index: 40; pointer-events: none;
  background: rgba(20,22,30,.96); border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  padding: 6px 11px; white-space: nowrap; box-shadow: 0 12px 28px rgba(0,0,0,.5);
}
.sp-stack-card:hover .sp-name { display: flex; }
.sp-stack-card .sp-name::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: rgba(20,22,30,.96); }
.sp-stack-card .spn-name { font-size: 11px; color: #e8edf5; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.sp-stack-card .spn-size { font-size: 10px; color: #9aa4b2; }
html[data-theme="light"] .sp-stack-card { background: #eef2f7; border-color: #dbe2ec; }
html[data-theme="light"] .sp-stack-card .sp-name { background: rgba(255,255,255,.98); border-color: #e2e8f0; box-shadow: 0 12px 28px rgba(15,23,42,.16); }
html[data-theme="light"] .sp-stack-card .spn-name { color: #1f2937; }
html[data-theme="light"] .sp-stack-card .spn-size { color: #64748b; }
html[data-theme="light"] .sp-stack-card .sp-name::after { border-top-color: rgba(255,255,255,.98); }

/* ===== “+附件”悬停：当前模型支持的附件类型/数量卡片（1:1 参考站） ===== */
.sp-upload-tip {
  position: fixed; z-index: 10003; display: none; min-width: 218px;
  background: rgba(18,20,28,.97); border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  padding: 13px 15px; box-shadow: 0 20px 48px -12px rgba(0,0,0,.75); backdrop-filter: blur(12px);
  font-size: 13px; line-height: 1.5; pointer-events: none;
}
.sp-upload-tip.show { display: block; animation: sutIn .16s ease both; }
@keyframes sutIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.sp-upload-tip .sut-title { font-weight: 800; color: #f1f5f9; font-size: 13.5px; }
.sp-upload-tip .sut-sub { color: #94a3b8; font-size: 11.5px; margin-top: 2px; }
.sp-upload-tip .sut-line { height: 1px; background: rgba(255,255,255,.1); margin: 8px 0; }
.sp-upload-tip .sut-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 2px 0; }
.sp-upload-tip .sut-k { color: #cbd5e1; }
.sp-upload-tip .sut-v { color: #fbbf24; font-weight: 700; font-variant-numeric: tabular-nums; }
html[data-theme="light"] .sp-upload-tip { background: rgba(255,255,255,.98); border-color: #e2e8f0; box-shadow: 0 20px 48px -14px rgba(15,23,42,.28); }
html[data-theme="light"] .sp-upload-tip .sut-title { color: #0f172a; }
html[data-theme="light"] .sp-upload-tip .sut-sub { color: #64748b; }
html[data-theme="light"] .sp-upload-tip .sut-line { background: #e6edf7; }
html[data-theme="light"] .sp-upload-tip .sut-k { color: #475569; }

/* ===== 全屏 Lightbox ===== */
.sp-lb-overlay { position: fixed; inset: 0; z-index: 10002; display: flex; align-items: center; justify-content: center;
  background: rgba(8,10,14,.55); backdrop-filter: blur(8.4px); -webkit-backdrop-filter: blur(8.4px); }
.sp-lb-overlay.hidden { display: none; }
.sp-lb-content { position: relative; max-width: 1116px; max-height: 92vh; display: flex; align-items: center; justify-content: center; }
.sp-lb-stage { max-width: 1116px; max-height: 86vh; display: flex; align-items: center; justify-content: center; }
.sp-lb-media { max-width: 1116px; max-height: 86vh; object-fit: contain; border-radius: 8.4px; box-shadow: 0 8.4px 33.6px rgba(0,0,0,.5); background: #0b0d12; }
.sp-lb-actions { position: absolute; top: -50px; right: 0; display: flex; gap: 4.2px;
  background: rgba(20,22,26,.78); backdrop-filter: blur(8.4px); border: .67px solid rgba(255,255,255,.1);
  border-radius: 10.5px; padding: 5px 5.9px; box-shadow: 0 6.3px 16.8px rgba(0,0,0,.28); }
.sp-lb-btn { width: 33.6px; height: 33.6px; display: grid; place-items: center; background: rgba(6,182,212,.22);
  color: #22d3ee; border: none; border-radius: 7.56px; cursor: pointer; transition: .15s; }
.sp-lb-btn:hover { background: rgba(6,182,212,.4); }
.sp-lb-btn svg { width: 18px; height: 18px; }
.sp-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  background: rgba(20,22,26,.6); color: #fff; border: 1px solid rgba(255,255,255,.12); cursor: pointer; display: grid; place-items: center; z-index: 3; }
.sp-lb-nav:hover { background: rgba(34,211,238,.4); }
.sp-lb-prev { left: -64px; } .sp-lb-next { right: -64px; }
.sp-lb-nav svg { width: 24px; height: 24px; }
.sp-lb-counter { position: absolute; bottom: -40px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: rgba(255,255,255,.9); border-radius: 16.8px; padding: 4px 14px; font-size: 12.5px; }
.sp-lb-quality { position: absolute; bottom: -40px; left: 12px; color: rgba(255,255,255,.62); font-size: 11.5px; max-width: 46%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1280px) { .sp-lb-prev { left: 8px; } .sp-lb-next { right: 8px; } }

/* ===== 图片标注/裁剪编辑器 ===== */
.sp-ed-overlay { position: fixed; inset: 0; z-index: 10003; background: rgba(6,8,12,.82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; flex-direction: column; }
.sp-ed-content { background: #16181f; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.sp-ed-title { color: #e8eaf2; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.sp-ed-counter { font-size: 12px; color: #8b93a5; font-weight: 400; }
.sp-ed-wrap { position: relative; margin: 0 auto; }
.sp-ed-base, .sp-ed-draw { position: absolute; left: 0; top: 0; }
.sp-ed-draw { cursor: crosshair; }
.sp-ed-cropbox { position: absolute; border: 2px dashed #22d3ee; background: rgba(34,211,238,.12); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none; }
.sp-ed-toolbar { display: flex; align-items: center; gap: 8px; }
.sp-ed-group { display: flex; gap: 6px; align-items: center; }
.sp-ed-group.colors { gap: 7px; }
.sp-ed-divider { width: 1px; height: 22px; background: rgba(255,255,255,.12); }
.sp-ed-spacer { flex: 1; }
.sp-ed-tbtn { background: #23262f; color: #d6d9e2; border: 1px solid #33373f; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.sp-ed-tbtn:hover { border-color: #22d3ee; color: #22d3ee; }
.sp-ed-tbtn.active { background: rgba(34,211,238,.18); border-color: #22d3ee; color: #22d3ee; }
.sp-ed-tbtn.primary { background: linear-gradient(135deg,#22d3ee,#0ea5e9); color: #04222a; border: none; font-weight: 700; }
.sp-ed-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sp-ed-color.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.3); }
.sp-ed-crop-hint { color: #8b93a5; font-size: 12px; }

/* ===== AI 编辑四项：动作条分隔 + 带文字标签的 AI 按钮 ===== */
.sp-lb-sep { width: 1px; height: 22px; background: rgba(255,255,255,.16); margin: 0 2px; }
.sp-lb-btn.sp-lb-aibtn { width: auto; padding: 0 9px; gap: 4px; display: flex; align-items: center; }
.sp-lb-btn.sp-lb-aibtn svg { width: 16px; height: 16px; }
.sp-lb-btn.sp-lb-aibtn em { font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 1; }
.sp-lb-btn.sp-lb-aibtn:hover { background: rgba(34,211,238,.45); color: #fff; }

/* ===== AI 编辑弹窗 ===== */
.sp-ed-content.sp-ai-edit { width: min(720px, 92vw); }
.sp-ai-hint { color: #9aa4b2; font-size: 12.5px; margin: -4px 0 0; line-height: 1.5; }
.sp-ai-stage { display: flex; justify-content: center; max-height: 46vh; overflow: auto; }
.sp-ai-prev { max-width: 100%; max-height: 46vh; border-radius: 8px; background: #0b0d12; }
.sp-ai-out { position: relative; display: flex; justify-content: center; max-height: 46vh; }
.sp-ai-result { max-width: 100%; max-height: 46vh; border-radius: 8px; border: 1px solid rgba(34,211,238,.5); }
.sp-ai-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(10,12,18,.82); color: #cfe9ff; font-size: 13px; border-radius: 8px; }
.sp-ai-loading.hidden { display: none; }
.sp-ai-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(34,211,238,.3); border-top-color: #22d3ee; animation: spAiSpin .8s linear infinite; }
@keyframes spAiSpin { to { transform: rotate(360deg); } }
.sp-ai-row { display: flex; }
.sp-ai-input { flex: 1; background: #0f1218; color: #e8eaf2; border: 1px solid #2c313a; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; outline: none; }
.sp-ai-input:focus { border-color: #22d3ee; }
.sp-ed-tbtn[disabled] { opacity: .5; cursor: not-allowed; }
.hidden { display: none !important; }
