/* Keep the desktop editor and print layout unchanged. */
button.studio-disclosure,.studio-file-label{display:none}
@media screen and (max-width:900px),screen and (pointer:coarse) and (max-width:1100px) and (max-height:600px) and (orientation:landscape){
  html{min-height:100%;height:auto}
  body{min-height:100%;height:auto;overflow:auto}
  .shell.studio-mobile{
    --edge:6px;--rail:clamp(288px,36vw,356px);
    box-sizing:border-box;height:100vh;height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
    min-height:0;overflow:auto;gap:5px;padding-block:5px;
    padding-inline-start:max(6px,env(safe-area-inset-right,0px));padding-inline-end:max(6px,env(safe-area-inset-left,0px))
  }
  .studio-mobile>:is(.topbar,.toolbar,.banner,.quick-open,.ribbon,.penbar,#textBoxSettings){flex:none;min-width:0}
  .studio-mobile .topbar{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:3px 4px;align-items:center;padding:5px 7px}
  .studio-mobile .brand{grid-row:1;grid-column:1/6;min-width:0;gap:5px;padding:0;white-space:normal}
  .studio-mobile .brand b{font-size:14px;line-height:1.15}
  .studio-mobile .brand small{font-size:10px;line-height:1.15}
  .studio-mobile .brand .mark{flex:none;width:26px;height:30px;font-size:21px}
  .studio-mobile .topbar #bPdf{grid-column:6/10;grid-row:1;min-width:0}
  .studio-mobile .topbar #bPdf .i{display:none}
  .studio-mobile #studioMoreActions{grid-column:10/-1;grid-row:1}
  .studio-mobile .studio-disclosure{display:inline-flex;white-space:normal}
  .studio-mobile .studio-disclosure::after{content:"";width:7px;height:7px;flex:none;border:solid currentColor;border-width:0 0 1.5px 1.5px;transform:translateY(-2px) rotate(-45deg)}
  .studio-mobile .studio-disclosure[aria-expanded=true]::after{transform:translateY(2px) rotate(135deg)}
  .studio-mobile .topbar .btn{min-height:40px;max-width:100%;font-size:12px;gap:5px;padding:4px 6px}
  .studio-mobile .topbar .docbox{grid-row:2;grid-column:1/8;min-width:0;align-self:stretch;gap:4px;border:0;padding:0}
  .studio-mobile .doc-name{width:0;min-width:0;font-size:16px;padding:4px;min-height:38px;text-overflow:ellipsis}
  .studio-mobile .docbox .status{min-width:0;max-width:48%;max-height:3.5em;overflow:auto;white-space:normal;font-size:10.5px;line-height:1.2}
  .studio-mobile .topbar .tb-group{justify-self:stretch;justify-content:space-evenly;gap:0;padding:0}
  .studio-mobile .topbar .tb-group:has(#zVal){grid-row:2;grid-column:8/-1;justify-self:stretch}
  .studio-mobile .topbar .tb-group :is(.ib,.zv){min-width:0;min-height:36px;height:auto;flex:1}
  .studio-mobile .topbar .tb-group .zv{flex:1.2;font-size:12px}
  .studio-mobile .topbar .tb-group:has(#bUndo){grid-row:3;grid-column:1/6}
  .studio-mobile .topbar .me{grid-row:3;grid-column:6/-1;min-width:0;justify-self:end;overflow-wrap:anywhere}
  .studio-mobile .topbar #bUpload{grid-row:4;grid-column:1/4}
  .studio-mobile .topbar #bPng{grid-row:4;grid-column:4/9}
  .studio-mobile .topbar>.tmenu{grid-row:4;grid-column:9/-1}
  .studio-mobile .topbar>.tmenu>.btn{width:100%}
  .studio-mobile .topbar>.grow{display:none}
  .studio-mobile:not(.studio-actions-open) .topbar>:is(.tb-group:has(#bUndo),#bUpload,#bPng,.tmenu,.me){display:none}
  .studio-mobile .topbar:has(.tpop:not([hidden])){position:relative;z-index:42}
  .studio-mobile .quick-open{flex-wrap:wrap;align-items:center;gap:3px 7px}
  .studio-mobile .quick-drop{min-width:0;flex:1 1 140px;min-height:44px;padding:4px 7px;gap:6px;font-size:12px}
  .studio-mobile .quick-drop>span{display:none}
  .studio-mobile .quick-drop>.studio-file-label{display:inline}
  .studio-mobile .quick-docs{flex:1 1 auto;max-width:100%}
  .studio-mobile .quick-docs select{max-width:100%;flex:1;min-height:36px}
  .studio-mobile .quick-open #studioInstallButton{min-height:38px;max-width:100%;white-space:normal}
  .studio-mobile .banner{padding:5px 8px;font-size:11.5px;line-height:1.3}
  .studio-mobile .toolbar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:stretch;gap:3px;padding:4px}
  .studio-mobile .toolbar>.tgroup{display:contents}
  .studio-mobile .toolbar>.tb-sep{display:none}
  .studio-mobile .toolbar .tool{width:100%;min-width:0;min-height:44px;padding:4px 2px;white-space:normal;overflow-wrap:anywhere;gap:2px}
  .studio-mobile .toolbar .tool svg.i{width:17px;height:17px}
  .studio-mobile #studioMoreTools{min-height:44px;min-width:0;padding:3px;font-size:12px;background:var(--surface-2);gap:5px}
  .studio-mobile:not(.studio-tools-open) .toolbar .tgroup>:not(#tSelect,#bAdd,#bMove,#bPen){display:none}
  .studio-mobile.studio-tools-open #studioMoreTools{grid-row:1;grid-column:5}
  .studio-mobile .tpop:not([hidden]),.studio-mobile .topbar .tmenu .tpop:not([hidden]),.studio-mobile .toolbar :is(#mBg,#mView):not([hidden]),.studio-mobile #textBoxSettings #pdfLineFillMenu:not([hidden]){
    position:fixed;inset:auto max(10px,env(safe-area-inset-right,0px)) calc(8px + env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px));
    width:auto;min-width:0;max-height:55vh;max-height:55dvh;overflow:auto;box-shadow:0 2px 26px rgba(0,0,0,.22)
  }
  .studio-mobile .tpop .tool{width:100%;min-height:44px;padding:7px 10px;text-align:start;white-space:normal}
  .studio-mobile .body,.studio-mobile .body.noside{position:relative;display:flex;flex:1 0 190px;min-height:190px;min-width:0;gap:0}
  .studio-mobile .stage{flex:1;min-height:0;height:auto;max-height:none;overflow:auto;container-type:inline-size}
  .studio-mobile .pages{
    --page-fit:min(860px,calc(100vw - 30px));
    box-sizing:border-box;min-width:100%;width:max(100%,calc(var(--page-fit)*var(--zoom) + 2*var(--edge)));
    padding:10px var(--edge) 30px;gap:24px
  }
  @supports(width:1cqw){.studio-mobile .pages{--page-fit:min(860px,calc(100cqw - 2*var(--edge)))}}
  .studio-mobile .pages .page,.studio-mobile .pages.fit .page{width:calc(var(--page-fit)*var(--zoom));max-width:none}
  .studio-mobile .pages.tool-move .page,.studio-mobile .pages.tool-move .page canvas.base{touch-action:none}
  .studio-mobile .modebar{top:3px;margin-top:3px;gap:5px;padding:4px 6px;max-width:calc(100% - 8px);flex-wrap:wrap;font-size:12px}
  .studio-mobile .modebar #modeText{flex:1 1 140px}
  .studio-mobile .modebar #modeDone{min-height:36px}
  .studio-mobile .modebar .seg{max-width:100%;flex-wrap:wrap}
  .studio-mobile .side{position:absolute;z-index:28;inset:3px 3px auto auto;width:min(360px,calc(100% - 6px));max-height:calc(100% - 6px);box-shadow:var(--sheet-shadow)}
  .studio-mobile .side-head{padding:2px 8px}
  .studio-mobile .side-head .px,.studio-mobile .ai-head .px{width:40px;height:40px}
  .studio-mobile .lyr-row .lb{min-width:32px;height:36px}
  .studio-mobile .lyr-row .ck{width:22px;height:22px}
  .studio-mobile .ribbon{max-height:min(42vh,370px);max-height:min(42dvh,370px);flex-direction:column}
  .studio-mobile .tabs{display:flex;flex-direction:row;width:100%;padding:3px 5px;border-inline-end:0;border-bottom:1px solid var(--line)}
  .studio-mobile .tabs button{flex:1;min-height:36px}
  .studio-mobile .tabs .px{margin:0}
  .studio-mobile .ribbon .tabpane{flex-direction:column;overflow:auto;align-items:stretch;padding:6px}
  .studio-mobile .ribbon .tabpane>:is(.card,.drop,.hint),.studio-mobile .ribbon #tab-lib>.card,.studio-mobile .ribbon :is(#cardText,#cardStamp){width:100%;max-height:none;min-width:0;overflow:visible}
  .studio-mobile .ribbon #cardStamp{grid-template-columns:minmax(0,1fr)}
  .studio-mobile .ribbon #cardStamp>#stpPreview{grid-row:auto;grid-column:1}
  .studio-mobile .penbar,.studio-mobile #textBoxSettings{max-height:36vh;max-height:36dvh;overflow:auto}
  .studio-mobile .penbar{gap:6px 9px;padding:5px}
  .studio-mobile .penbar .pb-col{flex-wrap:wrap;justify-content:center;gap:5px}
  .studio-mobile .penbar .pb-sep{display:none}
  .studio-mobile .penbar .pb-w,.studio-mobile .penbar .pb-w input[type=range]{max-width:100%;min-width:0}
  .studio-mobile #cardText .text-main{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  .studio-mobile #cardText .text-main>.fp{grid-column:span 2;max-width:none}
  .studio-mobile #cardText .btn{white-space:normal}
  .studio-mobile #textBoxSettings :is(.fp-btn,.f){font-size:16px;min-height:36px}
  .studio-mobile .dlg{max-height:86vh;max-height:86dvh;overflow:auto}
  .studio-mobile :is(.aibox,.dlg) :is(textarea,input:not([type=checkbox],[type=color])){font-size:16px;min-width:0}
  .studio-mobile .aibox{width:min(420px,calc(100% - 6px));max-width:none;inset-inline-end:3px;top:3px;max-height:calc(100% - 6px);overflow:auto}
  .studio-mobile .ai-head,.studio-mobile .ai-tools{flex-wrap:wrap}
  .studio-mobile .ai-log{min-height:76px}
  .studio-mobile .aibox .ai-in textarea{width:0}
  .studio-mobile .fp-pop{max-height:70vh;max-height:70dvh}
  .studio-mobile .fp-list{min-height:45px}
  .studio-mobile .libitem .x{display:block;width:30px;height:30px}
  .studio-mobile .layer .h::after{content:"";position:absolute;inset:-6px;border-radius:50%}
}
/* A compact control column leaves a full-height preview on a sideways phone. */
@media screen and (min-width:620px) and (max-width:900px) and (max-height:600px) and (orientation:landscape),screen and (pointer:coarse) and (min-width:901px) and (max-width:1100px) and (max-height:600px) and (orientation:landscape){
  .shell.studio-mobile{display:block;width:calc(var(--rail) + env(safe-area-inset-right,0px));margin-left:auto}
  .studio-mobile>:is(.topbar,.toolbar,.quick-open,.penbar,.ribbon,.banner,#textBoxSettings){margin-bottom:5px}
  .studio-mobile .body,.studio-mobile .body.noside{position:fixed;min-height:0;inset:max(5px,env(safe-area-inset-top,0px)) calc(var(--rail) + env(safe-area-inset-right,0px)) max(5px,env(safe-area-inset-bottom,0px)) max(5px,env(safe-area-inset-left,0px))}
  .studio-mobile .pages{--page-fit:calc(100vw - var(--rail) - 21px)}
  @supports(width:1cqw){.studio-mobile .pages{--page-fit:min(860px,calc(100cqw - 2*var(--edge)))}}
  .studio-mobile .ribbon,.studio-mobile #textBoxSettings,.studio-mobile .penbar{max-height:70vh;max-height:70dvh}
  .studio-mobile .tpop{left:auto!important;width:calc(var(--rail) - 18px)!important;max-width:calc(var(--rail) - 18px)}
  .studio-mobile .fp-pop{inset:auto max(10px,env(safe-area-inset-right,0px)) calc(8px + env(safe-area-inset-bottom,0px)) auto!important;width:calc(var(--rail) - 16px)!important;max-height:86dvh!important}
}
