/* =========================================================================
   onboarding-tutorial.css
   Estilos de:
     - Fase 3: el Rey que se asoma por el borde izquierdo + burbuja de
       diálogo con voz, la base enemiga marcada, la mano cartoon que
       demuestra el arrastre y el avance de conquista.
     - Fase 4: el modal de "Nombre de Usuario" (solo si gana) y la
       pantalla breve de reintento (solo si pierde).
   OJO: todo lo de Fase 3 vive DENTRO de #stage (1080x1920 escalado), así
   que los px son del escenario, no de la pantalla del teléfono.
   ========================================================================= */

/* ---------- Fase 3: personaje + burbuja ---------- */
#ot-personaje-wrap {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
}
#ot-personaje-wrap.ot-on { opacity: 1; }

/* El Rey asoma desde el borde izquierdo, debajo del HUD de arriba */
.ot-rey {
    position: absolute;
    left: 0;
    top: 340px;
    height: 560px;
    aspect-ratio: 344 / 900;
    transform: translateX(-110%);
    transition: transform .55s cubic-bezier(.3,1.4,.5,1);
    filter: drop-shadow(8px 12px 14px rgba(0,0,0,.5));
}
#ot-personaje-wrap.ot-on .ot-rey { transform: translateX(0); }

.ot-rey-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
            mask-image: linear-gradient(to bottom, transparent 0, #000 12px);
    transform-origin: 0 60%;
    animation: ot-rey-respira 3.4s ease-in-out infinite;
}
@keyframes ot-rey-respira {
    0%, 100% { transform: translateX(0) scale(1); }
    50%      { transform: translateX(6px) scale(1.012); }
}
/* Mientras habla: cabeceo corto y rítmico */
#ot-personaje-wrap.ot-habla .ot-rey-img {
    animation: ot-rey-habla .42s ease-in-out infinite;
}
@keyframes ot-rey-habla {
    0%, 100% { transform: translateX(4px) rotate(0deg) scale(1); }
    50%      { transform: translateX(10px) rotate(1.6deg) scale(1.03); }
}

.ot-dialogo {
    position: absolute;
    left: 236px;
    top: 360px;
    width: 770px;
    box-sizing: border-box;
    pointer-events: auto;
    background: #ffffff;
    border: 5px solid #05070a;
    border-radius: 34px;
    padding: 28px 100px 24px 34px;
    box-shadow: 0 8px 0 #05070a, 0 20px 40px rgba(0,0,0,.5);
    opacity: 0;
    transform: translateX(-30px) scale(.96);
    transition: opacity .3s ease .2s, transform .4s cubic-bezier(.3,1.4,.5,1) .2s;
}
#ot-personaje-wrap.ot-on .ot-dialogo { opacity: 1; transform: translateX(0) scale(1); }

/* Colita que apunta al Rey */
.ot-dialogo::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 66px;
    width: 34px;
    height: 34px;
    background: #ffffff;
    border-left: 5px solid #05070a;
    border-bottom: 5px solid #05070a;
    border-radius: 0 0 0 10px;
    transform: rotate(45deg);
}

.ot-dialogo-texto {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 42px;
    line-height: 1.25;
    color: #1c2430;
    min-height: 52px;
}

.ot-voz-btn {
    all: unset;
    box-sizing: border-box;
    position: absolute;
    top: 18px;
    right: 18px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
    border: 4px solid #05070a;
    border-radius: 50%;
    box-shadow: 0 4px 0 #05070a;
    cursor: pointer;
    touch-action: manipulation;
}
.ot-voz-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #05070a; }
.ot-voz-btn svg { width: 36px; height: 36px; }

.ot-dialogo-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}
.ot-dialogo-footer.ot-oculto { display: none; }

.ot-dialogo-btn {
    all: unset;
    box-sizing: border-box;
    font-family: 'Lilita One', sans-serif;
    font-size: 38px;
    letter-spacing: .5px;
    color: #1a1300;
    background: linear-gradient(180deg,#FFE066,#FFB300);
    border: 5px solid #05070a;
    border-radius: 20px;
    padding: 10px 40px;
    cursor: pointer;
    box-shadow: 0 8px 0 #7a4b00, 0 14px 22px rgba(0,0,0,.4);
    white-space: nowrap;
    touch-action: manipulation;
    animation: ot-btn-late 1.1s ease-in-out infinite;
}
.ot-dialogo-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #7a4b00; animation: none; }
@keyframes ot-btn-late { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ---------- Resaltados sobre elementos reales del HUD (carta, maná, barra %) ---------- */
.ot-resaltado {
    position: relative;
    z-index: 7;
    border-radius: 20px;
    outline: 8px solid rgba(255,209,0,.95);
    outline-offset: 8px;
    animation: ot-pulso-outline 1.1s ease-in-out infinite;
}
@keyframes ot-pulso-outline {
    0%, 100% { outline-color: rgba(255,209,0,.95); outline-offset: 6px; }
    50%      { outline-color: rgba(255,209,0,.25); outline-offset: 16px; }
}

#ot-resaltado-campo {
    position: absolute;
    left: 40px; right: 40px; top: 330px; bottom: 440px;
    z-index: 6;
    pointer-events: none;
    border: 8px solid rgba(255,209,0,.85);
    border-radius: 36px;
    animation: ot-pulso-borde 1.1s ease-in-out infinite;
}
@keyframes ot-pulso-borde {
    0%, 100% { border-color: rgba(255,209,0,.85); box-shadow: 0 0 0 0 rgba(255,209,0,.4); }
    50%      { border-color: rgba(255,209,0,.35); box-shadow: 0 0 34px 6px rgba(255,209,0,.35); }
}

/* ---------- Base enemiga marcada ---------- */
#ot-objetivo {
    position: absolute;
    z-index: 6;
    box-sizing: border-box;
    pointer-events: none;
    border: 8px dashed #FFD100;
    border-radius: 30px;
    background: rgba(255,209,0,.13);
    animation: ot-objetivo-pulso 1.2s ease-in-out infinite;
}
@keyframes ot-objetivo-pulso {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,209,0,.5); background: rgba(255,209,0,.10); }
    50%      { box-shadow: 0 0 40px 10px rgba(255,209,0,.55); background: rgba(255,209,0,.22); }
}
.ot-objetivo-cartel {
    position: absolute;
    left: 50%;
    top: -80px;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Lilita One', sans-serif;
    font-size: 36px;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(180deg,#ff5757,#c8102e);
    border: 5px solid #05070a;
    border-radius: 16px;
    padding: 4px 24px 6px;
    text-shadow: 0 3px 0 rgba(0,0,0,.55);
    box-shadow: 0 6px 0 #05070a;
    animation: ot-cartel-rebota 1s ease-in-out infinite;
}
.ot-objetivo-cartel::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -22px;
    transform: translateX(-50%);
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 18px solid #05070a;
}
@keyframes ot-cartel-rebota {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-10px); }
}

/* ---------- Demo de arrastre: mano cartoon que toca, desliza y suelta ---------- */
#ot-demo {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
}

.ot-mano {
    position: absolute;
    width: 130px;
    margin-left: -61px;
    margin-top: -8px;
    transform-origin: 47% 4%;
    filter: drop-shadow(0 10px 8px rgba(0,0,0,.45));
    opacity: 0;
    animation: ot-mano-ciclo 2.6s ease-in-out infinite;
}
@keyframes ot-mano-ciclo {
    0%   { opacity: 0; transform: translate(0,50px) rotate(-8deg) scale(1.1); }
    10%  { opacity: 1; transform: translate(0,0) rotate(-8deg) scale(1); }
    20%  { opacity: 1; transform: translate(0,0) rotate(-8deg) scale(.86); }
    28%  { opacity: 1; transform: translate(0,0) rotate(-8deg) scale(.86); }
    64%  { opacity: 1; transform: translate(var(--dx),var(--dy)) rotate(-8deg) scale(.86); }
    72%  { opacity: 1; transform: translate(var(--dx),var(--dy)) rotate(-15deg) scale(1.15); }
    84%  { opacity: 1; transform: translate(var(--dx),var(--dy)) rotate(-8deg) scale(1); }
    95%, 100% { opacity: 0; transform: translate(var(--dx),var(--dy)) rotate(-8deg) scale(1); }
}

.ot-fantasma {
    position: absolute;
    opacity: 0;
    transform-origin: 50% 50%;
    animation: ot-fantasma-ciclo 2.6s ease-in-out infinite;
}
@keyframes ot-fantasma-ciclo {
    0%, 18% { opacity: 0; transform: translate(0,0) scale(.6); }
    26%     { opacity: .95; transform: translate(0,0) scale(.6); }
    64%     { opacity: .95; transform: translate(var(--dx),var(--dy)) scale(.6); }
    72%     { opacity: 0; transform: translate(var(--dx),var(--dy)) scale(.25); }
    100%    { opacity: 0; transform: translate(var(--dx),var(--dy)) scale(.25); }
}

/* Camino punteado con flechita que se "mueve" hacia el destino */
.ot-ruta {
    position: absolute;
    height: 12px;
    margin-top: -6px;
    transform-origin: 0 50%;
    border-radius: 6px;
    background: repeating-linear-gradient(90deg, rgba(255,226,102,.95) 0 28px, transparent 28px 50px);
    opacity: 0;
    filter: drop-shadow(0 3px 0 rgba(0,0,0,.5));
    animation: ot-ruta-ciclo 2.6s ease-in-out infinite, ot-ruta-hormiga .55s linear infinite;
}
.ot-ruta::after {
    content: '';
    position: absolute;
    right: -26px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 34px solid #FFE266;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
}
@keyframes ot-ruta-ciclo {
    0%, 20% { opacity: 0; }
    28%, 66% { opacity: .95; }
    74%, 100% { opacity: 0; }
}
@keyframes ot-ruta-hormiga {
    from { background-position: 0 0; }
    to   { background-position: 50px 0; }
}

/* Ondas al tocar la carta y al soltar sobre la base */
.ot-onda {
    position: absolute;
    width: 150px;
    height: 150px;
    margin: -75px 0 0 -75px;
    border: 10px solid #ffffff;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 24px rgba(255,255,255,.7);
}
.ot-onda-ini { animation: ot-onda-ini 2.6s ease-out infinite; }
.ot-onda-fin { animation: ot-onda-fin 2.6s ease-out infinite; }
@keyframes ot-onda-ini {
    0%, 17% { opacity: 0; transform: scale(.3); }
    19%     { opacity: .95; transform: scale(.3); }
    34%     { opacity: 0; transform: scale(1.5); }
    100%    { opacity: 0; transform: scale(1.5); }
}
@keyframes ot-onda-fin {
    0%, 63% { opacity: 0; transform: scale(.3); }
    65%     { opacity: .95; transform: scale(.3); }
    84%     { opacity: 0; transform: scale(1.8); }
    100%    { opacity: 0; transform: scale(1.8); }
}

/* ---------- Avance de conquista de la base ---------- */
#ot-progreso {
    position: absolute;
    left: 236px;
    top: 650px;
    width: 560px;
    z-index: 7;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(10,14,20,.9);
    border: 4px solid #05070a;
    border-radius: 20px;
    padding: 10px 20px;
    box-shadow: 0 6px 0 #05070a;
}
.ot-progreso-txt {
    font-family: 'Lilita One', sans-serif;
    font-size: 28px;
    color: #FFD100;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(0,0,0,.6);
}
.ot-progreso-barra {
    flex: 1;
    height: 26px;
    background: #12081c;
    border: 3px solid #05070a;
    border-radius: 14px;
    overflow: hidden;
}
.ot-progreso-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(180deg,#8ef58e,#2fbf4a);
    border-radius: 10px;
    transition: width .35s ease;
}

/* ---------- Fase 4: modal de nombre de usuario ---------- */
#ot-modal-usuario {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(4,7,11,.86);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

#ot-modal-usuario.ot-on {
    opacity: 1;
    pointer-events: auto;
}

.ot-modal-caja {
    width: min(86vw, 460px);
    background: linear-gradient(180deg,#3b4a5e,#1a2431 55%,#101823);
    border: 4px solid #05070a;
    border-radius: 26px;
    padding: 26px 26px 24px;
    margin: auto;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    box-shadow: 0 10px 0 #05070a, 0 22px 44px rgba(0,0,0,.6), inset 0 3px 0 rgba(255,255,255,.15);
    text-align: center;
    transform: translateY(18px) scale(.96);
    transition: transform .35s cubic-bezier(.3,1.4,.5,1);
}

#ot-modal-usuario.ot-on .ot-modal-caja {
    transform: translateY(0) scale(1);
}

.ot-modal-trofeo {
    font-size: 54px;
    margin-bottom: 6px;
}

.ot-modal-titulo {
    font-family: 'Lilita One', sans-serif;
    font-size: 30px;
    color: #FFD100;
    text-shadow: 0 3px 0 rgba(0,0,0,.6);
    margin-bottom: 8px;
    letter-spacing: .5px;
}

.ot-modal-sub {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #b9c3d1;
    margin-bottom: 18px;
    line-height: 1.4;
}

.ot-input {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #fff;
    background: #0a0e14;
    border: 3px solid #05070a;
    border-radius: 14px;
    padding: 14px 18px;
    outline: none;
    box-shadow: inset 0 3px 8px rgba(0,0,0,.6);
    margin-bottom: 0;
    text-align: center;
    letter-spacing: .5px;
}

.ot-input::placeholder { color: #5b6675; font-weight: 700; }
.ot-input:focus { border-color: #FFD100; }

.ot-input-error {
    min-height: 16px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: #ff6767;
    margin-bottom: 8px;
}

.ot-btn-guardar {
    all: unset;
    box-sizing: border-box;
    display: block;
    width: 100%;
    text-align: center;
    font-family: 'Lilita One', sans-serif;
    font-size: 22px;
    letter-spacing: .5px;
    color: #1a1300;
    background: linear-gradient(180deg,#FFE066,#FFB300);
    border: 4px solid #05070a;
    border-radius: 16px;
    padding: 14px 0;
    cursor: pointer;
    box-shadow: 0 6px 0 #7a4b00, 0 12px 24px rgba(0,0,0,.5);
    transition: transform .1s, box-shadow .1s;
    touch-action: manipulation;
}

.ot-btn-guardar:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 #7a4b00, 0 4px 10px rgba(0,0,0,.4);
}

/* Victoria: la bandera del país es la protagonista */
.ot-bandera-heroe {
    position: relative;
    width: min(62%, 210px);
    margin: 0 auto 16px;
    animation: ot-bandera-entra .7s cubic-bezier(.3,1.5,.5,1) both .15s;
}

.ot-bandera-heroe::before {
    content: '';
    position: absolute;
    inset: -26px;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--ot-color-pais, #FFD100) 0%, rgba(255,209,0,.0) 100%);
    opacity: .45;
    z-index: 0;
    animation: ot-brillo 2.4s ease-in-out infinite;
}

.ot-bandera-heroe-img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 14px;
    border: 4px solid #05070a;
    box-shadow: 0 0 0 3px #FFD100, 0 8px 0 #05070a, 0 14px 26px rgba(0,0,0,.55);
    background: #222;
}

.ot-bandera-heroe-trofeo {
    position: absolute;
    z-index: 2;
    right: -16px;
    bottom: -16px;
    font-size: 40px;
    line-height: 1;
    filter: drop-shadow(0 3px 0 rgba(0,0,0,.65));
    transform: rotate(10deg);
}

@keyframes ot-bandera-entra {
    0%   { transform: scale(.3) rotate(-8deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes ot-brillo {
    0%, 100% { opacity: .30; transform: scale(.96); }
    50%      { opacity: .55; transform: scale(1.04); }
}

/* Campo de nombre con contador de caracteres */
.ot-campo-nombre {
    position: relative;
    margin-bottom: 6px;
}

.ot-campo-nombre .ot-input {
    padding-right: 58px;
    padding-left: 58px;   /* simétrico para que el texto quede centrado */
}

.ot-contador {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: #6b7788;
    pointer-events: none;
}

/* Aviso estilo Clash Royale: no uses tu nombre real */
.ot-aviso-nombre {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.35;
    color: #ffd98a;
    background: rgba(255,179,0,.10);
    border: 2px solid rgba(255,179,0,.28);
    border-radius: 12px;
    padding: 9px 12px;
    margin: 0 0 18px;
}

.ot-aviso-ico { margin-right: 6px; }

/* Confeti (una ráfaga al aparecer) */
.ot-confeti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.ot-confeti i {
    position: absolute;
    top: -16px;
    width: 9px;
    height: 15px;
    border-radius: 2px;
    opacity: 0;
    animation-name: ot-confeti-cae;
    animation-timing-function: cubic-bezier(.3,.6,.6,1);
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
}

#ot-modal-usuario:not(.ot-on) .ot-confeti i { animation-play-state: paused; }

@keyframes ot-confeti-cae {
    0%   { opacity: 0; transform: translate3d(0,0,0) rotate(0); }
    10%  { opacity: 1; }
    100% { opacity: 0; transform: translate3d(var(--ot-deriva,0),105vh,0) rotate(var(--ot-giro,360deg)); }
}

@media (prefers-reduced-motion: reduce) {
    .ot-confeti { display: none; }
    .ot-bandera-heroe, .ot-bandera-heroe::before { animation: none; }
}

@media (max-height: 640px) {
    .ot-bandera-heroe { width: min(46%, 150px); margin-bottom: 12px; }
}

/* ---------- Fase 3-bis: pantalla breve de reintento si pierde ---------- */
#ot-reintentar {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(4,7,11,.86);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    text-align: center;
    flex-direction: column;
}

#ot-reintentar.ot-on { opacity: 1; pointer-events: auto; }

#ot-reintentar .ot-modal-titulo { margin-bottom: 18px; }

.ot-btn-reintentar {
    all: unset;
    box-sizing: border-box;
    font-family: 'Lilita One', sans-serif;
    font-size: 22px;
    color: #fff;
    background: linear-gradient(180deg,#3ba9ff,#0056ff);
    border: 4px solid #05070a;
    border-radius: 16px;
    padding: 14px 40px;
    cursor: pointer;
    box-shadow: 0 6px 0 #002e8a, 0 12px 24px rgba(0,0,0,.5);
    touch-action: manipulation;
}

.ot-btn-reintentar:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 #002e8a, 0 4px 10px rgba(0,0,0,.4);
}


/* =========================================================================
   TUTORIAL v3: foco, llaves, pastillas, gotas de maná, etiquetas de pelea
   ========================================================================= */

/* Foco oscuro: atenúa todo el escenario MENOS el rectángulo indicado. */
#ot-foco {
    position: absolute;
    z-index: 6;
    box-sizing: border-box;
    pointer-events: none;
    border: 6px solid #FFD100;
    border-radius: 30px;
    box-shadow: 0 0 0 4000px rgba(5,7,10,.66), 0 0 44px 6px rgba(255,209,0,.55);
    animation: ot-foco-late 1.2s ease-in-out infinite;
}
@keyframes ot-foco-late {
    0%, 100% { border-color: rgba(255,209,0,1); }
    50%      { border-color: rgba(255,209,0,.45); }
}

/* Marco de la base marcada mientras arrastras: verde = suelta aquí, rojo = fuera del área */
#ot-objetivo.ot-dentro {
    border-color: #3CE05A;
    background: rgba(60,224,90,.22);
    box-shadow: 0 0 46px 10px rgba(60,224,90,.6);
    animation: none;
}
#ot-objetivo.ot-dentro .ot-objetivo-cartel { background: linear-gradient(180deg,#52e86f,#1fa83a); }
#ot-objetivo.ot-fuera {
    border-color: #ff4d4d;
    background: rgba(255,77,77,.10);
    animation: none;
}
#ot-objetivo.ot-error { animation: ot-sacude .5s ease-in-out 1; border-color: #ff4d4d; }
@keyframes ot-sacude {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-14px); } 40% { transform: translateX(14px); }
    60% { transform: translateX(-9px); }  80% { transform: translateX(9px); }
}

/* Burbuja compacta (durante la acción) y variante abajo para no tapar la base */
#ot-personaje-wrap.ot-compacto .ot-dialogo {
    width: 720px;
    padding: 20px 96px 18px 28px;
}
#ot-personaje-wrap.ot-compacto .ot-dialogo-texto { font-size: 34px; min-height: 44px; }
#ot-personaje-wrap.ot-compacto .ot-dialogo-btn { font-size: 32px; padding: 8px 32px; }
#ot-personaje-wrap.ot-abajo .ot-rey { top: auto; bottom: 440px; height: 460px; }
#ot-personaje-wrap.ot-abajo .ot-dialogo { top: auto; bottom: 480px; }
#ot-personaje-wrap.ot-abajo .ot-dialogo::before { top: auto; bottom: 40px; }

/* Pastillas con flechita (rótulos sobre el HUD) */
.ot-past {
    position: absolute;
    z-index: 9;
    pointer-events: none;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Lilita One', sans-serif;
    font-size: 34px;
    letter-spacing: .5px;
    color: #fff;
    background: linear-gradient(180deg,#5aa2ff,#1f5fd1);
    border: 5px solid #05070a;
    border-radius: 18px;
    padding: 4px 22px 6px;
    text-shadow: 0 3px 0 rgba(0,0,0,.55);
    box-shadow: 0 6px 0 #05070a;
    opacity: 0;
    animation: ot-pop .45s cubic-bezier(.3,1.6,.5,1) forwards, ot-past-flota 1.1s ease-in-out .5s infinite;
}
.ot-past::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -22px;
    transform: translateX(-50%);
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 18px solid #05070a;
}
.ot-past-arriba::after {
    bottom: auto;
    top: -22px;
    border-top: 0;
    border-bottom: 18px solid #05070a;
}
.ot-past-oro { color: #1a1300; background: linear-gradient(180deg,#FFE066,#FFB300); text-shadow: none; }
.ot-past-morada { background: linear-gradient(180deg,#e06bff,#8a1ad0); }
@keyframes ot-pop {
    0%   { opacity: 0; margin-top: 24px; }
    100% { opacity: 1; margin-top: 0; }
}
@keyframes ot-past-flota {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-8px); }
}

/* Llave sobre un grupo de cartas: rótulo + corchete */
.ot-llave {
    position: absolute;
    z-index: 9;
    pointer-events: none;
    box-sizing: border-box;
    opacity: 0;
    animation: ot-pop .5s cubic-bezier(.3,1.6,.5,1) forwards;
}
.ot-llave-txt {
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Lilita One', sans-serif;
    font-size: 40px;
    color: #fff;
    background: linear-gradient(180deg,#5aa2ff,#1f5fd1);
    border: 5px solid #05070a;
    border-radius: 18px;
    padding: 2px 24px 4px;
    text-shadow: 0 3px 0 rgba(0,0,0,.55);
    box-shadow: 0 6px 0 #05070a;
}
.ot-llave-linea {
    height: 26px;
    margin-top: 10px;
    border: 7px solid #5aa2ff;
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    filter: drop-shadow(0 4px 0 #05070a);
}
.ot-llave-oro .ot-llave-txt { color: #1a1300; background: linear-gradient(180deg,#FFE066,#FFB300); text-shadow: none; }
.ot-llave-oro .ot-llave-linea { border-color: #FFC21A; }

/* La gotita de precio de cada carta late */
.ot-pulso-gota { animation: ot-gota-brillo .9s ease-in-out infinite; }
@keyframes ot-gota-brillo {
    0%, 100% { filter: drop-shadow(0 4px 0 #05070a) drop-shadow(0 0 0 rgba(255,209,0,0)); }
    50%      { filter: drop-shadow(0 4px 0 #05070a) drop-shadow(0 0 26px #FFD100); }
}

/* Gota "-N" que viaja de la carta a la barra de maná */
.ot-gota {
    position: absolute;
    z-index: 9;
    pointer-events: none;
    width: 74px;
    height: 84px;
    margin: -42px 0 0 -37px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    box-sizing: border-box;
    font-family: 'Lilita One', sans-serif;
    font-size: 32px;
    color: #fff;
    text-shadow: 0 3px 0 rgba(0,0,0,.6);
    background: linear-gradient(180deg,#e06bff,#a922e8 55%,#7a12c2);
    border: 4px solid #05070a;
    border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
    opacity: 0;
    animation: ot-gota-viaja 2.2s ease-in infinite;
}
@keyframes ot-gota-viaja {
    0%   { opacity: 0; transform: translate(0,0) scale(.6); }
    12%  { opacity: 1; transform: translate(0,0) scale(1); }
    70%  { opacity: 1; transform: translate(var(--dx),var(--dy)) scale(.8); }
    85%  { opacity: 0; transform: translate(var(--dx),var(--dy)) scale(.3); }
    100% { opacity: 0; transform: translate(var(--dx),var(--dy)) scale(.3); }
}

/* Burbuja con título (línea 1) y cuerpo (resto) */
.ot-dialogo-titulo { display: block; font-size: 1.1em; color: #b3261e; margin-bottom: 4px; }
.ot-dialogo-cuerpo { display: block; font-weight: 800; }
#ot-personaje-wrap.ot-compacto .ot-dialogo-texto { font-size: 30px; }

/* ==========================================================================
   Fin de partida (victoria) del tutorial — plantilla FIN_DE_PARTIDA_TUTORIAL
   Lienzo de diseño: 390 px de ancho; se escala con --fp-k (ver onboarding-tutorial.js)
   ========================================================================== */
#ot-modal-usuario { background: rgba(0,10,40,.82); }

.ot-fp-escala {
    position: relative;
    z-index: 1;
    width: calc(366px * var(--fp-k, 1));
    height: calc(560px * var(--fp-k, 1));
    margin: auto;
    flex: none;
}

#ot-modal-usuario .ot-modal-caja.ot-fp {
    position: absolute;
    left: 0; top: 0;
    width: 390px; height: 600px;
    margin: 0; padding: 0;
    background: none; border: 0; border-radius: 0; box-shadow: none;
    text-align: left;
    transform-origin: 0 0;
    transform: translate(calc(-13.8px * var(--fp-k, 1)), calc(-34.5px * var(--fp-k, 1))) scale(var(--fp-k, 1)) translateY(18px);
    transition: transform .35s cubic-bezier(.3,1.4,.5,1);
}
#ot-modal-usuario.ot-on .ot-modal-caja.ot-fp {
    transform: translate(calc(-13.8px * var(--fp-k, 1)), calc(-34.5px * var(--fp-k, 1))) scale(var(--fp-k, 1));
}

.ot-fp .fp, .ot-fp .fp-campo > *, .ot-fp .fp-aviso > *, .ot-fp .fp-btn > * { position: absolute; display: block; user-select: none; -webkit-user-drag: none; }
.ot-fp img { pointer-events: none; }

.fp-fondo         { left: 13.8px;  top: 48px;    width: 365.7px; height: 544.5px; border-radius: 14px; object-fit: cover; z-index: 3; }
.fp-bandera-marco { left: 94.5px;  top: 76.5px;  width: 203.4px; height: 135.6px; object-fit: cover; z-index: 51; }
.fp-bandera       { left: 106.8px; top: 85.8px;  width: 179px;   height: 114.7px; border-radius: 13px; object-fit: cover; z-index: 54; background: #f2f4f9; }
.fp-trofeo        { left: 257.9px; top: 163px;   width: 57.3px;  height: 56.1px;  object-fit: cover; z-index: 57; animation: fp-trofeo-brilla 2.4s ease-in-out infinite; }
.fp-corona        { left: 166.3px; top: 34.5px;  width: 61.9px;  height: 41.7px;  object-fit: cover; z-index: 60; }
.fp-cinta         { left: 37.9px;  top: 211.5px; width: 317.7px; height: 94px;    border-radius: 14px; object-fit: cover; z-index: 42; }

.ot-fp .fp-t1, .ot-fp .fp-t2, .ot-fp .fp-sub {
    margin: 0; padding: 0; width: 256.1px; height: 28px; text-align: center; line-height: 14px; letter-spacing: 0;
    font-family: 'Lilita One', sans-serif; white-space: nowrap;
    text-shadow: 0 2px 0 rgb(30,25,60);
}
.ot-fp .fp-t1  { left: 68.5px; top: 230.5px; font-size: 19px; color: #fff; z-index: 45; }
.ot-fp .fp-t2  { left: 67px;   top: 258.5px; font-size: 34px; color: #FFCC00; z-index: 48; }
.ot-fp .fp-sub { white-space: nowrap; left: 71.6px; top: 305.5px; width: 251.7px; font-size: 16px; color: #fff; z-index: 39; font-weight: 400; }

/* Campo de nombre */
.ot-fp .fp-campo { left: 0; top: 0; width: 390px; height: 844px; pointer-events: none; z-index: 24; }
.fp-campo-bg      { left: 44.9px;  top: 353.1px; width: 304.5px; height: 52.9px; object-fit: cover; }
.fp-campo-ico     { left: 54.1px;  top: 362.1px; width: 39.3px;  height: 36.1px; object-fit: cover; }
.fp-campo-cont-bg { left: 300px;   top: 365.6px; width: 41.3px;  height: 28.9px; object-fit: cover; }
.ot-fp .fp-campo .ot-input {
    left: 104.2px; top: 360px; width: 193.6px; height: 40px; margin: 0; padding: 0;
    pointer-events: auto; background: transparent; border: 0; border-radius: 0; box-shadow: none;
    text-align: left; font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 16px; letter-spacing: 0; color: #fff;
    text-shadow: 0 2px 0 rgb(30,25,60);
}
.ot-fp .fp-campo .ot-input::placeholder { color: #fff; opacity: 1; font-weight: 400; }
.ot-fp .fp-campo .ot-input:focus::placeholder { opacity: .45; }
.ot-fp .fp-campo .ot-input:focus { border: 0; }
.ot-fp .fp-campo .ot-contador {
    left: 302px; top: 366.1px; right: auto; width: 37.1px; height: 28px; transform: none;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 13px; color: #fff; text-shadow: 0 2px 0 #000;
}

/* Mensaje de error (debajo del campo, encima del aviso) */
.ot-fp .fp-error {
    left: 48px; top: 405px; width: 294px; min-height: 0; height: 14px; margin: 0;
    text-align: center; font-size: 12px; line-height: 14px; z-index: 30; pointer-events: none;
}

/* Aviso */
.ot-fp .fp-aviso { left: 0; top: 0; width: 390px; height: 844px; pointer-events: none; z-index: 12; }
.fp-aviso-bg  { left: 47.3px; top: 421px;   width: 299.5px; height: 55.2px; object-fit: cover; }
.fp-aviso-ico { left: 56.6px; top: 431.2px; width: 26.9px;  height: 26.1px; object-fit: cover; }
.fp-aviso-txt {
    position: absolute; left: 83.6px; top: 431.2px; width: 253.8px; height: 28px; margin: 0;
    display: flex; flex-direction: column; justify-content: center; text-align: center;
    font-family: 'Lilita One', sans-serif; font-size: 14px; line-height: 14px; color: #fff; font-weight: 400;
    text-shadow: 0 2px 0 rgb(30,25,60); white-space: nowrap;
}
.fp-aviso-txt b { font-weight: 400; color: #FFCC00; }

/* Botón */
#ot-modal-usuario .ot-fp .ot-btn-guardar.fp-btn {
    all: unset; box-sizing: border-box; position: absolute; display: block; cursor: pointer;
    left: 47.3px; top: 489.9px; width: 300.1px; height: 66.7px; z-index: 6;
    background: none; border: 0; box-shadow: none; padding: 0; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent; transition: transform .1s, filter .1s;
}
.fp-btn-bg  { left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; }
.fp-btn-txt {
    left: 6.8px; top: 6px; width: 285px; height: 51.3px; display: flex !important; align-items: center; justify-content: center;
    text-align: center; font-family: 'Lilita One', sans-serif; font-size: 21px; line-height: 14px; color: rgb(35,18,0); white-space: nowrap;
}
#ot-modal-usuario .ot-fp .ot-btn-guardar.fp-btn:active { transform: translateY(4px); filter: brightness(.94); }

@keyframes fp-trofeo-brilla {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(255,209,0,.4)); }
    50%      { filter: drop-shadow(0 0 12px rgba(255,209,0,.95)); }
}
@media (prefers-reduced-motion: reduce) { .fp-trofeo { animation: none; } }
