/* ================================================================
   == TỆP: CSS/TROCHOISO.CSS
   == GIAO DIỆN MODAL POPUP IFRAME TRÒ CHƠI SỐ (THỬ THÁCH VR 360)
   ================================================================ */

#trochoiso-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 25, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#trochoiso-modal-overlay.active {
  display: flex;
  opacity: 1;
}

#trochoiso-modal-container {
  position: relative;
  width: 90vw;
  max-width: 1200px;
  height: 85vh;
  max-height: 850px;
  background: #0f172a;
  border: 1.5px solid rgba(251, 191, 36, 0.5); /* Viền vàng hoàng gia di sản */
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 25px rgba(251, 191, 36, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(15px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#trochoiso-modal-overlay.active #trochoiso-modal-container {
  transform: scale(1) translateY(0);
}

/* Chế độ toàn màn hình cho modal container */
#trochoiso-modal-container.is-fullscreen {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
}

/* Header của Popup */
.trochoiso-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  user-select: none;
}

.trochoiso-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.trochoiso-game-icon {
  font-size: 22px;
  animation: gameIconFloat 2s infinite ease-in-out;
}

@keyframes gameIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.trochoiso-title-text {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fef08a; /* Màu vàng sáng */
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.trochoiso-badge {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Nhóm nút điều khiển ở header */
.trochoiso-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trochoiso-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.trochoiso-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: #fef08a;
  transform: translateY(-1px);
}

.trochoiso-btn-close {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-weight: bold;
}

.trochoiso-btn-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

/* Phần thân chứa Iframe */
.trochoiso-body {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #090d16;
  overflow: hidden;
}

#trochoiso-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Vòng xoay nạp dữ liệu (Loading Spinner) */
.trochoiso-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #090d16;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 5;
  color: #fbbf24;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  transition: opacity 0.3s ease;
}

.trochoiso-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(251, 191, 36, 0.2);
  border-top-color: #fbbf24;
  border-radius: 50%;
  animation: trochoisoSpin 0.9s linear infinite;
}

@keyframes trochoisoSpin {
  to { transform: rotate(360deg); }
}

/* Tối ưu hiển thị trên di động */
@media (max-width: 768px) {
  #trochoiso-modal-container {
    width: 96vw;
    height: 94vh;
    border-radius: 12px;
  }
  .trochoiso-header {
    padding: 10px 14px;
  }
  .trochoiso-title-text {
    font-size: 14px;
  }
  .trochoiso-badge {
    display: none;
  }
  .trochoiso-btn-text {
    display: none;
  }
}

/* ================================================================
   == HIỆU ỨNG NHẤP NHÁY / PULSING CHO NÚT THỬ THÁCH TRÒ CHƠI SỐ ==
   ================================================================ */

@keyframes trochoisoHotspotBlink {
  0% {
    transform: scale(0.95);
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.5)) drop-shadow(0 0 8px rgba(251, 191, 36, 0.35)) brightness(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.95)) drop-shadow(0 0 24px rgba(251, 191, 36, 0.85)) brightness(1.22);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.5)) drop-shadow(0 0 8px rgba(251, 191, 36, 0.35)) brightness(1);
    opacity: 0.9;
  }
}

.trochoiso-hotspot-blink {
  animation: trochoisoHotspotBlink 1.4s ease-in-out infinite !important;
  transform-origin: 50% 50% !important;
  cursor: pointer !important;
}

.trochoiso-hotspot-blink:hover {
  animation-duration: 0.75s !important;
  filter: drop-shadow(0 0 20px #00e5ff) drop-shadow(0 0 35px #ffd700) brightness(1.35) !important;
}

/* ================================================================
   == THIẾT KẾ ĐỒNG BỘ NÚT ĐÓNG (DẤU X) CHO TẤT CẢ CÁC KHUNG POPUP ==
   == (Bao gồm: Popup Youtube, Phone, URL, PDF, Hình ảnh, Thông tin)==
   ================================================================ */

/* 1. Nút Đóng (Dấu X tròn màu đỏ rực rỡ, viền trắng, đổ bóng nổi bật) */
#close_popup_phone,
#video_popup_top,
#url_popup_top,
#pdf_popup_top,
#info_popup_top,
#image_popup_top {
  position: absolute !important;
  left: auto !important;          /* BẮT BUỘC: Hủy bỏ thuộc tính inline left: 0px của Pano2VR */
  right: 12px !important;
  top: 10px !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: rgba(239, 68, 68, 0.95) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), 0 0 10px rgba(239, 68, 68, 0.5) !important;
  cursor: pointer !important;
  z-index: 1000000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease !important;
}

#close_popup_phone:hover,
#video_popup_top:hover,
#url_popup_top:hover,
#pdf_popup_top:hover,
#info_popup_top:hover,
#image_popup_top:hover {
  background: #dc2626 !important;
  transform: scale(1.12) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8), 0 0 16px rgba(239, 68, 68, 0.8) !important;
}

/* Các container div con bên trong nút đóng */
#close_popup_phone > div,
#video_popup_top > div,
#url_popup_top > div,
#pdf_popup_top > div,
#info_popup_top > div,
#image_popup_top > div {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
}

/* Biểu tượng dấu X vector màu trắng sáng sắc nét */
#close_popup_phone img,
#video_popup_top img,
#url_popup_top img,
#pdf_popup_top img,
#info_popup_top img,
#image_popup_top img {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 16px !important;
  height: 16px !important;
  display: block !important;
  filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)) !important;
  pointer-events: none !important;
}

/* ================================================================
   == TỐI ƯU HÓA KHUNG POPUP VIDEO TRÊN ĐIỆN THOẠI & MÁY TÍNH      ==
   ================================================================ */

/* 2. Màn hình máy tính & Màn hình lớn (Desktop / 4K / Widescreen) */
#video_popup {
  width: 80vw !important;
  max-width: 960px !important;
  height: min(72vh, 560px) !important;
  max-height: 80vh !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  border-radius: 18px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 25px rgba(251, 191, 36, 0.25) !important;
  z-index: 100000 !important;
}

#video_popup #video_popup_bg {
  width: 100% !important;
  height: 100% !important;
  border-radius: 18px !important;
  background: rgba(15, 23, 42, 0.96) !important;
  border: 1.5px solid rgba(251, 191, 36, 0.45) !important;
}

#video_popup #video_popup_title {
  left: 20px !important;
  top: 14px !important;
  width: calc(100% - 90px) !important;
  color: #fef08a !important;
  font-size: 16px !important;
  font-weight: 700 !important;
}

#video_popup #youtube_popup {
  left: 15px !important;
  top: 55px !important;
  width: calc(100% - 30px) !important;
  height: calc(100% - 70px) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}

#video_popup #youtube_popup iframe {
  width: 100% !important;
  height: 100% !important;
  border-radius: 12px !important;
  border: none !important;
}

/* 3. Màn hình điện thoại & Tablet (Dưới 1024px - Khung screentint_phone của Pano2VR) */
@media screen and (max-width: 1024px) {
  #screentint_phone {
    width: 95vw !important;
    max-width: 560px !important;
    height: auto !important;
    aspect-ratio: 16 / 11 !important;
    max-height: 85vh !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    border-radius: 16px !important;
    background: rgba(15, 23, 42, 0.96) !important;
    border: 1.5px solid rgba(251, 191, 36, 0.45) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(251, 191, 36, 0.2) !important;
    overflow: hidden !important;
    z-index: 100000 !important;
  }

  #screentint_phone #youtube_popup_phone {
    left: 8px !important;
    top: 48px !important;
    width: calc(100% - 16px) !important;
    height: calc(100% - 56px) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }

  #screentint_phone #youtube_popup_phone iframe {
    width: 100% !important;
    height: 100% !important;
    border-radius: 10px !important;
    border: none !important;
  }

  #screentint_phone #close_popup_phone {
    right: 10px !important;
    top: 8px !important;
    width: 32px !important;
    height: 32px !important;
  }

  #screentint_phone #close_popup_phone img {
    width: 15px !important;
    height: 15px !important;
  }

  /* Thu nhỏ nút trò chơi vừa vặn, cân đối trên mobile */
  .trochoiso-hotspot-blink {
    width: 2.8rem !important;
    height: 2.8rem !important;
    left: calc(50% - 1.4rem) !important;
  }
}

/* 4. Màn hình điện thoại xoay ngang (Landscape) */
@media screen and (max-width: 920px) and (orientation: landscape) {
  #screentint_phone,
  #video_popup {
    width: 90vw !important;
    max-width: 720px !important;
    height: 88vh !important;
    aspect-ratio: auto !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  #screentint_phone #youtube_popup_phone,
  #video_popup #youtube_popup {
    top: 40px !important;
    height: calc(100% - 48px) !important;
  }
}

/* ================================================================
   == CÁC NÚT THỬ THÁCH TRÒ CHƠI SỐ TRONG MENU TRÁI (DANH MỤC)
   ================================================================ */

.trochoiso-menu-item {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

.trochoiso-menu-link {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 1.25rem !important;
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  border-bottom: 1px solid #fbf8ec !important;
  background: transparent;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.trochoiso-menu-link:hover,
.trochoiso-menu-link:focus-visible {
  background-color: #fbf8ec !important;
  color: #1f3d38 !important;
  font-weight: bold !important;
}

.trochoiso-item-icon {
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.6));
  transition: transform 0.25s ease;
}

.trochoiso-menu-link:hover .trochoiso-item-icon {
  transform: scale(1.18) rotate(-6deg);
}

.trochoiso-item-text {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  letter-spacing: 0.15px;
}

/* ================================================================
   == TỐI ƯU CÂN ĐỐI CHỮ TRÊN ĐIỆN THOẠI & MÀN HÌNH NHỎ (RESPONSIVE)
   ================================================================ */

@media screen and (max-width: 768px) {
  .trochoiso-menu-link {
    padding: 0.7rem 0.95rem !important;
    gap: 8px !important;
    font-size: 0.76rem !important;
    line-height: 1.35 !important;
  }

  .trochoiso-item-icon {
    font-size: 1.05rem !important;
  }
}

@media screen and (max-width: 480px) {
  .trochoiso-menu-link {
    padding: 0.62rem 0.8rem !important;
    gap: 7px !important;
    font-size: 0.74rem !important;
    line-height: 1.32 !important;
  }

  .trochoiso-item-icon {
    font-size: 0.98rem !important;
  }
}


