body {
  background: black;
  color: white;
  padding-bottom: 5rem;
}

header {
  text-align: center;
}
header h1 {
  font-size: 2.5rem;
  letter-spacing: 4px;
}
header h2 {
  font-family: serif;
}

#box_grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  max-width: 1000px;
  margin: auto;
}
@media (min-width: 400px) {
  #box_grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 600px) {
  #box_grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 800px) {
  #box_grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* * ### 立方体 ### */
.cube_outer {
  position: relative;
  display: flex;
  justify-content: center;
  border: 1px solid #111;
}

.cube_outer a {
  color: white;
}
@keyframes hover-anim {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.1;
  }
  100% {
    opacity: 1;
  }
}
.cube_outer a:hover {
  animation: hover-anim 1s linear infinite;
}

.cube {
  margin: 5rem 0;
  width: 80px;
  height: 80px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0) rotateY(0); /* 初期角度 */
  animation: rotate-anim 5s linear infinite;
  cursor: pointer;
}

@keyframes rotate-anim {
  0% {
    transform: rotateX(0) rotateZ(0);
  }
  100% {
    transform: rotateX(-360deg) rotateZ(360deg);
    animation-timing-function: ease-out;
  }
}

.cube div {
  width: 100%;
  height: 100%;
  position: absolute;
}
.cube div {
  border: 1px solid #ddd7;
}

.cube div:nth-child(1) {
  background: #eaeaea66;
  transform: translateZ(40px);
}
.cube div:nth-child(2) {
  background: #f9f9f966;
  transform: rotateY(180deg) translateZ(40px);
}
.cube div:nth-child(3) {
  background: #f9f9f966;
  transform: rotateY(90deg) translateZ(40px);
}
.cube div:nth-child(4) {
  background: #eeeded66;
  transform: rotateY(-90deg) translateZ(40px);
}
.cube div:nth-child(5) {
  background: #eeeded66;
  transform: rotateX(90deg) translateZ(40px);
}
.cube div:nth-child(6) {
  background: #eaeaea66;
  transform: rotateX(-90deg) translateZ(40px);
}

.box_id {
  margin: 0;
  padding: 0.25rem;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 2px;
  font-style: italic;
}

/** OPENED **/
a {
  text-decoration: none;
}
.opened {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  margin: auto;
  text-align: center;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: bold;
  background-color: #3337;
  font-style: italic;
  letter-spacing: 2px;
}
