.container {
  position: relative;
  overflow: hidden;
}

.grid {
  display: grid;
  width: 100%;
  height: 100%;
}

.tile {
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  transition: transform 0.3s ease;
}

.tile:hover {
  z-index: 10;
  transform: scale(1.05);
}

.tileContent {
  position: absolute;
  inset: 0;
  background: var(--tile-color, #1a1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tile:hover .tileContent {
  background: var(--tile-hover-color, #ff0040);
  transform: scale(1.02);
}

.tile.revealed .tileContent {
  opacity: 1;
  transform: scale(1);
}

.tile.hidden .tileContent {
  opacity: 0;
  transform: scale(0);
}

.tile .tileContent::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tile:hover .tileContent::before {
  opacity: 1;
}

/* Pattern variants */
.pattern-checkered .tile:nth-child(odd) .tileContent {
  background: var(--tile-color-1, #1a1a1a);
}

.pattern-checkered .tile:nth-child(even) .tileContent {
  background: var(--tile-color-2, #2a2a2a);
}

.pattern-random .tile .tileContent {
  background: var(--tile-random-color, #1a1a1a);
}

.pattern-gradient .tile .tileContent {
  background: linear-gradient(
    var(--gradient-angle, 135deg),
    var(--gradient-start, #1a1a1a) 0%,
    var(--gradient-end, #2a2a2a) 100%
  );
}

/* Tile size variants */
.grid.size-xs {
  grid-template-columns: repeat(var(--columns, 12), 1fr);
  grid-template-rows: repeat(var(--rows, 8), 1fr);
}

.grid.size-sm {
  grid-template-columns: repeat(var(--columns, 8), 1fr);
  grid-template-rows: repeat(var(--rows, 6), 1fr);
}

.grid.size-md {
  grid-template-columns: repeat(var(--columns, 6), 1fr);
  grid-template-rows: repeat(var(--rows, 4), 1fr);
}

.grid.size-lg {
  grid-template-columns: repeat(var(--columns, 4), 1fr);
  grid-template-rows: repeat(var(--rows, 3), 1fr);
}

.grid.size-xl {
  grid-template-columns: repeat(var(--columns, 3), 1fr);
  grid-template-rows: repeat(var(--rows, 2), 1fr);
}

/* Gap variants */
.grid.no-gap {
  gap: 0;
}

.grid.small-gap {
  gap: 1px;
}

.grid.medium-gap {
  gap: 4px;
}

.grid.large-gap {
  gap: 8px;
}

/* Shape variants */
.tile.shape-square .tileContent {
  border-radius: 0;
}

.tile.shape-rounded .tileContent {
  border-radius: 4px;
}

.tile.shape-circle .tileContent {
  border-radius: 50%;
}

/* Animation on reveal */
@keyframes tile-reveal {
  from {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.tile.animating .tileContent {
  animation: tile-reveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Stagger animation delays */
.tile:nth-child(4n+1) { animation-delay: 0ms; }
.tile:nth-child(4n+2) { animation-delay: 50ms; }
.tile:nth-child(4n+3) { animation-delay: 100ms; }
.tile:nth-child(4n+4) { animation-delay: 150ms; }

/* Glitch effect on hover */
.tile.glitch:hover .tileContent {
  animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

/* Pulse effect */
.tile.pulse:hover .tileContent {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}
