/* Responsive controls share the same native PDF editor and coordinate model. */
.mobile-only,.mobile-selection{display:none}
.workspace.hand{cursor:grab}
.workspace.hand:active{cursor:grabbing}
.object-layer.drawing{touch-action:none}
@media (max-width:900px){
  :root{--mobile-rail:70px;--mobile-status:24px}
  body{height:var(--app-height,100dvh);min-width:0;color:var(--text)}
  .app-header{height:58px;min-height:58px;padding:0 max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));gap:10px}
  .brand{font-size:16px;gap:7px;letter-spacing:-.6px;flex-shrink:0}
  .brand-mark{height:30px;width:30px}
  .header-divider,.doc-title{display:none}
  .header-actions{gap:6px;min-width:0}
  .header-actions .button{height:40px;font-size:11px;padding:0 10px}
  .header-actions .icon-button{width:40px;height:44px}
  .command-bar{height:48px;min-height:48px;padding:0 max(8px,env(safe-area-inset-left));gap:8px;justify-content:space-between}
  .command-group{flex-shrink:0;gap:2px;min-width:0}
  .command-bar .icon-button{width:40px;height:44px;min-width:40px}
  .command-bar input{font-size:16px;width:38px;height:36px}
  .command-bar .zoom-value{font-size:12px;min-width:50px;height:44px}
  .command-bar .quiet{font-size:11px;white-space:nowrap}
  .command-bar .separator{margin:0 3px}
  .command-right #fullscreen,.command-right #help,.local-badge{display:none}
  .command-right #theme{display:inline-flex}
  .command-bar #fit-width{display:inline-flex}
  .mobile-only{display:inline-flex}
  #properties-toggle[aria-expanded=true]{background:var(--soft);color:var(--accent)}
  .editor-shell{position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;min-width:0;overflow:hidden}
  .workspace{grid-row:1;width:100%;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y pinch-zoom;scroll-padding:16px}
  .pages{padding:24px 12px 76px;gap:24px;min-width:100%;width:max-content;align-items:center}
  .tool-rail{grid-row:2;width:100%;height:calc(var(--mobile-rail) + env(safe-area-inset-bottom));border-right:0;border-top:1px solid var(--line);padding:5px max(8px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:4px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:thin;background:var(--bg);z-index:15}
  .tool-list{flex-direction:row;gap:3px;align-items:center}
  .tool{position:relative;height:56px;min-width:58px;width:58px;gap:5px;padding:5px 3px;font-size:10px;touch-action:manipulation}
  .tool svg.icon{width:21px;height:21px}
  .tool.active:before{left:12px;right:12px;top:-5px;width:auto;height:3px;border-radius:0 0 3px 3px}
  .rail-divider{width:1px;height:26px;margin:0 4px;flex-shrink:0}
  .bottom-tool{margin:0 0 0 4px;flex-shrink:0;border-left:1px solid var(--line);border-radius:0}
  .inspector,.editor-shell:has(.welcome:not([hidden])) .inspector{display:none}
  .properties-open .inspector{display:flex!important;position:fixed;left:0;right:0;bottom:var(--keyboard-inset,0px);width:100%;height:min(70dvh,620px);max-height:calc(var(--app-height,100dvh) - 64px);z-index:40;border:1px solid var(--line);border-radius:16px 16px 0 0;box-shadow:0 -8px 40px #12254030;padding-bottom:env(safe-area-inset-bottom)}
  .panel-top{height:52px;padding:0 16px;font-size:11px;letter-spacing:1px}
  .panel-dot{display:none}
  #properties-close{height:44px;width:44px}
  .properties{padding:16px;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding:12px}
  .ad-reservation,.inspector-footer{display:none}
  .panel-help{font-size:12px;line-height:1.7}
  .panel-heading{font-size:14px;overflow-wrap:anywhere}
  .field{margin-bottom:14px;gap:7px}
  .field>span{font-size:11px}
  .field input,.field select,.field textarea,.search-input{font-size:16px;height:44px;line-height:1.4;padding:9px}
  .field textarea{height:116px}
  .field input[type=color]{height:44px}
  .field input[type=range]{height:44px}
  .field-row{gap:12px}
  .check-field{min-height:44px;font-size:13px}
  .check-field input{width:20px;height:20px;flex-shrink:0}
  .panel-actions{flex-wrap:wrap;gap:8px}
  .panel-actions .button,.button{min-height:42px;font-size:12px}
  .panel-actions .button{flex:1 1 110px;padding:0 10px}
  .thumb-actions .icon-button{min-width:44px;min-height:44px}
  .status-bar{height:var(--mobile-status);min-height:var(--mobile-status);padding:0 10px;gap:10px;font-size:9px;overflow:hidden}
  #status{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0}
  #offline-status{flex-shrink:0;font-size:8px}
  .status-end{display:none}
  .welcome{padding:30px 22px 24px;max-width:600px}
  .welcome .hero-title{font-size:36px;letter-spacing:-1.5px;margin:18px 0 14px}
  .welcome-heading>p{font-size:13px;line-height:1.8;margin-bottom:24px}
  .eyebrow{font-size:9px;letter-spacing:1px}
  .drop-zone{padding:22px 16px 0}
  .drop-zone h2{font-size:17px;line-height:1.5}
  .drop-zone p{font-size:12px;line-height:1.6}
  .drop-zone .button{height:46px;min-width:155px;font-size:13px}
  .drop-hint{font-size:10px;line-height:1.6}
  .file-illustration{height:65px;width:55px}
  .welcome-alternatives{flex-direction:column;gap:2px;margin-top:20px}
  .welcome-alternatives>span{display:none}
  .welcome-alternatives button{font-size:12px;min-height:44px;padding:10px}
  .welcome-features{grid-template-columns:1fr;gap:12px;margin-top:24px}
  .welcome-features>div{display:block}
  .welcome-features strong{font-size:12px}
  .welcome-features p{font-size:12px;line-height:1.7;margin:5px 0}
  .privacy-line{font-size:11px;line-height:1.8;margin-top:24px}
  .text-button{font-size:12px;min-height:44px}
  .mobile-selection:not([hidden]){position:absolute;display:flex;align-items:center;gap:7px;left:12px;right:12px;bottom:calc(var(--mobile-rail) + env(safe-area-inset-bottom) + 9px);padding:7px 9px;border:1px solid var(--line);border-radius:10px;background:var(--bg);box-shadow:0 4px 20px #12254020;z-index:20}
  #selection-name{flex:1;font-size:11px;min-width:0;line-height:1.4}
  .mobile-selection .button{padding:0 10px;min-height:44px;gap:5px;font-size:12px}
  .mobile-selection .icon{width:16px;height:16px}
  body:has(.inline-editor) .mobile-selection{display:none}
  .object-hit:after{content:'';position:absolute;inset:-5px -2px}
  .object-hit .handle{width:18px;height:18px}.handle.nw{left:-10px;top:-10px}.handle.ne{right:-10px;top:-10px}.handle.sw{left:-10px;bottom:-10px}.handle.se{right:-10px;bottom:-10px}
  .object-hit .handle:after{inset:-10px}
  .selection-label{font-size:9px;max-width:180px;white-space:nowrap}
  .inline-editor:not(.in-place){position:fixed!important;left:12px!important;right:12px;top:auto!important;bottom:max(calc(var(--keyboard-inset,0px) + 8px),calc(var(--mobile-rail) + var(--mobile-status) + env(safe-area-inset-bottom) + 8px));width:auto!important;min-width:0;max-height:calc(var(--app-height,100dvh) - 68px);overflow:auto;border:1px solid #2563eb;display:flex;flex-direction:column;border-radius:8px;background:white;z-index:60;box-shadow:0 4px 32px #12254040}
  .inline-editor:not(.in-place) textarea,.inline-editor:not(.in-place) input{font-size:16px!important;min-height:52px;max-height:calc(var(--app-height,100dvh) - 140px);resize:vertical;border:0;padding:12px}
  .inline-editor:not(.in-place) textarea{height:110px}
  .inline-editor:not(.in-place) .inline-actions{gap:8px;padding:8px;position:sticky;bottom:0}
  .inline-action{width:44px;height:40px}.inline-action .icon{width:20px;height:20px}
  .inline-actions .button{height:44px;min-height:44px;font-size:12px;padding:0 13px}
  dialog{inset:0 0 var(--keyboard-inset,0px);margin:auto;width:calc(100vw - 24px);max-width:630px;max-height:calc(var(--app-height,100dvh) - 24px);border-radius:12px;font-size:14px;overscroll-behavior:contain}
  .dialog-head{padding:8px 14px;gap:12px}
  .dialog-head h2{font-size:15px;line-height:1.5}
  .dialog-head .icon-button{width:44px;height:44px;flex-shrink:0}
  #dialog-body{padding:16px;font-size:13px;overflow-wrap:anywhere}
  .tool-grid{grid-template-columns:1fr}
  .tool-grid button{padding:14px;font-size:13px;min-height:64px}
  .tool-grid button small{font-size:11px;line-height:1.7}
  .toast{bottom:calc(var(--mobile-status) + var(--mobile-rail) + env(safe-area-inset-bottom) + 12px);width:calc(100% - 24px);max-width:500px;font-size:12px;padding:12px;overflow-wrap:anywhere}
  .busy{padding:20px;flex-wrap:wrap}
  .busy>span{max-width:100%;overflow-wrap:anywhere;text-align:center}
  .download-ready,.update-ready{gap:6px;padding:7px 10px;flex-wrap:wrap}.update-ready span{flex-basis:100%}
  .download-description{flex-basis:100%;font-size:11px}
  .download-ready .button,.update-ready .button{height:44px;flex:1}
  .download-ready .icon-button,.update-ready .icon-button{height:44px;width:44px}
}
@media (max-width:550px){
  .command-bar{height:94px;min-height:94px;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:46px 46px;gap:0 2px}
  .command-bar>.command-group:first-child{grid-column:1;grid-row:1}
  .command-right{grid-column:2;grid-row:1}
  .zoom-group{grid-column:1 / -1;grid-row:2;justify-content:center;border-top:1px solid var(--line);width:100%;gap:8px}
  .command-bar .icon-button{min-width:36px;width:36px}
  .command-group:first-child .separator{display:none}
  .command-group:first-child{gap:0}
}
@media (max-width:360px){
  .brand>span:last-child{display:none}
  .header-actions{gap:4px}
  .command-bar .icon-button{min-width:32px;width:32px}
  .command-bar input{width:34px}
  .command-bar .quiet{font-size:10px}
  .welcome{padding:24px 16px}
  .welcome .hero-title{font-size:32px}
  .eyebrow{font-size:8px}
  .mobile-selection .button{padding:0 8px}
}
@media (max-width:900px) and (max-height:500px){
  :root{--mobile-rail:58px;--mobile-status:20px}
  .app-header{height:48px;min-height:48px}
  .tool{height:46px;min-width:58px;gap:2px;font-size:9px}
  .tool svg.icon{height:18px;width:18px}
  .properties-open .inspector{height:calc(var(--app-height,100dvh) - 16px);max-height:calc(var(--app-height,100dvh) - 16px)}
  .welcome{padding-top:20px}
}

@media (max-width:900px){
  .mobile-selection:not([hidden]){gap:2px;padding:4px 6px}
  #selection-name{flex:1;min-width:0;font-size:11px;font-weight:600;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-left:4px}
  .mobile-selection .inline-action{width:40px;height:40px;flex-shrink:0}
  .mobile-selection .inline-action .icon{width:19px;height:19px}
  .mobile-selection .inline-action.apply{background:var(--accent);color:#fff}
  /* Smaller corner dots on phones; the invisible ring keeps a finger-sized target. */
  .object-hit .handle{width:12px;height:12px}.handle.nw{left:-7px;top:-7px}.handle.ne{right:-7px;top:-7px}.handle.sw{left:-7px;bottom:-7px}.handle.se{right:-7px;bottom:-7px}
  .object-hit .handle:after{inset:-13px}
}
@media (max-width:480px){
  /* Room for the full domain wordmark: Open PDF shows only its icon. */
  #open{font-size:0;gap:0;padding:0 11px}
  .brand{font-size:15px}
}
@media (max-width:480px){#save .label-long,#export .label-long{display:none}#save .label-short{display:inline}#export{font-size:0;gap:0;padding:0 10px}}
@media (max-width:900px){.tool{width:auto;min-width:58px;padding-left:6px;padding-right:6px}.tool span{white-space:nowrap;hyphens:manual}}
.lang-menu-small{display:none}
@media (max-width:480px){.lang-menu-small{display:flex}.header-actions .lang-menu{display:none}.lang-menu-small .lang-button{height:34px;padding:0 7px;font-size:11px}}
@media (max-width:480px){.brand-mark{display:none}#save .label-short{max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-actions{flex-shrink:0}}
