.image-editor {
  position: fixed;
  inset: 0;
  width: min(510px, calc(100% - 22px));
  max-height: calc(100dvh - 22px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #565656;
  border-radius: 12px;
  color: #f0f0f0;
  background: #161616;
  box-shadow: 0 18px 55px #000a;
  color-scheme: dark;
}
.image-editor::backdrop { background: #000b; }
.image-editor :is(header, footer, .image-editor-sources, .image-editor-controls) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
}
.image-editor header { flex-wrap: nowrap; justify-content: space-between; border-bottom: 1px solid #383838; }
.image-editor header h2 { margin: 0; font: 800 1.45rem/1.1 var(--site-display, sans-serif); }
.image-editor button, .image-editor-button {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 35px;
  padding: 5px 10px;
  border: 1px solid #515151;
  border-radius: 6px;
  color: #eee;
  background: #252525;
  font: 650 .8rem/1.2 Inter, sans-serif;
  text-align: center;
  cursor: pointer;
}
.image-editor button:hover:not(:disabled), .image-editor-button:hover { background: #333; }
.image-editor button:disabled { opacity: .45; cursor: default; }
.image-editor button:focus-visible, .image-editor-button:focus-within, .image-editor-frame:focus-visible { outline: 2px solid #eee; outline-offset: 2px; }
.image-editor header button { width: 35px; padding: 0; font-size: 1.3rem; }
.image-editor-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.image-editor-sources > div { display: flex; flex: 1 1 200px; gap: 6px; }
.image-editor-sources input[type=url] {
  flex: 1;
  min-width: 0;
  padding-inline: 8px;
  border: 1px solid #494949;
  border-radius: 6px;
  color: #eee;
  background: #111;
  font: inherit;
  font-size: .8125rem;
}
.image-editor-stage {
  display: grid;
  min-height: 85px;
  place-items: center;
  margin: 0 13px;
  padding: 10px;
  border: 1px solid #363636;
  border-radius: 8px;
  background: #101010;
}
.image-editor-frame {
  position: relative;
  width: min(100%, 380px, calc(43dvh * var(--image-ratio, 1)));
  aspect-ratio: var(--image-ratio, 1);
  overflow: hidden;
  outline: 1px solid #777;
  background: repeating-conic-gradient(#252525 0% 25%, #303030 0% 50%) 0 0 / 20px 20px;
  cursor: grab;
  touch-action: none;
}
.image-editor-frame:active { cursor: grabbing; }
.image-editor-frame img { position: absolute; display: block; max-width: none; object-fit: fill; pointer-events: none; }
.image-editor-message { min-height: 1em; margin: 9px 13px 0; color: #d0d0d0; font-size: .8125rem; line-height: 1.35; }
.image-editor-controls label { display: flex; flex: 1 1 235px; align-items: center; gap: 7px; color: #ddd; font-size: .8125rem; }
.image-editor-controls input { flex: 1; min-width: 52px; accent-color: #ddd; }
.image-editor-controls output { min-width: 36px; font-variant-numeric: tabular-nums; text-align: end; }
.image-editor footer { justify-content: flex-end; border-top: 1px solid #383838; }
.image-editor footer .image-editor-apply { border-color: #ddd; color: #161616; background: #eee; }
.image-editor footer .image-editor-apply:hover:not(:disabled) { color: #161616; background: #fff; }
.image-editor [hidden] { display: none !important; }
.image-field-action { margin-top: 5px; }
.ks-fileitem .ks-file-crop { width: auto; height: auto; padding: 5px 7px; border-radius: 5px; border-color: #555; color: #eee; font: 650 .75rem/1 Inter, sans-serif; }
