/* Shared image workspace. Keep navigation visible and image controls off the canvas. */
.ib-entry { display: flex; justify-content: center; margin: -8px 0 24px; }
.ib-mode-switch { display: inline-flex; align-items: center; padding: 4px; gap: 3px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); flex-shrink: 0; }
.ib-mode-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 17px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 550 13px var(--font); cursor: pointer; white-space: nowrap; }
.ib-mode-button[aria-pressed="true"] { color: var(--text); background: var(--panel); box-shadow: 0 1px 4px #0000000a; }
.ib-mode-button:hover { color: var(--accent); }
.ib-mode-button svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.7; }
.ib-entry .ib-mode-switch { box-shadow: var(--card-shadow); background: color-mix(in srgb, var(--panel) 65%, var(--surface)); }
.ib-workspace { min-height: 0; flex: 1; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.ib-workspace *, .ib-picker *, .ib-workspace *::before, .ib-picker *::before { box-sizing: border-box; }
.ib-workspace [hidden], .ib-picker [hidden] { display: none !important; }
.ib-workspace :is(button,input,textarea,select), .ib-picker :is(button,input,select) { font-family: var(--font); }
.ib-workspace :is(button,a,select), .ib-picker :is(button,a,select) { touch-action: manipulation; }
.ib-workspace :is(button,a,input,textarea,select,summary):focus-visible, .ib-picker :is(button,a,input,select):focus-visible, .ib-entry :is(button,a):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ib-workspace button:disabled, .ib-picker button:disabled { opacity: .46; cursor: not-allowed; }
.ib-toolbar { min-height: 82px; padding: 16px 152px 16px 30px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--panel) 62%, var(--bg)); }
.ib-identity { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 650; white-space: nowrap; }
.ib-identity svg { width: 20px; height: 20px; stroke: var(--soft); stroke-width: 1.6; }
.ib-toolbar-actions { display: flex; align-items: center; margin-left: auto; gap: 5px; }
.ib-button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 10px 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel); color: var(--soft); font: 550 13px var(--font); cursor: pointer; transition: background .16s, border-color .16s, color .16s; }
.ib-button svg, .ib-card-actions svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ib-button:hover { background: var(--surface); border-color: color-mix(in srgb, var(--muted) 40%, var(--border)); }
.ib-button.ib-mode-button { min-height: 40px; border: 0; padding: 9px 15px; background: transparent; color: var(--muted); }
.ib-button.ib-mode-button[aria-pressed="true"] { background: var(--panel); color: var(--text); }
.ib-quiet { background: transparent; border-color: transparent; }
.ib-quiet:hover { border-color: transparent; }
.ib-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
.ib-content { width: min(1180px, 100%); margin: 0 auto; padding: 46px 36px 80px; }
.ib-form { max-width: 870px; margin: 0 auto; }
.ib-hero { margin: 0 0 30px; }
.ib-eyebrow { display: block; color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .7px; margin-bottom: 10px; }
.ib-hero h1 { margin: 0 0 12px; font-size: clamp(26px, 2.6vw, 34px); letter-spacing: -1.1px; font-weight: 660; line-height: 1.3; }
.ib-hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.ib-editor { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--card-shadow); overflow: hidden; transition: border-color .16s; }
.ib-editor:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.ib-editor-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 0; }
.ib-field-title { font-size: 14px; font-weight: 630; line-height: 1.5; margin: 0; }
.ib-prompt-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ib-prompt { display: block; width: 100%; min-height: 155px; max-height: 430px; resize: vertical; background: transparent; border: 0; outline: none; padding: 15px 24px 20px; color: var(--text); font-size: 15px; line-height: 1.8; }
.ib-prompt::placeholder { color: var(--muted); opacity: .8; }
.ib-workspace .ib-prompt:focus-visible { outline-offset: -4px; outline: none; }
.ib-editor-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 24px; padding: 14px 0; border-top: 1px solid var(--hairline); }
.ib-ratio-field { display: flex; align-items: center; gap: 10px; }
.ib-ratio-field label, .ib-editor-note { font-size: 12px; color: var(--muted); }
.ib-select { cursor: pointer; min-height: 38px; max-width: 100%; border: 1px solid var(--border); border-radius: 9px; color: var(--soft); background: var(--panel); padding: 8px 11px; font-size: 12px; }
.ib-selection { margin: 26px 0; }
.ib-selection-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ib-selection-title { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.ib-selection-note { font-size: 12px; color: var(--muted); }
.ib-choose { background: transparent; border-color: transparent; color: var(--accent); padding: 8px 0 8px 12px; }
.ib-choose:hover { background: transparent; border-color: transparent; color: var(--text); }
.ib-selected-models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ib-selected { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px 6px 12px 13px; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; }
.ib-brand { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; background: var(--surface); font-size: 14px; font-weight: 650; }
.ib-brand .bot-ico { width: 32px; height: 32px; border-radius: 9px; }
.ib-brand .mod-badge { display: none; }
.ib-selected-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ib-selected-copy strong { font-size: 12px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.ib-selected-copy small { font-size: 11px; color: var(--muted); }
.ib-remove { margin-left: auto; width: 36px; min-height: 44px; padding: 8px; border: 0; background: transparent; color: var(--muted); flex-shrink: 0; }
.ib-remove svg { width: 14px; height: 14px; }
.ib-remove span:empty { display: none; }
.ib-selection-empty { width: 100%; min-height: 82px; border: 1px dashed var(--border); background: transparent; color: var(--muted); grid-column: 1 / -1; }
.ib-selection-empty:hover { border-color: var(--accent); color: var(--accent); }
.ib-hint { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0; }
.ib-selection > .ib-hint { margin-top: 12px; }
.ib-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0 0; border-top: 1px solid var(--border); }
.ib-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px 10px; }
.ib-total-caption { font-size: 12px; color: var(--muted); }
.ib-total strong { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ib-total small { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.ib-submit { background: var(--accent); border-color: transparent; color: #fff; min-height: 48px; padding: 13px 22px; font-weight: 600; white-space: nowrap; }
.ib-submit:hover { background: var(--accent); border-color: transparent; filter: brightness(1.08); }
.ib-form .ib-submit { flex-direction: row-reverse; gap: 15px; min-width: 190px; }
.ib-error { padding: 12px 16px; margin: 0 0 18px; border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border)); border-radius: 10px; color: var(--danger); background: color-mix(in srgb, var(--danger) 4%, var(--panel)); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.ib-recent { margin: 48px auto 0; max-width: 870px; }
.ib-recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ib-recent-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.ib-history-card { display: flex; width: 100%; gap: 12px; text-align: left; padding: 14px; min-width: 0; }
.ib-history-symbol { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; color: var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.ib-history-symbol svg { width: 18px; height: 18px; }
.ib-history-copy { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.ib-history-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; font-weight: 560; }
.ib-history-copy small { font-size: 11px; font-weight: 400; color: var(--muted); }
.ib-history-card > svg { width: 15px; height: 15px; color: var(--muted); }
.ib-history-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 28px; }
.ib-history-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); max-height: 340px; overflow-y: auto; gap: 8px; margin-top: 14px; }
.ib-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.ib-result-intro { min-width: 0; }
.ib-result-head h1 { margin: 0 0 14px; font-size: 24px; line-height: 1.45; font-weight: 650; letter-spacing: -.6px; overflow-wrap: anywhere; }
.ib-result-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 16px; color: var(--muted); font-size: 12px; }
.ib-batch-status { display: flex; align-items: center; gap: 6px; color: var(--soft); }
.ib-batch-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.ib-batch-status[data-active="true"]::before { background: var(--accent); }
.ib-result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 330px; flex-shrink: 0; }
.ib-download-all { color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 18%, var(--border)); }
.ib-prompt-detail { padding: 17px 20px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); margin: 0 0 28px; }
.ib-prompt-detail summary { display: flex; align-items: center; gap: 15px; cursor: pointer; min-height: 28px; list-style: none; }
.ib-prompt-detail summary::-webkit-details-marker { display: none; }
.ib-prompt-detail .ib-field-title { font-size: 12px; flex-shrink: 0; }
.ib-prompt-preview { font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.ib-prompt-expand { margin-left: auto; font-size: 12px; color: var(--accent); flex-shrink: 0; }
.ib-prompt-detail[open] .ib-prompt-preview { visibility: hidden; }
.ib-prompt-detail[open] .ib-prompt-expand { font-size: 0; }
.ib-prompt-detail[open] .ib-prompt-expand::after { content: '收起'; font-size: 12px; }
.ib-prompt-detail > p { margin: 14px 0 0; font-size: 13px; line-height: 1.8; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.ib-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--panel); }
.ib-card-head { display: flex; align-items: center; gap: 9px; padding: 16px 15px 0; }
.ib-card-head h2 { margin: 0; font-size: 12px; font-weight: 630; line-height: 1.45; overflow-wrap: anywhere; }
.ib-card-head .ib-brand, .ib-card-head .bot-ico { width: 27px; height: 27px; border-radius: 8px; }
.ib-card-body { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px; }
.ib-status, .ib-card-cost { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ib-status[data-status="failed"], .ib-status[data-status="error"] { color: var(--danger); }
.ib-status[data-status="running"], .ib-status[data-status="generating"] { color: var(--accent); }
.ib-card-visual { display: grid; place-items: center; position: relative; aspect-ratio: 1; overflow: hidden; background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.ib-card-visual > a { display: block; position: absolute; inset: 0; height: 100%; width: 100%; }
.ib-card-visual img { display: block; height: 100%; width: 100%; object-fit: contain; }
.ib-placeholder { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 22px; gap: 11px; color: var(--muted); text-align: center; overflow: auto; max-height: 100%; }
.ib-placeholder > svg { flex-shrink: 0; width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.3; margin-bottom: 3px; opacity: .65; }
.ib-placeholder strong { font-size: 13px; font-weight: 550; }
.ib-placeholder small { font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.ib-placeholder progress { width: min(160px,100%); height: 4px; margin-top: 3px; accent-color: var(--accent); }
.ib-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; }
.ib-card-actions :is(a,button) { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--soft); min-height: 44px; padding: 9px 5px; border: 0; background: transparent; text-decoration: none; }
.ib-card-actions :is(a,button):hover { color: var(--accent); }
.ib-card-actions svg { width: 14px; height: 14px; }
.ib-card-continue { flex-direction: row-reverse; }
.ib-card-note { display: block; min-height: 44px; padding: 14px 6px; color: var(--muted); font-size: 11px; }
.ib-background-note { margin: 24px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.ib-empty { padding: 28px 14px; color: var(--muted); font-size: 13px; line-height: 1.7; text-align: center; grid-column: 1 / -1; }
/* Model selection is a focused, bounded picker rather than an entire app in a modal. */
.ib-picker { width: min(600px, calc(100vw - 32px)); max-width: none; height: min(720px,calc(100dvh - 72px)); max-height: none; padding: 0; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); color: var(--text); box-shadow: var(--shadow-pop); font-family: var(--font); overflow: hidden; }
.ib-picker[open] { display: flex; flex-direction: column; }
.ib-picker::backdrop { background: var(--overlay-bg); backdrop-filter: blur(3px); }
.ib-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px 24px; }
.ib-picker-head h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.3px; }
.ib-icon-button { width: 44px; padding: 10px; background: transparent; border: 0; }
.ib-icon-button span:empty { display: none; }
.ib-search { display: flex; align-items: center; gap: 10px; margin: 0 24px 14px; padding: 0 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); flex-shrink: 0; }
.ib-search svg { height: 18px; width: 18px; color: var(--muted); stroke: currentColor; stroke-width: 1.7; flex-shrink: 0; }
.ib-search input { border: 0; background: transparent; outline: none; color: var(--text); font-size: 14px; min-height: 46px; min-width: 0; width: 100%; }
.ib-search:focus-within { border-color: var(--accent); }
.ib-brands { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 24px 12px; }
.ib-brand-tab { padding: 7px 11px; min-height: 36px; border-radius: 8px; border-color: transparent; background: transparent; font-size: 12px; }
.ib-brand-tab[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); color: var(--accent); }
.ib-picker-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 24px 7px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 12px; }
.ib-picker-tools > div { display: flex; gap: 4px; }
.ib-text-button { padding: 8px 6px; font-size: 12px; border: 0; background: transparent; }
.ib-models { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 12px; }
.ib-model { position: relative; display: flex; align-items: center; gap: 12px; min-height: 75px; padding: 13px 14px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; margin-bottom: 4px; }
.ib-model:hover { background: var(--surface); }
.ib-model[data-selected="true"] { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.ib-model[data-unavailable="true"] { opacity: .6; cursor: not-allowed; }
.ib-model input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.ib-model:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.ib-model-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.ib-model-name { color: var(--text); font-size: 13px; font-weight: 550; line-height: 1.5; overflow-wrap: anywhere; }
.ib-model-price { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.ib-model-check { display: grid; place-items: center; width: 21px; height: 21px; border: 1px solid var(--border); border-radius: 50%; flex-shrink: 0; }
.ib-model-check svg { width: 13px; height: 13px; stroke: transparent; stroke-width: 2.2; }
.ib-model[data-selected="true"] .ib-model-check { background: var(--accent); border-color: var(--accent); }
.ib-model[data-selected="true"] .ib-model-check svg { stroke: #fff; }
.ib-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--panel); }
@media (max-width: 1200px) {
  .ib-toolbar { gap: 15px; padding-left: 24px; }
  .ib-identity { display: none; }
  .ib-content { padding-inline: 28px; }
  .ib-selected-models { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ib-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .ib-toolbar { min-height: 120px; padding: 15px 18px 12px; flex-wrap: wrap; gap: 8px; }
  .ib-toolbar .ib-mode-switch { margin-right: 100px; }
  .ib-toolbar-actions { margin-left: 0; }
  .ib-toolbar-actions .ib-button { padding: 8px 10px; min-height: 36px; font-size: 12px; }
  .ib-content { padding: 30px 22px 60px; }
  .ib-hero { margin-bottom: 24px; }
  .ib-result-head { flex-direction: column; gap: 18px; }
  .ib-result-actions { justify-content: flex-start; max-width: none; }
  .ib-result-head h1 { font-size: 21px; }
  .ib-grid { gap: 14px; }
  .ib-recent-list, .ib-history-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .ib-entry { margin-bottom: 20px; }
  .ib-mode-button { min-height: 44px; padding-inline: 14px; font-size: 12px; }
  .ib-toolbar { padding: 66px 16px 12px; min-height: 0; }
  .ib-toolbar .ib-mode-switch { margin-right: 0; width: 100%; }
  .ib-toolbar .ib-mode-button { flex: 1; min-height: 40px; padding-inline: 9px; font-size: 12px; }
  .ib-toolbar-actions { margin-left: auto; }
  .ib-content { padding: 28px 16px 48px; }
  .ib-hero h1 { font-size: 25px; }
  .ib-hero p { font-size: 13px; }
  .ib-editor { border-radius: 16px; }
  .ib-editor-top { padding: 17px 17px 0; }
  .ib-prompt { padding: 14px 17px; font-size: 16px; min-height: 165px; }
  .ib-editor-bottom { margin-inline: 17px; flex-wrap: wrap; gap: 8px; }
  .ib-editor-note { font-size: 11px; }
  .ib-selection-title { gap: 3px; flex-direction: column; align-items: flex-start; }
  .ib-selection-note { font-size: 11px; }
  .ib-selected-models { grid-template-columns: 1fr; gap: 8px; }
  .ib-selected { padding-block: 8px; }
  .ib-selected-copy { flex: 1; flex-direction: row; align-items: center; justify-content: space-between; gap: 9px; }
  .ib-selected-copy strong { font-size: 12px; }
  .ib-selected-copy small { white-space: nowrap; }
  .ib-remove { width: 34px; }
  .ib-footer { align-items: stretch; flex-direction: column; gap: 16px; }
  .ib-form .ib-submit { min-height: 50px; width: 100%; }
  .ib-total strong { font-size: 18px; }
  .ib-recent { margin-top: 36px; }
  .ib-grid { grid-template-columns: 1fr; gap: 18px; }
  .ib-card-head h2 { font-size: 13px; }
  .ib-card-body { padding-block: 13px; }
  .ib-card-actions :is(a,button) { font-size: 12px; padding-inline: 8px; }
  .ib-prompt-detail { padding: 14px 15px; }
  .ib-prompt-detail summary { gap: 10px; }
  .ib-result-actions { gap: 6px; }
  .ib-result-actions .ib-button { padding-inline: 12px; font-size: 12px; }
  .ib-picker { width: calc(100vw - 20px); height: calc(100dvh - 36px); border-radius: 17px; }
  .ib-picker-head { padding: 14px 13px 10px 18px; }
  .ib-picker-head h2 { font-size: 18px; }
  .ib-search { margin-inline: 18px; }
  .ib-search input { font-size: 16px; }
  .ib-brands { padding-inline: 15px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; flex-shrink: 0; }
  .ib-brand-tab { white-space: nowrap; flex-shrink: 0; min-height: 44px; padding: 8px 11px; }
  .ib-picker-tools { padding-inline: 18px; }
  .ib-models { padding-inline: 9px; }
  .ib-model { gap: 10px; padding-inline: 10px; }
  .ib-picker-footer { padding: 14px 18px max(14px,env(safe-area-inset-bottom)); gap: 12px; }
  .ib-picker-footer .ib-hint { max-width: 140px; font-size: 11px; }
  .ib-picker-footer .ib-submit { padding-inline: 15px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ib-workspace *, .ib-picker *, .ib-entry * { transition: none !important; scroll-behavior: auto !important; animation: none !important; }
  .ib-picker::backdrop { backdrop-filter: none; }
}
