* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  text-align: center;
  padding: 2rem;
}

h1 {
  font-family: 'Macondo', cursive;
  font-size: 3rem;
  font-weight: 400;
  color: #1a1a1a;
  margin-bottom: 2rem;
}

.hidden {
  display: none !important;
}

.stealie-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.drop-zone {
  position: relative;
  width: 360px;
  height: 360px;
  cursor: pointer;
  border-radius: 50%;
  /* Only affects interactions within the circle if needed, but useful for drag */
  /* Remove hover transform */
  transition: background-color 0.2s ease;
}

.stealie-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.user-image-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.drop-indicator {
  position: absolute;
  top: 36.94%;
  /* CENTER_Y (133/360) */
  left: 51.11%;
  /* CENTER_X (184/360) */
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  color: #ccc;
  z-index: 10;
  /* Ensure on top */
  user-select: none;
  pointer-events: none;
  /* Let clicks/drags pass through to drop-zone */
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/*
  Center-only drag feedback overlay.
  Sits on top of everything (z-index 5) but below indicator (z-index 10).
  Normally transparent, turns blue when drop-zone has drag-over.
*/
.drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  transition: background 0.2s ease;

  /* Default transparent */
  background: transparent;
}

.drop-zone.drag-over .drag-overlay,
.drop-zone:active .drag-overlay {
  /* Final requested color: Gray (matching original +) */
  background: radial-gradient(circle at 184px 133px,
      rgba(204, 204, 204, 0.8) 0%,
      rgba(204, 204, 204, 0.8) 118px,
      transparent 119px);
}

.drop-zone.drag-over,
.drop-zone:active {
  /* clear background on main element since overlay handles it */
  background: none;
  outline: none;
}

/* White plus when dragging over or active (pressed) */
.drop-zone.drag-over .drop-indicator,
.drop-zone:active .drop-indicator {
  color: #fff !important;
}

.drop-zone.has-image .drop-indicator {
  display: none;
}

@media (max-width: 400px) {
  .drop-zone {
    width: 300px;
    height: 300px;
  }
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  font-family: 'Zalando Sans', sans-serif;
}

.modal-title {
  font-family: 'Zalando Sans', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  margin: 0 0 1rem 0;
  text-align: center;
}

.crop-container {
  width: 320px;
  height: 320px;
  overflow: hidden;
  background: #e8e8e8;
  border-radius: 8px;
}

.crop-container img {
  max-width: 100%;
  display: block;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0 0.5rem;
}

.zoom-label {
  color: #999;
  font-size: 1.25rem;
  user-select: none;
}

#zoom-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  border-radius: 2px;
  cursor: pointer;
}

#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #333;
  border-radius: 50%;
  cursor: pointer;
}

#zoom-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #333;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Icon Buttons */
.btn-icon {
  background: #fff;
  color: #333;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-icon svg {
  width: 24px;
  height: 24px;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.btn-ghost {
  background: transparent;
  color: #666;
}

.btn-ghost:hover {
  color: #333;
}

/* Actions */
.actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  min-height: 50px; /* Reserve space to prevent layout jump */
}

.actions.hidden {
  visibility: hidden;
  display: flex !important; /* Override generic .hidden */
}

@media (max-width: 400px) {
  .actions {
    flex-direction: row;
    /* Keep row for icons */
    justify-content: space-evenly;
  }
}

/* Circular crop preview */
.cropper-view-box,
.cropper-face {
  border-radius: 50%;
}

/* Remove old hover styles */
.drop-zone:hover {
  transform: none;
}

/* Ensure modal is scrollable on small screens */
@media (max-height: 500px) {
  .modal-content {
    max-height: 95vh;
    overflow-y: auto;
  }

  .crop-container {
    width: 250px;
    height: 250px;
  }
}