/* Estilos base para Tablero de Resultados Multiliga 2 */
body {
    margin: 0;
    padding: 0;
    background-color: #000000;
    overflow: hidden;
    color: #ffffff;
    font-family: 'Arial Black', 'Impact', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Clase de utilidad para lectores de pantalla y SEO */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Contenedor principal de resolución física (1024x128px) */
#canvas {
    width: 1024px;
    height: 128px;
    display: flex;
    flex-direction: column;
    background-color: #000000;
    box-sizing: border-box;
}

/* Viewports superior e inferior */
.viewport {
    width: 1024px;
    height: 64px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* El viewport inferior representa la mitad derecha de la pantalla (desfasada -1024px) */
#bottom-half .scroll-container {
    left: -1024px;
}

/* Contenedor del contenido animado */
.scroll-container {
    display: flex;
    align-items: center;
    height: 64px;
    position: absolute;
    white-space: nowrap;
    will-change: transform;
    box-sizing: border-box;
    width: max-content;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */

/* 1. Animación de Scroll Lineal de Ligas (Inicia estático en 0 y se desplaza) */
@keyframes leagueScroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(var(--scroll-end-x, -2048px), 0, 0);
    }
}

.animate-scroll {
    animation: leagueScroll var(--scroll-duration, 15s) linear var(--scroll-delay, 0s) both;
}

/* 2. Animación de Cartel de Día Vertical (Baja, espera, baja y sale) */
@keyframes slideVertical {
    0% {
        transform: translate3d(0, -100%, 0);
    }
    12% {
        transform: translate3d(0, 0, 0);
    }
    82% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(0, 100%, 0);
    }
}

.animate-title {
    animation: slideVertical var(--title-duration, 4.5s) cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* 3. Animación para Diapositiva Templo (Verde) */
@keyframes slideTemplo {
    0% {
        transform: translate3d(0, -100%, 0);
        opacity: 0;
    }
    15% {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
    85% {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
    100% {
        transform: translate3d(0, 100%, 0);
        opacity: 0;
    }
}

.animate-templo {
    animation: slideTemplo var(--intro-duration, 4s) cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* ==========================================================================
   ESTILOS DE CONTENIDO
   ========================================================================== */

.league-block {
    display: flex;
    align-items: center;
    height: 64px;
    box-sizing: border-box;
}

.league-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Cabecera de la liga */
.league-header {
    display: flex;
    align-items: center;
    height: 64px;
    background: linear-gradient(90deg, #111111 0%, #222222 100%);
    border-right: 2px solid #ffcc00;
    padding-left: 20px;
    padding-right: 25px;
    margin-right: 20px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.league-crest {
    height: 38px;
    width: 38px;
    margin-right: 12px;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-glow-fix {
    filter: drop-shadow(0px 0px 1px #ffffff) drop-shadow(0px 0px 2px #ffffff);
}

.league-title {
    font-size: 32px;
    font-weight: 900;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Contenedor interno de los partidos */
.matches-row {
    display: flex;
    align-items: center;
    gap: 60px; /* Separación fija entre partidos */
    padding-right: 40px; /* Espacio al final de la liga */
}

/* Item individual de cada partido */
.match-item {
    display: flex;
    align-items: center;
    height: 64px;
    font-size: 38px;
    color: #ffffff;
    letter-spacing: 1px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Meta información (Hora, Fecha) */
.match-meta {
    color: #aaaaaa;
    font-size: 24px;
    margin-right: 15px;
    font-family: 'Arial', sans-serif;
    font-weight: bold;
}

/* Tag EN VIVO (Estático, sin parpadeos para evitar lag) */
.live-tag {
    color: #ff3b30;
    font-size: 30px;
    margin-right: 15px;
    display: inline-flex;
    align-items: center;
}

.live-tag::before {
    content: "●";
    margin-right: 6px;
    font-size: 26px;
}

/* Tiempo de juego (ej. 45', ET) */
.match-time {
    color: #ffd700;
    font-size: 32px;
    margin-left: 15px;
}

/* Escudos de clubes en el ticker */
.team-crest {
    width: 44px;
    height: 44px;
    margin: 0 10px;
    object-fit: contain;
    background-color: transparent;
    flex-shrink: 0;
}

/* Código del equipo (TLA) */
.team-code {
    font-weight: 900;
}

/* Marcador */
.score-display {
    color: #ffd700;
    font-size: 40px;
    margin: 0 12px;
    font-weight: 900;
}

.score-divider {
    color: #ffffff;
    margin: 0 4px;
}

.penalty-score {
    font-size: 24px;
    color: #aaaaaa;
    margin-left: 2px;
    font-weight: bold;
}

/* Estilos de Cartel de Día y Títulos */
.title-block {
    position: relative;
    width: 2048px;
    height: 64px;
    box-sizing: border-box;
}

.title-item {
    position: absolute;
    top: 0;
    height: 64px;
    max-width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    font-size: 34px;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    box-sizing: border-box;
}

.title-long {
    font-size: 22px !important;
}

/* Estilos de Diapositiva de Intro (Templo) */
.slide-templo {
    position: absolute;
    top: 0;
    left: 0;
    width: 2048px;
    height: 64px;
    box-sizing: border-box;
    /* Degradado radial de alto contraste en verde esmeralda y verde bosque profundo */
    background: 
        radial-gradient(circle at 400px center, #1ebd6f 0%, transparent 260px),
        radial-gradient(circle at 900px center, #1ebd6f 0%, transparent 260px),
        radial-gradient(circle at 1400px center, #1ebd6f 0%, transparent 260px),
        radial-gradient(circle at 1900px center, #1ebd6f 0%, transparent 260px),
        radial-gradient(circle at -148px center, #1ebd6f 0%, transparent 260px),
        #052012;
}

.intro-item {
    position: absolute;
    top: 0;
    height: 64px;
    max-width: 510px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    white-space: nowrap;
    box-sizing: border-box;
    gap: 8px;
}

.slide-templo-text {
    font-size: 28px;
    font-family: 'Graduate', 'Arial Black', 'Impact', sans-serif;
    font-weight: bold;
    -webkit-text-stroke: 0.5px #ffffff;
    color: #ffffff;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0px 4px 6px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}



.logo-tdf {
    height: 52px;
    width: 52px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ==========================================================================
   NUEVAS OPTIMIZACIONES VISUALES: INTRO DE LIGA Y DESCENSO DE PARTIDOS
   ========================================================================== */

/* 1. Diapositiva del Título de la Competencia (Intro de liga) */
.slide-league-title {
    position: absolute;
    top: 0;
    left: 0;
    width: 2048px;
    height: 64px;
    box-sizing: border-box;
    /* Degradado de gris carbón a negro profundo con línea inferior dorada */
    background: 
        radial-gradient(circle at 400px center, #222222 0%, transparent 260px),
        radial-gradient(circle at 900px center, #222222 0%, transparent 260px),
        radial-gradient(circle at 1400px center, #222222 0%, transparent 260px),
        radial-gradient(circle at 1900px center, #222222 0%, transparent 260px),
        radial-gradient(circle at -148px center, #222222 0%, transparent 260px),
        #111111;
    border-bottom: 2px solid #ffcc00;
}

.league-title-item {
    position: absolute;
    top: 0;
    height: 64px;
    max-width: 510px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    white-space: nowrap;
    box-sizing: border-box;
    gap: 12px;
}

.league-title-text {
    font-size: 32px;
    font-weight: 900;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 1px;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.league-title-long {
    font-size: 22px !important;
}

.logo-title-crest {
    height: 38px;
    width: 38px;
    object-fit: contain;
    flex-shrink: 0;
}

/* 2. Animación de Entrada Vertical Descendente para los Partidos */
@keyframes matchesDescend {
    0% {
        transform: translate3d(0, -100%, 0);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

.matches-entry-wrapper {
    width: max-content;
    height: 64px;
    box-sizing: border-box;
}

.animate-matches-entry {
    animation: matchesDescend 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
