.nix-retune-chat {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    z-index: 9991;
    direction: rtl;
    font-family: inherit;
}

.nix-retune-chat__toggle {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(94, 224, 189, .28);
    border-radius: 12px;
    background: #5ee0bd;
    color: #06100e;
    box-shadow: none;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.nix-retune-chat__toggle:hover {
    border-color: rgba(94, 224, 189, .5);
    background: #78edcc;
    color: #06100e;
    transform: translateY(-1px);
}

.nix-retune-chat__panel {
    position: absolute;
    right: 0;
    bottom: 56px;
    width: min(390px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 128px));
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(25, 34, 49, .98), rgba(11, 17, 28, .98));
    color: #f8fafc;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .38);
    backdrop-filter: blur(18px);
    transform: translateY(10px) scale(.98);
    opacity: 0;
    visibility: hidden;
    transform-origin: right bottom;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.nix-retune-chat.is-open .nix-retune-chat__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.nix-retune-chat__panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .035);
}

.nix-retune-chat__panel header strong,
.nix-retune-chat__panel header span {
    display: block;
}

.nix-retune-chat__panel header strong {
    color: #f8fafc;
    font-size: 14px;
    font-weight: 950;
}

.nix-retune-chat__panel header span {
    margin-top: 4px;
    color: #9fb0c6;
    font-size: 12px;
    font-weight: 800;
}

.nix-retune-chat__panel header button,
.nix-retune-chat__form button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.nix-retune-chat__panel header button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #9fb0c6;
}

.nix-retune-chat__panel header button:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.nix-retune-chat__messages {
    display: grid;
    align-content: start;
    gap: 10px;
    overflow: auto;
    padding: 14px;
    scrollbar-width: thin;
}

.nix-retune-chat__message {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    line-height: 1.9;
    font-size: 13px;
    font-weight: 750;
}

.nix-retune-chat__message.is-ai {
    justify-self: start;
    border: 1px solid rgba(255, 255, 255, .08);
    border-bottom-right-radius: 5px;
    background: rgba(255, 255, 255, .06);
    color: #dbeafe;
}

.nix-retune-chat__message.is-user {
    justify-self: end;
    border-bottom-left-radius: 5px;
    background: rgba(94, 224, 189, .16);
    color: #ecfeff;
}

.nix-retune-chat__message.is-loading {
    color: #9fb0c6;
}

.nix-retune-chat__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .035);
}

.nix-retune-chat__form input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font: inherit;
}

.nix-retune-chat__form input:focus {
    border-color: rgba(94, 224, 189, .45);
    outline: 0;
}

.nix-retune-chat__form button {
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #5ee0bd;
    color: #06100e;
}

@media (max-width: 640px) {
    .nix-retune-chat {
        right: max(10px, env(safe-area-inset-right));
        bottom: max(58px, calc(env(safe-area-inset-bottom) + 58px));
    }

    .nix-retune-chat__toggle {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    .nix-retune-chat__panel {
        bottom: 48px;
        width: min(360px, calc(100vw - 20px));
        height: min(520px, calc(100vh - 104px));
    }
}
