.cp-crop-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.cp-crop-editor {
  --cp-crop-accent: #5b5bd6;
  --cp-crop-accent-2: #7c3aed;
  --cp-crop-text: #172033;
  --cp-crop-muted: #687086;
  --cp-crop-surface: #ffffff;
  --cp-crop-soft: #f5f6fa;
  --cp-crop-border: #e4e7ef;
  position: fixed;
  inset: 0;
  z-index: 10950;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 36px);
  font-family: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--cp-crop-text);
}

.cp-crop-editor[hidden] { display: none !important; }

.cp-crop-editor__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 34, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cp-crop-editor__dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1040px, 100%);
  max-height: min(880px, calc(100dvh - 24px));
  overflow: hidden;
  background: var(--cp-crop-surface);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(5, 10, 26, .35);
  animation: cp-crop-enter .22s ease-out both;
}

@keyframes cp-crop-enter {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.cp-crop-editor__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--cp-crop-border);
}

.cp-crop-editor__heading-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--cp-crop-accent), var(--cp-crop-accent-2));
  box-shadow: 0 9px 20px rgba(91, 91, 214, .25);
}

.cp-crop-editor__heading-icon .material-icons-outlined { font-size: 22px; }
.cp-crop-editor__heading { min-width: 0; flex: 1; }
.cp-crop-editor__heading h2 { margin: 0; font-size: 1.06rem; font-weight: 800; letter-spacing: -.015em; }
.cp-crop-editor__heading p { margin: 3px 0 0; color: var(--cp-crop-muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cp-crop-editor__icon-button,
.cp-crop-editor__tool,
.cp-crop-editor__ratio {
  appearance: none;
  border: 1px solid var(--cp-crop-border);
  color: var(--cp-crop-text);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, color .15s ease;
}

.cp-crop-editor__icon-button:hover,
.cp-crop-editor__tool:hover,
.cp-crop-editor__ratio:hover { border-color: #b9bde0; background: #f8f8ff; }
.cp-crop-editor__icon-button:active,
.cp-crop-editor__tool:active,
.cp-crop-editor__ratio:active { transform: scale(.97); }
.cp-crop-editor button:focus-visible,
.cp-crop-editor input:focus-visible { outline: 3px solid rgba(91, 91, 214, .2); outline-offset: 2px; }

.cp-crop-editor__icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
}

.cp-crop-editor__icon-button .material-icons-outlined { font-size: 21px; }

.cp-crop-editor__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  min-height: 0;
  overflow: auto;
}

.cp-crop-editor__workspace {
  position: relative;
  min-width: 0;
  min-height: 390px;
  padding: clamp(12px, 2vw, 22px);
  background:
    radial-gradient(circle at 18% 12%, rgba(91, 91, 214, .18), transparent 30%),
    radial-gradient(circle at 86% 86%, rgba(124, 58, 237, .15), transparent 32%),
    #141827;
  overflow: hidden;
}

.cp-crop-editor__stage {
  position: absolute;
  inset: clamp(12px, 2vw, 22px);
  display: grid;
  place-items: center;
}

.cp-crop-editor__canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cp-crop-editor__canvas.is-dragging { cursor: grabbing; }

.cp-crop-editor__hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 30px);
  padding: 7px 12px;
  color: rgba(255,255,255,.9);
  background: rgba(9, 13, 25, .62);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  font-size: .72rem;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(7px);
}

.cp-crop-editor__hint .material-icons-outlined { font-size: 15px; }

.cp-crop-editor__panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: var(--cp-crop-surface);
  border-left: 1px solid var(--cp-crop-border);
  overflow: auto;
}

.cp-crop-editor__group { display: grid; gap: 10px; }
.cp-crop-editor__group-title { color: var(--cp-crop-muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cp-crop-editor__ratios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cp-crop-editor__ratio { min-height: 38px; padding: 6px 4px; border-radius: 10px; font-size: .75rem; font-weight: 700; }
.cp-crop-editor__ratio[data-ratio="6"] { grid-column: 1 / -1; }
.cp-crop-editor__ratio.is-active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--cp-crop-accent), var(--cp-crop-accent-2)); box-shadow: 0 7px 16px rgba(91,91,214,.2); }

.cp-crop-editor__zoom-row { display: grid; grid-template-columns: 32px 1fr 32px; gap: 9px; align-items: center; }
.cp-crop-editor__zoom-row .material-icons-outlined { color: var(--cp-crop-muted); font-size: 19px; }
.cp-crop-editor__range { width: 100%; accent-color: var(--cp-crop-accent); cursor: pointer; }

.cp-crop-editor__tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.cp-crop-editor__tool { display: grid; place-items: center; min-height: 42px; padding: 0; border-radius: 10px; }
.cp-crop-editor__tool .material-icons-outlined { font-size: 20px; }

.cp-crop-editor__dimensions { display: grid; grid-template-columns: 1fr auto 1fr; gap: 7px; align-items: end; }
.cp-crop-editor__dimension { display: grid; gap: 5px; }
.cp-crop-editor__dimension label { color: var(--cp-crop-muted); font-size: .72rem; font-weight: 700; }
.cp-crop-editor__dimension input {
  width: 100%;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--cp-crop-border);
  border-radius: 10px;
  color: var(--cp-crop-text);
  background: var(--cp-crop-soft);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
}
.cp-crop-editor__dimensions > span { padding-bottom: 9px; color: #a0a6b6; font-size: .75rem; }
.cp-crop-editor__size-guide { display: grid; gap: 4px; padding: 10px 11px; border: 1px solid var(--cp-crop-border); border-radius: 10px; background: var(--cp-crop-soft); }
.cp-crop-editor__size-guide[hidden] { display: none; }
.cp-crop-editor__size-guide-title { color: var(--cp-crop-text); font-size: .72rem; font-weight: 800; }
.cp-crop-editor__size-guide p { margin: 0; color: var(--cp-crop-muted); font-size: .72rem; line-height: 1.4; }
.cp-crop-editor__size-guide p.is-current { color: var(--cp-crop-accent); font-weight: 800; }
.cp-crop-editor__size-guide small { color: var(--cp-crop-muted); font-size: .68rem; line-height: 1.45; }
.cp-crop-editor__output-note { margin: 0; color: var(--cp-crop-muted); font-size: .7rem; line-height: 1.55; }

.cp-crop-editor__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid var(--cp-crop-border);
  background: #fff;
}

.cp-crop-editor__meta { min-width: 0; color: var(--cp-crop-muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-crop-editor__actions { display: flex; gap: 9px; }
.cp-crop-editor__button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}
.cp-crop-editor__button--secondary { color: var(--cp-crop-text); background: var(--cp-crop-soft); border: 1px solid var(--cp-crop-border); }
.cp-crop-editor__button--primary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 128px; color: #fff; background: linear-gradient(135deg, var(--cp-crop-accent), var(--cp-crop-accent-2)); box-shadow: 0 9px 20px rgba(91,91,214,.25); }
.cp-crop-editor__button--primary .material-icons-outlined { font-size: 18px; }
.cp-crop-editor__button:disabled { opacity: .65; cursor: wait; }

html[data-bs-theme="dark"] .cp-crop-editor {
  --cp-crop-text: #f1f3fa;
  --cp-crop-muted: #aab0c1;
  --cp-crop-surface: #202435;
  --cp-crop-soft: #292e41;
  --cp-crop-border: #383e53;
}
html[data-bs-theme="dark"] .cp-crop-editor__icon-button,
html[data-bs-theme="dark"] .cp-crop-editor__tool,
html[data-bs-theme="dark"] .cp-crop-editor__ratio,
html[data-bs-theme="dark"] .cp-crop-editor__footer { background: var(--cp-crop-surface); }

@media (max-width: 767.98px) {
  .cp-crop-editor { padding: 0; place-items: stretch; }
  .cp-crop-editor__dialog { width: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .cp-crop-editor__header { padding: 12px 14px; }
  .cp-crop-editor__heading-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .cp-crop-editor__heading p { max-width: 62vw; }
  .cp-crop-editor__body { grid-template-columns: 1fr; grid-template-rows: minmax(240px, 1fr) auto; overflow: hidden; }
  .cp-crop-editor__workspace { min-height: 0; }
  .cp-crop-editor__panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; max-height: 260px; padding: 14px; border-left: 0; border-top: 1px solid var(--cp-crop-border); overflow: auto; }
  .cp-crop-editor__group { gap: 7px; }
  .cp-crop-editor__group--ratio { grid-column: 1 / -1; }
  .cp-crop-editor__ratios { grid-template-columns: repeat(6, 1fr); }
  .cp-crop-editor__ratio { min-height: 34px; }
  .cp-crop-editor__footer { padding: 11px 14px max(11px, env(safe-area-inset-bottom)); }
  .cp-crop-editor__meta { display: none; }
  .cp-crop-editor__actions { width: 100%; }
  .cp-crop-editor__button { flex: 1; }
}

@media (max-width: 430px) {
  .cp-crop-editor__heading p { display: none; }
  .cp-crop-editor__panel { grid-template-columns: 1fr; max-height: 240px; }
  .cp-crop-editor__group--ratio { grid-column: auto; }
  .cp-crop-editor__ratios { grid-template-columns: repeat(3, 1fr); }
  .cp-crop-editor__group--output { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-crop-editor__dialog { animation: none; }
  .cp-crop-editor * { scroll-behavior: auto !important; transition: none !important; }
}
