/* ===== Базовые стили ===== */
:root {
    --accent: #0095f6;
    --accent-hover: #007fd6;
    --grad: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    --bg: #fafafa;
    --card: #fff;
    --border: #dbdbdb;
    --text: #1c1e21;
    --muted: #8e8e8e;
    --danger: #ed4956;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

button { font-family: inherit; }

/* ===== Экран входа ===== */
.auth-screen {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow: hidden;
    background: linear-gradient(160deg, #fff7ed 0%, #fef2f4 45%, #eef6ff 100%);
}

.auth-bg { position: absolute; inset: 0; pointer-events: none; }

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.55;
    animation: float 9s ease-in-out infinite;
}

.orb-1 { width: 340px; height: 340px; background: #f09433; top: -90px; left: -80px; }
.orb-2 { width: 300px; height: 300px; background: #dc2743; bottom: -70px; right: -70px; animation-delay: -3s; }
.orb-3 { width: 240px; height: 240px; background: #0095f6; bottom: 15%; left: -90px; animation-delay: -6s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-24px); }
}

.auth-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
    animation: cardIn 0.5s ease;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-box { text-align: center; margin-bottom: 22px; }

.logo-camera {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: var(--grad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 10px 24px rgba(220, 39, 67, 0.35);
}

.logo-camera svg { width: 34px; height: 34px; }

.logo {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -1.5px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.logo-sub { color: var(--muted); font-size: 14px; margin-top: 8px; }

.tabs {
    display: flex;
    background: #f1f1f4;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.field input,
.field textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #e4e4e7;
    border-radius: 12px;
    background: #fafafa;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
    background: #fff;
}

.btn-primary {
    padding: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #b2dffc; cursor: not-allowed; }

.error-msg { color: var(--danger); font-size: 13px; min-height: 16px; text-align: center; }

.auth-foot {
    text-align: center;
    color: rgba(0, 0, 0, 0.45);
    font-size: 13px;
    margin-top: 18px;
}
/* ===== Экран приложения ===== */
.app-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo.small { font-size: 24px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.user-badge { font-size: 13px; font-weight: 600; color: var(--text); }

.icon-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover { background: #f1f1f4; }

.lang-select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 6px;
    cursor: pointer;
    outline: none;
}
.lang-float {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 30;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    border-color: #d5d5da;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

/* Контейнер */
.container {
    flex: 1;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 12px 90px;
}

/* Нижняя навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 10px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    max-width: 600px;
    margin: 0 auto;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 12px;
    transition: color 0.2s;
}

.nav-btn.active { color: var(--accent); }

.nav-btn svg { display: block; }

.nav-add {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(220, 39, 67, 0.4);
    transform: translateY(-14px);
    transition: transform 0.2s;
}

.nav-add:hover { transform: translateY(-14px) scale(1.06); }

/* Карточка поста */
.feed { display: flex; flex-direction: column; gap: 18px; }

.post-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    animation: cardIn 0.3s ease;
}

.post-header {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    gap: 10px;
}

.avatar,
.post-avatar-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    color: #fff;
    background: var(--grad);
    overflow: hidden;
}

.avatar img,
.post-avatar-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-author {
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text);
    padding: 0;
}

.post-author:hover { text-decoration: underline; }

.post-date { color: var(--muted); font-size: 11px; margin-top: 2px; }

.post-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: #efefef;
    cursor: pointer;
}

.post-body { padding: 12px 14px 14px; }

.post-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

.like-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: transform 0.15s;
}

.like-btn:active { transform: scale(1.4); }

.likes-count { font-size: 14px; font-weight: 700; }

.post-caption { font-size: 14px; word-break: break-word; line-height: 1.4; }

.empty-feed {
    text-align: center;
    color: var(--muted);
    padding: 48px 16px;
    font-size: 15px;
    line-height: 1.6;
}

/* Статус внизу ленты: спиннер / конец / ошибка */
.feed-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px 16px;
    color: var(--muted);
    font-size: 13px;
    cursor: default;
    user-select: none;
}
.feed-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: feedSpin .8s linear infinite;
    flex-shrink: 0;
}
@keyframes feedSpin {
    to { transform: rotate(360deg); }
}

/* ===== Профиль ===== */
.profile-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 8px 4px 20px;
    position: relative;
}

.profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: visible;
    margin-top: 6px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-camera {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.avatar-camera svg { width: 13px; height: 13px; }

.profile-info { flex: 1; min-width: 0; }

.profile-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.profile-name-row h2 {
    font-size: 19px;
    font-weight: 700;
    word-break: break-word;
}

.profile-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 8px;
}

.stat { display: flex; flex-direction: column; align-items: flex-start; }

.stat b { font-size: 17px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }

.profile-bio {
    font-size: 13.5px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.profile-bio.empty { color: var(--muted); }

/* Сетка постов в профиле */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.profile-grid .grid-post {
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 0;
    position: relative;
    overflow: hidden;
}

.profile-grid .grid-post:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
}

.profile-grid .grid-post img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Посты, ещё не прошедшие модерацию (видит автор/админ) */
.profile-grid .grid-post.grid-post-mod img {
    opacity: 0.4;
    filter: grayscale(0.7);
}
.profile-grid .grid-post.grid-post-mod.mod-rejected img {
    opacity: 0.3;
}
.profile-grid .grid-post .grid-mod-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ===== Модалки ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    background: #fff;
    width: 100%;
    max-width: 520px;
    border-radius: 22px 22px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    animation: slideUp 0.25s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-head h3 { font-size: 17px; font-weight: 700; }

.modal-close {
    background: #f1f1f4;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card form { display: flex; flex-direction: column; gap: 12px; }

/* Область выбора файла */
.file-drop {
    border: 2px dashed #c9c9ce;
    border-radius: 16px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
}

.file-drop:hover { border-color: var(--accent); background: #f0f8ff; }

.drop-icon { color: var(--muted); margin-bottom: 8px; }
.drop-icon svg { vertical-align: middle; }
.file-drop p { color: var(--muted); font-size: 14px; }

#file-preview,
#file-preview.show {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-card textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e4e4e7;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

.modal-card textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.15);
}

/* Редактирование аватара */
.avatar-edit-wrap { display: flex; justify-content: center; }

.avatar-edit {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: none;
    background: var(--grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
}

.avatar-edit img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 5px 4px;
    text-transform: none;
    letter-spacing: 0;
}

/* Десктоп: модалка по центру */
@media (min-width: 560px) {
    .modal-overlay { align-items: center; padding: 24px; }
    .modal-card { border-radius: 22px; max-height: 80vh; }
}

@media (min-width: 900px) {
    .profile-head { gap: 32px; }
    .profile-avatar { width: 120px; height: 120px; font-size: 44px; }
    .profile-name-row h2 { font-size: 24px; }
    .stat b { font-size: 20px; }
    .stat span { font-size: 13px; }
    .profile-grid { gap: 6px; }
}

/* ===== Просмотр поста ===== */
.viewer-card {
    background: #fff;
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    overflow: hidden;
    position: relative;
    animation: cardIn 0.25s ease;
}

.viewer-card > img {
    width: 100%;
    max-height: 70vh;
    object-fit: cover;
    display: block;
    background: #000;
}

.viewer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    z-index: 5;
}

.viewer-caption { padding: 12px 16px 4px; font-size: 14px; word-break: break-word; }
.viewer-actions { padding: 4px 16px 14px; display: flex; align-items: center; gap: 12px; }

/* Аватар в карточке поста — заменяет .post-avatar-mini */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ===== Кнопки действий поста ===== */
.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.post-actions-left { display: flex; align-items: center; gap: 6px; }
.post-actions-right { display: flex; align-items: center; gap: 4px; }

.action-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    transition: transform 0.15s, color 0.15s;
}

.action-btn:active { transform: scale(1.3); }

.action-btn.active-like { color: #ed4956; }
.action-btn.active-save { color: var(--accent); }

.post-likes {
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 4px;
}

.post-comments-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12.5px;
    cursor: pointer;
    font-weight: 600;
}

.post-comments-link:hover { color: var(--text); }

/* Кнопка подписки */
.follow-btn {
    margin: 10px 0 6px;
    padding: 11px 14px;
    width: 100%;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.follow-btn:hover { background: var(--accent-hover); }
.follow-btn.following { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.follow-btn.following:hover { background: #fafafa; }

/* Вкладки профиля */
.profile-tabs {
    display: flex;
    border-top: 1px solid var(--border);
    margin-bottom: 4px;
}

.p-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 13px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.p-tab.active { color: var(--text); border-bottom-color: var(--text); }

/* Статистика профиля кликабельна */
.stat { cursor: pointer; border-radius: 8px; padding: 2px 4px; transition: background 0.15s; }
.stat:hover { background: #f1f1f4; }

/* ===== Комментарии ===== */
.comments-modal { display: flex; flex-direction: column; max-height: 85vh; }

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    min-height: 120px;
}

.no-comments {
    color: var(--muted);
    text-align: center;
    padding: 30px 10px;
    font-size: 14px;
}

.comment-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 2px;
}

.avatar-sm { width: 30px; height: 30px; font-size: 13px; }

.comment-text { flex: 1; min-width: 0; }
.comment-text p { font-size: 13.5px; word-break: break-word; margin-top: 2px; }
.comment-author { font-size: 13px; }

.comment-delete {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.comment-delete:hover { color: var(--danger); }

.comment-form {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 6px;
}

.comment-form input {
    flex: 1;
    padding: 11px 14px;
    border: 1.5px solid #e4e4e7;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.comment-form input:focus { border-color: var(--accent); }

.comment-form button {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    padding: 0 8px;
}

/* Списки пользователей */
.users-list { max-height: 60vh; overflow-y: auto; }

.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    cursor: pointer;
    border-radius: 10px;
}

.user-row:hover { background: #f5f5f7; }
.user-row b { font-size: 14px; }

/* ===== Исправление адаптивности (горизонтальный скролл) ===== */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    overflow-x: clip;
    position: relative;
}

img, svg, video, canvas {
    max-width: 100%;
}

/* Длинные слова и имена не должны вылезать за экран */
h1, h2, h3, p, span, b, button, a, label, textarea, input {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Шапка: длинный username обрезается многоточием */
.topbar-actions { min-width: 0; }
.user-badge {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 45vw;
}

/* Любые flex-колонки не должны распирать страницу */
.profile-head, .profile-info, .profile-name-row,
.comment-text, .viewer-caption, .post-header, .post-body {
    min-width: 0;
}

/* Автор поста — перенос или обрезка длинного ника */
.post-author {
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.comment-text { flex: 1 1 0; }
.comment-row { overflow: hidden; }

/* Декоративные «орбы» не должны создавать скролл */
.auth-bg { overflow: hidden; }
.orb { will-change: transform; }

/* Обрезка длинного ника в профиле */
.profile-name-row h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Фиксация на очень узких экранах */
@media (max-width: 360px) {
    .topbar { padding-left: 10px; padding-right: 10px; }
    .profile-stats { gap: 12px; }
    .profile-avatar { width: 72px; height: 72px; font-size: 28px; }
    .stat span { font-size: 11px; }
}

/* ===== Баннер «Установить приложение» ===== */
.app-banner {
    display: none;
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.app-banner.show { display: flex; }

.app-banner .banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 22px;
}

.app-banner .banner-text { flex: 1; min-width: 0; }
.app-banner .banner-title { font-size: 14px; font-weight: 700; }
.app-banner .banner-sub { font-size: 12px; color: var(--muted); }

.banner-btn {
    flex-shrink: 0;
    padding: 9px 14px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.banner-btn:hover { background: var(--accent-hover); }

.banner-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
}


/* Ник и отображаемое имя */
.profile-names { min-width: 0; }
.profile-nick {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
    font-weight: 500;
}

.profile-nick.visible { display: block; }

/* Подпись под областью выбора фото */
.file-hint { font-size: 12px; color: #8e8e8e; margin-top: 6px; }
#upload-info {
    font-size: 12px;
    color: var(--accent);
    text-align: center;
    margin-top: 8px;
    min-height: 14px;
}

/* Спиннер загрузки */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -3px;
    margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Кнопка с загрузкой внутри */
.btn-primary:disabled {
    background: #0095f6;
    opacity: 0.75;
    cursor: progress;
}
/* ===== Галочка verified ===== */
.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 0;
    flex-shrink: 0;
}
.verified-img {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

/* ===== Бейдж уведомлений ===== */
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    background: #ed4956;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.icon-btn { position: relative; }

/* ===== Запрос галочки ===== */
.verify-request {
    padding: 12px;
    border-radius: 12px;
    border: 1.5px dashed #0095f6;
    background: #f0f8ff;
    color: #0095f6;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.verify-request svg { display: block; flex-shrink: 0; }
.verify-request span { line-height: 1.2; }

.verify-request:hover { background: #e4f3ff; }

.verify-status {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    padding: 6px 0;
}

/* ===== Админ-панель ===== */
.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-controls input[type="text"] {
    padding: 11px 14px;
    border: 1.5px solid #e4e4e7;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.admin-controls input:focus { border-color: var(--accent); }

.admin-check {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.admin-reload {
    background: #f1f1f4;
    border: none;
    border-radius: 10px;
    padding: 9px;
    font-weight: 600;
    cursor: pointer;
}

.admin-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 4px;
    border-bottom: 1px solid #f1f1f4;
    flex-wrap: wrap;
}

.admin-user-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.admin-user-info b { font-size: 14px; }

.tag-admin {
    background: #dcfce7;
    color: #166534;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
}

.tag-ban {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
}

.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.admin-btn {
    background: #f1f1f4;
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.admin-btn svg { display: block; flex-shrink: 0; }
.admin-btn span { line-height: 1.2; }

.admin-btn:hover { background: #e4e4e7; }

.admin-done {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    background: #0095f6;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.admin-done:hover { background: #007fd6; }

/* ===== Меню поста ===== */
.post-header { justify-content: flex-start; }
.post-menu-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.post-likes {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    display: block;
}

.post-likes:hover { opacity: 0.8; }

/* ===== Онлайн ===== */
.profile-online {
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0 0;
}

.profile-online.is-online { color: #22c55e; font-weight: 600; }

/* Зелёная точка «онлайн» */
.online-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    background: #31c24d;
    border: 2px solid #fff;
    border-radius: 50%;
    box-sizing: border-box;
    z-index: 2;
    pointer-events: none;
}
.profile-avatar > .online-dot {
    bottom: 2px;
    right: 2px;
    width: 17px;
    height: 17px;
    border-width: 3px;
    border-color: var(--bg);
}
.avatar-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}
.avatar-wrap .online-dot {
    bottom: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    border-color: var(--bg);
}

/* ===== Доп. действия в профиле ===== */
.profile-extras {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.profile-link-btn {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.profile-link-btn:hover { background: #fafafa; }
.profile-link-btn.muted { color: var(--danger); border-color: #ffd6da; }

/* ===== Раздел жалоб ===== */
.admin-reload.warn { background: #fff4e5; color: #92400e; }
.admin-reload.warn:hover { background: #ffe9c8; }

.report-row {
    padding: 10px 4px;
    border-bottom: 1px solid #f1f1f4;
}

.report-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

.report-head span { color: var(--muted); font-size: 12px; }

.report-reason {
    font-size: 13px;
    color: #555;
    margin: 6px 0;
    word-break: break-word;
}

.report-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.admin-btn.warn-btn { background: #fff4e5; color: #92400e; }
.admin-btn.warn-btn:hover { background: #ffe9c8; }
.admin-btn.danger { background: #fee2e2; color: #b91c1c; }
.admin-btn.danger:hover { background: #fecaca; }

/* ===== Вкладки ленты ===== */
.feed-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    position: sticky;
    top: 52px;
    background: var(--bg);
    z-index: 5;
    padding: 6px 0;
}

.ftab {
    flex: 1;
    max-width: 180px;
    padding: 9px 16px;
    border-radius: 20px;
    border: none;
    background: none;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.ftab.active {
    background: var(--accent);
    color: #fff;
}

/* Кнопка «обновить» и плашка новых постов */
.refresh-feed-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.refresh-feed-btn:hover { background: var(--card); color: var(--accent); }
.refresh-feed-btn.spinning svg { animation: feedSpin .7s linear infinite; }

.new-posts-banner {
    position: sticky;
    top: 98px;
    z-index: 6;
    display: block;
    width: fit-content;
    max-width: calc(100% - 24px);
    margin: 0 auto 10px;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.new-posts-banner:active { transform: scale(0.97); }

/* Индикатор pull-to-refresh */
.ptr-indicator {
    position: fixed;
    left: 0;
    right: 0;
    top: 64px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
}

/* ===== Тёмная тема ===== */
[data-theme="dark"] {
    --accent: #3897f0;
    --accent-hover: #5aa7f5;
    --bg: #0f1115;
    --card: #181b22;
    --border: #2b3040;
    --text: #e7e9ee;
    --muted: #9099a7;
    --danger: #ff5f73;
}

[data-theme="dark"] body {
    background: #0f1115;
    color: #e7e9ee;
}

[data-theme="dark"] .topbar {
    background: rgba(24, 27, 34, 0.94);
    border-bottom-color: #2b3040;
}

[data-theme="dark"] .bottom-nav {
    background: rgba(24, 27, 34, 0.96);
    border-top-color: #2b3040;
}

[data-theme="dark"] .post-card,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .upload-panel {
    background: #181b22;
    border-color: #2b3040;
}

[data-theme="dark"] .icon-btn:hover,
[data-theme="dark"] .btn-cancel:hover,
[data-theme="dark"] .admin-reload:hover,
[data-theme="dark"] .admin-btn:hover,
[data-theme="dark"] .user-row:hover {
    background: #242a35;
}

[data-theme="dark"] .modal-close,
[data-theme="dark"] .btn-logout {
    background: #242a35;
    border-color: #2b3040;
    color: #e7e9ee;
}

[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .auth-form input,
[data-theme="dark"] .comment-form input,
[data-theme="dark"] .upload-panel textarea {
    background: #10141a;
    border-color: #2b3040;
    color: #e7e9ee;
}

[data-theme="dark"] .file-drop {
    background: #10141a;
    border-color: #3a4254;
}

[data-theme="dark"] .file-drop:hover { background: #141a22; }

[data-theme="dark"] .auth-screen {
    background: linear-gradient(160deg, #1a1622 0%, #16121d 45%, #10131d 100%);
}

[data-theme="dark"] .auth-card {
    background: rgba(24, 27, 34, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tabs { background: #242a35; }
[data-theme="dark"] .tab.active { background: #181b22; color: #e7e9ee; box-shadow: none; }

[data-theme="dark"] .stat:hover { background: #242a35; }

[data-theme="dark"] .post-image { background: #10141a; }

[data-theme="dark"] .comment-form {
    border-top-color: #2b3040;
}

[data-theme="dark"] .profile-tabs { border-top-color: #2b3040; }
[data-theme="dark"] .p-tab.active { border-bottom-color: #e7e9ee; }

[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.7); }

[data-theme="dark"] .follow-btn.following,
[data-theme="dark"] .profile-link-btn {
    background: #181b22;
    border-color: #2b3040;
    color: #e7e9ee;
}

[data-theme="dark"] .profile-link-btn:hover { background: #242a35; }

[data-theme="dark"] .step-n,
[data-theme="dark"] .verify-status {
    background: #242a35;
    color: #e7e9ee;
}

[data-theme="dark"] .admin-user { border-bottom-color: #2b3040; }
[data-theme="dark"] .report-row { border-bottom-color: #2b3040; }

[data-theme="dark"] .post-comments-link,
[data-theme="dark"] .post-menu-btn {
    color: #9099a7;
}

/* ===== Личные сообщения ===== */
.profile-link-btn.msg { border-color: #bcdffb; color: var(--accent); }
.profile-link-btn.msg:hover { background: #f0f8ff; }

.chat-modal { display: flex; flex-direction: column; height: 80vh; max-height: 560px; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg);
    border-radius: 12px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-msg span { word-break: break-word; }
.chat-msg small { font-size: 10px; opacity: 0.7; margin-top: 3px; }

.chat-msg.theirs {
    align-self: flex-start;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-msg.mine {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-input {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 5px 6px 5px 16px;
    border: 1.5px solid var(--border);
    border-radius: 26px;
    background: var(--bg);
}

.chat-input input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    outline: none;
    padding: 8px 0;
    font-family: inherit;
}

.chat-input input::placeholder { color: var(--muted); }

.chat-input button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: background .15s, transform .1s;
}

.chat-input button svg { display: block; width: 18px; height: 18px; }

.chat-input button:active { transform: scale(0.93); }

.chat-mic {
    background: transparent;
    color: var(--muted);
}

.chat-mic:hover { background: var(--card); color: var(--text); }

.chat-send {
    background: var(--accent);
    color: #fff;
}

.chat-send:hover { background: var(--accent-hover); }

/* Кнопка прикрепления фото */
.chat-input .chat-attach {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: var(--muted);
    flex-shrink: 0;
    margin: 0;
}
.chat-input .chat-attach:hover { background: var(--card); color: var(--text); }
.chat-input .chat-attach svg { display: block; }

/* Фото-сообщения в чате */
.chat-media-wrap {
    display: flex;
    flex-direction: column;
}
.chat-msg .chat-photo {
    max-width: 220px;
    max-height: 260px;
    width: auto;
    height: auto;
    border-radius: 10px;
    display: block;
    cursor: zoom-in;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.06);
}
.chat-msg.mine .chat-photo { background: rgba(255, 255, 255, 0.14); }

/* Просмотр фото в полный размер */
.photo-viewer-overlay {
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
}
.photo-viewer-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Панель предпрослушивания голосового перед отправкой */
.voice-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-top: 10px;
    border: 1.5px solid var(--border);
    border-radius: 18px;
    background: var(--card);
}
.voice-preview .vp-play {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.voice-preview .vp-play svg { display: block; }
.voice-preview .vp-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.voice-preview .vp-hint {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.voice-preview .vp-cancel,
.voice-preview .vp-send {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.voice-preview .vp-cancel { background: transparent; color: var(--muted); font-size: 15px; }
.voice-preview .vp-cancel:hover { background: rgba(220, 53, 69, 0.12); color: var(--danger); }
.voice-preview .vp-send { background: var(--accent); color: #fff; }
.voice-preview .vp-send:hover { background: var(--accent-hover); }
.voice-preview .vp-send:disabled { opacity: 0.6; cursor: default; }
.voice-preview .vp-send svg { display: block; }

/* Пустой микрофон при недоступной записи */
.chat-mic .mic-off { display: none; }

.conv-row { align-items: center; }
.conv-main { flex: 1; min-width: 0; }
.conv-last {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-unread {
    background: var(--accent);
    color: #fff;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.conv-del {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.conv-del svg { display: block; }
.conv-del:hover { background: rgba(220, 53, 69, 0.12); color: var(--danger); }

/* ===== Карусель ===== */
.post-image-wrap { position: relative; }

.media-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 14px;
}

.carousel-stage { position: relative; }

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.carousel-nav.prev { left: 8px; }
.carousel-nav.next { right: 8px; }

.carousel-counter {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
}

.viewer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 12px;
}

.v-comments { margin-left: 6px; }
.v-share { margin-left: auto; }

/* ===== Action sheet ===== */
.sheet {
    width: 100%;
    max-width: 520px;
    background: var(--card);
    border-radius: 18px 18px 0 0;
    padding: 14px 14px 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    animation: slideUp .22s ease;
}

.sheet-title { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .3px; }

.sheet-items { display: flex; flex-direction: column; }

.sheet-item {
    padding: 13px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}
.sheet-item svg { flex-shrink: 0; }
.sheet-item span { line-height: 1.2; }

.sheet-item.danger { color: var(--danger); font-weight: 600; }
.sheet-item:last-child { border-bottom: none; }
.sheet-item:hover { background: var(--bg); }

.sheet-cancel {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    border: none;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    font-size: 15px;
}

/* Поле ввода в input-sheet */
#sheet-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    resize: vertical;
}

#sheet-input:focus { border-color: var(--accent); }

/* ===== Иконки действий профиля ===== */
.profile-extras.icons { display: flex; gap: 10px; margin-top: 12px; }

.p-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .12s, background .15s;
}

.p-icon-btn:hover { background: var(--bg); transform: translateY(-1px); }
.p-icon-btn:active { transform: scale(.94); }

/* ===== Заголовок чата ===== */
.chat-peer {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 15px;
}

.chat-peer:disabled { cursor: default; opacity: .7; }
.chat-peer:hover { background: var(--bg); }
.chat-peer small { font-size: 10px; color: var(--accent); font-weight: 600; }
.chat-peer small.online { color: #22c55e; font-weight: 700; }
.chat-peer small.lastseen { color: var(--muted); font-weight: 500; }
.chat-online {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 5px;
    border-radius: 50%;
    background: #31c24d;
    vertical-align: middle;
    flex-shrink: 0;
}

.viewer-more {
    position: absolute;
    top: 10px;
    right: 46px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 3;
}

.topbar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    border-radius: 10px;
}

.topbar-logo:hover { background: var(--bg); }

[data-theme="dark"] .viewer-more,
[data-theme="dark"] .feed-nav { background: rgba(255, 255, 255, 0.15); }

/* ===== Листание в ленте ===== */
.feed-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
}

.feed-nav.prev { left: 6px; }
.feed-nav.next { right: 6px; }

.feed-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 5px;
    z-index: 3;
}

.feed-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: background .2s;
}

.feed-dot.on { background: #fff; }

/* ===== Тост ===== */
#app-toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(16px);
    background: rgba(28, 30, 33, 0.94);
    color: #fff;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 100;
    max-width: 86vw;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Переопределяем вертикальную раскладку форм в модалках
   (глобальный .modal-card form делает column) */
.modal-card .chat-input {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

.modal-card .comment-form {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* ===== Голосовые ===== */
.chat-mic.rec {
    background: #ed4956;
    color: #fff;
    animation: pulseRec 1.2s ease-in-out infinite;
}

@keyframes pulseRec {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.rec-timer {
    font-size: 13px;
    font-weight: 700;
    color: var(--danger);
    white-space: nowrap;
}

.voice-play {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.voice-play svg { display: block; }

/* Входящие голосовые: синяя кнопка на белом бабле — контраст в светлой теме */
.chat-msg.theirs .voice-play {
    background: var(--accent);
    color: #fff;
}
.chat-msg.theirs .voice-play:hover { background: var(--accent-hover); }

/* Исходящие голосовые: белая кнопка на синем бабле */
.chat-msg.mine .voice-play { background: rgba(255, 255, 255, 0.32); }

.voice-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
    display: flex;
    align-items: center;
}

.chat-msg .voice-play + small { margin-top: 0; }
.chat-msg .voice-play + .voice-label { margin-top: 0; }

/* голосовые-бабл выстраиваем строкой: кнопка+текст+время */
.chat-msg:has(.voice-play) {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

/* В тёмной теме исходящий бабл делаем темнее, чтобы белый текст/время читались */
[data-theme="dark"] .chat-msg.mine { background: #1d6fd6; }

/* Голосовые и прочие баблы — приятные отступы для времени у фото */
.chat-media-wrap small { align-self: flex-end; }

