*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-main: #000000;
  --bg-elevated: #141414;
  --accent: #00c8ff;
  --accent-soft: #4cd4ff;
  --accent-dark: #023459;
  --text-primary: #ffffff;
  --text-muted: #b3b3b3;
  --card-radius: 6px;
  --transition-fast: 0.25s ease;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.app {
  min-height: 100vh;
  background: radial-gradient(circle at top, #025a8f 0, #012a46 40%, #000 80%);
  color: var(--text-primary);
}

.top-safe-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 18px;
  background: #000;
  z-index: 90;
}

/* HEADER fijo debajo de la barra */
.header {
  position: fixed;
  top: 18px;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3vw;
  height: 64px;
  background: #000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo-img {
  height: 34px;
  width: auto;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-weight: 500;
}

.nav-link.active,
.nav-link:hover {
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.03);
}

/* PERFIL + MENÚ */
.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: radial-gradient(circle at 20% 20%, #ffffff 0, #00c8ff 40%, #004eff 80%);
  border: 1px solid rgba(255,255,255,0.3);
  background-size: cover;
  background-position: center;
}

.profile-name {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-menu {
  position: absolute;
  top: 42px;
  right: 0;
  width: 260px;
  background: #101010;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 40px rgba(0,0,0,0.85);
  padding: 10px 10px 8px;
  display: none;
  animation: fadeInDown 0.18s ease-out;
}

.profile.open .profile-menu {
  display: block;
}

.profile-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  margin-bottom: 8px;
}

.profile-menu-avatar {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: radial-gradient(circle at 20% 20%, #ffffff 0, #00c8ff 40%, #004eff 80%);
  background-size: cover;
  background-position: center;
}

.profile-menu-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-menu-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.profile-menu-plan {
  font-size: 0.78rem;
  color: var(--accent-soft);
  margin-top: 2px;
}

.profile-menu-section {
  margin: 6px 0 4px;
}

.profile-menu-section-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 4px 0 4px;
}

.profile-menu-profiles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.profile-menu-profile-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.profile-menu-profile-item:hover {
  background: rgba(255,255,255,0.06);
}

.profile-menu-profile-item.active {
  background: rgba(0,200,255,0.18);
}

.profile-menu-profile-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 20% 20%, #ffffff 0, #00c8ff 40%, #004eff 80%);
  background-size: cover;
  background-position: center;
}

.profile-menu-item {
  width: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
}

.profile-menu-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.profile-menu-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ICONOS PEQUEÑOS */
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  position: relative;
}

.icon-search::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  top: 1px;
  left: 1px;
}
.icon-search::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  right: 1px;
  bottom: 1px;
}

.icon-bell::before,
.icon-bell::after {
  content: "";
  position: absolute;
}
.icon-bell::before {
  width: 12px;
  height: 10px;
  border-radius: 12px 12px 3px 3px;
  border: 2px solid currentColor;
  left: 3px;
  top: 2px;
}
.icon-bell::after {
  width: 6px;
  height: 4px;
  border-radius: 0 0 10px 10px;
  background: currentColor;
  bottom: 1px;
  left: 6px;
}

/* CONTENIDO PRINCIPAL */
.main {
  padding: 0 3vw 40px;
  margin-top: 94px; /* espacio para barra + header */
}

/* HERO */
.hero {
  position: relative;
  margin-top: 40px;
  margin-bottom: 26px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.hero-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.hero-img-wrapper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform var(--transition-fast);
}

.hero:hover .hero-img-wrapper img {
  transform: scale(1.06);
}

.poster-landscape { display: block; }
.poster-portrait { display: none; }

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.8) 0%,
    rgba(0,0,0,0.4) 45%,
    transparent 100%
  );
}

.hero-content {
  position: absolute;
  left: clamp(18px, 3vw, 26px);
  bottom: clamp(16px, 3vw, 24px);
  z-index: 1;
  max-width: 520px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  color: var(--accent-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
  border: 1px solid rgba(0,200,255,0.5);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0,200,255, 0.95);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  60% { transform: scale(1.35); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.hero-title {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin: 0 0 4px;
  font-weight: 700;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  max-width: 460px;
}

/* BOTONES */
.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 4px;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.65);
}

.btn-secondary {
  background: rgba(0,0,0,0.65);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(20,20,20,0.9);
}

/* ICONO PLAY (triángulo negro, sin cuadro) */
.btn-icon-play {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 11px;
  border-color: transparent transparent transparent #000;
}

/* Ícono info */
.btn-icon-info {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  position: relative;
}
.btn-icon-info::before,
.btn-icon-info::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: currentColor;
}
.btn-icon-info::before {
  top: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
}
.btn-icon-info::after {
  bottom: 3px;
  width: 2px;
  height: 7px;
  border-radius: 999px;
}

/* FILAS */
.section-row {
  margin-bottom: 22px;
  position: relative;
}

.row-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 6px 0 10px;
}

.row-scroller {
  position: relative;
}

.row-inner {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 18vw);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

.row-inner::-webkit-scrollbar {
  height: 0;
}
.row-inner {
  scrollbar-width: none;
}

/* CARD */
.card {
  position: relative;
  border-radius: var(--card-radius);
  cursor: pointer;
  overflow: hidden;
  background: #111;
  min-height: 80px;
  transform-origin: center;
  scroll-snap-align: start;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card-inner {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  overflow: hidden;
}

.card-inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050505;
}

.card:hover {
  transform: scale(1.07);
  box-shadow: 0 12px 30px rgba(0,0,0,0.85);
  z-index: 2;
}

/* Flechas filas */
.row-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 80px;
  border-radius: 3px;
  border: none;
  background: rgba(6,27,48,0.85);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast), background var(--transition-fast);
  z-index: 3;
}

.row-nav-btn svg {
  width: 22px;
  height: 22px;
}

.row-nav-btn:hover {
  background: rgba(0,200,255,0.9);
}

.row-nav-left { left: -10px; }
.row-nav-right { right: -10px; }

.section-row:hover .row-nav-btn {
  opacity: 1;
  visibility: visible;
}

/* FOOTER */
.footer {
  padding: 26px 3vw 30px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.06);
  background: radial-gradient(circle at top, #101820 0, #000 55%);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}
.footer-link {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-link:hover {
  text-decoration: underline;
}

/* MODAL DETALLE */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.22s ease-out forwards;
}

.modal {
  width: min(960px, 95vw);
  max-height: 90vh;
  background: #141414;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.9);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  transform: translateY(18px);
  opacity: 0;
}

.modal-backdrop.active .modal {
  animation: slideUp 0.22s ease-out forwards;
}

.modal-img {
  position: relative;
  background: #000;
}

.modal-img::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

/* NUEVO: iframe de Vimeo llenando el área */
.modal-video-wrapper {
  position: absolute;
  inset: 0;
}

.modal-video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-content {
  padding: 18px 22px 20px;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.modal-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.modal-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-description {
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.episode-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #1d1d1d;
  font-size: 0.9rem;
  cursor: pointer;
}

.episode-item:hover {
  background: #262626;
}

.episode-item.active {
  background: #00324a;
}

.episode-number {
  color: var(--text-muted);
  font-weight: 600;
}

.episode-title {
  font-weight: 500;
}

.episode-length {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.modal-badge {
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.24);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* BUSCADOR */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 80;
}

.search-overlay.active {
  display: flex;
}

.search-panel {
  width: min(720px, 96vw);
  margin-top: 90px;
}

.search-header {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.95rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(0,200,255,0.5);
}

.search-close {
  border-radius: 50%;
  border: none;
  width: 34px;
  height: 34px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  cursor: pointer;
}

.search-results {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.search-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0,0,0,0.5);
  margin-bottom: 8px;
  cursor: pointer;
}

.search-item:hover {
  background: rgba(0,0,0,0.75);
}

.search-thumb {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
}

.search-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-info-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.search-info-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ANIMACIONES */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .header {
    padding: 0 12px;
    height: 56px;
  }
  .main {
    padding: 0 12px 28px;
    margin-top: 88px;
  }
  .main-nav {
    display: none;
  }
  .profile-name {
    display: none;
  }
  .row-inner {
    grid-auto-columns: minmax(120px, 42vw);
  }
  .modal {
    grid-template-columns: 1fr;
  }
  .modal-img::before {
    padding-top: 56.25%;
  }
}

/* En móviles: vertical y portadas verticales */
@media (max-width: 600px) {
  .hero-img-wrapper {
    aspect-ratio: 2 / 3;
  }
  .poster-landscape { display: none; }
  .poster-portrait { display: block; }

  .card-inner {
    padding-top: 150%;
  }

  .hero-content {
    max-width: 80%;
  }

  .player-controls {
    padding: 0 16px;
  }
}
