/* ============================================ */
/* mobile_styles.css — Адаптивность портала     */
/* Версия 3.0 — улучшенная поддержка каналов    */
/* ============================================ */

/* ----- ОБЩИЕ НАСТРОЙКИ ----- */
html, body {
    overflow-x: hidden;
    max-width: 100%;
    -webkit-text-size-adjust: 100%; /* запрет автоматического увеличения шрифта на iPhone */
}

/* ----- КОНТЕЙНЕРЫ И ОСНОВНЫЕ БЛОКИ ----- */
@media (max-width: 1600px) {
    .page .hero {
        background: url(../images/hero_archer-mobile.png) no-repeat;
        right: 0;
        width: 773px;
    }
    .paralax .sparks_1 {
        left: 0px;
    }
    .paralax .feathers {
        left: 900px;
    }
}

@media (max-width: 1380px) {
    .sparks {
        display: none;
    }
    .paralax .feathers {
        left: 750px;
    }
}

@media (max-width: 1170px) {
    .page_title { font-size: 20px; }
    .profile { display: none; }
    .smalllog {
        display: block;
        margin-top: 20px;
    }
    .smalllog a { margin: 15px 0; }
    .langBlock, .serverBlock { display: none; }
    .topPanel {
        background: url(../images/dark-fon.png);
        padding: 0;
        height: 60px;
    }
    nav {
        position: fixed;
        width: 100%;
        left: 0;
        top: 60px;
        background: url(../images/dark-fon.png);
        display: none;
    }
    header {
        height: 800px;
        padding: 0 3%;
    }
    header .container { height: 800px; }
    .menu {
        display: block;
        height: 100%;
        padding: 20px;
        margin-left: 0;
        overflow-y: auto;
    }
    .menu li {
        border-bottom: 1px solid rgba(255,255,255,0.1);
        margin-right: 0;
    }
    .menu li a {
        font-size: 18px;
        padding-left: 0;
    }
    .container { padding: 0 15px; }
    .mini-container { padding-top: 30px; }
    .news_ava { display: none; }
    .socBlock:after { display: none; }
    .newsBlock {
        display: block;
        bottom: 15px;
    }
    .newsBlock > div { width: 100%; }
    .newsBlockLeft { display: none; }
    .fastPlayBlock {
        bottom: auto;
        top: 70px;
    }
    .serverBlock {
        bottom: auto;
        top: 120px;
    }
    .infoSeverBlock {
        padding-top: 200px;
        padding-bottom: 20px;
        bottom: auto;
        top: -20px;
        z-index: 12;
    }
    .circle-online { z-index: 14; }
    .menuBlock-logo {
        width: calc(100% - 30px);
        position: absolute;
        text-align: center;
        top: 5px;
    }
    .menuBlock-logo img { height: 50px; }
    .langBlock {
        position: absolute;
        left: auto;
        right: 20px;
        top: 15px;
        z-index: 5;
    }
    .langBlock-content {
        left: auto;
        right: -10px;
    }
    .langBlock-content:after { display: none; }
    .news a { width: 80%; }
    .menuButton {
        position: absolute;
        display: block;
        left: 20px;
        z-index: 5;
    }
    .menuButton span {
        width: 45px;
        height: 3px;
        display: block;
        margin: 3px 0;
    }
    .header__nav-item, .stock__vote, .f_menu { display: none; }
    .stock__block {
        grid-template-columns: 100%;
        grid-column-gap: 0;
        padding: 0 24px;
    }
    .menu__mobail { display: block; }
    .page .logo { display: none; }
	.lib-page .page-title, .profile-page .page-title{		
		padding: 15px 25px 15px 15px !important;
	}
	
    .page .menuBlock-logo { display: block; }
    body, html { overflow-x: hidden; }
    .hero { z-index: -1; }
    .drivers {
        flex-wrap: wrap;
        justify-content: center;
    }
    .drivers img { margin: 15px; }
    .rankBlock-block {
        flex-wrap: wrap;
        justify-content: center;
    }
    .rankBlock-block .rank { width: 565px; }
    .header-shadow {
        background: none;
        animation: none;
    }
    .paralax-sparks { display: none; }
    .regBlock { z-index: 10; }
    .jackpot { padding-left: 300px; }
}

@media (max-width: 1100px) {
    .serversBlock { display: block; }
    .serversBlock:after { display: none; }
    .servers {
        margin: 0 auto;
        margin-bottom: 50px;
    }
    .paralax-hero { display: none; }
    .jackpot { padding-left: 200px; }
}

/* ----- ПЛАНШЕТЫ (до 992px) ----- */
@media (max-width: 992px) {
    .rank-first, .rank-second {
        transform: none;
        margin-bottom: 20px;
    }
    .rank-first::before, .rank-second::before {
        font-size: 30px;
        top: -5px;
    }
    .rank-first .rank-info_text .rank-nickName a,
    .rank-second .rank-info_text .rank-nickName a {
        font-size: 12px;
    }
    .top_kind_1, .top_kind_2{

        height: 50px;
        width: 45px;
    }
    .only-pc{
        display: none !important;
    }
    .only-mob{
        display: block !important;
    }
    .rankingsButtons{
        gap: 0;
        padding: 0;
    }
    .downloadBlock-flex { flex-wrap: wrap; }
    .downloadBlock, .updateBlock { width: 100%; }
    .errorGroup {
        position: relative;
        left: 0;
        margin-left: 0;
        top: auto;
        width: 100%;
        min-width: auto;
    }
    .errorGroup:before { display: none; }

    /* Шапка */
    .topPanel { height: 60px; padding: 0; }
    .menuBlock-logo img { height: 50px; }

    /* Подвал */
    .footerInfoBlock { display: flex; flex-wrap: wrap; }
    .copyBlock, .dkLogo {
        float: none;
        width: 50%;
        margin-bottom: 30px;
    }
    .footerMenuBlock { width: 100%; }
    .footerMenu { margin-bottom: 30px; }
    footer { background-size: cover; }
    .logosBlock {
        position: relative;
        bottom: auto;
    }

    /* Новости */
    .news a { width: 300px; }

    /* Таблицы */
    table td { padding: 10px; }

    /* Заголовки страниц */
    .page-title {
        height: auto;
        padding: 20px 30px;
        margin-top: -40px;
    }
    .page header { height: 100px; }

    /* Модальные окна */
    .modal_div .modal_close { right: 0; top: 0; }

    /* Таблицы с прокруткой */
    .scroll-tableBlock { position: relative; }
    .scroll-tableBlock:after {
        content: "";
        background: linear-gradient(to right, rgba(18,18,18,0), #121212 80%);
        width: 20%;
        height: 100%;
        position: absolute;
        right: -15px;
        top: 0;
    }
    .scroll-table {
        overflow: hidden;
        overflow-x: auto;
    }
    .scroll-table table { min-width: 750px; }

    /* Заголовок страницы с фильтрами */
    .page-title {
        justify-content: center;
        flex-wrap: wrap;
    }
    .page-title .formGroup { margin-left: 0; }
    .page-title select { width: 100%; }
    .page-title h1 {
        width: 100%;
        margin-bottom: 10px;
        text-align: center;
    }

    /* Параллакс */
    .paralax-hero { display: none; }

    /* Поля ввода */
    select, input, .formGroup { max-width: 100%; }

    /* ===== СПЕЦИФИЧЕСКИЕ СТРАНИЦЫ ===== */

    /* Новости */
    .news-page .content { padding: 20px 15px; }
    .news-page .page-title h1 { font-size: 32px; }
    .news-tabs { flex-wrap: wrap; }
    .news-tab {
        flex: 1 1 calc(50% - 10px);
        font-size: 14px;
        padding: 8px 5px;
    }
    .news-card .news_info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .news-card .news_ava { margin-bottom: 15px; }
    .news-card .news-Title {
        flex-direction: column;
        align-items: center;
    }
    .news-card .news-Title .color-green {
        margin-left: 0;
        margin-top: 5px;
    }
    .news-card .rank-lvl { text-align: left; }

    /* Библиотека */
    .lib-page .content { padding: 20px 15px; }
    .lib-page .page-title {
        padding: 15px 20px !important;
        flex-direction: column;
    }
    .lib-page .page-title h1 {
        font-size: 28px;
        margin-bottom: 10px;
    }
    .lib-tabs { grid-template-columns: repeat(3, 1fr); }
    .lib-tab {
        font-size: 14px;
        padding: 8px 4px;
    }
    .lib-submenu { display: none; }
    .lib-submenu-select {
        display: block;
        margin-bottom: 20px;
    }
    .lib-content {
        padding: 25px 15px;
        font-size: 16px;
    }
    .lib-content h1.news-title {
        font-size: 32px;
        padding-left: 15px;
    }
    .lib-navigation { flex-direction: column; }
    .lib-navigation a {
        width: 100%;
        white-space: normal;
        text-overflow: clip;
    }

    /* Статьи */
    .article-header{
        padding: 15px 15px;
    }
    .article-title { font-size: 18px; }
    .article-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 15px;
    }
    .article-admin-actions .button{
        width: 100%;
        margin-bottom: 10px;
    }
    .meta-stats {
        width: 100%;
        justify-content: space-between;
    }
    .article-content {
        padding: 25px 15px;
        font-size: 16px;
    }
    .author-info {
        flex-direction: column;
        align-items: flex-start;
    }
    .author-link { margin-bottom: 10px; }

    /* Профиль */
    .profile-page .content { padding: 20px 15px; }
    .profile-tabs { 
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
	.feed-item-actions{
        display: grid;
        grid-template-columns: repeat(2, 1fr);		
	}
    .tab-button {
        width: 100%;
        justify-content: center;
    }
    .profile-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-avatar {
        width: 150px;
        height: 150px;
        margin-bottom: 20px;
    }
    .profile-field { justify-content: center; }
    .field-label { min-width: 100px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 24px; }
    .articles-grid { grid-template-columns: 1fr; }

    /* Сообщения */
    .messages-container {
        flex-direction: column;
    }
    .messages-content{

        max-width: 100%;
    }
    .dialogs-list {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #8b5a2b;
        max-height: 200px;
        overflow-y: auto;
    }
    .messages-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .message-form {
        flex-direction: column;
        border-radius: 0 0 20px 20px;}
    .message-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    .message-input-group .button { width: 100%; }
    #bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .message { flex-wrap: wrap; }
    .message-avatar {
        width: 40px;
        height: 40px;
    }
    .message-attach-section {
        width: 100%;
        text-align: center;
    }
    /* Магазин */
    .user-balance {
        flex-direction: column;
        gap: 5px;
        font-size: 14px;
    }
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    .item-preview {
        width: 80px;
        height: 80px;
    }

    /* История операций */
    .history-filters { padding: 10px; }
    .period-stats {
        flex-direction: column;
        align-items: flex-start;
    }
    .stats-numbers {
        width: 100%;
        justify-content: space-between;
    }

    /* Горизонтальное меню портала */
    .portal-hor-menu.hor-menu-large .menu-item img {
        width: 35px;
        height: 35px;
    }
    .portal-hor-menu.hor-menu-large .group-label {
        font-size: 0.7rem;
        top: -20px;
    }
    .portal-menu-arrow {
        width: 30px;
        height: 45px;
    }
    .portal-menu-arrow-left { left: -25px; }
    .portal-menu-arrow-right { right: -25px; }

    /* Реакции и награды */
    .reactions-rewards-row {
        flex-direction: column;
        align-items: stretch;
    }
    .reactions-list { justify-content: center; }
    .rewards-list { justify-content: center; }

    /* Комментарии */
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .comment-actions { flex-wrap: wrap; }
    .reply-form { margin-left: 0 !important; }

    /* Опросы */
    .poll-block { padding: 15px; }
    .poll-option label {
        padding: 10px;
        font-size: 14px;
    }

    /* Пагинация */
    .pagination .number {
        width: 36px;
        height: 36px;
        line-height: 34px;
        font-size: 14px;
    }
    .pagination .pag-arrow {
        width: 36px;
        height: 36px;
    }

    /* Поиск */
    .page-title .search-form { width: 100%; }
    .page-title .search-form input { width: 100%; }

    /* Лента статей */
    .feed-tabs { flex-direction: column; }
    .feed-tabs .tab-button {
        width: 100%;
        text-align: center;
    }
    .feed-item-actions { flex-wrap: wrap; }

    /* ===== НОВЫЕ СТИЛИ ДЛЯ КАНАЛОВ ===== */

    /* Страница публичных каналов (channels.php) */
    .channels-page .content {
        padding: 20px 15px;
    }
    .channels-page .page-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .channels-page .page-title h1 {
        font-size: 24px;
        margin-bottom: 5px;
    }
    .channels-page .button.small {
        width: 100%;
        text-align: center;
    }
    .channels-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .channel-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }
    .channel-avatar {
        width: 80px;
        height: 80px;
        margin-bottom: 10px;
    }
    .channel-info h3 {
        font-size: 18px;
    }
    .channel-description {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    .channel-meta {
        justify-content: center;
        flex-wrap: wrap;
    }
    .members-count {
        font-size: 12px;
    }
    .member-badge {
        font-size: 12px;
        padding: 3px 10px;
    }
    .join-channel-btn {
        font-size: 13px;
        padding: 5px 12px;
    }
    .attach-btn {
        width: 100%;
        border-radius: 8px;
    }
    .attach-btn span{
        display: block;
    }
    /* Каналы в сообщениях (messages.php?type=channel) */
    .channel-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        border-radius: 0;
        }
        .channel-header .channel-avatar {
            width: 50px;
            height: 50px;
            margin-bottom: 5px;
        }
        .channel-header h3 {
            font-size: 20px;
            margin-bottom: 10px;
        }
        .channel-header .header-actions {
            width: 100%;
            flex-wrap: wrap;
            justify-content: flex-start;
            gap: 8px;
        }
        .channel-header .header-actions .button.small {
            flex: 1 1 auto;
            min-width: 100px;
            padding: 8px 10px;
            font-size: 13px;
        }
        .channel-pinned-bar {
            flex-direction: column;
            align-items: flex-start;
            padding: 10px;
        }
        .channel-pinned-bar .pinned-list {
            width: 100%;
        }
        .channel-pinned-bar .pinned-item {
            width: 100%;
            white-space: normal;
            word-break: break-word;
        }
        .channel-messages-list {
            padding: 10px;
            max-height: 500px;
        }
        .channel-message {
            flex-direction: column;
            align-items: flex-start;
            gap: 8px;
            padding: 10px;
        }
        .channel-message .message-avatar {
            width: 35px;
            height: 35px;
        }
        .channel-message .message-content {
            width: 100%;
        }
        .channel-message .message-header {
            flex-wrap: wrap;
        }
        .channel-message .message-actions {
            justify-content: flex-start;
        }
        .channel-message .message-actions button {
            font-size: 11px;
            padding: 3px 8px;
        }
        .channel-message-form, .message-form-wrapper {
            padding: 15px;
            border-radius: 0 0 20px 20px;
        }
        .channel-message-form .message-input-group, .message-form-wrapper.message-input-group {
            flex-direction: column;
            gap: 10px;
        }
        .channel-message-form .textarea-wrapper textarea {
            min-height: 50px;
            font-size: 14px;
        }
        .channel-message-form .textarea-wrapper {
            width: 100%;
        }
        .channel-message-form .button, .message-form-wrapper .button {
            width: 100%;
        }
        .channel-message-form  .only-mob .button, .message-form-wrapper  .only-mob .button {
            width: 32%;
        }
    .pinned-messages-bar{
        margin: 0;
    }
        /* Индикатор закрепления в списке диалогов */
    .dialog-item.pinned {
        border-left-width: 3px;
    }
    .pin-indicator {
        font-size: 12px;
    }

    /* Модальные окна */
    .modal_div {
        width: 95%;
        max-width: none;
        border-radius: 20px;
        max-height: 85vh;
    }
    .modal-header {
        padding: 15px 20px 8px;
    }
    .modal-header h3 {
        font-size: 20px;
    }
    .modal-header h3::before {
        font-size: 22px;
    }
    .modal-body {
        padding: 15px 0;
        max-height: calc(85vh - 110px);
    }
    .modal-footer {
        padding: 12px 15px 15px;
        flex-direction: column;
        gap: 8px;
    }
    .modal-button-primary,
    .modal-button-secondary {
        width: 100%;
        margin: 2px 0;
        padding: 10px 15px;
        font-size: 15px;
    }
    .modal-body input,
    .modal-body textarea,
    .modal-body select {
        font-size: 16px; /* предотвращает масштабирование на iOS */
        padding: 10px 12px;
    }
    .modal-body .search-results {
        width: calc(100% - 30px);
        max-height: 150px;
    }
    .modal-body .search-result-item {
        font-size: 14px;
        padding: 8px 12px;
    }

    /* Улучшенные стили для списка диалогов и каналов на мобильных */
    .dialogs-list {
        max-height: 150px;
    }
    .dialog-item {
        padding: 10px;
    }
    .dialog-avatar {
        width: 40px;
        height: 40px;
    }
    .dialog-name {
        font-size: 15px;
    }
    .dialog-last {
        font-size: 12px;
    }
    .dialog-time {
        font-size: 11px;
    }
    .unread-badge {
        min-width: 18px;
        height: 18px;
        font-size: 11px;
        line-height: 18px;
    }
    .profile-follow-stats{
        display: grid;
    }
    .feed-item-actions .button.small{
        width: 100%;
    }
    .share-tabs{
        gap: 0 !important;
    }

    .add-comment-form .button{
        width: 100%;
        line-height: 32px;

    }
    .header-search, .marginer, .copyright, .page-title, .messages-page .profile-tabs, .messages-header, .channel-header, .dialogs-list h3{
        display: none !important;
    }
}

/* ----- ТЕЛЕФОНЫ (до 590px) ----- */
@media (max-width: 590px) {
    header {
        height: 1080px;
    }
    header .container { height: 1080px; }
    .fastPlayBlock {
        flex-wrap: wrap;
        top: 70px;
    }
    .download-button,
    .fastPlay,
    .serverBlock {
        width: 90%;
        margin: 0 auto;
    }
    .serverBlock {
        left: 50%;
        margin-left: -160px;
    }
    .circle-online { margin: 0; }
    .download-button { margin: 10px 0; }
    .fastPlay a { width: 160px; }
    .newsBlock {
        bottom: auto;
        top: 650px;
    }
    .newsBlock > div { flex-wrap: wrap; }
    .streamBlock {
        display: flex;
        width: 100%;
    }
    .streamBlock a { width: 33.3%; }
    .regButton {
        display: block;
        text-align: center;
        margin-top: 30px;
    }
    .regButton button,
    .regButton .button { margin-bottom: 20px; }
    .servers { padding: 20px 20px 0; }
    .agreement {
        text-align: left;
        margin-left: 0;
    }
    .logosBlock {
        display: flex;
        flex-wrap: wrap;
        text-align: center;
        justify-content: center;
    }
    .logosBlock img {
        display: block;
        margin: 20px;
    }
    .infoSeverBlock {
        left: 0;
        width: 160px;
    }
    .page-title h1 { font-size: 30px; }
    .modal_div {
        max-width: 100%;
        margin-left: 0;
        padding: 30px 20px;
        width: 95%;
    }
    .rank-info { padding: 10px; }
    .rank-info_text { width: 180px; }
    .container { padding: 0; }
    .stock__block { padding: 0; }
    .jackpot {
        padding-top: 20px;
        padding-bottom: 0;
        padding-left: 20px;
    }
    .newsBlock { top: 550px; }

    /* Дополнительные правки */
    .lib-tabs { grid-template-columns: repeat(2, 1fr); }
    .profile-tabs .tab-button {
        font-size: 14px;
        padding: 8px 12px;
    }
    .stat-value { font-size: 20px; }
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .item-preview {
        width: 70px;
        height: 70px;
    }
    .item-name { font-size: 12px; }

    /* Каналы */
    .channels-page .page-title h1 {
        font-size: 22px;
    }
    .channel-card {
        padding: 12px;
    }
    .channel-avatar {
        width: 70px;
        height: 70px;
    }
    .channel-info h3 {
        font-size: 16px;
    }
    .channel-meta {
        gap: 8px;
    }
    .members-count {
        font-size: 11px;
        padding: 2px 8px;
    }
    .join-channel-btn {
        font-size: 12px;
        padding: 4px 10px;
    }
    .channel-header .header-actions .button.small {
        min-width: 80px;
        font-size: 12px;
        padding: 6px 8px;
    }
    .channel-message .message-actions button {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* ----- МАЛЕНЬКИЕ ТЕЛЕФОНЫ (до 475px) ----- */
@media (max-width: 475px) {
    body { overflow-x: hidden; }
    .copyBlock, .dkLogo { width: 100%; }
    .socBlock {
        flex-wrap: wrap;
        justify-content: center;
    }
    .socBlock > div { margin: 10px; }
    .footerMenuBlock {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .footerMenu { width: 50%; }
    .news-block { padding: 10px 5px; }
    .news a { width: 215px; }
    .servers:after { right: 0; }
    .downloadBlock, .updateBlock {
        padding: 35px 25px;
        height: auto;
    }
    .servers {
        margin-bottom: 0;
        margin-top: 30px;
        padding: 80px 20px 20px;
        height: 65%;
        background-size: cover;
    }
    .servers h2 {
        text-align: center;
        margin-bottom: 15px;
        margin-top: 15px;
    }
    .server-title span {
        position: relative;
        z-index: 3;
    }
    .facebookButton {
        width: 100%;
        background-size: cover;
    }
    .rank { height: 90px; }
    .rank-info { justify-content: center; }
    .rank-info_ava { display: none; }
    .rankBlock-block .rank { width: 100%; }
    .page .hero { right: -200px; }
    .footerInfoBlock h3 { margin-bottom: 15px; }
    .servers.server_1:after {
        left: 50%;
        margin-left: -112px;
        top: -90px;
    }
    .servers.server_2:after {
        left: 50%;
        margin-left: -123px;
        top: -90px;
    }
    .dkLogo img { margin-bottom: 15px; }
    .server-icon { left: 50%; }
    .server-icon_1 { margin-left: -110px; }
    .server-icon_2 { margin-left: -120px; }
    .jackpot {
        padding-top: 20px;
        padding-bottom: 0;
        padding-left: 12px;
    }

    /* Уменьшаем шрифты и отступы */
    .page-title h1 { font-size: 24px; }
    .news-card .news-Title b { font-size: 18px; }
    .lib-content h1.news-title { font-size: 26px; }
    .article-title { font-size: 16px; }
    .profile-field { font-size: 14px; }
    .field-label { font-size: 14px; }
    .tab-button {
        font-size: 13px;
        padding: 6px 10px;
    }
    .reaction-btn {
        font-size: 14px;
        padding: 4px 8px;
    }
    .comment-item { padding: 10px; }
    .pagination .number {
        width: 32px;
        height: 32px;
        line-height: 30px;
        font-size: 12px;
    }

    /* Каналы */
    .channels-page .content {
        padding: 15px 10px;
    }
    .channels-page .page-title h1 {
        font-size: 20px;
    }
    .channel-card {
        padding: 10px;
    }
    .channel-avatar {
        width: 60px;
        height: 60px;
    }
    .channel-info h3 {
        font-size: 15px;
    }
    .channel-description {
        font-size: 12px;
    }
    .channel-meta .members-count {
        font-size: 10px;
    }
    .channel-meta .member-badge {
        font-size: 10px;
    }
    .channel-meta .join-channel-btn {
        font-size: 11px;
        padding: 3px 8px;
    }
    .channel-header .header-actions .button.small {
        min-width: 70px;
        font-size: 11px;
        padding: 5px 6px;
    }
    .channel-message .message-avatar {
        width: 30px;
        height: 30px;
    }
    .channel-message .message-author {
        font-size: 13px;
    }
    .channel-message .message-time {
        font-size: 10px;
    }
}

/* ----- ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 365px) ----- */
@media (max-width: 365px) {
    .container { padding: 0; }
    .row-container .serverIn {
        padding: 20px 0 20px 20px;
        background: none !important;
    }
    .block-title { padding-left: 15px; }
    .regBlock { text-align: center; }
    .registration { padding: 0 10px; }
    .jackpot {
        padding-top: 20px;
        padding-bottom: 0;
        padding-left: 0;
    }

    /* Ещё более компактно */
    .lib-tabs { grid-template-columns: 1fr; }
    .news-tab { flex: 1 1 100%; }
    .stats-grid { grid-template-columns: 1fr; }
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    .item-preview {
        width: 60px;
        height: 60px;
    }
    .modal_div {
        padding: 20px 10px;
    }
    .modal_div h3 { font-size: 20px; }

    /* Каналы */
    .channel-header h3 {
        font-size: 18px;
    }
    .channel-header .header-actions .button.small {
        min-width: 60px;
        font-size: 10px;
        padding: 4px 4px;
    }
    .channel-message .message-actions button {
        font-size: 9px;
        padding: 2px 4px;
    }
}

/* ----- ДОПОЛНИТЕЛЬНЫЕ УЛУЧШЕНИЯ ДЛЯ МОБИЛЬНЫХ ----- */

/* 1. Горизонтальное меню портала — экстремально малая ширина */
@media (max-width: 400px) {
    .portal-hor-menu.hor-menu-large .menu-item img {
        width: 24px;
        height: 24px;
    }
    .portal-hor-menu.hor-menu-large .control-item img {
        width: 18px;
        height: 18px;
    }
    .portal-hor-menu.hor-menu-large .control-item span {
        font-size: 1.2rem;
    }
    .portal-hor-menu .menu-group {
        padding-right: 5px;
        margin-right: 3px;
    }
    .portal-hor-menu .group-label {
        display: none; /* скрываем подписи групп */
    }
    .portal-menu-arrow {
        width: 22px;
        height: 32px;
    }
    .portal-menu-arrow-left { left: -16px; }
    .portal-menu-arrow-right { right: -16px; }
    .portal-menu-arrow span { font-size: 14px; }
}

/* 2. Модальные окна — кнопки на всю ширину */
@media (max-width: 768px) {
    .modal_div button {
        width: 100%;
        margin: 5px 0;
        padding: 12px;
        font-size: 16px;
    }
    .modal_div .modal_close {
        width: 40px;
        height: 40px;
    }
}

/* 3. Поля ввода — увеличенная область касания */
@media (max-width: 768px) {
    input, textarea, select, .styled-select {
        padding: 14px 12px;
        font-size: 16px; /* предотвращает масштабирование на iOS */
        height: auto;
    }
    .formGroup-name {
        font-size: 14px;
        top: -8px;
    }
}

/* 4. Комментарии — адаптация под тач */
@media (max-width: 590px) {
    .comment-avatar {
        width: 40px;
        height: 40px;
    }
    .comment-actions button {
        padding: 8px 12px;
        font-size: 14px;
        flex: 1 1 auto;
    }
    .comment-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
}

/* 5. Пагинация — большая кликабельная область */
@media (max-width: 768px) {
    .pagination .number {
        width: 44px;
        height: 44px;
        line-height: 42px;
        font-size: 16px;
    }
}

/* 6. Опросы — удобные радио/чекбоксы */
@media (max-width: 590px) {
    .poll-option label {
        display: flex;
        align-items: center;
        padding: 12px;
    }
    .poll-option input[type="radio"],
    .poll-option input[type="checkbox"] {
        width: 24px;
        height: 24px;
        margin-right: 12px;
        transform: scale(1.2);
    }
}

/* 7. Таблицы — более мелкий шрифт на узких экранах */
@media (max-width: 590px) {
    .history-table,
    .donations-table,
    .tableRank {
        font-size: 12px;
    }
    .history-table td,
    .donations-table td,
    .tableRank td {
        padding: 8px 5px;
    }
    .item-icon-small {
        width: 20px;
        height: 20px;
    }
}

/* 8. Скрытие tooltip на мобильных (они неудобны) */
@media (max-width: 768px) {
    [data-tooltip]:before,
    [data-tooltip]:after,
    .setting-hint .hint-tooltip {
        display: none !important;
    }
}

/* 9. Подвал — вертикальные ссылки */
@media (max-width: 590px) {
    .footer .f_menu {
        float: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-bottom: 15px;
    }
    .footer .f_menu a {
        margin-left: 0;
        font-size: 14px;
    }
    .f_content {
        padding: 20px 0 80px;
        text-align: center;
    }
    .f_logos {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .f_logos img {
        float: none;
        margin: 5px 0;
    }
    .f_text {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }
}

/* 10. Лента активности (попап) */
@media (max-width: 480px) {
    .activity-feed {
        width: 100%;
        right: 0;
        bottom: 0;
        border-radius: 20px 20px 0 0;
    }
    .activity-content {
        max-height: 300px;
    }
}

/* 11. Индикаторы онлайн/непрочитанных */
@media (max-width: 590px) {
    .online-indicator {
        width: 16px;
        height: 16px;
    }
    .unread-dot {
        width: 12px;
        height: 12px;
    }
    .stats-badge {
        min-width: 22px;
        height: 22px;
        font-size: 13px;
        line-height: 22px;
    }
}

/* 12. Кнопка «Поделиться» */
@media (max-width: 590px) {
    .share-btn {
        width: 100%;
        margin: 0;
        padding: 6px;
        font-size: 13px;
    }
}

/* 13. Поле поиска в шапке */
@media (max-width: 590px) {
    .header-search {
        margin-left: 0;
        width: 100%;
    }
    .header-search input {
        width: 100%;
        font-size: 16px;
    }
}

/* 14. Смайлы/стикеры — компактная сетка */
@media (max-width: 590px) {
    .set-items-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .sticker-item {
        max-width: 60px;
    }
}

@media (max-width: 400px) {
    .set-items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* 15. Горизонтальное меню */

/* Для экранов уже 768px и ниже */

@media (max-width: 1920px) {
    .portal-hor-menu .hor-menu-items {
        display: inline-flex;
        flex-wrap: nowrap;
        gap: 5px;
    }
    .portal-hor-menu.hor-menu-center {
        text-align: center;
        left: 0;
        transform: matrix(1, 0, 0, 1, 0, 0);
    }
}
@media (max-width: 1280px) {
    .portal-hor-menu {
        /* Убираем transform-центрирование, оставляем обычное */
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        margin: 0 auto;
        width: auto;
        max-width: calc(100vw - 20px); /* небольшие отступы по бокам */
        overflow-x: auto;
        overflow-y: visible;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch; /* плавная прокрутка на iOS */
        scrollbar-width: thin; /* тонкий скроллбар */
        padding: 5px 10px;
    }

    /* Скрываем абсолютные стрелки перемещения, они не нужны при прокрутке */
    .portal-menu-arrow-left,
    .portal-menu-arrow-right {
        display: none !important;
    }

    /* Делаем группы строчными, чтобы они не ломали прокрутку */
    .portal-hor-menu .hor-menu-items {
        display: inline-flex;
        flex-wrap: nowrap;
        gap: 0;
    }

    .menu-group {
        display: inline-flex;
        flex-wrap: nowrap;
        border-right: 1px solid #a0522d;
        padding-right: 8px;
        margin-right: 5px;
    }

    .menu-group:last-child {
        border-right: none;
    }

    /* Уменьшаем иконки и отступы */
    .portal-hor-menu .menu-item img,
    .portal-hor-menu .control-item img {
        width: 30px;
        height: 30px;
    }

    .portal-hor-menu .control-item span {
        font-size: 1.5rem;
    }

    /* Скрываем подписи групп (они занимают место) */
    .menu-group .group-label {
        display: none;
    }

    /* Убираем лишние паддинги */
    .portal-hor-menu {
        padding: 5px 8px;
    }
}

/* Ещё более узкие экраны (до 480px) */
@media (max-width: 1024px) {
    .portal-hor-menu .menu-item img,
    .portal-hor-menu .control-item img {
        width: 24px;
        height: 24px;
    }

    .portal-hor-menu .control-item span {
        font-size: 1.3rem;
    }

    /* Уменьшаем бейджи */
    .stats-badge {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
        line-height: 18px;
        bottom: -2px;
        right: -2px;
    }
    .portal-hor-menu .menu-group{
        padding-right: 3px;
        margin-right: 2px;
    }
}

/* Для экранов, где всё равно не помещается, добавляем подсказку о прокрутке */
.portal-hor-menu::after {
    content: '';
    display: none;
}

@media (max-width: 1280px) {
    .portal-hor-menu::after {
        display: none;
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0,0,0,0.5);
        color: #ffd966;
        font-size: 12px;
        padding: 2px 6px;
        border-radius: 12px;
        pointer-events: none;
        opacity: 0.5;
    }
}