.ligas-v2 {
    --ligas-panel: #111e32;
    --ligas-linea: #30425d;
    --ligas-texto: #f3f6fc;
    --ligas-secundario: #b7c6db;
    padding: clamp(1rem, 3vw, 2rem);
    border-radius: .75rem;
    background: #0b1220;
    color: var(--ligas-texto);
}

.ligas-v2-aviso {
    padding: .85rem 1rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: .75rem;
    color: var(--muted-dark, #c0cbdf);
}

.ligas-v2-cuadricula {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: 1rem;
}

.ligas-v2-tarjeta,
.ligas-v2-destacados {
    padding: 1rem;
    border: 1px solid var(--ligas-linea);
    border-radius: .75rem;
    background: var(--ligas-panel);
    min-width: 0;
}

.ligas-v2-tarjeta {
    padding: .85rem;
    border-color: var(--ligas-filo);
    border-top: 3px solid var(--ligas-metal);
    background: linear-gradient(155deg, var(--ligas-superficie), var(--ligas-fondo-profundo) 82%);
}

.ligas-v2-oro {
    --ligas-metal: #ffd67e;
    --ligas-reflejo: #fff3c8;
    --ligas-sombra: #ad741f;
    --ligas-superficie: #382919;
    --ligas-fondo-profundo: #20180f;
    --ligas-filo: rgb(255 205 106 / .36);
}

.ligas-v2-plata {
    --ligas-metal: #d8e4f1;
    --ligas-reflejo: #f9fcff;
    --ligas-sombra: #8294a8;
    --ligas-superficie: #2b3746;
    --ligas-fondo-profundo: #181f29;
    --ligas-filo: rgb(213 229 246 / .36);
}

.ligas-v2-bronce {
    --ligas-metal: #ecb08a;
    --ligas-reflejo: #ffead9;
    --ligas-sombra: #a4613d;
    --ligas-superficie: #392722;
    --ligas-fondo-profundo: #241815;
    --ligas-filo: rgb(234 168 126 / .36);
}

.ligas-v2-tarjeta h3 {
    margin: 0 0 .65rem;
    color: var(--ligas-metal);
}

.ligas-v2-podio {
    display: grid;
    gap: .45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ligas-v2-medallista {
    display: grid;
    grid-template-columns: 2rem clamp(3.2rem, 5vw, 3.8rem) minmax(0, 1fr);
    gap: .5rem;
    align-items: center;
    min-width: 0;
    padding: .45rem;
    border: 1px solid var(--ligas-filo);
    border-radius: .55rem;
    background: linear-gradient(105deg, var(--ligas-superficie), var(--ligas-fondo-profundo) 90%);
}

.ligas-v2-medallista[value="1"] {
    box-shadow: inset 0 1px 0 var(--ligas-filo);
}

.ligas-v2-medalla {
    display: grid;
    place-items: center;
    position: relative;
    isolation: isolate;
    aspect-ratio: .8;
    clip-path: polygon(0 11%, 50% 0, 100% 11%, 100% 72%, 50% 100%, 0 72%);
    background: linear-gradient(145deg, var(--ligas-reflejo), var(--ligas-metal) 42%, var(--ligas-sombra));
    color: #241a13;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 0 var(--ligas-reflejo);
}

.ligas-v2-medalla::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 3px;
    clip-path: inherit;
    background: linear-gradient(150deg, rgb(255 255 255 / .42), transparent 58%);
}

.ligas-v2-medallista[value="1"] .ligas-v2-medalla {
    filter: brightness(1.12);
}

.ligas-v2-medallista .ligas-v2-retrato {
    border: 1px solid var(--ligas-filo);
    border-radius: .42rem;
    background: var(--ligas-superficie);
}

.ligas-v2-ficha {
    position: relative;
    isolation: isolate;
    display: grid;
    align-content: center;
    gap: .28rem;
    align-self: stretch;
    min-width: 0;
    overflow: hidden;
}

.ligas-v2-emblema {
    position: absolute;
    z-index: -1;
    inset: auto auto 50% 0;
    transform: translateY(50%);
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
    opacity: .20;
    pointer-events: none;
}

.ligas-v2-apodo {
    color: var(--ligas-reflejo);
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.ligas-v2-resultado {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .15rem .65rem;
    font-size: .84rem;
    font-variant-numeric: tabular-nums;
}

.ligas-v2-medallista .ligas-v2-nivel {
    color: var(--ligas-reflejo);
}

.ligas-v2-marcador {
    color: var(--ligas-metal);
    font-weight: 800;
}

.ligas-v2-marcador small {
    font-size: .75em;
}

.ligas-v2-destacados {
    margin-top: 1rem;
}

.ligas-v2-vacio {
    color: var(--ligas-secundario);
}

.ligas-v2-lista {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ligas-v2-retrato {
    display: block;
    position: relative;
    flex: 0 0 2.8rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #233550;
}

.ligas-v2-retrato img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ligas-v2-retrato .ligas-v2-parche {
    inset: auto -12% -12% auto;
    width: 44%;
    height: 44%;
}

.ligas-v2-destacados .ligas-v2-lista {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: .75rem;
}

.ligas-v2-carta {
    --ligas-carta-acento: #f7d486;
    --ligas-color-rango: 125 164 230;
    width: min(100%, 20rem);
    min-width: 0;
    margin-inline: auto;
}

.ligas-v2-carta-soporte {
    position: relative;
    aspect-ratio: 5 / 7;
    perspective: 1050px;
}

.ligas-v2-carta-escena,
.ligas-v2-carta-caras {
    height: 100%;
}

.ligas-v2-carta-caras {
    display: grid;
}

.ligas-v2-cara {
    position: relative;
    isolation: isolate;
    min-width: 0;
    padding: 1rem 1rem 2.45rem;
    border: 1px solid #485b79;
    border-radius: .95rem;
    background: linear-gradient(150deg, #1d2d49, #10182a 65%, #20283a);
    box-shadow: inset 0 0 0 3px rgb(124 161 215 / .065), 0 .45rem 1rem rgb(0 0 0 / .26);
    overflow: hidden;
}

.ligas-v2-revelada {
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    align-items: center;
    gap: .7rem;
    background:
        radial-gradient(ellipse at 24% 17%, rgb(var(--ligas-color-rango) / .36), transparent 64%),
        radial-gradient(ellipse at 91% 87%, rgb(var(--ligas-color-rango) / .21), transparent 56%),
        linear-gradient(155deg, #1a263b, #0d1426 76%);
}

.ligas-v2-carta-rango {
    position: absolute;
    z-index: -1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: .23;
    pointer-events: none;
}

.ligas-v2-carta-nombre {
    position: relative;
    width: calc(100% - .55rem);
    margin: .25rem .55rem 0 0;
    padding: .65rem 2.65rem .65rem .85rem;
    border: 1px solid rgb(var(--ligas-color-rango) / .65);
    border-radius: 999px;
    background: rgb(9 17 34 / .83);
    overflow-wrap: anywhere;
    font-size: clamp(1rem, 3.2vw, 1.17rem);
    line-height: 1.15;
}

.ligas-v2-carta-nivel {
    position: absolute;
    inset: 50% -.55rem auto auto;
    transform: translateY(-50%);
    display: grid;
    place-content: center;
    gap: .05rem;
    width: 3rem;
    aspect-ratio: 1;
    text-align: center;
    line-height: 1;
    border: 1px solid rgb(var(--ligas-color-rango) / .86);
    border-radius: 50%;
    background: linear-gradient(140deg, rgb(var(--ligas-color-rango) / .42), #131e35 62%), #131e35;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 .25rem .7rem rgb(0 0 0 / .34);
}

.ligas-v2-carta-nivel small {
    font-size: .63rem;
}

.ligas-v2-carta-nivel abbr {
    text-decoration: none;
}

.ligas-v2-carta-nivel b {
    font-size: 1rem;
}

.ligas-v2-carta-retrato {
    width: clamp(6.75rem, 25vw, 9.3rem);
    padding: .4rem;
    border: 1px solid rgb(var(--ligas-color-rango) / .55);
    border-radius: 50%;
    background: radial-gradient(circle, rgb(var(--ligas-color-rango) / .28) 40%, rgb(12 22 41 / .65) 68%, transparent 69%);
    box-shadow: 0 0 1.45rem rgb(var(--ligas-color-rango) / .22);
}

.ligas-v2-carta-retrato .ligas-v2-retrato {
    width: 100%;
    background: transparent;
}

.ligas-v2-dorso {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    clip-path: polygon(
        8% 1.1%, 92% 1.1%, 94% 1.85%, 96.3% 3.6%, 97.5% 4.5%,
        98.2% 5.9%, 98.2% 92%, 98% 94.2%, 97% 95.5%, 95% 96.9%, 93.4% 98%,
        92% 98.5%, 8% 98.5%, 6.5% 98%, 4.7% 96.9%, 2.6% 95.5%, 1.65% 94.2%,
        1.5% 92%, 1.5% 5.9%, 2.2% 4.5%, 3.4% 3.6%, 5.8% 1.85%
    );
}

.ligas-v2-dorso img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ligas-v2-carta-estadisticas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, 1fr);
    gap: .55rem;
    margin: 0;
    width: 100%;
}

.ligas-v2-metrica {
    display: grid;
    place-content: center;
    gap: .25rem;
    min-width: 0;
    padding: .55rem .4rem;
    text-align: center;
    overflow-wrap: anywhere;
    border: 1px solid rgb(141 168 207 / .22);
    border-radius: .58rem;
    background: rgb(10 20 38 / .78);
}

.ligas-v2-metrica:nth-child(3):last-child {
    grid-column: 1 / -1;
}

.ligas-v2-metrica dt {
    color: var(--ligas-secundario);
    font-size: .79rem;
}

.ligas-v2-metrica dd {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.ligas-v2-metrica-aciertos dd { color: #82dbff; }
.ligas-v2-metrica-nota dd { color: #d3b9ff; }
.ligas-v2-metrica-porcentaje dd { color: #a7efba; }
.ligas-v2-metrica-prestigio dd { color: var(--ligas-carta-acento); }

.ligas-v2-carta[data-interactiva] .ligas-v2-carta-escena,
.ligas-v2-carta[data-interactiva] .ligas-v2-carta-caras {
    transform-style: preserve-3d;
}

.ligas-v2-carta[data-interactiva] .ligas-v2-carta-escena {
    transition: transform .22s ease-out;
}

.ligas-v2-carta[data-interactiva] .ligas-v2-carta-caras {
    gap: 0;
    transition: transform .55s cubic-bezier(.3, .7, .24, 1);
}

.ligas-v2-carta[data-interactiva] .ligas-v2-cara {
    grid-area: 1 / 1;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.ligas-v2-carta[data-interactiva] .ligas-v2-revelada,
.ligas-v2-carta[data-girada] .ligas-v2-carta-caras {
    transform: rotateY(180deg);
}

.ligas-v2-carta[data-interactiva] .ligas-v2-revelada {
    display: grid;
}

.ligas-v2-carta-giro {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: .95rem;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}

.ligas-v2-carta-giro[hidden] {
    display: none;
}

.ligas-v2-carta-giro:focus-visible {
    outline: 2px solid var(--ligas-carta-acento);
    outline-offset: 3px;
}

.ligas-v2-carta-invitacion {
    position: absolute;
    inset: auto 9% 8%;
    padding: .55rem .65rem;
    border: 1px solid rgb(240 220 171 / .52);
    border-radius: 999px;
    background: rgb(9 18 37 / .79);
    color: #fff3d4;
    backdrop-filter: blur(7px);
    font-size: .8rem;
    font-weight: 800;
}

.ligas-v2-carta-volver {
    position: absolute;
    inset: auto .8rem .57rem auto;
    display: grid;
    place-items: center;
    width: 1.5rem;
    aspect-ratio: 1;
    border: 1px solid rgb(149 181 226 / .32);
    border-radius: 50%;
    background: #23324f;
    color: #dceaff;
    font-size: 1rem;
    line-height: 1;
}

.ligas-v2-carta-giro[aria-expanded="false"] .ligas-v2-carta-volver,
.ligas-v2-carta-giro[aria-expanded="true"] .ligas-v2-carta-invitacion {
    display: none;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .ligas-v2-carta[data-interactiva]:hover {
        z-index: 2;
    }

    .ligas-v2-carta[data-interactiva] .ligas-v2-carta-soporte:hover .ligas-v2-carta-escena {
        transform: translateY(-.35rem) rotateX(var(--ligas-inclinacion-x, 0deg)) rotateY(var(--ligas-inclinacion-y, 0deg));
    }

    .ligas-v2-carta[data-interactiva] .ligas-v2-carta-soporte:hover .ligas-v2-revelada {
        border-color: #8caadd;
        box-shadow: inset 0 0 0 3px rgb(145 177 227 / .09), 0 .8rem 1.65rem rgb(0 0 0 / .4);
    }

    .ligas-v2-carta[data-interactiva] .ligas-v2-cara::after {
        content: "";
        position: absolute;
        z-index: 1;
        inset: 0;
        background: radial-gradient(circle at var(--ligas-luz-x, 50%) var(--ligas-luz-y, 50%), rgb(174 207 255 / .26), transparent 60%);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease-out;
    }

    .ligas-v2-carta[data-interactiva] .ligas-v2-carta-soporte:hover .ligas-v2-cara::after {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ligas-v2-carta[data-interactiva] .ligas-v2-carta-caras,
    .ligas-v2-carta[data-interactiva] .ligas-v2-revelada {
        transform: none;
        transition: none;
    }

    .ligas-v2-carta[data-interactiva] .ligas-v2-cara[aria-hidden="true"] {
        visibility: hidden;
    }
}

@media (max-width: 640px) {
    .ligas-v2-titulo {
        font-size: clamp(1rem, 5vw, 1.3rem);
        line-height: 1.2;
    }

    .ligas-v2-cuadricula,
    .ligas-v2-destacados .ligas-v2-lista {
        grid-template-columns: minmax(0, 1fr);
    }
}
