/* Sticky Talk With Me — bottom right */
.hm-talk-fab {
    position: fixed;
    right: 20px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 99985;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.hm-talk-fab__trigger,
.hm-talk-fab__hangup {
    pointer-events: auto;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    border: 0;
    padding: 0;
    margin: 0;
}

.hm-talk-fab__trigger {
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: #05053e;
}

.hm-talk-fab__idle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 8px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 8px 24px rgba(91, 77, 176, 0.16);
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
}

.hm-talk-fab__trigger:hover .hm-talk-fab__idle {
    transform: translateY(-2px);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.12),
        0 12px 28px rgba(91, 77, 176, 0.22);
}

.hm-talk-fab__trigger:focus-visible {
    outline: 2px solid #7b61ff;
    outline-offset: 3px;
    border-radius: 999px;
}

.hm-talk-fab__avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #c4b8f0;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f5f4ff 0%, #dcd6f8 45%, #9b8de8 100%);
}

.hm-talk-fab__avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.hm-talk-fab__label {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 18px;
    white-space: nowrap;
    padding-right: 2px;
}

.hm-talk-fab__mic-chip {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    color: #ffffff;
    background: linear-gradient(180deg, #8b7cff 0%, #6b5bff 55%, #5546d4 100%);
    box-shadow: 0 4px 10px rgba(107, 91, 255, 0.35);
}

.hm-talk-fab__mic-chip svg {
    display: block;
}

/* Active call UI — radar mic (matches Hello Brittany) */
.hm-talk-fab__call {
    display: none;
    align-items: center;
    justify-content: center;
}

.hm-talk-fab__orbit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(79, 57, 255, 0.04);
}

.hm-talk-fab__orbit::before,
.hm-talk-fab__orbit::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.hm-talk-fab__orbit::before {
    inset: 8px;
    background: rgba(79, 57, 255, 0.05);
}

.hm-talk-fab__orbit::after {
    inset: 16px;
    background: rgba(79, 57, 255, 0.1);
}

.hm-talk-fab__sphere {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid #9d7bff;
    color: #ffffff;
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 40%),
        radial-gradient(circle at 50% 44%, #7b61ff 0%, #624ecc 41%, #4a3a99 82%);
    box-shadow:
        0 3px 4px rgba(92, 69, 199, 0.28),
        0 10px 20px rgba(74, 58, 153, 0.28),
        inset 0 -8px 14px rgba(40, 28, 100, 0.42),
        inset 0 6px 12px rgba(255, 255, 255, 0.18);
}

.hm-talk-fab__sphere svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 1px 1px rgba(40, 28, 100, 0.35));
}

.hm-talk-fab__sphere::before,
.hm-talk-fab__sphere::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid #6855c7;
    background: transparent;
    pointer-events: none;
    opacity: 0;
    transform: scale(1);
}

/* Active / connecting — keep white pill like idle, centered horizontally */
.hm-talk-fab[data-state="connecting"],
.hm-talk-fab[data-state="live"] {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    gap: 8px;
    padding: 8px 10px 8px 8px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 8px 24px rgba(91, 77, 176, 0.16);
}

.hm-talk-fab[data-state="connecting"] .hm-talk-fab__idle,
.hm-talk-fab[data-state="live"] .hm-talk-fab__idle {
    display: none;
}

.hm-talk-fab[data-state="connecting"] .hm-talk-fab__call,
.hm-talk-fab[data-state="live"] .hm-talk-fab__call {
    display: flex;
}

.hm-talk-fab[data-state="connecting"] .hm-talk-fab__sphere::before,
.hm-talk-fab[data-state="connecting"] .hm-talk-fab__sphere::after,
.hm-talk-fab[data-state="live"] .hm-talk-fab__sphere::before,
.hm-talk-fab[data-state="live"] .hm-talk-fab__sphere::after {
    animation: hm-talk-radar 2.4s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

.hm-talk-fab[data-state="connecting"] .hm-talk-fab__sphere::after,
.hm-talk-fab[data-state="live"] .hm-talk-fab__sphere::after {
    animation-delay: 1.2s;
    border-color: #4a3a99;
}

@keyframes hm-talk-radar {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }
    55% {
        opacity: 0.4;
    }
    100% {
        transform: scale(1.85);
        opacity: 0;
    }
}

.hm-talk-fab__hangup {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    color: #ffffff;
    background: linear-gradient(180deg, #ff6b6b 0%, #e23d3d 55%, #c62828 100%);
    box-shadow:
        0 3px 4px rgba(198, 40, 40, 0.28),
        0 8px 16px rgba(198, 40, 40, 0.3),
        inset 0 -8px 14px rgba(120, 20, 20, 0.35),
        inset 0 6px 10px rgba(255, 255, 255, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.hm-talk-fab__hangup[hidden] {
    display: none !important;
}

.hm-talk-fab__hangup:hover {
    transform: translateY(-1px) scale(1.03);
}

.hm-talk-fab__hangup:focus-visible {
    outline: 2px solid #e23d3d;
    outline-offset: 3px;
}

.hm-talk-fab__trigger:disabled {
    cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
    .hm-talk-fab[data-state="connecting"] .hm-talk-fab__sphere::before,
    .hm-talk-fab[data-state="connecting"] .hm-talk-fab__sphere::after,
    .hm-talk-fab[data-state="live"] .hm-talk-fab__sphere::before,
    .hm-talk-fab[data-state="live"] .hm-talk-fab__sphere::after {
        animation: none;
        opacity: 0.45;
        transform: scale(1.35);
    }

    .hm-talk-fab[data-state="connecting"] .hm-talk-fab__sphere::after,
    .hm-talk-fab[data-state="live"] .hm-talk-fab__sphere::after {
        transform: scale(1.7);
        opacity: 0.28;
    }
}

/* Keep scroll-to-top clear of Talk With Me */
body:has(.hm-talk-fab) .scroll-top-btn {
    bottom: 150px;
    right: 28px;
}

body:has(.hm-talk-fab[data-state="connecting"]) .scroll-top-btn,
body:has(.hm-talk-fab[data-state="live"]) .scroll-top-btn {
    bottom: 170px;
}

@media (max-width: 575px) {
    .hm-talk-fab {
        right: 12px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        gap: 10px;
    }

    .hm-talk-fab__idle {
        gap: 8px;
        padding: 6px 8px 6px 6px;
    }

    .hm-talk-fab__avatar {
        width: 42px;
        height: 42px;
    }

    .hm-talk-fab__avatar img {
        width: 34px;
        height: 34px;
    }

    .hm-talk-fab__label {
        font-size: 13px;
    }

    .hm-talk-fab__mic-chip {
        width: 36px;
        height: 36px;
    }

    .hm-talk-fab__mic-chip svg {
        width: 16px;
        height: 16px;
    }

    .hm-talk-fab__orbit {
        width: 64px;
        height: 64px;
    }

    .hm-talk-fab__sphere {
        width: 48px;
        height: 48px;
    }

    .hm-talk-fab__sphere svg {
        width: 20px;
        height: 20px;
    }

    .hm-talk-fab__hangup {
        width: 40px;
        height: 40px;
    }

    .hm-talk-fab[data-state="connecting"],
    .hm-talk-fab[data-state="live"] {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        gap: 6px;
        padding: 6px 8px 6px 6px;
    }

    body:has(.hm-talk-fab) .scroll-top-btn {
        bottom: 130px;
        right: 18px;
    }

    body:has(.hm-talk-fab[data-state="connecting"]) .scroll-top-btn,
    body:has(.hm-talk-fab[data-state="live"]) .scroll-top-btn {
        bottom: 150px;
    }
}
