/* =========================================================================
   Selector de jugador compartido (v5.51.0) - Analizador y Comparador.
   El tema se cambia solo con tres variables:
     --mpo-sel-acc       color principal (filtros activos, foco, acento)
     --mpo-sel-acc-soft  fondo suave al pasar por una fila / elegida
     --mpo-sel-acc-ink   texto sobre el color principal
   Analizador = azul eléctrico · Comparador: jugador 1 verde, jugador 2 azul.
   ========================================================================= */
.mpo-sel {
    --mpo-sel-acc: #0047FF; --mpo-sel-acc-soft: rgba(0, 71, 255, .09); --mpo-sel-acc-ink: #fff;
    position: fixed; left: 0; width: 100%; z-index: 999990; display: none;
    font-family: 'Inter', system-ui, -apple-system, sans-serif; color: #0B1220;
    top: var(--mpo-sel-top, 0px);
    height: 100vh; height: var(--mpo-sel-h, 100dvh);
    align-items: flex-end; justify-content: center;
}
.mpo-sel--cmp-a { --mpo-sel-acc: #1FAF6E; --mpo-sel-acc-soft: rgba(31, 175, 110, .12); }
.mpo-sel--cmp-b { --mpo-sel-acc: #2563EB; --mpo-sel-acc-soft: rgba(37, 99, 235, .11); }
.mpo-sel.is-open { display: flex; }
.mpo-sel *, .mpo-sel *::before, .mpo-sel *::after { box-sizing: border-box; }
.mpo-sel button, .mpo-sel input {
    -webkit-appearance: none; appearance: none; font-family: inherit; text-transform: none;
    letter-spacing: normal; box-shadow: none; text-shadow: none; margin: 0; min-width: 0; min-height: 0;
}
.mpo-sel-back { position: absolute; inset: 0; background: rgba(6, 12, 40, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: mpoSelFade .18s ease-out both; }
.mpo-sel-sheet {
    position: relative; display: flex; flex-direction: column; outline: none; overflow: hidden;
    width: 100%; max-width: 560px; height: 92%; max-height: 760px;
    background: #fff; border-radius: 22px 22px 0 0; border-top: 4px solid var(--mpo-sel-acc);
    box-shadow: 0 -18px 50px rgba(0, 20, 120, .35);
    animation: mpoSelUp .26s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes mpoSelFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mpoSelUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
    .mpo-sel { align-items: center; }
    .mpo-sel-sheet { height: min(86%, 680px); border-radius: 22px; }
    .mpo-sel-grab { display: none; }
}
.mpo-sel-grab { flex: 0 0 auto; width: 40px; height: 4px; border-radius: 4px; background: #D5DBE1; margin: 8px auto 0; }

.mpo-sel-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 4px 18px; }
.mpo-sel-ttl h3 { margin: 0; font-family: 'Sora', 'Inter', sans-serif; font-weight: 800; font-size: 17px; line-height: 1.2; color: #0B1220; letter-spacing: 0; text-transform: none; }
.mpo-sel-ttl p { margin: 2px 0 0; font-size: 12px; color: #64748B; }
.mpo-sel-ttl p[hidden] { display: none; }
.mpo-sel-x { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 0; background: #EEF1F3; color: #0B1220; font-size: 15px; line-height: 1; cursor: pointer; }
.mpo-sel-x:hover { background: #E2E7EA; color: #0B1220; }

.mpo-sel-cab { flex: 0 0 auto; display: flex; gap: 8px; padding: 4px 18px 4px; }
.mpo-sel-cab[hidden] { display: none; }
.mpo-sel-cab button { flex: 1 1 0; padding: 10px 12px; border-radius: 11px; border: 0; cursor: pointer; font-weight: 800; font-size: 13px; }
.mpo-sel-cab .rm { background: #FDECEC; color: #B4332E; }
.mpo-sel-cab .rm:hover { background: #FBD9D8; color: #B4332E; }
.mpo-sel-cab .fi { background: #EEF4FF; color: #1B3FA8; }
.mpo-sel-cab .fi:hover { background: #DCE8FF; color: #1B3FA8; }

.mpo-sel-search { position: relative; flex: 0 0 auto; display: flex; align-items: center; margin: 6px 18px 2px; }
.mpo-sel-search > span { position: absolute; left: 13px; font-size: 14px; opacity: .65; pointer-events: none; }
.mpo-sel-search input {
    width: 100%; padding: 12px 44px 12px 38px; font-size: 16px; /* 16px: iOS no hace zoom */ font-weight: 600; color: #0B1220;
    border: 1.5px solid #E7EAEC; border-radius: 13px; background: #fff;
}
.mpo-sel-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.mpo-sel-search input:focus { outline: none; border-color: var(--mpo-sel-acc); box-shadow: 0 0 0 4px var(--mpo-sel-acc-soft); }
.mpo-sel-qx { position: absolute; right: 7px; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: #EEF1F3; color: #64748B; font-size: 12px; cursor: pointer; }
.mpo-sel-qx[hidden] { display: none; }

.mpo-sel-pos { flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 18px 0; padding: 3px; background: #F1F4F6; border-radius: 12px; }
.mpo-sel-pos[hidden] { display: none; }
.mpo-sel-posb { padding: 8px 0; border: 0; border-radius: 9px; background: transparent; color: #64748B; font-size: 12.5px; font-weight: 800; letter-spacing: .03em; cursor: pointer; }
.mpo-sel-posb:hover { background: rgba(255, 255, 255, .7); color: #0B1220; }
.mpo-sel-posb.is-on, .mpo-sel-posb.is-on:hover { background: var(--mpo-sel-acc); color: var(--mpo-sel-acc-ink); box-shadow: 0 2px 8px rgba(11, 18, 32, .18); }

.mpo-sel-teams { position: relative; flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; padding: 10px 18px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.mpo-sel-teams[hidden] { display: none; }
.mpo-sel-teams::-webkit-scrollbar { display: none; }
.mpo-sel-chip {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 6px 12px 6px 8px; border-radius: 999px;
    border: 1.5px solid #E7EAEC; background: #fff; color: #0B1220; font-size: 12.5px; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.mpo-sel-chip:first-child { padding-left: 12px; }
.mpo-sel-chip:hover { background: #fff; color: #0B1220; border-color: #CBD3DA; }
.mpo-sel-chip img { width: 18px; height: 18px; object-fit: contain; margin: 0; max-width: none; }
.mpo-sel-chip.is-on, .mpo-sel-chip.is-on:hover { border-color: var(--mpo-sel-acc); background: var(--mpo-sel-acc-soft); color: #0B1220; }

.mpo-sel-count { flex: 0 0 auto; min-height: 22px; padding: 6px 20px 4px; font-size: 11.5px; color: #64748B; }
.mpo-sel-list {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 10px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #EEF1F3; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.mpo-sel-sec { padding: 10px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #64748B; }

.mpo-sel-row {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; margin: 2px 0; padding: 8px 10px;
    border: 0; border-radius: 14px; background: transparent; color: #0B1220; text-align: left; cursor: pointer;
    content-visibility: auto; contain-intrinsic-size: auto 62px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.mpo-sel-row:hover, .mpo-sel-row.is-active { background: var(--mpo-sel-acc-soft); color: #0B1220; }
.mpo-sel-row:focus-visible { outline: 2px solid var(--mpo-sel-acc); outline-offset: -2px; }
.mpo-sel-row.is-sel { background: var(--mpo-sel-acc-soft); box-shadow: inset 0 0 0 1.5px var(--mpo-sel-acc); }
.mpo-sel-row[disabled] { opacity: .42; cursor: not-allowed; }
.mpo-sel-rank { flex: 0 0 auto; width: 22px; text-align: center; font-family: 'Sora', 'Inter', sans-serif; font-weight: 800; font-size: 13px; color: #94A3B8; }
.mpo-sel-rank.r1 { color: #E8A33D; }
.mpo-sel-rank.r2 { color: #94A3B8; }
.mpo-sel-rank.r3 { color: #B08D57; }
.mpo-sel-ph { position: relative; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; background: #EEF1F3; }
.mpo-sel-ph img.f { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: top; margin: 0; max-width: none; }
.mpo-sel-ph b { font-weight: 800; font-size: 16px; color: var(--mpo-sel-acc); }
.mpo-sel-ph img.c { position: absolute; right: -6px; bottom: -4px; width: 22px; height: 22px; padding: 2px; border-radius: 50%; background: #fff; object-fit: contain; box-shadow: 0 2px 6px rgba(11, 18, 32, .3); margin: 0; max-width: none; }
.mpo-sel-info { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; gap: 2px; }
.mpo-sel-n { font-weight: 800; font-size: 14.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpo-sel-t { font-size: 12px; color: #64748B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpo-sel-der { flex: 0 0 auto; text-align: right; font-size: 11px; color: #64748B; line-height: 1.3; min-width: 52px; }
.mpo-sel-der b { display: block; font-family: 'Sora', 'Inter', sans-serif; font-size: 15px; color: #0B1220; line-height: 1.15; }
.mpo-sel-der small { display: block; font-size: 10.5px; font-weight: 600; color: #64748B; white-space: nowrap; }
.mpo-sel-der-txt { font-size: 11px; font-weight: 700; color: #64748B; }
.mpo-sel-badge { flex: 0 0 auto; padding: 3px 7px; border-radius: 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; border: 1px solid currentColor; }
.mpo-sel-badge-portero { color: #B7791F; background: rgba(245, 158, 11, .12); }
.mpo-sel-badge-defensa { color: #1D6FD1; background: rgba(37, 99, 235, .10); }
.mpo-sel-badge-centrocampista { color: #0F9D58; background: rgba(15, 157, 88, .10); }
.mpo-sel-badge-delantero { color: #D93A45; background: rgba(217, 58, 69, .10); }
.mpo-sel-check { flex: 0 0 auto; color: var(--mpo-sel-acc); font-weight: 800; }

.mpo-sel-mas, .mpo-sel-quitar {
    display: block; width: calc(100% - 8px); margin: 8px auto 4px; padding: 12px 16px; border: 1.5px solid #E7EAEC; border-radius: 12px;
    background: #fff; color: #0B1220; font-size: 13px; font-weight: 700; cursor: pointer;
}
.mpo-sel-mas:hover, .mpo-sel-quitar:hover { background: var(--mpo-sel-acc-soft); border-color: var(--mpo-sel-acc); color: #0B1220; }
.mpo-sel-quitar { width: auto; border-radius: 999px; margin-top: 12px; }
.mpo-sel-vacio { padding: 30px 14px; text-align: center; font-size: 14px; color: #64748B; }

/* Bloque "Tus suplentes" del Analizador */
.mpo-sel-bench { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid #E5EAF0; }
.mpo-sel-brow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin-bottom: 4px; border-radius: 14px; background: #F6F9FF; }
.mpo-sel-bbtn { flex: 0 0 auto; padding: 9px 13px; border: 0; border-radius: 11px; background: var(--mpo-sel-acc); color: var(--mpo-sel-acc-ink); font-weight: 800; font-size: 12.5px; cursor: pointer; }
.mpo-sel-bbtn:hover { filter: brightness(.92); color: var(--mpo-sel-acc-ink); }
.mpo-sel .mpo-an-chollo { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #E7F7EF; border: 1px solid #8FD9B6; color: #0B6B43; font-size: 10.5px; font-weight: 800; white-space: nowrap; vertical-align: middle; }

@media (prefers-reduced-motion: reduce) {
    .mpo-sel-back, .mpo-sel-sheet { animation: none; }
}
