/* Phone editor: the canvas stays in place while tools open above the dock. */
.mobile-more,.mobile-more-menu,.mobile-sheet-backdrop,.mobile-panel-done{display:none}
@media (max-width:700px), (max-height:500px) and (pointer:coarse){
  :root{--mobile-dock-height:76px;--mobile-header-height:60px;--mobile-vh:100dvh;--mobile-keyboard-offset:0px;--mobile-viewport-top:0px}
  html{max-width:100%;overflow-x:hidden;scroll-padding-bottom:calc(var(--mobile-dock-height) + env(safe-area-inset-bottom))}
  body{max-width:100%;overflow-x:hidden}
  body:not(.mobile-review){overflow-y:hidden}
  main{width:100%;min-width:0;max-width:100%;padding:0}
  .topbar{display:none}
  .studio-commandbar{position:relative;z-index:50;display:flex;flex-wrap:nowrap;gap:8px;height:calc(60px + env(safe-area-inset-top));min-height:calc(60px + env(safe-area-inset-top));padding:calc(8px + env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left));background:#101113;border-bottom:1px solid #ffffff16}
  .product-heading{min-width:0;flex:1;gap:0}
  .product-heading>div{min-width:0}
  .product-heading .product-icon,.product-heading p{display:none}
  .product-heading h1{margin:0;font-size:13px;line-height:1.3;font-weight:750;letter-spacing:.015em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .command-actions{position:static;display:flex;align-items:center;gap:6px;width:auto;flex:none}
  .command-actions #top-review{display:inline-flex!important;order:0;justify-content:center;align-items:center;width:84px;min-width:84px;height:44px;min-height:44px;padding:0 12px;font-size:0;border-radius:9px;white-space:nowrap}
  #top-review::after{content:'Review';font-size:14px;font-weight:750}
  #top-review>span{display:none}
  .command-actions .mobile-more{display:inline-flex;order:1;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;font-size:17px;letter-spacing:1px;border:1px solid #ffffff29;border-radius:9px;background:#20252a;color:#edf3f5}
  .mobile-more-menu{position:absolute;display:flex;flex-direction:column;right:max(12px,env(safe-area-inset-right));top:calc(100% + 7px);z-index:60;width:224px;max-width:calc(100vw - 24px);padding:6px;background:#20282e;border:1px solid #ffffff2b;border-radius:13px;box-shadow:0 14px 40px #0009}
  .command-actions .mobile-more-menu>*{display:flex!important;align-items:center;justify-content:flex-start;gap:10px;width:100%;min-height:48px;margin:0;padding:10px 12px;border:0;border-radius:7px;background:transparent;color:#edf3f5;font-size:14px;text-align:left;text-decoration:none;white-space:normal}
  .command-actions .mobile-more-menu>*:hover,.command-actions .mobile-more-menu>*:focus-visible{background:#33444c}
  .mobile-more-menu svg{width:19px;height:19px;flex-shrink:0}
  .mobile-more-menu #close-studio{border-top:1px solid #ffffff1f;border-radius:0;margin-top:4px;color:#becbd1}
  .mobile-more-menu #close-studio span{display:inline}
  body #design.studio,body.panel-collapsed #design.studio,body.details-open #design.studio{display:block;position:relative;width:100%;height:calc(var(--mobile-vh) - var(--mobile-header-height) - var(--mobile-dock-height) - env(safe-area-inset-bottom));min-height:0;overflow:hidden;grid-template-columns:none;grid-template-rows:none}
  .studio .canvas-panel{position:relative;display:flex;width:100%;height:100%;min-height:0;overflow:hidden}
  .studio .canvas-surround{min-height:0;flex:1;width:100%}
  .studio .canvas-toolbar{display:flex;flex-wrap:nowrap;align-items:center;gap:6px;height:50px;min-height:50px;padding:3px 8px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain}
  .canvas-toolbar::-webkit-scrollbar,.tool-rail::-webkit-scrollbar,.selection-toolbar::-webkit-scrollbar{display:none}
  .canvas-toolbar .toolbar-group{flex:none;gap:4px;display:flex;align-items:center}
  .canvas-toolbar button{min-height:44px;min-width:44px;padding:7px 10px;font-size:12px;white-space:nowrap;touch-action:manipulation}
  .canvas-toolbar #canvas-color{gap:7px;padding-left:6px}
  #canvas-color-name{max-width:88px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .canvas-toolbar #pan-canvas span,.canvas-toolbar #orientation-short{display:none}
  .canvas-toolbar #rotate-towel svg{width:20px;height:20px}
  .canvas-toolbar #toggle-guides{font-size:12px}
  .canvas-toolbar #zoom-area{font-size:0;padding:7px 8px}
  .canvas-toolbar #zoom-area::after{content:attr(data-mobile-label);font-size:11px}
  .canvas-toolbar #toggle-details{gap:5px}
  .studio #towel-canvas{inset:72px 8px 94px;touch-action:none}
  .canvas-specs{top:55px;left:8px;right:8px;font-size:10px;line-height:15px;pointer-events:none}
  .canvas-zoom{left:50%;top:5px;transform:translateX(-50%);gap:3px;padding:3px;background:#1d252ae8;border:1px solid #ffffff21;border-radius:11px}
  .canvas-zoom>span,.canvas-zoom #canvas-zoom-range{display:none}
  .canvas-zoom button{height:44px;min-height:44px;width:44px;min-width:44px;border-radius:7px;font-size:23px;touch-action:manipulation}
  .canvas-zoom #zoom-reset{width:62px;font-size:13px;font-weight:650}
  .view-thumbnail{display:none}
  #canvas-dimensions{left:12px;right:auto;bottom:14px;max-width:calc(100% - 155px);font-size:10px;letter-spacing:0;text-align:left}
  .canvas-surround .floating-price{right:9px;bottom:8px;min-width:120px;max-width:calc(100% - 24px);border-radius:9px}
  .floating-price .price-toggle{min-height:44px;padding:7px 10px;gap:8px}
  .floating-price .price-toggle strong{font-size:18px}
  .floating-price .price-details{max-height:calc(var(--mobile-vh) * .4);overflow:auto;overscroll-behavior:contain}
  .studio .editor-footer{height:54px;min-height:54px;padding:5px 10px;gap:10px;border-top:1px solid #ffffff13;background:#151a1e}
  .editor-footer .footer-actions{gap:6px;flex-shrink:0}
  .editor-footer .icon-btn{height:44px;min-height:44px;width:44px;min-width:44px;padding:8px;font-size:20px;touch-action:manipulation}
  .editor-footer .footer-save{min-width:0;font-size:10px;line-height:1.4;text-align:right;margin-left:auto}
  .editor-footer [data-step="review"]{display:none}
  .studio .tool-rail{display:flex;position:fixed;top:auto;right:0;bottom:0;left:0;z-index:45;flex-direction:row;align-items:stretch;gap:3px;width:100%;height:calc(var(--mobile-dock-height) + env(safe-area-inset-bottom));min-height:0;padding:5px max(8px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));border-top:1px solid #ffffff29;border-right:0;background:#171c21;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:none;touch-action:pan-x}
  .studio .tool-rail button,.studio .tool-rail .rail-import{display:flex;flex-direction:column;justify-content:center;align-items:center;flex:1 0 72px;width:auto;min-width:72px;max-width:98px;min-height:64px;height:64px;margin:0;padding:7px 5px;gap:5px;border-radius:10px;border:1px solid transparent;touch-action:manipulation}
  .studio .tool-rail button.active{background:#113943;border-color:#00c4d964;color:#20d8ec}
  .studio .tool-rail svg{width:24px;height:24px;flex-shrink:0}
  .studio .tool-rail span{display:block;max-width:100%;font-size:10px;line-height:1.2;white-space:nowrap;letter-spacing:0}
  .studio .tool-rail #toggle-sidebar,.studio .tool-rail .rail-spacer{display:none}
  .mobile-sheet-backdrop{position:fixed;display:block;z-index:35;inset:0;margin:0;padding:0;border:0;border-radius:0;background:#0006;touch-action:none}
  .studio #sidebar.tools-panel,body .studio #design-inspector.inspector{position:fixed;top:auto!important;right:0!important;left:0!important;bottom:calc(var(--mobile-dock-height) + env(safe-area-inset-bottom));z-index:40;width:100%!important;min-width:0;max-width:100%;height:auto;max-height:calc(var(--mobile-vh) - var(--mobile-header-height) - var(--mobile-dock-height) - env(safe-area-inset-bottom) - 12px);margin:0;padding:0 16px 18px!important;border:1px solid #ffffff29;border-bottom:0;border-radius:19px 19px 0 0;background:#1b2228;box-shadow:0 -12px 35px #0006;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-width:thin;touch-action:pan-y;visibility:visible!important}
  body:not(.mobile-tools-open) .studio #sidebar.tools-panel,body:not(.mobile-details-open) .studio #design-inspector.inspector{display:none!important}
  body.mobile-tools-open .studio #sidebar.tools-panel,body.mobile-details-open .studio #design-inspector.inspector{display:block!important}
  .studio #sidebar .sidebar-heading,.studio #design-inspector .panel-heading{position:sticky;top:0;z-index:6;display:flex;align-items:center;gap:8px;min-height:66px;margin:0 -16px 10px;padding:11px 16px;background:#1b2228;border-bottom:1px solid #ffffff1a;border-radius:19px 19px 0 0}
  .sidebar-heading .eyebrow{display:none}
  .studio #sidebar #panel-title{font-size:18px;line-height:1.3;margin:0}
  .studio #sidebar #collapse-panel,.studio #design-inspector #close-details{display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-left:auto;width:auto;min-width:78px;height:44px;min-height:44px;padding:8px 12px;border:1px solid #20d8ec40;border-radius:9px;background:#123b44;color:#36d7e8;font-size:14px}
  .desktop-panel-close{display:none}
  .mobile-panel-done{display:inline}
  .mobile-panel-done span{margin-left:5px}
  .studio .tool-content{padding:0}
  .studio .source-picker{margin:0 0 12px}
  .studio .source-picker button{min-height:44px;padding:9px;font-size:13px}
  .studio .tools-panel button:not(.info-trigger),.studio .inspector button:not(.info-trigger){min-height:44px;touch-action:manipulation}
  .studio .tools-panel input:not([type="checkbox"]):not([type="radio"]),.studio .tools-panel textarea,.studio .tools-panel select,.studio .inspector input:not([type="checkbox"]):not([type="radio"]),.studio .inspector textarea,.studio .inspector select,dialog input:not([type="checkbox"]):not([type="radio"]),dialog textarea,dialog select{font-size:16px!important;max-width:100%;min-height:44px}
  .studio .tools-panel .up-reduction select,.studio .tools-panel .up-thread-row select{font-size:16px!important;min-height:44px!important}
  .studio .tools-panel input[type="checkbox"],.studio .inspector input[type="checkbox"]{width:22px;height:22px;flex-shrink:0}
  .studio .tool-content>*,.studio .field-grid>*,.studio .button-grid>*{min-width:0;max-width:100%}
  .studio .template-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .studio .font-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .studio .font-card{min-height:62px!important}
  .studio .config-body .swatches button,.studio .tool-content .swatches button{width:44px;height:44px;min-width:44px;min-height:44px}
  .studio .config-body .segmented{display:flex;flex-wrap:wrap}
  .studio .config-body .segmented button{flex:1;min-width:100px}
  .studio .selection-toolbar{left:8px;right:8px;bottom:62px;transform:none;display:flex;flex-wrap:nowrap;justify-content:center;gap:3px;width:calc(100% - 16px);max-width:calc(100% - 16px);padding:4px;border-radius:10px;overflow-x:auto;white-space:nowrap;scrollbar-width:none}
  #selection-toolbar-name{display:none}
  .selection-toolbar button,.selection-toolbar .quiet{height:44px;min-height:44px;min-width:44px;padding:7px;font-size:15px;flex-shrink:0;touch-action:manipulation}
  .selection-toolbar #selection-color-toggle{font-size:13px;gap:6px}
  .selection-toolbar #selection-angle{width:53px;min-width:53px;height:44px;min-height:44px;margin:0;font-size:16px;padding:5px;text-align:center}
  .selection-toolbar #selection-open-details{font-size:12px}
  .selection-toolbar .angle-unit{font-size:14px}
  .selection-colors-panel{left:8px;right:8px;bottom:117px;width:auto;max-width:calc(100% - 16px);max-height:calc(var(--mobile-vh) * .45);overflow:auto;overscroll-behavior:contain;padding:12px}
  .selection-colors-panel button{min-width:44px;min-height:44px;touch-action:manipulation}
  .selection-colors-panel .swatches{gap:8px}
  .selection-colors-panel .swatches button{width:44px;height:44px}
  #selection-print-color{min-width:44px;min-height:44px}
  .bleed-warning{top:76px;left:8px;right:8px;max-width:calc(100% - 16px);font-size:10px;line-height:1.4;pointer-events:none}
  body.mobile-keyboard-open .studio .tool-rail{display:none}
  body.mobile-keyboard-open .studio #sidebar.tools-panel,body.mobile-keyboard-open .studio #design-inspector.inspector{bottom:var(--mobile-keyboard-offset);max-height:calc(var(--mobile-vh) - 10px);padding-bottom:18px!important}
  .mobile-review{overflow-y:auto!important;min-height:var(--mobile-vh);background:#10171b}
  .mobile-review .studio-commandbar{position:sticky;top:0}
  .mobile-review #top-review{display:none!important}
  .mobile-review .tool-rail,.mobile-review .mobile-sheet-backdrop{display:none!important}
  .mobile-review #review{width:100%;max-width:100%;margin:0;padding:16px 14px calc(30px + env(safe-area-inset-bottom))}
  .mobile-review .review-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
  .mobile-review .review-layout>div{min-width:0;max-width:100%}
  .mobile-review .review-art{max-height:340px;padding:14px}
  .mobile-review .review-art img{max-height:285px;object-fit:contain}
  .mobile-review .page-title{margin:0 0 18px;padding:0}
  .mobile-review .page-title h1{font-size:26px}
  .mobile-review .page-title>p{font-size:13px}
  .mobile-review button,.mobile-review .towel-order button{min-height:48px;font-size:15px}
  .mobile-review input:not([type="checkbox"]):not([type="radio"]),.mobile-review textarea,.mobile-review select{font-size:16px!important;min-height:44px}
  .mobile-review .towel-order-approval{padding:8px 0;font-size:14px;line-height:1.5}
  .mobile-review .towel-order-approval input{width:24px;height:24px;margin:0 3px 0 0}
  .mobile-review .review-summary,.mobile-review .export-card,.mobile-review .towel-order{padding:16px;overflow-wrap:anywhere}
  .mobile-review #review-specs{column-gap:10px}
  dialog:not(.studio-tour){max-width:calc(100vw - 20px);max-height:calc(var(--mobile-vh) - 20px);padding:18px}
  dialog:not(.studio-tour) button{min-height:44px}
  .studio-tour button{min-height:44px}
  #toast{max-width:calc(100vw - 24px);bottom:calc(var(--mobile-dock-height) + env(safe-area-inset-bottom) + 12px)}
}
@media (max-height:500px) and (pointer:coarse){
  :root{--mobile-dock-height:64px}
  .studio-commandbar{height:calc(52px + env(safe-area-inset-top));min-height:calc(52px + env(safe-area-inset-top));padding-top:calc(4px + env(safe-area-inset-top));padding-bottom:4px}
  .studio .tool-rail{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}
  .studio .tool-rail button,.studio .tool-rail .rail-import{height:58px;min-height:58px;flex-direction:row;gap:7px;min-width:106px;max-width:150px}
  .studio .tool-rail svg{width:20px;height:20px}
  .studio .canvas-toolbar{height:44px;min-height:44px;padding-top:0;padding-bottom:0}
  .studio .canvas-surround{overflow:hidden}
  .studio #towel-canvas{inset:44px 76px 25px}
  .canvas-zoom{top:1px;left:auto;right:7px;transform:none;padding:1px;gap:0}
  .canvas-specs{top:15px;left:12px;right:180px;text-align:left}
  .studio .editor-footer{position:absolute;left:8px;bottom:5px;z-index:6;height:44px;min-height:44px;padding:0;background:transparent;border:0}
  .editor-footer .footer-save{display:none}
  #canvas-dimensions{bottom:10px;left:50%;right:auto;transform:translateX(-50%);max-width:calc(100% - 310px);text-align:center}
  .canvas-surround .floating-price{bottom:5px}
  .studio .selection-toolbar{bottom:54px;left:50%;right:auto;transform:translateX(-50%);width:max-content;max-width:calc(100% - 24px)}
  .selection-colors-panel{left:auto;right:8px;width:310px;bottom:105px;max-height:calc(var(--mobile-vh) - 120px)}
  .bleed-warning{top:48px;left:180px;right:180px;max-width:none}
}
@media (prefers-reduced-motion:reduce){.mobile-more-menu,.mobile-sheet-backdrop{transition:none}}
