/* Shared mobile workspace for image creation and editing tools. */
@media (max-width: 720px) {
  html:has(body[data-image-mobile-template]:not(.mobile-crypto-section-calculator)) {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
  }

  body[data-image-mobile-template] {
    --image-mobile-nav-height: 64px;
    --image-mobile-subnav-height: 64px;
    --image-mobile-sheet-default-height: 304px;
    --image-mobile-sheet-max-height: 75dvh;
  }

  body[data-image-mobile-template] .mobile-page-title,
  body[data-image-mobile-template] .mobile-editor-menu,
  body[data-image-mobile-template] .mobile-guide-modal {
    display: none !important;
  }

  body[data-image-mobile-template] .mobile-editor-toolbar
    > :not(#mobileToolbarClear):not(#mobileToolbarReset):not(#mobileToolbarDownload) {
    display: none !important;
  }

  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) {
    height: auto !important;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) .wrap {
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
  }

  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) .calculator-page,
  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) .calculator-grid,
  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) .calculator-main {
    display: block !important;
    width: 100%;
    min-width: 0;
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
  }

  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) .calculator-page {
    margin: 0;
    padding: 14px 10px 88px;
    box-sizing: border-box;
  }

  body[data-image-mobile-template]:not(.mobile-crypto-section-calculator) .calculator-main > section {
    display: block !important;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  body[data-image-mobile-template].mobile-crypto-section-overview #overview,
  body[data-image-mobile-template].mobile-crypto-section-howto #howto,
  body[data-image-mobile-template].mobile-crypto-section-guide #guide,
  body[data-image-mobile-template].mobile-crypto-section-faq #faq {
    display: block !important;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  body[data-image-mobile-template].mobile-crypto-section-faq
    #imageEffectPanel[data-image-mobile-related-panel] {
    display: block !important;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  body[data-image-mobile-template].mobile-crypto-section-calculator {
    padding-bottom: calc(
      var(--image-mobile-nav-height) +
      var(--image-mobile-subnav-height) +
      env(safe-area-inset-bottom, 0px)
    );
  }

  body[data-image-mobile-template] .mobile-editor-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    width: auto;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: var(--image-mobile-toolbar-background, transparent);
  }

  body[data-image-mobile-template][data-image-mobile-toolbar="transparent"] {
    --image-mobile-toolbar-background: transparent;
  }

  body[data-image-mobile-template][data-image-mobile-toolbar="solid"] {
    --image-mobile-toolbar-background: var(--image-mobile-toolbar-solid, #fff);
  }

  body[data-image-mobile-template][data-image-mobile-toolbar="solid"] .mobile-editor-toolbar {
    top: 4px;
    right: 4px;
    gap: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-radius: 9px;
    overflow: hidden;
  }

  body[data-image-mobile-template][data-image-mobile-toolbar="solid"]
    .mobile-editor-toolbar .mobile-icon-button {
    width: 28px;
    height: 32px;
    margin: 0;
    padding: 4px 2px;
  }

  body[data-image-mobile-template][data-image-mobile-toolbar="solid"]
    .mobile-editor-toolbar .mobile-icon-button svg {
    width: 19px;
    height: 19px;
  }

  body[data-image-mobile-template] .mobile-editor-toolbar .mobile-icon-button {
    width: 38px;
    height: 38px;
    border: 0;
    color: var(--text, #1d2939);
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  body[data-image-mobile-template] .canvas-wrapper > .placeholder {
    transform: translateY(-16.667%);
  }

  body[data-image-mobile-template] #imageEffectToolSection #canvasDropZone {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  body[data-image-mobile-template] #imageEffectToolSection .image-canvas-frame {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }

  body[data-image-mobile-template] #imageEffectToolSection .image-canvas-shell {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }

  body[data-image-mobile-template] #imageEffectToolSection .image-canvas-frame > .canvas-wrapper {
    width: 100% !important;
    flex: 1 1 100% !important;
    align-self: stretch !important;
  }

  body[data-image-mobile-template] #imageEffectToolSection #canvasDropZone > .canvas-container {
    position: relative !important;
    align-self: center !important;
    margin-top: 0 !important;
    margin-bottom: auto !important;
  }

  body[data-image-mobile-template] .mobile-effect-controls {
    position: fixed;
    right: 0;
    bottom: calc(var(--image-mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    left: 0;
    z-index: 101;
    height: var(--image-mobile-subnav-height) !important;
    min-height: var(--image-mobile-subnav-height) !important;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    transition: height .28s cubic-bezier(.22, 1, .36, 1);
  }

  body[data-image-mobile-template] .mobile-effect-controls.is-drawer-open {
    height: min(
      var(--mobile-sheet-height, var(--image-mobile-sheet-default-height)),
      var(--image-mobile-sheet-max-height)
    ) !important;
    min-height: min(
      var(--mobile-sheet-height, var(--image-mobile-sheet-default-height)),
      var(--image-mobile-sheet-max-height)
    ) !important;
    border-radius: 28px 28px 0 0;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -10px 28px rgba(16, 24, 40, .1);
  }

  body[data-image-mobile-template] .mobile-effect-controls.is-resizing {
    transition: none;
  }

  body[data-image-mobile-template].mobile-crypto-section-calculator .crypto-mobile-nav {
    height: calc(
      var(--image-mobile-nav-height) +
      var(--image-mobile-subnav-height) +
      env(safe-area-inset-bottom, 0px)
    );
    padding: calc(var(--image-mobile-subnav-height) + 8px) 4px
      calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: 28px 28px 0 0;
  }

  body[data-image-mobile-template] .mobile-effect-controls .mobile-bottom-dock,
  body[data-image-mobile-template] .mobile-effect-controls:not(.is-drawer-open) .mobile-bottom-dock {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: var(--image-mobile-subnav-height) !important;
    min-height: var(--image-mobile-subnav-height) !important;
    padding: 18px 12px 8px !important;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-image-mobile-template] .mobile-bottom-dock::after {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    transform: translateX(-50%);
  }

  body[data-image-mobile-template] .mobile-effect-controls.is-drawer-open .mobile-bottom-dock {
    border-top: 1px solid var(--border, #e3ebf5);
  }

  body[data-image-mobile-template] .mobile-effect-controls.is-drawer-open .mobile-bottom-dock::after {
    content: none;
    display: none;
  }

  body[data-image-mobile-template] .mobile-dock-button {
    position: relative;
    z-index: 1;
    min-height: 36px !important;
    padding: 0 2px !important;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted, #667085);
    font: inherit;
    font-size: .72rem;
    font-weight: 800;
  }

  body[data-image-mobile-template] .mobile-dock-button::before {
    content: "";
    position: absolute;
    inset: 1px 3px;
    z-index: -1;
    border-radius: 999px;
  }

  body[data-image-mobile-template] .mobile-dock-button.is-active {
    color: var(--brand, #0f67d8);
  }

  body[data-image-mobile-template] .mobile-dock-button.is-active::before {
    background: var(--brand-soft, #edf4ff);
  }

  body[data-image-mobile-template] .mobile-effect-drawer {
    position: absolute;
    inset: 0 0 var(--image-mobile-subnav-height);
    z-index: 1;
    display: block;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
  }

  body[data-image-mobile-template] .mobile-effect-drawer.is-collapsed {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  body[data-image-mobile-template] .mobile-effect-drawer:not(.is-collapsed) {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  body[data-image-mobile-template] .mobile-effect-drawer:not(.is-collapsed) .mobile-panel-host {
    display: block;
    visibility: visible;
    opacity: 1;
    height: calc(100% - 32px);
    max-height: none;
    padding: 4px 12px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme="dark"] body[data-image-mobile-template] .mobile-effect-controls.is-drawer-open {
    background: rgba(13, 17, 23, .98);
  }

  html[data-theme="dark"] body[data-image-mobile-template] .mobile-bottom-dock::after {
    background: #57606a;
  }
}
