*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --base-size: 75;
  --big-factor: 2;
  --container-w: 1920; /* no units so we can do division */
  --container-h: 1080;
  --logo-w: 75;
  --logo-h: 75;
  --name-h: 20;
  --target-opacity: 1;
}

body {
  font-size: 12px;
  margin: 0;
  overflow: clip;
}

.viewport {
  height: 100vh;
  width: 100vw;
}

#bouncers {
  height: 100%;
  text-shadow: 0 0.5px black;
  width: 100%;
}

.bouncer {
  --bouncer-size: var(--base-size);
  --name-background: rgba(0,0,0,0.5);
  --name-padding: 5px;
  --speed: 90; /* pixels per second */
  --duration-x: calc(
      (var(--container-w) - var(--logo-w)) / var(--speed) * 1s
  );
  --duration-y: calc(
      (var(--container-h) - var(--logo-h)) / var(--speed) * 1s
  );
  --delay: 0s;
  align-items: center;
  animation: y var(--duration-y) linear infinite alternate, colorX calc(var(--duration-x) * 5) step-start infinite, colorY calc(var(--duration-y) * 5) step-start infinite;
  animation-delay: var(--delay);
  color: #fff;
  display: flex;
  flex-direction: column;
  font-family: arial;
  font-size: calc(var(--base-size) / 75 * 12px);
  height: calc(var(--logo-h) * 1px);
  left: 0;
  opacity: 0;
  position: absolute;
  text-align: center;
  transition: opacity 0.5s;
  top: 0;
  width: calc(var(--logo-w) * 1px);
  will-change: transform, filter;
}
.bouncer.ready {
  opacity: var(--target-opacity);
}
.bouncer.is-streamer .bouncer__inner::after {
  background-image: url(/img/streamer-badge.png);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  content: "";
  display: block;
  height: 24px;
  left: 0;
  position: absolute;
  transform: translate3d(-25%, -25%, 0);
  top: 0;
  width: 24px;
}
.bouncer.is-guest:not(.is-streamer) .bouncer__guest-host {
  display: block;
}
.bouncer.powerup-bigmode {
  --logo-h: calc(var(--base-size) * var(--big-factor));
  --logo-w: calc(var(--base-size) * var(--big-factor));
  --name-h: 36;
  --name-padding: 8px;
  --bouncer-size: calc(var(--base-size) * var(--big-factor));
  font-size: calc(var(--big-factor) * 1em);
  animation: x var(--duration-x) linear infinite alternate, y var(--duration-y) linear infinite alternate, colorX calc(var(--duration-x) * 5) step-start infinite, colorY calc(var(--duration-y) * 5) step-start infinite;
  animation-delay: var(--delay);
}
.bouncer.powerup-stealthmode {
  --target-opacity: 0.5;
}
.bouncer.powerup-spinmove .bouncer__inner {
  animation: spin-move 10s forwards linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}
.bouncer.powerup-rainbow {
  color: hotpink;
  filter: hue-rotate(calc(14.4 * (var(--color-y) * 5 + var(--color-x)) * 1deg)) brightness(110%) saturate(150%);
}
.bouncer.powerup-fastmode {
  --speed: 300;
  --fast-speed: calc(var(--speed) * 2.5);
  --duration-x: calc(
      (var(--container-w) - var(--logo-w)) / var(--fast-speed) * 1s
  );
  --duration-y: calc(
      (var(--container-h) - var(--logo-h)) / var(--fast-speed) * 1s
  );
}
.bouncer__x-movement {
  animation: x var(--duration-x) linear infinite alternate;
  animation-delay: var(--delay);
  will-change: transform;
}
.bouncer__inner {
  align-items: center;
  display: flex;
  flex-direction: column;
}
.bouncer__image {
  filter: drop-shadow(2px 4px 6px black);
  height: calc(var(--bouncer-size) * 1px);
  width: calc(var(--bouncer-size) * 1px);
}
.bouncer__name {
  background-color: var(--name-background);
  height: calc(var(--name-h) * 1px);
  line-height: calc(var(--name-h) * 1px);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(var(--bouncer-size) * 1.3px);
  padding-inline: var(--name-padding);
  width: -moz-min-content;
  width: min-content;
  will-change: transform;
}
.bouncer__guest-host {
  filter: drop-shadow(0px 0px 3px rgba(0, 0, 0, 0.5));
  display: none;
  right: 0;
  top: 0;
  transform: translate3d(25%, -25%, 0);
  position: absolute;
  width: 25%;
}

@keyframes spin-move {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 360deg;
  }
}
@keyframes x {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(calc(var(--container-w) * 1px - var(--logo-w) * 1px), 0, 0);
  }
}
@keyframes y {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, calc(var(--container-h) * 1px - (var(--logo-h) * 1px + var(--name-h) * 1px)), 0);
  }
}
@keyframes colorX {
  from {
    --color--x: 0;
  }
  20% {
    --color-x: 2;
  }
  40% {
    --color-x: 4;
  }
  60% {
    --color-x: 1;
  }
  80% {
    --color-x: 3;
  }
  to {
    --color-x: 0;
  }
}
@keyframes colorY {
  from {
    --color-y: 0;
  }
  20% {
    --color-y: 2;
  }
  40% {
    --color-y: 4;
  }
  60% {
    --color-y: 1;
  }
  80% {
    --color-y: 3;
  }
  to {
    --color-y: 0;
  }
}