body {
  display: flex;
  /*justify-content: center;*/
  align-items: center;
  height: 100vh;
  margin: 0;
  background-color: #ffffff;
  perspective: 1000px;
  flex-direction: column;
  gap: 30px;
}

.controls {
  display: flex;
  gap: 15px;
  align-items: center;
  background: white;
  padding: 15px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

#diceContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  max-width: 800px;
  padding: 20px;
}

.scene {
  width: 120px;
  height: 120px;
  position: relative;
  perspective: 600px;
}

.cube {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  transform: rotateX(-30deg) rotateY(-45deg);
  transition: transform 3s ease-out;
}

/* Create a solid core to fill gaps from rounded corners */
.cube::before,
.cube::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
}

.cube::before {
  transform: rotateY(90deg);
}

.cube::after {
  transform: rotateX(90deg);
}

.face {
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  background: #fff;
  border: 2px solid #000;
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  font-weight: bold;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1);
  padding: 10px;
  box-sizing: border-box;
}

.dot {
  width: 24px;
  height: 24px;
  background-color: #333;
  border-radius: 50%;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.3);
}

/* Face Layouts */
.face {
  display: flex;
  justify-content: center;
  align-items: center;
}

.front {
  /* 1 */
  /* Default center */
}

.right {
  /* 2 */
  justify-content: space-between;
}

.right .dot:nth-child(1) {
  align-self: flex-start;
}

.right .dot:nth-child(2) {
  align-self: flex-end;
}

.top {
  /* 3 */
  justify-content: space-between;
}

.top .dot:nth-child(1) {
  align-self: flex-start;
}

.top .dot:nth-child(2) {
  align-self: center;
}

.top .dot:nth-child(3) {
  align-self: flex-end;
}

.bottom {
  /* 4 */
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  justify-items: center;
  align-items: center;
}

.bottom .dot {
  margin: 0;
}

.left {
  /* 5 */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  justify-items: center;
  align-items: center;
}

.left .dot:nth-child(1) {
  grid-area: 1 / 1;
}

.left .dot:nth-child(2) {
  grid-area: 1 / 3;
}

.left .dot:nth-child(3) {
  grid-area: 2 / 2;
}

.left .dot:nth-child(4) {
  grid-area: 3 / 1;
}

.left .dot:nth-child(5) {
  grid-area: 3 / 3;
}

.back {
  /* 6 */
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  justify-items: center;
  align-items: center;
  grid-auto-flow: column;
  /* Fill columns first to get 2 cols of 3 */
}

.back .dot {
  margin: 0;
}

.front {
  transform: rotateY(0deg) translateZ(60px);
}

.back {
  transform: rotateY(180deg) translateZ(60px);
}

.right {
  transform: rotateY(90deg) translateZ(60px);
}

.left {
  transform: rotateY(-90deg) translateZ(60px);
}

.top {
  transform: rotateX(90deg) translateZ(60px);
}

.bottom {
  transform: rotateX(-90deg) translateZ(60px);
}

@keyframes rotate {
  from {
    transform: rotateX(0deg) rotateY(0deg);
  }

  to {
    transform: rotateX(360deg) rotateY(360deg);
  }
}

select {
  padding: 8px 16px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#rollBtn {
  padding: 12px 24px;
  font-size: 1.2rem;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#rollBtn:hover {
  background-color: #555;
}

#rollBtn:active {
  transform: scale(0.98);
}

@media (max-width: 600px) {
  .scene {
    width: 80px;
    height: 80px;
  }

  .face {
    width: 80px;
    height: 80px;
    border-radius: 12px;
  }

  .dot {
    width: 16px;
    height: 16px;
  }

  .front {
    transform: rotateY(0deg) translateZ(40px);
  }

  .back {
    transform: rotateY(180deg) translateZ(40px);
  }

  .right {
    transform: rotateY(90deg) translateZ(40px);
  }

  .left {
    transform: rotateY(-90deg) translateZ(40px);
  }

  .top {
    transform: rotateX(90deg) translateZ(40px);
  }

  .bottom {
    transform: rotateX(-90deg) translateZ(40px);
  }

  #diceContainer {
    gap: 20px;
  }

  .controls {
    padding: 10px 20px;
    gap: 10px;
  }
}