Hitbox and collision PyGame

Hello, I have a problem with collision in my game. I make hitboxes for my player and enemy but I don’t know how to check for collision to end the game. Can someone please help me?
Here is my code:

import pygame
from pygame.locals import *
import random

pygame.init()

clock = pygame.time.Clock()
fps = 60

vyska_okna = 640
sirka_okna = 550

okno = pygame.display.set_mode((sirka_okna ,vyska_okna))
pygame.display.set_caption('Minigame1')

font = pygame.font.SysFont('Bauhaus 93', 70)
font_score = pygame.font.SysFont('Bauhaus 93', 25)

white =(255, 255, 255)
blue = (0,0,255)
black = (0,0,0)
red = (255, 0 ,0)
green = (0, 255, 0)

game_over = 0

pozadie = pygame.image.load('dino.png')
restart = pygame.image.load('restart_btn.png')

def draw_text(text, font, color, x, y):
    img = font.render(text, True, color)
    okno.blit(img, (x,y))

def reset_gm():
    global kosti
    global start_time
    global last_bone_spawn_time
    player.reset(sirka_okna // 2 - 75, 515)
    bones_group.empty()
    start_time = pygame.time.get_ticks()
    last_bone_spawn_time = 0
    kosti = []


class Button():
    def __init__(self, x, y, image):
        self.image = image
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.klik = False
        
    def draw(self):
        action = False
        pos = pygame.mouse.get_pos()
        
        #kliknutie
        if self.rect.collidepoint(pos):
            if pygame.mouse.get_pressed()[0] == 1 and self.klik == False:
                action = True
                self.klik = True
        if pygame.mouse.get_pressed()[0] == 0:
            self.klik = False
                
        okno.blit(self.image, self.rect)
        
        return action

class Player():

    def __init__(self, x, y):
        self.reset(x, y)
    
    def update(self, game_over):

        dx = 0
        kroky = 14
        
        if game_over == 0:
            key = pygame.key.get_pressed()

            if key[pygame.K_LEFT]:
                dx -= 3
                self.counter += 1
                self.direction = -1
            if key[pygame.K_RIGHT]:
                dx += 3
                self.counter += 1
                self.direction = 1
            if key[pygame.K_LEFT] == False and key[pygame.K_RIGHT] == False:
                self.counter = 0
                self.index = 0
                if self.direction == 1:
                    self.image = self.images_right[self.index]
                if self.direction == -1:
                    self.image = self.images_left[self.index]
                    
            self.rect.x = max(-30, min(sirka_okna - 120, self.rect.x))    


        
            #animacia
            if self.counter > kroky:
                self.counter = 0
                self.index += 1
                if self.index == len(self.images_right):
                    self.index = 0
                if self.direction == 1:
                    self.image = self.images_right[self.index]
                if self.direction == -1:
                    self.image = self.images_left[self.index]
                    
            self.rect.x += dx

        okno.blit(self.image, self.rect)
        return game_over
    
    def draw_pl(self, okno):
        if self.direction == 1: #vpravo
            self.hitbox = (self.rect.x + 80, self.rect.y+5, 35, 120)
            self.hitbox2 = (self.rect.x + 43, self.rect.y+41, 35, 53)
        if self.direction == -1: #vlavo
            self.hitbox = (self.rect.x+34, self.rect.y+5, 35, 120)
            self.hitbox2 = (self.rect.x + 60, self.rect.y+41, 45, 53)
        pygame.draw.rect(okno, (0,0,0), self.hitbox, 2)
        pygame.draw.rect(okno, (255,255,255), self.hitbox2, 2)
        
    def reset(self, x, y):
        self.images_left = []
        self.images_right = []
        self.index = 0
        self.counter = 0
        for cislo in range(1,3):
            img_right = pygame.image.load(f'd{cislo}.png')
            img_left = pygame.transform.flip(img_right, True, False)
            self.images_right.append(img_right)
            self.images_left.append(img_left)
        
        self.image = self.images_right[self.index]
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.direction = 0     
        self.width = self.image.get_width()
        self.height = self.image.get_height()
        self.hitbox = (self.rect.x + 80, self.rect.y+5, 35, 120)
        self.hitbox2 = (self.rect.x + 43, self.rect.y+41, 35, 70)
        
class Bones(pygame.sprite.Sprite):
    def __init__(self, x, y):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load('kost1.png')
        self.rect = self.image.get_rect()
        self.rect.y = y
        self.rect.x = x
        self.hitbox = (self.rect.x-3, self.rect.y+12, 16, 16)
        self.hitbox2 = (self.rect.x+41, self.rect.y+2, 16, 16)
        self.hitbox3 = (self.rect.x+2, self.rect.y+9, 40, 10)
        
    def update(self):
        global bone_spawn_interval
        if len(kosti) < 5:
            self.rect.y += 5
            bone_spawn_interval = 2500
        elif len(kosti) >= 5 and len(kosti)<= 11:  
            self.rect.y += 7
            bone_spawn_interval = 1300
        elif len(kosti) > 11 and len(kosti) <= 17:  
            self.rect.y += 9
            bone_spawn_interval = 1000
        elif len(kosti) > 17:  
            self.rect.y += 11
            bone_spawn_interval = 750
            
    def draw_bn(self, okno):
        self.hitbox = (self.rect.x-3, self.rect.y+12, 16, 16)
        self.hitbox2 = (self.rect.x+41, self.rect.y+2, 16, 16)
        self.hitbox3 = (self.rect.x+2, self.rect.y+9, 40, 10)
        pygame.draw.rect(okno, (0,255,0), self.hitbox, 2)
        pygame.draw.rect(okno, (255,255,255), self.hitbox2, 2)
        pygame.draw.rect(okno, (0,0,255), self.hitbox3, 2)


player = Player(sirka_okna // 2 - 75, 515)
bones_group = pygame.sprite.Group()
start_time = pygame.time.get_ticks()
restart = Button(215, 500,  restart)

  # v milisekundách
bone_spawn_interval = 2300
# Získame aktuálny čas pri štarte skriptu
last_bone_spawn_time = pygame.time.get_ticks()
kosti = []

run = True
while run:
    clock.tick(fps)
    elapsed_time = pygame.time.get_ticks() - start_time
    okno.blit(pozadie,(0,0))

    if game_over == 0:
        player.draw_pl(okno)

        if elapsed_time - last_bone_spawn_time > bone_spawn_interval:
            nova_kost = Bones(random.randint(0, sirka_okna - 50), -50)
            bones_group.add(nova_kost)
            kosti.append('1')
            last_bone_spawn_time = elapsed_time
        for bone in bones_group:
                bone.draw_bn(okno)
        bones_group.draw(okno)
        bones_group.update()
        game_over = player.update(game_over)
        time_text = font_score.render(f"Time: {elapsed_time // 1000}", True, white)
        okno.blit(time_text, (10, 10))

      
    elif game_over == -1:
        draw_text('GAME OVER', font, blue, 105, 250 )

        bones_group.draw(okno)
        if restart.draw():
                reset_gm()
                game_over = 0
                
    player.update(game_over) 
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
            
    pygame.display.update()
            
pygame.quit()