/* The phone workspace is activated by the same media query as phone.js.
   Desktop layout and the model's saved state remain independent of its screens. */
.phone-only{display:none}
body.phone-mode{
  --phone-header:64px;--phone-nav:64px;
  display:flex;flex-direction:column;height:100vh;height:var(--phone-height,100dvh);
  min-height:0;max-height:none;overflow:hidden;overscroll-behavior:none;
  padding:0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.phone-mode .phone-only{display:flex}
.phone-mode button,.phone-mode a,.phone-mode input,.phone-mode select,.phone-mode textarea{touch-action:manipulation}
.phone-mode .app-header{
  flex:0 0 auto;height:calc(var(--phone-header) + env(safe-area-inset-top));
  padding:calc(7px + env(safe-area-inset-top)) 12px 7px;gap:8px;flex-wrap:nowrap;align-content:normal;z-index:10;
}
.phone-mode .brand{flex:none;gap:0;min-width:30px;min-height:44px;justify-content:center}
.phone-mode .brand img{width:30px;height:34px}
.phone-mode .brand span,.phone-mode .header-divider{display:none}
.phone-mode .app-name{display:block;min-width:0;max-width:190px;font-size:13px;line-height:1.25;white-space:normal;margin:0;flex:1}
.phone-mode .app-name span{font-size:7px;letter-spacing:.7px;margin-top:4px}
.phone-mode .header-actions{width:auto;flex:none;gap:3px;margin:0;justify-content:normal}
.phone-mode .header-actions>button{display:none}
.phone-mode .header-actions #save-design,.phone-mode .header-actions #phone-menu-toggle{display:flex;align-items:center;justify-content:center;min-width:46px;min-height:44px;padding:8px;font-size:13px;border-radius:7px}
.phone-mode .header-actions #save-design{background:var(--navy);color:#fff}
.phone-mode #phone-menu-toggle{gap:4px}
.phone-mode #phone-menu-toggle span{font-size:19px;line-height:1}
.phone-mode .workspace{display:block;flex:1 1 0;height:auto;min-height:0;overflow:hidden;position:relative}
.phone-mode .studio,.phone-mode .wizard{height:100%;min-height:0;width:100%;margin:0;order:initial}
.phone-mode .studio{display:none}
.phone-mode .wizard{display:flex;border:0}
.phone-mode[data-phone-screen="scene"] .studio{display:block}
.phone-mode[data-phone-screen="scene"] .wizard{display:none}
.phone-mode .studio #viewport{inset:0 0 62px;min-height:0}
.phone-mode .studio-top{top:12px;left:14px;right:14px;max-width:calc(100% - 28px)}
.phone-mode .project-title{gap:7px;min-width:0;max-width:100%}
.phone-mode .project-title>div{min-width:0}
.phone-mode .project-title strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
.phone-mode .project-title small,.phone-mode .concept-tag{display:none}
.phone-mode .live-dot{margin-top:4px;flex:none}
.phone-mode .view-controls{top:42px;left:12px;padding:3px;border-radius:9px;max-width:calc(100% - 116px);z-index:4}
.phone-mode .view-controls button{min-height:44px;min-width:0;flex:1;padding:7px 9px;font-size:12px;white-space:nowrap}
.phone-mode .history-controls{top:45px;right:12px;z-index:4;border-radius:8px}
.phone-mode .history-controls button{width:44px;height:44px;font-size:23px}
.phone-mode .manipulation-bar{top:100px;left:12px;right:12px;gap:6px;align-items:flex-start;z-index:4}
.phone-mode .manipulation-modes{border-radius:9px;flex:0 1 auto;padding:3px}
.phone-mode .manipulation-modes button{min-height:44px;min-width:58px;padding:8px 11px;font-size:12px}
.phone-mode .manipulation-bar label{min-height:50px;padding:3px 7px;gap:5px;font-size:11px;border-radius:8px}
.phone-mode .manipulation-bar select{font-size:16px;min-height:40px;max-width:145px;padding:3px 0}
.phone-mode #drag-axis-label{order:3}
.phone-mode #drag-snap-label{margin-left:auto}
.phone-mode #drag-snap{max-width:86px}
.phone-mode .camera-controls{right:12px;top:44%;z-index:3;border-radius:9px}
.phone-mode .camera-controls button{width:44px;height:44px;font-size:23px}
.phone-mode .camera-controls #snapshot{display:none}
.phone-mode .selection-badge{top:211px;left:12px;min-height:38px;padding:2px 3px 2px 10px;font-size:11px;display:flex;align-items:center;z-index:3;max-width:calc(100% - 76px)}
.phone-mode .selection-badge button{width:44px;height:38px;margin-left:3px;font-size:22px}
.phone-mode .selection-badge #phone-selected-properties{width:auto;min-width:68px;min-height:44px;height:auto;margin-left:8px;padding:8px;font-size:12px;background:#fff;border:1px solid #c8d7e2;border-radius:6px;color:var(--navy)}
.phone-mode .phone-scene-footer{position:absolute;bottom:72px;left:12px;right:12px;gap:12px;align-items:center;z-index:5;pointer-events:none}
.phone-mode #phone-view-options{flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:10px 14px;border:1px solid #d6dfe2;border-radius:9px;background:#fffffff5;color:var(--navy);font-size:13px;box-shadow:0 2px 8px #233a3310;pointer-events:auto}
.phone-mode #phone-gesture-hint{margin:0;font-size:11px;line-height:1.5;color:#53665f;max-width:190px;text-shadow:0 1px 2px #fff}
.phone-mode #phone-gesture-hint span{display:block}
.phone-mode .spec-bar{left:10px;right:10px;bottom:8px;height:54px;padding:0 12px;gap:12px;border-radius:9px;box-shadow:0 2px 8px #203b330a}
.phone-mode .spec-bar .mini-mark,.phone-mode .spec-bar .area,.phone-mode .spec-bar #review-design{display:none}
.phone-mode .spec-name{min-width:0;flex:1;margin:0}
.phone-mode .spec-name>div{min-width:0}
.phone-mode .spec-name strong{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px}
.phone-mode .spec-bar small{font-size:8px;letter-spacing:.7px;margin-bottom:3px}
.phone-mode .spec-item strong{font-size:16px;white-space:nowrap}
.phone-mode .spec-times{font-size:12px}
.phone-mode .canvas-bottom{display:none;bottom:124px;left:12px;right:12px;gap:10px;max-height:calc(100% - 140px);overflow:auto;padding:12px;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 40px #152d5830;z-index:8;pointer-events:auto;overscroll-behavior:contain}
.phone-mode.phone-options-open .canvas-bottom{display:flex}
.phone-mode .phone-options-heading{width:100%;align-items:center;justify-content:space-between;font-size:16px}
.phone-mode #phone-options-close{min-width:44px;min-height:44px;border:0;background:#f0f3f6;border-radius:8px;font-size:24px;color:var(--navy)}
.phone-mode .preview-options{width:100%;display:grid;grid-template-columns:1fr 1fr;border:0;padding:0;gap:7px;white-space:normal;box-shadow:none}
.phone-mode .preview-options button{min-height:48px;white-space:normal;font-size:13px;padding:10px 7px;border:1px solid var(--line);text-align:left}
.phone-mode .preview-options button span{font-size:17px}
.phone-mode .orbit-hint{font-size:12px;line-height:1.5;max-width:none;color:#5e7068;margin:0;width:100%;text-align:left}
.phone-mode .layer-popover{left:12px;right:12px;bottom:126px;transform:none;width:auto;max-height:calc(100% - 155px);overflow:auto;padding:15px;z-index:9;overscroll-behavior:contain}
.phone-mode .layer-popover strong{font-size:16px}
.phone-mode .layer-popover label{min-height:44px;padding:8px 0;font-size:14px}
.phone-mode .layer-popover small{font-size:12px}
.phone-mode input[type=checkbox]{width:20px;height:20px;flex:none}
.phone-mode .viewer-size-handle{min-height:44px;min-width:112px;font-size:13px!important;padding:10px 12px!important}
.phone-mode .viewer-edit-status{font-size:13px!important;bottom:130px!important;max-width:calc(100% - 24px)!important;width:max-content}
.phone-mode .wizard-intro,.phone-mode .workspace-tabs{display:none}
.phone-mode .step-nav{flex:none;padding:12px 12px 10px;gap:2px;min-height:76px}
.phone-mode .step-link{min-height:54px;min-width:0;gap:5px;font-size:10px;justify-content:center}
.phone-mode .step-link b{width:29px;height:29px;font-size:12px}
.phone-mode .step-link:not(:last-child):after{top:17px}
.phone-mode .step-content{flex:1 1 0;min-height:0;overflow:auto;padding:20px 18px 24px;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding:18px}
.phone-mode .step-heading{margin-bottom:9px}
.phone-mode .step-heading h2{font-size:22px}
.phone-mode .step-description{font-size:14px;line-height:1.5;margin-bottom:18px}
.phone-mode .step-number{font-size:12px}
.phone-mode .type-grid{gap:12px}
.phone-mode .type-card .drawing{height:100px}
.phone-mode .type-card strong{font-size:15px;padding:12px 12px 5px}
.phone-mode .type-card small{font-size:12px;min-height:46px;padding:0 12px 12px;line-height:1.4}
.phone-mode .group-title{font-size:14px;gap:9px;flex-wrap:wrap}
.phone-mode .group-title small{font-size:11px}
.phone-mode .field{font-size:13px;line-height:1.4;min-width:0}
.phone-mode input:not([type=checkbox]):not([type=color]):not([type=hidden]),.phone-mode select,.phone-mode textarea{font-size:16px!important;min-height:46px;max-width:100%}
.phone-mode .field input,.phone-mode .field select,.phone-mode .field textarea{padding:11px 10px;margin-top:6px}
.phone-mode .field-grid{gap:14px 12px}
.phone-mode .coordinate-fields{gap:7px}
.phone-mode .coordinate-fields input{padding:10px 6px;min-width:0}
.phone-mode .unit-label{font-size:12px;bottom:14px}
.phone-mode .unit-switch button{min-height:44px;padding:8px 13px;font-size:12px}
.phone-mode .segmented button{min-height:44px;font-size:13px}
.phone-mode .option-line{min-height:64px;font-size:14px;gap:14px}
.phone-mode .option-line small{font-size:12px;line-height:1.5}
.phone-mode .switch{width:44px;height:44px;display:flex;align-items:center}
.phone-mode .switch input{width:44px;height:44px}
.phone-mode .switch span{width:40px;height:24px;position:relative}
.phone-mode .switch span:after{width:18px;height:18px}
.phone-mode .switch input:checked+span:after{transform:translateX(16px)}
.phone-mode .swatch{width:44px;height:44px;flex:none}
.phone-mode .color-custom{min-height:50px;font-size:13px}
.phone-mode .color-custom input,.phone-mode input[type=color]{width:48px;height:44px;min-height:44px}
.phone-mode .note,.phone-mode .review-note,.phone-mode .warning,.phone-mode .source-note{font-size:12px;line-height:1.65}
.phone-mode .recovery{font-size:13px}
.phone-mode .recovery button{min-height:44px;font-size:13px}
.phone-mode .primary,.phone-mode .secondary{min-height:46px;font-size:14px;padding:11px 13px;gap:10px}
.phone-mode .inline-button{min-height:44px;min-width:44px;font-size:12px}
.phone-mode .role-section{min-height:72px;padding:12px;gap:12px}
.phone-mode .role-section strong{font-size:14px;line-height:1.4}
.phone-mode .role-section small,.phone-mode .role-section em{font-size:12px}
.phone-mode .section-results{max-height:35dvh;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.phone-mode .section-result{min-height:64px;padding:12px}
.phone-mode .section-result strong{font-size:14px;line-height:1.4}
.phone-mode .section-result small{font-size:12px}
.phone-mode .library-count{font-size:12px;line-height:1.5}
.phone-mode .section-detail{padding:16px}
.phone-mode .profile-hero h3{font-size:19px;overflow-wrap:anywhere}
.phone-mode .profile-hero p,.phone-mode .property-list{font-size:13px}
.phone-mode .profile-hero .eyebrow{font-size:10px}
.phone-mode .property-list div{padding:10px 0}
.phone-mode .section-detail .primary{font-size:14px}
.phone-mode .selection-editor{padding:15px}
.phone-mode .selection-editor .primary{font-size:14px}
.phone-mode .selection-intro p{font-size:14px}
.phone-mode .entity-tags span{font-size:11px;padding:6px 8px}
.phone-mode .small-label{font-size:12px}
.phone-mode .direct-selection-actions{gap:8px}
.phone-mode .direct-selection-actions button{font-size:13px;padding:10px 7px}
.phone-mode .edit-actions button{font-size:13px;min-height:44px}
.phone-mode .model-results{max-height:none;overflow:visible}
.phone-mode .model-result{min-height:62px;padding:10px 8px}
.phone-mode .model-result strong{font-size:14px;line-height:1.4}
.phone-mode .model-result small{font-size:12px;line-height:1.4}
.phone-mode .empty-state{font-size:14px}
.phone-mode .opening-heading{font-size:15px}
.phone-mode .opening-heading button{width:44px;height:44px;font-size:24px}
.phone-mode .opening-actions button{font-size:14px}
.phone-mode .review-hero strong{font-size:24px}
.phone-mode .review-hero p{font-size:13px;line-height:1.5}
.phone-mode .review-downloads button{font-size:13px}
.phone-mode .email-link{font-size:14px}
.phone-mode .wizard-footer{position:static;flex:none;padding:10px 16px;background:#fff;box-shadow:0 -3px 15px #25324508;z-index:2}
.phone-mode .step-actions{max-width:none;gap:10px}
.phone-mode .step-actions .primary,.phone-mode .step-actions .secondary{font-size:14px;min-height:46px}
.phone-mode .step-progress{display:none}
.phone-mode #phone-nav{flex:none;min-height:calc(var(--phone-nav) + env(safe-area-inset-bottom));padding:5px 8px calc(5px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(4,1fr);gap:4px;background:#fff;border-top:1px solid #dbe2e6;z-index:10}
.phone-mode #phone-nav button{border:0;background:transparent;color:#697887;min-height:54px;border-radius:8px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:3px;font-size:12px;padding:5px}
.phone-mode #phone-nav button>span{font-size:20px;line-height:20px}
.phone-mode #phone-nav button[aria-current="page"]{background:#e8eff5;color:var(--navy);font-weight:700}
.phone-mode dialog{position:fixed;width:calc(100% - 24px);max-width:520px;max-height:calc(var(--phone-height,100dvh) - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));margin:auto;padding:30px 20px 22px;border-radius:15px;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.phone-mode dialog h2{font-size:25px;margin-top:12px;padding-right:24px;line-height:1.2}
.phone-mode dialog p{font-size:14px;line-height:1.6}
.phone-mode dialog .eyebrow{font-size:9px;max-width:calc(100% - 34px)}
.phone-mode dialog .dialog-note{font-size:12px!important}
.phone-mode dialog label{font-size:14px}
.phone-mode .dialog-close{width:44px;height:44px;right:7px;top:6px;font-size:26px;background:#f3f6f8;border-radius:8px;z-index:1}
.phone-mode .copy-row{flex-wrap:wrap}
.phone-mode .copy-row input{flex:1 1 100%;font-size:16px}
.phone-mode .copy-row .primary{width:100%}
.phone-mode .pdf-view-list{gap:6px 12px;margin:18px 0;grid-template-columns:1fr}
.phone-mode .pdf-view-list label{min-height:44px;font-size:14px}
.phone-mode .saved-projects{max-height:none;overflow:visible}
.phone-mode .saved-project{padding:16px;min-height:80px}
.phone-mode .saved-project strong{font-size:16px}
.phone-mode .saved-project small,.phone-mode .saved-project span{font-size:12px;line-height:1.5}
.phone-menu-actions{display:grid;gap:8px}
.phone-menu-actions button{display:flex;align-items:center;justify-content:space-between;text-align:left;min-height:52px;padding:12px 14px;border:1px solid #dfe5e9;border-radius:9px;background:#f8fafb;color:var(--navy);font-size:15px}
.phone-menu-actions button span{font-size:20px}
.phone-mode #toast{bottom:calc(var(--phone-nav) + env(safe-area-inset-bottom) + 14px);font-size:13px;width:max-content;max-width:calc(100% - 28px);padding:12px 16px;line-height:1.5;z-index:20}
.phone-mode .viewer-error{margin:170px 20px 20px;padding:20px;font-size:14px}

@media(max-width:359px){
  .phone-mode .app-name{font-size:12px}.phone-mode .app-name span{display:none}
  .phone-mode .view-controls{left:8px;max-width:calc(100% - 110px)}.phone-mode .view-controls button{padding:6px 7px;font-size:11px}
  .phone-mode .history-controls{right:8px}.phone-mode .manipulation-bar{left:8px;right:8px;gap:4px}
  .phone-mode .manipulation-modes button{padding:8px;min-width:54px}
  .phone-mode .manipulation-bar label{font-size:10px;padding:3px 5px}.phone-mode #drag-snap{max-width:70px}
  .phone-mode .step-content{padding:18px 14px 24px}.phone-mode .type-card strong{font-size:14px}
  .phone-mode #phone-gesture-hint{font-size:10px}.phone-mode .phone-scene-footer{gap:9px}
}
@media(max-width:1024px) and (max-height:600px) and (orientation:landscape){
  body.phone-mode{--phone-header:52px;--phone-nav:50px}
  .phone-mode .app-header{padding-top:calc(4px + env(safe-area-inset-top));padding-bottom:4px}
  .phone-mode .app-name{max-width:none;white-space:nowrap;font-size:14px}.phone-mode .app-name span{display:none}
  .phone-mode .studio-top{display:none}
  .phone-mode .studio #viewport{inset:0 0 50px 220px}
  .phone-mode .view-controls{top:8px;left:12px;width:196px;max-width:none}
  .phone-mode .view-controls button{padding:6px 7px;font-size:11px}
  .phone-mode .history-controls{top:11px;right:12px}
  .phone-mode .manipulation-bar{top:64px;left:12px;right:auto;width:196px;max-width:196px;max-height:calc(100% - 125px);gap:5px;overflow:auto;pointer-events:auto;overscroll-behavior:contain;scrollbar-width:thin}
  .phone-mode .manipulation-modes button{padding:7px 10px}
  .phone-mode .manipulation-bar label{min-height:46px}
  .phone-mode .camera-controls{top:64px;right:12px;flex-direction:row}
  .phone-mode .phone-scene-footer{left:auto;right:12px;bottom:58px;gap:12px}
  .phone-mode #phone-gesture-hint{display:none}
  .phone-mode .spec-bar{height:44px;bottom:6px;left:12px;right:12px;gap:18px}
  .phone-mode .spec-name{flex:0 1 220px;margin-right:auto}
  .phone-mode .spec-item.area{display:block;padding-left:16px}
  .phone-mode .selection-badge{top:auto;bottom:58px;left:12px;max-width:196px}
  .phone-mode .canvas-bottom{left:auto;right:12px;bottom:58px;width:min(390px,calc(100% - 24px));max-height:calc(100% - 66px);padding:10px}
  .phone-mode .layer-popover{left:auto;right:12px;bottom:58px;width:340px;max-height:calc(100% - 66px)}
  .phone-mode .viewer-edit-status{bottom:66px!important}
  .phone-mode .step-nav{padding:5px 15px;min-height:51px;max-height:51px;gap:8px}
  .phone-mode .step-link{flex-direction:row;min-height:41px;gap:7px;font-size:12px}.phone-mode .step-link:not(:last-child):after{display:none}
  .phone-mode .step-link b{width:25px;height:25px;font-size:11px}
  .phone-mode .step-content{padding:14px 22px 20px}.phone-mode .type-grid{grid-template-columns:repeat(3,1fr)}
  .phone-mode .wizard-footer{padding:6px 20px}.phone-mode .step-actions{max-width:540px;margin:auto}
  .phone-mode #phone-nav{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}
  .phone-mode #phone-nav button{min-height:44px;flex-direction:row;gap:7px;font-size:13px}
  .phone-mode .pdf-view-list{grid-template-columns:1fr 1fr}
}
