﻿        /* ================= ПЕРЕМЕННЫЕ ================= */
        :root {
            --glass-bg: rgba(18, 18, 28, 0.45);
            --glass-bg-strong: rgba(14, 14, 22, 0.65);
            --glass-border: rgba(255, 255, 255, 0.09);
            --glass-border-bright: rgba(255, 255, 255, 0.18);
            --accent: #6366f1;
            --accent-glow: rgba(99, 102, 241, 0.35);
            --text-main: #f0f0f8;
            --text-muted: #7b7b9a;
            --neo-gold: #FFD700;
            --neo-gold-glow: rgba(255, 215, 0, 0.3);
            --promo-blue: #38bdf8;
            --danger: #f43f5e;
            --success: #22d3a0;
            --font-head: 'Plus Jakarta Sans', sans-serif;
            --font-body: 'Inter', sans-serif;
        }

        * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
        
        body { 
            font-family: var(--font-body);
            background: #06060f; 
            color: var(--text-main); 
            height: 100vh; 
            overflow: hidden; 
            display: flex; 
            flex-direction: column; 
            position: relative;
        }
        
        /* ================= АНИМИРОВАННЫЙ ФОН (Canvas) ================= */
        /* CSS filter:blur(70px) на fixed-элементе создаёт GPU compositing isolation group —
           ВСЕ элементы поверх композируются против него каждый кадр (~10ms/frame).
           Canvas radial-gradient = тот же визуал, один GPU texture, ноль filter-стоимости. */
        #aurora-canvas {
            position: fixed;
            inset: 0;
            z-index: -2;
            width: 100%; height: 100%;
            pointer-events: none;
            /* Один compositor layer — scroll идёт независимо на GPU thread */
            will-change: transform;
        }
        /* Паузим когда чат открыт (фон всё равно не виден) */
        body.chat-open .aurora-paused { opacity: 0; }
        /* Во время скролла чат-листа — pointer events off */
        body.chats-scrolling .msg-view-body * { pointer-events: none !important; }
        /* Во время скролла сообщений */
        body.msg-view-scrolling .msg-view-body * { pointer-events: none !important; }


        /* ================= СКРОЛЛИРУЕМЫЙ КОНТЕНТ ================= */
        html, body { scrollbar-width: none; }
        html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
        * { scrollbar-width: none; -ms-overflow-style: none; }
        *::-webkit-scrollbar { display: none; }
        .content { 
            flex: 1; overflow-y: auto; 
            padding: 20px 16px; padding-bottom: 105px; 
            position: relative; z-index: 1;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
            overscroll-behavior: contain;
        }
        .content::-webkit-scrollbar { display: none; }

        .tab-content { display: none; animation: fadeSlide 0.25s ease both; flex-direction: column; }
        .tab-content.active { display: flex; }
        @keyframes fadeSlide { 
            from { opacity: 0; transform: translateY(8px); } 
            to { opacity: 1; transform: translateY(0); } 
        }

        /* ================= LIQUID GLASS КАРТОЧКИ ================= */
        .card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border-bright);
            border-radius: 22px;
            padding: 20px;
            margin-bottom: 14px;
            backdrop-filter: blur(40px) saturate(160%) brightness(1.05);
            -webkit-backdrop-filter: blur(40px) saturate(160%) brightness(1.05);
            box-shadow: 
                0 1px 0 rgba(255,255,255,0.07) inset,
                0 -1px 0 rgba(0,0,0,0.2) inset,
                0 8px 32px rgba(0,0,0,0.35),
                0 0 0 0.5px rgba(255,255,255,0.04);
            position: relative;
            overflow: hidden;
        }
        .card::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0; height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        }

        /* ================= КНОПКИ ================= */
        .btn { 
            width: 100%; padding: 15px 20px; 
            border-radius: 50px; border: none; 
            font-size: 0.95rem; font-weight: 600; 
            cursor: pointer; transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1); 
            display: flex; align-items: center; justify-content: center; gap: 8px; 
            color: white;
            font-family: var(--font-body);
            letter-spacing: 0.01em;
            position: relative;
            overflow: hidden;
        }
        .btn::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 60%);
            border-radius: inherit;
            pointer-events: none;
        }
        .btn-primary { 
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); 
            box-shadow: 0 4px 20px rgba(99,102,241,0.4), 0 1px 0 rgba(255,255,255,0.15) inset;
        }
        .btn-neo { 
            background: linear-gradient(135deg, #c9a227 0%, #f0c040 50%, #d4a017 100%); 
            color: #1a1100; 
            box-shadow: 0 4px 24px rgba(255,215,0,0.35), 0 1px 0 rgba(255,255,255,0.3) inset;
            font-weight: 700;
        }
        .btn-secondary { 
            background: rgba(255,255,255,0.07); 
            border: 1px solid rgba(255,255,255,0.12); 
            color: rgba(255,255,255,0.75);
            box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
        }
        .btn:active { transform: scale(0.96); }

        /* iOS-стиль кнопка "Добавить чат" */
        .btn-ios-add {
            background: rgba(99, 102, 241, 0.18);
            border: 1.5px solid rgba(99, 102, 241, 0.45);
            color: #a5b4fc;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            box-shadow: 0 2px 16px rgba(99,102,241,0.15), 0 1px 0 rgba(255,255,255,0.08) inset;
            border-radius: 50px;
            font-weight: 600;
            letter-spacing: 0.02em;
        }
        .btn-ios-add .add-icon {
            width: 20px; height: 20px;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }

        /* ================= ЧАТЫ — СПИСОК ================= */
        #chats-list-container {
            display: flex; flex-direction: column; gap: 4px;
            /* Own compositor layer — scroll on GPU thread */
            transform: translateZ(0); -webkit-transform: translateZ(0);
        }

        .chat-list-item {
            display: flex; align-items: center; gap: 12px;
            padding: 11px 14px; border-radius: 18px;
            background: rgba(22, 18, 44, 0.97);
            border: 1px solid rgba(255,255,255,0.08);
            /* NO box-shadow (per-item rasterization layer), NO transition (repaint on tap) */
            cursor: pointer;
            contain: content;
            -webkit-tap-highlight-color: transparent;
        }
        .chat-list-item:active { background: rgba(99,102,241,0.14); }

        .chat-item-avatar {
            width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
            background: linear-gradient(135deg, var(--accent), #8b5cf6);
            display: flex; align-items: center; justify-content: center;
            font-size: 18px; font-weight: 700; font-family: var(--font-head);
            color: white; overflow: hidden;
            border: 1.5px solid rgba(255,255,255,0.1);
            box-shadow: 0 2px 10px rgba(0,0,0,0.3);
        }
        .chat-item-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

        .chat-item-info { flex: 1; min-width: 0; }
        .chat-item-name {
            font-size: 0.92rem; font-weight: 700; font-family: var(--font-head);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            color: #f0f0ff;
            text-shadow: 0 1px 4px rgba(0,0,0,0.6);
        }
        .chat-item-preview {
            font-size: 0.76rem; color: rgba(200,200,220,0.75); margin-top: 2px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .chat-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
        .chat-item-time { font-size: 0.68rem; color: rgba(180,180,210,0.75); }
        .chat-item-deleted-tag {
            font-size: 0.62rem; color: rgba(244,63,94,0.9); background: rgba(244,63,94,0.12);
            border: 1px solid rgba(244,63,94,0.2); border-radius: 20px; padding: 1px 6px; font-weight: 600;
        }

        /* ── FAB Добавить — fixed над nav-bar ── */
        #chats-fab-area {
            position: fixed;
            bottom: calc(68px + env(safe-area-inset-bottom, 0px));
            left: 0; right: 0;
            display: flex; justify-content: center;
            padding: 0 0 8px; z-index: 100;
            pointer-events: none;
        }
        #btn-add-chat {
            pointer-events: all;
            display: flex; align-items: center; gap: 8px;
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
            color: white; border: none; border-radius: 50px;
            padding: 13px 24px; font-size: 0.9rem; font-weight: 700;
            font-family: var(--font-body); cursor: pointer;
            box-shadow: 0 6px 28px rgba(99,102,241,0.5), 0 1px 0 rgba(255,255,255,0.15) inset;
            transition: transform 0.14s, box-shadow 0.14s;
            -webkit-tap-highlight-color: transparent;
        }
        #btn-add-chat:active { transform: scale(0.95); box-shadow: 0 3px 14px rgba(99,102,241,0.35); }
        /* Отступ снизу на вкладке Чаты чтобы FAB не перекрывал контент */
        #tab-chats { padding-bottom: 100px; position: relative; }
        #tab-chats.active .chats-content-wrap { animation: cardIn 0.3s ease both 0.05s; }
        /* NOTE: removed #tab-chats::before with position:fixed —
           a fixed pseudo-element triggers full-screen composite repaint on every scroll frame. */

        /* ================= CHAT SELECTOR MODAL ================= */
        #chat-selector-modal {
            position: fixed; inset: 0; z-index: 500;
            display: flex; align-items: flex-end; justify-content: center;
            background: rgba(0,0,0,0.55);
            backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
            opacity: 0; pointer-events: none;
            transition: opacity 0.28s cubic-bezier(.4,0,.2,1);
        }
        #chat-selector-modal.open { opacity: 1; pointer-events: all; }

        .selector-sheet {
            width: 100%; max-width: 480px; max-height: 90vh;
            background: #0e0e1a;
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 28px 28px 0 0;
            display: flex; flex-direction: column;
            transform: translateY(100%);
            transition: transform 0.32s cubic-bezier(.4,0,.2,1);
            box-shadow: 0 -8px 60px rgba(0,0,0,0.7);
            overflow: hidden;
        }
        #chat-selector-modal.open .selector-sheet { transform: translateY(0); }

        .selector-handle {
            width: 36px; height: 4px; border-radius: 2px;
            background: rgba(255,255,255,0.15);
            margin: 10px auto 0; flex-shrink: 0;
        }
        .selector-header {
            display: flex; align-items: center;
            padding: 14px 18px 10px;
            flex-shrink: 0;
        }
        .selector-title {
            font-size: 1rem; font-weight: 800; font-family: var(--font-head);
            flex: 1; color: white;
        }
        .selector-counter {
            font-size: 0.78rem; font-weight: 700;
            background: rgba(99,102,241,0.2);
            border: 1px solid rgba(99,102,241,0.35);
            color: #a5b4fc; border-radius: 20px; padding: 3px 10px;
            margin-right: 10px;
        }
        .selector-close {
            width: 28px; height: 28px; border-radius: 50%;
            background: rgba(255,255,255,0.08); border: none; color: var(--text-muted);
            font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: background 0.15s;
        }
        .selector-close:active { background: rgba(255,255,255,0.15); }

        .selector-search-wrap {
            padding: 4px 14px 10px; flex-shrink: 0;
        }
        .selector-search {
            width: 100%; padding: 10px 14px;
            background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
            border-radius: 14px; color: var(--text-main); font-size: 0.88rem;
            font-family: var(--font-body); outline: none;
        }
        .selector-search::placeholder { color: var(--text-muted); }
        .selector-search:focus { border-color: rgba(99,102,241,0.45); background: rgba(99,102,241,0.07); }

        .selector-limit-bar {
            margin: 0 14px 10px;
            padding: 8px 12px; border-radius: 12px;
            background: rgba(255,215,0,0.07); border: 1px solid rgba(255,215,0,0.18);
            font-size: 0.77rem; color: rgba(255,215,0,0.85); font-weight: 600; flex-shrink: 0;
        }

        .selector-list-wrap {
            overflow-y: auto; flex: 1; padding: 0 14px 20px;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }
        .selector-list-wrap::-webkit-scrollbar { width: 0; }

        .selector-chat-item {
            display: flex; align-items: center; gap: 12px;
            padding: 11px 12px; border-radius: 16px; cursor: pointer;
            transition: background 0.15s; -webkit-tap-highlight-color: transparent;
            margin-bottom: 4px;
        }
        .selector-chat-item:active { background: rgba(255,255,255,0.05); }
        .selector-chat-item.selected { background: rgba(99,102,241,0.1); }

        .selector-avatar {
            width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            display: flex; align-items: center; justify-content: center;
            font-size: 17px; font-weight: 700; color: white; overflow: hidden;
            border: 1.5px solid rgba(255,255,255,0.08);
        }
        .selector-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

        .selector-chat-info { flex: 1; min-width: 0; }
        .selector-chat-name {
            font-size: 0.9rem; font-weight: 700; font-family: var(--font-head);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main);
        }
        .selector-chat-id { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; }
        .selector-chat-preview { font-size: 0.73rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

        .selector-checkbox {
            width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
            border: 2px solid rgba(255,255,255,0.2);
            display: flex; align-items: center; justify-content: center;
            transition: all 0.2s; background: transparent;
        }
        .selector-checkbox.checked {
            background: var(--accent); border-color: var(--accent);
            box-shadow: 0 0 10px rgba(99,102,241,0.4);
        }
        .selector-checkbox.checked svg { display: block; }
        .selector-checkbox svg { display: none; width: 13px; height: 13px; stroke: white; stroke-width: 2.5; fill: none; }

        .selector-empty {
            text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.85rem;
        }
        .selector-loading {
            text-align: center; padding: 30px; color: var(--text-muted); font-size: 0.82rem;
        }

        /* ================= CHAT MESSAGE VIEW ================= */
        #chat-message-view {
            position: fixed; inset: 0; z-index: 400;
            background: #06060f;
            display: flex; flex-direction: column;
            transform: translateX(100%);
            transition: transform 0.3s cubic-bezier(.4,0,.2,1);
        }
        /* Quasar chat wallpaper — custom image */
        #chat-message-view::before {
            content: '';
            position: absolute; inset: 0; z-index: 0; pointer-events: none;
            background: url('https://i.imgur.com/EIfvbgw.png') center center / cover no-repeat;
            /* Own GPU compositor layer: scroll never invalidates the wallpaper raster */
            will-change: transform;
            transform: translateZ(0); -webkit-transform: translateZ(0);
        }
        /* All children of chat-message-view need z-index above wallpaper */
        .msg-view-header { position: relative; z-index: 2; }
        .msg-view-body { position: relative; z-index: 2; }
        #chat-message-view.open { transform: translateX(0); }

        .msg-view-header {
            display: flex; align-items: center; gap: 12px;
            padding: 14px 16px 12px;
            background: rgba(14,14,26,0.95);
            backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
            border-bottom: 1px solid rgba(255,255,255,0.07);
            flex-shrink: 0; position: relative; z-index: 2;
        }
        .msg-view-back {
            width: 36px; height: 36px; border-radius: 50%;
            background: rgba(255,255,255,0.07); border: none; color: var(--text-main);
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: background 0.15s;
        }
        .msg-view-back:active { background: rgba(255,255,255,0.14); }
        .msg-view-avatar {
            width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            display: flex; align-items: center; justify-content: center;
            font-size: 15px; font-weight: 700; color: white; overflow: hidden;
        }
        .msg-view-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
        .msg-view-title { font-size: 0.95rem; font-weight: 800; font-family: var(--font-head); color: white; }
        .msg-view-subtitle { font-size: 0.72rem; color: var(--text-muted); }

        .msg-view-7day-badge {
            margin-left: auto; flex-shrink: 0;
            font-size: 0.65rem; font-weight: 700;
            background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3);
            color: #a5b4fc; border-radius: 20px; padding: 3px 8px;
        }

        .msg-view-body {
            flex: 1; overflow-y: auto; padding: 6px 14px 24px;
            display: flex; flex-direction: column; gap: 3px;
            -webkit-overflow-scrolling: touch;
            /* translateZ(0) → own GPU compositor layer, scroll on GPU thread */
            transform: translateZ(0); -webkit-transform: translateZ(0);
            /* overflow-anchor:none — prevents browser's built-in scroll anchor
               conflicting with our manual body.scrollTop += delta restoration */
            overflow-anchor: none;
            /* contain:strict — layout/paint/size isolated; off-screen content can't
               invalidate this layer. MUST NOT use content-visibility:auto here
               (msg-bubble-wrap heights vary wildly; auto collapses to hint = jank) */
            contain: strict;
            overscroll-behavior: contain;
        }
        .msg-view-body::-webkit-scrollbar { width: 0; }

        .msg-view-loading { text-align:center; padding:30px; color:var(--text-muted); font-size:0.82rem; }

        /* Date separator — Telegram pill */
        .msg-date-sep {
            text-align: center; margin: 4px 0 2px;
            display: flex; align-items: center; justify-content: center;
        }
        .msg-date-sep span {
            /* NO backdrop-filter: each blurred pill = 1 GPU compositor layer.
               With 5–10 separators per page that's 5–10 extra GPU passes/frame. */
            background: rgba(0,0,0,0.65);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 20px; padding: 4px 14px;
            font-size: 0.67rem; color: rgba(255,255,255,0.55);
            font-weight: 600; letter-spacing: 0.05em;
        }

        /* ── Floating sticky date pill (Telegram-style) ─────────────── */
        #sticky-date-bar {
            /* Must be OUTSIDE msg-view-body (not scrolled with content)
               and INSIDE chat-message-view (not visible outside it).
               position:absolute on chat-message-view (position:fixed) = correct. */
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            z-index: 20; /* above msg-view-body content */
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.18s ease;
            white-space: nowrap;
        }
        #sticky-date-bar.visible { opacity: 1; }
        #sticky-date-bar span {
            display: inline-block;
            background: rgba(0,0,0,0.72);
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 20px; padding: 4px 14px;
            font-size: 0.67rem; color: rgba(255,255,255,0.78);
            font-weight: 600; letter-spacing: 0.04em;
        }

        /* ── Scroll-to-bottom FAB ────────────────────────────────────── */
        #scroll-to-bottom-btn {
            position: absolute;
            bottom: 18px;
            right: 14px;
            z-index: 20;
            width: 42px; height: 42px;
            border-radius: 50%;
            background: rgba(18, 16, 40, 0.78);
            border: 1px solid rgba(255,255,255,0.15);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.08) inset;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer;
            opacity: 0; pointer-events: none;
            transform: translateY(10px) scale(0.88);
            transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
            -webkit-tap-highlight-color: transparent;
        }
        #scroll-to-bottom-btn.visible {
            opacity: 1; pointer-events: all;
            transform: translateY(0) scale(1);
        }
        #scroll-to-bottom-btn:active { transform: scale(0.92); }
        #scroll-to-bottom-btn svg { width:18px; height:18px; stroke:rgba(200,200,255,0.9); fill:none; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
        /* Unread count badge on FAB */
        #scroll-to-bottom-btn .stb-badge {
            position: absolute; top: -4px; right: -4px;
            min-width: 16px; height: 16px; border-radius: 8px;
            background: #6366f1; color: white;
            font-size: 0.58rem; font-weight: 700;
            display: none; align-items: center; justify-content: center;
            padding: 0 4px; border: 1.5px solid rgba(6,6,15,0.9);
            font-family: var(--font-body);
        }
        #scroll-to-bottom-btn.has-badge .stb-badge { display: flex; }

        /* ── Performance: strip ALL backdrop-filter from message-view elements ────
           Each blurred element = 1 GPU compositor layer (separate texture upload).
           With 20 messages on screen (bubbles, play buttons, overlays, controls):
           20 × blur-per-frame = GPU saturated at 20–25 FPS on mid-range phones.
           Solid opaque backgrounds are visually identical on our dark #06060f bg. */
        .msg-bubble,
        .msg-bubble.from-other,
        .msg-bubble.sticker-bubble,
        .msg-bubble.vn-bubble,
        .msg-bubble.media-only-bubble,
        .msg-bubble.media-only-bubble.from-other {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        /* Video play button: solid dark circle instead of blurred glass */
        .msg-vid-play {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            background: rgba(0,0,0,0.62) !important;
        }
        /* Custom video player controls: solid instead of glass */
        .custom-vid-ctrl,
        .custom-vid-player .custom-vid-ctrl {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            background: rgba(10,8,28,0.88) !important;
        }
        /* Buffer spinner backdrop */
        .custom-vid-buffer {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        /* During msg-view scroll: disable pointer events to prevent expensive hit-test */
        body.msg-view-scrolling .msg-view-body * {
            pointer-events: none !important;
        }
        html.ios-dev .msg-view-body {
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
        }
        html.ios-dev .msg-audio-player { max-width: 210px; }

        /* Message bubbles */
        .msg-bubble-wrap {
            display: flex; flex-direction: column; margin-bottom: 2px;
            /* contain:layout style — isolates paint/layout without creating stacking context.
               DO NOT add content-visibility:auto here: bubble heights vary greatly
               (text, photos, stickers, voice) — auto collapses off-screen items to the
               intrinsic hint height, changing scrollHeight and causing scroll position jumps.
               DOM is kept ≤250 rows by _pruneOldMessages so raw layout is fast enough. */
            contain: layout style;
        }
        .msg-bubble-wrap.grouped { margin-bottom: 1px; }
        .msg-bubble-wrap:not(.grouped) { margin-top: 5px; }
        .msg-bubble-wrap.from-me { align-items: flex-end; }
        .msg-bubble-wrap.from-other { align-items: flex-start; }
        /* Group that wraps forward banner + bubble together so banner matches bubble width */
        .msg-fwd-group {
            display: inline-flex;
            flex-direction: column;
            max-width: 85%;
            min-width: 0;
            align-items: stretch; /* все дети растягиваются на ширину группы */
        }
        .msg-fwd-group .msg-forward-banner {
            align-self: stretch;
            width: auto;
            max-width: 100%;
            box-sizing: border-box;
            flex-shrink: 0;
        }
        .msg-fwd-group .msg-bubble {
            max-width: 100%;
            width: auto; /* ширина задаётся через style.width в JS, не override здесь */
            min-width: unset;
            box-sizing: border-box;
            flex-shrink: 0;
        }
        /* Sticker/vn bubbles: keep fit-content width inside group */
        .msg-fwd-group .msg-bubble.sticker-bubble,
        .msg-fwd-group .msg-bubble.vn-bubble {
            width: fit-content !important;
        }

        .msg-sender-label {
            font-size: 0.68rem; color: var(--accent); font-weight: 600;
            margin-bottom: 2px; padding: 0 6px;
        }

        .msg-bubble {
            max-width: 85%; padding: 6px 9px 4px;
            border-radius: 18px; font-size: 0.875rem; line-height: 1.45;
            word-break: break-word; position: relative;
            overflow: hidden; /* CRITICAL: keeps media inside */
        }
        .msg-bubble.from-me {
            background: linear-gradient(135deg, #5a5cf0, #7c3aed);
            color: white; border-bottom-right-radius: 4px;
        }
        .msg-bubble.from-me.grouped { border-top-right-radius: 4px; }
        .msg-bubble.from-other {
            /* Solid opaque bg replaces backdrop-filter: visually identical on dark wallpaper,
               but costs ZERO per-bubble GPU compositor layers. */
            background: rgba(30,28,52,0.97);
            border: 1px solid rgba(255,255,255,0.09);
            color: var(--text-main); border-bottom-left-radius: 4px;
        }
        .msg-bubble.from-other.grouped { border-top-left-radius: 4px; }
        .msg-bubble.is-deleted { opacity: 0.65; }

        /* Sticker bubble — полностью прозрачный фон (как в Telegram) */
        .msg-bubble.sticker-bubble {
            background: transparent !important;
            border: none !important;
            border-radius: 0 !important;
            padding: 0 !important;
            overflow: visible !important;
            width: fit-content; min-width: unset;
            line-height: 0; font-size: 0; position: relative;
        }
        .msg-bubble.sticker-bubble.sticker-opaque {
            background: transparent !important;
            border: none !important;
        }
        /* Sticker content wrapper — shrink to actual image size */
        .msg-bubble.sticker-bubble .sticker-load-wrap {
            display: block;
            line-height: 0;
            font-size: 0;
            /* width/height set by JS after img loads so non-square stickers fit */
        }
        .msg-bubble.sticker-bubble .sticker-load-wrap img,
        .msg-bubble.sticker-bubble .sticker-load-wrap video,
        .msg-bubble.sticker-bubble .sticker-load-wrap svg {
            display: block;
            line-height: 0;
        }

        /* Custom-emoji inside sticker bubble: restore text size */
        .msg-bubble.sticker-bubble .sticker-custom-emoji {
            line-height: 1;
            font-size: 4rem;
        }

        /* Video note bubble — прозрачный фон, без рамки (как в Telegram) */
        .msg-bubble.vn-bubble {
            background: transparent !important;
            border: none !important;
            border-radius: 0 !important;
            padding: 0 !important;
            width: fit-content; overflow: visible; position: relative;
        }

        /* Media-only bubble */
        .msg-bubble.media-only-bubble { padding: 0 !important; overflow: hidden; }
        .msg-bubble.media-only-bubble.from-me {
            background: linear-gradient(135deg, #5a5cf0, #7c3aed) !important;
            border: none !important;
        }
        .msg-bubble.media-only-bubble.from-other {
            background: rgba(30,28,52,0.97) !important;
            border: 1px solid rgba(255,255,255,0.09) !important;
        }
        /* Media-only: edge-to-edge, media fills the bubble completely */
        .msg-bubble.media-only-bubble .msg-img-wrap,
        .msg-bubble.media-only-bubble .msg-video-wrap {
            margin: 0 !important;
            width: 100% !important;
            display: block;
        }


        /* Non-forwarded media-only: top of image has full bubble rounding (via overflow:hidden) */

        /* ── Media edge-to-edge inside bubble ───────────────────────── */
        .msg-bubble .msg-img-wrap,
        .msg-bubble .msg-media-group,
        .msg-bubble .msg-video-wrap { 
            margin: -6px -9px 4px -9px; /* Negative margins = fills bubble edges */
            display: block; width: calc(100% + 18px);
            overflow: hidden;
        }
        /* Video notes are circles — NOT edge-to-edge */
        .msg-bubble .msg-video-note {
            margin: 4px 0; display: inline-block;
            width: 148px; height: 148px;
        }
        .msg-bubble.vn-bubble .msg-video-note {
            margin: 0; display: block;
        }
        /* If media is ONLY child or last child, extend to bottom too */
        .msg-bubble .msg-img-wrap:last-child,
        .msg-bubble .msg-media-group:last-child,
        .msg-bubble .msg-video-wrap:last-child { margin-bottom: -4px; }
        /* Fix: msg-meta-media (position:absolute) breaks :last-child above — use :has() */
        .msg-bubble:has(> .msg-meta-media) .msg-img-wrap,
        .msg-bubble:has(> .msg-meta-media) .msg-media-group,
        .msg-bubble:has(> .msg-meta-media) .msg-video-wrap { margin-bottom: -4px; }

        .msg-media-placeholder {
            display: flex; align-items: center; gap: 8px;
            padding: 8px 12px; border-radius: 12px; margin-bottom: 4px;
            background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
            font-size: 0.82rem; color: var(--text-muted);
        }
        .msg-media-placeholder.from-me { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.2); }

        /* ── Time — Telegram-style inline float ───────────────────── */
        .msg-meta {
            font-size: 0.62rem; color: rgba(255,255,255,0.4);
            display: inline-flex; align-items: center; gap: 4px;
            float: right; padding: 3px 0 0 10px; position: relative; z-index: 2;
            line-height: 1; vertical-align: bottom;
        }
        .msg-bubble.from-other .msg-meta { color: rgba(255,255,255,0.35); }
        /* For media-only messages: time overlay on dark capsule */
        .msg-meta-media {
            position: absolute; bottom: 6px; right: 6px; z-index: 3;
            background: rgba(0,0,0,0.55); border-radius: 10px; padding: 2px 7px;
            font-size: 0.6rem; color: rgba(255,255,255,0.85);
        }
        /* Sticker & video note: time pill overlaid bottom-right ON the media (like Telegram) */
        .msg-bubble.sticker-bubble .msg-meta-media,
        .msg-bubble.vn-bubble .msg-meta-media {
            position: absolute;
            bottom: 6px;
            right: 6px;
            background: rgba(0,0,0,0.60);
            border-radius: 8px;
            padding: 3px 6px;
            font-size: 0.6rem; color: rgba(255,255,255,0.92);
            z-index: 10;
            line-height: 1.2;
            font-size: 0;  /* reset parent font-size:0 */
        }
        .msg-bubble.sticker-bubble .msg-meta-media,
        .msg-bubble.vn-bubble .msg-meta-media {
            font-size: 0.6rem;
        }

        .msg-edited-tag { color: rgba(255,255,255,0.4); font-style: italic; }
        .msg-deleted-tag { color: rgba(244,63,94,0.7); font-weight: 600; }
        .msg-reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
        .msg-reaction {
            font-size: 0.8rem; background: rgba(255,255,255,0.07);
            border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 1px 6px;
        }

        /* Text — allows time to float right */
        .msg-text-content { word-break: break-word; }
        .msg-text-content a { color: #8774e1; text-decoration: none; }
        .msg-text-content a:hover { text-decoration: underline; }

        .msg-reply-preview {
            border-left: 2px solid rgba(99,102,241,0.6);
            padding: 4px 8px; margin-bottom: 5px;
            border-radius: 0 8px 8px 0;
            background: rgba(99,102,241,0.08);
            font-size: 0.74rem; color: var(--text-muted);
        }
        .msg-reply-sender { color: #a5b4fc; font-weight: 600; font-size: 0.7rem; margin-bottom: 1px; }
        /* Once-view reply shows lock icon */
        .msg-reply-preview.once-view {
            border-left-color: rgba(167,139,250,0.6);
            background: rgba(124,58,237,0.08);
        }

        .msg-load-more {
            text-align: center; padding: 10px;
        }
        .msg-load-more button {
            background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3);
            color: #a5b4fc; border-radius: 20px; padding: 8px 20px;
            font-size: 0.8rem; font-weight: 600; cursor: pointer;
            font-family: var(--font-body); transition: background 0.15s;
        }
        .msg-load-more button:active { background: rgba(99,102,241,0.25); }

        .msg-scroll-sentinel { height:1px; pointer-events:none; }
        .msg-placeholder { padding:10px 14px; border-radius:12px; font-size:0.82rem; margin:2px 0; }
        .msg-placeholder-err { color:var(--text-muted); background:rgba(244,63,94,0.08); border:1px solid rgba(244,63,94,0.15); }
        .msg-placeholder-warn { color:rgba(255,159,10,0.9); background:rgba(255,159,10,0.08); border:1px solid rgba(255,159,10,0.15); }

        /* Telegram-style video thumbnail + play button */
        .msg-vid-thumb { position:relative; overflow:hidden; cursor:pointer; background:#0a0a14; border-radius:inherit; }
        .msg-vid-thumb img { width:100%; display:block; object-fit:cover; }
        .msg-vid-play { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:52px; height:52px; border-radius:50%; background:rgba(0,0,0,.65); border:2px solid rgba(255,255,255,.25); display:flex; align-items:center; justify-content:center; box-shadow:0 4px 20px rgba(0,0,0,.5); }
        .msg-vid-play:active { transform:translate(-50%,-50%) scale(.9); }
        .msg-vid-play svg.play-icon { width:22px; height:22px; fill:white; margin-left:3px; }
        /* Download sub-button — small circle at bottom-right of play button (Telegram style) */
        .msg-vid-dl-btn { position:absolute; bottom:-4px; right:-4px; width:21px; height:21px; border-radius:50%; background:rgba(20,20,35,0.95); border:1.5px solid rgba(255,255,255,.22); display:flex; align-items:center; justify-content:center; box-shadow:0 1px 5px rgba(0,0,0,.5); flex-shrink:0; }
        .msg-vid-dl-btn svg { width:11px; height:11px; fill:white; }
        .msg-vid-dur { position:absolute; bottom:8px; left:8px; background:rgba(0,0,0,.6); border-radius:10px; padding:2px 7px; font-size:.65rem; color:rgba(255,255,255,.85); font-weight:500; }
        .msg-vid-thumb.loading .msg-vid-play { display:none; }
        .msg-vid-thumb .vid-spinner { display:none; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); }
        .msg-vid-thumb.loading .vid-spinner { display:block; }

        /* ── Telegram-style Spoiler overlay with particles ─────────────── */
        .msg-spoiler-ov {
            position: absolute; inset: 0; z-index: 5;
            cursor: pointer; border-radius: inherit;
            overflow: hidden;
            transition: opacity .4s ease;
        }
        .msg-spoiler-ov.off { opacity: 0; pointer-events: none; }
        /* Canvas fills the overlay — particles drawn here */
        .msg-spoiler-ov canvas {
            position: absolute; inset: 0;
            width: 100%; height: 100%;
            border-radius: inherit;
        }
        /* Frosted blur layer underneath canvas */
        .msg-spoiler-blur {
            position: absolute; inset: 0;
            backdrop-filter: blur(28px) brightness(.75) saturate(1.4);
            -webkit-backdrop-filter: blur(28px) brightness(.75) saturate(1.4);
            border-radius: inherit;
        }

        /* Sticker */
        .msg-sticker {
            width: 120px; height: 120px; object-fit: contain;
        }

        /* ── Full-parity message rendering CSS ─────────────────────────── */

        /* Deleted badge inside bubble */
        .deleted-badge-inline {
            color: rgba(244,63,94,0.9); font-weight: 600; font-size: 0.85rem;
            margin-bottom: 2px;
        }

        /* One-time / protected badge */
        .once-badge {
            display: flex; width: fit-content; align-items: center; gap: 5px;
            color: #ff9f0a; font-size: 0.75rem; font-weight: 700;
            background: rgba(255,159,10,0.12); border: 1px solid rgba(255,159,10,0.28);
            padding: 3px 8px; border-radius: 8px; margin-bottom: 6px;
        }

        /* Edit history box */
        .history-box {
            background: rgba(255,255,255,0.05); padding: 6px 8px;
            border-radius: 8px; margin-bottom: 6px; font-size: 0.82rem;
            border: 1px solid rgba(255,255,255,0.06); color: var(--text-muted);
        }

        /* Plain text content in bubble */
        .msg-text-content { word-break: break-word; line-height: 1.5; }

        /* Forward banner — unified style: separate element in .msg-fwd-group, above bubble */
        .msg-forward-banner {
            border-left: 3px solid #a78bfa;
            padding: 6px 11px 6px 10px;
            margin-bottom: 3px;
            background: rgba(30, 20, 65, 0.92);
            border-radius: 8px 8px 8px 2px;
            font-size: 0.8rem; color: #e0d4ff;
            white-space: normal; word-break: break-word; overflow-wrap: break-word;
            line-height: 1.45;
            box-sizing: border-box;
            min-width: 110px;
            border: 1px solid rgba(140,110,255,0.22);
            border-left-width: 3px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.35);
        }
        .msg-forward-label { display: block; opacity: 0.7; font-size: 0.7rem; margin-bottom: 2px; letter-spacing: 0.01em; }
        .msg-forward-from { display: block; font-weight: 700; color: #c4b0ff; word-break: break-word; }
        .msg-forward-link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
        .msg-forward-link:active { opacity: 0.7; }

        /* Contact card */
        .msg-contact {
            display: flex; align-items: center; gap: 10px;
            background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
            border-radius: 12px; padding: 10px 12px; margin-top: 2px; max-width: 240px;
        }

        /* Location link (legacy, kept for compat) */
        .msg-location {
            display: flex; align-items: center; gap: 10px;
            background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
            border-radius: 12px; padding: 10px 12px; margin-top: 2px; max-width: 240px;
            text-decoration: none; color: var(--text-main);
        }
        .msg-location:active { background: rgba(99,102,241,0.1); }

        /* Map thumbnail card */
        .msg-location-map {
            display: block; max-width: 240px; margin-top: 2px;
            background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
            border-radius: 12px; overflow: hidden;
            text-decoration: none; color: var(--text-main); cursor: pointer;
        }
        .msg-location-map:active { opacity: 0.8; }
        .msg-location-map-tile {
            position: relative; width: 240px; height: 130px; overflow: hidden;
            background: #c8d4d8;
        }
        .msg-location-map-tile img {
            position: absolute; width: 256px; height: 256px;
            image-rendering: auto; pointer-events: none;
        }
        .msg-location-map-pin {
            position: absolute; left: 50%; top: 50%;
            transform: translate(-50%, -100%);
            font-size: 26px; line-height: 1;
            filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
            pointer-events: none;
        }
        .msg-location-map-info {
            display: flex; align-items: center; gap: 8px;
            padding: 8px 10px;
        }
        .msg-location-map-info-icon { font-size: 1.05rem; flex-shrink: 0; }
        .msg-location-map-label { font-weight: 600; font-size: 0.87rem; }
        .msg-location-map-coords { font-size: 0.72rem; color: #a5b4fc; margin-top: 1px; }

        /* Poll */
        .msg-poll {
            background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
            border-radius: 12px; padding: 10px 12px; margin-top: 2px; min-width: 180px;
        }
        .msg-poll-q { font-weight: 700; margin-bottom: 6px; font-size: 0.88rem; }
        .msg-poll-opt {
            padding: 5px 9px; background: rgba(255,255,255,0.05);
            border-radius: 8px; margin-bottom: 4px; font-size: 0.82rem;
            border: 1px solid rgba(255,255,255,0.07);
        }

        /* Reply highlight flash animation */
        .msg-highlight { animation: msgFlash 1.4s ease; }
        @keyframes msgFlash {
            0%,100% { background: transparent; }
            20%,60% { background: rgba(99,102,241,0.22); border-radius: 12px; }
        }

        /* Image loading skeleton wrapper */
        .msg-img-wrap { position: relative; display: inline-block; }
        .msg-img-skeleton { display: block; }

        /* ── Media loading indicators ────────────────────────────────── */
        /* Pulsing gradient bublé — used for video-note and sticker loading state */
        .media-load-ring {
            width: 42px; height: 42px;
            position: absolute; top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            z-index: 5;
        }
        .media-load-ring::before {
            content: '';
            position: absolute; inset: 0;
            border-radius: 50%;
            background: conic-gradient(
                from 0deg,
                transparent 0%,
                rgba(167,139,250,0.15) 20%,
                rgba(99,102,241,0.9) 50%,
                rgba(167,139,250,0.9) 75%,
                transparent 100%
            );
            animation: bubleSpin 0.9s linear infinite;
        }
        .media-load-ring::after {
            content: '';
            position: absolute; inset: 5px;
            border-radius: 50%;
            background: rgba(15,12,30,0.92);
            animation: bublePulse 1.8s ease-in-out infinite;
        }
        @keyframes bubleSpin {
            0%   { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        @keyframes bublePulse {
            0%, 100% { opacity: 0.85; transform: scale(0.96); }
            50%       { opacity: 1;    transform: scale(1.04); }
        }
        /* Loading % label */
        .media-load-pct {
            position: absolute; bottom: 8px; left: 50%;
            transform: translateX(-50%);
            font-size: 0.6rem; color: rgba(255,255,255,0.55);
            font-weight: 700; letter-spacing: 0.04em;
            pointer-events: none; white-space: nowrap;
        }
        /* Sticker loading wrapper */
        .sticker-load-wrap {
            width: 140px; height: 140px; display: flex;
            align-items: center; justify-content: center;
            border-radius: 16px; position: relative;
            background: transparent;
        }
        .sticker-load-wrap .chats-skeleton {
            position: absolute; inset: 0; border-radius: 16px;
            background: rgba(255,255,255,0.06); /* лёгкий скелет на прозрачном фоне */
        }
        /* Audio button loading spinner */
        .msg-audio-btn { position: relative; overflow: hidden; }
        .msg-audio-btn .btn-spin {
            position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
        }
        .msg-audio-btn .btn-spin svg { animation: spin 0.85s linear infinite; }
        /* Audio waveform loading state */
        .msg-audio-waveform.loading .msg-audio-bar {
            opacity: 0.25;
            animation: waveformPulse 1.2s ease-in-out infinite;
        }
        .msg-audio-waveform.loading .msg-audio-bar:nth-child(even) {
            animation-delay: 0.3s;
        }
        @keyframes waveformPulse { 0%,100%{opacity:0.15} 50%{opacity:0.4} }
        /* ══════════════════════════════════════════════════════════
           PREMIUM CUSTOM VIDEO PLAYER — Quasar Design
           ══════════════════════════════════════════════════════════ */
        .custom-vid-player {
            position: relative; width: 100%; border-radius: inherit; overflow: hidden;
            background: #000; display: block; user-select: none; -webkit-user-select: none;
        }
        .custom-vid-player video {
            width: 100%; display: block; max-height: 400px; object-fit: contain; cursor: pointer;
            background: #000;
        }
        /* Gradient overlay — always present, dims video for control readability */
        .custom-vid-gradient {
            position: absolute; bottom: 0; left: 0; right: 0; height: 90px;
            background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
            pointer-events: none; z-index: 2;
            opacity: 0; transition: opacity 0.22s ease;
        }
        .custom-vid-gradient-top {
            position: absolute; top: 0; left: 0; right: 0; height: 40px;
            background: linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 100%);
            pointer-events: none; z-index: 2;
            opacity: 0; transition: opacity 0.22s ease;
        }
        .custom-vid-ctrl {
            position: absolute; bottom: 0; left: 0; right: 0;
            padding: 0 10px 8px;
            display: flex; flex-direction: column; gap: 4px;
            opacity: 0; transition: opacity 0.22s ease;
            pointer-events: none; z-index: 3;
        }
        .custom-vid-player.ctrl-visible .custom-vid-ctrl,
        .custom-vid-player.ctrl-visible .custom-vid-gradient,
        .custom-vid-player.ctrl-visible .custom-vid-gradient-top { opacity: 1; pointer-events: auto; }
        /* Seek row */
        .custom-vid-seek-row {
            display: flex; align-items: center; gap: 0; padding: 0 0 2px;
        }
        .custom-vid-seek-wrap {
            flex: 1; height: 20px; display: flex; align-items: center; position: relative;
            cursor: pointer; touch-action: none;
        }
        .custom-vid-seek-track {
            position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
            height: 3px; border-radius: 3px;
            background: rgba(255,255,255,0.22);
            overflow: hidden; pointer-events: none;
            transition: height 0.15s ease;
        }
        .custom-vid-seek-wrap:active .custom-vid-seek-track,
        .custom-vid-seek-wrap.dragging .custom-vid-seek-track { height: 5px; }
        .custom-vid-seek-fill {
            height: 100%; width: 0%; border-radius: 3px;
            background: linear-gradient(90deg, #a78bfa, #6366f1);
        }
        .custom-vid-seek-buf {
            position: absolute; left: 0; height: 100%; width: 0%;
            background: rgba(255,255,255,0.18); border-radius: 3px;
            pointer-events: none;
        }
        .custom-vid-seek-thumb {
            position: absolute; top: 50%; transform: translate(-50%, -50%);
            width: 13px; height: 13px; border-radius: 50%;
            background: white; left: 0%;
            box-shadow: 0 1px 6px rgba(0,0,0,0.55);
            pointer-events: none; opacity: 0; transition: opacity 0.15s;
        }
        .custom-vid-seek-wrap:active .custom-vid-seek-thumb,
        .custom-vid-seek-wrap.dragging .custom-vid-seek-thumb,
        .custom-vid-player.ctrl-visible .custom-vid-seek-thumb { opacity: 1; }
        .custom-vid-seek-input {
            position: absolute; inset: 0; width: 100%; height: 100%;
            opacity: 0; cursor: pointer; margin: 0;
            -webkit-appearance: none; appearance: none;
        }
        /* Controls row */
        .custom-vid-ctrl-row {
            display: flex; align-items: center; gap: 6px;
        }
        .custom-vid-play-btn {
            width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
            background: rgba(99,102,241,0.75);
            color: white; display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: background 0.15s, transform 0.12s;
            backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
        }
        .custom-vid-play-btn:active { transform: scale(0.88); }
        .custom-vid-play-btn svg { width: 15px; height: 15px; fill: white; }
        /* Volume button */
        .custom-vid-vol-btn {
            width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
            background: rgba(255,255,255,0.1); color: white;
            display: flex; align-items: center; justify-content: center; flex-shrink: 0;
            transition: background 0.15s;
        }
        .custom-vid-vol-btn:active { background: rgba(255,255,255,0.22); }
        .custom-vid-vol-btn svg { width: 14px; height: 14px; stroke: white; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        /* Speed badge */
        .custom-vid-speed-btn {
            height: 22px; padding: 0 7px; border-radius: 11px; border: none; cursor: pointer;
            background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9);
            font-size: 0.62rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: background 0.15s; letter-spacing: 0.02em;
        }
        .custom-vid-speed-btn:active { background: rgba(99,102,241,0.5); }
        .custom-vid-time {
            font-size: 0.61rem; color: rgba(255,255,255,0.88); font-weight: 600;
            flex-shrink: 0; letter-spacing: 0.02em; white-space: nowrap; margin-left: auto;
        }
        .custom-vid-fullscreen {
            width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
            background: rgba(255,255,255,0.1); color: white;
            display: flex; align-items: center; justify-content: center; flex-shrink: 0;
            transition: background 0.15s;
        }
        .custom-vid-fullscreen:active { background: rgba(255,255,255,0.22); }
        .custom-vid-fullscreen svg { width: 13px; height: 13px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
        /* Center play/pause overlay */
        .custom-vid-center-btn {
            position: absolute; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.75);
            width: 60px; height: 60px; border-radius: 50%;
            background: rgba(0,0,0,0.62);
            border: 2px solid rgba(255,255,255,0.18);
            display: flex; align-items: center; justify-content: center;
            opacity: 0; transition: opacity 0.18s ease, transform 0.18s ease;
            pointer-events: none; z-index: 4;
            backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
        }
        .custom-vid-player.ctrl-visible .custom-vid-center-btn {
            opacity: 1; transform: translate(-50%, -50%) scale(1);
        }
        .custom-vid-center-btn svg { width: 22px; height: 22px; fill: white; }
        .custom-vid-center-btn svg.play-i { margin-left: 3px; }
        .custom-vid-player.playing .custom-vid-center-btn svg.play-i { display: none; }
        .custom-vid-player:not(.playing) .custom-vid-center-btn svg.pause-i { display: none; }
        /* Buffering spinner */
        .custom-vid-buffer {
            position: absolute; top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            display: none; z-index: 5; pointer-events: none;
        }
        .custom-vid-player.buffering .custom-vid-buffer { display: block; }
        /* Seek timestamp tooltip */
        .custom-vid-seek-tip {
            position: absolute; bottom: 28px; transform: translateX(-50%);
            background: rgba(0,0,0,0.8); color: white;
            font-size: 0.6rem; font-weight: 700; padding: 2px 6px; border-radius: 6px;
            pointer-events: none; white-space: nowrap; opacity: 0; transition: opacity 0.1s;
            z-index: 5; letter-spacing: 0.03em;
        }
        .custom-vid-seek-wrap.dragging .custom-vid-seek-tip { opacity: 1; }

        /* ── Chats page video player overrides ─── */
        .msg-video-skel {
            width: 100%; min-height: 140px;
            position: relative; overflow: hidden;
        }
        .msg-video-skel .chats-skeleton { width: 100%; height: 100%; }
        .msg-video-skel .media-load-ring { width: 34px; height: 34px; }


        .msg-img-wrap { position: relative; display: block; overflow: hidden; }
        .msg-img-thumb {
            position: absolute; inset: 0;
            width: 100%; height: 100%; object-fit: cover;
            filter: blur(10px); transform: scale(1.05);
            transition: opacity 0.3s ease; z-index: 1;
        }
        .msg-img-thumb.hidden { opacity: 0; pointer-events: none; }
        .msg-media-img { transition: opacity 0.3s ease; }
        .msg-media-img.loading { opacity: 0; }
        .msg-media-img {
            width: 100%; display: block; object-fit: cover; cursor: zoom-in;
        }
        .msg-media-img.group-img {
            width: 100%; height: 130px; object-fit: cover; cursor: zoom-in;
        }

        /* Media group grid */
        .msg-media-group {
            display: grid; grid-template-columns: repeat(2, 1fr);
            gap: 2px; overflow: hidden;
        }
        .msg-media-group img:only-child { grid-column: span 2; }

        /* Document */
        .msg-document {
            display: flex; align-items: center; gap: 10px;
            background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
            border-radius: 12px; padding: 9px 12px; margin-top: 2px; max-width: 220px;
        }
        .msg-doc-icon { font-size: 1.4rem; flex-shrink: 0; }
        .msg-doc-info { overflow: hidden; flex: 1; }
        .msg-doc-name {
            font-size: 0.82rem; font-weight: 600; white-space: nowrap;
            overflow: hidden; text-overflow: ellipsis; color: var(--text-main);
        }
        .msg-doc-dl {
            font-size: 0.75rem; color: #a5b4fc; text-decoration: none; font-weight: 600;
        }

        /* Audio player — Telegram waveform style */
        .msg-audio-player {
            display: flex; align-items: center; gap: 10px;
            padding: 4px 2px; margin-top: 2px;
            min-width: 200px; max-width: 240px;
        }
        .msg-audio-btn {
            width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
            background: linear-gradient(135deg, #7c3aed, #a78bfa); border: none;
            color: white; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: transform 0.12s, opacity 0.15s;
            box-shadow: 0 2px 12px rgba(124,58,237,0.45);
        }
        .msg-bubble.from-other .msg-audio-btn {
            background: linear-gradient(135deg, #3730a3, #6366f1);
            box-shadow: 0 2px 12px rgba(99,102,241,0.4);
        }
        .msg-audio-btn:active { transform: scale(0.88); opacity: 0.85; }
        .msg-audio-waveform {
            flex: 1; height: 28px; display: flex; align-items: center;
            gap: 1.5px; cursor: pointer; overflow: hidden;
        }
        .msg-audio-bar {
            width: 2px; border-radius: 1px; flex-shrink: 0; min-height: 3px;
            background: rgba(255,255,255,0.3); transition: background 0.05s;
        }
        .msg-audio-bar.played { background: rgba(255,255,255,0.9); }
        .msg-bubble.from-other .msg-audio-bar { background: rgba(99,102,241,0.3); }
        .msg-bubble.from-other .msg-audio-bar.played { background: var(--accent); }
        .msg-audio-time {
            font-size: 0.66rem; color: rgba(255,255,255,0.6); flex-shrink: 0;
            min-width: 30px; text-align: right; font-weight: 500;
        }
        .msg-bubble.from-other .msg-audio-time { color: var(--text-muted); }

        /* Video note (круглое) */
        .msg-video-note {
            margin-top: 2px; position: relative;
            display: inline-block; width: 148px; height: 148px;
        }
        /* Clip all absolutely-positioned children to the circular video area */
        .msg-video-note .vn-inner {
            position: absolute; top: 4px; left: 4px;
            width: 140px; height: 140px; border-radius: 50%;
            overflow: hidden;
        }
        .msg-video-note .vn-inner video {
            position: absolute; inset: 0;
            width: 100%; height: 100%; object-fit: cover;
            border-radius: 0; display: block; cursor: pointer;
        }
        /* Loading placeholder circle — Telegram-style gray shimmer while blob downloads */
        .vn-loading-bg {
            position: absolute; inset: 0;
            background: rgba(255,255,255,0.06);
            overflow: hidden;
        }
        .vn-loading-bg::after {
            content: ''; position: absolute; inset: 0;
            background: linear-gradient(90deg,
                transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
            animation: vnShimmer 1.4s ease-in-out infinite;
            transform: translateX(-100%);
        }
        @keyframes vnShimmer { to { transform: translateX(200%); } }
        .msg-video-note .vn-inner video { opacity: 0; transition: opacity 0.3s ease; }
        .msg-video-note.loaded .vn-inner video { opacity: 1; }
        .msg-video-note.loaded .vn-loading-bg { display: none; }
        /* Loading spinner centered in the circle */
        .msg-video-note .media-load-ring {
            position: absolute; top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            width: 28px; height: 28px; border-width: 2.5px;
        }
        .vn-ring-svg {
            position: absolute; top: 0; left: 0;
            width: 148px; height: 148px;
            pointer-events: none; transform: rotate(-90deg);
        }
        .vn-ring-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 3; }
        .vn-ring-progress {
            fill: none; stroke: #a78bfa; stroke-width: 3; stroke-linecap: round;
            will-change: stroke-dashoffset;
        }
        .vn-play-overlay {
            position: absolute; inset: 0; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            opacity: 0; transition: opacity 0.25s ease; pointer-events: none;
            z-index: 2;
        }
        .vn-play-overlay.visible { opacity: 1; pointer-events: auto; }
        .vn-play-btn {
            width: 46px; height: 46px;
            background: rgba(15,15,25,0.6);
            backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
            border-radius: 50%; display: flex; align-items: center; justify-content: center;
            border: 1.5px solid rgba(255,255,255,0.2);
            box-shadow: 0 2px 18px rgba(0,0,0,0.5); cursor: pointer;
        }
        .vn-play-btn svg { width: 18px; height: 18px; fill: white; stroke: none; margin-left: 2px; }
        .vn-pause-icon { display: none; margin-left: 0 !important; }
        .msg-video-note.playing .vn-play-icon { display: none; }
        .msg-video-note.playing .vn-pause-icon { display: block; }
        /* Custom emoji sticker — large emoji rendered natively */
        .sticker-custom-emoji {
            display: inline-flex; align-items: center; justify-content: center;
            width: 80px; height: 80px; font-size: 3.5rem; line-height: 1;
            user-select: none;
        }

        /* Placeholder for unavailable media */
        .msg-placeholder {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 7px 12px; border-radius: 10px;
            font-size: 0.8rem; font-weight: 500; margin-top: 2px;
        }
        .msg-placeholder-warn {
            color: #ff9f0a; background: rgba(255,159,10,0.1);
            border: 1px solid rgba(255,159,10,0.25);
        }
        .msg-placeholder-info {
            color: var(--text-muted); background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.08);
        }
        .msg-placeholder-err {
            color: rgba(244,63,94,0.8); background: rgba(244,63,94,0.08);
            border: 1px solid rgba(244,63,94,0.18);
        }

        /* chats empty / loaded state */
        .chats-content-wrap { display: none; flex-direction: column; gap: 6px; }
        .chats-content-wrap.visible { display: flex; }
        .chats-empty-wrap { display: none; flex-direction: column; align-items: center; justify-content: center; padding-top: 40px; }
        .chats-empty-wrap.visible { display: flex; }

        /* Chats page header */
        .chats-page-header {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 16px;
        }
        .chats-count-badge {
            font-size: 0.72rem; font-weight: 700;
            background: rgba(99,102,241,0.18); border: 1px solid rgba(99,102,241,0.3);
            color: #a5b4fc; border-radius: 20px; padding: 3px 10px;
        }
        .chats-refresh-btn {
            width: 32px; height: 32px; border-radius: 50%;
            background: rgba(20,18,40,0.7); border: 1px solid rgba(255,255,255,0.18);
            backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
            color: rgba(220,220,255,0.85); display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: all 0.2s;
        }
        .chats-refresh-btn:active { transform: rotate(180deg); background: rgba(99,102,241,0.2); color: #a5b4fc; }
        .chats-refresh-btn.spinning svg { animation: spin 0.6s linear; }
        @keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

        /* Skeleton loader */
        .chats-skeleton {
            background: rgba(255,255,255,0.04);
            border-radius: 12px;
            position: relative; overflow: hidden;
        }
        .chats-skeleton::after {
            content: '';
            position: absolute; inset: 0;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.065), transparent);
            transform: translateX(-100%);
            animation: shimmer 1.4s ease-in-out infinite;
        }
        /* translateX = compositor-tier (нет repaint), background-position = paint-tier */
        @keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }

        /* Empty state redesign */
        .chats-empty-inner {
            text-align: center; padding: 20px;
        }
        .chats-empty-icon {
            width: 72px; height: 72px; border-radius: 24px;
            background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2);
            display: flex; align-items: center; justify-content: center;
            margin: 0 auto 18px;
        }
        .chats-empty-icon svg { width: 36px; height: 36px; stroke: #a5b4fc; }
        .chats-empty-title {
            font-size: 1rem; font-weight: 700; font-family: var(--font-head);
            color: #f0f0ff; margin-bottom: 8px;
            text-shadow: 0 1px 8px rgba(0,0,0,0.8);
        }
        .chats-empty-desc {
            font-size: 0.82rem; color: rgba(200,200,230,0.75); line-height: 1.55; max-width: 260px; margin: 0 auto;
            text-shadow: 0 1px 4px rgba(0,0,0,0.7);
        }


        /* ================= НИЖНЯЯ НАВИГАЦИЯ ================= */
        .bottom-nav { 
            position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); 
            width: calc(100% - 32px); max-width: 400px; height: 62px; 
            background: rgba(12, 12, 22, 0.78); 
            backdrop-filter: blur(50px) saturate(200%) brightness(1.1); 
            -webkit-backdrop-filter: blur(50px) saturate(200%) brightness(1.1);
            border: 1px solid rgba(255,255,255,0.1); 
            border-radius: 32px; 
            display: flex; justify-content: space-around; align-items: center; 
            box-shadow: 
                0 1px 0 rgba(255,255,255,0.1) inset,
                0 12px 40px rgba(0,0,0,0.55),
                0 0 0 0.5px rgba(255,255,255,0.05);
            z-index: 100; 
        }
        .nav-item { 
            display: flex; flex-direction: column; align-items: center; justify-content: center; 
            width: 25%; color: var(--text-muted); transition: all 0.25s; cursor: pointer; 
            gap: 3px;
        }
        .nav-item.active { color: white; }
        .nav-item.active .nav-icon-wrap {
            background: rgba(99,102,241,0.2);
            border-color: rgba(99,102,241,0.3);
        }
        /* Sub button overrides its own icon-wrap color via JS when sub is active */
        .nav-icon-wrap {
            width: 36px; height: 26px;
            display: flex; align-items: center; justify-content: center;
            border-radius: 10px;
            border: 1px solid transparent;
            transition: all 0.25s;
        }
        .nav-item svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
        .nav-item span { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.02em; font-family: var(--font-body); }

        /* ================= ПРОФИЛЬ ================= */
        .profile-user-card { 
            display: flex; align-items: center; gap: 14px; 
            background: var(--glass-bg); 
            backdrop-filter: blur(40px) saturate(160%);
            -webkit-backdrop-filter: blur(40px) saturate(160%);
            padding: 16px; border-radius: 22px; 
            border: 1px solid var(--glass-border-bright); 
            margin-bottom: 12px;
            box-shadow: 0 1px 0 rgba(255,255,255,0.07) inset, 0 8px 32px rgba(0,0,0,0.3);
        }
        .profile-avatar { 
            width: 52px; height: 52px; border-radius: 50%; 
            background: linear-gradient(135deg, var(--accent), #8b5cf6); 
            display: flex; align-items: center; justify-content: center; 
            font-size: 20px; font-weight: 700; font-family: var(--font-head);
            box-shadow: 0 4px 16px rgba(99,102,241,0.4);
            border: 1.5px solid rgba(255,255,255,0.15);
            overflow: hidden; position: relative; flex-shrink: 0;
        }
        .profile-avatar img {
            width: 100%; height: 100%; object-fit: cover;
            display: block; position: absolute; inset: 0; border-radius: 50%;
        }
        .profile-name { font-size: 1.05rem; font-weight: 700; font-family: var(--font-head); }
        .profile-id { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; font-weight: 400; }

        .conn-status-card { 
            display: flex; align-items: center; gap: 12px; 
            background: var(--glass-bg); 
            backdrop-filter: blur(40px);
            -webkit-backdrop-filter: blur(40px);
            padding: 13px 16px; border-radius: 16px; 
            border: 1px solid var(--glass-border-bright); 
            margin-bottom: 12px; font-weight: 500; font-size: 0.9rem; 
            transition: background 0.15s;
        }
        .conn-status-card:active { background: rgba(255,255,255,0.07); }
        .status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

        /* ── QMONITOR styles ── */
        .qmon-fbtn {
            font-size:0.63rem; padding:2px 8px; border-radius:8px;
            border:1px solid rgba(255,255,255,0.1); background:transparent;
            color:#64748b; cursor:pointer; font-family:monospace; transition: all 0.15s;
        }
        .qmon-fbtn.qmon-active {
            border-color:rgba(99,102,241,0.5); background:rgba(99,102,241,0.2); color:#a5b4fc;
        }
        .qmon-row {
            display:flex; gap:6px; padding:3px 14px; border-bottom:1px solid rgba(255,255,255,0.025);
            align-items:flex-start; line-height:1.4; animation: qmonIn 0.15s ease both;
        }
        @keyframes qmonIn { from { opacity:0; transform:translateX(-4px); } to { opacity:1; transform:none; } }
        .qmon-ts { color:#334155; white-space:nowrap; min-width:60px; }
        .qmon-cat { border-radius:4px; padding:0px 5px; font-size:0.6rem; font-weight:700; white-space:nowrap; }
        .qmon-cat-API     { background:rgba(56,189,248,0.15); color:#38bdf8; }
        .qmon-cat-AVATAR  { background:rgba(167,139,250,0.15); color:#a78bfa; }
        .qmon-cat-AUTH    { background:rgba(251,191,36,0.15);  color:#fbbf24; }
        .qmon-cat-SSE     { background:rgba(34,211,160,0.15);  color:#34d399; }
        .qmon-cat-CONN    { background:rgba(99,102,241,0.15);  color:#818cf8; }
        .qmon-cat-CSP     { background:rgba(244,63,94,0.2);    color:#f87171; }
        .qmon-cat-ERROR   { background:rgba(244,63,94,0.15);   color:#fb7185; }
        .qmon-cat-UI      { background:rgba(148,163,184,0.1);  color:#94a3b8; }
        .qmon-cat-MEDIA   { background:rgba(249,115,22,0.15);  color:#fb923c; }
        .qmon-cat-LANG    { background:rgba(52,211,153,0.12);  color:#6ee7b7; }
        .qmon-msg { color:#cbd5e1; word-break:break-all; flex:1; }
        .status-on { background: var(--success); box-shadow: 0 0 10px var(--success); }
        .status-off { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

        /* ================= МЕНЮ ГРУППЫ ================= */
        .menu-group { 
            background: var(--glass-bg); 
            backdrop-filter: blur(40px) saturate(160%); 
            -webkit-backdrop-filter: blur(40px) saturate(160%);
            border-radius: 22px; 
            border: 1px solid var(--glass-border-bright); 
            overflow: hidden; margin-bottom: 12px;
            box-shadow: 0 1px 0 rgba(255,255,255,0.07) inset, 0 6px 24px rgba(0,0,0,0.25);
        }
        .menu-btn { 
            width: 100%; padding: 15px 18px; 
            background: transparent; border: none; 
            border-bottom: 1px solid rgba(255,255,255,0.05); 
            color: var(--text-main); font-weight: 500; font-size: 0.9rem; 
            display: flex; align-items: center; justify-content: space-between; 
            cursor: pointer; transition: background 0.15s;
            font-family: var(--font-body);
        }
        .menu-btn:last-child { border-bottom: none; }
        .menu-btn:active { background: rgba(255,255,255,0.04); }
        .menu-icon { display: flex; align-items: center; gap: 14px; }
        .menu-chevron { color: rgba(255,255,255,0.2); display: inline-flex; align-items: center; flex-shrink: 0; }

        /* Иконка-бейдж */
        .icon-badge {
            width: 34px; height: 34px; border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }
        .icon-badge svg { width: 18px; height: 18px; stroke: white; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        .icon-badge.blue { background: linear-gradient(135deg, #0ea5e9, #38bdf8); box-shadow: 0 3px 10px rgba(14,165,233,0.4); }
        .icon-badge.gold { background: linear-gradient(135deg, #c9a227, #f0c040); box-shadow: 0 3px 10px rgba(255,215,0,0.4); }
        .icon-badge.gray { background: linear-gradient(135deg, #374151, #4b5563); box-shadow: 0 3px 10px rgba(0,0,0,0.3); }
        .icon-badge.purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); box-shadow: 0 3px 10px rgba(124,58,237,0.4); }
        .icon-badge.teal { background: linear-gradient(135deg, #0d9488, #2dd4bf); box-shadow: 0 3px 10px rgba(13,148,136,0.4); }
        .icon-badge.rose { background: linear-gradient(135deg, #e11d48, #fb7185); box-shadow: 0 3px 10px rgba(225,29,72,0.4); }

        /* Статистика */
        .stats-title { 
            font-size: 0.75rem; font-weight: 700; 
            margin: 20px 0 10px 6px; 
            color: var(--text-muted); 
            text-transform: uppercase; letter-spacing: 1.2px;
            font-family: var(--font-head);
        }
        .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
        .stat-box { 
            background: var(--glass-bg); 
            backdrop-filter: blur(40px);
            -webkit-backdrop-filter: blur(40px);
            border: 1px solid var(--glass-border-bright); 
            border-radius: 20px; padding: 20px 16px; 
            text-align: center; 
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            box-shadow: 0 1px 0 rgba(255,255,255,0.07) inset;
        }
        .stat-num { font-size: 2.2rem; font-weight: 800; margin-bottom: 4px; font-family: var(--font-head); line-height: 1; }
        .stat-label { font-size: 0.73rem; color: var(--text-muted); font-weight: 500; line-height: 1.3; }

        /* ================= НАСТРОЙКИ И TOGGLES ================= */
        .settings-header { 
            margin-bottom: 18px; font-size: 1.6rem; font-weight: 800; 
            font-family: var(--font-head); letter-spacing: -0.02em;
        }
        .section-label {
            font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
            text-transform: uppercase; letter-spacing: 1.2px;
            margin: 18px 0 8px 6px;
            font-family: var(--font-head);
        }
        
        .toggle-row { 
            display: flex; justify-content: space-between; align-items: center; 
            padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.04); 
        }
        .toggle-row:last-child { border-bottom: none; }
        .toggle-label { font-weight: 600; font-size: 0.88rem; }
        .toggle-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
        
        /* iOS-style switch */
        .switch { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider { 
            position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
            background: rgba(255,255,255,0.12); 
            transition: .25s cubic-bezier(0.34,1.56,0.64,1); 
            border-radius: 28px; 
            border: 1px solid rgba(255,255,255,0.08);
        }
        .slider:before { 
            position: absolute; content: ""; 
            height: 22px; width: 22px; left: 2px; bottom: 2px; 
            background: white; 
            transition: .25s cubic-bezier(0.34,1.56,0.64,1); 
            border-radius: 50%; 
            box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3); 
        }
        input:checked + .slider { background: var(--accent); border-color: rgba(99,102,241,0.5); }
        input:checked + .slider:before { transform: translateX(20px); }

        /* Блокировка */
        .lock-mode { opacity: 0.4; pointer-events: none; filter: grayscale(70%); }
        .lock-mode .slider { background: rgba(255,255,255,0.04) !important; }
        .lock-mode .slider:before { background: #555 !important; box-shadow: none !important; }
        .lock-mode input:checked + .slider { background: rgba(255,255,255,0.06) !important; }
        .lock-mode .btn { background: rgba(255,255,255,0.02); color: #444; border-color: rgba(255,255,255,0.03); }

        .bottom-area { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 5px; }

        /* Баннер блокировки — иридесцентный радужный */
        .lock-banner { 
            background: rgba(12, 10, 22, 0.85);
            border: 1.5px solid transparent;
            border-radius: 20px; padding: 14px 16px; 
            display: none; align-items: center; justify-content: space-between; 
            cursor: pointer; 
            position: relative;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            overflow: hidden;
        }
        .lock-banner::before {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: 22px;
            background: linear-gradient(90deg, 
                #6366f1, #a855f7, #ec4899, #f43f5e, 
                #fb923c, #a855f7, #6366f1, #38bdf8, #6366f1);
            background-size: 300% 100%;
            z-index: -1;
            animation: iridBorder 4s linear infinite;
        }
        .lock-banner::after {
            content: '';
            position: absolute;
            inset: 1.5px;
            border-radius: 19px;
            background: rgba(12, 10, 22, 0.92);
            z-index: -1;
        }
        @keyframes iridBorder { 
            0%   { background-position: 0% 50%; }
            100% { background-position: 300% 50%; }
        }
        .lock-banner-inner-shimmer {
            position: absolute; inset: 0; border-radius: 20px;
            background: linear-gradient(90deg, 
                rgba(99,102,241,0.06), rgba(168,85,247,0.08), rgba(236,72,153,0.06),
                rgba(99,102,241,0.06));
            background-size: 200% 100%;
            animation: lockShimmer 3s ease-in-out infinite;
            pointer-events: none;
        }
        @keyframes lockShimmer {
            0%, 100% { background-position: 0% 50%; opacity: 0.7; }
            50% { background-position: 100% 50%; opacity: 1; }
        }
        .lock-arrow {
            background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(168,85,247,0.25)); 
            width: 34px; height: 34px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
            border: 1px solid rgba(168,85,247,0.3);
            background-clip: padding-box;
            color: #c4b5fd;
        }

        /* ================= ПОДПИСКА ================= */
        .sub-header-wrap { 
            display: flex; justify-content: center; align-items: center; 
            margin-bottom: 20px; gap: 6px;
        }
        
        /* Badge — УМЕНЬШЕН отступ до 2px */
        .neo-badge-wrap { 
            display: inline-flex; align-items: center; justify-content: center; 
            border: 1px solid rgba(255,215,0,0.45); 
            border-radius: 8px; padding: 3px 9px; 
            background: rgba(255,215,0,0.1); 
            margin-left: 2px; /* ← было 10px */
            box-shadow: 0 0 10px rgba(255,215,0,0.12);
            height: 26px; flex-shrink: 0; vertical-align: middle;
        }
        .neo-text { 
            font-weight: 800; font-size: 1rem; line-height: 1; 
            background: linear-gradient(45deg, #FFD700, #FFA500); 
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            font-family: var(--font-head);
        }
        
        .promo-badge-wrap { 
            display: inline-flex; align-items: center; justify-content: center; 
            border: 1px solid rgba(56,189,248,0.4); 
            border-radius: 8px; padding: 3px 9px; 
            background: rgba(56,189,248,0.1); 
            margin-left: 2px; /* ← было 10px */
            box-shadow: 0 0 10px rgba(56,189,248,0.12);
            height: 26px; flex-shrink: 0; vertical-align: middle;
        }
        .promo-text { 
            font-weight: 800; font-size: 1rem; line-height: 1; 
            background: linear-gradient(45deg, #38bdf8, #0ea5e9); 
            -webkit-background-clip: text; -webkit-text-fill-color: transparent;
            font-family: var(--font-head);
        }

        .sub-status-card { 
            background: var(--glass-bg-strong); 
            border: 1px solid var(--glass-border-bright); 
            border-radius: 24px; padding: 22px; margin-bottom: 14px; 
            backdrop-filter: blur(40px);
            -webkit-backdrop-filter: blur(40px);
            box-shadow: 0 1px 0 rgba(255,255,255,0.07) inset, 0 8px 32px rgba(0,0,0,0.3);
            position: relative; overflow: hidden;
        }
        .sub-status-card.neo { border-color: rgba(255,215,0,0.25); }
        .sub-status-card.promo { border-color: rgba(56,189,248,0.25); }
        
        .sub-active-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; font-family: var(--font-head); }
        
        .progress-bar-bg { 
            width: 100%; height: 6px; 
            background: rgba(255,255,255,0.07); 
            border-radius: 3px; margin-bottom: 12px; 
            overflow: hidden; 
        }
        .progress-bar-fill { height: 100%; border-radius: 3px; }
        .progress-bar-fill.neo { background: linear-gradient(90deg, #d4a017, #FFD700); box-shadow: 0 0 8px rgba(255,215,0,0.6); }
        .progress-bar-fill.promo { background: linear-gradient(90deg, #0ea5e9, #38bdf8); box-shadow: 0 0 8px rgba(56,189,248,0.6); }
        
        .progress-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }
        .progress-end { color: var(--text-main); font-weight: 600; }

        /* Заголовок внутри promo-upgrade-card */
        .upgrade-title { 
            display: flex; justify-content: center; align-items: center; 
            gap: 4px; margin-bottom: 6px;
            font-size: 1.35rem; font-weight: 800; font-family: var(--font-head);
        }
        .upgrade-title .neo-badge-wrap { margin-left: 4px; transform: none; height: 22px; padding: 2px 7px; }
        .upgrade-title .neo-text { font-size: 0.85rem; }

        /* Фичи Neo */
        .neo-feature-card { 
            background: rgba(18,18,28,0.5); 
            border: 1px solid rgba(255,255,255,0.07); 
            border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; 
            display: flex; align-items: center; gap: 14px; 
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            position: relative; overflow: hidden; 
        }
        .neo-feature-card::before { 
            content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; 
            border-radius: 0 2px 2px 0;
        }
        .nfc-1::before { background: linear-gradient(180deg, #bf5af2, #9b30e8); }
        .nfc-2::before { background: linear-gradient(180deg, #6366f1, #4f46e5); }
        .nfc-3::before { background: linear-gradient(180deg, #38bdf8, #0ea5e9); }
        .nfc-4::before { background: linear-gradient(180deg, #22d3a0, #059669); }
        .nfc-5::before { background: linear-gradient(180deg, #FFD700, #d4a017); }
        .nfc-6::before { background: linear-gradient(180deg, #a78bfa, #7c3aed); }

        .nfc-icon-wrap { 
            width: 40px; height: 40px; 
            border-radius: 12px; 
            display: flex; justify-content: center; align-items: center; 
            flex-shrink: 0; 
        }
        .nfc-1 .nfc-icon-wrap { background: rgba(191,90,242,0.2); }
        .nfc-2 .nfc-icon-wrap { background: rgba(99,102,241,0.2); }
        .nfc-3 .nfc-icon-wrap { background: rgba(56,189,248,0.2); }
        .nfc-4 .nfc-icon-wrap { background: rgba(34,211,160,0.2); }
        .nfc-5 .nfc-icon-wrap { background: rgba(255,215,0,0.15); }
        .nfc-icon-wrap svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        .nfc-1 .nfc-icon-wrap svg { color: #bf5af2; }
        .nfc-2 .nfc-icon-wrap svg { color: #818cf8; }
        .nfc-3 .nfc-icon-wrap svg { color: #38bdf8; }
        .nfc-4 .nfc-icon-wrap svg { color: #22d3a0; }
        .nfc-5 .nfc-icon-wrap svg { color: #FFD700; }

        .nfc-title { font-weight: 600; font-size: 0.88rem; }
        .nfc-desc { font-size: 0.73rem; color: var(--text-muted); margin-top: 3px; line-height: 1.3; }

        .support-link { 
            color: var(--promo-blue); 
            text-decoration: none;
            font-weight: 500;
        }
        .support-link:hover { text-decoration: underline; }

        /* Цена */
        .price-row { display: flex; justify-content: center; align-items: center; gap: 6px; margin-bottom: 20px; }
        .price-amount { font-size: 3rem; font-weight: 800; color: white; line-height: 1; font-family: var(--font-head); letter-spacing: -0.03em; }
        .price-period { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; margin-top: 14px; }

        /* Неактивная подписка */
        .sub-inactive-card { text-align: center; padding: 12px 0 0; }
        .sub-inactive-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; font-family: var(--font-head); }
        .sub-inactive-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; line-height: 1.6; }

        /* Quasar Neo brand row inside sub-inactive card */
        .sub-card-brand {
            display: flex; align-items: center; justify-content: center; gap: 6px;
            margin-bottom: 18px; padding-bottom: 16px;
            border-bottom: 1px solid rgba(255,255,255,0.07);
        }
        .sub-card-brand-name {
            font-size: 1.1rem; font-weight: 800;
            font-family: var(--font-head); color: white;
            letter-spacing: -0.01em;
        }

        /* Alt-pay-info — ширина до краёв карточки */
        .alt-pay-info {
            background: rgba(0,0,0,0.35);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 16px;
            padding: 14px 16px;
            margin-top: 14px;
            font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; text-align: left;
        }

        /* ── Discount badge & price (Promo → Neo) ── */
        .promo-discount-badge {
            display: inline-flex; align-items: center; gap: 5px;
            background: linear-gradient(135deg, rgba(244,63,94,0.18), rgba(220,38,38,0.1));
            border: 1px solid rgba(244,63,94,0.45);
            border-radius: 20px; padding: 5px 14px;
            font-size: 0.77rem; font-weight: 800; color: #fb7185;
            box-shadow: 0 0 16px rgba(244,63,94,0.22), 0 1px 0 rgba(255,255,255,0.05) inset;
            margin-bottom: 12px;
            letter-spacing: 0.03em;
        }
        .price-row-discount {
            display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 16px;
        }
        .price-old-row {
            display: inline-flex; align-items: center; gap: 3px;
            opacity: 0.55;
            color: var(--text-muted);
            position: relative;
        }
        .price-old-row::after {
            content: '';
            position: absolute;
            left: -5px;
            right: -5px;
            top: 50%;
            transform: translateY(-50%) rotate(4deg);
            transform-origin: center center;
            height: 2px;
            background: #f43f5e;
            box-shadow: 0 0 6px rgba(244,63,94,0.5);
            border-radius: 2px;
            pointer-events: none;
        }
        .price-old-amount {
            font-size: 1.35rem; font-weight: 700; font-family: var(--font-head);
            letter-spacing: -0.02em; color: var(--text-muted);
        }
        .price-old-period { font-size: 0.72rem; margin-top: 3px; }
        .price-new-row { display: flex; align-items: center; gap: 6px; }
        .price-amount-discount {
            font-size: 3rem; font-weight: 800; line-height: 1;
            font-family: var(--font-head); letter-spacing: -0.03em;
            color: #f43f5e;
            text-shadow: 0 0 28px rgba(244,63,94,0.6), 0 0 56px rgba(244,63,94,0.25);
        }

        /* ================= СУБ-СТРАНИЦЫ ================= */
        .subpage { 
            position: fixed; top: 0; left: 100%; width: 100%; height: 100%; 
            background: #06060f; 
            z-index: 200; 
            transition: transform 0.32s cubic-bezier(0.25, 0.8, 0.25, 1); 
            display: flex; flex-direction: column; 
        }
        .subpage.active { transform: translateX(-100%); }
        .subpage-header { 
            display: flex; align-items: center; 
            padding: 18px 20px; 
            border-bottom: 1px solid var(--glass-border); 
            background: rgba(12,12,22,0.8); 
            backdrop-filter: blur(30px); 
            -webkit-backdrop-filter: blur(30px);
            font-weight: 600; font-size: 1rem; font-family: var(--font-head);
        }
        .back-btn { 
            background: rgba(255,255,255,0.07); 
            border: 1px solid rgba(255,255,255,0.1); 
            color: var(--promo-blue); font-size: 0.85rem; 
            display: flex; align-items: center; gap: 6px; 
            cursor: pointer; margin-right: 14px; font-weight: 600;
            padding: 6px 12px; border-radius: 20px;
            font-family: var(--font-body);
            transition: background 0.15s;
        }
        .back-btn:active { background: rgba(255,255,255,0.12); }
        .subpage-content { flex: 1; overflow-y: auto; padding: 20px 16px; position: relative; scrollbar-width: none; }
        .subpage-content::-webkit-scrollbar { display: none; }

        /* INST CSS START */
        /* Wrapper clips the transparent padding baked into WebP icon files */
        .inst-icon-wrap {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            min-width: 20px;
            max-width: 20px;
            max-height: 20px;
            overflow: hidden;
            flex-shrink: 0;
            border-radius: 4px;
            font-size: 0;
            line-height: 0;
            vertical-align: middle;
            margin-left: 1px;
        }
        .inst-icon {
            width: 20px;
            height: 20px;
            object-fit: contain;
            display: block;
            flex-shrink: 0;
            transform: scale(1.26);
            transform-origin: center;
        }
        .inst-keyword { color:#60a5fa; font-weight:700; }

        /* QuasarNeo_bot tag — no border, color preserved */
        .inst-copy-tag {
            display: inline;
            background: none;
            border: none;
            border-radius: 0;
            padding: 0;
            color: #c4b5fd;
            font-weight: 700;
            font-size: inherit;
            line-height: inherit;
            cursor: pointer;
            transition: color 0.18s;
            white-space: nowrap;
            vertical-align: baseline;
            text-decoration: underline;
            text-underline-offset: 2px;
            text-decoration-color: rgba(196, 181, 253, 0.5);
        }
        .inst-copy-tag:hover { color: #e0d9ff; text-decoration-color: rgba(224, 217, 255, 0.8); }
        .inst-copy-tag:active { opacity: 0.75; }

        /* Custom SVG arrow */
        .inst-arrow { display:inline-flex; align-items:center; flex-shrink:0; }

        /* Instruction list: explicit flex rows, no CSS counter */
        .instructions-list { display:flex; flex-direction:column; }
        .instruction-step {
            display: flex;
            flex-direction: row;
            align-items: flex-start;
            gap: 10px;
            padding: 11px 0;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            font-size: 0.875rem;
            line-height: 1.55;
            color: rgba(255,255,255,0.88);
        }
        .instruction-step:last-child { border-bottom: none; }

        /* Number bubble — explicit element, no ::before magic */
        .step-num {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            min-width: 24px;
            height: 24px;
            border-radius: 50%;
            background: rgba(99,102,241,0.25);
            border: 1px solid rgba(99,102,241,0.4);
            font-size: 0.68rem;
            font-weight: 700;
            color: #a5b4fc;
            flex-shrink: 0;
            /* Align visually with the first text line:
               line-height 1.55 × 0.875rem ≈ 21.7px on 16px base.
               half-leading = (21.7 - 14) / 2 ≈ 3.85px.
               Circle center = 12px. Text line center = 10.85px.
               Offset = 0 → within 1px, visually perfect. */
            margin-top: 0;
        }

        /* step-body: flex row so icons sit perfectly on the same axis as text */
        .step-body {
            display: flex;
            flex-direction: row;
            align-items: center;
            flex-wrap: wrap;
            gap: 0 3px;
            line-height: 1.55;
            min-width: 0;
        }
        .step-done-sub { display:block; width:100%; margin-top:3px; font-size:0.775rem; color:var(--text-muted); font-weight:400; line-height:1.45; }

        .warn-box { background:rgba(255,215,0,0.07); border:1px solid rgba(255,215,0,0.2); padding:11px 14px; border-radius:14px; margin-top:14px; display:flex; align-items:center; gap:8px; }
        /* Star icon wrapper */
        .warn-star-wrap { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; overflow:hidden; flex-shrink:0; }
        .warn-box-star { width:126%; height:126%; display:block; object-fit:contain; }
        .warn-box-text { font-size:0.82rem; color:white; font-weight:500; line-height:1.4; }
        .btn-screenshots { display:flex; align-items:center; justify-content:center; gap:8px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1); color:rgba(255,255,255,0.7); border-radius:50px; padding:12px 20px; font-size:0.84rem; font-weight:600; cursor:pointer; transition:all 0.18s; width:100%; margin-top:14px; font-family:var(--font-body); }
        .btn-screenshots:hover { background:rgba(255,255,255,0.1); color:white; }
        .screenshot-gallery { display:none; flex-direction:column; gap:14px; margin-top:12px; animation:cardIn 0.25s ease both; }
        .screenshot-gallery.open { display:flex; }
        .screenshot-card { display:flex; flex-direction:column; gap:10px; background:linear-gradient(135deg,rgba(99,102,241,0.07),rgba(139,92,246,0.04)); border:1px solid rgba(99,102,241,0.22); border-radius:18px; padding:14px; overflow:hidden; }
        .screenshot-thumb { width:100%; border-radius:12px; overflow:hidden; border:1px solid rgba(99,102,241,0.2); order:2; }
        .screenshot-thumb img { width:100%; display:block; height:auto; }
        .screenshot-info { display:flex; flex-direction:column; gap:4px; order:1; padding-bottom:6px; }
        .screenshot-step-label { display:inline-flex; align-items:center; align-self:flex-start; background:linear-gradient(135deg,rgba(99,102,241,0.3),rgba(139,92,246,0.25)); border:1px solid rgba(99,102,241,0.45); border-radius:20px; padding:2px 10px; font-size:0.65rem; font-weight:800; color:#c4b5fd; text-transform:uppercase; letter-spacing:0.08em; margin-bottom:2px; }
        .screenshot-title { font-size:0.96rem; font-weight:800; color:white; font-family:var(--font-head); line-height:1.4; display:flex; align-items:center; flex-wrap:wrap; gap:3px; }
        .screenshot-desc { font-size:0.76rem; color:rgba(255,255,255,0.5); line-height:1.45; margin-top:1px; }

        /* ================= ОНБОРДИНГ (ЯЗЫК) ================= */
        #onboarding { 
            position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
            z-index: 1000; 
            background: rgba(6,6,15,0.96); 
            backdrop-filter: blur(30px);
            -webkit-backdrop-filter: blur(30px);
            display: flex; flex-direction: column; 
            padding: 44px 20px 24px; transition: opacity 0.35s; 
        }
        .onboarding-logo { text-align: center; margin-bottom: 28px; }
        .onboarding-logo-icon { 
            display: inline-flex; 
            background: rgba(99,102,241,0.15); 
            border: 1px solid rgba(99,102,241,0.3);
            border-radius: 20px; padding: 14px; 
            margin-bottom: 12px;
        }
        .onboarding-logo-icon svg { stroke: var(--accent); }
        .onboarding-title { font-size: 1.8rem; font-weight: 800; font-family: var(--font-head); }
        .onboarding-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

        .search-input { 
            width: 100%; padding: 14px 18px; 
            background: rgba(255,255,255,0.06); 
            border: 1px solid rgba(255,255,255,0.1); 
            border-radius: 16px; color: white; font-size: 0.95rem; 
            outline: none; transition: 0.2s; margin-bottom: 14px;
            font-family: var(--font-body);
            backdrop-filter: blur(20px);
        }
        .search-input:focus { border-color: rgba(99,102,241,0.5); background: rgba(255,255,255,0.08); }
        .search-input::placeholder { color: var(--text-muted); }
        
        .lang-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: none; }
        .lang-list::-webkit-scrollbar { display: none; }
        
        .lang-item { 
            padding: 14px 18px; 
            background: rgba(255,255,255,0.04); 
            border: 1px solid rgba(255,255,255,0.08); 
            border-radius: 16px; 
            display: flex; justify-content: space-between; align-items: center; 
            cursor: pointer; transition: all 0.15s; 
        }
        .lang-item:active { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.3); transform: scale(0.98); }
        .lang-native { font-size: 1rem; font-weight: 600; font-family: var(--font-head); }
        .lang-eng { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
        
        /* Звезда TG */
        .quasar-star { display: inline-block; vertical-align: middle; }

        /* Chats empty state */
        .empty-state { text-align: center; padding: 40px 20px; }
        .empty-icon { 
            width: 64px; height: 64px; 
            background: rgba(255,255,255,0.04); border-radius: 22px;
            display: flex; align-items: center; justify-content: center;
            margin: 0 auto 16px;
        }
        .empty-icon svg { width: 30px; height: 30px; stroke: var(--text-muted); fill: none; opacity: 0.5; stroke-width: 1.5; }
        .empty-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; font-family: var(--font-head); }
        .empty-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; line-height: 1.6; }

        /* Tab Headers */
        .tab-page-title { 
            font-size: 1.6rem; font-weight: 800; margin-bottom: 18px; 
            font-family: var(--font-head); letter-spacing: -0.02em;
            color: #ffffff;
            text-shadow: 0 2px 10px rgba(0,0,0,0.7), 0 1px 3px rgba(0,0,0,0.9);
        }

        /* Neo inc. label */
        .neo-inc-label { 
            font-size: 0.7rem; color: var(--text-muted); 
            margin-bottom: 12px; 
            text-transform: uppercase; font-weight: 700; letter-spacing: 1.2px; 
            padding-left: 4px;
            font-family: var(--font-head);
        }

        /* ================= ДОПОЛНИТЕЛЬНЫЕ АНИМАЦИИ ================= */
        /* Стаггер-вход карточек */
        #tab-profile.active .profile-user-card { animation: cardIn 0.3s ease both 0.03s; }
        #tab-profile.active .conn-status-card   { animation: cardIn 0.3s ease both 0.08s; }
        #tab-profile.active .menu-group         { animation: cardIn 0.3s ease both 0.13s; }
        #tab-profile.active .stats-grid         { animation: cardIn 0.3s ease both 0.2s; }

        #tab-settings.active .menu-group:nth-of-type(1) { animation: cardIn 0.3s ease both 0.05s; }
        #tab-settings.active .menu-group:nth-of-type(2) { animation: cardIn 0.3s ease both 0.12s; }
        #tab-settings.active .bottom-area       { animation: cardIn 0.3s ease both 0.18s; }

        #tab-chats.active .card                 { animation: cardIn 0.3s ease both 0.05s; }

        #tab-sub.active .sub-header-wrap        { animation: cardIn 0.3s ease both 0.02s; }
        #tab-sub.active .promo-info-banner      { animation: cardIn 0.3s ease both 0.06s; }
        #tab-sub.active .sub-status-card        { animation: cardIn 0.3s ease both 0.1s; }
        #tab-sub.active #promo-upgrade-block    { animation: cardIn 0.3s ease both 0.16s; }
        #tab-sub.active #neo-features-block     { animation: cardIn 0.3s ease both 0.16s; }
        #tab-sub.active #sub-inactive-view .card{ animation: cardIn 0.3s ease both 0.1s; }

        @keyframes cardIn {
            from { opacity: 0; transform: translateY(10px) scale(0.99); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }

        /* Пульс статус-точки */
        .status-on { background: var(--success); box-shadow: 0 0 10px var(--success); animation: dotPulse 2s ease-in-out infinite; }
        @keyframes dotPulse {
            0%, 100% { box-shadow: 0 0 6px var(--success); }
            50%       { box-shadow: 0 0 14px var(--success), 0 0 28px rgba(34,211,160,0.3); }
        }

        /* Hover карточек */
        .neo-feature-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
        .neo-feature-card:hover { transform: translateX(3px); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

        /* Subtle glow pulse on Neo/Promo badge — no white inset, clean */
        .neo-badge-wrap, .promo-badge-wrap { overflow: visible; position: relative; }
        .neo-badge-wrap {
            box-shadow: 0 0 10px rgba(255,215,0,0.12);
            animation: neoBadgeGlow 3.5s ease-in-out infinite;
        }
        .promo-badge-wrap {
            box-shadow: 0 0 10px rgba(56,189,248,0.12);
            animation: promoBadgeGlow 3.5s ease-in-out infinite 0.8s;
        }
        @keyframes neoBadgeGlow {
            0%, 100% { box-shadow: 0 0 6px rgba(255,215,0,0.08); }
            50%       { box-shadow: 0 0 16px rgba(255,215,0,0.22); }
        }
        @keyframes promoBadgeGlow {
            0%, 100% { box-shadow: 0 0 6px rgba(56,189,248,0.08); }
            50%       { box-shadow: 0 0 16px rgba(56,189,248,0.22); }
        }

        /* Animated gradient text on subscription header title */
        .sub-title-text {
            font-size: 2rem; font-weight: 800;
            font-family: var(--font-head); letter-spacing: -0.03em;
            background: linear-gradient(
                90deg,
                #e0e0f8 0%,
                #ffffff 35%,
                #c4b5fd 55%,
                #ffffff 75%,
                #e0e0f8 100%
            );
            background-size: 200% auto;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: titleShimmer 4s linear infinite;
        }
        @keyframes titleShimmer {
            0%   { background-position: 0%   center; }
            100% { background-position: 200% center; }
        }

        /* Hover кнопок меню */
        .menu-btn { transition: background 0.15s, padding-left 0.15s; }
        .menu-btn:hover { background: rgba(255,255,255,0.03); padding-left: 20px; }

        /* Hover stat-box */
        .stat-box { transition: transform 0.2s ease, box-shadow 0.2s ease; }
        .stat-box:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }

        /* Плавающая аватарка */
        .profile-avatar { animation: avatarFloat 5s ease-in-out infinite; }
        @keyframes avatarFloat {
            0%, 100% { transform: translateY(0); }
            50%       { transform: translateY(-3px); }
        }

        /* Promo info banner */
        .promo-info-banner {
            display: none;
            align-items: flex-start;
            gap: 12px;
            background: rgba(56,189,248,0.06);
            border: 1px solid rgba(56,189,248,0.22);
            border-radius: 18px;
            padding: 14px 16px;
            margin-bottom: 14px;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            animation: cardIn 0.3s ease both;
        }
        .promo-info-icon {
            width: 20px; height: 20px;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; margin-top: 1px;
        }
        .promo-info-title {
            font-size: 0.85rem; font-weight: 700;
            color: var(--promo-blue); margin-bottom: 3px;
        }
        .promo-info-desc {
            font-size: 0.78rem; color: rgba(255,255,255,0.5); line-height: 1.45;
        }

        /* Suppress card top-line inside promo upgrade block */
        #promo-upgrade-block .card::before { display: none; }
        /* Suppress badge shimmer inside upgrade card title - it conflicts with gold bg */
        .promo-upgrade-card .neo-badge-wrap::after { display: none; }

        /* ── Upgrade card (Promo → Neo) ── */
        .promo-upgrade-card {
            position: relative;
            border-radius: 14px;
            padding: 24px 16px 20px;
            text-align: center;
            overflow: hidden;
            margin-top: 0;
            /* Animated gradient background — position shift only, no transforms */
            background:
                linear-gradient(
                    115deg,
                    rgba(255,215,0,0.00) 0%,
                    rgba(255,200,60,0.13) 40%,
                    rgba(255,215,0,0.00) 80%
                ),
                linear-gradient(
                    160deg,
                    rgba(28, 20, 4, 0.97) 0%,
                    rgba(16, 11, 2, 0.99) 100%
                );
            background-size: 300% 100%, 100% 100%;
            animation: goldSlide 4s ease-in-out infinite;
            box-shadow:
                0 0 0 1px rgba(200, 155, 20, 0.2),
                inset 0 1px 0 rgba(255, 215, 0, 0.08),
                0 8px 28px rgba(0, 0, 0, 0.45);
        }
        @keyframes goldSlide {
            0%   { background-position: 0%   50%, 0% 0%; }
            50%  { background-position: 100% 50%, 0% 0%; }
            100% { background-position: 0%   50%, 0% 0%; }
        }
        /* ================= СТРАНИЦА ВОЗМОЖНОСТЕЙ ================= */
        .feat-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border-bright);
            border-radius: 22px;
            padding: 11px 11px 0;
            margin-bottom: 16px;
            backdrop-filter: blur(40px) saturate(160%) brightness(1.05);
            -webkit-backdrop-filter: blur(40px) saturate(160%) brightness(1.05);
            box-shadow: 0 1px 0 rgba(255,255,255,0.07) inset, 0 8px 32px rgba(0,0,0,0.3);
            overflow: hidden;
            position: relative;
        }
        .feat-card::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0; height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
        }
        .feat-card-head {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 10px;
        }
        .feat-icon-wrap {
            width: 40px; height: 40px;
            border-radius: 12px;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }
        .feat-icon-wrap svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        .feat-fi-blue  { background: rgba(56,189,248,0.18); color: #38bdf8; }
        .feat-fi-red   { background: rgba(244,63,94,0.18);  color: #f43f5e; }
        .feat-fi-purple{ background: rgba(191,90,242,0.18); color: #bf5af2; }
        .feat-fi-indigo{ background: rgba(99,102,241,0.18); color: #818cf8; }
        .feat-fi-teal  { background: rgba(34,211,160,0.18); color: #22d3a0; }
        .feat-fi-gold  { background: rgba(255,215,0,0.15);  color: #FFD700; }
        .feat-fi-rose  { background: rgba(251,113,133,0.18);color: #fb7185; }
        .feat-fi-muted { background: rgba(255,255,255,0.07);color: rgba(255,255,255,0.4); }
        .feat-card-title { font-size: 0.95rem; font-weight: 700; font-family: var(--font-head); color: var(--text-main); margin-bottom: 4px; line-height: 1.35; }
        .feat-card-desc  { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }
        .feat-card-desc.danger { color: rgba(244,63,94,0.85); }
        .feat-photos { display: flex; flex-direction: column; gap: 0; margin: 0 -11px; padding: 0 0 0; }
        .feat-photo  { width: 100%; display: block; border-top: 2px solid rgba(255,255,255,0.13); }
        .feat-photo:last-child { border-radius: 0 0 22px 22px; }
        .feat-photo img { width: 100%; display: block; height: auto; }
        .feat-card-nosub {
            display: flex; align-items: center; gap: 10px;
        }
        /* No-photo cards still need bottom padding */
        .feat-card.no-photo { padding-bottom: 11px; }
        .feat-support-link {
            color: var(--promo-blue);
            text-decoration: underline;
            text-underline-offset: 2px;
            font-weight: 600;
            cursor: pointer;
        }