@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,900&display=swap');

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #2c2f33;
    /* Color de asfalto */
    font-family: 'Roboto', sans-serif;
    user-select: none;
}

/* El fondo (Carretera) con textura realista */
#game-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    background-color: #2c2f33;
    /* Patrón de asfalto con textura y líneas amarillas centrales */
    background-image:
        linear-gradient(90deg, transparent 48%, #f1c40f 48%, #f1c40f 49%, transparent 49%, transparent 51%, #f1c40f 51%, #f1c40f 52%, transparent 52%),
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 2px, transparent 2px, transparent 4px);
    background-size: 100% 150px, 20px 20px;
    animation: roadMove 1s linear infinite;
    /* Aceras a los lados */
    box-shadow: inset 150px 0 0px #555, inset -150px 0 0px #555,
        inset 155px 0 10px rgba(0, 0, 0, 0.8), inset -155px 0 10px rgba(0, 0, 0, 0.8);
}

@keyframes roadMove {
    0% {
        background-position: 0 0, 0 0;
    }

    100% {
        background-position: 0 150px, 0 150px;
    }
}

/* HUD Superior */
#top-hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.money-box {
    font-size: 40px;
    font-weight: 900;
    font-style: italic;
    color: white;
    text-shadow: 2px 2px 0 #000, 4px 4px 0 rgba(0, 0, 0, 0.5);
    background: transparent;
    pointer-events: auto;
}

.wanted-level {
    font-size: 35px;
    color: rgba(255, 255, 255, 0.3);
    /* Apagadas por defecto */
    text-shadow: 2px 2px 0px #000;
    letter-spacing: 5px;
}

.star.active {
    color: #f1c40f;
    animation: pulseStar 0.5s infinite alternate;
}

@keyframes pulseStar {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px #f1c40f);
    }

    100% {
        transform: scale(1.2);
        filter: drop-shadow(0 0 15px #f1c40f);
    }
}

.nav-secret {
    pointer-events: auto;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
}

.nav-secret a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

/* ENTIDADES (Streamer) */
#main-character {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mc-sprite {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 10px 5px rgba(0, 0, 0, 0.5));
}

.mc-head {
    width: 35px;
    height: 35px;
    background: #e67e22;
    border-radius: 50%;
    border: 3px solid #000;
    z-index: 2;
    box-shadow: inset -2px -2px 10px rgba(0, 0, 0, 0.5);
}

.mc-shoulder {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    border: 2px solid #000;
    margin: -10px;
    z-index: 1;
}

#mc-health-bg {
    width: 60px;
    height: 8px;
    background: #000;
    border: 2px solid white;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

#mc-health-fill {
    width: 100%;
    height: 100%;
    background: #e74c3c;
    transition: width 0.2s;
}

/* PEATONES (Espectadores) */
.pedestrian {
    position: absolute;
    transform: translate(-50%, -100%);
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pedestrian-hp {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 5px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pedestrian-hp img {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid #fff;
}

.ped-sprite-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 45px;
    height: 45px;
    background: #c0392b;
    /* Camisa roja de pandillero */
    border-radius: 50%;
    border: 3px solid #000;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
    margin-top: -10px;
}

.ped-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    z-index: 2;
    animation: pedWobble 0.5s infinite alternate;
}

@keyframes pedWobble {
    0% {
        transform: translateY(0px) rotate(-5deg);
    }

    100% {
        transform: translateY(-3px) rotate(5deg);
    }
}

/* VEHÍCULOS (TANQUES O COCHES DE POLICÍAS) */
.vehicle {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 60;
    height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 15px 10px rgba(0, 0, 0, 0.7));
}

/* ICONOS FLOTANTES (+Plata) */
.floating-money {
    position: absolute;
    color: #2ecc71;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 2px 2px 0 black;
    z-index: 90;
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 1;
    }

    50% {
        transform: translateY(-50px) scale(1.2);
    }

    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

/* BUSTED/WASTED SCREEN */
#wasted-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    transition: opacity 0.5s;
}

#wasted-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#wasted-screen h1 {
    color: #3498db;
    /* Azul BUSTED policial */
    font-size: 100px;
    font-style: italic;
    font-weight: 900;
    text-shadow: 5px 5px 0 #000;
    letter-spacing: 15px;
}

/* Reutilizando Leaderboard de otros juegos */
#leaderboard-container {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 250px;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #e74c3c;
    /* Borde rojo peligro */
    border-radius: 10px;
    padding: 10px;
    color: white;
    z-index: 110;
}

#leaderboard-container h3 {
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #e74c3c;
}

.leader-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 5px;
}

.leader-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
}

.leader-item span {
    flex-grow: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-item strong {
    color: #f1c40f;
    font-size: 14px;
}

/* Guia de Controles Visual */
#controls-guide {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 10px 15px;
    color: white;
    z-index: 120;
    font-size: 14px;
    line-height: 1.5;
    pointer-events: none;
}

#controls-guide h4 {
    margin: 0 0 5px 0;
    color: #3498db;
    text-align: center;
}

#controls-guide p {
    margin: 3px 0;
}

#controls-guide b {
    color: #f1c40f;
}