:root {
  color-scheme: dark;
  background: #090909;
  font-family: system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }

html, body, #surface {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: #090909;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#surface {
  position: fixed;
  inset: 0;
  background: #090909;
  cursor: pointer;
  transition: background-color 180ms ease;
}

#players { position: absolute; inset: 0; pointer-events: none; }

.player {
  --size: clamp(112px, 25vw, 164px);
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  width: var(--size);
  height: var(--size);
  translate: -50% -50%;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--color) calc(var(--progress) * 1turn), color-mix(in srgb, var(--color), #000 38%) 0);
  animation: appear 140ms ease-out both;
}

.player::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: inherit;
  background: #090909;
}

.player::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: inherit;
  background: var(--color);
}

#surface.chosen { background: #e9e9e9; }
#surface.chosen .player { display: none; }
#surface.chosen .player.winner {
  --size: clamp(230px, 52vw, 360px);
  display: block;
  background: #050505;
  animation: winner 320ms cubic-bezier(.2,.9,.2,1) both;
}
#surface.chosen .player.winner::before { inset: 29%; background: #fff; }
#surface.chosen .player.winner::after { inset: 38%; background: #e9e9e9; }

#toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 4;
  max-width: calc(100% - 40px);
  translate: -50% 16px;
  padding: 10px 14px;
  border-radius: 99px;
  background: #fff;
  color: #111;
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
#toast.show { opacity: 1; translate: -50% 0; }

@keyframes appear { from { scale: .75; opacity: 0; } }
@keyframes winner { from { scale: .72; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
