* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dropzone {
  width: 100%;
  max-width: 800px;
  height: 500px;
  margin: 0 auto;
  border: 3px dashed #cbd5e0;
  border-radius: 12px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.dropzone:hover {
  border-color: #4A90E2;
  background: #f7fafc;
}

.dropzone.dragover {
  border-color: #4A90E2;
  background: #ebf8ff;
  border-style: solid;
  transform: scale(1.02);
  box-shadow: 0 10px 30px rgba(74, 144, 226, 0.2);
}

.empty-state {
  text-align: center;
  pointer-events: none;
}

.canvas-active {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: transform 0.2s ease;
}

.canvas-active:hover {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.canvas-active.exporting {
  pointer-events: none;
}

.image-grid {
  display: grid;
  aspect-ratio: 1;
  padding: 0;
  position: relative;
}

.image-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: move;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #f0f0f0;
}

.image-tile:hover {
  z-index: 10;
}

.image-tile.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.image-tile img {
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: #E74C3C;
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 20;
}

.image-tile:hover .remove-btn {
  opacity: 1;
}

.remove-btn:hover {
  background: #c0392b;
  transform: scale(1.1);
}

.empty-slot {
  aspect-ratio: 1;
  background: repeating-linear-gradient(
    45deg,
    #f9f9f9,
    #f9f9f9 10px,
    #f0f0f0 10px,
    #f0f0f0 20px
  );
  opacity: 0.5;
}

.download-btn {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
  opacity: 0.9;
}

.download-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.export-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 144, 226, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

.celebration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
}

.confetti {
  position: absolute;
  top: -50px;
  animation: fall 3s linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .dropzone {
    height: 400px;
    max-width: 95vw;
  }

  .canvas-active {
    max-width: 95vw;
  }

  h1 {
    font-size: 1.75rem !important;
  }

  .remove-btn {
    opacity: 1;
    width: 32px;
    height: 32px;
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .dropzone {
    height: 300px;
  }

  h1 {
    font-size: 1.5rem !important;
  }
}