/* Touch controls and the compact preview/editor layout. */
.mobile-preview-bar,.mobile-only{display:none}
.preview-settings{display:contents}
.tool-label{display:none}
#preview-dialog{width:min(430px,calc(100vw - 24px));padding:20px;max-height:calc(100dvh - 32px);overscroll-behavior:contain}
#preview-dialog h2{margin:0;font-size:20px}
#preview-dialog .modal-top{margin-bottom:20px}
#preview-dialog .scene-mode,#preview-dialog .hull-inspection,#preview-dialog .view-tools{position:static;display:flex;flex-direction:row;flex-wrap:wrap;margin:0 0 18px;gap:8px}
#preview-dialog .scene-mode button,#preview-dialog .hull-inspection button{flex:1;min-height:48px;font-size:14px}
#preview-dialog .view-tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:0}
#preview-dialog .tool-button{width:100%;height:72px;flex-direction:column;gap:8px}
#preview-dialog .tool-label{display:block;font-size:12px}
#preview-dialog .icon-small{width:44px;height:44px}
@media(max-width:900px){
 html,body{height:100%;overflow:hidden;overscroll-behavior:none}
 body{height:100dvh}
 .topbar{height:calc(56px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 12px 0;gap:8px;flex-shrink:0}
 .studio-title{display:none}.identity{gap:8px}.brand-mark{font-size:20px}.brand-name{font-size:10px;letter-spacing:1px}.brand-name>span{font-size:7px;letter-spacing:1.3px}
 .header-actions{gap:4px}.header-actions .text-button{width:44px;height:44px;justify-content:center;padding:0}
 .text-button>span:not(:first-child),.primary-button .desktop-only{display:none}
 .header-actions .primary-button{min-height:44px;padding:10px;font-size:12px;gap:6px}.header-actions svg{width:19px;height:19px}
 .workspace{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,38%) minmax(0,1fr);height:calc(100dvh - 56px - env(safe-area-inset-top));min-height:0}
 .viewer{height:auto;min-height:0;overflow:hidden}
 #canvas-wrap,.loading{inset:0 0 54px}
 .model-heading{top:12px;left:16px}.model-heading h1{font-size:27px;margin:0;letter-spacing:-1px}.model-heading h1 span{letter-spacing:-1px}
 .model-heading .eyebrow,.model-heading p,.viewer-bottom,.spec-strip{display:none}
 .viewer>.preview-settings{display:none}
 .mobile-preview-bar{display:flex;align-items:center;gap:8px;position:absolute;bottom:0;left:0;right:0;padding:5px 12px;background:#edf2f2e8;border-top:1px solid #dbe4e5}
 .mobile-camera-field{flex:1;min-width:0;position:relative}
 #mobile-camera{width:100%;height:44px;border:1px solid #cbd9db;border-radius:7px;background:#fff;color:var(--ink);padding:0 28px 0 12px;font-size:16px}
 .mobile-preview-bar>button{height:44px;border:1px solid #cbd9db;border-radius:7px;background:#fff;display:flex;align-items:center;justify-content:center;gap:7px;font-size:14px;padding:0 12px;flex-shrink:0}
 .mobile-preview-bar #expand-preview{width:44px;padding:0}
 .configurator{min-height:0;min-width:0;border:0;border-top:1px solid #cbd8da;border-radius:16px 16px 0 0;box-shadow:0 -4px 18px #183b4410;overflow:hidden;padding-bottom:env(safe-area-inset-bottom)}
 .config-header{display:flex;align-items:center;gap:8px;padding:6px 12px;min-height:56px;flex-shrink:0}
 .config-header>.eyebrow,.config-title h2{display:none}
 .config-title{order:2;margin:0}.config-title .icon-small{width:44px;height:44px}
 .preset-row{flex:1;min-width:0;padding:0 0 0 10px;gap:6px;border-radius:7px}
 .preset-row label{font-size:12px;flex-shrink:0}.preset-row select{flex:1;min-width:0;max-width:none;font-size:16px;height:42px;padding:0 3px}
 .mobile-only{display:flex}.config-header .mobile-only{order:3;min-height:44px;padding:0 10px;border-radius:7px;background:#eaf4f1;color:#23746c;font-size:12px;font-weight:650;align-items:center;justify-content:center;white-space:nowrap}
 .config-tabs{flex-shrink:0;padding:0 8px;min-height:58px;background:#fff}
 .config-tabs button{font-size:12px;gap:4px;padding:7px 3px;min-height:58px}.config-tabs button svg{width:19px;height:19px}
 .config-tabs button.active{background:#f0f7f5}.config-tabs button.active:after{left:8px;right:8px}
 .config-scroll{min-height:0;overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:20px 18px 28px;scroll-padding:20px}
 .config-footer{height:44px;min-height:44px;padding:0 18px;font-size:11px}.config-footer button{height:44px;width:44px;padding:10px}
 .section-heading h3{font-size:16px}.section-heading span{font-size:11px}
 .choice{padding:14px;min-height:100px}.choice strong{font-size:15px}.choice small{font-size:12px;line-height:1.5}
 .range-top{margin-bottom:2px;gap:8px}.range-top label{font-size:14px}.number-field{min-height:44px;padding:8px}.number-field input{font-size:16px;width:74px}.number-field span{font-size:12px}
 .range-control input[type=range]{height:44px;border-radius:0;background:linear-gradient(to right,#287e78 0%,#287e78 var(--value,50%),#e0e8e7 var(--value,50%),#e0e8e7 100%) center / 100% 5px no-repeat;touch-action:pan-y}
 .range-control input[type=range]::-webkit-slider-thumb{width:26px;height:26px;border:4px solid #fff;box-shadow:0 0 0 1px #2d827b,0 2px 5px #193b4930}
 .range-control input[type=range]::-moz-range-thumb{width:18px;height:18px;border:4px solid #fff}
 .range-ends{margin-top:0;font-size:12px}.control-divider{margin:22px 0}
 .select-field label{font-size:14px}.select-field select{min-height:48px;font-size:16px;padding:10px;width:100%;text-overflow:ellipsis}
 .inline-options button{min-height:48px;font-size:14px;padding:10px 8px}
 .swatches{grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}.swatch{min-width:44px;min-height:44px}
 .custom-color{font-size:14px}.custom-color input{width:64px;height:44px}
 .toggle-row{min-height:72px;gap:16px}.toggle-row strong{font-size:15px}.toggle-row small{font-size:12px;line-height:1.5}
 .toggle{width:48px;height:44px}.toggle span{inset:8px 0;border-radius:18px}.toggle span:after{height:22px;width:22px;top:3px;left:3px}.toggle input:checked+span:after{transform:translateX(20px)}
 .field-note,.info-card{font-size:12px;line-height:1.7}
 .workspace.controls-expanded{grid-template-rows:0 minmax(0,1fr)}.controls-expanded .viewer{visibility:hidden}
 .workspace.preview-expanded{grid-template-rows:minmax(0,1fr)}.preview-expanded .configurator{display:none}
 .preview-expanded #canvas-wrap{bottom:calc(110px + env(safe-area-inset-bottom))}
 .preview-expanded .mobile-preview-bar{bottom:calc(56px + env(safe-area-inset-bottom))}
 #return-to-controls{position:absolute;bottom:calc(8px + env(safe-area-inset-bottom));left:12px;right:12px;height:44px;border-radius:8px;background:var(--navy);color:white;font-size:15px;font-weight:600;display:flex;align-items:center;justify-content:center;gap:10px}
 dialog{max-height:calc(100dvh - 24px);padding:18px;width:calc(100vw - 24px);overscroll-behavior:contain}
 .modal-top .icon-small{width:44px;height:44px}.modal-top{position:sticky;top:-18px;background:white;z-index:2;padding:4px 0;margin-bottom:12px}
 #modal-content h2{font-size:25px}.reference-grid{grid-template-columns:1fr}.reference-grid .wide{grid-column:auto}
 .modal-actions{flex-direction:column}.modal-actions button{min-height:48px;font-size:14px}.export-option{padding:14px;gap:10px}.export-option strong{font-size:14px}.export-option small{font-size:12px;line-height:1.5}
 #toast{bottom:calc(46px + env(safe-area-inset-bottom));font-size:13px;width:max-content;max-width:calc(100vw - 32px)}
}
@media(max-width:360px){
 .brand-name{display:none}.topbar{padding-left:14px;padding-right:10px}
 .config-header{gap:4px;padding-left:10px;padding-right:10px}.preset-row{padding-left:8px}.preset-row label{font-size:11px}.config-header .mobile-only{padding:0 8px}
 .config-scroll{padding-left:16px;padding-right:16px}.swatches{gap:10px}
}
@media(max-width:900px){
 .topbar{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
 .mobile-preview-bar{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
}
@media(max-width:900px) and (orientation:landscape){
 .workspace{grid-template-columns:minmax(0,1fr) minmax(310px,43%);grid-template-rows:minmax(0,1fr)}
 .configurator{border-radius:0;border-left:1px solid #cbd8da;padding-right:env(safe-area-inset-right)}
 .config-header{padding:4px 10px;min-height:52px}.config-tabs,.config-tabs button{min-height:48px}.config-tabs button{flex-direction:row;gap:4px;font-size:11px}.config-tabs button svg{width:16px;height:16px}
 .config-footer{display:none}.config-header #expand-controls{display:none}
 .workspace.preview-expanded{grid-template-columns:minmax(0,1fr)}
 .workspace.controls-expanded{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
 .controls-expanded .configurator{grid-column:1;grid-row:1}.controls-expanded #expand-controls{display:flex}
}
/* A phone keyboard can consume half the screen. Keep the focused dimension
   field and its scroll area usable instead of shrinking them below the tabs. */
@media(max-width:900px) and (pointer:coarse){
 .workspace:has(input[type=number]:focus){grid-template-columns:minmax(0,1fr);grid-template-rows:0 minmax(0,1fr)}
 .workspace:has(input[type=number]:focus) .viewer{visibility:hidden}
 .workspace:has(input[type=number]:focus) .configurator{grid-column:1;grid-row:2}
 .workspace:has(input[type=number]:focus) .config-footer,.workspace:has(input[type=number]:focus) #expand-controls{display:none}
}
