.popups-root {
  position: relative;
  z-index: 3000;
}
.popup-item {
  position: fixed;
  z-index: 3000;
}
.pos-center {
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
}

/* 좌표 배치용 */
.popup-item.xy {
}

/* 팝업 박스 */
.popup-box {
  position: relative;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 0;
  max-width: 500px;
  width: 100%;
  overflow: hidden;
}
.popup-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 나열 모드: 박스 너비를 이미지 크기에 맞춤 */
.popup-item.xy .popup-box {
  width: fit-content;
  max-width: 500px;
}
.popup-item.xy .popup-box img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
}

/* 상단 컨트롤 영역 */
.popup-controls {
  position: absolute;
  top: 8px;
  right: 0;
  padding: 0 8px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  z-index: 2;
}
.popup-controls button {
  border: 0;
  cursor: pointer;
  border-radius: 9999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
}
.popup-controls .popup-close {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.65);
}
.popup-controls .popup-close:hover {
  background: rgba(0, 0, 0, 0.75);
}
.popup-controls .popup-hide-today:hover {
  background: rgba(0, 0, 0, 0.55);
}

/* 슬라이더 */
.popup-slider {
  position: relative;
  overflow: hidden;
}
.popup-slider .slides {
  display: flex;
  transition: transform 0.3s ease;
}
.popup-slider .slide {
  min-width: 100%;
}
.slide-prev,
.slide-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 2;
}
.slide-prev {
  left: 8px;
}
.slide-next {
  right: 8px;
}

.dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 10px;
}
.dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  background: #d1d5db;
  cursor: pointer;
}
.dots button.active {
  background: #0b6fb5;
}

/* 랩탑 이하(1024px): 나열 모드 중앙 정렬, 모달(딤드) 없음 */
@media (max-width: 1024px) {
  .popups-root {
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: none;
  }

  .popups-root .popup-item.xy {
    pointer-events: auto;
  }

  .popup-item.xy {
    inset: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    display: grid !important;
    place-items: center !important;
    transform: none !important;
    max-width: none;
    background: transparent;
  }

  .popup-item.xy .popup-box {
    width: fit-content;
    max-width: min(500px, calc(100vw - 32px));
    max-height: 85vh;
    margin: 16px;
  }

  .popup-item.xy .popup-box img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
  }

  .popup-item.xy:not(:first-child) {
    display: none;
  }
}

/* 가로(랜드스케이프) 화면: 흰색 배경/박스 안 보이게 */
@media (max-width: 1024px) and (orientation: landscape) {
  .popup-item.xy .popup-box {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
}

@media (max-width: 640px) {
  .popup-box {
    max-width: calc(100vw - 32px);
  }

  .popup-item.xy .popup-box {
    max-width: calc(100vw - 32px);
    max-height: 88vh;
  }

  .popup-item.xy .popup-box img {
    max-height: 78vh;
  }
}

@media (max-width: 640px) and (orientation: landscape) {
  .popup-item.xy .popup-box {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
}
