/* 1. 기본 스타일 리셋 & 스크롤바 완전 제거 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  outline: none !important;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: #000000; /* 완전한 검은색 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: none;
}

/* 2. 배경 캔버스 */
#dustCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  cursor: grab;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#dustCanvas:active {
  cursor: grabbing;
}

/* 3. 우측 상단 라이다 미니맵 (슬라이드 인/아웃 방식 & 미니멀 얇은 테두리) */
#minimapContainer {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 120px;
  height: 120px;
  background-color: #000000; /* 완전한 검은색 배경 */
  border: 0.5px solid rgba(0, 153, 255, 0.8); /* 가느다란 파란색 테두리 */
  box-shadow: none;
  backdrop-filter: none;
  border-radius: 0;
  z-index: 100;
  touch-action: none;
  cursor: pointer;

  /* 대각선 우측 상단 밖으로 숨김 처리 */
  transform: translate(140px, -140px);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.3s ease;
  pointer-events: none;
}

/* 미니맵 열림 상태 */
#minimapContainer.active {
  transform: translate(0, 0);
  opacity: 1;
  pointer-events: auto;
}

#minimapCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 우측 상단 제스처 감지 전용 투명 영역 */
#minimapTrigger {
  position: fixed;
  top: 0;
  right: 0;
  width: 60px; /* 제스처 감지 범위 확대 */
  height: 60px;
  z-index: 101; /* 캔버스보다 위에 배치 */
  cursor: pointer;

  /* [핵심] 이 영역 안에서 일어나는 브라우저 기본 터치/스크롤 동작 방지 */
  touch-action: none;
  background-color: transparent; /* 완전히 투명하게 설정 */
}

/* 힌트 아이콘 제거 (CSS ::after 삭제) */
#minimapTrigger::after {
  content: none;
}

/* 미니맵이 열리면 힌트 숨김 */
#minimapTrigger.active::after {
  opacity: 0;
}

/* 4. 미디어 모달 오버레이 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: rgba(0, 0, 0, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
  z-index: 999;
  padding: 16px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

/* 5. 모달 콘텐츠 및 미디어 반응형 처리 */
.modal-content {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  max-height: 90dvh;
  outline: none;
}

.modal-content img,
.modal-content video {
  max-width: 100%;
  max-height: 85vh;
  max-height: 85dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  background-color: #000000;
  border: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
  pointer-events: auto;
}

.modal-content img.hidden,
.modal-content video.hidden {
  display: none;
}

/* 6. 반응형 미디어 쿼리 */
@media (max-width: 768px) {
  /* 모바일 화면에 맞춰 크기만 축소 (위치 및 제스처 동작은 물려받음) */
  #minimapContainer {
    top: 12px;
    right: 12px;
    width: 90px;
    height: 90px;
  }

  .modal {
    padding: 10px;
  }

  .modal-content {
    max-width: 95vw;
    max-height: 80vh;
    max-height: 80dvh;
  }

  .modal-content img,
  .modal-content video {
    max-height: 75vh;
    max-height: 75dvh;
  }
}
