

/* Shared responsive generator. The modal and dock keep their original live controls. */
body.aidc-compact-generator { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
body.aidc-compact-generator #tg-header-root { position: sticky; top: 0; z-index: 1200; background: var(--aidc-bg-page); }
body.aidc-compact-generator #tg-bottom-nav-root { display: none !important; }
body.aidc-compact-generator .genprep-tabs,
.genprep-compact .ms-head,
.genprep-compact .ms-academy { display: none !important; }
.genprep-compact .genprep-panel,
.genprep-compact .genprep-panel[hidden],
.genprep-compact .tg-prep-section { display: flex !important; flex-direction: column; flex: 0 0 auto; }
.genprep-compact .generation-panel__content { gap: 14px; }
.genprep-compact .genprep-model-shell,
.genprep-compact .ms-meta { overflow: visible !important; padding: 0; gap: 8px; }
.genprep-compact .genprep-model-shell { height: auto !important; min-height: 0; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.genprep-compact .genprep-model-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; align-items: stretch; }
.genprep-compact .genprep-model-row > .ms-label,
.genprep-compact .genprep-model-row > label { display: none; }
.genprep-model-row > .ms-dropdown { min-width: 0; }
.genprep-model-row .ms-dropdown__toggle { min-height: 44px; white-space: normal; text-align: left; }
.genprep-settings-toggle,
.genprep-settings-close { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 1px solid var(--aidc-border-default); border-radius: 12px; background: var(--aidc-btn-secondary-bg); color: var(--aidc-text-primary); cursor: pointer; }
.genprep-settings-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-height: 44px; height: auto; padding: 0 10px; border-color: var(--aidc-action-primary-from); font-family: inherit; font-size: var(--aidc-font-size-control); letter-spacing: normal; text-transform: none; white-space: nowrap; }
.genprep-settings-toggle > svg { flex: 0 0 auto; }
.genprep-settings-toggle:hover,
.genprep-settings-close:hover { background: var(--aidc-btn-secondary-bg-hover); }
.genprep-settings-toggle:focus-visible,
.genprep-settings-close:focus-visible { outline: 2px solid var(--aidc-action-focus-ring); outline-offset: 2px; }
body .genprep-generation-dock { position: fixed; inset: auto 0 0; z-index: 1000; margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; border-top: 1px solid var(--aidc-border-default); background: var(--aidc-bg-generator-shell); box-shadow: var(--aidc-shadow-popover); }
body .genprep-generation-dock .ms-cta { width: 100%; max-width: 680px; min-height: 52px; margin: 0; }
body .genprep-generation-dock .ms-academy { display: none; }
body .genprep-settings-dialog { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(12px, env(safe-area-inset-top, 0px), calc(var(--genprep-header-bottom, 0px) + 12px)) 12px calc(88px + env(safe-area-inset-bottom, 0px)); border: 0; background: transparent; color: var(--aidc-text-primary); overflow: hidden; box-sizing: border-box; }
.genprep-settings-dialog:not([open]) { display: none; }
.genprep-settings-dialog::backdrop { inset: var(--genprep-header-bottom, 0px) 0 0; background: var(--aidc-backdrop); }
.genprep-settings-card { display: flex; flex-direction: column; gap: 12px; width: min(100%, 680px); max-height: 100%; margin: 0 auto; padding: 16px; border: 1px solid var(--aidc-border-default); border-radius: 20px; background: var(--aidc-bg-modal); box-shadow: var(--aidc-shadow-popover); box-sizing: border-box; }
.genprep-settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.genprep-settings-heading h2 { margin: 0; font-size: 16px; color: var(--aidc-text-primary); letter-spacing: normal; }
.genprep-settings-close { font-size: 26px; }
.genprep-settings-content { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.genprep-settings-content > * { flex: 0 0 auto; }
.genprep-settings-content .smart-row { align-items: start; }
body .genprep-select-popover { position: fixed; inset: auto; margin: 0; transform: none; max-height: min(220px, 40dvh); box-sizing: border-box; background: var(--aidc-bg-popover); color: var(--aidc-text-primary); border-color: var(--aidc-border-default); box-shadow: var(--aidc-shadow-popover); }
body .genprep-select-popover:not(:popover-open) { display: none !important; }
body .genprep-select-popover:popover-open { display: block; }
.genprep-compact .tg-create-panels { display: flex; flex-direction: column; gap: 14px; }
.genprep-compact [data-prep-section="refs"] { padding: 14px; border: 1px solid var(--aidc-border-subtle); border-radius: 16px 16px 0 0; border-bottom: 0; background: var(--aidc-bg-panel); }
.genprep-compact [data-prep-section="prompt"] { margin-top: -14px; padding: 0 14px 14px; border: 1px solid var(--aidc-border-subtle); border-top: 0; border-radius: 0 0 16px 16px; background: var(--aidc-bg-panel); }
.genprep-compact [data-ref-module] .refp-shell { padding: 0; border: 0; box-shadow: none; background: transparent; }
/* Reference and prompt headings share one typographic role in compact preparation. */
body.aidc-compact-generator .genprep-compact .refp-title,
body.aidc-compact-generator .genprep-compact .refp-prompt .refp-label-text {
  font-size: var(--aidc-font-size-control);
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aidc-text-primary);
}
body.aidc-compact-generator .tg-project-bar__title { width: 100%; min-width: 0; }
body.aidc-compact-generator .tg-project-bar__actions { display: none; }
body.aidc-compact-generator .aidc-generation-destination-cue { flex-direction: column; align-items: stretch; }
body.aidc-compact-generator .aidc-generation-destination-cue__actions { width: 100%; }
body.aidc-compact-generator .aidc-generation-destination-cue__actions button { flex: 1; }
@media (max-width: 1200px) {
  body.aidc-compact-generator .generation-panel { padding: 14px; flex: 0 0 auto; overflow: visible; }
  body.aidc-compact-generator .generation-panel__content,
  body.aidc-compact-generator .generation-panel .aidc-scroll-host,
  body.aidc-compact-generator .genprep-panel > [data-module] { overflow: visible !important; height: auto; flex: 0 0 auto; }
  body.aidc-compact-generator .generation-panel__header { gap: 0; }
}

body.aidc-compact-generator .genprep-compact[hidden] { display: flex !important; }
body.aidc-compact-generator #genprepFolderPlaceholder { display: none !important; }
.generator-catalog-status{margin:0;padding:24px;color:var(--aidc-text-secondary);font-size:13px;line-height:1.5}

/* Preserve the canonical renderer's complete form hierarchy. Only its presentation
   changes while closed; the full live shell enters the modal while open. */
.genprep-model-shell:not(.genprep-settings-open) > :not(.ms-meta):not(.genprep-model-row):not(.genprep-generation-dock):not(.aidc-3d-status) { display: none !important; }
.genprep-model-shell:not(.genprep-settings-open) > .ms-meta > :not(.genprep-model-row) { display: none !important; }
.genprep-settings-open .genprep-model-row { display: none !important; }
.genprep-settings-open .ms-meta { display: flex; flex-direction: column; }
.genprep-settings-open > .ms-mode-row { display: flex; flex-direction: column; }

/* Folding preparation must not fold away the viewport-owned launch control. */
body.aidc-compact-generator .genprep-compact.is-collapsed .generation-panel__content,
body.aidc-compact-generator .panel.is-collapsed .tg-create-panel.genprep-compact {
  display: flex !important;
  flex-direction: column;
  flex: 0 0 auto !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  visibility: hidden;
  pointer-events: none;
}
body.aidc-compact-generator .genprep-generation-dock {
  visibility: visible;
  pointer-events: auto;
}

/* First paint is already compact, including cold/slow module loads. The WebApp
   declares its classes in HTML; responsive web uses the same initial geometry. */
@media (max-width: 1200px) {
  body[data-compact-prep] .genprep-tabs { display: none !important; }
  body[data-compact-prep] .genprep-panel,
  body[data-compact-prep] .genprep-panel[hidden] { display: flex !important; flex-direction: column; flex: 0 0 auto; }
}
.genprep-loading { display: none; }
body.aidc-tg[data-compact-prep] .genprep-loading { display: flex; }
@media (max-width: 1200px) {
  body[data-compact-prep] .genprep-loading { display: flex; }
}
body[data-compact-prep] .genprep-loading { align-items: center; min-height: 52px; padding: 12px 16px; box-sizing: border-box; border: 1px solid var(--aidc-border-subtle); border-radius: 12px; background: var(--aidc-bg-panel); color: var(--aidc-text-secondary); }

/* Preserve the concurrently delivered audio form and its authoritative estimate. */
/* Reserve the measured dock at the end of the page, after the feed. */
body.aidc-compact-generator[data-page-type="audio"] { padding-bottom: calc(var(--aidc-audio-dock-height, 180px) + 16px + env(safe-area-inset-bottom, 0px)); }
body.aidc-compact-generator .audio-submit.genprep-generation-dock { display: grid; gap: 8px; }
body.aidc-compact-generator .audio-submit.genprep-generation-dock > * { width: min(100%, 680px); margin: 0 auto; }
body.aidc-compact-generator .audio-submit.genprep-generation-dock .audio-price { gap: 3px; }
body.aidc-compact-generator .audio-submit.genprep-generation-dock .audio-submit-actions { justify-content: stretch; }
body.aidc-compact-generator .audio-submit.genprep-generation-dock [data-submit] { flex: 1; }


/* Closed model controls form the same inset card and 32px action row as projects. */
.genprep-model-shell:not(.genprep-settings-open) { padding: 10px 12px !important; border: 1px solid var(--aidc-border-subtle) !important; border-radius: 11px; background: var(--aidc-bg-panel) !important; box-sizing: border-box; }
.genprep-compact .genprep-model-row .ms-dropdown__toggle { min-height: 32px; height: 32px; padding-top: 0; padding-bottom: 0; box-sizing: border-box; white-space: nowrap; display: block; overflow: hidden; text-overflow: ellipsis; }
.genprep-model-row .ms-dropdown__toggle > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.genprep-compact .genprep-settings-toggle { min-height: 32px; height: 32px; box-sizing: border-box; }

/* Vertical gestures over range controls belong to the settings scroller. */
.genprep-settings-content input[type="range"] { touch-action: pan-y; }
