.mercury-chat {
    position: relative;
    z-index: 2147483647;
}

.mercury-chat__panel {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: clamp(350px, 25vw, 460px);
    height: 75vh;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    display: none;
}

    .mercury-chat__panel.is-open {
        display: block;
    }

.mercury-chat__iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    overflow: auto;
}

.mercury-chat__panel.is-open .mercury-chat__iframe {
    transform: translateY(0);
    opacity: 1;
}

.mercury-chat__toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: transparent;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 2147483647;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mercury-chat__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: block;
    transition: transform 0.2s ease;
}

.mercury-chat__toggle.is-hidden {
    display: none;
}

@media (max-width: 900px) {
    .mercury-chat__toggle {
        right: 12px;
        bottom: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mercury-chat__iframe {
        transition: none;
    }
}

.mercury-chat__controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 2;
    pointer-events: auto;
}

.mc-btn {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    padding: 0;
}

    .mc-btn:hover {
        background: rgba(0,0,0,0.8);
    }

    .mc-btn svg {
        stroke: none;
        fill: currentColor;
    }

#mercuryChatMax .icon-close {
    display: none;
}

#mercuryChatMax .icon-open,
#mercuryChatMax .icon-close {
    fill: currentColor;
    stroke: none;
}

.mercury-chat__panel.is-fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
}

    .mercury-chat__panel.is-fullscreen .mercury-chat__iframe {
        border-radius: 0;
    }

    .mercury-chat__panel.is-fullscreen #mercuryChatMax .icon-open {
        display: none;
    }

    .mercury-chat__panel.is-fullscreen #mercuryChatMax .icon-close {
        display: inline;
    }
