/* One translation owns both launchers and anchors the floating AI surfaces. */
.editor-page .ai-edit-group {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  transform: translate(0, 0);
}
.editor-page .ai-region-panel {
  position: absolute; z-index: 52; width: 42px; height: 42px;
  border: 1px solid #3b434a; border-radius: 50%; background: #0b0b0b; color: #ededed;
  pointer-events: auto; box-shadow: 0 4px 16px #0004;
}
.editor-page .ai-group-handle { cursor: grab; touch-action: none; }
.editor-page .ai-group-handle:active { cursor: grabbing; }
.editor-page .ai-group-handle:focus-visible { outline: 1px solid #c9c9c9; outline-offset: -2px; }
.editor-page #ai-region-handle { height: 100%; }
.editor-page .ai-region-panel:hover { border-color: #758491; background: #141414; }
.editor-page #ai-region-expand {
  display: grid; align-content: center; justify-items: center; gap: 1px; width: 100%; height: 100%;
  padding: 3px; border: 0; border-radius: inherit; background: transparent; color: #eee;
  cursor: grab; touch-action: none; user-select: none;
}
.editor-page #ai-region-expand[data-dragging="true"] { cursor: grabbing; }
.editor-page #ai-region-expand:focus-visible { outline: 1px solid #a9c3d9; outline-offset: 2px; border-radius: 50%; }
.editor-page #ai-region-title { font-size: 7px; line-height: 1.1; letter-spacing: .06em; text-align: center; }
.editor-page .ai-region-icon { font-size: 12px; line-height: 1; color: #bbb; }
.editor-page .ai-region-panel[data-active="true"] .ai-region-icon { color: #78b8ee; }
.editor-page #ai-region-controls {
  position: absolute; top: 44px; right: 0; width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 64px); overflow: auto; padding: 16px;
  border: 1px solid #333; border-radius: 8px; background: #101010;
  box-shadow: 0 12px 38px #0009;
}
.editor-page #ai-region-form { display: grid; gap: 10px; }
.editor-page .ai-region-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-page .ai-region-panel-heading strong { font-size: 13px; }
.editor-page #ai-region-controls button {
  min-height: 36px; padding: 7px 12px; border: 1px solid #3b3b3b; border-radius: 5px;
  background: #1b1b1b; color: #ddd; font: inherit; font-size: 12px; cursor: pointer;
}
.editor-page #ai-region-controls button[aria-pressed="true"] { color: #fff; background: #343434; border-color: #7c7c7c; }
.editor-page #ai-region-controls button:disabled { opacity: .4; cursor: default; }
.editor-page #ai-region-sliders { display: grid; gap: 8px; }
.editor-page .ai-region-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.editor-page #ai-region-form label { font-size: 12px; color: #ddd; }
.editor-page #ai-region-prompt {
  width: 100%; min-height: 112px; resize: vertical; padding: 12px; border: 1px solid #393939;
  border-radius: 5px; background: #080808; color: #eee; font: inherit; font-size: 13px; line-height: 1.5;
}
.editor-page #ai-region-prompt:focus { outline: 1px solid #8d8d8d; outline-offset: 1px; }
.editor-page #ai-region-generate { width: 100%; background: #292929; color: #fff; }
.editor-page #ai-region-status { margin: 0; font-size: 12px; line-height: 1.5; color: #aaa; }
.editor-page #ai-region-status[data-state="error"] { color: #efb5ac; }
/* Only placement/stacking changes: the original launcher and logo visuals stay
   entirely in the unchanged checkpoint stylesheets. */
.editor-page #ai-edit-group > #prometheus-trigger { z-index: 51; pointer-events: auto; }
.editor-page .artboard[data-mask-active="true"] #mask-canvas { cursor: none; }
.editor-page #ai-region-cursor { position: fixed; z-index: 45; border: 1px solid #eee; border-radius: 50%; box-shadow: 0 0 0 1px #0009; transform: translate(-50%, -50%); pointer-events: none; }
.editor-page #ai-region-cursor[data-mode="erase"] { border-style: dashed; }
.editor-page .ai-edit-group [hidden], .editor-page #ai-region-cursor[hidden] { display: none !important; }

/* Floating AI surfaces use workspace-derived bounds supplied by place().
   Launchers retain their exact checkpoint visuals above these surfaces. */
.editor-page #generator-overlay:not([data-window-state=maximized]):not([data-window-state=minimized]) .generator-window {
  display:flex;flex-direction:column;height:auto!important;
  max-height:var(--ai-panel-max-height,calc(100dvh - 92px))!important;overflow:hidden;
}
.editor-page #generator-overlay .generator-header {flex:none;min-height:56px;box-sizing:border-box}
.editor-page #generator-overlay .generator-body {flex:0 1 auto;min-height:0}
.editor-page #generator-overlay .generator-reference-area {margin-top:10px;padding-top:8px}
.editor-page #generator-overlay #generator-reference-list:empty {min-height:0;margin-block:0;padding-block:0}
.editor-page #generator-overlay .generation-feedback {gap:8px}
.editor-page #generator-overlay {
  position: absolute; inset: auto; display: block; width: 560px; height: 576px;
  padding: 0; background: transparent; pointer-events: none; z-index: 49;
}
.editor-page #generator-overlay .generator-window {
  width: calc(100% - 32px); height: 100%; min-width: 0; min-height: 0; margin-left: 32px;
  display: grid; grid-template-rows: 56px minmax(0, 1fr);
  border: 1px solid #303030; border-radius: 8px; background: #0b0b0b;
  animation: none; overflow: visible;
}
.editor-page #generator-overlay .generator-header { grid-row: 1; min-width: 0; padding: 0 16px; gap: 12px; }
.editor-page #generator-overlay .generator-title-group h1 { font-size: 16px; }
.editor-page #generator-overlay .generator-body { grid-row: 2; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.editor-page #generator-overlay .generate-form { padding: 12px; }

.editor-page #generator-overlay #user-text { min-height: 140px; max-height: 300px; padding: 12px 12px 54px; font-size: 13px; }
.editor-page #generator-overlay .generate-button { min-height: 36px; padding: 0 16px; font-size: 12px; }
.editor-page #generator-overlay .generation-tip { margin-top: 8px; padding: 8px; font-size: 11px; }
.editor-page #generator-overlay .generation-feedback { margin-top: 8px; }
.editor-page #generator-overlay .session-gallery-tab {
  position: absolute; z-index: 1;
  inset: 88px auto auto -32px; width: 32px; height: auto; min-height: 32px; padding: 10px 6px; margin: 0;
  display: flex; align-items: center; gap: 6px; writing-mode: vertical-rl;
  transform: none; font-size: 11px; letter-spacing: .02em;
}
.editor-page #session-gallery {
  position: absolute; z-index: 50; width: 460px; height: 560px; min-width: 0; min-height: 0;
  padding: 12px; grid-template-rows: auto auto auto minmax(120px, 1fr) auto;
  background: #0b0b0b; border: 1px solid #303030; overflow: auto; overscroll-behavior: contain;
}
.editor-page #session-gallery .results-heading { margin-bottom: 6px; gap: 8px; }
.editor-page #session-gallery .results-heading h2 { font-size: 12px; letter-spacing: .06em; }
.editor-page #session-gallery .results-heading > div:first-child { flex-wrap: wrap; }
.editor-page #session-gallery .gallery-window-actions { gap: 6px; }
.editor-page #session-gallery .gallery-window-actions button { min-height: 34px; }
.editor-page #session-gallery #gallery-upload { padding: 0 10px; font-size: 11px; letter-spacing: 0; }
.editor-page #session-gallery > .gallery-helper { margin: 0 0 6px; font-size: 11px; line-height: 1.4; }
.editor-page #session-gallery .results-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; min-height: 120px;
  padding: 2px 3px 8px; overflow: auto; overscroll-behavior: contain;
}
.editor-page #session-gallery .artifact-identity strong { font-size: 11px; }
.editor-page #session-gallery .artifact-identity small { font-size: 10px; }
.editor-page #session-gallery .gallery-footer { gap: 8px; margin-top: 8px; padding-top: 8px; }
.editor-page #session-gallery .gallery-selection p { font-size: 11px; }
.editor-page #session-gallery .gallery-footer > .gallery-helper { font-size: 10px; }
.editor-page #ai-region-controls { position: absolute; height:auto!important;max-height:var(--ai-panel-max-height,calc(100dvh - 92px))!important; min-height: 0; padding:12px;overflow: auto; overscroll-behavior: contain; }
.editor-page .ai-region-panel-actions { display: flex; align-items: center; gap: 8px; }
.editor-page #ai-region-close { min-width: 36px; padding: 4px; font-size: 18px; }
@media (max-width: 720px) {

  .editor-page #generator-overlay .generator-title-group h1 { font-size: 14px; }
  .editor-page #generator-overlay .generator-header { padding: 0 10px; gap: 8px; }
}

/* Keep both AI panels inside their measured space, including short mobile views. */
.editor-page #generator-overlay{max-height:var(--ai-panel-max-height)!important;overflow:hidden!important}
.editor-page #generator-overlay .generator-window{max-height:var(--ai-panel-max-height)!important}
.editor-page #generator-overlay .generator-body{overflow:auto!important;min-height:0;overscroll-behavior:contain}

body.editor-page.mobile-studio :is(#generator-overlay,#ai-region-controls){--ai-mobile-room:max(1px,calc(var(--mobile-height) - var(--mobile-header) - var(--mobile-properties) - var(--mobile-sheet-offset) - 14px));top:var(--ai-panel-top,calc(var(--mobile-header) + var(--mobile-properties) + 12px))!important;bottom:auto!important;max-height:min(var(--ai-panel-max-height),var(--ai-mobile-room))!important}
body.editor-page.mobile-studio #generator-overlay .generator-window{max-height:min(var(--ai-panel-max-height),var(--ai-mobile-room))!important}
body.editor-page.mobile-studio #generator-overlay .generator-body{overflow:auto!important;max-height:calc(min(var(--ai-panel-max-height),var(--ai-mobile-room)) - 56px)!important}
