/* ===== Carousel ===== */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #111;
  touch-action: pan-y;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 560px;
  margin-bottom: 10px;
}
.carousel-track {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 0.28s ease;
}
.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.carousel-nav { display: none !important; }
.carousel-counter {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; pointer-events: none;
}
.carousel-dots {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 4;
  padding: 6px 10px; background: rgba(0,0,0,.28);
  border-radius: 999px; pointer-events: none;
}
.carousel-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.45);
}
.carousel-dots span.active {
  width: 18px; border-radius: 4px; background: #fff;
}

/* ===== Lightbox top: X left | count center | ⋯ right ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #000;
  flex-direction: column;
}
.lightbox.show { display: flex !important; }

.lb-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.lb-top .lb-icon-btn,
.lb-top .lb-counter {
  pointer-events: auto;
}
.lb-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(40,40,44,.85);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}
.lb-counter {
  height: 40px;
  min-width: 52px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(40,40,44,.85);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.lb-menu {
  display: none;
  position: absolute;
  top: calc(58px + env(safe-area-inset-top, 0px));
  right: 12px;
  background: #2c2c30;
  border-radius: 14px;
  padding: 6px 0;
  min-width: 250px;
  z-index: 50;
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}
.lb-menu.show { display: block !important; }
.lb-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  padding: 13px 16px;
  text-align: left;
  cursor: pointer;
}

.lightbox-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 70px 0 90px;
  touch-action: pan-y;
}
.lb-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.28s ease;
  will-change: transform;
}
.lb-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  background: #000;
}
.lightbox-nav, .lightbox-img { display: none !important; }

.lb-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(40,40,44,.92);
  color: #fff;
}
.lb-act {
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
}
.lb-act i { font-size: 22px; }
.lb-act.liked i { color: #ff2d55; }

/* ===== Reels smooth (Instagram-like) ===== */
.lightbox.lb-reels {
  background: #000;
}
.lightbox.lb-reels .lightbox-stage {
  padding: 0 !important;
  height: 100%;
  flex: 1;
  overflow: hidden;
  position: relative;
}
.lightbox.lb-reels .lb-track-reels {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  will-change: transform;
}
.lightbox.lb-reels .lb-reel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}
.lightbox.lb-reels .lb-reel-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* open / close animation */
.lightbox.lb-anim-in {
  animation: lbFadeIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lightbox.lb-anim-out {
  animation: lbFadeOut 0.22s ease both;
}
@keyframes lbFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes lbFadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.97); }
}

/* pause overlay */
.lb-play-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  pointer-events: none;
  backdrop-filter: blur(4px);
  animation: lbPop 0.2s ease;
}
@keyframes lbPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* double-tap heart */
.lb-dbl-heart {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  color: #ff2d55;
  font-size: 84px;
  transform: translate(-50%, -50%);
  animation: lbHeart 0.85s ease forwards;
  text-shadow: 0 4px 20px rgba(0,0,0,.35);
}
@keyframes lbHeart {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  50%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -65%) scale(1.05); }
}

.lightbox.lb-reels .lb-bottom {
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  border-radius: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}
.lightbox.lb-reels .lb-top .lb-counter {
  opacity: 0.9;
}
