/* ------------------------------
   Paleta (inspirada en Hattrick)
------------------------------ */
:root {
    --ht-green-950: #0d2a10;
    --ht-green-900: #133a17;
    --ht-green-800: #1b4f20;
    --ht-green-700: #23652a;
    --ht-green-600: #2e7d32;
    --ht-green-500: #43a047;
    --ht-green-400: #66bb4a;
    --ht-green-300: #9ccc65;
    --ht-green-100: #e5f1dd;
    --ht-green-50: #f3f8ef;
    --ht-gold: #f4c430;
    --ht-gold-dark: #c99a12;

    --ht-bg: #eef3ea;
    --ht-card: #ffffff;
    --ht-text: #1c2b1e;
    --ht-muted: #5f6f61;
    --ht-border: #d8e5d2;
    --ht-grid: rgba(27, 79, 32, 0.08);

    --ht-win: #2e9e44;
    --ht-draw: #8a958c;
    --ht-loss: #d64545;

    --ht-radius: 16px;
    --ht-shadow: 0 1px 2px rgba(19, 58, 23, 0.06), 0 8px 24px rgba(19, 58, 23, 0.08);
    --ht-shadow-hover: 0 2px 4px rgba(19, 58, 23, 0.08), 0 14px 32px rgba(19, 58, 23, 0.14);

    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-color: var(--ht-text);
    --bs-link-color: var(--ht-green-700);
    --bs-link-color-rgb: 35, 101, 42;
    --bs-link-hover-color: var(--ht-green-900);
    --bs-link-hover-color-rgb: 19, 58, 23;

    /* Tokens que cambian con el tema */
    --ht-heading: var(--ht-green-800);
    --ht-link: var(--ht-green-600);
    --ht-navbar: #1b4f20;
    --ht-tooltip: var(--ht-green-900);
    --ht-aviso: #fffaf0;
    --ht-shimmer: #d9ead0;
    color-scheme: light;
}

/* Modo oscuro: césped de noche. Los verdes de marca (barra, cabecera, podio) no cambian;
   cambian fondos, textos, bordes y los tintes claros. */
:root[data-theme="dark"] {
    --ht-green-100: #1d3321;
    --ht-green-50: #172a1b;
    --ht-bg: #0c140e;
    --ht-card: #131f16;
    --ht-text: #e3ece0;
    --ht-muted: #9db09e;
    --ht-border: #25382a;
    --ht-grid: rgba(220, 240, 215, 0.08);
    --ht-draw: #77837a;
    --ht-heading: #a5d68a;
    --ht-link: #b9e39f;
    --ht-navbar: #0f2a12;
    --ht-tooltip: #0a1d0c;
    --ht-aviso: #2a2412;
    --ht-shimmer: #284230;
    --ht-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --ht-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 14px 32px rgba(0, 0, 0, 0.5);

    --bs-body-color: var(--ht-text);
    --bs-body-bg: var(--ht-bg);
    --bs-link-color: #9ccc65;
    --bs-link-color-rgb: 156, 204, 101;
    --bs-link-hover-color: #c5e59f;
    --bs-link-hover-color-rgb: 197, 229, 159;
    --bs-secondary-color: var(--ht-muted);
    --bs-border-color: var(--ht-border);
    --bs-tertiary-bg: var(--ht-green-50);
    color-scheme: dark;
}

.ht-bg {
    background: var(--ht-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ht-main {
    flex: 1;
    max-width: 1140px;
    margin-top: -3.5rem;
    padding-bottom: 3rem;
    position: relative;
    z-index: 1;
}


/* ------------------------------
   Navegación
------------------------------ */

.ht-navbar {
    background: var(--ht-green-950);
    border-bottom: 3px solid var(--ht-gold);
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.ht-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ht-brand strong {
    color: var(--ht-gold);
    font-weight: 800;
}

.ht-ball {
    width: 28px;
    height: 28px;
    color: var(--ht-green-900);
    transition: transform 0.6s ease;
}

.ht-brand:hover .ht-ball {
    transform: rotate(360deg);
}

.ht-navbar .nav-link {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    padding: 0.4rem 1rem !important;
    transition: background 0.2s, color 0.2s;
}

.ht-navbar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.ht-navbar .nav-link.active {
    color: var(--ht-green-950);
    background: var(--ht-gold);
}

.ht-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
}

@media (max-width: 767.98px) {
    .ht-navbar .navbar-nav {
        padding-top: 0.75rem;
        gap: 0.25rem;
    }
}


/* ------------------------------
   Cabecera tipo cancha
------------------------------ */

.ht-hero {
    color: #fff;
    padding: 2.5rem 0 5rem;
    background:
        radial-gradient(ellipse at 50% 120%, rgba(244, 196, 48, 0.18), transparent 60%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 60px, transparent 60px 120px),
        linear-gradient(160deg, var(--ht-green-700), var(--ht-green-900));
    position: relative;
    overflow: hidden;
}

/* línea y círculo central */
.ht-hero::before,
.ht-hero::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.08);
}

.ht-hero::before {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
}

.ht-hero::after {
    top: 0;
    bottom: 0;
    right: 69px;
    border-width: 0 0 0 2px;
}

.ht-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ht-gold);
    margin-bottom: 0.35rem;
}

.ht-title {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: 0.01em;
    margin: 0;
}

.ht-subtitle {
    color: rgba(255, 255, 255, 0.75);
    margin: 0.5rem 0 0;
    max-width: 640px;
}

.ht-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.ht-back:hover {
    color: #fff;
}


/* ------------------------------
   Tarjetas
------------------------------ */

.ht-card {
    background: var(--ht-card);
    border: 1px solid var(--ht-border);
    border-radius: var(--ht-radius);
    box-shadow: var(--ht-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 575.98px) {
    .ht-card {
        padding: 1rem;
        border-radius: 12px;
    }
}

.ht-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ht-heading);
    margin-bottom: 1rem;
}

.ht-section-title::before {
    content: "";
    width: 6px;
    height: 1.2em;
    border-radius: 3px;
    background: linear-gradient(var(--ht-green-500), var(--ht-gold));
}


/* ------------------------------
   Animaciones de entrada
------------------------------ */

@keyframes ht-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes ht-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ht-shimmer {
    from { background-position: -200% 0; }
    to { background-position: 200% 0; }
}

.reveal {
    animation: ht-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 90ms);
}

.animate-rows tbody tr {
    animation: ht-fade 0.5s ease both;
}

.animate-rows tbody tr:nth-child(1) { animation-delay: 0.15s; }
.animate-rows tbody tr:nth-child(2) { animation-delay: 0.2s; }
.animate-rows tbody tr:nth-child(3) { animation-delay: 0.25s; }
.animate-rows tbody tr:nth-child(4) { animation-delay: 0.3s; }
.animate-rows tbody tr:nth-child(5) { animation-delay: 0.35s; }
.animate-rows tbody tr:nth-child(6) { animation-delay: 0.4s; }
.animate-rows tbody tr:nth-child(7) { animation-delay: 0.45s; }
.animate-rows tbody tr:nth-child(n+8) { animation-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
}


/* ------------------------------
   Gráficos y esqueleto de carga
------------------------------ */

.chart-wrap {
    position: relative;
    height: 320px;
}

.chart-wrap.chart-sm {
    height: 260px;
}

.chart-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--ht-green-50) 25%, var(--ht-green-100) 50%, var(--ht-green-50) 75%);
    background-size: 200% 100%;
    animation: ht-shimmer 1.4s linear infinite;
    transition: opacity 0.4s;
}

.chart-wrap.is-ready::before {
    opacity: 0;
    animation: none;
}

@media (max-width: 575.98px) {
    .chart-wrap {
        height: 280px;
    }
}


/* ------------------------------
   Filtro de torneo
------------------------------ */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    background: var(--ht-card);
    border: 1px solid var(--ht-border);
    border-radius: 999px;
    box-shadow: var(--ht-shadow);
    padding: 0.4rem 0.5rem 0.4rem 1.1rem;
    margin-bottom: 1.5rem;
    width: fit-content;
    max-width: 100%;
}

.filter-bar label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ht-muted);
}

.filter-bar .form-select {
    width: auto;
    min-width: 220px;
    max-width: 100%;
    border-radius: 999px;
    border-color: var(--ht-border);
    font-weight: 600;
    color: var(--ht-heading);
    background-color: var(--ht-green-50);
}

@media (max-width: 575.98px) {
    /* Más compacto que la superposición con la cabecera, para que quede dentro del verde como en escritorio */
    .filter-bar {
        width: 100%;
        flex-wrap: nowrap;
        padding: 0.35rem 0.4rem 0.35rem 1rem;
        margin-bottom: 1.25rem;
    }

    .filter-bar .form-select {
        flex: 1;
        min-width: 0;
    }
}

.form-select:focus,
.form-control:focus {
    border-color: var(--ht-green-400);
    box-shadow: 0 0 0 0.2rem rgba(67, 160, 71, 0.25);
}


/* ------------------------------
   Botones
------------------------------ */

.btn-ht {
    --bs-btn-color: var(--ht-green-950);
    --bs-btn-bg: var(--ht-gold);
    --bs-btn-border-color: var(--ht-gold);
    --bs-btn-hover-color: var(--ht-green-950);
    --bs-btn-hover-bg: #ffd24d;
    --bs-btn-hover-border-color: #ffd24d;
    --bs-btn-active-bg: var(--ht-gold-dark);
    --bs-btn-active-border-color: var(--ht-gold-dark);
    --bs-btn-disabled-bg: var(--ht-gold);
    --bs-btn-disabled-border-color: var(--ht-gold);
    --bs-btn-disabled-color: var(--ht-green-950);
    font-weight: 700;
    border-radius: 12px;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 4px 14px rgba(244, 196, 48, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-ht:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(244, 196, 48, 0.45);
}


/* ------------------------------
   Tablas
------------------------------ */

.ranking-table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: var(--ht-green-50);
    --bs-table-hover-bg: var(--ht-green-100);
    margin-bottom: 0;
    font-size: 0.92rem;
    border-collapse: separate;
    border-spacing: 0;
}

.ranking-table th {
    background: var(--ht-green-800) !important;
    color: #fff !important;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border: 0 !important;
    transition: background 0.2s;
}

.ranking-table th:hover {
    background: var(--ht-green-700) !important;
}

.ranking-table thead th:first-child {
    border-top-left-radius: 10px;
}

.ranking-table thead th:last-child {
    border-top-right-radius: 10px;
}

.ranking-table th.asc,
.ranking-table th.desc {
    color: var(--ht-gold) !important;
}

.ranking-table th.asc::after {
    content: " ▲";
    font-size: 0.65rem;
}

.ranking-table th.desc::after {
    content: " ▼";
    font-size: 0.65rem;
}

.ranking-table td,
.ranking-table th {
    padding: 0.7rem 0.75rem !important;
    vertical-align: middle !important;
    border-color: var(--ht-border) !important;
}

.ranking-table td {
    font-variant-numeric: tabular-nums;
}

/* Primera columna fija al desplazarse horizontalmente en móvil */
.ranking-table .col-sticky {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--ht-card);
    box-shadow: 1px 0 0 var(--ht-border);
}

.ranking-table tbody tr:nth-child(odd) .col-sticky {
    background: var(--ht-green-50);
}

.ranking-table th.col-sticky {
    z-index: 2;
}

/* En móvil la columna del equipo se limita y el nombre pasa a varias líneas, para dejar sitio a las estadísticas */
@media (max-width: 575.98px) {
    .ranking-table {
        font-size: 0.85rem;
    }

    .ranking-table td,
    .ranking-table th {
        padding: 0.55rem 0.5rem !important;
    }

    .ranking-table .col-sticky {
        max-width: 7.5rem;
        min-width: 6rem;
        white-space: normal;
    }

    .ranking-table .col-sticky .team-link {
        white-space: normal;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.25;
        display: inline-block;
    }
}

.team-link {
    font-weight: 600;
    color: var(--ht-heading);
    text-decoration: none;
    white-space: nowrap;
}

.team-link:hover {
    color: var(--ht-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.col-pts {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ht-heading);
}

.pct-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 110px;
}

.pct-bar .track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--ht-green-100);
    overflow: hidden;
}

.pct-bar .fill {
    height: 100%;
    width: var(--pct);
    border-radius: 3px;
    background: linear-gradient(90deg, var(--ht-green-500), var(--ht-gold));
    transform-origin: left;
    animation: ht-grow 1s 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ht-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.table-wrap {
    border-radius: 10px;
}


/* ------------------------------
   Diferencia de gol
------------------------------ */

.diff {
    font-weight: 700;
}

.diff.positive {
    color: var(--ht-win);
}

.diff.positive::before {
    content: "+";
}

.diff.negative {
    color: var(--ht-loss);
}

.diff.neutral {
    color: var(--ht-draw);
}


/* ------------------------------
   Racha / Resultados
------------------------------ */

.racha {
    white-space: nowrap;
}

.resultado {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 3px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: default;
    transition: transform 0.15s;
}

.resultado:hover {
    transform: scale(1.2);
}

.racha .resultado:last-child {
    box-shadow: 0 0 0 2px var(--ht-card), 0 0 0 3.5px var(--ht-gold);
}

.resultado-G {
    background: var(--ht-win);
}

.resultado-E {
    background: var(--ht-draw);
}

.resultado-P {
    background: var(--ht-loss);
}

.badge-pendiente {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ht-muted);
    background: var(--ht-green-100);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
}


/* ------------------------------
   Estadísticas (ficha de equipo)
------------------------------ */

.stat-card {
    background: var(--ht-card);
    border: 1px solid var(--ht-border);
    border-radius: 14px;
    box-shadow: var(--ht-shadow);
    padding: 1rem 0.75rem;
    text-align: center;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ht-shadow-hover);
}

.stat-card.stat-highlight {
    background: linear-gradient(150deg, var(--ht-green-700), var(--ht-green-900));
    border-color: transparent;
}

.stat-card.stat-highlight .stat-valor {
    color: var(--ht-gold);
}

.stat-card.stat-highlight .stat-label {
    color: rgba(255, 255, 255, 0.75);
}

.stat-valor {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ht-heading);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    margin-top: 0.35rem;
    color: var(--ht-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ht-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.ht-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
}

.ht-chip b {
    color: var(--ht-gold);
    font-weight: 600;
}


/* ------------------------------
   Head-to-Head
------------------------------ */

.h2h-picker {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 1rem;
    align-items: end;
}

.h2h-picker label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ht-muted);
    margin-bottom: 0.35rem;
}

.h2h-picker .form-select {
    border-radius: 12px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    font-weight: 600;
}

.vs-badge {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ht-green-900);
    color: var(--ht-gold);
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
}

@media (max-width: 767.98px) {
    .h2h-picker {
        grid-template-columns: 1fr;
    }

    .vs-badge {
        justify-self: center;
        width: 38px;
        height: 38px;
        margin: -0.25rem 0;
    }
}

.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    border-radius: var(--ht-radius);
    padding: 1.75rem 1.25rem;
    color: #fff;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 50px, transparent 50px 100px),
        linear-gradient(160deg, var(--ht-green-700), var(--ht-green-900));
    box-shadow: var(--ht-shadow);
    margin-bottom: 1.5rem;
    text-align: center;
}

.sb-name {
    font-weight: 700;
    font-size: 1rem;
    overflow-wrap: break-word;
    hyphens: auto;
}

.sb-num {
    font-family: "Barlow Condensed", sans-serif;
    font-size: clamp(2.8rem, 9vw, 4.2rem);
    font-weight: 800;
    line-height: 1;
    color: var(--ht-gold);
    margin: 0.35rem 0;
}

.sb-mid .sb-num {
    color: #fff;
    font-size: clamp(2rem, 6vw, 2.8rem);
}

.sb-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.sb-mid {
    padding: 0 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.sb-foot {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 0.9rem;
}

.sb-foot b {
    color: #fff;
}

@media (max-width: 575.98px) {
    .scoreboard {
        gap: 0.5rem;
        padding: 1.25rem 0.75rem;
    }

    .sb-mid {
        padding: 0 0.5rem;
    }

    .sb-name {
        font-size: 0.85rem;
    }
}

.match-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.match-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid var(--ht-border);
}

.match-item:last-child {
    border-bottom: 0;
}

.match-date {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--ht-muted);
    text-align: center;
    margin-bottom: -0.4rem;
}

.match-team {
    font-weight: 500;
    overflow-wrap: break-word;
    hyphens: auto;
    min-width: 0;
}

@media (max-width: 575.98px) {
    .match-team {
        font-size: 0.88rem;
    }

    .match-score {
        min-width: 3.4rem;
        font-size: 1.15rem;
        padding: 0.1rem 0.5rem;
    }
}

.match-team.home {
    text-align: right;
}

.match-team.winner {
    font-weight: 700;
    color: var(--ht-heading);
}

.match-score {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    background: var(--ht-green-900);
    border-radius: 8px;
    padding: 0.1rem 0.7rem;
    min-width: 4.2rem;
    text-align: center;
}

.skeleton {
    border-radius: var(--ht-radius);
    background: linear-gradient(90deg, var(--ht-green-100) 25%, var(--ht-shimmer) 50%, var(--ht-green-100) 75%);
    background-size: 200% 100%;
    animation: ht-shimmer 1.2s linear infinite;
}

.h2h-empty {
    text-align: center;
    color: var(--ht-muted);
    padding: 2.5rem 1rem;
}

.h2h-empty .ht-ball {
    width: 56px;
    height: 56px;
    color: var(--ht-green-300);
    margin-bottom: 0.75rem;
    animation: ht-bounce 1.8s ease-in-out infinite;
}

@keyframes ht-bounce {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-10px) rotate(180deg); }
}


/* ------------------------------
   Pie de página
------------------------------ */

.ht-footer {
    background: var(--ht-green-950);
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem;
    padding: 1.25rem 0;
    text-align: center;
    border-top: 3px solid var(--ht-gold);
}


/* ------------------------------
   Mensajes
------------------------------ */

.ht-flash .alert {
    border: 0;
    border-radius: 12px;
    box-shadow: var(--ht-shadow);
    margin-bottom: 0.75rem;
}


/* ------------------------------
   Importar
------------------------------ */

.estado-conexion {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.estado-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.estado-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    background: var(--ht-green-50);
    border: 1px solid var(--ht-border);
}

.estado-item::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ht-win);
}

.estado-item.off::before {
    background: var(--ht-loss);
}

.torneo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.torneo-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid var(--ht-border);
    border-radius: 14px;
    padding: 1rem;
    background: var(--ht-green-50);
    transition: transform 0.2s, box-shadow 0.2s;
}

.torneo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ht-shadow-hover);
}

.torneo-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.torneo-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--ht-green-100);
    flex-shrink: 0;
}

.torneo-nombre {
    font-weight: 700;
    color: var(--ht-heading);
    line-height: 1.2;
    overflow-wrap: break-word;
}

.torneo-meta {
    font-size: 0.8rem;
    color: var(--ht-muted);
}

.torneo-card form {
    margin-top: auto;
}

.badge-estado {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    background: var(--ht-green-100);
    color: var(--ht-heading);
}

.badge-estado.nuevo {
    background: var(--ht-gold);
    color: var(--ht-green-950);
}

.form-id {
    display: grid;
    grid-template-columns: 1fr 140px auto;
    gap: 0.75rem;
    align-items: end;
}

.form-id label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ht-muted);
    margin-bottom: 0.35rem;
}

.form-id .form-control {
    border-radius: 12px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

@media (max-width: 575.98px) {
    .form-id {
        grid-template-columns: 1fr 1fr;
    }

    .form-id .btn {
        grid-column: 1 / -1;
    }
}

.btn-ht-outline {
    --bs-btn-color: var(--ht-green-800);
    --bs-btn-border-color: var(--ht-green-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ht-green-700);
    --bs-btn-hover-border-color: var(--ht-green-700);
    --bs-btn-active-bg: var(--ht-green-800);
    --bs-btn-active-border-color: var(--ht-green-800);
    font-weight: 600;
    border-radius: 10px;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-head .ht-section-title {
    margin-bottom: 0;
}

.aviso-sin-id {
    border: 1px dashed var(--ht-gold-dark);
    background: var(--ht-aviso);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}


/* ------------------------------
   Entrar
------------------------------ */

.login-card {
    max-width: 420px;
}

.login-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ht-muted);
}

.login-input {
    border-radius: 12px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}


/* ------------------------------
   Visor de torneos
------------------------------ */

.min-w-0 {
    min-width: 0;
}

.logo-iniciales {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    color: var(--ht-gold);
    background: var(--ht-green-800);
}

.logo-iniciales img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.torneos-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

@media (max-width: 575.98px) {
    .torneos-lista {
        grid-template-columns: 1fr;
    }
}

.torneo-tile {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    background: var(--ht-card);
    border: 1px solid var(--ht-border);
    border-radius: var(--ht-radius);
    box-shadow: var(--ht-shadow);
    padding: 1.1rem;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.torneo-tile:hover {
    color: inherit;
    transform: translateY(-3px);
    box-shadow: var(--ht-shadow-hover);
    border-color: var(--ht-green-300);
}

.torneo-estado {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.torneo-campeon {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: auto;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--ht-green-800), var(--ht-green-950));
    color: #fff;
}

.torneo-campeon-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.torneo-campeon-nombre {
    font-weight: 700;
    overflow-wrap: break-word;
}

.torneo-campeon-nombre span {
    color: var(--ht-gold);
    font-weight: 600;
    white-space: nowrap;
}

.trofeo {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.trofeo-oro {
    color: var(--ht-gold);
}

.trofeo-lider {
    color: var(--ht-green-300);
}

.torneo-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.torneo-hero-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    font-size: 1.6rem;
}

@media (max-width: 575.98px) {
    .torneo-hero-logo {
        width: 56px;
        height: 56px;
    }
}

/* Podio */
.podio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: end;
    gap: 0.75rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.podio-puesto {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
    border-radius: 16px 16px 10px 10px;
    padding: 1rem 0.5rem;
    color: #fff;
    box-shadow: var(--ht-shadow);
}

.podio-1 {
    min-height: 190px;
    background: linear-gradient(170deg, var(--ht-green-600), var(--ht-green-900));
    border-top: 4px solid var(--ht-gold);
}

.podio-2 {
    min-height: 160px;
    background: linear-gradient(170deg, var(--ht-green-700), var(--ht-green-950));
    border-top: 4px solid #c9d1d6;
}

.podio-3 {
    min-height: 140px;
    background: linear-gradient(170deg, var(--ht-green-800), var(--ht-green-950));
    border-top: 4px solid #cd8a4b;
}

.podio .trofeo {
    width: 34px;
    height: 34px;
}

.podio-1 .trofeo { color: var(--ht-gold); width: 44px; height: 44px; }
.podio-2 .trofeo { color: #c9d1d6; }
.podio-3 .trofeo { color: #cd8a4b; }

.podio-pos {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.podio-equipo {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.podio-equipo:hover {
    color: var(--ht-gold);
}

.podio-pts {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 575.98px) {
    .podio {
        gap: 0.4rem;
    }

    .podio-puesto {
        padding: 0.75rem 0.3rem;
    }

    .podio-equipo {
        font-size: 0.8rem;
    }

    .podio-1 { min-height: 170px; }
    .podio-2 { min-height: 145px; }
    .podio-3 { min-height: 125px; }
}

/* Posición en la tabla */
.pos-badge {
    display: inline-grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    background: var(--ht-green-100);
    color: var(--ht-heading);
}

.pos-badge.pos-1 { background: var(--ht-gold); color: var(--ht-green-950); }
.pos-badge.pos-2 { background: #dfe5e8; color: #3a4a52; }
.pos-badge.pos-3 { background: #f0d2b4; color: #6b3f16; }

/* Rondas */
.rondas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

@media (max-width: 575.98px) {
    .rondas-grid {
        grid-template-columns: 1fr;
    }
}

.ronda {
    border: 1px solid var(--ht-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--ht-card);
}

.ronda-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.9rem;
    background: var(--ht-green-800);
    color: #fff;
}

.ronda-pendiente .ronda-head {
    background: var(--ht-green-100);
    color: var(--ht-heading);
}

.ronda-num {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.ronda-fecha {
    font-size: 0.8rem;
    opacity: 0.8;
}

.ronda-partido {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--ht-border);
    font-size: 0.88rem;
}

.ronda-partido:last-child {
    border-bottom: 0;
}

.ronda-partido .match-score {
    font-size: 1.05rem;
    min-width: 3.6rem;
    padding: 0.05rem 0.5rem;
}

.match-score.pendiente {
    background: var(--ht-green-100);
    color: var(--ht-heading);
    font-size: 0.85rem !important;
}

.goleada .match-item {
    border-bottom: 0;
    padding: 0.25rem 0;
}

/* ---------- Invictos ---------- */
.badge-invicto {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    border-radius: 999px;
    padding: 0.18rem 0.55rem 0.18rem 0.4rem;
    background: var(--ht-gold);
    color: var(--ht-green-950);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
}

.badge-invicto svg {
    width: 14px;
    height: 14px;
}

/* Solo el escudo (tabla de posiciones) */
.badge-invicto.solo {
    padding: 0.18rem;
}

.torneo-campeon .badge-invicto {
    margin-left: auto;
}

.podio .badge-invicto {
    margin-top: 0.4rem;
}

.invictos-intro {
    color: var(--ht-muted);
    margin-top: -0.4rem;
}

.invictos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}

.invicto-card {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--ht-border);
    background: linear-gradient(135deg, var(--ht-green-50), var(--ht-card));
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.invicto-card:hover {
    transform: translateY(-2px);
    border-color: var(--ht-gold);
    box-shadow: var(--ht-shadow-hover);
}

.invicto-escudo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--ht-green-700), var(--ht-green-950));
    color: var(--ht-gold);
}

.invicto-escudo svg {
    width: 28px;
    height: 28px;
}

.invicto-equipo {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    overflow-wrap: break-word;
}

.invicto-torneo {
    font-size: 0.82rem;
    color: var(--ht-muted);
}

.invicto-record {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.45rem;
}

.invicto-record .resultado {
    width: auto;
    min-width: 1.5rem;
    padding: 0 0.4rem;
    border-radius: 999px;
}

.invicto-pts {
    font-size: 0.82rem;
    font-weight: 600;
    margin-left: 0.2rem;
}

.invicto-en-curso {
    margin: 0.9rem 0 0;
    padding: 0.6rem 0.85rem;
    border-left: 3px solid var(--ht-gold);
    border-radius: 0 10px 10px 0;
    background: var(--ht-green-50);
    font-size: 0.9rem;
}

/* ---------- Tema ---------- */
.tema-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    margin-left: 0.25rem;
    padding: 0 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ht-gold);
    transition: background 0.2s, transform 0.3s;
}

.tema-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
}

.tema-toggle:active svg {
    transform: rotate(40deg);
}

.tema-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
}

.tema-toggle span {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

[data-theme="dark"] .icono-luna,
:root:not([data-theme="dark"]) .icono-sol {
    display: none;
}

@media (max-width: 767.98px) {
    .tema-toggle {
        margin: 0.4rem 0 0.2rem;
    }
}

/* ---------- Compartir ---------- */
.btn-compartir {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    cursor: pointer;
}

.btn-compartir svg {
    width: 15px;
    height: 15px;
}

/* ---------- Récords ---------- */
.chart-wrap.chart-tall {
    height: 420px;
}

.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.record-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.1rem 1.15rem;
    border-radius: var(--ht-radius);
    background: var(--ht-card);
    border: 1px solid var(--ht-border);
    box-shadow: var(--ht-shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.record-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--ht-green-600), var(--ht-gold));
}

.record-card.record-negativo::after {
    background: linear-gradient(90deg, var(--ht-loss), #f28b5b);
}

.record-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ht-shadow-hover);
}

.record-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.record-icono {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ht-green-700), var(--ht-green-950));
    color: var(--ht-gold);
}

.record-negativo .record-icono {
    background: linear-gradient(135deg, #a33434, #5a1717);
    color: #ffd2c2;
}

.record-icono svg {
    width: 20px;
    height: 20px;
}

.record-titulo {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ht-muted);
}

.record-valor {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ht-heading);
}

.record-valor small {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ht-muted);
    margin-left: 0.2rem;
}

.record-ganadores {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.record-ganadores li {
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.record-ganadores .badge-estado {
    margin-left: 0.25rem;
    vertical-align: 1px;
}

.record-detalle {
    display: block;
    font-size: 0.8rem;
    color: var(--ht-muted);
}

.record-detalle a {
    color: inherit;
}

.jugador {
    font-weight: 600;
}

.jugador-equipo {
    display: block;
    font-size: 0.75rem;
    color: var(--ht-muted);
}

/* Hat-tricks */
.hattricks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.6rem;
}

.hattrick-extra {
    display: none !important;
}

.hattricks.todos .hattrick-extra {
    display: flex !important;
}

.hattrick {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    background: var(--ht-green-50);
    border: 1px solid var(--ht-border);
}

.hattrick-goles {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ht-green-700);
    color: #fff;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
}

.hattrick-goles.poker {
    background: var(--ht-gold);
    color: var(--ht-green-950);
    box-shadow: 0 0 0 3px rgba(244, 196, 48, 0.3);
}

.hattrick-jugador {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.hattrick-jugador span {
    font-weight: 500;
    color: var(--ht-muted);
}

/* ---------- Matriz cara a cara ---------- */
.matriz-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.matriz {
    border-collapse: separate;
    border-spacing: 4px;
    width: 100%;
    min-width: 600px;
    table-layout: fixed;
}

.matriz thead th:first-child {
    width: 150px;
}

.matriz th {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ht-muted);
    text-align: center;
    padding: 0.3rem;
    vertical-align: bottom;
    line-height: 1.15;
}

.matriz th.matriz-fila {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    color: var(--ht-text);
    background: var(--ht-card);
    max-width: 150px;
    vertical-align: middle;
}

.matriz td {
    text-align: center;
    border-radius: 10px;
    padding: 0;
    min-width: 72px;
}

.matriz-celda {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0.45rem 0.25rem;
    border: 0;
    border-radius: 10px;
    background: color-mix(in srgb, var(--balance-color) calc(var(--balance) * 1%), var(--ht-green-50));
    color: var(--ht-text);
    transition: transform 0.15s, box-shadow 0.15s;
}

.matriz-celda:hover,
.matriz-celda:focus-visible {
    transform: scale(1.06);
    box-shadow: var(--ht-shadow-hover);
    outline: none;
}

.matriz-gep {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.matriz-goles {
    font-size: 0.7rem;
    opacity: 0.8;
}

.matriz-vacia {
    background: repeating-linear-gradient(135deg, var(--ht-green-50) 0 6px, transparent 6px 12px);
}

.matriz-leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--ht-muted);
}

.matriz-leyenda span::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 0.35rem;
    border-radius: 3px;
    vertical-align: -1px;
    background: var(--c);
}

/* ---------- Carrera por el título y próxima fecha ---------- */
.proxima {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cuenta-regresiva {
    display: flex;
    gap: 0.5rem;
}

.cuenta-regresiva span {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 58px;
    padding: 0.4rem 0.5rem;
    border-radius: 12px;
    background: linear-gradient(160deg, var(--ht-green-800), var(--ht-green-950));
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cuenta-regresiva b {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.7rem;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.carrera {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.carrera li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.75rem;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--ht-border);
    border-left: 4px solid var(--estado, var(--ht-border));
    background: var(--ht-card);
}

.carrera .estado-campeon { --estado: var(--ht-gold); background: color-mix(in srgb, var(--ht-gold) 12%, var(--ht-card)); }
.carrera .estado-depende { --estado: var(--ht-green-500); }
.carrera .estado-opciones { --estado: #e0a020; }
.carrera .estado-fuera { --estado: var(--ht-draw); opacity: 0.75; }

.carrera-equipo {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.carrera-necesita {
    grid-column: 1;
    font-size: 0.82rem;
    color: var(--ht-muted);
}

.carrera-pts {
    grid-row: 1 / span 2;
    grid-column: 2;
    text-align: right;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ht-heading);
    line-height: 1;
}

.carrera-pts small {
    display: block;
    font-family: "Inter", sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ht-muted);
}

.proximos-partidos .ronda-partido {
    padding: 0.55rem 0;
}

/* ---------- Perfil de equipo ---------- */
.titulos-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.titulo-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem 0.35rem 0.45rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ht-gold) 18%, var(--ht-card));
    border: 1px solid color-mix(in srgb, var(--ht-gold) 55%, transparent);
    color: var(--ht-text);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: transform 0.15s;
}

.titulo-chip:hover {
    transform: translateY(-2px);
    color: var(--ht-text);
}

.titulo-chip .trofeo {
    width: 20px;
    height: 20px;
    color: var(--ht-gold-dark);
}

.campana-pos {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
}

/* ---------- Búsqueda de torneos ---------- */
.form-busqueda {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

@media (max-width: 575.98px) {
    .form-busqueda {
        grid-template-columns: 1fr 1fr;
    }

    .form-busqueda .btn {
        grid-column: 1 / -1;
    }
}

.equipos-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.equipos-chips span {
    font-size: 0.72rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--ht-green-100);
    color: var(--ht-heading);
}

.equipos-chips .externo {
    background: transparent;
    border: 1px dashed var(--ht-border);
    color: var(--ht-muted);
}

.goleadores-torneo {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.5rem 1rem;
}

.goleadores-torneo li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    background: var(--ht-green-50);
}

.goleadores-torneo .min-w-0 {
    flex: 1;
}

.goleador-goles {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ht-heading);
}

.trofeo.trofeo-mini {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
}

.trofeo.chip-trofeo {
    width: 16px;
    height: 16px;
    vertical-align: -2px;
}

/* Que la barra fija no tape la tarjeta al desplazarse hasta ella */
.ht-card {
    scroll-margin-top: 84px;
}

@media (max-width: 575.98px) {
    .matriz thead th:first-child {
        width: 104px;
    }

    .matriz th.matriz-fila {
        font-size: 0.72rem;
    }
}


/* ------------------------------
   Alineaciones, partidos y jugadores
------------------------------ */

a.jugador {
    display: block;
    color: var(--ht-text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.jugador:hover,
.hattrick-jugador a:hover {
    color: var(--ht-link);
    text-decoration: underline;
}

.hattrick-jugador a {
    color: inherit;
    text-decoration: none;
}

.goleador-goles small {
    font-size: 0.8rem;
    color: var(--ht-gold-dark);
    margin-left: 1px;
}

/* Marcador en la cabecera del partido */
.marcador {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0 0.25rem;
}

.marcador-equipo {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3.5vw, 2.1rem);
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    text-align: right;
    overflow-wrap: anywhere;
}

.marcador-equipo.visita {
    text-align: left;
}

.marcador-equipo.ganador {
    color: #fff;
}

.marcador-equipo:hover {
    color: var(--ht-gold);
}

.marcador-goles {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: clamp(2.6rem, 8vw, 4.2rem);
    line-height: 1;
    padding: 0.2rem 1.1rem;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    white-space: nowrap;
}

.marcador-goles i {
    font-style: normal;
    color: var(--ht-gold);
    margin: 0 0.3rem;
}

@media (max-width: 575.98px) {
    .marcador {
        gap: 0.5rem;
    }

    .marcador-goles {
        padding: 0.15rem 0.6rem;
    }
}

/* Cancha: grilla de 5 carriles; la de partido tiene 8 filas (4 por equipo), la media cancha 4 */
.cancha {
    --cancha-linea: rgba(255, 255, 255, 0.38);
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem 0.2rem;
    padding: 1.1rem 0.5rem;
    border-radius: 14px;
    overflow: hidden;
    isolation: isolate;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0 calc(100% / 8), transparent calc(100% / 8) calc(100% / 4)),
        linear-gradient(180deg, #2f8a34, #23702a);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.cancha-completa {
    grid-template-rows: repeat(8, minmax(68px, auto));
}

.cancha-media {
    grid-template-rows: repeat(4, minmax(82px, auto));
}

/* Borde de la cancha y línea central (o línea de fondo en la media cancha) */
.cancha::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px solid var(--cancha-linea);
    border-radius: 4px;
    z-index: -1;
}

.cancha-completa::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border: 2px solid var(--cancha-linea);
    border-radius: 50%;
    z-index: -1;
}

/* Línea de medio campo, de borde a borde */
.cancha-completa {
    background:
        linear-gradient(var(--cancha-linea), var(--cancha-linea)) center / calc(100% - 16px) 2px no-repeat,
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0 calc(100% / 8), transparent calc(100% / 8) calc(100% / 4)),
        linear-gradient(180deg, #2f8a34, #23702a);
}

.cancha-media::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    width: 24%;
    aspect-ratio: 2;
    transform: translate(-50%, -50%);
    border: 2px solid var(--cancha-linea);
    border-radius: 50%;
    z-index: -1;
}

.cancha-area {
    position: absolute;
    left: 50%;
    width: 46%;
    height: 11%;
    transform: translateX(-50%);
    border: 2px solid var(--cancha-linea);
    z-index: -1;
}

.cancha-area.arriba {
    top: 8px;
    border-top: 0;
}

.cancha-area.abajo {
    bottom: 8px;
    border-bottom: 0;
}

.cancha-media .cancha-area {
    height: 20%;
}

.cancha-leyenda {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--ht-heading);
    margin: 0.35rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cancha-leyenda span::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: 0;
}

.leyenda-local::before { background: var(--ht-green-600); box-shadow: 0 0 0 2px #fff inset; }
.leyenda-visita::before { background: var(--ht-gold); }

@keyframes ficha-entra {
    from { opacity: 0; transform: scale(0.4) translateY(10px); }
    to { opacity: 1; transform: none; }
}

.ficha {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    text-decoration: none;
    color: #fff;
    animation: ficha-entra 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: calc(var(--i, 0) * 45ms + 250ms);
}

.ficha-camiseta {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1;
    background: var(--ht-green-900);
    border: 2px solid #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.ficha-camiseta small {
    position: absolute;
    bottom: 3px;
    font-size: 0.5rem;
    color: var(--ht-gold);
}

.ficha-visita .ficha-camiseta {
    background: var(--ht-gold);
    color: var(--ht-green-950);
    border-color: var(--ht-green-950);
}

.ficha-visita .ficha-camiseta small {
    color: var(--ht-green-800);
}

.ficha:hover .ficha-camiseta {
    transform: scale(1.12);
}

.ficha-nombre {
    max-width: 100%;
    margin-top: 0.2rem;
    padding: 0 0.3rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ficha-detalle {
    max-width: 100%;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ficha-capitan,
.ficha-goles,
.ficha-tarjeta {
    position: absolute;
    display: grid;
    place-items: center;
    font-family: "Inter", sans-serif;
    font-size: 0.55rem;
    font-weight: 800;
}

.ficha-capitan {
    top: -5px;
    left: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    color: var(--ht-green-900);
}

.ficha-goles {
    top: -6px;
    right: -9px;
    display: flex;
    align-items: center;
    padding: 1px 3px 1px 1px;
    border-radius: 9px;
    background: #fff;
    color: #111;
}

.ficha-goles .balon {
    width: 13px;
    height: 13px;
}

.ficha-tarjeta {
    bottom: -3px;
    right: -5px;
    width: 9px;
    height: 13px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.ficha-tarjeta.amarilla,
.tarjeta-icono.amarilla { background: #ffd23f; }
.ficha-tarjeta.roja,
.tarjeta-icono.roja { background: #e53935; }

.tarjeta-icono {
    display: inline-block;
    width: 9px;
    height: 13px;
    border-radius: 2px;
    vertical-align: -2px;
    margin: 0 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.balon {
    width: 1em;
    height: 1em;
}

.balon-mini {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    color: var(--ht-heading);
    margin-left: 2px;
}

.mini-badge {
    display: inline-grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    background: var(--ht-gold);
    color: var(--ht-green-950);
    vertical-align: 1px;
    margin-left: 2px;
}

/* Posición: color según la línea */
.pos-chip {
    display: inline-block;
    min-width: 2.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.03em;
}

.pos-chip.linea-0 { background: var(--ht-gold); color: var(--ht-green-950); }
.pos-chip.linea-1 { background: var(--ht-green-800); color: #fff; }
.pos-chip.linea-2 { background: var(--ht-green-600); color: #fff; }
.pos-chip.linea-3 { background: var(--ht-green-300); color: var(--ht-green-950); }

@media (max-width: 575.98px) {
    .cancha {
        padding: 0.9rem 0.2rem;
        gap: 0.3rem 0.1rem;
    }

    .cancha-completa {
        grid-template-rows: repeat(8, minmax(60px, auto));
    }

    .ficha-camiseta {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .ficha-nombre {
        font-size: 0.64rem;
    }
}

/* Comparación local / visita (HatStats, posesión, ocasiones) */
.comparacion {
    display: grid;
    gap: 0.6rem;
}

.comparacion-fila {
    display: grid;
    grid-template-columns: 3.2rem 1fr 3.2rem;
    align-items: center;
    gap: 0.6rem;
}

.comparacion-valor {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--ht-heading);
}

.comparacion-valor:last-child {
    text-align: right;
}

.comparacion-label {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ht-muted);
    margin-bottom: 0.2rem;
}

.comparacion-barra {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--ht-green-100);
}

.comparacion-barra .lado-local {
    width: var(--a);
    background: var(--ht-green-600);
    animation: ht-grow-x 1s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
    transform-origin: left;
}

.comparacion-barra .lado-visita {
    flex: 1;
    background: var(--ht-gold);
    animation: ht-grow-x 1s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
    transform-origin: right;
}

@keyframes ht-grow-x {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* Cronología: local a la izquierda, visita a la derecha (en móvil, todos a la izquierda) */
.cronologia {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    display: grid;
    gap: 0.4rem;
}

.cronologia::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ht-border);
    transform: translateX(-50%);
}

.evento {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    width: calc(50% + 1.6rem);
    animation: ht-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 60ms + 200ms);
}

.evento.lado-local {
    text-align: right;
}

.evento.lado-local .evento-texto { order: 1; }
.evento.lado-local .evento-icono { order: 2; }
.evento.lado-local .evento-minuto { order: 3; }

.evento.lado-visita {
    margin-left: calc(50% - 1.6rem);
    grid-template-columns: auto auto 1fr;
}

.evento-minuto {
    display: grid;
    place-items: center;
    width: 3.2rem;
    height: 1.8rem;
    border-radius: 999px;
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1rem;
    background: var(--ht-card);
    border: 2px solid var(--ht-border);
    color: var(--ht-heading);
    z-index: 1;
}

.evento-gol .evento-minuto {
    background: var(--ht-green-600);
    border-color: var(--ht-green-600);
    color: #fff;
}

.evento-icono {
    display: grid;
    place-items: center;
    width: 1.4rem;
    color: var(--ht-heading);
}

.evento-icono svg {
    width: 18px;
    height: 18px;
}

.evento-cambio .evento-icono {
    color: var(--ht-green-500);
}

.evento-texto {
    min-width: 0;
    font-size: 0.9rem;
}

.evento-texto a {
    color: var(--ht-text);
    font-weight: 600;
    text-decoration: none;
}

.evento-texto a:hover {
    color: var(--ht-link);
    text-decoration: underline;
}

.evento-texto small {
    color: var(--ht-muted);
    margin: 0 0.2rem;
}

.evento-texto .evento-equipo {
    display: block;
    margin: 0;
    font-size: 0.7rem;
}

.evento-marcador {
    display: inline-block;
    margin: 0 0.3rem;
    padding: 0 0.4rem;
    border-radius: 6px;
    background: var(--ht-green-100);
    color: var(--ht-heading);
    font-family: "Barlow Condensed", sans-serif;
    font-size: 1rem;
}

@media (max-width: 767.98px) {
    .cronologia::before {
        left: 1.6rem;
    }

    .evento,
    .evento.lado-local,
    .evento.lado-visita {
        width: 100%;
        margin-left: 0;
        grid-template-columns: auto auto 1fr;
        text-align: left;
    }

    .evento.lado-local .evento-texto { order: 3; }
    .evento.lado-local .evento-icono { order: 2; }
    .evento.lado-local .evento-minuto { order: 1; }

    .evento.lado-visita .evento-minuto {
        border-color: var(--ht-gold);
    }
}

/* Partidos con ficha: toda la fila enlaza al partido */
.ronda-partido.con-ficha {
    position: relative;
    transition: background-color 0.15s ease;
}

.ronda-partido.con-ficha:hover {
    background: var(--ht-green-50);
}

.partido-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.marcador-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid var(--ht-gold);
}

.marcador-link:hover {
    color: var(--ht-link);
}

/* Jugador: mejor partido */
.mejor-partido {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background:
        radial-gradient(circle at 0 50%, rgba(244, 196, 48, 0.22), transparent 55%),
        var(--ht-card);
}

.mejor-partido-estrellas {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--ht-gold);
    color: var(--ht-green-950);
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 2.2rem;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(201, 154, 18, 0.35);
}

.mejor-partido-estrellas small {
    font-size: 0.9rem;
    margin-top: -0.6rem;
}

.mejor-partido-texto {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--ht-text);
    text-decoration: none;
}

.mejor-partido-texto:hover {
    color: var(--ht-link);
}

/* Equipo: formaciones */
.formaciones {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}

.formaciones li {
    display: grid;
    grid-template-columns: 3.4rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
}

.formacion-nombre {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--ht-heading);
}

.formacion-barra {
    height: 10px;
    border-radius: 5px;
    background: var(--ht-green-100);
    overflow: hidden;
}

.formacion-barra span {
    display: block;
    width: var(--w);
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--ht-green-600), var(--ht-green-400));
    transform-origin: left;
    animation: ht-grow-x 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 80ms + 300ms);
}

.formacion-datos {
    font-size: 0.8rem;
    color: var(--ht-muted);
    white-space: nowrap;
}

.records-subtitulo {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--ht-heading);
    margin: 0.5rem 0 1rem;
}

/* Tablas largas: solo las primeras filas hasta pulsar "Ver todos" */
.tabla-recortada:not(.todos) tbody tr:nth-child(n+21) {
    display: none;
}
