.svx-chat-shell,
.svx-chat-modal {
    --svx-chat-edge: color-mix(in srgb, var(--text) 16%, var(--border));
    --svx-chat-surface: var(--bg);
    --svx-chat-r: var(--halo-r);
    --svx-chat-g: var(--halo-g);
    --svx-chat-b: var(--halo-b);
    --svx-chat-glow-alpha: 34%;
    --svx-chat-shine: color-mix(in srgb, var(--text) 55%, transparent);
    --svx-chat-flow: linear-gradient(90deg, color-mix(in srgb, var(--svx-chat-r) var(--svx-chat-glow-alpha), transparent), color-mix(in srgb, var(--svx-chat-g) calc(var(--svx-chat-glow-alpha) * 0.75), transparent), color-mix(in srgb, var(--svx-chat-b) var(--svx-chat-glow-alpha), transparent), color-mix(in srgb, var(--svx-chat-r) var(--svx-chat-glow-alpha), transparent));
}

[data-theme="dark"] .svx-chat-shell {
    --svx-chat-glow-alpha: 60%;
    --svx-chat-shine: rgb(255 255 255 / 0.9);
}

.svx-chat-window .svx-chat-box {
    position: relative;
}

.svx-chat-window .svx-chat-box::after {
    content: "";
    position: absolute;
    inset: -16px 7% 45% 7%;
    z-index: -1;
    border-radius: 50% 50% 30% 30% / 100% 100% 30% 30%;
    background: var(--svx-chat-flow) 0 0 / 200% 100%;
    filter: blur(22px);
    pointer-events: none;
    animation: svx-chat-breathe 4.5s ease-in-out infinite alternate, svx-chat-flow 9s linear infinite;
}

@keyframes svx-chat-border {
    0% {
        background-position: -50% 0, 200% 0;
    }

    25% {
        background-position: 150% 0, 150% 0;
    }

    49.99% {
        background-position: 150% 0, 100.02% 0;
    }

    50% {
        background-position: -50% 0, 100% 0;
    }

    75% {
        background-position: 150% 0, 50% 0;
    }

    99.99% {
        background-position: 150% 0, 0.02% 0;
    }

    100% {
        background-position: -50% 0, 0 0;
    }
}

@keyframes svx-chat-flow {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: 0 0;
    }
}

@keyframes svx-chat-breathe {
    from {
        opacity: 0.7;
    }

    to {
        opacity: 1;
    }
}

.svx-chat-window .svx-chat-box::before {
    content: "";
    position: absolute;
    inset: -1px;
    padding: 1px;
    border-radius: inherit;
    background:
        linear-gradient(90deg, transparent, var(--svx-chat-shine), transparent) -50% 0 / 30% 100% no-repeat,
        var(--svx-chat-flow) 0 0 / 200% 100%;
    animation: svx-chat-border 9s linear infinite;
    -webkit-mask: linear-gradient(180deg, #000, transparent 40%), linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: source-in, xor;
    mask: linear-gradient(180deg, #000, transparent 40%) intersect, linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
}

.svx-chat-shell:not(.is-live) .svx-chat-box::before,
.svx-chat-shell:not(.is-live) .svx-chat-box::after {
    animation-play-state: paused;
}

.svx-chat {
    z-index: 1;
}

[data-theme="dark"] :is(.svx-chat-shell, .svx-chat-modal) {
    --svx-chat-edge: color-mix(in srgb, var(--text) 8%, transparent);
    --svx-chat-surface: color-mix(in srgb, var(--text) 3%, var(--bg));
}

.pw:has(> .ld-hero):has(+ .pw > .svx-chat) .ld-hero {
    --hero-cut: 0px;
    padding-bottom: calc(var(--svx-chat-lift) + 24px);
}

.pw:has(> .ld-hero) + .pw > .svx-chat {
    padding-top: 0;
}

.pw:has(> .ld-hero) + .pw > .svx-chat .svx-chat-shell {
    position: relative;
    z-index: 4;
    margin-top: calc(var(--svx-chat-lift) * -1);
}

:root {
    --svx-chat-lift: clamp(48px, 6vw, 88px);
}

.svx-chat-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 860px);
    margin-inline: auto;
}

.svx-chat-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    text-align: center;
}

.svx-chat-title.ld-title {
    margin: 0;
    font-size: calc(clamp(28px, 4.2vw, 46px) * var(--display-scale, 1));
    transform-origin: center;
}

.svx-chat-window {
    position: relative;
    width: 100%;
}

.svx-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--svx-rule);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: 500 13.5px/1 var(--font);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.svx-chip:hover {
    border-color: var(--text);
}

.svx-chat-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 22px 14px 14px 24px;
    border: 1px solid var(--svx-chat-edge);
    border-radius: 28px;
    background: var(--svx-chat-surface);
    box-shadow: var(--shadow-lg);
    transition: border-color 0.2s ease;
}

.svx-chat-box:focus-within {
    border-color: color-mix(in srgb, var(--text) 28%, var(--border));
}

.svx-chat-input {
    width: 100%;
    min-height: 60px;
    max-height: 160px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: 500 18px/1.5 var(--font);
    letter-spacing: -0.005em;
    resize: none;
    outline: none;
}

.svx-chat-input::placeholder {
    color: var(--text-3);
}

.svx-chat-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.svx-chat-scope {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--text-2);
}

.svx-chat-tools {
    --svx-chat-ghost: 22px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.svx-chat-tools .svx-chat-mic,
.svx-chat-tools .svx-chat-resume {
    width: var(--svx-chat-ghost);
}

.svx-chat-mic,
.svx-chat-send {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    cursor: pointer;
}

.svx-chat-mic {
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
}

.svx-chat-mic:hover {
    color: var(--text);
}

.svx-chat-mic .icon-square {
    display: none;
}

.svx-chat-mic.is-recording .icon-mic {
    display: none;
}

.svx-chat-mic.is-recording .icon-square {
    display: block;
    fill: currentColor;
}

.svx-chat-box.is-recording .svx-chat-input {
    display: none;
}

.svx-chat-voice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
}

.svx-chat-voice-x {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    height: 32px;
    margin-left: -6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}

.svx-chat-voice-x:hover {
    color: var(--text);
}

.svx-chat-wave {
    --svx-wave-step: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    height: 36px;
    overflow: hidden;
}

.svx-chat-wave span {
    flex: 0 0 3px;
    height: calc(3px + var(--lv, 0) * 33px);
    border-radius: 2px;
    background: var(--text-2);
    transition: height 0.08s linear;
}

.svx-chat-send {
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-contrast);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.svx-chat-send:not(:disabled):hover {
    transform: scale(1.06);
}

.svx-chat-send:disabled {
    cursor: default;
}

.svx-chat-resume {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-2);
    cursor: pointer;
    transition: color 0.2s ease;
}

.svx-chat-resume:hover {
    color: var(--text);
}

.svx-chat-resume[hidden],
.svx-chat-slot .svx-chat-resume {
    display: none;
}

@media (max-width: 640px) {
    .svx-chat-box {
        padding: 16px 10px 10px 18px;
        border-radius: 22px;
    }

    .svx-chat-input {
        font-size: 16px;
    }

    .svx-chat-input::placeholder {
        font-size: 13.5px;
    }
}
