html:has(body.ai-editor), body.ai-editor { height: 100%; margin: 0; overflow: hidden; }
body.ai-editor { color: #7c7a7d; font-family: 'Source Sans Pro', sans-serif; }
#imageEditor { --editor-bottom: max(20px, env(safe-area-inset-bottom)); position: fixed; inset: 0; width: 100%; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; background: #f7f8f9; }
#imageEditor *, #imageEditor *::before, #imageEditor *::after { box-sizing: border-box; }
#imageEditor [hidden] { display: none !important; }
#imageEditor button { flex-shrink: 0; border: 0; margin: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; background-color: transparent; }
#imageEditor button:disabled { opacity: .4; cursor: default; }
#imageEditor button:focus-visible { outline: 2px solid #4a86b3; outline-offset: 3px; }
/* Match ai_creator's header, credit, submit and image-action control sizes. */
#imageEditor .editor-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 15px; padding-top: env(safe-area-inset-top); min-height: 46px; background: white; }
.editor-heading, .editor-account, .editor-credits, .editor-send-actions { display: flex; align-items: center; }
.editor-heading { gap: 20px; min-width: 0; }
#imageEditor h1 { font: 400 20px/1.2 'Source Sans Pro', sans-serif; padding: 0; margin: 0; white-space: nowrap; }
#imageEditor #siteMenuButton { display: block; width: 30px; height: 40px; margin-left: -5px; background: url(/images/ai_editor/icons/menu_dark.svg) center/20px no-repeat; }
.editor-account { gap: 5px; }
#imageEditor .editor-credits { gap: 10px; font-size: 14px; line-height: 1; white-space: nowrap; }
.editor-credits img { width: 20px; height: 20px; }
#imageEditor .editor-account .editor-credits { margin-left: 10px; font-size: 16px; }
#imageEditor .editor-icon { width: 30px; height: 35px; display: inline-flex; justify-content: center; align-items: center; border-radius: 5px; }
#imageEditor .editor-icon:not(.editor-download):hover { background-color: rgba(124, 122, 125, .07); }
#imageEditor .editor-download { width: 25px; background: url(/images/ai_editor/icons/download.svg) left center/14px no-repeat; }
#imageEditor .editor-buy { width: 18px; height: 18px; background: url(/images/ai_editor/icons/add_credits.svg) center/18px no-repeat; }
.editor-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#editorFullscreen { --editor-symbol: url(/images/site/fitToScreenIcon.svg); }
#editorHistoryClose { --editor-symbol: url(/images/site/closeIcon.svg); }
#editorFullscreen::before, #editorHistoryClose::before { content: ''; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--editor-symbol) center / contain no-repeat; mask: var(--editor-symbol) center / contain no-repeat; }
.editor-canvas { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px 64px; overflow: hidden; }
#imageEditor #editorEmpty { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; color: #929194; opacity: .65; }
#imageEditor #editorEmpty:hover:not(:disabled), #imageEditor #editorEmpty:focus-visible { color: #4a86b3; opacity: 1; }
.editor-empty-image { display: block; width: 48px; height: 48px; background: currentColor; -webkit-mask: url(/images/site/graphicIcon.svg) center / contain no-repeat; mask: url(/images/site/graphicIcon.svg) center / contain no-repeat; }
#editorEmptyNotice { position: absolute; top: calc(50% + 44px); left: 50%; transform: translateX(-50%); display: flex; align-items: flex-start; gap: 10px; width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 0; color: #f23c32; font-size: 13px; line-height: 1.4; }
#editorEmptyNotice img { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; }
#editorImage { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.editor-view-tools { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 0; padding: 5px; border-radius: 5px; background: rgba(0, 0, 0, .7); }
#imageEditor .editor-view-tools button { color: white; background: transparent; border-radius: 0; box-shadow: none; }
.editor-view-tools svg, .editor-view-tools button::before { opacity: .8; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
#imageEditor .editor-view-tools button:hover:not(:disabled) svg,
#imageEditor .editor-view-tools button:hover:not(:disabled)::before,
#imageEditor .editor-view-tools button:focus-visible svg,
#imageEditor .editor-view-tools button:focus-visible::before { opacity: 1; }
#imageEditor .editor-view-tools button:focus-visible { outline-color: white; outline-offset: -3px; }
.editor-input-area { min-width: 0; padding: 0 24px var(--editor-bottom); }
.editor-feedback { width: 100%; max-width: 800px; margin: 0 auto; }
#editorProgress { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; width: 25px; height: 25px; pointer-events: none; }
#editorProgress span { width: 25px; height: 25px; background: url(/images/site/loadingBall.svg) center / 25px no-repeat; }
.editor-history { position: absolute; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 8px 16px 16px; }
.editor-history-heading { display: flex; align-items: center; justify-content: space-between; }
#imageEditor .editor-history .editor-icon { border-radius: 0; }
#imageEditor .editor-history h2 { padding: 0; margin: 0; font: 400 16px/1.3 'Source Sans Pro', sans-serif; }
.editor-history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 5px; min-height: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; }
#imageEditor .editor-history-list button { position: relative; width: 100%; aspect-ratio: 1; border-radius: 0; overflow: hidden; background: #eceef0; }
.editor-history-list img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.editor-drop-target { position: absolute; inset: 8px; z-index: 1000; display: flex; align-items: center; justify-content: center; border: 2px dashed #4a86b3; border-radius: 12px; background: #f7f8f9b3; pointer-events: none; }
.editor-drop-target span { padding: 12px 20px; border-radius: 8px; background: white; color: #4a86b3; font-size: 20px; }
.editor-composer { position: relative; max-width: 800px; width: 100%; margin: 0 auto; padding: 18px 20px 12px; border-radius: 18px; background: white; box-shadow: 0 3px 20px #00000007; }
/* Inherit AG's Roboto, line height, text and placeholder colors from scaffold. */
#editorPrompt { display: block; width: 100%; height: 1.5em; min-height: 1.5em; max-height: 4.5em; padding: 0; margin: 0 0 12px; border: 0; border-radius: 0; outline: none; resize: none; background: transparent; font-size: 15px; caret-color: #4a86b3; overflow-y: auto; }
.editor-composer-actions { position: relative; display: flex; align-items: center; justify-content: space-between; }
.editor-send-actions { gap: 0; }
#imageEditor #editorAttach { height: 30px; margin-right: 15px; }
#editorAttach::before { content: ''; width: 18px; height: 18px; background: currentColor; -webkit-mask: url(/free_icons/feather/paperclip.svg) center / contain no-repeat; mask: url(/free_icons/feather/paperclip.svg) center / contain no-repeat; }
#imageEditor #editorSend { width: 60px; height: 30px; border-radius: 5px; background: #4a86b3 url(/images/ai_editor/icons/submit.svg) center/20px no-repeat; }
#editorNotice { margin: 0 20px 10px; padding: 0; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; max-height: 80px; overflow-y: auto; }
#editorNotice a { color: #4a86b3; text-decoration: underline; }
.editor-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#imageEditor.editor-expanded .editor-header { display: none; }
#imageEditor.editor-expanded { grid-template-rows: minmax(0, 1fr) auto; }
@media (max-width: 700px) {
  #imageEditor { background: linear-gradient(#f7f8f9 calc(100% - 220px), #fff calc(100% - 110px)); }
  .editor-canvas { padding: 12px 8px; }
  .editor-view-tools { right: 8px; }
  .editor-input-area { padding: 0 0 var(--editor-bottom); }
  #editorNotice { margin-left: 16px; margin-right: 16px; }
  .editor-history { padding: 0 8px 8px; }
  .editor-history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-composer { max-width: none; padding: 14px 16px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
}
@media (max-width: 600px) {
  #imageEditor .editor-header { padding-left: 10px; padding-right: 10px; }
  .editor-heading { gap: 10px; }
  #imageEditor h1 { font-size: 18px; }
}
