/* ==========================================================
   REBORN UI KIT - Glassmorphism Style (Final Clean)
   ========================================================== */

:root {
    --bg-base: #0a0a0c;
    --text-main: #ffffff;
    --text-muted: #8e8e93;
    --accent: #ff6b00;
    --accent-glow: rgba(255, 107, 0, 0.5);
    --accent-light: #ff9a44;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(16px);
    --radius-card: 24px;
    --radius-input: 12px;
    --radius-btn: 50px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    padding-bottom: 90px; /* Отступ под нижнее меню */
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(255, 107, 0, 0.08), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(255, 107, 0, 0.05), transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; transition: all 0.3s ease; }
a:hover { color: #fff; text-shadow: 0 0 8px var(--accent-glow); }

/* =========================================
   ИДЕАЛЬНАЯ ШАПКА (TOPBAR)
   ========================================= */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.topbar .logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    margin: 0;
    flex-shrink: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0;
}

.notification-icon { display: flex; color: var(--text-muted); transition: color 0.2s; }
.notification-icon:hover { color: var(--accent); }
.notification-dot {
    position: absolute; top: -2px; right: -2px;
    width: 10px; height: 10px; background-color: #ff4d4d;
    border-radius: 50%; box-shadow: 0 0 8px rgba(255, 77, 77, 0.8);
    border: 2px solid var(--bg-base);
}

.avatar-sm {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--glass-border);
    display: block;
}

/* =========================================
   НИЖНЕЕ МЕНЮ (Bottom Navigation)
   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: rgba(10, 10, 12, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

.nav-item {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: all 0.3s ease;
    padding: 8px 16px; border-radius: 12px; position: relative;
}

.bottom-nav svg { width: 24px !important; height: 24px !important; transition: all 0.3s ease; }
.nav-item:hover, .nav-item.active { color: var(--accent); }
.nav-item.active svg { filter: drop-shadow(0 0 8px var(--accent-glow)); transform: translateY(-2px); }
.nav-item.active::after {
    content: ''; position: absolute; bottom: 0; width: 4px; height: 4px;
    background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent);
}

/* =========================================
   ОСНОВНОЙ КОНТЕЙНЕР И КАРТОЧКИ
   ========================================= */
.container { max-width: 680px; margin: 40px auto; padding: 0 20px; }

.flash {
    max-width: 680px; margin: 20px auto 0; padding: 16px 24px;
    border-radius: var(--radius-card); font-size: 14px;
    backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border);
    text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.flash-success { background: rgba(23, 191, 99, 0.1); border-color: rgba(23, 191, 99, 0.3); color: #17bf63; }
.flash-error { background: rgba(224, 36, 94, 0.1); border-color: rgba(224, 36, 94, 0.3); color: #ff4d4d; }

.card, .post, .profile-head, .post-form, .hero {
    background: var(--glass-bg); backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-border);
    border-radius: var(--radius-card); padding: 32px; margin-bottom: 24px;
    position: relative; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card::after, .post-form::after, .hero::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 60%; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 20px 2px var(--accent-glow); border-radius: 50%;
}

/* =========================================
   ФОРМЫ И ВВОД
   ========================================= */
.card label, .post-form label {
    display: block; margin-bottom: 20px; font-size: 12px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
}

.card input, .card textarea, .post-form textarea {
    width: 100%; padding: 14px 20px; margin-top: 8px;
    background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-input); font: inherit; color: #fff;
    transition: all 0.3s ease; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.card input:focus, .card textarea:focus, .post-form textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 0 15px var(--accent-glow);
    background: rgba(0, 0, 0, 0.6);
}
.post-form textarea { min-height: 120px; resize: vertical; }

.post-form > div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

/* =========================================
   КНОПКИ
   ========================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #cc5500); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2); padding: 14px 32px;
    border-radius: var(--radius-btn); font: inherit; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px; cursor: pointer;
    transition: all 0.3s ease; margin: 0;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5); }
.btn-secondary { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); color: var(--text-main); }

/* =========================================
   ПОСТЫ
   ========================================= */
.post header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 16px; }
.post header a { display: flex; align-items: center; gap: 12px; color: var(--text-main); text-decoration: none; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; color: #e0e0e0; margin: 0; }
.post-body br + br { display: block; content: ""; margin-top: 0.45em; }
.post > .post-body + div, .post > .post-body + img { margin-top: 12px !important; }

/* АВАТАРКИ */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 0 10px rgba(0,0,0,0.5); }
.avatar-lg { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 2px solid var(--glass-border); box-shadow: 0 0 20px rgba(0,0,0,0.8), 0 0 0 4px rgba(255, 107, 0, 0.1); }

.profile-head { display: flex; gap: 24px; align-items: center; }
.profile-head h1 { margin: 0 0 4px 0; font-size: 28px; }
.profile-head .muted { color: var(--accent); font-weight: 500; margin-top: 0; }

.muted { color: var(--text-muted); font-size: 13px; }
.site-footer { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }

/* Кнопка загрузки файла */
.file-upload {
    display: inline-flex; align-items: center; justify-content: center;
    white-space: nowrap; padding: 10px 16px; font-size: 13px; height: 42px;
    cursor: pointer; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    border-radius: 30px; color: var(--text-muted); transition: all 0.2s;
}
.file-upload:hover { background: rgba(255, 107, 0, 0.1); border-color: var(--accent); color: var(--accent); }
.file-upload input[type="file"] { display: none; }
.file-upload span { font-size: 13px; }

.action-btn { background: none; border: none; color: var(--text-muted); display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; transition: all 0.2s; padding: 0; }
.action-btn:hover { color: var(--accent); }
.action-btn.active { color: var(--accent); text-shadow: 0 0 10px var(--accent-glow); }

/* =========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (ФИКСЫ)
   ========================================= */
@media (max-width: 450px) {
    .post-form > div {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .post-form .file-upload {
        width: 100% !important;
        justify-content: center !important;
    }
    .post-form .btn {
        width: 100% !important;
    }
    .profile-head {
        flex-direction: column;
        text-align: center;
    }
    .card, .post, .profile-head, .post-form { padding: 20px; }
    .container { margin: 20px auto; padding: 0 12px; }
}

/* =========================================
   СВЕТЛАЯ ТЕМА
   ========================================= */
body.theme-light {
    --bg-base: #f4f4f9;
    --text-main: #111;
    --text-muted: #666;
    --glass-bg: #ffffff;
    --glass-border: #ddd;
    background-image: none;
    color: var(--text-main);
}
body.theme-light .topbar, body.theme-light .bottom-nav { background: rgba(255, 255, 255, 0.9); border-color: #ddd; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
body.theme-light .logo, body.theme-light .post-body, body.theme-light h1, body.theme-light h2 { color: #111; }
body.theme-light .post-form textarea, body.theme-light .card input, body.theme-light select { background: #f9f9f9 !important; color: #111 !important; border: 1px solid #ccc !important; }
body.theme-light .btn-secondary { background: #eee; color: #111; border: 1px solid #ccc; }
body.theme-light .nav-item { color: #888; }
body.theme-light .nav-item.active { color: #ff6b00; }
body.theme-light .notification-dot { border-color: #fff; }

/* =========================================
   БЕЙДЖИ РОЛЕЙ (ADMIN, MOD)
   ========================================= */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(255, 77, 77, 0.15);
    color: #ff4d4d;
    border: 1px solid rgba(255, 77, 77, 0.5);
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
    text-shadow: 0 0 5px rgba(255, 77, 77, 0.5);
}

.badge-mod {
    background: rgba(0, 255, 170, 0.15);
    color: #00ffaa;
    border: 1px solid rgba(0, 255, 170, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 170, 0.2);
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.5);
}

.badge-banned {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Кнопка "Плюс" (FAB) */
.fab-button {
    position: fixed; bottom: 90px; right: 20px;
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #cc5500);
    color: #fff; border: none;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.5);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 900; transition: transform 0.2s;
}
.fab-button:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(255, 107, 0, 0.7); }

/* Модальное окно */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--glass-bg); backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); border-radius: var(--radius-card);
    width: 100%; max-width: 500px; padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: modalSlideUp 0.3s ease-out;
}
@keyframes modalSlideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =========================================
   ФИКС ПОЛЕЙ ВВОДА В МОДАЛЬНОМ ОКНЕ
   ========================================= */
.modal-content textarea {
    width: 100% !important;
    display: block !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--radius-input) !important;
    padding: 14px 20px !important;
    color: #fff !important;
    font: inherit !important;
    resize: vertical !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.modal-content textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 15px var(--accent-glow) !important;
}

/* =========================================
   БЕЙДЖИ УВЕДОМЛЕНИЙ (Красные кружки с цифрами)
   ========================================= */
.badge-dot {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: #ff4d4d;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.8);
    border: 2px solid var(--bg-base);
    animation: pulse 2s infinite;
}

.bottom-dot {
    top: 2px;
    right: 10px;
}

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

/* Компактные кнопки для профиля */
.btn-sm {
    padding: 8px 14px !important;
    font-size: 12px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    margin: 0 !important;
}

@media (max-width: 450px) {
    .profile-head {
        padding: 20px 15px;
    }
    .profile-head h1 {
        font-size: 22px;
    }
}

/* Синяя галочка верификации */
.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 6px;
    width: 18px;
    height: 18px;
}

.verified-badge svg {
    width: 100%;
    height: 100%;
    fill: #1d9bf0;
    filter: drop-shadow(0 0 5px rgba(29, 155, 240, 0.5));
}

.verified-badge-admin svg {
    fill: #ff6b00;
    filter: drop-shadow(0 0 5px rgba(255, 107, 0, 0.5));
}

/* =========================================
   ФИКС ЧАТА (Прибиваем к экрану)
   ========================================= */
.chat-wrapper {
    position: fixed;
    top: 65px; /* Отступ под верхнюю шапку сайта */
    bottom: 70px; /* Отступ под нижнее меню */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 680px; /* Ширина как у контейнера */
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    z-index: 500;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(10, 10, 12, 0.95);
    border-bottom: 1px solid var(--glass-border);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== ЧАТЫ: переменные пузырей (персонализируются в настройках → «Чат») ===== */
:root {
    --bubble-mine-bg: #f97316;
    --bubble-mine-text: #ffffff;
    --bubble-theirs-bg: #262633;
    --bubble-theirs-text: #f4f4f8;
    --bubble-radius: 18px;
    --bubble-tail: 5px;
}
body.theme-light { --bubble-theirs-bg: #e9e9f1; --bubble-theirs-text: #15151c; }

.chat-messages { position: relative; scroll-behavior: auto; overscroll-behavior: contain; gap: 2px; }
.chat-msg-row { display: flex; align-items: flex-end; gap: 4px; width: 100%; margin: 2px 0; }
.chat-msg-row.mine { justify-content: flex-end; }
.chat-msg-row.theirs { justify-content: flex-start; }

.chat-msg {
    position: relative; max-width: min(78%, 520px); min-width: 0;
    padding: 8px 12px 6px; font-size: 15px; line-height: 1.4;
    border-radius: var(--bubble-radius);
    overflow-wrap: anywhere; word-break: break-word; text-align: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: filter .3s, outline-color .3s;
}
.chat-msg-row.mine .chat-msg {
    background: var(--bubble-mine-bg); color: var(--bubble-mine-text);
    border-bottom-right-radius: var(--bubble-tail);
}
.chat-msg-row.theirs .chat-msg {
    background: var(--bubble-theirs-bg); color: var(--bubble-theirs-text);
    border-bottom-left-radius: var(--bubble-tail);
}
.chat-msg.flash { outline: 2px solid var(--accent); outline-offset: 2px; filter: brightness(1.2); }
.chat-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg-text { white-space: pre-wrap; }
.msg-author { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.msg-image { display: block; max-width: 100%; max-height: 340px; border-radius: calc(var(--bubble-radius) - 6px); cursor: zoom-in; margin: 2px 0; }
.msg-audio { display: block; width: 240px; max-width: 100%; height: 38px; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; opacity: .72; line-height: 1; user-select: none; }
.msg-ticks.read { opacity: 1; color: #7cf4d4; }
.chat-msg-row.mine .msg-ticks.read { color: currentColor; filter: drop-shadow(0 0 1px currentColor); }
.msg-reply-quote {
    margin: 0 0 5px; padding: 4px 8px; border-left: 3px solid currentColor; border-radius: 4px;
    background: rgba(0, 0, 0, .18); font-size: 12px; cursor: pointer; max-width: 100%;
}
.msg-reply-quote strong { display: block; opacity: .95; }
.msg-reply-quote .quote-text { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg-more {
    background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 18px; line-height: 1;
    width: 28px; height: 28px; border-radius: 50%; flex: none; opacity: 0; transition: opacity .15s, background .15s;
}
.chat-msg-row:hover .msg-more, .msg-more:focus-visible { opacity: 1; }
.msg-more:hover { background: rgba(255, 255, 255, .1); color: var(--text-main); }
@media (hover: none) { .msg-more { opacity: .55; } }

.msg-reactions { display: none; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react-chip {
    border: 0; cursor: pointer; font-size: 12px; padding: 2px 7px; border-radius: 99px; color: inherit;
    background: rgba(0, 0, 0, .22);
}
.react-chip.mine { background: rgba(255, 255, 255, .28); box-shadow: inset 0 0 0 1px currentColor; }

.chat-day { text-align: center; margin: 10px 0 6px; }
.chat-day span { font-size: 12px; color: var(--text-muted); background: rgba(255, 255, 255, .06); padding: 3px 10px; border-radius: 99px; }
.chat-empty { text-align: center; color: var(--text-muted); margin: auto; padding: 40px 10px; }
.chat-more { align-self: center; background: rgba(255, 255, 255, .07); border: 0; color: var(--text-main); padding: 6px 14px; border-radius: 99px; cursor: pointer; font-size: 13px; margin-bottom: 8px; }
.chat-jump {
    position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 5; display: none;
    background: var(--accent); color: #fff; border: 0; padding: 8px 16px; border-radius: 99px; cursor: pointer; font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}

.chat-status { font-size: 11px; color: var(--text-muted); }
.chat-status.online { color: #00ffaa; }
.chat-status.typing { color: var(--accent); }
#online-dot { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; border-radius: 50%; background: #8e8e93; border: 2px solid var(--bg-base); }
#online-dot.on { background: #00ffaa; box-shadow: 0 0 5px #00ffaa; }

.chat-form {
    display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px;
    background: rgba(10, 10, 12, .95); border-top: 1px solid var(--glass-border);
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.chat-form textarea {
    flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 11px 16px; border-radius: 22px; line-height: 1.35; font: inherit;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: var(--text-main); outline: none;
}
.chat-form textarea:focus { border-color: var(--accent); }
.chat-icon-btn {
    background: none; border: 0; color: var(--text-muted); cursor: pointer; flex: none;
    display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; transition: background .2s, color .2s;
}
.chat-icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text-main); }
.chat-icon-btn.send-btn { background: var(--accent); color: #fff; }
.chat-icon-btn.send-btn:disabled { opacity: .5; }
.chat-icon-btn.recording { background: rgba(255, 77, 77, .18); color: #ff4d4d; }
.rec-box { display: none; flex: 1; align-items: center; gap: 10px; color: #ff4d4d; padding: 0 8px; }
.rec-box i { width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; animation: recpulse 1s infinite; }
.rec-box button { margin-left: auto; background: none; border: 0; color: var(--text-muted); cursor: pointer; }
@keyframes recpulse { 50% { opacity: .35; transform: scale(1.25); } }
.chat-notice { display: none; padding: 14px 20px; text-align: center; color: var(--text-muted); background: rgba(10, 10, 12, .95); border-top: 1px solid var(--glass-border); }

.reply-bar { display: none; position: relative; margin: 0; padding: 8px 40px 8px 14px; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, .06); font-size: 13px; }
.reply-bar.active { display: block; }
.reply-bar strong { color: var(--accent); display: block; }
.reply-bar .reply-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.reply-bar .reply-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-muted); font-size: 22px; cursor: pointer; }

.chat-menu {
    position: fixed; z-index: 3000; min-width: 210px; padding: 6px; border-radius: 14px;
    background: #23232e; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 10px 34px rgba(0, 0, 0, .6);
}
body.theme-light .chat-menu { background: #fff; border-color: #ddd; }
.chat-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text-main); padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.chat-menu button:hover { background: rgba(255, 255, 255, .08); }
.chat-menu button.danger { color: #ff6b6b; }
.chat-menu-emoji { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 4px; }
.chat-menu-emoji button { width: auto; padding: 5px 8px; font-size: 20px; }

.forward-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 3500; display: none; align-items: center; justify-content: center; }
.forward-modal.active { display: flex; }
.forward-modal-box { background: #1e1e2e; border: 1px solid var(--glass-border); padding: 24px; border-radius: 16px; width: 360px; max-width: 92vw; }
.forward-input { width: 100%; padding: 12px; border-radius: 8px; background: rgba(0, 0, 0, .3); border: 1px solid var(--glass-border); color: var(--text-main); margin: 8px 0 12px; box-sizing: border-box; }
.forward-actions { display: flex; gap: 8px; }
.forward-actions .btn { flex: 1; }

.header-menu-wrap { position: relative; margin-left: auto; }
.header-menu-btn { background: none; border: 0; color: var(--text-main); cursor: pointer; font-size: 22px; padding: 4px 10px; border-radius: 50%; line-height: 1; }
.header-menu-btn:hover { background: rgba(255, 255, 255, .1); }
.header-menu { display: none; position: absolute; top: 100%; right: 0; background: #1e1e2e; border: 1px solid var(--glass-border); border-radius: 10px; padding: 6px; min-width: 220px; z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.header-menu-wrap.open .header-menu { display: block; }
.header-menu a, .header-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: #fff; padding: 10px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; text-decoration: none; box-sizing: border-box; }
.header-menu a:hover, .header-menu button:hover { background: rgba(255, 255, 255, .08); }
.header-menu .danger { color: #ff6b6b; }

/* Настройки → Чат */
.chat-presets { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.chat-preset { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .04); color: var(--text-main); cursor: pointer; }
.chat-preset:hover { border-color: var(--accent); }
.chat-preset span { width: 18px; height: 18px; border-radius: 50%; }
.chat-preset span:nth-child(1) { background: var(--a); }
.chat-preset span:nth-child(2) { background: var(--b); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); margin-left: -12px; }
.chat-preset em { font-style: normal; font-size: 13px; }
.chat-color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.chat-color-grid label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-color-grid input[type=color] { width: 48px; height: 32px; padding: 0; border: 1px solid var(--glass-border); border-radius: 8px; background: none; cursor: pointer; }
.chat-preview { margin-top: 18px; padding: 16px; border-radius: 16px; background: rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 6px; }
.chat-preview .chat-msg { max-width: 80%; }

.chat-form-legacy-reset { display: none; }

/* =========================================
   КРАСИВЫЕ КАРТИНКИ В ПОСТАХ
   ========================================= */
.post-image {
    margin-top: 15px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Картинки в постах */
.post-image {
    margin-top: 15px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
}

.post-image img {
    display: block;
    width: 100% !important; /* Жестко на всю ширину */
    max-width: 100% !important; /* Не шире контейнера */
    height: auto !important; 
    object-fit: contain;
}

/* Стилизация ползунка плеера */
input[type=range]#player-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
input[type=range]#player-seek::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Меню профиля */
.menu-item {
    display: block;
    padding: 10px 15px;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
}
.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
/* ==========================================
   ВСПЛЫВАЮЩИЕ УВЕДОМЛЕНИЯ (ТОСТЫ)
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Чтобы не мешали кликам по контенту */
}

.toast {
    background: rgba(20, 20, 22, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #fff;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    animation: toastSlideIn 0.3s ease-out forwards;
    pointer-events: auto;
}

.toast.toast-success { border-left: 4px solid #00ffaa; }
.toast.toast-error   { border-left: 4px solid #ff4d4d; }
.toast.toast-info    { border-left: 4px solid var(--accent); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.hide {
    animation: toastFadeOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@media (max-width: 600px) {
    .toast-container {
        top: 80px;
        bottom: auto;
        right: 10px;
        left: 10px;
    }
    .toast {
        min-width: 0;
        width: 100%;
    }
}

/* Иконки в чате */
.chat-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

.chat-icon-btn.recording {
    background: rgba(255, 77, 77, 0.15);
    color: #ff4d4d;
}

.chat-icon-btn.recording svg {
    animation: pulse 1s infinite;
}

.send-btn {
    background: linear-gradient(135deg, var(--accent), #cc5500) !important;
    color: #fff !important;
    box-shadow: 0 0 10px var(--accent-glow);
    width: 44px !important;
    height: 44px !important;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-glow);
}
/* ==========================================
   СКРЫТИЕ ШАПКИ ТОЛЬКО В ЧАТЕ
   ========================================== */
body.page-messages .topbar {
    display: none !important;
}

/* Поднимаем чат наверх, так как шапки больше нет */
body.page-messages .chat-wrapper {
    top: 0 !important;
}

/* Поднимаем контейнер, если чат не в чате, а в списке диалогов */
body.page-messages .container {
    margin-top: 20px !important;
}

body.page-messages .topbar,
body.page-group_chat .topbar {
    display: none !important;
}

body.page-messages .chat-wrapper,
body.page-group_chat .chat-wrapper {
    top: 0 !important;
}

/* ==========================================
   АНИМИРОВАННЫЙ ФОН (ИСПРАВЛЕННЫЙ)
   ========================================== */
body {
    position: relative;
    /* Убираем возможные отступы, чтобы фон не съезжал */
    margin: 0;
    padding-bottom: 90px !important; /* Оставляем отступ для нижнего меню, но строго фиксированный */
    min-height: 100vh;
    box-sizing: border-box;
    background-color: var(--bg-base); /* Базовый цвет */
    overflow-x: hidden;
}

/* Слой с движущимися пятнами */
body::before,
body::after {
    content: '';
    position: fixed; /* Жёстко привязываем к окну */
    top: 0;
    left: 0;
    width: 100%;   /* Ровно ширина экрана */
    height: 100%;  /* Ровно высота экрана */
    pointer-events: none;
    z-index: -1;
    opacity: 0.6;
}

body::before {
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 107, 0, 0.15), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 107, 0, 0.12), transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(255, 140, 0, 0.08), transparent 50%);
    animation: bgMove1 25s ease-in-out infinite;
}

body::after {
    background: 
        radial-gradient(circle at 70% 20%, rgba(255, 107, 0, 0.1), transparent 40%),
        radial-gradient(circle at 30% 80%, rgba(255, 107, 0, 0.1), transparent 45%);
    animation: bgMove2 35s ease-in-out infinite;
}

@keyframes bgMove1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25%      { transform: translate(-50px, 30px) scale(1.1); }
    50%      { transform: translate(30px, -20px) scale(0.95); }
    75%      { transform: translate(-20px, -50px) scale(1.05); }
}

@keyframes bgMove2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33%      { transform: translate(40px, -40px) rotate(120deg); }
    66%      { transform: translate(-30px, 40px) rotate(240deg); }
}

/* Отключаем анимацию, если пользователь выбрал свой фон */
body.has-custom-bg::before,
body.has-custom-bg::after {
    display: none;
}

/* На светлой теме делаем пятна менее заметными */
body.theme-light::before,
body.theme-light::after {
    opacity: 0.3;
}
/* ==========================================================
   TЁMA — обновлённая кастомная нижняя навигация
   ========================================================== */
:root {
    --nav-height: 68px;
    --nav-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    padding-bottom: calc(var(--nav-height) + 24px + var(--nav-safe-bottom));
}

.bottom-nav {
    min-height: var(--nav-height);
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(8px + var(--nav-safe-bottom)) max(10px, env(safe-area-inset-left, 0px));
    gap: 6px;
    justify-content: space-evenly;
    background: rgba(10, 10, 12, .88);
    border-top: 1px solid rgba(255, 255, 255, .09);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .32);
    isolation: isolate;
}

.bottom-nav::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 0, .45), transparent);
    pointer-events: none;
}

.bottom-nav .nav-item {
    flex: 1 1 0;
    min-width: 0;
    max-width: 96px;
    min-height: 46px;
    padding: 9px 8px;
    border-radius: 17px;
    color: var(--text-muted);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.bottom-nav .nav-item svg {
    display: block;
    width: 25px !important;
    height: 25px !important;
    flex: 0 0 auto;
    filter: none;
    transform: none;
    stroke-width: 1.9;
}

.bottom-nav .nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .055);
    text-shadow: none;
}

.bottom-nav .nav-item.active {
    color: #ff8a24;
    background: linear-gradient(180deg, rgba(255, 107, 0, .16), rgba(255, 107, 0, .055));
    box-shadow: inset 0 0 0 1px rgba(255, 107, 0, .13);
}

.bottom-nav .nav-item.active svg {
    filter: drop-shadow(0 0 7px rgba(255, 107, 0, .4));
    transform: translateY(-1px);
}

.bottom-nav .nav-item.active::after {
    bottom: 3px;
    width: 4px;
    height: 4px;
    box-shadow: 0 0 9px rgba(255, 107, 0, .85);
}

.bottom-nav .nav-item:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}

/* Leave the message composer and floating player above the dock. */
@media (max-width: 600px) {
    .bottom-nav {
        gap: 3px;
        padding-top: 7px;
        padding-bottom: calc(7px + var(--nav-safe-bottom));
    }
    .bottom-nav .nav-item {
        min-height: 44px;
        padding: 8px 4px;
        border-radius: 14px;
    }
    .bottom-nav .nav-item svg {
        width: 24px !important;
        height: 24px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav .nav-item,
    .bottom-nav .nav-item svg {
        transition: none !important;
    }
}

/* Шапка чата */
.chat-back { font-size: 22px; color: var(--text-main); text-decoration: none; margin-right: 10px; }
.chat-peer { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.chat-title { margin: 0; color: var(--text-main); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-group-ava { width: 42px; height: 42px; object-fit: cover; border-radius: 50%; margin-right: 10px; flex: none; }
.chat-wrapper .chat-messages { min-height: 0; }

/* Чат — светлая тема */
body.theme-light .chat-header,
body.theme-light .chat-form,
body.theme-light .chat-notice { background: rgba(255, 255, 255, .96); border-color: #ddd; }
body.theme-light .chat-title, body.theme-light .chat-back, body.theme-light .header-menu-btn { color: #111; }
body.theme-light .chat-form textarea { background: #f2f2f7; border-color: #d6d6de; color: #111; }
body.theme-light .chat-day span { background: rgba(0, 0, 0, .06); color: #666; }
body.theme-light .reply-bar { background: #f2f2f7; }
body.theme-light .header-menu, body.theme-light .forward-modal-box { background: #fff; border-color: #ddd; }
body.theme-light .header-menu a, body.theme-light .header-menu button { color: #111; }
body.theme-light .forward-input { background: #f6f6fa; color: #111; }
body.theme-light .chat-more { background: rgba(0, 0, 0, .06); color: #111; }

/* ==========================================================
   v3: ПЛЕЕР, ПРОФИЛЬ, КАНАЛЫ, ПОИСК, ВИДИМОСТЬ ПОСТОВ
   ========================================================== */
:root { --ok: #00d68f; --danger: #ff5c5c; --surface-2: rgba(255,255,255,.05); }
body.theme-light { --surface-2: rgba(0,0,0,.05); }

/* ───── общие элементы ───── */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.section-title { margin: 26px 0 12px; font-size: 16px; font-weight: 700; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--glass-border); font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.more-link { display: block; text-align: center; margin: 12px 0 4px; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--text-muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
.link-btn.danger, .danger-btn { color: var(--danger) !important; }
.danger-btn { border-color: rgba(255,92,92,.4) !important; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack > label, .form-stack label { margin: 0; }
.tabs { display: flex; gap: 6px; margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--glass-border); }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 16px; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: 14px; }
.tab:hover { color: var(--text-main); text-shadow: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.switch-row { display: flex !important; align-items: flex-start; gap: 12px; text-transform: none !important; cursor: pointer; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--glass-border); }
.switch-row input { width: 20px !important; height: 20px; margin: 2px 0 0 !important; flex: none; accent-color: var(--accent); }
.switch-row b { display: block; font-size: 14px; color: var(--text-main); }
.switch-row small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.handle-field { display: flex; align-items: center; border: 1px solid var(--glass-border); border-radius: var(--radius-input); background: rgba(0,0,0,.3); padding-left: 12px; margin-top: 6px; }
.handle-field span { color: var(--text-muted); font-weight: 700; }
.handle-field input { border: 0 !important; background: transparent !important; margin: 0 !important; box-shadow: none !important; }
.field-status { min-height: 18px; font-size: 12px; margin-top: 5px; font-weight: 600; text-transform: none; }
.field-status.ok { color: var(--ok); } .field-status.bad { color: var(--danger); }
.danger-zone { border-color: rgba(255,92,92,.35) !important; }
.card select, .vis-row select, .composer-row select, .vis-select { background: rgba(0,0,0,.35); color: var(--text-main); border: 1px solid var(--glass-border); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 13px; max-width: 100%; }
body.theme-light .handle-field { background: #f4f4f4; }

/* ───── посты ───── */
.post-flag { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; font-weight: 600; }
.post-flag.accent { color: var(--accent); text-transform: uppercase; }
.post-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.vis-select { padding: 4px 6px; font-size: 12px; }
.post-original { margin-top: 15px; padding: 15px; border: 1px solid var(--glass-border); border-radius: 12px; background: rgba(0,0,0,.2); }
.post-actions { margin-top: 18px; border-top: 1px solid var(--glass-border); padding-top: 14px; display: flex; gap: 20px; align-items: center; }
.post-actions .push-right { margin-left: auto; }
.comments-section { margin-top: 14px; border-top: 1px solid var(--glass-border); padding-top: 14px; }
.comment-row { font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.comment-form { display: flex; gap: 10px; margin-top: 10px; }
.comment-form input { flex: 1; padding: 10px 14px; border-radius: 20px; background: rgba(0,0,0,.4); border: 1px solid var(--glass-border); color: var(--text-main); min-width: 0; }
.vis-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; text-transform: none; font-size: 13px; color: var(--text-muted); }
.wall-composer textarea, .channel-composer textarea { width: 100%; min-height: 60px; resize: vertical; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.composer-row .btn { margin: 0; }

/* ───── профиль ───── */
.profile-card { padding: 24px 20px; }
.profile-top { display: flex; align-items: center; gap: 18px; }
.profile-avatar-wrap { position: relative; flex: none; }
.profile-avatar-wrap .avatar-lg { width: 96px; height: 96px; display: block; }
.online-dot-lg { position: absolute; right: 4px; bottom: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); border: 3px solid var(--bg-base); box-shadow: 0 0 10px var(--ok); }
.online-dot-sm { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg-base); }
.profile-id { min-width: 0; }
.profile-id h1 { font-size: 26px; margin: 0 0 2px; word-break: break-word; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.profile-nick { font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.profile-uid { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--glass-border); }
.profile-presence { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.profile-presence i { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; }
.profile-presence.is-online { color: var(--ok); } .profile-presence.is-online i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.profile-status { margin: 16px 0 0; font-style: italic; color: var(--text-main); opacity: .9; overflow-wrap: anywhere; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: 16px; background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-main); }
a.stat:hover { border-color: var(--accent); text-shadow: none; color: var(--text-main); }
.stat b { font-size: 20px; line-height: 1.2; } .stat span { font-size: 12px; color: var(--text-muted); }
.profile-bio { margin: 0 0 12px; overflow-wrap: anywhere; }
.info-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.info-list li { display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; }
.info-list li span { width: 20px; flex: none; text-align: center; }

/* ───── треки ───── */
.track-list { display: flex; flex-direction: column; gap: 6px; }
.track { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; transition: .15s; }
.track[hidden] { display: none; }
.track:hover { border-color: var(--glass-border); }
.track.is-current { border-color: rgba(255,107,0,.45); background: rgba(255,107,0,.08); }
.track-play { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 0 12px var(--accent-glow); }
.track-play .i-play { margin-left: 2px; }
.track-play .eq { display: none; gap: 2px; align-items: flex-end; height: 16px; }
.track-play .eq i { width: 3px; background: #fff; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.track-play .eq i:nth-child(2) { animation-delay: .2s; } .track-play .eq i:nth-child(3) { animation-delay: .4s; }
.track.is-playing .track-play .eq, .track-play.is-playing .eq { display: flex; }
.track.is-playing .track-play .i-play, .track-play.is-playing .i-play { display: none; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 16px; } }
.track-meta { flex: 1; min-width: 0; }
.track-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-act { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn { background: none; border: 0; color: var(--text-muted); width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { color: var(--accent); background: var(--surface-2); } .icon-btn.danger:hover { color: var(--danger); }
.music-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.music-toolbar input[type=search] { flex: 1; min-width: 140px; padding: 9px 14px; border-radius: 999px; background: rgba(0,0,0,.3); border: 1px solid var(--glass-border); color: var(--text-main); }
button.js-play-track.is-playing { box-shadow: 0 0 0 3px var(--accent-glow); }

/* ───── каналы / поиск ───── */
.channel-row, .search-row, .member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; margin: 0 0 10px; border-radius: 18px; }
.channel-row-main, .search-main, .member-main { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; color: var(--text-main); }
.channel-row-main:hover, .search-main:hover, .member-main:hover { color: var(--text-main); text-shadow: none; }
.channel-row-title, .search-name { font-weight: 700; display: flex; align-items: center; gap: 5px; }
.channel-row-desc { font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.channel-row-right, .search-act, .member-actions { flex: none; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input { flex: 1; min-width: 0; padding: 14px 20px; border-radius: 50px; background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); color: var(--text-main); outline: none; }
.channel-head { padding: 22px 20px; }
.channel-head-top { display: flex; align-items: center; gap: 16px; }
.channel-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.channel-desc { margin: 16px 0 0; overflow-wrap: anywhere; }
.channel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.channel-post header { border-bottom: 0 !important; margin-bottom: 8px !important; padding-bottom: 0 !important; }
@media (max-width: 520px) {
    .channel-row, .search-row, .member-row { flex-wrap: wrap; }
    .channel-row-right, .search-act, .member-actions { width: 100%; justify-content: flex-start; }
    .profile-top { flex-direction: column; text-align: center; }
    .profile-id h1, .profile-nick, .profile-presence { justify-content: center; }
    .profile-actions { justify-content: center; }
}

/* ───── плеер ───── */
.has-player, html.has-player { padding-bottom: 170px; }
.has-player .fab-button { bottom: 150px !important; }
.mp { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 1100; display: flex; justify-content: center; pointer-events: none; }
.mp[hidden] { display: none; }
.mp-bar { pointer-events: auto; position: relative; width: calc(100% - 16px); max-width: 680px; display: flex; align-items: center; gap: 10px; padding: 8px 12px 10px; background: rgba(22,22,26,.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.55); overflow: hidden; }
.mp-cover { flex: none; width: 42px; height: 42px; border-radius: 10px; border: 0; cursor: pointer; background: linear-gradient(135deg, var(--accent), #b34700); color: #fff; display: flex; align-items: center; justify-content: center; }
.mp-cover svg { width: 20px; height: 20px; }
.mp.is-playing .mp-cover { animation: mp-pulse 2s ease-in-out infinite; }
@keyframes mp-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 6px transparent; } }
.mp-meta { flex: 1; min-width: 0; background: none; border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; padding: 0; display: flex; flex-direction: column; }
.mp-meta .mp-title { font-weight: 700; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-meta .mp-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-ctrl { display: flex; align-items: center; gap: 2px; flex: none; }
.mp-ctrl button, .mp-main button, .mp-sheet-head button { background: none; border: 0; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.mp-ctrl button { width: 36px; height: 36px; } .mp-ctrl svg { width: 20px; height: 20px; }
.mp-play { background: var(--accent) !important; box-shadow: 0 0 12px var(--accent-glow); }
.mp-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; display: none; font-variant-numeric: tabular-nums; }
.mp-close { background: none; border: 0; color: var(--text-muted); font-size: 24px; line-height: 1; cursor: pointer; width: 28px; flex: none; }
.mp-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.12); cursor: pointer; }
.mp-progress-fill { height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.mp-sheet { display: none; }
.mp.expanded { bottom: 0; top: 0; align-items: stretch; background: rgba(8,8,10,.97); backdrop-filter: blur(24px); pointer-events: auto; overflow-y: auto; }
.mp.expanded .mp-bar { display: none; }
.mp.expanded .mp-sheet { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 480px; padding: 16px 22px calc(28px + env(safe-area-inset-bottom)); margin: 0 auto; }
.mp-sheet-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.mp-sheet-head button { width: 40px; height: 40px; } .mp-sheet-head svg { width: 24px; height: 24px; }
.mp-art { aspect-ratio: 1; width: min(100%, 320px); margin: 6px auto 0; border-radius: 28px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), #5a1d00 70%); color: rgba(255,255,255,.9); box-shadow: 0 20px 60px rgba(255,107,0,.25); }
.mp-art svg { width: 38%; height: 38%; }
.mp.is-playing .mp-art { animation: mp-breathe 3s ease-in-out infinite; }
@keyframes mp-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
.mp-now .mp-title { font-size: 20px; font-weight: 800; color: #fff; overflow-wrap: anywhere; }
.mp-now .mp-artist { font-size: 15px; color: var(--text-muted); margin-top: 2px; }
.mp-seek { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mp-seek input, .mp-vol input { flex: 1; accent-color: var(--accent); height: 22px; cursor: pointer; }
.mp-main { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.mp-main button { width: 48px; height: 48px; } .mp-main svg { width: 26px; height: 26px; }
.mp-main .mp-play.big { width: 68px; height: 68px; } .mp-main .mp-play.big svg { width: 34px; height: 34px; }
.mp-opt { color: var(--text-muted) !important; position: relative; } .mp-opt.on { color: var(--accent) !important; }
.mp-opt b { position: absolute; font-size: 10px; right: 8px; top: 8px; }
.mp-vol { display: flex; align-items: center; gap: 10px; color: var(--text-muted); } .mp-vol svg { width: 20px; height: 20px; flex: none; }
.mp-queue-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }
.mp-queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: q; }
.mp-queue-list li { counter-increment: q; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 9px 12px; border-radius: 12px; cursor: pointer; background: rgba(255,255,255,.04); }
.mp-queue-list li.cur { background: rgba(255,107,0,.14); }
.mp-queue-list .q-title { font-size: 14px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-queue-list .q-artist { grid-column: 1; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-queue-list .q-del { grid-column: 2; grid-row: 1 / span 2; background: none; border: 0; color: var(--text-muted); font-size: 20px; cursor: pointer; }
body.mp-open { overflow: hidden; }
@media (min-width: 720px) { .mp-time { display: inline; } .mp-bar { padding: 10px 16px 12px; } }
body.theme-light .mp-bar { background: rgba(255,255,255,.97); }
body.theme-light .mp-meta .mp-title, body.theme-light .mp-ctrl button, body.theme-light .mp-queue-list .q-title { color: #111; }
body.theme-light .mp.expanded { background: rgba(245,245,247,.98); }
body.theme-light .mp-now .mp-title, body.theme-light .mp-main button { color: #111; }
body.theme-light .mp-ctrl .mp-play, body.theme-light .mp-main .mp-play { color: #fff; }

/* полоска загрузки при переходах без перезагрузки */
#spa-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); z-index: 3000; opacity: 0; transition: width .35s ease, opacity .3s; pointer-events: none; }

/* =========================================
   v4: вход, регистрация, почта, поддержка, админка, шифрование
   ========================================= */
.card select, .adm-filter select, .adm-inline select, .sup-form select {
    width: 100%; padding: 12px 14px; margin-top: 8px; background: rgba(0,0,0,.4); color: var(--text-main);
    border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius-input); font: inherit; cursor: pointer;
}
.card input[type=checkbox], .card input[type=radio] { width: auto; margin: 0; padding: 0; box-shadow: none; accent-color: var(--accent); }
.card label.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13px; margin: 10px 0 0; color: var(--text-main); font-weight: 500; }
.badge-inline { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.chip.ok { color: var(--ok); border-color: rgba(0,214,143,.4); }
.chip.bad { color: #ff7b7b; border-color: rgba(255,92,92,.4); }
.link-btn { background: none; border: none; color: var(--accent-light); cursor: pointer; font: inherit; font-size: 14px; padding: 4px 2px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }
.link-btn.muted { color: var(--text-muted); }

/* --- авторизация --- */
.auth-wrap { min-height: calc(100vh - 220px); display: flex; align-items: center; justify-content: center; padding: 16px 0; }
.auth-card { width: 100%; max-width: 420px; margin: 0 auto; padding: 36px 32px; text-align: left; }
.auth-card-wide { max-width: 470px; }
.auth-logo { text-align: center; font-size: 30px; font-weight: 900; letter-spacing: 2px; margin-bottom: 18px; }
.auth-logo span { color: var(--accent); text-shadow: 0 0 18px var(--accent-glow); }
.auth-icon { text-align: center; font-size: 46px; margin-bottom: 4px; }
.auth-title { text-align: center; margin: 0 0 6px; font-size: 24px; }
.auth-sub { text-align: center; color: var(--text-muted); margin: 0 0 24px; line-height: 1.5; font-size: 14px; }
.auth-btn { width: 100%; margin-top: 8px; padding: 15px; }
.auth-row { text-align: right; margin: -8px 0 6px; font-size: 13px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-muted); }
.auth-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin: 14px 0 0; }
.auth-split { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.auth-split form { margin: 0; }
.field { display: block; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-38%); background: none; border: none; cursor: pointer; font-size: 18px; opacity: .6; padding: 6px; }
.at-sign { position: absolute; left: 15px; top: 50%; transform: translateY(-22%); color: var(--text-muted); font-weight: 700; }
.pw-meter { display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; background: #ff4d4d; transition: width .25s, background .25s; }
.pw-meter[data-s="1"] i { width: 25%; } .pw-meter[data-s="2"] i { width: 50%; background: #ffb020; }
.pw-meter[data-s="3"] i { width: 75%; background: #9bd400; } .pw-meter[data-s="4"] i { width: 100%; background: #00d68f; }
.card .otp-input { text-align: center; font: 700 34px/1 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 10px; padding: 16px 10px 16px 20px; margin-bottom: 12px; }

/* --- поддержка --- */
.sup-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.sup-list { display: flex; flex-direction: column; gap: 10px; }
.sup-row { display: flex !important; align-items: center; gap: 14px; padding: 14px 18px !important; margin: 0 0 10px !important; color: var(--text-main); }
.sup-subj { font-weight: 700; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; box-shadow: 0 0 8px var(--accent-glow); }
.sup-status { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid var(--glass-border); }
.sup-status.st-open { color: #ffb020; border-color: rgba(255,176,32,.4); }
.sup-status.st-answered { color: var(--ok); border-color: rgba(0,214,143,.4); }
.sup-status.st-closed { color: var(--text-muted); }
.sup-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.sup-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.sup-msg { max-width: 86%; padding: 12px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--glass-border); }
.sup-msg.mine { align-self: flex-end; background: rgba(255,107,0,.12); border-color: rgba(255,107,0,.3); }
.sup-msg.staff:not(.mine) { border-color: rgba(0,214,143,.35); }
.sup-msg.internal { background: rgba(255,176,32,.08); border: 1px dashed rgba(255,176,32,.5); }
.sup-who { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.sup-body { word-break: break-word; line-height: 1.5; }
.sup-time { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-align: right; }
.sup-reply textarea, .sup-form textarea { min-height: 90px; resize: vertical; }

/* --- админка --- */
.adm-tabs { margin-bottom: 18px; }
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.adm-stat { margin: 0 !important; padding: 16px !important; text-align: center; }
.adm-stat span { display: block; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.adm-stat b { display: block; font-size: 30px; font-weight: 800; margin-top: 6px; }
.adm-privacy { display: flex; gap: 16px; align-items: center; border-color: rgba(0,214,143,.35); }
.adm-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.adm-chart .bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.adm-chart .bar i { width: 100%; max-width: 28px; background: linear-gradient(180deg, var(--accent), #cc5500); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.adm-chart .bar em { font-style: normal; font-size: 10px; color: var(--text-muted); position: absolute; top: 0; }
.adm-chart .bar small { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.adm-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.adm-event { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--glass-border); font-size: 13px; }
.adm-event:last-child { border-bottom: none; }
.adm-event code { flex: none; font-size: 12px; color: var(--accent-light); }
.adm-event span { flex: 1; min-width: 0; word-break: break-word; color: var(--text-muted); }
.adm-event time { flex: none; font-size: 11px; color: var(--text-muted); }
.adm-filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-filter input[type=text] { flex: 1; min-width: 160px; padding: 12px 18px; border-radius: 999px; background: rgba(0,0,0,.35); border: 1px solid var(--glass-border); color: var(--text-main); }
.adm-filter select { width: auto; margin: 0; min-width: 150px; }
.adm-user { padding: 16px 20px !important; margin: 0 0 12px !important; }
.adm-user-head { display: flex; gap: 12px; align-items: flex-start; }
.adm-more { margin-top: 10px; }
.adm-more summary { cursor: pointer; font-size: 13px; color: var(--accent-light); user-select: none; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.adm-inline { display: flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.adm-inline input[type=text], .adm-inline input[type=number], .adm-inline input[type=email] { padding: 9px 12px; border-radius: 10px; background: rgba(0,0,0,.4); border: 1px solid var(--glass-border); color: var(--text-main); font: inherit; font-size: 13px; width: auto; min-width: 150px; }
.adm-inline select { width: auto; margin: 0; padding: 9px 12px; font-size: 13px; }
.adm-block { margin: 0; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 16px; }
.adm-split { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: space-between; margin-top: 8px; }
.adm-post { display: flex !important; gap: 14px; align-items: flex-start; padding: 14px 18px !important; margin: 0 0 10px !important; }
.adm-invite { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,.25); margin-bottom: 6px; flex-wrap: wrap; }
.adm-invite code { color: var(--accent); letter-spacing: 1px; font-weight: 700; flex: none; }
.adm-invite span { flex: 1; }
.adm-pager { display: flex; gap: 6px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.adm-pager .pg { padding: 6px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--glass-border); color: var(--text-main); font-size: 13px; }
.adm-pager .pg.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.card label.mode-card { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 14px 16px 14px 42px; position: relative; text-transform: none; letter-spacing: 0; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--glass-border); cursor: pointer; color: var(--text-main); font-size: 14px; }
.mode-card input { position: absolute !important; left: 14px; top: 16px; }
.mode-card span { font-size: 12px; color: var(--text-muted); font-weight: 400; line-height: 1.4; }
.mode-card.active { border-color: var(--accent); background: rgba(255,107,0,.08); }
.mail-preview { width: 100%; min-width: min(560px, 80vw); height: 520px; border: 1px solid var(--glass-border); border-radius: 12px; background: #0b0b0f; margin-top: 10px; }

/* --- объявление --- */
.site-announce { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; font-size: 14px; border-bottom: 1px solid var(--glass-border); background: rgba(255,107,0,.12); }
.site-announce.ann-warn { background: rgba(255,176,32,.16); }
.site-announce.ann-success { background: rgba(0,214,143,.14); }
.site-announce button { background: none; border: none; color: inherit; font-size: 22px; cursor: pointer; line-height: 1; }

/* --- сквозное шифрование --- */
.e2e-overlay { position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.e2e-box { width: 100%; max-width: 440px; background: #14141a; border: 1px solid var(--glass-border); border-radius: 22px; padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-height: 92vh; overflow-y: auto; }
body.theme-light .e2e-box { background: #fff; }
.e2e-box h2 { margin: 6px 0 8px; font-size: 20px; text-align: center; }
.e2e-box .e2e-ico { text-align: center; font-size: 44px; }
.e2e-box p { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.e2e-box input[type=password], .e2e-box input[type=text] { width: 100%; box-sizing: border-box; padding: 13px 16px; margin: 0 0 10px; background: rgba(0,0,0,.4); border: 1px solid var(--glass-border); border-radius: 12px; color: var(--text-main); font: inherit; }
body.theme-light .e2e-box input { background: #f1f1f4; }
.e2e-box .e2e-warn { background: rgba(255,176,32,.1); border: 1px solid rgba(255,176,32,.35); color: #ffc65c; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 0 0 14px; line-height: 1.45; }
.e2e-box .e2e-err { color: #ff6b6b; font-size: 13px; min-height: 18px; margin: 0 0 8px; }
.e2e-box .e2e-actions { display: flex; gap: 10px; }
.e2e-box .e2e-actions .btn { flex: 1; margin: 0; padding: 13px 10px; }
.e2e-lock { font-size: 12px; color: var(--ok); margin-left: 6px; }
.msg-e2e-pending { opacity: .6; font-style: italic; }
.msg-legacy-flag { font-size: 10px; color: #ffb020; margin-left: 6px; }
.chat-lockbar { display: none; text-align: center; padding: 14px; color: var(--text-muted); font-size: 14px; }
.chat-lockbar button { margin-top: 8px; }
.fp-code { font: 600 15px/1.8 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 2px; text-align: center; color: var(--text-main); background: rgba(0,0,0,.3); border-radius: 12px; padding: 12px; word-break: break-all; }
.e2e-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:6px 14px; font-size:12px; color:var(--text-muted); background:rgba(0,214,143,.07); border-bottom:1px solid var(--glass-border); }
.e2e-bar.warn { background:rgba(255,176,32,.12); color:#ffb020; }
.msg-legacy { font-size:10px; color:#ffb020; margin-top:4px; }
.msg-locked { opacity:.7; font-style:italic; }
.e2e-box .btn-secondary { background: rgba(255,255,255,.08); box-shadow: none; color: var(--text-main); }

/* ═════════ Сторис v5 ═════════ */
.st-strip { margin: 0 0 18px; padding: 14px 14px 8px; border: 1px solid var(--glass-border); border-radius: 18px; background: linear-gradient(135deg, rgba(255,107,0,.07), rgba(255,255,255,.025)); overflow: hidden; }
.card .st-strip { margin: 0; padding: 0; border: 0; background: none; }
.st-row { display: flex; gap: 14px; overflow-x: auto; padding: 3px 1px 8px; scrollbar-width: none; }
.st-row::-webkit-scrollbar { display: none; }
.st-bubble { flex: 0 0 68px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.st-big .st-bubble { flex-basis: 84px; }
.st-ring { width: 64px; height: 64px; padding: 3px; border-radius: 50%; background: conic-gradient(from 200deg, #ffb347, #ff6b00, #ff2d78, #ffb347); display: flex; transition: filter .2s, background .2s; }
.st-big .st-ring { width: 80px; height: 80px; }
.st-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--bg-base, #0a0a0c); display: block; background: #222; }
.st-bubble.st-seen .st-ring { background: #4a4a50; filter: saturate(.3); }
.st-ring-add { background: none; border: 2px dashed rgba(255,107,0,.6); padding: 0; align-items: center; justify-content: center; }
.st-plus { font-size: 26px; color: var(--accent, #ff6b00); line-height: 1; }
.st-name { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--text-muted); }
.st-empty { align-self: center; color: var(--text-muted); font-size: 12px; }

.st-view, .st-comp { position: fixed; inset: 0; z-index: 10050; background: rgba(0,0,0,.96); display: flex; align-items: center; justify-content: center; }
.st-comp { flex-direction: column; background: #0b0b0d; z-index: 10060; padding: 0 0 8px; }
.st-stage, .st-cstage { position: relative; width: min(100%, 420px); aspect-ratio: 9 / 16; max-height: 100dvh; background: #000; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 80px #000; touch-action: manipulation; }
@media (max-width: 480px) { .st-stage { width: 100%; height: 100dvh; aspect-ratio: auto; border-radius: 0; } }
.st-media { position: absolute; inset: 0; background: #000; }
.st-media img, .st-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.st-bars { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 4px; z-index: 5; }
.st-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.3); overflow: hidden; }
.st-bars i { display: block; height: 100%; background: #fff; }
.st-head { position: absolute; top: 18px; left: 10px; right: 8px; z-index: 5; display: flex; align-items: center; gap: 10px; color: #fff; text-shadow: 0 1px 5px #000; }
.st-ava { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.7); }
.st-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-who b { font-size: 14px; } .st-who small { font-size: 11px; opacity: .8; }
.st-ibtn { border: 0; background: rgba(0,0,0,.35); color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.st-zone { position: absolute; top: 70px; bottom: 70px; z-index: 3; }
.st-zl { left: 0; width: 32%; } .st-zr { right: 0; width: 68%; }
.st-text { position: absolute; left: 50%; transform: translate(-50%, -50%); max-width: 86%; z-index: 4; padding: 8px 14px; border-radius: 12px; font-size: 24px; font-weight: 800; line-height: 1.25; text-align: center; white-space: pre-wrap; word-break: break-word; pointer-events: none; }
.st-text.st-drag { pointer-events: auto; cursor: grab; touch-action: none; }
.st-t-bg { border-radius: 10px; }
.st-music { position: absolute; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 5; display: flex; align-items: center; gap: 8px; max-width: 88%; padding: 8px 14px; border-radius: 999px; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); color: #fff; font-size: 13px; }
.st-music span:last-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-note { color: var(--accent, #ff6b00); animation: stNote 1.2s ease-in-out infinite alternate; }
@keyframes stNote { from { transform: translateY(1px); } to { transform: translateY(-2px); } }
.st-chip-x { border: 0; background: rgba(255,255,255,.2); color: #fff; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }

.st-ctop { width: min(100%, 420px); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 8px; color: #fff; }
.st-pub { border: 0; border-radius: 999px; padding: 10px 18px; background: linear-gradient(135deg, #ff7a00, #d65a00); color: #fff; font-weight: 800; font-size: 14px; cursor: pointer; }
.st-pub:disabled { opacity: .6; } .st-wide { width: 100%; margin-top: 14px; }
.st-cstage { flex: 0 1 auto; max-height: calc(100dvh - 250px); }
.st-tools { display: flex; gap: 10px; padding: 10px 0; }
.st-tool { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: rgba(255,255,255,.08); color: #fff; padding: 8px 16px; border-radius: 14px; font-size: 11px; cursor: pointer; }
.st-tool.disabled { opacity: .35; }
.st-ti { font-size: 18px; font-weight: 800; }
.st-thumbs { display: flex; gap: 8px; overflow-x: auto; max-width: min(100%, 420px); padding: 4px 8px; }
.st-th { position: relative; flex: 0 0 52px; height: 52px; border-radius: 10px; border: 2px solid transparent; padding: 0; overflow: hidden; background: #222; cursor: pointer; }
.st-th.on { border-color: var(--accent, #ff6b00); }
.st-th img, .st-th video { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-th-v { position: absolute; right: 3px; bottom: 1px; color: #fff; font-size: 10px; }
.st-th-d { position: absolute; left: 4px; top: -2px; color: var(--accent, #ff6b00); font-size: 22px; }
.st-th-add { color: #fff; font-size: 22px; background: rgba(255,255,255,.08); }
.st-cprog { color: #fff; font-size: 13px; padding: 6px; }
.st-sheet-back { position: absolute; inset: 0; z-index: 10; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.st-sheet { width: min(100%, 460px); max-height: 80dvh; overflow: auto; background: #16161a; border-radius: 20px 20px 0 0; padding: 18px; color: #fff; box-sizing: border-box; }
.st-sheet h3 { margin: 0 0 12px; }
.st-sheet textarea, .st-sheet input[type=search] { width: 100%; box-sizing: border-box; background: #0b0b0d; border: 1px solid var(--glass-border); color: #fff; border-radius: 12px; padding: 12px; font: inherit; }
.st-styles, .st-colors { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.st-style { border: 1px solid var(--glass-border); background: none; color: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 800; cursor: pointer; }
.st-style.on { background: var(--accent, #ff6b00); border-color: transparent; }
.st-col { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); cursor: pointer; padding: 0; }
.st-col.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent, #ff6b00); }
.st-mlist { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.st-mrow { background: rgba(255,255,255,.05); border-radius: 12px; padding: 8px 10px; }
.st-mmain { display: flex; align-items: center; gap: 10px; }
.st-mplay { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent, #ff6b00); color: #fff; cursor: pointer; flex: none; }
.st-mmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-mmeta b, .st-mmeta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .st-mmeta small { color: var(--text-muted); }
.st-mpick { border: 1px solid var(--glass-border); background: none; color: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.st-mstart { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; } .st-mstart input { flex: 1; }
.st-mempty { color: var(--text-muted); text-align: center; padding: 16px; }

/* Галерея */
.gallery-upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--glass-border); background: #000; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.gallery-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; }
.gallery-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.gallery-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; display: block; }
@media (min-width: 640px) { .gallery-strip { grid-template-columns: repeat(8, 1fr); } }

/* Голосовые сообщения v5 */
.voice { display: flex; align-items: center; gap: 12px; min-width: 230px; max-width: 290px; padding: 2px 2px; color: inherit; }
.voice-play { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; background: currentColor; transition: transform .15s; }
.voice-play svg { color: var(--bubble-bg, #1a1a1d); mix-blend-mode: normal; }
.chat-msg-row.mine .voice-play { background: #fff; } .chat-msg-row.mine .voice-play svg { color: #e8650a; }
.chat-msg-row.theirs .voice-play { background: var(--accent, #ff6b00); } .chat-msg-row.theirs .voice-play svg { color: #fff; }
.voice-play:active { transform: scale(.92); }
.voice-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.voice-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .38; transition: opacity .15s; }
.voice-wave i.on { opacity: 1; }
.voice.playing .voice-wave i.on:last-of-type { animation: voicePulse .8s infinite alternate; }
@keyframes voicePulse { from { opacity: 1; } to { opacity: .6; } }
.voice-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; opacity: .85; }
.voice-speed { border: 0; background: rgba(255,255,255,.18); color: inherit; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.chat-msg-row.theirs .voice-wave i.on { background: var(--accent, #ff6b00); opacity: 1; }

/* ==========================================================
   v5.1 — ДЕСКТОП (≥1024px): боковая панель + широкий контент
   Мобильная версия не затрагивается.
   ========================================================== */
.nav-label { display: none; }
@media (min-width: 1024px) {
    :root { --side-w: 248px; }
    html, body { padding-bottom: 24px; }
    body { padding-left: var(--side-w); }

    /* Нижняя панель → левый сайдбар */
    .bottom-nav {
        position: fixed; top: 0; bottom: 0; left: 0; right: auto; width: var(--side-w);
        min-height: 0; height: 100vh; flex-direction: column; justify-content: flex-start; align-items: stretch;
        gap: 6px; padding: 84px 14px 20px; background: rgba(12,12,14,.92);
        border-top: 0; border-right: 1px solid rgba(255,255,255,.08); box-shadow: 8px 0 30px rgba(0,0,0,.25);
        z-index: 600; overflow-y: auto;
    }
    .bottom-nav::before {
        content: "TËMA"; position: absolute; top: 22px; left: 26px; font-size: 24px; font-weight: 900; letter-spacing: 1px; color: #fff;
        text-shadow: none; background: none !important; width: auto; height: auto;
    }
    .bottom-nav::after { inset: 0 0 0 auto; width: 1px; height: auto; background: linear-gradient(180deg, transparent, rgba(255,107,0,.4), transparent); }
    .bottom-nav .nav-item {
        flex: 0 0 auto; max-width: none; width: 100%; min-height: 50px; padding: 12px 16px;
        flex-direction: row !important; justify-content: flex-start !important; align-items: center; gap: 14px; border-radius: 16px;
    }
    .bottom-nav .nav-item .nav-label { display: inline; font-size: 15px; font-weight: 600; letter-spacing: .2px; }
    .bottom-nav .nav-item.active::after { display: none; }
    .bottom-nav .nav-item.active { box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px rgba(255,107,0,.13); }
    .bottom-nav .nav-item .badge-dot, .bottom-nav .nav-item .bottom-dot { position: static !important; margin-left: auto; transform: none !important; }

    /* Шапка — правее сайдбара, без логотипа */
    .topbar { width: auto; margin-left: calc(-1 * var(--side-w)); padding: 14px 32px 14px calc(var(--side-w) + 32px); }
    .topbar .logo { visibility: hidden; width: 0; overflow: hidden; }
    .topbar { justify-content: flex-end; }

    /* Контент */
    .container { max-width: 760px; margin: 32px auto; padding: 0 24px; }
    body.page-photos .container, body.page-music .container, body.page-channels .container, body.page-friends .container,
    body.page-search .container, body.page-stories .container, body.page-saved .container,
    body.page-support .container, body.page-notifications .container { max-width: 1040px; }
    body.page-admin .container { max-width: 1180px; }
    body.page-profile .container { max-width: 880px; }
    body.page-messages .container { max-width: 820px; margin-top: 32px !important; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .flash { max-width: 760px; margin-left: auto; margin-right: auto; }

    /* Чат — по центру области контента, без нижней панели */
    .chat-wrapper { left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); top: 0 !important; bottom: 0; max-width: 880px;
        border-left: 1px solid rgba(255,255,255,.06); border-right: 1px solid rgba(255,255,255,.06); }

    /* Плеер и кнопка + */
    .mp { left: var(--side-w); bottom: 16px; }
    .mp-bar { max-width: 720px; }
    .has-player, html.has-player { padding-bottom: 110px; }
    .fab-button { bottom: 32px; right: 40px; }
    .has-player .fab-button { bottom: 100px !important; }
}
@media (min-width: 1500px) {
    .container { max-width: 820px; }
    body.page-photos .container, body.page-music .container, body.page-channels .container, body.page-friends .container,
    body.page-search .container, body.page-stories .container { max-width: 1160px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (min-width: 1024px) { body.page-settings .container, body.page-support .container { max-width: 820px; } }
