/* Reproductor a pantalla completa. Siempre oscuro, como los videos. */
html.feed-open, html.feed-open body { overflow: hidden; }

.feed {
  --stage-w: 100vw;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  color: #EDF2F5;
  color-scheme: dark;
  animation: feed-in 0.22s ease-out both;
}
@keyframes feed-in { from { opacity: 0; transform: scale(0.985); } }

.feed-scroller {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed-scroller::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.stage { position: relative; width: 100%; height: 100%; overflow: hidden; cursor: pointer; background: #000; }
.stage-poster, .stage-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.stage-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: rgba(8, 13, 19, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.stage-flash .icon { width: 28px; height: 28px; margin-left: 3px; }
.feed.is-flashing .stage-flash,
.feed.is-paused .stage-flash { opacity: 1; transform: scale(1); }

.stage-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 72px 76px calc(24px + var(--safe-bottom)) 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.stage-info p { margin: 0; }
.stage-info .mono { font-size: 11px; color: #A4B0BC; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-info h2 { font-size: 22px; line-height: 1.15; margin: 4px 0 2px; }
.stage-sub { font-size: 14px; color: #A4B0BC; }

.stage-scrub {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--safe-bottom);
  height: 18px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
}
.stage-scrub::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(237, 242, 245, 0.18); }
.stage-scrub span { position: relative; height: 2px; width: 0; background: #58D5E3; }

/* Barra superior: segmentos por lección de la serie, título y cerrar */
.feed-top {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--stage-w);
  transform: translateX(-50%);
  padding: calc(8px + var(--safe-top)) 12px 0;
  pointer-events: none;
}
.feed-segments { display: flex; gap: 3px; margin-bottom: 8px; }
.segment { flex: 1; height: 2px; border-radius: 2px; background: rgba(237, 242, 245, 0.22); overflow: hidden; }
.segment span { display: block; height: 100%; background: #EDF2F5; }
.feed-bar { display: flex; align-items: center; gap: 8px; }
.feed-count { margin-left: auto; font-size: 12px; color: #A4B0BC; }

.feed-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 13, 19, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #EDF2F5;
  cursor: pointer;
  pointer-events: auto;
  flex-shrink: 0;
}
.feed-btn:active { transform: scale(0.94); }
.feed-bar .feed-btn { margin-left: -6px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }

.feed-rail {
  position: absolute;
  right: 12px;
  bottom: calc(40px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-unmute {
  position: absolute;
  top: calc(80px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(8, 13, 19, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #EDF2F5;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.feed-unmute .icon { width: 16px; height: 16px; }

/* Indicación de deslizar: una cápsula con un punto que sube, y una línea de texto */
.feed-cue {
  position: absolute;
  left: 50%;
  bottom: calc(150px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translate(-50%, 8px);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.feed.show-cue .feed-cue { opacity: 1; transform: translate(-50%, 0); }
.cue-track {
  position: relative;
  width: 22px;
  height: 36px;
  border: 1.5px solid rgba(237, 242, 245, 0.55);
  border-radius: 11px;
}
.cue-dot {
  position: absolute;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: #58D5E3;
  animation: cue-swipe 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes cue-swipe {
  0% { top: 24px; opacity: 0; }
  20% { opacity: 1; }
  80% { top: 7px; opacity: 1; }
  100% { top: 5px; opacity: 0; }
}
.cue-label {
  font-size: 12px;
  color: rgba(237, 242, 245, 0.75);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

/* Escritorio: el video como un teléfono centrado, con controles al lado */
@media (min-width: 900px) {
  .feed { --stage-w: min(100vw, calc((100dvh - 48px) * 9 / 16)); background: #05080C; }
  .stage { width: var(--stage-w); height: calc(100% - 48px); border-radius: 16px; border: 1px solid #233240; }
  .feed-top { top: 24px; padding-top: 12px; border-radius: 16px 16px 0 0; }
  .stage-info { padding-right: 20px; }
  .feed-rail {
    left: calc(50% + var(--stage-w) / 2 + 20px);
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }
  .feed-rail .feed-btn { background: #131E29; border: 1px solid #233240; }
  .feed-rail .feed-btn:hover { background: #192734; }
  .feed-unmute { top: 96px; }
}

@media (max-width: 899px) {
  .feed .desktop-only { display: none !important; }
}

@media (min-width: 900px) {
  .feed .mobile-only { display: none !important; }
  /* En computadora se baja con la rueda: el punto va hacia abajo. */
  .cue-dot { animation-name: cue-scroll; }
  @keyframes cue-scroll {
    0% { top: 5px; opacity: 0; }
    20% { opacity: 1; }
    80% { top: 22px; opacity: 1; }
    100% { top: 24px; opacity: 0; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .cue-dot { animation: none; top: 8px; }
}
