/* ===== Number Shapes — Gallery Layout ===== */

.shapes-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 800px;
  padding: 10px 0;
}

.shape-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px 16px;
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-round);
  box-shadow: 0 4px 12px var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 180px;
}

.shape-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.shape-card:active {
  transform: scale(0.96);
}

.shape-card-block {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 110px;
  max-height: 130px;
  max-width: 100%;
  overflow: hidden;
  transition: opacity 0.15s ease;
}

.shape-card-block.morphing {
  animation: shape-morph 0.35s ease;
}

@keyframes shape-morph {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(0.7) rotate(8deg); opacity: 0.4; }
  70% { transform: scale(1.1) rotate(-3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.shape-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  min-height: 24px;
}

.shape-card-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.shape-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
  transition: background 0.3s ease, transform 0.3s ease;
}

.shape-dot--found {
  background: var(--star-color);
  transform: scale(1.2);
}

.shape-dot--current {
  background: var(--btn-primary);
  transform: scale(1.4);
  box-shadow: 0 0 6px rgba(30, 136, 229, 0.4);
}

.discovery-counter {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  opacity: 0.7;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .shapes-gallery {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
  }

  .shape-card {
    padding: 14px 8px 12px;
    min-height: 150px;
  }

  .shape-card-block {
    min-height: 80px;
    --block-size-sm: 28px;
  }

  .shape-card-name {
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .shapes-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
