/* =======================================================
   DISCORD-CLONE — SOFT BLUR (LESS GLASS) FULL CSS (REPLACEMENT)
   ======================================================= */

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

/* ---------------------------
   Theme tokens (Soft Blur)
--------------------------- */
:root{
    --bg-0:#0a0f18;
    --bg-1:#0c1322;

    /* было "стекло" -> стало "матовая поверхность" */
    --glass: rgba(16, 20, 30, .86);
    --glass-2: rgba(16, 20, 30, .76);
    --glass-strong: rgba(16, 20, 30, .92);

    /* границы мягче */
    --stroke: rgba(255,255,255,.08);
    --stroke-soft: rgba(255,255,255,.05);

    --text: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.62);
    --muted-2: rgba(255,255,255,.48);

    --shadow: 0 18px 60px rgba(0,0,0,.55);
    --shadow-soft: 0 10px 26px rgba(0,0,0,.38);

    /* blur помягче */
    --blur: 12px;
    --blur-2: 16px;

    --accent: #8b5cf6;   /* violet */
    --accent-rgb: 139, 92, 246;   /* rgb for rgba() usage */
    --accentB: #60a5fa;  /* blue */
    --accent-light: #e0a8ff;  /* light violet for code */
    --accent-transparent: rgba(139, 92, 246, .26);
    --accentB-transparent: rgba(96, 165, 250, .16);
    --accent-hover-bg: rgba(139, 92, 246, .26);

    /* ✅ ДОБАВЛЕНО: недостающие токены (используются ниже) */
    --accent-border-focus: rgba(139, 92, 246, .55);
    --accent-shadow-focus: rgba(139, 92, 246, .18);
    --accent-reaction-hover: rgba(139, 92, 246, .32);

    --good: #22c55e;
    --danger: #ef4444;

    --r-8: 8px;
    --r-10: 10px;
    --r-12: 12px;
    --r-14: 14px;
    --r-16: 16px;
}

html, body { height: 100%; }
body { color-scheme: dark; }

/* ---------------------------
   App background scene
--------------------------- */
body {
    font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;

    background:
        radial-gradient(1200px 800px at 15% 20%, rgba(139,92,246,.18), transparent 55%),
        radial-gradient(900px 700px at 85% 10%, rgba(96,165,250,.14), transparent 55%),
        radial-gradient(900px 700px at 75% 85%, rgba(34,197,94,.10), transparent 60%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
    position: relative;
}

/* soft glow (чуть тише) */
body::before{
    content:"";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 30%, rgba(255,255,255,.045), transparent 45%),
        radial-gradient(circle at 82% 18%, rgba(255,255,255,.040), transparent 40%),
        radial-gradient(circle at 72% 82%, rgba(255,255,255,.040), transparent 45%);
    filter: blur(16px);
    opacity: .75;
    z-index: 0;
}

/* subtle grid (чуть тише) */
body::after{
    content:"";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255,255,255,.030) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
    background-size: 46px 46px;
    opacity: .12;
    z-index: 0;
}

/* keep app above background */
.server-list,
.channel-list,
.main-content,
.call-interface,
.incoming-call,
.emoji-picker-full{
    position: relative;
    z-index: 1;
}

/* ---------------------------
   Common surfaces (Soft blur, no “glass”)
--------------------------- */
.server-list,
.channel-list,
.main-content,
.user-panel,
.chat-header,
.server-header,
.message-input-wrapper,
.call-interface,
.incoming-call,
.emoji-picker-full{
    background: var(--glass-2);
    border: 1px solid var(--stroke-soft);
    box-shadow: var(--shadow-soft);

    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
    .server-list,
    .channel-list,
    .main-content,
    .user-panel,
    .chat-header,
    .server-header,
    .message-input-wrapper,
    .call-interface,
    .incoming-call,
    .emoji-picker-full{
        background: rgba(16, 20, 30, .92);
    }
}

/* =======================================================
   DM List
   ======================================================= */
.server-list {
    width: 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
    gap: 10px;
    overflow-y: auto;

    border-right: 1px solid rgba(255,255,255,.05);
}

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 10px 22px rgba(0,0,0,.35);

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-radius .18s ease, box-shadow .18s ease, color .18s ease;
    color: rgba(255,255,255,.82);
    position: relative;
}

.server-icon:hover {
    border-radius: 16px;
    background: var(--accent-hover-bg);
    box-shadow: 0 16px 32px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08) inset;
    transform: translateY(-1px);
    color: #fff;
}

.server-icon.home {
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 16px 34px rgba(0,0,0,.48);
    color: #fff;
}

.server-icon.friend-avatar-server {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 10px 22px rgba(0,0,0,.35);
    color: rgba(255,255,255,.82);
    margin-right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.server-icon.friend-avatar-server .friend-avatar-content {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 10px 18px rgba(0,0,0,.35);
}

.server-icon.friend-avatar-server:hover {
    border-radius: 16px;
    background: var(--accent-hover-bg);
    box-shadow: 0 16px 32px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08) inset;
    transform: translateY(-1px);
    color: #fff;
}

.server-icon.friend-avatar-server:hover .friend-avatar-content {
    background: var(--accent);
    transform: translateY(-1px);
}

/* =======================================================
   DM List
   ======================================================= */
.channel-list {
    width: 260px;
    display: flex;
    flex-direction: column;

    border-right: 1px solid rgba(255,255,255,.05);
}

.server-header {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;

    border-bottom: 1px solid rgba(255,255,255,.06);
    background: var(--glass);

    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
}

.server-header:hover {
    background: rgba(16, 20, 30, .82);
}

.server-name {
    font-size: 16px;
    color: var(--text);
}

.channel {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin: 3px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, transform .14s ease, box-shadow .14s ease;
    color: var(--muted);
}

.channel:hover {
    background: rgba(255,255,255,.06);
    color: var(--text);
}

.channel.active {
    background: linear-gradient(135deg, var(--accent-transparent), var(--accentB-transparent));
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 10px 18px rgba(0,0,0,.28);
    color: #fff;
}

.channel svg {
    margin-right: 8px;
    flex-shrink: 0;
    color: rgba(255,255,255,.55);
}

.channel.active svg,
.channel:hover svg {
    color: rgba(255,255,255,.80);
}

.channel span {
    font-size: 16px;
    font-weight: 500;
}

/* Системный канал - Новости */
.system-channel {
    background: linear-gradient(135deg, rgba(234, 138, 21, 0.15), rgba(255, 140, 0, 0.08));
    border: 1px solid rgba(255, 140, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 8px;
}

.system-channel:hover {
    background: linear-gradient(135deg, rgba(234, 138, 21, 0.25), rgba(255, 140, 0, 0.15));
    border-color: rgba(255, 140, 0, 0.5);
}

.system-channel.active {
    background: linear-gradient(135deg, rgba(234, 138, 21, 0.3), rgba(255, 140, 0, 0.2));
    border-color: rgba(255, 140, 0, 0.6);
    box-shadow: 0 8px 16px rgba(255, 140, 0, 0.2);
}

.system-channel .channel-icon {
    color: #ff8c00;
    margin-right: 8px;
}

.system-channel .channel-name {
    font-weight: 600;
    color: #ffaa33;
}

/* Сообщения новостей */
.news-message {
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.08), rgba(234, 138, 21, 0.05));
    border-left: 3px solid #ff8c00;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

.news-message:hover {
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.12), rgba(234, 138, 21, 0.08));
}

.news-message .message-avatar {
    background: linear-gradient(135deg, #ff8c00, #ffaa33) !important;
    font-size: 20px;
}

.news-message .message-author {
    color: #ffaa33 !important;
    font-weight: 600;
}

.news-message ul {
    margin: 8px 0;
    padding-left: 20px;
}

.news-message li {
    margin: 4px 0;
}

/* Статусы загрузки сообщений */
.loading-messages,
.error-messages,
.no-messages {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--muted);
    font-size: 14px;
}

.error-messages {
    color: #ff4444;
}

.loading-messages {
    color: #888;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 8px 8px 4px 8px;
    cursor: pointer;
    user-select: none;
}

.category-header svg {
    margin-right: 6px;
    color: var(--muted-2);
}

.category-header span {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted-2);
    letter-spacing: 0.6px;
}

.friend-avatar.self-chat-icon .friend-avatar-content {
    background: linear-gradient(135deg, rgba(255,215,0,.95), rgba(255,140,0,.85)) !important;
}

.server-icon.friend-avatar-server.self-chat-icon .friend-avatar-content {
    background: linear-gradient(135deg, rgba(255,215,0,.95), rgba(255,140,0,.85)) !important;
}

/* =======================================================
   User Panel
   ======================================================= */
.user-panel {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;

    background: var(--glass);
    border-top: 1px solid rgba(255,255,255,.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar .user-avatar-content {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,.35);
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.username {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.user-status {
    font-size: 12px;
    color: var(--muted-2);
}

.user-controls {
    display: flex;
    gap: 0;
}

.control-btn {
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    border-radius: 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    color: var(--muted);
    transition: transform .14s ease, background-color .14s ease, color .14s ease;
}

.control-btn svg {
    width: 15px;
    height: 15px;
}

.control-btn:hover {
    background: rgba(255,255,255,.07);
    color: var(--text);
    transform: translateY(-1px);
}

/* Бейдж уведомлений на кнопке */
.control-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: notification-pulse 2s infinite;
}

/* Бейдж непрочитанных в DM списке */
.dm-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    z-index: 2;
}

@keyframes notification-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Модальное окно уведомлений */
.notifications-panel {
    position: absolute;
    top: 50px;
    right: 10px;
    width: 360px;
    max-height: 500px;
    background: var(--glass-strong);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--stroke);
    border-radius: var(--r-12);
    box-shadow: var(--shadow);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notifications-panel.active {
    display: flex;
}

.notifications-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--stroke);
}

.notifications-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.notifications-panel-actions {
    display: flex;
    gap: 8px;
}

.notifications-panel-actions button {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.notifications-panel-actions button:hover {
    background: rgba(255,255,255,.07);
    color: var(--text);
}

.notifications-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.notifications-panel-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--muted-2);
    font-size: 14px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: var(--r-8);
    margin-bottom: 8px;
    background: rgba(255,255,255,.03);
    transition: background-color 0.14s ease;
}

.notification-item:hover {
    background: rgba(255,255,255,.06);
}

.notification-item.unread {
    background: rgba(139, 92, 246, 0.1);
    border-left: 3px solid var(--accent);
}

.notification-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.notification-item-icon.message {
    background: rgba(139, 92, 246, 0.2);
}

.notification-item-icon.call {
    background: rgba(34, 197, 94, 0.2);
}

.notification-item-icon.missed-call {
    background: rgba(239, 68, 68, 0.2);
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.notification-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.notification-item-time {
    font-size: 11px;
    color: var(--muted-2);
}

.notification-item-text {
    font-size: 13px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notification-item-actions button {
    flex: 1;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.14s ease, transform 0.1s ease;
}

.notification-item-actions button:hover {
    transform: translateY(-1px);
}

.notification-item-actions button.call-back {
    background: var(--accent-transparent);
    color: var(--accent-light);
}

.notification-item-actions button.call-back:hover {
    background: rgba(139, 92, 246, 0.35);
}

.notification-item-actions button.dismiss {
    background: rgba(255,255,255,.07);
    color: var(--muted);
}

.notification-item-actions button.dismiss:hover {
    background: rgba(255,255,255,.12);
}

/* =======================================================
   Main Content
   ======================================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;

    /* ✅ ПРИВЕДЕНО К ЕДИНОМУ: без отдельного "случайного" rgba */
    background: var(--glass-2);
    position: relative;
}

.chat-view,
#chatView {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.friends-welcome-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: rgba(255,255,255,.45);
}

.friends-welcome-content h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text);
}

.friends-welcome-content p {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255,255,255,.65);
}

/* header */
.chat-header {
    height: 54px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;

    background: var(--glass);
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-info svg {
    color: var(--muted-2);
}

.channel-info span {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.chat-controls {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: color 0.15s, background .15s, transform .14s ease;
}

.icon-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,.06);
    transform: translateY(-1px);
}

/* =======================================================
   Messages
   ======================================================= */
.messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Важно для flex-контейнера с прокруткой */
}

/* Исправление прокрутки для Firefox */
.messages {
    scrollbar-width: thin;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Сообщение канала/новостей */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    margin: 4px 0;
    flex-shrink: 0; /* Важно: сообщения не должны сжиматься */
}

.message-group {
    margin-bottom: 14px;
    display: flex;
    padding: 8px 14px;
    border-radius: 14px;
    transition: background-color 0.12s;
}

.message-group:hover {
    background: rgba(255,255,255,.040);
}

.message-text.user-message-text:not(:empty) {
    background: linear-gradient(135deg, var(--accent-transparent), var(--accentB-transparent));
    padding: 8px 12px;
    border-radius: 8px;
    display: inline-block;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    margin-right: 14px;
    flex-shrink: 0;
    box-shadow: 0 10px 18px rgba(0,0,0,.35);
}

.message-content {
    flex: 1;
    min-width: 0; /* Важно для flex-контейнера с прокруткой */
}

.message-header {
    display: flex;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 8px;
}

.message-author {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.message-timestamp {
    font-size: 12px;
    color: rgba(255,255,255,.38);
}

.message-text {
    font-size: 16px;
    line-height: 1.375;
    color: rgba(255,255,255,.82);
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.message-text > div:not(.md-paragraph):not(.md-code-block-delimiter) {
    display: inline;
    margin: 0;
    padding: 0;
}

.message-text > div[align] {
    display: block !important;
    margin: 8px 0;
}

/* ======= Markdown Styles ======= */

/* Headers */
.md-header {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin: 12px 0 8px 0;
    line-height: 1.4;
}

.md-h1 { font-size: 1.5em; }
.md-h2 { font-size: 1.35em; }
.md-h3 { font-size: 1.2em; }
.md-h4 { font-size: 1.1em; }
.md-h5 { font-size: 1em; }
.md-h6 { font-size: 0.9em; color: rgba(255, 255, 255, 0.7); }

/* Lists */
.md-list {
    margin: 8px 0;
    padding-left: 24px;
}

.md-list-item {
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.82);
}

/* Inline code */
.md-code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-light, #e0a8ff);
}

/* Code block */
.md-code-block {
    background: var(--glass);
    border: 1px solid var(--stroke);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.5;
}

.md-code-block-content {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: var(--text);
    white-space: pre;
    display: block;
    background: transparent;
    padding: 0;
}

/* Syntax highlighting using app accent colors */
.md-code-block .token.comment,
.md-code-block .token.prolog,
.md-code-block .token.doctype,
.md-code-block .token.cdata {
    color: var(--muted-2);
}

.md-code-block .token.punctuation {
    color: var(--text);
}

.md-code-block .token.property,
.md-code-block .token.tag,
.md-code-block .token.boolean,
.md-code-block .token.number,
.md-code-block .token.constant,
.md-code-block .token.symbol,
.md-code-block .token.deleted {
    color: var(--accentB);
}

.md-code-block .token.selector,
.md-code-block .token.attr-name,
.md-code-block .token.string,
.md-code-block .token.char,
.md-code-block .token.builtin,
.md-code-block .token.inserted {
    color: var(--accent-light);
}

.md-code-block .token.operator,
.md-code-block .token.entity,
.md-code-block .token.url,
.language-css .token.string,
.style .token.string {
    color: var(--text);
}

.md-code-block .token.atrule,
.md-code-block .token.attr-value,
.md-code-block .token.keyword {
    color: var(--accent);
}

.md-code-block .token.function,
.md-code-block .token.class-name {
    color: var(--accentB);
}

.md-code-block .token.regex,
.md-code-block .token.important,
.md-code-block .token.variable {
    color: var(--accent-light);
}

.md-code-block .token.important,
.md-code-block .token.bold {
    font-weight: bold;
}

.md-code-block .token.italic {
    font-style: italic;
}

.md-code-block .token.entity {
    cursor: help;
}

/* Code block delimiter - hide now */
.md-code-block-delimiter {
    display: none;
}

/* Horizontal rule */
.md-hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 16px 0;
}

/* Paragraph */
.md-paragraph {
    display: block;
    margin: 4px 0;
}

/* Markdown image */
.md-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
    cursor: pointer;
}

/* HTML Elements Support */
.message-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
}

.message-text img[align="left"] {
    float: left;
    margin-right: 16px;
}

.message-text img[align="right"] {
    float: right;
    margin-left: 16px;
}

.message-text img[align="center"] {
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.message-text img[align="left"] {
    float: left;
    margin-right: 16px;
}

.message-text img[align="right"] {
    float: right;
    margin-left: 16px;
}

/* Centered div with align attribute */
.message-text div[align="center"] {
    text-align: center !important;
    display: block !important;
    width: 100%;
    margin: 8px 0;
}

.message-text div[align="center"] > img:first-child {
    display: block !important;
    margin: 0 auto 8px auto !important;
}

.message-text div[align="center"] > h1,
.message-text div[align="center"] > h2,
.message-text div[align="center"] > h3,
.message-text div[align="center"] > h4,
.message-text div[align="center"] > h5,
.message-text div[align="center"] > h6 {
    display: block !important;
    margin: 8px auto !important;
    text-align: center !important;
}

.message-text div[align="center"] > a {
    display: inline-block !important;
    margin: 0 4px !important;
}

.message-text div[align="center"] > a img {
    display: inline-block !important;
    margin: 0 !important;
}

.message-text div[align="center"] > p {
    display: block !important;
    margin: 16px auto 8px auto !important;
    max-width: 600px;
    text-align: center !important;
}

.message-text div[align="center"] > hr {
    display: block !important;
    border: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
    width: 100% !important;
}

.message-text div[align="left"] {
    text-align: left !important;
}

.message-text div[align="right"] {
    text-align: right !important;
}

/* Helper classes for alignment */
.message-text .text-center {
    text-align: center !important;
}

.message-text .text-left {
    text-align: left !important;
}

.message-text .text-right {
    text-align: right !important;
}

/* Centered content wrapper */
.message-text .centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.message-text details {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.message-text summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    padding: 4px 8px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
}

/* Custom arrow for summary */
.message-text summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.8em;
    transition: transform 0.2s;
    color: var(--accent);
}

.message-text summary:hover {
    color: var(--accent-hover);
}

.message-text summary:hover::before {
    color: var(--accent-hover);
}

/* Rotate arrow when open */
.message-text details[open] > summary::before {
    transform: rotate(90deg);
}

.message-text details[open] summary {
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

/* Hide default marker in webkit browsers */
.message-text summary::-webkit-details-marker {
    display: none;
}

.message-text a {
    color: var(--accent);
    text-decoration: underline;
    word-break: break-word;
}

.message-text a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Link Preview Card */
.link-preview {
    display: flex;
    flex-direction: column;
    background: var(--glass);
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 0;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.link-preview:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.link-preview.has-image {
    flex-direction: row;
    max-width: 500px;
}

.link-preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    flex-shrink: 0;
}

.link-preview.has-image .link-preview-image {
    width: 120px;
    height: auto;
    min-height: 120px;
}

.link-preview-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.link-preview-site {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.link-preview-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.link-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.link-preview-title:hover {
    color: var(--accent);
}

.link-preview-description {
    font-size: 13px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.link-preview-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    color: var(--muted);
    font-size: 40px;
}

.link-preview.has-image .link-preview-no-image {
    display: none;
}

.link-preview-hide {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.2s;
}

.link-preview-container:hover .link-preview-hide {
    opacity: 1;
}

.link-preview-hide:hover {
    background: rgba(0, 0, 0, 0.8);
    color: rgba(255, 255, 255, 0.8);
}

.link-preview-container {
    position: relative;
    margin: 8px 0;
}

.link-preview-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--glass);
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
}

.link-preview-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--glass);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.settings-modal.active {
    display: flex;
}

.settings-modal-content {
    background: var(--background-primary, #1a1f2e);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
}

.settings-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.settings-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.settings-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 0 0 12px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.setting-info {
    flex: 1;
}

.setting-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}

.setting-description {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.setting-btn {
    background: var(--glass);
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.setting-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.setting-btn.danger {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.setting-btn.danger:hover {
    background: rgba(244, 67, 54, 0.3);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Strong and Em */
.message-text strong {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.message-text em {
    font-style: italic;
}

.message-text del {
    text-decoration: line-through;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   НОВАЯ СИСТЕМА ОТВЕТОВ
   ============================================ */

/* Превью ответа над полем ввода */
.reply-preview {
    background: rgba(16, 20, 30, .82);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 8px 8px 0 0;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 16px 0 0;
    animation: slideDown 0.2s ease;
}

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

.reply-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    transition: background 0.15s;
    padding: 4px 8px;
    border-radius: 6px;
}

.reply-preview-content:hover {
    background: rgba(255, 255, 255, .05);
}

.reply-preview-author {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-separator {
    color: var(--muted);
    font-size: 14px;
    flex-shrink: 0;
}

.reply-preview-text {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.reply-preview-cancel {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.reply-preview-cancel:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text);
}

/* Подсветка сообщения при переходе */
.message-group.highlighted {
    background: rgba(var(--accent-rgb), .15);
    border: 1px solid rgba(var(--accent-rgb), .3);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0);
    }
}

/* Блок ответа внутри сообщения (для отображения при получении) */
.message-reply-block {
    background: rgba(0, 0, 0, .2);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.message-reply-block:hover {
    background: rgba(0, 0, 0, .3);
}

.message-reply-block .reply-icon {
    color: var(--accent);
    font-size: 16px;
    flex-shrink: 0;
}

.message-reply-block .reply-author {
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-reply-block .reply-separator {
    color: var(--muted);
    font-size: 13px;
    flex-shrink: 0;
}

.message-reply-block .reply-text {
    color: var(--muted-2);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.message-reply-block .reply-voice-icon,
.message-reply-block .reply-file-icon {
    font-size: 14px;
    margin-right: 4px;
}

.reply-btn {
    background: none;
    border: 1px solid transparent;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 12px;
    transition: background-color 0.2s;
    margin-top: 8px;
    color: var(--muted);
}

.reply-btn:hover {
    background: var(--glass);
    color: var(--text);
}

.edit-btn, .delete-btn {
    background: none;
    border: 1px solid transparent;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 12px;
    transition: background-color 0.2s;
    margin-top: 8px;
    color: var(--muted);
}

.edit-btn:hover, .delete-btn:hover {
    background: var(--glass);
    color: var(--text);
}

/* Container for reactions and actions */
.reactions-and-actions-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 8px;
}

/* Message actions container */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    margin-left: auto;
}

.reply-selection-btn {
    position: fixed;
    z-index: 1000;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

/* =======================================================
   Message Input
   ======================================================= */
.message-input-container {
    padding: 14px 16px 16px;
    flex-shrink: 0; /* Важно: не сжимать контейнер ввода */
}

.message-input-wrapper {
    background: rgba(16, 20, 30, .72);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 0 16px;

    display: flex;
    align-items: center;
    gap: 10px;

    box-shadow: 0 18px 40px rgba(0,0,0,.35);
}

.attach-btn, .emoji-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 10px 0;
    border-radius: 10px;
    transition: color 0.15s, background .15s, transform .14s ease;
}

.attach-btn:hover, .emoji-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,.05);
    transform: translateY(-1px);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: rgba(255,255,255,.88);
    font-size: 16px;
    font-family: inherit;
    padding: 11px 0;
    resize: none;

    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-height: 150px;
    line-height: 1.375;
    overflow-y: auto;
}

#messageInput::placeholder {
    color: rgba(255,255,255,.42);
}

#messageInput:focus-visible{
    outline: none;
}

/* =======================================================
   Call Interface
   ======================================================= */
.call-interface {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 90vw;
    min-width: 400px;

    z-index: 1000;
    display: flex;
    flex-direction: column;

    border-radius: 18px;
    background: var(--glass-strong);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 30px 90px rgba(0,0,0,.65);

    transition: all 0.3s ease;
    animation: callSlideIn 0.3s ease;

    resize: both;
    overflow: auto;
}

.call-interface.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
}

@keyframes callSlideIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.call-interface.hidden { display: none; }

.call-header {
    height: 56px;
    background: rgba(16, 20, 30, .72);
    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(255,255,255,.07);
}

.call-channel-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.close-call-btn {
    width: 36px;
    height: 36px;
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.18);
    color: rgba(239,68,68,.92);
    font-size: 24px;
    cursor: pointer;

    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.2s;
}

.close-call-btn:hover {
    background: rgba(239,68,68,.95);
    color: #fff;
    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;
}

.participant {
    position: relative;
    width: 100%;
    min-width: 150px;
    min-height: 100px;
    aspect-ratio: 16/9;

    background: rgba(16, 20, 30, .62);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 14px 30px rgba(0,0,0,.35);
    resize: both;
    transition: opacity 0.3s ease, transform .14s ease;
}

.participant:hover { transform: translateY(-1px); }
.participant:hover .resize-handle { opacity: 1; }

.resize-handle {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.participant[data-resizable="true"] { cursor: default; }

.participant.screen-share {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16/9;
}

.participant video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

.participant.minimized {
    width: 120px;
    height: 90px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    cursor: pointer;
}

.participant.maximized {
    width: 90vw !important;
    height: 90vh !important;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
}

.participant-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,.52);
    border: 1px solid rgba(255,255,255,.10);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.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: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.40) 100%);
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

.call-control-btn {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: all 0.2s;
    position: relative;
    box-shadow: 0 10px 22px rgba(0,0,0,.35);
}

.call-control-btn:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
    transform: translateY(-1px) scale(1.06);
}

.call-control-btn.active {
    background: rgba(239,68,68,.95);
    border-color: rgba(239,68,68,.40);
    color: #fff;
}

.call-control-btn.active:hover {
    filter: brightness(.95);
}

.call-control-btn svg {
    width: 24px;
    height: 24px;
}


.call-control-btn.screen-active {
    background: linear-gradient(135deg, rgba(34,197,94,.90), rgba(16,185,129,.75));
    border-color: rgba(34,197,94,.28);
    color: #fff;
}

.call-control-btn.screen-active:hover {
    filter: brightness(.95);
}

/* Video Size Controls */
.video-size-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.participant:hover .video-size-controls { opacity: 1; }

.size-control-btn {
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,.45);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 14px;
    transition: all 0.2s;
}

.size-control-btn:hover {
    background: var(--accent-transparent);
    color: #fff;
}

/* Double click hint */
.participant::after {
    content: 'Double-click to fullscreen';
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.55);
    border: 1px solid rgba(255,255,255,.10);
    color: #fff;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.participant:hover::after { opacity: 1; }

/* =======================================================
   Incoming Call
   ======================================================= */
.incoming-call {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: 90vw;

    background: var(--glass-strong);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 18px;
    padding: 32px;

    box-shadow: 0 30px 90px rgba(0,0,0,.65);
    z-index: 2000;

    animation: incomingCallPulse 0.4s ease;
}

@keyframes incomingCallPulse {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.88); }
    50%  { transform: translate(-50%, -50%) scale(1.02); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.incoming-call.hidden { display: none; }

.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: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    box-shadow: 0 16px 34px rgba(0,0,0,.45);
    animation: callerAvatarPulse 2s infinite;
}

@keyframes callerAvatarPulse {
    0%, 100% { box-shadow: 0 16px 34px rgba(0,0,0,.45); }
    50%      { box-shadow: 0 18px 44px rgba(139,92,246,.22), 0 16px 34px rgba(0,0,0,.45); }
}

.caller-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.incoming-call-content p {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 24px;
}

.incoming-call-actions {
    display: flex;
    gap: 16px;
}

.call-action-btn {
    padding: 12px 32px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    min-width: 120px;
}

.call-action-btn.accept {
    background: linear-gradient(135deg, rgba(34,197,94,.92), rgba(16,185,129,.75));
    color: #fff;
}

.call-action-btn.accept:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

.call-action-btn.reject {
    background: linear-gradient(135deg, rgba(239,68,68,.92), rgba(248,113,113,.75));
    color: #fff;
}

.call-action-btn.reject:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

/* =======================================================
   Call Overlay
   ======================================================= */
.call-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,.56);
    z-index: 999;

    -webkit-backdrop-filter: blur(var(--blur-2));
    backdrop-filter: blur(var(--blur-2));
}

.call-overlay.hidden { display: none; }

/* =======================================================
   Scrollbar
   ======================================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,.04);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.20);
}

/* =======================================================
   Friends / DM
   ======================================================= */
.dm-list-view {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.dm-search-bar {
    padding: 10px 8px;
}

.dm-search-bar input {
    width: 100%;
    background: rgba(16, 20, 30, .70);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 10px 12px;
    color: rgba(255,255,255,.88);
    font-size: 14px;
    outline: none;
}

.dm-search-bar input::placeholder{
    color: rgba(255,255,255,.42);
}

.dm-list .channel {
    padding-left: 22px;
}

.friends-main-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.friends-header {
    height: 54px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--glass);
}

.friends-tabs {
    display: flex;
    gap: 8px;
}

.friends-tab {
    background: none;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .16s, color .16s, transform .14s;
}

.friends-tab:hover {
    background: rgba(255,255,255,.06);
    color: var(--text);
    transform: translateY(-1px);
}

.friends-tab.active {
    background: linear-gradient(135deg, var(--accent-transparent), var(--accentB-transparent));
    border: 1px solid rgba(255,255,255,.08);
    color: #fff;
}

.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: rgba(255,255,255,.45);
    padding: 40px 20px;
    font-size: 14px;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 10px;

    background: rgba(16, 20, 30, .66);
    border: 1px solid rgba(255,255,255,.07);
    transition: background-color 0.2s, transform .14s;
}

.friend-item:hover {
    background: rgba(16, 20, 30, .74);
    transform: translateY(-1px);
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.friend-avatar .friend-avatar-content {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 10px 18px rgba(0,0,0,.35);
}

.friend-info { flex: 1; }

.friend-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.friend-status {
    font-size: 12px;
    color: rgba(34,197,94,.92);
}

.friend-status.offline {
    color: rgba(255,255,255,.45);
}

.friend-actions {
    display: flex;
    gap: 8px;
}

.friend-action-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    color: var(--muted);
    transition: background .16s, color .16s, transform .14s;
}

.friend-action-btn:hover {
    background: rgba(255,255,255,.06);
    color: var(--text);
    transform: translateY(-1px);
}

.friend-action-btn.accept {
    background: rgba(34,197,94,.92);
    color: #fff;
}

.friend-action-btn.accept:hover { filter: brightness(.95); }

.friend-action-btn.reject {
    background: rgba(239,68,68,.92);
    color: #fff;
}

.friend-action-btn.reject:hover { filter: brightness(.95); }

/* =======================================================
   Add Friend Form
   ======================================================= */
.add-friend-form {
    padding: 20px;
}

.add-friend-form h3 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
    font-weight: 800;
}

.add-friend-form p {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
}

.add-friend-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.add-friend-input-wrapper input {
    flex: 1;
    background: rgba(16, 20, 30, .70);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    color: rgba(255,255,255,.88);
    padding: 12px;
    font-size: 14px;
    outline: none;
}

.add-friend-input-wrapper input:focus {
    border-color: var(--accent-border-focus);
    box-shadow: 0 0 0 3px var(--accent-shadow-focus);
}

.add-friend-input-wrapper button {
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    color: #fff;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.add-friend-input-wrapper button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

#searchResults { margin-top: 16px; }

.user-search-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 10px;

    background: rgba(16, 20, 30, .66);
    border: 1px solid rgba(255,255,255,.07);
}

.user-search-item .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-search-item .user-avatar .user-avatar-content {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 10px 18px rgba(0,0,0,.35);
}

.user-search-item .user-info { flex: 1; }

.user-search-item .user-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.user-search-item .add-friend-btn {
    background: linear-gradient(135deg, var(--good), #2db87a);
    color: #fff;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s, filter .16s;
}

.user-search-item .add-friend-btn:hover {
    transform: translateY(-1px);
    filter: brightness(.95);
}

.user-search-item .add-friend-btn:disabled {
    background: rgba(255,255,255,.10);
    color: rgba(255,255,255,.45);
    cursor: not-allowed;
}

/* =======================================================
   File Attachments
   ======================================================= */
.file-attachment {
    display: flex;
    align-items: center;
    background: var(--glass-2);
    border: 1px solid var(--stroke-soft);
    border-radius: 14px;
    padding: 12px;
    margin-top: 8px;
    gap: 12px;
    box-shadow: var(--shadow-soft);
}

.file-icon { font-size: 24px; }

.file-info { flex: 1; }

.file-name {
    font-size: 14px;
    color: var(--text);
    font-weight: 700;
}

.file-size {
    font-size: 12px;
    color: var(--muted-2);
    margin-top: 2px;
}

.file-download {
    background: linear-gradient(135deg, var(--accent), var(--accentB));
    color: #fff;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    transition: transform .16s, filter .16s;
    border: 1px solid rgba(255,255,255,.10);
}

.file-download:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* =======================================================
   Message Reactions
   ======================================================= */
.message-reactions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.reaction {
    background: rgba(16, 20, 30, .66);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;

    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform .14s ease, background .14s ease, border-color .14s ease;
}

.reaction:hover {
    background: rgba(16, 20, 30, .74);
    border-color: var(--accent-reaction-hover);
    transform: translateY(-1px);
}

.reaction span {
    font-size: 12px;
    color: rgba(255,255,255,.55);
}

.add-reaction-btn {
    background: none;
    border: 1px solid transparent;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 12px;
    transition: background-color 0.2s;
    margin-top: 8px;
    color: var(--muted);
}

.add-reaction-btn:hover {
    background: rgba(255,255,255,.06);
    color: var(--text);
}

/* =======================================================
   Emoji Picker (Full)
   ======================================================= */
.emoji-picker-full {
    position: fixed;
    bottom: 80px;
    right: 20px;

    background: var(--glass-strong);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;

    box-shadow: 0 30px 90px rgba(0,0,0,.65);
    z-index: 1000;
    animation: slideInUp 0.2s ease;

    width: 350px;
    max-height: 420px;

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.emoji-tabs {
    display: flex;
    background: rgba(16, 20, 30, .72);
    padding: 8px;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.emoji-tab {
    background: none;
    border: 1px solid transparent;
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s, transform .14s;
    font-size: 18px;
    color: var(--muted);
}

.emoji-tab:hover {
    background: rgba(255,255,255,.06);
    transform: translateY(-1px);
}

.emoji-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accentB-transparent));
    border-color: rgba(255,255,255,.10);
    color: #fff;
}

.emoji-tab img.emoji {
    width: 20px;
    height: 20px;
}

.emoji-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.emoji-category-title {
    color: rgba(255,255,255,.48);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-left: 4px;
    letter-spacing: .6px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.emoji-option {
    background: none;
    border: 1px solid transparent;
    font-size: 22px;
    font-family: "Noto Color Emoji", sans-serif;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;

    transition: background-color 0.2s, transform .14s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-option:hover {
    background: rgba(255,255,255,.07);
    transform: translateY(-1px);
}

.emoji-option img.emoji {
    width: 22px;
    height: 22px;
}

/* emoji sizes */
img.emoji {
    height: 1.2em;
    width: 1.2em;
    vertical-align: -0.2em;
}

.reaction img.emoji {
    height: 16px;
    width: 16px;
}

.message-text img.emoji {
    height: 1.4em;
    width: 1.4em;
}

/* =======================================================
   Speaking Indicator
   ======================================================= */
.participant.speaking {
    border: 3px solid rgba(34,197,94,.92);
    box-shadow: 0 0 24px rgba(34,197,94,.35), 0 18px 44px rgba(0,0,0,.45);
}

.participant.speaking .participant-name {
    background: rgba(34,197,94,.85);
}

/* =======================================================
   Animations
   ======================================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message-group {
    animation: fadeIn 0.2s ease;
}

/* =======================================================
   Theme Selector Dropdown
   ======================================================= */
.theme-selector {
    position: absolute;
    bottom: 70px;
    right: 10px;
    background: var(--glass-strong);
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 12px;
    width: 220px;
    z-index: 1000;
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    display: none;
}

.theme-selector.visible {
    display: block;
}

.theme-selector h3 {
    color: var(--text);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--stroke);
    font-size: 14px;
    font-weight: 700;
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-option {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text);
    font-size: 14px;
}

.theme-option:hover {
    background: rgba(255,255,255,0.08);
}

.theme-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid var(--stroke);
}

.accent-colors {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--stroke);
}

.accent-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.accent-color:hover {
    transform: scale(1.15);
}

.accent-color.selected {
    border-color: white;
    transform: scale(1.15);
}

.transparency-control {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--stroke);
}

.custom-color-control {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-color-control label {
    color: var(--text);
    font-size: 14px;
}

.custom-color-control input[type="color"] {
    width: 100%;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

#applyCustomColorBtn {
    background: var(--glass);
    color: var(--text);
    border: 1px solid var(--stroke);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

#applyCustomColorBtn:hover {
    background: rgba(255,255,255,0.08);
}

.transparency-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 8px;
}

#transparencySlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    outline: none;
    -webkit-appearance: none;
}

#transparencySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--stroke);
}

#transparencySlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--stroke);
}

/* =======================================================
   Reduced motion
   ======================================================= */
@media (prefers-reduced-motion: reduce){
    *{
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* =======================================================
   Responsive tweaks (safe)
   ======================================================= */
@media (max-width: 900px){
    .channel-list { width: 230px; }
    .server-list { width: 72px; }
}

@media (max-width: 740px){
    .channel-list { width: 210px; }
    .server-list { width: 68px; }
    .message-input-container { padding: 12px; }
    .messages { padding: 14px 12px; }
    .emoji-picker-full { width: 320px; right: 12px; }
    .emoji-grid { grid-template-columns: repeat(7, 1fr); }
    .call-interface { min-width: 320px; }
}

/* =======================================================
   Mobile layout pack — bottom servers + left drawer channels
   ======================================================= */

.drawer-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    z-index: 900;

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.drawer-overlay.is-open{
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-btn{
    display: none;
}

@media (max-width: 820px){

    body{
        height: 100dvh;
        overflow: hidden;
    }

    .main-content{
        width: 100vw;
        height: calc(100dvh - 64px);
        min-height: calc(100dvh - 64px);
    }

    .server-list{
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;

        width: 100vw;
        height: 64px;

        flex-direction: row;
        align-items: center;
        justify-content: flex-start;

        gap: 10px;
        padding: 10px 12px;

        overflow-x: auto;
        overflow-y: hidden;

        border-right: none;
        border-top: 1px solid rgba(255,255,255,.07);

        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        height: calc(64px + env(safe-area-inset-bottom));
        z-index: 800;
    }

    /* ✅ ДОБАВЛЕНО: чтобы разделитель реально был видимым */
    .server-separator{
        width: 2px;
        height: 28px;
        border-radius: 999px;
        opacity: .6;
        background: rgba(255,255,255,.10);
        flex: 0 0 auto;
    }

    .server-icon{
        width: 44px;
        height: 44px;
        border-radius: 14px;
        flex: 0 0 auto;
    }

    .server-icon:hover{
        transform: translateY(-1px);
    }

    .channel-list{
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;

        width: min(86vw, 360px);
        height: 100dvh;

        transform: translateX(-110%);
        transition: transform .22s ease;

        z-index: 950;
        border-right: 1px solid rgba(255,255,255,.10);
        box-shadow: 0 30px 90px rgba(0,0,0,.65);
    }

    .channel-list.is-open{
        transform: translateX(0);
    }

    .channel-list{
        display: flex;
    }
    .dm-list-view{
        min-height: 0;
    }
    .user-panel{
        height: 62px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .server-header,
    .chat-header,
    .friends-header{
        height: 56px;
    }

    .mobile-menu-btn{
        display: inline-flex;
    }

    .friends-tabs{
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding: 0 2px;
    }
    .friends-tab{
        white-space: nowrap;
        font-size: 13px;
        padding: 8px 10px;
        border-radius: 12px;
        flex: 0 0 auto;
    }

    .messages{
        padding: 12px;
    }
    .message-group{
        padding: 10px 10px;
        margin-bottom: 10px;
        border-radius: 14px;
    }
    .message-avatar{
        width: 36px;
        height: 36px;
        margin-right: 12px;
    }
    .message-author{
        font-size: 15px;
    }
    .message-text{
        font-size: 15px;
        line-height: 1.42;
    }

    .message-input-container{
        padding: 10px 12px 12px;
    }
    .message-input-wrapper{
        border-radius: 16px;
        padding: 0 12px;
        gap: 8px;
    }
    .attach-btn, .emoji-btn{
        padding: 10px 6px;
    }
    #messageInput{
        font-size: 16px;
        padding: 12px 0;
        max-height: 140px;
    }

    .emoji-picker-full{
        right: 10px;
        left: 10px;
        width: auto;
        bottom: calc(76px + env(safe-area-inset-bottom));
        max-height: 45vh;
        border-radius: 16px;
    }
    .emoji-grid{
        grid-template-columns: repeat(8, 1fr);
        gap: 6px;
    }

    .call-interface{
        top: 0;
        left: 0;
        transform: none;
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        min-width: 0;
        border-radius: 0;
        resize: none;
        overflow: hidden;
    }
    .call-participants{
        max-height: none;
        min-height: 0;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .dm-list-view,
    .messages,
    .friends-content-wrapper,
    .emoji-content,
    .call-participants{
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

@media (max-width: 420px){
    .server-list{
        gap: 8px;
        padding: 10px 10px;
    }
    .server-icon{
        width: 42px;
        height: 42px;
    }
    .emoji-grid{
        grid-template-columns: repeat(7, 1fr);
    }
}


/* =======================================================
   ✅ Mobile Burger / Drawer — FINAL PATCH (append to end)
   - correct z-index stacking
   - smooth drawer + overlay
   - body lock while open (works with .drawer-open on html/body)
   - nicer burger button look
   - iOS safe-area & tap fixes
   ======================================================= */

/* 1) Body lock when drawer open (JS должен добавлять класс drawer-open) */
html.drawer-open,
body.drawer-open{
  overflow: hidden !important;
  height: 100%;
  touch-action: none;           /* блокируем жесты фона */
  overscroll-behavior: none;
}

/* 2) Overlay всегда над контентом, но под drawer */
.drawer-overlay{
  z-index: 940;                 /* было 900 — поднимем */
  will-change: opacity;
}

/* 3) Drawer всегда поверх overlay */
@media (max-width: 820px){
  .channel-list{
    z-index: 950;               /* у тебя так и есть — фиксируем */
    will-change: transform;
    /* чуть приятнее инерция */
    transition: transform .22s cubic-bezier(.2,.9,.2,1);
  }

  /* чтобы в drawer не было “вылетов” по высоте на iOS */
  .channel-list,
  .main-content{
    -webkit-overflow-scrolling: touch;
  }

  /* 4) Кнопка бургера — делаем её реально "кнопкой" */
  .mobile-menu-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    border-radius: 12px;

    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 10px 22px rgba(0,0,0,.30);

    cursor: pointer;
    transition: transform .14s ease, background .14s ease, border-color .14s ease;
  }

  .mobile-menu-btn:hover{
    background: rgba(255,255,255,.085);
    border-color: rgba(255,255,255,.14);
    transform: translateY(-1px);
  }

  .mobile-menu-btn:active{
    transform: translateY(0) scale(.98);
  }

  /* 5) Чтобы клики не “пробивали” в фоне при закрытом drawer */
  .channel-list:not(.is-open){
    pointer-events: none;
  }
  .channel-list.is-open{
    pointer-events: auto;
  }

  /* 6) Безопасная нижняя зона под сервер-бар на телефоне */
  .messages{
    padding-bottom: calc(12px + 64px + env(safe-area-inset-bottom));
  }
  .message-input-container{
    padding-bottom: calc(12px + 64px + env(safe-area-inset-bottom));
  }
}

/* 7) Мелкие телефоны — чуть компактнее бургер */
@media (max-width: 420px){
  .mobile-menu-btn{
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
}


/* FIX: overlay не блокирует клики, когда закрыт */
.drawer-overlay{
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 999; /* ниже, чем drawer */
}

.drawer-overlay.is-open{
  opacity: 1;
  pointer-events: auto;
}

/* drawer должен быть выше overlay */
.channel-list.is-open{
  z-index: 1000;
}

/* а theme selector — выше всего (чтобы точно кликается) */
#themeSelector{
  position: fixed;
  z-index: 2000;
}



.send-btn{
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.78);

  cursor: pointer;
  transition: transform .14s ease, background .14s ease, color .14s ease, box-shadow .14s ease, border-color .14s ease;
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
}

.send-btn:hover{
  background: rgba(255,255,255,.085);
  color: #fff;
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.14);
}

.send-btn:active{
  transform: translateY(0) scale(.98);
}

.send-btn:disabled{
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.send-btn.ready{
  background: linear-gradient(135deg, var(--accent), var(--accentB));
  border-color: rgba(255,255,255,.14);
  color: #fff;
  box-shadow: 0 16px 34px rgba(0,0,0,.38);
}

.send-btn.ready:hover{
  filter: brightness(1.02);
}

/* Voice record button styles */
.voice-record-btn{
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.78);

  cursor: pointer;
  transition: transform .14s ease, background .14s ease, color .14s ease, box-shadow .14s ease, border-color .14s ease;
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
  
  position: relative;
}

.voice-record-btn::before{
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zM17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zM17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z'/%3E%3C/svg%3E") no-repeat center;
}

.send-btn{
  position: relative;
}

.send-btn::before{
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 21l21-9L2 3v7l15 2-15 2v7z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 21l21-9L2 3v7l15 2-15 2v7z'/%3E%3C/svg%3E") no-repeat center;
}

.voice-record-btn:hover{
  background: rgba(255,255,255,.085);
  color: #fff;
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.14);
}

.voice-record-btn:active{
  transform: translateY(0) scale(.98);
}

.voice-record-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fff;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    animation: pulse 1.5s infinite;
}

.voice-record-btn.recording::before{
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3C/svg%3E") no-repeat center;
}

/* Message editing indicators */
.edited-indicator {
    color: var(--muted-2);
    font-size: 0.75rem;
    margin-left: 4px;
    vertical-align: middle;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-message-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.9em;
}

/* Voice message styles */
.voice-message-container {
    width: 100%;
    background: var(--glass);
    border-radius: 18px;
    padding: 12px;
    border: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
}

.voice-player {
    width: 100%;
    margin: 8px 0;
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.voice-play-btn {
    background: var(--accent) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: white !important;
    flex-shrink: 0;
}

.voice-speed-btn {
    background: transparent !important;
    border: 1px solid var(--accent) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    cursor: pointer !important;
    color: var(--accent) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.voice-duration {
    color: var(--muted) !important;
    font-size: 13px !important;
    margin-left: auto !important;
}

/* Recording timer */
.recording-timer {
    position: absolute !important;
    bottom: 10px !important;
    right: 10px !important;
    background-color: rgba(239, 68, 68, 0.9) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    z-index: 10 !important;
    font-weight: bold !important;
}

.voice-transcribe-small-btn {
    transition: all 0.2s ease;
}

.voice-transcribe-small-btn:hover {
    background: var(--glass) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

.voice-transcribe-small-btn.transcribing {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    border-color: transparent !important;
    color: #fff !important;
    animation: pulse-transcribe 1.5s infinite;
}
