/* Decorative, fully local alternative when WebGL cannot render a capsule.
   These rules never resize, recolor, hide or animate the 3D canvases. */
.capsule-fallback {
  --cap-angle: 26deg;
  --cap-edge: #88612d;
  --cap-mid: #cba04f;
  --cap-shine: #f4d79b;
  --cap-shade: #977035;
  --cap-rim: #d0ad6b;
  --cap-glow: rgb(222 184 107 / 16%);
  width: 80px;
  height: 182px;
  border: 1px solid rgb(255 246 221 / 23%);
  border-radius: 999px;
  overflow: hidden;
  transform: translate(-50%, -50%) rotate(var(--cap-angle));
  background:
    radial-gradient(ellipse at 32% 10%, rgb(255 255 255 / 64%), transparent 24%),
    radial-gradient(ellipse at 65% 94%, rgb(255 255 255 / 17%), transparent 32%),
    linear-gradient(180deg, transparent 49.5%, rgb(24 24 35 / 11%) 50.7%),
    linear-gradient(96deg,
      var(--cap-edge) 0%,
      var(--cap-mid) 10%,
      var(--cap-shine) 24%,
      var(--cap-mid) 49%,
      var(--cap-shade) 83%,
      var(--cap-rim) 100%);
  box-shadow:
    inset 2px 0 3px rgb(255 255 255 / 34%),
    inset -5px 0 12px rgb(25 26 38 / 19%),
    inset 0 -3px 8px rgb(25 26 38 / 12%),
    0 17px 28px rgb(0 0 0 / 24%),
    0 0 55px var(--cap-glow);
  animation: capsule-float-fallback 7s ease-in-out infinite;
  transition:
    transform .55s cubic-bezier(.2,.7,.3,1),
    filter .4s ease,
    box-shadow .4s ease;
  pointer-events: none;
  will-change: translate;
}

.capsule-fallback::before {
  content: '';
  position: absolute;
  left: 16%;
  top: 8%;
  width: 10%;
  height: 78%;
  border-radius: 90% 80% 75% 70%;
  background: linear-gradient(180deg, rgb(255 255 255 / 71%), rgb(255 255 255 / 10%) 58%, transparent);
  filter: blur(1.5px);
  box-shadow: 4px 0 10px rgb(255 255 255 / 14%);
  opacity: .8;
}

.capsule-fallback::after {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(50% - 2px);
  height: 4px;
  border: 0;
  border-top: 1px solid rgb(22 29 42 / 25%);
  border-bottom: 1px solid rgb(255 255 255 / 40%);
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

canvas[data-capsule="blue"] ~ .capsule-fallback {
  --cap-angle: -23deg;
  --cap-edge: #244e98;
  --cap-mid: #447fe1;
  --cap-shine: #a5c9ff;
  --cap-shade: #2452a7;
  --cap-rim: #7ba9ee;
  --cap-glow: rgb(81 143 243 / 17%);
  border-color: rgb(207 227 255 / 28%);
  animation-delay: -2.1s;
}

canvas[data-capsule="green"] ~ .capsule-fallback {
  --cap-angle: 22deg;
  --cap-edge: #1d6c54;
  --cap-mid: #36b189;
  --cap-shine: #a2efca;
  --cap-shade: #267c60;
  --cap-rim: #7bc8a6;
  --cap-glow: rgb(88 214 159 / 16%);
  border-color: rgb(205 255 229 / 27%);
  animation-delay: -4.3s;
}

.capsule-choice:is(:hover, :focus-visible) .capsule-fallback {
  transform: translate(-50%, -52%) rotate(calc(var(--cap-angle) - 4deg)) scale(1.045);
  filter: brightness(1.055);
}

.world-art .capsule-fallback {
  width: 116px;
  height: 278px;
  box-shadow:
    inset 3px 0 5px rgb(255 255 255 / 34%),
    inset -8px 0 18px rgb(25 26 38 / 17%),
    inset 0 -4px 12px rgb(25 26 38 / 10%),
    0 23px 40px rgb(0 0 0 / 15%),
    0 0 75px var(--cap-glow);
  animation-duration: 8s;
}

.world-art .capsule-fallback::before {
  filter: blur(2px);
}

@keyframes capsule-float-fallback {
  0%, 100% { translate: 0 2px; }
  50% { translate: 0 -5px; }
}

@media (max-width: 800px) {
  .capsule-fallback { width: 70px; height: 157px; }
  .world-art .capsule-fallback { width: 96px; height: 229px; }
}

@media (max-width: 540px) {
  .capsule-fallback { width: 52px; height: 124px; }
  .world-art .capsule-fallback { width: 87px; height: 207px; }
}

@media (max-width: 380px) {
  .capsule-fallback { width: 47px; height: 116px; }
  .world-art .capsule-fallback { width: 82px; height: 198px; }
}

@media (prefers-reduced-motion: reduce) {
  .capsule-fallback {
    animation: none !important;
    translate: none;
    transition: none;
    will-change: auto;
  }
  .capsule-choice:is(:hover, :focus-visible) .capsule-fallback {
    transform: translate(-50%, -50%) rotate(var(--cap-angle));
    filter: brightness(1.06);
  }
}
