.matis-launcher-wrap {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.matis-intro[hidden],
.matis-panel[hidden] {
    display: none !important;
}

.matis-launcher {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 999px;
    background: #1e293b;
    color: #fff;
    box-shadow:
        0 10px 24px rgba(15, 23, 42, 0.18),
        0 2px 8px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition:
        transform 0.18s ease,
        box-shadow 0.22s ease,
        background 0.22s ease,
        opacity 0.22s ease;
    will-change: transform;
}

.matis-launcher:hover {
    background: #0f172a;
    transform: translateY(-2px);
    box-shadow:
        0 18px 36px rgba(15, 23, 42, 0.24),
        0 4px 12px rgba(15, 23, 42, 0.14);
}

.matis-launcher:active {
    transform: translateY(0);
}

.matis-launcher:focus-visible,
.matis-intro-close:focus-visible,
.matis-lang:focus-visible,
.matis-close:focus-visible,
.matis-intro-open:focus-visible,
.matis-form textarea:focus-visible,
.matis-form button:focus-visible {
    outline: 2px solid rgba(11, 95, 173, 0.45);
    outline-offset: 2px;
}

.matis-launcher-svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.matis-launcher__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.matis-intro {
    position: absolute;
    right: 0;
    bottom: 96px;
    width: 316px;
    animation: matisFadeUp 220ms ease-out;
}

.matis-intro-card {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    box-shadow:
        0 20px 44px rgba(15, 23, 42, 0.16),
        0 4px 14px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
    overflow: hidden;
    padding: 18px 18px 16px;
}

.matis-intro-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.matis-intro-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #475569;
    z-index: 20;
    border-radius: 999px;
    transition: background 0.18s ease, color 0.18s ease;
}

.matis-intro-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.matis-intro-hitarea {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    background: transparent;
    text-align: left;
    padding: 0;
    cursor: pointer;
}

.matis-intro-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-right: 28px;
}

.matis-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 999px;
    background: linear-gradient(180deg, #243244, #1e293b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(30, 41, 59, 0.18);
}

.matis-intro-text strong {
    display: block;
    font-size: 24px;
    letter-spacing: -0.02em;
    line-height: 1.02;
    margin-bottom: 3px;
    color: #111827;
}

.matis-intro-subtitle {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #667085;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.matis-intro-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
}

.matis-intro-open {
    margin-top: 12px;
    border: 0;
    border-radius: 999px;
    background: #0b5fad;
    color: #fff;
    padding: 10px 14px;
    font: 600 14px/1 'Inter', sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(11, 95, 173, 0.16);
    transition:
        transform 0.16s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.matis-intro-open:hover {
    background: #094e8e;
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(11, 95, 173, 0.20);
}

.matis-panel {
    position: absolute;
    right: 0;
    bottom: 80px;
    width: min(392px, calc(100vw - 32px));
    height: 580px;
    max-height: 72vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.18),
        0 6px 18px rgba(15, 23, 42, 0.10);
    border: 1px solid rgba(15, 23, 42, 0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: matisPanelIn 220ms ease-out;
}

.matis-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.05);
}

.matis-panel__header strong {
    letter-spacing: -0.01em;
}

.matis-panel__header p {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: 0.82;
}

.matis-panel__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.matis-lang,
.matis-close {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: #fff;
    border-radius: 999px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.matis-lang:hover,
.matis-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.matis-lang.is-active {
    background: #fff;
    color: #1e293b;
    border-color: #fff;
}

.matis-close {
    font-size: 18px;
    line-height: 1;
    padding: 4px 10px;
}

.matis-messages {
    flex: 1;
    overflow: auto;
    padding: 14px;
    background:
        linear-gradient(to bottom, rgba(248,250,252,0.96), rgba(246,248,251,0.96));
    scroll-behavior: smooth;
}

.matis-message {
    max-width: 82%;
    padding: 11px 13px;
    border-radius: 16px;
    margin-bottom: 10px;
    white-space: pre-wrap;
    font: 400 14px/1.5 'Inter', sans-serif;
    animation: matisBubbleIn 180ms ease-out;
}

.matis-message.user {
    margin-left: auto;
    background: #0b5fad;
    color: #fff;
    border-bottom-right-radius: 5px;
    box-shadow: 0 8px 16px rgba(11, 95, 173, 0.14);
}

.matis-message.bot {
    background: #fff;
    color: #172033;
    border-bottom-left-radius: 5px;
    box-shadow:
        0 1px 4px rgba(15, 23, 42, 0.05),
        0 8px 18px rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.matis-quote-action {
    display: flex;
    margin: -2px 0 12px;
}

.matis-quote-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border-radius: 999px;
    background: #0b5fad;
    color: #fff;
    font: 600 13px/1.2 'Inter', sans-serif;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(11, 95, 173, 0.16);
    transition: background 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.matis-quote-link:hover,
.matis-quote-link:focus-visible {
    background: #094e8e;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(11, 95, 173, 0.22);
}

.matis-quote-link:focus-visible {
    outline: 3px solid rgba(11, 95, 173, 0.24);
    outline-offset: 2px;
}

.matis-typing {
    padding: 0 14px 10px;
    color: #475569;
    font: 400 12px/1.4 'Inter', sans-serif;
    background: #f6f8fb;
}

.matis-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255,255,255,0.98);
}

.matis-form textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 110px;
    border: 1px solid #d0d5dd;
    border-radius: 14px;
    padding: 11px 13px;
    font: 400 14px/1.45 'Inter', sans-serif;
    color: #172033;
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.matis-form textarea::placeholder {
    color: #94a3b8;
}

.matis-form textarea:focus {
    outline: none;
    border-color: #1e293b;
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.10);
    background: #fff;
}

.matis-form button {
    border: 0;
    border-radius: 999px;
    background: #0b5fad;
    color: #fff;
    padding: 0 16px;
    font: 600 14px/1 'Inter', sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(11, 95, 173, 0.15);
    transition:
        transform 0.16s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.matis-form button:hover {
    background: #094e8e;
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(11, 95, 173, 0.20);
}

.matis-form button:active,
.matis-intro-open:active {
    transform: translateY(0);
}

@keyframes matisFadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes matisPanelIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes matisBubbleIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .matis-launcher {
        width: auto;
        min-width: 64px;
        padding: 0 18px 0 16px;
        gap: 10px;
    }

    .matis-launcher__label {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        white-space: nowrap;
        font-size: 14px;
        font-weight: 700;
    }
}

@media (max-width: 640px) {
    .matis-launcher-wrap {
        right: 16px;
        bottom: 16px;
    }

    .matis-intro {
        right: 0;
        bottom: 88px;
        width: calc(100vw - 32px);
        max-width: 320px;
    }

    .matis-panel {
        right: 0;
        bottom: 74px;
        width: calc(100vw - 16px);
        max-width: 360px;
        height: 72vh;
        border-radius: 18px;
    }

    .matis-intro-text strong {
        font-size: 20px;
    }
}