:root {
  --ink: #151816;
  --muted: #68716b;
  --paper: #fbfcf8;
  --surface: #f1f4ee;
  --line: #cfd7cd;
  --line-strong: #aab5aa;
  --accent: #c84725;
  --accent-hover: #b83d20;
  --accent-active: #a9341a;
  --accent-soft: #fff0e9;
  --highlight: #f3c969;
  --success: #0d8050;
  --green: var(--success);
  --danger: #9f3522;
  --danger-strong: #812817;
  --danger-line: #d7a398;
  --danger-soft: #fff0ec;
  --warning: #8b610b;
  --warning-line: #b68016;
  --warning-soft: #fff5d9;
  --panel: #f2f5ef;
  --surface-strong: #e8ede5;
  --selected-surface: #e5ece1;
  --selected-paper: #fffaf7;
  --text-soft: #4f5952;
  --art-editorial: #d7e2d3;
  --art-retro: #f0b35d;
  --art-future: #9db6c7;
  --art-lifestyle: #e7d6b8;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --control-height: 32px;
  --icon-button-size: 32px;
  --icon-size: 16px;
  --result-card-min-width: 260px;
  --result-grid-columns: 3;
  --result-thumbnail-height: 180px;
  --panel-padding: var(--space-3);
  --dialog-padding: var(--space-4);
  --field-gap: var(--space-1);
  --frame-gutter: clamp(var(--space-2), 1.8vw, var(--space-4));
  --frame-edge: max(var(--frame-gutter), calc((100vw - 1480px) / 2));
  --submission-bar-height: calc(var(--control-height) + var(--space-4) + 1px);
  --toast-inline-inset: calc(var(--frame-edge) + var(--space-3));
  --toast-block-inset: calc(var(--space-2) + var(--space-3));
  --focus-ring: 0 0 0 3px var(--accent-soft);
  --shadow: 0 16px 38px rgba(21, 24, 22, .08);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.desktop-required { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  min-height: 52px; padding: 0 var(--frame-edge); border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 248, .94); backdrop-filter: blur(14px);
}
.brand { display: inline-flex; justify-self: start; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-size: 14px; letter-spacing: 0; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; letter-spacing: 0; text-transform: uppercase; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 4px); align-items: end; gap: 2px; width: 24px; height: 24px; padding: 5px; border: 1px solid var(--ink); background: var(--ink); }
.brand-mark i { display: block; background: var(--accent); }
.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 12px; background: var(--highlight); }
.brand-mark i:nth-child(3) { height: 17px; background: #d9e4d4; }
.topbar-actions { display: flex; justify-self: end; align-items: center; gap: var(--space-1); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status-pill.is-offline .status-dot { background: var(--accent); }

.app-shell { max-width: 1680px; margin: 0 auto; padding: var(--space-3) var(--frame-gutter) 32px; }
.stage-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-self: center; width: min(30vw, 320px); min-width: 252px; gap: 1px; padding: 0; }
.stage-nav button { display: inline-flex; min-width: 0; min-height: var(--control-height); align-items: center; justify-content: center; gap: var(--space-1); padding: 0 var(--space-2); border: 1px solid var(--line-strong); color: var(--ink); background: var(--paper); font-size: 11px; font-weight: 700; white-space: nowrap; }
.stage-index { color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 8px; font-weight: 500; }
.stage-nav button.is-active { border-color: var(--ink); color: #fff; background: var(--ink); }
.stage-nav button.is-active .stage-index { color: var(--highlight); }
.stage-nav button:not(:disabled):active { color: #fff; background: var(--ink); }
.stage-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 4px; border-radius: 9px; color: #fff; background: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; vertical-align: middle; }
.stage-nav button.has-active-generation:not(.is-active) { border-color: var(--accent); }
.stage-nav button.has-active-generation .stage-count { animation: pulse 1s ease-in-out infinite alternate; }
.intro-block { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.eyebrow, .step-label { margin: 0; color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; letter-spacing: 0; }
.title-pair { min-width: 0; }
.intro-block h1 { margin: 16px 0 20px; font-size: clamp(42px, 6vw, 82px); line-height: .98; letter-spacing: 0; font-weight: 720; }
.intro-block h1 em { color: var(--accent); font-style: normal; }
.intro-copy { max-width: 550px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

.workspace-grid { display: grid; grid-template-columns: minmax(260px, 320px) minmax(280px, 360px) minmax(0, 1fr); gap: var(--space-3); align-items: start; }
.control-panel, .results-column { min-width: 0; }
.control-panel { position: relative; overflow: visible; padding: var(--panel-padding); border: 1px solid var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.control-panel .panel-heading { margin: calc(-1 * var(--panel-padding)) calc(-1 * var(--panel-padding)) 0; padding: var(--space-3) var(--space-3) var(--space-2); background: var(--panel); }
.prompt-column { min-width: 0; overflow: visible; }
.workbench-panel { padding: var(--panel-padding); border: 1px solid var(--line-strong); background: var(--surface); }
.panel-heading, .results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.panel-heading h2, .results-heading h2 { margin: 7px 0 0; font-size: 21px; letter-spacing: 0; }
.form-stack { display: grid; align-content: start; gap: var(--space-3); margin-top: var(--space-4); }
.setup-scroll-region { display: grid; min-width: 0; align-content: start; gap: var(--space-3); }
.form-section { display: grid; gap: var(--space-2); min-width: 0; padding-top: 0; border-top: 0; }
.form-section-heading { display: flex; align-items: baseline; gap: 8px; }
.form-section-heading h3 { margin: 0; font-size: 12px; }
.form-section-index { color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.field-group { min-width: 0; }
label, legend { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.form-field { display: grid; min-width: 0; align-content: start; gap: var(--field-gap); margin-bottom: 0; }
.form-field > label, .form-field > legend, label.form-field > span:first-child { margin: 0; }
.form-field > .file-preview { margin-top: 0; }
.field-helper { margin: 0; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.optional { color: var(--muted); font-weight: 500; }
.field-label-inline { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-label-inline > span { flex: 0 0 auto; }
.label-helper { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.input-lock-status { color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; font-weight: 600; letter-spacing: .04em; }
input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 0; color: var(--ink); background: var(--paper); font-size: 11px; outline: none; }
textarea { min-height: 88px; padding: 12px; resize: vertical; line-height: 1.58; }
input, select { min-height: var(--control-height); }
textarea:focus, input:focus, select:focus, .dropzone:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
textarea[readonly] { border-color: var(--line); color: var(--muted); background: var(--surface-strong); cursor: not-allowed; }
input:disabled, select:disabled { border-color: var(--line); color: var(--muted); background: var(--surface-strong); cursor: not-allowed; opacity: 1; }
.select-control:has(select:disabled)::after { color: var(--line-strong); }
select { padding: 0 34px 0 11px; }
.select-control { position: relative; display: block; }
.select-control::after { content: "⌄"; position: absolute; top: 50%; right: 11px; color: var(--muted); font-size: 15px; line-height: 1; transform: translateY(-58%); pointer-events: none; }
.select-control select { appearance: none; padding-right: 34px; }
.helper { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.split-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.output-settings { margin-top: 0; }
.dropzone { display: flex; align-items: center; gap: 12px; min-height: 67px; margin: 0; padding: 12px; border: 1px dashed var(--line-strong); background: var(--paper); cursor: pointer; }
.dropzone.is-disabled { border-color: var(--line); color: var(--muted); background: var(--surface-strong); cursor: not-allowed; }
.dropzone.is-disabled .dropzone-icon { border-color: var(--line-strong); color: var(--muted); }
.dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dropzone-icon { display: grid; flex: 0 0 auto; place-items: center; width: 27px; height: 27px; padding-bottom: 2px; border: 1px solid var(--ink); font-size: 20px; font-weight: 300; line-height: 1; }
.dropzone strong, .dropzone small { display: block; }
.dropzone strong { font-size: 12px; }
.dropzone small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.file-preview { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; margin-top: 8px; padding: 8px; border: 1px solid var(--line); background: var(--paper); }
.file-preview img { width: 48px; height: 48px; object-fit: cover; }
.file-preview strong, .file-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview strong { font-size: 11px; }
.file-preview small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.reference-usage { min-width: 0; margin: 10px 0 0; padding: 0; border: 0; }
.reference-usage legend { margin-bottom: var(--field-gap); }
.reference-usage-options, .content-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.content-mode-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.content-mode-fieldset legend { margin-bottom: var(--field-gap); }
.choice-option { display: flex; min-width: 0; min-height: 48px; align-items: center; gap: 7px; margin: 0; padding: 7px 8px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.choice-option:hover, .choice-option:has(input:checked) { border-color: var(--ink); background: var(--selected-surface); }
.choice-option:active:not(:has(input:disabled)) { background: var(--surface-strong); }
.choice-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-option:has(input:disabled) { border-color: var(--line); color: var(--muted); background: var(--surface-strong); cursor: not-allowed; }
.choice-option input { flex: 0 0 auto; width: 15px; min-height: 15px; margin: 0; accent-color: var(--accent); }
.choice-option span { min-width: 0; }
.choice-option strong, .choice-option small { display: block; letter-spacing: 0; }
.choice-option strong { font-size: 10px; line-height: 1.25; }
.choice-option small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 400; line-height: 1.3; }
.hidden { display: none !important; }
.icon-button { display: grid; width: var(--icon-button-size); height: var(--icon-button-size); place-items: center; padding: 0; border: 1px solid transparent; color: var(--muted); background: transparent; }
.icon-button:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-button:active:not(:disabled) { color: var(--ink); background: var(--surface); }
.icon-button:disabled { cursor: not-allowed; opacity: .55; }
.ui-icon { display: block; width: var(--icon-size); height: var(--icon-size); pointer-events: none; }
.dimension-fieldset { container-type: inline-size; margin: 0; padding: 0; border: 0; }
.dimension-fieldset legend { margin-bottom: var(--field-gap); }
.dimension-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.dimension-option { display: flex; min-width: 0; align-items: center; gap: 8px; min-height: 32px; margin: 0; padding: 4px 9px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.dimension-option:hover, .dimension-option:has(input:checked) { border-color: var(--ink); background: var(--selected-surface); }
.dimension-option input { flex: 0 0 auto; width: 16px; min-height: 16px; margin: 0; accent-color: var(--accent); }
.dimension-option:has(input:disabled) { border-color: var(--line); color: var(--muted); background: var(--surface-strong); cursor: not-allowed; }
.dimension-option span { min-width: 0; overflow: hidden; font-size: 11px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.dimension-option strong { line-height: 1.2; }
.dimension-option small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; line-height: 1.2; }
@container (min-width: 680px) {
  .dimension-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-height: var(--control-height); padding: 0 var(--space-2); border: 1px solid var(--ink); border-radius: 0; color: var(--ink); background: var(--paper); font-size: 12px; font-weight: 700; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: none; background: var(--surface); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-primary { width: 100%; border-color: var(--accent); background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-hover); }
.button-primary:active:not(:disabled) { background: var(--accent-active); }
.button-quiet { min-height: var(--control-height); padding-inline: 12px; border-color: var(--line-strong); color: var(--muted); font-weight: 600; }
.button:focus-visible, .icon-button:focus-visible, .stage-nav button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.setup-action { position: sticky; bottom: 0; z-index: 3; margin: 0 -16px; padding: 0 16px 16px; border-top: 0; background: rgba(242, 245, 239, .96); backdrop-filter: blur(10px); }
.setup-action:has(#editSetupBtn:not(.hidden)) { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.setup-action #editSetupBtn { white-space: nowrap; }
.setup-action .action-hint { display: none; }
.setup-action .prototype-note { display: none; }
.prototype-note { margin: -8px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.action-hint { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; text-align: center; }
.inline-blueprint { margin: 24px -16px -16px; padding: 16px; border-top: 1px solid var(--line-strong); background: var(--surface-strong); }
.inline-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.title-pair h3 { margin: 5px 0 0; font-size: 15px; }
.inline-section-actions { display: flex; align-items: center; gap: 6px; }
.blueprint-toggle { display: none; }
.blueprint-toggle .ui-icon { transition: transform .15s ease; }
.inline-blueprint.is-collapsed .blueprint-toggle .ui-icon { transform: rotate(-90deg); }
.mini-status { color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }
.panel-helper { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.results-column { min-height: 480px; padding: 16px; border: 1px solid var(--line-strong); background: var(--paper); }
.results-heading { padding-bottom: 16px; border-bottom: 1px solid var(--ink); }
.results-heading-actions { display: flex; align-items: center; gap: 10px; }
.board-heading { margin-top: 46px; border-bottom-color: var(--line); }
.result-count { display: inline-grid; place-items: center; min-width: 21px; height: 21px; margin-left: 4px; padding: 0 5px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; vertical-align: 2px; }
.board-hint { padding-top: 0; color: var(--muted); font-size: 11px; }
.blueprint-panel { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 13px 0 0; }
.blueprint-empty { display: grid; justify-items: center; gap: 8px; min-height: 148px; align-content: center; padding: 20px 16px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 11px; line-height: 1.55; text-align: center; }
.blueprint-empty strong { color: var(--ink); font-size: 13px; }
.blueprint-empty span { max-width: 26em; }
.blueprint-block { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: start; gap: 10px; min-height: 0; padding: 11px; border: 1px solid var(--line); background: var(--surface); }
.blueprint-block-index { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line-strong); color: var(--accent); background: var(--paper); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.blueprint-block strong { display: block; margin-bottom: 5px; font-size: 11px; }
.blueprint-block p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.prompt-list { display: grid; gap: 12px; padding: 16px 0; }
.prompt-card { min-width: 0; padding: 16px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.prompt-card:hover { border-color: var(--line-strong); }
.prompt-card.selected { border-color: var(--accent); background: var(--selected-paper); box-shadow: inset 3px 0 0 var(--accent); }
.prompt-card-selector { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; cursor: pointer; }
.prompt-card-selector input { flex: 0 0 16px; width: 16px; min-width: 16px; height: 16px; min-height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.prompt-card-selector span { min-width: 0; flex: 1; }
.prompt-card-selector strong, .prompt-card-selector small { display: block; }
.prompt-card-selector strong { margin-top: 4px; font-size: 15px; line-height: 1.35; }
.prompt-card-selector small { color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.prompt-card-specs { display: grid; gap: 8px; padding: 11px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prompt-card-specs p { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; margin: 0; font-size: 11px; line-height: 1.5; }
.prompt-card-specs strong { color: var(--muted); font-size: 10px; font-weight: 600; }
.prompt-card-specs span { min-width: 0; }
.prompt-exploration-option, .prompt-change-summary { display: block; }
.prompt-exploration-option { color: var(--ink); font-weight: 700; }
.prompt-change-summary { margin-top: 2px; color: var(--muted); }
.locked-line span { color: var(--muted); }
.prompt-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 11px; }
.prompt-card-actions .button { min-height: var(--control-height); width: auto; padding-inline: 12px; }
.prompt-detail-toggle { color: var(--muted); }
.prompt-preview { margin-top: 10px; padding: 11px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; line-height: 1.6; white-space: pre-wrap; cursor: text; }
.generation-body summary { padding: 9px 0; color: var(--muted); font-size: 10px; cursor: pointer; }
.submission-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -16px -16px; padding: 12px 16px; border-top: 1px solid var(--ink); background: rgba(241, 244, 238, .96); backdrop-filter: blur(10px); }
.submission-bar span { color: var(--muted); font-size: 11px; }
.submission-bar strong { color: var(--accent); }
.submission-bar .button { min-width: 112px; width: auto; }
.empty-board.compact-empty { min-height: 190px; margin-top: 12px; }
.empty-board { display: grid; min-height: 300px; align-content: center; justify-items: center; gap: 12px; padding: 32px; border: 1px dashed var(--line-strong); text-align: center; }
.state-marker { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--ink); font-size: 22px; font-weight: 400; line-height: 1; }
.state-copy { display: grid; justify-items: center; gap: 8px; }
.empty-board h3 { margin: 0; font-size: 17px; }
.empty-board p { max-width: 350px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.result-toolbar { display: grid; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.generation-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-strong); }
.generation-overview button { display: flex; min-width: 0; min-height: 30px; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 10px; border: 0; border-right: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); cursor: pointer; }
.generation-overview button:last-child { border-right: 0; }
.generation-overview button[aria-pressed="true"] { color: var(--ink); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.generation-overview button:hover { color: var(--ink); }
.generation-overview span { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.generation-overview strong { flex: 0 0 auto; color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.result-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 130px 180px auto; align-items: center; gap: 8px; }
.result-filters label { min-width: 0; margin: 0; }
.result-filters input, .result-filters select { width: 100%; min-height: var(--control-height); padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 0; color: var(--ink); background: var(--paper); outline: none; }
.result-filters .select-control select { padding-right: 34px; }
.result-filters input:focus, .result-filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.result-filter-clear { width: auto; min-width: 54px; min-height: var(--control-height); padding-inline: 10px; border-color: var(--line-strong); background: var(--paper); }
.generation-feed { display: grid; gap: 12px; padding-top: 12px; }
.generation-batch { position: relative; border: 1px solid var(--line-strong); background: var(--surface); }
.generation-batch-summary { display: flex; min-height: 52px; align-items: center; gap: 12px; padding: 8px 112px 8px 12px; cursor: pointer; list-style: none; }
.generation-batch-summary::-webkit-details-marker { display: none; }
.generation-batch-summary strong, .generation-batch-summary small { display: block; }
.generation-batch-summary strong { font-size: 13px; }
.generation-batch-title { display: flex !important; min-width: 0; align-items: center; gap: 7px; }
.generation-batch-variable { max-width: 140px; padding: 2px 5px; overflow: hidden; border: 1px solid var(--accent); color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 8px; font-weight: 600; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.generation-batch-summary small { margin-top: 4px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.generation-batch-meta { position: absolute; z-index: 1; top: 10px; right: 12px; display: flex; align-items: center; gap: 8px; }
.generation-batch-stats { display: inline; margin-left: 6px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.generation-batch-stats > span + span { margin-left: 6px; }
.generation-batch-stats .is-ready { color: var(--green); }
.generation-batch-stats .is-error { color: var(--danger); }
.generation-batch-delete { flex: 0 0 auto; border-color: var(--line-strong); color: var(--muted); background: var(--paper); font-size: 17px; line-height: 1; }
.generation-batch-delete:hover { border-color: var(--danger); color: var(--danger); }
.generation-batch-delete:disabled { color: var(--muted); background: var(--surface); cursor: not-allowed; opacity: .55; }
.generation-batch-delete:disabled:hover { border-color: var(--line-strong); color: var(--muted); }
.generation-batch-grid { display: grid; grid-template-columns: repeat(var(--result-grid-columns), minmax(min(var(--result-card-min-width), 100%), 1fr)); gap: 12px; padding: 0 12px 12px; }
.generation-card { display: flex; width: 100%; min-width: 0; margin: 0; flex-direction: column; border: 1px solid var(--line-strong); background: var(--paper); }
.generation-card:has(.text-tooltip-trigger.has-overflow:hover), .generation-card:has(.text-tooltip-trigger.has-overflow:focus) { position: relative; z-index: 4; }
.generation-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.generation-card-title { min-width: 0; flex: 1; }
.generation-card-head strong, .generation-card-head small { display: block; }
.generation-card-head strong { font-size: 14px; line-height: 1.35; }
.generation-card-title-tooltip { display: block; width: 100%; min-width: 0; }
.generation-card-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generation-card-title-tooltip > .text-tooltip { top: calc(100% + 7px); bottom: auto; }
.generation-card-title-tooltip > .text-tooltip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: rgba(21,24,22,.92); }
.generation-card-head small { margin-top: 5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.generation-status { display: inline; margin-left: 6px; color: var(--muted); font-size: 8px; line-height: 1.2; vertical-align: middle; }
.generation-status.ready { color: var(--green); }
.generation-status.error { color: var(--danger); }
.generation-card-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
.generation-card-tools .icon-button { border-color: var(--line-strong); background: var(--paper); }
.generation-card-tools .icon-button:disabled { color: var(--muted); background: var(--surface); cursor: not-allowed; opacity: .55; }
.generation-card-tools .icon-button:disabled:hover { border-color: var(--line-strong); color: var(--muted); }
.generation-delete { font-size: 17px; line-height: 1; }
.generation-delete:hover { border-color: var(--danger); color: var(--danger); }
.generation-favorite { font-size: 15px; line-height: 1; }
.generation-favorite.is-active { border-color: var(--warning-line); color: var(--warning); background: var(--warning-soft); }
.generation-art { container-type: size; position: relative; display: grid; height: var(--result-thumbnail-height); min-height: var(--result-thumbnail-height); place-items: center; border-bottom: 1px solid var(--line); overflow: hidden; background: var(--surface); }
.generation-art img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.generation-state { position: relative; z-index: 1; display: grid; max-width: 240px; justify-items: center; gap: 8px; padding: 16px; text-align: center; }
.generation-state .state-marker { width: 36px; height: 36px; color: var(--muted); border-color: var(--line-strong); background: var(--paper); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; }
.generation-state strong { font-size: 12px; }
.generation-state small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.generation-state.loading .state-marker { color: var(--accent); border-color: var(--accent); animation: pulse 1s ease-in-out infinite alternate; }
.generation-state.error .state-marker { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.generation-state .button { min-height: 30px; padding-inline: 10px; font-size: 10px; }
.generation-image-open { position: relative; z-index: 1; display: grid; width: 100%; height: 100%; place-items: center; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.generation-image-frame { display: grid; width: min(100cqw, calc(100cqh * var(--generation-image-ratio))); height: min(100cqh, calc(100cqw / var(--generation-image-ratio))); max-width: 100%; max-height: 100%; place-items: center; box-shadow: 0 0 0 1px rgba(21,24,22,.42); }
.generation-image-frame img { width: 100%; height: 100%; object-fit: contain; }
.generation-image-recovery { position: absolute; z-index: 3; display: none; max-width: 150px; place-items: center; gap: 6px; padding: 12px; color: var(--ink); background: rgba(251,252,248,.94); text-align: center; }
.generation-image-recovery strong { font-size: 11px; }
.generation-image-recovery small { color: var(--muted); font-size: 9px; }
.generation-image-recovery .button { min-height: 28px; padding-inline: 9px; font-size: 10px; }
.generation-image-frame.is-image-error { background: var(--surface); }
.generation-image-frame.is-image-error img { display: none; }
.generation-image-frame.is-image-error .generation-image-recovery { display: grid; }
.generation-ratio-badge { position: absolute; z-index: 2; top: 8px; left: 8px; padding: 4px 6px; border: 1px solid rgba(251,252,248,.72); color: #fff; background: rgba(21,24,22,.78); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; line-height: 1; }
.generation-image-open-label { position: absolute; z-index: 2; right: 8px; bottom: 8px; padding: 5px 7px; border: 1px solid rgba(251,252,248,.72); color: #fff; background: rgba(21,24,22,.78); font-size: 10px; opacity: 0; transform: translateY(3px); transition: opacity .15s ease, transform .15s ease; }
.generation-image-open:hover .generation-image-open-label, .generation-image-open:focus-visible .generation-image-open-label { opacity: 1; transform: translateY(0); }
.generation-body { display: flex; min-width: 0; flex: 1; flex-direction: column; padding: 12px; }
.generation-exploration { display: flex; min-width: 0; align-items: center; gap: 7px; margin-top: 8px; padding: 7px 8px; border: 1px solid var(--line); background: var(--surface); }
.generation-exploration-label { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.generation-exploration-value { min-width: 0; overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.generation-card-summary { display: grid; gap: 5px; margin-top: 8px; }
.generation-card-summary strong { color: var(--muted); font-size: 9px; font-weight: 600; }
.generation-change-tooltip { display: block; width: 100%; min-width: 0; }
.generation-change-text { display: -webkit-box; height: 3.1em; overflow: hidden; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.generation-card-meta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; margin-top: 8px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.generation-card-meta > span { min-width: 0; overflow-wrap: anywhere; }
.generation-card-meta > span:last-child { margin-left: auto; }
.generation-image-diagnostics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.generation-image-cache-error { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: start; padding: 8px 9px; border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent); background: color-mix(in srgb, var(--danger) 7%, var(--paper)); color: var(--ink); }
.generation-image-cache-error strong { min-width: 0; align-self: center; color: var(--danger); line-height: 1.35; }
.generation-image-cache-error-message { grid-column: 1 / -1; min-width: 0; color: var(--muted); line-height: 1.5; }
.generation-image-cache-error-actions { display: flex; grid-column: 2; grid-row: 1; gap: 5px; }
.generation-image-cache-error .button { min-height: 26px; padding-inline: 8px; font-size: 9px; }
.generation-actual-size { color: var(--muted); }
.generation-actual-size.is-match { color: var(--success); }
.generation-actual-size.is-mismatch { color: var(--danger); font-weight: 700; }
.text-tooltip-trigger { position: relative; }
.text-tooltip-trigger.has-overflow { cursor: help; }
.text-tooltip-trigger.has-overflow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.text-tooltip { position: absolute; z-index: 12; bottom: calc(100% + 7px); left: 0; width: min(320px, 100%); padding: 9px 10px; visibility: hidden; color: #fff; background: rgba(21,24,22,.92); box-shadow: 0 8px 20px rgba(21,24,22,.2); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 10px; font-weight: 400; line-height: 1.55; opacity: 0; pointer-events: none; transform: translateY(3px); transition: opacity .15s ease, transform .15s ease, visibility .15s ease; white-space: normal; }
.text-tooltip::after { position: absolute; top: 100%; left: 14px; border: 5px solid transparent; border-top-color: rgba(21,24,22,.92); content: ""; }
.text-tooltip-trigger.has-overflow:hover > .text-tooltip, .text-tooltip-trigger.has-overflow:focus > .text-tooltip { visibility: visible; opacity: 1; transform: translateY(0); }
.text-tooltip strong, .text-tooltip small { display: block; }
.text-tooltip strong { margin-bottom: 3px; font-size: 9px; }
.text-tooltip > span { display: block; overflow-wrap: anywhere; }
.text-tooltip small { margin-top: 6px; color: rgba(255,255,255,.72); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; overflow-wrap: anywhere; }
.generation-error-tooltip-trigger { display: flex; width: 100%; min-width: 0; align-items: baseline; gap: 5px; color: var(--danger); }
.generation-error-tooltip-trigger.has-overflow:hover .generation-error-summary, .generation-error-tooltip-trigger.has-overflow:focus .generation-error-summary { text-decoration: underline; text-underline-offset: 2px; }
.generation-error-label { flex: 0 0 auto; font-weight: 700; }
.generation-error-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generation-progress { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px; border: 1px solid var(--line); background: var(--surface); }
.generation-progress strong, .generation-progress small { display: block; }
.generation-progress strong { font-size: 10px; }
.generation-progress small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.generation-task-id { display: block; margin-top: 3px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, monospace; }
.generation-elapsed { color: var(--ink); font-variant-numeric: tabular-nums; }
.generation-spinner { width: 16px; height: 16px; flex: 0 0 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.generation-prompt-snapshot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.generation-prompt-snapshot > .prompt-preview { box-sizing: border-box; height: 96px; max-height: none; margin-top: 0; padding: 8px; }
.generation-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, var(--control-height)); gap: 8px; margin-top: auto; padding-top: 8px; }
.generation-actions .button { width: 100%; min-width: 0; height: var(--control-height); min-height: 0; padding-inline: 7px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.generation-actions .button:disabled { border-color: var(--line); color: var(--muted); background: var(--surface-strong); opacity: .7; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.variant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 16px; }
.variant-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line-strong); background: var(--paper); transition: border-color .15s ease, box-shadow .15s ease; }
.variant-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.variant-card-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.variant-card-head strong { font-size: 13px; }
.variant-card-head small { color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }
.mock-art { position: relative; display: grid; place-items: center; min-height: 205px; overflow: hidden; border-bottom: 1px solid var(--line); }
.mock-art::before, .mock-art::after { content: ""; position: absolute; border: 1px solid rgba(21,24,22,.25); }
.mock-art::before { width: 58%; height: 58%; transform: rotate(-8deg); }
.mock-art::after { width: 30%; height: 30%; transform: rotate(20deg); }
.mock-art span { position: relative; z-index: 1; padding: 6px 8px; border: 1px solid var(--ink); background: rgba(251,252,248,.8); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; }
.art-editorial { background: var(--art-editorial); }
.art-retro { background: var(--art-retro); }
.art-future { background: var(--art-future); }
.art-lifestyle { background: var(--art-lifestyle); }
.variant-body { display: grid; gap: 12px; padding: 16px; }
.changed-line, .locked-line { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.changed-line strong, .locked-line strong { color: var(--ink); }
.prompt-preview { max-height: 112px; overflow: auto; padding: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.variant-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.variant-actions .button { min-width: 0; padding-inline: 8px; font-size: 11px; }
.variant-actions .button-primary { grid-column: 1 / -1; }
.toast { position: fixed; right: var(--toast-inline-inset); bottom: var(--toast-block-inset); z-index: 20; display: flex; max-width: 320px; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--ink); color: #fff; background: var(--ink); font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.has-action { pointer-events: auto; }
.toast button { min-width: 44px; min-height: var(--control-height); padding: 0; border: 0; border-bottom: 1px solid currentColor; color: var(--highlight); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
body:has(#promptStage.is-stage-active) .toast { bottom: calc(var(--toast-block-inset) + var(--submission-bar-height)); }
.button-danger { border-color: var(--danger); color: #fff; background: var(--danger); }
.button-danger:hover { background: var(--danger-strong); }
.confirm-dialog { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--ink); border-radius: 0; color: var(--ink); background: var(--paper); box-shadow: 0 24px 70px rgba(21, 24, 22, .24); overflow: hidden; }
.confirm-dialog::backdrop { background: rgba(21, 24, 22, .48); backdrop-filter: blur(3px); }
.confirm-dialog-body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; max-height: calc(100dvh - 50px); padding: var(--dialog-padding); }
.confirm-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.confirm-dialog-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.dialog-close { width: var(--icon-button-size); height: var(--icon-button-size); flex: 0 0 var(--icon-button-size); margin: -4px -4px 0 0; border-color: var(--line-strong); background: var(--paper); }
.dialog-close:hover { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.confirm-dialog h2 { margin: 6px 0 0; font-size: 20px; }
.dialog-meta { display: block; margin-top: 3px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; font-weight: 400; }
.confirm-dialog p { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.confirm-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.confirm-dialog-actions.image-recovery-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.image-preview-dialog { width: min(1120px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--ink); color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(21,24,22,.32); }
.image-preview-dialog::backdrop { background: rgba(21,24,22,.72); backdrop-filter: blur(4px); }
.image-preview-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100dvh - 50px); overflow: hidden; }
.image-preview-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label ." "title actions" "meta ."; align-items: center; column-gap: 16px; row-gap: 2px; padding: 12px 16px; border-bottom: 1px solid var(--line-strong); background: var(--paper); }
.image-preview-head > .step-label { grid-area: label; }
.image-preview-head h2 { grid-area: title; margin: 0; font-size: 17px; }
.image-preview-head small { grid-area: meta; display: block; margin: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.image-preview-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.image-preview-head > .image-preview-actions { grid-area: actions; }
.image-preview-actions .button { min-height: var(--control-height); padding-inline: 11px; }
.image-preview-actions .dialog-close { margin: 0; }
.image-preview-stage { display: grid; min-height: 0; place-items: center; padding: 16px; overflow: auto; background: #151816; }
.image-preview-stage img { display: block; max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; }
.comparison-dialog { width: min(1180px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--ink); color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(21,24,22,.32); }
.comparison-dialog::backdrop { background: rgba(21,24,22,.72); backdrop-filter: blur(4px); }
.comparison-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100dvh - 50px); overflow: hidden; }
.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; min-height: 0; padding: 16px; overflow: auto; background: var(--surface); }
.comparison-item { display: grid; align-content: start; min-width: 0; border: 1px solid var(--line-strong); background: var(--paper); }
.comparison-item.is-favorite { border-color: var(--warning-line); box-shadow: inset 0 0 0 1px var(--warning-line); }
.comparison-image { display: grid; width: 100%; height: clamp(260px, 48vh, 460px); min-height: 0; place-items: center; padding: 0; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); background: #151816; cursor: zoom-in; }
.comparison-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
.comparison-caption { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px; }
.comparison-caption strong, .comparison-caption small { display: block; }
.comparison-caption strong { font-size: 12px; }
.comparison-caption small { margin-top: 4px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.comparison-favorite { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; color: var(--warning); }
.api-dialog { width: min(560px, calc(100vw - 32px)); }
.api-dialog-title-row { display: flex; min-width: 0; align-items: center; gap: 8px; }
.api-dialog-title-row h2 { flex: 0 0 auto; }
.dialog-title-action { display: inline-flex; min-height: 28px; align-items: center; margin-top: 3px; padding: 0 4px; border: 0; color: var(--accent); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.dialog-title-action:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.dialog-title-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dialog-title-action:disabled { color: var(--muted); cursor: wait; text-decoration: none; }
.history-dialog { width: min(520px, calc(100vw - 32px)); }
.history-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.history-stats div { display: grid; gap: 4px; padding: 8px; border: 1px solid var(--line); background: var(--surface); }
.history-stats strong { font-size: 18px; }
.history-stats span { color: var(--muted); font-size: 10px; }
.history-retention { margin-top: 16px; }
.history-cleanup-hint { min-height: 19px; }
.api-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.api-provider-group { display: grid; align-content: start; gap: 12px; padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.api-provider-heading { display: grid; gap: 5px; padding-bottom: 10px; border-bottom: 1px solid var(--line-strong); }
.api-provider-heading h3 { margin: 0; font-size: 14px; }
.api-test-status { min-height: 13px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; line-height: 1.4; text-align: left; overflow-wrap: anywhere; }
.api-test-status.is-testing { color: var(--muted); }
.api-test-status.is-success { color: var(--success); }
.api-test-status.is-warning { color: var(--warning); }
.api-test-status.is-error { color: var(--danger); font-weight: 700; }
.image-diagnostic-panel { border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-soft); }
.image-diagnostic-panel summary { display: flex; cursor: pointer; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 10px 12px; list-style: none; }
.image-diagnostic-panel summary::-webkit-details-marker { display: none; }
.image-diagnostic-panel summary strong { color: var(--text); font-size: 11px; }
.image-diagnostic-panel summary span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; }
.image-diagnostic-panel dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; margin: 0; border-top: 1px solid var(--line); padding: 12px; }
.image-diagnostic-panel dl div { min-width: 0; }
.image-diagnostic-panel dt { color: var(--muted); font-size: 9px; line-height: 1.4; }
.image-diagnostic-panel dd { margin: 2px 0 0; color: var(--text); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.image-diagnostic-panel .image-diagnostic-error { grid-column: 1 / -1; }
.api-settings-grid label { margin: 0; }
.api-settings-grid input { padding: 0 10px; }
.api-key-control { position: relative; display: block; min-width: 0; }
.api-key-control input { padding-right: 48px; }
.api-key-visibility { position: absolute; top: 0; right: 0; display: inline-flex; min-width: 44px; min-height: var(--control-height); align-items: center; justify-content: center; padding: 0 8px; border: 1px solid var(--line-strong); border-left-color: var(--line); color: var(--muted); background: transparent; font-size: 9px; font-weight: 700; }
.api-key-visibility:hover { color: var(--accent); background: var(--surface); }
.api-key-visibility:active { color: var(--ink); background: var(--surface-strong); }
.api-key-visibility:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.api-key-visibility[aria-pressed="true"] { color: var(--accent); }
.form-field-label-row { display: flex; align-items: baseline; gap: 6px; }
.api-provider-group .form-field-label-row small { display: inline; margin: 0; color: var(--muted); font-size: 9px; font-weight: 400; }
.api-provider-group small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.api-provider-group .field-error { color: var(--danger); font-weight: 700; }
.api-protocol-summary { margin-top: 12px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); }
.api-protocol-summary summary { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.api-protocol-summary summary strong { font-size: 11px; }
.api-protocol-summary summary span { color: var(--muted); font-size: 9px; }
.api-protocol-summary dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.api-protocol-summary dl div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 6px; min-width: 0; }
.api-protocol-summary dt, .api-protocol-summary dd { margin: 0; font-size: 9px; line-height: 1.5; }
.api-protocol-summary dt { color: var(--muted); }
.api-protocol-summary dd { min-width: 0; overflow-wrap: anywhere; }
.api-protocol-summary code { font-family: ui-monospace, SFMono-Regular, monospace; }
.brand-attribution { display: grid; gap: 3px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 9px; font-weight: 400; line-height: 1.5; }
.brand-attribution strong { color: var(--ink); font-size: 10px; }

@media (min-width: 900px) {
  body { height: 100dvh; overflow: hidden; }
  .app-shell { display: grid; grid-template-rows: minmax(0, 1fr); height: calc(100dvh - 52px); padding-bottom: 12px; overflow: hidden; }
  .workspace-grid { display: block; width: 100%; max-width: 1480px; min-height: 0; margin: 0 auto; overflow: hidden; }
  .workspace-grid > [id] { display: none; overflow: hidden; }
  .workspace-grid > .is-stage-active { display: block; height: 100%; overflow: hidden; overscroll-behavior: contain; }
  .workspace-grid > .control-panel.is-stage-active { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); grid-template-rows: auto minmax(0, 1fr); gap: 0 24px; max-width: 1480px; margin: 0 auto; overflow: hidden; }
  .control-panel .panel-heading { grid-column: 1 / -1; margin: -8px -16px 0; padding: 8px 16px; }
  .panel-heading .title-pair, .results-heading .title-pair { display: grid; gap: 2px; }
  .control-panel .panel-heading h2, .results-heading h2 { margin: 0; font-size: 18px; }
  .control-panel .form-stack { min-height: 0; grid-column: 1; grid-template-rows: minmax(0, 1fr) auto; align-content: stretch; gap: 0; margin-top: 12px; overflow: hidden; }
  .control-panel .setup-scroll-region { min-height: 0; padding-right: 8px; padding-bottom: 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .control-panel .setup-action { position: static; margin: 0; padding: 12px 8px 16px 0; background: var(--panel); backdrop-filter: none; }
  .control-panel .inline-blueprint { position: static; min-height: 0; grid-column: 2; align-self: stretch; margin: 12px 0 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line-strong); }
  .prompt-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prompt-column, .results-column { width: 100%; }
  .prompt-column.is-stage-active { display: grid; min-height: 0; }
  .prompt-column.is-stage-active .workbench-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-height: 0; height: 100%; overflow: hidden; }
  .prompt-scroll-region, .result-scroll-region { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .prompt-scroll-region .prompt-list { min-height: 100%; align-content: start; padding-bottom: 16px; }
  .prompt-column .submission-bar { position: static; margin: 0 -16px -16px; }
  .results-column.is-stage-active { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; overflow: hidden; }
  .empty-board { max-width: 960px; margin-inline: auto; }
}
@media (max-width: 899px) {
  body { min-width: 0; background: var(--surface); }
  body > .topbar, body > .app-shell, body > dialog, body > .toast { display: none !important; }
  .desktop-required { display: grid; min-height: 100dvh; place-content: center; justify-items: start; gap: 10px; max-width: 560px; margin: 0 auto; padding: 32px 24px; }
  .desktop-required-mark { margin-bottom: 16px; }
  .desktop-required p { margin: 0; color: var(--accent); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; }
  .desktop-required h1 { max-width: 12em; margin: 0; font-size: clamp(26px, 8vw, 38px); line-height: 1.2; letter-spacing: 0; }
  .desktop-required-copy { color: var(--muted); font-size: 14px; line-height: 1.6; }
  .desktop-required-owner { margin-top: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; line-height: 1.4; }
}
@media (min-width: 1180px) {
  :root { --result-grid-columns: 4; }
  .prompt-list[data-count="3"], .prompt-list[data-count="5"], .prompt-list[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-toolbar { grid-template-columns: minmax(300px, .68fr) minmax(0, 1.32fr); align-items: start; }
}
@media (min-width: 1540px) {
  :root { --result-grid-columns: 5; }
}
@media (min-width: 900px) and (max-width: 1280px) {
  .workspace-grid { grid-template-columns: minmax(248px, 290px) minmax(270px, 320px) minmax(340px, 1fr); gap: 12px; }
  .control-panel, .workbench-panel, .results-column { padding: 16px; }
  .control-panel .panel-heading { margin: -8px -16px 0; padding: 8px 16px; }
  .setup-action { margin-inline: -16px; padding: 12px 16px 16px; }
  .submission-bar { bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px; }
  .panel-heading h2, .results-heading h2 { font-size: 18px; }
}
@media (max-width: 600px) {
  .topbar { min-height: 50px; padding-inline: 12px; }
  .brand small, .status-pill { display: none; }
  .app-shell { padding: 12px 12px 24px; }
  .stage-nav { margin: 0; }
  .stage-nav button { min-height: var(--control-height); padding: 0 8px; }
  #setupStage, #promptStage, #resultStage { scroll-margin-top: 108px; }
  .control-panel { padding: 16px; }
  .setup-action { padding: 0; border-top: 0; }
  .setup-action .button-primary { min-height: var(--control-height); }
  .setup-action .action-hint { margin: 8px 0 0; }
  .setup-action .prototype-note { margin: 4px 0 0; }
  .workspace-grid { grid-template-columns: 1fr; }
  .form-stack { gap: 12px; margin-top: 22px; }
  .inline-blueprint { margin-top: 16px; }
  .blueprint-toggle { display: grid; place-items: center; width: 40px; height: 40px; }
  .inline-blueprint.is-collapsed { padding-bottom: 12px; }
  .inline-blueprint.is-collapsed .blueprint-panel { display: none; }
  .control-panel, .prompt-column, .results-column { grid-column: auto; grid-row: auto; }
  .prompt-column { max-height: none; }
  .split-fields, .blueprint-panel, .variant-grid { grid-template-columns: 1fr; }
  .generation-batch-grid { grid-template-columns: 1fr; }
  .generation-batch-summary { align-items: flex-start; gap: 10px; }
  .generation-batch-meta { align-items: flex-start; gap: 4px; }
  .generation-batch-stats { white-space: normal; }
  .compact-empty { min-height: 150px; }
  .empty-board { min-height: 220px; padding: 24px 16px; }
  .board-hint { display: none; }
  .results-heading-actions { gap: 0; }
  .results-heading-actions .button { min-height: var(--control-height); }
  .history-stats { grid-template-columns: repeat(2, 1fr); }
  .result-filters { grid-template-columns: 1fr 1fr auto; }
  .result-search { grid-column: 1 / -1; }
  .variant-grid { gap: 12px; }
  .confirm-dialog-actions { grid-template-columns: 1fr; }
  .api-settings-grid { grid-template-columns: 1fr; }
  .api-protocol-summary summary { align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; padding-block: 6px; }
  .api-protocol-summary dl { grid-template-columns: 1fr; }
  .api-dialog .confirm-dialog-actions { display: flex; flex-direction: column-reverse; }
  .confirm-dialog-actions .button { min-height: var(--control-height); }
}
