/* 工具箱 / 通用工具面板 / 批量任务  —— 2026-09-14 02:30 */

/* ---------- 工具卡片网格 ---------- */
.tool-box-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));
  gap:16px;
  margin-top:4px;
  min-width:0;
}
.tool-card{
  position:relative;display:flex;gap:13px;align-items:flex-start;
  box-sizing:border-box;min-width:0;width:100%;
  padding:18px 18px 17px;border-radius:18px;cursor:pointer;text-align:left;overflow:hidden;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.10);
  transition:transform .2s cubic-bezier(.2,.7,.3,1),background .2s,border-color .2s,box-shadow .2s;
  color:inherit;font:inherit;width:100%;
}
.tool-card::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:3px;
  background:#d9743f;opacity:0;transition:opacity .2s;
}
.tool-card:hover{transform:translateY(-3px);background:rgba(255,255,255,0.08);border-color:rgba(217,116,63,.5);box-shadow:0 14px 34px rgba(0,0,0,.45);}
.tool-card:hover::before{opacity:.9;}
.tool-card:active{transform:translateY(-1px);}
.tool-card-ico{
  flex:0 0 46px;width:46px;height:46px;border-radius:13px;display:grid;place-items:center;
  background:rgba(217,116,63,.14);
  border:1px solid rgba(217,116,63,.32);color:#F0B689;
}
.tool-card-ico svg{width:23px;height:23px;}
.tool-card-body{min-width:0;flex:1;padding-top:1px;}
.tool-card-title{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  min-width:0;font-size:15.5px;font-weight:700;color:#F3EEE5;letter-spacing:.3px;
  line-height:1.35;
}
.tool-card-title-text{min-width:0;overflow-wrap:anywhere;}
.tool-card-desc{margin-top:7px;font-size:12.5px;line-height:1.6;color:rgba(239,234,225,.62);}
.tool-card-tag{
  flex:0 0 auto;font-size:10.5px;padding:3px 8px;border-radius:999px;letter-spacing:.3px;font-weight:600;
  background:rgba(217,116,63,.18);color:#E9A874;border:1px solid rgba(217,116,63,.32);
  font-style:normal;line-height:1.25;white-space:nowrap;
}
.tool-card-tag.free{background:rgba(47,93,80,.26);color:#8FC9B4;border-color:rgba(143,201,180,.3);}
.tool-card-tag.point{background:rgba(217,116,63,.18);color:#E9A874;border:1px solid rgba(217,116,63,.32);}
.tool-card-tag.sub{background:rgba(150,110,210,.2);color:#C4A7EE;border:1px solid rgba(150,110,210,.35);}

/* 工具箱页头图例 */
.tool-box-legend{display:flex;flex-wrap:wrap;gap:14px;margin:8px 0 24px;font-size:12px;color:rgba(239,234,225,.6);}
.tool-box-legend span{display:inline-flex;align-items:center;gap:6px;}
.tool-box-legend i{width:9px;height:9px;border-radius:50%;display:inline-block;}
.tool-box-legend .lg-free{background:#8FC9B4;}
.tool-box-legend .lg-point{background:#E9A874;}

/* ---------- 通用工具面板 ---------- */
.tool-modal{position:fixed;inset:0;z-index:1200;display:flex;align-items:center;justify-content:center;padding:22px;}
.tool-modal[hidden]{display:none!important;}
.tool-modal-backdrop{position:absolute;inset:0;background:rgba(8,7,6,.74);backdrop-filter:blur(3px);}
.tool-modal-panel{
  position:relative;z-index:1;width:min(1080px,100%);max-height:90vh;display:flex;flex-direction:column;
  background:#171512;border:1px solid rgba(255,255,255,0.10);border-radius:20px;
  box-shadow:0 30px 80px rgba(0,0,0,.6);overflow:hidden;
}
.tool-modal-head{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid rgba(255,255,255,.08);}
.tool-modal-title{font-size:16px;font-weight:700;color:#F2EDE4;letter-spacing:.3px;}
.tool-modal-close{width:30px;height:30px;border-radius:9px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.05);color:#D8D2C8;cursor:pointer;font-size:14px;line-height:1;}
.tool-modal-close:hover{background:rgba(255,255,255,.12);}
.tool-modal-body{padding:18px 20px;overflow:auto;flex:1;}
.tool-modal-foot{padding:14px 20px;border-top:1px solid rgba(255,255,255,.08);display:flex;gap:10px;align-items:center;justify-content:flex-end;background:rgba(255,255,255,.02);}
.tool-modal-foot .foot-hint{margin-right:auto;font-size:12px;color:rgba(239,234,225,.5);}

/* 工具内部通用件 */
.t-grid{display:grid;grid-template-columns:minmax(280px,1fr) minmax(280px,1fr);gap:18px;}
@media (max-width:900px){.t-grid{grid-template-columns:1fr;}}
.t-label{display:block;font-size:12.5px;font-weight:600;color:rgba(239,234,225,.72);margin:0 0 7px;}
.t-field{margin-bottom:14px;}
.t-row{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;}
.t-row>*{flex:1;min-width:130px;}
.t-input,.t-select,.t-textarea{
  width:100%;padding:9px 11px;border-radius:10px;font-size:13.5px;color:#EFEAE1;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.13);outline:none;font-family:inherit;
}
.t-textarea{resize:vertical;line-height:1.6;}
.t-input:focus,.t-select:focus,.t-textarea:focus{border-color:rgba(217,116,63,.6);}
.t-select option{background:#171512;color:#EFEAE1;}
.t-hint{font-size:12px;color:rgba(239,234,225,.45);line-height:1.6;margin-top:6px;}
.t-seg{display:inline-flex;border:1px solid rgba(255,255,255,.13);border-radius:10px;overflow:hidden;}
.t-seg button{
  padding:7px 13px;font-size:13px;background:transparent;border:0;color:rgba(239,234,225,.62);cursor:pointer;font-family:inherit;
}
.t-seg button+button{border-left:1px solid rgba(255,255,255,.13);}
.t-seg button.on{background:rgba(217,116,63,.22);color:#F0B689;}
.t-check{display:flex;align-items:center;gap:8px;font-size:13px;color:rgba(239,234,225,.75);cursor:pointer;}

.t-stage{
  position:relative;background:#0F0E0C;border:1px solid rgba(255,255,255,.09);border-radius:14px;
  min-height:220px;display:grid;place-items:center;overflow:hidden;padding:10px;
}
.t-stage img{max-width:100%;max-height:46vh;display:block;border-radius:8px;}
.t-stage-empty{color:rgba(239,234,225,.35);font-size:13px;text-align:center;line-height:1.8;padding:30px 10px;}
.t-marquee{position:absolute;border:2px dashed #E9A874;background:rgba(217,116,63,.16);border-radius:3px;pointer-events:none;display:none;}
.t-stage.selecting{cursor:crosshair;}
.t-stage.selecting img{user-select:none;-webkit-user-drag:none;}

.t-preview{border:1px solid rgba(255,255,255,.09);border-radius:14px;background:#0F0E0C;min-height:220px;display:grid;place-items:center;padding:10px;overflow:hidden;}
.t-preview img{max-width:100%;max-height:46vh;display:block;border-radius:8px;}
.t-preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px;}
.t-preview-grid figure{margin:0;}
.t-preview-grid img{width:100%;border-radius:9px;display:block;border:1px solid rgba(255,255,255,.1);}
.t-preview-grid figcaption{margin-top:5px;font-size:11.5px;color:rgba(239,234,225,.5);display:flex;justify-content:space-between;gap:6px;}

.t-btn{padding:9px 18px;border-radius:11px;font-size:13.5px;font-weight:600;cursor:pointer;font-family:inherit;border:1px solid transparent;}
.t-btn.primary{background:linear-gradient(180deg,#D9743F,#B4532A);color:#fff;border-color:rgba(0,0,0,.2);}
.t-btn.primary:hover{filter:brightness(1.08);}
.t-btn.ghost{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.14);color:#E4DED4;}
.t-btn.ghost:hover{background:rgba(255,255,255,.12);}
.t-btn[disabled]{opacity:.45;cursor:not-allowed;}

.t-status{font-size:12.5px;color:#E9A874;line-height:1.6;}

/* 选图来源 */
.t-source{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start;}
.t-drop{
  flex:1;min-width:200px;border:1.5px dashed rgba(255,255,255,.18);border-radius:14px;padding:20px 14px;text-align:center;
  cursor:pointer;transition:border-color .2s,background .2s;background:rgba(255,255,255,.02);
}
.t-drop:hover{border-color:rgba(217,116,63,.6);background:rgba(217,116,63,.06);}
.t-drop svg{width:22px;height:22px;color:#E9A874;}
.t-drop b{display:block;margin-top:8px;font-size:13.5px;color:#EFEAE1;}
.t-drop span{display:block;margin-top:4px;font-size:11.5px;color:rgba(239,234,225,.45);}
.t-recents{flex:1.4;min-width:240px;}
.t-recent-strip{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;}
.t-recent-strip img{
  width:64px;height:64px;object-fit:cover;border-radius:9px;cursor:pointer;flex:0 0 auto;
  border:1px solid rgba(255,255,255,.12);transition:transform .18s,border-color .18s;
}
.t-recent-strip img:hover{transform:translateY(-2px);border-color:#E9A874;}

/* 滑块 */
.t-slider{display:flex;align-items:center;gap:10px;}
.t-slider input[type=range]{flex:1;accent-color:#D9743F;}
.t-slider b{min-width:46px;text-align:right;font-size:12.5px;color:#E9A874;font-variant-numeric:tabular-nums;}

/* ---------- 图片编辑页：面板呼吸间距 ---------- */
#psstudioView > section.panel{
  box-sizing:border-box;
  padding:22px 24px 24px;
  margin:0 0 22px;
  min-width:0;
}
#psstudioView > section.panel:last-child{margin-bottom:0;}
#psstudioView > section.panel > .panel-title{
  display:flex;
  align-items:baseline;
  gap:12px;
  min-width:0;
  margin:0 0 16px;
  padding:0;
}
#psstudioView > section.panel > .panel-title h3{
  flex:0 1 auto;
  min-width:0;
  margin:0;
  line-height:1.4;
  overflow-wrap:anywhere;
}
#psstudioView > section.panel > .panel-title > span{
  min-width:0;
  line-height:1.5;
  overflow-wrap:anywhere;
}
#psstudioView .ps-studio-panel{margin-top:6px;}
#psstudioView .ps-studio-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px;margin-top:10px;}
@media (max-width:640px){
  #psstudioView > section.panel{padding:18px 16px 20px;}
  #psstudioView > section.panel > .panel-title{gap:8px;margin-bottom:14px;align-items:flex-start;}
  #psstudioView > section.panel > .panel-title h3{font-size:18px;line-height:1.45;}
  #psstudioView > section.panel > .panel-title > span{font-size:12px;line-height:1.45;}
  #psstudioView .tool-box-grid{grid-template-columns:minmax(0,1fr);gap:12px;}
  #psstudioView .tool-card{padding:16px 15px;gap:11px;border-radius:15px;}
  #psstudioView .tool-card-ico{flex-basis:42px;width:42px;height:42px;border-radius:11px;}
  #psstudioView .tool-card-title{font-size:14.5px;}
}

/* ---------- 批量任务 ---------- */
/* 批量面板内边距：避免任务项/选项贴边（#3 贴边问题） */
section.panel:has(#batchPrompts){padding:20px 22px;}
.batch-textarea{width:100%;padding:12px 14px;border-radius:13px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.13);color:#EFEAE1;font-size:13.5px;line-height:1.75;resize:vertical;font-family:inherit;outline:none;}
.batch-textarea:focus{border-color:rgba(217,116,63,.6);}
.batch-options{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-end;margin-top:14px;}
.batch-field{display:flex;flex-direction:column;gap:6px;font-size:12.5px;color:rgba(239,234,225,.7);}
.batch-field select,.batch-field input[type=file]{padding:8px 10px;border-radius:10px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.13);color:#EFEAE1;font-size:13px;font-family:inherit;max-width:240px;}
.batch-actions{display:flex;gap:10px;margin-left:auto;}
.batch-progress{display:flex;align-items:center;gap:12px;margin-top:16px;}
.batch-progress-bar{flex:1;height:7px;border-radius:999px;background:rgba(255,255,255,.09);overflow:hidden;}
.batch-progress-bar i{display:block;height:100%;width:0;border-radius:999px;background:linear-gradient(90deg,#D9743F,#B4532A);transition:width .3s;}
.batch-progress span{font-size:12.5px;color:rgba(239,234,225,.6);min-width:60px;text-align:right;}
.batch-list{margin-top:16px;display:flex;flex-direction:column;gap:9px;}
.batch-item{
  display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:12px;
  background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.08);
}
.batch-item .bi-idx{flex:0 0 26px;height:26px;border-radius:8px;display:grid;place-items:center;font-size:12px;background:rgba(255,255,255,.07);color:rgba(239,234,225,.7);}
.batch-item .bi-text{flex:1;min-width:0;font-size:13px;color:#E4DED4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.batch-item .bi-state{flex:0 0 auto;font-size:12px;padding:3px 9px;border-radius:999px;border:1px solid transparent;}
.batch-item.s-wait .bi-state{color:rgba(239,234,225,.5);border-color:rgba(255,255,255,.12);}
.batch-item.s-run .bi-state{color:#F0B689;border-color:rgba(217,116,63,.45);background:rgba(217,116,63,.12);}
.batch-item.s-ok .bi-state{color:#8FC9B4;border-color:rgba(143,201,180,.4);background:rgba(47,93,80,.22);}
.batch-item.s-err .bi-state{color:#E88B7D;border-color:rgba(232,139,125,.4);background:rgba(180,60,45,.18);}
.batch-item .bi-thumb{width:38px;height:38px;border-radius:8px;object-fit:cover;border:1px solid rgba(255,255,255,.12);cursor:pointer;}

/* 费用提示 */
.t-cost{font-size:12.5px;color:#E9A874;line-height:1.6;margin-top:8px;}
.batch-cost{font-size:12.5px;color:#E9A874;line-height:1.6;margin-top:10px;padding-left:2px;}
