/* Чат ИИ-агента и карточка «как это придёт в Telegram». Цвета из токенов --bk-* сайта. */
:where(:root) {
  --bk-bg: #111; --bk-surface: #1a1a1a; --bk-line: #2c2c2c; --bk-text: #eee; --bk-muted: #999;
  --bk-accent: #c33; --bk-accent-ink: #fff; --bk-hi: #eee; --bk-hi-ink: #111; --bk-card-r: 14px;
  --bk-display: Georgia, serif; --bk-font: system-ui, sans-serif;
}
.chat { position: fixed; right: 18px; bottom: 18px; z-index: 70; width: min(410px, 100vw - 24px); height: min(640px, 100dvh - 36px); display: flex; flex-direction: column; background: var(--bk-bg); color: var(--bk-text); border: 1px solid var(--bk-line); border-radius: var(--bk-card-r); box-shadow: 0 40px 90px rgba(0, 0, 0, .35); font: 400 15px/1.5 var(--bk-font); overflow: hidden; }
.chat[hidden] { display: none; }
.chat.is-open { animation: bk-in .45s cubic-bezier(.22, 1, .36, 1); }
@keyframes bk-in { from { opacity: 0; transform: translateY(22px); } }
.chat button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--bk-line); }
.chat__ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bk-accent); color: var(--bk-accent-ink); font: 500 20px/1 var(--bk-display); flex: 0 0 auto; position: relative; }
.chat__ava::after { content: ''; position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: #5FBF7F; border: 2px solid var(--bk-bg); }
.chat__head b { display: block; font-weight: 600; line-height: 1.2; }
.chat__head small { font-size: 12.5px; color: var(--bk-muted); }
.chat__x { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--bk-line) !important; border-radius: 50%; }
.chat__x svg { width: 16px; height: 16px; }
.chat__log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.cm { max-width: 88%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.cm--bot { align-self: flex-start; background: var(--bk-surface); border-bottom-left-radius: 4px; }
.cm--me { align-self: flex-end; background: var(--bk-hi); color: var(--bk-hi-ink); border-bottom-right-radius: 4px; }
.cm--img { padding: 4px; border-radius: 12px; }
.cm--img img { display: block; max-width: 220px; max-height: 220px; border-radius: 9px; }
.cm--note { align-self: stretch; max-width: none; padding: 0 2px; font-size: 13px; color: var(--bk-muted); }
.cm--note a { color: var(--bk-accent); }
.cm--lead { align-self: stretch; max-width: none; padding: 0; }
.cm--lead p { font-size: 12.5px; color: var(--bk-muted); margin: 8px 0 0; }
.typing { display: inline-flex; gap: 5px; padding: 14px; align-self: flex-start; background: var(--bk-surface); border-radius: 16px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--bk-muted); animation: bk-blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bk-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.chat__quick { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; scrollbar-width: none; }
.chat__quick button { flex: 0 0 auto; min-height: 44px; padding: 0 14px; border: 1px solid var(--bk-line) !important; border-radius: 999px; font-size: 13.5px; }
.chat__quick button:hover { border-color: var(--bk-accent) !important; }
.chat__att { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--bk-line); }
.chat__att img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.chat__att-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--bk-line) !important; font-size: 20px; color: var(--bk-muted); }
.chat__form { display: flex; border-top: 1px solid var(--bk-line); }
.chat__form textarea { flex: 1; min-height: 56px; max-height: 120px; padding: 17px 16px; background: var(--bk-bg); color: var(--bk-text); border: 0; resize: none; font: 400 16px/1.4 var(--bk-font); outline: none; }
.chat__form textarea::placeholder { color: var(--bk-muted); }
.chat__form button[type=submit] { width: 58px; display: grid; place-items: center; color: var(--bk-accent); border-left: 1px solid var(--bk-line) !important; }
.chat__form button:disabled { opacity: .4; }
.chat__form button svg, .chat__photo svg { width: 20px; height: 20px; }
.chat__photo { width: 54px; display: grid; place-items: center; cursor: pointer; color: var(--bk-muted); border-right: 1px solid var(--bk-line); }
.chat__photo:hover { color: var(--bk-accent); }
.tg { background: #17212B; border-radius: 18px; padding: 14px; color: #E6ECF1; }
.tg__head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid #243344; margin-bottom: 12px; }
.tg__ava { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--bk-accent); color: var(--bk-accent-ink); font-weight: 600; }
.tg__head b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.2; }
.tg__head small { font-size: 12.5px; color: #8CA0B3; }
.tg__msg { background: #1F2F3F; border-radius: 14px 14px 14px 4px; padding: 10px 12px 6px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.tg__msg b { font-weight: 600; }
.tg__msg time { display: block; text-align: right; font-size: 12.5px; color: #97ACBF; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 720px) { .chat { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; } }
@media (prefers-reduced-motion: reduce) { .chat.is-open { animation: none; } .typing i { animation: none; } }
