@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.header {
  height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-medium);
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.3s ease-out;
  position: relative;
  z-index: 100;
}

.title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.backButton,
.confirmButton {
  padding: var(--spacing-small) var(--spacing-medium);
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
  border-radius: var(--border-radius);
}

.backButton {
  font-size: 1.5rem;
  padding: var(--spacing-small);
}

.confirmButton {
  color: var(--color-primary);
  font-weight: 600;
}

.cropContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-medium);
  position: relative;
}

.viewportContainer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.viewport {
  width: min(90vw, 90vh);
  height: min(90vw, 90vh);
  position: relative;
  border-radius: var(--border-radius);
  background: transparent;
  overflow: visible;
  z-index: 1;
}

.imageWrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  will-change: transform;
  transition: transform 0.1s ease-out;
  touch-action: none;
  cursor: move;
  transform-origin: 0 0;
  z-index: 1;
}

.image {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transform-origin: 0 0;
}

.frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
  border-radius: var(--border-radius);
  z-index: 2;
}

/* Направляющие */
.frameCross {
  position: absolute;
  inset: 2px;
  pointer-events: none;
  z-index: 3;
}

.frameCross::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-0.5px);
}

.frameCross::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-0.5px);
}

.controls {
  width: min(90vw, 90vh);
  padding: var(--spacing-medium);
  background: var(--color-surface);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-small);
  animation: slideUp 0.3s ease-out;
  position: relative;
  z-index: 100;
  margin-top: var(--spacing-medium);
}

.zoomSlider {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  outline: none;
}

.zoomSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.hint {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}
