.box {
  width: 8rem;
  margin-bottom: 1rem;
  border: 1px dashed gray;
}

.cards {
  display: grid;
}

.cards div {
  padding: 0.5rem;
  color: white;
  background-color: teal;
}

.plain {
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
}

.safe {
  grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr));
}