:root {
    --tc-support-navy: #071722;
    --tc-support-panel: #0d2230;
    --tc-support-panel-soft: #132d3d;
    --tc-support-border: rgba(126, 177, 204, 0.24);
    --tc-support-text: #effaff;
    --tc-support-muted: #9db6c4;
    --tc-support-green: #08d9a5;
}

.tc-support-root,
.tc-support-root * { box-sizing: border-box; }

.tc-support-root {
    position: fixed;
    z-index: 2147483600;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(104px, calc(env(safe-area-inset-bottom) + 92px));
    color: var(--tc-support-text);
    font-family: "Open Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

.tc-support-launcher {
    display: inline-flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: linear-gradient(135deg, #0bcf9d, #087dcc);
    box-shadow: 0 14px 36px rgba(0, 62, 93, 0.32);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    letter-spacing: 0.01em;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.tc-support-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(0, 62, 93, 0.4);
}

.tc-support-root.is-open .tc-support-launcher {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.96);
}

.tc-support-launcher:focus-visible,
.tc-support-channel-option:focus-visible,
.tc-support-button:focus-visible,
.tc-support-choice:focus-visible,
.tc-support-input:focus-visible,
.tc-support-icon-button:focus-visible {
    outline: 3px solid rgba(59, 166, 255, 0.56);
    outline-offset: 3px;
}

.tc-support-launcher-icon {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.tc-support-launcher-icon::before {
    position: absolute;
    top: 8px;
    left: 7px;
    width: 16px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 7px;
    content: "";
}

.tc-support-launcher-icon::after {
    position: absolute;
    top: 18px;
    left: 10px;
    width: 6px;
    height: 6px;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    content: "";
    transform: skewY(-35deg);
}

.tc-support-channel-menu {
    position: absolute;
    right: 0;
    bottom: 66px;
    display: grid;
    width: min(330px, calc(100vw - 36px));
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--tc-support-border);
    border-radius: 18px;
    background: linear-gradient(145deg, #0d2636, #091a26);
    box-shadow: 0 22px 54px rgba(0, 21, 33, 0.44);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 170ms ease, transform 170ms ease;
}

.tc-support-root.is-channel-open .tc-support-channel-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.tc-support-channel-eyebrow {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.tc-support-channel-copy {
    margin: -5px 0 2px;
    color: var(--tc-support-muted);
    font-size: 12px;
    line-height: 1.5;
}

.tc-support-channel-option {
    display: grid;
    min-height: 68px;
    width: 100%;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid rgba(54, 169, 230, 0.34);
    border-radius: 14px;
    background: rgba(19, 70, 97, 0.68);
    color: #effaff;
    cursor: pointer;
    font: inherit;
    text-align: left;
    text-decoration: none;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.tc-support-channel-option:hover {
    border-color: var(--tc-support-green);
    background: rgba(14, 98, 105, 0.78);
    color: #fff;
    transform: translateY(-1px);
}

.tc-support-channel-option.is-telegram {
    border-color: rgba(55, 173, 237, 0.42);
    background: rgba(24, 119, 174, 0.3);
}

.tc-support-channel-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #0bd9a5, #2381ed);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -2px;
}

.tc-support-channel-option.is-telegram .tc-support-channel-icon {
    background: linear-gradient(135deg, #2aabee, #1877b5);
    letter-spacing: normal;
}

.tc-support-channel-text { display: grid; gap: 2px; min-width: 0; }
.tc-support-channel-text strong { color: #fff; font-size: 14px; line-height: 1.25; }
.tc-support-channel-text small { color: var(--tc-support-muted); font-size: 11px; line-height: 1.35; }
.tc-support-channel-arrow { color: var(--tc-support-muted); font-size: 25px; line-height: 1; }

.tc-support-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    display: grid;
    width: min(390px, calc(100vw - 36px));
    height: min(650px, calc(100dvh - 126px));
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid var(--tc-support-border);
    border-radius: 22px;
    background: var(--tc-support-panel);
    box-shadow: 0 26px 70px rgba(0, 21, 33, 0.46);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 180ms ease, transform 180ms ease;
}

.tc-support-root.is-open .tc-support-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.tc-support-header {
    display: flex;
    min-height: 76px;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--tc-support-border);
    background: linear-gradient(135deg, #0b2839, #0a1d2a);
}

.tc-support-avatar {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: linear-gradient(135deg, #0bd9a5, #2381ed);
    color: #fff;
    font-size: 20px;
    font-weight: 900;
}

.tc-support-heading { min-width: 0; flex: 1; }

.tc-support-title {
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.tc-support-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 0;
    color: var(--tc-support-muted);
    font-size: 12px;
}

.tc-support-status::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc-support-green);
    box-shadow: 0 0 0 4px rgba(8, 217, 165, 0.1);
    content: "";
}

.tc-support-header-actions { display: flex; gap: 4px; }

.tc-support-icon-button {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--tc-support-muted);
    cursor: pointer;
    font: inherit;
    font-size: 21px;
}

.tc-support-icon-button:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.tc-support-messages {
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 14px 24px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.tc-support-message { display: flex; margin: 0 0 12px; }
.tc-support-message.is-user { justify-content: flex-end; }

.tc-support-bubble {
    max-width: 86%;
    padding: 11px 13px;
    border: 1px solid var(--tc-support-border);
    border-radius: 15px 15px 15px 5px;
    background: var(--tc-support-panel-soft);
    color: var(--tc-support-text);
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.tc-support-message.is-user .tc-support-bubble {
    border-color: rgba(47, 131, 255, 0.5);
    border-radius: 15px 15px 5px 15px;
    background: #176ad0;
    color: #fff;
}

.tc-support-message.is-error .tc-support-bubble {
    border-color: rgba(255, 109, 125, 0.45);
    background: rgba(126, 29, 44, 0.34);
    color: #ffd8dd;
}

.tc-support-actions { display: grid; gap: 9px; margin: 4px 0 16px; }

.tc-support-choice,
.tc-support-button {
    display: flex;
    min-height: 46px;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid rgba(54, 169, 230, 0.45);
    border-radius: 12px;
    background: rgba(19, 70, 97, 0.72);
    color: #eaf9ff;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.tc-support-choice:hover,
.tc-support-button:hover {
    border-color: var(--tc-support-green);
    background: rgba(14, 98, 105, 0.78);
}

.tc-support-button.is-primary {
    border-color: transparent;
    background: linear-gradient(135deg, #08c996, #147fd6);
    color: #fff;
}

.tc-support-button:disabled { cursor: wait; opacity: 0.6; }
.tc-support-form { display: grid; gap: 10px; margin: 4px 0 16px; }

.tc-support-label {
    color: var(--tc-support-muted);
    font-size: 12px;
    font-weight: 700;
}

.tc-support-input {
    min-height: 48px;
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--tc-support-border);
    border-radius: 12px;
    outline: 0;
    background: var(--tc-support-navy);
    color: #fff;
    font: inherit;
    font-size: 16px;
}

.tc-support-label .tc-support-input { display: block; margin-top: 7px; }
.tc-support-input::placeholder { color: #718c9c; }

.tc-support-privacy {
    margin: 0;
    color: #7693a4;
    font-size: 11px;
    line-height: 1.5;
}

.tc-support-composer {
    display: none;
    gap: 9px;
    padding: 12px;
    border-top: 1px solid var(--tc-support-border);
    background: #091b27;
}

.tc-support-root.is-ready .tc-support-composer { display: flex; }
.tc-support-composer .tc-support-input { min-width: 0; flex: 1; }

.tc-support-send {
    display: grid;
    width: 48px;
    min-width: 48px;
    height: 48px;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: var(--tc-support-green);
    color: #05231b;
    cursor: pointer;
    font-size: 20px;
    font-weight: 900;
}

.tc-support-typing .tc-support-bubble::after {
    display: inline-block;
    width: 20px;
    overflow: hidden;
    vertical-align: bottom;
    animation: tc-support-dots 1.2s steps(4, end) infinite;
    content: "…";
}

@keyframes tc-support-dots { 0% { width: 5px; } 100% { width: 20px; } }

@media (max-width: 560px) {
    .tc-support-root {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(92px, calc(env(safe-area-inset-bottom) + 82px));
    }
    .tc-support-panel {
        position: fixed;
        inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 18px;
        transform-origin: bottom center;
    }
    .tc-support-launcher { min-height: 52px; padding: 0 16px; font-size: 15px; }
    .tc-support-channel-menu { width: min(330px, calc(100vw - 24px)); }
    .tc-support-bubble { max-width: 91%; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    .tc-support-panel,
    .tc-support-channel-menu,
    .tc-support-launcher,
    .tc-support-messages { scroll-behavior: auto; transition: none; }
}
