.photo-editor{--pe-bg:#1b2721;--pe-ink:#f5f4ed;--pe-accent:#d1dfb5;width:min(680px,100%);height:min(900px,96dvh);max-height:96dvh;overflow:hidden;border:0;border-radius:22px;padding:0;background:var(--pe-bg);color:var(--pe-ink);box-sizing:border-box;display:none;flex-direction:column;font-family:system-ui,sans-serif;color-scheme:dark}.photo-editor[open]{display:flex}.photo-editor::backdrop{background:#101812e8}.photo-editor *{box-sizing:border-box}.photo-editor [hidden]{display:none!important}.photo-editor button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:44px;min-height:44px;border:0;border-radius:12px;background:transparent;color:inherit;padding:9px;font:600 14px system-ui,sans-serif;cursor:pointer}.photo-editor button:disabled{opacity:.3;cursor:default}.photo-editor svg{display:block;width:24px;height:24px;flex-shrink:0;pointer-events:none}.photo-editor button span{pointer-events:none}.photo-editor button:focus-visible,.pe-crop:focus-visible{outline:3px solid #e7baae;outline-offset:2px}.pe-header{display:flex;align-items:center;gap:8px;padding:10px 12px;flex-shrink:0}.photo-editor h2{margin:0;flex:1;font:600 17px system-ui,sans-serif;white-space:nowrap}.photo-editor .pe-done{background:var(--pe-accent);color:#1b2721;padding:10px 12px}.pe-done svg{width:20px}.pe-image{flex:1;min-height:80px;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:12px;background:#101612}.pe-stage{position:relative;max-width:100%;max-height:100%;overflow:hidden;touch-action:none;flex-shrink:0}.photo-editor canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair;background:#fff}.pe-crop{position:absolute;border:1px solid #fff;box-shadow:0 0 0 2000px #0009;cursor:move;touch-action:none}.pe-grid{position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(to right,transparent calc(33.333% - .5px),#fff6 33.333%,transparent calc(33.333% + .5px),transparent calc(66.666% - .5px),#fff6 66.666%,transparent calc(66.666% + .5px)),linear-gradient(to bottom,transparent calc(33.333% - .5px),#fff6 33.333%,transparent calc(33.333% + .5px),transparent calc(66.666% - .5px),#fff6 66.666%,transparent calc(66.666% + .5px))}.photo-editor .pe-handle{position:absolute;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border-radius:0;z-index:1}.pe-handle::after{content:'';position:absolute;width:17px;height:17px;border-color:#fff;border-style:solid;border-width:0;filter:drop-shadow(0 1px 2px #000)}.pe-nw{left:-22px;top:-22px;cursor:nwse-resize}.pe-nw::after{left:20px;top:20px;border-top-width:3px;border-left-width:3px}.pe-ne{right:-22px;top:-22px;cursor:nesw-resize}.pe-ne::after{right:20px;top:20px;border-top-width:3px;border-right-width:3px}.pe-sw{left:-22px;bottom:-22px;cursor:nesw-resize}.pe-sw::after{left:20px;bottom:20px;border-bottom-width:3px;border-left-width:3px}.pe-se{right:-22px;bottom:-22px;cursor:nwse-resize}.pe-se::after{right:20px;bottom:20px;border-bottom-width:3px;border-right-width:3px}.pe-controls{padding:10px 16px;flex-shrink:0;max-height:39dvh;overflow:auto}.photo-editor #peHint{font-size:13px;text-align:center;line-height:1.4;margin:0 0 8px;color:#e3e8dc}.pe-sizes{display:flex;align-items:center;justify-content:center;gap:14px}.pe-dot{display:block;background:currentColor;border-radius:50%}.photo-editor button[aria-pressed=true]{background:#d1dfb51f;color:var(--pe-accent);box-shadow:inset 0 0 0 1px #d1dfb570}.pe-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.pe-presets button{flex-direction:column;font-size:11px;gap:5px;padding:7px}.pe-presets svg{width:22px;height:22px}.photo-editor .pe-apply{display:flex;margin:8px auto 0;background:var(--pe-accent);color:#1b2721;min-height:40px;padding:8px 16px}.pe-toolbar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px;padding:8px 10px 12px;border-top:1px solid #ffffff15;flex-shrink:0}.pe-toolbar button{flex-direction:column;gap:5px;font-size:11px;min-height:62px;padding:8px 3px}.pe-toolbar svg{width:25px;height:25px}.photo-editor label{display:block;font-size:13px}.photo-editor #peText{display:block;width:100%;padding:11px;border:1px solid #ffffff55;border-radius:12px;background:#101612;color:#fff;font:16px system-ui,sans-serif;margin-top:5px}.photo-editor #peStatus{font-size:12px;margin:5px 0 0;text-align:center;line-height:1.35;color:#e7baae}.photo-editor #peStatus:empty{display:none}.photo-edit-list>div{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}.photo-edit-list span{overflow-wrap:anywhere;min-width:0;flex:1;font-size:13px}@media(max-width:480px){.photo-editor{width:100%;height:100dvh;max-height:100dvh;max-width:100%;margin:0;border-radius:0}.pe-header{padding-top:max(10px,env(safe-area-inset-top))}.pe-toolbar{padding-bottom:max(12px,env(safe-area-inset-bottom))}}
/* Keep the full 44px corner touch targets inside the photo. */
.photo-editor .pe-nw{left:0;top:0}.photo-editor .pe-ne{right:0;top:0}.photo-editor .pe-sw{left:0;bottom:0}.photo-editor .pe-se{right:0;bottom:0}.pe-nw::after{left:0;top:0}.pe-ne::after{right:0;top:0}.pe-sw::after{left:0;bottom:0}.pe-se::after{right:0;bottom:0}
.pe-toolbar{grid-template-columns:repeat(6,minmax(0,1fr))}

.photo-editor:has(.pe-toolbar button:nth-child(5):last-child) .pe-toolbar{grid-template-columns:repeat(5,minmax(0,1fr))}
.photo-edit-list .selected-upload-caption-field{flex-basis:100%;display:grid;gap:6px;margin:0 0 8px}.selected-upload-caption-field label{font-size:13px;font-weight:600}.selected-upload-caption-field textarea{box-sizing:border-box;width:100%;min-height:68px;padding:10px 12px;border:1px solid #d7d9cf;border-radius:12px;background:#fffdf9;color:#25352d;font:16px/1.4 system-ui,sans-serif;resize:vertical}
.photo-edit-list .selected-video-duration{flex-basis:100%;font-size:12px;color:#58604f}
.pe-stickers{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}.photo-editor .pe-stickers button{flex-direction:column;padding:7px 2px;gap:4px;font-size:10px;min-width:0;min-height:54px}.pe-stickers svg{width:23px;height:23px}.pe-sticker-help{font-size:12px;line-height:1.35;text-align:center;margin:7px 0;color:#e3e8dc}.photo-editor #peStickerRemove{display:flex;margin:4px auto 0;min-height:44px;font-size:12px}.pe-sticker-selection{position:absolute;border:2px dashed #fff;box-shadow:0 0 0 1px #1b2721;cursor:move;touch-action:none}.pe-sticker-selection:focus-visible{outline:3px solid #e7baae;outline-offset:2px}.photo-editor [data-sticker-resize]{position:absolute;right:0;bottom:0;width:44px;height:44px;min-width:44px;min-height:44px;padding:8px;border-radius:12px 0 0 0;background:#1b2721e6;color:#fff;border:1px solid #ffffffb3;cursor:nwse-resize;touch-action:none}.photo-editor [data-sticker-resize] svg{width:24px;height:24px}
