/* Phone-only panels leave tablet and desktop panes in their original positions. */
.mobile-only{display:none}.mobile-panel{display:none}.mobile-panel[open]{display:flex;flex-direction:column;width:min(460px,calc(100vw - 16px));height:min(780px,calc(100dvh - 16px));max-width:none;max-height:calc(100dvh - 16px);padding:0;overflow:hidden;margin:auto;background:var(--cad-panel);color:var(--cad-text);border:1px solid var(--cad-line);border-radius:3px}.mobile-panel-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;border-bottom:1px solid var(--cad-line);flex:none;background:var(--cad-surface)}.mobile-panel-heading h2{font:600 17px/1.3 var(--cad-font);margin:0}.mobile-panel .mobile-panel-close{font-size:14px;min-width:58px;min-height:44px;padding:8px;border:1px solid var(--cad-line);background:var(--cad-field);color:var(--cad-text)}.mobile-panel-body{overflow:auto;overscroll-behavior:contain;min-height:0;flex:1;padding:14px;scroll-padding:14px}.mobile-panel .library,.mobile-panel .inspector{display:block!important;position:static!important;top:auto;bottom:auto;width:auto;height:auto;max-height:none;overflow:visible;border:0;padding:0;box-shadow:none;background:transparent!important}.mobile-panel .library>.eyebrow,.mobile-panel .library>h2,.mobile-panel .inspector>.eyebrow,.mobile-panel .inspector>h2{display:none}.mobile-panel .library-results{position:static;margin:16px 0 8px}.mobile-panel .library-note{display:none}.mobile-panel #parts{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:10px}.mobile-panel .part,.mobile-panel[data-theme] .part{height:130px}.mobile-panel .part svg{height:52px}.mobile-panel .part b{font-size:13px}.mobile-panel .part small{font-size:11px}.mobile-panel .part-meta{font-size:10px}.mobile-panel #search{font-size:16px;padding:12px;width:100%}.mobile-panel .library-category{font-size:13px}.mobile-panel .library-filter-grid label,.mobile-panel .color-label,.mobile-panel .properties label,.mobile-panel .table-fields label{font-size:12px}.mobile-panel .library-filter-grid{gap:10px}.mobile-panel .color-label{margin-top:14px}.mobile-panel .library-category select,.mobile-panel .library-filter-grid select,.mobile-panel .library-results select,.mobile-panel .color-label select,.mobile-panel .properties input,.mobile-panel .table-fields input,.mobile-panel .table-fields select{min-height:44px;font-size:16px!important;padding:9px!important;width:100%}.mobile-panel .properties{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mobile-panel .editor-section>summary{min-height:44px;padding:12px;font-size:14px}.mobile-panel .help,.mobile-panel .selection-actions button,.mobile-panel #openGenerator,.mobile-panel #openPropBuilder,.mobile-panel .custom-transfer button,.mobile-panel #clearFilters,.mobile-panel #quickSpawn button{min-height:44px;font-size:13px;padding:10px}.mobile-panel summary{font-size:13px;min-height:44px;padding-top:12px;padding-bottom:12px}.mobile-panel .selection-actions{flex-wrap:wrap}.mobile-panel .layer{min-height:48px;gap:7px;font-size:13px}.mobile-panel .layer button{min-width:44px;min-height:44px}.mobile-panel .layer .select-layer{font-size:12px;padding:5px 8px}.mobile-panel .inventory-row{font-size:12px}.mobile-panel .stats b{font-size:24px}.mobile-panel .selection-name{font-size:14px}.mobile-panel .library-build-settings{margin-top:12px}
#mobileFilesPanel .project{display:block;padding:0 0 18px;border:0;margin:0}#mobileFilesPanel .project input{width:100%;font:600 16px var(--cad-font);color:var(--cad-text)!important;background:var(--cad-field)!important;border:1px solid var(--cad-line);padding:12px;min-height:44px;margin:8px 0}#mobileFilesPanel .project span{display:block;color:var(--cad-muted);margin:5px 0;font:11px/1.5 var(--cad-mono)}#mobileFilesPanel .project .app-version{color:var(--cad-accent);margin:5px 0;font-size:12px}#mobileFilesPanel .mobile-layout-label{font-size:13px;font-weight:600}#mobileFilesPanel .actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0}#mobileFilesPanel .actions button{min-height:44px;font-size:14px;padding:10px;background:var(--cad-field);color:var(--cad-text);border:1px solid var(--cad-line);width:100%}#mobileFilesPanel .actions #new{display:block}#mobileFilesPanel #import{height:100%}#mobileFilesPanel .import-dropdown{grid-column:1/-1}#mobileFilesPanel #importMenu{position:static;width:100%;min-width:0;box-shadow:none;margin-top:8px}#mobileFilesPanel #importMenu button{padding:12px;text-align:left}#mobileFilesPanel #importMenu small{font-size:12px;white-space:normal}#mobileFilesPanel .actions button.theme-toggle{grid-column:1/-1;width:72px;min-width:72px;height:44px;background:#3b4650;color:#fff}#mobileFilesPanel .theme-toggle::before{top:10px}#mobileFilesPanel .theme-toggle svg{top:14px}
.mobile-setting-section{padding:0 0 18px;margin-bottom:18px;border-bottom:1px solid var(--cad-line)}.mobile-setting-section:last-child{border:0;margin:0}.mobile-setting-section h3{font-size:14px;margin:0 0 12px}.mobile-setting-section p{font-size:12px;margin:8px 0}#mobileDrawingTools{display:flex;flex-wrap:wrap;gap:8px}#mobileDrawingTools>button,#mobileDrawingTools #toolsToggle{min-height:44px;font-size:14px;padding:10px}#mobileDrawingTools .touch-action{display:inline-flex}#mobileDrawingTools .tools-tab{width:100%}#mobileDrawingTools #toolsPanel{position:static;width:100%;max-width:100%;margin-top:8px;box-shadow:none;background:var(--cad-surface);color:var(--cad-text);padding:14px;border-color:var(--cad-line)}#mobileDrawingTools #toolsPanel button{min-height:44px;font-size:13px;max-width:100%}.mobile-tools-disabled{opacity:.4;pointer-events:none}#mobileViewOptions>.toolgroup{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}#mobileViewOptions label{min-height:44px;display:flex;gap:8px;align-items:center;font-size:13px;margin:0;padding:8px;background:var(--cad-surface);border:1px solid var(--cad-line)}#mobileViewOptions .snap-settings{grid-column:1/-1}#mobileViewOptions .snap-settings>div{position:static;width:auto;max-width:100%;padding:6px;background:var(--cad-surface);color:var(--cad-text);box-shadow:none}#mobileViewOptions .snap-settings label{margin:8px 0;line-height:1.5}#mobileViewOptions .snap-settings p{white-space:normal;font-size:12px}#mobileViewOptions #inspectorToggle{display:none}#mobileSaveOptions .save-controls{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0;font-size:14px}#mobileSaveOptions .save-controls label{grid-column:1/-1;min-height:44px;gap:10px}#mobileSaveOptions .save-controls button{min-height:44px;font-size:14px}#mobileSaveOptions #saveSessionStatus{font-size:12px;grid-column:1/-1}.mobile-panel input[type=checkbox]{width:18px;height:18px;flex-shrink:0}
.phone-layout{height:100dvh;overflow:hidden}.phone-layout header{height:calc(56px + env(safe-area-inset-top));padding:env(safe-area-inset-top) max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));gap:8px}.phone-layout header .brand-logo{width:155px;height:44px}.phone-layout header #mobileFilesButton{display:block;margin-left:auto;min-height:44px;min-width:64px;border-color:#56616d;background:#343e49;color:#f3f5f7;font-size:14px}.phone-layout main{display:block;height:calc(100dvh - 56px - env(safe-area-inset-top));min-width:0}.phone-layout .workspace{width:100%;height:100%;min-width:0}.phone-layout .mobile-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));height:44px;flex-shrink:0;gap:0;background:var(--cad-panel);border-bottom:1px solid var(--cad-line)}.phone-layout .mobile-nav button{border:0;border-right:1px solid var(--cad-line);border-radius:0;font-size:14px;min-height:44px;padding:7px}.phone-layout .viewbar{padding:0;gap:0;min-height:40px;flex-wrap:nowrap;justify-content:flex-start}.phone-layout .view-switch{height:40px;width:100%}.phone-layout .view-switch button{min-height:40px;font-size:13px;flex:1}.phone-layout .canvasbar{padding:4px;min-height:52px;flex-shrink:0;overflow:visible}.phone-layout .canvasbar>.toolgroup{display:flex;flex-wrap:nowrap;align-items:center;gap:3px;width:100%;min-width:0;overflow-x:auto;scrollbar-width:thin}.phone-layout .canvasbar .toolgroup button{min-height:44px;min-width:40px;font-size:13px;padding:7px;flex-shrink:0}.phone-layout .canvasbar .toolgroup button span{display:inline}.phone-layout .canvasbar .divider{display:none}.phone-layout .canvasbar #touchDone{display:inline-flex}.phone-layout .canvasbar #fit{margin-left:auto}.phone-layout .canvasbar #finishPropOutline{white-space:nowrap}.phone-layout .grid-legend{left:8px;bottom:8px;padding:6px;font-size:8px;max-width:calc(100% - 140px)}.phone-layout .grid-legend #gridScale,.phone-layout .grid-legend #scaleBar+span{display:block}.phone-layout .grid-legend>span:nth-child(2){display:none}.phone-layout .canvas-bottom{right:8px;bottom:8px}.phone-layout .zoom button{min-width:40px;min-height:44px;padding:6px}.phone-layout .canvas-heading{left:8px;top:8px;max-width:calc(100% - 65px);padding:5px 7px}.phone-layout .canvas-heading p{font-size:11px}.phone-layout .drawing-view-indicator{right:8px;top:8px;padding:5px}.phone-layout .drawing-view-indicator span{display:none}.phone-layout footer{min-height:30px;flex-shrink:0;gap:8px;padding:6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));flex-wrap:nowrap;font-size:9px}.phone-layout footer #status{min-width:0;max-width:70%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.phone-layout footer span.footer-metrics{display:flex;margin-left:auto}.phone-layout footer #memoryUsage,.phone-layout footer #storageUsage,.phone-layout footer #refreshMetrics,.phone-layout footer .footer-metrics>span:last-child{display:none}.phone-layout footer .changelog-link{font-size:11px;padding:5px 0}.phone-layout #toast{max-width:calc(100vw - 24px);width:max-content;bottom:48px;font-size:13px;padding:10px 14px;z-index:500}.phone-layout .loading-indicator{min-width:0;width:min(340px,calc(100vw - 32px));padding:20px;gap:14px}.phone-layout .is-3d .canvasbar{display:none}
.phone-layout dialog:not(.mobile-panel){max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);margin:auto;padding:16px;overflow:auto}.phone-layout dialog .generator-fields{grid-template-columns:1fr;gap:12px}.phone-layout dialog input:not([type=checkbox]),.phone-layout dialog select,.phone-layout dialog textarea{font-size:16px!important;min-height:44px}.phone-layout dialog button{min-height:44px;font-size:14px}.phone-layout dialog input[type=checkbox]{width:18px;height:18px}.phone-layout dialog .confirm-actions,.phone-layout dialog .prop-builder-actions{flex-wrap:wrap;gap:8px}.phone-layout dialog .confirm-actions button{flex:1;min-width:100px}.phone-layout #changelogDialog{padding:0;overflow:hidden}.phone-layout .changelog-heading{padding:14px}.phone-layout .changelog-heading h2{font-size:20px}.phone-layout .changelog-content{padding:0 14px}.phone-layout .release{grid-template-columns:1fr;gap:12px;padding:16px 0}.phone-layout .release-meta{display:flex;align-items:center;gap:12px}.phone-layout .release-meta h3{margin:0}.phone-layout .release ul{font-size:13px}.phone-layout .changelog-footer{padding:10px 14px}.phone-layout .preview-help{font-size:10px;left:8px;bottom:8px;max-width:calc(100% - 16px)}.phone-layout #previewPerformanceWarning{left:8px;right:8px;max-width:none;font-size:12px;top:55px}.phone-layout .parts-library-list strong{font-size:13px}.phone-layout .parts-library-list small{font-size:11px}

.mobile-library-options{border:1px solid var(--cad-line);margin:12px 0;background:var(--cad-surface)}.mobile-library-options>summary{padding:12px;font-size:13px;font-weight:600;cursor:pointer}.mobile-library-options>div{padding:0 12px 12px}.mobile-panel .library-filter-grid{grid-template-columns:1fr}.phone-layout #layoutPicker .saved-layout-row{flex-direction:column;align-items:stretch;gap:8px}.phone-layout #layoutPicker .saved-layout-actions{flex-wrap:wrap;align-self:stretch}.phone-layout #layoutPicker .saved-layout-actions button{flex:1}.phone-layout dialog :is(input,select,textarea){max-width:100%;min-width:0}.phone-layout dialog :is(h2,p,li,small){overflow-wrap:anywhere}.phone-layout #mobileDrawingTools .experimental-note{color:var(--cad-muted)}

.mobile-usage{margin-top:24px;border-top:1px solid var(--cad-line);padding-top:16px}.mobile-usage h3{font-size:13px;margin:0 0 10px}#mobileUsage{display:flex;flex-wrap:wrap;gap:10px;align-items:center;color:var(--cad-muted);font:11px var(--cad-mono)}#mobileUsage button{min-width:44px;min-height:44px;font-size:18px}.phone-layout .changelog-link{min-height:28px;display:inline-flex;align-items:center}
.mobile-panel .library-results{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:8px 0}.mobile-panel #libraryResults{grid-column:1/-1}.mobile-panel .library-results select{min-width:0}
/* The first-open dialog appears before the mobile controls initialize. */
@media(max-width:640px),(max-width:950px) and (max-height:500px){.storage-consent.startup-popup{padding:18px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.storage-consent.startup-popup h2{font-size:21px}.storage-consent.startup-popup p{font-size:14px;line-height:1.6}.storage-consent.startup-popup .disclaimer-agreement{font-size:14px;min-height:44px}.storage-consent.startup-popup .disclaimer-agreement input{width:18px;height:18px}.storage-consent.startup-popup button{min-height:44px;font-size:14px}}

#mobileFilesButton small{font:10px/1.3 var(--cad-mono);color:#edbe73;margin-top:2px}#mobileFilesButton small[hidden]{display:none}

.phone-layout .mobile-selection-actions{display:flex;gap:3px;padding:4px;flex-shrink:0;border-bottom:1px solid var(--cad-line);background:var(--cad-panel)}.phone-layout .mobile-selection-actions button{flex:1;min-width:0;min-height:44px;font-size:11px;padding:4px 3px;white-space:nowrap}.phone-layout .mobile-selection-actions .touch-action{display:inline-flex;justify-content:center;align-items:center}.phone-layout .mobile-selection-actions [aria-pressed="true"]{background:var(--cad-selected);border-color:var(--cad-accent)}

.phone-layout #mobileFilesButton{display:inline-flex;align-items:center;justify-content:center;gap:6px}
