/* RedFeed — stories overlay sobre o Feed (estilo Instagram) */
.rf-story-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483200;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
}

.rf-story-overlay.on {
  display: flex;
  pointer-events: auto;
}

.rf-story-overlay .rf-story-view {
  min-height: 0;
  height: auto;
  width: 100%;
  display: grid;
  place-items: center;
  background: transparent;
}

.rf-story-overlay .rf-story-phone {
  width: min(430px, calc(100vw - 20px));
  height: min(92dvh, 860px);
  max-height: calc(100dvh - 16px);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.rf-story-overlay .rf-story-overlay-body {
  width: 100%;
  touch-action: none;
}

body.rf-stories-open {
  overflow: hidden !important;
}

body.rf-stories-open .rf-header,
body.rf-stories-open .rf-bottom-nav {
  visibility: visible !important;
  pointer-events: none !important;
}

.rf-story-overlay-loading {
  color: #fff;
  font-size: 1.4rem;
  display: grid;
  place-items: center;
  min-height: 40vh;
}

/* Mobile / app — story ocupa a tela inteira; chat colado embaixo */
@media (max-width: 640px) {
  .rf-story-overlay {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    background: #050508 !important;
  }

  .rf-story-overlay .rf-story-view {
    min-height: 100dvh;
    height: 100dvh;
    width: 100%;
    display: block !important;
    place-items: unset !important;
  }

  .rf-story-overlay .rf-story-phone {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 1;
  }

  body.rf-stories-open .rf-bottom-nav,
  body.rf-stories-open .rf-header {
    display: none !important;
  }
}

html[data-rf-native-app="1"] .rf-story-overlay {
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  background: #050508 !important;
}

html[data-rf-native-app="1"] .rf-story-overlay .rf-story-view {
  min-height: 100dvh;
  height: 100dvh;
  width: 100%;
  display: block !important;
}

html[data-rf-native-app="1"] .rf-story-overlay .rf-story-phone {
  width: 100% !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  border-radius: 0 !important;
  position: fixed !important;
  inset: 0 !important;
}

html[data-rf-native-app="1"] body.rf-stories-open .rf-bottom-nav,
html[data-rf-native-app="1"] body.rf-stories-open .rf-header {
  display: none !important;
}

@media (min-width: 901px) {
  .rf-story-overlay {
    background: rgba(0, 0, 0, 0.96) !important;
    backdrop-filter: none;
    padding: 0;
  }

  .rf-story-overlay .rf-story-view {
    min-height: 100dvh;
    height: 100dvh;
    width: 100%;
    max-width: none;
  }

  .rf-story-overlay .rf-story-phone {
    width: min(420px, 36vw) !important;
    height: min(860px, calc(100dvh - 40px)) !important;
    max-height: calc(100dvh - 40px) !important;
    border-radius: 10px !important;
    border: 0 !important;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.55) !important;
  }

  .rf-story-overlay .rf-story-overlay-body {
    width: 100%;
    max-width: none;
    margin: 0;
  }
}
