@import "../studio-warm-20260921/tokens.css";
@import "./thinking-state.css";

:root {
  color-scheme: light;
  --ink: var(--color-ink);
  --muted: var(--color-muted);
  --line: var(--color-hairline);
  --paper: var(--color-canvas);
  --accent: var(--color-primary-active);
  --tint: var(--color-surface-card);
  --accent-hover: color-mix(in srgb, var(--color-primary-active) 86%, var(--color-ink));
  --error-tint: color-mix(in srgb, var(--color-error) 5%, var(--color-canvas));
  --error-line: color-mix(in srgb, var(--color-error) 25%, var(--color-hairline));
  --error-text: color-mix(in srgb, var(--color-error) 75%, var(--color-ink));
  --backdrop: color-mix(in srgb, var(--color-surface-dark) 80%, transparent);
  --display-font: Georgia, "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, .button { cursor: pointer; }
button, .button, select, input, textarea { border: 1px solid var(--line); border-radius: 9px; }
button, .button { background: var(--color-canvas); padding: 9px 14px; font-weight: 550; text-decoration: none; text-align: center; transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease; }
button:hover, .button:hover { background: var(--color-surface-soft); border-color: var(--color-surface-cream-strong); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--color-primary); outline-offset: 3px;
}
a { color: var(--accent); text-underline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--display-font); font-size: clamp(27px, 3vw, 36px); line-height: 1.35; letter-spacing: -.8px; font-weight: 400; text-wrap: balance; }
h2 { font-size: 17px; letter-spacing: -.3px; font-weight: 650; }
h3 { font-size: 15px; }
.site-header { border-bottom: 1px solid var(--line); background: var(--color-canvas); }
.nav { max-width: 1440px; margin: auto; min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 32px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; object-fit: cover; border-radius: 9px; }
.brand strong { font-size: 16px; letter-spacing: -.3px; }
.brand span { color: var(--muted); margin-left: 9px; padding-left: 13px; border-left: 1px solid var(--line); font-size: 13px; }
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 13px; }
.nav-links a { color: var(--muted); text-decoration: none; }
main { max-width: 1440px; margin: auto; padding: 30px 32px 48px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.intro p { color: var(--muted); margin-top: 8px; }
.intro-note { font-size: 12px; color: var(--muted); white-space: nowrap; }
.workspace { display: grid; grid-template-columns: minmax(320px, 410px) minmax(0, 1fr); gap: 24px; align-items: start; }
.controls { background: var(--color-canvas); border: 1px solid var(--line); border-radius: 16px; padding: 22px; min-width: 0; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.section { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-weight: 600; }
.eyebrow { text-transform: uppercase; color: var(--muted); font-size: 10px; letter-spacing: 1.4px; margin-bottom: 3px; }
.small, .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.hint { margin-top: 8px; line-height: 1.65; }
summary { cursor: pointer; font-weight: 550; }
.connection summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.connection summary::after { content: "+"; font-size: 18px; font-weight: 400; }
.connection[open] summary::after { content: "−"; }
.connection input[type=password], .connection input[type=text] { width: 100%; margin: 12px 0 8px; }
.connection small { display: block; color: var(--muted); margin-top: 10px; overflow-wrap: anywhere; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.text-button { border: 0; background: none; padding: 4px 0; font-size: 12px; color: var(--muted); }
.text-button:hover { background: none; color: var(--ink); }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--color-surface-soft); border-radius: 10px; margin: 20px 0; }
.segments label { position: relative; cursor: pointer; text-align: center; }
.segments input { position: absolute; opacity: 0; }
.segments span { display: block; padding: 8px; border-radius: 7px; color: var(--muted); }
.segments input:checked + span { background: var(--color-canvas); color: var(--ink); box-shadow: 0 1px 4px color-mix(in srgb, var(--color-ink) 6%, transparent); font-weight: 600; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); }
.segments input:disabled + span { opacity: .5; cursor: not-allowed; }
textarea, select, input[type=password], input[type=text], input[type=number] { background: var(--color-canvas); padding: 10px 12px; width: 100%; }
textarea { display: block; resize: vertical; min-height: 154px; max-height: 420px; line-height: 1.75; }
textarea::placeholder { color: var(--color-muted); }
.prompt-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
#prompt-count { font-variant-numeric: tabular-nums; }
.prompt-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prompt-examples button { font-size: 11px; padding: 5px 9px; border-color: transparent; background: var(--color-surface-soft); font-weight: 400; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid label, .field { display: grid; gap: 7px; font-size: 12px; font-weight: 550; }
.field-grid + .field-grid { margin-top: 14px; }
.field-grid select { min-width: 0; }
.model-id { display: block; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); margin-top: 9px; }
.advanced { margin-top: 16px; }
.advanced .field-grid { margin-top: 12px; }
.upload-zone { padding: 15px; border: 1px dashed var(--color-surface-cream-strong); background: var(--color-canvas); border-radius: 10px; margin-bottom: 16px; }
.upload-zone.dragover { border-color: var(--accent); background: var(--tint); }
.upload-zone input { max-width: 100%; font-size: 12px; margin-top: 8px; }
.upload-zone input::file-selector-button { border: 0; background: var(--tint); color: var(--accent); padding: 7px 10px; border-radius: 6px; margin-right: 8px; cursor: pointer; }
.reference-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.reference-row img { width: 58px; height: 58px; object-fit: contain; border-radius: 6px; background: var(--color-canvas); }
#reference-name { overflow-wrap: anywhere; flex: 1; font-size: 12px; min-width: 0; }
.launch { margin-top: 22px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--color-on-primary); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
#generate { width: 100%; min-height: 46px; font-size: 14px; }
.launch .hint { text-align: center; font-size: 11px; }
.stage { min-width: 0; }
.stage-header { display: flex; align-items: center; justify-content: space-between; min-height: 30px; margin: 0 2px 12px; gap: 12px; }
.status-badge { font-size: 11px; padding: 3px 9px; border-radius: 5px; background: var(--tint); color: var(--color-body); white-space: nowrap; }
.canvas { background: var(--color-surface-soft); border: 1px solid var(--color-hairline); border-radius: 16px; min-height: 460px; overflow: hidden; }
.empty { min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 35px; }
.empty-art { width: clamp(180px, 24vw, 250px); height: auto; margin-bottom: 24px; color: var(--color-muted); }
.empty-art .paper { fill: var(--color-canvas); stroke: var(--color-surface-cream-strong); }
.empty-art .accent { stroke: var(--color-primary); }
.empty h3 { font-family: var(--display-font); font-size: 21px; font-weight: 400; margin-bottom: 8px; }
.empty p { font-size: 13px; color: var(--muted); max-width: 320px; }
.busy { border-radius: 11px; border: 1px solid var(--color-hairline); background: var(--color-surface-soft); padding: 16px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.busy p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.spinner { display: inline-block; height: 12px; width: 12px; border: 2px solid var(--color-surface-cream-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin-right: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }
.message { padding: 13px 16px; border-radius: 9px; background: var(--color-surface-soft); border: 1px solid var(--line); margin-bottom: 14px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.error { background: var(--error-tint); border-color: var(--error-line); color: var(--error-text); }
.result { margin: 0; padding: 16px; }
.result + .result { border-top: 1px solid var(--line); }
.image-preview { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.image-preview:hover { background: none; }
.image-preview img { max-width: 100%; max-height: 640px; display: block; object-fit: contain; margin: auto; border-radius: 7px; }
.result figcaption { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.result figcaption .button { font-size: 12px; background: var(--color-canvas); }
.canvas-note { color: var(--muted); font-size: 12px; margin: 13px 3px 0; }
.history { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.history-head p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.history-card { min-width: 0; background: var(--color-canvas); border: 1px solid var(--line); border-radius: 11px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.history-thumb { width: 100%; height: 135px; object-fit: contain; border-radius: 6px; background: var(--color-surface-soft); }
.history-prompt { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12px; overflow-wrap: anywhere; }
.history-card time { color: var(--muted); font-size: 10px; }
.history-actions { display: flex; gap: 7px; margin-top: auto; flex-wrap: wrap; }
.history-actions button, .history-actions a { font-size: 11px; padding: 5px 8px; }
.history-empty { padding: 22px 0; color: var(--muted); font-size: 13px; }
#legacy-history { margin-top: 20px; }
#legacy-list { margin-top: 12px; }
footer { padding: 0 24px 28px; text-align: center; color: var(--muted); font-size: 11px; }
dialog { max-width: min(96vw, 1400px); max-height: 94dvh; width: fit-content; border: 0; border-radius: 12px; padding: 15px; background: var(--paper); }
dialog::backdrop { background: var(--backdrop); }
.dialog-toolbar { display: flex; justify-content: end; gap: 12px; margin-bottom: 12px; }
dialog img { display: block; max-width: 100%; max-height: 78dvh; object-fit: contain; }
@media (min-width: 1600px) { main { padding-top: 40px; } .canvas, .empty { min-height: 530px; } }
@media (max-width: 1050px) { .workspace { grid-template-columns: 350px minmax(0, 1fr); gap: 18px; } .controls { padding: 18px; } .history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .nav { padding: 12px 18px; } main { padding: 24px 18px 32px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .intro-note { display: none; } .nav-links { gap: 16px; }
  .canvas, .empty { min-height: 300px; }
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-header { margin-top: 0; } .empty-art { width: 175px; }
}
@media (max-width: 430px) {
  .brand span { display: none; } .nav-links { font-size: 12px; gap: 12px; }
  main { padding: 20px 12px 30px; } .controls { padding: 16px; }
  .intro p { font-size: 12px; } .history-head { align-items: start; }
  .history-grid { gap: 10px; } .history-card { padding: 10px; }
  .busy { align-items: start; } .busy button { flex-shrink: 0; padding: 7px 9px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Only decorative controls lift. Generated images are never recolored or filtered. */
@keyframes studio-reveal {
  from { opacity: .65; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .result { animation: studio-reveal .38s cubic-bezier(.2, .65, .3, 1); }
  .busy:not([hidden]), .message:not([hidden]), #reference-section:not([hidden]), dialog[open] {
    animation: studio-reveal .22s ease-out;
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .primary:not(:disabled):hover, .prompt-examples button:not(:disabled):hover { transform: translateY(-1px); }
  .primary:not(:disabled):active, .prompt-examples button:not(:disabled):active { transform: translateY(0); }
}
textarea, select, input[type=password], input[type=text], input[type=number] {
  transition: border-color .2s ease, background .2s ease;
}
textarea:hover, select:hover { border-color: var(--color-surface-cream-strong); }
textarea:focus, input:focus, select:focus { border-color: var(--color-primary); }
.segments span { transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.history-card { transition: border-color .2s ease; }
.history-card:hover { border-color: var(--color-surface-cream-strong); }

/* Studio components: native controls remain the interaction and accessibility layer. */
:root {
  --surface: color-mix(in srgb, var(--color-canvas) 35%, var(--color-on-primary));
  --selected: color-mix(in srgb, var(--color-primary) 7%, var(--color-canvas));
  --shadow: 0 2px 5px color-mix(in srgb, var(--color-ink) 3%, transparent), 0 12px 40px color-mix(in srgb, var(--color-ink) 3%, transparent);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 5; padding: 10px 16px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
button, .button, select { min-height: 40px; }
button:disabled, fieldset:disabled .choice, fieldset:disabled .upload-target { cursor: not-allowed; }
fieldset:disabled .choice > span, fieldset:disabled .segments span { opacity: .55; }
main { max-width: 1440px; padding-top: 32px; }
.intro { margin-bottom: 30px; }
.intro .eyebrow { display: block; letter-spacing: 1.8px; margin-bottom: 9px; }
.intro h1 { font-size: clamp(26px, 3vw, 36px); }
.intro p { margin-top: 10px; font-size: 13px; }
.intro-note { text-decoration: none; padding: 8px 0; }
.intro-note:hover { color: var(--ink); }
.workspace { grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); gap: 28px; }
.controls { padding: 24px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.control-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.control-heading h2 { font-size: 16px; }
.control-heading .small { font-size: 11px; }
.connection { background: var(--color-canvas); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.connection summary { font-size: 12px; min-height: 24px; }
.connection summary::-webkit-details-marker { display: none; }
.connection summary::marker { content: ''; }
.connection summary::after { content: '⌄'; font-size: 15px; transition: transform .2s ease; }
.connection[open] summary::after { content: '⌄'; transform: rotate(180deg); }
.connection-title { display: inline-flex; align-items: center; gap: 7px; }
.connection-dot { width: 6px; height: 6px; border: 1px solid var(--muted); border-radius: 50%; }
.has-key .connection-dot { background: var(--color-body); border-color: var(--color-body); }
.connection #key-status { margin-left: auto; font-size: 11px; }
.connection small { font-size: 11px; }
.connection .checkbox { min-height: 32px; font-size: 11px; }
.connection .text-button { min-height: 32px; }
.connection input[type=password] { background: var(--surface); font-size: 13px; }
.segments { margin: 18px 0 20px; border: 1px solid var(--line); background: var(--color-surface-soft); padding: 3px; }
.segments span { min-height: 39px; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; }
.segments svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.segments input:checked + span { background: var(--surface); box-shadow: 0 1px 3px color-mix(in srgb, var(--color-ink) 8%, transparent); }
.section-label { font-size: 13px; margin-bottom: 10px; font-weight: 550; }
.section-label .small { font-size: 11px; }
.prompt-shell { border: 1px solid var(--line); border-radius: 12px; background: var(--color-canvas); transition: border-color .2s ease, box-shadow .2s ease; }
.prompt-shell:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--selected); }
.prompt-shell textarea { background: transparent; border: 0; border-radius: 12px 12px 0 0; padding: 14px; min-height: 145px; font-size: 13px; line-height: 1.8; }
.prompt-shell textarea:focus-visible { outline: none; }
.prompt-shell textarea::placeholder { color: var(--muted); opacity: .85; }
.prompt-footer { padding: 5px 14px 11px; margin: 0; gap: 10px; }
.prompt-footer .small { font-size: 10px; }
.prompt-examples { gap: 7px; margin-top: 9px; }
.prompt-examples button { min-height: 30px; background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 4px 10px; border-radius: 6px; }
.prompt-examples button:hover { background: var(--color-surface-soft); color: var(--ink); }
.section { margin-top: 22px; padding-top: 20px; }
.model-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; min-width: 0; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: inherit; }
.choice > span { display: flex; position: relative; pointer-events: none; border: 1px solid var(--line); border-radius: 9px; color: var(--color-body); background: var(--color-canvas); transition: border-color .18s ease, background .18s ease; }
.choice:hover > span { border-color: var(--color-muted-soft); }
.choice input:checked + span { border-color: var(--color-primary-active); background: var(--selected); }
.choice input:focus-visible + span { outline: 3px solid var(--color-primary); outline-offset: 3px; }
.choice input:disabled { cursor: not-allowed; }
.model-choice > span { align-items: flex-start; flex-direction: column; padding: 12px 9px 11px; gap: 4px; min-height: 108px; }
.model-symbol { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; font-family: var(--display-font); font-size: 15px; font-weight: 400; margin-bottom: 4px; background: var(--surface); }
.model-choice strong { font-size: 12px; line-height: 1.35; font-weight: 600; }
.model-choice small { font-size: 10px; color: var(--muted); }
.choice-check { position: absolute; right: 8px; top: 9px; font-style: normal; font-size: 11px; color: var(--accent); visibility: hidden; }
.choice input:checked + span .choice-check { visibility: visible; }
.option-section { margin-top: 18px; }
.option-section legend { width: 100%; padding: 0; }
.resolution-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.resolution-options .choice > span { align-items: center; justify-content: center; min-height: 38px; font-size: 12px; font-weight: 550; }
.model-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.model-line code { font: 10px ui-monospace, monospace; overflow-wrap: anywhere; text-align: right; }
.size-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.size-options .choice > span { padding: 12px 2px 9px; flex-direction: column; align-items: center; gap: 7px; }
.size-options b { font-size: 11px; font-weight: 500; }
.size-options small { font-size: 9px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.shape { display: block; height: 20px; width: 20px; border: 1.3px solid currentColor; border-radius: 3px; color: var(--muted); font-size: 10px; font-weight: 500; font-style: normal; text-align: center; line-height: 18px; margin: 3px 0; }
.shape.landscape { width: 27px; height: 17px; margin: 4.5px 0; }
.shape.portrait { width: 17px; height: 26px; margin: 0; }
.shape.auto { border-style: dashed; }
#tier-note { min-height: 34px; font-size: 11px; margin-top: 10px; }
.advanced { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.advanced summary { font-size: 12px; min-height: 28px; }
.advanced summary .small { font-size: 11px; font-weight: 400; margin-left: 6px; }
.quality-field { margin-top: 12px; }
.field-grid select, .quality-field select { padding-right: 28px; background: var(--color-canvas); font-size: 12px; }
#compression-field { margin-top: 12px; }
.launch { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.selection-summary { display: block; color: var(--muted); font-size: 10px; text-align: center; margin-bottom: 9px; overflow-wrap: anywhere; }
#generate { min-height: 46px; border-radius: 10px; font-size: 13px; }
.launch .hint { font-size: 10px; }
.upload-zone { padding: 0; border-radius: 12px; background: var(--color-canvas); }
.upload-target { position: relative; display: flex; align-items: center; flex-direction: column; padding: 22px 12px; cursor: pointer; text-align: center; gap: 5px; }
.upload-target svg { width: 26px; height: 26px; fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
.upload-target strong { font-size: 12px; font-weight: 500; }
.upload-target span { font-size: 10px; color: var(--muted); }
.upload-target input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.upload-target:focus-within { outline: 3px solid var(--color-primary); outline-offset: 3px; border-radius: 12px; }
.reference-row { margin: 0; padding: 12px; border-top: 1px solid var(--line); }
#upload-status { margin: 0; padding: 0 12px 12px; }
.stage { align-self: stretch; }
.stage-inner { position: sticky; top: 24px; }
.stage-header { padding: 5px 2px 13px; margin-bottom: 0; }
.stage-header .eyebrow { font-size: 9px; letter-spacing: 1.7px; margin-bottom: 3px; }
.stage-header h2 { font-size: 16px; }
.status-badge { border: 1px solid var(--line); background: var(--color-canvas); border-radius: 6px; font-size: 11px; }
.canvas { min-height: clamp(380px, 60vh, 680px); border-radius: 16px; background: var(--color-surface-soft); }
.empty { min-height: clamp(380px, 60vh, 680px); padding: 38px 24px; }
.empty-art { width: clamp(160px, 20vw, 230px); margin-bottom: 25px; }
.empty-kicker { font-size: 10px; color: var(--muted); margin-bottom: 10px; letter-spacing: 1px; }
.empty h3 { font-size: clamp(19px, 2vw, 25px); margin-bottom: 12px; }
.empty p { font-size: 12px; line-height: 1.8; }
.empty-steps { display: flex; gap: 18px; font-size: 10px; color: var(--muted); margin-top: 30px; flex-wrap: wrap; justify-content: center; }
.result-footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 12px; font-size: 10px; color: var(--muted); }
#result-model { overflow-wrap: anywhere; min-width: 0; }
.result-footer > span:last-child { flex-shrink: 0; }
.canvas-note { font-size: 10px; margin-top: 8px; }
.busy { padding: 13px 15px; background: var(--surface); border-color: var(--line); margin-top: 3px; margin-bottom: 12px; }
.busy-content { display: flex; align-items: center; gap: 11px; min-width: 0; }
.busy strong { font-size: 12px; font-weight: 500; }
.busy p { font-size: 10px; }
.busy button { font-size: 11px; min-height: 32px; padding: 5px 10px; flex-shrink: 0; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.message { font-size: 12px; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; }
#dimension-note { margin-top: 12px; }
.image-preview img { max-height: min(64vh, 720px); }
.result figcaption .button { background: var(--surface); }
.history { margin-top: 36px; padding-top: 26px; }
.history-count { display: inline-block; color: var(--muted); font: 11px ui-monospace, monospace; padding: 1px 6px; background: var(--color-surface-card); border-radius: 4px; margin-left: 5px; vertical-align: middle; }
.history-head .eyebrow { font-size: 9px; margin-bottom: 6px; }
.history-head p { font-size: 11px; }
.history-head button { min-height: 36px; }
.history-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.history-card { padding: 12px; border-radius: 12px; background: var(--surface); }
.history-thumb { height: 160px; }
.history-prompt { font-size: 12px; line-height: 1.6; margin-top: 4px; }
.history-model { font: 9px ui-monospace, monospace; color: var(--muted); overflow-wrap: anywhere; }
.history-actions { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.history-actions button, .history-actions a { min-height: 32px; padding: 5px 9px; }
.history-actions button:last-child { margin-left: auto; border-color: transparent; color: var(--muted); }
.history-empty { border: 1px dashed var(--line); border-radius: 12px; padding: 35px 20px; text-align: center; background: var(--color-canvas); font-size: 12px; }
.dialog-toolbar { align-items: center; }
.dialog-toolbar h2 { margin-right: auto; font-size: 14px; }
.confirm-dialog { width: min(400px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; }
.confirm-dialog h2 { font-size: 18px; margin-bottom: 12px; }
.confirm-dialog p { font-size: 13px; line-height: 1.8; color: var(--muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.confirm-actions button { font-size: 12px; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(340px, 380px) minmax(0, 1fr); gap: 20px; }
  .controls { padding: 18px; }
  .empty-steps { gap: 10px; }
}
@media (max-width: 800px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .stage-inner { position: static; }
  .intro { margin-bottom: 22px; }
  .controls { padding: 22px; }
  .canvas, .empty { min-height: 340px; }
  .empty-art { width: 165px; }
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .controls { padding: 16px; }
  .intro h1 { font-size: 26px; }
  .model-choice > span { padding: 10px 8px; min-height: 103px; }
  .model-choice strong { font-size: 11px; }
  .model-choice small { font-size: 9px; }
  .size-options { gap: 5px; }
  .size-options small { font-size: 8px; }
  .canvas, .empty { min-height: 310px; }
  .history-thumb { height: 130px; }
  .history-actions { gap: 4px; }
  .history-actions button, .history-actions a { padding: 5px 6px; font-size: 10px; }
  .dialog-toolbar { gap: 7px; }
  .dialog-toolbar .button, .dialog-toolbar button { padding: 7px 9px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  button:active, .button:active { transform: none; }
}
