.fw-boreal {
    --fw-boreal-size: 112px;
    --fw-boreal-mobile-size: 88px;
    --fw-boreal-bottom: 10px;
    position: fixed;
    right: 20px;
    bottom: var(--fw-boreal-bottom);
    z-index: 99990;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f7fbff;
}

.fw-boreal[data-position="left"] {
    right: auto;
    left: 20px;
}

.fw-boreal[hidden] { display: none !important; }

/* A corrida desloca apenas o contêiner externo. As animações já existentes
   continuam independentes dentro da imagem do Boreal. */
.fw-boreal.is-roaming {
    transition: transform var(--fw-boreal-roam-duration, 5200ms) linear;
    will-change: transform;
}

.fw-boreal.is-roaming.is-roaming-away {
    transform: translate3d(var(--fw-boreal-roam-x, 0), 0, 0);
}

.fw-boreal.fw-boreal--no-transition {
    transition: none !important;
}

.fw-boreal__mascot {
    display: block;
    width: var(--fw-boreal-size);
    height: calc(var(--fw-boreal-size) * 1.08);
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 45%;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .45));
    transition: transform .22s ease, filter .22s ease;
}

.fw-boreal[data-position="left"] .fw-boreal__mascot { margin: 0 auto 0 0; }

.fw-boreal__mascot:hover,
.fw-boreal__mascot:focus-visible {
    transform: translateY(-5px) scale(1.04);
    filter: drop-shadow(0 10px 18px rgba(0, 194, 255, .35));
    outline: none;
}

.fw-boreal__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    transform-origin: 50% 32%;
}

/* Movimento de segurança: continua visível mesmo se o navegador não reproduzir o WebP. */
.fw-boreal:not(.is-open) .fw-boreal__image {
    animation: fw-boreal-alive 7s ease-in-out infinite;
}

.fw-boreal.is-roaming .fw-boreal__image {
    animation: none !important;
}

.fw-boreal__mascot:hover .fw-boreal__image,
.fw-boreal__mascot:focus-visible .fw-boreal__image {
    animation: fw-boreal-look 1.15s ease-in-out 1;
}

@keyframes fw-boreal-alive {
    0%, 68%, 100% { transform: translateY(0) rotate(0deg); }
    74% { transform: translateY(-1px) rotate(-1.8deg); }
    81% { transform: translateY(0) rotate(1.2deg); }
    88% { transform: translateY(-1px) rotate(-.7deg); }
    94% { transform: translateY(0) rotate(.35deg); }
}

@keyframes fw-boreal-look {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    28% { transform: translateY(-2px) rotate(-3deg); }
    58% { transform: translateY(-1px) rotate(2deg); }
    80% { transform: translateY(0) rotate(-.7deg); }
}

.fw-boreal__panel {
    position: absolute;
    right: 0;
    bottom: calc(var(--fw-boreal-size) * 1.08 + 10px);
    width: min(390px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid rgba(0, 194, 255, .42);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(4, 10, 20, .97), rgba(12, 26, 43, .96));
    box-shadow: 0 18px 54px rgba(0, 0, 0, .48), 0 0 24px rgba(0, 194, 255, .12);
    backdrop-filter: blur(16px) saturate(130%);
    -webkit-backdrop-filter: blur(16px) saturate(130%);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.fw-boreal[data-position="left"] .fw-boreal__panel {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.fw-boreal.is-open .fw-boreal__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.fw-boreal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 16px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    background: linear-gradient(90deg, rgba(0, 194, 255, .13), rgba(255, 132, 0, .1));
}

.fw-boreal__title { display: block; color: #fff; font-size: 17px; line-height: 1.15; }
.fw-boreal__status { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #b9cfdf; font-size: 11px; }
.fw-boreal__status i { width: 7px; height: 7px; border-radius: 50%; background: #00ffa6; box-shadow: 0 0 8px #00ffa6; }

.fw-boreal__close,
.fw-boreal__nudge-close {
    border: 0;
    background: transparent;
    color: #b9cfdf;
    cursor: pointer;
    font-size: 25px;
    line-height: 1;
}

.fw-boreal__close:hover,
.fw-boreal__nudge-close:hover { color: #fff; }

.fw-boreal__conversation {
    display: flex;
    flex-direction: column;
    max-height: min(570px, calc(100vh - 170px));
    padding: 16px;
}

.fw-boreal__messages {
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-height: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1px 4px 3px 1px;
    scrollbar-color: rgba(0, 194, 255, .45) transparent;
    scrollbar-width: thin;
}

.fw-boreal__message {
    align-self: flex-start;
    max-width: 92%;
    padding: 12px 14px;
    border-radius: 14px 14px 14px 4px;
    background: rgba(0, 194, 255, .11);
    border: 1px solid rgba(0, 194, 255, .2);
    color: #eaf8ff;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.fw-boreal__message--user {
    align-self: flex-end;
    border-color: rgba(255, 151, 35, .28);
    border-radius: 14px 14px 4px 14px;
    background: rgba(255, 132, 0, .13);
    color: #fff5e8;
}

.fw-boreal__message--typing {
    color: #a9c7da;
    font-style: italic;
}

.fw-boreal__choices { display: grid; gap: 8px; margin-top: 12px; }

.fw-boreal__chat-form {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding: 7px 7px 7px 11px;
    border: 1px solid rgba(0, 194, 255, .28);
    border-radius: 14px;
    background: rgba(255, 255, 255, .055);
}

.fw-boreal__chat-form[hidden] { display: none !important; }

.fw-boreal__input {
    width: 100%;
    min-height: 36px;
    max-height: 96px;
    margin: 0;
    padding: 7px 2px;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: #f7fbff;
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
}

.fw-boreal__input::placeholder { color: #819bab; }

.fw-boreal__send {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(0, 255, 166, .48);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(0, 194, 255, .25), rgba(0, 255, 166, .2));
    color: #fff;
    cursor: pointer;
    font-size: 17px;
}

.fw-boreal__send:hover,
.fw-boreal__send:focus-visible {
    border-color: #00ffa6;
    background: rgba(0, 255, 166, .25);
    outline: none;
}

.fw-boreal__send:disabled,
.fw-boreal__input:disabled { cursor: wait; opacity: .55; }

.fw-boreal__website {
    position: fixed !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.fw-boreal__privacy {
    margin: 7px 2px 0;
    color: #718b9d;
    font-size: 9px;
    line-height: 1.3;
}

.fw-boreal__privacy[hidden] { display: none !important; }

.fw-boreal__choice {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 11px;
    background: rgba(255, 255, 255, .055);
    color: #f7fbff;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    text-align: left;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.fw-boreal__choice:hover,
.fw-boreal__choice:focus-visible {
    border-color: rgba(0, 194, 255, .62);
    background: rgba(0, 194, 255, .12);
    transform: translateX(2px);
    outline: none;
}

.fw-boreal__choice--primary {
    border-color: rgba(0, 255, 166, .45);
    background: rgba(0, 255, 166, .11);
}

.fw-boreal__footer {
    padding: 9px 14px 11px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #7f9db3;
    font-size: 10px;
    text-align: center;
    letter-spacing: .02em;
}

.fw-boreal__nudge {
    position: absolute;
    right: calc(var(--fw-boreal-size) - 12px);
    bottom: calc(var(--fw-boreal-size) * .7);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 142px;
    padding: 9px 9px 9px 12px;
    border: 1px solid rgba(0, 194, 255, .36);
    border-radius: 14px 14px 4px 14px;
    background: rgba(4, 10, 20, .95);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .32);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: .2s ease;
}

.fw-boreal[data-position="left"] .fw-boreal__nudge {
    right: auto;
    left: calc(var(--fw-boreal-size) - 12px);
    border-radius: 14px 14px 14px 4px;
}

.fw-boreal.show-nudge:not(.is-open) .fw-boreal__nudge {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fw-boreal__nudge-close { font-size: 17px; }

@media (max-width: 600px) {
    .fw-boreal { right: 12px; --fw-boreal-size: var(--fw-boreal-mobile-size); }
    .fw-boreal[data-position="left"] { right: auto; left: 12px; }
    .fw-boreal__panel { position: fixed; right: 12px; left: 12px; bottom: calc(var(--fw-boreal-bottom) + var(--fw-boreal-size) + 8px); width: auto; }
    .fw-boreal[data-position="left"] .fw-boreal__panel { right: 12px; left: 12px; }
    .fw-boreal__nudge { right: calc(var(--fw-boreal-size) - 7px); bottom: calc(var(--fw-boreal-size) * .65); }
    .fw-boreal__conversation { max-height: min(520px, calc(100vh - 155px)); }
    .fw-boreal__messages { max-height: 245px; }
}

@media (prefers-reduced-motion: reduce) {
    .fw-boreal *, .fw-boreal *::before, .fw-boreal *::after { transition-duration: .01ms !important; }
}
