/* The back and the cut-out front share the same registration. The flying
   bottle passes between them, then joins the pile under the front film. */
.bag-front {
  z-index: 7;
  pointer-events: none;
  filter: none;
}
.bag-size, .bag-sway, #bag-contents, .bag .bag-skin {
  position: absolute;
  inset: 0;
  display: block;
}
.bag-size {
  transform-origin: 50% 99%;
  transform: scale(var(--bag-width, .82), var(--bag-height, .85));
  transition: transform .42s ease-out;
}
.bag-sway { transform-origin: 51% 99%; }
#bag-contents, .bag-size { pointer-events: none; }
#bag .bag-skin, .bag-front .bag-skin {
  height: 100%;
  width: 100%;
  object-fit: contain;
  animation: none;
}
#bag.is-target:active { scale: 1; }
#bag.is-target .bag-skin {
  filter: drop-shadow(0 0 1.5px #c5eeff);
}
#bag.is-hit .bag-sway, #bag.is-hit ~ .bag-front .bag-sway {
  animation: bag-sway .50s cubic-bezier(.19,.58,.28,1) both;
}
.bag-front-film {
  clip-path: polygon(0 0, 20% 0, 23% 16%, 26% 32%, 29.5% 43.5%, 33.6% 46.7%, 38.5% 46.4%, 46% 43.3%, 52% 41.5%, 62% 41.2%, 69% 39.5%, 75% 30%, 78% 12%, 83% 0, 100% 0, 100% 100%, 0 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, #000e 49%, #0008 58%, #0009 80%, #000e 96%);
  mask-image: linear-gradient(to bottom, #000 40%, #000e 49%, #0008 58%, #0009 80%, #000e 96%);
}
#bag-entry { position: absolute; top: 50%; left: 50%; }
#bag .bag-bottle {
  position: absolute;
  display: block;
  height: auto;
  max-width: none;
  transform: translate(-50%, -50%) rotate(var(--rest-angle));
  transform-origin: 50% 50%;
  filter: sepia(.10) saturate(.93) drop-shadow(0 1px 1.3px #25384980);
  animation: settle-in-bag .32s ease-out;
}
@keyframes settle-in-bag {
  from { top: var(--entry-top); transform: translate(-50%, -50%) rotate(var(--rest-angle)) scale(.82); }
}
@media (prefers-reduced-motion: reduce) {
  .bag-size { transition: none; }
  #bag.is-hit .bag-sway, #bag.is-hit ~ .bag-front .bag-sway { animation: none; }
}
