/* === tour.css — Artifact Popup, Auto Tour Controller, Responsive === */

/* POPUP CHI TIẾT HIỆN VẬT */
.artifact-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  backdrop-filter: none;
  z-index: 20000;
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.artifact-popup-overlay.active {
  visibility: visible;
  opacity: 1;
}

.artifact-popup-container {
  width: calc(100% - 140px);
  max-width: 1000px;
  height: auto;
  margin-right: 120px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4);
  transform: translateY(40px) scale(0.9);
  transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
  position: relative;
  padding: 10px;
}

.artifact-popup-overlay.active .artifact-popup-container {
  transform: translateY(0) scale(1);
}

/* Final unified modal guard */
#lbClose {
  display: none !important;
}

@media (max-width: 768px) {
  #galleryOverlay,
  #customMapWrapper,
  #museumPopupOverlay,
  #artifactPopupOverlay,
  #sharePopupOverlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .gallery-container,
  .map-container,
  .museum-popup-container,
  .artifact-popup-container,
  .share-popup-container {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: calc(100dvh - 12px) !important;
    transform: translateY(100%) scale(1) !important;
    background: rgba(255, 255, 255, 0.94) !important;
  }

  #galleryOverlay.active .gallery-container,
  #customMapWrapper.active .map-container,
  #museumPopupOverlay.active .museum-popup-container,
  #artifactPopupOverlay.active .artifact-popup-container,
  #sharePopupOverlay.active .share-popup-container {
    transform: translateY(0) scale(1) !important;
  }

  .gallery-container::before,
  .map-container::before,
  .museum-popup-container::before,
  .artifact-popup-container::before,
  .share-popup-container::before {
    content: "" !important;
    display: block !important;
    width: 46px !important;
    height: 5px !important;
    margin: 10px auto 6px !important;
    border-radius: 999px !important;
    background: rgba(218, 37, 29, 0.42) !important;
    flex: 0 0 auto !important;
  }

  .gallery-header,
  .map-header,
  .share-popup-header {
    min-height: 62px !important;
    padding: 14px 22px 16px !important;
  }

  .gallery-grid {
    max-height: calc(100dvh - 92px) !important;
    overflow-y: auto !important;
    padding: 16px 14px max(22px, env(safe-area-inset-bottom)) !important;
  }

  .map-container,
  .museum-popup-container {
    height: calc(100dvh - 12px) !important;
  }

  .artifact-popup-container {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  .artifact-popup-image {
    min-height: min(48dvh, 420px) !important;
  }
}

/* Unified popup system: desktop modal + mobile bottom sheet */
#galleryOverlay,
#customMapWrapper,
#museumPopupOverlay,
#artifactPopupOverlay,
#sharePopupOverlay {
  align-items: center !important;
  justify-content: center !important;
  padding: clamp(18px, 4vw, 42px) !important;
  background: rgba(8, 12, 18, 0) !important;
  backdrop-filter: blur(0px) saturate(100%) !important;
  -webkit-backdrop-filter: blur(0px) saturate(100%) !important;
  transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, opacity 0.4s ease, visibility 0.4s ease !important;
}

#galleryOverlay.active,
#customMapWrapper.active,
#museumPopupOverlay.active,
#artifactPopupOverlay.active,
#sharePopupOverlay.active {
  background: rgba(8, 12, 18, 0.26) !important;
  backdrop-filter: blur(8px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(8px) saturate(120%) !important;
}

.gallery-container,
.map-container,
.museum-popup-container,
.artifact-popup-container,
.share-popup-container {
  width: min(1040px, calc(100vw - 96px)) !important;
  max-width: min(1040px, calc(100vw - 96px)) !important;
  max-height: min(86dvh, 820px) !important;
  margin: 0 !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(0px) saturate(100%) !important;
  -webkit-backdrop-filter: blur(0px) saturate(100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.76) !important;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
  overflow: hidden !important;
  transition: backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease !important;
}

#galleryOverlay.active .gallery-container,
#customMapWrapper.active .map-container,
#museumPopupOverlay.active .museum-popup-container,
#artifactPopupOverlay.active .artifact-popup-container,
#sharePopupOverlay.active .share-popup-container {
  transform: translateY(0) scale(1) !important;
  opacity: 1 !important;
  backdrop-filter: blur(24px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(150%) !important;
}

.gallery-header,
.map-header,
.share-popup-header {
  min-height: 86px !important;
  padding: 26px 42px !important;
  background: rgba(255, 255, 255, 0.82) !important;
  border-bottom: 1px solid rgba(17, 17, 17, 0.06) !important;
}

.gallery-title,
.map-nav-title,
.share-popup-title {
  color: #111111 !important;
  font-family: var(--font-main, "Segoe UI", Arial, sans-serif) !important;
  font-size: clamp(18px, 2.1vw, 28px) !important;
  font-weight: 800 !important;
  letter-spacing: 3px !important;
  line-height: 1.18 !important;
  text-transform: uppercase !important;
}

.gallery-grid,
.map-content,
.share-qr-panel,
.artifact-popup-content,
.artifact-popup-image-side {
  background: rgba(255, 255, 255, 0.64) !important;
}

.gallery-grid {
  padding: 38px 40px !important;
  gap: 26px !important;
}

.gallery-item {
  border: 1px solid rgba(17, 17, 17, 0.06) !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.07) !important;
}

.gallery-img-wrapper {
  height: clamp(150px, 19vw, 230px) !important;
}

.gallery-footer {
  min-height: 82px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
}

.gallery-item-title {
  color: #111111 !important;
  font-size: clamp(14px, 1.25vw, 17px) !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
}

.map-content {
  padding: 18px !important;
}

#leafletMap {
  border: 1px solid rgba(17, 17, 17, 0.08) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.map-footer {
  border-top: 1px solid rgba(17, 17, 17, 0.06) !important;
  background: rgba(255, 255, 255, 0.74) !important;
}

.map-hint {
  color: #555555 !important;
}

.share-popup-container {
  width: min(460px, calc(100vw - 48px)) !important;
  max-width: min(460px, calc(100vw - 48px)) !important;
}

.share-qr-panel {
  margin: 28px 34px 18px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(218, 37, 29, 0.08) !important;
}

.share-link-panel {
  padding-bottom: 34px !important;
}

.artifact-popup-container {
  display: grid !important;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr) !important;
  gap: 0 !important;
  padding: 10px !important;
  background: rgba(255, 255, 255, 0.82) !important;
}

.artifact-popup-image-side {
  padding: 12px !important;
}

.artifact-popup-image {
  min-height: min(62dvh, 520px) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  background-color: rgba(255, 255, 255, 0.7) !important;
}

.artifact-popup-content {
  padding: clamp(28px, 4vw, 48px) !important;
  border-radius: 12px !important;
}

.artifact-label {
  color: #da251d !important;
  font-weight: 700 !important;
}

.artifact-title {
  color: #111111 !important;
  letter-spacing: 0 !important;
  font-family: var(--font-main, "Segoe UI", Arial, sans-serif) !important;
}

.artifact-detail-label {
  color: #da251d !important;
}

.artifact-detail-value {
  color: #333333 !important;
}

.artifact-popup-overlay.image-only .artifact-popup-container {
  grid-template-columns: 1fr !important;
  width: min(680px, calc(100vw - 96px)) !important;
  max-width: min(680px, calc(100vw - 96px)) !important;
}

.museum-popup-container {
  height: min(84dvh, 820px) !important;
}

.museum-popup-iframe {
  border-radius: 18px !important;
  background: #ffffff !important;
}

.artifact-image-viewer {
  background: rgba(8, 12, 18, 0.78) !important;
  backdrop-filter: blur(10px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(120%) !important;
}

.artifact-image-viewer-tools {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.65) !important;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.24) !important;
}

.artifact-image-viewer-tools button {
  color: #da251d !important;
  background: rgba(255, 255, 255, 0.76) !important;
  border-color: rgba(218, 37, 29, 0.16) !important;
}

.artifact-image-viewer-tools button:hover {
  background: #da251d !important;
  color: #ffffff !important;
}

@media (max-width: 768px) {
  #galleryOverlay,
  #customMapWrapper,
  #museumPopupOverlay,
  #artifactPopupOverlay,
  #sharePopupOverlay {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
    background: rgba(8, 12, 18, 0) !important;
  }

  #galleryOverlay.active,
  #customMapWrapper.active,
  #museumPopupOverlay.active,
  #artifactPopupOverlay.active,
  #sharePopupOverlay.active {
    background: rgba(8, 12, 18, 0.28) !important;
  }

  .gallery-container,
  .map-container,
  .museum-popup-container,
  .artifact-popup-container,
  .share-popup-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: calc(100dvh - 12px) !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    transform: translateY(100%) scale(1) !important;
    transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, backdrop-filter 0.34s ease, -webkit-backdrop-filter 0.34s ease !important;
    overflow: hidden !important;
  }

  #galleryOverlay.active .gallery-container,
  #customMapWrapper.active .map-container,
  #museumPopupOverlay.active .museum-popup-container,
  #artifactPopupOverlay.active .artifact-popup-container,
  #sharePopupOverlay.active .share-popup-container {
    transform: translateY(0) scale(1) !important;
  }

  .gallery-container::before,
  .map-container::before,
  .museum-popup-container::before,
  .artifact-popup-container::before,
  .share-popup-container::before {
    content: "" !important;
    display: block !important;
    width: 46px !important;
    height: 5px !important;
    margin: 10px auto 6px !important;
    border-radius: 999px !important;
    background: rgba(218, 37, 29, 0.42) !important;
  }

  .gallery-header,
  .map-header,
  .share-popup-header {
    min-height: 64px !important;
    padding: 14px 22px 18px !important;
  }

  .gallery-title,
  .map-nav-title,
  .share-popup-title {
    font-size: 16px !important;
    letter-spacing: 1.5px !important;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    padding: 16px 14px max(22px, env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 92px) !important;
    overflow-y: auto !important;
  }

  .gallery-img-wrapper {
    height: 116px !important;
  }

  .gallery-footer {
    min-height: 72px !important;
    padding: 12px !important;
  }

  .gallery-item-title {
    font-size: 13px !important;
  }

  .map-container {
    height: calc(100dvh - 12px) !important;
  }

  .map-content {
    flex: 1 !important;
    min-height: 0 !important;
    padding: 10px !important;
  }

  #leafletMap {
    min-height: 0 !important;
    height: 100% !important;
  }

  .map-footer {
    padding: 14px 18px max(18px, env(safe-area-inset-bottom)) !important;
  }

  .museum-popup-container {
    height: calc(100dvh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
  }

  .museum-popup-iframe {
    border-radius: 18px 18px 0 0 !important;
  }

  .share-popup-container {
    max-height: calc(100dvh - 12px) !important;
  }

  .share-qr-panel {
    margin: 18px 22px 16px !important;
    padding: 22px 16px !important;
  }

  .share-qr-img {
    width: min(210px, 58vw) !important;
    height: min(210px, 58vw) !important;
  }

  .share-link-panel {
    flex-direction: column !important;
    padding: 0 22px max(24px, env(safe-area-inset-bottom)) !important;
  }

  .artifact-popup-container {
    display: flex !important;
    flex-direction: column !important;
    max-height: calc(100dvh - 12px) !important;
    padding: 8px !important;
    overflow-y: auto !important;
  }

  .artifact-popup-image-side {
    padding: 8px !important;
  }

  .artifact-popup-image {
    min-height: min(48dvh, 420px) !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
  }

  .artifact-popup-content {
    padding: 18px 18px max(24px, env(safe-area-inset-bottom)) !important;
  }

  .artifact-title {
    font-size: clamp(20px, 6vw, 28px) !important;
  }

  .artifact-popup-overlay.image-only .artifact-popup-container {
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

/* Auto tour controller - sync with white glass action buttons */
#autoTourController {
  background: rgba(255, 255, 255, 0.86) !important;
  backdrop-filter: blur(25px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.22),
    inset 0 0 12px rgba(255, 255, 255, 0.42) !important;
}

#autoTourController .atc-icon,
#autoTourController .atc-btn {
  background: rgba(255, 255, 255, 0.72) !important;
  border: 1px solid rgba(218, 37, 29, 0.16) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08) !important;
}

#autoTourController .atc-btn:hover {
  background: #ffffff !important;
  border-color: rgba(218, 37, 29, 0.45) !important;
  box-shadow: 0 10px 28px rgba(218, 37, 29, 0.22) !important;
}

#autoTourController .atc-label,
#autoTourController .atc-counter {
  color: #da251d !important;
}

#autoTourController .atc-scene-name {
  color: #111111 !important;
}

#autoTourController .atc-progress-wrap {
  background: rgba(218, 37, 29, 0.12) !important;
}

#autoTourController .atc-progress-bar {
  background: #da251d !important;
  box-shadow: 0 0 12px rgba(218, 37, 29, 0.28) !important;
}

#autoTourController .atc-live-dot {
  background: #da251d !important;
  box-shadow: 0 0 12px rgba(218, 37, 29, 0.55) !important;
}

#autoTourController .atc-btn svg rect,
#autoTourController .atc-btn svg path {
  fill: #da251d !important;
  stroke: #da251d !important;
}

/* Final close-less popup overrides */
.artifact-close-x,
.artifact-image-viewer-close {
  display: none !important;
}

.artifact-popup-container {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
}

.artifact-detail-label,
.atc-label {
  color: #da251d !important;
}

.atc-progress-bar {
  background: linear-gradient(90deg, #da251d, #ffffff) !important;
}

#artifactPopupOverlay [id*="close" i],
#artifactPopupOverlay [class*="close" i],
#artifactImageViewer [id*="close" i],
#artifactImageViewer [class*="close" i] {
  display: none !important;
}

.artifact-popup-overlay.image-only .artifact-popup-container {
  width: min(620px, calc(100vw - 80px));
  max-width: 620px;
  margin-right: 120px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.artifact-popup-overlay.image-only .artifact-popup-content {
  display: none;
}

.artifact-popup-overlay.image-only .artifact-popup-image-side {
  flex: 1;
  background: transparent !important;
  padding: 0 !important;
}

.artifact-popup-overlay.image-only .artifact-popup-image {
  min-height: min(70vh, 620px);
  background-size: contain;
  background-repeat: no-repeat;
  background-color: transparent !important;
}

/* Nút X đóng ở góc phải */
.artifact-close-x {
  position: absolute;
  top: 25px;
  right: 30px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  z-index: 100;
  line-height: 1;
  transition: 0.3s;
}

.artifact-close-x:hover {
  transform: scale(1.2);
  color: #ffd700;
}

.artifact-popup-image-side {
  flex: 1;
  padding: 10px;
}

.artifact-popup-image {
  width: 100%;
  height: 100%;
  min-height: 450px;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  cursor: zoom-in;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.artifact-popup-image:hover {
  filter: brightness(1.06);
  transform: scale(1.01);
}

.artifact-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: background 0.25s ease, backdrop-filter 0.25s ease, -webkit-backdrop-filter 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
}

.artifact-image-viewer.active {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.artifact-image-viewer-img {
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  transform-origin: center center;
  transition: transform 0.12s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.artifact-image-viewer-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.artifact-image-viewer-close {
  position: fixed;
  top: 24px;
  right: 30px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  z-index: 1;
  transition: 0.2s ease;
}

.artifact-image-viewer-close:hover {
  background: #da251d;
  transform: rotate(90deg);
}

.artifact-image-viewer-tools {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1;
}

.artifact-image-viewer-tools button {
  min-width: 42px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s ease;
}

.artifact-image-viewer-tools button:hover {
  background: #da251d;
  border-color: #da251d;
}

.artifact-popup-content {
  flex: 1.2;
  padding: 40px 50px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: transparent;
}

.artifact-info-group {
  margin-bottom: 25px;
}

.artifact-label {
  font-size: 14px;
  font-weight: 700;
  color: #888;
  margin-bottom: 8px;
  display: block;
}

.artifact-title {
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.artifact-detail-item {
  margin-bottom: 20px;
  line-height: 1.6;
}

.artifact-detail-label {
  font-weight: 800;
  color: #ffd700;
  font-size: 16px;
  margin-right: 8px;
}

.artifact-detail-value {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
}

.artifact-footer-btn {
  margin-top: auto;
  display: none; /* Ẩn nút thừa vì đã có nút X */
}

/* AUTO TOUR CONTROLLER — DESKTOP VERSION */
#autoTourController {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    /* VNPT PREMIUM DARK - Mix từ Logo VNPT */
    background: linear-gradient(135deg, rgba(7, 26, 51, 0.98), rgba(0, 71, 133, 0.94));
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(0, 91, 170, 0.3);
    border-radius: 60px;
    padding: 10px 22px 10px 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10000;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    min-width: 320px;
}

#autoTourController.hidden {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
    pointer-events: none;
}

.atc-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05); /* Lighter inside */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15); /* More subtle border */
}

.atc-live-dot {
    width: 8px;
    height: 8px;
    background: #da251d;
    border-radius: 50%;
    box-shadow: 0 0 10px #da251d;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.atc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.atc-label {
    font-size: 9px;
    font-weight: 800;
    color: #ffd700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.atc-scene-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.atc-progress-wrap {
    width: 100%;
    height: 3px;
    background: rgba(0, 91, 170, 0.2); /* Nền xanh VNPT nhạt */
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.atc-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffcc00, #fff); /* More intense gold */
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5); /* Glow */
    transition: width 0.1s linear;
}

.atc-counter {
    font-size: 10.5px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.7); /* Brighter text color */
    margin-right: 5px;
    letter-spacing: 0.5px;
}

.atc-btn {
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.atc-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.atc-btn-stop:hover {
    background: rgba(218, 37, 29, 0.2);
}

/* ═══════════════════════════════════════════════════════════
   XV. CHỈNH SỬA RESPONSIVE CHUẨN (MOBILE - TABLET - LANDSCAPE)
   ═══════════════════════════════════════════════════════════ */

/* ── Reset margin-right trên tablet/mobile — popup dùng hết màn hình ── */

@media (max-width: 768px) {

.map-container,
  .museum-popup-container,
  .gallery-container,
  .artifact-popup-container {
    margin-right: 0 !important;
    width: 95vw !important;
    max-width: 95vw !important;
  }

/* Menu hamburger — thu nhỏ */
  #menuToggleBtn {
    width: 52px;
    height: 52px;
    bottom: 14px;
    left: 14px;
  }
  #menuToggleBtn span {
    width: 20px;
  }
  #menuToggleBtn span:nth-child(2) {
    width: 14px;
    margin-left: 16px;
  }

  /* ── Quick Actions (nút 3 chấm) — thu nhỏ đồng bộ ── */
  .quick-actions-wrapper {
    bottom: 14px;
    right: 14px;
    gap: 10px;
  }
  .main-more-btn {
    width: 52px !important;
    height: 52px !important;
    font-size: 18px;
  }
  .main-more-btn i {
    font-size: 18px;
  }
  .menu-action-fab {
    width: 46px !important;
    height: 46px !important;
  }
  .menu-action-fab svg {
    width: 20px !important;
    height: 20px !important;
  }
  .sub-actions-container {
    gap: 10px;
  }

  /* ── MENU DRAWER: full width trên mobile, layout 1 cột ── */
  .menu-drawer {
    width: 100vw !important;
    min-width: unset !important;
  }
  .menu-header {
    padding: 20px 18px;
    gap: 14px;
  }
  .menu-logo-container img {
    width: 60px;
  }
  .menu-title-container h2 {
    font-size: 15px;
  }
  .menu-title-container h2 span {
    font-size: 11px;
    letter-spacing: 2px;
  }

  /* Chuyển từ 2 cột sang 1 cột dọc: categories trên, items dưới */
  .menu-content-flex {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .categories-column {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 10px 0;
    /* Hiển thị ngang thay vì dọc */
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    flex-shrink: 0;
  }
  .column-label {
    display: none;
  }
  .level-1-item {
    padding: 14px 18px;
    flex-direction: column;
    gap: 6px;
    min-width: 90px;
    text-align: center;
    border-bottom: none;
    font-size: 11px;
    flex-shrink: 0;
  }
  /* .level-1-item.active::after logic removed as it's not present in current markup */
  
  .cat-arrow {
    display: none;
  }
  .cat-name {
    font-size: 11px;
    line-height: 1.3;
  }

  .items-column {
    padding: 16px 14px;
    overflow-y: auto;
    flex: 1;
  }
  .items-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .card-img-wrapper {
    height: 110px;
  }
  .card-content {
    padding: 12px;
  }
  .card-title {
    font-size: 12px;
    height: auto;
    margin-bottom: 8px;
  }
  .card-btn {
    font-size: 10px;
  }

  .menu-footer {
    padding: 14px 18px;
  }
  .menu-close-btn {
    padding: 12px 24px;
  }
  .close-text {
    font-size: 10px;
  }

  /* ── HOTSPOT label — không tràn màn hình nhỏ ── */
  .epic-hotspot-label {
    font-size: 12px;
    padding: 8px 14px;
    white-space: normal;
    max-width: 180px;
    text-align: center;
  }

#cinematicIntro .menu-drawer-wrapper {
    flex-direction: column !important;
    padding: 15px 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    justify-content: flex-start !important;
    align-items: center !important; /* CĂN GIỮA CHO MOBILE DỄ NHÌN */
    background: transparent !important;
    pointer-events: none !important;
  }
  
  #cinematicIntro .menu-drawer {
    width: 100vw !important;
    flex: none !important;
    transition: all 0.5s ease !important;
  }
  
  /* CƠ CHẾ ẨN MENU MẸ BẰNG CLASS SUB-MENU-ACTIVE (TƯƠNG THÍCH MỌI TRÌNH DUYỆT) */
  #cinematicIntro .sub-menu-active .categories-column {
    display: none !important;
  }
  
  #cinematicIntro .categories-column {
    padding: 10px 0 !important;
    width: 100% !important;
    align-items: center !important;
  }
  
  #cinematicIntro .level-1-item {
    font-size: 16px !important;
    padding: 15px 10px !important;
    text-align: center !important;
    width: 100% !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  }
  
  #cinematicIntro .items-column.active {
    width: 100vw !important;
    margin: 5px 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }
  
  #cinematicIntro .text-dest-item {
    font-size: 15px !important;
    padding: 15px 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    text-align: center !important;
    width: 90% !important;
    align-items: center !important;
  }

  #cinematicIntro .click-preview {
    width: 95% !important;
    margin: 10px 0 !important;
  }

/* Splash title */
  .splash-title {
    font-size: clamp(28px, 7vw, 48px);
    margin-bottom: 28px;
    letter-spacing: 2px;
  }

  /* Nút bắt đầu */
  .start-tour-btn {
    padding: 16px 48px;
    font-size: 16px;
    letter-spacing: 2px;
  }

  /* Language selector — thu nhỏ, không tràn */
  .language-selector {
    top: 18px;
    right: 18px;
    padding: 10px 18px;
    gap: 16px;
    border-radius: 16px;
  }
  .lang-option img {
    width: 36px;
  }
  .lang-option span {
    font-size: 11px;
  }

  /* Splash mode cards — 2 card cạnh nhau vẫn fit */
  .splash-mode-cards {
    gap: 12px;
    max-width: 95vw;
  }
  .splash-mode-card {
    min-width: 0;
    flex: 1;
    padding: 22px 16px 20px;
    border-radius: 18px;
  }
  .splash-mode-card-icon {
    width: 62px;
    height: 62px;
  }
  .splash-mode-card-title {
    font-size: 12px;
    letter-spacing: 1.5px;
  }
  .splash-mode-card-desc {
    font-size: 10.5px;
  }
  .splash-mode-card-badge {
    font-size: 8.5px;
    padding: 4px 10px;
  }
  .splash-mode-title {
    font-size: clamp(14px, 4vw, 20px);
    letter-spacing: 2px;
  }

  /* Gallery — bỏ translate cứng, căn giữa */
  .gallery-container {
    width: 96vw;
    height: 88vh;
    transform: scale(0.95) translateY(20px);
    border-radius: 14px;
  }
  .museum-gallery-overlay.active .gallery-container {
    transform: scale(1) translateY(0);
  }
  .gallery-header {
    padding: 18px 20px;
  }
  .gallery-title {
    font-size: 16px;
    letter-spacing: 2px;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 20px;
  }

  /* Artifact popup — stack dọc trên mobile */
  .artifact-popup-container {
    width: 96vw;
    max-width: 96vw;
    flex-direction: column;
    transform: scale(0.95) translateY(30px);
    border-radius: 16px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .artifact-popup-overlay.active .artifact-popup-container {
    transform: scale(1) translateY(0);
  }
  .artifact-popup-image-side {
    padding: 12px 12px 0;
  }
  .artifact-popup-image {
    min-height: 220px;
    border-radius: 10px;
  }
  .artifact-popup-content {
    padding: 20px 20px 24px;
  }
  .artifact-title {
    font-size: clamp(18px, 5vw, 26px);
    margin-bottom: 16px;
  }
  .artifact-detail-label,
  .artifact-detail-value {
    font-size: 13px;
  }
  .artifact-detail-item {
    margin-bottom: 12px;
  }

  /* Map container */
  .map-container {
    width: 96vw;
    max-width: 96vw;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    margin-right: 0 !important;
  }
  .map-header {
    padding: 16px 18px;
    flex-shrink: 0;
  }
  .map-nav-title {
    font-size: 14px;
  }
  .map-content {
    flex: 1;
    min-height: 0;
    padding: 10px;
  }
  #leafletMap {
    height: 100% !important;
    min-height: 240px !important;
  }
  .map-footer {
    padding: 12px;
    flex-shrink: 0;
  }
  .map-hint {
    font-size: 11px;
  }

  /* Museum popup — căn giữa, chiều cao vừa màn hình */
  .museum-popup-container {
    width: 92vw !important;
    max-width: 92vw !important;
    height: 82dvh !important;
    max-height: 82dvh !important;
    margin-right: 0 !important;
    transform: translateY(50px) !important;
  }
  .museum-popup-container.active {
    transform: translateY(0) !important;
  }

  /* Auto tour controller — rút gọn trên tablet */
  #autoTourController {
    background: rgba(7, 21, 35, 0.96);
    gap: 12px;
    padding: 10px 18px 10px 12px;
    min-width: 280px;
    border-radius: 40px;
  }
  .atc-scene-name {
    font-size: 11.5px;
  }

}

@media (max-width: 480px) {

/* Splash */
  .splash-title {
    font-size: clamp(22px, 8vw, 34px);
    margin-bottom: 20px;
  }
  .start-tour-btn {
    padding: 14px 36px;
    font-size: 13px;
    letter-spacing: 1.5px;
    border-radius: 40px;
  }
  .language-selector {
    top: 14px;
    right: 14px;
    padding: 8px 14px;
    gap: 12px;
  }
  .lang-option img { width: 30px; }
  .lang-option span { font-size: 10px; }

  /* Mode cards — xếp dọc */
  .splash-mode-cards {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
  }
  .splash-mode-card {
    width: 100%;
    max-width: 92vw;
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
    padding: 16px 16px;
    gap: 14px;
    border-radius: 16px;
  }
  .splash-mode-card-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }
  .splash-mode-card-icon::after { display: none; }
  /* Nội dung text xếp dọc bên phải icon */
  .splash-mode-card-title,
  .splash-mode-card-desc,
  .splash-mode-card-badge {
    text-align: left;
  }
  .splash-mode-card-title { font-size: 12px; }
  .splash-mode-card-desc  { font-size: 10px; line-height: 1.5; }

  /* Gallery */
  .gallery-container {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .gallery-header { padding: 14px 16px; }
  .gallery-title  { font-size: 13px; letter-spacing: 1px; }
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
  }

  /* Artifact popup */
  .artifact-popup-container {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    padding: 6px;
  }
  .artifact-popup-image { min-height: 180px; }
  .artifact-popup-content { padding: 16px; }
  .artifact-title { font-size: 18px; }
  .artifact-close-x { top: 16px; right: 16px; font-size: 22px; }

  /* Map */
  .map-container {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    max-height: 100dvh;
    margin-right: 0 !important;
    display: flex;
    flex-direction: column;
  }
  .map-content {
    flex: 1;
    min-height: 0;
    padding: 8px;
  }
  #leafletMap {
    height: 100% !important;
    min-height: 200px !important;
  }

  /* Museum popup full screen mobile */
  .museum-popup-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin-right: 0 !important;
    transform: translateY(50px) !important;
  }
  .museum-popup-container.active {
    transform: translateY(0) !important;
  }

  /* Auto tour controller */
  #autoTourController {
    bottom: 15px;
    min-width: 0;
    width: calc(100vw - 28px);
    max-width: 420px;
    background: rgba(7, 21, 35, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 12px 14px;
    gap: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
  }
  .atc-label   { display: none; }
  .atc-scene-name { font-size: 11px; }
  .atc-counter { font-size: 9px; }
  .atc-btn     { width: 28px; height: 28px; }
  .atc-icon    { width: 32px; height: 32px; }

}

@media (max-height: 500px) and (orientation: landscape) {

.splash-title {
    font-size: clamp(18px, 4vh, 28px);
    margin-bottom: 12px;
  }
  .start-tour-btn {
    padding: 10px 32px;
    font-size: 13px;
  }
  .language-selector {
    top: 10px;
    right: 12px;
    padding: 6px 12px;
    gap: 10px;
  }
  .lang-option img { width: 28px; }

  .splash-mode-cards {
    flex-direction: row;
    gap: 10px;
  }
  .splash-mode-card {
    padding: 12px 14px;
    gap: 8px;
  }
  .splash-mode-card-icon { width: 44px; height: 44px; }
  .splash-mode-card-desc { display: none; }

  /* Map chiều cao màn hình ngang */
  .map-content { min-height: 200px; }
  #leafletMap  { height: 200px !important; }

  /* Artifact popup ngang */
  .artifact-popup-container {
    flex-direction: row;
    max-height: 90vh;
    overflow-y: auto;
  }
  .artifact-popup-image { min-height: 160px; }
  .artifact-popup-content { padding: 16px 20px; }

}

/* Final unified modal guard */
#lbClose {
  display: none !important;
}

@media (max-width: 768px) {
  #galleryOverlay,
  #customMapWrapper,
  #museumPopupOverlay,
  #artifactPopupOverlay,
  #sharePopupOverlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .gallery-container,
  .map-container,
  .museum-popup-container,
  .artifact-popup-container,
  .share-popup-container {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: calc(100dvh - 12px) !important;
    transform: translateY(100%) scale(1) !important;
    background: rgba(255, 255, 255, 0.94) !important;
  }

  #galleryOverlay.active .gallery-container,
  #customMapWrapper.active .map-container,
  #museumPopupOverlay.active .museum-popup-container,
  #artifactPopupOverlay.active .artifact-popup-container,
  #sharePopupOverlay.active .share-popup-container {
    transform: translateY(0) scale(1) !important;
  }

  .gallery-container::before,
  .map-container::before,
  .museum-popup-container::before,
  .artifact-popup-container::before,
  .share-popup-container::before {
    content: "" !important;
    display: block !important;
    width: 46px !important;
    height: 5px !important;
    margin: 10px auto 6px !important;
    border-radius: 999px !important;
    background: rgba(218, 37, 29, 0.42) !important;
    flex: 0 0 auto !important;
  }

  .gallery-header,
  .map-header,
  .share-popup-header {
    min-height: 62px !important;
    padding: 14px 22px 16px !important;
  }

  .gallery-grid {
    max-height: calc(100dvh - 92px) !important;
    overflow-y: auto !important;
    padding: 16px 14px max(22px, env(safe-area-inset-bottom)) !important;
  }

  .map-container,
  .museum-popup-container {
    height: calc(100dvh - 12px) !important;
  }

  .artifact-popup-container {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  .artifact-popup-image {
    min-height: min(48dvh, 420px) !important;
  }
}
