/* Agent 上传入口：与视频生成「选择」一致 */
.ws-ref-pick-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
}
.ws-ref-pick-ico{
  width:14px;height:14px;flex:0 0 auto;display:block;
}

/* 出海匠式参考图上传：左本地 + 右近期 30 张（全站共用） */
.ws-ref-upload-modal{
  position:fixed;inset:0;z-index:12100;
  display:none;align-items:center;justify-content:center;
  padding:18px;background:rgba(6,8,12,.74);box-sizing:border-box;
}
.ws-ref-upload-modal:not([hidden]){display:flex}
.ws-ref-upload-sheet{
  width:min(920px,100%);
  max-height:min(86vh,760px);
  display:flex;flex-direction:column;
  border-radius:16px;overflow:hidden;
  background:#141820;
  border:1px solid rgba(158,193,255,.2);
  box-shadow:0 24px 72px rgba(0,0,0,.5);
  color:#e8eef8;
}
.ws-ref-upload-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 14px;border-bottom:1px solid rgba(255,255,255,.08);
  background:#181e28;
}
.ws-ref-upload-tabs{display:flex;align-items:center;gap:4px;flex-wrap:wrap;min-width:0}
.ws-ref-upload-tabs button{
  height:34px;padding:0 12px;border:0;border-radius:8px;white-space:nowrap;
  background:transparent;color:#9aa7b8;font:inherit;font-size:13px;font-weight:700;cursor:pointer;
}
.ws-ref-upload-tabs button.is-active{
  color:#ffb24a;box-shadow:inset 0 -2px 0 #ff9a2e;
  border-radius:0;background:transparent;
}
.ws-ref-upload-head-meta{display:flex;align-items:center;gap:10px;color:#9aa7b8;font-size:12px}
.ws-ref-upload-close{
  width:34px;height:34px;border:0;border-radius:10px;
  background:rgba(255,255,255,.06);color:#aeb8c8;font-size:20px;line-height:1;cursor:pointer;
}
.ws-ref-upload-close:hover{background:rgba(255,255,255,.1);color:#fff}
.ws-ref-upload-main{
  position:relative;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;
}
.ws-ref-upload-body{
  display:grid;grid-template-columns:200px minmax(0,1fr);gap:14px;
  padding:14px;min-height:0;flex:1;overflow:hidden;
}
.ws-ref-upload-body[hidden]{display:none!important}
.ws-ref-upload-wview{
  flex:1;min-height:0;display:flex;flex-direction:column;padding:10px;overflow:hidden;
}
.ws-ref-upload-sheet.is-wgallery .ws-ref-upload-wview{padding:10px}
.ws-ref-upload-sheet.is-wgallery .ws-ref-upload-wcontent{
  flex:1;min-height:0;border-radius:10px;
}
.ws-ref-upload-sheet.is-wgallery-iframe .ws-ref-upload-wframe{
  min-height:calc(75vh - 120px);
}
.ws-ref-upload-wview[hidden]{display:none!important}
.ws-ref-upload-sheet.is-wgallery{
  width:min(75vw,calc(100vw - 24px));
  height:min(75vh,calc(100vh - 24px));
  max-height:min(75vh,calc(100vh - 24px));
}
.ws-ref-upload-sheet.is-wgallery.is-wgallery-iframe{
  width:min(75vw,calc(100vw - 24px));
  height:min(75vh,calc(100vh - 24px));
  max-height:min(75vh,calc(100vh - 24px));
}
.ws-ref-upload-local{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;
  min-height:280px;padding:16px;border-radius:14px;
  border:1.5px dashed rgba(158,193,255,.35);
  background:rgba(24,32,48,.55);color:#c9d4e6;
  font:inherit;cursor:pointer;text-align:center;
}
.ws-ref-upload-local:hover,
.ws-ref-upload-local:focus-visible{
  border-color:rgba(255,178,74,.55);
  background:rgba(36,44,64,.7);
  color:#ffe0b0;
}
.ws-ref-upload-local:disabled{opacity:.5;cursor:not-allowed}
.ws-ref-upload-local-ico{color:#9ec1ff;display:flex}
.ws-ref-upload-local:hover .ws-ref-upload-local-ico{color:#ffb24a}
.ws-ref-upload-local strong{font-size:14px;font-weight:750}
.ws-ref-upload-local span{font-size:12px;color:#8a97ab}
.ws-ref-upload-library{
  min-width:0;min-height:0;display:flex;flex-direction:column;gap:10px;overflow:hidden;
}
.ws-ref-upload-toolbar input[type=search]{
  width:100%;height:36px;padding:0 12px;border-radius:10px;
  border:1px solid rgba(255,255,255,.12);background:#0f141c;color:#e8eef8;
  font:inherit;font-size:13px;box-sizing:border-box;
}
.ws-ref-upload-toolbar input[type=search]:focus{
  outline:none;border-color:rgba(158,193,255,.5);
}
.ws-ref-upload-grid{
  flex:1;min-height:0;overflow:auto;
  display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:10px;
  padding-right:2px;align-content:start;
}
.ws-ref-upload-card{
  position:relative;display:flex;flex-direction:column;gap:0;padding:0;border:0;background:transparent;
  color:inherit;font:inherit;text-align:left;border-radius:12px;
}
.ws-ref-upload-pick{
  display:flex;flex-direction:column;gap:6px;padding:0;border:0;background:transparent;
  color:inherit;font:inherit;cursor:pointer;text-align:left;border-radius:12px;width:100%;
}
.ws-ref-upload-card:hover .ws-ref-upload-thumb{border-color:rgba(255,178,74,.55)}
.ws-ref-upload-thumb{
  position:relative;aspect-ratio:1;border-radius:12px;overflow:hidden;
  border:1px solid rgba(255,255,255,.1);background:#0f141c;
}
.ws-ref-upload-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.ws-ref-upload-del{
  position:absolute;top:6px;right:6px;z-index:2;
  width:22px;height:22px;padding:0;border:0;border-radius:999px;
  display:inline-flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,.72);color:#fff;font-size:16px;line-height:1;font-weight:700;
  cursor:pointer;opacity:0;pointer-events:none;transition:opacity .15s ease,background .15s ease;
  box-shadow:0 1px 4px rgba(0,0,0,.35);
}
.ws-ref-upload-card:hover .ws-ref-upload-del,
.ws-ref-upload-card:focus-within .ws-ref-upload-del{opacity:1;pointer-events:auto}
.ws-ref-upload-del:hover{background:#c0392b}
.ws-ref-upload-del:active{transform:scale(.96)}
@media (hover:none){
  .ws-ref-upload-del{opacity:1;pointer-events:auto}
}
.ws-ref-upload-time{
  position:absolute;right:6px;bottom:6px;padding:2px 6px;border-radius:6px;
  background:rgba(0,0,0,.62);color:#fff;font-size:10px;font-weight:650;line-height:1.3;
}
.ws-ref-upload-name{
  font-size:11px;color:#9aa7b8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 2px;
}
.ws-ref-upload-empty{
  margin:28px 8px;text-align:center;color:#6b7588;font-size:13px;line-height:1.5;
}
.ws-ref-upload-card.is-busy{opacity:.55;pointer-events:none}
body.ws-ref-upload-open{overflow:hidden}
.ws-ref-upload-wcontent{
  flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;
  border:1px solid rgba(255,255,255,.08);border-radius:12px;background:#0f141c;
}
.ws-ref-upload-wframe{
  flex:1;min-height:0;width:100%;border:0;background:#0d0f14;border-radius:12px;
}
.ws-ref-upload-wframe[hidden]{display:none!important}
.ws-ref-upload-wgrid-wrap{
  flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;padding:10px;overflow:hidden;
}
.ws-ref-upload-wgrid-wrap[hidden]{display:none!important}
.ws-ref-upload-wgrid{flex:1;min-height:0}
.ws-ref-upload-witem{
  display:flex;flex-direction:column;gap:6px;padding:0;border:0;background:transparent;
  color:inherit;font:inherit;cursor:pointer;text-align:left;border-radius:12px;width:100%;
}
.ws-ref-upload-witem:hover .ws-ref-upload-thumb{border-color:rgba(255,178,74,.55)}
.ws-ref-upload-insert{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,.45);color:#fff;font-size:13px;font-weight:800;
  opacity:0;transition:opacity .15s ease;pointer-events:none;
}
.ws-ref-upload-witem:hover .ws-ref-upload-insert,
.ws-ref-upload-witem:focus-visible .ws-ref-upload-insert{opacity:1}
@media (hover:none){
  .ws-ref-upload-insert{opacity:1;background:rgba(0,0,0,.35)}
}

.ws-ref-upload-hover-zoom{
  position:fixed;z-index:12150;pointer-events:none;
  padding:6px;border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(12,16,24,.96);
  box-shadow:0 18px 48px rgba(0,0,0,.45);
  opacity:0;transform:scale(.96);
  transition:opacity .16s ease,transform .16s ease;
}
.ws-ref-upload-hover-zoom.is-visible{
  opacity:1;transform:scale(1);
}
.ws-ref-upload-hover-zoom[hidden]{display:none!important}
.ws-ref-upload-hover-zoom img{
  display:block;border-radius:10px;object-fit:contain;
}

@media (max-width:720px){
  .ws-ref-upload-body{grid-template-columns:1fr;overflow:auto}
  .ws-ref-upload-local{min-height:140px}
  .ws-ref-upload-sheet{max-height:94vh}
}

/* 裁剪参考图（对齐图片创作 / 视频生成） */
.ws-ref-crop-modal{
  position:fixed;inset:0;z-index:12200;
  display:flex;align-items:center;justify-content:center;
  background:rgba(8,10,14,.78);padding:16px;box-sizing:border-box;
}
.ws-ref-crop-modal[hidden]{display:none!important}
.ws-ref-crop-card{
  position:relative;width:min(560px,100%);max-height:94vh;overflow:auto;
  display:flex;flex-direction:column;gap:14px;
  border-radius:20px;background:#12151c;border:1px solid rgba(255,255,255,.12);
  box-shadow:0 24px 64px rgba(0,0,0,.5);padding:22px;
}
.ws-ref-crop-card h2{margin:0;font-size:20px;font-weight:900;color:#f3f5f9}
.ws-ref-crop-close{
  position:absolute;top:14px;right:14px;z-index:2;
  border:0;border-radius:50%;width:38px;height:38px;cursor:pointer;
  background:rgba(255,255,255,.1);color:#fff;font-size:20px;line-height:1;
}
.ws-ref-crop-stage{
  display:grid;place-items:center;min-height:220px;
  background:#0d0f14;border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:14px;
}
.ws-ref-crop-stage canvas{max-width:100%;touch-action:none;cursor:grab;border-radius:6px}
.ws-ref-crop-label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:800;color:#dfe5ef}
.ws-ref-crop-label input[type=range]{width:100%;accent-color:#2f6bff}
.ws-ref-crop-ratios{display:flex;flex-wrap:wrap;gap:8px}
.ws-ref-crop-ratios button{
  flex:1 1 auto;min-width:56px;height:34px;padding:0 10px;border-radius:10px;cursor:pointer;
  border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.06);color:#e8eef8;
  font-size:13px;font-weight:800;letter-spacing:.02em;
}
.ws-ref-crop-ratios button:hover{background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.28)}
.ws-ref-crop-ratios button.is-on{background:rgba(47,107,255,.92);border-color:#2f6bff;color:#fff}
.ws-ref-crop-row{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.ws-ref-crop-confirm{
  border:0;border-radius:12px;padding:13px 16px;cursor:pointer;
  background:#f3f5f9;color:#10131a;font-size:15px;font-weight:900;
}
.ws-ref-crop-confirm:hover{background:#fff}
body.ws-ref-crop-open{overflow:hidden}
@media (max-width:760px){
  .ws-ref-crop-row{grid-template-columns:1fr}
}
