.dieditor-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-viewer, 3000) + 10);
  display: flex;
  flex-direction: column;
  background: #111;
  color: #fff;
}
body.dieditor-open {
  overflow: hidden;
}
.dieditor-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35);
}
.dieditor-title {
  font-size: 16px;
  font-weight: 600;
}
.dieditor-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.dieditor-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
.dieditor-stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.dieditor-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
touch-action: none;
  cursor: grab;
}
.dieditor-viewport:active {
  cursor: grabbing;
}
.dieditor-wrap {
position: absolute;
}
.dieditor-canvas {
  display: block;
}
.dieditor-cropbox {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
pointer-events: none;
}
.dieditor-cropbox.is-adjustable {
  pointer-events: auto;
  touch-action: none;
  cursor: move;
}
.dieditor-handle {
  display: none;
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px;
  background: #fff;
  border-radius: 999px;
  touch-action: none;
}
.dieditor-cropbox.is-adjustable .dieditor-handle {
  display: block;
}
.dieditor-handle-nw { top: 0; left: 0; cursor: nwse-resize; }
.dieditor-handle-ne { top: 0; right: 0; margin-right: -9px; cursor: nesw-resize; }
.dieditor-handle-sw { bottom: 0; left: 0; margin-bottom: -9px; cursor: nesw-resize; }
.dieditor-handle-se { bottom: 0; right: 0; margin-right: -9px; margin-bottom: -9px; cursor: nwse-resize; }
.dieditor-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.35);
}
.dieditor-tool-btn {
  min-width: 44px;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.dieditor-tool-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
.dieditor-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35);
}
.dieditor-btn {
  min-width: 88px;
  height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.dieditor-btn-cancel {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.dieditor-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.22);
}
.dieditor-btn-save {
  background: #2563eb;
  color: #fff;
}
.dieditor-btn-save:hover {
  background: #1d4ed8;
}
.dieditor-btn-save:disabled {
  opacity: 0.6;
  cursor: default;
}
.dieditor-loading-overlay {
  align-items: center;
  justify-content: center;
}
.dieditor-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dieditor-spin .7s linear infinite;
}
@keyframes dieditor-spin {
  to { transform: rotate(360deg); }
}
.dieditor-btn-save.is-saving {
  position: relative;
  padding-left: 40px;
}
.dieditor-btn-save.is-saving::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dieditor-spin .6s linear infinite;
}
