.ff-brave-mascot {
    position: fixed;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 9998;
    width: var(--ff-brave-mascot-size, 170px);
    line-height: 0;
    filter: drop-shadow(0 10px 14px rgba(20, 25, 32, 0.18));
    transition: opacity 180ms ease, transform 180ms ease;
}

.ff-brave-mascot--right {
    right: max(14px, env(safe-area-inset-right));
}

.ff-brave-mascot--left {
    left: max(14px, env(safe-area-inset-left));
}

.ff-brave-mascot__character,
.ff-brave-mascot__close {
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    cursor: pointer;
}

.ff-brave-mascot__character {
    display: block;
    width: 100%;
    line-height: 0;
    transform-origin: 50% 90%;
}

.ff-brave-mascot__character img {
    display: block;
    width: 100%;
    height: auto;
    border: 0;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.ff-brave-mascot__sprite {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    background-image: url('ff-brave-mascot-sprite.webp');
    background-repeat: no-repeat;
    background-size: 400% 200%;
    background-position: 0 0;
}

.ff-brave-mascot[data-state="blink"] .ff-brave-mascot__sprite { background-position: 33.333% 0; }
.ff-brave-mascot[data-state="look-left"] .ff-brave-mascot__sprite { background-position: 66.666% 0; }
.ff-brave-mascot[data-state="look-right"] .ff-brave-mascot__sprite { background-position: 100% 0; }
.ff-brave-mascot[data-state="wave"] .ff-brave-mascot__sprite { background-position: 0 100%; }
.ff-brave-mascot[data-state="hop"] .ff-brave-mascot__sprite { background-position: 33.333% 100%; }
.ff-brave-mascot[data-state="laugh"] .ff-brave-mascot__sprite { background-position: 66.666% 100%; }
.ff-brave-mascot[data-state="sleepy"] .ff-brave-mascot__sprite { background-position: 100% 100%; }

.ff-brave-mascot--animated .ff-brave-mascot__character {
    animation: ff-brave-mascot-float 3.2s ease-in-out infinite;
}

.ff-brave-mascot__character.is-reacting {
    animation: ff-brave-mascot-react 520ms ease both;
}

.ff-brave-mascot[data-state="hop"] .ff-brave-mascot__character {
    animation: ff-brave-mascot-hop 620ms cubic-bezier(.2, .8, .35, 1) both;
}

.ff-brave-mascot[data-state="wave"] .ff-brave-mascot__character,
.ff-brave-mascot[data-state="laugh"] .ff-brave-mascot__character {
    animation: ff-brave-mascot-react 620ms ease both;
}

.ff-brave-mascot__close {
    position: absolute;
    top: 2%;
    right: 0;
    z-index: 1;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: rgba(28, 32, 38, 0.78);
    color: #fff;
    font: 22px/1 Arial, sans-serif;
    opacity: 0;
    transition: opacity 160ms ease, background-color 160ms ease;
}

.ff-brave-mascot:hover .ff-brave-mascot__close,
.ff-brave-mascot:focus-within .ff-brave-mascot__close {
    opacity: 1;
}

.ff-brave-mascot__close:hover,
.ff-brave-mascot__close:focus-visible {
    background: #b42318;
}

.ff-brave-mascot.is-hidden {
    pointer-events: none;
    opacity: 0;
    transform: translateY(24px) scale(0.9);
}

@keyframes ff-brave-mascot-float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes ff-brave-mascot-react {
    0%, 100% { transform: translateY(0) rotate(0) scale(1); }
    35% { transform: translateY(-18px) rotate(-4deg) scale(1.06); }
    65% { transform: translateY(-8px) rotate(4deg) scale(1.03); }
}

@keyframes ff-brave-mascot-hop {
    0%, 100% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-22px) scale(1.04); }
    70% { transform: translateY(-5px) scale(0.98); }
}

@media (max-width: 782px) {
    .ff-brave-mascot {
        width: var(--ff-brave-mascot-mobile-size, 105px);
    }

    .ff-brave-mascot__close {
        width: 26px;
        height: 26px;
        opacity: 0.9;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ff-brave-mascot,
    .ff-brave-mascot__character,
    .ff-brave-mascot__close {
        animation: none !important;
        transition: none !important;
    }
}
