/* ================================================================ */
/* ===== СТИЛИ ЭКРАНА РЕГИСТРАЦИИ/ГЛАВНОГО МЕНЮ (лендинг),          */
/* ===== все селекторы скоуплены под #landingRoot, чтобы не         */
/* ===== пересекаться со стилями чата ниже                          */
/* ================================================================ */
        :root {
            --accent: #c9b09b;
            --accent-hover: #b89a82;
            --accent-rgb: 201, 176, 155;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            margin: 0;
            padding: 20px 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #f5efe6;
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }

        #landingRoot .screen {
            display: none;
            width: 100%;
            justify-content: center;
            align-items: center;
        }

        #landingRoot .screen.active {
            display: flex;
        }

        /* ===== ЭКРАН 0: СПЛЭШ ===== */
        #landingRoot #splashScreen {
            position: fixed;
            inset: 0;
            width: 100%;
            height: 100%;
            background: #ffffff;
            z-index: 2000;
        }

        #landingRoot .splash-logo-wrap {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
        }

        #landingRoot .splash-logo {
            width: 220px;
            max-width: 60vw;
            height: auto;
            display: block;
            animation: splashPulse 1s ease-in-out infinite;
        }

        @keyframes splashPulse {
            0%   { transform: scale(1);    opacity: 1; }
            50%  { transform: scale(1.12); opacity: 0.85; }
            100% { transform: scale(1);    opacity: 1; }
        }

        /* ===== ВЫБОР ЯЗЫКА (кастомный дропдаун) ===== */
        #landingRoot .lang-dropdown {
            position: relative;
            width: 100%;
            margin-bottom: 16px;
        }

        #landingRoot .lang-dropdown-toggle {
            background: #fcf9f5;
            border: 2px solid #f0e4d8;
            border-radius: 14px;
            padding: 10px 16px;
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
            cursor: pointer;
            outline: none;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            transition: border-color 0.2s;
        }

        .lang-dropdown-toggle:hover,
        #landingRoot .lang-dropdown.open .lang-dropdown-toggle {
            border-color: var(--accent);
        }

        #landingRoot .lang-flag {
            font-size: 16px;
        }

        #landingRoot .lang-arrow {
            margin-left: auto;
            font-size: 11px;
            color: #b8a898;
            transition: transform 0.2s;
        }

        #landingRoot .lang-dropdown.open .lang-arrow {
            transform: rotate(180deg);
        }

        #landingRoot .lang-dropdown-list {
            display: none;
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            right: 0;
            max-height: 260px;
            overflow-y: auto;
            background: #ffffff;
            border: 2px solid #f0e4d8;
            border-radius: 14px;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
            z-index: 50;
        }

        #landingRoot .lang-dropdown.open .lang-dropdown-list {
            display: block;
        }

        #landingRoot .lang-option {
            padding: 10px 16px;
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: background 0.15s;
        }

        #landingRoot .lang-option:hover {
            background: #fcf9f5;
        }

        /* ===== ЭКРАН 1: АВТОРИЗАЦИЯ ===== */
        #landingRoot .card-container {
            background: #ffffff;
            width: 90%;
            max-width: 380px;
            padding: 25px 20px;
            border-radius: 28px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            align-items: center;
            border: 2px solid #f0e4d8;
        }

        /* ===== ВЫБОР ЯЗЫКА ===== */
        #landingRoot .lang-select {
            background: #fcf9f5;
            border: 2px solid #f0e4d8;
            border-radius: 14px;
            padding: 10px 16px;
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
            cursor: pointer;
            outline: none;
            margin-bottom: 16px;
            text-align: center;
            width: 100%;
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            transition: border-color 0.2s;
        }

        #landingRoot .lang-select:focus {
            border-color: var(--accent);
        }

        #landingRoot .inner-box {
            width: 100%;
            border: 1px solid #f0e4d8;
            border-radius: 22px;
            padding: 25px 15px;
            display: flex;
            flex-direction: column;
            align-items: center;
            background: #ffffff;
        }

        #landingRoot .image-container {
            width: 100%;
            border-radius: 16px;
            overflow: hidden;
            border: 2px solid #f0e4d8;
            margin-bottom: 16px;
        }

        #landingRoot .image-container img {
            width: 100%;
            height: auto;
            display: block;
        }

        #landingRoot .logo-mini {
            width: 70px;
            height: 70px;
            border-radius: 16px;
            object-fit: cover;
            margin-bottom: 6px;
            display: block;
        }

        #landingRoot .cta-btn {
            background: var(--accent);
            color: #ffffff;
            border: none;
            border-radius: 25px;
            padding: 12px 28px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.4);
            transition: all 0.25s ease;
            user-select: none;
            width: 100%;
        }

        #landingRoot .cta-btn:hover {
            background: var(--accent-hover);
            transform: scale(1.02);
        }

        #landingRoot .auth-panel {
            display: none;
            width: 100%;
            margin-top: 20px;
            flex-direction: column;
            gap: 12px;
            animation: fadeIn 0.3s ease-in-out;
        }

        #landingRoot .auth-panel.active {
            display: flex;
        }

        #landingRoot .input-field {
            width: 100%;
            padding: 12px 16px;
            border: 1.5px solid #e2e8f0;
            border-radius: 12px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
            background: #fcf9f5;
        }

        #landingRoot .input-field:focus {
            border-color: var(--accent);
        }

        #landingRoot .rules-checkbox {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            color: #555;
            cursor: pointer;
            margin: 4px 0;
        }

        #landingRoot .rules-checkbox a {
            color: var(--accent);
            text-decoration: none;
            cursor: pointer;
        }

        #landingRoot .rules-checkbox a:hover {
            text-decoration: underline;
        }

        #landingRoot .btn-group {
            display: flex;
            gap: 10px;
            width: 100%;
        }

        #landingRoot .btn-action {
            flex: 1;
            padding: 12px 8px;
            border: none;
            border-radius: 12px;
            font-weight: 700;
            font-size: 13px;
            cursor: pointer;
            color: white;
            transition: all 0.25s ease;
            background: var(--accent);
            box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
        }

        #landingRoot .btn-action:hover {
            background: var(--accent-hover);
            transform: scale(1.02);
        }

        #landingRoot .btn-login {
            background: var(--accent);
        }

        #landingRoot .btn-register {
            background: var(--accent);
        }

        #landingRoot .forgot-password-link {
            text-align: center;
            font-size: 13px;
            color: #a89484;
            text-decoration: underline;
            cursor: pointer;
            margin-top: 10px;
        }

        #landingRoot .forgot-password-link:hover {
            color: var(--accent);
        }

        #landingRoot .biometric-login-link {
            text-align: center;
            font-size: 13px;
            font-weight: 700;
            color: var(--accent);
            cursor: pointer;
            margin-top: 12px;
            padding: 10px;
            border-radius: 14px;
            background: rgba(var(--accent-rgb), 0.12);
        }

        #landingRoot .biometric-login-link:hover {
            background: rgba(var(--accent-rgb), 0.22);
        }

        #landingRoot .success-message {
            display: none;
            color: #2ed573;
            font-size: 13px;
            font-weight: 700;
            text-align: center;
            margin-top: 8px;
            line-height: 1.4;
            animation: fadeIn 0.3s ease-in-out;
        }

        #landingRoot .success-message.active {
            display: block;
        }

        #landingRoot .logout-btn-bottom {
            margin-top: 20px;
            margin-bottom: 0;
        }

        #landingRoot .color-picker-title {
            color: #3d2a1a;
            font-size: 15px;
            font-weight: 700;
            text-align: center;
            margin-bottom: 12px;
        }

        #landingRoot .color-circles {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 14px;
            margin-bottom: 25px;
            flex-wrap: wrap;
        }

        #landingRoot .color-circle {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            cursor: pointer;
            border: 3px solid #ffffff;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
            transition: all 0.25s ease;
        }

        #landingRoot .color-circle:hover {
            transform: scale(1.15);
        }

        #landingRoot .color-circle.selected {
            border-color: #3d2a1a;
            transform: scale(1.2);
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
        }

        /* ===== ЭКРАН 2: ГЛАВНОЕ МЕНЮ ===== */
        #landingRoot .main-container {
            width: 90%;
            max-width: 420px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        #landingRoot .logout-btn {
            background: var(--accent);
            color: white;
            border: none;
            padding: 10px 24px;
            border-radius: 20px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
            transition: transform 0.2s;
            margin-bottom: 20px;
        }

        #landingRoot .logout-btn:hover {
            transform: scale(1.05);
            background: var(--accent-hover);
        }

        #landingRoot .page-title {
            color: #3d2a1a;
            font-size: 20px;
            font-weight: 800;
            text-align: center;
            margin-bottom: 25px;
            white-space: pre-line;
        }

        #landingRoot .grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            width: 100%;
            margin-bottom: 15px;
        }

        #landingRoot .card {
            background: #ffffff;
            border-radius: 24px;
            padding: 20px 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
            transition: all 0.25s ease;
            border: 2px solid #f0e4d8;
            min-height: 130px;
            justify-content: center;
        }

        #landingRoot .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
            border-color: var(--accent);
            background: #ffffff;
        }

        #landingRoot .card:active {
            transform: scale(0.96);
        }

        #landingRoot .card-emoji {
            font-size: 28px;
        }

        #landingRoot .card-title {
            font-size: 15px;
            font-weight: 800;
            color: #2c3e50;
            margin-bottom: 2px;
        }

        #landingRoot .card-sub {
            font-size: 12px;
            color: #b8a898;
        }

        #landingRoot .card-wide {
            background: #ffffff;
            border-radius: 24px;
            padding: 16px 20px;
            width: 100%;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
            transition: all 0.25s ease;
            border: 2px solid #f0e4d8;
        }

        #landingRoot .card-wide:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
            border-color: var(--accent);
            background: #ffffff;
        }

        #landingRoot .card-wide .card-title {
            margin: 0;
            font-size: 14px;
            text-align: left;
        }

        #landingRoot .card-wide .logo-mini {
            width: 60px;
            height: 60px;
        }

        #landingRoot .card-wide-compact {
            width: 50%;
            margin-left: auto;
            margin-right: auto;
            padding: 10px 16px;
            border-radius: 18px;
            margin-bottom: 4px;
            justify-content: center;
        }

        #landingRoot .card-wide-compact .card-title {
            font-size: 13px;
            font-weight: 700;
        }

        /* ===== ВСПЛЫВАЮЩЕЕ ОКНО ===== */
        #landingRoot .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(5px);
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
            z-index: 1000;
        }

        #landingRoot .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        #landingRoot .modal-box {
            background: #ffffff;
            padding: 30px 25px;
            border-radius: 28px;
            text-align: center;
            max-width: 300px;
            width: 80%;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
            transform: scale(0.8);
            transition: transform 0.3s ease;
        }

        #landingRoot .modal-overlay.active .modal-box {
            transform: scale(1);
        }

        #landingRoot .modal-emoji {
            font-size: 55px;
            margin-bottom: 10px;
            display: block;
        }

        #landingRoot .modal-title {
            font-size: 20px;
            font-weight: 800;
            color: #2c3e50;
            margin-bottom: 8px;
        }

        #landingRoot .modal-badge {
            display: inline-block;
            background: #ffeaa7;
            color: #d63031;
            font-size: 13px;
            font-weight: 700;
            padding: 6px 16px;
            border-radius: 20px;
            margin-bottom: 20px;
        }

        #landingRoot .modal-close-btn {
            background: var(--accent);
            color: white;
            border: none;
            padding: 10px 25px;
            border-radius: 16px;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
            transition: all 0.25s;
        }

        #landingRoot .modal-close-btn:hover {
            background: var(--accent-hover);
        }

        /* ===== СТРАНИЦА ПРАВИЛ (внутри) ===== */
        #landingRoot .privacy-screen {
            display: none;
            width: 100%;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        #landingRoot .privacy-screen.active {
            display: flex;
        }

        #landingRoot .privacy-container {
            background: #ffffff;
            padding: 40px;
            border-radius: 28px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
            border: 2px solid #f0e4d8;
            width: 100%;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
        }

        #landingRoot .privacy-container .logo-small {
            width: 60px;
            height: auto;
            display: block;
            margin: 0 auto 16px;
        }

        #landingRoot .privacy-container h1 {
            color: #3d2a1a;
            border-bottom: 3px solid var(--accent);
            padding-bottom: 14px;
            font-size: 26px;
            text-align: center;
        }

        #landingRoot .privacy-container h2 {
            color: #5a4a3a;
            margin-top: 28px;
            margin-bottom: 12px;
            font-size: 18px;
            border-left: 4px solid var(--accent);
            padding-left: 12px;
        }

        #landingRoot .privacy-container .section {
            margin: 16px 0;
            padding: 16px 20px;
            background: #fcf9f5;
            border-radius: 16px;
            border: 1px solid #f0e4d8;
        }

        #landingRoot .privacy-container .item {
            margin: 8px 0;
            padding-left: 8px;
            font-size: 15px;
            color: #3d2a1a;
        }

        #landingRoot .privacy-container .good {
            color: #2d7d46;
            font-weight: 600;
        }

        #landingRoot .privacy-container .bad {
            color: #b33c3c;
            font-weight: 600;
        }

        #landingRoot .privacy-container .section p {
            color: #5a4a3a;
            font-size: 15px;
            line-height: 1.6;
            margin: 6px 0;
        }

        #landingRoot .privacy-container .footer {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 2px solid #f0e4d8;
            color: #b8a898;
            font-size: 14px;
            text-align: center;
        }

        #landingRoot .privacy-container .footer strong {
            color: #5a4a3a;
        }

        #landingRoot .privacy-container .btn-back {
            display: inline-block;
            margin-top: 24px;
            padding: 14px 32px;
            background: var(--accent);
            color: white;
            text-decoration: none;
            border-radius: 16px;
            font-weight: 700;
            font-size: 15px;
            transition: all 0.25s ease;
            text-align: center;
            width: 100%;
            border: none;
            cursor: pointer;
        }

        #landingRoot .privacy-container .btn-back:hover {
            background: var(--accent-hover);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.3);
        }

        /* ===== ИНСТРУКЦИЯ: вступление, подсказка, сворачиваемые разделы ===== */
        #landingRoot .privacy-container .instr-intro {
            background: #fff4e0;
            border: 2px solid #ffdd9e;
            border-radius: 16px;
            padding: 14px 18px;
            font-size: 14px;
            line-height: 1.6;
            color: #7a5a2a;
            margin-bottom: 8px;
        }

        #landingRoot .privacy-container .instr-hint {
            text-align: center;
            font-size: 12px;
            color: #b8a898;
            margin: 10px 0 4px;
        }

        #landingRoot .privacy-container .instr-divider {
            display: block;
            width: fit-content;
            margin: 20px auto 10px;
            padding: 6px 18px;
            background: #fff4e0;
            border: 2px solid #ffdd9e;
            border-radius: 20px;
            font-size: 13px;
            font-weight: 700;
            color: #b45309;
            text-align: center;
        }

        #landingRoot .privacy-container .instr-section h2 {
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
            margin-top: 0;
            user-select: none;
        }

        #landingRoot .privacy-container .instr-chevron {
            transition: transform 0.25s ease;
            font-size: 14px;
            flex-shrink: 0;
            margin-left: 8px;
        }

        #landingRoot .privacy-container .instr-section.open .instr-chevron {
            transform: rotate(180deg);
        }

        #landingRoot .privacy-container .instr-body {
            display: none;
            padding-top: 8px;
        }

        #landingRoot .privacy-container .instr-section.open .instr-body {
            display: block;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @media (max-width: 600px) {
            #landingRoot .privacy-container {
                padding: 24px 16px;
            }
            #landingRoot .privacy-container h1 {
                font-size: 20px;
            }
            #landingRoot .privacy-container .section {
                padding: 12px 14px;
            }
            #landingRoot .privacy-container .item {
                font-size: 14px;
            }
            #landingRoot .logo-mini {
                width: 55px;
                height: 55px;
            }
            #landingRoot .card-wide .logo-mini {
                width: 48px;
                height: 48px;
            }
        }

/* ================================================================ */
/* ===== СТИЛИ ЧАТА (страницы приветствия/контактов/переписки,      */
/* ===== звонки и т.д.)                                              */
/* ================================================================ */
/* ============================================================ */
        /* ===== ВСЕ СТИЛИ ИЗ ПЕРВОЙ ВЕРСИИ ===== */
        /* ============================================================ */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        button {
            font-family: 'Quicksand', sans-serif;
        }

        body {
            font-family: 'Nunito', 'Segoe UI', sans-serif;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 16px;
            background: linear-gradient(135deg, #fef9f0 0%, #ffe8d6 100%);
            transition: background 0.5s ease;
        }

        .container {
            max-width: 420px;
            width: 100%;
        }

        .page {
            display: none;
            animation: slideUp 0.4s ease;
        }

        .page.active {
            display: block;
        }

        @keyframes slideUp {
            0% { opacity: 0; transform: translateY(20px); }
            100% { opacity: 1; transform: translateY(0); }
        }

        /* ============================================================ */
        /* ===== ОБЩИЕ СТИЛИ ===== */
        /* ============================================================ */
        .box {
            background: #ffffff;
            border-radius: 40px;
            padding: 32px 24px 30px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10), 0 0 0 2px #ffdbb5 inset;
            transition: all 0.5s ease;
        }

        .header-row {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 2px solid #f5ede4;
            transition: border-color 0.5s ease;
        }

        .header-row .back-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 215, 180, 0.4);
            font-size: 20px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid rgba(255, 215, 180, 0.3);
            color: #3d2a1a;
            flex-shrink: 0;
        }

        .header-row .back-btn:hover {
            background: rgba(255, 215, 180, 0.7);
            transform: scale(0.95);
        }

        .header-row .title {
            font-size: 20px;
            font-weight: 700;
            color: #3d2a1a;
            flex: 1;
            transition: color 0.5s ease;
        }

        .header-row .action-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 215, 180, 0.3);
            color: #3d2a1a;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .header-row .action-btn:hover {
            background: rgba(255, 215, 180, 0.6);
            transform: scale(1.05);
        }

        .input-field {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e8ddd0;
            border-radius: 16px;
            font-size: 15px;
            outline: none;
            background: #fcf7f0;
            font-family: inherit;
            color: #3d2a1a;
            transition: all 0.3s;
        }

        .input-field:focus {
            border-color: #ffb07c;
            box-shadow: 0 0 0 4px rgba(255, 176, 124, 0.15);
            background: #ffffff;
        }

        .input-field::placeholder {
            color: #b8a898;
        }

        /* ============================================================ */
/* ===== СТРАНИЦА 1: ВХОД ===== */
/* ============================================================ */
.login-box {
    background: #ffffff;
    border-radius: 40px;
    padding: 48px 32px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10), 0 0 0 2px #ffdbb5 inset;
    text-align: center;
    transition: all 0.5s ease;
}

.logo-emoji {
    display: block;
    width: 140px;
    height: auto;
    margin: 0 auto 6px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo-title {
    font-family: 'Comfortaa', cursive;
    font-size: 28px;
    font-weight: 800;
    color: #3d2a1a;
    letter-spacing: -0.5px;
}

.logo-title span {
    background: linear-gradient(135deg, #ff8a5c, #ffb07c);
    padding: 0 8px;
    border-radius: 12px;
    color: #fff;
}

.logo-sub {
    font-size: 14px;
    color: #b28a6a;
    margin-top: 4px;
    font-weight: 500;
}

.greeting {
    font-family: 'Comfortaa', cursive;
    font-size: 20px;
    font-weight: 700;
    color: #3d2a1a;
    margin-bottom: 6px;
    margin-top: 16px;
}

.greeting-sub {
    font-size: 14px;
    color: #8a7a6a;
    margin-bottom: 28px;
}

/* ============================================================ */
/* ===== НОВЫЕ СТИЛИ ДЛЯ ПОЛЯ ВВОДА ===== */
/* ============================================================ */
.input-group {
    margin-bottom: 32px;
    text-align: left;
}

.input-label {
    font-size: 13px;
    font-weight: 600;
    color: #6a5a4a;
    display: block;
    margin-bottom: 8px;
    padding-left: 4px;
}

.input-field {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid #e8ddd0;
    border-radius: 18px;
    font-size: 17px;
    outline: none;
    background: #fcf7f0;
    font-family: inherit;
    color: #3d2a1a;
    transition: all 0.3s;
}

.input-field:focus {
    border-color: #ffb07c;
    box-shadow: 0 0 0 4px rgba(255, 176, 124, 0.15);
    background: #ffffff;
}

.input-field::placeholder {
    color: #b8a898;
}

.btn-enter {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #ff8a5c, #ffb07c);
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Quicksand', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(255, 138, 92, 0.3);
}

.btn-enter:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(255, 138, 92, 0.4);
}

.btn-enter:active {
    transform: scale(0.97);
}

.btn-enter:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.footer-text {
    margin-top: 20px;
    font-size: 13px;
    color: #8a7a6a;
}

.footer-text a {
    color: #ff8a5c;
    text-decoration: none;
    font-weight: 600;
}

/* ===== ВКЛАДКИ ВХОД / РЕГИСТРАЦИЯ ===== */
.auth-tabs {
    display: flex;
    gap: 8px;
    width: 100%;
    background: #fff5e8;
    border-radius: 16px;
    padding: 4px;
    margin: 20px 0 18px;
}

.auth-tab {
    flex: 1;
    padding: 11px 0;
    border: none;
    border-radius: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: #b28a6a;
    transition: all 0.25s ease;
}

.auth-tab.active {
    background: #ffffff;
    color: #ff8a5c;
    box-shadow: 0 4px 14px rgba(255, 138, 92, 0.2);
}

.auth-form {
    display: none;
    flex-direction: column;
    width: 100%;
}

.auth-form.active {
    display: flex;
}

.auth-message {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: none;
    text-align: center;
}

.auth-message.error {
    display: block;
    background: #fdf0ec;
    color: #c0503f;
}

.auth-message.success {
    display: block;
    background: #eaf7ec;
    color: #3f8a52;
}

body.dark .auth-tabs {
    background: rgba(60, 42, 74, 0.5);
}

body.dark .auth-tab {
    color: #a89898;
}

body.dark .auth-tab.active {
    background: #2a1f2a;
    color: #ff8a5c;
}

body.dark .auth-message.error {
    background: rgba(192, 80, 63, 0.2);
    color: #ff8a7a;
}

body.dark .auth-message.success {
    background: rgba(63, 138, 82, 0.2);
    color: #7ad68f;
}

/* ============================================================ */
/* ===== СТРАНИЦА 2: ПРИВЕТСТВИЕ ===== */
/* ============================================================ */
.welcome-box {
    background: #ffffff;
    border-radius: 40px;
    padding: 48px 32px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10), 0 0 0 2px #ffdbb5 inset;
    text-align: center;
    transition: all 0.5s ease;
}


.greeting-text {
    font-size: 24px;
    font-weight: 800;
    color: #3d2a1a;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    animation: greetingPulse 1.8s ease-in-out infinite;
}

@keyframes greetingPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}



.username-display {
    font-size: 20px;
    font-weight: 700;
    color: #5a4632;
    margin-bottom: 20px;
}

.username-display .emoji {
    font-size: 20px;
}

.username-display #userNameDisplay {
    color: #d9733a;
    font-weight: 800;
}

.datetime {
    font-size: 13px;
    font-weight: 600;
    color: #b45309;
    margin-bottom: 32px;
    padding: 10px 18px;
    background: #fff4e0;
    border: 2px solid #ffdd9e;
    border-radius: 20px;
    display: inline-block;
    text-align: center;
    line-height: 1.5;
}

.connection-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

/* Столбики сигнала вместо плоской точки — узнаваемый паттерн
   (как индикатор Wi-Fi/сотовой связи на телефоне): количество и цвет
   закрашенных столбиков сразу показывают уровень связи на глаз,
   не только текст рядом. */
.connection-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 11px;
    flex-shrink: 0;
}

.connection-bar {
    width: 3px;
    border-radius: 1px;
    background: #e0d6c8;
}

.connection-bar:nth-child(1) { height: 4px; }
.connection-bar:nth-child(2) { height: 6px; }
.connection-bar:nth-child(3) { height: 8px; }
.connection-bar:nth-child(4) { height: 11px; }

.connection-bars.connection-excellent .connection-bar { background: #4caf50; }
.connection-bars.connection-good .connection-bar:nth-child(-n+3) { background: #8bc34a; }
.connection-bars.connection-fair .connection-bar:nth-child(-n+2) { background: #ffb300; }
.connection-bars.connection-poor .connection-bar:nth-child(1) { background: #ff5252; }
.connection-bars.connection-offline .connection-bar { background: #d8cdbe; }

body.dark .connection-bar { background: #4a3f36; }
body.dark .connection-bars.connection-offline .connection-bar { background: #4a3f36; }

.datetime .net-warning-line {
    display: block;
    margin-top: 4px;
}

.welcome-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.btn {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 18px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Quicksand', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f5ebe0;
    color: #5a4632;
}

.btn:active {
    transform: scale(0.97);
}

.btn-contacts:hover,
.btn-settings:hover {
    background: #efe0cf;
    transform: translateY(-2px);
}

.btn-exit {
    padding: 10px;
    background: none;
    border: 2px solid #e8ddd0;
    border-radius: 14px;
    font-size: 14px;
    color: #8a7a6a;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    width: 100%;
}

.btn-exit:hover {
    background: #f5ede4;
    border-color: #ff8a5c;
    color: #ff8a5c;
}

/* ============================================================ */
/* ===== СТРАНИЦА 3: КОНТАКТЫ ===== */
/* ============================================================ */
.contacts-box {
    background: #ffffff;
    border-radius: 40px;
    padding: 14px 20px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10), 0 0 0 2px #ffdbb5 inset;
    transition: all 0.5s ease;
    min-height: 480px;
}

/* Список контактов — своя прокрутка, как у сообщений в чате, чтобы при
   большом количестве контактов шапка и поля поиска оставались на месте,
   а листался только сам список. */
#contactsList {
    max-height: 420px;
    overflow-y: auto;
}

#contactsList::-webkit-scrollbar {
    width: 4px;
}

#contactsList::-webkit-scrollbar-thumb {
    background: #ffdbb5;
    border-radius: 4px;
}

/* Настройки, открытые со страницы контактов (без активного чата) —
   пункты, требующие собеседника (звонок, отправка файла в чат и т.д.),
   тут не имеют смысла и скрываются. */
.contacts-box .chat-settings-item.needs-contact {
    display: none;
}

#pageContacts {
    position: relative;
}

.phone-search-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0px;
    /* align-items: center — иначе по умолчанию flex растягивает поле ввода
       (align-items: stretch) по высоте кнопки-соседа (48px), и уменьшение
       padding у самого поля ни на что не влияет: реальная причина высоты
       была не в padding, а в этом. */
}

.phone-search-row .input-field {
    flex: 1 1 auto;
    max-width: 290px;
    margin-bottom: 0;
    /* Только у этих двух полей (не у всех .input-field в приложении) —
       по умолчанию padding: 16px 18px даёт полю высоту заметно больше,
       чем нужно тексту (16px). Оставляем небольшой зазор вокруг букв. */
    padding-top: 5px;
    padding-bottom: 5px;
}

.phone-import-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 16px;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}


.phone-import-btn:hover {
    background: rgba(255, 215, 180, 0.3);
    transform: scale(1.05);
}

.news-btn-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.news-read-label {
    font-size: 12px;
    font-weight: 700;
    color: #22c55e;
    white-space: nowrap;
}

.phone-import-btn.has-news {
    background: rgba(34, 197, 94, 0.18);
}

.phone-import-btn.has-news:hover {
    background: rgba(34, 197, 94, 0.3);
}

.phone-import-btn.busy {
    opacity: 0.6;
    pointer-events: none;
}

.phone-search-result {
    margin-bottom: 4px;
}

.phone-search-result:empty {
    display: none;
}

.phone-search-result .contact-item {
    border: 2px dashed var(--accent, #ffb37a);
}

.header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0px;
    padding-bottom: 4px;
    border-bottom: 2px solid #f5ede4;
    transition: border-color 0.5s ease;
}

.header-row .back-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 215, 180, 0.4);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 215, 180, 0.3);
    color: #3d2a1a;
    flex-shrink: 0;
    padding: 0;
}

.header-row .back-btn:hover {
    background: rgba(255, 215, 180, 0.7);
    transform: scale(0.95);
}

.header-row .title {
    font-size: 20px;
    font-weight: 700;
    color: #3d2a1a;
    flex: 1;
    transition: color 0.5s ease;
}

.header-row .action-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 215, 180, 0.3);
    color: #3d2a1a;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-row .action-btn:hover {
    background: rgba(255, 215, 180, 0.6);
    transform: scale(1.05);
}

/* ===== КОНТАКТЫ ===== */
.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.contact-item:hover {
    background: #fcf7f0;
    border-color: #f5ede4;
}

.contact-item:active {
    transform: scale(0.98);
}

.contact-delete-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 68, 68, 0.12);
    color: #ff4444;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.contact-delete-btn:hover {
    background: rgba(255, 68, 68, 0.25);
    transform: scale(1.08);
}

body.dark .contact-delete-btn {
    background: rgba(192, 80, 63, 0.2);
    color: #ff8a7a;
}

.contact-favorite-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #d0c0a8;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.contact-favorite-btn:hover {
    background: rgba(255, 193, 7, 0.15);
    transform: scale(1.08);
}

.contact-favorite-btn.active {
    color: #ffb300;
}

body.dark .contact-favorite-btn {
    color: #6a5a48;
}

body.dark .contact-favorite-btn.active {
    color: #ffcb52;
}

.contacts-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #b8a898;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 6px 6px;
}

.contacts-section-label:first-child {
    padding-top: 2px;
}

.contact-avatar.group-avatar {
    background: linear-gradient(135deg, #ba68c8, #8e5ca6);
}

body.dark .contacts-section-label {
    color: #7a6a8a;
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    background: #4fc3f7;
    overflow: hidden;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.contact-avatar.me {
    background: #ffb07c;
}

.contact-avatar.found-by-phone {
    background: #a58cff;
}

.contact-avatar.color1 { background: #4fc3f7; }
.contact-avatar.color2 { background: #81c784; }
.contact-avatar.color3 { background: #ff8a65; }
.contact-avatar.color4 { background: #f8bbd0; color: #3d2a1a; }
.contact-avatar.color5 { background: #ffd54f; color: #3d2a1a; }
.contact-avatar.color6 { background: #26c6da; }

.my-avatar-wrap {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 4px auto 10px;
    cursor: pointer;
}

.my-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffb07c, #ff8a5c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 800;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(255, 138, 92, 0.35);
}

.my-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Камера (сменить фото) и корзина (удалить фото) — раньше камера сидела
   поверх аватарки отдельным бейджем, а у корзины вообще не было стилей
   (падала как мелкий неоформленный текст). Теперь обе рядом, одной парой. */
.my-avatar-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.avatar-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #faf3ea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

.avatar-action-btn:hover {
    transform: scale(1.1);
}

body.dark .avatar-action-btn {
    background: #2a1f2a;
    border-color: #1f1620;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    color: #3d2a1a;
    transition: color 0.5s ease;
}

.contact-name .you-label {
    font-size: 12px;
    font-weight: 400;
    color: #8a7a6a;
    background: #f5ede4;
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 8px;
}

.contact-status {
    font-size: 12px;
    color: #8a7a6a;
}

.contact-status.online {
    color: #4caf50;
}

.contact-custom-status {
    font-size: 12px;
    color: #ff8a5c;
    margin-top: 1px;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-last-message {
    font-size: 12px;
    color: #a89484;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-unread-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ff8a5c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #b45309;
    background: #fff4e0;
    border: 1px solid #ffdd9e;
    border-radius: 8px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.contact-item.blocked {
    opacity: 0.55;
}

.contact-status.offline {
    color: #bdbdbd;
}

.contact-delete {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.2s;
    padding: 4px;
}

.contact-delete:hover {
    opacity: 1;
    transform: scale(1.2);
}

.add-contact-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed #f5ede4;
    transition: border-color 0.5s ease;
}

.add-contact-row .input-field {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
}

.add-contact-row .btn-add {
    padding: 12px 18px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #81c784, #388e3c);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Quicksand', sans-serif;
    white-space: nowrap;
}

.add-contact-row .btn-add:hover {
    transform: scale(1.05);
}

.empty-contacts {
    text-align: center;
    padding: 40px 20px;
    color: #b8a898;
}

.empty-contacts .emoji {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.empty-contacts .text {
    font-size: 16px;
}

        /* ============================================================ */
        /* ===== СТРАНИЦА 4: КОМНАТА ЧАТА ===== */
        /* ============================================================ */
        .chat-box {
            background: #ffffff;
            border-radius: 40px;
            padding: 20px 20px 24px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10), 0 0 0 2px #ffdbb5 inset;
            transition: all 0.5s ease;
            min-height: 500px;
            display: flex;
            flex-direction: column;
            position: relative;
        }

        .video-msg-preview {
            display: none;
            position: absolute;
            top: 66px;
            right: 28px;
            width: 100px;
            height: 140px;
            object-fit: cover;
            border-radius: 18px;
            border: 3px solid #ff8a5c;
            background: #000;
            z-index: 50;
            box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
        }

        .video-msg-preview.active {
            display: block;
        }

        .chat-header {
            display: flex;
            align-items: center;
            gap: 8px;
            padding-bottom: 12px;
            border-bottom: 2px solid #f5ede4;
            transition: border-color 0.5s ease;
            position: relative;
            z-index: 2;
            background: #fff;
        }

        .chat-header .back-btn {
            width: 36px;
            height: 36px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 215, 180, 0.4);
            font-size: 18px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid rgba(255, 215, 180, 0.3);
            color: #3d2a1a;
            flex-shrink: 0;
        }

        .chat-header .back-btn:hover {
            background: rgba(255, 215, 180, 0.7);
            transform: scale(0.95);
        }

        .chat-header .chat-contact-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .chat-header .chat-contact-name {
            font-size: 17px;
            font-weight: 700;
            color: #3d2a1a;
            transition: color 0.5s ease;
        }

        .chat-header .chat-contact-status {
            font-size: 12px;
            font-weight: 500;
            color: #b8a898;
            margin-top: 1px;
        }

        .chat-header .chat-contact-status.online {
            color: #4caf50;
        }

        .chat-header .chat-contact-status.typing {
            color: #ff8a5c;
            font-style: italic;
        }

        .chat-header .chat-action-btn {
            width: 36px;
            height: 36px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: #3d2a1a;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chat-header .chat-action-btn:hover {
            background: rgba(255, 215, 180, 0.3);
            transform: scale(1.05);
        }

        .chat-header .chat-action-btn.active {
            background: #ff8a5c;
            color: #fff;
        }

        .chat-header .chat-action-btn.holding {
            background: #ff4444 !important;
            color: #fff;
            transform: scale(1.15);
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            max-height: 380px;
            padding: 12px 4px;
            margin: 8px 0 12px 0;
        }

        .chat-messages::-webkit-scrollbar {
            width: 4px;
        }

        .chat-messages::-webkit-scrollbar-thumb {
            background: #dcc8b8;
            border-radius: 10px;
        }

        .message {
            margin-bottom: 10px;
            padding: 10px 14px;
            border-radius: 16px;
            max-width: 85%;
            word-wrap: break-word;
            animation: messageIn 0.3s ease;
            position: relative;
            transition: all 0.3s;
        }

        @keyframes messageIn {
            0% { opacity: 0; transform: translateY(10px); }
            100% { opacity: 1; transform: translateY(0); }
        }

        .message.mine {
            background: linear-gradient(135deg, #ffb07c, #ff8a5c);
            color: #fff;
            margin-left: auto;
            border-bottom-right-radius: 4px;
        }

        .message.theirs {
            background: #f5ede4;
            color: #3d2a1a;
            margin-right: auto;
            border-bottom-left-radius: 4px;
        }

        .message.pending-message {
            opacity: 0.7;
        }

        .msg-pending-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-top: 6px;
            padding-top: 6px;
            border-top: 1px solid rgba(255, 255, 255, 0.35);
        }

        .msg-pending-timer {
            font-size: 11px;
            opacity: 0.9;
            white-space: nowrap;
        }

                .message .msg-text {
            font-size: 15px;
        }

        body.font-small .message .msg-text,
        body.font-small .chat-contact-name {
            font-size: 13px;
        }

        body.font-large .message .msg-text,
        body.font-large .chat-contact-name {
            font-size: 18px;
        }

        body.font-xlarge .message .msg-text,
        body.font-xlarge .chat-contact-name {
            font-size: 21px;
        }

        /* ===== СТИЛИ ДЛЯ ФОТО ===== */
        .message .msg-photo {
            max-width: 200px;
            max-height: 200px;
            width: auto;
            height: auto;
            border-radius: 12px;
            margin-top: 4px;
            display: block;
            cursor: pointer;
            transition: all 0.3s;
            object-fit: cover;
        }

        /* Бежевый пузырёк вокруг голосового сообщения — компактнее, чем
           обычные текстовые сообщения (там не нужно столько воздуха
           вокруг короткого плеера). */
        .message.has-voice {
            padding: 6px 8px;
        }

        .voice-msg-player {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 2px 4px;
            width: 190px;
        }

        .voice-msg-play-btn {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            border: none;
            background: linear-gradient(135deg, #ffb07c, #ff8a5c);
            color: #fff;
            font-size: 13px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: transform 0.15s;
            box-shadow: 0 2px 8px rgba(255, 138, 92, 0.4);
        }

        .voice-msg-play-btn:hover {
            transform: scale(1.08);
        }

        /* Имитация "волны" — декоративный узор из полосок разной высоты,
           не настоящий анализ звука (это отдельная, более тяжёлая задача).
           Серые полоски — фон, оранжевые — та же волна поверх, но обрезана
           по ширине = прогресс воспроизведения, поэтому "закрашивается"
           слева направо по мере игры, как в Telegram/WhatsApp. */
        .voice-msg-waveform {
            position: relative;
            flex: 1;
            height: 22px;
            cursor: pointer;
            overflow: hidden;
        }

        .voice-msg-waveform-bg, .voice-msg-waveform-fill {
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            display: flex;
            align-items: center;
            gap: 2px;
        }

        .voice-msg-waveform-fill {
            width: 0%;
            overflow: hidden;
            transition: width 0.1s linear;
        }

        .voice-msg-waveform .bar {
            width: 2.5px;
            border-radius: 2px;
            background: rgba(61, 42, 26, 0.22);
            flex-shrink: 0;
        }

        .voice-msg-waveform-fill .bar {
            background: linear-gradient(180deg, #ffb07c, #ff8a5c);
        }

        .voice-msg-waveform .bar:nth-child(4n) { height: 45%; }
        .voice-msg-waveform .bar:nth-child(4n+1) { height: 90%; }
        .voice-msg-waveform .bar:nth-child(4n+2) { height: 65%; }
        .voice-msg-waveform .bar:nth-child(4n+3) { height: 30%; }
        .voice-msg-waveform .bar:nth-child(7n) { height: 100%; }
        .voice-msg-waveform .bar:nth-child(9n) { height: 20%; }

        .voice-msg-time {
            font-size: 10px;
            color: #7a6a5a;
            min-width: 24px;
            text-align: right;
            flex-shrink: 0;
        }

        body.dark .voice-msg-waveform .bar {
            background: rgba(255, 255, 255, 0.2);
        }

        body.dark .voice-msg-time {
            color: #c9b8a8;
        }

        .message .msg-photo:hover {
            transform: scale(1.02);
            box-shadow: 0 4px 16px rgba(0,0,0,0.2);
        }

        /* ===== ГЕОЛОКАЦИЯ ===== */
        .msg-location {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            margin-top: 2px;
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.18);
            text-decoration: none;
            color: inherit;
            transition: all 0.2s;
        }

        .message.theirs .msg-location {
            background: #fff;
            box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        }

        .msg-location:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .message.theirs .msg-location:hover {
            background: #fff8f0;
        }

        .msg-location-icon {
            font-size: 24px;
            flex-shrink: 0;
        }

        .msg-location-title {
            font-size: 13px;
            font-weight: 700;
        }

        .msg-location-coords {
            font-size: 11px;
            opacity: 0.8;
        }

        .msg-file {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            margin-top: 2px;
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.18);
            text-decoration: none;
            color: inherit;
            transition: all 0.2s;
            min-width: 180px;
            max-width: 260px;
        }

        .message.theirs .msg-file {
            background: #fff;
            box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        }

        .msg-file:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .message.theirs .msg-file:hover {
            background: #fff8f0;
        }

        .msg-file-icon {
            font-size: 28px;
            flex-shrink: 0;
        }

        .msg-file-info {
            min-width: 0;
        }

        .msg-file-name {
            font-size: 13px;
            font-weight: 700;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .msg-file-size {
            font-size: 11px;
            opacity: 0.8;
        }

        /* Сообщения с фото/видео — без внутренних отступов бабла,
           медиа отображается ровно по своему реальному размеру
           (без обрезки object-fit:cover и без цветной рамки вокруг). */
        .message.has-media {
            padding: 0;
            overflow: hidden;
            background: transparent !important;
            box-shadow: none;
        }

        .message.has-media .msg-name {
            padding: 8px 10px 0;
            font-size: 12px;
            font-weight: 700;
            opacity: 0.85;
        }

        .message.has-media .msg-photo {
            max-width: 280px;
            max-height: 360px;
            width: auto;
            height: auto;
            object-fit: contain;
            border-radius: 16px;
            margin-top: 0;
            display: block;
        }

        .message.has-media.mine .msg-photo {
            margin-left: auto;
        }

        .message.has-media .msg-time {
            position: absolute;
            right: 8px;
            bottom: 6px;
            margin-top: 0;
            padding: 2px 7px;
            background: rgba(0, 0, 0, 0.45);
            color: #fff;
            border-radius: 8px;
            opacity: 1;
        }

        .message.has-media .msg-pinned-badge {
            top: 4px;
            right: 4px;
        }

        .message .msg-time {
            font-size: 10px;
            opacity: 0.6;
            margin-top: 4px;
            text-align: right;
        }

        .msg-ticks {
            display: inline-block;
            margin-left: 4px;
            font-size: 11px;
            letter-spacing: -1px;
            opacity: 0.7;
        }

        .msg-ticks.read-partial {
            opacity: 0.9;
        }

        .msg-ticks.read {
            color: #4fc3f7;
            opacity: 1;
        }


        .message .msg-time {
            font-size: 10px;
            opacity: 0.6;
            margin-top: 4px;
            text-align: right;
        }

        .msg-translation-note {
            font-size: 11px;
            opacity: 0.65;
            margin-top: 4px;
            cursor: pointer;
            text-decoration: underline dotted;
        }

        .msg-translation-note:hover {
            opacity: 1;
        }

        .msg-reactions-row {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin-top: 6px;
        }

        .msg-reaction-pill {
            display: flex;
            align-items: center;
            gap: 4px;
            border: none;
            padding: 3px 9px;
            border-radius: 20px;
            font-size: 13px;
            cursor: pointer;
            font-family: 'Quicksand', sans-serif;
            transition: all 0.15s;
        }

        .message.mine .msg-reaction-pill {
            background: rgba(255, 255, 255, 0.3);
            color: #fff;
        }

        .message.theirs .msg-reaction-pill {
            background: rgba(0, 0, 0, 0.07);
            color: #3d2a1a;
        }

        .msg-reaction-pill:hover {
            transform: scale(1.08);
        }

        .msg-reaction-pill.mine {
            box-shadow: inset 0 0 0 1.5px #ff6b9d;
        }

        .msg-reaction-count {
            font-weight: 700;
            font-size: 11px;
        }

        .reaction-picker-grid {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 8px;
            padding: 6px 0 14px 0;
        }

        .reaction-picker-emoji {
            font-size: 28px;
            line-height: 1;
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px;
            border-radius: 14px;
            transition: all 0.15s;
        }

        .reaction-picker-emoji:hover {
            background: rgba(255, 215, 180, 0.4);
            transform: scale(1.15);
        }

        .reaction-picker-emoji.active {
            background: #ffe4c8;
            box-shadow: inset 0 0 0 2px #ff6b9d;
        }

        body.dark .reaction-picker-emoji:hover {
            background: rgba(255, 255, 255, 0.12);
        }

        body.dark .reaction-picker-emoji.active {
            background: rgba(255, 107, 157, 0.25);
        }

        /* ===== УПОМИНАНИЯ (@mention) ===== */
        .msg-mention {
            font-weight: 700;
        }

        .message.theirs .msg-mention {
            color: #ff6b9d;
        }

        .message.mine .msg-mention {
            text-decoration: underline;
            text-decoration-color: rgba(255, 255, 255, 0.6);
        }

        .msg-mention-me {
            background: rgba(255, 200, 0, 0.35);
            border-radius: 6px;
            padding: 0 4px;
        }

        .mention-suggestions {
            display: none;
            flex-direction: column;
            gap: 2px;
            padding: 6px;
            margin: 0 12px;
            background: #fff;
            border-radius: 14px;
            box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
            max-height: 180px;
            overflow-y: auto;
        }

        .mention-suggestions.active {
            display: flex;
        }

        .mention-suggestion-item {
            text-align: left;
            border: none;
            background: none;
            padding: 8px 12px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
            cursor: pointer;
            font-family: 'Quicksand', sans-serif;
        }

        .mention-suggestion-item:hover {
            background: #ffe4c8;
        }

        body.dark .mention-suggestions {
            background: #2a2530;
            box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.4);
        }

        body.dark .mention-suggestion-item {
            color: #f0e8e0;
        }

        body.dark .mention-suggestion-item:hover {
            background: rgba(255, 107, 157, 0.2);
        }

        .contact-unread-badge.mention {
            background: #ff6b9d;
        }

        /* ===== ХЕШТЕГИ ===== */
        .msg-hashtag {
            font-weight: 700;
            cursor: pointer;
            text-decoration: underline;
            text-decoration-style: dotted;
        }

        .message.theirs .msg-hashtag {
            color: #ff8a5c;
        }

        .message.mine .msg-hashtag {
            color: #fff;
        }

        .hashtag-list-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            border: none;
            background: none;
            padding: 12px 4px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
            font-size: 15px;
            font-weight: 700;
            color: #ff8a5c;
            cursor: pointer;
            font-family: 'Quicksand', sans-serif;
        }

        .hashtag-list-item:last-child {
            border-bottom: none;
        }

        .hashtag-list-item:hover {
            background: rgba(255, 138, 92, 0.08);
        }

        .hashtag-list-count {
            font-size: 12px;
            font-weight: 700;
            color: #fff;
            background: #ff8a5c;
            padding: 2px 8px;
            border-radius: 20px;
        }

        body.dark .hashtag-list-item {
            border-bottom-color: rgba(255, 255, 255, 0.08);
        }

        /* ===== ОПРОСЫ (polls) ===== */
        .poll-box {
            min-width: 220px;
            max-width: 100%;
        }

        .poll-question {
            font-size: 15px;
            font-weight: 700;
            margin-bottom: 10px;
            line-height: 1.35;
        }

        .poll-option {
            position: relative;
            display: block;
            width: 100%;
            text-align: left;
            border: none;
            background: rgba(0, 0, 0, 0.05);
            border-radius: 12px;
            padding: 9px 12px;
            margin-bottom: 7px;
            cursor: pointer;
            overflow: hidden;
            font-family: 'Quicksand', sans-serif;
        }

        .message.mine .poll-option {
            background: rgba(255, 255, 255, 0.2);
        }

        .poll-option.closed {
            cursor: default;
        }

        .poll-option-fill {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            background: rgba(255, 138, 92, 0.25);
            transition: width 0.3s ease;
            z-index: 0;
        }

        .message.mine .poll-option-fill {
            background: rgba(255, 255, 255, 0.22);
        }

        .poll-option.voted .poll-option-fill {
            background: rgba(255, 107, 157, 0.35);
        }

        .poll-option-row {
            position: relative;
            z-index: 1;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .poll-option-check {
            font-size: 14px;
            flex-shrink: 0;
        }

        .poll-option-text {
            flex: 1;
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
        }

        .message.mine .poll-option-text {
            color: #fff;
        }

        .poll-option-pct {
            font-size: 13px;
            font-weight: 700;
            flex-shrink: 0;
        }

        .poll-option-count {
            position: relative;
            z-index: 1;
            font-size: 11px;
            opacity: 0.7;
            margin-top: 2px;
            margin-left: 22px;
        }

        .poll-submit-btn {
            width: 100%;
            border: none;
            background: #ff6b9d;
            color: #fff;
            font-weight: 700;
            font-size: 13px;
            padding: 9px;
            border-radius: 12px;
            cursor: pointer;
            margin-bottom: 6px;
            font-family: 'Quicksand', sans-serif;
        }

        .poll-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 11px;
            opacity: 0.75;
            gap: 8px;
            margin-top: 2px;
        }

        .poll-close-btn {
            flex-shrink: 0;
            border: none;
            background: rgba(0, 0, 0, 0.08);
            color: inherit;
            font-size: 11px;
            font-weight: 700;
            padding: 4px 9px;
            border-radius: 20px;
            cursor: pointer;
            font-family: 'Quicksand', sans-serif;
        }

        .message.mine .poll-close-btn {
            background: rgba(255, 255, 255, 0.25);
        }

        /* ----- Окно создания опроса ----- */
        .poll-options-editor {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin: 10px 0;
            max-height: 240px;
            overflow-y: auto;
        }

        .poll-option-field-row {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .poll-option-field {
            flex: 1;
            margin: 0;
        }

        .poll-option-remove-btn {
            flex-shrink: 0;
            width: 30px;
            height: 30px;
            border: none;
            border-radius: 50%;
            background: rgba(0, 0, 0, 0.06);
            color: #b8a898;
            font-size: 14px;
            cursor: pointer;
        }

        .poll-add-option-btn {
            width: 100%;
            border: none;
            background: none;
            color: #ff8a5c;
            font-weight: 700;
            font-size: 13px;
            padding: 8px;
            cursor: pointer;
            font-family: 'Quicksand', sans-serif;
        }

        .poll-multiple-label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            font-weight: 600;
            color: #3d2a1a;
            margin: 10px 0 4px 0;
            cursor: pointer;
        }

        body.dark .poll-option-text {
            color: #f0e8e0;
        }

        body.dark .poll-multiple-label {
            color: #f0e8e0;
        }

        body.dark .poll-option-remove-btn {
            background: rgba(255, 255, 255, 0.1);
            color: #b8a898;
        }

        .msg-reply-quote {
            display: flex;
            flex-direction: column;
            gap: 1px;
            padding: 5px 8px;
            margin-bottom: 5px;
            border-left: 3px solid rgba(255, 255, 255, 0.6);
            background: rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            cursor: pointer;
        }

        .message.theirs .msg-reply-quote {
            border-left-color: #ffb07c;
            background: rgba(255, 176, 124, 0.12);
        }

        .msg-reply-quote-name {
            font-size: 11px;
            font-weight: 700;
            opacity: 0.9;
        }

        .msg-reply-quote-text {
            font-size: 12px;
            opacity: 0.85;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 220px;
        }

        .reply-indicator-body {
            flex: 1;
            min-width: 0;
        }

        .reply-indicator-name {
            font-size: 12px;
            font-weight: 700;
            color: #6a5a4a;
        }

        .reply-indicator-text {
            font-size: 12px;
            color: #8a7a6a;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        body.dark .reply-indicator-name {
            color: #f0e6da;
        }

        body.dark .reply-indicator-text {
            color: #cbb8d8;
        }

        .message .msg-pinned-badge {
            position: absolute;
            top: -8px;
            right: 8px;
            font-size: 13px;
            filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
        }

        @keyframes flashHighlight {
            0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 92, 0); }
            30% { box-shadow: 0 0 0 4px rgba(255, 138, 92, 0.55); }
        }

        .message.flash-highlight {
            animation: flashHighlight 1.1s ease;
        }

        .pinned-bar {
            display: none;
            flex-direction: column;
            gap: 4px;
            margin: 8px 4px 0 4px;
            padding: 8px 10px;
            background: rgba(255, 138, 92, 0.12);
            border: 1px solid rgba(255, 138, 92, 0.3);
            border-radius: 12px;
            max-height: 140px;
            overflow-y: auto;
        }

        .pinned-bar.active {
            display: flex;
        }

        .pinned-bar-header {
            font-size: 12px;
            font-weight: 700;
            color: #ff8a5c;
            margin-bottom: 2px;
        }

        .pinned-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            padding: 6px 8px;
            background: #fff;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .pinned-item:hover {
            background: #fff5ef;
        }

        .pinned-item-text {
            font-size: 13px;
            color: #3d2a1a;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .pinned-item-unpin {
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 68, 68, 0.15);
            color: #ff4444;
            font-size: 11px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .pinned-item-unpin:hover {
            background: rgba(255, 68, 68, 0.3);
        }

        body.dark .pinned-bar {
            background: rgba(255, 138, 92, 0.15);
            border-color: rgba(255, 138, 92, 0.35);
        }

        body.dark .pinned-item {
            background: rgba(255, 255, 255, 0.08);
        }

        body.dark .pinned-item:hover {
            background: rgba(255, 255, 255, 0.14);
        }

        body.dark .pinned-item-text {
            color: #f0e6da;
        }

        /* ===== ПОИСК ПО СООБЩЕНИЯМ ===== */
        .search-bar {
            display: none;
            flex-direction: column;
            margin: 8px 4px 0 4px;
            padding: 8px 10px;
            background: rgba(79, 195, 247, 0.12);
            border: 1px solid rgba(79, 195, 247, 0.3);
            border-radius: 12px;
        }

        .search-bar.active {
            display: flex;
        }

        .search-bar-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .search-input {
            flex: 1;
            border: none;
            background: #fff;
            border-radius: 10px;
            padding: 8px 12px;
            font-size: 14px;
            font-family: 'Quicksand', sans-serif;
            color: #3d2a1a;
        }

        .search-input:focus {
            outline: 2px solid rgba(79, 195, 247, 0.5);
        }

        .search-close-btn {
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 68, 68, 0.15);
            color: #ff4444;
            font-size: 13px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .search-close-btn:hover {
            background: rgba(255, 68, 68, 0.3);
        }

        .search-results {
            max-height: 220px;
            overflow-y: auto;
            margin-top: 6px;
        }

        .search-results:empty {
            margin-top: 0;
        }

        .search-result-item {
            padding: 8px;
            background: #fff;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 6px;
            transition: all 0.2s;
        }

        .search-result-item:last-child {
            margin-bottom: 0;
        }

        .search-result-item:hover {
            background: #eef8fe;
        }

        .search-result-meta {
            font-size: 11px;
            color: #8a7a6a;
            margin-bottom: 2px;
        }

        .search-result-text {
            font-size: 13px;
            color: #3d2a1a;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .search-result-text mark {
            background: #ffe08a;
            color: inherit;
            border-radius: 3px;
            padding: 0 2px;
        }

        .search-empty {
            text-align: center;
            font-size: 13px;
            color: #b8a898;
            padding: 10px 0;
        }

        body.dark .search-bar {
            background: rgba(79, 195, 247, 0.15);
            border-color: rgba(79, 195, 247, 0.35);
        }

        body.dark .search-input {
            background: rgba(255, 255, 255, 0.1);
            color: #f0e6da;
        }

        body.dark .search-result-item {
            background: rgba(255, 255, 255, 0.08);
        }

        body.dark .search-result-item:hover {
            background: rgba(255, 255, 255, 0.14);
        }

        body.dark .search-result-meta {
            color: #cbb8d8;
        }

        body.dark .search-result-text {
            color: #f0e6da;
        }

        /* ===== ПАНЕЛЬ НАСТРОЕК ЧАТА (⚙️ в шапке) ===== */
        .chat-settings-panel {
            display: none;
        }

        .chat-settings-panel.active {
            display: block;
            position: absolute;
            inset: 0;
            z-index: 1;
            margin: 0;
            padding: 20px;
            background: #fffaf5;
            border: none;
            border-radius: 40px;
            max-height: none;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .chat-settings-scroll {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .settings-top-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .settings-panel-back {
            flex-shrink: 0;
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 215, 180, 0.4);
            font-size: 18px;
            color: #3d2a1a;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .settings-panel-back:hover {
            background: rgba(255, 176, 124, 0.5);
        }

        .chat-settings-item {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
            padding: 12px 14px;
            border: none;
            border-radius: 12px;
            background: #fff;
            cursor: pointer;
            text-align: left;
            transition: all 0.2s;
            font-family: 'Quicksand', sans-serif;
        }

        .chat-settings-item:hover {
            background: #fff1e4;
        }

        .chat-settings-item.active {
            background: #ffe4c8;
            box-shadow: inset 0 0 0 2px #ffb07c;
        }

        .chat-settings-num {
            font-size: 12px;
            font-weight: 700;
            color: #b8a898;
            width: 18px;
            flex-shrink: 0;
            text-align: right;
        }

        .chat-settings-emoji {
            font-size: 18px;
            width: 22px;
            flex-shrink: 0;
            text-align: center;
        }

        .chat-settings-label {
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
            flex: 1;
        }

        .chat-settings-badge-new {
            font-size: 10px;
            font-weight: 700;
            color: #fff;
            background: linear-gradient(135deg, #ff8fab, #ff6b9d);
            padding: 3px 8px;
            border-radius: 20px;
            flex-shrink: 0;
            letter-spacing: 0.3px;
            white-space: nowrap;
        }

        body.dark .chat-settings-panel {
            background: #2a1f2a;
            border-color: #4a3a4a;
        }

        body.dark .chat-settings-item {
            background: rgba(255, 255, 255, 0.08);
        }

        body.dark .chat-settings-item:hover {
            background: rgba(255, 255, 255, 0.14);
        }

        body.dark .chat-settings-item.active {
            background: rgba(108, 92, 231, 0.25);
            box-shadow: inset 0 0 0 2px #8a7cf0;
        }

        body.dark .chat-settings-label {
            color: #f0e6da;
        }

        body.dark .chat-settings-num {
            color: #7a6a8a;
        }

        .sound-block {
            display: none;
            padding: 4px 2px 2px;
        }

        .sound-block.active {
            display: block;
        }

        .message.deleted {
            opacity: 0.7;
            transform: none;
            background: #e8e2da !important;
            color: #9a8a7a !important;
            box-shadow: none !important;
            border: 1px dashed #d8ccc0 !important;
        }

        .message.deleted .msg-text {
            font-style: italic;
            color: #9a8a7a !important;
        }

        .message.deleted .msg-time {
            color: #b0a494 !important;
        }

        body.dark .message.deleted {
            background: rgba(120, 110, 130, 0.25) !important;
            color: #a89ca8 !important;
            border-color: rgba(120, 110, 130, 0.4) !important;
        }

        body.dark .message.deleted .msg-text,
        body.dark .message.deleted .msg-time {
            color: #a89ca8 !important;
        }

        .chat-input-row {
            display: flex;
            gap: 8px;
            padding-top: 12px;
            border-top: 2px solid #f5ede4;
            transition: border-color 0.5s ease;
            align-items: center;
        }

        .recording-row {
            display: none;
            align-items: center;
            gap: 10px;
            padding-top: 12px;
            border-top: 2px solid #f5ede4;
        }

        .recording-row.active {
            display: flex;
        }

        .recording-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #ff4444;
            flex-shrink: 0;
            animation: recDotPulse 1s ease-in-out infinite;
        }

        @keyframes recDotPulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.4; transform: scale(0.8); }
        }

        .recording-label {
            flex: 1;
            font-size: 14px;
            font-weight: 600;
            color: #6a5a4a;
        }

        .recording-timer {
            font-size: 14px;
            font-weight: 700;
            color: #ff4444;
            font-variant-numeric: tabular-nums;
        }

        .recording-cancel {
            border: none;
            background: #fdf0ec;
            color: #c0503f;
            font-size: 13px;
            font-weight: 700;
            padding: 8px 14px;
            border-radius: 12px;
            cursor: pointer;
        }

        .send-btn.mic-mode {
            background: linear-gradient(135deg, #ff8a5c, #ffb07c) !important;
        }

        .send-btn.mic-mode.holding {
            background: #ff4444 !important;
            transform: scale(1.15);
        }

        body.dark .recording-row {
            border-color: #4a3a4a;
        }

        body.dark .recording-label {
            color: #c0b0c0;
        }

        body.dark .recording-cancel {
            background: rgba(192, 80, 63, 0.2);
            color: #ff8a7a;
        }

        /* ===== ИНДИКАТОР РЕДАКТИРОВАНИЯ СООБЩЕНИЯ ===== */
        .edit-indicator {
            display: none;
            align-items: center;
            gap: 10px;
            padding: 10px 4px;
            border-top: 2px solid #f5ede4;
        }

        .edit-indicator.active {
            display: flex;
        }

        .edit-indicator-icon {
            font-size: 15px;
            flex-shrink: 0;
        }

        .edit-indicator-label {
            flex: 1;
            font-size: 13px;
            font-weight: 600;
            color: #6a5a4a;
        }

        .edit-indicator-cancel {
            flex-shrink: 0;
            width: 24px;
            height: 24px;
            border: none;
            border-radius: 50%;
            background: #fdf0ec;
            color: #c0503f;
            font-size: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        body.dark .edit-indicator {
            border-color: #4a3a4a;
        }

        body.dark .edit-indicator-label {
            color: #c0b0c0;
        }

        body.dark .edit-indicator-cancel {
            background: rgba(192, 80, 63, 0.2);
            color: #ff8a7a;
        }

        .chat-input-row .input-field {
            flex: 1;
            padding: 13px 16px;
            font-size: 16px;
            border-radius: 16px;
        }

        /* Капсула вокруг поля ввода — само поле теперь без своей рамки/фона
           (это даёт капсула-обёртка), а иконки фото/видео плавают внутри,
           справа от текста, как скрепка+камера в WhatsApp. */
        .chat-input-pill {
            flex: 1;
            display: flex;
            align-items: center;
            background: #fcf7f0;
            border: 2px solid #e8ddd0;
            border-radius: 16px;
            transition: all 0.3s;
            min-width: 0;
        }

        .chat-input-pill:focus-within {
            border-color: #ffb07c;
        }

        .chat-input-pill .input-field {
            border: none;
            background: transparent;
            min-width: 0;
        }

        .chat-input-pill .input-field:focus {
            border: none;
            box-shadow: none;
        }

        .chat-input-inline-actions {
            display: flex;
            align-items: center;
            gap: 2px;
            padding-right: 6px;
            flex-shrink: 0;
            max-width: 80px;
            overflow: hidden;
            opacity: 1;
            transition: max-width 0.25s ease, opacity 0.2s ease;
        }

        /* Пока печатаешь — иконки фото/видео уезжают вправо (сворачиваются),
           освобождая место под текст; кнопка отправки/микрофона снаружи
           капсулы их не касается. */
        .chat-input-inline-actions.typing-hide {
            max-width: 0;
            opacity: 0;
            pointer-events: none;
        }

        .chat-inline-btn {
            width: 30px;
            height: 30px;
            border: none;
            background: transparent;
            border-radius: 50%;
            color: #3d2a1a;
            font-size: 15px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.2s;
        }

        .chat-inline-btn:hover {
            background: rgba(255, 215, 180, 0.4);
        }

        .chat-inline-btn.holding {
            background: #ff4444 !important;
            color: #fff;
            transform: scale(1.15);
        }

        body.dark .chat-input-pill {
            background: #2a1a1a;
            border-color: #4a3020;
        }

        body.dark .chat-inline-btn {
            color: #f0e6da;
        }

        .chat-input-row .chat-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 215, 180, 0.3);
            color: #3d2a1a;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .chat-input-row .chat-btn:hover {
            background: rgba(255, 215, 180, 0.6);
            transform: scale(1.05);
        }

        .chat-input-row .chat-btn.send-btn {
            background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%);
            color: #fff;
            box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45);
        }

        .chat-input-row .chat-btn.send-btn:hover {
            box-shadow: 0 5px 20px rgba(177, 140, 255, 0.6);
            transform: scale(1.06);
        }

        .chat-input-row .chat-btn:active {
            transform: scale(0.9);
        }

        .chat-input-row .chat-btn.holding {
            background: #ff4444 !important;
            color: #fff;
            transform: scale(1.15);
        }

        /* ============================================================ */
        /* ===== СТРАНИЦА 5: НАСТРОЙКИ ===== */
        /* ============================================================ */
        .room {
            background: #ffffff;
            border-radius: 40px 40px 30px 30px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.10), 0 0 0 2px #ffdbb5 inset;
            padding: 24px 20px 30px;
            position: relative;
            overflow: hidden;
            transition: background 0.5s ease, border-color 0.5s ease;
        }

        .settings-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .settings-header .back-btn {
            width: 44px;
            height: 44px;
            border: none;
            border-radius: 50%;
            background: rgba(255, 215, 180, 0.4);
            font-size: 22px;
            color: #3d2a1a;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid rgba(255, 215, 180, 0.3);
            font-weight: 300;
        }

        .settings-header .back-btn:hover {
            background: rgba(255, 215, 180, 0.7);
            transform: scale(0.95);
        }

        .settings-header .back-btn:active {
            transform: scale(0.9);
        }

        .color-picker {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }

        .color-dots {
            display: flex;
            gap: 8px;
            align-items: center;
            flex-wrap: wrap;
            justify-content: center;
        }

        .color-dot {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            border: 3px solid rgba(255, 255, 255, 0.8);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            position: relative;
        }

        .color-dot:hover {
            transform: scale(1.2);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
        }

        .color-dot:active {
            transform: scale(0.85);
        }

        .color-dot.active {
            transform: scale(1.25);
            border-color: #ffffff;
            box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.6), 0 4px 24px rgba(0, 0, 0, 0.3);
        }

        .color-dot:nth-child(1) { background: #4fc3f7; }
        .color-dot:nth-child(2) { background: #81c784; }
        .color-dot:nth-child(3) { background: #ff8a65; }
        .color-dot:nth-child(4) { background: #f8bbd0; }
        .color-dot:nth-child(5) { background: #ffd54f; }
        .color-dot:nth-child(6) { background: #26c6da; }

        .color-label {
            font-size: 10px;
            color: #8a7a6a;
            font-weight: 600;
            letter-spacing: 0.3px;
            transition: color 0.3s ease;
            text-transform: uppercase;
        }

        .logout-super-btn {
            width: 44px;
            height: 44px;
            border: none;
            border-radius: 50%;
            background: linear-gradient(135deg, #6c5ce7, #a855f7, #ec4899);
            font-size: 22px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 0 20px rgba(108, 92, 231, 0.3);
            color: white;
            border: 2px solid rgba(255,255,255,0.2);
        }

        .logout-super-btn:hover {
            transform: scale(1.1) rotate(-10deg);
            box-shadow: 0 0 40px rgba(108, 92, 231, 0.6), 0 0 80px rgba(168, 85, 247, 0.3);
        }

        .logout-super-btn:active {
            transform: scale(0.9) rotate(10deg);
        }

        .pupsi-corner {
            display: flex;
            align-items: center;
            gap: 14px;
            margin-bottom: 24px;
            margin-top: 10px;
            background: #fff5e8;
            padding: 16px 18px;
            border-radius: 60px;
            border: 2px dashed #ffb07c;
            transition: all 0.5s ease;
        }

        .pupsi-avatar {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: linear-gradient(135deg, #ffb07c, #ff8a5c);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
            box-shadow: 0 4px 12px rgba(255, 138, 92, 0.3);
            flex-shrink: 0;
            transition: all 0.5s ease;
        }

        .pupsi-greeting {
            font-size: 14px;
            color: #7a5a3a;
            line-height: 1.4;
            transition: color 0.5s ease;
        }

        .pupsi-greeting strong {
            font-family: 'Comfortaa', cursive;
            font-size: 18px;
            color: #d9733a;
            display: block;
            transition: color 0.5s ease;
        }

        .pupsi-greeting span {
            font-size: 13px;
            opacity: 0.7;
        }

        .section {
            margin-bottom: 18px;
        }

        .card {
            background: #fcf7f0;
            border-radius: 20px;
            padding: 14px 16px;
            border: 2px solid #f5ede4;
            transition: all 0.5s ease;
        }

        .theme-pills {
            display: flex;
            gap: 8px;
            flex: 1;
        }

        .theme-pill {
            flex: 1;
            padding: 12px;
            border: 2px solid #e8ddd0;
            border-radius: 14px;
            background: #ffffff;
            font-size: 14px;
            font-weight: 600;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            color: #3d2a1a;
            font-family: 'Quicksand', sans-serif;
        }

        .theme-pill:hover {
            border-color: #ffb07c;
        }

        .theme-pill.active {
            background: #ffb07c;
            border-color: #ff8a5c;
            color: #ffffff;
            box-shadow: 0 4px 12px rgba(255, 138, 92, 0.25);
        }

        .sound-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
        }

        .sound-chip {
            padding: 10px 12px;
            border: 2px solid #e8ddd0;
            border-radius: 14px;
            background: #ffffff;
            font-size: 13px;
            font-weight: 500;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            color: #3d2a1a;
            font-family: 'Quicksand', sans-serif;
        }

        .sound-chip:hover {
            border-color: #ffb07c;
        }

        .sound-chip.active {
            background: #ffb07c;
            border-color: #ff8a5c;
            color: #ffffff;
            box-shadow: 0 4px 12px rgba(255, 138, 92, 0.2);
        }

        .name-row {
            display: flex;
            gap: 10px;
        }

        .account-name-display {
            font-size: 15px;
            color: #6a5a4a;
            padding: 8px 4px;
        }

        .account-name-display strong {
            color: #ff8a5c;
        }

        body.dark .account-name-display {
            color: #b8a8a8;
        }

        .name-btn {
            padding: 12px 20px;
            border: none;
            border-radius: 16px;
            background: #ffb07c;
            color: #ffffff;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
            font-family: 'Quicksand', sans-serif;
        }

        .name-btn:hover {
            background: #ff8a5c;
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(255, 138, 92, 0.3);
        }

        .name-btn:active {
            transform: translateY(0);
        }

        .features-carousel-wrapper {
            margin-top: 20px;
            position: relative;
            overflow: hidden;
            border-radius: 20px;
            background: #fcf7f0;
            padding: 16px 0 10px 0;
            border: 2px dashed #dcc8b8;
            transition: all 0.5s ease;
        }

        .features-scroll-hint {
            text-align: center;
            font-size: 12px;
            color: #b28a6a;
            font-weight: 600;
            letter-spacing: 0.5px;
            margin-bottom: 10px;
            opacity: 0.7;
            transition: color 0.5s ease;
        }

        .features-carousel {
            display: flex;
            overflow-x: auto;
            scroll-snap-type: x mandatory;
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
            gap: 16px;
            padding: 0 20px 10px 20px;
            cursor: grab;
            scrollbar-width: none;
        }

        .features-carousel::-webkit-scrollbar {
            display: none;
        }

        .feature-card {
            flex: 0 0 220px;
            scroll-snap-align: start;
            background: #ffffff;
            border-radius: 20px;
            padding: 20px 18px;
            border: 2px solid #f0e8e0;
            transition: all 0.5s ease;
            box-shadow: 0 2px 12px rgba(0,0,0,0.04);
            min-height: 120px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .feature-card .emoji {
            font-size: 32px;
            margin-bottom: 6px;
        }

        .feature-card .name {
            font-size: 16px;
            font-weight: 700;
            color: #3d2a1a;
            transition: color 0.5s ease;
        }

        .feature-card .desc {
            font-size: 13px;
            color: #8a7a6a;
            margin: 4px 0 8px 0;
            line-height: 1.3;
            transition: color 0.5s ease;
        }

        .feature-card .status-badge {
            font-size: 11px;
            font-weight: 700;
            padding: 3px 12px;
            border-radius: 20px;
            display: inline-block;
            width: fit-content;
        }

        .status-badge.ready {
            background: #d4edda;
            color: #155724;
        }

        .status-badge.dev {
            background: #fff3cd;
            color: #856404;
        }

        .status-badge.soon {
            background: #cce5ff;
            color: #004085;
        }

        .dots-indicator {
            display: flex;
            justify-content: center;
            gap: 6px;
            padding: 8px 0 4px 0;
        }

        .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #dcc8b8;
            transition: all 0.3s;
            cursor: pointer;
        }

        .dot.active {
            background: #ff8a5c;
            width: 24px;
            border-radius: 4px;
        }

        /* ============================================================ */
        /* ===== TOAST ===== */
        /* ============================================================ */
        .toast {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%) translateY(80px);
            background: #3d2a1a;
            color: #fff5e8;
            padding: 14px 24px;
            border-radius: 60px;
            font-size: 14px;
            font-weight: 500;
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            z-index: 9999;
            box-shadow: 0 8px 30px rgba(0,0,0,0.15);
            max-width: 90%;
            text-align: center;
            pointer-events: none;
            font-family: inherit;
            border: 2px solid #ffdbb5;
        }

        .toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        .update-banner {
            position: fixed;
            top: 16px;
            left: 50%;
            transform: translateX(-50%) translateY(-80px);
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 18px;
            border-radius: 60px;
            background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%);
            color: #fff;
            font-size: 13.5px;
            font-weight: 600;
            box-shadow: 0 8px 24px rgba(177, 140, 255, 0.45);
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            z-index: 9999;
            cursor: pointer;
            max-width: 90%;
        }

        .update-banner.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        .update-banner b {
            font-weight: 800;
            text-decoration: underline;
            text-underline-offset: 2px;
        }

        .update-banner:hover {
            box-shadow: 0 10px 30px rgba(177, 140, 255, 0.6);
        }

        .waiting-call-banner {
            position: fixed;
            top: 16px;
            left: 50%;
            transform: translateX(-50%) translateY(-80px);
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px 10px 16px;
            border-radius: 60px;
            background: #fffaf5;
            border: 2px solid #ffdbb5;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
            opacity: 0;
            transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            z-index: 9998;
            max-width: 90%;
            font-size: 13.5px;
            color: #3d2a1a;
        }

        .waiting-call-banner.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        .waiting-call-text {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .waiting-call-accept, .waiting-call-decline {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            border: none;
            font-size: 14px;
            font-weight: 800;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            color: #fff;
            transition: transform 0.15s;
        }

        .waiting-call-accept {
            background: #4caf50;
        }

        .waiting-call-decline {
            background: #e57373;
        }

        .waiting-call-accept:hover, .waiting-call-decline:hover {
            transform: scale(1.1);
        }

        body.dark .waiting-call-banner {
            background: #241a1a;
            border-color: #4a3020;
            color: #f0e6da;
        }

        .connection-banner {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: #d84315;
            color: #fff;
            text-align: center;
            font-size: 13px;
            font-weight: 700;
            padding: 8px 12px;
            z-index: 10000;
            transform: translateY(-100%);
            transition: transform 0.3s ease;
        }

        .connection-banner.active {
            transform: translateY(0);
        }

        /* ===== ИНДИКАТОР ОФЛАЙН-ОЧЕРЕДИ ===== */
        .queue-indicator {
            position: fixed;
            bottom: 90px;
            left: 50%;
            transform: translateX(-50%) translateY(20px);
            background: rgba(33, 150, 243, 0.95);
            color: white;
            padding: 10px 18px;
            border-radius: 25px;
            box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
            z-index: 9998;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            font-weight: 600;
            font-family: 'Quicksand', sans-serif;
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s ease;
        }

        .queue-indicator.active {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        .queue-indicator .spinner {
            width: 14px;
            height: 14px;
            border: 2px solid rgba(255,255,255,0.35);
            border-top-color: #fff;
            border-radius: 50%;
            animation: connSpin 0.8s linear infinite;
        }

        @keyframes connSpin {
            to { transform: rotate(360deg); }
        }

        @media (max-width: 600px) {
            .queue-indicator {
                bottom: 80px;
                font-size: 12px;
                padding: 9px 14px;
            }
        }

        .delete-sheet-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.4);
            z-index: 10500;
            align-items: flex-end;
            justify-content: center;
        }

        .delete-sheet-overlay.active {
            display: flex;
        }

        .delete-sheet {
            width: 100%;
            max-width: 420px;
            background: #fffaf5;
            border-radius: 24px 24px 0 0;
            padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
            box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
            animation: sheetUp 0.25s ease;
        }

        @keyframes sheetUp {
            0% { transform: translateY(100%); }
            100% { transform: translateY(0); }
        }

        .delete-sheet-title {
            text-align: center;
            font-weight: 700;
            font-size: 15px;
            color: #3d2a1a;
            margin-bottom: 14px;
        }

        .delete-sheet-btn {
            display: block;
            width: 100%;
            border: none;
            border-radius: 16px;
            padding: 14px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            margin-bottom: 10px;
            transition: transform 0.15s;
        }

        .delete-sheet-btn:active {
            transform: scale(0.97);
        }

        .delete-sheet-all {
            background: #ff4444;
            color: #fff;
        }

        .delete-sheet-mine {
            background: #fff0e4;
            color: #ff8a5c;
            border: 2px solid #ffdbb5;
        }

        .delete-sheet-cancel {
            background: transparent;
            color: #8a7a6a;
            margin-bottom: 0;
        }

        body.dark .delete-sheet {
            background: #241a24;
        }

        body.dark .delete-sheet-title {
            color: #d0c0c0;
        }

        body.dark .delete-sheet-mine {
            background: rgba(108, 92, 231, 0.15);
            border-color: #4a3a4a;
            color: #b8a8e8;
        }

        body.dark .delete-sheet-cancel {
            color: #a89898;
        }

        /* ============================================================ */
        /* ===== ЗВОНОК (АУДИО/ВИДЕО) ===== */
        /* ============================================================ */
        .video-container {
            display: none;
            position: fixed;
            /* Раньше здесь стоял inset:0, который сам задаёт нижнюю
               границу — из-за этого явная высота ниже могла конфликтовать
               и не применяться. Задаём верх/бока явно, а НИЗ пусть
               определяется только высотой — без противоречий. */
            top: 0;
            left: 0;
            right: 0;
            /* На Android (особенно Samsung) нижняя панель браузера может
               перекрывать контент, если высота посчитана как обычный vh —
               100dvh учитывает её появление/скрытие динамически, а
               --app-height (через JS, window.visualViewport) добивает
               те случаи, где даже dvh не поспевает за реальным браузером. */
            height: 100vh;
            height: 100dvh;
            height: var(--app-height, 100dvh);
            background: #1a1210;
            z-index: 10000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .video-container.active {
            display: flex;
        }

        .call-status {
            position: absolute;
            top: 40px;
            left: 50%;
            transform: translateX(-50%);
            color: #fff5e8;
            font-size: 18px;
            font-weight: 700;
            background: rgba(0, 0, 0, 0.35);
            padding: 10px 22px;
            border-radius: 30px;
            text-align: center;
            max-width: 90%;
        }

        .call-timer {
            position: absolute;
            top: 92px;
            left: 50%;
            transform: translateX(-50%);
            color: #ffdbb5;
            font-size: 15px;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
            letter-spacing: 0.5px;
            display: none;
        }

        .call-timer.active {
            display: block;
        }

        .remote-video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            background: #000;
        }

        .local-video {
            position: absolute;
            bottom: 110px;
            right: 20px;
            width: 110px;
            height: 150px;
            object-fit: cover;
            border-radius: 20px;
            border: 3px solid #ffdbb5;
            background: #000;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        }

        .video-controls {
            position: absolute;
            bottom: calc(40px + env(safe-area-inset-bottom, 0px));
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 20px;
        }

        .video-controls button {
            width: 58px;
            height: 58px;
            border-radius: 50%;
            border: none;
            font-size: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .btn-mute, .btn-video, .btn-switch-camera {
            background: rgba(255, 255, 255, 0.18);
            color: #fff;
        }

        .btn-mute:hover, .btn-video:hover, .btn-switch-camera:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .btn-end-call {
            background: #ff4444;
            color: #fff;
        }

        .btn-end-call:hover {
            background: #e53939;
            transform: scale(1.05);
        }

        /* Кнопка приглашения контакта в текущий звонок (рядом с "завершить") —
           тот же кружочек, что и у остальных кнопок звонка, но с эмодзи
           и короткой подписью внутри вместо одной большой иконки. */
        .btn-invite {
            flex-direction: column;
            gap: 0;
            font-size: 9px;
            line-height: 1.15;
            background: rgba(255, 255, 255, 0.18);
            color: #fff;
        }

        .btn-invite:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .btn-invite-emoji {
            font-size: 19px;
        }

        .btn-invite-label {
            font-size: 8px;
            font-weight: 700;
            margin-top: 1px;
        }

        /* ===== ПРИГЛАШЕНИЕ КОНТАКТА В ЗВОНОК ===== */
        .invite-call-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 10050;
            align-items: flex-end;
            justify-content: center;
        }

        .invite-call-overlay.active {
            display: flex;
        }

        /* Эти два списка ("кто посмотрел" и "комментарии") открываются
           ИЗ полноэкранного просмотра статуса (z-index: 99996) — обычного
           10050 не хватает, список рисуется под статусом и не виден.
           Тот же баг был и у "кто посмотрел" ещё до этой правки — заодно
           починил и его. */
        #storyViewersOverlay,
        #storyCommentsOverlay {
            z-index: 99998;
        }

        /* ===== МЕНЮ ДЕЙСТВИЙ НАД СООБЩЕНИЕМ (долгое нажатие) ===== */
        .message-menu-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 10060;
            align-items: flex-end;
            justify-content: center;
        }

        .message-menu-overlay.active {
            display: flex;
        }

        .message-menu-sheet {
            width: 100%;
            max-width: 420px;
            background: #fffaf5;
            border-radius: 24px 24px 0 0;
            padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
            box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.25);
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .message-menu-item {
            display: flex;
            align-items: center;
            gap: 14px;
            width: 100%;
            padding: 13px 10px;
            background: none;
            border: none;
            border-radius: 14px;
            font-size: 15px;
            font-weight: 600;
            color: #3d2a1a;
            text-align: left;
            cursor: pointer;
            transition: background 0.15s;
        }

        .message-menu-item:active {
            background: rgba(255, 138, 115, 0.12);
        }

        .message-menu-item.danger {
            color: #d64545;
        }

        .message-menu-icon {
            font-size: 19px;
            width: 24px;
            text-align: center;
            flex-shrink: 0;
        }

        body.dark .message-menu-sheet {
            background: #2a2320;
        }

        body.dark .message-menu-item {
            color: #f0e6da;
        }

        body.dark .message-menu-item:active {
            background: rgba(255, 138, 115, 0.18);
        }

        .invite-call-box {
            width: 100%;
            max-width: 420px;
            background: #fffaf5;
            border-radius: 24px 24px 0 0;
            padding: 20px;
            box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.25);
        }

        .invite-call-title {
            font-size: 16px;
            font-weight: 700;
            color: #3d2a1a;
            margin-bottom: 14px;
            text-align: center;
        }

        .invite-call-list {
            max-height: 320px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .invite-contact-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 14px;
            background: #fff;
            cursor: pointer;
            transition: all 0.2s;
        }

        .invite-contact-item:hover {
            background: #fff1e4;
        }

        .invite-contact-name {
            font-size: 15px;
            font-weight: 600;
            color: #3d2a1a;
        }

        .invite-call-empty {
            text-align: center;
            padding: 20px;
            color: #b8a898;
            font-size: 14px;
        }

        .invite-call-cancel {
            width: 100%;
            margin-top: 16px;
            padding: 12px;
            border: none;
            border-radius: 14px;
            background: #f5ede4;
            color: #6a5a4a;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            font-family: 'Quicksand', sans-serif;
        }

        /* ===== ЧЁРНЫЙ СПИСОК ===== */
        .blocked-list-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 14px;
            background: #fff;
            border: 2px solid #f5ede4;
            font-size: 14px;
            font-weight: 600;
            color: #3d2a1a;
        }

        .blocked-list-item button {
            flex-shrink: 0;
            border: none;
            background: rgba(255, 68, 68, 0.12);
            color: #ff4444;
            font-size: 12px;
            font-weight: 700;
            padding: 6px 12px;
            border-radius: 20px;
            cursor: pointer;
        }

        /* ===== QR-КОД ПРОФИЛЯ ===== */
        .profile-qr-wrap {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            padding: 8px 0 4px;
        }

        .profile-qr-img {
            width: 220px;
            height: 220px;
            border-radius: 16px;
            border: 2px solid #f5ede4;
            background: #fff;
        }

        .profile-qr-username {
            font-size: 18px;
            font-weight: 800;
            color: #3d2a1a;
        }

        .profile-qr-hint {
            font-size: 13px;
            color: #a89484;
            text-align: center;
            max-width: 260px;
        }

        /* ===== КОД ВОССТАНОВЛЕНИЯ ПАРОЛЯ ===== */
        .recovery-code-hint {
            font-size: 13px;
            color: #a89484;
            text-align: center;
            line-height: 1.5;
            margin-bottom: 14px;
        }

        .recovery-code-value {
            font-family: 'Courier New', monospace;
            font-size: 22px;
            font-weight: 800;
            letter-spacing: 1px;
            color: #3d2a1a;
            text-align: center;
            background: #fff4e0;
            border: 2px dashed #ffdd9e;
            border-radius: 14px;
            padding: 14px 10px;
            margin-bottom: 14px;
            user-select: all;
        }

        .recovery-code-confirm {
            background: #ffb07c !important;
            color: #fff !important;
        }

        .twofa-code-input {
            font-family: 'Courier New', monospace;
            font-size: 24px;
            font-weight: 800;
            letter-spacing: 6px;
            text-align: center;
        }

        /* ===== СОЗДАНИЕ ГРУППОВОГО ЧАТА ===== */
        .group-name-input {
            width: 100%;
            box-sizing: border-box;
            margin-bottom: 14px;
            padding: 12px 14px;
            border: 2px solid #f0e4d6;
            border-radius: 14px;
            font-size: 15px;
            font-family: 'Quicksand', sans-serif;
        }

        .group-member-item {
            justify-content: space-between;
        }

        .group-member-item.selected {
            background: #fff1e4;
            box-shadow: inset 0 0 0 2px #ffb07c;
        }

        .group-member-check {
            font-size: 16px;
            flex-shrink: 0;
        }

        .group-create-confirm {
            margin-top: 16px;
            background: linear-gradient(135deg, #ba68c8, #8e5ca6);
            color: #fff;
        }

        body.dark .group-name-input {
            background: rgba(255, 255, 255, 0.08);
            border-color: #4a3a4a;
            color: #f0e6da;
        }

        body.dark .group-member-item.selected {
            background: rgba(186, 104, 200, 0.2);
            box-shadow: inset 0 0 0 2px #ba68c8;
        }

        body.dark .invite-call-box {
            background: #2a1f2a;
        }

        body.dark .invite-call-title {
            color: #f0e6da;
        }

        body.dark .invite-contact-item {
            background: rgba(255, 255, 255, 0.08);
        }

        body.dark .invite-contact-item:hover {
            background: rgba(255, 255, 255, 0.14);
        }

        body.dark .invite-contact-name {
            color: #f0e6da;
        }

        body.dark .invite-call-cancel {
            background: rgba(255, 255, 255, 0.1);
            color: #f0e6da;
        }

        /* ============================================================ */
        /* ===== ГРУППОВОЙ ЗВОНОК ===== */
        /* ============================================================ */
        .group-call-grid {
            width: 100%;
            height: 100%;
            padding: 90px 14px 120px;
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            grid-auto-rows: min-content;
            gap: 10px;
            align-content: start;
            overflow-y: auto;
        }

        .group-call-tile {
            position: relative;
            width: 100%;
            aspect-ratio: 3 / 4;
            border-radius: 18px;
            overflow: hidden;
            background: #2a1f1a;
            border: 2px solid rgba(255, 219, 181, 0.35);
        }

        .group-call-tile video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            background: #000;
        }

        .group-call-tile-name {
            position: absolute;
            left: 8px;
            bottom: 8px;
            color: #fff5e8;
            font-size: 12px;
            font-weight: 700;
            background: rgba(0, 0, 0, 0.45);
            padding: 3px 10px;
            border-radius: 20px;
            max-width: calc(100% - 16px);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .group-btn-mute,
        .group-btn-video {
            background: rgba(255, 255, 255, 0.18);
            color: #fff;
        }

        .group-btn-mute:hover,
        .group-btn-video:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .group-btn-leave {
            background: #ff4444;
            color: #fff;
        }

        .group-btn-leave:hover {
            background: #e53939;
            transform: scale(1.05);
        }

        /* ============================================================ */
        /* ===== ВХОДЯЩИЙ ЗВОНОК ===== */
        /* ============================================================ */
        .incoming-call-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(20, 12, 10, 0.92);
            z-index: 10001;
            align-items: center;
            justify-content: center;
        }

        .incoming-call-overlay.active {
            display: flex;
        }

        .incoming-call-box {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            text-align: center;
        }

        .incoming-call-avatar {
            width: 96px;
            height: 96px;
            border-radius: 50%;
            background: linear-gradient(135deg, #ffb07c, #ff8a65);
            color: #fff;
            font-size: 40px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 0 0 0 rgba(255, 138, 101, 0.6);
            animation: incoming-pulse 1.6s infinite;
        }

        @keyframes incoming-pulse {
            0% { box-shadow: 0 0 0 0 rgba(255, 138, 101, 0.55); }
            70% { box-shadow: 0 0 0 26px rgba(255, 138, 101, 0); }
            100% { box-shadow: 0 0 0 0 rgba(255, 138, 101, 0); }
        }

        .incoming-call-name {
            color: #fff5e8;
            font-size: 24px;
            font-weight: 800;
        }

        .incoming-call-type {
            color: #ffdbb5;
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 20px;
        }

        .incoming-call-buttons {
            display: flex;
            gap: 40px;
        }

        .incoming-call-btn {
            width: 64px;
            height: 64px;
            border-radius: 50%;
            border: none;
            font-size: 26px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .incoming-call-btn.decline {
            background: #ff4444;
            color: #fff;
        }

        .incoming-call-btn.decline:hover {
            background: #e53939;
            transform: scale(1.05);
        }

        .incoming-call-btn.accept {
            background: #4caf50;
            color: #fff;
            animation: incoming-accept-pulse 1.6s infinite;
        }

        .incoming-call-btn.accept:hover {
            background: #43a047;
            transform: scale(1.05);
        }

        @keyframes incoming-accept-pulse {
            0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.55); }
            70% { box-shadow: 0 0 0 14px rgba(76, 175, 80, 0); }
            100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
        }

        /* ============================================================ */
        /* ===== ТЁМНАЯ ТЕМА ===== */
        /* ============================================================ */
        body.dark {
            background: linear-gradient(135deg, #0f0a1a 0%, #1a0f2a 100%);
        }

        body.dark .login-box,
        body.dark .welcome-box,
        body.dark .contacts-box,
        body.dark .chat-box,
        body.dark .room {
            background: #1e1a2e;
            border-color: #3a2a4a;
        }

        body.dark .logo-title {
            color: #d0c0c0;
        }

        body.dark .logo-title span {
            background: linear-gradient(135deg, #6c5ce7, #a855f7);
        }

        body.dark .logo-sub {
            color: #8a7a8a;
        }

        body.dark .greeting {
            color: #d0c0c0;
        }

        body.dark .greeting-sub {
            color: #8a7a8a;
        }

        body.dark .input-field {
            background: #2a1a2e;
            border-color: #4a3a4a;
            color: #d0c0c0;
        }

        body.dark .input-field:focus {
            border-color: #6c5ce7;
            background: #2a1a2e;
            box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
        }

        body.dark .input-field::placeholder {
            color: #6a5a6a;
        }

        body.dark .btn-enter {
            background: linear-gradient(135deg, #6c5ce7, #a855f7);
            box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
        }

        body.dark .btn-enter:hover {
            box-shadow: 0 8px 28px rgba(108, 92, 231, 0.4);
        }

        body.dark .footer-text {
            color: #8a7a8a;
        }

        body.dark .footer-text a {
            color: #a855f7;
        }

        body.dark .greeting-text {
            color: #d0c0c0;
        }

        body.dark .greeting-text span {
            background: linear-gradient(135deg, #6c5ce7, #a855f7);
        }

        body.dark .username-display {
            color: #ffb07c;
        }

        body.dark .username-display #userNameDisplay {
            color: #ffb07c;
        }

        body.dark .datetime {
            background: #3a2410;
            border-color: #6a4a1e;
            color: #ffcb7a;
        }

        body.dark .btn {
            background: #2a1a2e;
            color: #d0c0d0;
        }

        body.dark .btn-contacts:hover,
        body.dark .btn-settings:hover {
            background: #352340;
        }

        body.dark .btn-exit {
            border-color: #4a3a4a;
            color: #8a7a8a;
        }

        body.dark .btn-exit:hover {
            background: #2a1a2e;
            border-color: #a855f7;
            color: #a855f7;
        }

        body.dark .back-btn {
            background: rgba(60, 42, 74, 0.5);
            border-color: rgba(60, 42, 74, 0.3);
            color: #c0a0b0;
        }

        body.dark .back-btn:hover {
            background: rgba(60, 42, 74, 0.8);
        }

        body.dark .color-dot {
            border-color: rgba(255, 255, 255, 0.2);
        }

        body.dark .color-dot.active {
            border-color: #ffffff;
            box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3), 0 4px 24px rgba(0, 0, 0, 0.5);
        }

        body.dark .color-label {
            color: #8a7a8a;
        }

        body.dark .pupsi-corner {
            background: #2a1a2e;
            border-color: #6a4a6a;
        }

        body.dark .pupsi-greeting {
            color: #c0a0b0;
        }

        body.dark .pupsi-greeting strong {
            color: #ffb07c;
        }

        body.dark .card {
            background: #2a1a2e;
            border-color: #3a2a4a;
        }

        body.dark .theme-pill {
            background: #2a1a2e;
            border-color: #4a3a4a;
            color: #d0c0c0;
        }

        body.dark .theme-pill.active {
            background: #6c5ce7;
            border-color: #6c5ce7;
            color: #ffffff;
        }

        body.dark .sound-chip {
            background: #2a1a2e;
            border-color: #4a3a4a;
            color: #d0c0c0;
        }

        body.dark .sound-chip.active {
            background: #6c5ce7;
            border-color: #6c5ce7;
            color: #ffffff;
        }

        body.dark .name-btn {
            background: #6c5ce7;
        }

        body.dark .name-btn:hover {
            background: #5a4bd1;
        }

        body.dark .features-carousel-wrapper {
            background: #2a1a2e;
            border-color: #4a3a4a;
        }

        body.dark .features-scroll-hint {
            color: #8a7a8a;
        }

        body.dark .feature-card {
            background: #1e1a2e;
            border-color: #3a2a4a;
        }

        body.dark .feature-card .name {
            color: #d0c0c0;
        }

        body.dark .feature-card .desc {
            color: #8a7a8a;
        }

        body.dark .dot {
            background: #4a3a4a;
        }

        body.dark .dot.active {
            background: #6c5ce7;
        }

        body.dark .toast {
            background: #2a1a2e;
            border-color: #4a3a4a;
            color: #e0d0d0;
        }

        body.dark .contact-item:hover {
            background: #2a1a2e;
            border-color: #4a3a4a;
        }

        body.dark .contact-name {
            color: #d0c0c0;
        }

        body.dark .contact-name .you-label {
            background: #3a2a4a;
            color: #a090a0;
        }

        body.dark .add-contact-row {
            border-color: #4a3a4a;
        }

        body.dark .add-contact-row .btn-add {
            background: linear-gradient(135deg, #6c5ce7, #a855f7);
        }

        body.dark .chat-header {
            border-color: #4a3a4a;
            background: #1e1a2e;
        }

        body.dark .chat-header .chat-contact-name {
            color: #d0c0c0;
        }

        body.dark .chat-header .chat-contact-status {
            color: #8a7a8a;
        }

        body.dark .chat-header .chat-action-btn {
            background: rgba(60, 42, 74, 0.5);
            color: #c0a0b0;
        }

        body.dark .chat-header .chat-action-btn:hover {
            background: rgba(60, 42, 74, 0.8);
        }

        body.dark .chat-header .chat-action-btn.active {
            background: #6c5ce7;
            color: #fff;
        }

        body.dark .chat-input-row {
            border-color: #4a3a4a;
        }

        body.dark .chat-input-row .chat-btn {
            background: rgba(60, 42, 74, 0.5);
            color: #c0a0b0;
        }

        body.dark .chat-input-row .chat-btn:hover {
            background: rgba(60, 42, 74, 0.8);
        }

        body.dark .chat-input-row .chat-btn.send-btn {
            background: linear-gradient(135deg, #6c5ce7, #a855f7);
            color: #fff;
        }

        body.dark .message.theirs {
            background: #2a1a2e;
            color: #d0c0c0;
        }

        body.dark .message.mine {
            background: linear-gradient(135deg, #6c5ce7, #a855f7);
        }

        body.dark .settings-header .back-btn {
            background: rgba(60, 42, 74, 0.5);
            border-color: rgba(60, 42, 74, 0.3);
            color: #c0a0b0;
        }

        body.dark .settings-header .back-btn:hover {
            background: rgba(60, 42, 74, 0.8);
        }

        /* ============================================================ */
        /* ===== ЦВЕТОВЫЕ ТЕМЫ ДЛЯ НАСТРОЕК ===== */
        /* ============================================================ */
        body.color-blue .room { border-color: #4fc3f7; }
        body.color-blue .pupsi-corner { border-color: #4fc3f7; background: #e1f5fe; }
        body.color-blue .pupsi-avatar { background: linear-gradient(135deg, #4fc3f7, #0288d1); }
        body.color-blue .pupsi-greeting strong { color: #0288d1; }
        body.color-blue .theme-pill.active { background: #4fc3f7; border-color: #0288d1; }
        body.color-blue .sound-chip.active { background: #4fc3f7; border-color: #0288d1; }
        body.color-blue .name-btn { background: #4fc3f7; }
        body.color-blue .name-btn:hover { background: #0288d1; }
        body.color-blue .dot.active { background: #4fc3f7; }
        body.color-blue .chat-input-row .chat-btn.send-btn { background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%); box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45); }
        body.color-blue .message.mine { background: linear-gradient(135deg, #4fc3f7, #0288d1); }

        body.color-green .room { border-color: #81c784; }
        body.color-green .pupsi-corner { border-color: #81c784; background: #e8f5e9; }
        body.color-green .pupsi-avatar { background: linear-gradient(135deg, #81c784, #388e3c); }
        body.color-green .pupsi-greeting strong { color: #388e3c; }
        body.color-green .theme-pill.active { background: #81c784; border-color: #388e3c; }
        body.color-green .sound-chip.active { background: #81c784; border-color: #388e3c; }
        body.color-green .name-btn { background: #81c784; }
        body.color-green .name-btn:hover { background: #388e3c; }
        body.color-green .dot.active { background: #81c784; }
        body.color-green .chat-input-row .chat-btn.send-btn { background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%); box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45); }
        body.color-green .message.mine { background: linear-gradient(135deg, #81c784, #388e3c); }

        body.color-coral .room { border-color: #ff8a65; }
        body.color-coral .pupsi-corner { border-color: #ff8a65; background: #fbe9e7; }
        body.color-coral .pupsi-avatar { background: linear-gradient(135deg, #ff8a65, #d84315); }
        body.color-coral .pupsi-greeting strong { color: #d84315; }
        body.color-coral .theme-pill.active { background: #ff8a65; border-color: #d84315; }
        body.color-coral .sound-chip.active { background: #ff8a65; border-color: #d84315; }
        body.color-coral .name-btn { background: #ff8a65; }
        body.color-coral .name-btn:hover { background: #d84315; }
        body.color-coral .dot.active { background: #ff8a65; }
        body.color-coral .chat-input-row .chat-btn.send-btn { background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%); box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45); }
        body.color-coral .message.mine { background: linear-gradient(135deg, #ff8a65, #d84315); }

        body.color-pink .room { border-color: #f8bbd0; }
        body.color-pink .pupsi-corner { border-color: #f8bbd0; background: #fce4ec; }
        body.color-pink .pupsi-avatar { background: linear-gradient(135deg, #f8bbd0, #c2185b); }
        body.color-pink .pupsi-greeting strong { color: #c2185b; }
        body.color-pink .theme-pill.active { background: #f8bbd0; border-color: #c2185b; }
        body.color-pink .sound-chip.active { background: #f8bbd0; border-color: #c2185b; }
        body.color-pink .name-btn { background: #f8bbd0; }
        body.color-pink .name-btn:hover { background: #c2185b; }
        body.color-pink .dot.active { background: #f8bbd0; }
        body.color-pink .chat-input-row .chat-btn.send-btn { background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%); box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45); }
        body.color-pink .message.mine { background: linear-gradient(135deg, #f8bbd0, #c2185b); }

        body.color-yellow .room { border-color: #ffd54f; }
        body.color-yellow .pupsi-corner { border-color: #ffd54f; background: #fffde7; }
        body.color-yellow .pupsi-avatar { background: linear-gradient(135deg, #ffd54f, #f9a825); }
        body.color-yellow .pupsi-greeting strong { color: #f9a825; }
        body.color-yellow .theme-pill.active { background: #ffd54f; border-color: #f9a825; color: #3d2a1a; }
        body.color-yellow .sound-chip.active { background: #ffd54f; border-color: #f9a825; color: #3d2a1a; }
        body.color-yellow .name-btn { background: #ffd54f; color: #3d2a1a; }
        body.color-yellow .name-btn:hover { background: #f9a825; }
        body.color-yellow .dot.active { background: #ffd54f; }
        body.color-yellow .chat-input-row .chat-btn.send-btn { background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%); color: #fff; box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45); }
        body.color-yellow .message.mine { background: linear-gradient(135deg, #ffd54f, #f9a825); color: #3d2a1a; }

        body.color-teal .room { border-color: #26c6da; }
        body.color-teal .pupsi-corner { border-color: #26c6da; background: #e0f7fa; }
        body.color-teal .pupsi-avatar { background: linear-gradient(135deg, #26c6da, #00838f); }
        body.color-teal .pupsi-greeting strong { color: #00838f; }
        body.color-teal .theme-pill.active { background: #26c6da; border-color: #00838f; }
        body.color-teal .sound-chip.active { background: #26c6da; border-color: #00838f; }
        body.color-teal .name-btn { background: #26c6da; }
        body.color-teal .name-btn:hover { background: #00838f; }
        body.color-teal .dot.active { background: #26c6da; }
        body.color-teal .chat-input-row .chat-btn.send-btn { background: linear-gradient(135deg, #ff8fd6 0%, #b18cff 45%, #57c7ff 100%); box-shadow: 0 3px 12px rgba(177, 140, 255, 0.45); }
        body.color-teal .message.mine { background: linear-gradient(135deg, #26c6da, #00838f); }

/* ============================================================ */
/* ===== ПОЛНЫЙ ЭКРАН НА ТЕЛЕФОНЕ (как в WhatsApp) ===== */
/* ============================================================ */
@media (max-width: 600px) {
    html, body {
        height: 100%;
    }

    body {
        padding: 0;
        align-items: stretch;
        background: #fff5e8;
    }

    .container {
        max-width: 100%;
        width: 100%;
    }

    .page.active {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .login-box,
    .welcome-box,
    .contacts-box,
    .chat-box,
    .room {
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        box-sizing: border-box;
    }

    .login-box,
    .welcome-box {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-left: 28px;
        padding-right: 28px;
    }

    .contacts-box,
    .room {
        padding-top: max(24px, env(safe-area-inset-top));
        padding-left: 20px;
        padding-right: 20px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .chat-box {
        height: 100vh;
        height: 100dvh;
        height: var(--app-height, 100dvh);
        min-height: 0;
        padding-top: max(14px, env(safe-area-inset-top));
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    body.dark {
        background: #150d1e;
    }
}

/* ===== ПУЛЬСИРУЮЩИЕ ЗВЁЗДОЧКИ ===== */
.greeting-emoji {
    font-size: 28px !important;
    display: inline !important;
    animation: pulseStar 2s ease-in-out infinite !important;
}

.greeting-emoji:last-child {
    animation-delay: 0.5s !important;
}

@keyframes pulseStar {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ: избранное, форматирование, DND, множественная
   ===== пересылка, приватность фото, кнопка "вниз чата" =====
   ================================================================ */

/* Кнопка "вниз чата" */
.scroll-to-bottom-btn {
    display: none;
    position: absolute;
    right: 24px;
    bottom: 96px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--accent, #c9b09b);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    z-index: 5;
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0;
    transform: translateY(8px);
}

.scroll-to-bottom-btn.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.message .msg-favorite-badge {
    position: absolute;
    top: -8px;
    left: 8px;
    font-size: 12px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.favorite-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 34px 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 2px solid #f5ede4;
    cursor: pointer;
}

.favorite-item-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #ffb300;
}

.favorite-item-time {
    font-weight: 500;
    color: #b8a898;
}

.favorite-item-text {
    font-size: 14px;
    font-weight: 500;
    color: #3d2a1a;
}

.favorite-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: rgba(255, 68, 68, 0.12);
    color: #ff4444;
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
}

body.dark .favorite-item {
    background: #2a2030;
    border-color: #4a3a4a;
}

body.dark .favorite-item-text {
    color: #f0e6da;
}

/* Форматирование текста жирный/курсив в сообщениях */
.msg-text b {
    font-weight: 800;
}

.msg-text i {
    font-style: italic;
}

body.dark .scroll-to-bottom-btn {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (2): прогресс загрузки, превью медиа, плейсхолдер
   ===== автозагрузки, история звонков =====
   ================================================================ */

/* Прогресс-бар загрузки файла */
.upload-progress-bar {
    display: none;
    position: relative;
    height: 22px;
    margin: 8px 4px 0 4px;
    border-radius: 12px;
    background: #f5ede4;
    overflow: hidden;
    align-items: center;
}

.upload-progress-bar.active {
    display: flex;
}

.upload-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #ffb37a, #ff8a5c);
    transition: width 0.2s ease;
}

.upload-progress-label {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #3d2a1a;
}

body.dark .upload-progress-bar {
    background: #3a2a3a;
}

body.dark .upload-progress-label {
    color: #f0e6da;
}

/* Превью фото/видео перед отправкой */
.media-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0 12px;
}

.media-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f5ede4;
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* Плейсхолдер, когда автозагрузка медиа выключена */
.msg-media-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 16px;
    border-radius: 14px;
    background: rgba(255, 138, 92, 0.12);
    border: 2px dashed rgba(255, 138, 92, 0.4);
    font-size: 13px;
    font-weight: 700;
    color: #ff8a5c;
    cursor: pointer;
    text-align: center;
}

body.dark .msg-media-placeholder {
    background: rgba(255, 138, 92, 0.15);
}

/* История звонков */
.call-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.call-history-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 138, 92, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.call-history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.call-history-contact {
    font-size: 14px;
    font-weight: 700;
    color: #3d2a1a;
}

.call-history-meta {
    font-size: 12px;
    font-weight: 500;
    color: #b8a898;
}

body.dark .call-history-contact {
    color: #f0e6da;
}

/* Кнопка глобального поиска в шапке контактов */
.global-search-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 215, 180, 0.15);
    color: #3d2a1a;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
}

.global-search-btn:hover {
    background: rgba(255, 215, 180, 0.35);
    transform: scale(1.05);
}

body.dark .global-search-btn {
    background: rgba(255, 138, 92, 0.1);
    color: #f0e6da;
}

.global-search-btn.push-right {
    margin-left: auto;
}

.global-search-btn.qr-btn {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.global-search-btn.camera-btn {
    font-size: 22px;
}

.global-search-btn.settings-btn {
    font-size: 20px;
}


/* ================================================================
   ===== НОВЫЕ ФИЧИ (3): аватар в шапке чата, инфо о группе,
   ===== аватар группы, управление участниками =====
   ================================================================ */

.chat-contact-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffb37a, #ff8a5c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
}

.chat-contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-contact-avatar.group {
    background: linear-gradient(135deg, #7ec8e3, #4fc3f7);
    font-size: 17px;
}

.group-info-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 10px;
}

.group-info-avatar-wrap {
    position: relative;
    width: 76px;
    height: 76px;
}

.group-info-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7ec8e3, #4fc3f7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    overflow: hidden;
}

.group-info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-info-avatar-edit {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 26px;
    height: 26px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #ff8a5c;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-info-description {
    font-size: 13px;
    font-weight: 500;
    color: #b8a898;
    max-width: 260px;
}

.group-member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
}

.group-member-row-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #3d2a1a;
}

.group-member-remove {
    flex-shrink: 0;
    border: none;
    background: rgba(255, 68, 68, 0.12);
    color: #ff4444;
    font-size: 12px;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
}

body.dark .chat-contact-avatar {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
}

body.dark .group-info-description,
body.dark .group-member-row-name {
    color: #f0e6da;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (4): drag&drop =====
   ================================================================ */

/* Drag & drop файлов в чат */
.chat-box.drag-over {
    outline: 3px dashed #ff8a5c;
    outline-offset: -6px;
    background: rgba(255, 138, 92, 0.06);
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (5): цвет аватарки, профиль, отображаемое имя =====
   ================================================================ */

.my-avatar.color1 { background: #4fc3f7; }
.my-avatar.color2 { background: #81c784; }
.my-avatar.color3 { background: #ff8a65; }
.my-avatar.color4 { background: #f8bbd0; color: #3d2a1a; }
.my-avatar.color5 { background: #ffd54f; color: #3d2a1a; }
.my-avatar.color6 { background: #26c6da; }

.profile-field-label {
    font-size: 12px;
    font-weight: 700;
    color: #b8a898;
    margin: 12px 2px 6px;
    text-align: left;
}

.profile-static-value {
    font-size: 14px;
    font-weight: 600;
    color: #3d2a1a;
    padding: 10px 12px;
    background: #f5ede4;
    border-radius: 12px;
    text-align: left;
}

.avatar-color-swatches {
    display: flex;
    gap: 10px;
    padding: 2px 0 4px;
}

.avatar-color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
}

.avatar-color-swatch.color1 { background: #4fc3f7; }
.avatar-color-swatch.color2 { background: #81c784; }
.avatar-color-swatch.color3 { background: #ff8a65; }
.avatar-color-swatch.color4 { background: #f8bbd0; }
.avatar-color-swatch.color5 { background: #ffd54f; }
.avatar-color-swatch.color6 { background: #26c6da; }

.avatar-color-swatch.selected {
    border-color: #3d2a1a;
}

body.dark .profile-static-value {
    background: #3a2a3a;
    color: #f0e6da;
}

body.dark .avatar-color-swatch.selected {
    border-color: #fff;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (6): исчезающие сообщения, отложенная отправка =====
   ================================================================ */

.disappearing-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 12px;
}

.disappearing-option {
    border: none;
    background: #f5ede4;
    color: #3d2a1a;
    font-size: 14px;
    font-weight: 700;
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
}

.disappearing-option:hover {
    background: rgba(255, 138, 92, 0.2);
}

body.dark .disappearing-option {
    background: #3a2a3a;
    color: #f0e6da;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (7): статистика звонка =====
   ================================================================ */

.call-stats-overlay {
    position: absolute;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    display: none;
    z-index: 5;
    cursor: pointer;
    white-space: nowrap;
}

.call-stats-overlay.active {
    display: block;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (8): скелетоны загрузки =====
   ================================================================ */

@keyframes skeletonPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
}

.skeleton-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #f5ede4;
    flex-shrink: 0;
    animation: skeletonPulse 1.2s ease-in-out infinite;
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: #f5ede4;
    animation: skeletonPulse 1.2s ease-in-out infinite;
}

.skeleton-line.short {
    width: 40%;
    height: 14px;
}

body.dark .skeleton-avatar,
body.dark .skeleton-line {
    background: #3a2a3a;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (9): предпросмотр ссылок =====
   ================================================================ */

.msg-link {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.link-preview-card {
    margin-top: 6px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.04);
}

.link-preview-inner {
    display: block;
    text-decoration: none;
    color: inherit;
}

.link-preview-image {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    display: block;
}

.link-preview-text {
    padding: 8px 10px;
}

.link-preview-title {
    font-size: 13px;
    font-weight: 700;
    color: #3d2a1a;
    margin-bottom: 2px;
}

.link-preview-description {
    font-size: 12px;
    font-weight: 500;
    color: #7a6a5a;
    line-height: 1.3;
}

.message.mine .link-preview-card {
    background: rgba(255, 255, 255, 0.15);
}

.message.mine .link-preview-title {
    color: inherit;
}

.message.mine .link-preview-description {
    color: inherit;
    opacity: 0.85;
}

body.dark .link-preview-title {
    color: #f0e6da;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (10): свайп-ответ, pull-to-refresh =====
   ================================================================ */

.message {
    transition: transform 0.15s ease;
}

.message.swipe-armed {
    opacity: 0.85;
}

.news-delete-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    padding: 2px;
    line-height: 1;
}

.news-delete-btn:hover {
    opacity: 1;
}

.pull-refresh-indicator {
    display: none;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #b8a898;
    padding: 6px 0;
}

.pull-refresh-indicator.visible {
    display: block;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (11): полноэкранный просмотр фото с зумом,
   ===== галерея медиа =====
   ================================================================ */

.media-viewer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    background: rgba(0, 0, 0, 0.92);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.media-viewer-overlay.active {
    display: flex;
}

.media-viewer-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-viewer-media {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    touch-action: none;
}

.media-viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 1;
}

.media-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px 0 12px;
}

.media-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #f5ede4;
}

.media-gallery-item img,
.media-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-gallery-video-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 14px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (12): фильтры и история поиска =====
   ================================================================ */

.search-filters-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.search-filters-row select,
.search-filters-row input {
    flex: 1;
    font-size: 12px;
    padding: 8px 10px;
}

.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #b8a898;
    padding: 4px 4px 8px;
}

.search-history-header button {
    border: none;
    background: none;
    color: #ff8a5c;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.search-history-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: #f5ede4;
    color: #3d2a1a;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 6px;
    cursor: pointer;
}

body.dark .search-history-item {
    background: #3a2a3a;
    color: #f0e6da;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (13): поворот экрана в видеозвонке =====
   ================================================================ */

@media (orientation: landscape) and (max-height: 500px) {
    .local-video {
        bottom: 16px;
        right: 16px;
        width: 90px;
        height: 120px;
    }

    .video-controls {
        bottom: 16px;
        gap: 12px;
    }

    .video-controls button {
        width: 46px;
        height: 46px;
        font-size: 19px;
    }

    .call-status {
        top: 12px;
        font-size: 13px;
    }

    .call-stats-overlay {
        top: 40px;
    }
}

/* Обычный (портретный) телефон — 7 кнопок в ряд не влезают в полный
   размер, уменьшаем их и зазор между ними, чтобы все поместились. */
@media (max-width: 600px) and (orientation: portrait) {
    .video-controls {
        bottom: 28px;
        gap: 6px;
    }

    .video-controls button {
        width: 42px;
        height: 42px;
        font-size: 17px;
    }

    .btn-invite {
        font-size: 8px;
    }

    .btn-invite .btn-invite-emoji {
        font-size: 15px;
    }
}

/* Совсем узкие телефоны — жмём ещё чуть плотнее */
@media (max-width: 360px) and (orientation: portrait) {
    .video-controls {
        gap: 4px;
    }

    .video-controls button {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (14): стикеры =====
   ================================================================ */

.sticker-pack-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.sticker-pack-tab {
    flex-shrink: 0;
    border: none;
    background: #f5ede4;
    color: #7a6a5a;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.sticker-pack-tab.active {
    background: #ff8a5c;
    color: #fff;
}

.sticker-picker-item {
    font-size: 26px !important;
}

.message.sticker-message {
    background: none !important;
    padding: 4px !important;
    box-shadow: none !important;
    max-width: 120px;
}

.message.sticker-message .msg-sticker {
    font-size: 64px;
    line-height: 1;
    text-align: center;
}

.message.sticker-message .msg-name {
    padding-left: 4px;
}

body.dark .sticker-pack-tab {
    background: #3a2a3a;
    color: #d8c8bc;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (15): GIF =====
   ================================================================ */

.msg-gif {
    max-width: 220px;
    border-radius: 12px;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (16): голосовая почта =====
   ================================================================ */

.voicemail-record-timer {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    color: #ff8a5c;
    padding: 16px 0;
}

/* ================================================================
   ===== НОВЫЕ ФИЧИ (17): редактор фото =====
   ================================================================ */

.media-preview-edit {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
}

.photo-editor-canvas-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0 auto 12px;
    background: #1a1210;
    border-radius: 12px;
    overflow: hidden;
}

#photoEditorCanvas {
    display: block;
    max-width: 100%;
}

.editor-crop-box {
    position: absolute;
    border: 2px dashed #fff;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
    cursor: move;
    touch-action: none;
}

.editor-crop-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff8a5c;
    border: 2px solid #fff;
    cursor: nwse-resize;
    touch-action: none;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.editor-tool-btn {
    flex: 1;
    border: none;
    background: #f5ede4;
    color: #3d2a1a;
    font-size: 12px;
    font-weight: 700;
    padding: 9px;
    border-radius: 12px;
    cursor: pointer;
}

.editor-filters-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.editor-filter-btn {
    flex-shrink: 0;
    border: none;
    background: #f5ede4;
    color: #7a6a5a;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.editor-filter-btn.active {
    background: #ff8a5c;
    color: #fff;
}

body.dark .editor-tool-btn,
body.dark .editor-filter-btn {
    background: #3a2a3a;
    color: #d8c8bc;
}

/* ================================================================
   ===== ВЫБОР ЦВЕТА ТЕМЫ В НАСТРОЙКАХ ЧАТА (перенесено с главного
   ===== экрана — те же классы, но без #landingRoot, чтобы работали
   ===== и внутри чата) =====
   ================================================================ */
.chat-settings-panel .color-picker-title {
    color: #3d2a1a;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.chat-settings-panel .color-circles {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.chat-settings-panel .color-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

.chat-settings-panel .color-circle:hover {
    transform: scale(1.15);
}

.chat-settings-panel .color-circle.selected {
    border-color: #3d2a1a;
    transform: scale(1.2);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

body.dark .chat-settings-panel .color-picker-title {
    color: #f0e6da;
}

/* ================================================================
   ===== НОВАЯ АРХИТЕКТУРА КОНТАКТОВ: кнопка "Добавить" у результата
   ===== поиска по телефону/логину =====
   ================================================================ */
.search-add-contact-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 138, 92, 0.15);
    color: #ff8a5c;
    font-size: 15px;
    cursor: pointer;
}

.search-add-contact-btn:hover {
    background: rgba(255, 138, 92, 0.3);
}

body.dark .search-add-contact-btn {
    background: rgba(255, 138, 92, 0.2);
}

.search-result-hint {
    font-size: 12px;
    font-weight: 600;
    color: #ff8a5c;
    padding: 0 2px 6px;
}

body.dark .search-result-hint {
    color: #ffb37a;
}

/* ================================================================
   ===== СКАНЕР QR-КОДА (камера) =====
   ================================================================ */
.qr-scanner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    background: #000;
    z-index: 99997;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qr-scanner-overlay.active {
    display: flex;
}

.qr-scanner-title {
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    z-index: 1;
    /* Растянут на всю ширину (left:0; right:0) и оказывается поверх крестика
       закрытия в правом верхнем углу при одинаковом z-index — крестик
       технически виден, но клик перехватывал именно этот текст, а не кнопку.
       Заголовку клики не нужны — пропускаем их насквозь к тому, что под ним. */
    pointer-events: none;
}

.qr-scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qr-scanner-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 240px;
    border: 3px solid #ff8a5c;
    border-radius: 20px;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.qr-scanner-status {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    text-align: center;
    color: #ff8a8a;
    font-size: 14px;
    font-weight: 700;
}

/* ================================================================
   ===== ИСТОРИИ (СТАТУСЫ) — лента кружков, полноэкранный просмотр =====
   ================================================================ */

.stories-bar {
    display: none;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 2px 14px;
    margin-bottom: 4px;
}

/* В шапке контактов места мало — кружки мельче, подписи под ними нет,
   сама лента растягивается на всё доступное место и скроллится сама. */
.header-row .stories-bar {
    display: none;
    flex: 1;
    gap: 10px;
    padding: 0;
    margin-bottom: 0;
    min-width: 0;
}

.header-row .stories-bar.has-stories {
    display: flex;
}

.header-row .story-circle-item {
    width: auto;
}

.header-row .story-circle {
    width: 38px;
    height: 38px;
    padding: 2px;
}

.header-row .story-circle-avatar {
    font-size: 13px;
}

.header-row .story-add-badge {
    width: 15px;
    height: 15px;
    font-size: 10px;
}

.header-row .story-circle-label {
    display: none;
}

.story-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    width: 62px;
    cursor: pointer;
}

.story-circle {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-circle.unseen {
    background: linear-gradient(135deg, #ff8a5c, #ffb37a, #ff6a88);
}

.story-circle.seen {
    background: #d8c8bc;
}

.story-circle.no-story {
    background: #f5ede4;
}

.story-circle-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffb37a, #ff8a5c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    overflow: hidden;
    border: 2px solid #fff;
}

.story-circle-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-add-badge {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff8a5c;
    color: #fff;
    border: 2px solid #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-circle-label {
    font-size: 11px;
    font-weight: 600;
    color: #7a6a5a;
    text-align: center;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark .story-circle-label {
    color: #d8c8bc;
}

body.dark .story-circle.no-story {
    background: #3a2a3a;
}

/* Полноэкранный просмотр истории */
.story-viewer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    background: #000;
    z-index: 99996;
    flex-direction: column;
}

.story-viewer-overlay.active {
    display: flex;
}

.story-progress-row {
    display: flex;
    gap: 4px;
    padding: 10px 10px 0;
}

.story-progress-track {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
}

.story-viewer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}

.story-viewer-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffb37a, #ff8a5c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.story-viewer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-viewer-info {
    flex: 1;
    min-width: 0;
}

.story-stats-row {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 14px 10px;
}

.story-stat {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    padding: 5px 12px;
    border-radius: 14px;
}

.story-stat-clickable {
    cursor: pointer;
}

.story-stat-clickable:hover {
    background: rgba(255, 255, 255, 0.25);
}

.story-viewer-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.story-viewer-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.story-viewer-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.story-viewer-media-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.story-media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.story-tap-zone {
    position: absolute;
    top: 60px;
    bottom: 60px;
    width: 33%;
}

.story-tap-prev {
    left: 0;
}

.story-tap-next {
    right: 0;
}

.story-viewer-caption {
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.story-my-actions-row {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto max(20px, env(safe-area-inset-bottom));
}

.story-viewers-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
}

.story-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 82, 82, 0.25);
    color: #fff;
    font-size: 15px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
}

.story-delete-btn:hover {
    background: rgba(255, 82, 82, 0.4);
}

.story-actions-row {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 0 16px max(20px, env(safe-area-inset-bottom));
}

.story-like-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    font-size: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.story-comment-input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 20px;
    padding: 11px 16px;
    color: #fff;
    font-size: 14px;
}

.story-comment-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.story-comment-send {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #ff8a5c;
    color: #fff;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ================================================================
   ===== СТРАНИЦА "СТАТУСЫ" (список) =====
   ================================================================ */

.status-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.status-list-item:hover {
    background: #fcf7f0;
}

.status-list-item .story-circle {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
}

.status-list-info {
    flex: 1;
    min-width: 0;
}

.status-list-name {
    font-size: 15px;
    font-weight: 700;
    color: #3d2a1a;
}

.status-list-time {
    font-size: 12px;
    font-weight: 500;
    color: #b8a898;
    margin-top: 2px;
}

.status-list-add-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 138, 92, 0.15);
    color: #ff8a5c;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

body.dark .status-list-name {
    color: #f0e6da;
}

body.dark .status-list-item:hover {
    background: rgba(60, 42, 74, 0.4);
}

/* ================================================================
   ===== ОТВЕТ НА СТАТУС В ЧАТЕ (как в WhatsApp) =====
   ================================================================ */

.msg-story-reply {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 200px;
}

.msg-story-reply-label {
    font-size: 11px;
    font-weight: 700;
    color: #b8a898;
}

.msg-story-reply-media {
    width: 90px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 138, 92, 0.4);
}

.msg-story-reply-media img,
.msg-story-reply-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-story-reply-text {
    font-size: 14px;
    line-height: 1.4;
}

/* ================================================================
   ===== MONETIZATION / PREMIUM / COINS ============================
   ================================================================ */
.monetization-overlay { z-index: 100001; }
.monetization-box { max-height: 90vh; overflow-y: auto; width: min(680px, 94vw); }
.monetization-status { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 0; }
/* Окошко выбора получателя подарка открывается ПОВЕРХ главного окна
   монетизации — без явного z-index оно наследует обычный z-index
   класса invite-call-overlay (10050), что ниже, чем у самого главного
   окна (100001), и оказывается физически позади него, хотя визуально
   можно не сразу заметить проблему — только при попытке нажать что-то
   внутри окошка выбора становится ясно, что клики до него не доходят. */
#monetizationGiftRecipientOverlay { z-index: 100002; }
.monetization-status > div { padding:12px; border-radius:14px; background:rgba(255,138,92,.10); display:flex; justify-content:space-between; gap:8px; }
.monetization-status span { opacity:.7; }
.monetization-test-note { padding:10px 12px; border-radius:12px; background:rgba(255,193,7,.12); margin-bottom:12px; font-size:13px; }
.monetization-section { margin-top:16px; }
.monetization-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:8px; }
.monetization-card { min-width:0; border:1px solid rgba(127,127,127,.18); border-radius:14px; padding:11px; background:var(--panel-bg,#fff); display:flex; flex-direction:column; gap:7px; text-align:left; color:inherit; }
.monetization-card b { font-size:14px; }
.monetization-card span { opacity:.7; font-size:12px; }
.monetization-card button { align-self:flex-start; border:0; border-radius:10px; padding:7px 10px; cursor:pointer; background:rgba(255,138,92,.16); color:inherit; }
.monetization-inline { display:flex; gap:8px; margin-top:8px; }
.monetization-inline .profile-text-input { flex:1; min-width:0; }
.monetization-feature-list { margin-top:8px; padding:12px; border-radius:12px; background:rgba(127,127,127,.08); line-height:1.8; font-size:13px; }
/* Три в ряд остаются три в ряд даже на телефоне — раньше тут схлопывалось
   в одну колонку, теперь только status/inline (там текста больше). */
@media (max-width:560px) { .monetization-status { grid-template-columns:1fr; } .monetization-inline { flex-direction:column; } }
body.dark .monetization-card { background:rgba(255,255,255,.05); }

/* Компактные карточки без цены (монеты, Premium) — иконка сверху,
   число/название снизу, по центру. Саму реальную цену в евро убрали —
   деньги ещё не подключены, вернём когда дойдёт до настоящего запуска. */
.monetization-card-compact {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  padding: 12px 6px;
}
.monetization-card-icon { font-size: 22px; line-height: 1; }
.monetization-card-amount { font-size: 13px; line-height: 1.25; word-break: break-word; }

/* Баннер "выбери, кому подарить" на странице контактов — появляется,
   когда человек нажал "Подарить" в окне монетизации, и остаётся, пока
   он не выберет получателя (кликом по контакту) или не нажмёт "Отмена". */
.gift-recipient-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,138,92,.9), rgba(255,177,124,.95));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.gift-recipient-banner button {
    border: none;
    border-radius: 10px;
    padding: 6px 12px;
    background: rgba(255,255,255,.25);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}


/* Monetization test: coin amounts are real clickable buttons. */
.monetization-coin-card {
  width: 100%;
  min-height: 68px;
  cursor: pointer !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.monetization-coin-card:hover {
  transform: translateY(-1px);
}
.monetization-coin-card:active {
  transform: translateY(0);
}
.monetization-coin-card b, .monetization-coin-card span {
  pointer-events: none;
}

.monetization-coin-card:focus { outline: 2px solid currentColor; outline-offset: 2px; }


/* ===== Monetization gifts v1 ===== */
.monetization-recipient { margin: 8px 0 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,177,124,.12); font-size: 13px; }
.monetization-gift-inbox { display: grid; gap: 8px; }
.monetization-gift-inbox:empty::before { content: 'Пока подарков нет'; display: block; text-align: center; padding: 10px; color: #b8a898; font-size: 13px; }
.msg-gift-card { min-width: 190px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, rgba(255,215,180,.9), rgba(255,238,220,.95)); border: 2px solid rgba(255,138,92,.25); text-align: center; box-shadow: 0 6px 18px rgba(100,60,30,.10); }
.msg-gift-emoji { font-size: 42px; line-height: 1.1; }
.msg-gift-title { font-size: 17px; font-weight: 800; margin-top: 5px; }
.msg-gift-subtitle { font-size: 12px; margin-top: 5px; opacity: .8; }
.msg-gift-coins { font-size: 12px; font-weight: 800; margin-top: 7px; }
.msg-gift-message { margin-top: 8px; padding: 7px 9px; border-radius: 10px; background: rgba(255,255,255,.55); font-size: 12px; }
body.dark .monetization-recipient { background: rgba(255,177,124,.10); }
body.dark .msg-gift-card { background: linear-gradient(135deg, #3b2b31, #302631); border-color: rgba(255,138,92,.3); }
body.dark .msg-gift-message { background: rgba(255,255,255,.08); }

.monetization-gift-recipient-list { display:grid; gap:7px; max-height:260px; overflow:auto; margin:8px 0; }
.monetization-recipient-item { width:100%; display:flex; align-items:center; gap:8px; padding:10px 12px; border:2px solid transparent; border-radius:12px; background:#f8eee6; cursor:pointer; text-align:left; }
.monetization-recipient-item.selected { border-color:#ff8a5c; }
.monetization-recipient-item small { margin-left:auto; color:#b8a898; }
.monetization-recipient-empty { padding:12px; text-align:center; color:#b8a898; font-size:13px; }
.monetization-received-gift { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:14px; background:#fff7ef; border:1px solid #f2ddca; }
.monetization-received-emoji { font-size:30px; }
.monetization-received-gift div { font-size:12px; }
.monetization-received-gift b { font-size:14px; }
.monetization-received-gift small { display:block; margin-top:3px; }
body.dark .monetization-recipient-item { background:#302630; }
body.dark .monetization-received-gift { background:#302630; border-color:#4a3a4a; }

/* ===== Яркая карточка-вход в монетизацию в настройках чата — заметно
   выделяется среди обычных пронумерованных пунктов, специально не
   пронумерована, чтобы не сбивать порядок остальных 50+ пунктов ниже. */
.monetization-entry-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    text-align: left;
    color: #fff;
    background: linear-gradient(135deg, #ff8a5c 0%, #ffb37a 55%, #ffcf9e 100%);
    box-shadow: 0 6px 18px rgba(255, 138, 92, .35);
    transition: transform .15s ease, box-shadow .15s ease;
}
.monetization-entry-card:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(255, 138, 92, .45); }
.monetization-entry-card:active { transform: translateY(0); }
.monetization-entry-emoji { font-size: 26px; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.15)); }
.monetization-entry-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.monetization-entry-title { font-weight: 800; font-size: 15px; }
.monetization-entry-sub { font-size: 12px; opacity: .92; }
.monetization-entry-arrow { margin-left: auto; font-size: 22px; opacity: .85; flex-shrink: 0; }
body.dark .monetization-entry-card { box-shadow: 0 6px 18px rgba(0,0,0,.4); }

/* ================================================================
   ===== БЕСПЛАТНЫЙ PupsiCoin: экран баланса и подарков =====
   ================================================================ */
.free-coins-overlay { z-index: 100001; }
.free-coins-box { max-height: 90vh; overflow-y: auto; width: min(420px, 94vw); }

.free-coins-hero {
    background: var(--card-bg, #fff);
    border-radius: 22px;
    padding: 22px 18px 18px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(74, 63, 53, .08);
    margin: 10px 0 16px;
    position: relative;
    overflow: hidden;
}
.free-coins-label { font-weight: 600; font-size: 13px; opacity: .65; margin-bottom: 6px; }
.free-coins-amount {
    font-weight: 800; font-size: 38px; line-height: 1;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.free-coins-coin-emoji { font-size: 30px; filter: drop-shadow(0 2px 4px rgba(245,166,35,.35)); }
.free-coins-note {
    margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #C97B12;
    background: #FCE3B0; padding: 6px 14px; border-radius: 100px;
}

.free-coins-cooldown {
    background: var(--card-bg, #fff);
    border-radius: 22px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(74, 63, 53, .08);
    margin: 10px 0 16px;
}
.free-coins-cooldown-icon { font-size: 46px; margin-bottom: 8px; display: block; }
.free-coins-cooldown-title { font-weight: 800; font-size: 18px; margin-bottom: 6px; }
.free-coins-cooldown-sub { font-size: 13.5px; opacity: .7; line-height: 1.5; }

.free-coins-recipient {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 18px; background: var(--card-bg, #fff);
    border-radius: 16px; padding: 10px 14px;
    box-shadow: 0 3px 10px rgba(74,63,53,.05);
}
.free-coins-recipient-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #FFD3A8, #FF9D7A);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; flex-shrink: 0;
}
.free-coins-recipient-label { font-size: 11px; opacity: .6; font-weight: 700; }
.free-coins-recipient-name { font-size: 14.5px; font-weight: 700; }

.free-coins-pick-title {
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    margin: 4px 0 14px;
    background: linear-gradient(90deg, #FF8A73, #DCC9F0);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.free-coins-invite-switch {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent, #c9b09b);
    margin-bottom: 16px;
    cursor: pointer;
}
.free-coins-invite-switch:hover { text-decoration: underline; }

.free-coins-tier-section { margin-bottom: 18px; }
.free-coins-tier-title { font-weight: 700; font-size: 14.5px; margin-bottom: 8px; padding-left: 2px; }
.free-coins-tier-section.common .free-coins-tier-title { color: #6E93B8; }
.free-coins-tier-section.rare .free-coins-tier-title { color: #2E9C86; }
.free-coins-tier-section.epic .free-coins-tier-title { color: #8E5BC7; }
.free-coins-tier-section.legendary .free-coins-tier-title {
    background: linear-gradient(90deg, #FFC857, #FF7A59);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.free-coins-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.free-coins-grid.legendary { grid-template-columns: repeat(2, 1fr); }

.free-coins-gift-card {
    border-radius: 16px; padding: 12px 6px 9px; text-align: center;
    cursor: pointer; transition: transform .15s ease; border: 2px solid transparent;
    background: #EEF5FB;
}
.free-coins-gift-card:active { transform: scale(.94); }
.free-coins-gift-card.rare { background: #E7F8F4; box-shadow: 0 3px 10px rgba(94,201,180,.18); }
.free-coins-gift-card.epic {
    background: #F4EBFC; box-shadow: 0 4px 14px rgba(185,140,232,.28);
    border-color: rgba(185,140,232,.35);
}
.free-coins-gift-card.legendary {
    background: linear-gradient(160deg, #FFF6E8, #FFEFE0) padding-box,
                linear-gradient(135deg, #FFC857, #FF7A59) border-box;
    border: 2px solid transparent;
    box-shadow: 0 6px 18px rgba(255,122,89,.25);
    padding: 16px 8px 12px; position: relative;
}
.free-coins-gift-card.legendary::after {
    content: "✨"; position: absolute; top: 6px; right: 8px; font-size: 12px; opacity: .7;
}
.free-coins-gift-emoji { font-size: 28px; display: block; margin-bottom: 4px; }
.free-coins-gift-card.legendary .free-coins-gift-emoji { font-size: 36px; }
.free-coins-gift-title { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.free-coins-gift-price { font-size: 11px; font-weight: 800; opacity: .85; }
.free-coins-gift-card.legendary .free-coins-gift-price {
    background: linear-gradient(90deg, #FFC857, #FF7A59);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

body.dark .free-coins-hero,
body.dark .free-coins-cooldown,
body.dark .free-coins-recipient { background: #2a2a2e; }

.gift-invite-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #FFF6E8, #FFEFE0);
    border: 2px solid;
    border-image: linear-gradient(135deg, #FFC857, #FF7A59) 1;
    border-radius: 16px;
    padding: 12px 14px;
    margin: 0 0 14px;
    text-align: left;
    box-shadow: 0 4px 14px rgba(255,122,89,.2);
}
.gift-invite-emoji { font-size: 30px; flex-shrink: 0; }
.gift-invite-text { font-size: 13px; color: #4A3F35; line-height: 1.4; }
