* { box-sizing: border-box; margin: 0; }

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #1d1b2e, #08070d 70%);
  color: #e8e6f0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 24px;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

h1 { font-size: 1.8rem; letter-spacing: 0.04em; }
.hint { color: #9a97ad; font-size: 0.95rem; }

.ball {
  width: min(320px, 78vw);
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 12px 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.35), rgba(255,255,255,0) 22%),
    radial-gradient(circle at 50% 50%, #2a2a2e, #050505 72%);
  box-shadow:
    inset -18px -24px 50px rgba(0,0,0,0.9),
    0 30px 60px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.04);
}

.window {
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #ffffff, #dcdce4 80%);
  box-shadow: inset 0 4px 14px rgba(0,0,0,0.45);
  overflow: hidden;
}

.triangle {
  width: 92%;
  height: 92%;
  display: grid;
  place-items: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.answer {
  color: #111;
  font-weight: 700;
  font-size: clamp(0.72rem, 3.4vw, 0.95rem);
  line-height: 1.2;
  padding: 0 10%;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.answer.eight {
  font-size: clamp(2.6rem, 14vw, 4rem);
  text-transform: none;
}

.triangle.hidden { opacity: 0; transform: scale(0.6) rotate(-12deg); }

.ball.shaking { animation: shake 0.9s cubic-bezier(.36,.07,.19,.97); }

@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  10% { transform: translate(-14px, -6px) rotate(-8deg); }
  20% { transform: translate(14px, 6px) rotate(8deg); }
  30% { transform: translate(-12px, 8px) rotate(-6deg); }
  40% { transform: translate(12px, -8px) rotate(6deg); }
  50% { transform: translate(-10px, 4px) rotate(-5deg); }
  60% { transform: translate(10px, -4px) rotate(5deg); }
  70% { transform: translate(-6px, 2px) rotate(-3deg); }
  80% { transform: translate(6px, -2px) rotate(3deg); }
  90% { transform: translate(-2px, 1px) rotate(-1deg); }
}

button {
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 12px 30px;
  border-radius: 999px;
  border: 1px solid #4b4870;
  background: linear-gradient(180deg, #3a3766, #24223f);
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.2s ease;
}
button:hover { filter: brightness(1.15); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible { outline: 2px solid #8f8be0; outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  .ball.shaking { animation: none; }
  .triangle { transition: none; }
}
