/* ===== Reset & Layout ===== */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: pan-y;       /* hanya scroll vertical */
  overscroll-behavior: none; /* cegah overscroll bounce */
}

* { box-sizing: border-box; }

.mobile-wrapper {
  position: relative;
  height: 100vh;
  aspect-ratio: 9 / 16;
  max-height: 100%;
  max-width: calc(100vh * (9 / 16));
  border-radius: 20px;
  overflow-y: scroll;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.mobile-wrapper::-webkit-scrollbar { display: none; }

.page {
  width: 100%;
  height: 100%;
  position: relative;
  scroll-snap-align: start;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: black;
}

/* ===== Overlay base (semua tombol & navbar) =====
   NOTE: posisi (left/top) akan di-set oleh JS; CSS hanya styling/size.
*/
#storyIcon,
.location-button-img,
.copy-btn,
.bottom-nav {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  transition: opacity 0.35s ease, transform 0.25s ease, left 0.12s ease, top 0.12s ease;
  pointer-events: auto;
}

/* helper hidden class (if used in HTML) */
.hidden { opacity: 0; pointer-events: none; }

/* ===== Story Icon ===== */
#storyIcon {
  width: clamp(80px, 40%, 180px);
  cursor: pointer;
  opacity: 0; /* visible when .story-show ditambahkan via JS */
}
#storyIcon.story-show {
  opacity: 1;
  pointer-events: auto;
  animation: fadeInBounce 0.8s ease forwards;
}

/* ===== Location Button ===== */
.location-button-img {
  width: clamp(60px, 18%, 120px);
  cursor: pointer;
  opacity: 0; /* visibility toggled by page6 observer via .location-show */
}
.location-button-img.location-show {
  opacity: 1;
  animation: fadeInBounce 0.8s ease forwards;
}

/* ===== Copy Buttons ===== */
.copy-btn {
  width: clamp(50px, 16%, 100px);
  height: auto;
  cursor: pointer;
  opacity: 0; /* toggled by page7 observer */
}
.copy-btn.copy-show {
  opacity: 1;
  animation: fadeInBounce 0.8s ease forwards;
}

/* ===== Navbar =====
   Default hidden. JS will toggle opacity/pointerEvents when in page 2-5.
   Position will be set by JS (so it aligns to video).
*/
.bottom-nav {
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.55);
  padding: 6px 12px;
  border-radius: 40px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);

  /* default hidden to avoid flash on load */
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.28s ease, transform 0.22s ease;
}

.nav-btn {
  width: clamp(40px, 8vw, 64px);
  height: clamp(40px, 8vw, 64px);
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}
.nav-btn:hover { background: rgba(255,255,255,0.55); transform: scale(1.05); }
.nav-btn img { width: 70%; height: auto; transition: transform 0.2s ease; }
.nav-btn:active img { transform: scale(0.92); }

/* ===== Animasi ===== */
@keyframes fadeInBounce {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  80%  { transform: translate(-50%, -50%) scale(0.98); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ====== TOAST ====== */
.toast {
  position: fixed;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 9999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === FIX khusus layar 853x1280 === */
@media screen and (width: 853px) and (height: 1280px) {
    #storyIcon {
    width: 300px;   /* lebih proporsional daripada 600px */
    bottom: 1%;
  }

  .location-button-img {
    width: 160px;   /* biar nggak terlalu besar */
  }

  .bottom-nav {
    gap: 24px;      /* atur jarak antar tombol navbar */
    padding: 10px 20px; /* biar ada napas */
  }

  .nav-btn {
    width: 75px;    /* lebih realistis buat desktop */
    height: 75px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
  }

  .copy-btn {
    width: 150px;   /* lebih proporsional */
  }

  #copyBtn1 {
    top: 29%;
  }

  #copyBtn2 {
    bottom: 22%;
  }
}

/* === FIX khusus desktop (layar lebar) === */
@media screen and (min-width: 1024px) {
  #storyIcon {
    width: 200px;   /* lebih proporsional daripada 600px */
    bottom: 1%;
  }

  .location-button-img {
    width: 100px;   /* biar nggak terlalu besar */
  }

  .bottom-nav {
    gap: 24px;      /* atur jarak antar tombol navbar */
    padding: 10px 20px; /* biar ada napas */
  }

  .nav-btn {
    width: 75px;    /* lebih realistis buat desktop */
    height: 75px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
  }

  .copy-btn {
    width: 100px;   /* lebih proporsional */
  }

  #copyBtn1 {
    top: 29%;
  }

  #copyBtn2 {
    bottom: 22%;
  }
}

/* === FIX khusus NEST HUB (layar lebar) === */
@media screen and (width: 1024px) and (height: 600px)
{
  #storyIcon {
    width: 100px;   /* lebih proporsional daripada 600px */
    bottom: 1%;
  }

  .location-button-img {
    width: 100px;   /* biar nggak terlalu besar */
  }

  .bottom-nav {
    gap: 24px;      /* atur jarak antar tombol navbar */
    padding: 10px 20px; /* biar ada napas */
  }

  .nav-btn {
    width: 40px;    /* lebih realistis buat desktop */
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
  }

  .copy-btn {
    width: 75px;   /* lebih proporsional */
  }

  #copyBtn1 {
    top: 29%;
  }

  #copyBtn2 {
    bottom: 22%;
  }
}

/* ===== Global Loader ===== */
#globalLoader {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#globalLoader.active {
  visibility: visible;
  opacity: 1;
}

#globalLoader .loader-overlay {
  text-align: center;
  color: white;
}

#globalLoader .loader-overlay img {
  width: 120px;
  margin-bottom: 12px;
}

