body.knit-avatar-crop-open {
  overflow: hidden;
}

.knit-avatar-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.knit-avatar-crop-modal[hidden] {
  display: none !important;
}

.knit-avatar-crop-panel {
  width: min(92vw, 520px);
  max-height: min(92vh, 680px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.knit-avatar-crop-head {
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid #eee;
}

.knit-avatar-crop-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111;
}

.knit-avatar-crop-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #666;
  line-height: 1.45;
}

.knit-avatar-crop-body {
  flex: 1;
  min-height: 0;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
}

.knit-avatar-crop-viewport {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  overflow: hidden;
  background: #111;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
}

.knit-avatar-crop-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.knit-avatar-crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.knit-avatar-crop-shade {
  position: absolute;
  background: rgba(0, 0, 0, 0.48);
}

.knit-avatar-crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: move;
  touch-action: none;
}

.knit-avatar-crop-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: calc(100% / 3) calc(100% / 3);
  pointer-events: none;
}

.knit-avatar-crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #111;
  border-radius: 2px;
  box-sizing: border-box;
  touch-action: none;
}

.knit-avatar-crop-handle--nw {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.knit-avatar-crop-handle--ne {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.knit-avatar-crop-handle--sw {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.knit-avatar-crop-handle--se {
  bottom: -8px;
  right: -8px;
  cursor: nwse-resize;
}

.knit-avatar-crop-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  padding: 0.75rem 1rem 0.95rem;
  border-top: 1px solid #eee;
}

.knit-avatar-crop-btn {
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
}

.knit-avatar-crop-btn--ghost {
  color: #444;
  background: #fff;
  border: 1px solid #d1d5db;
}

.knit-avatar-crop-btn--primary {
  color: #fff;
  background: #111827;
  border: 1px solid #111827;
}

.knit-avatar-crop-btn--primary:disabled {
  opacity: 0.55;
  cursor: wait;
}
