/* The new (Plana-style) editor layout and its bilingual Tag chips.
   Loaded last. Rules that change the page are scoped body:not(.tag-layout-legacy),
   so the legacy layout keeps every original rule. Sections run roughly in the
   order the layout was built, and a later section may refine an earlier one;
   overridden declarations have been removed, so each line that remains is live.
   When changing a component, search the whole file for its selector.
   Note: 见 .agents/notes/implemented/feature/2026-10-02-tag-chips-and-selection-dock.md */

body:not(.tag-layout-legacy) .tag-list,
body:not(.tag-layout-legacy) .character-tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 6px;
  padding: 8px 10px;
  grid-template-columns: none;
}
body:not(.tag-layout-legacy) .character-tag-list { padding: 4px 0 8px; }

.tag-card.tag-chip {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  grid-template-columns: none;
  gap: 0;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  padding: 0;
  border: 1px solid #3d3e37;
  border-radius: 10px;
  background: #23241f;
  transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.tag-chip .tag-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 5px 10px 6px;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tag-chip .chip-line { display: flex; align-items: baseline; gap: 5px; min-width: 0; max-width: 100%; }
.tag-chip .chip-line strong { color: var(--text); font-size: 14px; font-weight: 650; line-height: 1.28; overflow-wrap: anywhere; }
.tag-chip .tag-translation { max-width: 100%; color: var(--muted); font-size: 11.5px; line-height: 1.3; overflow-wrap: anywhere; }
/* No translation yet: show the English line only, as Plana does. */
.tag-chip .tag-translation.missing { display: none; }
.tag-chip .tag-copy:has(.tag-translation.missing) { justify-content: center; }
.tag-chip.translations-hidden .tag-translation { display: none; }
.tag-chip.translations-hidden .tag-copy { justify-content: center; }
.tag-chip .chip-weight { flex: none; padding: 0 4px; border-radius: 5px; font-size: 11px; font-style: normal; font-weight: 700; }
.tag-chip .bundle-mark { flex: none; padding: 0 4px; border-radius: 5px; background: #ffffff12; color: var(--muted); font-size: 10px; font-style: normal; }

/* Weight reads at a glance: warm = emphasis ({ }), cool = de-emphasis ([ ]). */
.tag-chip.weight-up { border-color: #8a6440; }
.tag-chip.weight-up .chip-weight { background: #d08a4a24; color: #f0b073; }
.tag-chip.weight-down { border-color: #44618a; }
.tag-chip.weight-down .chip-weight { background: #5b7fb824; color: #95b5ea; }
.tag-chip.negative-weight { border-color: #8a4444; }
.tag-chip.negative-weight .chip-weight { background: #b85b5b24; color: #ff9a9a; }
.tag-chip.disabled { opacity: .42; }
.tag-chip.disabled .chip-line strong { text-decoration: line-through; }

.tag-chip:hover { border-color: #57584e; }
.tag-chip.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, #23241f);
  box-shadow: inset 0 0 0 1px var(--accent);
  opacity: 1;
}
.tag-chip .tag-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tag-chip .drag-handle { display: none; }
@media (hover: hover) and (pointer: fine) {
  .tag-chip .drag-handle { display: flex; align-items: center; padding: 0 7px 0 0; color: var(--muted); cursor: grab; opacity: 0; transition: opacity .12s ease; }
  .tag-chip:hover .drag-handle { opacity: .75; }
}
.tag-chip.tag-drop-before { box-shadow: -3px 0 0 var(--accent); }

/* Compact inline add row: "继续添加…", ＋, 整块 and 语义 share one line. */
body:not(.tag-layout-legacy) .tag-add:not(.character-tag-add),
body:not(.tag-layout-legacy) .character-tag-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
  padding: 0 10px 10px;
}
body:not(.tag-layout-legacy) .character-tag-add { padding: 0 0 8px; }
body:not(.tag-layout-legacy) .tag-add input { border-style: dashed; }
body:not(.tag-layout-legacy) .tag-add input:focus { border-style: solid; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .whole-add-button,
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .semantic-open-button { padding-inline: 9px; }

/* Layout switch + undo/redo share the existing tool row instead of adding one. */
.editor-tool-row { grid-template-columns: auto minmax(260px, 1fr) auto auto; }
.tag-history-buttons { display: flex; gap: 4px; }
.tag-history-buttons button { min-width: 38px; }
.tag-history-buttons #tagLayoutButton { min-width: 0; padding-inline: 10px; white-space: nowrap; }
.tag-history-buttons button:disabled { opacity: .35; }

/* Selection strip (#tagSelectionDock): base look. The new layout opens it inline
   under the selected chip's row (further down). */
.tag-dock {
  position: fixed;
  z-index: 75;
  right: 24px;
  bottom: 22px;
  width: min(460px, calc(100vw - var(--workspace-nav, 0px) - 48px));
  display: grid;
  border: 1px solid #5b4d3e;
  border-radius: 14px;
  background: #191a17f2;
  box-shadow: 0 14px 42px #000b;
  backdrop-filter: blur(18px);
  gap: 6px;
  padding: 6px 8px;
}
.tag-dock.hidden { display: none; }

/* Dock: one slim row (stepper + frequent actions); "更多" reveals the rest. */
.tag-dock svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.tag-dock-bar { display: flex; align-items: center; gap: 2px; min-height: 40px; }
.tag-dock-count { color: var(--accent); font-size: 12.5px; white-space: nowrap; }
.tag-dock-count:empty { display: none; }
.tag-dock-stepper { display: flex; align-items: center; }
.tag-dock-stepper button { width: 38px; height: 38px; padding: 0; border: 0; background: none; color: var(--text); font-size: 20px; }
.tag-dock-weight { min-width: 48px; color: var(--accent); font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 700; text-align: center; }
.tag-dock-spacer { flex: 1; }
.tag-dock-icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--text); }
.tag-dock-icon-button:active { background: #ffffff0f; }
.tag-dock-icon-button:disabled { opacity: .3; }
.tag-dock-icon-button[data-tone="danger"] { color: #e8908f; }
.tag-dock-icon-button[aria-expanded="true"] { color: var(--accent); }
.tag-dock-toolbar { display: flex; justify-content: space-between; gap: 2px; padding-top: 4px; border-top: 1px solid #ffffff0d; }
.tag-dock-toolbar[hidden] { display: none; }
.tag-dock-tool { position: relative; display: grid; flex: 1; justify-items: center; gap: 3px; min-width: 0; min-height: 48px; padding: 5px 0 2px; border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 0; cursor: pointer; }
.tag-dock-tool small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.tag-dock-tool:active { background: #ffffff0a; }
.tag-dock-tool:disabled { opacity: .3; }
.tag-dock-tool[aria-pressed="true"], .tag-dock-tool[aria-pressed="true"] small { color: var(--accent); }
.tag-dock-tool.tag-artist-jump { width: auto; height: auto; font-size: 18px; line-height: 20px; }
.tag-dock-tool.tag-artist-jump::after { content: "画师"; color: var(--muted); font-size: 11px; }
.tag-dock-move select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Quick ✎ / × on the selected chip. */
.chip-quick { display: flex; align-items: center; margin-left: -4px; padding-right: 2px; }
.chip-quick button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; background: none; color: var(--accent); }
.chip-quick button[data-tone="danger"] { color: #e8908f; }
.chip-quick svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }

/* Same breakpoint as the original tool-row grid in styles.css. */
@media (max-width: 760px) {
  .editor-tool-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "search restore"
      "modes history";
  }
  .tag-history-buttons { grid-area: history; }
  .tag-history-buttons button { min-height: 34px; min-width: 36px; font-size: 12px; }
}

@media (max-width: 720px) {
  .tag-dock { right: 6px; bottom: calc(72px + env(safe-area-inset-bottom)); width: calc(100vw - 12px); padding: 9px 10px; border-radius: 14px; }
  body.tag-selection-active .editor-column { padding-bottom: 250px; }
  .tag-chip .chip-line strong { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .tag-card.tag-chip { transition: none; }
}

/* ---------------------------------------------------------------------------
   New layout: one flowing page. Section tabs on top, flat sections separated
   by hairlines (no box-in-box), chips as the only rounded objects, and the
   positive/negative/text switch above the generate bar.
   The legacy layout keeps every original rule.
   --------------------------------------------------------------------------- */
body.tag-layout-legacy [data-new-layout-only] { display: none !important; }

/* Top: section tabs + quick actions, then a thin token meter. */
body:not(.tag-layout-legacy) .editor-command-bar { display: grid; align-items: center; column-gap: 6px; }
body:not(.tag-layout-legacy) .editor-command-bar > .module-nav { grid-column: 1; grid-row: 1; gap: 2px; padding: 0; }
body:not(.tag-layout-legacy) .editor-command-bar > .command-quick { position: relative; display: flex; align-items: center; }
body:not(.tag-layout-legacy) .editor-command-bar > .character-drag-targets { grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .editor-command-bar > .editor-tool-row { display: none; grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .editor-command-bar.search-open > .editor-tool-row { display: grid; grid-template-columns: 1fr; grid-template-areas: "search"; }
body:not(.tag-layout-legacy) .editor-command-bar.search-open > .editor-tool-row > :not(.prompt-search-box) { display: none; }
/* Tabs read as text with an underline, not as stacked pills. */
body:not(.tag-layout-legacy) .module-nav-button { min-height: 34px; padding: 6px 9px; border: 0; border-radius: 0; background: none; color: var(--muted); box-shadow: inset 0 -2px 0 transparent; }
body:not(.tag-layout-legacy) .module-nav-button.active { background: none; color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
body:not(.tag-layout-legacy) .module-nav-button > span { background: none; color: inherit; opacity: .6; }
.prompt-meter-row { display: flex; align-items: center; gap: 8px; padding: 0 4px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prompt-meter-row .prompt-meter-bar { flex: 1; }
.prompt-meter-bar { display: block; height: 3px; overflow: hidden; border-radius: 2px; background: #ffffff14; }
.prompt-meter-bar > i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.prompt-meter-bar > i[data-state="warn"] { background: #e0a35a; }
.prompt-meter-bar > i[data-state="over"] { background: #e06a6a; }
.layout-switch-button { border-radius: 17px; background: none; font-size: 12.5px; white-space: nowrap; }
.command-icon-button { display: grid; place-items: center; width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); font-size: 17px; }
.command-icon-button[aria-expanded="true"] { color: var(--accent); }
.command-menu { position: absolute; z-index: 90; top: calc(100% + 8px); right: 0; display: grid; min-width: 200px; padding: 6px; border: 1px solid #5b4d3e; border-radius: 12px; background: #1b1c18f7; box-shadow: 0 18px 44px #000c; }
.command-menu.hidden { display: none; }
.command-menu button { display: flex; align-items: center; justify-content: flex-start; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; text-align: left; }
.command-menu button:hover, .command-menu button:focus-visible { background: #ffffff0f; }
.command-menu button.danger { color: #ff9a9a; }

/* Flat page: panels lose their boxes and are separated by hairlines. */
body:not(.tag-layout-legacy) .editor-column,
body:not(.tag-layout-legacy) .settings-column { gap: 0; }
body:not(.tag-layout-legacy) .editor-column > .panel,
body:not(.tag-layout-legacy) .settings-column > .panel {
  padding: 14px 4px;
  border: 0;
  border-top: 1px solid #ffffff10;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
body:not(.tag-layout-legacy) .panel-title-row h2 { color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .06em; }
body:not(.tag-layout-legacy) .tag-display-options,
body:not(.tag-layout-legacy) .tag-panel-heading,
body:not(.tag-layout-legacy) .negative-panel > .panel-title-row { display: none; }
body:not(.tag-layout-legacy) .editor-column > [data-editor-module="tags"],
body:not(.tag-layout-legacy) .editor-column > [data-editor-module="uc"],
body:not(.tag-layout-legacy) .editor-column > [data-editor-module="raw"] { order: 1; border-top: 0; }
body:not(.tag-layout-legacy) .editor-column > [data-editor-module="characters"] { order: 2; }
body:not(.tag-layout-legacy) .editor-column > [data-editor-module="image"] { order: 3; }

/* Tag sections: small heading, chips, and an underline-style add input. */
body:not(.tag-layout-legacy) .tag-groups { display: grid; gap: 0; }
.tag-group.tag-section { padding: 10px 0 12px; border: 0; border-bottom: 1px solid #ffffff0c; border-radius: 0; background: none; }
.tag-group.tag-section:last-child { border-bottom: 0; }
.tag-section-head { display: flex; align-items: baseline; gap: 8px; padding: 0 2px 6px; }
.tag-section-head strong { color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; }
.tag-section-head .tag-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
body:not(.tag-layout-legacy) .tag-section .tag-list { min-height: 0; padding: 0; }
body:not(.tag-layout-legacy) .tag-section-add,
body:not(.tag-layout-legacy) .uc-chip-add { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px; padding: 6px 0 0; }
body:not(.tag-layout-legacy) .uc-chip-add { grid-template-columns: minmax(0, 1fr) auto; }
body:not(.tag-layout-legacy) .tag-add input {
  min-height: 34px;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid #ffffff1a;
  border-radius: 0;
  background: none;
  font-size: 14px;
}
body:not(.tag-layout-legacy) .tag-add input:focus { border-bottom-color: var(--accent); box-shadow: none; outline: none; }
body:not(.tag-layout-legacy) .tag-add .tag-add-button { border-radius: 50%; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions { display: flex; grid-column: auto; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .whole-add-button,
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .semantic-open-button { width: auto; }
/* 自动联想: candidates are a row of chips right under the input, in the
   section's own flow, so nothing (such as the generate bar) can cover them. A
   dashed outline in the section hue marks "not added yet"; tapping one adds it. */
body:not(.tag-layout-legacy) .tag-add .suggestion-menu { position: static; grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; max-height: none; margin: 8px 0 2px; padding: 0; overflow: visible; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) .tag-add .suggestion-menu.hidden { display: none; }
body:not(.tag-layout-legacy) .tag-add .suggestion-item { display: inline-flex; align-items: baseline; gap: 5px; width: auto; max-width: 100%; min-width: 0; min-height: 0; padding: 5px 10px 6px 8px; border: 1px dashed color-mix(in srgb, var(--hue, var(--accent)) 42%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--hue, var(--accent)) 7%, transparent); color: var(--text); box-shadow: none; transition: background-color .12s ease, transform .12s ease; }
body:not(.tag-layout-legacy) .tag-add .suggestion-item::before { align-self: center; color: var(--hue, var(--accent)); font-size: 14px; font-weight: 700; line-height: 1; content: "+"; }
body:not(.tag-layout-legacy) .tag-add .suggestion-item:hover,
body:not(.tag-layout-legacy) .tag-add .suggestion-item.active { border-style: solid; background: color-mix(in srgb, var(--hue, var(--accent)) 18%, transparent); }
body:not(.tag-layout-legacy) .tag-add .suggestion-item:active { transform: scale(.96); }
body:not(.tag-layout-legacy) .tag-add .suggestion-copy { gap: 1px; }
body:not(.tag-layout-legacy) .tag-add .suggestion-copy strong { font-size: 13.5px; font-weight: 600; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
body:not(.tag-layout-legacy) .tag-add .suggestion-copy small { color: var(--muted); font-size: 11px; line-height: 1.25; }
body:not(.tag-layout-legacy) .tag-add .suggestion-copy small.missing { display: none; }
body:not(.tag-layout-legacy) .tag-add .suggestion-count { color: var(--muted); font-size: 10px; opacity: .75; }
body:not(.tag-layout-legacy) .tag-add .suggestion-loading,
body:not(.tag-layout-legacy) .tag-add .suggestion-empty { display: flex; align-items: center; gap: 7px; padding: 2px 2px 0; color: var(--muted); font-size: 12px; }
body:not(.tag-layout-legacy) .tag-add .suggestion-loading::before { width: 6px; height: 6px; border-radius: 50%; background: var(--hue, var(--accent)); content: ""; animation: suggest-pulse 1s ease-in-out infinite; }
@keyframes suggest-pulse { 50% { opacity: .25; transform: scale(.6); } }
@media (prefers-reduced-motion: reduce) { body:not(.tag-layout-legacy) .tag-add .suggestion-loading::before { animation: none; } }
.uc-chip-list.empty::before { content: '暂无负面 Tag'; color: var(--muted); font-size: 13px; }
body:not(.tag-layout-legacy) .uc-chip-list { padding: 4px 0 2px; }

/* Characters: a thin accent rail instead of a box. */
body:not(.tag-layout-legacy) .character-card { border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) .character-list.empty-state { min-height: 0; border: 0; background: none; text-align: left; }
body:not(.tag-layout-legacy) .character-tag-area { padding: 0; border: 0; background: none; }

/* Positive / negative side and text mode pick what is shown. */
body:not(.tag-layout-legacy):not(.edit-text-mode) .editor-column > [data-editor-module="raw"],
body:not(.tag-layout-legacy).edit-side-negative .editor-column > [data-editor-module="raw"],
body:not(.tag-layout-legacy).edit-text-mode .editor-column > [data-editor-module="tags"],
body:not(.tag-layout-legacy).edit-side-negative .editor-column > [data-editor-module="tags"],
body:not(.tag-layout-legacy):not(.edit-side-negative) .editor-column > [data-editor-module="uc"],
body:not(.tag-layout-legacy).edit-text-mode .editor-column > [data-editor-module="characters"] { display: none; }
body:not(.tag-layout-legacy):not(.edit-side-negative) .character-uc-area,
body:not(.tag-layout-legacy).edit-side-negative .character-tag-area:not(.character-uc-area) { display: none; }
body:not(.tag-layout-legacy):not(.edit-text-mode) #negativePrompt,
body:not(.tag-layout-legacy).edit-text-mode .uc-chip-list,
body:not(.tag-layout-legacy).edit-text-mode .uc-chip-add { display: none; }
/* Reached only through the switch, so a remembered fold must not hide them. */
body:not(.tag-layout-legacy) .negative-panel.collapsed > .collapsible-panel-body,
body:not(.tag-layout-legacy) .raw-panel.collapsed > .collapsible-panel-body { display: block !important; }

/* Edit row (sticky, under the tabs): side, text mode, meter, undo/redo. */
.edit-switch-row { display: flex; align-items: center; gap: 6px; }
.edit-switch-row .prompt-meter-bar { flex: 1; min-width: 28px; }
.edit-side-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #0f100e; }
.edit-side-switch button { min-height: 28px; padding: 0 11px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.edit-side-switch button[aria-pressed="true"] { background: var(--accent); color: #1b1408; font-weight: 700; }
.edit-side-switch button[data-edit-side="negative"][aria-pressed="true"] { background: #8a4444; color: #fff; }
.edit-switch-button { min-width: 30px; min-height: 30px; padding: 0 7px; border: 0; border-radius: 999px; background: none; color: var(--text); font-size: 12.5px; white-space: nowrap; }
.edit-switch-button[aria-pressed="true"] { color: var(--accent); }
.edit-switch-button:disabled { opacity: .3; }

@media (max-width: 720px) {
  /* The header row folds into the tab bar; ⚙ stays pinned top-right. */
  body.editor-tab-active:not(.tag-layout-legacy) .workspace-topbar { display: none; }
  body.editor-tab-active:not(.tag-layout-legacy) .editor-command-bar {
    top: 0;
    width: 100%;
    margin-top: 0;
    padding: max(4px, env(safe-area-inset-top)) 50px 6px 6px;
    border: 0;
    border-bottom: 1px solid #ffffff10;
    border-radius: 0;
  }
  body:not(.tag-layout-legacy) .workspace { padding-bottom: 170px; }
  body:not(.tag-layout-legacy) .editor-column > .panel,
  body:not(.tag-layout-legacy) .settings-column > .panel { padding: 12px 2px; }
  .edit-side-switch button { padding: 0 10px; }
}

/* ---------------------------------------------------------------------------
   Plana-style length control. Everything except the Tags collapses to
   one line: workflow tool rows, two-line character tiles, parameters in a
   bottom sheet opened from bar readouts, and one-line empty sections.
   --------------------------------------------------------------------------- */

/* Image workflow: three flat tool rows; bodies open per row. */
body:not(.tag-layout-legacy) .image-workflow-panel { display: flex; flex-direction: column; }
body:not(.tag-layout-legacy) .image-workflow-panel > .panel-title-row { order: 0; margin-bottom: 2px; }
body:not(.tag-layout-legacy) .image-workflow-panel > .workflow-switch-grid { display: none; }
body:not(.tag-layout-legacy) .image-workflow-panel > [data-wf-row="base"] { order: 1; }
body:not(.tag-layout-legacy) .image-workflow-panel > [data-wf-body="base"] { order: 2; }
body:not(.tag-layout-legacy) .image-workflow-panel > #baseImageWorkflow { order: 3; }
body:not(.tag-layout-legacy) .image-workflow-panel > [data-wf-row="vibe"] { order: 4; }
body:not(.tag-layout-legacy) .image-workflow-panel > [data-wf-body="vibe"] { order: 5; }
body:not(.tag-layout-legacy) .image-workflow-panel > #vibeReferencePanel { order: 6; }
body:not(.tag-layout-legacy) .image-workflow-panel > [data-wf-row="precise"] { order: 7; }
body:not(.tag-layout-legacy) .image-workflow-panel > [data-wf-body="precise"] { order: 8; }
body:not(.tag-layout-legacy) .image-workflow-panel > #preciseReferencePanel { order: 9; }
.workflow-row { display: flex; align-items: center; gap: 6px; min-height: 48px; border-bottom: 1px solid #ffffff0a; }
.workflow-row-main { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; min-height: 46px; padding: 0 2px; border: 0; background: none; color: var(--text); font-size: 14.5px; text-align: left; }
.workflow-row-main strong { font-weight: 600; white-space: nowrap; }
.workflow-row-icon { width: 20px; color: var(--muted); font-size: 16px; text-align: center; }
.workflow-row-state { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 12.5px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.workflow-row-chevron { color: var(--muted); font-size: 11px; transition: transform .15s ease; }
.workflow-row-add { display: grid; place-items: center; width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; }
.image-workflow-panel.wf-base-active [data-wf-row="base"] .workflow-row-state,
.image-workflow-panel.wf-vibe-active [data-wf-row="vibe"] .workflow-row-state,
.image-workflow-panel.wf-precise-active [data-wf-row="precise"] .workflow-row-state { color: var(--accent); }
.image-workflow-panel.wf-base-active [data-wf-row="base"] .workflow-row-icon,
.image-workflow-panel.wf-vibe-active [data-wf-row="vibe"] .workflow-row-icon,
.image-workflow-panel.wf-precise-active [data-wf-row="precise"] .workflow-row-icon { color: var(--accent); }
.image-workflow-panel.wf-open-base [data-wf-row="base"] .workflow-row-chevron,
.image-workflow-panel.wf-open-vibe [data-wf-row="vibe"] .workflow-row-chevron,
.image-workflow-panel.wf-open-precise [data-wf-row="precise"] .workflow-row-chevron { transform: rotate(180deg); }
/* Row bodies and the existing subpanels show only while their row is open. */
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-open-base) > [data-wf-body="base"],
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-open-base) > #baseImageWorkflow,
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-open-vibe) > [data-wf-body="vibe"],
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-open-vibe) > #vibeReferencePanel,
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-open-precise) > [data-wf-body="precise"],
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-open-precise) > #preciseReferencePanel,
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-vibe-active) > [data-wf-body="vibe"],
body:not(.tag-layout-legacy) .image-workflow-panel:not(.wf-precise-active) > [data-wf-body="precise"] { display: none; }
.workflow-row-body { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 4px 30px; }
.workflow-mode-chips button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; background: none; color: var(--muted); font-size: 13px; }
.workflow-mode-chips button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); }
.workflow-mode-chips button:disabled { opacity: .35; }
.workflow-off { min-height: 30px; padding: 0; border: 0; background: none; color: #e39494; font-size: 12.5px; }
/* Existing subpanels lose their boxes; the row acts as their title. */
body:not(.tag-layout-legacy) .image-workflow-panel .workflow-subpanel { margin: 0; padding: 8px 0 12px 30px; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) #vibeReferencePanel > .workflow-subpanel-title,
body:not(.tag-layout-legacy) #preciseReferencePanel > .workflow-subpanel-title,
body:not(.tag-layout-legacy) #baseImageWorkflow > .workflow-subpanel-title { display: none; }

/* Characters: two-line tiles that expand in place. */
.count-badge { border-radius: 10px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.count-badge.over { background: #8a444433; color: #ff9a9a; }
body:not(.tag-layout-legacy) .character-card > .character-head { display: none; }
/* Positions are edited in the shared position sheet. */
body:not(.tag-layout-legacy) .character-card > .character-position-box { display: none; }
body:not(.tag-layout-legacy) .character-card:not(.tile-open) .character-tag-area { display: none !important; }
.character-tile { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; }
.character-tile-row { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.character-power { display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--muted); font-size: 17px; }
.character-power[aria-pressed="true"] { color: var(--accent); }
.character-tile-name { flex: 1; min-width: 0; overflow: hidden; color: var(--text); font-size: 14.5px; text-overflow: ellipsis; white-space: nowrap; }
.character-tile-name em { margin-left: 6px; font-weight: 400; }
.character-position-chip { border: 0; color: var(--accent); font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: nowrap; }
.character-tile-icon { display: grid; place-items: center; width: 32px; min-width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 15px; }
.character-tile-icon.danger { color: #e39494; }
.character-tile-preview { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 2px 0 40px; border: 0; background: none; color: var(--muted); font-size: 13.5px; text-align: left; }
.character-tile-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.character-tile-preview span.placeholder { opacity: .6; }
.character-tile-preview em { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11px; font-style: normal; opacity: .7; }
.character-tile-preview i { font-size: 10px; font-style: normal; transition: transform .15s ease; }
.character-card.tile-open .character-tile-preview i { transform: rotate(180deg); }
body:not(.tag-layout-legacy) .character-card .character-position-box { margin: 4px 0 6px 40px; }

/* Parameters: bar readouts open a bottom sheet holding the existing form. */
body:not(.tag-layout-legacy):not(.params-sheet-open) .settings-column > .sticky-settings { display: none; }
.params-sheet-backdrop { display: none; }
body:not(.tag-layout-legacy).params-sheet-open .params-sheet-backdrop { position: fixed; inset: 0; display: block; background: #000a; }
body:not(.tag-layout-legacy).params-sheet-open .settings-column > .sticky-settings {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  max-height: min(78vh, 720px);
  overflow: auto;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid #5b4d3e;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #191a17;
  box-shadow: 0 -18px 48px #000c;
}
body:not(.tag-layout-legacy).params-sheet-open .sticky-settings > .collapsible-panel-body { display: block !important; }
body:not(.tag-layout-legacy) .sticky-settings .panel-collapse-button,
body:not(.tag-layout-legacy) .sticky-settings .parameter-summary { display: none; }
.params-sheet-close { margin-left: auto; }
body.tag-layout-legacy .params-sheet-close { display: none; }
@media (min-width: 721px) {
  body:not(.tag-layout-legacy).params-sheet-open .settings-column > .sticky-settings { right: auto; bottom: 24px; left: 50%; width: min(560px, calc(100vw - 48px)); border-bottom: 1px solid #5b4d3e; border-radius: 16px; transform: translateX(-50%); }
}

/* Empty Tag sections are one line; ＋ reveals their input. */
.tag-section-add-toggle { display: none; margin-left: auto; width: 28px; height: 28px; padding: 0; border-radius: 50%; line-height: 1; }
.tag-section.is-empty .tag-section-add-toggle { display: grid; place-items: center; }
.tag-section.is-empty .tag-section-head { padding-bottom: 0; }
.tag-section.is-empty .tag-list,
.tag-section.is-empty:not(.adding) .tag-section-add { display: none; }
.tag-group.tag-section.is-empty { padding: 8px 0; }

/* Line icons for the character tile. */
.character-power svg, .character-tile-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

/* ---------------------------------------------------------------------------
   Rounded rectangles only where they carry meaning (the
   chips and the floating surfaces). Everything else is text, icons, colour
   and hairlines.
   --------------------------------------------------------------------------- */
/* Chips: light fill instead of an outline; weight reads from the badge. */
body:not(.tag-layout-legacy) .tag-card.tag-chip { background: #ffffff0b; }
body:not(.tag-layout-legacy) .tag-chip.weight-up,
body:not(.tag-layout-legacy) .tag-chip.weight-down,
body:not(.tag-layout-legacy) .tag-chip.negative-weight { border-color: transparent; }
body:not(.tag-layout-legacy) .tag-chip:hover { border-color: transparent; background: #ffffff12; }
body:not(.tag-layout-legacy) .tag-chip .chip-weight { padding: 0; background: none; }

/* Add controls: plain accent ＋ and text actions. */
body:not(.tag-layout-legacy) .tag-add .tag-add-button,
.workflow-row-add,
.tag-section-add-toggle { border: 0; background: none; color: var(--accent); box-shadow: none; }
.workflow-row-add { font-size: 22px; }
.tag-section-add-toggle { font-size: 18px; }

/* Character header: text actions, no boxes; collapsing is not needed. */
body:not(.tag-layout-legacy) .character-panel .panel-collapse-button { display: none; }
body:not(.tag-layout-legacy) .character-panel #addCharacterButton { padding: 0 4px; border: 0; background: none; box-shadow: none; font-weight: 600; }
body:not(.tag-layout-legacy) .character-panel .character-position-toggle { min-height: 32px; padding: 0 4px; border: 0; background: none; color: var(--muted); }
body:not(.tag-layout-legacy) .character-panel .character-position-toggle:has(input:checked) { color: var(--accent); }
.count-badge { padding: 0; background: none; }

/* Character tiles: icons and text only. */
.character-power { width: 30px; min-width: 30px; height: 30px; border-radius: 0; }
.character-power[aria-pressed="true"] { background: none; }
.character-position-chip { min-height: 30px; padding: 0 4px; border-radius: 0; background: none; }

/* Top bar: the layout switch is a quiet text action. */
.layout-switch-button { min-height: 30px; padding: 0 6px; border: 0; color: var(--muted); }

/* Position sheet (after Plana's position dialog). */
.position-sheet { display: none; }
body:not(.tag-layout-legacy).position-sheet-open .params-sheet-backdrop { position: fixed; z-index: 94; inset: 0; display: block; background: #000a; }
body:not(.tag-layout-legacy).position-sheet-open .position-sheet {
  position: fixed;
  z-index: 95;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 10px;
  max-height: 86vh;
  overflow: auto;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid #5b4d3e;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #191a17;
  box-shadow: 0 -18px 48px #000c;
}
@media (min-width: 721px) {
  body:not(.tag-layout-legacy).position-sheet-open .position-sheet { right: auto; bottom: 24px; left: 50%; width: min(440px, calc(100vw - 48px)); border-bottom: 1px solid #5b4d3e; border-radius: 16px; transform: translateX(-50%); }
}
.position-sheet-head { display: flex; align-items: center; gap: 10px; }
.position-sheet-head strong { flex: 1; color: var(--text); font-size: 16px; }
.position-auto { min-height: 30px; padding: 0 10px; border: 0; border-radius: 15px; background: none; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; font-weight: 700; }
.position-auto[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.position-strip { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.position-strip button { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 16px; background: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
.position-strip button b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #ffffff14; color: var(--text); font-size: 11px; }
.position-strip button[aria-pressed="true"] { color: var(--text); }
.position-strip button[aria-pressed="true"] b { background: var(--accent); color: #1b1408; }
.position-canvas { position: relative; width: min(100%, calc(52vh * var(--ratio, .68))); max-height: 52vh; margin: 0 auto; overflow: hidden; border-radius: 10px; background: #ffffff08; touch-action: none; cursor: crosshair; }
/* Rule-of-thirds guide on the free V5 canvas. */
.position-guide {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent calc(33.33% - .5px), #ffffff12 calc(33.33% - .5px), #ffffff12 calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), #ffffff12 calc(66.66% - .5px), #ffffff12 calc(66.66% + .5px), transparent calc(66.66% + .5px)),
  linear-gradient(to bottom, transparent calc(33.33% - .5px), #ffffff12 calc(33.33% - .5px), #ffffff12 calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), #ffffff12 calc(66.66% - .5px), #ffffff12 calc(66.66% + .5px), transparent calc(66.66% + .5px));
  pointer-events: none;
}
.position-canvas.grid-mode .position-guide { display: none; }
.position-cell { position: absolute; width: 20%; height: 20%; box-shadow: inset 0 0 0 .5px #ffffff14; pointer-events: none; }
.position-dot { position: absolute; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #ffffff26; color: var(--text); font-size: 11px; font-weight: 700; transform: translate(-50%, -50%); pointer-events: none; transition: left .08s linear, top .08s linear; }
.position-dot.current { z-index: 2; width: 34px; height: 34px; background: var(--accent); color: #1b1408; font-size: 13px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
.position-dot.disabled { opacity: .35; }
.position-canvas.auto .position-dot { opacity: .45; }
.position-auto-note { position: absolute; right: 8px; bottom: 6px; color: var(--muted); font-size: 11.5px; font-style: normal; pointer-events: none; }
.position-readout { margin: 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: center; }
/* AUTO lives in the sheet; the panel header no longer needs the checkbox. */
body:not(.tag-layout-legacy) .character-panel .character-position-toggle { display: none; }

/* Lighter chips and fewer framed boxes. */
body:not(.tag-layout-legacy) .tag-chip .tag-copy { min-height: 34px; padding: 4px 10px 5px; }
body:not(.tag-layout-legacy) .tag-card.tag-chip { border-radius: 8px; }
body:not(.tag-layout-legacy) .tag-chip .chip-line strong { font-size: 13.5px; font-weight: 600; }
body:not(.tag-layout-legacy) .tag-chip .tag-translation { font-size: 11px; }
body:not(.tag-layout-legacy) .parameter-help-button { border: 0; background: none; color: var(--muted); }
body:not(.tag-layout-legacy) .quick-latest { border: 0; background: none; }
body:not(.tag-layout-legacy) .quick-latest:has(> span:only-child) { min-height: 0; padding: 2px 0; justify-content: flex-start; color: var(--muted); font-size: 13px; }
body:not(.tag-layout-legacy) .generation-panel .batch-control-heading strong { color: var(--muted); font-size: 12.5px; letter-spacing: .06em; }

/* The tile row is the title; the area heading would repeat it. */
body:not(.tag-layout-legacy) .character-card .character-tag-title { display: none; }

/* Visible translation prompt. */
.translate-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 2px 2px; color: var(--muted); font-size: 12.5px; }
.translate-hint[hidden] { display: none; }
.translate-hint button { min-height: 30px; padding: 0 4px; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; }

/* Parameter sheet regrouped — size tiles, sliders, switch rows. */
body:not(.tag-layout-legacy).params-sheet-open .sticky-settings .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > * { min-width: 0; }
.sheet-group-title { grid-column: 1 / -1; margin-top: 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#model) { order: 1; grid-column: 1 / -1; }
.sheet-group-title[data-sheet-group="size"] { order: 10; }
.size-tiles { order: 11; grid-column: 1 / -1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#sizePreset) { order: 12; display: none; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#width) { order: 13; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#height) { order: 14; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > .dimension-tools { order: 15; grid-column: 1 / -1; }
.sheet-group-title[data-sheet-group="sampling"] { order: 20; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#steps) { order: 21; grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#scale) { order: 22; grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#sampler) { order: 23; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#noiseSchedule) { order: 24; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#cfgRescale) { order: 25; grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#ucPreset) { order: 26; grid-column: 1 / -1; }
.sheet-group-title[data-sheet-group="options"] { order: 30; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > .parameter-choice { order: 31; grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > .advanced-box { order: 50; grid-column: 1 / -1; }
/* Size tiles: a proportional outline per preset. */
.size-tiles button { display: grid; flex: 1 0 auto; justify-items: center; align-content: end; gap: 4px; min-width: 64px; min-height: 76px; padding: 8px 6px; border-radius: 12px; background: #ffffff08; color: var(--muted); }
.size-tiles button i { display: block; border: 1.5px solid currentColor; border-radius: 3px; }
.size-tiles button b { color: var(--text); font-size: 12px; font-weight: 600; }
.size-tiles button small { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.size-tiles button[aria-pressed="true"] { border-color: var(--accent); }
/* Label with value + slider underneath (number field keeps precise entry). */
body:not(.tag-layout-legacy) .sticky-settings label:has(.param-slider) { display: grid; align-items: center; column-gap: 10px; }
body:not(.tag-layout-legacy) .sticky-settings label:has(.param-slider) > input[type="number"] { grid-column: 2; grid-row: 1; text-align: right; }
.param-slider { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
/* Option toggles become switch rows. The checkbox stays hidden (existing
   rule); the span after it draws the row text plus a track (::after) and a
   knob (::before), driven by input:checked. */
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice { display: flex; align-items: center; gap: 4px; min-height: 46px; border-bottom: 1px solid #ffffff0a; }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice > label { flex: 1; min-height: 46px; }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice label span { position: relative; justify-content: flex-start; min-height: 46px; padding: 0 58px 0 0; border: 0; border-radius: 0; background: none; color: var(--text); font-size: 14px; }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice label span::after { position: absolute; top: 50%; right: 4px; width: 42px; height: 24px; border-radius: 12px; background: #ffffff1f; content: ""; transform: translateY(-50%); transition: background .15s ease; }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice label span::before { position: absolute; z-index: 1; top: 50%; right: 25px; width: 18px; height: 18px; border-radius: 50%; background: #d9d4c8; content: ""; transform: translateY(-50%); transition: right .15s ease, background .15s ease; }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice input:checked + span { border: 0; background: none; color: var(--text); }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice input:checked + span::after { background: var(--accent); }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice input:checked + span::before { right: 7px; background: #1b1408; }
body:not(.tag-layout-legacy) .sticky-settings .parameter-choice input:disabled + span { opacity: .35; }
/* Compact number fields beside sliders; the aspect row and JSON box lose frames. */
body:not(.tag-layout-legacy) .sticky-settings label:has(.param-slider) > input[type="number"] { min-height: 0; }
body:not(.tag-layout-legacy) .sticky-settings .dimension-tools,
body:not(.tag-layout-legacy) .sticky-settings .advanced-box { padding: 0; border: 0; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) .sticky-settings .advanced-box { padding-top: 6px; border-top: 1px solid #ffffff0a; }
body:not(.tag-layout-legacy) .sticky-settings .advanced-box > summary { color: var(--muted); font-size: 13px; }

/* Generate bar = shot parameters + count + generate (no queue). */
body:not(.tag-layout-legacy) .floating-generate-bar { align-items: center; }
body:not(.tag-layout-legacy) .floating-generate-bar > #batchCount,
body:not(.tag-layout-legacy) .floating-generate-bar > #customCount,
body:not(.tag-layout-legacy) .floating-generate-bar > #floatingQueueButton { display: none !important; }
.gen-params { display: flex; grid-column: 1 / -1; align-items: center; gap: 2px; min-width: 0; padding-bottom: 6px; border-bottom: 1px solid #ffffff0d; }
.gen-params > * + * { margin-left: 2px; }
.gen-stepper { display: flex; align-items: center; }
.gen-stepper > button[data-gen-step] { width: 28px; height: 34px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 17px; touch-action: manipulation; }
.gen-stepper > button[data-gen-step].holding { color: var(--accent); }
.gen-value { display: flex; align-items: center; gap: 3px; min-height: 34px; padding: 0 2px; border: 0; background: none; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gen-value small { color: var(--muted); font-size: 10.5px; }
.gen-value b { font-weight: 600; }
/* Seed: the mode is the message — random is quiet, fixed is gold with a lock. */
.gen-seed { display: flex; align-items: center; gap: 4px; min-height: 30px; margin-left: auto !important; padding: 0 9px; border: 0; border-radius: 15px; background: #ffffff0d; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.gen-seed i { width: 13px; height: 13px; border: 1.6px solid currentColor; border-radius: 3px; }
.gen-seed[data-mode="random"] i { border-radius: 50%; border-style: dashed; }
.gen-seed b { font-weight: 700; }
.gen-seed small { max-width: 76px; overflow: hidden; color: inherit; font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; opacity: .8; text-overflow: ellipsis; }
.gen-seed small:empty { display: none; }
.gen-seed[data-mode="fixed"], .gen-seed[data-mode="increment"] { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.gen-size, .gen-more { min-height: 34px; padding: 0 4px; border: 0; background: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gen-more { font-size: 16px; }
.gen-count { display: flex; align-items: center; height: 44px; border-radius: 12px; background: #ffffff0a; }
.gen-count button { width: 34px; height: 44px; padding: 0; border: 0; background: none; color: var(--text); font-size: 18px; touch-action: manipulation; }
.gen-count b { min-width: 30px; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; text-align: center; }
@media (max-width: 380px) {
  .gen-size { display: none; }
}

/* Artist chips: the ◈ is its own tap target that opens the artist preview. */
.tag-chip .chip-artist-jump { margin-right: -6px; font-size: 14px; }

/* Sheet: seed sits right under the size group. */
.sheet-group-title[data-sheet-group="seed"] { order: 16; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#seedMode) { order: 17; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label:has(#seed) { order: 18; }

/* The bar carries model / sampler / UC and the four option buttons. */
.gen-deck { grid-column: 1 / -1; align-items: center; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; border-bottom: 1px solid #ffffff0d; -webkit-overflow-scrolling: touch; }
.gen-deck::-webkit-scrollbar { display: none; }
/* 3 / 5 / custom counts must not squeeze the generate button. */
body:not(.tag-layout-legacy) .floating-generate-bar,
body:not(.tag-layout-legacy) .floating-generate-bar:has(.floating-custom-count:not([hidden])) { grid-template-columns: auto minmax(0, 1fr); }
body:not(.tag-layout-legacy) .floating-generate-button { min-width: 0; white-space: nowrap; }

/* Sheet: flat fields (underline) instead of rounded boxes. */
body:not(.tag-layout-legacy) .sticky-settings input[type="number"],
body:not(.tag-layout-legacy) .sticky-settings input[type="text"],
body:not(.tag-layout-legacy) .sticky-settings select {
  min-height: 34px;
  height: 34px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid #ffffff1f;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
}
body:not(.tag-layout-legacy) .sticky-settings input:focus,
body:not(.tag-layout-legacy) .sticky-settings select:focus { border-bottom-color: var(--accent); outline: none; }
body:not(.tag-layout-legacy) .sticky-settings .form-grid > label { gap: 2px; color: var(--muted); font-size: 12px; }
body:not(.tag-layout-legacy) .sticky-settings .swap-dimensions-button { min-height: 34px; padding: 0 6px; border: 0; background: none; color: var(--accent); }
body:not(.tag-layout-legacy) .sticky-settings textarea { border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) .sticky-settings .relocated-home,
body:not(.tag-layout-legacy) .sheet-group-title[data-sheet-group="options"] { display: none; }
.gen-deck { padding-right: 24px; }
/* Slider rows: one line for name + value, the track right under it. */
body:not(.tag-layout-legacy) .sticky-settings label:has(.param-slider) { grid-template-columns: 1fr 64px; row-gap: 0; }
body:not(.tag-layout-legacy) .sticky-settings label:has(.param-slider) > input[type="number"] { height: 30px; padding: 0 2px; border-bottom-color: transparent; color: var(--accent); font-weight: 600; }
.param-slider { height: 22px; min-height: 0; margin: 0; padding: 0; border: 0; background: none; }
body:not(.tag-layout-legacy) .sticky-settings input.param-slider { height: 22px; min-height: 0; }

/* 法典 is a bottom tab (Storm's slot in the new layout) — flat, image-first. */
.codex-page { padding: 0 14px 24px; }
.codex-top { position: sticky; z-index: 6; top: var(--codex-sticky-top, 0px); margin: 0 -14px; padding: 4px 14px 0; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px); }
.codex-head { display: flex; align-items: center; padding: 2px 0 0; }
.codex-r18 { color: #e98a8a; font-size: 10px; font-style: normal; font-weight: 700; }
.codex-tools { display: flex; align-items: center; gap: 12px; padding: 0 0 6px; }
.codex-tools input[type="search"] { flex: 1; min-width: 0; min-height: 38px; height: 38px; padding: 0 2px; border: 0; border-bottom: 1px solid #ffffff1a; border-radius: 0; background: none; color: var(--text); font-size: 14px; }
.codex-tools input[type="search"]:focus { border-bottom-color: var(--accent); box-shadow: none; }
.codex-path { display: grid; gap: 4px; margin: 0 -14px; padding: 0 14px 8px; border-bottom: 1px solid #ffffff0d; }
.codex-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; }
.codex-crumb { min-height: 26px; padding: 0 3px; border: 0; background: none; color: var(--muted); font-size: 13px; box-shadow: none; }
.codex-crumb + .codex-crumb::before { margin-right: 5px; color: #ffffff30; content: "›"; }
.codex-crumb[aria-current="true"] { color: var(--text); font-weight: 600; }
.codex-total { margin-left: auto; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.codex-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.codex-cats::-webkit-scrollbar { display: none; }
.codex-cat { display: flex; flex: none; gap: 4px; min-height: 30px; padding: 0 11px; border: 0; border-radius: 15px; background: #ffffff0b; color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; box-shadow: none; }
.codex-cat small { color: var(--muted); font-size: 10.5px; }
.codex-grid { columns: 2 160px; column-gap: 10px; padding-top: 12px; }
@media (min-width: 900px) {
  .codex-grid { columns: 4 180px; }
}
.codex-card { display: grid; gap: 6px; padding: 0; border: 0; background: none; color: var(--text); text-align: left; box-shadow: none; }
.codex-thumb { display: block; width: 100%; min-height: 80px; border-radius: 10px; background: #ffffff08; object-fit: cover; }
.codex-thumb.broken { min-height: 0; height: 0; }
.codex-card b { padding: 0 2px; font-size: 13px; font-weight: 600; line-height: 1.35; }
.codex-card.text-only { border-top: 1px solid #ffffff14; }
.codex-card.text-only small { display: -webkit-box; overflow: hidden; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.codex-chars { position: absolute; top: 6px; right: 6px; padding: 2px 7px; border-radius: 9px; background: #000a; color: var(--accent); font-size: 10.5px; font-style: normal; }
.codex-empty { column-span: all; padding: 28px 6px; color: var(--muted); font-size: 13px; text-align: center; }
.codex-more { display: block; width: 100%; min-height: 40px; margin: 4px 0 8px; border: 0; background: none; color: var(--accent); font-size: 13px; box-shadow: none; }
.codex-more[hidden] { display: none; }
.codex-credit { margin: 6px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.codex-credit a { color: var(--accent); }
/* Entry detail: a full-screen page over the tab, image first. */
.codex-detail { position: fixed; z-index: 120; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); background: var(--bg); }
.codex-detail[hidden] { display: none; }
body.codex-detail-open { overflow: hidden; }
.codex-detail-head { display: flex; align-items: center; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; padding: 8px 14px 8px 6px; border-bottom: 1px solid #ffffff0d; }
.codex-detail-head strong { min-width: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.codex-detail-head .command-icon-button { font-size: 26px; }
.codex-detail-body { flex: 1; min-height: 0; max-width: 760px; width: 100%; margin: 0 auto; padding: 12px 18px calc(env(safe-area-inset-bottom, 0px) + 28px); overflow-y: auto; overscroll-behavior: contain; }
.codex-detail-image { display: block; width: 100%; max-height: 62vh; margin-bottom: 10px; border-radius: 12px; background: #ffffff08; object-fit: contain; }
.codex-detail-image.broken { display: none; }
.codex-detail-path { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.codex-apply-all { width: 100%; min-height: 42px; margin-top: 14px; border: 0; border-radius: 21px; background: var(--accent); color: var(--on-accent); font-size: 13.5px; font-weight: 700; }
/* 画风 header link to Storm; the bottom-nav Storm tab is dropped in the new layout. */
.tag-section-link { min-height: 28px; margin-left: auto; padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 12px; }
.tag-section-link + .tag-section-add-toggle { margin-left: 0; }
body:not(.tag-layout-legacy) .tab[data-tab="storm"] { display: none; }
body.tag-layout-legacy .tab[data-tab="codex"] { display: none; }
.codex-kind { color: var(--accent); font-size: 10px; font-style: normal; opacity: .8; }

/* Bar deck polish — no frames inside the bar, tint for state. */
/* The global focus halo (3px ring) is clipped by scrolling rows and fights
   underline fields; the new layout signals focus with color only. */
body:not(.tag-layout-legacy) :is(input, textarea, select):focus { box-shadow: none; }
/* Selects: own chevron, width fitted to the text by script. */
.gen-slot-select { position: relative; }
.gen-slot-select::after { position: absolute; top: 50%; right: 10px; width: 5px; height: 5px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); content: ""; pointer-events: none; transform: translateY(-70%) rotate(45deg); }
/* Rescale stepper inside the deck. */
.gen-rescale { flex: none; border-radius: 15px; background: #ffffff0f; }
.gen-rescale .gen-value { min-height: 30px; font-size: 12.5px; }
/* Seed: the mode alone — no number on the bar (it is in the tooltip and sheet). */
.gen-seed small { display: none; }
/* One selection language in the new layout: tinted fill + accent text, never
   a frame (frames collided with sheet edges and the bar border). */
body:not(.tag-layout-legacy) .tag-chip.selected { border-color: transparent; outline: 0; touch-action: pan-y; }
body:not(.tag-layout-legacy) .tag-chip.selected .chip-line strong { color: var(--accent-2); }
.size-tiles button { border: 0; }
.size-tiles button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.size-tiles button[aria-pressed="true"] b { color: var(--accent-2); }
.workflow-mode-chips button[aria-pressed="true"] { border-color: transparent; }
.gen-deck :is(select, input, button):focus-visible { outline: 0; }

/* Texture without boxes — each Tag section carries a hue as an open
   bar on its left edge, a tinted title and a faint wash on its chips. */
.tag-section[data-group="scene"] { --hue: #8fbf9f; }
.tag-section[data-group="camera"] { --hue: #86aee0; }
.tag-section[data-group="style"] { --hue: #d6b38a; }
.tag-section[data-group="misc"] { --hue: #b0a4d6; }
body:not(.tag-layout-legacy) .tag-group.tag-section { position: relative; padding-left: 14px; border-bottom-color: transparent; }
body:not(.tag-layout-legacy) .tag-group.tag-section::before { position: absolute; top: 12px; bottom: 14px; left: 2px; width: 3px; border-radius: 2px; background: linear-gradient(180deg, var(--hue, var(--accent)), color-mix(in srgb, var(--hue, var(--accent)) 10%, transparent)); content: ""; }
body:not(.tag-layout-legacy) .tag-section.is-empty::before { bottom: 12px; opacity: .45; }
body:not(.tag-layout-legacy) .tag-section-head strong { color: var(--hue, var(--accent)); }
body:not(.tag-layout-legacy) .tag-section .tag-chip.selected .chip-line strong { color: #fff; }
body:not(.tag-layout-legacy) .tag-section .tag-add input:focus { border-bottom-color: var(--hue, var(--accent)); }
body:not(.tag-layout-legacy) .tag-section .tag-section-add-toggle { color: var(--hue, var(--accent)); }
/* Add row: ＋ is a tinted disc; 整块 / 语义 are small capsules with a glyph. */
body:not(.tag-layout-legacy) .tag-add .tag-add-button { width: 30px; min-width: 30px; min-height: 30px; height: 30px; border: 0; background: color-mix(in srgb, var(--hue, var(--accent)) 22%, transparent); color: var(--hue, var(--accent)); font-size: 17px; box-shadow: none; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions { gap: 4px; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .whole-add-button,
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .semantic-open-button { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; height: 28px; padding: 0 10px 0 8px; border: 0; border-radius: 14px; background: #ffffff0b; color: var(--text-secondary); font-size: 11.5px; box-shadow: none; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .whole-add-button::before { color: var(--muted); font-size: 11px; content: "▤"; }
body:not(.tag-layout-legacy) .tag-add .tag-extra-actions > .semantic-open-button::before { color: var(--hue, var(--accent)); font-size: 11px; content: "✦"; }
/* Artist jump: a palette badge in front of the name. */
.tag-chip .chip-artist-jump { display: grid; place-items: center; align-self: center; width: 22px; min-width: 22px; height: 22px; margin: 0 -2px 0 8px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-2); box-shadow: none; }
.tag-chip .chip-artist-jump svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tag-chip .chip-artist-jump svg circle { fill: currentColor; stroke: none; }
.tag-chip .chip-artist-jump.detected { background: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); opacity: 1; }
.tag-chip .chip-artist-jump:active { background: color-mix(in srgb, var(--accent) 40%, transparent); }
/* Search: one underline, no box inside the bar and no halo. */
body:not(.tag-layout-legacy) .prompt-search-box { min-height: 38px; padding-left: 4px; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) .prompt-search-box:focus-within { border-bottom-color: var(--accent); box-shadow: none; }
body:not(.tag-layout-legacy) .prompt-search-box input { border: 0; background: none; box-shadow: none; outline: 0; }
/* Parameter sheet: flush with the screen bottom, above the tab bar. The
   sticky-sidebar rule's top:126px used to win and leave the sheet floating
   60px up with its content cut off. */
body:not(.tag-layout-legacy).params-sheet-open .settings-column > .sticky-settings { top: auto; z-index: 125; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
body:not(.tag-layout-legacy).params-sheet-open .params-sheet-backdrop { z-index: 124; }
/* Characters share the open-bar language with their own hue. */
body:not(.tag-layout-legacy) .character-card { --hue: #e2a6bb; border-left: 3px solid color-mix(in srgb, var(--hue) 70%, transparent); }
/* The palette badge is a fixed 22px disc (chip buttons default to tall). */
.tag-chip .chip-artist-jump { min-height: 0; max-height: 22px; flex: none; }
/* Sheet title stays put while the form scrolls under it. */
body:not(.tag-layout-legacy).params-sheet-open .sticky-settings > .panel-title-row { position: sticky; z-index: 3; top: -14px; margin: -14px -16px 6px; padding: 14px 16px 10px; background: #191a17; border-bottom: 1px solid #ffffff0a; }

/* Bar deck = four equal cells (caption over value), no scrolling. */
.gen-deck { display: grid; gap: 5px; overflow: visible; padding: 0 0 6px; mask-image: none; }
.gen-cell { position: relative; display: block; min-width: 0; height: 40px; border-radius: 11px; background: #ffffff0d; box-shadow: inset 0 1px 0 #ffffff0d; }
.gen-cell > small { position: absolute; z-index: 1; top: 5px; left: 10px; color: var(--muted); font-size: 9.5px; letter-spacing: .04em; line-height: 1; pointer-events: none; }
.gen-cell.gen-slot-select::after { position: absolute; top: auto; right: 9px; bottom: 11px; width: 4px; height: 4px; border-right: 1.4px solid var(--muted); border-bottom: 1.4px solid var(--muted); content: ""; pointer-events: none; transform: rotate(45deg); }
.gen-cell select { position: absolute; inset: 0; width: 100% !important; max-width: none; height: 40px; min-height: 0; margin: 0; padding: 14px 18px 0 10px; border: 0; border-radius: inherit; background: none; color: var(--text); font-size: 12.5px; font-weight: 600; text-align: left; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; }
.gen-cell select:focus { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.gen-rescale { display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px; height: 40px; }
.gen-rescale > button[data-gen-step] { width: 22px; padding: 0; font-size: 14px; }
.gen-rescale > b { color: var(--text); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }

/* The four generation options sit in one row above 最新结果. */
.option-strip { display: none; }
body:not(.tag-layout-legacy) .option-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 4px 0 10px; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice { display: block; min-width: 0; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice > label { min-height: 36px; }
body:not(.tag-layout-legacy) .option-strip .parameter-help-button { display: none; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice label span { justify-content: center; gap: 6px; min-height: 36px; padding: 0 6px; border: 0; border-radius: 18px; box-shadow: inset 0 1px 0 #ffffff0d; color: var(--muted); font-size: 12px; white-space: nowrap; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice label span::before { flex: none; width: 6px; height: 6px; border: 1.3px solid currentColor; border-radius: 50%; content: ""; opacity: .7; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice input:checked + span::before { border-color: var(--accent); background: var(--accent); opacity: 1; }
body:not(.tag-layout-legacy) .option-strip .alpha-choice label span { background-size: 8px 8px; background-position: 0 0, 0 4px, 4px -4px, -4px 0; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice input:focus-visible + span { outline: 0; box-shadow: inset 0 0 0 1.5px var(--accent); }

/* Chip material: a hue gradient with a top highlight and a soft drop, the
   Chinese line tinted toward the hue, and a weight bar along the bottom edge
   whose length shows how far the weight is from 1. */
body:not(.tag-layout-legacy) .tag-card.tag-chip { border-color: transparent; box-shadow: inset 0 1px 0 #ffffff14, 0 1px 2px #00000059; --chip-hue: var(--hue, #a39e93); }
body:not(.tag-layout-legacy) .uc-chip-list { --hue: #d98a8a; }
body:not(.tag-layout-legacy) .tag-chip:not(.selected),
body:not(.tag-layout-legacy) .tag-section .tag-chip:not(.selected),
body:not(.tag-layout-legacy) .character-card .tag-chip:not(.selected) { background: linear-gradient(180deg, color-mix(in srgb, var(--chip-hue) 15%, #262722), color-mix(in srgb, var(--chip-hue) 6%, #1d1e1a)); }
body:not(.tag-layout-legacy) .tag-chip.selected,
body:not(.tag-layout-legacy) .tag-section .tag-chip.selected,
body:not(.tag-layout-legacy) .character-card .tag-chip.selected { background: linear-gradient(180deg, color-mix(in srgb, var(--chip-hue) 40%, #262722), color-mix(in srgb, var(--chip-hue) 26%, #1d1e1a)); box-shadow: inset 0 1px 0 #ffffff26, 0 2px 10px color-mix(in srgb, var(--chip-hue) 22%, transparent); }
body:not(.tag-layout-legacy) .tag-chip .tag-translation { color: color-mix(in srgb, var(--chip-hue) 45%, var(--muted)); }
body:not(.tag-layout-legacy) .tag-chip:is(.weight-up, .weight-down, .negative-weight)::after { position: absolute; bottom: 3px; left: 10px; width: calc((100% - 20px) * var(--wspan, .3)); height: 2px; border-radius: 1px; background: #f0b073; content: ""; opacity: .9; pointer-events: none; }
body:not(.tag-layout-legacy) .tag-chip.disabled { opacity: .45; box-shadow: none; }

/* 翻新释义缓存 dialog. */
.renewal-dialog { width: min(440px, calc(100vw - 32px)); }
.renewal-body { display: grid; gap: 10px; }
.renewal-intro { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.renewal-meter { height: 6px; overflow: hidden; border-radius: 3px; background: #ffffff12; }
.renewal-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.renewal-text { margin: 0; color: var(--text); font-size: 13px; line-height: 1.5; }
.renewal-quota { margin: 0; color: var(--muted); font-size: 11.5px; }
.renewal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.gen-rescale { align-items: center; align-content: end; padding: 17px 2px 1px; }
.gen-rescale > button[data-gen-step], .gen-rescale > b { height: 20px; line-height: 20px; }
/* Section tabs scroll inside their column instead of running under the quick actions. */
body:not(.tag-layout-legacy) .editor-command-bar > .module-nav { min-width: 0; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); }
body:not(.tag-layout-legacy) .editor-command-bar > .module-nav::-webkit-scrollbar { display: none; }

/* UC / Rescale cells read like the select cells — caption top-left,
   value bottom-left, a compact −/＋ pair on the right. */
.gen-cell.gen-num { display: grid; align-items: end; align-content: end; }
.gen-num > input { display: none; }
.gen-num > b { height: 22px; overflow: hidden; color: var(--text); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 22px; text-align: left; white-space: nowrap; }
.gen-num > b.is-off { color: var(--muted); font-weight: 500; }
.gen-num > button[data-gen-step] { padding: 0; border: 0; border-radius: 7px; background: #ffffff0a; color: var(--muted); font-size: 13px; line-height: 1; }
.gen-num > button[data-gen-step] + button[data-gen-step] { margin-left: 0; }
.gen-num > button[data-gen-step]:active, .gen-num > button[data-gen-step].holding { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.gen-num { column-gap: 3px; }

/* 法典 fixes: no focus box on search, centered category text, clean text cards. */
.codex-tools input[type="search"]:focus-visible { outline: 0; }
.codex-cat { align-items: center; line-height: 1; }
.codex-card { position: relative; width: 100%; margin: 0 0 14px; break-inside: avoid; }
.codex-open { display: grid; gap: 6px; width: 100%; padding: 0; border: 0; background: none; color: var(--text); text-align: left; box-shadow: none; }
.codex-open b { padding: 0 2px; font-size: 13px; font-weight: 600; line-height: 1.35; }
.codex-card.text-only { padding: 0; border: 0; }
.codex-card.text-only .codex-open { padding: 10px 11px 12px; border-radius: 10px; background: linear-gradient(180deg, #ffffff0c, #ffffff05); box-shadow: inset 0 1px 0 #ffffff0d; }
.codex-card.text-only .codex-open small { display: -webkit-box; overflow: hidden; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; word-break: break-all; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.codex-card.text-only .codex-chars { position: static; justify-self: start; padding: 0; background: none; }
.codex-quick { position: absolute; z-index: 1; right: 6px; bottom: 30px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: #000000a8; color: var(--accent-2); font-size: 17px; box-shadow: 0 1px 6px #0007; backdrop-filter: blur(6px); }
.codex-card.text-only .codex-quick { bottom: auto; background: #ffffff12; box-shadow: none; }
.codex-quick.done { background: var(--accent); color: var(--on-accent); }

/* 法典 detail: prompts as selectable chips. */
.cx-block { padding: 12px 0 14px; border-bottom: 1px solid #ffffff0d; }
.cx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cx-label { color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .06em; }
.cx-count { margin-right: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cx-link { min-height: 28px; padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 12px; box-shadow: none; }
.cx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-tag { position: relative; display: grid; gap: 1px; max-width: 100%; min-height: 34px; padding: 5px 10px 6px; border: 0; border-radius: 9px; background: #ffffff08; color: var(--muted); text-align: left; box-shadow: inset 0 0 0 1px #ffffff12; transition: background-color .12s ease, color .12s ease; }
.cx-tag[aria-pressed="true"] { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, #262722), color-mix(in srgb, var(--accent) 12%, #1d1e1a)); color: var(--text); box-shadow: inset 0 1px 0 #ffffff1a; }
.cx-line { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.cx-tag b { font-size: 13px; font-weight: 600; line-height: 1.3; }
.cx-tag em { flex: none; padding: 0 4px; border-radius: 5px; font-size: 10.5px; font-style: normal; font-weight: 700; }
.cx-tag.weight-up em { background: #d08a4a24; color: #f0b073; }
.cx-tag.weight-down em { background: #5b7fb824; color: #95b5ea; }
.cx-tag.negative-weight em { background: #b85b5b24; color: #ff9a9a; }
.cx-tag small { color: inherit; font-size: 11px; line-height: 1.3; opacity: .75; }
.cx-tag.bundle b::after { margin-left: 5px; padding: 0 4px; border-radius: 5px; background: #ffffff12; color: var(--muted); font-size: 10px; font-weight: 500; content: "整块"; }
.cx-tag.present { opacity: .55; }
.cx-present { top: -6px; right: -4px; border-radius: 7px; }
.cx-apply { width: 100%; min-height: 38px; margin-top: 10px; border: 0; border-radius: 19px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-2); font-size: 13px; font-weight: 700; box-shadow: none; }
.cx-apply:disabled { opacity: .4; }
.codex-detail .codex-apply-all { margin-top: 16px; }
/* Desktop: image left (sticky), prompts right. */
@media (min-width: 900px) {
  .codex-detail-head, .codex-detail-body { max-width: 1180px; }
  .codex-detail-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; gap: 28px; }
  .cx-media { position: sticky; top: 0; }
  .codex-detail-image { max-height: calc(100vh - 120px); }
}
.cx-present { position: static; flex: none; padding: 0; background: none; color: #9fd0a6; font-size: 10.5px; font-style: normal; }
.codex-card.text-only .codex-quick { top: 7px; right: 7px; width: 28px; height: 28px; font-size: 16px; }
.gen-deck { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .82fr) minmax(0, 1.18fr); }
.gen-cell.gen-num { grid-template-columns: minmax(0, 1fr) 20px 20px; column-gap: 2px; padding: 0 3px 3px 9px; }
.gen-num > button[data-gen-step] { width: 20px; min-width: 0; height: 22px; min-height: 0; }
.codex-card.text-only .codex-open { padding-right: 42px; }
.codex-card.text-only .codex-open > b { padding-right: 0; }

/* Header without section jump tabs. Row 1: 正面/负面 · 文本 on the
   left, ↶ ↷ ⌕ ⋯ on the right. Row 2: a thin token meter and 旧版. */
body:not(.tag-layout-legacy) .editor-command-bar > .module-nav { display: none; }
body:not(.tag-layout-legacy) .editor-command-bar { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
body:not(.tag-layout-legacy) .editor-command-bar > .prompt-meter-row { grid-column: 1; grid-row: 1; min-width: 0; }
body:not(.tag-layout-legacy) .editor-command-bar > .command-quick { grid-column: 2; grid-row: 1; gap: 2px; }
body:not(.tag-layout-legacy) .editor-command-bar > .prompt-meter-line { grid-column: 1 / -1; grid-row: 2; }
.prompt-meter-line { display: none; }
body:not(.tag-layout-legacy) .prompt-meter-line { display: flex; align-items: center; gap: 10px; padding: 0 4px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prompt-meter-line .prompt-meter-bar { flex: 1; min-width: 40px; }
.prompt-meter-line .layout-switch-button { min-height: 24px; padding: 0 2px; font-size: 12px; }
.command-quick .command-icon-button[data-history] { font-size: 17px; }
.command-quick .command-icon-button[data-history]:disabled { opacity: .3; }

/* Toasts sit at the top in the new layout; the offset under the header is set further down. */
body:not(.tag-layout-legacy) .toast-host { bottom: auto; }

/* 快删 mode: every chip shows a ×; one tap deletes. */
.quick-delete-button { min-height: 24px; padding: 0 8px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 12px; box-shadow: none; }
body.quick-delete .quick-delete-button { background: color-mix(in srgb, var(--danger) 20%, transparent); color: #ffb0bc; font-weight: 700; }
body.quick-delete:not(.tag-layout-legacy) .tag-chip { cursor: pointer; }
body.quick-delete:not(.tag-layout-legacy) .tag-chip::before { position: absolute; z-index: 2; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--danger); color: #2a0d12; content: "×"; font-size: 13px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 1px 4px #0009; pointer-events: none; }
body.quick-delete:not(.tag-layout-legacy) .tag-chip:active { transform: scale(.96); }
body.quick-delete .chip-artist-jump, body.quick-delete .chip-quick, body.quick-delete .drag-handle { pointer-events: none; }
body.quick-delete #tagSelectionDock { display: none !important; }
.renewal-actions [hidden] { display: none !important; }

/* The Tag controls open inline under the selected chip's row — no
   bar at the bottom of the screen. Tinted with the section's hue. */
#tagSelectionDock.tag-dock { position: static; z-index: auto; flex: 0 0 100%; width: auto; max-width: none; margin: 2px 0 6px; padding: 4px 6px; border: 0; border-radius: 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--hue, var(--accent)) 13%, #20211d), color-mix(in srgb, var(--hue, var(--accent)) 7%, #1b1c18)); box-shadow: inset 0 1px 0 #ffffff12; backdrop-filter: none; }
#tagSelectionDock.tag-dock.hidden { display: none; }
body.tag-selection-active .editor-column { padding-bottom: 0; }
@media (max-width: 720px) {
  body.tag-selection-active .editor-column { padding-bottom: 0; }
}
#tagSelectionDock .tag-dock-bar { min-height: 38px; gap: 0; }
#tagSelectionDock .tag-dock-stepper { padding: 0 2px; border-radius: 10px; background: #00000024; }
#tagSelectionDock .tag-dock-stepper button[data-dock="minus"], #tagSelectionDock .tag-dock-stepper button[data-dock="plus"] { width: 34px; height: 34px; min-height: 0; color: var(--hue, var(--accent)); }
#tagSelectionDock .tag-dock-weight { min-width: 52px; height: 34px; min-height: 0; padding: 0 2px; border: 0; background: none; color: var(--text); font-size: 14px; }
#tagSelectionDock .tag-dock-weight:disabled { color: var(--muted); opacity: 1; }
#tagSelectionDock .tag-dock-icon-button { width: 34px; height: 34px; min-height: 0; }
.tag-dock-toggle { display: inline-flex; align-items: center; gap: 4px; height: 30px; min-height: 0; margin: 0 4px; padding: 0 10px 0 8px; border: 0; border-radius: 15px; background: #ffffff0d; color: var(--text); font-size: 12.5px; box-shadow: none; flex: none; white-space: nowrap; }
.tag-dock-toggle svg { width: 16px; height: 16px; }
.tag-dock-toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--hue, var(--accent)) 26%, transparent); color: var(--accent-2); }
.tag-dock-toggle:disabled { opacity: .35; }
#tagSelectionDock .tag-dock-toolbar { padding-top: 2px; }
#tagSelectionDock .tag-dock-tool { min-height: 44px; }
#tagSelectionDock .tag-dock-bar { min-width: 0; }
@media (max-width: 390px) {
  #tagSelectionDock.tag-dock { padding: 4px 3px; }
  #tagSelectionDock .tag-dock-stepper button[data-dock="minus"], #tagSelectionDock .tag-dock-stepper button[data-dock="plus"] { width: 28px; }
  #tagSelectionDock .tag-dock-weight { min-width: 44px; font-size: 13.5px; }
  #tagSelectionDock .tag-dock-icon-button { width: 30px; }
  .tag-dock-toggle { margin: 0 2px; padding: 0 8px 0 6px; }
}

/* Compact characters. Header reads like a Tag section; each tile is
   a name row (tap to open) plus a one-line preview; an open tile shows its
   chips instead of the preview. */
body:not(.tag-layout-legacy) .character-panel { --hue: #e2a6bb; }
body:not(.tag-layout-legacy) .character-panel > .panel-title-row { min-height: 30px; margin: 0 0 2px; padding: 0 2px; gap: 8px; }
body:not(.tag-layout-legacy) .character-panel > .panel-title-row h2 { margin: 0; color: var(--hue); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; }
body:not(.tag-layout-legacy) #characterCountBadge { min-width: 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
body:not(.tag-layout-legacy) .character-panel-actions > .character-position-toggle { display: none !important; }
body:not(.tag-layout-legacy) .character-panel #addCharacterButton { min-height: 28px; color: var(--hue); }
/* minmax(0, 1fr): an auto track never shrinks below its content, so one long
   nowrap title (a character's first Tag) used to widen the whole page. */
body:not(.tag-layout-legacy) .character-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
body:not(.tag-layout-legacy) .character-list.empty-state { padding: 2px 4px 4px; color: var(--muted); font-size: 12.5px; }
body:not(.tag-layout-legacy) .character-card { grid-template-columns: minmax(0, 1fr); min-width: 0; margin: 0; padding: 2px 0 4px 8px; }
body:not(.tag-layout-legacy) .character-card .character-tile { gap: 0; }
body:not(.tag-layout-legacy) .character-card .character-tile-row { min-height: 34px; }
body:not(.tag-layout-legacy) .character-card .character-power { width: 28px; min-width: 28px; height: 28px; min-height: 0; }
body:not(.tag-layout-legacy) .character-card .character-tile-name { display: flex; flex: 1; align-items: baseline; gap: 6px; min-width: 0; min-height: 30px; padding: 0 4px; border: 0; background: none; color: color-mix(in srgb, var(--hue) 60%, var(--text)); font-size: 14px; text-align: left; box-shadow: none; justify-content: flex-start; }
.character-tile-name b { min-width: 0; overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.character-tile-name em { flex: none; color: var(--muted); font-size: 11px; font-style: normal; }
.character-tile-name i { flex: none; color: var(--muted); font-size: 10px; font-style: normal; transition: transform .15s ease; }
.character-card.tile-open .character-tile-name i { transform: rotate(180deg); }
body:not(.tag-layout-legacy) .character-card .character-position-chip { min-height: 28px; font-size: 12px; }
body:not(.tag-layout-legacy) .character-card .character-tile-icon { width: 30px; min-width: 30px; height: 30px; min-height: 0; }
body:not(.tag-layout-legacy) .character-card .character-tile-preview { min-height: 24px; padding: 0 2px 2px 34px; font-size: 13px; }
.character-tile-preview i { display: none; }
body:not(.tag-layout-legacy) .character-card.tile-open .character-tile-preview { display: none; }
body:not(.tag-layout-legacy) .character-panel > .panel-title-row > h2 { margin-right: 0; }
body:not(.tag-layout-legacy) .character-panel > .panel-title-row > #characterCountBadge { margin-right: auto; }
body:not(.tag-layout-legacy) .character-card .tag-list:not(:has(.tag-card)) { min-height: 0; padding: 0; }
body:not(.tag-layout-legacy) .character-card { row-gap: 2px; }
body:not(.tag-layout-legacy) .character-card .character-tag-body { padding-top: 4px; }
body:not(.tag-layout-legacy) .character-card .character-tag-list:not(:has(.tag-card)) { min-height: 0; padding: 0; }

/* Settings in the new layout — a sheet with a sticky title; flat
   sections marked by an open hue bar (no cards inside cards); underline
   fields, pill buttons, thin meters. Controls and IDs are unchanged. */
body:not(.tag-layout-legacy) #settingsDialog { --hue: var(--accent); width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid #ffffff14; border-radius: 18px; background: #191a17; box-shadow: 0 24px 64px #000c; }
@media (max-width: 720px) {
  body:not(.tag-layout-legacy) #settingsDialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
}
body:not(.tag-layout-legacy) #settingsDialog .dialog-header { position: sticky; z-index: 3; top: 0; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px 20px; border-bottom: 1px solid #ffffff0d; background: #191a17; }
body:not(.tag-layout-legacy) #settingsDialog .dialog-header strong { font-size: 16px; letter-spacing: .04em; }
body:not(.tag-layout-legacy) #settingsDialog #closeSettingsButton { width: 36px; height: 36px; min-height: 0; border: 0; border-radius: 50%; background: #ffffff0d; box-shadow: none; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-body { display: block; padding: 2px 18px calc(env(safe-area-inset-bottom, 0px) + 28px) 16px; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-section { position: relative; margin: 0; padding: 16px 0 16px 16px; border: 0; border-bottom: 1px solid #ffffff0b; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-section:last-child { border-bottom: 0; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-section::before { position: absolute; top: 18px; bottom: 18px; left: 2px; width: 3px; border-radius: 2px; background: linear-gradient(180deg, var(--hue), color-mix(in srgb, var(--hue) 8%, transparent)); content: ""; }
body:not(.tag-layout-legacy) #settingsDialog .usage-settings-section { --hue: #7fc4b8; }
body:not(.tag-layout-legacy) #settingsDialog .renewal-settings-section { --hue: #8fbf9f; }
body:not(.tag-layout-legacy) #settingsDialog .visitor-settings-section { --hue: #b0a4d6; }
body:not(.tag-layout-legacy) #settingsDialog .annotation-settings-section { --hue: #e2a6bb; }
body:not(.tag-layout-legacy) #settingsDialog .settings-section-heading { margin: 0 0 10px; }
body:not(.tag-layout-legacy) #settingsDialog .settings-section-heading .workspace-eyebrow { display: none; }
body:not(.tag-layout-legacy) #settingsDialog :is(.settings-section-heading h2, .artist-automation-settings h2, .artist-automation-settings h3) { margin: 0; color: var(--hue); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
/* Inner boxes become plain groups separated by hairlines. */
body:not(.tag-layout-legacy) #settingsDialog :is(.provider-settings, .provider-token-manager, details.account-usage-panel, .nai-account-usage, .visitor-access-panel, .visitor-access-body, .artist-automation-settings-block, .artist-automation-help) { margin: 0; padding-right: 0; padding-left: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) #settingsDialog .nai-account-usage + .nai-account-usage,
body:not(.tag-layout-legacy) #settingsDialog .artist-automation-settings-block + .artist-automation-settings-block { margin-top: 10px; padding-top: 12px; border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) #settingsDialog .provider-default-badge { padding: 1px 7px; border: 0; border-radius: 9px; background: color-mix(in srgb, var(--hue) 16%, transparent); color: var(--hue); font-size: 11px; }
/* Text, labels and hints. */
body:not(.tag-layout-legacy) #settingsDialog label { color: var(--muted); font-size: 12px; }
body:not(.tag-layout-legacy) #settingsDialog :is(.hint, p) { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
body:not(.tag-layout-legacy) #settingsDialog summary { display: flex; align-items: center; gap: 8px; min-height: 36px; color: var(--text-secondary); font-size: 13.5px; cursor: pointer; list-style: none; }
body:not(.tag-layout-legacy) #settingsDialog summary strong { font-size: 13.5px; font-weight: 600; }
body:not(.tag-layout-legacy) #settingsDialog summary small { margin-left: auto; color: var(--muted); font-size: 11.5px; }
/* Fields: underline, readable size. */
body:not(.tag-layout-legacy) #settingsDialog :is(input:not([type]), input[type="text"], input[type="password"], input[type="number"], input[type="url"], select) { min-height: 36px; height: 36px; padding: 0 2px; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background-color: transparent; box-shadow: none; color: var(--text); font-size: 14px; }
body:not(.tag-layout-legacy) #settingsDialog textarea { padding: 8px 10px; border: 1px solid #ffffff12; border-radius: 10px; background: #ffffff05; box-shadow: none; color: var(--text); font-size: 13px; line-height: 1.6; }
body:not(.tag-layout-legacy) #settingsDialog :is(input, select, textarea):focus { border-color: var(--hue); outline: 0; box-shadow: none; }
body:not(.tag-layout-legacy) #settingsDialog input[type="checkbox"] { accent-color: var(--hue); }
/* Buttons: pills. */
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-body button:is(.ghost, .compact-button) { min-height: 32px; height: auto; padding: 0 14px; border: 0; border-radius: 16px; background: #ffffff0d; color: var(--text); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-body button.ghost.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: #ffa3b0; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-body button.primary { min-height: 34px; padding: 0 18px; border: 0; border-radius: 17px; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; box-shadow: none; }
/* Usage meters: thin bars. */
body:not(.tag-layout-legacy) #settingsDialog progress.meter-track { height: 4px; border: 0; border-radius: 2px; background: #ffffff12; appearance: none; -webkit-appearance: none; }
body:not(.tag-layout-legacy) #settingsDialog progress.meter-track::-webkit-progress-bar { border-radius: 2px; background: #ffffff12; }
body:not(.tag-layout-legacy) #settingsDialog progress.meter-track::-webkit-progress-value { border-radius: 2px; background: var(--hue); }
body:not(.tag-layout-legacy) #settingsDialog progress.meter-track::-moz-progress-bar { border-radius: 2px; background: var(--hue); }
body:not(.tag-layout-legacy) #settingsDialog summary::-webkit-details-marker { display: none; }
body:not(.tag-layout-legacy) #settingsDialog summary::after { flex: none; margin-left: auto; color: var(--muted); content: "›"; font-size: 18px; line-height: 1; transition: transform .15s ease; }
body:not(.tag-layout-legacy) #settingsDialog summary:has(small)::after { margin-left: 8px; }
body:not(.tag-layout-legacy) #settingsDialog details[open] > summary::after { transform: rotate(90deg); }
body:not(.tag-layout-legacy) #settingsDialog .artist-automation-settings h3 { margin: 0 0 4px; color: var(--text-secondary); font-size: 12.5px; letter-spacing: .02em; }
body:not(.tag-layout-legacy) #settingsDialog .settings-dialog-section > p { margin: 0 0 10px; }

/* Entries whose titles are long unbroken strings (e.g. 站长的小仓库)
   must not widen their card: the grid track is pinned to the column width,
   titles wrap anywhere and clamp to two lines. */
.codex-card { min-width: 0; max-width: 100%; }
.codex-open { grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: 100%; }
.codex-thumb { max-width: 100%; }
.codex-open > b { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; word-break: break-word; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.codex-detail-head strong { overflow-wrap: anywhere; }
.cx-tag b, .codex-detail-path { overflow-wrap: anywhere; word-break: break-word; }

/* Weight bar on every chip. Length ∝ |weight| on a 0–2 scale, so ×1
   is half the chip, ×2 the full width, ×0 nothing; negatives grow in red.
   ×1 is a quiet neutral, emphasis warm, de-emphasis cool. */
body:not(.tag-layout-legacy) .tag-chip::after { position: absolute; bottom: 3px; left: 10px; width: calc((100% - 20px) * var(--wspan, .5)); height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--chip-hue, #a39e93) 50%, #77736b); content: ""; opacity: .5; pointer-events: none; }
body:not(.tag-layout-legacy) .tag-chip.weight-up::after { background: #f0b073; opacity: .95; }
body:not(.tag-layout-legacy) .tag-chip.weight-down::after { background: #95b5ea; opacity: .95; }
body:not(.tag-layout-legacy) .tag-chip.negative-weight::after { background: #ff7a8a; opacity: .95; }
body:not(.tag-layout-legacy) .tag-chip.disabled::after { display: none; }

/* Seed: a seed — dashed with sparkles when random, solid with a lock when fixed. */
.gen-seed > i { display: none; }
.gen-seed .seed-icon { width: 17px; height: 17px; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.gen-seed .seed-random path { fill: currentColor; stroke: none; }
.gen-seed[data-mode="random"] .seed-body { stroke-dasharray: 2.6 2.2; }
.gen-seed[data-mode="random"] .seed-fixed { display: none; }
.gen-seed:not([data-mode="random"]) .seed-random { display: none; }
.gen-seed:not([data-mode="random"]) .seed-body { fill: color-mix(in srgb, var(--accent) 35%, transparent); }
.gen-seed:not([data-mode="random"]) .seed-fixed rect { fill: #2a2418; }

/* Drag: the ghost keeps the chip's exact size; a delete zone appears on top. */
.tag-chip.tag-drag-ghost { width: var(--ghost-w) !important; height: var(--ghost-h) !important; max-width: none; overflow: hidden; }
.tag-drag-trash { position: fixed; z-index: 290; top: 0; right: 0; left: 0; display: flex; align-items: center; justify-content: center; gap: 8px; height: calc(env(safe-area-inset-top, 0px) + 64px); padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid #ff718555; background: linear-gradient(180deg, #3a1a20f2, #2a1418e0); color: #ffb0bc; font-size: 14px; font-weight: 600; pointer-events: none; animation: tag-trash-in .16s ease-out; }
.tag-drag-trash svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.tag-drag-trash.drag-nav-target { background: linear-gradient(180deg, #c23a52, #9c2c40); color: #fff; }
@keyframes tag-trash-in { from { transform: translateY(-100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tag-drag-trash { animation: none; }
}

/* Generate bar: tighter rows. */
body:not(.tag-layout-legacy) .floating-generate-bar { row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
body:not(.tag-layout-legacy) .gen-deck { gap: 4px; padding-bottom: 4px; }
body:not(.tag-layout-legacy) .gen-cell { height: 36px; }
body:not(.tag-layout-legacy) .gen-cell select { height: 36px; padding-top: 12px; }
body:not(.tag-layout-legacy) .gen-cell > small { top: 4px; }
body:not(.tag-layout-legacy) .gen-cell.gen-slot-select::after { bottom: 10px; }
body:not(.tag-layout-legacy) .gen-cell.gen-num { padding-bottom: 2px; }
body:not(.tag-layout-legacy) .gen-params { padding-bottom: 2px; }
body:not(.tag-layout-legacy) .gen-params .gen-stepper > button[data-gen-step],
body:not(.tag-layout-legacy) .gen-params .gen-value,
body:not(.tag-layout-legacy) .gen-size,
body:not(.tag-layout-legacy) .gen-more { height: 30px; min-height: 0; }
body:not(.tag-layout-legacy) .gen-seed { min-height: 28px; }
body:not(.tag-layout-legacy) .gen-count { height: 40px; }
body:not(.tag-layout-legacy) .gen-count button { height: 40px; min-height: 0; }
body:not(.tag-layout-legacy) .floating-generate-button { height: 40px; min-height: 0; }

/* Character row — a numbered disc (= on/off), a title that names the
   character, and one segmented action capsule. */
body:not(.tag-layout-legacy) .character-card .character-tile-row { gap: 8px; }
.character-disc { display: grid; flex: none; place-items: center; width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--hue, #e2a6bb) 75%, #2a2026); color: #2a1820; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 0 #ffffff40; }
.character-disc[aria-pressed="false"] { border: 1.5px dashed color-mix(in srgb, var(--hue, #e2a6bb) 60%, transparent); background: none; color: var(--hue, #e2a6bb); box-shadow: none; }
body:not(.tag-layout-legacy) .character-card.disabled { opacity: .62; }
body:not(.tag-layout-legacy) .character-card.disabled .character-tile-name b { text-decoration: line-through; }
.character-actions { display: inline-flex; flex: none; align-items: center; height: 30px; padding: 0 2px; border-radius: 15px; background: #ffffff0b; box-shadow: inset 0 1px 0 #ffffff0d; }
.character-actions > * + * { border-left: 1px solid #ffffff12 !important; }
body:not(.tag-layout-legacy) .character-actions .character-position-chip { height: 30px; min-height: 0; padding: 0 9px 0 10px; border: 0; border-radius: 0; background: none; color: var(--accent); font-size: 12px; }
body:not(.tag-layout-legacy) .character-actions .character-tile-icon { display: grid; place-items: center; width: 30px; min-width: 30px; height: 30px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); }
.character-actions .character-tile-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.character-actions .character-tile-icon.danger { color: #e8908f; }
.character-actions .character-tile-icon:disabled { opacity: .3; }
.character-actions .character-tile-icon:active, .character-actions .character-position-chip:active { background: #ffffff10; }
body:not(.tag-layout-legacy) .character-card .character-tile-preview { padding-left: 32px; }
body:not(.tag-layout-legacy) .character-card.tile-open .character-tag-area { padding-left: 32px; }

/* 清空 in section headers and over the negative list. */
.tag-section-clear { min-height: 26px; height: 26px; padding: 0 8px; border: 0; border-radius: 13px; background: none; color: var(--muted); font-size: 12px; box-shadow: none; }
.tag-section-clear:active { background: color-mix(in srgb, var(--danger) 14%, transparent); color: #ffa3b0; }
.tag-section-head .tag-section-clear { margin-left: auto; }
.tag-section-head .tag-section-clear + .tag-section-link { margin-left: 0; }
.uc-chip-head { display: none; }
body:not(.tag-layout-legacy) .uc-chip-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 6px; }
.uc-chip-head strong { color: #d98a8a; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; }
.uc-chip-head .tag-section-clear { margin-left: auto; }

/* Swipe-to-weight on a selected chip. */
.tag-chip.scrubbing { cursor: ew-resize; transform: scale(1.04); transition: transform .1s ease; }
.tag-chip.scrubbing .chip-weight { box-shadow: 0 0 0 1.5px currentColor; }

/* 最新结果 as a canvas — current output proportions, a faint dot
   texture and a hairline frame; the image sits on it. */
body:not(.tag-layout-legacy) #quickLatest { position: relative; display: grid; place-items: center; min-height: 0; max-height: none; margin: 6px auto 2px; padding: 0; overflow: hidden; border: 0; border-radius: 14px; background-color: #1b1c18; background-image: radial-gradient(ellipse at 50% 35%, #ffffff0c, transparent 70%), radial-gradient(#ffffff14 1px, transparent 1.3px); background-size: 100% 100%, 12px 12px; box-shadow: inset 0 0 0 1px #ffffff14, 0 12px 30px #00000080; cursor: pointer; }
body:not(.tag-layout-legacy) #quickLatest:has(.canvas-empty) { cursor: default; }
body:not(.tag-layout-legacy) #quickLatest:has(.canvas-empty)::before { position: absolute; inset: 10px; border: 1px dashed #ffffff17; border-radius: 9px; content: ""; pointer-events: none; }
.canvas-empty { display: grid; justify-items: center; color: var(--muted); text-align: center; }
.canvas-empty b { color: var(--text-secondary); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.canvas-empty b:empty { display: none; }
.canvas-empty small { font-size: 11.5px; }

/* Option strip: the shared on-state (each option adds its own effect below); the transparency checker
   shows only when 原生透明 is on. */
body:not(.tag-layout-legacy) .option-strip .parameter-choice label span,
body:not(.tag-layout-legacy) .option-strip .alpha-choice label span { background-color: #ffffff0b; background-image: none; }
body:not(.tag-layout-legacy) .option-strip .parameter-choice input:checked + span,
body:not(.tag-layout-legacy) .option-strip .quality-choice input:checked + span { background-color: color-mix(in srgb, var(--accent) 18%, transparent); background-image: none; color: var(--accent); }
body:not(.tag-layout-legacy) .option-strip .alpha-choice input:checked + span { background-color: color-mix(in srgb, var(--accent) 16%, #1d1e1b); background-image: linear-gradient(45deg, #ffffff14 25%, transparent 25%), linear-gradient(-45deg, #ffffff14 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ffffff14 75%), linear-gradient(-45deg, transparent 75%, #ffffff14 75%); background-position: 0 0, 0 4px, 4px -4px, -4px 0; background-size: 8px 8px; }
body:not(.tag-layout-legacy) #quickLatest { justify-content: center; align-content: center; }

/* Banners sit just under the current header. */
body:not(.tag-layout-legacy) .toast-host { top: var(--toast-top, calc(env(safe-area-inset-top, 0px) + 10px)); }

/* Option strip: each option has its own effect, shown only when it is on.
   Off, all four are the same quiet pill. */
body:not(.tag-layout-legacy) .option-strip .parameter-choice input:checked + span { position: relative; overflow: hidden; }
/* Quality Tags — a slow gold sheen and a ✦. */
body:not(.tag-layout-legacy) .option-strip .quality-choice input:checked + span {
  background-color: #2c2418;
  background-image: linear-gradient(110deg, transparent 32%, #ffe6b455 46%, transparent 60%), linear-gradient(180deg, color-mix(in srgb, var(--accent) 34%, #2a2418), color-mix(in srgb, var(--accent) 16%, #1f1c16));
  background-size: 260% 100%, 100% 100%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 0 12px color-mix(in srgb, var(--accent) 22%, transparent);
  color: #f6ddb0;
  animation: option-sheen 3.4s ease-in-out infinite;
}
body:not(.tag-layout-legacy) .option-strip .quality-choice input:checked + span::before { width: auto; height: auto; border: 0; background: none; color: #ffe2a8; content: "✦"; font-size: 12px; opacity: 1; }
@keyframes option-sheen { 0% { background-position: 160% 0, 0 0; } 55%, 100% { background-position: -70% 0, 0 0; } }
/* Brownian Noise — a fine grain and ≈. */
body:not(.tag-layout-legacy) .option-strip .parameter-choice:has(#preferBrownian) input:checked + span {
  background-color: #2a2520;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .92  0 0 0 0 .8  0 0 0 .32 0'/></filter><rect width='64' height='64' filter='url(%23g)'/></svg>"), linear-gradient(180deg, #4a3a2c, #2e261e);
  background-size: 64px 64px, 100% 100%;
  box-shadow: inset 0 0 0 1px #c9a27a66;
  color: #f0d2ae;
}
body:not(.tag-layout-legacy) .option-strip .parameter-choice:has(#preferBrownian) input:checked + span::before { width: auto; height: auto; border: 0; background: none; color: #f0c48e; content: "≈"; font-size: 14px; font-weight: 700; opacity: 1; }
/* Variety+ — a soft multicolour wash and a three-colour dot. */
body:not(.tag-layout-legacy) .option-strip .parameter-choice:has(#varietyBoost) input:checked + span {
  background-color: #221f26;
  background-image: linear-gradient(100deg, #e98aa63d, #e8c27a36 34%, #7fc4b836 66%, #9aa6ef3d);
  box-shadow: inset 0 0 0 1px #ffffff26;
  color: #f3e8f4;
}
body:not(.tag-layout-legacy) .option-strip .parameter-choice:has(#varietyBoost) input:checked + span::before { width: 9px; height: 9px; border: 0; background: conic-gradient(#e98aa6, #e8c27a, #7fc4b8, #9aa6ef, #e98aa6); opacity: 1; }
/* 原生透明 — the checkerboard (already only when on) and a hollow square. */
body:not(.tag-layout-legacy) .option-strip .alpha-choice input:checked + span { box-shadow: inset 0 0 0 1px #ffffff26; color: #eef0f2; }
body:not(.tag-layout-legacy) .option-strip .alpha-choice input:checked + span::before { border: 1.4px solid currentColor; border-radius: 2px; background: none; }
@media (prefers-reduced-motion: reduce) {
  body:not(.tag-layout-legacy) .option-strip .quality-choice input:checked + span { animation: none; }
}

/* 法典 quick ＋: a true circle, and a two-choice menu (追加 / 替换). */
.codex-quick { min-width: 0; min-height: 0; aspect-ratio: 1; line-height: 1; }
.codex-quick-menu { position: absolute; z-index: 2; right: 6px; bottom: 66px; display: none; gap: 4px; padding: 4px; border-radius: 16px; background: #000000c4; box-shadow: 0 6px 20px #000a; backdrop-filter: blur(8px); }
.codex-card.text-only .codex-quick-menu { top: 40px; bottom: auto; }
.codex-card.quick-open .codex-quick-menu { display: flex; }
.codex-quick-menu button { min-width: 0; min-height: 0; height: 28px; padding: 0 12px; border: 0; border-radius: 14px; background: #ffffff14; color: var(--text); font-size: 12.5px; font-weight: 600; box-shadow: none; }
.codex-quick-menu button[data-codex-quick-replace] { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--accent-2); }
.codex-card.quick-open .codex-quick { background: var(--accent); color: var(--on-accent); }
/* Detail: 追加 and 替换现有 side by side. */
.cx-actions { display: flex; gap: 8px; margin-top: 10px; }
.cx-actions .cx-apply { flex: 1; margin-top: 0; }
.cx-replace { flex: none; min-height: 38px; padding: 0 14px; border: 0; border-radius: 19px; background: #ffffff0d; color: var(--text-secondary); font-size: 12.5px; box-shadow: none; }
.cx-replace:disabled { opacity: .4; }

/* 法典 detail — parameters row, negative block, 一键复现. */
.cx-params .cx-head .cx-count { margin-right: auto; }
.cx-params-apply { color: var(--accent); font-weight: 600; }
.cx-param-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-param { display: grid; gap: 1px; min-width: 64px; padding: 5px 10px 6px; border-radius: 9px; background: #ffffff08; box-shadow: inset 0 0 0 1px #ffffff10; }
.cx-param small { color: var(--muted); font-size: 10.5px; }
.cx-param b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cx-block[data-cx-block="neg"] .cx-label { color: #d98a8a; }
.cx-reproduce { width: 100%; min-height: 44px; margin-top: 14px; border: 0; border-radius: 22px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 34%, #2a2418), color-mix(in srgb, var(--accent) 20%, #1f1c16)); color: var(--accent-2); font-size: 13.5px; font-weight: 700; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.cx-reproduce.confirm { background: color-mix(in srgb, var(--danger) 24%, #2a1418); color: #ffc2cb; box-shadow: inset 0 0 0 1px #ff718566; }
.codex-detail .codex-apply-all { background: #ffffff0d; color: var(--text); }

/* 最新结果: full width. With an image the canvas follows the image; empty it
   is a low strip with a small outline in the output proportions. */
body:not(.tag-layout-legacy) #quickLatest { width: 100%; aspect-ratio: auto; }
body:not(.tag-layout-legacy) #quickLatest:has(img) { display: block; }
body:not(.tag-layout-legacy) #quickLatest img { display: block; width: 100%; height: auto; max-height: 75vh; object-fit: contain; }
body:not(.tag-layout-legacy) #quickLatest:has(.canvas-empty) { height: 132px; }
body:not(.tag-layout-legacy) #quickLatest:has(.canvas-empty)::before { display: none; }
.canvas-empty { grid-auto-flow: column; align-items: center; gap: 14px; }
.canvas-empty::before { grid-row: span 2; height: 64px; aspect-ratio: var(--cw, 2) / var(--ch, 3); max-width: 120px; border: 1.5px dashed #ffffff2e; border-radius: 6px; background: #ffffff05; content: ""; }
.canvas-empty b, .canvas-empty small { justify-self: start; }
.canvas-empty { grid-template-rows: auto auto; row-gap: 2px; align-content: center; }

/* 法典 — a character already in the editor, and the 一键复现 hint. */
.cx-block.added .cx-apply:disabled { opacity: 1; background: transparent; color: var(--success, #8fd1a5); box-shadow: inset 0 0 0 1px #8fd1a540; }
.cx-reproduce-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; text-align: center; }

/* 新版本已就绪: stays until tapped (toasts themselves ignore taps). */
.toast.update-banner { display: block; width: 100%; border-color: var(--line-accent); color: var(--accent); font: inherit; font-weight: 600; text-align: left; cursor: pointer; pointer-events: auto; }

/* ---------------------------------------------------------------------------
   语义工作台 (new layout): a sheet in the hue of the target section. The query
   is an underline field; mode and NSFW are text chips over the real controls
   (kept for state). Results are flat rows: a tap selects (the selection feeds
   加入 and the recommendations), ＋ adds at once. A bar under a selection
   holds the actions. Legacy keeps the original cards.
   --------------------------------------------------------------------------- */
.semantic-nsfw-short { display: none; }
body:not(.tag-layout-legacy) #semanticDialog { --hue: var(--accent); width: min(720px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px); border: 1px solid #ffffff14; border-radius: 18px; background: #191a17; box-shadow: 0 30px 80px #000c; }
body:not(.tag-layout-legacy) #semanticDialog[open] { display: flex; flex-direction: column; }
body:not(.tag-layout-legacy) #semanticDialog[data-target-group="scene"] { --hue: #8fbf9f; }
body:not(.tag-layout-legacy) #semanticDialog[data-target-group="camera"] { --hue: #86aee0; }
body:not(.tag-layout-legacy) #semanticDialog[data-target-group="style"] { --hue: #d6b38a; }
body:not(.tag-layout-legacy) #semanticDialog[data-target-group="misc"] { --hue: #b0a4d6; }
body:not(.tag-layout-legacy) #semanticDialog[data-target-group="character"] { --hue: #e2a6bb; }
@media (max-width: 720px) {
  body:not(.tag-layout-legacy) #semanticDialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
}
body:not(.tag-layout-legacy) #semanticDialog .dialog-header { flex: none; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 10px 18px; border-bottom: 1px solid #ffffff0d; background: #191a17; }
body:not(.tag-layout-legacy) #semanticDialog .dialog-header > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
body:not(.tag-layout-legacy) #semanticDialog .dialog-header strong { font-size: 16px; letter-spacing: .04em; }
body:not(.tag-layout-legacy) #semanticTargetLabel { padding: 2px 9px; border-radius: 10px; background: color-mix(in srgb, var(--hue) 15%, transparent); color: var(--hue); font-size: 11.5px; font-weight: 600; }
body:not(.tag-layout-legacy) #closeSemanticDialog { width: 36px; height: 36px; min-height: 0; border: 0; border-radius: 50%; background: #ffffff0d; box-shadow: none; }
/* Block flow: in the original grid a scroll container (the result lists) may
   shrink to nothing, which clipped the lists to an inner scroll box. */
body:not(.tag-layout-legacy) #semanticDialog .semantic-body { display: block; flex: 1; min-height: 0; max-height: none; padding: 4px 16px 0; }

/* Search: underline query, chips, one accent button. */
body:not(.tag-layout-legacy) #semanticDialog .semantic-search-workbench { gap: 10px; padding: 8px 0 12px; border-bottom: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-search-workbench > label { gap: 0; font-size: 0; }
body:not(.tag-layout-legacy) #semanticQuery { field-sizing: content; min-height: 46px; max-height: 132px; padding: 10px 2px; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; color: var(--text); font-size: 16px; line-height: 1.5; resize: none; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticQuery:focus { border-bottom-color: var(--hue); outline: none; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-primary-options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-primary-options > label:not(.check-label) { display: none; }
body:not(.tag-layout-legacy) #semanticDialog :is(.semantic-mode-chips, .semantic-seed-chips) { display: flex; flex-wrap: wrap; gap: 4px; }
body:not(.tag-layout-legacy) #semanticDialog :is(.semantic-mode-chips, .semantic-seed-chips) button,
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw { min-width: 0; min-height: 30px; height: 30px; padding: 0 11px; border: 0; border-radius: 15px; background: #ffffff0b; color: var(--muted); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticDialog :is(.semantic-mode-chips, .semantic-seed-chips) button[aria-pressed="true"] { background: color-mix(in srgb, var(--hue) 20%, transparent); color: var(--hue); font-weight: 650; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw { display: inline-flex; align-items: center; gap: 0; cursor: pointer; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw:has(input:checked) { background: #e0607018; color: #ff9aa8; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw:has(input:focus-visible) { box-shadow: inset 0 0 0 1.5px var(--hue); }
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw-long { display: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-nsfw-short { display: inline; }
body:not(.tag-layout-legacy) #semanticSearchButton { min-height: 34px; height: 34px; margin-left: auto; padding: 0 20px; border: 0; border-radius: 17px; background: var(--hue); color: #1b1408; font-weight: 700; box-shadow: 0 4px 14px color-mix(in srgb, var(--hue) 22%, transparent); }
body:not(.tag-layout-legacy) #semanticSearchButton:disabled { opacity: .5; }

/* 高级选项: a quiet fold; fields are underlines, groups are hairlines. */
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced { border: 0; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced > summary { min-height: 30px; padding: 2px 0; gap: 8px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced > summary::before { color: var(--muted); font-size: 11px; content: "▸"; transition: transform .15s ease; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced[open] > summary::before { transform: rotate(90deg); }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced > summary span { margin-right: 0; color: var(--muted); font-size: 12.5px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced > summary small { margin-left: auto; font-size: 11px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced-body { gap: 12px; padding: 8px 0 4px; border-top: 0; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-number-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced-body :is(input[type="number"], select) { min-height: 34px; padding: 4px 2px; border: 0; border-bottom: 1px solid #ffffff1a; border-radius: 0; background: none; font-size: 14px; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-advanced-body :is(input[type="number"], select):focus { border-bottom-color: var(--hue); outline: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-filter-grid { grid-template-columns: 1fr; gap: 10px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-filter-grid fieldset { padding: 10px 0 0; border: 0; border-top: 1px solid #ffffff0b; border-radius: 0; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-filter-grid legend { padding: 0; }

/* Results: flat rows. */
body:not(.tag-layout-legacy) #semanticDialog .semantic-status { padding: 10px 0 2px; color: var(--muted); font-size: 12px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-result-toolbar { display: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-results { display: grid; gap: 0; min-height: 0; max-height: none; overflow: visible; padding: 0; border: 0; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-results.empty-state { padding: 18px 2px; color: var(--muted); font-size: 13px; text-align: left; }
.semantic-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: start; gap: 2px 10px; padding: 11px 6px 11px 4px; border-bottom: 1px solid #ffffff0a; cursor: pointer; transition: background-color .12s ease; -webkit-tap-highlight-color: transparent; }
.semantic-row:focus-visible { outline: 2px solid var(--hue, var(--accent)); outline-offset: -2px; }
.semantic-row-check { width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid #ffffff2e; border-radius: 50%; }
.semantic-row.selected { border-bottom-color: transparent; border-radius: 10px; background: color-mix(in srgb, var(--hue, var(--accent)) 12%, transparent); }
.semantic-row.selected .semantic-row-check { display: grid; place-items: center; border-color: var(--hue, var(--accent)); background: var(--hue, var(--accent)); }
.semantic-row.selected .semantic-row-check::after { color: #1b1408; font-size: 11px; font-weight: 800; line-height: 1; content: "✓"; }
.semantic-row-text { display: grid; gap: 2px; min-width: 0; }
.semantic-row-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; min-width: 0; }
.semantic-row-title strong { color: var(--text); font-size: 14.5px; font-weight: 650; overflow-wrap: anywhere; }
.semantic-row-title a { display: inline-flex; align-items: baseline; gap: 3px; color: inherit; text-decoration: none; }
.semantic-row-title a span { color: var(--muted); font-size: 11px; }
.semantic-row-kind { padding: 0 6px; border-radius: 6px; background: #ffffff0f; color: var(--muted); font-size: 10.5px; font-style: normal; }
.semantic-row-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
.semantic-row-cn { color: color-mix(in srgb, var(--hue, var(--accent)) 75%, var(--text)); font-size: 13px; }
.semantic-row-wiki { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.semantic-row-meta { color: var(--muted); font-size: 11px; opacity: .8; overflow-wrap: anywhere; }
.semantic-row-add { align-self: center; width: 32px; min-width: 0; height: 32px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--hue, var(--accent)) 20%, transparent); color: var(--hue, var(--accent)); font-size: 18px; line-height: 1; box-shadow: none; }
.semantic-row-add:active { transform: scale(.92); }
.semantic-row-add:disabled { width: auto; padding: 0 9px; border-radius: 12px; background: #ffffff0b; color: var(--muted); font-size: 11px; opacity: 1; }
.semantic-row.exists .semantic-row-title strong { color: var(--muted); }

/* 关联探索: basis chips, two action pills, rows below. */
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-panel { display: grid; gap: 10px; margin-top: 18px; padding: 14px 0 0; border: 0; border-top: 1px solid #ffffff0b; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-heading > strong { color: var(--hue); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-heading > label { display: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-control-pair { display: flex; align-items: center; gap: 8px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-control-pair > button { flex: none; width: auto; min-width: 0; max-width: none; min-height: 32px; height: 32px; padding: 0 14px; border: 0; border-radius: 16px; background: color-mix(in srgb, var(--hue) 18%, transparent); color: var(--hue); font-size: 13px; font-weight: 650; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-control-pair > button.ghost { background: #ffffff0d; color: var(--text); }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-control-pair label { display: inline-flex; align-items: center; gap: 4px; width: auto; color: var(--muted); font-size: 11.5px; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-control-pair input { width: 46px; min-width: 0; height: 28px; min-height: 28px; padding: 2px; border: 0; border-bottom: 1px solid #ffffff1a; border-radius: 0; background: none; font-size: 13px; text-align: center; box-shadow: none; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-recommendation-status { color: var(--muted); font-size: 12px; }
.semantic-artist-row { display: grid; gap: 6px; padding: 12px 2px; border-bottom: 1px solid #ffffff0a; }
.semantic-artist-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.semantic-artist-actions button { min-width: 0; min-height: 28px; height: 28px; padding: 0 11px; border: 0; border-radius: 14px; background: #ffffff0b; color: var(--text); font-size: 12px; box-shadow: none; }
.semantic-artist-actions .semantic-artist-add { background: color-mix(in srgb, var(--hue, var(--accent)) 20%, transparent); color: var(--hue, var(--accent)); font-weight: 650; }
.semantic-artist-actions .semantic-artist-add:disabled { opacity: .4; }
body:not(.tag-layout-legacy) #semanticDialog .semantic-credit { margin: 18px 0 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); color: var(--muted); font-size: 11px; }

/* The bar under a selection. */
.semantic-action-bar { position: sticky; z-index: 2; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 -16px; padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 10px); border-top: 1px solid #ffffff12; background: #191a17f2; backdrop-filter: blur(12px); }
.semantic-action-bar[hidden] { display: none; }
#semanticBarCount { margin-right: auto; color: var(--hue, var(--accent)); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.semantic-action-bar button { min-width: 0; min-height: 34px; height: 34px; padding: 0 12px; border: 0; border-radius: 17px; background: #ffffff0d; color: var(--text); font-size: 13px; box-shadow: none; }
.semantic-action-bar .semantic-bar-add { background: var(--hue, var(--accent)); color: #1b1408; font-weight: 700; }

/* Queue control: why it is paused, 换渠道 and 全部取消 (both layouts). */
.queue-control { display: grid; gap: 8px; margin: 4px 0 10px; }
.queue-pause-note { margin: 0; padding: 9px 12px; border-radius: 10px; background: #ffffff0a; color: var(--text-secondary, var(--text)); font-size: 13px; line-height: 1.5; }
.queue-pause-note.warn { background: #e0a35a1c; color: #f2c58c; }
.queue-control-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.queue-control-actions button { min-height: 34px; padding: 0 14px; border-radius: 17px; font-size: 13px; }
.queue-control-actions button.confirm { border-color: #ff718566; background: #e0607024; color: #ffc2cb; }
.queue-route-menu { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #ffffff08; }
.queue-route-menu[hidden] { display: none; }
.queue-route-menu p { margin: 0; color: var(--muted); font-size: 12.5px; }
.queue-route-menu button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: #ffffff0d; color: var(--text); font-size: 14px; text-align: left; box-shadow: none; }
.queue-route-menu button.dead { color: var(--muted); }
.queue-route-menu button small { color: #e0a35a; font-size: 11px; }
.queue-route-hint { color: var(--muted); font-size: 11.5px; }
.queue-route { color: var(--accent); }

/* ---------------------------------------------------------------------------
   队列 (new layout): no boxes. Counts read as one line; each job is a flat
   row led by a 44px square (the finished image, or a status mark); actions are
   small pills, under the text on phones. Legacy keeps the cards.
   --------------------------------------------------------------------------- */
body:not(.tag-layout-legacy) .queue-panel { padding: 6px 2px 24px; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) .queue-panel > .panel-title-row { align-items: center; margin-bottom: 6px; }
body:not(.tag-layout-legacy) .queue-panel > .panel-title-row h2 { color: var(--accent); font-size: 13px; letter-spacing: .08em; }
body:not(.tag-layout-legacy) .queue-panel > .panel-title-row button { min-width: 0; min-height: 32px; height: 32px; padding: 0 16px; border: 0; border-radius: 16px; font-size: 13px; box-shadow: none; }
body:not(.tag-layout-legacy) .queue-panel > .panel-title-row button.ghost { background: #ffffff0d; color: var(--text); }
body:not(.tag-layout-legacy) .queue-panel > .panel-title-row button:disabled { display: none; }
body:not(.tag-layout-legacy) .queue-panel .metrics { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 2px 0 10px; padding: 0 2px; }
body:not(.tag-layout-legacy) .queue-panel .metric { display: flex; align-items: baseline; gap: 5px; padding: 0; border: 0; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) .queue-panel .metric strong { display: inline; color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; font-weight: 650; }
body:not(.tag-layout-legacy) .queue-panel .metric span { font-size: 12px; }
body:not(.tag-layout-legacy) .queue-panel .metric:first-child strong { color: var(--accent); }
body:not(.tag-layout-legacy) .queue-panel .queue-cooldown { flex-basis: 100%; color: #e6c78b; font-size: 12px; }
body:not(.tag-layout-legacy) .queue-control-actions button { border: 0; background: #ffffff0d; box-shadow: none; }
body:not(.tag-layout-legacy) .queue-list { gap: 0; border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) .queue-item { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "lead main actions" "log log log"; align-items: start; gap: 2px 12px; padding: 10px 4px; border: 0; border-bottom: 1px solid #ffffff0b; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) .queue-item.is-running { border-radius: 10px; border-bottom-color: transparent; background: color-mix(in srgb, var(--accent) 9%, transparent); }
body:not(.tag-layout-legacy) .queue-item.is-cancelled { opacity: .55; }
body:not(.tag-layout-legacy) .queue-item .queue-main { grid-area: main; gap: 3px; }
body:not(.tag-layout-legacy) .queue-item .queue-actions { grid-area: actions; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; width: auto; }
body:not(.tag-layout-legacy) .queue-item .queue-actions > button { width: auto; min-width: 0; min-height: 28px; height: 28px; padding: 0 11px; border: 0; border-radius: 14px; background: #ffffff0b; color: var(--text); font-size: 12px; box-shadow: none; }
body:not(.tag-layout-legacy) .queue-item .queue-actions > button.danger { color: #ff9aa8; }
body:not(.tag-layout-legacy) .queue-item .queue-log-panel { grid-area: log; margin-top: 6px; }
body:not(.tag-layout-legacy) .queue-item .queue-line { gap: 3px 8px; }
body:not(.tag-layout-legacy) .queue-item .queue-line strong { font-size: 14px; }
body:not(.tag-layout-legacy) .queue-item .queue-line small { color: var(--muted); font-size: 11.5px; }
body:not(.tag-layout-legacy) .queue-item .queue-line small.queue-route { color: var(--accent); }
body:not(.tag-layout-legacy) .queue-item .status { padding: 1px 7px; font-size: 10.5px; }
.queue-thumb { grid-area: lead; display: block; width: 44px; height: 44px; min-width: 0; min-height: 0; padding: 0; overflow: hidden; border: 0; border-radius: 9px; background: #ffffff0a; box-shadow: none; }
.queue-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.queue-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 16px; }
.queue-thumb.placeholder.pending::after { width: 14px; height: 14px; border: 1.5px dashed #e0b47c99; border-radius: 50%; content: ""; }
.queue-thumb.placeholder.running::after { width: 16px; height: 16px; border: 2px solid #ffffff1a; border-top-color: var(--accent); border-radius: 50%; content: ""; animation: queue-spin 1s linear infinite; }
.queue-thumb.placeholder.failed { background: #e0607018; color: #ff9aa8; }
.queue-thumb.placeholder.failed::after { font-weight: 800; content: "!"; }
.queue-thumb.placeholder.cancelled::after { content: "×"; }
.queue-thumb.placeholder.completed::after { color: #8fd1a5; content: "✓"; }
@keyframes queue-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .queue-thumb.placeholder.running::after { animation: none; } }
@media (max-width: 720px) {
  body:not(.tag-layout-legacy) .queue-item { grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "lead main" "lead actions" "log log"; }
  body:not(.tag-layout-legacy) .queue-item .queue-actions { justify-content: flex-start; margin-top: 4px; }
}

/* ---------------------------------------------------------------------------
   画师资料库 (new layout, the artist tab page only; phone first).
     coverage line ................................ 管理 ⌄   (jobs in a menu)
     ⌕ search ─────────────────────────────────── 筛选 · n
     全部模型 ⌄   默认排序 ⌄   ☆ 收藏                      (quiet text controls)
     [筛选 panel: 有标注 / 已确认 / 清除, then the three groups as an accordion]
     n 位画师 ................................... ‹ 1 / 295 页 ›
   Every original element and class stays (legacy, the modal and tests use
   them); this only places and restyles them.
   --------------------------------------------------------------------------- */
body:not(.tag-layout-legacy) .artist-library-page { position: relative; }
/* 管理 floats right; the coverage line (a flex container) sits beside it on the same line. */
body:not(.tag-layout-legacy) .artist-library-page .artist-library-header { position: relative; z-index: 6; float: right; display: block; height: 30px; margin: 0 0 0 8px; padding: 0; border: 0; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-body { clear: both; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-role-badge:not([data-read-only="true"]) { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-role-badge[data-read-only="true"] { margin: 6px 0 0; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-header:has(.artist-library-role-badge[data-read-only="true"]) .artist-library-manage-toggle { display: none; }
.artist-library-manage-toggle { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-manage-toggle { display: inline-flex; align-items: center; gap: 5px; min-width: 0; min-height: 30px; height: 30px; padding: 0 4px 0 10px; border: 0; background: none; color: var(--muted); font-size: 13px; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-manage-toggle::after { font-size: 10px; content: "▾"; }
body:not(.tag-layout-legacy) .artist-library-page .jobs-open .artist-library-manage-toggle { color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-header:has(.artist-library-task-summary:not(:empty)) .artist-library-manage-toggle::before { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); content: ""; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-overview-actions { position: absolute; top: 36px; right: 0; display: none; flex-direction: column; align-items: stretch; gap: 2px; min-width: 176px; margin: 0; padding: 6px; border: 1px solid #ffffff14; border-radius: 14px; background: #1c1d19f7; box-shadow: 0 16px 40px #000b; }
body:not(.tag-layout-legacy) .artist-library-page .jobs-open .artist-library-overview-actions { display: flex; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-overview-actions > button { justify-content: space-between; min-height: 42px; height: auto; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--text); font-size: 14px; font-weight: 400; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-overview-actions > button:active { background: #ffffff0d; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-overview-actions > button[hidden] { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-overview { min-height: 30px; margin: 0 0 4px; padding: 0 0 0 2px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage { font-size: 11.5px; }

/* Search line and the quiet controls under it. */
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-page :is(.artist-library-filter-main, .artist-library-filter-scopes) { display: contents; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-control-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search { order: 0; flex: 1 1 100%; display: block; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search-row { align-items: center; gap: 10px; border-bottom: 1px solid #ffffff1f; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search-row:focus-within { border-bottom-color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search-row::before { color: var(--muted); font-size: 18px; content: "⌕"; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search-row > input { min-height: 48px; padding: 8px 0; border: 0; border-radius: 0; background: none; font-size: 16px; box-shadow: none; outline: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search-row > input::-webkit-search-cancel-button { opacity: .45; filter: grayscale(1); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-toggle { flex: none; min-width: 0; min-height: 32px; height: 32px; padding: 0 14px; border: 0; border-radius: 16px; background: #ffffff0d; color: var(--text); font-size: 13px; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open .artist-library-filter-toggle { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-search-button { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filters label:has(> select) { order: 1; display: block; min-width: 0; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filters label > select { width: auto; min-width: 0; max-width: 10em; min-height: 44px; height: 44px; padding: 0 16px 0 0; overflow: hidden; border: 0; border-radius: 0; background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23a39e93' stroke-width='1.5' stroke-linecap='round'/></svg>") no-repeat right 2px center; color: var(--text); font-size: 13.5px; text-overflow: ellipsis; box-shadow: none; appearance: none; -webkit-appearance: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-scopes label:has(input[name="favorite"]) { order: 1; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-scopes label:has(input[name="favorite"]) span { min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13.5px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-scopes label:has(input[name="favorite"]) span::before { margin-right: 4px; content: "☆"; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-scopes label:has(input[name="favorite"]) input:checked + span { background: none; color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-scopes label:has(input[name="favorite"]) input:checked + span::before { content: "★"; }

/* The 筛选 panel: only while open; it starts on its own line behind a hairline. */
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filters.filters-open::before { order: 2; flex: 1 1 100%; height: 0; margin-bottom: 10px; border-top: 1px solid #ffffff0b; content: ""; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filters:not(.filters-open) :is(label:has(input[name="annotated"]), label:has(input[name="confirmedOnly"]), .artist-library-clear, .artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters, .artist-library-filter-collapse) { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open :is(label:has(input[name="annotated"]), label:has(input[name="confirmedOnly"])) { order: 3; margin: 0 -8px 10px 0; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open :is(label:has(input[name="annotated"]), label:has(input[name="confirmedOnly"])) span { min-height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: #ffffff0b; color: var(--muted); font-size: 12.5px; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open :is(label:has(input[name="annotated"]), label:has(input[name="confirmedOnly"])) input:checked + span { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-clear { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open[data-filtered] .artist-library-clear { order: 3; display: inline-flex; min-height: 30px; margin: 4px 0 10px auto; padding: 0 2px; border: 0; background: none; color: var(--muted); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open :is(.artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters) { order: 4; flex: 1 1 100%; border: 0; border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) .artist-library-page :is(.artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters) > summary { display: flex; align-items: center; justify-content: space-between; min-height: 46px; margin: 0; padding: 0 2px; border-radius: 0; background: none; color: var(--text); font-size: 13.5px; font-weight: 600; list-style: none; }
body:not(.tag-layout-legacy) .artist-library-page :is(.artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters) > summary::-webkit-details-marker { display: none; }
body:not(.tag-layout-legacy) .artist-library-page :is(.artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters) > summary::after { color: var(--muted); font-size: 11px; font-weight: 400; content: "▾"; }
body:not(.tag-layout-legacy) .artist-library-page :is(.artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters)[open] > summary::after { content: "▴"; }
body:not(.tag-layout-legacy) .artist-library-page :is(.artist-library-facet-disclosure, .artist-library-refined-filters, .artist-library-auxiliary-filters)[open] { padding-bottom: 14px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-facet-grid { grid-template-columns: 1fr; gap: 14px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-facet-grid fieldset { gap: 6px; padding: 0; border: 0; border-radius: 0; background: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-facet-grid legend { float: left; width: 100%; margin-bottom: 6px; padding: 0; color: var(--muted); font-size: 11.5px; letter-spacing: .06em; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filters .artist-library-option > span { min-height: 30px; padding: 0 11px; border-color: transparent; border-radius: 15px; background: #ffffff0b; }
body:not(.tag-layout-legacy) .artist-library-page .filters-open .artist-library-filter-collapse { order: 5; display: block; flex: 1 1 100%; min-height: 40px; margin: 2px 0 10px; border: 0; border-radius: 12px; background: #ffffff0b; color: var(--text); font-size: 13px; box-shadow: none; }
.artist-library-filter-toggle, .artist-library-filter-collapse { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-filter-toggle { display: inline-flex; align-items: center; }

/* Results: the count and a compact pager share one line. */
body:not(.tag-layout-legacy) .artist-library-page [data-artist-results] { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) .artist-library-page [data-artist-results] > * { grid-column: 1 / -1; }
body:not(.tag-layout-legacy) .artist-library-page [data-artist-results] > .artist-library-list-summary { grid-column: 1; min-height: 46px; padding: 0 2px; }
body:not(.tag-layout-legacy) .artist-library-page [data-artist-results] > .artist-library-list-summary + .artist-library-pagination { grid-column: 2; padding: 0; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-list-summary strong { color: var(--muted); font-size: 12.5px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-pagination { gap: 0; padding: 16px 0 4px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-pagination > button { width: 34px; min-width: 0; height: 34px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); font-size: 0; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-pagination > button::before { font-size: 22px; line-height: 1; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-pagination > button:first-child::before { content: "‹"; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-pagination > button:last-child::before { content: "›"; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-pagination > button:disabled { opacity: .25; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-page-jump { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12.5px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-page-jump > span:first-of-type,
body:not(.tag-layout-legacy) .artist-library-page .artist-library-page-jump button { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-page-jump input { width: 40px; min-width: 0; height: 30px; min-height: 0; padding: 0; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; color: var(--text); font-size: 13.5px; text-align: center; box-shadow: none; }

/* ---------------------------------------------------------------------------
   图片反推 (both layouts): a sheet, full screen on a phone. The image on top,
   then the Tags as chips (a thin bar under each shows the tagger's
   confidence), the actions, and 推荐画师 at the end.
   --------------------------------------------------------------------------- */
.tagger-dialog { width: min(720px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px); padding: 0; overflow: hidden; border: 1px solid #ffffff14; border-radius: 18px; background: #191a17; color: var(--text); box-shadow: 0 30px 80px #000c; }
.tagger-dialog[open] { display: flex; flex-direction: column; }
.tagger-dialog::backdrop { background: #000a; }
@media (max-width: 720px) {
  .tagger-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
}
.tagger-head { display: flex; flex: none; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 10px 18px; border-bottom: 1px solid #ffffff0d; }
.tagger-title { display: flex; flex: 1; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.tagger-title strong { font-size: 16px; letter-spacing: .04em; }
.tagger-title small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tagger-close { width: 36px; min-width: 0; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #ffffff0d; color: var(--text); font-size: 20px; box-shadow: none; }
.tagger-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 20px); }
.tagger-media { display: grid; place-items: center; padding: 14px 0 10px; }
.tagger-image { max-width: 100%; max-height: 34vh; border-radius: 12px; object-fit: contain; box-shadow: 0 10px 30px #0008; }
.tagger-loading { display: grid; justify-items: center; gap: 8px; padding: 26px 8px; color: var(--muted); text-align: center; }
.tagger-loading p { margin: 0; color: var(--text); font-size: 14px; }
.tagger-loading small { max-width: 32em; font-size: 12px; line-height: 1.5; }
.tagger-loading.error p { color: #ffb2be; }
.tagger-spinner { width: 22px; height: 22px; border: 2px solid #ffffff1a; border-top-color: var(--accent); border-radius: 50%; animation: queue-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .tagger-spinner { animation: none; } }
.tagger-retry { min-height: 34px; padding: 0 18px; border: 0; border-radius: 17px; background: #ffffff0d; color: var(--text); box-shadow: none; }
.tagger-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 4px 2px 8px; color: var(--muted); font-size: 12px; }
.tagger-rating { padding: 1px 8px; border-radius: 9px; background: #ffffff0f; color: var(--text); font-size: 11.5px; }
.tagger-rating.questionable, .tagger-rating.explicit { background: #e0607022; color: #ffb2be; }
.tagger-link { margin-left: auto; min-width: 0; min-height: 28px; padding: 0 4px; border: 0; background: none; color: var(--accent); font-size: 12.5px; box-shadow: none; }
.tagger-block { padding: 8px 0 12px; border-top: 1px solid #ffffff0b; }
.tagger-label { margin: 0 2px 8px; color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; }
.tagger-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tagger-chip { position: relative; display: inline-grid; justify-items: start; gap: 1px; min-width: 0; min-height: 0; max-width: 100%; padding: 6px 11px 8px; overflow: hidden; border: 0; border-radius: 10px; background: #ffffff08; color: var(--muted); text-align: left; box-shadow: inset 0 0 0 1px #ffffff0d; }
.tagger-chip::after { position: absolute; bottom: 0; left: 0; width: calc(var(--conf, 0) * 100%); height: 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); content: ""; }
.tagger-chip[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, #23241f); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.tagger-chip.present { opacity: .6; }
.tagger-chip-line { display: flex; align-items: baseline; gap: 6px; }
.tagger-chip-line b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.tagger-chip-line i { color: #8fd1a5; font-size: 11px; font-style: normal; }
.tagger-chip small { color: var(--muted); font-size: 11.5px; }
.tagger-actions { position: sticky; z-index: 2; bottom: 0; display: flex; gap: 8px; margin: 4px -16px 0; padding: 10px 16px; border-top: 1px solid #ffffff12; background: #191a17f2; backdrop-filter: blur(12px); }
.tagger-primary { flex: 1; min-height: 40px; border: 0; border-radius: 20px; background: var(--accent); color: #1b1408; font-weight: 700; box-shadow: none; }
.tagger-secondary { min-width: 0; min-height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: #ffffff0d; color: var(--text); font-size: 13px; box-shadow: none; }
.tagger-actions .tagger-secondary { min-height: 40px; border-radius: 20px; }
.tagger-primary:disabled, .tagger-secondary:disabled { opacity: .4; }
.tagger-artists { padding: 14px 0 4px; }
.tagger-artists-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tagger-artists-head .tagger-label { margin-bottom: 0; }
.tagger-hint { margin: 8px 2px 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.tagger-artist { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 11px 2px; border-bottom: 1px solid #ffffff0a; }
.tagger-artist-text { display: grid; gap: 2px; min-width: 0; }
.tagger-artist-name { color: var(--text); font-size: 14.5px; font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.tagger-artist-text small { color: var(--muted); font-size: 11.5px; }
.tagger-artist-text em { overflow: hidden; color: var(--muted); font-size: 12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.tagger-artist-actions { display: flex; gap: 6px; }
.tagger-artist-actions .tagger-secondary { min-height: 30px; padding: 0 11px; font-size: 12px; }

/* 图片详情: a button hidden by its attribute stays hidden (a display rule on the
   row used to show the retired 以此图搜索相似 again). */
.dialog-create-row > [hidden] { display: none !important; }
/* 全部参数 (both layouts): the rebuilt NovelAI request, folded by default. */
.dialog-payload { margin: 4px 0 14px; border-top: 1px solid #ffffff0b; border-bottom: 1px solid #ffffff0b; }
.dialog-payload > summary { display: flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 12px 2px 0; color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; list-style: none; }
.dialog-payload > summary::-webkit-details-marker { display: none; }
.dialog-payload > summary small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.dialog-payload > summary::after { margin-left: auto; color: var(--muted); font-size: 11px; content: "▾"; }
.dialog-payload[open] > summary::after { content: "▴"; }
.dialog-payload-body { display: grid; gap: 8px; padding: 0 0 12px; }
.dialog-payload-body > button { justify-self: end; min-width: 0; min-height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: #ffffff0d; color: var(--text); font-size: 12px; box-shadow: none; }
#dialogPayloadJson { max-height: 50vh; margin: 0; padding: 12px; overflow: auto; border-radius: 10px; background: #0f100e; color: var(--text-secondary, var(--text)); font: 11.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; user-select: text; }

/* New layout: 用此图创作 / ✦ 反推 Tag as two calm buttons; the fields as flat rows. */
body:not(.tag-layout-legacy) .image-dialog .dialog-create-row { margin-bottom: 14px; }
body:not(.tag-layout-legacy) .image-dialog .dialog-create-row > button { min-height: 40px; border: 0; border-radius: 20px; background: #ffffff0d; color: var(--text); font-size: 13px; box-shadow: none; }
body:not(.tag-layout-legacy) #dialogTaggerFromImage { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 650; }
body:not(.tag-layout-legacy) #dialogMeta { gap: 0; margin-bottom: 4px; border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) #dialogMeta .meta-row { grid-template-columns: 64px minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) #dialogMeta .meta-row span { font-size: 12px; }
body:not(.tag-layout-legacy) #dialogMeta .meta-row code { padding: 0; border-radius: 0; background: none; font-family: inherit; font-size: 13.5px; line-height: 1.5; }
body:not(.tag-layout-legacy) #dialogMeta .meta-row:nth-child(n+6) { grid-template-columns: 1fr; gap: 6px; }
body:not(.tag-layout-legacy) #dialogMeta .meta-row:nth-child(n+6) code { padding: 10px 12px; border-radius: 10px; background: #ffffff06; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }

/* 画师资料库 counts (new layout): each fact is a small stat — the number set
   apart, its unit beside it, the label under it. */
body:not(.tag-layout-legacy) .artist-library-page .artist-library-overview { margin: 2px 0 12px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage { display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); align-items: start; gap: 10px 30px; }
@media (min-width: 721px) { body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage { grid-template-columns: repeat(4, minmax(0, max-content)); } }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage > span + span::before { content: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage span:has(> b) { display: inline-flex; flex-wrap: wrap; align-items: baseline; row-gap: 1px; color: var(--muted); white-space: nowrap; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage .coverage-label { order: 3; flex-basis: 100%; color: var(--muted); font-size: 11px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage b { order: 1; color: var(--text); font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage .coverage-unit { order: 2; margin-left: 3px; color: var(--muted); font-size: 11px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage-pending b { color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage-tail { align-items: center; gap: 10px; }
/* The 「?」 panel hangs from the start of the stats line: that line is narrower than the
   row here (管理 sits beside it), so a right-anchored panel spilled off the left edge at 360px. */
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage { position: relative; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-coverage-help-panel { right: auto; left: 0; }

/* ---------------------------------------------------------------------------
   图库 (new layout, phone first). The old boxes are flattened (display:
   contents) and their items placed on three lines:
     常规作品  例图样本 ..................... ☆ 收藏   ⋯
     ⌕ search ───────────────────────────── 全部时间 ⌄
     30 / 60 张 · disk line
   清理模式 / 批量选择 / 检查存储 live in ⋯ (its items click the originals).
   --------------------------------------------------------------------------- */
body:not(.tag-layout-legacy) #galleryTab .gallery-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; padding: 2px 2px 24px; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) #galleryTab :is(.gallery-title-row, .gallery-title-actions, .gallery-toolbar) { display: contents; }
body:not(.tag-layout-legacy) #galleryTab .gallery-title-row h2,
body:not(.tag-layout-legacy) #galleryTab #storageAuditButton,
body:not(.tag-layout-legacy) #galleryTab .gallery-mode-row { display: none; }
body:not(.tag-layout-legacy) #galleryTab .gallery-scope-row { order: 1; display: flex; flex: 1 1 0; width: auto; min-width: 0; gap: 20px; margin: 0; padding: 0; border: 0; background: none; }
body:not(.tag-layout-legacy) #galleryTab .gallery-scope-row button { flex: none; width: auto; min-width: 0; min-height: 44px; height: 44px; padding: 0 1px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 15px; font-weight: 600; box-shadow: inset 0 -2px 0 transparent; }
body:not(.tag-layout-legacy) #galleryTab .gallery-scope-row button[aria-pressed="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
body:not(.tag-layout-legacy) #galleryTab .gallery-title-actions > .check-label { order: 2; position: relative; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0; font-size: 0; cursor: pointer; }
body:not(.tag-layout-legacy) #galleryTab .gallery-title-actions > .check-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
body:not(.tag-layout-legacy) #galleryTab .gallery-title-actions > .check-label::after { color: var(--muted); font-size: 13.5px; content: "☆ 收藏"; }
body:not(.tag-layout-legacy) #galleryTab .gallery-title-actions > .check-label:has(input:checked)::after { color: var(--accent); content: "★ 收藏"; }
body:not(.tag-layout-legacy) #galleryTab .gallery-title-actions > .check-label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.gallery-more { position: relative; }
body:not(.tag-layout-legacy) #galleryTab .gallery-more { order: 3; }
.gallery-more-toggle { width: 36px; min-width: 0; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #ffffff0d; color: var(--text); font-size: 17px; box-shadow: none; }
.gallery-more-menu { position: absolute; z-index: 20; top: 42px; right: 0; display: flex; flex-direction: column; gap: 2px; min-width: 168px; padding: 6px; border: 1px solid #ffffff14; border-radius: 14px; background: #1c1d19f7; box-shadow: 0 16px 40px #000b; }
.gallery-more-menu[hidden] { display: none; }
.gallery-more-menu button { display: flex; align-items: center; justify-content: space-between; min-width: 0; min-height: 42px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--text); font-size: 14px; text-align: left; box-shadow: none; }
.gallery-more-menu button:active { background: #ffffff0d; }
.gallery-more-menu button[aria-checked="true"] { color: var(--accent); }
.gallery-more-menu button[aria-checked="true"]::after { font-size: 12px; content: "开"; }
body:not(.tag-layout-legacy) #galleryTab .gallery-selection-actions { order: 4; display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 6px; }
body:not(.tag-layout-legacy) #galleryTab .gallery-selection-actions > :not(.hidden) { margin: 6px 0 2px; }
body:not(.tag-layout-legacy) #galleryTab .gallery-selection-actions button { min-width: 0; min-height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: #ffffff0d; color: var(--text); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) #galleryTab .gallery-selection-actions button.danger { color: #ff9aa8; }
body:not(.tag-layout-legacy) #galleryTab #gallerySelectionText { align-self: center; color: var(--muted); font-size: 12px; }
body:not(.tag-layout-legacy) #galleryTab .gallery-filter-row { order: 5; display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: 0 14px; margin: 0; padding: 0; border: 0; background: none; }
body:not(.tag-layout-legacy) #galleryTab #gallerySearch { flex: 1 1 160px; min-width: 0; min-height: 46px; padding: 8px 0; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; font-size: 16px; box-shadow: none; outline: none; }
body:not(.tag-layout-legacy) #galleryTab #gallerySearch:focus { border-bottom-color: var(--accent); }
body:not(.tag-layout-legacy) #galleryTab #galleryAgeFilter { flex: none; width: auto; min-width: 0; min-height: 44px; padding: 0 16px 0 0; border: 0; border-radius: 0; background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23a39e93' stroke-width='1.5' stroke-linecap='round'/></svg>") no-repeat right 2px center; color: var(--text); font-size: 13.5px; box-shadow: none; appearance: none; -webkit-appearance: none; }
body:not(.tag-layout-legacy) #galleryTab :is(#galleryMonthFilter, #galleryCustomRange input) { min-height: 36px; padding: 2px; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; font-size: 13.5px; box-shadow: none; }
body:not(.tag-layout-legacy) #galleryTab #galleryCustomRange { display: flex; align-items: center; gap: 6px; }
body:not(.tag-layout-legacy) #galleryTab #galleryCustomRange.hidden,
body:not(.tag-layout-legacy) #galleryTab #galleryMonthFilter.hidden { display: none; }
body:not(.tag-layout-legacy) #galleryTab #galleryNewImagesButton { min-height: 30px; padding: 0 12px; border: 0; border-radius: 15px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) #galleryTab #galleryResultSummary { flex: 1 1 100%; min-height: 0; margin: 8px 0 0; padding: 0 1px; border: 0; background: none; color: var(--muted); font-size: 12px; text-align: left; }
body:not(.tag-layout-legacy) #galleryTab #storageMeter { order: 6; flex: 1 1 100%; margin: 2px 0 12px; padding: 0 1px; border: 0; background: none; color: var(--muted); font-size: 11px; opacity: .8; }
body:not(.tag-layout-legacy) #galleryTab #storageMeter .storage-meter-line { display: block; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:not(.tag-layout-legacy) #galleryTab #galleryGrid { order: 7; flex: 1 1 100%; min-width: 0; }
body:not(.tag-layout-legacy) #galleryTab #loadMoreButton { order: 8; flex: 1 1 100%; }
/* Cards: no frame; the two actions are small and quiet, the image does the talking. */
body:not(.tag-layout-legacy) #galleryTab .gallery-card { border: 0; border-radius: 12px; background: #ffffff06; }
body:not(.tag-layout-legacy) #galleryTab .gallery-card footer { padding: 6px 8px 7px; font-size: 11px; }
body:not(.tag-layout-legacy) #galleryTab :is(.gallery-delete-button, .gallery-favorite-button, .gallery-check) { top: 6px; width: 28px; min-width: 0; height: 28px; min-height: 0; border: 0; background: #0000005c; box-shadow: none; font-size: 14px; }
body:not(.tag-layout-legacy) #galleryTab .gallery-delete-button { left: 6px; color: #ffd0d8; opacity: .75; }
body:not(.tag-layout-legacy) #galleryTab .gallery-favorite-button { right: 6px; color: #ffffffd9; }
body:not(.tag-layout-legacy) #galleryTab .gallery-favorite-button.active { color: #ffd86f; }
body:not(.tag-layout-legacy) #galleryTab .gallery-check { left: 6px; }

/* 画师卡片 (new layout, the artist page): the picture leads; ＋ (加入画风) and ☆ are
   small quiet buttons on it, the button row is gone, the copy is two quiet lines. */
.artist-library-card-add { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card-add { position: absolute; z-index: 3; top: 8px; left: 8px; display: grid; place-items: center; width: 30px; min-width: 0; height: 30px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #0000005c; color: #fff; font-size: 17px; line-height: 1; box-shadow: none; backdrop-filter: blur(6px); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card-add:disabled { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card-favorite { top: 8px; right: 8px; width: 30px; min-width: 0; height: 30px; min-height: 0; border: 0; background: #0000005c; font-size: 15px; backdrop-filter: blur(6px); }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card-actions { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card { gap: 7px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card-copy { gap: 3px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-card-name strong { font-size: 14.5px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-cover-badge { display: none; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-chips .artist-library-chip.is-pending { padding: 0; border: 0; background: none; color: var(--muted); font-size: 11px; }
body:not(.tag-layout-legacy) .artist-library-page .artist-library-chips .artist-library-chip.is-pending::before { margin-right: 4px; content: "○"; }

/* 法典 source: one line naming the current source (kind · title · count ⌄);
   tapping it unfolds every source under it, grouped by kind, titles in full.
   R18 lives at the foot of that list. */
.codex-source { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 46px; padding: 0 2px; border: 0; border-radius: 0; background: none; color: var(--text); text-align: left; box-shadow: none; }
.codex-source-label { display: flex; flex: 1; align-items: baseline; gap: 8px; min-width: 0; }
.codex-source-label .codex-kind { flex: none; color: var(--accent); font-size: 11.5px; font-style: normal; font-weight: 650; letter-spacing: .04em; }
.codex-source-label b { overflow: hidden; font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.codex-source-label small { flex: none; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.codex-source > i { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #ffffff0d url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1.5 1.5l4.5 4.5 4.5-4.5' fill='none' stroke='%23a39e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat center; transition: transform .18s ease; }
.codex-source[aria-expanded="true"] > i { transform: rotate(180deg); }
.codex-source-panel { max-height: min(62vh, 520px); margin: 0 -14px; padding: 2px 14px 10px; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid #ffffff12; }
.codex-source-panel[hidden] { display: none; }
.codex-books { display: grid; }
.codex-source-group { margin: 14px 0 2px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .08em; }
.codex-source-group:first-child { margin-top: 4px; }
.codex-book { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 44px; padding: 8px 2px 8px 12px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 14px; text-align: left; box-shadow: inset 2px 0 0 #ffffff10; }
.codex-book b { flex: 1; min-width: 0; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.codex-book small { flex: none; font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
.codex-book:active { background: #ffffff08; }
.codex-book[aria-pressed="true"] { color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.codex-book[aria-pressed="true"] b { font-weight: 700; }
.codex-book[aria-pressed="true"] small { color: var(--accent); opacity: 1; }
.codex-nsfw { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; padding: 0 2px; border-top: 1px solid #ffffff0b; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.codex-nsfw input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: #e98a8a; }

/* ---------------------------------------------------------------------------
   方案 (new layout): no panel box. One create line — name, 保存, ⋯ (导出 /
   导入备份 click the originals) — then flat rows: cover, name, summary and
   date, 恢复 and ⋯ (设为默认 / 删除 unfold in the row). Tapping a row opens
   the detail, as before.
   --------------------------------------------------------------------------- */
body:not(.tag-layout-legacy) #schemeTab .scheme-library-panel { padding: 4px 2px 24px; border: 0; border-radius: 0; background: none; box-shadow: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-library-panel > .panel-title-row { display: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-library-create { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; }
body:not(.tag-layout-legacy) #schemeTab #schemeLibraryName { flex: 1; min-width: 0; min-height: 46px; padding: 8px 0; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; font-size: 16px; box-shadow: none; outline: none; }
body:not(.tag-layout-legacy) #schemeTab #schemeLibraryName:focus { border-bottom-color: var(--accent); }
body:not(.tag-layout-legacy) #schemeTab #schemeLibrarySaveCurrent { flex: none; width: auto; min-width: 0; min-height: 34px; height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-size: 13px; font-weight: 650; box-shadow: none; }
.scheme-more { position: relative; flex: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 0 28px; margin-top: 10px; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-grid:not(:has(.scheme-card)) { padding: 28px 2px; border: 0; background: none; color: var(--muted); font-size: 13px; text-align: left; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto; gap: 14px; padding: 12px 0; overflow: visible; border: 0; border-bottom: 1px solid #ffffff0b; border-radius: 0; background: none; box-shadow: none; transform: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card:active { background: #ffffff05; }
body:not(.tag-layout-legacy) #schemeTab .scheme-cover { width: 64px; aspect-ratio: 3 / 4; align-self: start; border-radius: 10px; background: #ffffff08; }
body:not(.tag-layout-legacy) #schemeTab .scheme-cover-placeholder { font-size: 22px; }
body:not(.tag-layout-legacy) #schemeTab .scheme-default-badge { top: auto; right: 0; bottom: 0; left: 0; padding: 2px 0; border: 0; border-radius: 0; background: #000000a8; color: var(--accent); font-size: 10px; font-weight: 650; text-align: center; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-body { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 3px; padding: 0; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-title strong { font-size: 15px; font-weight: 650; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-meta { font-size: 11.5px; line-height: 1.55; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions button { width: auto; min-width: 0; min-height: 32px; height: 32px; padding: 0 14px; border: 0; border-radius: 16px; background: #ffffff0d; color: var(--text); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions [data-scheme-detail] { display: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions [data-scheme-restore] { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 650; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card:not(.menu-open) .scheme-card-actions :is([data-scheme-default], [data-scheme-delete]) { display: none; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions [data-scheme-delete] { color: #ff9aa8; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions [data-scheme-default]:disabled { opacity: .5; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card-actions .scheme-card-more { width: 32px; margin-left: auto; padding: 0; background: none; color: var(--muted); font-size: 16px; }
body:not(.tag-layout-legacy) #schemeTab .scheme-card.menu-open .scheme-card-more { background: #ffffff0d; color: var(--text); }
body.tag-layout-legacy .scheme-card-more { display: none; }

/* ---------------------------------------------------------------------------
   Top bar and bottom tabs (new layout, phone). The page name reads as a
   title; 导入 is quiet text and ⚙ a bare icon, 退出 moved into 设置. The
   current tab is its accent icon and a short bar under it, never a box; the
   icon gives a small hop when the tab is chosen.
   --------------------------------------------------------------------------- */
@media (max-width: 720px) {
  body:not(.tag-layout-legacy) .workspace-topbar.topbar { border-bottom-color: #ffffff0a; }
  body:not(.tag-layout-legacy) .workspace-crumb > strong { color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: .02em; }
  body:not(.tag-layout-legacy) #logoutButton { display: none; }
  body:not(.tag-layout-legacy) .top-actions button { min-height: 40px; padding: 0 10px; border: 0; border-radius: 20px; background: none; color: var(--muted); font-size: 13px; box-shadow: none; }
  body:not(.tag-layout-legacy) .top-actions button:active { background: #ffffff0d; }
  body:not(.tag-layout-legacy) .workspace-settings-button { border-color: transparent; background: none; color: var(--muted); }
  body:not(.tag-layout-legacy) .workspace-settings-button:active { background: #ffffff0d; }
  body:not(.tag-layout-legacy) .workspace-nav .tab,
  body:not(.tag-layout-legacy) .workspace-nav .tab:hover { border-color: transparent; background: none; }
  body:not(.tag-layout-legacy) .workspace-nav .tab.active { border-color: transparent; background: none; color: var(--accent); }
  body:not(.tag-layout-legacy) .workspace-nav .tab.active > span:not(.badge) { font-weight: 650; }
  body:not(.tag-layout-legacy) .workspace-nav .tab.active::before { right: auto; bottom: 1px; left: calc(50% - 9px); width: 18px; height: 3px; border-radius: 2px; }
  body:not(.tag-layout-legacy) .workspace-nav .tab.active svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 45%, transparent)); animation: tab-hop .32s cubic-bezier(.3, 1.6, .5, 1); }
}
@keyframes tab-hop { 0% { transform: translateY(0) scale(1); } 45% { transform: translateY(-3px) scale(1.12); } 100% { transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { body:not(.tag-layout-legacy) .workspace-nav .tab.active svg { animation: none; } }
/* 设置 › 登录 */
body:not(.tag-layout-legacy) #settingsDialog .account-settings-section { --hue: #e98a8a; }
body:not(.tag-layout-legacy) #settingsDialog #settingsLogoutButton { width: auto; min-height: 40px; margin-top: 4px; padding: 0 18px; border: 0; border-radius: 20px; background: #e98a8a1f; color: #ff9aa8; font-size: 13.5px; box-shadow: none; }

/* ---------------------------------------------------------------------------
   画师例图生成 (new layout, phone first). Reading order: one status line, the
   frozen baseline with its two actions (清除 needs a second tap), what the next
   run does and 开始生成, settings as label · value rows, then 详细信息 folded.
   --------------------------------------------------------------------------- */
body:not(.tag-layout-legacy) .artist-library-rotation { gap: 14px; }
body:not(.tag-layout-legacy) .artist-library-rotation > h3 { display: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-status { padding: 0 2px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 13px; line-height: 1.5; }
body:not(.tag-layout-legacy) .artist-library-rotation-status.is-ready { border: 0; background: none; color: var(--accent); font-weight: 650; }
body:not(.tag-layout-legacy) .artist-library-rotation-body { gap: 16px; }
body:not(.tag-layout-legacy) .artist-library-rotation-baseline { display: grid; gap: 8px; }
body:not(.tag-layout-legacy) .artist-library-rotation-prompt { max-height: 132px; margin: 0; padding: 10px 12px; border: 0; border-radius: 10px; background: #ffffff06; color: var(--text); font: 12.5px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
body:not(.tag-layout-legacy) .artist-library-rotation-character { gap: 2px; padding: 2px 0 2px 12px; border: 0; border-radius: 0; background: none; box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
body:not(.tag-layout-legacy) .artist-library-rotation-character strong { font-size: 12px; }
body:not(.tag-layout-legacy) .artist-library-rotation-character span { color: var(--text); font-size: 12.5px; }
body:not(.tag-layout-legacy) .artist-library-rotation-baseline-actions { display: flex; gap: 6px; }
body:not(.tag-layout-legacy) .artist-library-rotation-baseline-actions button { min-width: 0; min-height: 32px; height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: #ffffff0d; color: var(--text); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-baseline-actions [data-rotation-clear] { margin-left: auto; background: none; color: #ff9aa8; }
body:not(.tag-layout-legacy) .artist-library-rotation-baseline-actions [data-rotation-clear].is-armed { background: #ff9aa81f; font-weight: 650; }
body:not(.tag-layout-legacy) .artist-library-rotation-hint { font-size: 12px; line-height: 1.6; }
body:not(.tag-layout-legacy) .artist-library-rotation-actions { display: flex; gap: 8px; }
body:not(.tag-layout-legacy) .artist-library-rotation-actions [data-rotation-start] { flex: 1; min-height: 46px; border: 0; border-radius: 23px; background: var(--accent); color: #1a1712; font-size: 15px; font-weight: 700; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-actions [data-rotation-cancel] { min-height: 46px; padding: 0 18px; border: 0; border-radius: 23px; background: #ffffff0d; color: var(--text); box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-actions [hidden] { display: none; }
/* Settings: label left, a compact value right, one per row. */
body:not(.tag-layout-legacy) .artist-library-rotation-settings { grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) .artist-library-rotation-settings > label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 2px; border-bottom: 1px solid #ffffff0b; color: var(--text); font-size: 13.5px; }
body:not(.tag-layout-legacy) .artist-library-rotation-settings > label > :is(input, select) { flex: none; width: 84px; min-width: 0; min-height: 36px; height: 36px; padding: 0 2px; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; color: var(--text); font-size: 15px; font-weight: 600; text-align: right; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-settings > label > select { width: auto; max-width: 62%; text-align: left; font-size: 13.5px; font-weight: 500; }
body:not(.tag-layout-legacy) .artist-library-rotation-settings > label > :is(input, select):focus { border-bottom-color: var(--accent); outline: 0; }
body:not(.tag-layout-legacy) .artist-library-rotation-settings-actions { padding-top: 10px; }
body:not(.tag-layout-legacy) .artist-library-rotation-settings-actions button { min-height: 38px; padding: 0 18px; border: 0; border-radius: 19px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 650; box-shadow: none; }
/* Artist picker (仅指定的画师): one row per artist — box, name, state. */
body:not(.tag-layout-legacy) .artist-library-rotation-picker { gap: 8px; margin-top: 8px; padding: 0; border: 0; background: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-picker input[name="rotation-artist-search"] { width: 100%; min-height: 42px; padding: 6px 2px; border: 0; border-bottom: 1px solid #ffffff1f; border-radius: 0; background: none; font-size: 15px; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-picker-list { grid-template-columns: minmax(0, 1fr); gap: 0; max-height: 46vh; }
body:not(.tag-layout-legacy) .artist-library-rotation-candidate { display: flex; align-items: center; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 2px; border-bottom: 1px solid #ffffff08; border-radius: 0; color: var(--text); font-size: 14px; }
body:not(.tag-layout-legacy) .artist-library-rotation-candidate input[type="checkbox"] { flex: none; width: 18px; height: 18px; min-width: 0; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
body:not(.tag-layout-legacy) .artist-library-rotation-candidate span { flex: 1; min-width: 0; text-align: left; }
body:not(.tag-layout-legacy) .artist-library-rotation-candidate em { border-radius: 9px; background: #ffffff0d; font-size: 11px; font-style: normal; }
/* 详细信息 */
body:not(.tag-layout-legacy) .artist-library-rotation-details { border-top: 1px solid #ffffff0b; }
body:not(.tag-layout-legacy) .artist-library-rotation-details > summary { display: flex; align-items: center; min-height: 44px; padding: 0 2px; color: var(--muted); font-size: 13px; cursor: pointer; list-style: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-details > summary::-webkit-details-marker { display: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-details > summary::after { margin-left: auto; font-size: 11px; content: "▾"; }
body:not(.tag-layout-legacy) .artist-library-rotation-details[open] > summary::after { content: "▴"; }
body:not(.tag-layout-legacy) .artist-library-rotation-details .artist-library-rotation-facts { gap: 6px 14px; padding: 0 2px 10px; font-size: 12.5px; }
body:not(.tag-layout-legacy) .artist-library-rotation-repair button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: #ffffff0d; color: var(--text); font-size: 12.5px; box-shadow: none; }
body:not(.tag-layout-legacy) .artist-library-rotation-actions [data-rotation-capture] { flex: 1; min-height: 46px; border: 0; border-radius: 23px; background: var(--accent); color: #1a1712; font-size: 15px; font-weight: 700; box-shadow: none; }
