/* Layout corrections: one workspace surface, content-sized controls, viewport panels. */
.app-content:has(#preset-browser:not([hidden])) { position: relative; z-index: 1000 !important; }
body:has(#preset-browser:not([hidden])) { overflow: hidden !important; }
#studio-app .control-chip[aria-expanded="true"] { color: var(--cf-accent) !important; background: var(--cf-input) !important; }
#studio-app .composer-body { overflow: visible !important; flex: 1 0 auto !important; }
#studio-app .composer-body > * { flex-shrink: 0 !important; }
#studio-app .reference-zone { height: auto !important; max-height: none !important; overflow: visible !important; padding: 0 !important; border: 0 !important; }
#studio-app .reference-field { box-shadow: none !important; background: transparent !important; border: 0 !important; border-radius: 0 !important; }
#studio-app .reference-unified > label { padding: 10px 2px !important; min-height: 70px !important; }
#studio-app .reference-field small { overflow-wrap: anywhere; }
#studio-app .preset-summary { box-shadow: none !important; background: transparent !important; border: 0 !important; padding: 8px 0 !important; }
#studio-app .prompt-card { flex: 0 0 auto !important; box-shadow: none !important; background: var(--cf-input) !important; border: 1px solid var(--cf-line) !important; }
#studio-app .quick-settings .control-chip { width: auto !important; max-width: none !important; }
#studio-app .control-chip { max-width: 100% !important; }
#studio-app .control-chip span { overflow: visible !important; text-overflow: clip !important; }
#studio-app .cf-composer { overflow: visible !important; height: auto !important; }
#studio-app .cf-workspace { height: auto !important; overflow: visible !important; align-items: start; }
#studio-app .composer-controls { position: static !important; }
#studio-app.kind-video .cf-result-workspace { min-height: 540px; height: calc(100dvh - 150px); position: sticky; top: 88px; }
#studio-app.kind-image .cf-result-workspace:has(.empty-stage) { background: transparent !important; border: 0 !important; box-shadow: none !important; flex: 0 0 auto !important; min-height: 0 !important; height: auto !important; }
#studio-app.kind-image .cf-result-workspace:has(.empty-stage) .result-toolbar { display: none !important; }
#studio-app.kind-image .generation-stage:has(.empty-stage) { margin: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important; min-height: 0 !important; }
#studio-app.kind-image .empty-stage { position: static !important; transform: none !important; display: block !important; width: auto !important; padding: 18px 12px !important; }
#studio-app.kind-image .generation-stage:has(.empty-stage) { display: block !important; height: auto !important; }
#studio-app.kind-image .cf-result-workspace:has(.empty-stage) { display: block !important; }
#studio-app.kind-image .cf-workspace { align-items: center !important; }
#studio-app.kind-image .empty-glyph { display: none !important; }
#studio-app.kind-image .cf-workspace { min-height: 0 !important; gap: 12px !important; padding-block: 20px 36px !important; }
#studio-app .floating-panel { position: fixed !important; top: 88px !important; bottom: 20px !important; right: 20px !important; left: auto !important; width: min(410px, calc(100vw - 40px)) !important; max-height: calc(100dvh - 108px) !important; overflow-y: auto !important; overflow-x: hidden !important; transform: none !important; z-index: 150; background: var(--cf-panel) !important; overscroll-behavior: contain; scroll-padding-top: 90px; }
#studio-app .floating-panel[hidden] { display: none !important; }
#studio-app .panel-head { position: sticky !important; top: 0 !important; background: var(--cf-panel) !important; min-height: 78px; z-index: 2; }
#studio-app .setting-row { padding-block: 10px; gap: 18px; }
#studio-app .setting-row > span { min-width: 0; flex: 1; }
#studio-app .setting-row select { min-width: 0 !important; width: 52%; max-width: 210px; }
#studio-app .toggle-row { position: relative; cursor: pointer; }
#studio-app .toggle-row input { display: block !important; position: absolute; right: 0; width: 52px; height: 40px; opacity: 0; z-index: 1; cursor: pointer; }
#studio-app .toggle-row i { flex: 0 0 46px; width: 46px !important; height: 28px !important; border: 1px solid var(--cf-line-strong); background: var(--cf-panel-2) !important; box-shadow: inset 1px 2px 4px rgba(0,0,0,.15) !important; }
#studio-app .toggle-row i:after { width: 20px !important; height: 20px !important; left: 3px !important; top: 3px !important; background: var(--cf-text) !important; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
#studio-app .toggle-row input:checked + i { background: #3158ed !important; }
#studio-app .toggle-row input:checked + i:after { left: 21px !important; background: #fff !important; }
#studio-app .toggle-row input:focus-visible + i { outline: 2px solid var(--cf-accent); outline-offset: 3px; }
#studio-app .preset-browser { position: fixed !important; inset: 0 !important; padding: 24px !important; overflow: auto !important; place-items: center !important; z-index: 180; }
#studio-app .preset-browser[hidden] { display: none !important; }
#studio-app .preset-browser > section { width: min(1024px, 100%) !important; max-height: calc(100dvh - 48px) !important; display: flex !important; flex-direction: column; overflow: hidden !important; padding: 20px !important; margin: auto !important; background: var(--cf-panel) !important; box-shadow: 0 24px 70px rgba(0,0,0,.3) !important; }
#studio-app .preset-browser-head { flex: 0 0 auto; padding: 0 0 16px; gap: 20px; }
#studio-app .preset-browser-head h2 { font-size: clamp(18px, 2vw, 24px) !important; }
#studio-app .preset-browser-head button { flex: 0 0 40px; }
#studio-app .preset-grid { min-height: 0; overflow-y: auto !important; overflow-x: hidden; overscroll-behavior: contain; padding: 4px 6px 12px !important; gap: 16px !important; }
#studio-app .preset-grid button { box-shadow: none !important; background: transparent !important; border: 1px solid var(--cf-line) !important; padding: 6px !important; border-radius: 16px !important; }
#studio-app .preset-grid button[aria-pressed="true"] { border-color: var(--cf-accent) !important; background: var(--cf-hover) !important; }
#studio-app .preset-art { display: block; height: auto !important; aspect-ratio: 3 / 2; background-size: cover !important; background-position: center !important; border-radius: 10px !important; }
#studio-app .art-none { background-image: none !important; background-color: var(--cf-input); display: grid; place-items: center; }
#studio-app .art-none .ui-icon { width: 36px; height: 36px; color: var(--cf-muted); }
#studio-app .art-push { background-image: url('../art/preset-push-v2.webp') !important; }
#studio-app .art-track { background-image: url('../art/preset-track-v2.webp') !important; }
#studio-app .art-orbit { background-image: url('../art/preset-orbit-v2.webp') !important; }
#studio-app .art-reveal { background-image: url('../art/preset-reveal-v2.webp') !important; }
#studio-app .art-natural { background-image: url('../art/preset-natural-v2.webp') !important; }
#studio-app .preset-thumb { background-image: none !important; background-color: var(--cf-input) !important; background-size: cover !important; background-position: center !important; }
#studio-app .preset-thumb i { display: none !important; }
#studio-app .preset-thumb .ui-icon { color: var(--cf-muted); width: 22px; height: 22px; }
@media(max-width: 900px) {
  #studio-app.kind-video .cf-workspace { display: flex !important; flex-direction: column; }
  #studio-app.kind-video .cf-composer { width: 100% !important; }
  #studio-app.kind-video .cf-result-workspace { position: relative; top: auto; width: 100%; height: 280px !important; min-height: 260px !important; }
}
@media(max-width: 680px) {
  #studio-app .setting-row:not(.toggle-row) { display: grid; gap: 8px; }
  #studio-app .setting-row select { width: 100%; max-width: none; }
  #studio-app .floating-panel { top: 76px !important; bottom: 12px !important; right: 12px !important; left: 12px !important; width: auto !important; max-height: calc(100dvh - 88px) !important; }
  #studio-app .preset-browser { padding: 12px !important; }
  #studio-app .preset-browser > section { max-height: calc(100dvh - 24px) !important; width: 100% !important; padding: 14px !important; }
  #studio-app .preset-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 10px !important; }
  #studio-app .preset-grid strong { font-size: 13px !important; overflow-wrap: anywhere; }
  #studio-app .preset-grid small { font-size: 12px !important; }
}

/* Persistent creator history: results remain visible on every creator page. */
#studio-app .generation-stage.history-stage {
  display: block !important;
  place-items: initial !important;
  min-height: 320px !important;
  padding: 10px !important;
  overflow: auto !important;
  background: var(--cf-bg) !important;
  box-shadow: none !important;
  scrollbar-width: thin;
}
#studio-app .studio-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  grid-auto-flow: dense;
  gap: 10px;
  align-items: start;
}
#studio-app .history-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--cf-line);
  border-radius: 18px;
  color: #fff;
  background: #070908;
  box-shadow: var(--cf-clay-shadow-sm);
  isolation: isolate;
}
#studio-app .history-card.history-video { aspect-ratio: 16 / 10; }
#studio-app .history-media,
#studio-app .history-media img,
#studio-app .history-media video {
  display: block;
  width: 100%;
  height: 100%;
}
#studio-app .history-media img,
#studio-app .history-media video { object-fit: cover; background: #070908; }
#studio-app button.history-media-open {
  padding: 0;
  border: 0;
  color: inherit;
  background: #070908;
  cursor: zoom-in;
}
#studio-app button.history-media-open[draggable="true"] { cursor: grab; }
#studio-app button.history-media-open[draggable="true"]:active { cursor: grabbing; }
#studio-app .reference-zone.is-dragover { outline: 2px solid var(--cf-accent); outline-offset: 5px; border-radius: 14px; }
#studio-app .reference-drop-hint { display: none; position: absolute; inset: 0; z-index: 5; place-items: center; border: 2px dashed var(--cf-accent); border-radius: 14px; background: color-mix(in srgb, var(--cf-panel) 90%, transparent); color: var(--cf-text); font-weight: 700; pointer-events: none; }
#studio-app .reference-zone.is-dragover .reference-drop-hint { display: grid; }
#studio-app .reference-library-shortcuts { display: flex; align-items: center; gap: 6px; padding: 2px 0 7px; overflow-x: auto; scrollbar-width: none; }
#studio-app .reference-library-shortcuts > span { margin-right: 2px; color: var(--cf-muted); font-size: 10px; white-space: nowrap; }
#studio-app .reference-library-shortcuts > button[data-library-image] { flex: 0 0 38px; width: 38px; height: 38px; padding: 0; overflow: hidden; border: 1px solid var(--cf-line); border-radius: 9px; background: var(--cf-panel-2); cursor: grab; }
#studio-app .reference-library-shortcuts img { width: 100%; height: 100%; object-fit: cover; }
#studio-app .reference-library-shortcuts .reference-library-trigger { flex: 0 0 auto; height: 34px; padding: 0 9px; border: 1px solid var(--cf-line); border-radius: 9px; background: transparent; color: var(--cf-text); font-size: 10px; cursor: pointer; }
.reference-library { width: min(920px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 18px; border: 1px solid var(--cf-line-strong); border-radius: 22px; background: var(--cf-panel); color: var(--cf-text); box-shadow: 0 30px 100px #0008; }
.reference-library::backdrop { background: #050706b8; backdrop-filter: blur(10px); }
.reference-library-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.reference-library-head div { display: grid; gap: 3px; }
.reference-library-head small { color: var(--cf-accent); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.reference-library-head strong { font-size: 22px; }
.reference-library-head button { width: 38px; height: 38px; border: 1px solid var(--cf-line); border-radius: 12px; background: var(--cf-panel-2); color: var(--cf-text); font-size: 22px; cursor: pointer; }
.reference-library > p { margin: 9px 0 15px; color: var(--cf-muted); font-size: 12px; }
.reference-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 9px; max-height: min(610px, calc(100vh - 150px)); overflow: auto; }
.reference-library-grid button { position: relative; min-width: 0; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--cf-line); border-radius: 14px; background: var(--cf-panel-2); cursor: grab; }
.reference-library-grid button:hover { border-color: var(--cf-accent); transform: translateY(-1px); }
.reference-library-grid img { width: 100%; height: 100%; object-fit: cover; }
.reference-library-grid span { position: absolute; inset: auto 7px 7px; padding: 6px 7px; overflow: hidden; border-radius: 7px; background: #070907c9; color: #fff; font-size: 9px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 680px) { .reference-library { padding: 12px; border-radius: 17px; } .reference-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } #studio-app .reference-library-shortcuts > span { display: none; } }
#studio-app button.history-media-open:focus-visible {
  outline: 3px solid var(--cf-accent);
  outline-offset: -3px;
}
#studio-app .history-card::after {
  content: "";
  position: absolute;
  inset: 36% 0 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(5,7,6,.9));
}
#studio-app .history-card-top,
#studio-app .history-card-meta { position: absolute; left: 12px; right: 12px; z-index: 2; }
#studio-app .history-card-top {
  top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
#studio-app .history-card-top span,
#studio-app .history-card-top small {
  max-width: 68%;
  padding: 6px 9px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  color: #fff;
  background: rgba(8,10,9,.68);
  backdrop-filter: blur(12px);
  font-size: 12px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#studio-app .history-card-meta { bottom: 12px; }
#studio-app .history-card-meta p {
  margin: 0 0 9px;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#studio-app .history-card-meta nav { display: flex; flex-wrap: wrap; gap: 6px; }
#studio-app .history-card-meta :is(a,button) {
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 9px;
  color: #fff;
  background: rgba(8,10,9,.68);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
#studio-app .history-card-meta :is(a,button):hover { background: rgba(49,88,237,.92); }
#studio-app .gallery-status {
  position: sticky;
  top: 0;
  z-index: 8;
  width: 100%;
  max-width: none;
  min-height: 74px;
  margin: 0 0 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--cf-line-strong);
  border-radius: 16px;
  color: var(--cf-text);
  background: color-mix(in srgb, var(--cf-panel) 92%, transparent);
  box-shadow: var(--cf-clay-shadow-sm);
  backdrop-filter: blur(18px);
  text-align: left;
}
#studio-app .gallery-status .progress-orb { width: 42px; height: 42px; margin: 0; }
#studio-app .gallery-status strong { display: block; font-size: 14px; }
#studio-app .gallery-status p { margin: 3px 0 7px; font-size: 12px; }
#studio-app .gallery-status .progress-line { margin: 0; }
#studio-app .gallery-status > small { color: var(--cf-muted); font-size: 12px; }
#studio-app .gallery-status.job-progress{display:flex;align-items:center;justify-content:center;gap:clamp(18px,4vw,54px);min-height:0;padding:18px;overflow:hidden;isolation:isolate;background:var(--cf-panel)!important;color:var(--cf-text)!important;border-color:var(--cf-line-strong)!important}
#studio-app .generation-preview{position:relative;width:min(55%,var(--gen-width,46dvh));max-height:46dvh;aspect-ratio:var(--gen-ratio);flex:none;overflow:hidden;border:1px solid var(--cf-line-strong);border-radius:18px;background:linear-gradient(140deg,color-mix(in srgb,var(--cf-accent) 11%,var(--cf-panel-2)),var(--cf-panel-2) 42%,color-mix(in srgb,var(--cf-accent) 7%,var(--cf-panel)));box-shadow:inset 0 1px 0 var(--cf-clay-highlight),0 16px 44px rgba(0,0,0,.12)}
#studio-app .generation-preview::after{content:"";position:absolute;inset:-50%;background:linear-gradient(110deg,transparent 38%,color-mix(in srgb,var(--cf-accent) 18%,transparent) 50%,transparent 62%);animation:cf-generation-sweep 3.8s ease-in-out infinite}
#studio-app .generation-preview-grain{position:absolute;inset:0;opacity:.4;background-image:radial-gradient(circle,color-mix(in srgb,var(--cf-accent) 26%,transparent) 1px,transparent 1px);background-size:17px 17px;mask-image:linear-gradient(135deg,#000,transparent 72%)}
#studio-app .generation-preview-shape{position:absolute;display:block;border:1px solid color-mix(in srgb,var(--cf-accent) 28%,var(--cf-line));border-radius:18px;background:color-mix(in srgb,var(--cf-accent) 8%,transparent);animation:cf-generation-shape 4s ease-in-out infinite alternate}
#studio-app .generation-preview-shape-one{width:55%;height:42%;left:-12%;bottom:-9%;transform:rotate(-18deg)}
#studio-app .generation-preview-shape-two{width:48%;height:38%;right:-12%;top:-9%;transform:rotate(18deg);animation-delay:-2s}
#studio-app .generation-preview-focus{position:absolute;z-index:1;left:50%;top:50%;display:grid;place-items:center;width:64px;height:64px;border:1px solid var(--cf-line-strong);border-radius:20px;background:var(--cf-panel);box-shadow:var(--cf-clay-shadow-sm);transform:translate(-50%,-50%);animation:cf-generation-pulse 2.4s ease-in-out infinite}
#studio-app .generation-preview-focus .ui-icon{width:30px;height:30px;color:var(--cf-accent)}
#studio-app .generation-preview-ratio{position:absolute;z-index:2;left:12px;bottom:12px;padding:5px 9px;border:1px solid var(--cf-line-strong);border-radius:8px;background:var(--cf-panel);color:var(--cf-text);font-size:12px;font-weight:750}
#studio-app .generation-progress-copy{width:min(330px,40%);min-width:190px;text-align:left}
#studio-app .generation-progress-kicker{display:block;margin-bottom:10px;color:var(--cf-accent);font-size:11px;font-weight:750;letter-spacing:.08em;text-transform:uppercase}
#studio-app .gallery-status.job-progress strong{font-family:var(--cf-font-display,"Kadrora Sans",sans-serif);font-size:clamp(18px,2vw,25px);line-height:1.22}
#studio-app .gallery-status.job-progress p{margin:10px 0 22px;color:var(--cf-muted);font-size:13px;line-height:1.5}
#studio-app .gallery-status.job-progress .progress-line{height:4px;border-radius:6px;background:var(--cf-line-strong)}
#studio-app .gallery-status.job-progress .progress-line i{border-radius:6px;background:var(--cf-accent)}
#studio-app .generation-progress-copy>small{display:block;margin-top:8px;color:var(--cf-muted);font-size:12px}
@keyframes cf-generation-sweep{0%,100%{transform:translateX(-78%)}55%{transform:translateX(78%)}}
@keyframes cf-generation-shape{from{translate:0 0;opacity:.5}to{translate:8px -12px;opacity:1}}
@keyframes cf-generation-pulse{0%,100%{transform:translate(-50%,-50%) scale(1)}50%{transform:translate(-50%,-50%) scale(1.08)}}
@media(max-width:680px){#studio-app .gallery-status.job-progress{flex-direction:column;padding:12px;gap:14px}#studio-app .generation-preview{width:min(100%,var(--gen-width,42dvh));max-height:42dvh}#studio-app .generation-progress-copy{width:100%;min-width:0}#studio-app .gallery-status.job-progress p{margin:5px 0 10px}}
@media(prefers-reduced-motion:reduce){#studio-app .generation-preview::after,#studio-app .generation-preview-shape,#studio-app .generation-preview-focus{animation:none!important}}
@media (min-width: 681px) {
  #studio-app.kind-image .cf-result-workspace { min-height: 52vh !important; flex-basis: 52vh !important; }
  #studio-app.kind-image .generation-stage.history-stage { min-height: calc(52vh - 76px) !important; }
  #studio-app.kind-image .studio-history-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
}
@media (max-width: 900px) {
  #studio-app.kind-video .cf-result-workspace:has(.history-stage) { height: 52vh !important; min-height: 360px !important; }
}
@media (max-width: 680px) {
  #studio-app .generation-stage.history-stage { min-height: 300px !important; padding: 7px !important; }
  #studio-app .studio-history-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
  #studio-app .history-card { border-radius: 14px; }
  #studio-app .history-card-top { top: 8px; left: 8px; right: 8px; }
  #studio-app .history-card-top small { display: none; }
  #studio-app .history-card-meta { left: 8px; right: 8px; bottom: 8px; }
  #studio-app .history-card-meta p { font-size: 12px; }
  #studio-app .history-card-meta nav :is(a,button):not(:first-child):not([data-delete-asset]) { display: none; }
}

/* Image creator: a full-bleed media wall with one floating composer, like a
   dedicated visual tool rather than a stack of cards. */
@media (min-width: 681px) {
  #studio-app.kind-image .cf-workspace:has(.history-stage) {
    position: relative;
    display: block !important;
    width: 100%;
    min-height: calc(100dvh - 60px) !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  #studio-app.kind-image .cf-result-workspace:has(.history-stage) {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: calc(100dvh - 60px) !important;
    min-height: 620px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #070908 !important;
    box-shadow: none !important;
  }
  #studio-app.kind-image .cf-result-workspace:has(.history-stage) .result-toolbar {
    display: none !important;
  }
  #studio-app.kind-image .generation-stage.history-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #070908 !important;
    overflow: auto !important;
  }
  #studio-app.kind-image .studio-history-grid {
    height: 100%;
    min-height: 100%;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    grid-auto-rows: minmax(300px, 1fr);
    gap: 2px;
    align-items: stretch;
  }
  #studio-app.kind-image .history-card {
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #studio-app.kind-image .cf-workspace:has(.history-stage) .cf-composer {
    position: absolute !important;
    z-index: 20;
    inset: auto auto 22px 50% !important;
    width: min(1040px, calc(100% - 36px)) !important;
    transform: translateX(-50%) !important;
    border-radius: 24px !important;
    background: color-mix(in srgb, var(--cf-panel) 92%, transparent) !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.42) !important;
    backdrop-filter: blur(24px);
  }
  #studio-app.kind-image .cf-workspace:has(.history-stage) .composer-head {
    padding-block: 11px !important;
  }
  #studio-app.kind-image .cf-workspace:has(.history-stage) .prompt-card textarea {
    min-height: 104px !important;
    padding-top: 10px !important;
  }
  #studio-app.kind-image .gallery-status {
    position: absolute;
    z-index: 30;
    top: 18px;
    left: 50%;
    width: min(880px, calc(100% - 36px));
    transform: translateX(-50%);
    border-color: var(--cf-line-strong);
    background: var(--cf-panel);
    color: var(--cf-text);
  }
}

/* Keep the composer outside the media at every viewport size and input type. */
@media all {
  #studio-app.kind-image .cf-workspace:has(.history-stage) {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding: 12px !important;
    gap: 16px !important;
    overflow: visible !important;
  }
  #studio-app.kind-image .cf-result-workspace:has(.history-stage) {
    position: relative !important;
    order: 0 !important;
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }
  #studio-app.kind-image .generation-stage.history-stage {
    position: relative !important;
    inset: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 64dvh !important;
    overflow: auto !important;
    background: transparent !important;
  }
  #studio-app.kind-image .studio-history-grid {
    height: auto;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 12px;
  }
  #studio-app.kind-image .history-card {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    background: var(--cf-panel);
    color: var(--cf-text);
  }
  #studio-app.kind-image .history-card:only-child { grid-column: 1 / -1; }
  #studio-app.kind-image .history-media {
    height: clamp(180px, 38dvh, 380px);
    flex: none;
  }
  #studio-app.kind-image .history-card:only-child .history-media { height: clamp(200px, 48dvh, 520px); }
  #studio-app.kind-image .history-media img { object-fit: contain; }
  #studio-app.kind-image .history-card::after { display: none; }
  #studio-app.kind-image .history-card-meta {
    position: static;
    padding: 10px;
  }
  #studio-app.kind-image .history-card-meta p { color: var(--cf-text); }
  #studio-app.kind-image .cf-workspace:has(.history-stage) .cf-composer {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    order: 1 !important;
    flex: none !important;
    width: 100% !important;
    max-width: 1040px !important;
    margin: 0 auto !important;
    z-index: auto;
  }
  #studio-app.kind-image .cf-workspace:has(.history-stage) .prompt-card textarea {
    min-height: 80px !important;
    height: 100px !important;
    max-height: 180px !important;
    overflow-y: auto !important;
  }
  #studio-app.kind-image .gallery-status {
    position: relative;
    inset: auto;
    transform: none;
    width: 100%;
  }
}
