/* ==========================================================================
   Mobile workspace polish for every public tool page and the AI workbench.
   Loaded last (after the per-tool CSS and tool-viewport.css) so this file can
   own the phone layout without rewriting each workbench stylesheet.

   Rules of the mobile layout:
   1. The sticky preview keeps only the canvas and one compact control row.
      Section intros, helper paragraphs and duplicated upload cards step aside.
   2. Preview heights are viewport-relative and never clip the artwork: every
      canvas workbench redraws through a ResizeObserver with a "contain" fit.
   3. The fixed bottom navigation never covers the last control: every scroll
      rail reserves the nav height plus breathing room.
   ========================================================================== */

@media (max-width: 1023px) {
  /* ------------------------------------------------------------------------
     1 · Shared studio chrome
     ------------------------------------------------------------------------ */

  /* One slim identity strip instead of the desktop bar + footnote. The tool
     name stays visible; the repeated privacy/hint pills and the bottom format
     line step aside. */
  .tool-detail .tstudio-console__bar {
    min-height: 0;
    padding: 7px 14px;
    border-bottom: 1px solid var(--ts-line);
    background: transparent;
  }

  .tool-detail .tstudio-console__bar :is(.tstudio-console__kicker, .tstudio-console__meta) {
    display: none;
  }

  .tool-detail .tstudio-console__bar .tstudio-console__id strong {
    font-size: 12px;
  }

  .tool-detail .tstudio-console__bar .tstudio-console__id strong::before {
    margin-right: 7px;
  }

  .tool-detail .tstudio-console__bar .tstudio-console__live {
    width: 6px;
    height: 6px;
  }

  .tool-detail .tstudio-console__foot {
    display: none !important;
  }

  /* The control sheet owns the bottom of the page now, so the page itself no
     longer needs a trailing spacer; the sheet bleeds to the viewport edge. */
  .tool-detail[data-tstudio="v1"] {
    padding-bottom: 0;
  }

  .tool-detail .tstudio-workspace {
    margin-top: 0;
    scroll-margin-top: calc(var(--tool-sticky-top, 96px) + 8px);
  }

  .tool-detail .tstudio-console {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
  }

  /* The console identity bar repeated the tool name that the sticky header
     already shows; removing it returns ~44px to the artwork and the sheet. */
  .tool-detail .tstudio-console__bar {
    display: none;
  }

  /* The mobile shell (tool-mobile-shell.css) owns the preview / sheet split.
     Nothing here may pin the sheet's overflow, or the shell's scroll pane
     would be overridden by a more specific legacy selector. */

  /* The shell used to reserve room under the page for the fixed bottom nav.
     The sheet already pads for it, so that trailing gap only pushed the sheet
     away from the real bottom edge. */
  body.page_tool_detail .page-shell,
  body.page_ai_workbench .page-shell,
  body.page_tool_detail .page-main,
  body.page_ai_workbench .page-main {
    padding-bottom: 0 !important;
  }

  /* Full-bleed workspace: the preview keeps a small gutter, the sheet reaches
     both screen edges so its bottom corners are square at the page bottom. */
  .tool-detail {
    padding: 0 !important;
  }

  /* Keep the last control above the fixed bottom navigation: the sheet's own
     bottom padding already reserves the nav height (see the shell rules above)
     plus breathing room, so no extra rail scroll is needed here. */

  /* Status / helper lines stay, but as one quiet line instead of a paragraph. */
  .tool-detail :is(.sll-status, .ms-status, .ic-status) {
    margin: 4px 0 0 !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
    max-height: 3em;
    overflow: hidden;
  }

  /* Long "how it works" copy next to the preview is noise on a phone. Errors
     remain visible because they use their own class/tone. Legal/privacy notes
     and in-panel field help stay where they are. */
  .tool-detail :is(.perspective-hint, .sll-summary, .ms-note, .stage-hint, .loader-sub) {
    display: none !important;
  }

  .tool-detail :is(.palette-tool__status, .image-upscale__status, .ic-status):not(.is-error):not([data-tone="error"]) {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     2 · Perspective grid
     ------------------------------------------------------------------------ */

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-toolbar {
    gap: 6px;
    padding: 0 0 6px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__mode-group button {
    min-height: 36px;
    padding: 4px 8px;
    font-size: 12px;
    gap: 4px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__mode-group button svg {
    width: 16px;
    height: 16px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-actions {
    gap: 4px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-actions button {
    min-height: 30px;
    padding: 3px 8px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-wrap {
    height: clamp(170px, 24dvh, 210px);
    min-height: 0;
    max-height: none;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-section {
    padding: 8px;
  }

  /* The reference-image card is the first control; keep it as a 56px row. */
  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__vision-panel {
    padding: 8px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-area {
    min-height: 0;
    margin-top: 6px;
    padding: 8px 10px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-empty {
    flex-direction: row;
    gap: 8px;
    min-height: 0;
    padding: 8px;
    border-radius: 10px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-empty strong {
    font-size: 12.5px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-empty small {
    display: none;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-icon {
    width: 26px;
    height: 26px;
    font-size: 15px;
  }

  /* ------------------------------------------------------------------------
     3 · Space light lab
     ------------------------------------------------------------------------ */

  .tool-detail[data-tool-slug="space-light-lab"] .sll-stagebar {
    gap: 8px;
    padding: 0;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-mode-tabs {
    width: 100%;
    flex: 1 1 auto;
    margin-left: 0;
    padding: 3px;
    border-radius: 12px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-mode-tabs button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-viewport {
    height: clamp(160px, 24dvh, 200px);
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 16px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-drop-hint {
    gap: 4px;
    padding: 12px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-drop-hint strong {
    font-size: 15px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-drop-hint__sub,
  .tool-detail[data-tool-slug="space-light-lab"] .sll-drop-hint small {
    display: none;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-drop-hint__cta {
    min-height: 38px;
    margin-top: 4px;
    padding: 0 16px;
    font-size: 13px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-aperture {
    width: 44px;
    height: 44px;
    margin-bottom: 0;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-aperture i:nth-child(2) {
    inset: 8px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-aperture i:nth-child(3) {
    inset: 17px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-rail {
    padding: 4px;
    gap: 4px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-rail button {
    min-height: 44px;
    padding: 4px 2px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-import {
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-import__copy {
    display: none;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-file-button {
    width: 100%;
    min-height: 38px;
    justify-content: center;
    font-size: 12.5px;
  }

  /* The depth thumbnail stacks above its slider under 380px; cap it so it does
     not become a second hero image in the control rail. */
  .tool-detail[data-tool-slug="space-light-lab"] .sll-depth-preview {
    height: 120px;
    max-height: 120px;
    aspect-ratio: auto;
  }

  /* ------------------------------------------------------------------------
     4 · Material segment
     ------------------------------------------------------------------------ */

  .tool-detail[data-tool-slug="material-segment"] .ms-stagebar {
    gap: 6px;
    padding: 0;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-history button {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-views button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-viewport {
    height: clamp(160px, 24dvh, 200px);
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 14px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-empty {
    gap: 4px;
    padding: 12px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-empty strong {
    font-size: 15px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-empty__sub,
  .tool-detail[data-tool-slug="material-segment"] .ms-empty small {
    display: none;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-empty__mark {
    width: 40px;
    height: 40px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-empty__cta {
    min-height: 38px;
    padding: 0 16px;
    font-size: 13px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-dock {
    margin-top: 6px;
    padding: 4px;
    gap: 4px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-dock button {
    height: 44px;
    min-width: 48px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-step {
    padding: 10px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-hint {
    display: none;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-filebtn {
    min-height: 40px;
  }

  /* ------------------------------------------------------------------------
     5 · Palette extractor
     ------------------------------------------------------------------------ */

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__stage {
    height: clamp(160px, 24dvh, 200px);
    border-radius: 14px;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__empty {
    gap: 4px;
    padding: 12px;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__empty strong {
    font-size: 15px;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .pt-empty__sub,
  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__empty small {
    display: none;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .pt-empty__swatches i {
    width: 22px;
    height: 34px;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__mobile-actions {
    gap: 6px;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__mobile-actions button {
    min-height: 36px;
    border-radius: 10px;
    font-size: 12px;
  }

  /* An empty "recent uploads" card is pure height before the first image. */
  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool[data-state="empty"] .pt-recent {
    display: none;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .pt-card {
    padding: 10px;
    border-radius: 14px;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__strip {
    height: 56px;
  }

  /* ------------------------------------------------------------------------
     6 · Watermark remover
     ------------------------------------------------------------------------ */

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench > .tool-state[data-points-quota] {
    display: none !important;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .model-loader {
    margin: 0 0 8px;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .loader-head strong {
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .loader-meta {
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .progress-track {
    height: 3px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .dropzone {
    flex: none;
    height: clamp(160px, 24dvh, 200px);
    max-height: clamp(160px, 24dvh, 200px);
    min-height: 0;
    padding: 12px;
    overflow: hidden;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .canvas-area {
    padding: 10px;
    min-height: 0;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .dropzone-inner {
    gap: 9px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .dropzone-title {
    font-size: 17px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .dropzone-sub,
  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .dropzone-formats {
    display: none;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .dropzone-icon {
    width: 40px;
    height: 40px;
  }

  /* The sidebar status pill repeats the model-loader strip above. */
  .tool-detail[data-tool-slug="watermark-remover"] .sidebar .status-pill {
    display: none;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .editor,
  .tool-detail[data-tool-slug="watermark-remover"] .watermark-workbench .stage {
    height: clamp(160px, 24dvh, 200px);
    min-height: 0;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .sidebar .card {
    padding: 10px;
  }

  /* ------------------------------------------------------------------------
     7 · Image converter
     ------------------------------------------------------------------------ */

  .tool-detail[data-tool-slug="image-converter"] .ic-welcome {
    gap: 12px;
    padding: 16px 14px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-welcome__copy h2 {
    font-size: 22px;
    line-height: 1.3;
    margin-bottom: 0;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-welcome__copy p,
  .tool-detail[data-tool-slug="image-converter"] .ic-welcome__formats {
    display: none;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-drop {
    min-height: 140px;
    height: 150px;
    max-height: 170px;
    padding: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-drop strong {
    font-size: 15px;
    padding: 9px 22px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-drop p,
  .tool-detail[data-tool-slug="image-converter"] .ic-drop small {
    display: none;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-drop__icon {
    width: 30px;
    height: 30px;
    margin-bottom: 8px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview__stage {
    height: clamp(150px, 22dvh, 190px);
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview__empty {
    padding: 14px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-detail {
    margin: 4px 0 0;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-warnings:empty {
    display: none;
  }

  /* Loaded workspace: the preview becomes one floating card, the queue and the
     settings become separate cards below it instead of a full-bleed column. */
  .tool-detail[data-tool-slug="image-converter"] .tstudio-console {
    padding: 8px;
    border: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-workspace {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-main {
    display: block;
    padding: 10px;
    border: 1px solid var(--ts-line);
    border-radius: 16px;
    background: var(--ts-surface);
    box-shadow: 0 10px 24px -22px var(--ts-shadow);
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview {
    padding: 0;
    background: none;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview__head {
    margin-bottom: 8px;
    min-height: 28px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview__title h2 {
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview__title > span {
    font-size: 12px;
    padding: 2px 4px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-view-switch button {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-preview__stage {
    height: clamp(160px, 24dvh, 200px);
    border-radius: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-main .ic-detail {
    margin-top: 6px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-controls {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--ts-line);
    border-radius: 16px;
    background: var(--ts-surface);
    align-self: stretch;
  }

  /* The queue is moved to the top of the control rail on phones. */
  .tool-detail[data-tool-slug="image-converter"] .ic-controls .ic-queue {
    margin: 0 0 12px;
    padding: 0 0 10px;
    border-top: 0;
    border-bottom: 1px solid var(--ts-line);
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-section-head {
    margin-bottom: 6px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-section-head h3 {
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-list {
    max-height: 150px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-target select {
    min-height: 42px;
    font-size: 13px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-format-note {
    min-height: 0;
    margin: 6px 0 12px;
    font-size: 12px;
    line-height: 1.6;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-adjust summary {
    padding: 11px 0;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-adjust summary small {
    margin-top: 3px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-actions {
    margin-top: 12px;
    padding-top: 12px;
    gap: 6px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-actions button {
    min-height: 44px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-status {
    margin: 0;
    padding: 8px 12px;
    border-top: 1px solid var(--ts-line);
    background: var(--ts-surface);
    border-radius: 12px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-formats {
    margin: 0;
    border: 1px solid var(--ts-line);
    border-radius: 14px;
    background: var(--ts-surface);
    overflow: hidden;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-formats summary {
    padding: 12px;
  }

  /* ------------------------------------------------------------------------
     8 · AI workbench
     ------------------------------------------------------------------------ */

  /* The stage is pinned; 24dvh + a 50px toolbar left too little room for the
     controls, so trim both and keep the image on "contain". */

  }

@media (max-width: 1023px) {
  /* ------------------------------------------------------------------------
     9 · 2026 mobile pass: give the height back to the control sheet
     ------------------------------------------------------------------------ */

  /* ---- AI workbench -------------------------------------------------- */

  /* The upload panel used to clip its own format line: let it grow with its
     content instead of forcing a fixed stage height. */

  /* ---- Perspective grid ---------------------------------------------- */
  /* Wrap instead of a hidden horizontal scroll: every action stays visible on
     a 375px phone, even when the mode labels are long. */
  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    grid-template-columns: none;
    gap: 6px;
    padding: 0 0 4px;
    border-top: 0;
    background: none;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__mode-group,
  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-actions {
    flex-wrap: wrap;
    flex: 0 1 auto;
    min-width: 0;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-actions {
    margin-left: auto;
    justify-content: flex-end;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__mode-group button {
    min-height: 30px;
    padding: 3px 7px;
    font-size: 12px;
    gap: 3px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__mode-group button svg {
    width: 14px;
    height: 14px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__canvas-actions button {
    min-height: 28px;
    padding: 2px 7px;
    font-size: 12px;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-area {
    min-height: 42px !important;
  }

  .tool-detail[data-tool-slug="perspective-grid"] .tool-workbench__upload-empty {
    min-height: 0;
  }

  /* ---- Space light lab ----------------------------------------------- */
  .tool-detail[data-tool-slug="space-light-lab"] .sll-file-button {
    min-height: 34px;
  }

  .tool-detail[data-tool-slug="space-light-lab"] .sll-rail button {
    min-height: 36px;
  }

  /* ---- Material segment ---------------------------------------------- */
  .tool-detail[data-tool-slug="material-segment"] .ms-filebtn {
    min-height: 34px;
  }

  .tool-detail[data-tool-slug="material-segment"] .ms-step {
    padding: 8px;
  }

  /* ---- Palette extractor --------------------------------------------- */
  .tool-detail[data-tool-slug="palette-extractor"] .pt-hint {
    display: none;
  }

  .tool-detail[data-tool-slug="palette-extractor"] .palette-tool__mobile-actions button {
    min-height: 34px;
  }

  /* ---- Image upscale -------------------------------------------------- */
  /* The hero block only repeated the tool name and three tags. */
  .tool-detail[data-tool-slug="image-upscale"] .image-upscale__topbar {
    display: none;
  }

  /* Stack the preview and the sheet directly; the grid/row sizing left a
     dead band above the canvas. */
  .tool-detail[data-tool-slug="image-upscale"] .image-upscale__layout {
    display: block !important;
    border-top: 0;
  }

  .tool-detail[data-tool-slug="image-upscale"] .image-upscale__main {
    padding: 0 !important;
    background: none !important;
    /* The sticky offset on this page resolved to a full header height and
       pushed the preview over the sheet; the artwork stays in flow here. */
    position: static !important;
  }

  /* ---- Image converter ------------------------------------------------ */
  .tool-detail[data-tool-slug="image-converter"] .ic-welcome__copy h2 {
    font-size: 15px;
    line-height: 1.35;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-welcome {
    gap: 8px;
    padding: 10px 12px;
  }

  /* Before the first image the converter has no control sheet at all; let the
     welcome block sit at its natural height instead of stretching a blank band. */
  .tool-detail[data-tool-slug="image-converter"] .ic {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-welcome {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    align-content: stretch;
    gap: 10px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-drop {
    flex: none;
    width: 100%;
    height: auto;
    min-height: 210px;
    max-height: 240px;
  }

  .tool-detail[data-tool-slug="image-converter"] .ic {
    padding-bottom: calc(var(--tool-bottom-reserve, var(--mobile-bottom-nav-reserved, 0px)) + 16px);
  }

  .tool-detail[data-tool-slug="image-converter"] .ic-controls {
    border: 0;
    background: none;
    padding: 0;
  }

  /* ---- Watermark remover ---------------------------------------------- */
  .tool-detail[data-tool-slug="watermark-remover"] .model-loader {
    padding: 5px 8px;
  }

  .tool-detail[data-tool-slug="watermark-remover"] .loader-sub {
    display: none;
  }

  /* ---- Shared: duplicate upload controls ------------------------------ */
  /* These repeat the call to action that already sits on the artwork, so they
     keep working after an image is loaded but at control size. */
  [data-tool-controls] :is(.sll-file-button, .ms-filebtn, .palette-tool__mobile-actions button) {
    min-height: 34px;
    font-size: 12px;
  }
}

/* --------------------------------------------------------------------------
   Stage viewer: every artwork pane fits by default and can be zoomed with the
   mouse wheel, a trackpad pinch, or two fingers. The reset chip returns to fit.
   -------------------------------------------------------------------------- */
[data-stage-zoom-host] {
  transform-origin: center center;
  transition: transform 0.12s ease-out;
  touch-action: none;
}

[data-stage-zoom-host].is-stage-zoomed {
  transition: none;
  touch-action: none;
  cursor: grab;
}

[data-stage-zoom-host].is-stage-zoomed:active {
  cursor: grabbing;
}

.stage-zoom-bar {
  position: absolute;
  z-index: 8;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--ts-line, rgba(0, 0, 0, 0.12));
  border-radius: 999px;
  background: color-mix(in srgb, var(--ts-surface, #fff) 68%, transparent);
  box-shadow: 0 10px 24px -18px var(--ts-shadow, rgba(0, 0, 0, 0.4));
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
}

.stage-zoom-bar[hidden] { display: none !important; }

.stage-zoom-bar button {
  display: grid;
  width: 26px;
  height: 26px;
  min-width: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ts-ink, #1c1a17);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.stage-zoom-bar button:hover {
  background: color-mix(in srgb, var(--ts-ink, #1c1a17) 8%, transparent);
}

.stage-zoom-bar output {
  min-width: 32px;
  color: var(--ts-muted, #6b6560);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
/* Landscape phones (short viewports) keep the natural page scroll instead of a
   fixed-height control rail, matching tool-viewport's short-screen behaviour.
   The preview shrinks further so the controls still get a usable slice. */
@media (max-width: 1023px) and (max-height: 520px) {
  [data-tool-viewport] [data-tool-controls] {
    max-height: none !important;
    overflow: visible !important;
  }

  .tool-detail :is(.image-upscale__stage, .sll-viewport, .ms-viewport, .palette-tool__stage, .ic-preview__stage, .watermark-workbench .stage, .watermark-workbench .dropzone, .tool-workbench__canvas-wrap) {
    height: 140px !important;
    min-height: 140px !important;
    max-height: 140px !important;
  }

  .tool-detail :is(.sll-drop-hint__sub, .sll-drop-hint small, .ms-empty__sub, .ms-empty small, .palette-tool__empty small) {
    display: none !important;
  }

  .tool-detail .tstudio-console__bar {
    padding-block: 5px;
  }
}
