/* Test bot: keep the preview and all main style tools visible on phones. */
html[data-ui=studio] body.photo-mode #style .side>.tool-grid>.tool-tile[data-open-sheet="sheetText"]{
  display:none!important;
}

@media (max-width:699px){
  html[data-ui=studio] #style .workspace,
  html[data-ui=studio] #photoOnly .workspace{
    gap:7px!important;
    padding:5px 12px 0!important;
  }
  html[data-ui=studio] #style .workspace .stage,
  html[data-ui=studio] #photoOnly .workspace .stage{
    flex:0 0 clamp(160px,34dvh,285px)!important;
    min-height:0!important;
    padding:0!important;
  }
  html[data-ui=studio] #style .workspace .preview,
  html[data-ui=studio] #photoOnly .workspace .preview{
    width:min(94%,calc(34dvh * var(--ar,4/3)))!important;
    height:auto!important;
    max-height:100%!important;
  }
  html[data-ui=studio] #style .workspace .side,
  html[data-ui=studio] #photoOnly .workspace .side{
    flex:0 0 auto!important;
    min-height:0!important;
    overflow:visible!important;
    padding:0!important;
  }
  html[data-ui=studio] #style .preview-note{display:none!important}
  html[data-ui=studio] #style .side>.tool-grid,
  html[data-ui=studio] #photoOnly .side>.tool-grid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px!important;
    overflow:visible!important;
  }
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile,
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile.tool-secondary,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile.tool-secondary{
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:3px!important;
    min-width:0!important;
    min-height:58px!important;
    padding:6px 3px!important;
    border:1px solid var(--reference-line,var(--border))!important;
    border-radius:12px!important;
    background:var(--surface)!important;
    text-align:center!important;
  }
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile.tool-secondary:last-child{
    grid-column:auto!important;
  }
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile .tt-ico,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile .tt-ico{
    width:22px!important;
    height:22px!important;
    border-radius:0!important;
    background:transparent!important;
    color:var(--primary)!important;
  }
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile .tt-ico .i,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile .tt-ico .i{
    width:20px!important;
    height:20px!important;
  }
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile .tt-body,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile .tt-body{
    flex:none!important;
    width:100%!important;
    overflow:visible!important;
  }
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile b,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile b{
    font-size:11px!important;
    font-weight:600!important;
    line-height:1.12!important;
    white-space:normal!important;
  }
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile small,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile small{
    display:none!important;
  }
  html[data-ui=studio] #sheetBackground.ph-ed{
    max-height:min(49dvh,455px)!important;
    min-height:0!important;
  }
  html[data-ui=studio] #sheetBackground.ph-ed.ph-tool-open{
    max-height:min(52dvh,500px)!important;
  }
  html[data-ui=studio] #sheetBackground.ph-ed .sheet-body{
    min-height:0!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
  }
  html[data-ui=studio] #sheetBackground.ph-ed .ph-tools{
    margin:2px 12px 6px!important;
    padding:4px 2px 6px!important;
  }
  html[data-ui=studio] #sheetBackground.ph-ed .ph-tool{
    flex:0 0 68px!important;
    min-width:68px!important;
    min-height:50px!important;
    padding:5px 2px!important;
    border-radius:10px!important;
    font-size:10px!important;
  }
  html[data-ui=studio] #sheetBackground.ph-ed .ph-tool svg{
    width:19px!important;
    height:19px!important;
  }
  html[data-ui=studio] #sheetEffects,
  html[data-ui=studio] #sheetQuickEffects{
    max-height:min(50dvh,470px)!important;
  }
  html[data-ui=studio] #sheetTextLayer{
    max-height:min(48dvh,440px)!important;
  }
  html[data-ui=studio] #sheetTextLayer .sheet-body{
    min-height:0!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
  }
  html[data-ui=studio] #sheetEffects .sheet-body,
  html[data-ui=studio] #sheetQuickEffects .sheet-body{
    min-height:0!important;
    overflow-y:auto!important;
  }
  html[data-ui=studio] .effect-sheet .effect-settings-panel{
    max-height:min(54dvh,500px)!important;
  }
  html[data-ui=studio] .fx-mini{
    max-height:min(56dvh,520px)!important;
  }
}

@media (max-width:699px) and (max-height:620px){
  html[data-ui=studio] #style .workspace .stage,
  html[data-ui=studio] #photoOnly .workspace .stage{flex-basis:145px!important}
  html[data-ui=studio] #style .workspace .preview,
  html[data-ui=studio] #photoOnly .workspace .preview{width:min(92%,calc(28dvh * var(--ar,4/3)))!important}
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile,
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile.tool-secondary,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile.tool-secondary{min-height:50px!important}
  html[data-ui=studio] #sheetBackground.ph-ed{max-height:46dvh!important}
  html[data-ui=studio] #sheetBackground.ph-ed.ph-tool-open{max-height:53dvh!important}
}

@media (min-width:700px){
  html[data-ui=studio] #style .side>.tool-grid>.tool-tile,
  html[data-ui=studio] #photoOnly .side>.tool-grid>.tool-tile{
    min-height:62px!important;
    padding:9px 11px!important;
  }
}
