.escalador-fc-container { 
    position: relative; 
    margin: 20px auto;
    max-width: 900px; 
    font-family: sans-serif;
}

.escalacao-campo-wrapper {
    position: relative;
    width: 100%;
}

#escalacao-campo {
    position: relative;
    width: 100%;
    aspect-ratio: 1024 / 768;
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.player-slot {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #b81414;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.8);
    /* Otimização INP: usar apenas transform para animação (GPU accelerated) */
    transition: transform 0.15s ease-out;
    user-select: none;
    touch-action: manipulation;
    /* Otimização INP: promove para própria camada de composição */
    will-change: transform;
    contain: layout style;
}

.player-slot .slot-indicator,
.player-slot .player-info .player-name, 
.player-slot .player-info img.player-photo { 
    pointer-events: none; 
}

.player-slot:hover {
    transform: scale(1.05);
}

.player-slot .slot-indicator {
    font-size: 36px;
    font-weight: lighter;
    line-height: 1;
    display: block;
}

.player-slot.filled .slot-indicator {
    display: none;
}

.player-slot .player-info {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.player-slot.filled .player-info {
    display: flex;
}

.player-slot .player-info img.player-photo {
    width: 65px; /* Foto no Desktop */
    height: 65px;/* Foto no Desktop */
    border-radius: 20%; /* Foto quadrada no Desktop */
    object-fit: cover;
}

.player-slot .player-info .player-name {
    font-size: 14px;
    line-height: 1.2;
    color: white;
    background-color: #000;
    padding: 2px 4px;
    border-radius: 8px;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-slot.dragging-source,
.player-slot.dragging-active { 
    opacity: 0.5;
    touch-action: none; 
}

.dragging-helper { 
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    transform: scale(1.05);
    touch-action: none; 
}

#jogador-select-modal {
    display: none;
    position: absolute;
    z-index: 1001;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border-radius: 6px;
    width: 330px;
}

#jogador-select-modal.is-visible {
    display: block;
}

#jogador-select-modal h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    font-size: 16px;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border-bottom: 1px solid #dddddd;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
	color: #000000; 
}

#jogador-select-modal .close-modal {
    font-size: 22px;
    color: #888;
    cursor: pointer;
    padding: 0 5px;
    font-weight: bold;
    text-decoration: none;
}
#jogador-select-modal .close-modal:hover {
    color: #333;
}

#jogador-select-modal #jogador-search-input {
    width: calc(100% - 30px);
    margin: 15px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    color: #000000; 
}

#jogador-select-modal #jogador-search-input::placeholder {
    color: #332f2f;
    opacity: 1;   
}

#jogador-select-modal #jogador-list {
    padding: 0 15px 15px 15px;
    max-height: 250px;
    overflow-y: auto;
    /* Otimização INP: content-visibility para renderização sob demanda */
    content-visibility: auto;
    contain-intrinsic-size: 0 250px;
}

#jogador-select-modal .jogador-item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    /* Otimização INP: transição mais curta */
    transition: background-color 0.1s ease;
    contain: layout style;
}
#jogador-select-modal .jogador-item:last-child {
    border-bottom: none;
}
#jogador-select-modal .jogador-item:hover {
    background-color: #f7f5e9;
}
#jogador-select-modal .jogador-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f0f0f0;
    color: #888;
}
#jogador-select-modal .jogador-item.disabled:hover {
    background-color: #f0f0f0;
}
#jogador-select-modal .jogador-item img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    border: 1px solid #ddd;
}
#jogador-select-modal .jogador-item .nome {
    font-weight: bold;
    color: #333;
}
#jogador-select-modal .jogador-item .posicao { 
    font-size: 0.85em;
    color: #555;
    margin-left: 5px;
}

.escalacao-controles {
    text-align: center;
    margin-top: 20px;
    padding-bottom: 20px;
}
.escalacao-controles .button {
    margin: 0 5px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid transparent;
    text-decoration: none;
    /* Otimização INP: transição mais curta e touch-action */
    transition: background-color 0.1s ease, border-color 0.1s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.escalacao-controles #btn-nova-escalacao {
    background-color: #e0e0e0;
    color: #333333;
    border-color: #cccccc;
}
.escalacao-controles #btn-nova-escalacao:hover {
    background-color: #d0d0d0;
    border-color: #bbbbbb;
}

.escalacao-controles #btn-baixar-imagem {
    background-color: #cc0000; 
    color: white;
    border-color: #a70000; 
}
.escalacao-controles #btn-baixar-imagem:hover {
    background-color: #b81414; 
}

.escalacao-controles #btn-baixar-imagem.efc-button-disabled,
.escalacao-controles #btn-baixar-imagem:disabled {
    background-color: #cccccc !important;
    color: #666666 !important;
    border-color: #aaaaaa !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.escalacao-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
    z-index: 1000;
}

@media (max-width: 768px) {
    #escalacao-campo {
    }

    .player-slot {
        width: 40px;    /* <<<---- NOVO TAMANHO REDUZIDO PARA O SLOT NO MOBILE */
        height: 40px;   /* <<<---- NOVO TAMANHO REDUZIDO PARA O SLOT NO MOBILE */
        border-width: 1px;
		touch-action: manipulation;
    }
	
	.player-slot .slot-indicator,
	.player-slot .player-info .player-name, 
	.player-slot .player-info img.player-photo {
    pointer-events: none;
}

    .player-slot .slot-indicator {
        font-size: 22px;
    }

    .player-slot .player-info img.player-photo {
        width: 34px;    /* FOTO REDUZIDA PARA MOBILE (menor que o slot de 48px) */
        height: 34px;   /* FOTO REDUZIDA PARA MOBILE */
        border-radius: 15%; /* Foto redonda no mobile */
    }

    .player-slot .player-info .player-name {
        font-size: 10px;  /* Nome do jogador ainda menor */
        padding: 1px 2px; /* Padding menor no nome */
        /* Se o nome não couber bem, considere: */
        /* white-space: normal; */
        /* line-height: 1.1; */
        /* height: 18px; */ /* Altura para duas linhas, por exemplo */
        /* position: static; */ /* Se não quiser sobrepor a foto */
        /* margin-top: 1px; */
    }

    #jogador-select-modal {
        width: calc(100% - 30px); /* Modal ocupa quase toda a largura, com margens de 15px */
        /* O JS calcula 'left' e 'top'. O '!important' em left:10px foi removido.
           A lógica JS tentará centralizar se for muito para as bordas. */
    }

     #jogador-select-modal #jogador-search-input {
        width: calc(100% - 20px);
        margin: 10px;
    }
    #jogador-select-modal #jogador-list {
        padding: 0 10px 10px 10px;
        max-height: 200px;
    }
     #jogador-select-modal h3 {
        padding: 8px 10px;
        font-size: 15px;
    }
    #jogador-select-modal .close-modal {
        top: 8px;
        right: 10px;
        font-size: 20px;
    }

    #jogador-select-modal .jogador-item img {
        width: 30px;
        height: 30px;
        margin-right: 8px;
    }
    #jogador-select-modal .jogador-item .nome {
        font-size: 0.9em;
    }
    #jogador-select-modal .jogador-item .posicao {
        font-size: 0.75em;
    }
}

#jogador-select-modal .jogador-item .status-text {
    color: #b81414; /* Um tom de vermelho para indicar indisponibilidade */
    font-weight: bold;
}

#jogador-select-modal .jogador-item .status-duvida {
    color: #d68a00; /* Um tom de laranja/amarelo para indicar dúvida */
    font-weight: bold;
}

/*
 * CSS Definitivo para a estrutura com <img>
 */

/* O 'wrapper' é a nossa base de posicionamento relativa. */
.escalacao-campo-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* A imagem é a camada de baixo, responsiva. */
.escalacao-campo-imagem {
    display: block;
    width: 100%;
    height: auto;
    user-select: none; /* Impede que o utilizador arraste a imagem por engano */
}

/* #escalacao-campo é a camada de cima (overlay) para os slots.
   Ele estica-se para cobrir exatamente o tamanho do wrapper. */
#escalacao-campo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}