/*!
 * mascota-game.css — Juego "encuentra a Vapi" (recompensa mascota)
 * -----------------------------------------------------------------------------
 * Todas las clases van bajo el espacio de nombres mascota-game-* / mg-*.
 * Sin variables CSS ni features modernas: el sitio legacy debe soportarlo en
 * navegadores antiguos. Se usan prefijos -webkit-/-moz-/-o- donde aporta.
 */

/* -----------------------------------------------------------------------------
 * 1. Nodo de arranque (solo contrato con PHP, nunca visible)
 * -------------------------------------------------------------------------- */
#mascota-game {
    display: none !important;
}

/* -----------------------------------------------------------------------------
 * 2. Mascota escondida
 *    .mascota-game-wrapper es el contenedor RECORTANTE: su tamano es la parte
 *    visible del cuerpo. El resto queda fuera por overflow:hidden y, en modo
 *    peek_behind, ademas por debajo del elemento ancla (z-index menor).
 * -------------------------------------------------------------------------- */
.mascota-game-wrapper {
    position: absolute;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    pointer-events: none; /* decorativo: nunca roba ni bloquea clicks */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* peek_behind: por DEBAJO del ancla (que se eleva a z-index 2 desde JS). */
.mascota-game-wrapper--behind {
    z-index: 1;
}

/* edge / free: no hay nada tras lo que esconderse, debe verse sobre el fondo. */
.mascota-game-wrapper--front {
    z-index: 9998;
}

.mascota-game-inner {
    position: absolute;
    display: block;
    line-height: 0;
    pointer-events: none;
    -webkit-transform-origin: 50% 80%;
    -ms-transform-origin: 50% 80%;
    transform-origin: 50% 80%;
    filter: drop-shadow(0 2px 3px rgba(14, 58, 99, 0.28));
}

.mascota-game-inner svg {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Entrada: aparece con un pequeno pop, una sola vez. */
.mascota-game-wrapper.mg-enter .mascota-game-inner {
    -webkit-animation: mgEnter 420ms ease-out 1 both;
    -moz-animation: mgEnter 420ms ease-out 1 both;
    -o-animation: mgEnter 420ms ease-out 1 both;
    animation: mgEnter 420ms ease-out 1 both;
}

/* Animacion de atencion (solo en fase boost, la decide el servidor):
 * balanceo vertical suave de +-3px con ligera inclinacion. */
.mascota-game-inner.mg-idle {
    -webkit-animation: mgIdle 2600ms ease-in-out infinite;
    -moz-animation: mgIdle 2600ms ease-in-out infinite;
    -o-animation: mgIdle 2600ms ease-in-out infinite;
    animation: mgIdle 2600ms ease-in-out infinite;
}

/* Si hay entrada + idle, el idle arranca tras la entrada. */
.mascota-game-wrapper.mg-enter .mascota-game-inner.mg-idle {
    -webkit-animation: mgEnter 420ms ease-out 1 both, mgIdle 2600ms ease-in-out 420ms infinite;
    -moz-animation: mgEnter 420ms ease-out 1 both, mgIdle 2600ms ease-in-out 420ms infinite;
    -o-animation: mgEnter 420ms ease-out 1 both, mgIdle 2600ms ease-in-out 420ms infinite;
    animation: mgEnter 420ms ease-out 1 both, mgIdle 2600ms ease-in-out 420ms infinite;
}

@-webkit-keyframes mgEnter {
    0%   { opacity: 0; -webkit-transform: scale(0.6) translateY(6px); }
    60%  { opacity: 1; -webkit-transform: scale(1.08) translateY(-2px); }
    100% { opacity: 1; -webkit-transform: scale(1) translateY(0); }
}
@-moz-keyframes mgEnter {
    0%   { opacity: 0; -moz-transform: scale(0.6) translateY(6px); }
    60%  { opacity: 1; -moz-transform: scale(1.08) translateY(-2px); }
    100% { opacity: 1; -moz-transform: scale(1) translateY(0); }
}
@keyframes mgEnter {
    0%   { opacity: 0; transform: scale(0.6) translateY(6px); }
    60%  { opacity: 1; transform: scale(1.08) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@-webkit-keyframes mgIdle {
    0%   { -webkit-transform: translateY(0) rotate(0deg); }
    25%  { -webkit-transform: translateY(-3px) rotate(-2.5deg); }
    50%  { -webkit-transform: translateY(0) rotate(0deg); }
    75%  { -webkit-transform: translateY(3px) rotate(2.5deg); }
    100% { -webkit-transform: translateY(0) rotate(0deg); }
}
@-moz-keyframes mgIdle {
    0%   { -moz-transform: translateY(0) rotate(0deg); }
    25%  { -moz-transform: translateY(-3px) rotate(-2.5deg); }
    50%  { -moz-transform: translateY(0) rotate(0deg); }
    75%  { -moz-transform: translateY(3px) rotate(2.5deg); }
    100% { -moz-transform: translateY(0) rotate(0deg); }
}
@keyframes mgIdle {
    0%   { transform: translateY(0) rotate(0deg); }
    25%  { transform: translateY(-3px) rotate(-2.5deg); }
    50%  { transform: translateY(0) rotate(0deg); }
    75%  { transform: translateY(3px) rotate(2.5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* -----------------------------------------------------------------------------
 * 3. Area de pulsacion
 *    Transparente, minimo 44x44 px, sobre TODO lo que tenga alrededor.
 *    Es el unico elemento del juego que recibe eventos en la pagina.
 * -------------------------------------------------------------------------- */
.mascota-game-hit {
    position: absolute;
    z-index: 2147483000;
    display: block;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    background: rgba(255, 255, 255, 0); /* superficie tactil real en iOS */
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mascota-game-hit:focus {
    outline: 2px solid #3E9BEC;
    outline-offset: 2px;
}

.mascota-game-hit[aria-disabled="true"] {
    cursor: default;
    pointer-events: none;
}

/* -----------------------------------------------------------------------------
 * 4. Overlay de celebracion (implementacion propia, sin colorbox)
 * -------------------------------------------------------------------------- */
.mascota-game-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483600;
    display: block;
    text-align: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mg-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    background: #0E3A63;
    background: rgba(6, 26, 46, 0.72);
}

/* El canvas de fuegos artificiales queda sobre el backdrop, bajo la tarjeta. */
.mg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mg-card {
    position: relative;
    z-index: 3;
    display: inline-block;
    width: 92%;
    max-width: 460px;
    margin: 6% auto 40px auto;
    padding: 26px 24px 22px 24px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 14px 40px rgba(6, 26, 46, 0.45);
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    color: #14456F;
    vertical-align: top;
}

.mg-card--in {
    -webkit-animation: mgCardIn 340ms ease-out 1 both;
    -moz-animation: mgCardIn 340ms ease-out 1 both;
    -o-animation: mgCardIn 340ms ease-out 1 both;
    animation: mgCardIn 340ms ease-out 1 both;
}

@-webkit-keyframes mgCardIn {
    0%   { opacity: 0; -webkit-transform: translateY(18px) scale(0.94); }
    100% { opacity: 1; -webkit-transform: translateY(0) scale(1); }
}
@-moz-keyframes mgCardIn {
    0%   { opacity: 0; -moz-transform: translateY(18px) scale(0.94); }
    100% { opacity: 1; -moz-transform: translateY(0) scale(1); }
}
@keyframes mgCardIn {
    0%   { opacity: 0; transform: translateY(18px) scale(0.94); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.mg-figure {
    display: block;
    margin: 0 auto 14px auto;
    line-height: 0;
}

.mg-figure-img,
.mg-figure-fallback {
    display: block;
    width: 320px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.mg-figure-fallback {
    width: 320px;
    height: 320px;
    max-width: 100%;
}

.mg-figure-fallback svg {
    display: block;
    width: 100%;
    height: 100%;
}

.mg-eyebrow {
    margin: 0 0 6px 0;
    padding: 0;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #3E9BEC;
}

.mg-title {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: bold;
    color: #0E3A63;
}

.mg-reminder {
    margin: -6px 0 16px 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #EDF7E4;
    color: #2d5016;
    font-size: 14px;
    line-height: 1.4;
    font-weight: bold;
}

.mg-msg {
    margin: 0 0 18px 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.45;
    color: #33556F;
}

.mg-actions {
    display: block;
    margin: 0;
    padding: 0;
}

.mg-btn {
    display: inline-block;
    margin: 5px 4px;
    padding: 11px 20px;
    border: 0;
    border-radius: 6px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

.mg-btn--cta,
.mg-btn--cta:link,
.mg-btn--cta:visited {
    background: #3E9BEC;
    color: #ffffff;
    text-decoration: none;
}

.mg-btn--cta:hover,
.mg-btn--cta:focus {
    background: #2D86D4;
    color: #ffffff;
    text-decoration: none;
}

.mg-btn--close {
    background: #EDF4FA;
    color: #14456F;
}

.mg-btn--close:hover,
.mg-btn--close:focus {
    background: #DCE9F5;
}

.mg-x {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #7B95AB;
    font-size: 26px;
    line-height: 34px;
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

.mg-x:hover,
.mg-x:focus {
    color: #14456F;
}

/* -----------------------------------------------------------------------------
 * 5. Tooltip del saldo (premio tipo credit)
 * -------------------------------------------------------------------------- */
.mascota-game-tip {
    position: absolute;
    z-index: 2147483500;
    max-width: 260px;
    padding: 9px 13px;
    border-radius: 8px;
    background: #14456F;
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 6px 18px rgba(6, 26, 46, 0.35);
    cursor: pointer;
}

.mg-tip-text {
    display: block;
}

/* Flecha apuntando hacia arriba, al elemento de saldo. */
.mg-tip-arrow {
    position: absolute;
    top: -8px;
    left: 50%;
    display: block;
    width: 0;
    height: 0;
    margin-left: -8px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #14456F;
}

.mg-tip--in {
    -webkit-animation: mgTipIn 300ms ease-out 1 both, mgTipNudge 1400ms ease-in-out 300ms infinite;
    -moz-animation: mgTipIn 300ms ease-out 1 both, mgTipNudge 1400ms ease-in-out 300ms infinite;
    -o-animation: mgTipIn 300ms ease-out 1 both, mgTipNudge 1400ms ease-in-out 300ms infinite;
    animation: mgTipIn 300ms ease-out 1 both, mgTipNudge 1400ms ease-in-out 300ms infinite;
}

@-webkit-keyframes mgTipIn {
    0%   { opacity: 0; -webkit-transform: translateY(-8px); }
    100% { opacity: 1; -webkit-transform: translateY(0); }
}
@-moz-keyframes mgTipIn {
    0%   { opacity: 0; -moz-transform: translateY(-8px); }
    100% { opacity: 1; -moz-transform: translateY(0); }
}
@keyframes mgTipIn {
    0%   { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}

@-webkit-keyframes mgTipNudge {
    0%   { -webkit-transform: translateY(0); }
    50%  { -webkit-transform: translateY(-4px); }
    100% { -webkit-transform: translateY(0); }
}
@-moz-keyframes mgTipNudge {
    0%   { -moz-transform: translateY(0); }
    50%  { -moz-transform: translateY(-4px); }
    100% { -moz-transform: translateY(0); }
}
@keyframes mgTipNudge {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}

/* -----------------------------------------------------------------------------
 * 6. Movil
 * -------------------------------------------------------------------------- */
@media screen and (max-width: 760px) {
    .mg-card {
        width: 94%;
        max-width: 94%;
        margin: 14% auto 30px auto;
        padding: 20px 16px 18px 16px;
    }

    .mg-figure-img,
    .mg-figure-fallback {
        width: 200px;
    }

    .mg-figure-fallback {
        height: 200px;
    }

    .mg-title {
        font-size: 20px;
    }

    .mg-msg {
        font-size: 15px;
    }

    .mg-btn {
        display: block;
        width: 100%;
        margin: 7px 0 0 0;
        padding: 13px 16px;
        text-align: center;
    }

    .mascota-game-tip {
        max-width: 220px;
        font-size: 12px;
    }
}

@media screen and (max-width: 400px) {
    .mg-figure-img,
    .mg-figure-fallback {
        width: 160px;
    }

    .mg-figure-fallback {
        height: 160px;
    }
}

/* -----------------------------------------------------------------------------
 * 7. Movimiento reducido: sin balanceo, sin entrada, sin animaciones.
 *    (El JS ademas desactiva fuegos artificiales y cuenta atras del saldo.)
 * -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .mascota-game-wrapper.mg-enter .mascota-game-inner,
    .mascota-game-wrapper.mg-enter .mascota-game-inner.mg-idle,
    .mascota-game-inner.mg-idle,
    .mg-card--in,
    .mg-tip--in {
        -webkit-animation: none !important;
        -moz-animation: none !important;
        -o-animation: none !important;
        animation: none !important;
        opacity: 1 !important;
        -webkit-transform: none !important;
        -ms-transform: none !important;
        transform: none !important;
    }

    .mg-canvas {
        display: none !important;
    }
}

/* Enlace discreto a las bases legales de la promoción, al pie de la tarjeta. */
.mg-terms {
    display: block;
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    color: #7a8699;
    text-decoration: underline;
}
.mg-terms:hover,
.mg-terms:focus {
    color: #1f76cb;
}

/* -----------------------------------------------------------------------------
 * 8. Popup de anuncio de la caza (gaming)
 * -------------------------------------------------------------------------- */
.mg-card--hunt {
    max-width: 520px;
    background: #0B1F3A;
    background: -webkit-linear-gradient(160deg, #0B1F3A 0%, #123057 55%, #1B3F6E 100%);
    background: -moz-linear-gradient(160deg, #0B1F3A 0%, #123057 55%, #1B3F6E 100%);
    background: -o-linear-gradient(160deg, #0B1F3A 0%, #123057 55%, #1B3F6E 100%);
    background: linear-gradient(160deg, #0B1F3A 0%, #123057 55%, #1B3F6E 100%);
    color: #DCE9F7;
    border: 1px solid rgba(95, 224, 245, 0.35);
    box-shadow: 0 0 0 1px rgba(14, 58, 99, 0.6),
                0 18px 55px rgba(2, 12, 26, 0.65),
                0 0 42px rgba(62, 155, 236, 0.25);
}

.mg-card--hunt .mg-title {
    color: #5FE0F5;
    text-shadow: 0 0 14px rgba(95, 224, 245, 0.45);
}

.mg-card--hunt .mg-msg {
    color: #B9CFE4;
}

.mg-card--hunt .mg-x {
    color: #7FA8CC;
}

.mg-card--hunt .mg-x:hover,
.mg-card--hunt .mg-x:focus {
    color: #FFFFFF;
}

.mg-card--hunt .mg-terms {
    color: #6E8DB0;
}

.mg-card--hunt .mg-terms:hover,
.mg-card--hunt .mg-terms:focus {
    color: #5FE0F5;
}

.mg-figure--hero .mg-figure-img,
.mg-figure--hero .mg-figure-fallback {
    width: 210px;
}

.mg-figure--hero .mg-figure-fallback {
    height: 210px;
}

.mg-hints {
    display: block;
    margin: 0 0 16px 0;
    padding: 0;
}

.mg-hint {
    display: block;
    margin: 8px 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(95, 224, 245, 0.30);
    background: rgba(10, 34, 64, 0.55);
    color: #EAF4FF;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    -webkit-transition: border-color 160ms ease, background 160ms ease;
    -moz-transition: border-color 160ms ease, background 160ms ease;
    -o-transition: border-color 160ms ease, background 160ms ease;
    transition: border-color 160ms ease, background 160ms ease;
}

.mg-hint:link,
.mg-hint:visited {
    color: #EAF4FF;
    text-decoration: none;
}

.mg-hint:hover,
.mg-hint:focus {
    border-color: #5FE0F5;
    background: rgba(23, 60, 108, 0.75);
    color: #FFFFFF;
    text-decoration: none;
}

.mg-hint-icon {
    display: inline-block;
    width: 26px;
    height: 26px;
    margin-right: 10px;
    border-radius: 50%;
    background: #3E9BEC;
    color: #FFFFFF;
    font-size: 15px;
    font-weight: bold;
    line-height: 26px;
    text-align: center;
    vertical-align: middle;
    box-shadow: 0 0 10px rgba(62, 155, 236, 0.65);
}

.mg-hint-label {
    display: inline-block;
    vertical-align: middle;
    max-width: 86%;
}

/* CTA del popup gaming: acento neon sobre el tema oscuro. */
.mg-card--hunt .mg-btn--cta,
.mg-card--hunt .mg-btn--cta:link,
.mg-card--hunt .mg-btn--cta:visited {
    background: #FF7B4F;
    color: #101F30;
    box-shadow: 0 0 16px rgba(255, 123, 79, 0.45);
}

.mg-card--hunt .mg-btn--cta:hover,
.mg-card--hunt .mg-btn--cta:focus {
    background: #FF9066;
    color: #101F30;
}

/* Texto-guia que sustituye al boton CTA en el popup de caza. */
.mg-cta-note {
    display: block;
    margin: 10px 0 4px 0;
    padding: 12px 18px;
    border-radius: 8px;
    background: rgba(255, 123, 79, 0.16);
    border: 1px dashed rgba(255, 123, 79, 0.55);
    color: #FFB08F;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.35;
    text-align: center;
}

/* Opt-out discreto bajo las acciones. */
.mg-optout {
    display: block;
    margin: 12px auto 0 auto;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: #6E8DB0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: underline;
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

.mg-optout:hover,
.mg-optout:focus {
    color: #B9CFE4;
}

@media screen and (max-width: 760px) {
    .mg-card--hunt {
        max-width: 94%;
    }

    .mg-figure--hero .mg-figure-img,
    .mg-figure--hero .mg-figure-fallback {
        width: 150px;
    }

    .mg-figure--hero .mg-figure-fallback {
        height: 150px;
    }

    .mg-hint {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mg-hint {
        -webkit-transition: none !important;
        -moz-transition: none !important;
        -o-transition: none !important;
        transition: none !important;
    }
}

/* -----------------------------------------------------------------------------
 * 9. Chip flotante de la caza minimizada (popup persistente, D23)
 * -------------------------------------------------------------------------- */
.mg-chip {
    position: fixed;
    /* Abajo-derecha, sobre la burbuja «Contáctanos»: la esquina izquierda la
     * ocupa el banner de cookies. */
    right: 14px;
    bottom: 76px;
    z-index: 2147483200;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px 8px 10px;
    border: 1px solid rgba(95, 224, 245, 0.45);
    border-radius: 999px;
    background: #0B1F3A;
    color: #EAF4FF;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(2, 12, 26, 0.55), 0 0 18px rgba(62, 155, 236, 0.35);
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    -webkit-animation: mgChipIn 260ms ease-out 1 both;
    -moz-animation: mgChipIn 260ms ease-out 1 both;
    -o-animation: mgChipIn 260ms ease-out 1 both;
    animation: mgChipIn 260ms ease-out 1 both;
}

.mg-chip:hover,
.mg-chip:focus {
    border-color: #5FE0F5;
    box-shadow: 0 6px 22px rgba(2, 12, 26, 0.55), 0 0 26px rgba(95, 224, 245, 0.55);
}

.mg-chip-icon {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 0;
}

.mg-chip-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.mg-chip-label {
    display: block;
    white-space: nowrap;
}

@-webkit-keyframes mgChipIn {
    0%   { opacity: 0; -webkit-transform: translateY(10px) scale(0.9); }
    100% { opacity: 1; -webkit-transform: translateY(0) scale(1); }
}
@-moz-keyframes mgChipIn {
    0%   { opacity: 0; -moz-transform: translateY(10px) scale(0.9); }
    100% { opacity: 1; -moz-transform: translateY(0) scale(1); }
}
@keyframes mgChipIn {
    0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media screen and (max-width: 760px) {
    .mg-chip {
        right: 10px;
        bottom: 66px;
        font-size: 13px;
        padding: 7px 14px 7px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mg-chip {
        -webkit-animation: none !important;
        -moz-animation: none !important;
        -o-animation: none !important;
        animation: none !important;
    }
}
