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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column; /* Allow footer to sit at bottom if needed */
  justify-content: center;
  align-items: center;
}

.container {
  text-align: center;
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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%;
  transition: background-color 0.2s ease;
  -webkit-touch-callout: none; /* Disable iOS long-press menu */
  user-select: none; /* Disable text/image selection */
  -webkit-tap-highlight-color: transparent; /* Removes default tap highlight */
}

.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%;
  left: 51.11%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  color: #ccc;
  z-index: 10;
  user-select: none;
  pointer-events: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Covers exactly the hollow center (circle at 184,133 r=118 in the 360px SVG),
   in percentages so it stays aligned when the drop zone shrinks on mobile */
.drag-overlay {
  position: absolute;
  top: 4.17%;     /* (133 - 118) / 360 */
  left: 18.33%;   /* (184 - 118) / 360 */
  width: 65.56%;  /* 236 / 360 */
  height: 65.56%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  transition: background 0.2s ease;
  background: transparent;
}

/* Only show overlay on actual drag hover, NOT on click/active by default */
.drop-zone.drag-over .drag-overlay {
  background: rgba(204, 204, 204, 0.8);
}

/* Desktop-only click feedback */
@media (hover: hover) {
  .drop-zone:active .drag-overlay {
    background: rgba(204, 204, 204, 0.8);
  }
  
  .drop-zone:active {
    background: none;
    outline: none;
  }
  
  .drop-zone:active .drop-indicator {
    color: #fff !important;
  }
}

.drop-zone.drag-over {
  background: none;
  outline: none;
}

.drop-zone.drag-over .drop-indicator {
  color: #fff !important;
}

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

.drop-zone:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 4px;
}

.error-message {
  color: #b00020;
  font-family: 'Zalando Sans', sans-serif;
  margin-bottom: 1rem;
}

@media (max-width: 400px) {
  .drop-zone {
    width: 300px;
    height: 300px;
  }
  
  h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  
  .container {
    padding: 1rem;
  }
}

/* Footer */
footer {
  padding: 1rem;
  font-family: 'Zalando Sans', sans-serif;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
}

footer a {
  color: #333;
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}

.privacy-note {
  font-size: 0.75rem;
  color: #888;
  max-width: 360px;
  margin: 0.5rem auto 0;
}

.privacy-toggle {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.privacy-toggle:hover {
  text-decoration: underline;
}

.privacy-text {
  margin-top: 0.25rem;
  visibility: hidden;
}

.privacy-note.open .privacy-text {
  visibility: visible;
}

/* 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;
}

/* Never wider than the modal can fit (90vw minus 1.5rem padding each side) */
.crop-container {
  width: min(320px, calc(90vw - 3rem));
  height: min(320px, calc(90vw - 3rem));
  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-btn {
  background: none;
  border: none;
  color: #999;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  user-select: none;
}

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

#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: min(250px, calc(90vw - 3rem));
    height: min(250px, calc(90vw - 3rem));
  }
}