/* ReelsPress — improved layout, avatar, spinner, safe-area offset */
:root {
  --rp-vertical-offset: 120px; /* total reserved top+bottom space (adjust if needed) */
  --rp-spinner-size: 64px;
}

/* Root: leave vertical breathing room so header/footer stay visible */
.reelspress-root {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--rp-vertical-offset));
  margin: calc(var(--rp-vertical-offset) / 2) 0;
  overflow: hidden;
  background: #000;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: block;
}

/* Video elements occupy container fully */
.reelspress-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform, opacity;
  transition: transform 360ms cubic-bezier(.2,.9,.2,1), opacity 240ms ease;
}

/* Overlay bottom-left: avatar + name (clickable) */
.reelspress-avatar {
  position: absolute;
  left: 12px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(0deg, rgba(0,0,0,0.45), rgba(0,0,0,0.12));
  padding: 6px 8px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.reelspress-avatar img { width:44px; height:44px; border-radius:50%; object-fit:cover; display:block; box-shadow: 0 6px 16px rgba(0,0,0,0.6); border:2px solid rgba(255,255,255,0.06); }
.reelspress-avatar .name { font-size:14px; font-weight:600; margin-right:8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:140px; }

/* Pagination top-right */
.reelspress-pagination {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 95;
  font-weight: 700;
  background: rgba(0,0,0,0.25);
  padding: 6px 10px;
  border-radius: 10px;
  color: #fff;
  backdrop-filter: blur(6px);
}

/* Action buttons right */
.reelspress-action {
  position: absolute;
  right: 12px;
  bottom: 40px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reelspress-action button {
  background: rgba(255,255,255,0.06);
  border: none;
  padding: 10px;
  border-radius: 12px;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  backdrop-filter: blur(4px);
}

/* Spinner (center) */
.reelspress-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--rp-spinner-size);
  height: var(--rp-spinner-size);
  z-index: 120;
  display: none; /* shown only while loading */
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.reelspress-spinner.visible { display: flex; }

/* Simple CSS spinner ring */
.reelspress-spinner .ring {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.12);
  border-top-color: rgba(255,255,255,0.94);
  animation: rp-spin 1s linear infinite;
}
@keyframes rp-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Poster / thumbnail fallback style (if visible) */
.reelspress-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  z-index: 15;
  transition: opacity 240ms ease;
}

/* Responsive adjustments */
@media (max-width: 720px) {
  :root { --rp-vertical-offset: 100px; }
  .reelspress-avatar { left: 10px; bottom: 12px; padding:6px; }
  .reelspress-avatar img { width:40px; height:40px; }
  .reelspress-action { right: 8px; bottom: 28px; }
  .reelspress-pagination { top: 8px; right: 8px; font-size: 13px; padding: 5px 8px; }
}
