Thank you for the help!
I could fix the two problems the next way:
To fix the problem with the div of 0x0 size, I changed the next property of my carousel class.
@media (max-width: 780px) {
.container {
grid-template-columns: 100%;
}
}
To fix the problem with the gap, I only put the media query at the end of my styles.