.msl-chat {
    --msl-ink: #000000;
    --msl-paper: #ffffff;
    --msl-line: #d9d9d9;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100001;
    width: max-content;
    max-width: calc(100vw - 32px);
    font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
    color: #111;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

.msl-chat-launch {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(125, 211, 252, 0.35);
    border-radius: 999px;
    padding: 8px 16px 8px 8px;
    background: #0b1b3a;
    color: #f7f4ef;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    animation: msl-chat-glow 3.4s ease-in-out infinite;
}

.msl-chat-launch[aria-expanded="true"] {
    animation: none;
    background: #111;
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

@keyframes msl-chat-glow {
    0%, 100% {
        background-color: #071226;
        box-shadow: 0 0 8px 1px rgba(37, 99, 235, 0.22), 0 8px 20px rgba(0, 0, 0, 0.22);
    }
    50% {
        background-color: #1d4ed8;
        box-shadow: 0 0 18px 6px rgba(56, 189, 248, 0.4), 0 8px 22px rgba(0, 0, 0, 0.16);
    }
}

@media (prefers-reduced-motion: reduce) {
    .msl-chat-launch {
        animation: none;
        background: #0b1b3a;
        box-shadow: 0 0 12px 2px rgba(37, 99, 235, 0.35);
    }
}

.msl-chat-launch img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
}

.msl-chat-panel[hidden] {
    display: none !important;
}

.msl-chat-panel {
    position: fixed;
    top: auto;
    right: 24px;
    bottom: 88px;
    width: min(400px, calc(100vw - 48px));
    max-height: min(560px, calc(100vh - 112px));
    height: auto;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #cfcfcf;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.msl-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #cfcfcf;
}

.msl-chat-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    background: #f3f4f6;
}

.msl-chat-id {
    min-width: 0;
    flex: 1;
}

.msl-chat-id strong {
    display: block;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.2;
}

.msl-chat-head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.msl-chat-ghost,
.msl-chat-close {
    border: 0;
    background: transparent;
    color: #111;
    cursor: pointer;
    font: inherit;
}

.msl-chat-ghost {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 8px;
    border-radius: 8px;
}

.msl-chat-ghost:hover,
.msl-chat-close:hover {
    background: rgba(20, 32, 51, 0.05);
    color: var(--msl-ink);
}

.msl-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

.msl-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 22px 12px;
    background: #fff;
    scrollbar-width: none;
}

.msl-chat-log::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.msl-chat-turn {
    margin: 0 0 18px;
}

.msl-chat-turn.user {
    display: flex;
    justify-content: flex-end;
}

.msl-chat-turn.user p {
    max-width: 84%;
    margin: 0;
    padding: 9px 14px;
    border-radius: 18px 18px 4px 18px;
    background: #111;
    color: #fff;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -0.006em;
    text-align: left;
    text-wrap: pretty;
}

.msl-chat-turn.bot p {
    margin: 0 0 0.85em;
    color: #111;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: -0.011em;
    text-align: left;
    text-wrap: pretty;
    white-space: pre-wrap;
}

.msl-chat-turn.bot p:last-of-type {
    margin-bottom: 0;
}

.msl-chat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 12px;
}

.msl-chat-links a {
    color: #000;
    font-size: 15px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.msl-chat-links a:hover {
    color: #000;
}

.msl-chat-replies {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0 6px;
}

.msl-chat-replies button {
    width: 100%;
    text-align: left;
    border: 1px solid #bdbdbd;
    background: #fff;
    color: #000;
    border-radius: 8px;
    padding: 11px 12px;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    cursor: pointer;
}

.msl-chat-replies button:hover {
    border-color: #000;
    background: #f5f5f5;
}

.msl-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 14px;
    background: #fff;
    border-top: 1px solid var(--msl-line);
}

.msl-chat-field {
    flex: 1;
    min-width: 0;
}

.msl-chat-form input {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 8px 4px;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #000;
    outline: none;
}

.msl-chat-form input::placeholder {
    color: #595959;
}

.msl-chat-form button[type="submit"] {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--msl-ink);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.msl-chat-form button[type="submit"]:hover {
    background: #24344d;
}

.msl-chat-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

@media (max-width: 640px) {
    .msl-chat {
        right: 16px;
    }

    .msl-chat-panel {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 80px;
        width: auto;
        max-height: calc(100vh - 104px);
        border-radius: 16px;
    }
}
