* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Палитра, как на экране логина */
:root {
    --accent: #1f8ded;
    --accent-strong: #2563eb;
    --accent-secondary: #4f46e5;
    --accent-soft: rgba(37, 99, 235, 0.5);

    --bg-main: #020617;
    --bg-elevated: #020617;
    --bg-elevated-soft: rgba(15, 23, 42, 0.92);
    --bg-sidebar: #020617;
    --bg-sidebar-alt: rgba(15, 23, 42, 0.9);

    --border-subtle: rgba(148, 163, 184, 0.16);

    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-soft: #64748b;

    --danger: #ef4444;
    --danger-strong: #dc2626;
    --success: #22c55e;
}

/* Фон в стиле логина */
body {
    font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.18), transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(79, 70, 229, 0.25), transparent 55%),
        radial-gradient(circle at 50% 0%, rgba(15, 23, 42, 1), rgba(2, 6, 23, 1));
    position: relative;
}

/* Глобальная заставка при загрузке index.html (фон и логотип как на login.html) */
.app-loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    background:
        radial-gradient(circle at 10% 0%, rgba(31, 141, 237, 0.35), transparent 60%),
        radial-gradient(circle at 90% 100%, rgba(79, 70, 229, 0.35), transparent 55%),
        radial-gradient(circle at 50% 0%, #020617, #020617);
    animation: appLoadingFadeIn 0.25s ease-out;
}

.app-loading-inner {
    width: 100%;
    max-width: 420px;
    padding: 32px 24px 28px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid var(--border-subtle);
    box-shadow:
        0 22px 60px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.app-loading-logo svg {
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.7));
    animation: logoGlow 10s ease-in-out infinite;
}

.app-loading-text h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 4px;
}

.app-loading-text p {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

/* Спиннер как на login.html */
.app-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(148, 163, 184, 0.3);
    border-top-color: var(--accent);
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 22px rgba(37, 99, 235, 0.7);
    margin-top: 4px;
}

/* Пока идёт загрузка приложения, скрываем основной интерфейс под заставкой */
body.app-loading .server-list,
body.app-loading .channel-list,
body.app-loading .main-content {
    filter: blur(8px);
    opacity: 0;
    pointer-events: none;
}

/* Плавное появление заставки */
@keyframes appLoadingFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Лёгкий стеклянный слой */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.5;
    background:
        radial-gradient(circle at 30% 20%, rgba(56, 189, 248, 0.16), transparent 55%),
        radial-gradient(circle at 70% 80%, rgba(37, 99, 235, 0.18), transparent 55%);
    z-index: -1;
}

/* -------- SERVER LIST (левая колонка) -------- */

.server-list {
    width: 76px;
    /* Более «оригинальный» дискордовский тёмный столбец серверов */
    background: linear-gradient(180deg, #202225 0%, #111827 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 10px;
    overflow-y: auto;
    border-right: 1px solid #111827;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(18px);
}

.server-icon {
    width: 48px;
    height: 48px;
    background: radial-gradient(circle at 30% 0%, #020617, #020617);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    transition:
        border-radius 0.18s ease,
        background 0.18s ease,
        transform 0.16s ease,
        box-shadow 0.18s ease,
        color 0.18s ease;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 1);
}

.server-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 1px solid rgba(148, 163, 184, 0.1);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.server-icon:hover {
    border-radius: 18px;
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    color: #f9fafb;
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px rgba(37, 99, 235, 0.55),
        0 0 0 1px rgba(15, 23, 42, 1);
}

.server-icon:hover::before {
    opacity: 1;
}

.server-icon.home {
    background: radial-gradient(circle at 0 0, var(--accent-strong), var(--accent-secondary));
    color: #f9fafb;
    box-shadow:
        0 10px 26px rgba(37, 99, 235, 0.7),
        0 0 0 1px rgba(15, 23, 42, 1);
}

.server-icon.home.active {
    transform: translateY(-1px);
}

.server-separator {
    width: 32px;
    height: 2px;
    background: rgba(30, 64, 175, 0.45);
    border-radius: 999px;
}

/* -------- CHANNEL LIST / ДМ (вторая колонка) -------- */

.channel-list {
    width: 260px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(15, 23, 42, 0.96) 100%);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
    box-shadow: 8px 0 26px rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
}

.server-header {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 16px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.9);
    cursor: pointer;
    font-weight: 600;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.18), transparent 60%);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.server-header:hover {
    background:
        radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.25), transparent 60%),
        linear-gradient(180deg, rgba(15, 23, 42, 1) 0%, rgba(15, 23, 42, 0.96) 100%);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.85);
}

.server-name {
    font-size: 15px;
    color: var(--text-main);
}

.server-dropdown {
    font-size: 14px;
    color: var(--text-muted);
}

/* DМ + Channels view контейнеры */

.channels-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Сообщение об отсутствии медиа */
.no-media-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.92);
    border-radius: 12px;
    padding: 20px 24px;
    text-align: center;
    z-index: 10;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
}

/* Список каналов */

.channels-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.channel-category {
    margin-bottom: 16px;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 8px 8px 4px 8px;
    cursor: pointer;
    user-select: none;
}

.category-header svg {
    margin-right: 4px;
    color: var(--text-soft);
}

.category-header span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-soft);
    letter-spacing: 0.5px;
}

.channel {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: 8px;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.08s ease;
    color: var(--text-muted);
}

.channel:hover {
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.12), rgba(15, 23, 42, 0.98));
    color: var(--text-main);
    transform: translateY(-1px);
}

.channel.active {
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.24), rgba(15, 23, 42, 0.98));
    color: #f9fafb;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.9);
}

.channel svg {
    margin-right: 8px;
    flex-shrink: 0;
}

.channel span {
    font-size: 15px;
    font-weight: 500;
}

/* -------- USER PANEL (низ левой колонки) -------- */

.user-panel {
    height: 60px;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.98));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-top: 1px solid rgba(30, 41, 59, 1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #f9fafb;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 1), 0 8px 18px rgba(15, 23, 42, 0.9);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

/* Маленький кружок статуса (онлайн/занят/нб/оффлайн) */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-left: 6px;
    background-color: #4b5563; /* базовый серый */
}

/* внутренние цвета — переиспользуем и в друзьях, и в DM, и в заголовке чата */
.status-online {
    background-color: #22c55e; /* зелёный — онлайн */
}

.status-idle {
    background-color: #eab308; /* жёлтый — занят */
}

.status-dnd {
    background-color: #ef4444; /* красный — не беспокоить */
}

.status-offline {
    background-color: #4b5563; /* тёмно-серый — оффлайн */
}

.user-status {
    font-size: 12px;
    color: var(--text-soft);
}

.user-controls {
    display: flex;
    gap: 6px;
}

.control-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.08s ease,
        box-shadow 0.15s ease;
}

/* Иконки в user-panel наследуют currentColor */
.control-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Ховер — синий, как раньше */
.control-btn:hover {
    background-color: rgba(37, 99, 235, 0.18);
    color: var(--text-main);
    transform: translateY(-1px);
}

/* Активное состояние (mute/deafen) — стиль, как в call-controls-main */
.control-btn.active {
    background: radial-gradient(circle at 0 0, var(--danger), var(--danger-strong));
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
    transform: translateY(-1px);
}

.control-btn.active:hover {
    background: radial-gradient(circle at 0 0, var(--danger-strong), #b91c1c);
    color: #ffffff;
}

/* -------- MAIN CONTENT -------- */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 0%, rgba(15, 23, 42, 0.95), #020617 55%);
    position: relative;
}

/* Chat / Friends */

.chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative; /* нужно для абсолютного позиционирования окна звонка поверх сообщений */
}

.friends-welcome-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-soft);
}

.friends-welcome-content h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-main);
}

.friends-welcome-content p {
    font-size: 16px;
    line-height: 1.6;
}

/* Header в чате/друзьях */

.chat-header {
    height: 52px;
    border-bottom: 1px solid rgba(30, 41, 59, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.11), rgba(15, 23, 42, 0.98));
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-info svg {
    color: var(--text-soft);
}

.channel-info span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.chat-controls {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, transform 0.08s ease;
}

.icon-btn:hover {
    color: var(--text-main);
    transform: translateY(-1px);
}

/* -------- MESSAGES -------- */

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Индикатор "собеседник набирает..." под хедером чата */
.typing-indicator {
    min-height: 18px;
    padding: 2px 16px 4px;
    font-size: 13px;
    color: var(--text-soft);
    font-style: italic;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transform: translateY(-2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.typing-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.typing-indicator::after {
    content: '• • •';
    letter-spacing: 2px;
    font-size: 16px;
    animation: typingDots 1s infinite ease-in-out;
}

@keyframes typingDots {
    0%   { opacity: 0.2; transform: translateY(0); }
    50%  { opacity: 1;   transform: translateY(-1px); }
    100% { opacity: 0.2; transform: translateY(0); }
}

.message-group {
    display: flex;
    padding: 2px 0;
    transition: background-color 0.1s ease;
    animation: fadeIn 0.2s ease;
    border-radius: 8px;
}

.message-group:hover {
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.05), rgba(15, 23, 42, 0.98));
}

/* ---------- СИСТЕМНЫЕ СООБЩЕНИЯ (НАПР. НАЧАЛО/КОНЕЦ ЗВОНКА) ---------- */
.system-message {
    display: flex;
    justify-content: center;
    margin: 10px 0;
    animation: fadeIn 0.2s ease;
}

.system-message-inner {
    max-width: 60%;
    padding: 6px 14px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
}

/* Чужие сообщения — слева */
.message-group.incoming-message {
    justify-content: flex-start;
}

/* Мои сообщения — справа */
.message-group.own-message {
    justify-content: flex-end;
}

/* контент сообщения */
.message-group.incoming-message .message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.message-group.own-message .message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-header {
    display: flex;
    align-items: baseline;
    margin-bottom: 4px;
}

.message-author {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-right: 8px;
}

.message-timestamp {
    font-size: 12px;
    color: var(--text-soft);
}


/* Сам «бабл» — полупрозрачный, с блюром */
.message-bubble {
    position: relative;
    display: inline-block;
    margin-top: 2px;
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(30, 41, 59, 0.9);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.85);
}

/* Чужие баблы — более спокойные */
.message-group.incoming-message .message-bubble {
    border-color: rgba(51, 65, 85, 1);
}

/* Мои баблы — акцентные */
.message-group.own-message .message-bubble {
    background: radial-gradient(
        circle at 0 0,
        rgba(37, 99, 235, 0.7),
        rgba(15, 23, 42, 0.96)
    );
    border-color: var(--accent-strong);
}
.message-text {
    font-size: 15px;
    line-height: 1.4;
    color: var(--text-main);
    word-wrap: break-word;
}
/* -------- MESSAGE INPUT -------- */

.message-input-container {
    padding: 16px;
}

.message-input-wrapper {
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.96));
    border-radius: 999px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(30, 41, 59, 1);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.95);
}

.attach-btn,
.voice-btn,
.gif-btn,
.emoji-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    transition: color 0.15s ease, transform 0.08s ease;
}

.attach-btn:hover,
.voice-btn:hover,
.gif-btn:hover,
.emoji-btn:hover {
    color: var(--text-main);
    transform: translateY(-1px);
}

.voice-btn.recording {
    color: var(--danger);
    animation: pulse 1.5s infinite;
}

.gif-btn {
    font-weight: 600;
    font-size: 12px;
    padding: 8px 4px;
    border-radius: 4px;
    background: linear-gradient(45deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
    color: white;
    min-width: 32px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 15px;
    padding: 11px 0;
}

#messageInput::placeholder {
    color: var(--text-soft);
}

/* -------- CALL INTERFACE -------- */

/* Окно звонка теперь плавающее поверх сообщений и не занимает место в потоке */
.call-interface {
    position: absolute;
    top: 60px;                 /* чуть ниже header чата */
    left: 50%;
    transform: translateX(-50%);
    width: min(900px, calc(100% - 32px));
    max-width: 100%;
    min-width: 0;
    margin: 0;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.97));
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.9);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(14px);
    z-index: 1000;             /* поверх сообщений и инпута */
}

.call-interface.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
}

.call-interface.hidden {
    display: none;
}

@keyframes callSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.call-header {
    height: 56px;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.4), rgba(15, 23, 42, 0.98));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    cursor: move;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom: 1px solid rgba(30, 41, 59, 1);
    position: relative;
    z-index: 2; /* всегда поверх плиток с видео */
}

.call-channel-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
}

.close-call-btn {
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.12);
    border: none;
    color: var(--danger);
    font-size: 22px;
    cursor: pointer;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-call-btn:hover {
    background-color: var(--danger);
    color: white;
    transform: scale(1.05);
}

.call-participants {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    padding: 16px;
    gap: 12px;
    overflow-y: auto;
    max-height: 600px;
    min-height: 280px;
    position: relative; /* база для оверлеев и z-index */
    z-index: 1;
}

.participant {
    position: relative;
    width: 100%;
    min-width: 150px;
    min-height: 100px;
    aspect-ratio: 16/9;
    background: radial-gradient(circle at 0 0, #020617, #020617);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.95);
    resize: both;
    transition: opacity 0.3s ease, transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid rgba(30, 41, 59, 1);
}

.participant:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.98);
}

.participant.screen-share {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16/9;
}

.participant video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

/* Плейсхолдер когда нет картинки с камеры */
.participant-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    text-align: center;
    background: radial-gradient(circle at 0 0, #020617, #020617);
    color: var(--text-soft);
}

.participant-placeholder .no-camera-icon svg {
    width: 28px;
    height: 28px;
}

.participant-placeholder .no-camera-text {
    font-size: 12px;
}

.participant.minimized {
    width: 120px;
    height: 90px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    cursor: pointer;
}

.participant.maximized {
    /* Максимизация внутри области участников, не перекрывая хедер и нижние кнопки звонка */
    grid-column: 1 / -1;
    width: 100% !important;
    height: 100% !important;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    z-index: 1; /* остаётся под .call-header и .call-controls-main (z-index: 2) */
}

.participant-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background-color: rgba(15, 23, 42, 0.8);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.participant-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
}

.call-controls-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: radial-gradient(circle at 50% 0, rgba(37, 99, 235, 0.3), rgba(15, 23, 42, 0.98));
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    position: relative;
    z-index: 2; /* панель управления всегда поверх видео */
}

.call-control-btn {
    width: 48px;
    height: 48px;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.96));
    border: none;
    border-radius: 999px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(30, 41, 59, 1);
}

.call-control-btn:hover {
    background: radial-gradient(circle at 0 0, var(--accent-strong), var(--accent-secondary));
    color: white;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.65);
}

.call-control-btn.active {
    background: radial-gradient(circle at 0 0, var(--danger), var(--danger-strong));
    color: white;
}

.call-control-btn.screen-active {
    background: radial-gradient(circle at 0 0, #22c55e, #16a34a);
    color: white;
}

.call-control-btn svg {
    width: 24px;
    height: 24px;
}

/* Указатели размера видео */

.video-size-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.participant:hover .video-size-controls {
    opacity: 1;
}

.size-control-btn {
    width: 28px;
    height: 28px;
    background: rgba(15, 23, 42, 0.9);
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.size-control-btn:hover {
    background: rgba(37, 99, 235, 0.85);
    color: white;
}

/* Speaking Indicator */
.participant.speaking {
    border: 2px solid rgba(34, 197, 94, 0.85);
    box-shadow: 0 0 26px rgba(34, 197, 94, 0.6);
}

.participant.speaking .participant-name {
    background-color: rgba(34, 197, 94, 0.9);
}

/* -------- INCOMING CALL -------- */

.incoming-call {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90vw;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.97));
    border-radius: 18px;
    padding: 28px 26px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.98);
    z-index: 2000;
    animation: incomingCallPulse 0.4s ease;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(18px);
}

.incoming-call.hidden {
    display: none;
}

@keyframes incomingCallPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.86);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.03);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.incoming-call-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.caller-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.caller-avatar {
    width: 82px;
    height: 82px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, var(--accent-strong), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.95);
    animation: callerAvatarPulse 2s infinite;
}

@keyframes callerAvatarPulse {
    0%, 100% {
        box-shadow: 0 10px 26px rgba(37, 99, 235, 0.35);
    }
    50% {
        box-shadow: 0 14px 34px rgba(37, 99, 235, 0.6);
    }
}

.caller-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.incoming-call-content p {
    font-size: 15px;
    color: var(--text-soft);
    margin-bottom: 22px;
}

.incoming-call-actions {
    display: flex;
    gap: 16px;
}

.call-action-btn {
    padding: 11px 26px;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.9);
}

.call-action-btn.accept {
    background: radial-gradient(circle at 0 0, #22c55e, #16a34a);
    color: white;
}

.call-action-btn.accept:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 18px 40px rgba(34, 197, 94, 0.55);
}

.call-action-btn.reject {
    background: radial-gradient(circle at 0 0, var(--danger), var(--danger-strong));
    color: white;
}

.call-action-btn.reject:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 18px 40px rgba(239, 68, 68, 0.5);
}

/* Overlay для звонка */

.call-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.88);
    z-index: 999;
    backdrop-filter: blur(6px);
}

.call-overlay.hidden {
    display: none;
}

/* -------- FRIENDS / DM / ADD FRIEND -------- */

.dm-list-view {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.dm-search-bar {
    padding: 10px 8px;
}

.dm-search-bar input {
    width: 100%;
    background-color: rgba(15, 23, 42, 1);
    border: 1px solid rgba(30, 41, 59, 1);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.dm-search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
    background-color: rgba(15, 23, 42, 0.98);
}

.dm-list .channel {
    padding-left: 20px;
    position: relative;
}

/* Строка имени DM + иконки/бейджи */
.dm-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Явный триггер для mute-меню рядом с ником (работает и на мобильной, и на ПК) */
.dm-mute-trigger {
    background: none;
    border: none;
    color: var(--text-soft);
    cursor: pointer;
    padding: 0 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    transition:
        color 0.15s ease,
        background-color 0.15s ease,
        transform 0.08s ease;
}

.dm-mute-trigger:hover {
    color: var(--text-main);
    background-color: rgba(37, 99, 235, 0.16);
    transform: translateY(-1px);
}

.dm-mute-trigger svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Кружок с количеством непрочитанных DM */
.dm-unread-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, var(--accent-strong), var(--accent-secondary));
    color: #f9fafb;
    font-size: 11px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 1), 0 6px 16px rgba(15, 23, 42, 0.9);
}

.dm-unread-badge.visible {
    display: inline-flex;
}

/* Иконка mute для заглушённого собеседника */
.dm-muted-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    opacity: 0;
    color: var(--text-soft);
    transition: opacity 0.15s ease, color 0.15s ease;
}

.dm-muted-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Показываем значок только когда пользователь реально заглушён */
.dm-muted-icon.active {
    opacity: 1;
    color: var(--accent-secondary);
}

/* Всплывающее меню заглушения DM */
.dm-mute-menu {
    position: fixed;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 10px;
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.98);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
}

.dm-mute-menu-header {
    padding: 8px 12px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid rgba(30, 41, 59, 1);
    margin-bottom: 4px;
}

.dm-mute-menu button {
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: var(--text-soft);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dm-mute-menu button:hover {
    background-color: rgba(37, 99, 235, 0.16);
    color: var(--text-main);
}

.friends-main-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.friends-header {
    height: 52px;
    border-bottom: 1px solid rgba(30, 41, 59, 1);
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.12), rgba(15, 23, 42, 0.98));
}

.friends-tabs {
    display: flex;
    gap: 8px;
}

.friends-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.friends-tab:hover {
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-main);
}

.friends-tab.active {
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.5), rgba(15, 23, 42, 0.98));
    color: #f9fafb;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
}

/* Кружок‑счётчик для Pending */
.friends-pending-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.3); /* мягкий серый */
    color: var(--text-main);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

/* Если нет числа — кружок не показываем */
.friends-pending-count:empty {
    display: none;
}

.friends-content-wrapper {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.friends-list {
    display: none;
    padding: 16px;
}

.friends-list.active-tab {
    display: block;
}

.friends-empty {
    text-align: center;
    color: var(--text-soft);
    padding: 40px 20px;
    font-size: 14px;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    background-color: rgba(15, 23, 42, 0.95);
    transition: background-color 0.18s ease, transform 0.08s ease, box-shadow 0.18s ease;
    border: 1px solid rgba(30, 41, 59, 1);
}

.friend-item:hover {
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.14), rgba(15, 23, 42, 0.98));
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.95);
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 1), 0 10px 26px rgba(15, 23, 42, 0.9);
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.friend-status {
    font-size: 12px;
    color: var(--success);
}

.friend-status.offline {
    color: var(--text-soft);
}

.friend-actions {
    display: flex;
    gap: 8px;
}

.friend-action-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.18s ease;
}

/* DM call buttons — стиль как у friend-action-btn audio/video */
.icon-btn.dm-audio-call-btn,
.icon-btn.dm-video-call-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.18s ease;
    box-shadow: none;
    padding: 0;
}

.friend-action-btn:hover {
    background: rgba(37, 99, 235, 0.16);
    color: var(--text-main);
}

/* hover такой же */
.icon-btn.dm-audio-call-btn:hover,
.icon-btn.dm-video-call-btn:hover {
    background: rgba(37, 99, 235, 0.16);
    color: var(--text-main);
    transform: translateY(-1px);
}

.friend-action-btn.accept {
    background: radial-gradient(circle at 0 0, #22c55e, #16a34a);
    color: white;
}

.friend-action-btn.accept:hover {
    background: radial-gradient(circle at 0 0, #16a34a, #15803d);
}

.friend-action-btn.reject {
    background: radial-gradient(circle at 0 0, var(--danger), var(--danger-strong));
    color: white;
}

.friend-action-btn.reject:hover {
    background: radial-gradient(circle at 0 0, var(--danger-strong), #b91c1c);
}

/* Add Friend Form */

.add-friend-form {
    padding: 20px;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.97));
    border-radius: 16px;
    border: 1px solid rgba(30, 41, 59, 1);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.95);
}

.add-friend-form h3 {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 600;
}

.add-friend-form p {
    font-size: 14px;
    color: var(--text-soft);
    margin-bottom: 16px;
}

.add-friend-input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-friend-input-wrapper input {
    flex: 1;
    background-color: rgba(15, 23, 42, 1);
    border: 1px solid rgba(30, 41, 59, 1);
    border-radius: 999px;
    color: var(--text-main);
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.add-friend-input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.5);
    background-color: rgba(15, 23, 42, 0.98);
}

.add-friend-input-wrapper button {
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.95);
}

.add-friend-input-wrapper button:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

/* Результаты поиска друзей */

#searchResults {
    margin-top: 16px;
}

.user-search-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    background-color: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(30, 41, 59, 1);
}

.user-search-item .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    margin-right: 12px;
}

.user-search-item .user-info {
    flex: 1;
}

.user-search-item .user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.user-search-item .add-friend-btn {
    background: radial-gradient(circle at 0 0, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.08s ease;
}

.user-search-item .add-friend-btn:hover {
    transform: translateY(-1px);
}

.user-search-item .add-friend-btn:disabled {
    background-color: #4b5563;
    cursor: not-allowed;
}

/* -------- FILE ATTACHMENTS / REACTIONS -------- */

.file-attachment {
    display: flex;
    align-items: center;
    background-color: rgba(15, 23, 42, 0.95);
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    gap: 12px;
    border: 1px solid rgba(30, 41, 59, 1);
}

.file-icon {
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

.file-size {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
}

.file-download {
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.18s ease;
}

.file-download:hover {
    filter: brightness(1.05);
}

.message-reaction-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.message-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Реакции делаем чуть более «выделенными» */
.reaction {
    background-color: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.18s ease;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 1), 0 6px 16px rgba(15, 23, 42, 0.9);
}

.reaction:hover {
    background-color: rgba(15, 23, 42, 1);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.reaction span {
    font-size: 12px;
    color: var(--text-soft);
}

/* Плюсик для добавления реакции — компактный и рядом с реакциями */
.add-reaction-btn {
    background-color: transparent;
    border: 1px dashed var(--accent-soft);
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    padding: 0;
    width: 22px;
    height: 22px;
    cursor: pointer;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.08s ease,
        color 0.18s ease,
        border-color 0.18s ease;
}

.add-reaction-btn:hover {
    background-color: rgba(37, 99, 235, 0.16);
    box-shadow: 0 0 0 1px var(--accent-soft);
    transform: translateY(-1px);
}

/* Emoji Picker */

.emoji-picker {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: rgba(15, 23, 42, 0.97);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.98);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 300px;
    z-index: 1000;
    animation: slideInUp 0.2s ease;
    border: 1px solid rgba(30, 41, 59, 1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji-option {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.18s ease;
}

.emoji-option:hover {
    background-color: rgba(37, 99, 235, 0.2);
}

/* Voice channel in-call */
.voice-channel.in-call {
    background-color: rgba(34, 197, 94, 0.9);
    color: white;
}

.voice-channel.in-call:hover {
    background-color: rgba(22, 163, 74, 0.95);
}

/* Permissions button (камера/микрофон) */

.permissions-btn {
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 999px;
    cursor: pointer;
    margin: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.18s ease;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.95);
}

.permissions-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* Scrollbars */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 1);
}

::-webkit-scrollbar-thumb {
    background: rgba(30, 41, 59, 1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(51, 65, 85, 1);
}

/* Анимации */

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------- GIF MESSAGE STYLES -------- */

.gif-message-container {
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--accent-strong);
    position: relative;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.message-group.incoming-message .gif-message-container {
    border: 1px solid rgba(30, 41, 59, 0.9);
}

.gif-message-container img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.gif-timestamp {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 11px;
    backdrop-filter: blur(10px);
    z-index: 2;
}

/* Убираем ограничения высоты для сообщений с GIF */
.message-group .message-content {
    max-width: none !important;
}

.message-group.own-message .message-content,
.message-group.incoming-message .message-content {
    max-width: 80% !important;
}

/* -------- GIF PICKER STYLES -------- */

#gifPicker {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: var(--bg-sidebar);
    border-radius: 12px;
    padding: 16px;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(18px);
}

#gifPicker::-webkit-scrollbar {
    width: 6px;
}

#gifPicker::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 3px;
}

#gifPicker::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.6);
    border-radius: 3px;
}

#gifPicker::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.8);
}

.gif-option {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(30, 41, 59, 0.5);
}

.gif-option:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.gif-option img {
    width: 100%;
    height: auto;
    display: block;
}

/* -------- VOICE MESSAGE STYLES -------- */

.voice-message-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.7), rgba(15, 23, 42, 0.96));
    border-radius: 18px;
    border: 1px solid var(--accent-strong);
    min-width: 200px;
    cursor: pointer;
    backdrop-filter: blur(12px);
}

.voice-message-bubble:not(.own-message .voice-message-bubble) {
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(30, 41, 59, 0.9);
}

/* -------- MEDIA DEVICE FALLBACK STYLES -------- */

.media-fallback-message {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    text-align: center;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.9);
}

.media-fallback-message p {
    margin-bottom: 12px;
    color: var(--text-main);
}

/* -------- ACCOUNT SETTINGS MODAL -------- */

.account-settings-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
}

.account-settings-modal.hidden {
    display: none;
}

.account-settings-content {
    width: min(720px, 96vw);
    max-height: 80vh;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.97));
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.98);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.account-settings-header {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(30, 41, 59, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.18), rgba(15, 23, 42, 0.98));
}

.account-settings-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.account-settings-close {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.account-settings-close:hover {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.account-settings-body {
    padding: 16px 20px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Вкладки настроек аккаунта */

.account-tabs {
    display: flex;
    gap: 8px;
    padding: 2px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
    border: 1px solid rgba(30, 41, 59, 1);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.9);
    margin-bottom: 10px;
}

.account-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.account-tab:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.96);
}

.account-tab.active {
    color: #f9fafb;
    background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.65), rgba(15, 23, 42, 0.98));
    box-shadow: 0 10px 26px rgba(15, 23, 42, 1);
}

.account-tabs-content {
    margin-top: 4px;
}

.account-tab-panel {
    display: none;
    animation: fadeIn 0.18s ease;
}

.account-tab-panel.active {
    display: block;
}

.actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

/* блок выбора устройств — чуть дальше от кнопок */

.device-select-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.account-section {
    padding: 14px 14px 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(30, 41, 59, 1);
}

.account-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}

.account-profile-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.account-avatar-preview {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, var(--accent-strong), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: #f9fafb;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.95);
    flex-shrink: 0;
}

.account-profile-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-row label {
    font-size: 12px;
    color: var(--text-soft);
}

.field-row input,
.field-row textarea {
    background-color: rgba(15, 23, 42, 1);
    border: 1px solid rgba(30, 41, 59, 1);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--text-main);
    outline: none;
    resize: vertical;
    min-height: 32px;
}

.field-row textarea {
    min-height: 56px;
}

.field-row input:focus,
.field-row textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
}

/* devices */

.devices-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.device-row {
    display: flex;
    gap: 6px;
    font-size: 13px;
}

.device-label {
    width: 70px;
    color: var(--text-soft);
}

.device-value {
    flex: 1;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.device-test-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.mic-level-indicator {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-soft);
    min-width: 180px;
}

.mic-level-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 1);
    overflow: hidden;
}

.mic-level-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
    transition: width 0.1s linear;
}

.mic-settings-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mic-settings-row input[type="range"] {
    width: 100%;
}

.primary-btn {
    background: radial-gradient(circle at 0 0, var(--accent), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.95);
    white-space: nowrap;
}

.primary-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.danger-btn {
    background: radial-gradient(circle at 0 0, var(--danger), var(--danger-strong));
    color: white;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.95);
}

.danger-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.device-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.device-option {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--accent-soft);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
}

.device-option:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--accent);
}

.device-option.selected {
    background: rgba(37, 99, 235, 0.3);
    border-color: var(--accent-strong);
}
