/* Unified original popover skin. Loaded after legacy styles to avoid fragmented overrides. */
.popover {
  z-index:80; box-sizing:border-box; padding:4px; border-radius:12px; min-width:160px;
  background:#262626; border:none;
  color:var(--studio-text,#eee); box-shadow:0 12px 40px #0006,0 2px 6px #0002;
  overflow:auto; overscroll-behavior:contain; scrollbar-width:thin;
  scrollbar-color:#555 transparent; max-width:calc(100vw - 24px);
  display:none; flex-direction:column; gap:4px;
}
.popover.open { display:flex; }
.popover[data-placement="top"] { transform-origin:left bottom; }
.popover[data-placement="bottom"] { transform-origin:left top; }
.popover .popover-title { margin:2px 4px 10px; padding:4px 6px; font-size:12px; font-weight:500; color:var(--studio-muted); }
.popover button:focus-visible { outline:2px solid var(--studio-accent); outline-offset:-2px; }
/* 匹配即梦网站的菜单项样式 */
.popover > button {
  padding:0 12px; min-height:36px; font-size:13px;
  display:flex; align-items:center; gap:8px;
  border-radius:8px; background:transparent;
  text-align:left; color:var(--studio-text);
}
.popover > button:hover { background:rgba(255,255,255,.08); }
.popover > button .menu-icon { width:16px; text-align:center; font-size:16px; flex-shrink:0; }
[data-menu][aria-expanded="true"],[data-studio="params"][aria-expanded="true"] { background:var(--studio-raised); border-radius:8px; }
[data-menu][aria-expanded="true"]>b,[data-studio="params"][aria-expanded="true"]>b { transform:rotate(180deg); }
.tool-select>b { transition:transform .12s; }
#autoMenu { padding:10px; }
#autoMenu .model-options { display:grid; gap:4px; }
#autoMenu .model-option {
  display:flex; flex-direction:row; align-items:center; gap:11px; padding:10px;
  min-height:62px; width:100%; border:1px solid transparent; border-radius:10px;
  background:none; color:var(--studio-text); text-align:left;
}
#autoMenu .model-option:hover { background:var(--studio-raised); }
#autoMenu .model-option.selected { background:var(--studio-raised); border-color:var(--studio-border); }
#autoMenu .model-emblem {
  display:grid; place-items:center; width:34px; height:34px; flex:0 0 34px;
  border:1px solid #ffffff15; border-radius:10px; font-size:16px; font-weight:650;
  color:#dae9e6; background:linear-gradient(145deg,#49645b,#283e3e);
}
#autoMenu .model-emblem.mj { background:linear-gradient(145deg,#5a547c,#343144);color:#eee5ff; }
#autoMenu .model-emblem.seedream { background:linear-gradient(145deg,#715b46,#413931);color:#ffe4b9; }
#autoMenu .model-copy { min-width:0; display:flex; flex:1; flex-direction:column; gap:5px; }
#autoMenu .model-copy strong { font-size:13px; font-weight:550; line-height:1.4; overflow-wrap:anywhere; }
#autoMenu .model-copy small { color:var(--studio-muted); font-size:11px; line-height:1.4; }
#autoMenu .model-check { flex:0 0 16px; color:var(--studio-text); font-size:15px; text-align:center; }
#autoMenu .popover-note { margin:0 4px 10px; padding:8px 10px; font-size:11px; line-height:1.55; }
#autoMenu>button { margin-top:6px; border-top:1px solid var(--studio-border); border-radius:0 0 8px 8px; padding-top:12px; }
#parameterPanel { padding:18px; border-radius:16px; }
.parameter-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:20px; }
.parameter-heading strong { font-size:14px; font-weight:550; }
.parameter-heading>span { font-size:11px; color:var(--studio-muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#parameterPanel .popover-title { font-size:12px; font-weight:400; padding:0; margin:0 0 11px; color:var(--studio-muted); }
#parameterPanel .popover-title:not(:first-child) { margin-top:22px; }
#parameterPanel .param-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; padding:0; background:none; }
#parameterPanel .param-choice { position:relative; margin:0; min-width:0; }
#parameterPanel .param-choice span { min-height:66px; padding:9px 4px; gap:9px; background:var(--studio-raised); border:1px solid transparent; border-radius:9px; color:var(--studio-text); font-size:12px; line-height:1.25; box-sizing:border-box; }
#parameterPanel .param-choice i { color:var(--studio-muted); border-color:currentColor; border-width:1px; background:none; font-size:12px; }
#parameterPanel .param-choice input:checked+span { background:#465055; border-color:#bdd9df; color:#edfafd; box-shadow:none; }
#parameterPanel .param-choice input:checked+span i { color:#d7e7eb; }
#parameterPanel .param-choice.is-disabled { opacity:.4; }
#parameterPanel .param-choice small { font-size:9px; line-height:1.3; color:var(--studio-muted); white-space:normal; }
#parameterPanel .inline-segments { display:flex; gap:4px; padding:4px; background:var(--studio-raised); border-radius:9px; }
#parameterPanel .inline-segments label { margin:0; }
#parameterPanel .inline-segments span { min-height:34px; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:5px; padding:7px 3px; font-size:12px; background:transparent; color:var(--studio-text); border:1px solid transparent; border-radius:6px; line-height:1.25; }
#parameterPanel .inline-segments input:checked+span { background:#50575b; color:#fff; border-color:#63757c; box-shadow:0 1px 4px #0003; }
#parameterPanel .resolution-options .param-choice span { min-height:48px; }
#parameterPanel .quality-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
#parameterPanel .param-toggle { color:var(--studio-text); font-size:12px; margin-top:18px; line-height:1.5; }
#parameterPanel .param-toggle small { font-size:10px; color:var(--studio-muted); }
#parameterPanel .parameter-note { border-top:1px solid var(--studio-border); margin-top:18px; padding-top:12px; color:var(--studio-muted); font-size:10px; line-height:1.65; }
html[data-theme="light"] #autoMenu .popover-note { background:#eef3f5; color:#526675; }
html[data-theme="light"] #autoMenu .popover-note.is-warn { background:#fff3e3; color:#80643b; }
html[data-theme="light"] #parameterPanel .param-choice input:checked+span,
html[data-theme="light"] #parameterPanel .inline-segments input:checked+span { background:#d3e8f0; color:#244d61; border-color:#80a8ba; }
html[data-theme="light"] #parameterPanel .param-choice input:checked+span i { color:#426c7c; }
@media(max-width:760px) {
  #parameterPanel { padding:15px; }
  #parameterPanel .param-choice span { min-height:59px; }
  #parameterPanel .inline-segments span { min-height:34px; }
  #autoMenu .model-option { padding:9px 7px; }
}
@media(prefers-reduced-motion:reduce) { .tool-select>b { transition:none; } }
/* Pin the shell, not a scrollable document: focus/scrollIntoView must not shift the topbar. */
html,body { overflow:clip; }
body>.app-shell { position:fixed; inset:0; height:100dvh; }
/* Geometry is measured during opening; opacity does not distort its bounding box. */
.popover.open { animation:studioPopoverFade .12s ease-out; }
@keyframes studioPopoverFade { from { opacity:0; } to { opacity:1; } }
@media(prefers-reduced-motion:reduce) { .popover.open { animation:none; } }
/* Keep the frequently-used controls compact; secondary settings are disclosed in place. */
.parameter-advanced { border-top:1px solid var(--studio-border); margin-top:18px; }
.parameter-advanced>summary { list-style:none; display:flex; align-items:center; gap:8px; padding:14px 0 0; color:var(--studio-text); cursor:pointer; font-size:12px; }
.parameter-advanced>summary::-webkit-details-marker { display:none; }
.parameter-advanced>summary::after { content:'⌄'; margin-left:auto; color:var(--studio-muted); }
.parameter-advanced[open]>summary::after { transform:rotate(180deg); }
.parameter-advanced>summary span { color:var(--studio-muted); font-size:10px; }
.parameter-advanced>summary:focus-visible { outline:2px solid var(--studio-accent); outline-offset:4px; border-radius:3px; }
#parameterPanel .parameter-advanced .popover-title { margin-top:18px; }
#parameterPanel label:has(input:disabled) { cursor:not-allowed; }
#parameterPanel .inline-segments label:has(input:disabled) { opacity:.4; }
#parameterPanel .param-toggle:has(input:disabled) { color:var(--studio-muted); }