/* Phone-only Image workspace composition.
   This file intentionally loads after responsive, shell, and prompt-composer
   styles so one cascade owner controls the floating composer and More sheet. */

@media (max-width: 767px) {
  body.vix-app-shell-v2 #imageSection.image-command-mode {
    --vix-image-mobile-gap: 10px;
    --vix-image-mobile-edge: 10px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode > .image-command-overlay {
    inset: auto 0 0 !important;
    padding: 0 var(--vix-image-mobile-edge)
      max(var(--vix-image-mobile-edge), var(--vix-shell-safe-bottom)) !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode > .image-command-overlay > .image-command-bar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    padding: 9px !important;
    border-radius: 18px !important;
    overflow: hidden !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-left {
    display: grid;
    grid-template-rows: auto auto auto auto;
    gap: 7px;
    width: 100%;
    min-width: 0;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-ref-row {
    max-height: 70px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-main {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 30px auto !important;
    gap: 4px !important;
    align-items: stretch !important;
    width: 100%;
    min-width: 0;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-prompt-tools {
    position: static !important;
    grid-row: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    min-height: 30px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode #imageCommandPrompt.image-command-prompt {
    grid-row: 2;
    display: block;
    width: 100%;
    height: auto;
    min-height: 96px !important;
    max-height: 128px !important;
    padding: 9px 7px !important;
    border-radius: 10px !important;
    background: rgba(0, 0, 0, 0.13) !important;
    font-size: 16px !important;
    line-height: 1.42;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  body.vix-prompt-composer-v2 #imageCommandOverlay #imageCommandBar:not(.vix-prompt-expanded) {
    overflow: hidden !important;
  }

  body.vix-prompt-composer-v2 #imageCommandOverlay #imageCommandBar.vix-prompt-expanded {
    position: relative !important;
    inset: auto !important;
    z-index: calc(var(--vix-z-modal, 2000) + 2) !important;
    display: grid !important;
    width: 100% !important;
    max-width: none !important;
    max-height: min(calc(78dvh - var(--vix-keyboard-inset, 0px)), 640px) !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  body.vix-prompt-composer-v2 #imageCommandBar.vix-prompt-expanded #imageCommandPrompt.vix-prompt-field {
    min-height: min(44dvh, 360px) !important;
    max-height: min(58dvh, 480px) !important;
  }

  body.vix-prompt-composer-v2 #imageCommandOverlay > .vix-prompt-sheet-backdrop.visible,
  body.vix-prompt-composer-v2 #imageCommandOverlay > #imageCommandBar {
    pointer-events: auto;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-controls-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-controls {
    display: contents !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-controls::after {
    display: none !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-controls-row
    > :is(.image-command-controls, #imageCommandMore),
  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-controls
    > :is(.image-command-icon-btn, #imageCommandAspect, .image-command-model-picker, .image-command-count-control),
  body.vix-app-shell-v2 #imageSection.image-command-mode #imageCommandMore {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
    font-size: clamp(0.69rem, 3.1vw, 0.8rem) !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-model-picker {
    display: inline-flex;
    flex: none;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-model-picker .model-picker-current,
  body.vix-app-shell-v2 #imageSection.image-command-mode #imageCommandAspect,
  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-count-control {
    min-height: 44px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-icon-btn {
    padding-inline: 5px !important;
    white-space: normal;
    line-height: 1.1;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-count-control {
    justify-content: space-between;
    padding: 3px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-stepper-btn {
    width: 32px;
    height: 36px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-count-value {
    min-width: 0;
    font-size: clamp(0.72rem, 3vw, 0.86rem);
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-extra-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-extra-controls:empty {
    display: none;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-extra-controls
    > :not(.image-command-control-hidden) {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 44px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-action-rail {
    width: 100%;
    min-height: 48px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode .image-command-generate-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 13px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode > .left-panel {
    position: fixed !important;
    inset: auto auto auto 0 !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    max-height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode.show-image-advanced > .left-panel {
    left: var(--vix-image-mobile-edge) !important;
    right: var(--vix-image-mobile-edge) !important;
    top: calc(var(--vix-shell-top-inset) + var(--vix-image-mobile-gap)) !important;
    bottom: var(--vix-image-more-panel-bottom, 10px) !important;
    z-index: calc(var(--vix-z-sticky-action, 800) + 5) !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    box-sizing: border-box !important;
    padding: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 18px !important;
    opacity: 1 !important;
    overflow: hidden !important;
    pointer-events: auto !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode.show-image-advanced
    > .left-panel .image-more-panel-header {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    padding: 2px 0 10px;
    background: transparent;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode.show-image-advanced
    > .left-panel .image-more-dock-controls {
    display: none !important;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode.show-image-advanced
    > .left-panel .image-more-panel-close {
    display: inline-grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 12px;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode.show-image-advanced
    > .left-panel .image-more-panel-close svg {
    display: block;
  }

  body.vix-app-shell-v2 #imageSection.image-command-mode.show-image-advanced > .left-panel .content {
    min-height: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}
