.obstacle-popover{position:absolute;right:12px;bottom:12px;z-index:6;width:310px;max-width:calc(100% - 24px);padding:10px 12px;background:#fff;color:#1d2429;border:1px solid #ccd3d2;border-radius:8px;box-shadow:0 5px 16px #0002}.obstacle-popover-title{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.obstacle-popover-title strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.obstacle-popover .button{min-width:44px;min-height:44px;padding:8px;flex:none}.obstacle-popover-title .button{min-height:44px;min-width:44px;padding:5px}.obstacle-corner-controls{display:flex;align-items:end;gap:5px}.obstacle-corner-controls label{display:flex;flex-direction:column;flex:1;min-width:70px;font-size:12px}.obstacle-corner-controls select{height:44px;padding:6px;font-size:14px;width:100%}.obstacle-corner-controls [data-action="obstacle-previous"] svg{transform:rotate(180deg)}.obstacle-popover [data-action="obstacle-delete"]{color:#a52929}.obstacle-popover p{font-size:12px;line-height:1.4;margin:8px 0 0}.obstacle-point{cursor:move}.obstacle-point:focus{outline:none;stroke:#146b8c;stroke-width:3}@media(max-width:850px){.obstacle-popover{right:8px;bottom:8px;width:292px;max-width:calc(100% - 16px);padding:8px}.obstacle-popover p{display:none}.obstacle-corner-controls select{font-size:16px}}

.obstacle-popover .obstacle-new{width:100%;margin-top:8px;justify-content:center}
#roof-canvas.hole-mode,#roof-canvas.hole-mode .roof-shape{cursor:crosshair}
#roof-canvas [data-obstacle]{cursor:grab}
#roof-canvas.hole-mode [data-obstacle-selected=true]{cursor:grab}
#roof-canvas.hole-mode .obstacle-point{cursor:move}
#roof-canvas.obstacle-dragging,#roof-canvas.obstacle-dragging *{cursor:grabbing}

/* On a narrow portrait photo, editing replaces the general search panel.
   The controls occupy their own row rather than covering the whole photograph. */
.workarea>.obstacle-popover.docked{position:relative;width:auto;max-width:none;flex:0 0 auto;border-radius:0;box-shadow:none;padding:4px 8px}
.obstacle-popover.docked .obstacle-popover-title{gap:6px;margin-bottom:4px}
.obstacle-popover.docked .obstacle-popover-title strong{flex:1;min-width:0;font-size:12px}
.obstacle-popover.docked .obstacle-new{width:auto;margin:0;font-size:12px;gap:4px;padding-inline:6px}
.obstacle-popover.docked .obstacle-new svg{display:none}
.obstacle-docked>.tool-help .editor-context{display:none}
.obstacle-docked>.tool-help{min-height:44px;padding-block:4px}

/* A short phone in landscape needs controls beside the photo, not stacked on it. */
@media(max-width:850px) and (max-height:500px) and (orientation:landscape){
 #app.photo-expanded .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry)){display:grid;grid-template-columns:280px minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr) auto auto}
 .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry))>.toolbar-shell{grid-column:1 / -1;grid-row:1}
 .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry))>.tool-help{grid-column:1 / -1;grid-row:2;padding-block:2px;min-height:44px}
 .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry))>.tool-help .editor-context{display:none}
 .workarea.obstacle-docked>.obstacle-popover.docked,.workarea>.obstacle-assist-entry{grid-column:1;grid-row:3 / 5;align-self:start;max-height:100%;overflow:auto}
 .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry))>.canvas-stage{grid-column:2;grid-row:3;min-height:0}
 .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry))>.canvas-controls{grid-column:2;grid-row:4}
 .workarea:is(.obstacle-docked,:has(>.obstacle-assist-entry))>.canvas-footer{grid-column:1 / -1;grid-row:5}
 .workarea>.obstacle-assist-entry{padding:8px;gap:8px}
 .workarea>.obstacle-assist-entry>div:first-child{min-width:0}
 .workarea>.obstacle-assist-entry p{display:none}
 .workarea>.obstacle-assist-entry .obstacle-assist-actions{gap:6px;flex-wrap:nowrap;width:100%}
 .workarea>.obstacle-assist-entry .button{min-width:0;flex:1;padding-inline:6px;white-space:normal;font-size:12px}
}

.obstacle-shape-actions{margin-top:6px;border-top:1px solid #e1e5e4}
.obstacle-shape-actions summary{display:flex;align-items:center;min-height:44px;cursor:pointer;font-size:12px;font-weight:600;list-style:none}
.obstacle-shape-actions summary::before{content:'+';font-size:18px;width:22px;flex:none}
.obstacle-shape-actions[open] summary::before{content:'−'}
.obstacle-vertex-actions{display:flex;gap:6px}
.obstacle-vertex-actions .button{min-width:0;flex:1;font-size:12px;justify-content:center;padding-inline:5px}
.obstacle-popover .obstacle-shape-actions p{display:block;margin:6px 0;font-size:12px}

.obstacle-popover.docked{position:relative}
.obstacle-popover.docked .obstacle-shape-actions{margin:0;border:0;flex:none}
.obstacle-popover.docked .obstacle-shape-actions summary{padding-inline:8px;font-size:12px;border:1px solid #ccd3d2;border-radius:6px}
.obstacle-popover.docked .obstacle-shape-actions summary::before{display:none}
.obstacle-popover.docked .obstacle-shape-actions[open] .obstacle-vertex-actions{position:absolute;z-index:9;top:100%;right:8px;width:min(292px,calc(100% - 16px));padding:10px 10px 64px;border:1px solid #ccd3d2;border-radius:8px;background:#fff;box-shadow:0 5px 16px #0002}
.obstacle-popover.docked .obstacle-shape-actions p{position:absolute;z-index:10;top:calc(100% + 58px);right:18px;width:min(272px,calc(100% - 36px));margin:0;pointer-events:none}

/* Direct object actions; framing belongs to the user, not an editing dialog. */
.obstacle-popover,.workarea>.obstacle-popover.docked{display:flex;align-items:center;gap:6px;width:auto;max-width:calc(100% - 24px);padding:4px 8px;border-radius:6px}
.obstacle-popover>strong{font-size:12px;white-space:nowrap}
.obstacle-popover .obstacle-shape-actions{margin:0;border:0;position:relative}
.obstacle-popover .obstacle-shape-actions summary{padding:0 6px;white-space:nowrap;font-size:12px;min-height:44px}
.obstacle-popover .obstacle-shape-actions summary::before{display:none}
.obstacle-popover .obstacle-vertex-actions{position:absolute;right:0;bottom:100%;background:var(--panel);border:1px solid var(--line);padding:6px;z-index:8;width:260px;max-width:calc(100vw - 24px);display:grid;grid-template-columns:1fr 1fr;border-radius:6px}
.obstacle-popover [data-action=obstacle-previous] svg{transform:rotate(180deg)}
.obstacle-popover>.button{width:44px;min-width:44px}
.workarea>.obstacle-popover.docked{max-width:none;justify-content:flex-end;border-radius:0}
@media(max-width:850px){.obstacle-popover .obstacle-vertex-actions{bottom:auto;top:100%}}

@media(max-width:850px){.obstacle-popover.docked .obstacle-shape-actions{position:static}.obstacle-popover.docked .obstacle-vertex-actions{left:8px;right:auto;top:100%;max-width:calc(100% - 16px)}}

.obstacle-corner-choice{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 10px;font-size:13px;font-weight:600;grid-column:1 / -1}
.obstacle-corner-choice select{font:inherit;min-height:44px;min-width:0;padding:4px 8px}
@media(max-width:850px){
  #app .workarea:is(.obstacle-docked,[data-editor-tool=hole])>.canvas-footer .planning-actions{display:none}
  .workarea.obstacle-docked>.canvas-footer .roof-progress{min-width:0;max-width:100%}
  .workarea.obstacle-docked .canvas-stage .source-caption{display:none}
}
