.image-editor { width: min(100%, 1000px); height: 100dvh; max-width: 100%; max-height: 100%; margin: auto; padding: 0;
  border: 0; background: var(--bg); color: var(--text); }
.image-editor[open] { display: flex; flex-direction: column; }
.image-editor::backdrop { background: rgba(0,0,0,.7); }
.image-editor header, .image-editor footer { display: block; flex: none; background: var(--card); padding: 12px; }
.image-editor header { border-bottom: 1px solid var(--line); }
.image-editor footer { border-top: 1px solid var(--line); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.image-editor .ie-bar, .image-editor .ie-tools, .image-editor .ie-modes, .image-editor .ie-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.image-editor h2 { flex: 1; margin: 0; font-size: 18px; }
.image-editor button, .image-editor select { min-height: 44px; font-size: 16px; margin: 0; }
.image-editor .ie-tools, .image-editor .ie-modes { margin-top: 8px; }
.image-editor select { width: 100%; }
.image-editor .ie-mode, .image-editor .ie-actions button { flex: 1; }
.image-editor .ie-mode[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.image-editor .ie-scale { min-width: 48px; text-align: center; }
.image-editor .ie-hint, .image-editor .ie-status { font-size: 14px; margin: 8px 0; }
.image-editor .ie-hint { color: var(--muted); }
.image-editor .ie-error { color: var(--danger); }
.image-editor .ie-viewport { flex: 1; min-height: 100px; position: relative; overflow: hidden; touch-action: none; user-select: none;
  -webkit-user-select: none; background: var(--line); }
.image-editor .ie-canvas { position: absolute; transform-origin: 0 0; background: #fff; color: #17243b; }
.image-editor .ie-canvas img { display: block; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.image-editor .ie-polygons { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.image-editor .ie-polygons polygon, .image-editor .ie-polygons polyline { fill: rgba(173,24,50,.23); stroke: #ad1832; stroke-width: 2; vector-effect: non-scaling-stroke; }
.image-editor .ie-polygons polyline { fill: none; stroke-dasharray: 6 4; }
.image-editor .ie-marker { position: absolute; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent;
  display: grid; place-items: center; transform-origin: center; cursor: crosshair; color: #fff; }
.image-editor .ie-marker span { display: block; min-width: 22px; height: 22px; border-radius: 50%; background: #ad1832; color: #fff;
  border: 2px solid #fff; box-shadow: 0 1px 4px #0008; font: 700 12px/18px system-ui, sans-serif; text-align: center; }
.image-editor .ie-marker:focus-visible { outline: 3px solid #123e87; outline-offset: 1px; }
@media print { .image-editor { display: none !important; } }
