.eight-ball-wrapper {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #555, #000);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  user-select: none;
  overflow: hidden;
  touch-action: none;
}
.eight-ball-wrapper:active {
  cursor: grabbing;
}
.eight-ball-inner {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eight-ball-number-bg {
  position: absolute;
  width: 50%;
  height: 50%;
  background-color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.3s ease,
    opacity 0.8s ease;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}
/* Slight yellowish tint */
.eight-ball-number-bg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 200, 0.2) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.eight-ball-number {
  font-family: sans-serif;
  font-size: 60px;
  font-weight: bold;
  color: black;
}

.eight-ball-answer {
  position: absolute;
  width: 60%;
  height: 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #4a4f99f0; /* Blue-ish fluid text look - Updated by user */
  font-family: sans-serif;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 2s ease-in;
  /* Triangle shape for typical 8ball answer fluid */
  background: radial-gradient(triangle at center, #000044, #000022);
  /* Since implementing a real triangle fluid floating in blue liquid is hard, 
     we will just use text. Or maybe a triangle container? */
}

.eight-ball-triangle {
  width: 0;
  height: 0;
  border-left: 65px solid transparent;
  border-right: 65px solid transparent;
  border-top: 110px solid #1a1a5a;
  position: absolute;
  display: flex;
  align-items: flex-start; /* Align to top to place text in the "top" border area */
  justify-content: center;
  opacity: 0;
  transition:
    opacity 3s ease-in,
    transform 0.4s ease; /* Faster dismissal to match incoming "8" */
  z-index: 20; /* Ensure on top */
  transform: translateX(150px); /* Default: hidden to right */
  margin-top: 18px; /* Visual correction to lower the center of gravity */
}
.eight-ball-answer-text {
  position: absolute;
  top: -95px; /* The content box is at the BOTTOM of the top border. So we need to go UP into the border. */
  width: 110px;
  font-size: 10px;
  line-height: 10px;
  text-align: center;
  color: #fff; /* Brighter text */
  text-shadow: 0 0 2px #000;
  pointer-events: none;
}

/* Animation states */
.eight-ball-wrapper.state-dragging .eight-ball-number-bg {
  transform: translateX(-150px) rotate(-180deg);
  opacity: 0;
}
.eight-ball-wrapper.state-dragging .eight-ball-triangle {
  /* While dragging, reset triangle to center instantly so it can fade in later */
  transform: translateX(0);
  transition: none;
  opacity: 0;
}

.eight-ball-wrapper.state-shaken .eight-ball-triangle {
  opacity: 0.8;
  transform: translateX(0);
}

.eight-ball-wrapper.state-answering .eight-ball-triangle {
  opacity: 1;
  transform: translateX(0);
  /* TODO There are too many transition properties around */
  transition: opacity 1.5s ease-in; /* Only animate opacity when appearing */
}
.eight-ball-wrapper.state-answering .eight-ball-number-bg {
  /* Hide number */
  opacity: 0;
  transform: translateX(-150px);
}
