body.crop-overlay-open {
  overflow: hidden;
}

.image-crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(48, 41, 35, 0.68);
  backdrop-filter: blur(12px);
}

.image-crop-overlay[hidden] {
  display: none;
}

.image-crop-dialog {
  width: min(900px, 100%);
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto auto auto minmax(260px, 1fr) auto auto;
  gap: 13px;
  padding: 24px;
  overflow: auto;
  background: var(--off-white);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 28px;
  box-shadow: 0 32px 90px rgba(35, 28, 22, 0.35);
}

.image-crop-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.image-crop-header h2 {
  margin: 2px 0 0;
  font-family: "Fraunces", serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.image-crop-eyebrow {
  color: var(--clay);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.image-crop-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0 0 3px;
  color: var(--muted);
  background: rgba(231, 220, 203, 0.44);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.image-crop-close:hover {
  color: var(--terracotta);
  background: #fff;
}

.image-crop-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.image-crop-aspects {
  width: max-content;
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(231, 220, 203, 0.4);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.image-crop-aspects[hidden] {
  display: none;
}

.image-crop-aspects button {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.image-crop-aspects button:hover {
  color: var(--terracotta);
}

.image-crop-aspects button.is-selected {
  color: var(--ink);
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 4px 12px rgba(74, 56, 37, 0.08);
}

.image-crop-aspect-icon {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 1px;
}

.image-crop-aspect-icon.is-landscape {
  width: 16px;
  height: 11px;
}

.image-crop-aspect-icon.is-portrait {
  width: 10px;
  height: 15px;
}

.image-crop-stage {
  min-height: 360px;
  height: min(55vh, 540px);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    #302b27;
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  border-radius: 19px;
  outline: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.image-crop-stage:focus-visible {
  box-shadow: 0 0 0 3px var(--off-white), 0 0 0 6px rgba(182, 111, 86, 0.38);
}

.image-crop-stage.is-dragging {
  cursor: grabbing;
}

.image-crop-photo {
  max-width: none;
  position: absolute;
  z-index: 1;
  display: block;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: left, top, width, height;
  -webkit-user-drag: none;
}

.image-crop-frame {
  position: absolute;
  z-index: 2;
  border: 2px solid rgba(255, 253, 249, 0.95);
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(28, 24, 21, 0.57), 0 5px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.image-crop-frame::before,
.image-crop-frame::after {
  content: "";
  position: absolute;
  opacity: 0.26;
}

.image-crop-frame::before {
  inset: 0 33.333%;
  border-inline: 1px solid #fff;
}

.image-crop-frame::after {
  inset: 33.333% 0;
  border-block: 1px solid #fff;
}

.image-crop-corner {
  width: 20px;
  height: 20px;
  position: absolute;
  border-color: #fff;
  border-style: solid;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.corner-top-left {
  left: -3px;
  top: -3px;
  border-width: 3px 0 0 3px;
}

.corner-top-right {
  right: -3px;
  top: -3px;
  border-width: 3px 3px 0 0;
}

.corner-bottom-left {
  left: -3px;
  bottom: -3px;
  border-width: 0 0 3px 3px;
}

.corner-bottom-right {
  right: -3px;
  bottom: -3px;
  border-width: 0 3px 3px 0;
}

.image-crop-frame-label {
  position: absolute;
  left: 50%;
  top: -29px;
  padding: 5px 9px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(28, 24, 21, 0.64);
  border-radius: 999px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.image-crop-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  place-items: center;
  color: rgba(255, 255, 255, 0.76);
  background: #302b27;
  font-family: "Fraunces", serif;
  font-size: 13px;
}

.image-crop-overlay.is-loading .image-crop-loading {
  display: grid;
}

.image-crop-toolbar,
.image-crop-actions,
.image-crop-zoom {
  display: flex;
  align-items: center;
}

.image-crop-toolbar {
  min-height: 34px;
  justify-content: space-between;
  gap: 15px;
}

.image-crop-gesture-hint {
  color: var(--taupe);
  font-size: 9px;
}

.image-crop-gesture-hint b {
  color: var(--beige);
  font-weight: 400;
}

.image-crop-zoom {
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  background: rgba(231, 220, 203, 0.4);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.image-crop-zoom button {
  width: 30px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 17px;
  cursor: pointer;
}

.image-crop-zoom button:hover:not(:disabled) {
  color: var(--terracotta);
  background: rgba(255, 255, 255, 0.76);
}

.image-crop-zoom button:disabled {
  opacity: 0.3;
  cursor: default;
}

.image-crop-zoom output {
  width: 50px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.image-crop-actions {
  justify-content: flex-end;
  gap: 9px;
  padding-top: 4px;
}

.image-crop-actions button {
  min-height: 43px;
  padding: 10px 18px;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.image-crop-cancel {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.image-crop-cancel:hover {
  color: var(--terracotta);
  background: #fff;
  border-color: rgba(150, 86, 66, 0.3);
}

.image-crop-confirm {
  min-width: 145px;
  color: var(--off-white);
  background: var(--clay);
  border: 1px solid var(--terracotta);
  box-shadow: 0 9px 20px rgba(150, 86, 66, 0.2);
}

.image-crop-confirm:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--terracotta);
}

.image-crop-confirm:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media (max-width: 760px) {
  .image-crop-overlay {
    padding: 10px;
  }

  .image-crop-dialog {
    max-height: calc(100vh - 20px);
    gap: 10px;
    padding: 18px;
    border-radius: 22px;
  }

  .image-crop-header h2 {
    font-size: 22px;
  }

  .image-crop-stage {
    min-height: 300px;
    height: min(51vh, 470px);
    border-radius: 15px;
  }
}

@media (max-width: 440px) {
  .image-crop-dialog {
    grid-template-rows: auto auto auto minmax(220px, 1fr) auto auto;
    padding: 15px;
  }

  .image-crop-help {
    font-size: 10px;
  }

  .image-crop-stage {
    min-height: 240px;
    height: min(42vh, 360px);
  }

  .image-crop-gesture-hint {
    max-width: 135px;
    line-height: 1.45;
  }

  .image-crop-actions button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-crop-overlay *,
  .image-crop-overlay *::before,
  .image-crop-overlay *::after {
    transition-duration: 0.01ms !important;
  }
}
