html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ffd23f;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.cart {
  position: relative;
  width: min(300px, 90vw);
}

.cart__check {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cart__bag {
  position: absolute;
  top: 0;
  right: 0;
}

.cart__basket {
  position: relative;
  display: block;
  width: 44px;
  height: 36px;
  box-sizing: border-box;
  border: 3px solid #17141a;
  border-radius: 4px 4px 8px 8px;
}

.cart__basket::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 8px;
  width: 20px;
  height: 12px;
  border: 3px solid #17141a;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.cart__badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #17141a;
  font-weight: 800;
  font-size: 11px;
  font-family: inherit;
  color: #ffffff;
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

#cart-add:checked ~ .cart__bag .cart__badge {
  transform: scale(1.35);
}

.cart__product {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-top: 48px;
  padding: 16px;
  width: 180px;
  box-sizing: border-box;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

.cart__swatch {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ff4d1f;
}

.cart__name {
  margin: 0;
  font-weight: 800;
  font-size: clamp(13px, 3.8vw, 15px);
  font-family: inherit;
  color: #17141a;
}

.cart__btn {
  padding: 4px 16px;
  border-radius: 12px;
  background: #17141a;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  color: #ffffff;
  cursor: pointer;
  transition: transform 220ms ease-out;
}

.cart__btn:active {
  transform: scale(0.94);
}

.cart__fly {
  position: absolute;
  left: 16px;
  top: 64px;
  opacity: 0;
  transition: opacity 220ms linear;
  pointer-events: none;
  z-index: 2;
}

.cart__fly-y {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff4d1f;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

#cart-add:checked ~ .cart__fly {
  transform: translateX(273px);
  opacity: 0;
  transition: transform 700ms ease-out, opacity 220ms linear 700ms;
}

#cart-add:checked ~ .cart__fly .cart__fly-y {
  transform: translateY(-71px);
  transition: transform 700ms ease-out;
}

.cart.is-demo .cart__fly {
  animation: fly-x 2s linear infinite;
  opacity: 1;
}

.cart.is-demo .cart__fly-y {
  animation: fly-y 2s ease-out infinite;
}

.cart.is-demo .cart__badge {
  animation: badge-loop 2s ease-out infinite;
}

@keyframes fly-x {
  0%, 30% {
    transform: translateX(0);
    opacity: 1;
  }
  68%, 100% {
    transform: translateX(273px);
    opacity: 0;
  }
}
@keyframes fly-y {
  0%, 30% {
    transform: translateY(0);
  }
  68%, 100% {
    transform: translateY(-71px);
  }
}
@keyframes badge-loop {
  0%, 66% {
    transform: scale(1);
  }
  74% {
    transform: scale(1.35);
  }
  84%, 100% {
    transform: scale(1);
  }
}
@media (max-width: 360px) {
  .cart__product {
    margin-top: 8px;
    padding: 8px;
    width: 148px;
    gap: 4px;
  }
  .cart__swatch {
    width: 36px;
    height: 36px;
  }
  .cart__name {
    font-size: 12px;
  }
  .cart__btn {
    padding: 4px 12px;
    font-size: 11px;
  }
  .cart__fly {
    top: 40px;
    left: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cart__badge, .cart__btn {
    transition: none;
  }
  .cart.is-demo .cart__fly,
  .cart.is-demo .cart__fly-y,
  .cart.is-demo .cart__badge {
    animation: none;
  }
  .cart.is-demo .cart__fly {
    opacity: 0;
  }
  #cart-add:checked ~ .cart__fly {
    transform: translateX(273px);
  }
}
