/* =========================================================================
   onboarding-paises.css
   Pantalla "ELIGE TU BANDERA" para NUEVOS JUGADORES (plantilla de Lienzo).
   Todo vive dentro de un escenario de 390x700 (.op-stage) con las
   coordenadas exactas de la plantilla; onboarding-paises.js lo escala para
   que quepa en cualquier pantalla.
   Flujo: tocar bandera = SELECCIONAR; tocar el botón amarillo = ENTRAR.
   ========================================================================= */

#onboarding-paises {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 9998; /* justo debajo de pantalla-carga (9999), encima del juego */
    background: #001d61;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

#onboarding-paises.op-visible {
    opacity: 1;
    pointer-events: auto;
}

.op-stage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 390px;
    height: calc(700px + var(--op-extra, 0px)); /* 700 = alto de la plantilla; --op-extra lo pone el JS en pantallas más altas */
    transform: translate(-50%, -50%);
    transform-origin: center center;
    font-family: 'Lilita One', sans-serif;
    background: #001d61;
    overflow: hidden;
}

/* max-width:none: tu página limita las <img> a max-width:100% de su contenedor (igual que en .tv-img / .tl-img de ui-menu.css);
   sin esto la imagen del seleccionado (127px) quedaba recortada al ancho de la celda (106px) y el width no tenía efecto. */
.op-stage img { max-width: none !important; max-height: none !important; pointer-events: none; -webkit-user-drag: none; }

/* ---------- Mundo + adornos ---------- */
.op-mundo { position: absolute; left: 47.3px;  top: 111.2px; width: 308.6px; height: 203.6px; z-index: 20; }
.op-adorno-mundo-izq { position: absolute; left: -8.1px;  top: 155.8px; width: 131.6px; height: 137.8px; z-index: 21; }
.op-adorno-mundo-der { position: absolute; left: 273.3px; top: 160.6px; width: 137px;   height: 139.9px; z-index: 21; }

/* ---------- Cabecera + textos en arco ---------- */
.op-header { position: absolute; left: 22px; top: 3.3px; width: 343.3px; height: 93.5px; z-index: 40; }

.op-arco {
    position: absolute;
    width: 273px;
    height: 16.8px;
    text-align: center;
    line-height: 15px;
    white-space: pre;
    text-shadow: 0 2px 0 #000;
    z-index: 41;
    pointer-events: none;
}
.op-arco span { display: inline-block; white-space: pre; transform-origin: 50% 100%; }
.op-arco .op-amarillo { color: #ffdf15; } /* palabra resaltada, mismo amarillo que el título */
.op-arco-titulo { left: 57px;   top: 50.3px;  font-size: 28px; color: #ffdf15; }
.op-arco-sub1   { left: 60.3px; top: 86.7px;  font-size: 16px; color: #fff; }
.op-arco-sub2   { left: 60.3px; top: 102.7px; font-size: 16px; color: #fff; }

/* ---------- Buscador ---------- */
.op-buscador { position: absolute; left: 0; top: 0; width: 390px; height: 0; z-index: 30; }
.op-buscador-bg   { position: absolute; left: 30.5px; top: 265.1px; width: 329px; height: 40.8px; }
.op-buscador-lupa { position: absolute; left: 39.1px; top: 270.6px; width: 29px;  height: 29.6px; }

.op-buscador-input {
    position: absolute;
    left: 78px;
    top: 270.5px;
    width: 240px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-family: 'Lilita One', sans-serif;
    font-size: 16px;
    line-height: 30px;
    color: #fff;
    text-shadow: 0 2px 0 #000;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}
.op-buscador-input::placeholder { color: rgb(120, 159, 230); opacity: 1; }

.op-buscador-x {
    all: unset;
    box-sizing: border-box;
    position: absolute;
    left: 322px;
    top: 270.5px;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgb(120, 159, 230);
    cursor: pointer;
    touch-action: manipulation;
}
.op-buscador.op-con-texto .op-buscador-x { display: flex; }

/* ---------- Lista de banderas con scroll ---------- */
.op-scroll {
    position: absolute;
    left: 0;
    top: 308px;      /* justo debajo del buscador */
    width: 390px;
    height: calc(288px + var(--op-extra, 0px)); /* termina antes del botón: se asoma un poco la siguiente fila */
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 209, 0, .75) transparent;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 12px), transparent 100%);
            mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 12px), transparent 100%);
}
.op-scroll::-webkit-scrollbar { width: 4px; }
.op-scroll::-webkit-scrollbar-thumb { background: rgba(255, 209, 0, .75); border-radius: 4px; }
.op-scroll::-webkit-scrollbar-track { background: transparent; }

.op-grid {
    display: grid;
    grid-template-columns: repeat(3, 106.3px);
    column-gap: 12.1px;
    row-gap: 8.2px;
    justify-content: start;
    padding: 20px 22.5px 26px;   /* 20px arriba: deja sitio al borde del check/agrandado de la 1ª fila */
}

.op-celda {
    all: unset;
    box-sizing: border-box;
    position: relative;
    display: block;
    width: 106.3px;
    height: 97.6px;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .12s ease;
}
.op-celda:active { transform: scale(.96); }

.op-celda-bg,
.op-celda-bg-sel { position: absolute; }
.op-celda-bg     { left: 0; top: 0; width: 106.3px; height: 97.6px; }
.op-celda-bg-sel { left: -9.5px; top: -10.9px; width: 127.4px; height: 120.3px; display: none; }
/* img_07 es la tarjeta seleccionada completa (marco dorado + halo): ocupa x19-323, y24-302 de 348x331.
   Tamaño de la plantilla (127.4x120.3) y centrada sobre la tarjeta normal para que el marco quede
   alineado con la bandera y el nombre. */

.op-celda-flag {
    position: absolute;
    left: 12.5px;
    top: 9.4px;
    width: 81px;
    height: 55px;
    object-fit: cover;
    border-radius: 8px;
    background: #f2f4f9; /* placeholder mientras carga la bandera */
}

.op-celda-nombre {
    position: absolute;
    left: 7.5px;
    top: 68.5px;
    width: 91.3px;
    height: 17px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 14px;
    line-height: 15px;
    color: #fff;
    text-shadow: 0 2px 0 #000;
    white-space: nowrap;
    pointer-events: none;
}
/* Nombres largos (Guayana Francesa, República Dominicana...): más chico y en 2 líneas */
.op-celda.op-largo .op-celda-nombre {
    top: 66px;
    height: 26px;
    font-size: 11.5px;
    line-height: 12px;
    white-space: normal;
}

.op-celda-check {
    position: absolute;
    left: 84px;
    top: -10px;
    width: 36.3px;
    height: 34.8px;
    display: none;
}

/* Estado SELECCIONADO */
.op-celda.op-sel .op-celda-bg     { display: none; }
.op-celda.op-sel .op-celda-bg-sel { display: block; animation: op-pop .28s cubic-bezier(.3, 1.6, .5, 1); }
.op-celda.op-sel .op-celda-check  { display: block; animation: op-pop .32s cubic-bezier(.3, 1.8, .5, 1); }
.op-celda.op-sel { z-index: 2; }

@keyframes op-pop {
    0%   { transform: scale(.82); }
    100% { transform: scale(1); }
}

.op-vacio {
    display: none;
    padding-top: 40px;
    text-align: center;
    font-size: 17px;
    color: rgb(120, 159, 230);
    text-shadow: 0 2px 0 #000;
}
.op-vacio.op-on { display: block; }

/* ---------- Botón amarillo "¡UNIRME! A <PAÍS>" ---------- */
.op-boton-adorno-izq { position: absolute; left: 12.9px;  top: calc(598.1px + var(--op-extra, 0px)); width: 44.5px; height: 80.2px; z-index: 48; }
.op-boton-adorno-der { position: absolute; left: 333.3px; top: calc(598.1px + var(--op-extra, 0px)); width: 44.1px; height: 77.6px; z-index: 48; }

.op-boton {
    all: unset;
    box-sizing: border-box;
    position: absolute;
    left: 43.5px;
    top: calc(601.6px + var(--op-extra, 0px));
    width: 302.5px;
    height: 73.4px;
    z-index: 50;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .1s ease, filter .15s;
}
.op-boton:active { transform: translateY(3px) scale(.985); filter: brightness(.94); }

.op-boton-bg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }

.op-boton-titulo {
    position: absolute;
    left: 0;
    right: 0;
    top: 15.9px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    line-height: 15px;
    letter-spacing: -0.5px;
    color: rgb(75, 25, 0);
    text-shadow: rgb(254, 232, 144) 0 2px 0;
    white-space: nowrap;
}

.op-boton-sub {
    position: absolute;
    left: 0;
    right: 0;
    top: 40.3px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    line-height: 15px;
    letter-spacing: -0.5px;
    color: rgb(75, 25, 0);
    white-space: nowrap;
}

.op-boton-flag {
    width: 21px;
    height: 15px;
    object-fit: cover;
    border: 1px solid rgb(228, 232, 240);
    border-radius: 2px;
    background: rgb(242, 244, 249);
}

/* ---------- Confirmación breve tras tocar "¡UNIRME!" ---------- */
.op-confirmando {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 10, 40, .6);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.op-confirmando.op-on { opacity: 1; pointer-events: auto; }

.op-confirmando-txt {
    font-family: 'Lilita One', sans-serif;
    font-size: 30px;
    color: #FFD100;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .7);
    display: flex;
    align-items: center;
    gap: 14px;
}
.op-confirmando-txt img {
    width: 64px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid #05070a;
}
