:root {
    --lc-bg: rgba(10, 10, 14, 0.92);
    --lc-panel: rgba(20, 20, 28, 0.96);
    --lc-panel-soft: rgba(255, 255, 255, 0.08);
    --lc-border: rgba(255, 255, 255, 0.16);
    --lc-text: #ffffff;
    --lc-muted: rgba(255, 255, 255, 0.68);
    --lc-accent: #ff3b30;
    --lc-accent-2: #ff8a00;
    --lc-good: #31d158;
    --lc-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}

#lc-root {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    font-family: Arial, sans-serif;
    color: var(--lc-text);
}

#lc-launcher {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 1px solid var(--lc-border);
    background: radial-gradient(circle at 30% 20%, var(--lc-accent-2), var(--lc-accent) 55%, #2a0202);
    box-shadow: var(--lc-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#lc-launcher:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

#lc-launcher img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
}

#lc-launcher .lc-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    background: var(--lc-good);
    border: 3px solid #111;
    border-radius: 50%;
}

#lc-window {
    width: 370px;
    max-width: calc(100vw - 28px);
    height: 560px;
    max-height: calc(100vh - 110px);
    background: var(--lc-bg);
    border: 1px solid var(--lc-border);
    border-radius: 22px;
    box-shadow: var(--lc-shadow);
    overflow: hidden;
    display: none;
    flex-direction: column;
    backdrop-filter: blur(16px);
}

#lc-window.lc-open {
    display: flex;
}

.lc-header {
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.95), rgba(255, 138, 0, 0.88));
    display: flex;
    align-items: center;
    gap: 12px;
}

.lc-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.lc-avatar img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.lc-title-wrap {
    flex: 1;
    min-width: 0;
}

.lc-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
}

.lc-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lc-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.lc-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background:
        radial-gradient(circle at top right, rgba(255, 59, 48, 0.12), transparent 38%),
        radial-gradient(circle at bottom left, rgba(255, 138, 0, 0.1), transparent 32%),
        rgba(8, 8, 12, 0.96);
}

.lc-panel {
    border: 1px solid var(--lc-border);
    background: var(--lc-panel-soft);
    border-radius: 18px;
    padding: 14px;
}

.lc-panel h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.lc-panel p {
    margin: 8px 0;
    color: var(--lc-muted);
    font-size: 13px;
    line-height: 1.35;
}

.lc-captcha-question {
    margin: 12px 0;
    padding: 13px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.5px;
}

.lc-row {
    display: flex;
    gap: 8px;
}

.lc-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--lc-border);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 14px;
    padding: 12px 13px;
    outline: none;
    font-size: 14px;
}

.lc-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.lc-button {
    border: 0;
    border-radius: 14px;
    padding: 12px 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--lc-accent), var(--lc-accent-2));
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.lc-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lc-message {
    max-width: 82%;
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 16px;
    line-height: 1.35;
    font-size: 14px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.lc-message.visitor {
    margin-left: auto;
    background: linear-gradient(135deg, var(--lc-accent), var(--lc-accent-2));
    color: #fff;
    border-bottom-right-radius: 5px;
}

.lc-message.admin {
    margin-right: auto;
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
    border-bottom-left-radius: 5px;
}

.lc-message.system {
    max-width: 100%;
    margin: 10px auto;
    text-align: center;
    color: var(--lc-muted);
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
}

.lc-footer {
    padding: 12px;
    border-top: 1px solid var(--lc-border);
    background: var(--lc-panel);
}

.lc-send-row {
    display: flex;
    gap: 8px;
}

#lc-message-input {
    resize: none;
    min-height: 44px;
    max-height: 110px;
}

.lc-hidden {
    display: none !important;
}

@media (max-width: 600px) {
    #lc-root {
        right: 14px;
        bottom: 14px;
    }

    #lc-window {
        position: fixed;
        right: 10px;
        left: 10px;
        bottom: 10px;
        width: auto;
        height: min(620px, calc(100vh - 20px));
        max-height: calc(100vh - 20px);
        border-radius: 20px;
    }

    #lc-launcher {
        width: 64px;
        height: 64px;
    }

    #lc-launcher img {
        width: 44px;
        height: 44px;
    }
}

.lc-message.system.connected {
    color: #d9ffe2;
    background: rgba(49, 209, 88, 0.18);
    border: 1px solid rgba(49, 209, 88, 0.35);
    font-weight: 800;
}

.lc-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.lc-mini-button {
    flex: 1;
    border: 1px solid var(--lc-border);
    border-radius: 12px;
    padding: 9px 10px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}

.lc-mini-button:hover {
    background: rgba(255, 255, 255, 0.14);
}

.lc-mini-button.danger {
    border-color: rgba(255, 59, 48, 0.45);
    background: rgba(255, 59, 48, 0.14);
}

.lc-message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.lc-message-time {
    margin-top: 4px;
    font-size: 10px;
    line-height: 1;
    opacity: 0.58;
    text-align: right;
}

.lc-message.system .lc-message-time {
    text-align: center;
    opacity: 0.45;
}

.lc-actions {
    flex-wrap: wrap;
}

.lc-actions .lc-mini-button {
    min-width: 30%;
}
