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

/* General Styling */
body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  padding: 10px;
  overflow-x: hidden;
}

/* Grid Container */
.grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 10px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.grid div {
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  position: relative;
}

.grid div:active {
  cursor: grabbing;
}

/* Swap animation */
.grid div.swapping {
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover effect for interactivity on desktop */
@media (hover: hover) {
  .grid div:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 5px;
  }

  .grid {
    gap: 3px;
    padding: 8px;
    max-width: 500px;
  }
}

/* iPhone SE and small devices */
@media (max-width: 375px) {
  body {
    padding: 5px;
  }

  .grid {
    gap: 2px;
    padding: 5px;
    max-width: 100%;
    border-radius: 12px;
  }
}