.spion-chat-fab {
    position: fixed;
    bottom: 150px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: linear-gradient(135deg, var(--bold-color), var(--hover-color));
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 18px 38px rgba(27, 21, 34, 0.22);
    backdrop-filter: blur(10px);
    z-index: 1300;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.spion-chat-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(27, 21, 34, 0.26);
    background: linear-gradient(135deg, var(--hover-color), var(--bold-color));
}

.spion-chat-fab:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 4px;
}

.spion-chat-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.spion-chat-icon i {
    color: #fff;
    font-size: 16px;
}

.spion-chat-label {
    font-size: 14px;
}

.spion-chat-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(27, 21, 34, 0.08), transparent 32%),
        radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.18), transparent 28%),
        rgba(230, 225, 233, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2vw, 28px);
    z-index: 1350;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.spion-chat-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.spion-chat-locked {
    overflow: hidden;
}

.spion-chat-modal {
    width: min(960px, calc(100% - 24px));
    max-height: 90vh;
    background: linear-gradient(180deg, #ffffff 0%, rgba(250, 248, 252, 0.96) 100%);
    border-radius: 16px;
    border: 1px solid rgba(27, 21, 34, 0.06);
    box-shadow: 0 28px 68px rgba(27, 21, 34, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(8px) scale(0.99);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.spion-chat-overlay.is-open .spion-chat-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.spion-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px 12px;
    gap: 12px;
    border-bottom: 1px solid rgba(27, 21, 34, 0.06);
}

.spion-chat-id h3 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

.spion-chat-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--paragraph-color);
}

.spion-chat-kicker {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--bold-color);
    font-weight: 700;
}

.spion-chat-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(27, 21, 34, 0.08);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(27, 21, 34, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.spion-chat-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(27, 21, 34, 0.18);
    background: #fff;
}

.spion-chat-close:focus-visible {
    outline: 2px solid var(--bold-color);
    outline-offset: 2px;
}

.spion-chat-body {
    display: grid;
    gap: 12px;
    grid-template-rows: 1fr auto auto;
    padding: 0 16px 16px;
    height: 100%;
}

.spion-chat-messages {
    background: rgba(255, 255, 255, 0.82);
    border-radius: 12px;
    border: 1px solid rgba(27, 21, 34, 0.05);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
    padding: 14px;
    overflow-y: auto;
    max-height: 58vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.spion-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.spion-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(27, 21, 34, 0.12);
    border-radius: 999px;
}

.spion-chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.spion-chat-message.user {
    flex-direction: row-reverse;
}

.spion-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bold-color), var(--hover-color));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(27, 21, 34, 0.16);
}

.spion-chat-avatar.user {
    background: linear-gradient(135deg, #2f80ed, #56ccf2);
}

.spion-chat-bubble {
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f7f5fb);
    color: var(--text-color);
    box-shadow: 0 10px 18px rgba(27, 21, 34, 0.08);
    max-width: min(80ch, 100%);
    line-height: 1.5;
    font-size: 14px;
    word-break: break-word;
}

.spion-chat-message.user .spion-chat-bubble {
    background: linear-gradient(135deg, var(--bold-color), var(--hover-color));
    color: #fff;
}

.spion-chat-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(27, 21, 34, 0.06);
    color: var(--text-color);
    width: fit-content;
    box-shadow: 0 10px 18px rgba(27, 21, 34, 0.08);
}

.spion-chat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bold-color);
    animation: spion-chat-bounce 1s infinite ease-in-out;
}

.spion-chat-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.spion-chat-dot:nth-child(3) {
    animation-delay: 0.3s;
}

.spion-chat-loading-label {
    font-size: 12px;
    color: var(--paragraph-color);
}

@keyframes spion-chat-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
    40% { transform: translateY(-6px); opacity: 1; }
}

.spion-chat-form {
    margin: 0;
    border-top: 1px solid rgba(27, 21, 34, 0.04);
    padding-top: 6px;
}

.spion-chat-input-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 12px 0;
}

.spion-chat-input {
    width: 100%;
    border: 1px solid rgba(27, 21, 34, 0.12);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    background: #fff;
    color: var(--text-color);
    box-shadow: 0 8px 18px rgba(27, 21, 34, 0.08);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.spion-chat-input:focus-visible {
    outline: none;
    border-color: var(--bold-color);
    box-shadow: 0 0 0 3px rgba(92, 57, 176, 0.16);
}

.spion-chat-input::placeholder {
    color: rgba(27, 21, 34, 0.6);
}

.spion-chat-send {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(27, 21, 34, 0.12);
    background: linear-gradient(135deg, var(--bold-color), var(--hover-color));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 14px 26px rgba(27, 21, 34, 0.16);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.spion-chat-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(27, 21, 34, 0.2);
}

.spion-chat-send i {
    font-size: 14px;
}

.spion-chat-send:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 8px 18px rgba(27, 21, 34, 0.08);
}

.spion-chat-input:disabled {
    background: rgba(255, 255, 255, 0.6);
    cursor: not-allowed;
}

.spion-chat-is-loading .spion-chat-input {
    pointer-events: none;
}

@media (max-width: 900px) {
    .spion-chat-modal {
        width: min(760px, calc(100% - 24px));
    }
}

@media (max-width: 768px) {
    .spion-chat-fab {
        bottom: 124px;
        right: 16px;
        padding: 11px 14px;
    }

    .spion-chat-modal {
        height: 82vh;
    }

    .spion-chat-messages {
        max-height: none;
        min-height: 40vh;
    }
}

@media (max-width: 560px) {
    .spion-chat-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .spion-chat-modal {
        height: 86vh;
        border-radius: 12px;
        width: 100%;
        max-height: 88vh;
    }

    .spion-chat-body {
        padding: 0 12px 14px;
    }

    .spion-chat-input-wrap {
        grid-template-columns: 1fr;
    }

    .spion-chat-send {
        width: 100%;
        justify-content: center;
    }

    .spion-chat-label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spion-chat-fab,
    .spion-chat-overlay,
    .spion-chat-modal,
    .spion-chat-send,
    .spion-chat-close {
        transition: none;
    }

    .spion-chat-dot {
        animation: none;
    }
}
