body {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #f0f0f0;
  font-family: Arial, sans-serif;
}

.toy {
  position: relative;
  width: 90vmin;
  margin: 5vmin auto;
  text-align: center; /* Center contents within the toy */
}

.ball {
  position: relative;
  border-radius: 50%;
  width: 90vmin;
  height: 90vmin;
  overflow: hidden;
  background: radial-gradient(circle at 30vmin 30vmin, #444, #000);
}

.answers, .labels, label {
  width: 90vmin;
  height: 90vmin;
}

.answer {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  left: 36vmin;
  top: 34.6vmin;
  width: 18vmin;
  height: 20.8vmin;
  color: white;
  text-align: center;
  font-variant: small-caps;
  font-size: 2.1vmin;
  line-height: 2.4vmin;
  opacity: 0;
  transition: opacity 1s;
  animation: floating 6s linear infinite;
}

.answer::before {
  content: "";
  z-index: -1;
  position: absolute;
  left: 0;
  border-left: 8.8vmin solid transparent;
  border-right: 8.8vmin solid transparent;
  border-radius: 0.4vmin;
  width: 0.4vmin;
  height: 0;
}

.answer.up::before {
  top: 0.4vmin;
  border-bottom: 15.2vmin solid #1c23e8;
}

.answer.down::before {
  bottom: 0.4vmin;
  border-top: 15.2vmin solid #1c23e8;
}

.answer::after {
  content: "";
  z-index: 1;
  position: absolute;
  left: -7vmin;
  top: -5vmin;
  border-radius: 50%;
  width: 32vmin;
  height: 32vmin;
  background: linear-gradient(to left, rgba(0,0,0,0.9), rgba(0,0,0,0));
  animation: rotating 6s infinite linear;
}

input {
  display: none;
}

input:checked + .answer {
  opacity: 1;
  transition: opacity 2s 1s;
}

form:active input:checked + .answer {
  opacity: 0;
  transition: opacity 1s;
}

.labels {
  position: absolute;
  top: 0;
  animation: random 1s steps(20) infinite;
}

form:active .labels {
  animation-play-state: paused;
}

label {
  display: block;
  cursor: pointer;
}

.window, .eight {
  position: absolute;
  left: 22.5vmin;
  top: 22.5vmin;
  width: 45vmin;
  height: 45vmin;
  border-radius: 50%;
}

.window {
  background: radial-gradient(#002, #001 18vmin, #666 18vmin, #000 18.5vmin, #000 22vmin, #666 22vmin, #000 22.5vmin);
}

.eight {
  background: #fff;
  font-size: 27vmin;
  text-align: center;
  line-height: 45vmin;
  transition: opacity 1s;
}

form:valid .eight {
  opacity: 0;
}

.instruction {
  z-index: -1;
  position: absolute;
  top: -10vmin;
  left: -10vmin;
  width: 110vmin;
  height: 110vmin;
  text-align: center;
  font-family: fantasy;
  font-size: 3vmin;
  line-height: 4.2vmin;
  opacity: 0;
}

.instruction:nth-of-type(1) {
  transform: rotate(-45deg);
  animation: instruction 1s both;
}

.instruction:nth-of-type(2) {
  transform: rotate(45deg);
  animation: instruction 1s 1s both;
}

.instruction:nth-of-type(3) {
  transform: rotate(-45deg) translateY(102vmin);
  animation: instruction 1s 2s both;
}

.instruction:nth-of-type(4) {
  transform: rotate(45deg) translateY(102vmin);
  animation: instruction 1s 3s both;
}

form:valid ~ .instruction {
  display: none;
}

.restart-button {
  margin-top: 20px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #2a2b4d, #1a1a3d);
  color: #e0e0ff;
  border: none;
  border-radius: 12px;
  font-size: 1.5vmin;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.2) inset;
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.restart-button::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 70%);
  transform: translateX(-50%) translateY(-50%) rotate(45deg);
  transition: opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}

.restart-button:hover::before {
  opacity: 1;
}

.restart-button:hover {
  background: linear-gradient(135deg, #3c3d5e, #2a2a4e);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 255, 255, 0.3) inset;
  transform: scale(1.05);
}

.restart-button:active {
  transform: scale(0.95);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6), 0 0 5px rgba(255, 255, 255, 0.2) inset;
}

@keyframes random {
  to {
    transform: translateY(-1710vmin);
  }
}

@keyframes floating {
  from {
    transform: rotateZ(0) rotateY(15deg) translateZ(6.8vmin) rotateZ(0);
  }
  to {
    transform: rotateZ(1turn) rotateY(15deg) translateZ(6.8vmin) rotateZ(-1turn);
  }
}

@keyframes rotating {
  to {
    transform: rotate(1turn);
  }
}

@keyframes instruction {
  to {
    opacity: 1;
  }
}
