:root {
  --color1: #000;
  --color2: #fff;
  --box-size: 1vw; /* smaller size */
}

body {
  margin: 0;
  background: #111;
  overflow: hidden;
}

.container {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--box-size));
  grid-template-rows: repeat(auto-fill, var(--box-size));
  width: 100vw;
  height: 100vh;
}

.box {
  width: var(--box-size);
  height: var(--box-size);
  background-color: var(--color1);
  animation: jitter 0.4s infinite alternate;
  animation-delay: var(--delay);
}

@keyframes jitter {
  from {
    transform: scale(1) translate(0px, 0px);
    background-color: var(--color1);
  }
  to {
    transform: scale(1.2) translate(calc(10px * var(--randX)), calc(10px * var(--randY)));
    background-color: var(--color2);
  }
}
