#ub-banner {
  position: fixed;
  z-index: 99998;
  display: none;
  width: var(--ub-width, 340px);
  max-width: calc(100vw - 20px);
  gap: 8px;
}

#ub-banner.visible {
  display: flex;
  flex-direction: column;
  animation: ub-show 0.35s ease;
}

/* Position */

#ub-banner.bottom-left {
  bottom: 20px;
  left: 20px;
}

#ub-banner.bottom-right {
  bottom: 20px;
  right: 20px;
}

#ub-banner.top-left {
  top: 20px;
  left: 20px;
}

#ub-banner.top-right {
  top: 20px;
  right: 20px;
}

/* Banner */

.ub-item {
  position: relative;
  cursor: default;
}

.ub-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 3px 15px #0003;
  transition: opacity 0.2s ease;
}

.ub-item[style*="pointer"] img:hover {
  opacity: 0.9;
}

/* Banner Close Button */

.ub-close {
  position: absolute;
  top: -10px;
  right: -10px;

  width: 32px;
  height: 32px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 2px solid #fff;
  border-radius: 50%;

  background: #222;
  color: #fff;

  cursor: pointer;

  box-shadow: 0 2px 8px #0004;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.ub-close:hover {
  background: #e53935;
  transform: scale(1.1);
}

.ub-close:active {
  transform: scale(0.9);
}

.ub-close svg {
  display: block;
  width: 17px;
  height: 17px;

  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Popup */

#ub-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;

  background: rgba(0, 0, 0, 0.8);

  align-items: center;
  justify-content: center;

  padding: 20px;
  box-sizing: border-box;
}

#ub-modal.open {
  display: flex;
}

#ub-modal img {
  display: block;

  max-width: 90vw;
  max-height: 85vh;

  width: auto;
  height: auto;

  object-fit: contain;
  border-radius: 8px;
}

/* Popup Close Button - SVG */

#ub-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;

  width: 42px;
  height: 42px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #fff;
  background: rgba(30, 30, 30, 0.75);

  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;

  cursor: pointer;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

/* Popup SVG Icon */

#ub-modal-close svg {
  display: block;

  width: 19px;
  height: 19px;

  flex-shrink: 0;

  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#ub-modal-close:hover {
  background: #e53935;
  transform: rotate(90deg);
}

#ub-modal-close:active {
  transform: scale(0.92);
}

#ub-modal-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Animation */

@keyframes ub-show {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile */

@media (max-width: 600px) {
  #ub-banner.bottom-left {
    left: 10px;
    bottom: 10px;
  }

  #ub-banner.bottom-right {
    right: 10px;
    bottom: 10px;
  }

  #ub-banner.top-left {
    left: 10px;
    top: 10px;
  }

  #ub-banner.top-right {
    right: 10px;
    top: 10px;
  }

  .ub-close {
    width: 34px;
    height: 34px;
    top: -8px;
    right: -8px;
  }

  .ub-close svg {
    width: 18px;
    height: 18px;
  }

  #ub-modal {
    padding: 12px;
  }

  #ub-modal img {
    max-width: 96vw;
    max-height: 85vh;
  }

  #ub-modal-close {
    top: 12px;
    right: 12px;

    width: 40px;
    height: 40px;
  }

  #ub-modal-close svg {
    width: 18px;
    height: 18px;
  }
}

/* Reduced Motion */

@media (prefers-reduced-motion: reduce) {
  #ub-banner.visible {
    animation: none;
  }

  .ub-item img,
  .ub-close,
  #ub-modal-close {
    transition: none;
  }
}
