/* Shared controls for Inspiration and Generation. */
.image-spec-menu.viewport-fitted {
  position: fixed;
  z-index: 150;
  right: auto;
  bottom: auto;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: none;
  transform: none;
}

@media (min-width: 681px) {
  body.inspiration-open .direct-studio.inspiration-home .direct-layout {
    margin-top: clamp(64px, 14vh, 140px);
  }
}

.direct-toolbar { display: block; }
.direct-tool-group { width: 100%; display: grid; gap: 8px; }
.direct-tool-row { min-width: 0; display: flex; align-items: center; gap: 7px; }
.direct-tool-primary { flex-wrap: wrap; }

.direct-composer-card .direct-toolbar { border-top-color: transparent; }
.direct-composer-card .direct-tool-primary { align-items: center; }
.direct-composer-card .direct-tool-primary > .reference-picker { order: 10; flex: 0 0 auto; }
.direct-composer-card .direct-tool-primary > .direct-clear-all { order: 11; flex: 0 0 auto; }
.direct-composer-card .direct-tool-primary :is(.creation-type-pill, .model-picker-trigger, .image-spec-trigger, .duration-stepper, .reference-trigger, .direct-clear-all) { box-sizing: border-box; height: 40px; min-height: 40px; box-shadow: none; }
.direct-composer-card .direct-tool-primary > .direct-submit-cluster { order: 12; margin-left: auto; }

.direct-tool-primary > .direct-submit-cluster {
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
}

.direct-submit-cluster .direct-price-estimate {
  min-height: 38px;
  padding-inline: 13px;
  border-color: #d8e7e0;
  color: #17765e;
  background: #f5fbf8;
  font-size: 12px;
  font-weight: 750;
}

.direct-submit-cluster .direct-generate { flex: 0 0 46px; }

/* A compact creation dock: one shell, a left reference rail, and text that grows upward. */
.direct-studio:not(.has-session-history) .direct-layout {
  min-height: clamp(280px, 38vh, 380px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
}
.direct-composer-card:not(.is-prompt-fullscreen) {
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid #e0e3e8;
  border-radius: 19px;
  box-shadow: 0 9px 32px rgba(35,43,52,.1);
}
.direct-composer-card:not(.is-prompt-fullscreen):focus-within {
  border-color: #bbb8ef;
  box-shadow: 0 0 0 3px rgba(92,86,232,.07), 0 12px 34px rgba(35,43,52,.11);
}
.direct-composer-card:not(.is-prompt-fullscreen) .direct-input-surface {
  position: relative;
  display: grid;
  grid-template-columns: minmax(76px, auto) minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.direct-composer-card:not(.is-prompt-fullscreen) .direct-input-surface:focus-within {
  border: 0;
  box-shadow: none;
}
.direct-composer-card:not(.is-prompt-fullscreen) #directPrompt {
  grid-column: 2;
  grid-row: 1;
  min-height: 58px;
  max-height: min(240px, 42vh);
  padding: 7px 44px 24px 2px;
  border: 0;
  resize: none;
  overflow-y: hidden;
  line-height: 1.65;
}
.direct-composer-card:not(.is-prompt-fullscreen) .direct-prompt-meta {
  position: absolute;
  right: 43px;
  bottom: 5px;
  z-index: 3;
  margin: 0;
}
.direct-composer-card:not(.is-prompt-fullscreen) .direct-prompt-fullscreen {
  top: 4px;
  right: 2px;
}

.direct-assets {
  grid-column: 1;
  grid-row: 1;
  display: block;
  min-width: 76px;
  min-height: 64px;
  padding: 2px 0 0 6px;
}
.direct-asset-stack { width: 100%; min-width: 0; overflow: visible; padding-left: 8px; }
.direct-asset-stack > .direct-add-card:first-child { margin-left: 0; }

/* Model details stay out of the composer and appear only while inspecting a model. */
.model-detail-tooltip {
  position: fixed;
  z-index: 1200;
  display: grid;
  gap: 5px;
  width: min(360px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
  color: #f7f8f8;
  background: #242626;
  box-shadow: 0 10px 28px rgba(12,18,16,.28);
  pointer-events: none;
  animation: model-detail-in .12s ease both;
}
.model-detail-tooltip.hidden { display: none; }
.model-detail-tooltip .model-detail-face {
  justify-self: start;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
}
.model-detail-tooltip .model-detail-face.is-open { color: #9bf1c6; border-color: #2d8d62; background: #123d2c; }
.model-detail-tooltip .model-detail-face.is-locked { color: #ffc1b8; border-color: #a64a3e; background: #4a211d; }
.model-detail-tooltip strong { font-size: 11px; font-weight: 700; line-height: 1.55; }
.model-detail-tooltip span { color: #bfc5c2; font-size: 10px; line-height: 1.45; }
@keyframes model-detail-in { from { opacity: 0; transform: translateY(3px); } }

/* One icon is the single entrance and exit for focused prompt editing. */
.direct-input-surface { position: relative; }
.direct-prompt-fullscreen {
  position: absolute;
  z-index: 8;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #68746f;
  background: rgba(255,255,255,.88);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.direct-prompt-fullscreen:hover { border-color: #d8e2de; color: #26352f; background: #f6faf8; }
.direct-prompt-fullscreen:focus-visible { outline: 3px solid rgba(48,157,123,.18); outline-offset: 2px; }
.direct-prompt-fullscreen svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.direct-prompt-fullscreen .collapse-mark { display: none; }
.direct-prompt-fullscreen[aria-expanded="true"] .expand-mark { display: none; }
.direct-prompt-fullscreen[aria-expanded="true"] .collapse-mark { display: block; }

html { scrollbar-gutter: stable; }
body.direct-prompt-fullscreen-open { overflow: hidden; }
.direct-composer-card.is-prompt-fullscreen {
  position: fixed;
  z-index: 1000;
  top: auto;
  right: auto;
  bottom: var(--prompt-fullscreen-bottom, 18px);
  left: var(--prompt-fullscreen-left, 18px);
  width: var(--prompt-fullscreen-width, calc(100vw - 36px));
  height: min(760px, calc(100vh - var(--prompt-fullscreen-bottom, 18px) - 18px));
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 19px 15px;
  border-radius: 24px;
  background: rgba(255,255,255,.99);
  box-shadow: 0 28px 74px rgba(22,30,35,.2);
  transform: none;
  will-change: transform;
}
.direct-composer-card.is-prompt-fullscreen .direct-input-surface { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.direct-composer-card.is-prompt-fullscreen #directPrompt { min-height: 0; max-height: none; flex: 1 1 auto; resize: none; }
.direct-composer-card.is-prompt-fullscreen .direct-toolbar { flex: 0 0 auto; }

@media (max-width: 980px) {
  .direct-tool-primary > .direct-submit-cluster { width: 100%; margin-left: 0; }
}

@media (max-width: 760px) {
  .direct-studio:not(.has-session-history) .direct-layout { min-height: 150px; }
  .direct-composer-card:not(.is-prompt-fullscreen) .direct-input-surface { grid-template-columns: 70px minmax(0, 1fr); column-gap: 7px; }
  .direct-composer-card:not(.is-prompt-fullscreen) #directPrompt { min-height: 64px; max-height: min(220px, 38vh); padding-right: 38px; }
  .direct-composer-card:not(.is-prompt-fullscreen) .direct-prompt-meta { right: 37px; }
  .direct-assets { min-width: 70px; padding-left: 4px; }
  .direct-tool-primary > .direct-submit-cluster { width: 100%; flex-direction: row; align-items: center; }
  .direct-submit-cluster .direct-price-estimate { flex: 1 1 auto; width: auto; }
  .direct-submit-cluster .direct-generate { width: 46px; padding: 0; background: transparent; }
  .direct-submit-cluster .direct-generate span { display: none; }
  .direct-submit-cluster .direct-generate b { width: 42px; height: 42px; color: #fff; background: #00a7e8; }
  .direct-composer-card.is-prompt-fullscreen { right: auto; bottom: 9px; left: 9px; width: calc(100vw - 18px); height: calc(100vh - 18px); padding: 12px; border-radius: 18px; }
  .direct-composer-card.is-prompt-fullscreen .direct-assets { min-height: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  .direct-prompt-fullscreen { transition: none; }
}
.direct-count {
  font-variant-numeric: tabular-nums;
  transition: color 160ms ease;
}

.direct-count.near-limit {
  color: #b06a18;
  font-weight: 750;
}

.direct-prompt-meta { gap: 10px; }
.direct-prompt-optimize {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid #dcd9fb;
  border-radius: 999px;
  color: #5751c9;
  background: rgba(248,247,255,.96);
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.direct-prompt-optimize:hover { border-color: #bdb8f5; background: #f1efff; }
.direct-prompt-optimize:disabled { color: #8a879c; background: #f4f4f6; cursor: wait; }
.direct-prompt-optimize span { font-size: 12px; }

@media (max-width: 680px) {
  .direct-prompt-meta {
    width: calc(100% - 26px);
    justify-content: space-between;
  }
}
