.cover-editor{width:min(46rem,calc(100% - 1.5rem));max-width:46rem;max-height:92vh;max-height:92dvh;box-sizing:border-box;padding:0;border:2px solid var(--ui-main);border-radius:1rem;background:var(--ui-panel);color:var(--ui-ink);overscroll-behavior:contain}
.cover-editor::backdrop{background:#000b}
.cover-editor-body{padding:1rem}.cover-editor h2{margin:0}.cover-editor p{line-height:1.4;margin:.65rem 0}.cover-editor-status{min-height:1.5em}
.cover-editor-stage{position:relative;width:fit-content;max-width:100%;margin:.8rem auto;background:repeating-conic-gradient(#ddd 0% 25%,#fff 0% 50%) 50% / 16px 16px;overflow:hidden;isolation:isolate}
.cover-editor-stage canvas{display:block;max-width:100%;max-height:42vh;max-height:42svh;width:auto;height:auto}
.cover-editor-crop{position:absolute;box-sizing:border-box;border:2px solid #fff;box-shadow:0 0 0 200vmax #0008,inset 0 0 0 1px #111;touch-action:none;cursor:move}
.cover-editor .crop-handle{position:absolute;margin:0;min-width:36px;min-height:36px;width:36px;height:36px;padding:0;border:0;border-radius:0;background:transparent;touch-action:none;z-index:1}
.crop-handle::after{content:'';position:absolute;width:14px;height:14px;background:#fff;border:2px solid #111;border-radius:50%}
.crop-nw{left:0;top:0;cursor:nwse-resize}.crop-ne{right:0;top:0;cursor:nesw-resize}.crop-sw{left:0;bottom:0;cursor:nesw-resize}.crop-se{right:0;bottom:0;cursor:nwse-resize}
.crop-nw::after{left:0;top:0}.crop-ne::after{right:0;top:0}.crop-sw::after{left:0;bottom:0}.crop-se::after{right:0;bottom:0}
.cover-editor .crop-handle:focus-visible{outline:3px solid var(--ui-main);outline-offset:-3px;background:#0005}
.cover-editor-turn,.cover-editor-actions{display:flex;flex-wrap:wrap;gap:.5rem}.cover-editor button{min-height:44px;margin-top:.5rem;cursor:pointer;background:var(--ui-soft);color:var(--ui-ink);border:1px solid var(--ui-muted)}
.cover-editor .primary-action{background:var(--ui-main);color:var(--ui-button-text);border-color:var(--ui-main);font-weight:700}
.cover-editor button:disabled{opacity:.5;cursor:wait}.cover-editor input[type=range]{padding:.5rem 0;width:100%;accent-color:var(--ui-main)}
.cover-editor select{background:var(--ui-bg);color:var(--ui-ink)}.cover-editor-tools label{margin-top:.65rem}
@media(max-width:32rem){.cover-editor-actions{display:grid;grid-template-columns:1fr}.cover-editor-actions button{width:100%}.cover-editor-turn button{flex:1;padding:.5rem}}
.photo-perspective-overlay{position:absolute;inset:0;touch-action:none}
.photo-perspective-overlay svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.photo-perspective-overlay path{fill:#0008}.photo-perspective-overlay polygon{fill:none;stroke:#fff;stroke-width:.7;vector-effect:non-scaling-stroke}
.cover-editor .perspective-point{position:absolute;margin:0;padding:0;width:40px;height:40px;min-width:40px;min-height:40px;background:transparent;border:0;border-radius:0;touch-action:none;cursor:move}
.perspective-point::after{content:'';position:absolute;width:15px;height:15px;border:2px solid #111;border-radius:50%;background:#fff}
.point-0{transform:translate(0,0)}.point-1{transform:translate(-100%,0)}.point-2{transform:translate(-100%,-100%)}.point-3{transform:translate(0,-100%)}
.point-0::after{left:0;top:0}.point-1::after{right:0;top:0}.point-2::after{right:0;bottom:0}.point-3::after{left:0;bottom:0}
.cover-editor .perspective-point:focus-visible{outline:3px solid var(--ui-main);outline-offset:-3px;background:#0005}
.cover-editor [data-rectify]{font-weight:700;background:var(--ui-main);color:var(--ui-button-text);width:100%}
.photo-edit-selection>div{display:flex;align-items:center;flex-wrap:wrap;gap:.4rem .75rem;margin:.4rem 0}.photo-edit-selection span{overflow-wrap:anywhere;min-width:0}.photo-edit-selection button{margin:0;min-height:44px}
.cover-editor [hidden]{display:none!important}
.photo-perspective-overlay polygon{stroke-width:2}

/* Keep large hit areas, but show only a fine marker at the actual image point. */
.cover-editor .crop-handle,.cover-editor .perspective-point{min-width:44px;min-height:44px;width:44px;height:44px}
.cover-editor .crop-handle::after,.cover-editor .perspective-point::after{width:7px;height:7px;border-width:1px;box-shadow:0 0 0 1px #fff}
.photo-loupe{position:absolute;width:120px;height:120px;z-index:10;pointer-events:none;border:2px solid #fff;outline:1px solid #111;border-radius:.5rem;overflow:hidden;box-shadow:0 2px 12px #0008;background:#777}
.photo-loupe canvas{display:block;width:120px;height:120px}
[data-saved-photo] img{width:180px;height:180px;max-width:100%;object-fit:contain}
.saved-photo-comparison{display:flex;flex-wrap:wrap;gap:1rem}.saved-photo-comparison figure{margin:0}
[data-saved-photo] [hidden]{display:none!important}

.cover-editor-crop .crop-nw{left:-2px;top:-2px}.cover-editor-crop .crop-ne{right:-2px;top:-2px}.cover-editor-crop .crop-sw{left:-2px;bottom:-2px}.cover-editor-crop .crop-se{right:-2px;bottom:-2px}
.crop-nw::after,.point-0::after{transform:translate(-50%,-50%)}.crop-ne::after,.point-1::after{transform:translate(50%,-50%)}.crop-sw::after,.point-3::after{transform:translate(-50%,50%)}.crop-se::after,.point-2::after{transform:translate(50%,50%)}

.cover-editor button.crop-handle:not(:disabled):active,.cover-editor button.perspective-point:not(:disabled):active{background:transparent}
