* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  overflow: hidden;
  font-family: 'Poppins', sans-serif;
  -webkit-user-select: none;
  user-select: none;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
}

.app_videos {
  position: relative;
  width: 90vw;
  max-width: 1400px;
  height: 70vh;
  height: 70dvh; /* Dynamic viewport height for mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2000px;
  overflow: visible;
}

.video {
  position: absolute;
  max-width: 70%;
  max-height: 95%;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s 0.7s;
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.video video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  cursor: pointer;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  border-radius: 24px;
}

/* FRONT (ACTIVE) VIDEO */
.video.active {
  transform: translateZ(100px) scale(1.08);
  z-index: 3;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s;
  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.6),
    0 10px 25px rgba(0, 0, 0, 0.4),
    0 0 100px rgba(255, 255, 255, 0.03);
  filter: brightness(1.05) drop-shadow(0 0 40px rgba(255, 255, 255, 0.02));
  -webkit-filter: brightness(1.05) drop-shadow(0 0 40px rgba(255, 255, 255, 0.02));
}

.video.behind1 {
  transform: translateX(-55%) rotateY(40deg) scale(0.7) translateZ(-250px);
  z-index: 2;
  opacity: 0.25;
  visibility: visible;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s;
  filter: brightness(0.5) blur(2px);
  -webkit-filter: brightness(0.5) blur(2px);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

.video.behind2 {
  transform: translateX(55%) rotateY(-40deg) scale(0.7) translateZ(-250px);
  z-index: 1;
  opacity: 0.25;
  visibility: visible;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s;
  filter: brightness(0.5) blur(2px);
  -webkit-filter: brightness(0.5) blur(2px);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}


.nav-button {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  position: absolute;
  bottom: -80px;
  z-index: 10;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.nav-button::before {
  content: '';
  width: 0;
  height: 0;
  transition: all 0.3s ease;
}

.nav-button.left {
  left: max(15vw, 40px);
}

.nav-button.left::before {
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 14px solid white;
  margin-right: 2px;
}

.nav-button.right {
  right: max(15vw, 40px);
}

.nav-button.right::before {
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 14px solid white;
  margin-left: 2px;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.nav-button:active {
  transform: scale(0.95);
}

#volumeSlider {
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 10px;
  border-radius: 10px;
  background: linear-gradient(to right,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(255, 255, 255, 0.7) var(--volume-percent, 100%),
    rgba(100, 100, 100, 0.2) var(--volume-percent, 100%),
    rgba(100, 100, 100, 0.2) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  outline: none;
  cursor: pointer;
  z-index: 11;
  transition: background 0.1s ease, border 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.4);
  -webkit-appearance: none;
  appearance: none;
}

/* Custom slider track styling to remove blue and use gray */
#volumeSlider::-webkit-slider-runnable-track {
  background: transparent;
}

#volumeSlider::-moz-range-track {
  background: transparent;
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #e8e8e8);
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border: 3px solid rgba(255, 255, 255, 1);
}

#volumeSlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #e8e8e8);
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border: 3px solid rgba(255, 255, 255, 1);
}

#volumeSlider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(255, 255, 255, 0.4);
}

#volumeSlider::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

#volumeSlider:hover {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}


.overlay-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 80px;
  color: white;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.3s ease;
}

.overlay-icon.show {
  opacity: 0.9;
}

body.transition-bg {
  transition: background 1s ease;
  background: radial-gradient(circle at center, #111 0%, #000 100%);
}

/* TikTok Logo Link */
.tiktok-link {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 100;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.tiktok-logo {
  width: 50px;
  height: 50px;
  color: #fff;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  transition: all 0.3s ease;
}

.tiktok-link:hover .tiktok-logo {
  color: #00f2ea;
  transform: scale(1.1);
  filter: drop-shadow(0 6px 20px rgba(0, 242, 234, 0.4));
}

.tiktok-link:active .tiktok-logo {
  transform: scale(0.95);
}

/* Tooltip */
.tiktok-tooltip {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tiktok-link:hover .tiktok-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile Portrait - Vertical Carousel */
@media screen and (max-width: 768px) and (orientation: portrait) {
  .app_videos {
    width: 95vw;
    height: 85vh;
    height: 85dvh;
  }

  .video {
    max-width: 90%;
    max-height: 70%;
  }

  /* Vertical carousel stacking */
  .video.active {
    transform: translateZ(50px) scale(1.05) translateY(0);
  }

  .video.behind1 {
    transform: translateY(-80%) scale(0.75) translateZ(-150px);
    opacity: 0.3;
  }

  .video.behind2 {
    transform: translateY(80%) scale(0.75) translateZ(-150px);
    opacity: 0.3;
  }

  /* Hide navigation buttons on mobile - use swipe instead */
  .nav-button {
    display: none;
  }

  /* Position volume slider at bottom on mobile */
  #volumeSlider {
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
  }

  /* TikTok logo on mobile */
  .tiktok-link {
    bottom: 20px;
    right: 20px;
  }

  .tiktok-logo {
    width: 45px;
    height: 45px;
  }

  .tiktok-tooltip {
    font-size: 12px;
    padding: 8px 12px;
    bottom: 60px;
  }
}

/* Mobile Landscape - Horizontal Carousel */
@media screen and (max-width: 926px) and (orientation: landscape) {
  .app_videos {
    width: 95vw;
    height: 80vh;
    height: 80dvh;
  }

  .video {
    max-width: 60%;
    max-height: 90%;
  }

  /* Horizontal carousel (same as desktop but smaller) */
  .video.active {
    transform: translateZ(50px) scale(1.05);
  }

  .video.behind1 {
    transform: translateX(-60%) rotateY(40deg) scale(0.7) translateZ(-200px);
    opacity: 0.25;
  }

  .video.behind2 {
    transform: translateX(60%) rotateY(-40deg) scale(0.7) translateZ(-200px);
    opacity: 0.25;
  }

  /* Hide navigation buttons on mobile - use swipe instead */
  .nav-button {
    display: none;
  }

  /* Position volume slider */
  #volumeSlider {
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
  }

  /* TikTok logo on mobile */
  .tiktok-link {
    bottom: 15px;
    right: 15px;
  }

  .tiktok-logo {
    width: 40px;
    height: 40px;
  }

  .tiktok-tooltip {
    font-size: 11px;
    padding: 6px 10px;
    bottom: 55px;
  }
}

/* Responsive adjustments for smaller desktop screens */
@media screen and (min-width: 769px) and (max-width: 1200px) {
  .nav-button {
    bottom: -70px;
  }

  .nav-button.left {
    left: max(10vw, 30px);
  }

  .nav-button.right {
    right: max(10vw, 30px);
  }

  #volumeSlider {
    bottom: -75px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .nav-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }

  #volumeSlider::-webkit-slider-thumb:hover {
    transform: scale(1);
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.3),
      0 2px 4px rgba(0, 0, 0, 0.2);
  }
}
