:root {
    --idle-grad: linear-gradient(to bottom right, #4f46e5, #9333ea, #3730a3);
}

* {
    box-sizing: border-box;
}

/* =========================================================
   WIDGET
   ========================================================= */

.widget {
    width: 100%;
    max-width: 42rem;
}

.widget__prompt {
    flex: 0 0 auto;
    display: block;
    width: 100%;
    margin: 0 0 8px !important;
    padding: 4px 0 !important;
    height: auto;
    line-height: 1.3;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #64748b;
    position: relative;
    z-index: 10;
    transform: translateY(-10px);
}



/* =========================================================
   MAIN CARD 
   ========================================================= */

.card {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    background: var(--idle-grad);
    border-radius: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

    .card::before {
        content: "";
        position: absolute;
        inset: 0;
        opacity: 0.2;
        mix-blend-mode: overlay;
        background: radial-gradient( circle at 30% 20%, white, transparent 60% );
        pointer-events: none;
    }


/* =========================================================
   COMMON STATE LAYERS
   ========================================================= */

.idle-layer,
.connecting-layer,
.connected-layer {
    position: absolute;
    inset: 0;
    display: none;
}

.ended-layer {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #162633;
    border-radius: 0; /* was 30px */
    overflow: hidden;
    box-sizing: border-box;
    color: #fff;
    padding-top: 10px;
}

/* =========================================================
   STATE 1 - IDLE
   ========================================================= */

.idle-layer {
    align-items: center;
    justify-content: center;
}

.idle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

    .idle-btn:focus-visible {
        outline: 4px solid rgba(255, 255, 255, 0.6);
        outline-offset: 4px;
        border-radius: 50%;
    }

.avatar-circle {
    position: relative;
    width: 10rem;
    height: 10rem;
    border-color: floralwhite;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    outline: 4px solid rgba(255, 255, 255, 0.3);
}

    .avatar-circle img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center 15%;
        display: block;
    }

.chat-now-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
}

.chat-now-pill {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: 3px solid rgb(255 255 255 / 35%);
    background: rgb(96 66 223 / 72%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}


/* =========================================================
   STATE 2 - CONNECTING
   ========================================================= */

.connecting-layer {
    overflow: hidden;
    background: #162633; /* same dark background as connected/ended */
}

.connecting-layer {
    overflow: hidden;
    background: #162633;
}

.connecting-avatar-icon {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #253746;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Call user icon */
.connecting-avatar-icon-img {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain !important;
    display: block;
    filter: grayscale(100%) brightness(0) invert(70%) !important;
    transform: none !important;
    opacity: 1 !important;
}

.connecting-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
}

.connecting-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.25rem;
}

    .connecting-dots span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.35);
        animation: dot-pulse 1.4s ease-in-out infinite;
    }

        .connecting-dots span:nth-child(1) {
            animation-delay: 0s;
        }

        .connecting-dots span:nth-child(2) {
            animation-delay: 0.15s;
        }

        .connecting-dots span:nth-child(3) {
            animation-delay: 0.3s;
        }

        .connecting-dots span:nth-child(4) {
            animation-delay: 0.45s;
        }

        .connecting-dots span:nth-child(5) {
            animation-delay: 0.6s;
        }

        .connecting-dots span:nth-child(6) {
            animation-delay: 0.75s;
        }

@keyframes dot-pulse {
    0%, 60%, 100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.35);
    }

    30% {
        transform: scale(1.4);
        background: rgba(255, 255, 255, 0.9);
    }
}

.connecting-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.connecting-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    max-width: 24rem;
    margin: 0;
}

/* =========================================================
   CONNECTED / AI CALL SCREEN
   ========================================================= */

.connected-layer {
    position: absolute;
    inset: 0;
    display: none;
    overflow: hidden;
    background: #142533;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

.connected-content {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    box-sizing: border-box;
}


/* =========================================================
   AI AVATAR AREA
   ========================================================= */

.ai-avatar-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}


/* subtle outer ring */

.ai-avatar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(43, 183, 201, 0.18);
    pointer-events: none;
}

    .ai-avatar-ring.ring-1 {
        width: 125px;
        height: 125px;
    }

    .ai-avatar-ring.ring-2 {
        width: 155px;
        height: 155px;
    }


/* =========================================================
   AI IMAGE
   ========================================================= */

.ai-avatar-container {
    position: relative;
    z-index: 2;
    width: 125px; /* matches ring-1 */
    height: 125px;
    border-radius: 50%;
    overflow: hidden;
    background: #253746;
    border: none;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

    .ai-avatar-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }




/* =========================================================
   SPEAKING / LISTENING
   ========================================================= */

.call-status {
    min-height: 22px;
    margin: 0 0 22px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    text-align: center;
}


    /* status dot */

    .call-status::before {
        content: "";
        display: inline-block;
        width: 7px;
        height: 7px;
        margin-right: 7px;
        border-radius: 50%;
        background: #45c957;
        vertical-align: middle;
    }


    /* AI Speaking */

    .call-status.speaking::before {
        background: #20b7c9;
    }


/* =========================================================
   MUTE / SPEAKER
   ========================================================= */

.call-controls {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 45px;
    margin: 0 0 17px;
}


/* Each control */

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 52px;
}


/* Icon button */

.circle-control {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .circle-control:hover {
        background: rgba(255,255,255,0.08);
    }

    .circle-control:active {
        background: rgba(255,255,255,0.12);
    }


    /* Muted microphone */

    .circle-control.muted {
        background: #e11d48;
    }


/* Muted speaker */

.speaker-btn.muted {
    background: #e11d48;
}


/* =========================================================
   CONTROL LABELS
   ========================================================= */

.control-label {
    margin-top: 3px;
    color: rgba(255,255,255,0.72);
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
}


/* =========================================================
   END CALL BUTTON
   ========================================================= */

.end-call-circle {
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ff5b3d;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    flex-shrink: 0;
}

    .end-call-circle:hover {
        background: #ed4c31;
        transform: scale(1.05);
    }

    .end-call-circle:active {
        transform: scale(0.95);
    }


/* =========================================================
   CONNECTED STATE
   ========================================================= */

body[data-state="connected"] .connected-layer {
    display: flex;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 640px) {

    .connected-content {
        padding-top: 15px;
    }

    .ai-avatar-wrapper {
        width: 135px;
        height: 115px;
    }

    .ring-1 {
        width: 105px;
        height: 105px;
    }

    .ring-2 {
        width: 128px;
        height: 128px;
    }

    .ai-avatar-container {
        width: 78px;
        height: 78px;
    }

    .call-status {
        margin-bottom: 15px;
        font-size: 15px;
    }

    .call-controls {
        gap: 38px;
        margin-bottom: 14px;
    }

    .circle-control {
        width: 42px;
        height: 42px;
    }

    .end-call-circle {
        width: 44px;
        height: 44px;
    }
}
/* =========================================================
   STATE 4 - ENDED
   ========================================================= */



/* END CALL - Call User Icon */
.ended-avatar-icon-img {
    width: 28px !important;
    height: 28px !important;
    object-fit: contain !important;
    display: block;
    filter: grayscale(100%) brightness(0) invert(70%) !important;
    transform: none !important;
    opacity: 1 !important;
}

.ended-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
}

.ended-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgba(225, 29, 72, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
    padding: 0;
}

    .ended-icon:hover {
        background: rgba(225, 29, 72, 0.3);
    }

.ended-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.ended-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    max-width: 24rem;
    margin: 0 0 1.5rem;
}


/* =========================================================
   STATE VISIBILITY
   ========================================================= */

body[data-state="idle"] .idle-layer {
    display: flex;
}

body[data-state="connecting"] .connecting-layer {
    display: flex;
}

body[data-state="connected"] .connected-layer {
    display: flex;
}

body[data-state="ended"] .ended-layer {
    display: flex;
}


/* =========================================================
   UNUSED OLD ELEMENT
   ========================================================= */

.time-badge {
    display: none;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 640px) {

    .avatar-circle {
        width: 12rem;
        height: 12rem;
    }

    .call-overlay {
        padding: 1rem;
    }

    .call-controls {
        gap: 0.75rem;
    }

    .speaker-btn,
    .mic-btn {
        width: 2.75rem;
        height: 2.75rem;
    }

    .end-chat-btn {
        padding: 0.65rem 1.15rem;
    }

    .connecting-title,
    .ended-title {
        font-size: 1.25rem;
    }
}


/* =========================================================
   AVATAR IMAGE MODE
   ========================================================= */

/*
   ?avatar=1 -> real-avatar-placeholder.jpg
   ?avatar=0/missing -> grace-avatar.jpg

   JavaScript changes the .avatar-img source.
   body[data-avatar-mode] is available if future
   avatar-provider logic is needed.
*/
.end-call-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}

.control-icon {
    width: 25px;
    height: 25px;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}
/* =========================================================
   ENDED STATE
   ========================================================= */


/* =========================================================
   ENDED STATE
   ========================================================= */

.ended-layer {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #162633;
    border-radius: 0;
    overflow: hidden;
    box-sizing: border-box;
    color: #fff;
    padding-top: 10px;
}


/* =========================================================
   TOP CALL USER CIRCLE
   ========================================================= */

.ended-avatar-wrapper {
    position: relative;
    width: 170px;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


/* Rings */

.ended-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(43, 183, 201, 0.18);
    pointer-events: none;
}

    .ended-ring.ring-1 {
        width: 85px;
        height: 85px;
    }

    .ended-ring.ring-2 {
        width: 115px;
        height: 115px;
    }

    .ended-ring.ring-3 {
        width: 145px;
        height: 145px;
    }


/* Grey call-user circle */

.ended-avatar-container {
    position: relative;
    z-index: 5;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #253746;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}


/* Grey icon */

.ended-avatar-icon-img {
    width: 25px !important;
    height: 25px !important;
    object-fit: contain !important;
    display: block;
    filter: grayscale(100%) brightness(0) invert(70%) !important;
    opacity: 1 !important;
}


/* =========================================================
   HOSPITAL NAME
   ========================================================= */

.ended-hospital-name {
    margin: 2px 0 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
    color: #fff;
    text-align: center;
    white-space: nowrap;
}


/* =========================================================
   ENDED TEXT
   ========================================================= */

.ended-status {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 16px;
    line-height: 20px;
    color: #c6cbd0;
}


.ended-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b8b8b;
    display: inline-block;
}


/* =========================================================
   BOTTOM MICROPHONE
   ========================================================= */

.ended-bottom-controls {
    position: absolute;
    left: 0;
    bottom: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}


.ended-mic-btn {
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #20a69c;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(32, 166, 156, 0.3);
    transition: transform 0.15s ease, background 0.2s ease;
}


    .ended-mic-btn:hover {
        background: #269f96;
        transform: scale(1.05);
    }


    .ended-mic-btn:active {
        transform: scale(0.95);
    }


    .ended-mic-btn img {
        width: 27px;
        height: 27px;
        object-fit: contain;
        filter: brightness(0) invert(1);
    }


.continue-talking-text {
    margin-top: 7px;
    font-size: 13px;
    line-height: 16px;
    color: #d6dadd;
    white-space: nowrap;
}

.ended-feedback-icon {
    position: absolute;
    right: 18px;
    bottom: 5px;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

/* =========================================================
   INTERACTIVE CARD
   ========================================================= */

#interactiveCard {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0 auto !important;
    overflow: hidden !important;
}

/* =========================================================
   IDLE / FIRST PAGE
   ========================================================= */

body[data-state="idle"] #interactiveCard {
    flex: 0 0 260px !important;
    height: 260px !important;
    min-height: 260px !important;
    max-height: 260px !important;
    aspect-ratio: auto !important;
    border-radius: 2rem !important;
}

/* =========================================================
   CONNECTING / CONNECTED / ENDED
   FULL HEIGHT CARD
   ========================================================= */


/* Call screens use available space */
body[data-state="connecting"] #interactiveCard,
body[data-state="connected"] #interactiveCard,
body[data-state="ended"] #interactiveCard {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    /* fill all available space */
    height: auto !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 0 !important;
}

.assistant-titlebar {
    display: none;
    position: relative;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex: 0 0 auto;
}

.assistant-back-btn {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: #2f8f7e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.assistant-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

/* idle: show nav row, hide title bar */
body[data-state="idle"] .assistant-titlebar {
    display: none;
}

body[data-state="idle"] #pageNav {
    display: block;
}

body[data-state="idle"] #widgetPrompt {
    display: block !important;
}

body[data-state="idle"] #bottomCard {
    display: block;
}

/* connecting/connected/ended: hide nav row, show title bar */
body[data-state="connecting"] .assistant-titlebar,
body[data-state="connected"] .assistant-titlebar,
body[data-state="ended"] .assistant-titlebar {
    display: flex;
}

body[data-state="connecting"] #pageNav,
body[data-state="connected"] #pageNav,
body[data-state="ended"] #pageNav {
    display: none;
}

body[data-state="connecting"] #widgetPrompt,
body[data-state="connected"] #widgetPrompt,
body[data-state="ended"] #widgetPrompt {
    display: none !important;
}

body[data-state="connecting"] #bottomCard,
body[data-state="connected"] #bottomCard,
body[data-state="ended"] #bottomCard {
    display: none;
}

html,
body {
    height: 100%;
    margin: 0;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    margin: 0 auto;
    max-width: 400px;
}

.content {
    display: flex !important;
    flex: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.back-arrow-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
    filter: brightness(0) saturate(100%) invert(100%);
}

main {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 2px 12px 8px 12px;
    margin: 0;
    gap: 16px; /* was 5px */
    box-sizing: border-box;
    overflow: hidden;
}
/* =========================================================
   FOOTER - ALWAYS AT VERY BOTTOM
   ========================================================= */

.app-wrapper > footer {
    flex: 0 0 auto;
    width: 100%;
    margin-top: auto;
}

.idle-layer {
    flex-direction: column; /* was missing — needed to stack prompt above the circle */
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.5rem;
}

    /* prompt now sits on the purple card, not the white page background */
    .idle-layer .widget__prompt {
        color: #fff;
        font-size: 1.15rem;
        font-weight: 700;
        text-align: center;
        line-height: 1.3;
        margin: 0 !important;
        padding: 0 1rem !important;
    }

.avatar-circle {
    position: relative;
    width: 10rem; /* was 12rem — smaller avatar */
    height: 10rem;
    background: #fff; /* white circle */
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    outline: 4px solid #fff; /* solid white ring, was rgba(255,255,255,0.3) */
}

.chat-now-overlay {
    background: transparent; /* was rgba(0,0,0,0.4) — let the photo show through, like image 2 */
}

.chat-now-pill {
    padding: 0.4rem 1rem; /* slightly smaller to fit the reduced circle */
    font-size: 0.8rem;
}

#pageNav {
    margin-bottom: 16px; /* match whatever gap you used in main for consistency */
}
/* ============ CALL LAYER (connecting + connected, merged) ============ */
.call-layer {
    position: absolute;
    inset: 0;
    display: none;
    background: radial-gradient(120% 90% at 50% 0%, #1e2a44 0%, #0f1729 70%);
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 1.5rem 1.25rem;
}

/* top-right persistent controls */
.call-topbar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 2;
}

.my-requests-pill {
    background: #6366f1;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

    .my-requests-pill:hover {
        background: #4f46e5;
    }

.requests-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    background: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

/* concentric rings + center avatar/dots */
.call-rings {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(94,234,212,0.18);
}

/* =========================================================
   SLIGHTLY SMALLER CALL RINGS
   ========================================================= */

.ring--1 {
    width: 8rem !important;
    height: 8rem !important;
}

.ring--2 {
    width: 11rem !important;
    height: 11rem !important;
}

.ring--3 {
    width: 13rem !important;
    height: 13rem !important;
}


.call-avatar svg {
    width: 1.4rem;
    height: 1.4rem;
    color: rgba(255,255,255,0.85);
}

.call-dots {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    z-index: 6 !important;
}

    .call-dots span {
        width: 0.45rem;
        height: 0.45rem;
        border-radius: 50%;
        background: rgba(255,255,255,0.55);
        animation: dotPulse 1.2s ease-in-out infinite;
    }

        .call-dots span:nth-child(2) {
            animation-delay: .15s;
        }

        .call-dots span:nth-child(3) {
            animation-delay: .3s;
        }

        .call-dots span:nth-child(4) {
            animation-delay: .45s;
        }

        .call-dots span:nth-child(5) {
            animation-delay: .6s;
        }

        .call-dots span:nth-child(6) {
            animation-delay: .75s;
        }

@keyframes dotPulse {
    0%,100% {
        opacity: .3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* title + status */
.call-title {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 1rem 0 0.4rem;
    text-align: center;
}

.call-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}

.call-status-text {
    color: rgba(255,255,255,0.75);
    font-size: 0.95rem;
}

/* mic/speaker + hangup — hidden until listening/thinking/speaking */
.call-controls {
    display: none;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.control-btn-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.control-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .control-btn.muted {
        background: #e11d48;
    }

.control-label {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

.hangup-btn {
    display: none;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #ef4444;
    color: #fff;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(239,68,68,0.4);
}

    .hangup-btn:hover {
        background: #dc2626;
    }


.call-layer[data-status="speaking"] .ring {
    border-color: rgba(94,234,212,0.4);
}
/* Route body-level call states onto the merged .call-layer */
body[data-state="connecting"] .call-layer,
body[data-state="connected"] .call-layer {
    display: flex;
}


.call-avatar {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #253746 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5 !important;
    transform: translate(calc(-50% + 25px), calc(-50% + 60px)) !important;
}

/* Keep icon centered inside avatar */
.call-avatar-icon {
    width: 16px !important;
    height: 16px !important;
    object-fit: contain !important;
    display: block !important;
    /* Makes the actual icon grey too */
    filter: grayscale(100%) brightness(0) invert(75%) !important;
    opacity: 1 !important;
    transform: none !important;
    margin: 0 !important;
}
/* ============ Exact-match dialing/ringing/connecting sequence ============ */

.call-layer[data-status="dialing"] .call-avatar-icon,
.call-layer[data-status="dialing"] .call-dots {
    display: none !important;
}

.call-layer:not([data-status="dialing"]) .call-dots {
    display: flex;
}

.call-layer:not([data-status="dialing"]) .call-avatar {
    display: flex;
}

.call-layer[data-status="dialing"] .status-dot,
.call-layer[data-status="ringing"] .status-dot {
    background: #9ca3af;
}

.call-layer[data-status="connecting"] .status-dot {
    background: #f97316;
}

.call-layer[data-status="connected"] .status-dot,
.call-layer[data-status="listening"] .status-dot,
.call-layer[data-status="thinking"] .status-dot,
.call-layer[data-status="speaking"] .status-dot {
    background: #22c55e;
}

.call-layer[data-status="connecting"] .call-controls,
.call-layer[data-status="connected"] .call-controls,
.call-layer[data-status="listening"] .call-controls,
.call-layer[data-status="thinking"] .call-controls,
.call-layer[data-status="speaking"] .call-controls {
    display: flex;
}

.call-layer[data-status="connecting"] .hangup-btn,
.call-layer[data-status="connected"] .hangup-btn,
.call-layer[data-status="listening"] .hangup-btn,
.call-layer[data-status="thinking"] .hangup-btn,
.call-layer[data-status="speaking"] .hangup-btn {
    display: flex;
}
.speaker-btn .control-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    /* Green */
    filter: invert(52%) sepia(65%) saturate(650%) hue-rotate(120deg) brightness(90%) contrast(90%);
}
.bottom-card {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 12px 20px; /* reduced */
    background: linear-gradient(135deg, #6f3ce8, #853de5);
    border-radius: 18px;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.talk-to-grace {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 18px; /* smaller button */
    background: white;
    color: #5d35c7;
    border-radius: 25px;
    font-size: 13px; /* smaller text */
    font-weight: 600;
}

    .talk-to-grace img {
        width: 21px;
        height: 21px;
        object-fit: contain;
    }