/* A photo-first workspace. Secondary controls open only when requested. */
body .site-header{height:64px;flex-basis:64px;gap:16px;background:#080f13}
body .site-header h1{
 display:block;margin:0;color:#eef3f8;text-align:center;text-transform:uppercase;
 font-size:clamp(1.5rem,2.6vw,2.5rem);font-weight:700;line-height:1.05;letter-spacing:.015em;
}
body .header-actions{gap:10px}
body .brand{gap:10px}
.brand-symbol,.brand-wordmark{position:relative;display:block;overflow:hidden;flex-shrink:0}
.brand-symbol{width:72px;aspect-ratio:182/140}
.brand-wordmark{width:154px;aspect-ratio:246/64}
.brand-divider{width:1px;height:38px;flex-shrink:0;background:#53646e}
.brand-symbol img,.brand-wordmark img{position:absolute;height:auto;max-width:none;display:block}
.brand-symbol img{width:290.10989%;left:-16.483517%;top:-8.571429%}
.brand-wordmark img{width:214.634146%;left:-107.317073%;top:-87.5%}
body .workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:12px;padding:12px 18px 8px}
body.controls-open .workspace{grid-template-columns:minmax(0,1fr) 340px;grid-template-rows:minmax(0,1fr)}
body .visualizer{gap:8px}
body .viewer-toolbar{flex-wrap:nowrap;gap:10px}
body .viewer-toolbar>.segmented{width:auto}
body .segmented button{min-height:38px;padding:6px 16px}
.viewer-tip{color:#8f9fb3;font-size:13px}
body .viewer-footer{min-height:24px;gap:8px}
.preview-note{flex:0 0 auto;margin:0;color:#b7c3d1;font-size:12px;line-height:1.35;text-align:center;white-space:normal}
body.is-editing .preview-note{display:none}
body .photo-caption>span{max-width:520px}
.local-note{font-size:12px;color:#8f9fb3;white-space:nowrap}
.primary-tools{flex-shrink:0;display:flex;justify-content:center;gap:8px;padding:8px 16px max(10px,env(safe-area-inset-bottom));border-top:1px solid #344253;background:#131b25}
.primary-tools>button{display:flex;align-items:center;justify-content:center;gap:10px;min-height:48px;min-width:150px;padding:8px 18px;border:1px solid transparent;border-radius:10px;background:transparent;color:#c4d2e2;font-size:15px}
.primary-tools>button:hover{background:#243348}
.primary-tools>button.active{color:#eaf5ff;background:#283e57;border-color:#557490}
.primary-tools .icon{width:23px;height:23px}
body .finish-panel{gap:10px;padding:14px;background:#1b2633;border-color:#3b4b5e;border-radius:12px}
.panel-top{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}
.panel-top h2{font-size:18px;font-weight:600;letter-spacing:-.02em;margin:0}
.panel-top .button{min-height:40px}
body.colours-active .panel-top h2{display:none}
.finish-type-picker{display:flex;flex:1;min-width:0}
body .finish-type-picker button{flex:1;min-width:0;min-height:40px;padding:5px 7px;font-size:14px;white-space:nowrap}
body .panel-heading{display:none}
body .filters{margin-bottom:10px}
body .filters button{min-height:38px}
body .blend-grid{gap:9px}
body .blend-card .blend-name{font-size:14px;line-height:21px}
body .blend-art{min-height:20px}
body .blend-pagination{min-height:36px;margin-top:4px}
body .blend-pagination .text-button{min-height:36px;padding:4px 6px}
body .finish-summary{padding-top:9px}
body .selected-finish{gap:9px;margin:0}
body .selected-swatch{width:30px;height:30px}
body .selected-finish>div:nth-child(2){flex-direction:row;align-items:center;flex-wrap:wrap;column-gap:9px}
body .selected-finish strong{font-size:16px}
body .selected-finish .selected-label,body .selected-finish .check{display:none}
body .selected-finish .flake-size{display:block;font-size:11px}
body .save-actions{display:none;justify-content:space-between;gap:10px}
body .save-actions .text-button{font-size:13px;min-height:40px}
body.settings-active .save-actions{display:flex}
body.settings-active .selected-finish{display:none}
body .adjustments{gap:12px;padding-top:4px}
body .setting-tabs{margin:0 0 12px;padding:3px;border:1px solid #344253}
body .setting-tabs button{padding:6px 8px;min-height:38px}
body .settings-pane input[type=range]{height:30px;margin:3px 0 0}
body .surface-control .segmented button{min-height:38px;padding:6px 13px}
body .object-tools .button{min-height:42px}
body .curbs-empty-state p{font-size:15px;line-height:1.45;margin:0 0 14px}
body .curb-panel{gap:8px}
body .curb-heading .button{min-height:40px}
body .curb-row{min-height:44px;padding:3px 0}
body .curb-row-actions .button,body .curb-row-actions .text-button{min-height:40px;padding:6px 8px}
body .curb-shade input{height:30px;margin-top:2px}
body .curb-shade small,body .curb-footer p{display:none}
body .curb-footer{justify-content:flex-end}
body .curb-footer .text-button{min-height:32px}
body.is-editing .primary-tools,body.is-editing .viewer-toolbar,body.is-editing .viewer-footer,body.is-editing .finish-panel{display:none}
body.is-editing .workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
body .edit-panel{gap:7px;background:transparent;border:0;border-radius:0;padding:0}
.edit-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:44px}
.edit-heading>strong{font-size:16px;font-weight:600}
.edit-commit{display:flex;gap:8px;flex-shrink:0}
.edit-commit .button{min-height:42px;padding:7px 15px}
.edit-tools{display:flex;align-items:center;gap:8px}
body .selection-tools{min-width:0}
body .selection-tools button{min-height:38px;min-width:90px;padding:6px 13px}
.edit-tools>.button{min-height:44px;padding:7px 14px}
.edit-help{font-size:13px;line-height:1.4;color:#a9bfd6;min-height:19px;display:block}
.selection-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px}
.selection-actions .point-actions{flex:1;min-width:0}
#removeSectionButton{flex-shrink:0;min-height:40px;margin-left:auto;padding:7px 10px;background:#28435d;border-color:#6689a9;color:#e0efff}
.point-actions{display:flex;flex-wrap:wrap;gap:6px 20px;align-items:center}
.point-actions .text-button{min-height:30px;font-size:13px;padding:4px 0}
.auto-controls{display:flex;align-items:center;gap:12px;font-size:13px;color:#a9bfd6;min-height:38px}
body .auto-controls .segmented{padding:2px}
body .auto-controls .segmented button{min-height:34px;padding:5px 15px;font-size:13px}
.auto-status{font-size:13px;color:#c8e3fc;line-height:1.4;min-height:19px}
.auto-status:not([hidden]){display:flex;align-items:center;gap:8px}
.auto-status[data-busy=true]::before{content:"";flex-shrink:0;width:12px;height:12px;border:2px solid #c8e3fc44;border-top-color:#c8e3fc;border-radius:50%;animation:spin .8s linear infinite}
.stage[data-edit-tool=auto]{cursor:crosshair}
.stage.auto-selecting{cursor:progress}
.third-party-note{font-size:12px!important}
.third-party-note a{text-decoration:underline;text-underline-offset:3px}
.corner-dialog{padding:14px;width:min(430px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);overflow:hidden;border:1px solid #5e7c98;border-radius:18px;background:#172331;color:#eaf4ff;box-shadow:0 18px 70px #000a}
.corner-dialog[open]{display:flex;flex-direction:column;gap:10px}
.corner-dialog::backdrop{background:#020711c9}
.corner-dialog,.corner-dialog *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.corner-dialog-heading h2{margin:0;font-size:20px;line-height:1.3;font-weight:650}
.corner-dialog-heading p{margin:3px 0 0;color:#9eb4cb;font-size:13px}
.corner-bubble-wrap{display:grid;place-items:center;min-height:0;min-width:0}
.corner-lens{display:block;width:min(100%,calc(100dvh - 220px));height:auto;aspect-ratio:1;box-sizing:border-box;clip-path:circle(50%);border-radius:50%;border:2px solid #a8d4fb;background:#09121c;touch-action:none;cursor:crosshair;-webkit-user-drag:none;outline-offset:3px}
.corner-lens:focus-visible{outline:3px solid #d4edff}
.corner-hint{margin:0;color:#c4d8eb;font-size:14px;line-height:1.4;min-height:2.8em}
.corner-actions{display:flex;justify-content:flex-end;gap:10px}
.corner-actions .button{min-height:46px;padding:10px 18px;font-size:15px}
.corner-actions #applyCorner{flex:1}
.save-preview-dialog{width:min(640px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);margin:auto;padding:14px;border:1px solid #5e7c98;border-radius:18px;background:#172331;color:#eaf4ff;box-shadow:0 18px 70px #000a;overflow:auto}
.save-preview-dialog[open]{display:flex;flex-direction:column;gap:8px}
.save-preview-dialog::backdrop{background:#020711c9}
.save-preview-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}
.save-preview-heading h2{margin:0;font-size:20px;line-height:1.3;font-weight:650}
.save-preview-dialog .button{min-height:44px;font-size:14px}
.save-preview-dialog .save-preview-close{width:44px;min-width:44px;padding:10px}
#savePreviewImage{display:block;flex:0 1 auto;min-height:0;width:100%;height:auto;max-height:min(46dvh,440px);object-fit:contain;border:1px solid #344c64;border-radius:9px;background:#09121c;-webkit-user-select:auto;user-select:auto;-webkit-touch-callout:default;touch-action:auto}
.save-preview-details,.save-preview-status{flex-shrink:0;margin:0;font-size:14px;line-height:1.35;overflow-wrap:anywhere}
.save-preview-details{color:#a8bfd5}
.save-preview-status{color:#d0e4f7}
.save-preview-details:empty,.save-preview-status:empty{display:none}
.save-preview-actions{display:flex;flex-wrap:wrap;gap:6px 8px;flex-shrink:0}
.save-preview-actions>.button{flex:1 1 130px}
.save-preview-open{display:flex;align-items:center;justify-content:center;flex:1 0 100%;min-height:44px;font-size:14px}
#retrySavePreview{flex-shrink:0}
@media(max-height:500px) and (min-width:500px){
 .corner-dialog[open]{display:grid;grid-template-columns:minmax(0,1fr) minmax(210px,1fr);grid-template-rows:auto 1fr auto;width:min(720px,calc(100vw - 24px));gap:10px 18px}
 .corner-bubble-wrap{grid-column:1;grid-row:1/4}
 .corner-lens{width:min(100%,calc(100dvh - 58px))}
 .corner-dialog-heading{grid-column:2;grid-row:1;align-self:end}
 .corner-hint{grid-column:2;grid-row:2;align-self:center;min-height:0}
 .corner-actions{grid-column:2;grid-row:3}
}
body .stage{transform:translate(var(--pan-x,0px),var(--pan-y,0px)) scale(var(--stage-zoom,1));transform-origin:center;will-change:transform}
body .stage[data-edit-tool=move]{cursor:grab}
body .stage[data-edit-tool=move]:active{cursor:grabbing}
body.is-editing .stage-frame{touch-action:none;user-select:none}
/* Safari needs its own selection and long-press callout rules on the help
   text as well as the photo. Keep normal document/dialog text selectable. */
#editPanel,#editPanel *,#stageFrame,#stageFrame *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
#roomImage{-webkit-user-drag:none}
body .toast{bottom:90px}
body.is-editing .toast{bottom:70px}
@media(max-width:740px){
 body .site-header{height:58px;flex-basis:58px;padding:0 12px;gap:8px}
 body .header-actions{gap:7px}
 body .header-actions .button{min-height:42px;padding:7px 9px;font-size:13px;gap:6px}
 body .header-actions .icon{width:17px;height:17px}
 body .brand{gap:6px}
 body .brand-symbol{width:46px}
 body .brand-wordmark{width:98px}
 body .brand-divider{height:24px}
 body .workspace,body.controls-open .workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);padding:8px;gap:8px}
 body.controls-open .workspace{grid-template-rows:minmax(0,1fr) auto}
 body.controls-open.settings-active .workspace{grid-template-rows:minmax(0,1fr) auto}
 body .viewer-toolbar>.segmented{width:100%}
 body .viewer-toolbar .segmented button{min-height:36px;padding:5px 12px;font-size:14px;flex:1}
 .viewer-tip,.local-note{display:none}
 body .viewer-footer{min-height:20px}
 body .photo-caption>span{max-width:320px;font-size:11px}
 .primary-tools{gap:4px;padding:5px 6px max(7px,env(safe-area-inset-bottom))}
 .primary-tools>button{flex:1;min-width:0;min-height:56px;padding:5px 2px;gap:4px;flex-direction:column;font-size:12px;line-height:1.2}
 .primary-tools>button span{max-width:100%;white-space:normal}
 .primary-tools .icon{width:21px;height:21px}
 body .finish-panel{padding:10px;gap:7px}
 .panel-top h2{font-size:16px}
 .panel-top .button{min-height:36px;padding:5px 12px}
 body .filters{margin-bottom:7px;gap:5px}
 body .filters button{min-height:32px;font-size:13px;padding:4px}
 body .blend-grid{gap:5px 8px}
 body .blend-card .blend-name{font-size:13px;line-height:18px}
 body .blend-pagination{min-height:32px;margin-top:3px}
 body .blend-pagination .text-button{min-height:32px;font-size:13px}
 body .finish-summary{padding-top:7px}
 body .selected-finish .flake-size{font-size:11px}
 body .selected-finish strong{font-size:14px}
 body .adjustments{gap:7px;padding:0}
 body .setting-tabs{margin-bottom:7px}
 body .setting-tabs button{min-height:34px;font-size:13px}
 body .settings-pane input[type=range]{height:25px;margin-top:0}
 body .surface-control .segmented button{min-height:32px;padding:4px 13px}
 body .range-field>span,body .range-field output{font-size:13px}
 body .curb-panel{gap:4px}
 body .curb-heading .button{min-height:36px}
 body .curb-row{font-size:13px}
 body .curb-description{font-size:12px}
 body .curb-footer .text-button{min-height:26px}
 body .curb-shade input{height:27px}
 body.is-editing .site-header{display:none}
 body.is-editing .workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);padding:8px}
 .edit-heading>strong{font-size:14px}
 .edit-commit{gap:6px}
 .edit-commit .button{min-height:42px;padding:7px 12px}
 .edit-tools{gap:6px}
 body .selection-tools{flex:1;padding:2px;gap:1px}
 body .selection-tools button{flex:1;min-width:0;min-height:38px;font-size:13px;padding:6px 5px}
 .edit-tools>.button{font-size:13px;padding:7px 8px;min-height:44px}
 .edit-help{font-size:12px;min-height:17px}
 .point-actions{gap:6px 12px}
 .selection-actions{gap:6px 8px}
 #removeSectionButton{font-size:13px;gap:6px}
 .selection-actions .auto-controls>span{display:none}
 body .toast{bottom:82px;padding:10px 14px;font-size:13px}
}
@media(max-width:560px){
 body .site-header{
  display:grid;grid-template-columns:1fr auto;grid-template-areas:"brand actions" "title title";
  height:auto;flex-basis:auto;gap:2px 8px;padding-block:5px 8px;
 }
 body .site-header .brand{grid-area:brand}
 body .site-header .header-actions{grid-area:actions}
 body .site-header h1{grid-area:title;font-size:1.375rem}
}
@media(max-width:420px){body .header-actions .upload-photo-word{display:none}}
@media(max-width:360px){
 body .brand{gap:5px}
 body .brand-symbol{width:42px}
 body .brand-wordmark{width:90px}
 body .brand-divider{height:22px}
 body .finish-type-picker button{font-size:13px;padding:5px}
}
@media(max-width:360px){body .header-actions #saveButton span{display:none}body .header-actions #saveButton{min-width:42px}.edit-tools>.button{padding:7px 8px}body .selection-tools button{padding:6px 5px}}
@media(max-height:500px) and (min-width:500px){
 @media(min-width:561px){body .site-header{height:48px;flex-basis:48px}}
 body .brand{gap:7px}
 body .brand-symbol{width:52px}
 body .brand-wordmark{width:111px}
 body .brand-divider{height:27px}
 body .workspace,body.controls-open .workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);padding:6px 10px;gap:8px}
 body.controls-open .workspace{grid-template-columns:minmax(0,1fr) 300px}
 .primary-tools{padding:4px 10px;gap:8px}
 .primary-tools>button{flex-direction:row;min-width:125px;min-height:42px;font-size:13px;gap:8px}
 body .viewer-toolbar .segmented button{min-height:30px;font-size:13px;padding:4px 12px}
 body .viewer-footer{display:none}
 body .panel-top{min-height:34px}
 body .panel-top h2{font-size:15px}
 body .panel-top .button{min-height:32px}
 body .finish-panel{padding:8px;gap:5px}
 body .selected-finish{display:none}
 body .finish-summary{padding:0;border:0}
 body .filters button{min-height:30px;padding:3px}
 body .filters{margin-bottom:5px}
 body .blend-pagination,body .blend-pagination .text-button{min-height:30px}
 body .adjustments{gap:3px;padding:0}
 body .setting-tabs{margin-bottom:4px}
 body .setting-tabs button{min-height:28px;padding:4px 8px}
 body .settings-pane input[type=range]{height:21px;margin:0}
 body .surface-control .segmented button{min-height:28px;padding:3px 12px}
 body .save-actions .text-button{min-height:30px}
 body.is-editing .site-header{display:none}
 body.is-editing .workspace{grid-template-columns:minmax(0,1fr)}
 body .edit-panel{display:grid;grid-template-columns:1fr 1fr;gap:3px 20px}
 .edit-heading{min-height:42px}
 .edit-heading>strong{font-size:14px}
 .edit-tools{grid-column:2;grid-row:1}
 body .selection-tools{flex:1;padding:2px}
 body .selection-tools button{min-width:0;flex:1;min-height:34px;font-size:13px;padding:5px 8px}
 .edit-tools>.button{min-height:40px;padding:6px 8px;font-size:13px}
 .selection-actions{grid-column:2;grid-row:2}
 .point-actions{justify-content:flex-start;gap:12px}
 .edit-help{grid-column:1;grid-row:2;font-size:12px;align-self:center}
 .point-actions .text-button{min-height:26px}
 .auto-controls{min-height:32px}
 body .auto-controls .segmented button{min-height:28px;padding:3px 12px}
 .auto-status{grid-column:1/-1;grid-row:3;font-size:12px}
}
/* Keep the photo large while choosing or adjusting a finish on a phone.
   Panels measure their visible controls instead of reserving an empty row. */
@media(max-width:740px), (max-width:960px) and (max-height:500px){
 body.controls-open .site-header,body.controls-open .viewer-footer{display:none}
 body.controls-open .primary-tools{padding:4px 6px max(6px,env(safe-area-inset-bottom))}
 body.controls-open .primary-tools>button{flex:1;flex-direction:row;min-width:0;min-height:44px;gap:4px;padding:5px 4px;font-size:12px}
 body.controls-open .primary-tools .icon{display:none}
 body.controls-open:not(.settings-active) .finish-panel{align-self:end;max-height:calc(100dvh - 180px)}
 body.controls-open:not(.settings-active) .controls-body{flex:0 1 auto}
 body.controls-open:not(.settings-active) .panel-top .button{min-height:44px}
 body.controls-open:not(.settings-active) .blends-pane{height:auto}
 body.controls-open:not(.settings-active) .blend-grid{flex:none;height:82px;grid-template-rows:82px}
 body.controls-open:not(.settings-active) .blend-pagination,body.controls-open:not(.settings-active) .blend-pagination .text-button{min-height:40px}
 body.controls-open:not(.settings-active) .finish-summary{display:none}
 body.controls-open.curbs-active .workspace{grid-template-rows:minmax(0,1fr) auto}
 body.curbs-active .curbs-pane{height:auto}
 body.curbs-active .curb-panel{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 8px}
 body.curbs-active .curb-heading{grid-column:2;grid-row:1;align-self:start}
 body.curbs-active .curb-description{display:none}
 body.curbs-active .curb-heading .button{min-height:44px;padding:6px 9px}
 body.curbs-active .curb-list{grid-column:1;grid-row:1;max-height:88px;overflow:auto}
 body.curbs-active .curb-row{min-height:44px;gap:4px}
 body.curbs-active .curb-row>span{min-width:0;font-size:12px;line-height:1.2}
 body.curbs-active .curb-row-actions{gap:3px}
 body.curbs-active .curb-row-actions .button,body.curbs-active .curb-row-actions .text-button{padding:4px;font-size:12px}
 body.curbs-active .curb-shade,body.curbs-active .curb-footer{grid-column:1/-1}
 body.curbs-active .curb-shade input{height:30px}
 body.curbs-active .curb-footer .text-button{min-height:40px}
 body.settings-active .finish-panel{position:relative;align-self:end;padding:8px;gap:6px;max-height:calc(100dvh - 180px)}
 body.settings-active .controls-body{flex:0 1 auto;overflow:auto;overscroll-behavior:contain}
 body.settings-active .settings-pane{height:auto;overflow:visible}
 body.settings-active .panel-top{position:absolute;right:8px;top:8px;height:44px;z-index:1}
 body.settings-active .panel-top h2{display:none}
 body.settings-active .panel-top .button{min-height:44px;padding:8px 12px;font-size:14px}
 body.settings-active .setting-tabs{margin:0 76px 6px 0;padding:2px;border:1px solid #344253;min-height:44px}
 body.settings-active .setting-tabs button{min-height:38px;padding:5px 7px;font-size:14px}
 body.settings-active .adjustments{gap:4px;padding:0}
 body.settings-active .range-field>span,body.settings-active .range-field output{font-size:14px}
 body.settings-active .settings-pane input[type=range]{height:30px;margin:0}
 body.settings-active .surface-control{min-height:40px}
 body.settings-active .surface-control .segmented button{min-height:34px;padding:4px 13px}
 body.settings-active .finish-summary{padding-top:4px;border-top:1px solid #3e4d6070}
 body.settings-active .save-actions .text-button{min-height:40px;font-size:12px}
}
@media(min-width:741px) and (max-width:960px){
 .primary-tools>button{min-width:0;flex:1;gap:6px;padding:8px;font-size:14px}
}
@media(max-width:960px) and (max-height:500px) and (min-width:500px){
 body .primary-tools>button{min-width:0;flex:1;gap:5px;padding:5px 6px;font-size:12px}
 body .primary-tools>button span{max-width:100%;white-space:normal}
 .selection-actions .auto-controls>span{display:none}
 body.controls-open .workspace,body.controls-open.settings-active .workspace,body.controls-open.curbs-active .workspace{grid-template-columns:minmax(0,1fr) 280px;grid-template-rows:minmax(0,1fr)}
 body.controls-open:not(.settings-active) .finish-panel,body.controls-open.settings-active .finish-panel{align-self:center;max-height:100%}
}

/* A sideways phone gets a full-height picture with optional controls beside it.
   The controls scroll internally on short webviews; the photograph stays put. */
@media(orientation:landscape) and (max-height:500px) and (max-width:1100px){
 body:not(.is-editing):not(.preview-expanded) .site-header,
 body:not(.is-editing):not(.preview-expanded) .viewer-footer,
 body:not(.is-editing):not(.preview-expanded) .viewer-tip{display:none}
 body:not(.is-editing):not(.preview-expanded) .workspace{
  grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:8px;
  padding:4px max(8px,env(safe-area-inset-right)) 4px max(8px,env(safe-area-inset-left));
  padding-top:max(4px,env(safe-area-inset-top));
 }
 body.controls-open:not(.is-editing):not(.preview-expanded) .workspace{
  grid-template-columns:minmax(0,1fr) clamp(240px,32vw,280px);grid-template-rows:minmax(0,1fr);
 }
 body:not(.is-editing):not(.preview-expanded) .visualizer{gap:4px}
 body:not(.is-editing):not(.preview-expanded) .viewer-toolbar>.segmented{width:100%;padding:2px;gap:2px}
 body:not(.is-editing):not(.preview-expanded) .viewer-toolbar .segmented button{flex:1;min-width:0;min-height:40px;padding:5px 8px;font-size:14px}
 body:not(.is-editing):not(.preview-expanded) .primary-tools{
  gap:4px;padding:3px max(8px,env(safe-area-inset-right)) max(3px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
 }
 body:not(.is-editing):not(.preview-expanded) .primary-tools>button{
  flex:1;flex-direction:row;min-width:0;min-height:44px;padding:4px;gap:5px;font-size:14px;line-height:1.15;
 }
 body:not(.is-editing):not(.preview-expanded) .primary-tools>button span{max-width:100%;white-space:normal}
 body:not(.is-editing):not(.preview-expanded) .primary-tools .icon{width:18px;height:18px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .finish-panel{
  align-self:stretch;height:100%;max-height:100%;min-height:0;padding:8px;gap:6px;overflow:hidden;
 }
 body.controls-open:not(.is-editing):not(.preview-expanded) .panel-top{position:static;height:auto;min-height:44px;gap:6px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .panel-top .button{min-height:44px;padding:7px 10px;font-size:14px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .panel-top h2{display:block;font-size:16px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .finish-type-picker{padding:2px;gap:2px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .finish-type-picker button{min-height:40px;padding:4px 5px;font-size:14px;line-height:1.15;white-space:normal}
 body.controls-open:not(.is-editing):not(.preview-expanded) .controls-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}
 body.controls-open:not(.is-editing):not(.preview-expanded) .control-pane{height:auto;overflow:visible}
 body.controls-open:not(.is-editing):not(.preview-expanded) .filters{margin-bottom:6px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .filters button{min-height:40px;font-size:14px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .blend-grid{flex:0 0 auto;height:auto;min-height:82px;grid-template-rows:repeat(var(--blend-rows,1),82px)}
 body.controls-open:not(.is-editing):not(.preview-expanded) .blend-card .blend-name{font-size:14px;line-height:20px}
 body.controls-open:not(.is-editing):not(.preview-expanded) .blend-pagination,
 body.controls-open:not(.is-editing):not(.preview-expanded) .blend-pagination .text-button{min-height:44px;font-size:14px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .setting-tabs{margin:0 0 6px;min-height:44px;padding:2px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .setting-tabs button{min-height:38px;font-size:14px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .adjustments{gap:5px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .range-field>span,
 body.settings-active:not(.is-editing):not(.preview-expanded) .range-field output{font-size:14px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .settings-pane input[type=range]{height:32px;margin:0}
 body.settings-active:not(.is-editing):not(.preview-expanded) .surface-control .segmented button{min-height:40px;font-size:14px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .finish-summary{flex:0 0 auto;padding-top:4px}
 body.settings-active:not(.is-editing):not(.preview-expanded) .save-actions .text-button{min-height:36px;font-size:12px}
 body.controls-open:not(.settings-active):not(.is-editing):not(.preview-expanded) .finish-summary{display:none}
 body.curbs-active:not(.is-editing):not(.preview-expanded) .curb-panel{display:flex;flex-direction:column;height:auto;gap:8px}
 body.curbs-active:not(.is-editing):not(.preview-expanded) .curb-list{max-height:none;overflow:visible}
 body.curbs-active:not(.is-editing):not(.preview-expanded) .curb-row>span{font-size:14px}
 body.curbs-active:not(.is-editing):not(.preview-expanded) .curb-row-actions .button,
 body.curbs-active:not(.is-editing):not(.preview-expanded) .curb-row-actions .text-button{min-height:44px;font-size:14px}
}

/* An in-page expanded view also works in iPhone webviews without native
   fullscreen support. The existing aspect-fit sizing keeps the entire photo. */
body.preview-expanded{background:#070d12}
body.preview-expanded .site-header,
body.preview-expanded .primary-tools,
body.preview-expanded .finish-panel,
body.preview-expanded .viewer-footer,
body.preview-expanded .viewer-tip,
body.preview-expanded .preview-note{display:none}
body.preview-expanded .workspace,
body.preview-expanded.controls-open .workspace,
body.preview-expanded.controls-open.settings-active .workspace,
body.preview-expanded.controls-open.curbs-active .workspace{
 position:fixed;left:var(--preview-left,0px);top:var(--preview-top,0px);right:auto;bottom:auto;z-index:30;
 width:var(--preview-width,100vw);height:var(--preview-height,100vh);height:var(--preview-height,100dvh);
 grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:0;overflow:hidden;
 padding:max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
 background:#070d12;
}
/* If a phone reports landscape while an embedded viewport is still upright,
   lay out a wide workspace and rotate the complete view as one surface. */
body.preview-expanded.preview-rotated .workspace,
body.preview-expanded.preview-rotated.controls-open .workspace,
body.preview-expanded.preview-rotated.controls-open.settings-active .workspace,
body.preview-expanded.preview-rotated.controls-open.curbs-active .workspace{
 width:var(--preview-height,100vh);width:var(--preview-height,100dvh);height:var(--preview-width,100vw);
 transform-origin:0 0;transform:translateX(var(--preview-width,100vw)) rotate(90deg);
 padding:max(8px,env(safe-area-inset-left)) max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom));
}
body.preview-expanded.preview-rotated.preview-rotated-reverse .workspace,
body.preview-expanded.preview-rotated.preview-rotated-reverse.controls-open .workspace,
body.preview-expanded.preview-rotated.preview-rotated-reverse.controls-open.settings-active .workspace,
body.preview-expanded.preview-rotated.preview-rotated-reverse.controls-open.curbs-active .workspace{
 transform:translateY(var(--preview-height,100vh)) rotate(-90deg);
 transform:translateY(var(--preview-height,100dvh)) rotate(-90deg);
 padding:max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)) max(6px,env(safe-area-inset-top));
}
body.preview-rotated .compare-line{cursor:ns-resize}
body.preview-expanded .visualizer{gap:4px;min-width:0;min-height:0}
body.preview-expanded .viewer-toolbar{justify-content:center;min-height:44px;gap:0}
body.preview-expanded .viewer-toolbar>.segmented{width:auto;max-width:100%;padding:2px;gap:2px}
body.preview-expanded .viewer-toolbar .segmented button{flex:1;min-width:86px;min-height:44px;padding:6px 14px;font-size:14px}
body.preview-expanded .stage-frame{flex:1;min-width:0;min-height:0;background:#070d12;border:0;border-radius:0}
body.preview-expanded .stage{border-radius:5px}
body.preview-expanded .toast{bottom:max(18px,env(safe-area-inset-bottom));z-index:45}

/* Phone colours stay in one swipeable row, leaving the photo full width. */
body.phone-layout .blend-grid,
body.phone-layout.controls-open:not(.is-editing):not(.preview-expanded) .blend-grid{
 display:flex;flex:0 0 auto;align-items:flex-start;gap:8px;
 width:100%;max-width:100%;min-width:0;height:94px;min-height:94px;padding:2px;
 overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;touch-action:pan-x;
 scroll-snap-type:x proximity;scroll-padding-inline:2px;-webkit-overflow-scrolling:touch;
 scrollbar-width:thin;scrollbar-color:#60748b transparent;
}
body.phone-layout .blend-grid .blend-card{
 flex:0 0 clamp(84px,calc((100% - 40px)/3),132px);height:82px;min-height:82px;
 scroll-snap-align:start;
}
body.phone-layout .blend-grid::-webkit-scrollbar{height:6px}
body.phone-layout .blend-grid::-webkit-scrollbar-track{background:transparent}
body.phone-layout .blend-grid::-webkit-scrollbar-thumb{background:#60748b;border-radius:4px}
/* Draw attention to the visitor's own-photo workflow without flashing. */
body .site-header .upload-trigger {
 background:linear-gradient(135deg,#087eb9,#12517e);
 border-color:#83d9ff;
 color:#fff;
 box-shadow:0 0 0 1px #65ceff55,0 0 12px #2aa9ef55;
 animation:ecc-upload-glow 2.8s ease-in-out infinite;
}
@keyframes ecc-upload-glow {
 0%,100%{box-shadow:0 0 0 1px #65ceff55,0 0 10px #2aa9ef44}
 50%{box-shadow:0 0 0 2px #65ceff77,0 0 20px #2aa9ef99}
}
@media(prefers-reduced-motion:reduce){
 body .site-header .upload-trigger{animation:none}
}
/* Colours opens on arrival, so keep Upload visible in a compact phone header. */
@media(max-width:740px) and (orientation:portrait){
 body.controls-open.colours-active:not(.is-editing):not(.preview-expanded) .site-header {
  display:flex;height:58px;flex-basis:58px;min-height:58px;padding:5px 12px;
 }
 body.controls-open.colours-active .site-header h1{display:none}
 body.controls-open.colours-active .header-actions{margin-left:auto}
}

/* A manual expand control for phone layouts; editing keeps the drawing surface clear. */
.preview-expand-toggle {
 position:absolute;right:10px;bottom:10px;z-index:9;
 display:grid;place-items:center;width:44px;height:44px;padding:9px;
 color:#fff;background:#0b1728e8;border:1px solid #b5d7f2;border-radius:9px;
 box-shadow:0 2px 12px #0006;touch-action:manipulation;
}
.preview-expand-toggle[hidden]{display:none}
.preview-expand-toggle svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.preview-expand-toggle .collapse-photo-icon{display:none}
.preview-expand-toggle[aria-pressed="true"] .expand-photo-icon{display:none}
.preview-expand-toggle[aria-pressed="true"] .collapse-photo-icon{display:block}
.preview-expand-toggle:focus-visible{outline:3px solid #83d9ff;outline-offset:3px}
/* Float the viewing controls over the preview instead of reserving a row.
   The aspect-fit photo can now use the full available browser height. */
body.preview-expanded .visualizer{position:relative;gap:0}
body.preview-expanded .viewer-toolbar{
 position:absolute;top:4px;left:50%;transform:translateX(-50%);z-index:8;min-height:0;
}
body.preview-expanded .viewer-toolbar>.segmented{background:#0b1422ed;box-shadow:0 2px 12px #0005}
body.preview-expanded .viewer-toolbar .segmented button{min-height:40px;min-width:72px;padding:5px 10px;font-size:13px}
body.preview-expanded .stage-frame{width:100%;height:100%}
body.preview-expanded .scene-badge,body.preview-expanded .preview-badge{display:none}

/* Own gestures only on the photograph, keeping page zoom elsewhere available. */
body.preview-gestures-ready .stage-frame,
body.preview-gestures-ready .stage { touch-action:none; }
body.preview-zoomed:not(.is-editing) .stage-frame { cursor:grab; }
body.preview-zoomed:not(.is-editing) .stage-frame:active { cursor:grabbing; }
.preview-expand-toggle {
 right:var(--photo-control-right,10px);bottom:var(--photo-control-bottom,10px);
}

/* Expanded-view controls stay attached to the screen while the photo moves. */
body.preview-expanded .preview-expand-toggle {
 position:fixed;top:auto;right:max(12px,env(safe-area-inset-right));
 bottom:max(12px,env(safe-area-inset-bottom));
}
