/* The score is on by default, but a browser will not start an AudioContext
   without a gesture. The small control starts it on the first interaction and
   remains as the remembered mute switch. */
.score-toggle {
  position: absolute;
  top: clamp(16px, 2.8vw, 28px);
  right: clamp(16px, 2.8vw, 30px);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(170, 246, 255, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 48%),
    rgba(4, 16, 22, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(226, 253, 255, 0.12),
    0 12px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  color: rgba(192, 242, 250, 0.7);
  font: inherit;
  cursor: pointer;
  transition:
    color 220ms ease,
    border-color 220ms ease,
    background 220ms ease,
    opacity 220ms ease;
}

.score-toggle[hidden] {
  display: none;
}

.score-toggle:hover,
.score-toggle:focus-visible {
  color: rgba(238, 255, 255, 0.95);
  border-color: rgba(170, 246, 255, 0.4);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0) 48%),
    rgba(8, 30, 39, 0.6);
  outline: none;
}

.score-toggle:focus-visible {
  outline: 1px solid rgba(127, 232, 255, 0.5);
  outline-offset: 3px;
}

.score-toggle.is-on {
  color: rgba(236, 255, 255, 0.95);
  border-color: rgba(170, 246, 255, 0.34);
}

.score-toggle.is-waiting {
  color: rgba(242, 255, 255, 0.98);
  border-color: rgba(170, 246, 255, 0.55);
  animation: score-call 2.4s ease-in-out infinite;
}

@keyframes score-call {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(226, 253, 255, 0.12),
      0 12px 30px rgba(0, 0, 0, 0.24),
      0 0 0 rgba(127, 232, 255, 0);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(226, 253, 255, 0.2),
      0 12px 30px rgba(0, 0, 0, 0.24),
      0 0 26px rgba(127, 232, 255, 0.32);
  }
}

.score-toggle:disabled {
  cursor: default;
  opacity: 0.42;
}

.score-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 15px;
  height: 12px;
}

.score-bars i {
  --h: 0.45;
  display: block;
  flex: 1 1 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(180deg, #e5ffff, #67d8ef 62%, #2b98ad);
  box-shadow: 0 0 7px rgba(127, 232, 255, 0.4);
  transform: scaleY(calc(var(--h) * 0.55));
  transform-origin: 50% 100%;
  opacity: 0.55;
}

.score-bars i:nth-child(1) {
  --h: 0.32;
  animation-delay: -0.9s;
}

.score-bars i:nth-child(2) {
  --h: 0.58;
  animation-delay: -0.62s;
}

.score-bars i:nth-child(3) {
  --h: 0.42;
  animation-delay: -0.35s;
}

.score-bars i:nth-child(4) {
  --h: 0.78;
  animation-delay: -0.77s;
}

.score-bars i:nth-child(5) {
  --h: 0.5;
  animation-delay: -0.14s;
}

.score-toggle.is-on .score-bars i {
  opacity: 1;
  animation: score-bar 1.25s ease-in-out infinite;
}

@keyframes score-bar {
  0%,
  100% {
    transform: scaleY(calc(var(--h) * 0.62));
  }
  50% {
    transform: scaleY(1);
  }
}

.score-wait {
  position: absolute;
  left: clamp(16px, 3vw, 32px);
  top: clamp(16px, 2.8vw, 28px);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid rgba(170, 246, 255, 0.14);
  border-radius: 999px;
  background: rgba(4, 16, 22, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(226, 253, 255, 0.08),
    0 10px 26px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  color: rgba(196, 242, 250, 0.68);
  font: inherit;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.score-wait[hidden] {
  display: none;
}

.score-wait.is-visible {
  opacity: 1;
  transform: none;
}

.score-wait i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9cecff;
  box-shadow: 0 0 0 0 rgba(127, 232, 255, 0.42);
  animation: score-wait-pulse 2.1s ease-out infinite;
}

@keyframes score-wait-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(127, 232, 255, 0.4);
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px rgba(127, 232, 255, 0);
  }
}

.score-label {
  font-size: 8.5px;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .score-toggle {
    top: 12px;
    right: 12px;
    min-height: 34px;
    gap: 8px;
    padding: 8px 11px;
  }

  .score-label {
    font-size: 8px;
    letter-spacing: 0.16em;
  }

  .score-wait {
    left: 12px;
    top: 54px;
    gap: 7px;
    padding: 7px 10px;
    font-size: 7px;
    letter-spacing: 0.14em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .score-toggle.is-on .score-bars i {
    animation: none;
    transform: scaleY(calc(var(--h) * 0.8));
  }

  .score-toggle.is-waiting {
    animation: none;
  }

  .score-wait i {
    animation: none;
  }
}
