/* ============================================
   STORIES SYSTEM - BUHONEA 2025
   Sistema de historias tipo Instagram/Stories
   ============================================ */

/* ========== VARIABLES STORIES ========== */
:root {
  --story-bg: #000000;
  --story-glass-bg: rgba(0, 0, 0, 0.3);
  --story-glass-border: rgba(255, 255, 255, 0.1);
  --story-progress-bg: rgba(255, 255, 255, 0.3);
  --story-progress-active: #ffffff;
  --story-duration: 6s;
  --story-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== FONDO NEGRO PRINCIPAL ========== */
body {
  background: var(--story-bg) !important;
  overflow-x: hidden;
}

/* Ocultar contenido anterior del sistema de feed */
#listado-noticias,
#contenedor-detalle,
#scroll-sentinel,
#pie-pagina {
  display: none !important;
}

/* ========== HEADER CON GLASSMORPHISM ========== */
#cabecera-principal {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  transition: transform var(--story-transition);
  /* Degradado difuminado en la parte inferior */
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

#cabecera-principal h1 {
  font-size: clamp(18px, 4vw, 22px);
  margin: 0;
  font-weight: 700;
  color: #ffffff;
}

#cabecera-principal .sub {
  display: none; /* Ocultar subtítulo en modo stories */
}

/* ========== BOTÓN FAB (mantener tal cual) ========== */
.fab-more {
  z-index: 10001 !important; /* Por encima del header */
}

/* ========== STORIES CONTAINER ========== */
.stories-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--story-bg);
  overflow: hidden;
}

.story-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--story-transition), transform var(--story-transition);
  pointer-events: none;
}

.story-item.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

/* ========== BARRAS DE PROGRESO (STORIES) ========== */
.story-progress-bars {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 70px);
  left: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  gap: 6px;
  height: 3px;
  transition: opacity 0.3s ease;
  padding: 0 4px;
}

.story-progress-bars.hidden {
  opacity: 0;
  pointer-events: none;
}

.progress-bar {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 2px;
  transition: none;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
  will-change: width;
}

.progress-bar-fill.animating {
  /* La transición se aplica dinámicamente en JS */
}

.progress-bar-fill.completed {
  width: 100%;
  transition: none;
}

/* ========== MEDIA FULLSCREEN ========== */
.story-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--story-bg);
}

/* Overlay oscuro COMPLETO para quitar brillo */
.story-media::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1;
  pointer-events: none;
}

/* Degradado superior adicional */
.story-media::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

.story-media img,
.story-media video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cubre toda la pantalla */
}

.story-media.horizontal img,
.story-media.horizontal video {
  object-fit: contain; /* Si es horizontal, muestra bordes arriba/abajo */
}

/* ========== ETIQUETA DE CATEGORÍA ========== */
.story-category-tag {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 100px);
  left: 16px;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Colores por categoría */
.story-category-tag.evento {
  background: rgba(139, 92, 246, 0.9);
  color: #ffffff;
}

.story-category-tag.video {
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
}

.story-category-tag.actualizacion {
  background: rgb(34 197 94 / 58%);
  color: #ffffff;
}

.story-category-tag.default {
  background: rgba(103, 232, 249, 0.9);
  color: #000000;
}

.story-category-tag.encuesta {
  background: rgba(250, 204, 21, 0.9);
  color: #000000;
  font-weight: 800;
  font-size: 15px;
}

.story-category-tag.encuesta.voted-thanks {
  background: rgb(34 197 94 / 49%);
  color: #ffffff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.story-survey-voted-option-card {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 140px);
  left: 16px;
  right: 16px;
  z-index: 1000;
  padding: 8px 15px;
  border-radius: 5px;
  background: rgb(249 115 22 / 33%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(249, 115, 22, 0.3);
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
  width: fit-content;
}

.story-survey-voted-option-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

.story-survey-voted-option-text {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  text-align: left;
}

.story-survey-card.no-background {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Encuesta finalizada - Resultados */
.story-survey-finalized {
  padding: 20px;
  text-align: center;
}

.story-survey-finalized .story-survey-title {
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.story-survey-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.story-survey-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 16px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.story-survey-result-item.winner {
  background: rgba(34, 197, 94, 0.85);
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.story-survey-result-item.loser {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.story-survey-result-text {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  flex: 1;
  text-align: left;
}

.story-survey-result-votes {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-left: 16px;
  min-width: 40px;
  text-align: right;
}

/* ========== INFO INFERIOR SIN BACKGROUND ========== */
.story-info {
  position: fixed;
  bottom: calc(30px + env(safe-area-inset-bottom));
  left: 16px;
  right: 90px; /* Espacio para los botones laterales */
  z-index: 1000;
  padding: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  transition: transform var(--story-transition);
}

.story-title {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 12px;
  line-height: 1.2;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 4px 8px rgba(0, 0, 0, 0.7),
    0 6px 12px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(0, 0, 0, 0.8);
  letter-spacing: -0.5px;
}

.story-title h1 {
  line-height: 45px;
  margin: 0;
}

.story-summary {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 14px;
  line-height: 1.4;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 4px 8px rgba(0, 0, 0, 0.7),
    0 0 16px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Ocultar el texto completo, solo mostrar título y resumen */
.story-body {
  display: none !important;
}

/* QUITAR visualizaciones de la landing - ocultar completamente */
.story-views {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* ========== BOTONES LATERALES ========== */
.story-actions {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  background: linear-gradient(to top, rgb(0 0 0 / 45%) 0%, rgb(0 0 0 / 25%) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 5px 5px;
  border-radius: 999px;
}

.story-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 24px;
  position: relative;
}

.story-action-btn:active {
  transform: scale(0.9);
}

.story-action-count {
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

/* Botón de corazón */
.story-action-btn.like-btn {
  border-color: rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-action-btn.like-btn:hover {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(239, 68, 68, 0.2);
}

.story-action-btn.like-btn.active {
  background: rgba(239, 68, 68, 0.9) !important;
  border-color: rgba(239, 68, 68, 1) !important;
}

.story-action-btn.like-btn.active:not(.just-activated) {
  animation: none;
}

.story-action-btn.like-btn.active.just-activated {
  animation: heartBeat 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.story-action-btn.like-btn.active i {
  color: #ffffff !important;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(0.9); }
  45% { transform: scale(1.2); }
  60% { transform: scale(0.95); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Botón de no me gusta - ELIMINADO (solo usamos like ahora) */

/* Botón de más (+) */
.story-action-btn.more-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #000000;
  font-size: 32px;
  font-weight: 300;
  border-color: rgba(255, 255, 255, 1);
}

/* ========== ANIMACIÓN CENTRAL (CORAZÓN/PULGAR) ========== */
.story-reaction-center {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9998;
  pointer-events: none;
}

.story-reaction-icon {
  font-size: 120px;
  opacity: 0;
  transform: scale(0);
  animation: reactionPop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  filter: drop-shadow(0 0 20px currentColor);
}

.story-reaction-icon.heart {
  color: #EF4444;
}

@keyframes reactionPop {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-45deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.3) rotate(10deg);
  }
  75% {
    opacity: 0.8;
    transform: scale(1.1) rotate(-5deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.6) rotate(0deg);
  }
}

/* ========== MODAL DETALLE (ESTILO APPLE) ========== */
.story-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.story-detail-modal.active {
  pointer-events: all;
  opacity: 1;
  visibility: visible;
}

.story-detail-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-detail-modal.active .story-detail-backdrop {
  background: rgb(0 0 0 / 78%);
  backdrop-filter: blur(20px) saturate(75%);
  -webkit-backdrop-filter: blur(30px) saturate(120%);
}

.story-detail-card {
  position: relative;
  width: 100%;
  overflow: hidden;
  will-change: transform;
}

.story-detail-modal .story-detail-card {
  max-width: 580px;
  padding: 0;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 80px);
  min-height: 200px;
  width: 100%;
  background: rgb(15 15 15 / 56%);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
}

.story-detail-modal.active .story-detail-card {
  transform: translateY(0);
}

/* Animación de cierre */
.story-detail-modal.closing .story-detail-card {
  transform: translateY(100%);
}

.story-detail-modal.closing .story-detail-backdrop {
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

.story-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1;
}

.story-detail-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.story-detail-content {
  color: #ffffff;
  padding: 60px 24px 40px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.story-detail-content h1 {
  line-height: 33px;
  margin-bottom: 2rem;
  margin-top: 0;
  color: #ffffff;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Personalizar scrollbar */
.story-detail-content::-webkit-scrollbar {
  width: 6px;
}

.story-detail-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.story-detail-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.story-detail-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.story-detail-category {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  width: fit-content;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Colores de categoría en modal (iguales que en landing) */
.story-detail-category.evento {
  background: rgba(139, 92, 246, 0.9);
  color: #ffffff;
}

.story-detail-category.video {
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
}

.story-detail-category.actualizacion {
  background: rgba(34, 197, 94, 0.9);
  color: #ffffff;
}

.story-detail-category.default {
  background: rgba(103, 232, 249, 0.9);
  color: #000000;
}

.story-detail-category.encuesta {
  background: rgba(250, 204, 21, 0.9);
  color: #000000;
  font-weight: 800;
}

.story-detail-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 30px;
  line-height: 1.3;
  color: #ffffff;
  word-wrap: break-word;
}

.story-detail-summary {
  font-size: 17px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 24px;
  font-style: italic;
  word-wrap: break-word;
}

.story-detail-body {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.92);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.story-detail-body p {
  margin: 0 0 18px;
  word-wrap: break-word;
}

.story-detail-body h2,
.story-detail-body h3,
.story-detail-body h4 {
  color: #ffffff;
  margin: 24px 0 12px;
  word-wrap: break-word;
}

.story-detail-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 20px 0;
  display: block;
}

.story-detail-body video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 20px 0;
  display: block;
}

.story-detail-body ul,
.story-detail-body ol {
  margin: 12px 0;
  padding-left: 24px;
  word-wrap: break-word;
}

.story-detail-body li {
  margin: 8px 0;
  word-wrap: break-word;
}

.story-detail-body * {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ========== ENCUESTA ========== */
.story-survey-card {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  z-index: 1000;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(to top, rgb(0 0 0 / 45%) 0%, rgb(0 0 0 / 25%) 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: transparent;
  text-align: center;
  transition: all var(--story-transition);
}

/* Overlay vidrializado para encuestas (pre-cargado en CSS) */
.story-survey-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  z-index: 999 !important;
  opacity: 1 !important;
  pointer-events: none;
  will-change: backdrop-filter;
}

.story-survey-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0px;
}

/* Título dentro de las opciones de encuesta (cuando se pulsa participar) - usar clase específica */
.story-survey-options-container .story-survey-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 16px;
  text-align: center;
}

.story-survey-description {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 15px;
}

.story-survey-btn {
  padding: 8px 40px;
  border-radius: 5px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.story-survey-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.story-survey-btn:active {
  transform: scale(0.95);
}

/* Botón cerrar encuesta */
.story-survey-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 28px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.story-survey-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Opciones de encuesta */
.story-survey-options {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.story-survey-options.active {
  display: flex;
}

.story-survey-option {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.story-survey-option:hover {
  background: rgba(255, 255, 255, 0.15);
}

.story-survey-option.selected {
  background: rgba(139, 92, 246, 0.5);
  border-color: rgba(139, 92, 246, 1);
}

/* Botón de envío con rayo */
.story-survey-submit {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(250, 204, 21, 0.8);
  color: #FACC15;
  font-size: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  cursor: pointer;
  transition: all 0.3s ease;
}

.story-survey-submit.active {
  display: flex;
  animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(250, 204, 21, 0);
  }
}

/* Confirmación de voto */
.story-vote-confirmation {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10003;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-direction: column;
  gap: 24px;
}

.story-vote-confirmation.active {
  display: flex;
}

.story-vote-check {
  width: 100px;
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  border: 4px solid #22C55E;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #22C55E;
  font-size: 50px;
  flex-shrink: 0;
  animation: checkPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  box-sizing: border-box;
}

@keyframes checkPop {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.story-vote-thanks {
  position: static;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.3s forwards;
  text-align: center;
  width: 100%;
  white-space: nowrap;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ya votado */
.story-survey-voted {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.story-survey-voted.active {
  display: flex;
}

.story-survey-voted-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  border: 4px solid #22C55E;
  color: #22C55E;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

.story-survey-voted-option {
  padding: 14px 28px;
  border-radius: 20px;
  background: rgba(139, 92, 246, 0.4);
  border: 2px solid rgba(139, 92, 246, 0.8);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* ========== GESTOS TÁCTILES ========== */
.story-touch-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 200px; /* No interferir con botones */
  z-index: 500;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.story-touch-left,
.story-touch-right {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ========== RESPONSIVE MAX 580PX ========== */
@media (max-width: 580px) {
  .story-progress-bars {
    left: 12px;
    right: 12px;
    top: calc(env(safe-area-inset-top) + 75px);
    gap: 5px;
  }

  .story-info {
    left: 12px;
    right: 75px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: calc(95% - 100px);
    max-width: calc(100% - 100px);
    padding: 10px;
  }

  .story-title {
    font-size: clamp(22px, 5.5vw, 28px);
  }

  .story-summary {
    font-size: clamp(14px, 3.5vw, 17px);
  }

  /* Visualizaciones eliminadas de la landing */

  .story-actions {
    right: 12px;
    bottom: calc(30px + env(safe-area-inset-bottom));
    gap: 18px;
  }

  .story-action-btn {
    width: 54px;
    height: 54px;
    font-size: 22px;
  }

  .story-action-count {
    font-size: 11px;
  }

  .story-reaction-icon {
    font-size: 100px;
  }

  .story-detail-content {
    padding: 50px 20px 40px;
    max-height: calc(92vh - 0px);
  }

  .story-detail-title {
    font-size: 22px;
    line-height: 35px;
  }

  .story-detail-content h1 {
    line-height: clamp(28px, 8vw, 33px);
    margin-bottom: 1.5rem;
  }

  .story-detail-body {
    font-size: 15px;
  }

  .story-survey-card {
    left: 12px;
    right: 12px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    padding: 18px;
  }
}

/* ========== RESPONSIVE MAYORES A 580PX ========== */
@media (min-width: 581px) and (max-width: 768px) {
  .story-progress-bars {
    top: calc(env(safe-area-inset-top) + 75px);
  }
}

@media (min-width: 769px) {
  .story-progress-bars {
    top: calc(env(safe-area-inset-top) + 80px);
  }
}

/* ========== ANIMACIONES DE TRANSICIÓN ========== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
