/* style.css — Полностью переработан для мобильных устройств */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

body {
    background: #edeef0;
    color: #000;
}

#app {
    height: 100vh;
    height: 100dvh; /* Для современных браузеров с учётом адресной строки */
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

/* ===== HEADER ===== */
.header {
    background: #4a76a8;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    z-index: 10;
    flex-wrap: wrap;
    min-height: 40px;
}
.header h1 {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}
.header .user-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px 2px 4px;
    border-radius: 30px;
    color: #fff;
    cursor: pointer;
    flex-wrap: wrap;
}
.header .user-badge .avatar {
    width: 26px;
    height: 26px;
    font-size: 11px;
}
.header .user-badge span {
    font-size: 12px;
}
.logout-btn,
.profile-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    padding: 3px 8px;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 11px;
    white-space: nowrap;
}
.logout-btn:hover,
.profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== AVATARS ===== */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #6d8fb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    transition: 0.3s;
    color: #fff;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar:hover {
    transform: scale(1.05);
}

.avatar-big {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #6d8fb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
    color: #fff;
    cursor: pointer;
}
.avatar-big img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== ONLINE DOT ===== */
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
    margin-left: 3px;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}

/* ===== MAIN LAYOUT ===== */
.main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid #d3d9de;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #d3d9de;
    background: #f8f9fa;
}
.sidebar-tabs button {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 0;
    color: #656565;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: 0.3s;
    border-bottom: 2px solid transparent;
    position: relative;
}
.sidebar-tabs button.active {
    color: #4a76a8;
    border-bottom-color: #4a76a8;
    background: #fff;
}
.sidebar-tabs button:hover {
    background: #e8edf2;
}
.badge {
    position: absolute;
    top: 2px;
    right: 6px;
    background: #e74c3c;
    color: #fff;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
}

/* ===== SEARCH ===== */
.search-box {
    padding: 6px 10px;
    border-bottom: 1px solid #d3d9de;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 5px 10px;
    border-radius: 30px;
    border: 1px solid #d3d9de;
    background: #f5f6f8;
    color: #000;
    outline: none;
    font-size: 13px;
}
.search-box input:focus {
    border-color: #4a76a8;
}
.search-results {
    position: absolute;
    background: #fff;
    border: 1px solid #d3d9de;
    border-radius: 8px;
    max-height: 180px;
    overflow-y: auto;
    width: calc(100% - 20px);
    margin-top: 4px;
    z-index: 100;
    display: none;
}
.search-result-item {
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.search-result-item:hover {
    background: #f0f2f5;
}
.search-result-item .avatar {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

/* ===== CONTACT LIST ===== */
.contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: 0.3s;
    border-left: 3px solid transparent;
}
.contact-item:hover {
    background: #f0f2f5;
}
.contact-item.active {
    background: #e8edf2;
    border-left-color: #4a76a8;
}
.contact-item .avatar {
    width: 34px;
    height: 34px;
}
.contact-info {
    flex: 1;
    min-width: 0;
}
.contact-name {
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.contact-name .username-link {
    cursor: pointer;
    color: #000;
    text-decoration: none;
}
.contact-name .username-link:hover {
    color: #4a76a8;
    text-decoration: underline;
}
.contact-preview {
    font-size: 11px;
    color: #656565;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.typing-indicator {
    font-size: 11px;
    color: #4a76a8;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.no-contacts {
    padding: 30px 16px;
    text-align: center;
    color: #656565;
}
.no-contacts i {
    font-size: 30px;
    display: block;
    margin-bottom: 10px;
    color: #b0b8c0;
}

/* ===== CHAT ===== */
.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
    height: 100%;
}
.chat-header {
    padding: 6px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #d3d9de;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-height: 44px;
}
.chat-header .avatar {
    width: 30px;
    height: 30px;
}
.chat-header .contact-name {
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.chat-header .contact-name:hover {
    color: #4a76a8;
}
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    background: #f5f6f8;
    display: flex;
    flex-direction: column;
}
.message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 16px;
    word-wrap: break-word;
    background: #fff;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.3s ease;
    margin-bottom: 4px;
    font-size: 14px;
}
.message.mine {
    background: #4a76a8;
    color: #fff;
    align-self: flex-end;
}
.message .msg-time {
    font-size: 9px;
    color: #656565;
    margin-top: 3px;
    text-align: right;
}
.message.mine .msg-time {
    color: rgba(255, 255, 255, 0.7);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-input-area {
    display: flex;
    padding: 6px 10px;
    background: #fff;
    border-top: 1px solid #d3d9de;
    gap: 6px;
    flex-shrink: 0;
    min-height: 44px;
}
.chat-input-area input {
    flex: 1;
    padding: 6px 12px;
    border-radius: 30px;
    border: 1px solid #d3d9de;
    background: #f5f6f8;
    color: #000;
    outline: none;
    font-size: 14px;
    min-width: 0;
}
.chat-input-area input:focus {
    border-color: #4a76a8;
}
.chat-input-area button {
    background: #4a76a8;
    border: none;
    padding: 6px 16px;
    border-radius: 30px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-size: 13px;
    white-space: nowrap;
}
.chat-input-area button:hover {
    background: #3a5f8a;
}

/* ===== POSTS FEED ===== */
.posts-feed {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    background: #edeef0;
}
.post-card {
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    cursor: pointer;
}
.post-header:hover .post-author {
    color: #4a76a8;
}
.post-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #6d8fb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
    color: #fff;
    cursor: pointer;
}
.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-author {
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
}
.post-author:hover {
    color: #4a76a8;
    text-decoration: underline;
}
.post-date {
    font-size: 11px;
    color: #656565;
}
.post-text {
    font-size: 14px;
    line-height: 1.4;
    margin: 4px 0 6px 0;
}
.post-media {
    margin: 4px 0;
    border-radius: 8px;
    overflow: hidden;
    max-height: 300px;
}
.post-media img,
.post-media video {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}
.post-stats {
    display: flex;
    gap: 14px;
    color: #656565;
    font-size: 12px;
    margin-top: 4px;
}
.post-actions {
    display: flex;
    gap: 14px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #e8edf2;
    color: #656565;
    font-size: 12px;
}
.post-actions span {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.3s;
}
.post-actions span:hover {
    color: #4a76a8;
}
.post-actions span.liked {
    color: #e74c3c;
}
.post-filter {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #d3d9de;
}
.post-filter button {
    background: transparent;
    border: 1px solid #d3d9de;
    padding: 3px 10px;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 11px;
    color: #656565;
}
.post-filter button.active {
    background: #4a76a8;
    color: #fff;
    border-color: #4a76a8;
}
.post-filter button:hover {
    background: #e8edf2;
}

/* ===== COMMENTS ===== */
.comments-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e8edf2;
}
.comment {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}
.comment:hover .comment-author {
    color: #4a76a8;
}
.comment .avatar {
    width: 24px;
    height: 24px;
    font-size: 10px;
    flex-shrink: 0;
}
.comment .comment-author {
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: 0.3s;
}
.comment .comment-author:hover {
    color: #4a76a8;
    text-decoration: underline;
}
.comment .comment-text {
    font-size: 12px;
    color: #333;
}
.comment .comment-time {
    font-size: 10px;
    color: #656565;
}
.comment-input-area {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.comment-input-area input {
    flex: 1;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid #d3d9de;
    background: #f5f6f8;
    outline: none;
    font-size: 12px;
    min-width: 0;
}
.comment-input-area input:focus {
    border-color: #4a76a8;
}
.comment-input-area button {
    background: #4a76a8;
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}
.comment-input-area button:hover {
    background: #3a5f8a;
}

/* ===== USER PROFILE MODAL ===== */
.user-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}
.user-profile-overlay.active {
    display: flex;
}
.user-profile-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 500px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    position: relative;
    animation: fadeIn 0.3s ease;
}
.user-profile-modal .close-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 22px;
    cursor: pointer;
    color: #656565;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}
.user-profile-modal .close-btn:hover {
    color: #000;
    background: rgba(255, 255, 255, 0.95);
}
.user-profile-modal .profile-banner {
    width: 100%;
    height: 100px;
    background: #e8edf2;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}
.user-profile-modal .profile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-profile-modal .profile-avatar-section {
    display: flex;
    align-items: flex-end;
    padding: 0 16px;
    margin-top: -36px;
    position: relative;
}
.user-profile-modal .profile-avatar-section .avatar-big {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: #6d8fb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    overflow: hidden;
    color: #fff;
    flex-shrink: 0;
}
.user-profile-modal .profile-avatar-section .avatar-big img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-profile-modal .profile-info {
    padding: 12px 16px 16px;
}
.user-profile-modal .profile-info .username {
    font-size: 18px;
    font-weight: 700;
}
.user-profile-modal .profile-info .bio {
    color: #656565;
    margin-top: 4px;
    font-size: 13px;
}
.user-profile-modal .profile-info .actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}
.user-profile-modal .profile-info .actions button {
    background: #4a76a8;
    border: none;
    padding: 6px 16px;
    border-radius: 30px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-size: 13px;
}
.user-profile-modal .profile-info .actions button:hover {
    background: #3a5f8a;
}
.user-profile-modal .profile-posts {
    padding: 0 16px 16px;
}
.user-profile-modal .profile-posts h4 {
    font-size: 13px;
    color: #656565;
    margin-bottom: 10px;
}
.user-profile-modal .profile-posts .post-item {
    background: #f5f6f8;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}
.user-profile-modal .profile-posts .post-item .post-date {
    font-size: 10px;
    color: #656565;
}
.user-profile-modal .profile-posts .post-item .post-text {
    margin-top: 4px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== PROFILE PANEL ===== */
.profile-panel {
    width: 280px;
    background: #fff;
    border-left: 1px solid #d3d9de;
    padding: 12px;
    overflow-y: auto;
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    gap: 10px;
}
.profile-panel.active {
    display: flex;
}
.profile-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #d3d9de;
    padding-bottom: 6px;
}
.profile-panel .panel-header h3 {
    font-size: 15px;
    color: #2c3e50;
}
.profile-panel .panel-header .close-panel-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #656565;
    padding: 0 4px;
}
.profile-panel .panel-header .close-panel-btn:hover {
    color: #000;
}
.profile-avatar-banner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.banner-placeholder {
    width: 100%;
    height: 60px;
    background: #e8edf2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #656565;
    font-size: 12px;
    overflow: hidden;
}
.banner-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-avatar-large {
    display: flex;
    align-items: center;
    gap: 12px;
}
.profile-avatar-large .avatar-big {
    width: 56px;
    height: 56px;
    font-size: 22px;
}
.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.profile-field label {
    font-size: 11px;
    color: #656565;
    font-weight: 500;
}
.profile-field input,
.profile-field textarea {
    background: #f5f6f8;
    border: 1px solid #d3d9de;
    border-radius: 8px;
    padding: 6px 10px;
    color: #000;
    font-size: 13px;
    outline: none;
    width: 100%;
}
.profile-field input:focus,
.profile-field textarea:focus {
    border-color: #4a76a8;
}
.profile-field textarea {
    resize: vertical;
    min-height: 40px;
}
.profile-field button {
    background: #4a76a8;
    border: none;
    padding: 6px 0;
    border-radius: 30px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 2px;
    font-size: 13px;
}
.profile-field button:hover {
    background: #3a5f8a;
}
.file-input-wrap {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.file-input-wrap label {
    background: #e8edf2;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #d3d9de;
    transition: 0.3s;
}
.file-input-wrap label:hover {
    background: #d3d9de;
}
.file-input-wrap input[type="file"] {
    display: none;
}

/* ===== AUTH ===== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    background: #edeef0;
    padding: 16px;
}
.auth-box {
    background: #fff;
    padding: 30px 24px;
    border-radius: 16px;
    width: 360px;
    max-width: 100%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}
.auth-box h2 {
    margin-bottom: 16px;
    color: #2c3e50;
    text-align: center;
    font-size: 22px;
}
.auth-box input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #d3d9de;
    background: #f5f6f8;
    color: #000;
    margin-bottom: 10px;
    outline: none;
    font-size: 14px;
}
.auth-box input:focus {
    border-color: #4a76a8;
}
.auth-box .auth-buttons {
    display: flex;
    gap: 8px;
}
.auth-box .auth-buttons button {
    flex: 1;
    background: #4a76a8;
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
}
.auth-box .auth-buttons button:hover {
    opacity: 0.9;
}
.auth-box .auth-buttons button.secondary {
    background: #e8edf2;
    color: #2c3e50;
}
.auth-error {
    color: #e74c3c;
    margin-top: 10px;
    font-size: 13px;
    text-align: center;
}
.username-hint {
    font-size: 11px;
    color: #656565;
    margin-top: -6px;
    margin-bottom: 6px;
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 30px;
    color: #656565;
}
.loading i {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 3px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d3d9de;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #b0b8c0;
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */

/* Планшеты */
@media (max-width: 900px) {
    .profile-panel {
        width: 240px;
    }
}

/* Телефоны в горизонтальной ориентации */
@media (max-width: 768px) {
    .header h1 {
        font-size: 15px;
    }
    .header .user-badge span {
        font-size: 11px;
    }
    .sidebar {
        width: 200px;
    }
    .profile-panel {
        width: 200px;
    }
    .chat-header .contact-name {
        font-size: 13px;
    }
}

/* Телефоны в вертикальной ориентации — ОСНОВНАЯ АДАПТАЦИЯ */
@media (max-width: 600px) {
    /* Сайдбар становится сверху */
    .sidebar {
        width: 100%;
        max-height: 35vh;
        border-right: none;
        border-bottom: 1px solid #d3d9de;
        flex-shrink: 0;
    }
    
    .main {
        flex-direction: column;
        height: 100%;
        flex: 1;
    }
    
    /* Чат */
    .chat {
        flex: 1;
        min-height: 0;
        height: 100%;
    }
    
    .chat-messages-container {
        padding: 6px 10px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .chat-input-area {
        padding: 4px 8px;
        min-height: 40px;
        gap: 4px;
    }
    .chat-input-area input {
        font-size: 13px;
        padding: 5px 10px;
        min-width: 0;
        height: 34px;
    }
    .chat-input-area button {
        font-size: 11px;
        padding: 5px 12px;
        white-space: nowrap;
        height: 34px;
    }
    
    /* Посты */
    .posts-feed {
        flex: 1;
        padding: 6px 8px;
        overflow-y: auto;
        height: 100%;
        min-height: 0;
    }
    
    .post-card {
        padding: 8px;
        margin-bottom: 8px;
    }
    .post-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    .post-author {
        font-size: 12px;
    }
    .post-text {
        font-size: 12px;
    }
    .post-actions {
        font-size: 11px;
        gap: 10px;
    }
    
    /* Профиль — открывается по кнопке */
    .profile-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #d3d9de;
        max-height: 65vh;
        position: fixed;
        bottom: 0;
        left: 0;
        background: #fff;
        z-index: 100;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        padding: 12px 16px;
        display: none;
        overflow-y: auto;
    }
    .profile-panel.active {
        display: flex;
        animation: slideUp 0.3s ease;
    }
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .profile-avatar-large .avatar-big {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    .banner-placeholder {
        height: 50px;
    }
    
    /* Заголовок */
    .header {
        padding: 4px 8px;
        gap: 4px;
        min-height: 36px;
    }
    .header h1 {
        font-size: 13px;
    }
    .header .user-badge {
        padding: 2px 6px 2px 3px;
    }
    .header .user-badge .avatar {
        width: 20px;
        height: 20px;
        font-size: 8px;
    }
    .header .user-badge span {
        font-size: 10px;
    }
    .logout-btn,
    .profile-btn {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    /* Вкладки */
    .sidebar-tabs button {
        font-size: 11px;
        padding: 5px 0;
    }
    
    /* Поиск */
    .search-box {
        padding: 4px 8px;
    }
    .search-box input {
        font-size: 11px;
        padding: 4px 8px;
        height: 28px;
    }
    
    /* Контакты */
    .contact-item {
        padding: 4px 8px;
        gap: 6px;
    }
    .contact-item .avatar {
        width: 28px;
        height: 28px;
    }
    .contact-name {
        font-size: 11px;
    }
    .contact-preview {
        font-size: 10px;
    }
    
    /* Сообщения */
    .message {
        max-width: 85%;
        font-size: 13px;
        padding: 5px 10px;
    }
    
    /* Фильтры */
    .post-filter {
        padding: 4px 8px;
        gap: 4px;
    }
    .post-filter button {
        font-size: 10px;
        padding: 2px 8px;
    }
    
    /* Комментарии */
    .comment-input-area input {
        font-size: 11px;
        padding: 4px 8px;
    }
    .comment-input-area button {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    /* Модальное окно */
    .user-profile-modal {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }
    .user-profile-modal .profile-banner {
        height: 70px;
    }
    .user-profile-modal .profile-avatar-section .avatar-big {
        width: 56px;
        height: 56px;
        font-size: 20px;
        margin-top: -28px;
    }
    .user-profile-modal .profile-info .username {
        font-size: 16px;
    }
    .user-profile-modal .profile-info .bio {
        font-size: 12px;
    }
    .user-profile-modal .close-btn {
        top: 6px;
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
}

/* Очень маленькие телефоны */
@media (max-width: 400px) {
    .header h1 {
        font-size: 11px;
    }
    .header .user-badge span {
        font-size: 9px;
    }
    .sidebar-tabs button {
        font-size: 10px;
        padding: 4px 0;
    }
    .chat-input-area input {
        font-size: 12px;
        padding: 4px 8px;
        height: 30px;
    }
    .chat-input-area button {
        font-size: 10px;
        padding: 4px 10px;
        height: 30px;
    }
    .message {
        font-size: 12px;
        padding: 4px 8px;
    }
    .post-text {
        font-size: 11px;
    }
    .profile-panel {
        padding: 10px 12px;
        max-height: 70vh;
    }
    .profile-avatar-large .avatar-big {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .auth-box {
        padding: 20px 16px;
    }
    .auth-box h2 {
        font-size: 18px;
    }
    .auth-box input {
        font-size: 13px;
        padding: 8px 12px;
    }
    .auth-box .auth-buttons button {
        font-size: 13px;
        padding: 8px;
    }
}

/* ============================================================
   СПЕЦИАЛЬНО ДЛЯ YANDEX BROWSER (исправление нижней панели)
   ============================================================ */
@supports (-webkit-touch-callout: none) {
    #app {
        height: -webkit-fill-available;
    }
    .auth-container {
        height: -webkit-fill-available;
    }
}

/* Для всех браузеров с адресной строкой снизу */
@supports (padding: max(0px)) {
    .chat-input-area {
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
    .profile-panel {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .header {
        padding-top: max(6px, env(safe-area-inset-top));
    }
}