body {
  background-color: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh; /* 모바일 브라우저 툴바 대응 */
  overflow-x: hidden;
}

.gallery {
  width: 100%;
  position: relative;
  padding: 20px 0; /* 상하 여백 추가 */
}

.gallery-container {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* 아이템이 정중앙에 오도록 좌우 여백 계산 */
  padding: 0 calc((100vw - 85vw) / 2); 
  gap: 12px; /* 모바일에서는 간격 축소 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 화면이 커질 때 max-width(1000px)에 대응 */
@media (min-width: 1177px) {
  .gallery-container {
    padding: 0 calc((100% - 1000px) / 2);
    gap: 20px;
  }
}

/* 스크롤바 숨기기 */
.gallery-container::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 85vw; /* 화면의 85% 너비 차지 */
  max-width: 1000px;
  height: 60vh; /* 화면 높이에 비례하도록 설정 */
  max-height: 560px; /* 너무 커지지 않도록 제한 */
  min-height: 320px; /* 너무 작아지지 않도록 제한 */
  scroll-snap-align: center;
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transform: translateZ(0); /* iOS 렌더링 최적화 */
}

.gallery-content {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: cover;
  background-position: center;
  position: relative;
}

.gallery-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}

.gallery-title {
  font-size: clamp(1.5rem, 5vw, 2.5rem); /* 화면 너비에 따라 폰트 크기 가변 */
  font-weight: 700;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  text-align: center;
  padding: 0 20px;
}

/* 네비게이션 제어 영역 */
.gallery-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding: 0 20px;
}

.gallery-nav-wrapper {
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px); /* Safari 대응 */
  padding: 10px 20px;
  border-radius: 40px;
}

.gallery-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  flex-shrink: 0;
}

/* 활성화된 점 디자인: 가로로 긴 타원형 */
.nav-dot.active {
  width: 40px; /* 모바일에서는 약간 줄임 */
  height: 6px;
  border-radius: 3px;
  background-color: #fff;
}

@media (min-width: 768px) {
  .nav-dot {
    width: 8px;
    height: 8px;
  }
  .nav-dot.active {
    width: 56px;
    height: 8px;
  }
}

/* 재생/정지 버튼 */
.play-pause-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .play-pause-btn {
    width: 40px;
    height: 40px;
  }
}

/* 양옆의 아이템은 약간 작게 보이는 효과 (선택사항) */
@media (min-width: 768px) {
  .gallery-item {
    transform: scale(0.95);
  }
  .gallery-item.active {
    transform: scale(1);
  }
}
