/* Mobile layout: the drawing keeps its full space; panels overlay it. */
.mobile-nav,.mobile-view,.mobile-edit,.mobile-panel-close,.mobile-shade,.mobile-touch-guide,.mobile-help-row{display:none}
.mobile-selection-overlay,.mobile-selection-actions,.mobile-panel-heading{display:none}
#nourriceCanvas{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
@media(max-width:1100px){
 html,body{height:100%;height:100dvh;min-height:0;overflow:hidden;overscroll-behavior:none}
 body{--mobile-bottom:calc(64px + env(safe-area-inset-bottom,0px))}
 .chuck-header-main{min-height:58px;gap:9px;padding:5px 12px;flex-wrap:nowrap}
 .chuck-logo img{width:45px;height:40px}.chuck-header-title>span{display:none}.chuck-header-title h1{font-size:14px;margin:0}
 .chuck-header-main>.chuck-quote{font-size:12px;padding:10px 12px;min-height:42px;white-space:nowrap}
 .chuck-navigation,#nourriceGuideControls,#footer,#mobileNotification{display:none!important}
 .main-container{display:block!important;position:relative;flex:1;min-height:0;padding:0!important;margin:0!important;overflow:hidden}
 .workspace{width:100%;height:100%;min-height:0;padding:8px!important;padding-top:55px!important}
 .canvas-frame{height:100%;margin:0;border-radius:10px;overflow:hidden}.canvas-frame::before{display:none}
 #nourriceCanvas{width:100%!important;height:100%!important;max-width:100%!important}
 .toolbar-left,.toolbar-right,.mobile-edit,#paletteDock{display:none!important;position:fixed!important;inset:64px 8px calc(var(--mobile-bottom) + 8px)!important;width:auto!important;max-width:500px!important;height:auto!important;max-height:none!important;margin:0 auto!important;transform:none!important;border-radius:14px;border:1px solid #afc8c2!important;background:#fff!important;overflow:auto!important;overscroll-behavior:contain;z-index:1200!important;padding:0 12px 16px!important;box-shadow:0 8px 40px #123c3b45}
 body[data-mobile-panel=pieces] .toolbar-left,body[data-mobile-panel=options] .toolbar-right,body[data-mobile-panel=edit] .mobile-edit,body[data-mobile-panel=tools] #paletteDock{display:block!important}
 .toolbar>h2,.mobile-panel-heading{display:block;position:sticky;top:0;z-index:5;background:#16878c!important;color:#fff!important;margin:0 -12px 12px!important;padding:15px 58px 15px 15px!important;font-size:17px;min-height:52px}
 .mobile-panel-close{display:block;position:sticky;float:right;top:7px;margin:7px 0 -48px;z-index:9;min-width:44px;min-height:40px;border:1px solid #b8d8d7!important;background:#fff!important;color:#245052!important;border-radius:9px;font-size:22px;cursor:pointer}
 .toolbar .tool-group{margin:12px 0!important;padding:12px!important}.toolbar .tool-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .toolbar button,.mobile-edit button,#paletteDock button{min-height:44px;touch-action:manipulation}
 .toolbar .components-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}.toolbar .btn-component--thumb{width:100%!important;height:85px!important}
 .toolbar .btn-component--thumb::after{content:attr(data-label);display:block;font-size:10px;white-space:normal;line-height:1.2}.toolbar .btn-component--thumb .thumb{height:52px!important}
 .component-search input{min-height:44px;font-size:16px!important}.component-search{margin-top:12px}.components-mode{justify-content:center}
 .mobile-nav{display:grid;flex:0 0 auto;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;z-index:1400;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));background:#fff;border-top:1px solid #c7dcd6;min-height:var(--mobile-bottom)}
 .mobile-nav button{border:0;border-radius:10px;padding:6px 1px;min-height:50px;background:#fff;color:#355954;font-size:11px;line-height:1.2;font-weight:600;cursor:pointer}.mobile-nav button span{display:block;font-size:20px;line-height:1.2;margin-bottom:3px}.mobile-nav button[aria-expanded=true]{background:#e4f5eb;color:#125b3e}
 .mobile-view{display:flex;gap:5px;position:absolute;top:9px;left:12px;right:12px;z-index:10;align-items:center}.mobile-view button{min-height:40px;min-width:42px;padding:6px 10px;border:1px solid #bdd2cb;border-radius:9px;background:#fff;color:#245347;font-size:16px;box-shadow:0 2px 8px #12382a0d;touch-action:manipulation}.mobile-view button[aria-pressed=true]{background:#175f4a;color:#fff}.mobile-view output{font-size:11px;color:#35564c;margin-left:auto;background:#ffffffe6;padding:5px;border-radius:7px;max-width:130px;text-align:right}
 .mobile-shade{position:fixed;inset:58px 0 var(--mobile-bottom);background:#163c3b55;z-index:1100}body[data-mobile-panel] .mobile-shade{display:block}
 .mobile-edit{color:#294a40}.mobile-edit h3{font-size:14px;margin:18px 0 8px}.mobile-edit p{font-size:13px}.mobile-edit .mobile-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.mobile-edit button{border:1px solid #bed2c7;background:#f6faf8;color:#244c3d;padding:9px;border-radius:9px;font-size:13px}.mobile-edit button:disabled{opacity:.4}.mobile-edit button.danger{color:#9b2736;background:#fff3f3}.mobile-edit button[aria-pressed=true]{background:#17684d;color:#fff}
 #paletteDock>.floating-palette{position:static!important;display:block!important;margin:14px 0!important;transform:none!important;width:100%!important}#paletteDock .palette-toggle{display:none!important}#paletteDock .palette-panel{display:block!important;position:static!important;width:100%!important;max-height:none!important;box-shadow:none!important}#paletteDock .floating-palette .palette-content{display:grid!important;width:100%!important;max-height:none!important;margin:0!important;box-shadow:none!important}#paletteDock .palette-close{display:none}#paletteDock .nourrice-help-hint--dock{display:none!important}
 .mobile-help-row{display:flex;gap:8px;margin:16px 0;flex-wrap:wrap}.mobile-help-row button{font-size:13px;padding:10px}
 .mobile-touch-guide{display:block}#shapePalette [data-shape]::after{content:attr(title);display:block;font-size:12px;margin-top:4px}#shapePalette [data-shape]{text-align:center!important}
 #nourriceCanvas g.is-selected{filter:drop-shadow(0 0 1px #fff) drop-shadow(0 0 3px #0672ef) drop-shadow(0 0 5px #0672efaa)!important}
 .mobile-selection-overlay{display:block;position:absolute;inset:0;z-index:8;pointer-events:none!important;overflow:hidden;border-radius:inherit}
 .mobile-selection-ring{position:absolute;border:2px dashed #096ee8;border-radius:7px;background:#0975ee08;box-shadow:0 0 0 1px #ffffffd9;pointer-events:none!important;box-sizing:border-box}
 .mobile-selection-actions{display:flex;flex-direction:column;align-items:center;gap:5px;position:absolute;bottom:16px;left:50%;transform:translateX(-50%);z-index:20;max-width:calc(100% - 24px);padding:7px 9px;border:1px solid #a8c7ee;border-radius:13px;background:#fffffff5;box-shadow:0 4px 18px #163f6240;color:#145da6}
 .mobile-selection-actions[hidden]{display:none!important}.mobile-selection-actions>span{font-size:11px;font-weight:600}.mobile-selection-actions>div{display:flex;gap:4px}.mobile-selection-actions button{min-height:44px;min-width:39px;padding:5px 9px;border:1px solid #c2d8ef;border-radius:8px;background:#edf5ff;color:#155da6;font-size:20px;touch-action:manipulation}.mobile-selection-actions button[data-quick=edit]{font-size:12px}.mobile-selection-actions .danger{color:#a12b3c;background:#fff1f2;border-color:#eac9cf}
 body[data-mobile-panel] .mobile-selection-actions{display:none!important}.mobile-view output{min-width:0;font-size:10px}.mobile-view{gap:4px}.mobile-view button{min-width:38px;padding:6px 8px}
 .context-menu{position:fixed!important;max-height:65dvh;overflow:auto;z-index:1500}.context-menu li{min-height:44px;padding:12px!important}
 dialog{box-sizing:border-box!important;width:calc(100vw - 20px)!important;max-width:670px!important;max-height:calc(100dvh - 24px)!important;padding:16px!important;overflow:auto;overscroll-behavior:contain}
 dialog input,dialog textarea,dialog select,.chuck-setup-form input,.chuck-setup-form select,.form-grid input{font-size:16px!important;min-height:44px;max-width:100%;box-sizing:border-box}dialog button{min-height:44px}dialog .form-grid{grid-template-columns:1fr!important}
 .chuck-setup-form{padding:16px!important;max-width:100%!important}.chuck-setup-form label{line-height:2!important}.chuck-setup-form select{max-width:100%;margin-left:0!important}.chuck-setup-form>label select{display:block;width:100%}.chuck-setup-form>div:last-child{flex-wrap:wrap}.chuck-setup-form>div:last-child button{flex:1;min-height:46px}.chuck-setup-form fieldset{min-width:0;padding:8px}.chuck-setup-form fieldset label{font-size:13px}
 .nourrice-quick-guide dl>div{grid-template-columns:1fr;gap:5px}.nourrice-quick-guide kbd{color:#172b36!important}.nourrice-help-bubble{z-index:16000}.nourrice-quick-guide h2{font-size:19px}
 #partsModal{padding:10px!important}#partsModal [role=dialog]{max-width:100%!important;max-height:90dvh!important;overflow:auto}
}
@media(max-width:1100px) and (max-height:480px){.chuck-header-main{min-height:46px}.chuck-logo img{height:32px}.toolbar-left,.toolbar-right,.mobile-edit,#paletteDock{top:50px!important}.workspace{padding-top:48px!important}.mobile-nav{min-height:52px;padding-top:2px;padding-bottom:2px}.mobile-nav button{min-height:45px}.mobile-nav button span{font-size:16px}body{--mobile-bottom:52px}}
@media print{.mobile-nav,.mobile-view,.mobile-edit,.mobile-shade,.mobile-panel-close,.mobile-selection-overlay,.mobile-selection-actions{display:none!important}}
