
body{background:radial-gradient(circle at 50% 0%,rgba(255,173,92,.1),transparent 34%),linear-gradient(180deg,#070b0f 0%,#0b1218 100%)}
body::before{background:radial-gradient(circle at 78% 26%,rgba(255,142,45,.12),transparent 26%),radial-gradient(circle at 18% 18%,rgba(255,196,118,.08),transparent 24%);opacity:1}
body.light-theme{color-scheme:light;--bg:#f8f8f7;--panel:rgba(255,255,255,.78);--panel-strong:rgba(255,255,255,.94);--line:rgba(20,20,20,.1);--line-strong:rgba(255,121,31,.32);--text:#191919;--muted:rgba(30,30,30,.58);--soft:rgba(30,30,30,.42);--accent:#ff7a1a;--accent-2:#ffba6b;--danger:#ef4444;--shadow:0 18px 48px rgba(15,23,42,.08);background:linear-gradient(180deg,#fbfbfa 0%,#f4f3f1 100%)}
body.light-theme::before{background:radial-gradient(circle at 72% 18%,rgba(255,122,26,.09),transparent 27%),radial-gradient(circle at 18% 22%,rgba(255,186,107,.09),transparent 28%)}
.app{width:min(1460px,calc(100% - 28px));padding-top:14px}
.topbar{border-radius:8px;padding:12px 24px;background:rgba(8,12,16,.82);border-color:rgba(255,255,255,.14);box-shadow:0 14px 36px rgba(0,0,0,.24),inset 0 1px 0 rgba(255,255,255,.08)}
body.light-theme .topbar{background:rgba(255,255,255,.86);border-color:rgba(17,24,39,.08);box-shadow:0 14px 34px rgba(15,23,42,.08),inset 0 1px 0 rgba(255,255,255,.8)}
.brand-mark{background:rgba(255,122,26,.1);color:#fff;font-size:0;position:relative}
.brand-sub{display:none}.brand-name{font-size:25px}
.nav-item,.notice-trigger,.theme-toggle,.history-btn,.debug-btn,.img-btn,.hp-btn,.save-btn{border-radius:8px;background:transparent;color:var(--text);border-color:transparent;font-weight:850}
.nav-item.active{background:linear-gradient(135deg,rgba(255,122,26,.2),rgba(255,181,96,.12));border-color:rgba(255,122,26,.2);box-shadow:0 10px 26px rgba(255,122,26,.12)}
.theme-toggle{height:38px;padding:0 13px;font-size:15px;gap:7px;display:inline-flex;align-items:center;justify-content:center}
.theme-toggle .theme-moon{display:none}body.light-theme .theme-toggle .theme-sun{display:none}body.light-theme .theme-toggle .theme-moon{display:inline-grid}
.hero{display:block;margin:28px 0 22px}.hero h1{font-size:clamp(36px,4.2vw,58px);letter-spacing:0}.hero h1 span,.hero h1 strong{color:var(--accent)}.hero-brand{display:inline-flex;align-items:center;gap:.08em;white-space:nowrap;vertical-align:baseline;line-height:1}.hero-brand-c{width:.78em;height:.78em;display:inline-flex;align-items:center;transform:translateY(.01em)}.hero-brand-c img{width:100%;height:100%;display:block;object-fit:contain}.hero-brand-dash,.hero-brand-image{font-family:ParticleBrand,Inter,Arial,"Microsoft YaHei",sans-serif;font-weight:400;text-transform:uppercase;line-height:1;background:linear-gradient(135deg,#ffc39a 0%,#ff7a1a 60%,#f25c0d 100%);-webkit-background-clip:text;background-clip:text;color:transparent}.hero-brand-dash{transform:translateY(-.01em)}
.hero p{font-size:16px;margin-top:10px}.hero-panel,.system-announcement{display:none}
.workspace-grid{grid-template-columns:minmax(440px,.95fr) minmax(520px,1.05fr);gap:20px;padding:24px;border-radius:8px;background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.06)}
body.light-theme .workspace-grid{background:rgba(255,255,255,.52);border-color:rgba(17,24,39,.06)}
.card,.composer{border-radius:8px;background:linear-gradient(180deg,rgba(255,255,255,.09),rgba(255,255,255,.045));border-color:rgba(255,255,255,.13);box-shadow:var(--shadow),inset 0 1px 0 rgba(255,255,255,.1)}
body.light-theme .card,body.light-theme .composer{background:rgba(255,255,255,.78);border-color:rgba(17,24,39,.08);box-shadow:0 18px 44px rgba(15,23,42,.07)}
.composer-inner{padding:22px}.tabs{display:none}.composer-footer{padding:0 22px 22px;border-top:0;background:transparent}
.prompt-tools{margin-bottom:10px}.prompt-tools label,.ref-header label,.card-title{font-size:20px}.prompt-count{display:inline-block;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.prompt,textarea,.input,.glass-select{border-radius:8px;background:rgba(255,255,255,.04);border-color:rgba(255,255,255,.12);box-shadow:inset 0 1px 0 rgba(255,255,255,.05)}
body.light-theme .prompt,body.light-theme textarea,body.light-theme .input,body.light-theme .glass-select{background:rgba(255,255,255,.82);border-color:rgba(17,24,39,.09);color:#191919}
body.light-theme textarea::placeholder,body.light-theme input::placeholder{color:rgba(25,25,25,.38)}body.light-theme .masked-api-key::placeholder{color:#191919;opacity:1}body.light-theme .glass-select option{background:#fff;color:#191919}
.composer-control-bar{display:grid;grid-template-columns:1fr;gap:12px;padding:0;border:0;background:transparent;box-shadow:none}
.model-field{gap:10px}.glass-select{height:48px;font-size:14px;padding-left:16px}.inline-controls{grid-template-columns:1.55fr .8fr .9fr;border-top:1px solid var(--line);padding-top:14px}
.btn-group{gap:8px}.btn-opt{height:48px;min-width:54px;border-radius:8px;background:rgba(255,255,255,.04);font-size:14px}.btn-opt.active{background:linear-gradient(135deg,rgba(255,122,26,.18),rgba(255,181,96,.1));color:var(--text);border-color:rgba(255,122,26,.62);box-shadow:0 12px 26px rgba(255,122,26,.16)}
.selection-summary{display:none}.composer-actions{display:block;padding:0;border:0;background:transparent}.gen-btn{width:100%;min-height:72px;margin-top:18px;font-size:22px;background:linear-gradient(135deg,#ff7417 0%,#ffae57 58%,#ffd39b 100%);color:#17110b;box-shadow:0 18px 42px rgba(255,122,26,.25)}
.ref-thumb,.ref-upload{width:150px;height:150px}.ref-grid{gap:12px}.ref-hint{display:none}
.preview-column{position:sticky;top:104px}.result-area{min-height:510px;border-style:solid;background:rgba(255,255,255,.025)}body.light-theme .result-area{background:rgba(255,255,255,.48);border-color:rgba(17,24,39,.08)}
.result-viewer{height:clamp(320px,52vh,620px);cursor:zoom-in}.result-image{cursor:zoom-in}
#home-history-card{margin-top:18px}.debug-toolbar,.debug-log,.card:has(.debug-toolbar){display:none}
.image-modal{position:fixed;inset:0;z-index:950;display:none;background:rgba(5,8,12,.82);backdrop-filter:blur(18px);padding:24px}.image-modal.open{display:flex;flex-direction:column}.image-modal-bar{height:46px;display:flex;align-items:center;justify-content:flex-end;gap:8px}.image-modal-btn{height:38px;min-width:38px;border-radius:8px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.1);color:#fff;font-weight:900;cursor:pointer}.image-modal-stage{flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;cursor:grab}.image-modal-stage.dragging{cursor:grabbing}.image-modal-stage img{max-width:92vw;max-height:82vh;object-fit:contain;border-radius:8px;box-shadow:0 24px 80px rgba(0,0,0,.45);transform:translate(var(--viewer-pan-x,0px),var(--viewer-pan-y,0px)) scale(var(--viewer-zoom,1));transform-origin:center;transition:transform .12s;user-select:none;pointer-events:none}
@media (max-width:980px){.workspace-grid{grid-template-columns:1fr;padding:14px}.preview-column{position:static}.ref-thumb,.ref-upload{width:104px;height:104px}}
@media (max-width:760px){.topbar{padding:10px 12px}.inline-controls{grid-template-columns:1fr}.gen-btn{min-height:58px;font-size:18px}}


.composer-footer{padding:0 22px 24px}
.composer-control-bar{display:grid;grid-template-columns:1fr;gap:18px;padding:0;border:0;background:transparent;box-shadow:none}
.model-field{gap:9px}.model-field label,.control-section label{font-size:15px;color:var(--text);font-weight:900}
.glass-select{height:48px;border-radius:8px;padding:0 42px 0 15px;font-size:15px;font-weight:700;background:rgba(255,255,255,.05);border-color:var(--line);box-shadow:inset 0 1px 0 rgba(255,255,255,.08)}
.model-select-wrap{position:relative;display:block}.model-select-wrap::after{content:"";position:absolute;right:17px;top:18px;width:7px;height:7px;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(45deg);pointer-events:none}.model-select-wrap .glass-select{appearance:none;-webkit-appearance:none;background-image:none}
select.input{appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(100% - 19px) 50%,calc(100% - 13px) 50%;background-size:6px 6px,6px 6px;background-repeat:no-repeat}
.inline-controls{display:grid;grid-template-columns:minmax(0,1.8fr) minmax(140px,.8fr) minmax(140px,.85fr);gap:22px;align-items:start;padding-top:18px;border-top:1px solid var(--line)}
.control-section{position:relative;gap:12px}.control-section:not(:first-child)::before{content:"";position:absolute;left:-11px;top:6px;bottom:0;width:1px;background:var(--line)}
.btn-group{display:flex;gap:8px;flex-wrap:nowrap;padding:0}
#size-group{display:grid;grid-template-columns:repeat(6,minmax(42px,1fr));gap:9px}
#res-group,#count-group{display:grid;grid-template-columns:repeat(3,minmax(42px,1fr));gap:8px;padding:6px;border:1px solid var(--line);border-radius:8px;background:rgba(255,255,255,.035)}
.btn-opt{height:70px;min-width:0;padding:8px 8px;border-radius:8px;background:transparent;border:1px solid transparent;color:var(--muted);font-size:14px;font-weight:800;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;box-shadow:none}
.btn-opt:hover{background:rgba(255,122,26,.06);border-color:rgba(255,122,26,.2);color:var(--text)}
.btn-opt.active{background:linear-gradient(180deg,rgba(255,122,26,.12),rgba(255,180,96,.08));border-color:rgba(255,122,26,.72);color:var(--text);box-shadow:0 10px 24px rgba(255,122,26,.16),inset 0 1px 0 rgba(255,255,255,.1)}
#res-group .btn-opt,#count-group .btn-opt{height:58px;gap:0}
#size-group .btn-opt::before{content:"";display:block;width:24px;height:18px;border:2px solid currentColor;border-radius:2px;opacity:.78}
#size-group .btn-opt[data-val="1:1"]::before{width:22px;height:22px}
#size-group .btn-opt[data-val="16:9"]::before{width:28px;height:16px}
#size-group .btn-opt[data-val="9:16"]::before{width:16px;height:28px}
#size-group .btn-opt[data-val="4:3"]::before{width:27px;height:18px}
#size-group .btn-opt[data-val="3:4"]::before{width:18px;height:27px}
#size-group .btn-opt[data-val="custom"]::before{content:"＋";display:flex;align-items:center;justify-content:center;width:24px;height:18px;border:2px dashed currentColor;border-radius:2px;font-size:15px;line-height:1;opacity:.78}
/* 自定义比例输入行（点"自定义"时展开） */
.custom-ratio-box{display:flex;gap:8px;align-items:center;margin-top:9px}
.custom-ratio-box[hidden]{display:none}
.custom-ratio-box input{flex:1 1 auto;min-width:0;height:36px;border-radius:8px;border:1px solid var(--line);background:rgba(255,255,255,.05);color:var(--text);padding:0 11px;font-size:13px;font-weight:600}
.custom-ratio-box input:focus{outline:none;border-color:rgba(255,122,26,.72)}
.custom-ratio-box .custom-ratio-apply{height:36px;padding:0 15px;border-radius:8px;border:1px solid rgba(255,122,26,.72);background:linear-gradient(180deg,rgba(255,122,26,.16),rgba(255,180,96,.1));color:var(--text);font-size:13px;font-weight:700;cursor:pointer}
.custom-ratio-box .custom-ratio-apply:hover{background:linear-gradient(180deg,rgba(255,122,26,.26),rgba(255,180,96,.16))}
body.light-theme .glass-select,body.light-theme #res-group,body.light-theme #count-group{background:rgba(255,255,255,.72);border-color:rgba(17,24,39,.1)}
body.light-theme .custom-ratio-box input{background:rgba(255,255,255,.72);border-color:rgba(17,24,39,.1)}
body.light-theme .ref-upload{border-color:rgba(255,122,26,.36);background:rgba(255,122,26,.035);color:rgba(25,25,25,.62)}
body.light-theme .ref-upload:hover{border-color:rgba(255,122,26,.72);background:rgba(255,122,26,.08);color:var(--text)}
@media (max-width:760px){.inline-controls{grid-template-columns:1fr;gap:14px}.control-section::before{display:none}#size-group{grid-template-columns:repeat(6,1fr)}.btn-opt{height:62px;font-size:13px}}


/* Unified stack tray for image-generation references */
#page-generate .composer,
#page-generate .composer-inner,
#page-generate .composer-body,
#page-generate .upload-stack,
#page-generate .ref-section{
  overflow:visible!important;
}
#page-generate .ref-grid{
  position:relative!important;
  width:100%!important;
  min-height:116px!important;
  padding:10px!important;
  border:1px solid rgba(255,122,26,.18)!important;
  border-radius:10px!important;
  background:linear-gradient(180deg,rgba(255,250,245,.08),rgba(255,255,255,.035))!important;
  box-shadow:0 12px 28px rgba(15,23,42,.08),inset 0 1px 0 rgba(255,255,255,.08)!important;
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  overflow:visible!important;
  isolation:isolate;
}
#page-generate .ref-grid:hover{
  z-index:90;
  border-color:rgba(255,122,26,.34)!important;
  box-shadow:0 16px 34px rgba(15,23,42,.12),0 0 0 3px rgba(255,122,26,.06)!important;
}
#page-generate .ref-upload{
  width:84px!important;
  height:84px!important;
  min-width:84px!important;
  flex:0 0 84px!important;
  margin:0!important;
  border-radius:8px!important;
  z-index:2;
}
#page-generate .ref-thumb{
  position:absolute!important;
  left:102px!important;
  top:17px!important;
  width:78px!important;
  height:78px!important;
  transform:translateX(calc(var(--stack-i, 0) * 8px)) translateY(calc(var(--stack-i, 0) * 3px)) rotate(calc((var(--stack-i, 0) - 1) * 4deg))!important;
  z-index:calc(20 - var(--stack-i, 0))!important;
  box-shadow:0 12px 24px rgba(15,23,42,.16),inset 0 1px 0 rgba(255,255,255,.52)!important;
}
#page-generate .ref-grid:hover .ref-thumb{
  top:20px!important;
  transform:translateX(calc(var(--stack-i, 0) * 86px)) translateY(0) rotate(0deg)!important;
  z-index:calc(10 + var(--stack-i, 0))!important;
}
#page-generate .ref-grid:hover::after{
  content:"";
  position:absolute;
  left:96px;
  top:8px;
  width:min(742px,calc(100vw - 160px));
  height:102px;
  border:1px solid rgba(255,122,26,.22);
  border-radius:10px;
  background:rgba(31,31,30,.96);
  box-shadow:0 24px 70px rgba(0,0,0,.34),0 0 0 1px rgba(255,255,255,.08) inset;
  backdrop-filter:blur(14px);
  z-index:0;
  pointer-events:none;
}
#page-generate .ref-thumb.dragging{
  opacity:1!important;
  transform:translateX(calc(var(--stack-i, 0) * 86px)) translateY(-5px) scale(1.04) rotate(0deg)!important;
  border:2px dashed rgba(255,122,26,.66)!important;
  background:rgba(255,122,26,.08)!important;
  box-shadow:inset 0 0 0 4px rgba(255,122,26,.05)!important;
}
#page-generate .ref-thumb.dragging img,
#page-generate .ref-thumb.dragging .ref-del{
  opacity:0!important;
}
#page-generate .ref-thumb.drag-over{
  border-color:rgba(255,122,26,.78)!important;
  box-shadow:0 0 0 3px rgba(255,122,26,.18),0 18px 38px rgba(15,23,42,.18)!important;
  transform:translateX(calc(var(--stack-i, 0) * 86px)) translateY(-5px) scale(1.04) rotate(0deg)!important;
}
#page-generate .ref-stack-count{
  position:absolute;
  right:12px;
  bottom:12px;
  z-index:35;
  height:22px;
  min-width:42px;
  padding:0 8px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(17,24,39,.86);
  color:#fff;
  font-size:12px;
  font-weight:900;
}
body.light-theme #page-generate .ref-grid{
  background:linear-gradient(180deg,rgba(255,250,245,.92),rgba(255,255,255,.78))!important;
  border-color:rgba(255,122,26,.18)!important;
  box-shadow:0 12px 28px rgba(15,23,42,.05),inset 0 1px 0 rgba(255,255,255,.74)!important;
}
body.light-theme #page-generate .ref-grid:hover::after{
  background:rgba(255,255,255,.96);
  box-shadow:0 24px 70px rgba(15,23,42,.18),0 0 0 1px rgba(255,255,255,.7) inset;
}
@media (max-width:760px){
  #page-generate .ref-grid:hover::after{
    left:8px;
    right:8px;
    top:104px;
    width:auto;
  }
  #page-generate .ref-grid:hover{
    min-height:220px!important;
    overflow-x:auto!important;
  }
  #page-generate .ref-grid:hover .ref-thumb{
    left:18px!important;
    top:116px!important;
  }
}


.ref-thumb,.ref-upload{width:128px;height:128px}
.ref-upload{font-size:22px}.ref-upload span{font-size:12px}
.composer-control-bar,.composer-actions{width:100%}
.inline-controls{grid-template-columns:minmax(0,1.55fr) minmax(154px,.72fr) minmax(154px,.72fr);gap:18px;width:100%}
.control-section:not(:first-child)::before{left:-9px}
#res-group,#count-group{height:64px;align-items:center}
#res-group .btn-opt,#count-group .btn-opt{height:50px;font-size:15px;font-weight:850}
#count-group .btn-opt{font-size:18px}
.gen-btn{min-height:58px;height:58px;margin-top:16px;border-radius:12px;font-size:18px;font-weight:850;gap:10px;letter-spacing:0;box-shadow:0 14px 30px rgba(255,122,26,.22)}
.gen-btn #gen-btn-icon{font-size:22px;line-height:1}.gen-btn #gen-btn-text{font-size:18px;font-weight:850}
.gen-btn:hover{box-shadow:0 16px 34px rgba(255,122,26,.28)}
.state-submitted-copy{position:relative;z-index:2}.state-submitted-tip{font-size:13px;margin-top:6px;color:var(--muted)}
@media (max-width:980px){.ref-thumb,.ref-upload{width:112px;height:112px}}
@media (max-width:760px){.inline-controls{grid-template-columns:1fr}.gen-btn{height:54px;min-height:54px;font-size:17px}.gen-btn #gen-btn-text{font-size:17px}}


.prompt-library{border:1px solid var(--line);border-radius:8px;background:rgba(255,255,255,.045);overflow:hidden}
.prompt-library-toggle{width:100%;min-height:48px;padding:0 14px;border:0;background:transparent;color:var(--text);display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;align-items:center;cursor:pointer;text-align:left}
.prompt-library-toggle span{font-size:16px;font-weight:900}.prompt-library-toggle small{color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-library-toggle b{font-size:12px;color:var(--accent);font-weight:900}
.prompt-library-icon{width:32px;height:32px;border-radius:8px;background:linear-gradient(135deg,#f25c0d,#ff9a5c);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:18px;font-weight:950;box-shadow:0 12px 26px rgba(242,92,13,.25)}
.prompt-library-panel{display:block;padding:0 14px 14px}.prompt-library.collapsed .prompt-library-panel{display:none}
.prompt-library-tools{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;margin-bottom:12px}.prompt-template-search{height:40px;border:1px solid var(--line);border-radius:8px;background:rgba(0,0,0,.14);color:var(--text);padding:0 13px;outline:none}.prompt-template-search-btn,.prompt-template-new{height:40px;border:1px solid rgba(255,122,26,.32);border-radius:8px;background:rgba(255,122,26,.1);color:var(--accent);font-weight:900;padding:0 14px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:7px}.prompt-template-new{background:linear-gradient(135deg,rgba(255,122,26,.18),rgba(255,190,115,.1))}.btn-icon-search,.btn-icon-plus{position:relative;width:18px;height:18px;display:inline-block;flex:0 0 auto}.btn-icon-search::before{content:"";position:absolute;left:2px;top:2px;width:10px;height:10px;border:2px solid currentColor;border-radius:50%}.btn-icon-search::after{content:"";position:absolute;right:2px;bottom:2px;width:7px;height:2px;background:currentColor;border-radius:2px;transform:rotate(45deg);transform-origin:center}.btn-icon-plus{border:2px solid currentColor;border-radius:50%}.btn-icon-plus::before,.btn-icon-plus::after{content:"";position:absolute;left:4px;right:4px;top:7px;height:2px;background:currentColor;border-radius:2px}.btn-icon-plus::after{transform:rotate(90deg)}
.prompt-template-tabs{display:flex;gap:8px;overflow:auto;padding-bottom:10px;scrollbar-width:none}.prompt-template-tabs::-webkit-scrollbar{display:none}.prompt-template-tab{height:30px;padding:0 12px;border:1px solid var(--line);border-radius:8px;background:rgba(255,255,255,.045);color:var(--muted);font-size:12px;font-weight:850;white-space:nowrap;cursor:pointer}.prompt-template-tab.active{background:rgba(255,122,26,.16);border-color:rgba(255,122,26,.42);color:var(--text)}
.prompt-template-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px;max-height:315px;overflow:auto;padding-right:2px}.prompt-template-card{--cat-color:var(--accent);position:relative;min-width:0;border:1px solid color-mix(in srgb,var(--cat-color) 42%,var(--line));border-radius:8px;background:linear-gradient(180deg,color-mix(in srgb,var(--cat-color) 10%,transparent),rgba(255,255,255,.045));padding:10px;display:grid;gap:8px;cursor:pointer;transition:border-color .16s,background .16s,transform .16s;overflow:hidden}.prompt-template-card::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--cat-color)}.prompt-template-card:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--cat-color) 70%,var(--line));background:linear-gradient(180deg,color-mix(in srgb,var(--cat-color) 16%,transparent),rgba(255,255,255,.055))}.prompt-template-cover,.prompt-template-cover-placeholder{width:100%;aspect-ratio:4/3;border-radius:8px;object-fit:cover;background:linear-gradient(135deg,color-mix(in srgb,var(--cat-color) 22%,rgba(255,255,255,.06)),rgba(255,255,255,.045));border:1px solid color-mix(in srgb,var(--cat-color) 38%,var(--line));display:grid;place-items:center;color:color-mix(in srgb,var(--cat-color) 78%,#fff);font-size:22px;font-weight:950}
.prompt-template-delete{height:28px;min-width:48px;border-radius:8px;border:1px solid rgba(255,122,26,.36);background:rgba(255,122,26,.1);color:var(--accent);cursor:pointer;font-size:12px;font-weight:900;line-height:1}.prompt-template-delete:hover{border-color:rgba(255,122,26,.58);background:rgba(255,122,26,.18);color:var(--text)}
.prompt-template-head{min-width:0;display:flex;align-items:center;justify-content:space-between;gap:8px}.prompt-template-title{min-width:0;font-size:13px;font-weight:950;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prompt-template-use{flex:0 0 auto;font-size:11px;color:var(--cat-color);font-weight:900}
.prompt-template-text{min-width:0;font-size:12px;line-height:1.5;color:var(--muted);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;min-height:54px;word-break:break-word}.prompt-template-tags{min-width:0;display:flex;gap:5px;flex-wrap:nowrap;overflow:hidden}.prompt-template-tags span{flex:0 1 auto;max-width:64px;min-width:0;font-size:10px;color:var(--soft);border:1px solid var(--line);border-radius:999px;padding:2px 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-template-empty{grid-column:1/-1;color:var(--muted);font-size:13px;text-align:center;padding:22px}
body.light-theme .prompt-library,body.light-theme .prompt-template-card,body.light-theme .prompt-template-tab{background:rgba(255,255,255,.72);border-color:rgba(17,24,39,.08)}body.light-theme .prompt-template-search{background:rgba(255,255,255,.82);border-color:rgba(17,24,39,.1);color:#191919}
@media (max-width:620px){.prompt-library-toggle{grid-template-columns:1fr auto}.prompt-library-toggle small{display:none}.prompt-library-tools{grid-template-columns:1fr}.prompt-template-grid{grid-template-columns:1fr}}
.template-modal{position:fixed;inset:0;z-index:320;display:none;align-items:center;justify-content:center;background:rgba(5,8,12,.72);backdrop-filter:blur(16px);padding:18px}.template-modal.open{display:flex}.template-modal-card{width:min(640px,100%);border:1px solid var(--line);border-radius:8px;background:var(--panel-strong);box-shadow:0 24px 80px rgba(0,0,0,.36);padding:18px}.template-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}.template-modal-head strong{display:block;font-size:18px}.template-modal-head span{display:block;color:var(--muted);font-size:12px;margin-top:4px}.template-modal-head button{width:34px;height:34px;border:1px solid var(--line);border-radius:8px;background:rgba(255,255,255,.06);color:var(--text);cursor:pointer}.template-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.template-form-grid label,.template-field{display:grid;gap:7px;color:var(--text);font-size:13px;font-weight:900}.template-field{margin-top:12px}.template-image-row{display:flex;align-items:center;gap:12px;margin-top:12px}.template-image-picker{width:112px;height:86px;border:1px dashed rgba(255,122,26,.48);border-radius:8px;background:rgba(255,122,26,.06);color:var(--muted);display:grid;place-items:center;cursor:pointer}.template-image-picker span{font-size:24px;line-height:1}.template-image-picker small{font-size:11px}.template-image-row img{width:112px;height:86px;border-radius:8px;object-fit:cover;border:1px solid var(--line)}.template-modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
body.light-theme .template-modal-card{background:rgba(255,255,255,.96)}


.prompt-library-toggle{grid-template-columns:auto auto minmax(0,1fr) 18px}
.prompt-library-toggle,.home-history-head,.model-select-wrap{transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease,color .16s ease}
.prompt-library-toggle:hover,.home-history-head:hover,.model-select-wrap:hover{transform:translateY(-1px);box-shadow:0 16px 34px rgba(255,122,26,.16),0 0 28px rgba(255,122,26,.12)}
.prompt-library-toggle:hover{background:rgba(255,122,26,.07);color:var(--text)}
.model-select-wrap:hover .glass-select{border-color:var(--line-strong);background:rgba(255,255,255,.085);box-shadow:0 16px 34px rgba(255,122,26,.16),0 0 28px rgba(255,122,26,.12),inset 0 1px 0 rgba(255,255,255,.12)}
.model-select-wrap:hover::after,.prompt-library-toggle:hover b,.home-history-head:hover .home-history-toggle b{color:var(--accent)}
.prompt-library-toggle b{width:18px;height:18px;font-size:0;position:relative;color:var(--muted);display:block}
.prompt-library-toggle b::before{content:"";position:absolute;left:5px;top:4px;width:7px;height:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);transition:transform .16s,top .16s}
.prompt-library:not(.collapsed) .prompt-library-toggle b::before{top:7px;transform:rotate(225deg)}
.prompt-template-grid{grid-template-columns:repeat(auto-fill,minmax(205px,1fr));grid-auto-rows:auto;max-height:430px;min-height:310px;overflow-y:auto;overflow-x:hidden;align-items:start}
.prompt-template-card{border-color:var(--line);background:rgba(255,255,255,.045);box-shadow:0 16px 36px rgba(0,0,0,.2),0 0 26px color-mix(in srgb,var(--cat-color) 12%,transparent);min-height:296px;grid-template-rows:auto auto minmax(54px,1fr) auto}
.prompt-template-card::before{display:none}.prompt-template-card:hover{border-color:rgba(255,122,26,.42);background:rgba(255,255,255,.065);box-shadow:0 20px 42px rgba(0,0,0,.24),0 0 32px color-mix(in srgb,var(--cat-color) 16%,transparent)}
.prompt-template-cover,.prompt-template-cover-placeholder{border-color:var(--line);background:rgba(255,255,255,.055);color:var(--cat-color)}
.prompt-template-delete{margin-left:auto;height:30px;min-width:52px;border-radius:8px;border:1px solid rgba(255,122,26,.36);background:rgba(255,122,26,.1);color:var(--accent);font-size:12px;font-weight:900;padding:0 12px;white-space:nowrap;box-shadow:inset 0 1px 0 rgba(255,255,255,.08);cursor:pointer}
.prompt-template-delete:hover{border-color:rgba(255,122,26,.58);background:rgba(255,122,26,.18);color:var(--text)}
.prompt-template-tags{align-items:flex-end;margin-top:auto}.prompt-template-tags span.prompt-template-tag-category{border-color:color-mix(in srgb,var(--cat-color) 58%,var(--line));background:color-mix(in srgb,var(--cat-color) 18%,transparent);color:color-mix(in srgb,var(--cat-color) 82%,#fff);font-weight:900}
body.light-theme .prompt-template-card{background:rgba(255,255,255,.72);border-color:rgba(17,24,39,.08)}body.light-theme .prompt-template-card:hover{border-color:rgba(255,122,26,.32);background:rgba(255,255,255,.9)}body.light-theme .prompt-template-delete{background:rgba(255,122,26,.1);color:#d95f00;border-color:rgba(255,122,26,.28)}body.light-theme .prompt-template-delete:hover{background:rgba(255,122,26,.18);color:#9a3412;border-color:rgba(255,122,26,.42)}body.light-theme .prompt-template-tags span.prompt-template-tag-category{color:var(--cat-color)}
body.light-theme .prompt-library{background:#fff;border-color:#e8eaf1;box-shadow:0 18px 50px rgba(15,23,42,.08),0 0 42px rgba(242,92,13,.06)}body.light-theme .prompt-library-toggle span{color:#111827}body.light-theme .prompt-library-toggle small{color:#8a8f9b}body.light-theme .prompt-template-search{border-color:#e1e5ee;background:#fff;color:#1f2937;box-shadow:0 10px 28px rgba(15,23,42,.04)}body.light-theme .prompt-template-search-btn{border-color:#ff7a1a;background:#fff;color:#ff7417;box-shadow:0 10px 28px rgba(255,122,26,.08)}body.light-theme .prompt-template-new{border-color:transparent;background:linear-gradient(135deg,#ff8a23,#ff6f1a);color:#fff;box-shadow:0 14px 28px rgba(255,122,26,.2)}body.light-theme .prompt-template-tab{border-color:#edf0f5;background:#fff;color:#606672;box-shadow:0 8px 20px rgba(15,23,42,.03)}body.light-theme .prompt-template-tab.active{border-color:rgba(255,122,26,.28);background:#fff7f1;color:#ff7417}body.light-theme .prompt-template-card{background:#fff;border-color:#e7eaf1;box-shadow:0 18px 46px rgba(15,23,42,.08),0 0 28px color-mix(in srgb,var(--cat-color) 14%,transparent)}body.light-theme .prompt-template-card:hover{background:#fff;border-color:rgba(255,122,26,.24);box-shadow:0 24px 58px rgba(15,23,42,.11),0 0 34px color-mix(in srgb,var(--cat-color) 18%,transparent)}body.light-theme .prompt-template-cover,body.light-theme .prompt-template-cover-placeholder{border-color:#eef1f6;background:#f8f9fd}body.light-theme .prompt-template-title{color:#111827}body.light-theme .prompt-template-text{color:#818895}body.light-theme .prompt-template-use{color:#ff7a1a}body.light-theme .prompt-template-delete{background:#fff;border-color:rgba(255,122,26,.32);color:#ff7417}body.light-theme .prompt-template-delete:hover{background:#fff7f1;color:#c2410c;border-color:rgba(255,122,26,.48)}
@media (max-width:620px){.prompt-template-grid{grid-template-columns:1fr;max-height:430px;min-height:310px}}
@media (max-width:620px){body.light-theme .prompt-library-toggle{grid-template-columns:auto minmax(0,1fr) 18px}body.light-theme .prompt-library-toggle small{display:none}body.light-theme .prompt-library-tools{grid-template-columns:1fr}body.light-theme .prompt-template-search-btn,body.light-theme .prompt-template-new{width:100%}}


/* Match dark theme width to the approved light theme width */
.app,
body.light-theme .app,
body:not(.light-theme) .app{width:min(1600px,calc(100% - 24px))}


/* Unified topbar geometry for both themes */
.topbar,
body.light-theme .topbar,
body:not(.light-theme) .topbar{height:76px;top:10px;padding:0 22px;border-radius:10px;display:grid;grid-template-columns:210px minmax(0,1fr);align-items:center;gap:14px}
.brand,
body.light-theme .brand,
body:not(.light-theme) .brand{gap:10px}
.brand-mark,
body.light-theme .brand-mark,
body:not(.light-theme) .brand-mark{width:40px;height:40px;border-radius:8px}
.brand-mark img,
body.light-theme .brand-mark img,
body:not(.light-theme) .brand-mark img{width:30px;height:30px}
.brand-name,
body.light-theme .brand-name,
body:not(.light-theme) .brand-name{font-size:24px}
.brand-sub,
body.light-theme .brand-sub,
body:not(.light-theme) .brand-sub{display:none}
.topbar-actions,
body.light-theme .topbar-actions,
body:not(.light-theme) .topbar-actions{height:100%;display:flex;align-items:center;justify-content:flex-end;gap:34px;flex-wrap:nowrap}
.sidebar-nav,
body.light-theme .sidebar-nav,
body:not(.light-theme) .sidebar-nav{height:100%;display:flex;align-items:center;gap:34px}
.notice-trigger,
.nav-item,
.theme-toggle,
body.light-theme .notice-trigger,
body.light-theme .nav-item,
body.light-theme .theme-toggle,
body:not(.light-theme) .notice-trigger,
body:not(.light-theme) .nav-item,
body:not(.light-theme) .theme-toggle{height:100%;padding:0 2px;border-radius:0;border:0;background:transparent;box-shadow:none;display:inline-flex;align-items:center;gap:9px;font-size:15px;font-weight:900;white-space:nowrap;position:relative;transform:none}
.nav-icon,
body.light-theme .nav-icon,
body:not(.light-theme) .nav-icon{width:20px;height:20px;font-size:18px}
.theme-label,
body.light-theme .theme-label,
body:not(.light-theme) .theme-label{font-size:15px;font-weight:900}
.nav-item.active,
body.light-theme .nav-item.active,
body:not(.light-theme) .nav-item.active{background:transparent;border:0;box-shadow:none}
.nav-item.active::after,
body.light-theme .nav-item.active::after,
body:not(.light-theme) .nav-item.active::after{content:"";position:absolute;left:0;right:0;bottom:0;height:3px;border-radius:999px;background:#ff7417;box-shadow:0 8px 18px rgba(255,122,26,.34)}
body:not(.light-theme) .topbar{background:rgba(18,15,13,.72);border:1px solid var(--line);box-shadow:0 16px 44px rgba(0,0,0,.2);backdrop-filter:blur(22px)}
body:not(.light-theme) .notice-trigger,
body:not(.light-theme) .nav-item,
body:not(.light-theme) .theme-toggle{color:var(--muted)}
body:not(.light-theme) .notice-trigger:hover,
body:not(.light-theme) .nav-item:hover,
body:not(.light-theme) .theme-toggle:hover,
body:not(.light-theme) .nav-item.active{color:var(--text)}
@media (max-width:980px){.topbar,body.light-theme .topbar,body:not(.light-theme) .topbar{grid-template-columns:1fr;height:auto;gap:10px;padding:12px 14px}.topbar-actions,body.light-theme .topbar-actions,body:not(.light-theme) .topbar-actions{justify-content:flex-start;gap:14px;overflow:auto}.sidebar-nav,body.light-theme .sidebar-nav,body:not(.light-theme) .sidebar-nav{gap:14px}}


/* Settings follows the same compact glass-panel system as the main workspace. */
#page-settings .settings-layout{
  min-height:calc(100vh - 146px);
  border:1px solid rgba(255,238,214,.14);
  border-radius:14px;
  background:linear-gradient(145deg,rgba(32,26,21,.88),rgba(15,12,10,.94));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10),0 22px 60px rgba(0,0,0,.22);
}
#page-settings .settings-sidebar{
  width:236px;
  padding:18px 10px;
  background:rgba(24,19,15,.60);
  border-right-color:rgba(255,238,214,.12);
}
#page-settings .settings-sidebar-header{padding:4px 12px 16px;font-size:22px;letter-spacing:.01em}
#page-settings .settings-nav-item{
  margin:3px 0;
  padding:11px 12px;
  border-radius:10px;
  border:1px solid transparent;
}
#page-settings .settings-nav-item:hover{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.07)}
#page-settings .settings-nav-item.active{
  border:1px solid rgba(255,145,65,.40);
  border-left:1px solid rgba(255,145,65,.40);
  background:linear-gradient(135deg,rgba(255,122,26,.22),rgba(247,179,92,.08));
  box-shadow:inset 3px 0 0 #ff8a34,0 8px 20px rgba(255,122,26,.10);
}
#page-settings .settings-nav-icon{font-size:18px}
#page-settings .settings-sidebar-footer{margin:16px 0 0;padding:16px 12px 0;border-top-color:rgba(255,238,214,.12)}
#page-settings .settings-main{padding:24px;scrollbar-width:thin}
#page-settings .settings-section{
  margin-bottom:16px;
  padding:18px;
  border-radius:12px;
  border-color:rgba(255,238,214,.12);
  background:linear-gradient(145deg,rgba(255,244,235,.055),rgba(255,244,235,.018));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.045);
}
#page-settings .settings-section-head{margin-bottom:14px}
#page-settings .settings-section-num{width:30px;height:30px;background:linear-gradient(135deg,#ff7417,#ffae57);color:#fff;box-shadow:0 7px 16px rgba(255,116,23,.22)}
#page-settings .settings-section-title{font-size:16px}
#page-settings .settings-field .input{
  min-height:40px;
  border-radius:9px;
  background:rgba(0,0,0,.24);
  border-color:rgba(255,238,214,.14);
}
#page-settings .settings-field .input:focus{border-color:rgba(255,142,61,.62);box-shadow:0 0 0 3px rgba(255,122,26,.10)}
#page-settings .saved-config-grid{gap:10px}
#page-settings .saved-config-card{min-height:122px;border-radius:11px;background:rgba(255,255,255,.04);border-color:rgba(255,238,214,.14)}
#page-settings .saved-config-card.active{border-color:#ff8a34;box-shadow:0 0 0 1px #ff8a34,0 14px 30px rgba(255,122,26,.14)}
#page-settings .saved-config-badge.active{background:rgba(74,222,128,.14);color:#86efac}
#page-settings .saved-config-add{min-height:122px;border-radius:11px}
#page-settings .settings-footer{
  padding:14px 0 2px;
  border-top-color:rgba(255,238,214,.12);
  background:linear-gradient(180deg,transparent,rgba(15,12,10,.76) 34%);
  backdrop-filter:blur(12px);
}
#page-settings .settings-save-btn{border-radius:10px;background:linear-gradient(135deg,#ff7417,#ffae57);color:#fff;box-shadow:0 10px 22px rgba(255,116,23,.22)}
body.light-theme #page-settings .settings-layout{background:linear-gradient(145deg,rgba(255,255,255,.96),rgba(247,244,240,.94));border-color:rgba(17,24,39,.09);box-shadow:0 20px 48px rgba(15,23,42,.08)}
body.light-theme #page-settings .settings-sidebar{background:rgba(248,247,245,.86);border-right-color:rgba(17,24,39,.08)}
body.light-theme #page-settings .settings-nav-item.active{border-color:rgba(255,122,26,.30);background:linear-gradient(135deg,rgba(255,122,26,.13),rgba(255,181,96,.06));box-shadow:inset 3px 0 0 #ff7417,0 8px 18px rgba(255,122,26,.08)}
body.light-theme #page-settings .settings-section{background:rgba(255,255,255,.82);border-color:rgba(17,24,39,.08);box-shadow:0 10px 24px rgba(15,23,42,.04)}
body.light-theme #page-settings .settings-field .input{background:#fff;border-color:rgba(17,24,39,.12)}
body.light-theme #page-settings .settings-footer{background:linear-gradient(180deg,transparent,rgba(255,255,255,.86) 34%)}

/* Settings navigation stays textual and calm; section numbers add no value. */
#page-settings .settings-nav-icon,#page-settings .settings-section-num{display:none!important}
#page-settings .settings-nav-item{align-items:center!important;gap:10px!important}
#page-settings .settings-nav-label{flex:0 0 auto}
#page-settings .settings-nav-desc{margin:0!important;line-height:1.35!important}
#page-settings .settings-section-head{gap:0!important}

/* Keep all global navigation pictograms optically centered with their labels. */
.topbar .nav-item,.topbar .notice-trigger,.topbar .theme-toggle{line-height:1!important;align-items:center!important}
.topbar .nav-icon{margin:0!important;transform:translateY(0)!important;vertical-align:middle!important}

/* Model profiles use an even card rhythm, with clear active states in each theme. */
#page-settings .saved-config-grid{grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
#page-settings .saved-config-card{display:flex;flex-direction:column;min-height:174px;padding:18px;border-radius:14px;background:linear-gradient(145deg,rgba(255,255,255,.065),rgba(255,255,255,.022));transition:transform .16s,border-color .16s,box-shadow .16s}
#page-settings .saved-config-card:hover{transform:translateY(-2px)}
#page-settings .saved-config-top{padding-right:54px;gap:12px}
#page-settings .saved-config-icon{width:48px;height:48px;border-radius:13px;box-shadow:0 8px 18px rgba(255,116,23,.18)}
#page-settings .saved-config-name{font-size:15px;line-height:1.35;margin:1px 0 0}
#page-settings .saved-config-meta{margin-top:6px;line-height:1.35}
#page-settings .saved-config-badge-row{margin-top:auto;padding-top:14px}
#page-settings .saved-config-badge{border-radius:999px;background:rgba(255,122,26,.12);color:#ffb35c}
#page-settings .saved-config-card.active{border-color:#ff8a34;box-shadow:0 0 0 1px #ff8a34,0 16px 32px rgba(255,122,26,.16)}

/* Light settings intentionally use the purple visual language. */
body.light-theme #page-settings .settings-nav-item.active{border-color:rgba(242,92,13,.30)!important;box-shadow:inset 3px 0 0 #f25c0d,0 8px 18px rgba(242,92,13,.10)!important;background:linear-gradient(135deg,rgba(242,92,13,.14),rgba(167,139,250,.07))!important}
body.light-theme #page-settings .settings-section-num{background:linear-gradient(135deg,#f25c0d,#ff9a5c)!important}
body.light-theme #page-settings .saved-config-card{background:linear-gradient(145deg,#fff,#faf8ff);border-color:#e6e0f0}
body.light-theme #page-settings .saved-config-card.active{border-color:#f25c0d;box-shadow:0 0 0 1px #f25c0d,0 16px 32px rgba(242,92,13,.14)}
body.light-theme #page-settings .saved-config-icon{background:linear-gradient(135deg,#f25c0d,#ff9a5c);box-shadow:0 8px 18px rgba(242,92,13,.18)}
body.light-theme #page-settings .saved-config-badge{background:rgba(242,92,13,.10);color:#6d35df}
body.light-theme #page-settings .settings-save-btn{background:linear-gradient(135deg,#f25c0d,#ff9a5c);box-shadow:0 10px 22px rgba(242,92,13,.22)}

/* ===== 参考图展开层约束在卡片内 + 提示词框缩放手柄 ===== */
/* 展开托盘宽度不再超出卡片 */
#page-generate .ref-grid:hover::after {
  left: 96px !important;
  width: calc(100% - 108px) !important;
}
/* 缩略图横向展开用 left + min() 约束,超出时收紧间距堆叠,绝不溢出卡片 */
#page-generate .ref-grid:hover .ref-thumb {
  left: min(calc(102px + var(--stack-i, 0) * 86px), calc(100% - 92px)) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
#page-generate .ref-thumb.dragging {
  left: min(calc(102px + var(--stack-i, 0) * 86px), calc(100% - 92px)) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
#page-generate .ref-thumb.drag-over {
  left: min(calc(102px + var(--stack-i, 0) * 86px), calc(100% - 92px)) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
/* 拖拽排序只在目标位变化时重排,不再每像素触发 */
/* 提示词框右下角缩放手柄加明显引导 */
#page-generate #prompt { resize: vertical; }
#prompt::-webkit-resizer {
  background:
    linear-gradient(135deg, transparent 0 50%, rgba(255,122,26,.55) 50% 58%, transparent 58% 66%, rgba(255,122,26,.55) 66% 74%, transparent 74%) !important;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  background-position: bottom right;
  border-radius: 0 0 8px;
  cursor: ns-resize;
}
#prompt:hover::-webkit-resizer {
  background:
    linear-gradient(135deg, transparent 0 50%, rgba(255,122,26,.95) 50% 58%, transparent 58% 66%, rgba(255,122,26,.95) 66% 74%, transparent 74%) !important;
  background-size: 16px 16px;
}

/* ===== 参考图展开:动态间距 + 超出时托盘横向滚动 ===== */
#page-generate .ref-grid {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,122,26,.45) transparent;
}
#page-generate .ref-grid::-webkit-scrollbar { height: 6px; }
#page-generate .ref-grid::-webkit-scrollbar-thumb { background: rgba(255,122,26,.4); border-radius: 3px; }
#page-generate .ref-grid:hover { min-height: 106px; }
#page-generate .ref-grid:hover .ref-thumb {
  left: calc(102px + var(--stack-i, 0) * var(--fan-gap, 86px)) !important;
  transform: translateY(0) rotate(0deg) !important;
}
#page-generate .ref-thumb.dragging {
  left: calc(102px + var(--stack-i, 0) * var(--fan-gap, 86px)) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
#page-generate .ref-thumb.drag-over {
  left: calc(102px + var(--stack-i, 0) * var(--fan-gap, 86px)) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
#page-generate .ref-grid:hover::after {
  width: var(--tray-w, calc(100% - 108px)) !important;
}

/* ===== 参考图展开(按用户要求):每张固定全间距展开,溢出卡片浮于右列之上 ===== */
#page-generate .ref-grid { overflow: visible !important; }
#page-generate .ref-grid:hover::after,
body.ref-fan-force #page-generate .ref-grid::after {
  width: var(--tray-w, calc(100% - 108px)) !important;
  z-index: 5;
}
#page-generate .ref-grid:hover .ref-thumb,
body.ref-fan-force #page-generate .ref-thumb {
  left: calc(102px + var(--stack-i, 0) * 86px) !important;
  transform: translateY(0) rotate(0deg) !important;
}
body.ref-fan-force #page-generate .ref-thumb.dragging {
  left: calc(102px + var(--stack-i, 0) * 86px) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
body.ref-fan-force #page-generate .ref-thumb.drag-over {
  left: calc(102px + var(--stack-i, 0) * 86px) !important;
  transform: translateY(-5px) scale(1.04) rotate(0deg) !important;
}
/* 拖动时显示当前位置 */
.drag-index-badge {
  position: fixed;
  z-index: 10000;
  background: linear-gradient(135deg, #ff9a5c, #ff6a1a);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(255,106,26,.45);
  pointer-events: none;
  white-space: nowrap;
}

/* 展开层需要越过右列:悬停/拖拽时抬升左面板整个堆叠上下文 */
#page-generate .composer:has(.ref-grid:hover),
body.ref-fan-on #page-generate .composer,
body.ref-fan-force #page-generate .composer {
  position: relative;
  z-index: 80;
}

/* ===== 参考图悬停宽容:离开网格后短暂延迟才收起(避免移动途中收缩) ===== */
body.ref-fan-on #page-generate .ref-grid { min-height: 106px; }
body.ref-fan-on #page-generate .ref-grid::after {
  width: var(--tray-w, calc(100% - 108px)) !important;
  z-index: 5;
}
body.ref-fan-on #page-generate .ref-thumb:not(.dragging):not(.drag-over) {
  left: calc(102px + var(--stack-i, 0) * 86px) !important;
  transform: translateY(0) rotate(0deg) !important;
}

/* ============================================================
   云端次数制(html.cimage-cloud,由 index.html 在解析期打好标):
   调试工具/模型选择/公告从首帧就不渲染,不依赖 app.js 运行时隐藏时序。
   个人版(CIMAGE_DEV=1)不加该类,以下规则全部不生效。
   ============================================================ */
html.cimage-cloud #debug-log-fab,
html.cimage-cloud #c-log-fab,
html.cimage-cloud .notice-trigger,
html.cimage-cloud #announcement-bar,
html.cimage-cloud #wrap-model,
html.cimage-cloud #composer-model-picker { display: none !important; }
html.cimage-cloud .card:has(> .debug-toolbar) { display: none !important; }
html.cimage-cloud .c-field:has(#commerce-image-model) { display: none !important; }
