.image-editor {
  box-sizing: border-box;
  width: min(1120px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 32px));
  height: min(900px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 16px;
  border: 1px solid var(--line, #2a3242);
  border-radius: 14px;
  background: var(--panel, #171c25);
  color: var(--text, #e6e9ef);
  color-scheme: dark;
  font: 14px/1.5 system-ui, sans-serif;
  overflow: auto;
  overscroll-behavior: contain;
}
.image-editor[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.image-editor::backdrop { background: rgb(0 0 0 / 75%); }
.image-editor *, .image-editor *::before, .image-editor *::after { box-sizing: border-box; }
.image-editor [hidden] { display: none; }
.image-editor-header { display: flex; align-items: baseline; gap: 16px; flex: none; min-width: 0; }
.image-editor h2 { margin: 0; font-size: 18px; flex: none; }
.image-editor-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted, #8b95a7); }
.image-editor-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none; }
.image-editor button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line, #2a3242);
  border-radius: 8px;
  background: var(--panel2, #1e2430);
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.image-editor button[aria-pressed="true"] { border-color: var(--accent, #7c9cff); background: #283858; }
.image-editor button:disabled, .image-editor input:disabled { opacity: .5; cursor: default; }
.image-editor button:focus-visible, .image-editor input:focus-visible { outline: 2px solid var(--accent, #7c9cff); outline-offset: 3px; }
.image-editor-color { display: flex; align-items: center; gap: 8px; margin: 0; color: inherit; font: inherit; }
.image-editor-color input { width: 48px; height: 44px; padding: 3px; margin: 0; border: 1px solid var(--line, #2a3242); border-radius: 8px; background: transparent; cursor: pointer; }
.image-editor-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-height: 160px;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #0b0e14;
}
.image-editor-canvas { display: block; flex: none; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.image-editor-hint, .image-editor-status { margin: 0; flex: none; color: var(--muted, #8b95a7); overflow-wrap: anywhere; }
.image-editor-status { font-size: 13px; }
.image-editor-status.image-editor-error { color: var(--err, #ff6b6b); }
.image-editor-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; flex: none; }
.image-editor .image-editor-save { background: var(--accent, #7c9cff); border-color: var(--accent, #7c9cff); color: #0b1020; font-weight: 600; }
@media (max-width: 600px) {
  .image-editor { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; border: 0; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .image-editor[open] { gap: 8px; }
  .image-editor-header { flex-direction: column; gap: 0; }
  .image-editor-name { max-width: 100%; font-size: 12px; }
  .image-editor-toolbar { gap: 6px; }
  .image-editor button { padding: 8px 10px; }
  .image-editor-footer button { flex: 1; }
}
