/* Reels Viewer - Shared CSS */
.x-reels-overlay {
  position: fixed;
  inset: 0;
  --x-reel-vh: 100vh;
  height: 100vh;
  height: 100dvh;
  background: #000;
  z-index: 9999;
  display: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.x-reels-overlay.is-open { display: block; }
.x-reels-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .02em;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.x-reels-loading.is-show {
  opacity: 1;
}
.x-reels-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.4);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.x-reels-track {
  height: 100vh;
  height: 100dvh;
  height: var(--x-reel-vh, 100dvh);
  overflow: hidden;
  touch-action: none;
  will-change: transform;
}
.x-reels-track-inner {
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform .22s ease;
}
.x-reel {
  height: 100vh;
  height: 100dvh;
  height: var(--x-reel-vh, 100dvh);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.x-reel video,
.x-reel iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.x-reel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.x-reel-fallback {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.12), rgba(0,0,0,0) 55%), #000;
}

/* Gallery preview lock state (before opening reels) */
.explore-gallery-item.is-locked-preview .x-media {
  filter: blur(14px) saturate(.9);
  transform: scale(1.07);
}
.explore-gallery-item.is-locked-preview .x-scrim {
  opacity: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.62) 100%);
}
.x-reel-locked-media {
  width: 100%;
  height: 100%;
}
.x-reel-locked-media img,
.x-reel-locked-media video,
.x-reel-locked-media iframe,
.x-reel-locked-media .x-reel-fallback {
  filter: blur(18px);
  transform: scale(1.05);
}
.x-reel-gradient {
  position: absolute;
  inset: auto 0 0 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.55) 100%);
  z-index: 1;
  pointer-events: none;
}

/* Right actions */
.x-reel-actions {
  position: absolute;
  right: 12px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #fff;
  transition: bottom .25s ease;
  pointer-events: none;
}
.x-reel-actions * {
  pointer-events: auto;
}
@media (max-width: 576px) {
  .x-reel-actions {
    gap: 10px;
    right: 8px;
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}
.x-reel-avatar {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.85);
  object-fit: cover;
  background: #111;
}
@media (max-width: 576px) {
  .x-reel-avatar {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    border-width: 2px;
  }
}
.x-reel-follow {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease;
  gap: 6px;
}
.x-reel-follow::after {
  content: '';
  display: block;
  height: 13px;
  width: 1px;
}
.x-reel-follow:hover {
  transform: scale(1.08);
}
.x-reel-follow:active {
  transform: scale(0.95);
}
.x-reel-action {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
}
.x-reel-action button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  line-height: 1;
}
.x-reel-action i {
  font-size: 32px;
  text-shadow: 0 10px 30px rgba(0,0,0,.45);
}
@media (max-width: 576px) {
  .x-reel-action i {
    font-size: 28px;
  }
}
.x-reel-action .x-reel-count {
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.x-reel-action.is-liked i {
  color: #ff2d55;
}

/* Bottom description */
.x-reel-bottom {
  position: absolute;
  left: 14px;
  right: 78px;
  bottom: 20px;
  z-index: 6;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 10px 30px rgba(0,0,0,.55);
  transition: bottom .25s ease;
  pointer-events: none;
}
.x-reel-bottom * {
  pointer-events: auto;
}
@media (max-width: 576px) {
  .x-reel-bottom {
    left: 10px;
    right: 60px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    gap: 6px;
  }
}
.x-reel-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: clamp(12px, 2.8vw, 14px);
}
@media (max-width: 576px) {
  .x-reel-user {
    font-size: clamp(12px, 3.2vw, 13px);
  }
}
.x-reel-desc {
  font-weight: 500;
  font-size: clamp(12px, 2.9vw, 14px);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  max-height: calc(1.3em * 3);
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.x-reel-unlock-btn {
  margin-top: 8px;
  width: fit-content;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(0,0,0,.35);
  color: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.x-reel-unlock-btn:active {
  transform: scale(.98);
}
@media (max-width: 576px) {
  .x-reel-desc {
    font-size: clamp(11px, 3.1vw, 12px);
    -webkit-line-clamp: 3;
    max-height: calc(1.3em * 3);
  }
}

/* Comments sheet */
.x-reels-comments {
  position: absolute;
  inset: auto 0 0 0;
  height: 70vh;
  height: min(70dvh, calc(var(--x-reel-vh, 100dvh) - 20px));
  background: #0b0b0c;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  transform: translateY(105%);
  transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 8;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 -10px 40px rgba(0,0,0,.5);
}
.x-reels-comments.is-open { transform: translateY(0); }

.x-reels-comments__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 50px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(15,15,15,.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.x-reels-comments__header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.15);
}
.x-reels-comments__title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: rgba(255,255,255,.95);
}
.x-reels-comments__close-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  cursor: pointer;
}
.x-reels-comments__close-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.x-reels-comments__close-btn:active {
  transform: translateY(-50%) scale(.95);
}
.x-reels-comments__close-btn i {
  font-size: 16px;
  line-height: 1;
}

.x-reels-comments__body {
  padding: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.x-reels-comments__body .media {
  margin-bottom: 14px;
}
.x-reels-comments__body .media .avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 999px;
  object-fit: cover;
}
.x-reels-comments__body .media-body {
  color: rgba(255,255,255,.9);
  font-size: 14px;
  line-height: 1.4;
}
.x-reels-comments__body .media-body .text-muted,
.x-reels-comments__body .media-body small {
  color: rgba(255,255,255,.5) !important;
  font-size: 12px;
}
.x-reels-comments__body .btn-comment-like {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  transition: color .2s;
}
.x-reels-comments__body .btn-comment-like:hover {
  color: rgba(255,255,255,.9);
}

.x-reels-comments__composer {
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(0,0,0,.3);
}
.x-reels-comments__composer input {
  flex: 1;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
  font-size: 14px;
  transition: all .2s ease;
}
.x-reels-comments__composer input:focus {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.15);
}
.x-reels-comments__composer input::placeholder {
  color: rgba(255,255,255,.4);
}
.x-reels-comments__composer button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: #007bff;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  transition: all .2s ease;
  cursor: pointer;
}
.x-reels-comments__composer button:hover {
  transform: scale(1.03);
}
.x-reels-comments__composer button:active {
  transform: scale(.98);
}

/* Center play/pause button */
.x-reel-toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.35);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: .92;
  transition: transform .12s ease, opacity .12s ease;
}
.x-reel-toggle:active { transform: translate(-50%, -50%) scale(.96); }
.x-reel-toggle i { font-size: 34px; line-height: 1; }
.x-reel-toggle.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Double-tap like burst */
.x-reel-like {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(.6);
  z-index: 5;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 10px 30px rgba(0,0,0,.45);
  transition: opacity .08s ease, transform .22s ease;
}
.x-reel-like i { font-size: 86px; line-height: 1; }
.x-reel-like.is-show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
