/* Figura marcada (azul) */
.figure-cell.figure-marked {
    background: #2196f3 !important;
    border: 2px solid #1976d2 !important;
    box-shadow: 0 0 5px #1976d2;
}

.figure-cell.figure-marked .figure-img {
    filter: brightness(1.1) drop-shadow(0 0 4px #1976d2);
}

/* Figura ganadora (amarillo) */
.figure-cell.figure-winner {
    background: #ffe082 !important;
    border: 2px solid #ffc107 !important;
    box-shadow: 0 0 6px #ffc107;
}

.figure-cell.figure-winner .figure-img {
    filter: brightness(1.2) drop-shadow(0 0 2px #ffc107);
}

@media (max-width: 900px) {
    .bingo-cards-vertical {
        grid-template-columns: 1fr !important;
        gap: 1.2rem !important;
    }

    .bingo-cards-vertical .bingo-card {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .bingo-card-figures-grid {
        padding: 4px 0 !important;
    }

    .figure-side {
        border-radius: 6px !important;
        margin: 0 1px !important;
    }

    .figure-block {
        padding: 1px 2px 1px 2px !important;
    }

    .figure-cell {
        width: 36px !important;
        height: 36px !important;
        margin: 0.5px !important;
    }

    .figure-img {
        width: 34px !important;
        height: 34px !important;
        margin: 0 auto 0.5px auto !important;
    }
}

/* Móvil pequeño (≤480px): celdas aún más compactas para caber en 375px */
@media (max-width: 480px) {
    .bingo-card {
        padding: 0.5rem !important;
        box-sizing: border-box !important;
    }

    .bingo-cards-vertical .bingo-card {
        max-width: 100% !important;
        width: 100% !important;
    }

    .bingo-card-figures-grid {
        padding: 2px 0 !important;
        gap: 4px !important;
    }

    .figure-side {
        margin: 0 !important;
    }

    .figure-block {
        padding: 0px 1px !important;
        gap: 0 !important;
    }

    .figure-cell {
        width: 30px !important;
        height: 30px !important;
        margin: 0.3px !important;
        border-radius: 4px !important;
    }

    .figure-img {
        width: 28px !important;
        height: 28px !important;
        margin: 0 auto !important;
    }

    .figure-name {
        font-size: 0.55em !important;
        min-height: 10px !important;
        max-width: 30px !important;
    }

    /* Header BINGO también más compacto */
    .bingo-header-cell {
        font-size: 1rem !important;
        padding: 0.35rem 0 !important;
        min-height: 36px !important;
    }

    /* Nombre del cartón */
    .bingo-card > div:first-child,
    .card-title {
        font-size: 0.8rem !important;
    }
}


.bingo-cards-vertical {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
}

.bingo-cards-vertical-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 0;
    grid-column: span 1;
}

.bingo-cards-vertical .bingo-card {
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.bingo-card-figures-grid {
    display: flex;
    flex-direction: row;
    /* Usar space-between para que los dos lados se distribuyan
       simétricamente y ocupen el mismo ancho que el header BINGO */
    justify-content: space-between;
    align-items: stretch;
    gap: 8px;
    margin: 0.5rem 0;
    border-left: 3px solid #fe7c79;
    border-right: 3px solid #ffd746;
    border-radius: 12px;
    background: #f7f7f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 8px 4px;
    box-sizing: border-box;
    width: 100%;
}

.figure-side {
    display: flex;
    flex-direction: column;
    /* Cada lado crece igual para cubrir exactamente la mitad del ancho */
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 0.1rem;
    border: 2px solid #201d1d;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.figure-block {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    border-bottom: 2px solid #201d1d;
    padding: 2px 4px 2px 4px;
    width: 100%;
    align-items: center;
    box-sizing: border-box;
}

/* Asegurar que padding/bordes no sumen ancho extra (evita recorte de las celdas) */
.bingo-card-figures-grid,
.figure-side,
.figure-row,
.figure-cell,
.figure-img { box-sizing: border-box; }

.figure-block:last-child {
    border-bottom: none;
}

.figure-row {
    display: flex;
    flex-direction: row;
    gap: 0.3rem;
    justify-content: center;
    /* Ocupar todo el ancho disponible para que las celdas puedan repartirse y encoger */
    width: 100%;
}

.figure-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Celdas flexibles: se reparten el ancho del lado y encogen si el contenedor es angosto
       (p. ej. con la barra de miembros desplegada), con tope de 54px cuando hay espacio. */
    flex: 1 1 0;
    min-width: 0;
    max-width: 54px;
    aspect-ratio: 1 / 1;
    height: auto;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin: 0;
    padding: 0;
    position: relative;
    box-sizing: border-box;
}

.figure-cell.empty {
    background: transparent;
    box-shadow: none;
}

.figure-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

.figure-name {
    font-size: 0.78em;
    color: #02515a;
    margin-top: 1px;
    text-align: center;
    word-break: break-word;
    line-height: 1.1;
    max-width: 48px;
    min-height: 14px;
    overflow: hidden;
    white-space: normal;
}