body {
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  gap: 30px;
  margin: 0;
  font-family: "Roboto Mono", monospace;
}

/* Title */
.title {
  color: #ffffff;
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Scene */
.scene {
  perspective: 900px;
}

/* Ball */
.eight-ball {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;

  background: radial-gradient(circle at 30% 30%, #444 0%, #111 40%, #000 75%);

  box-shadow:
    inset -30px -40px 60px rgba(0, 0, 0, 0.9),
    inset 20px 20px 40px rgba(255, 255, 255, 0.08),
    0 20px 40px rgba(0, 0, 0, 0.8);

  overflow: hidden;
}

/* Shared window */
.window {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scaleX(1);
  transition: all 0.8s ease;
}

/* White 8 */
.white {
  background: radial-gradient(circle at 50% 40%, #fff, #ddd 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Dark side */
.dark {
  background: radial-gradient(circle at 50% 40%, #111, #000 80%);
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.9);
  z-index: 1;

  transform: translate(-200%, -50%) scaleX(0.3);
  opacity: 0.6;
}

/* Number */
.answer {
  color: #000;
  font-size: 64px;
  font-weight: 900;
}

/* Animate rotation illusion */
.eight-ball.animate .white {
  transform: translate(120%, -50%) scaleX(0.3);
  opacity: 0.6;
}

.eight-ball.animate .dark {
  transform: translate(-50%, -50%) scaleX(1);
  opacity: 1;
}

/* Shake */
.eight-ball.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-5px, 3px);
  }
  50% {
    transform: translate(5px, -3px);
  }
  75% {
    transform: translate(-3px, 2px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* Triangle */
.triangle {
  position: absolute;
  width: 120px;
  height: 100px;
  margin: 2px 0 0 7px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: radial-gradient(circle at 50% 30%, #3aa0ff, #001a4d);

  display: flex;

  align-items: flex-end; /* push content to bottom */
  justify-content: center; /* keep horizontally centered */

  padding: 10px 12px 14px; /* a little bottom breathing room */
  box-sizing: border-box;

  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 1.2s ease,
    transform 1.2s ease;
}

/* Show triangle */
.eight-ball.animate .triangle {
  opacity: 1;
  transform: scale(1);
  transition-delay: 0.5s;
}

/* Fortune text */
#fortune {
  color: #fff;
  font-size: 13px;
  text-align: center;
  line-height: 1.2;
  font-family: Arial, sans-serif;
  white-space: pre-line;

  max-width: 85%;
  padding: 0 10px;
  word-wrap: break-word;
  overflow-wrap: break-word;

  /* Center better vertically */
  display: flex;
  align-items: center;
  justify-content: center;

  text-shadow:
    0 0 2px rgba(180, 120, 255, 0.8),
    0 0 6px rgba(140, 80, 255, 0.6),
    0 0 12px rgba(120, 60, 255, 0.4);
}

.eight-ball.animate #fortune {
  opacity: 1;
  transition-delay: 0.9s;
}
