.editor-guide-toolbar{display:flex;flex:0 0 auto;align-items:center;gap:4px;padding:4px;border:1px solid var(--line);border-radius:9px;background:color-mix(in srgb,var(--panel) 88%,var(--paper))}
.editor-guide-toolbar button{display:grid;width:30px;height:30px;padding:5px;place-items:center;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--muted);cursor:pointer}
.editor-guide-toolbar button:hover,.editor-guide-toolbar button.active{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.editor-guide-toolbar button>span{display:block;width:15px;height:15px;border:1px solid currentColor}
.editor-guide-toolbar .guide-focus-toggle>span{background:repeating-linear-gradient(135deg,transparent 0 2px,currentColor 2px 3px)}
.editor-guide-toolbar .guide-focus-toggle.active>span{box-shadow:inset 0 0 0 4px currentColor}
.editor-guide-toolbar .guide-color-toggle>span{background:#fff;box-shadow:inset 0 0 0 1px #9ca3af}
.editor-guide-toolbar .guide-color-toggle.active>span{background:#111}
.editor-guide-toolbar .guide-focus-toggle{grid-column:1;grid-row:1}.editor-guide-toolbar .guide-color-toggle{grid-column:2;grid-row:1}.editor-guide-toolbar [data-grid-density="3"]{grid-column:1;grid-row:2}.editor-guide-toolbar [data-grid-density="4"]{grid-column:2;grid-row:2}.editor-guide-toolbar [data-grid-density="5"]{grid-column:3;grid-row:2}
.editor-guide-toolbar .guide-grid-button>span{--icon-grid:3;background-image:repeating-linear-gradient(to right,transparent 0 calc((100% / var(--icon-grid)) - 1px),currentColor calc((100% / var(--icon-grid)) - 1px) calc(100% / var(--icon-grid))),repeating-linear-gradient(to bottom,transparent 0 calc((100% / var(--icon-grid)) - 1px),currentColor calc((100% / var(--icon-grid)) - 1px) calc(100% / var(--icon-grid)))}
.editor-guide-toolbar [data-grid-density="4"]>span{--icon-grid:4}.editor-guide-toolbar [data-grid-density="5"]>span{--icon-grid:5}
.editor-guide-toolbar .guide-grid-off>span{position:relative;background-image:linear-gradient(to right,transparent 46%,currentColor 46% 54%,transparent 54%),linear-gradient(to bottom,transparent 46%,currentColor 46% 54%,transparent 54%)}
.editor-guide-toolbar .guide-grid-off>span::after{content:'';position:absolute;left:50%;top:50%;width:20px;height:2px;border-radius:2px;background:currentColor;transform:translate(-50%,-50%) rotate(-45deg)}
.editor-flip-toolbar{display:flex;flex:0 0 auto;align-items:center;gap:4px;padding:4px;border:1px solid var(--line);border-radius:9px;background:color-mix(in srgb,var(--panel) 88%,var(--paper))}
.editor-flip-toolbar button{display:grid;width:30px;height:30px;padding:0;place-items:center;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--muted);font:700 19px/1 'Cascadia Mono',Consolas,monospace;cursor:pointer}
.editor-flip-toolbar button:hover,.editor-flip-toolbar button.active{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.editor-shape-toolbar{display:grid;flex:0 0 auto;grid-template-columns:repeat(5,28px);gap:3px;padding:4px;border:1px solid var(--line);border-radius:9px;background:color-mix(in srgb,var(--panel) 88%,var(--paper))}
.editor-shape-toolbar button{display:grid;width:28px;height:28px;padding:5px;place-items:center;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--muted);cursor:pointer}
.editor-shape-toolbar button:hover,.editor-shape-toolbar button.active{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.editor-shape-toolbar button span{display:block;width:16px;height:16px;background:currentColor}
.crop-editor .editor-ratio-bar>.editor-shape-toolbar{width:100%;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:8px}
.crop-editor .editor-ratio-bar>.editor-shape-toolbar button{width:100%;min-width:0}
.editor-shape-toolbar [data-crop-shape="rectangle"] span{clip-path:inset(0)}.editor-shape-toolbar [data-crop-shape="circle"] span{clip-path:circle(50%)}.editor-shape-toolbar [data-crop-shape="ellipse"] span{height:11px;clip-path:ellipse(50% 50%)}.editor-shape-toolbar [data-crop-shape="triangle"] span{clip-path:polygon(50% 0,100% 100%,0 100%)}.editor-shape-toolbar [data-crop-shape="star"] span{clip-path:polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 94%,50% 72%,21% 94%,32% 57%,2% 35%,39% 35%)}.editor-shape-toolbar [data-crop-shape="heart"] span{clip-path:polygon(50% 100%,5% 55%,0 28%,12% 8%,35% 5%,50% 23%,65% 5%,88% 8%,100% 28%,95% 55%)}.editor-shape-toolbar [data-crop-shape="pentagon"] span{clip-path:polygon(50% 0,100% 38%,81% 100%,19% 100%,0 38%)}.editor-shape-toolbar [data-crop-shape="hexagon"] span{clip-path:polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%)}.editor-shape-toolbar [data-crop-shape="octagon"] span{clip-path:polygon(30% 0,70% 0,100% 30%,100% 70%,70% 100%,30% 100%,0 70%,0 30%)}.editor-shape-toolbar [data-crop-shape="diamond"] span{clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%)}
.editor-shape-toolbar [data-crop-shape="curved_heart"] span{clip-path:path('M8 15 C6 13 0 9 0 4.8 C0 .8 5 -1 8 3 C11 -1 16 .8 16 4.8 C16 9 10 13 8 15')}.editor-shape-toolbar [data-crop-shape="drop"] span{clip-path:path('M8 0 C8 0 2 7 2 11 C2 14.5 4.7 16 8 16 C11.3 16 14 14.5 14 11 C14 7 8 0 8 0 Z')}
.main-shape-control{display:grid;gap:7px;min-width:0}
.main-shape-control>strong{color:var(--muted);font:600 10px 'DM Mono',monospace}
.main-shape-toolbar{width:100%;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px;padding:6px}
.main-shape-toolbar button{width:100%;height:36px;min-width:0;padding:8px}
.main-shape-toolbar button span{width:18px;height:18px}
@media(max-width:420px){.main-shape-toolbar{grid-template-columns:repeat(4,minmax(0,1fr))}}
#editor-stage.guide-focus-only #crop-selection{box-shadow:0 0 0 9999px #000}
#crop-selection{--crop-guide-color:rgba(255,255,255,.78);border-width:1px;border-color:var(--crop-guide-color)}
#crop-selection.guide-black{--crop-guide-color:rgba(8,10,14,.9)}
#crop-selection::before{z-index:1;inset:0;left:0;top:0;width:100%;height:100%;background-color:transparent;background-image:repeating-linear-gradient(to right,transparent 0 calc((100% / var(--crop-grid-count,3)) - 1px),var(--crop-guide-color) calc((100% / var(--crop-grid-count,3)) - 1px) calc(100% / var(--crop-grid-count,3))),repeating-linear-gradient(to bottom,transparent 0 calc((100% / var(--crop-grid-count,3)) - 1px),var(--crop-guide-color) calc((100% / var(--crop-grid-count,3)) - 1px) calc(100% / var(--crop-grid-count,3)));box-shadow:none;pointer-events:none}
#crop-selection:not([data-crop-shape="rectangle"]){border-color:transparent;background:transparent}
#crop-selection:not([data-crop-shape="rectangle"])::before{display:none}
#crop-selection[data-crop-shape="circle"]{--crop-shape-clip:circle(50% at 50% 50%)}#crop-selection[data-crop-shape="ellipse"]{--crop-shape-clip:ellipse(50% 50% at 50% 50%)}#crop-selection[data-crop-shape="triangle"]{--crop-shape-clip:polygon(50% 0,100% 100%,0 100%)}#crop-selection[data-crop-shape="star"]{--crop-shape-clip:polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 94%,50% 72%,21% 94%,32% 57%,2% 35%,39% 35%)}#crop-selection[data-crop-shape="heart"]{--crop-shape-clip:polygon(50% 100%,5% 55%,0 28%,12% 8%,35% 5%,50% 23%,65% 5%,88% 8%,100% 28%,95% 55%)}#crop-selection[data-crop-shape="pentagon"]{--crop-shape-clip:polygon(50% 0,100% 38%,81% 100%,19% 100%,0 38%)}#crop-selection[data-crop-shape="hexagon"]{--crop-shape-clip:polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%)}#crop-selection[data-crop-shape="octagon"]{--crop-shape-clip:polygon(30% 0,70% 0,100% 30%,100% 70%,70% 100%,30% 100%,0 70%,0 30%)}#crop-selection[data-crop-shape="diamond"]{--crop-shape-clip:polygon(50% 0,100% 50%,50% 100%,0 50%)}
#crop-selection[data-crop-shape="curved_heart"]{--crop-shape-clip:polygon(50% 100%,38% 86%,24% 73%,12% 58%,4% 43%,2% 29%,5% 16%,14% 7%,27% 5%,39% 11%,50% 23%,61% 11%,73% 5%,86% 7%,95% 16%,98% 29%,96% 43%,88% 58%,76% 73%,62% 86%)}#crop-selection[data-crop-shape="drop"]{--crop-shape-clip:polygon(50% 0,38% 20%,25% 40%,12% 65%,14% 82%,28% 96%,50% 100%,72% 96%,86% 82%,88% 65%,75% 40%,62% 20%)}
#crop-selection>.crop-shape-overlay{position:absolute;z-index:1;inset:0;display:none;width:100%;height:100%;overflow:visible;pointer-events:none}
#crop-selection:not([data-crop-shape="rectangle"])>.crop-shape-overlay{display:block}
#crop-selection>.crop-shape-overlay .crop-shape-shade{fill:transparent}
#editor-stage.guide-focus-only #crop-selection>.crop-shape-overlay .crop-shape-shade{fill:#000}
#crop-selection>.crop-shape-overlay .crop-shape-outline{fill:none;stroke:var(--crop-guide-color);stroke-width:2}
#crop-selection>.crop-shape-overlay .crop-shape-grid{fill:none;stroke:var(--crop-guide-color);stroke-width:1}
#crop-selection.grid-hidden::before,#crop-selection.grid-hidden>.crop-shape-overlay .crop-shape-grid{display:none}
/* In focus mode the rectangular resize boundary must disappear into the black mask. */
#editor-stage.guide-focus-only #crop-selection:not([data-crop-shape="rectangle"]){border-color:#000;box-shadow:0 0 0 9999px #000,inset 0 0 0 1px #000}
#editor-stage.guide-focus-only #crop-selection .crop-handle:is(.nw,.ne,.se,.sw),#editor-stage.guide-focus-only #crop-selection .crop-handle:is(.nw,.ne,.se,.sw)::after{border-color:#fff}
#editor-stage.guide-focus-only #crop-selection .crop-handle:is(.n,.s,.e,.w)::after{border-color:#fff;background:#fff}
#crop-selection::after{display:none}#crop-selection .crop-center{color:var(--crop-guide-color)}#crop-selection .crop-handle:is(.nw,.ne,.se,.sw){border-color:var(--crop-guide-color)}#crop-selection .crop-handle:is(.n,.s,.e,.w)::after{border-color:color-mix(in srgb,var(--crop-guide-color) 75%,transparent);background:var(--crop-guide-color)}
.results .inline-crop{--crop-guide-color:rgba(255,255,255,.78);border-width:1px;border-color:var(--crop-guide-color)}
.results.guide-focus-only .inline-crop{box-shadow:0 0 0 9999px #000}
.results.guide-black .inline-crop{--crop-guide-color:rgba(8,10,14,.9)}
.results .inline-crop::before{z-index:1;inset:0;left:0;top:0;width:100%;height:100%;background-color:transparent;background-image:repeating-linear-gradient(to right,transparent 0 calc((100% / var(--crop-grid-count,3)) - 1px),var(--crop-guide-color) calc((100% / var(--crop-grid-count,3)) - 1px) calc(100% / var(--crop-grid-count,3))),repeating-linear-gradient(to bottom,transparent 0 calc((100% / var(--crop-grid-count,3)) - 1px),var(--crop-guide-color) calc((100% / var(--crop-grid-count,3)) - 1px) calc(100% / var(--crop-grid-count,3)));pointer-events:none}
.results.grid-hidden .inline-crop::before{display:none}
.results .inline-crop::after,.results .inline-crop>i{display:none}
.results .inline-crop b:is(.nw,.ne,.se,.sw){border-color:var(--crop-guide-color)}
.results .inline-crop b:is(.n,.s,.e,.w){border-color:color-mix(in srgb,var(--crop-guide-color) 75%,transparent);background:var(--crop-guide-color)}
#crop-selection .crop-handle.nw,.results .inline-crop b.nw{border-width:2px 0 0 2px}
#crop-selection .crop-handle.ne,.results .inline-crop b.ne{border-width:2px 2px 0 0}
#crop-selection .crop-handle.se,.results .inline-crop b.se{border-width:0 2px 2px 0}
#crop-selection .crop-handle.sw,.results .inline-crop b.sw{border-width:0 0 2px 2px}
#crop-selection .crop-handle:is(.n,.s)::after{height:3px}
#crop-selection .crop-handle:is(.e,.w)::after{width:3px}
.results .inline-crop b:is(.n,.s){height:3px}
.results .inline-crop b:is(.e,.w){width:3px}
.results .inline-crop>.inline-shape-preview{position:absolute;z-index:1;inset:0;display:none;width:100%;height:100%;overflow:visible;pointer-events:none}
.results .inline-crop:not([data-crop-shape="rectangle"]){border-color:transparent;background:transparent;box-shadow:none}
.results .inline-crop:not([data-crop-shape="rectangle"])::before{display:none}
.results .inline-crop:not([data-crop-shape="rectangle"])>.inline-shape-preview{display:block}
.results .inline-shape-preview .inline-shape-shade{fill:transparent}
.results .inline-shape-preview .inline-shape-outline{fill:none;stroke:var(--crop-guide-color);stroke-width:1.5}
.results .inline-shape-preview .inline-shape-grid{fill:none;stroke:var(--crop-guide-color);stroke-width:1}
.results.grid-hidden .inline-shape-preview .inline-shape-grid{display:none}
.results.guide-focus-only .inline-crop:not([data-crop-shape="rectangle"]){border-color:#000;box-shadow:0 0 0 9999px #000,inset 0 0 0 1px #000}
.results.guide-focus-only .inline-shape-preview .inline-shape-shade{fill:#000}
/* Keep resize hit areas inside the image when the crop frame touches every edge. */
#crop-selection .crop-handle.n,.inline-crop b.n{top:0}
#crop-selection .crop-handle.s,.inline-crop b.s{bottom:0}
#crop-selection .crop-handle.e,.inline-crop b.e{right:0}
#crop-selection .crop-handle.w,.inline-crop b.w{left:0}
#crop-selection .crop-handle.nw,.inline-crop b.nw{left:0;top:0}
#crop-selection .crop-handle.ne,.inline-crop b.ne{right:0;top:0;left:auto}
#crop-selection .crop-handle.se,.inline-crop b.se{right:0;bottom:0;left:auto;top:auto}
#crop-selection .crop-handle.sw,.inline-crop b.sw{left:0;bottom:0;top:auto}
.inline-crop b:is(.nw,.ne,.se,.sw){transform:none}
#crop-selection .crop-handle.n::after,.inline-crop b.n::after{top:0}
#crop-selection .crop-handle.s::after,.inline-crop b.s::after{top:auto;bottom:0;transform:translate(-50%,50%)}
#crop-selection .crop-handle.e::after,.inline-crop b.e::after{left:auto;right:0;transform:translate(50%,-50%)}
#crop-selection .crop-handle.w::after,.inline-crop b.w::after{left:0}
/* Larger invisible resize targets; the visible guides stay on the original edge. */
#crop-selection .crop-handle:is(.n,.s),.inline-crop b:is(.n,.s){height:28px}
#crop-selection .crop-handle:is(.e,.w),.inline-crop b:is(.e,.w){width:28px}
#crop-selection .crop-handle:is(.nw,.ne,.se,.sw),.inline-crop b:is(.nw,.ne,.se,.sw){width:28px;height:28px;border:0;filter:none}
#crop-selection .crop-handle:is(.nw,.ne,.se,.sw)::after,.inline-crop b:is(.nw,.ne,.se,.sw)::after{content:'';position:absolute;width:16px;height:16px;border-color:var(--crop-guide-color);border-style:solid;pointer-events:none}
#crop-selection .crop-handle.nw::after,.inline-crop b.nw::after{left:0;top:0;border-width:2px 0 0 2px}
#crop-selection .crop-handle.ne::after,.inline-crop b.ne::after{right:0;top:0;border-width:2px 2px 0 0}
#crop-selection .crop-handle.se::after,.inline-crop b.se::after{right:0;bottom:0;border-width:0 2px 2px 0}
#crop-selection .crop-handle.sw::after,.inline-crop b.sw::after{left:0;bottom:0;border-width:0 0 2px 2px}
@media(max-width:760px){.editor-guide-toolbar{order:4}}
.crop-align-control[data-align-scope="all"]{grid-template-columns:max-content max-content;align-items:end}
.crop-align-control[data-align-scope="all"]>strong{grid-column:1/-1}
.crop-align-control[data-align-scope="all"]>.main-guide-toolbar{display:grid;grid-template-columns:repeat(3,30px);grid-template-rows:repeat(2,30px);align-self:stretch}
@media(max-width:620px){.crop-align-control[data-align-scope="all"]{grid-template-columns:minmax(0,1fr)}.crop-align-control[data-align-scope="all"]>strong{grid-column:1}.crop-align-control[data-align-scope="all"]>.main-guide-toolbar{width:max-content;max-width:100%}}
@media(min-width:901px){.crop-editor .editor-align-control{flex-wrap:wrap;align-items:center}.crop-editor .editor-align-control>.editor-quick-options{align-items:center}.crop-editor .editor-align-control>.crop-align-buttons,.crop-editor .editor-align-control>.editor-guide-toolbar,.crop-editor .editor-align-control>.editor-flip-toolbar,.crop-editor .editor-align-control>.editor-shape-toolbar,.crop-editor .editor-align-control>.editor-actions{align-self:center}.crop-editor .editor-align-control>.editor-actions button{min-height:40px}}

/* Keep the ratio and crop-shape controls together at the top of the sidebar. */
.crop-editor .editor-ratio-bar{height:auto;align-self:start;align-content:start;grid-template-rows:none;grid-auto-rows:max-content}
.crop-editor .editor-ratio-bar>.editor-shape-toolbar{align-self:start;margin-top:0}
@media(min-width:761px){.crop-editor .editor-ratios{height:auto;grid-template-rows:none;grid-auto-rows:max-content;align-content:start}}
@media(min-width:981px){.image-editor-sidebar.cropper-panel{height:calc(100dvh - 112px);max-height:calc(100dvh - 112px);overflow-y:auto;overscroll-behavior:contain}}

/* Keep alignment and guide controls on one compact row inside the sidebar. */
.image-editor-sidebar.cropper-panel .crop-align-control[data-align-scope="all"]{
  width:100%;
  min-width:0;
  grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  column-gap:5px;
  row-gap:6px;
  align-items:end;
}
.image-editor-sidebar.cropper-panel .crop-align-control[data-align-scope="all"]>strong{grid-column:1/-1}
.image-editor-sidebar.cropper-panel .crop-align-buttons{
  grid-template-columns:repeat(6,minmax(24px,1fr));
  width:100%;
  max-width:100%;
  gap:2px;
  padding:3px;
}
.image-editor-sidebar.cropper-panel .crop-align-buttons button{
  width:100%;
  min-width:24px;
  height:26px;
}
.image-editor-sidebar.cropper-panel .crop-align-buttons [data-align="center"]{
  height:54px;
}
.image-editor-sidebar.cropper-panel .main-guide-toolbar{
  grid-template-columns:repeat(3,minmax(24px,1fr))!important;
  grid-template-rows:repeat(2,26px)!important;
  width:100%;
  max-width:100%;
  justify-self:start;
  gap:2px;
  padding:3px;
}
.image-editor-sidebar.cropper-panel .main-guide-toolbar button{
  width:100%;
  height:26px;
  padding:4px;
}
@media(max-width:380px){
  .image-editor-sidebar.cropper-panel .crop-align-control[data-align-scope="all"]{
    grid-template-columns:minmax(0,1fr);
  }
  .image-editor-sidebar.cropper-panel .crop-align-control[data-align-scope="all"]>strong{grid-column:1}
  .image-editor-sidebar.cropper-panel .crop-align-buttons{
    grid-template-columns:repeat(6,minmax(24px,1fr));
    width:100%;
    gap:3px;
    padding:4px;
  }
  .image-editor-sidebar.cropper-panel .crop-align-buttons button{
    width:100%;
    min-width:24px;
  }
}
