﻿/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ ФОРУМА — адаптация ПК-дизайна
   Порог: max-width: 720px (единый с уже существующим правилом
   шрифта в вашем ПК-коде, чтобы не плодить лишние breakpoint'ы)

   Подключать ПОСЛЕ основного style.css / импортов ПК-версии —
   либо вставить в отдельное поле темы "CSS для мобильной версии",
   если оно используется на вашем форуме отдельно от основного.

   К этому файлу нужен небольшой HTML для гамбургер-меню —
   см. отдельный файл html-top-header.html, вставляется в самое
   начало HTML-верха (перед текущим блоком #custom_table).
============================================================ */

/* ------------------------------------------------------------
   ИНДИКАТОР НОВЫХ/СТАРЫХ СООБЩЕНИЙ НА ГЛАВНОЙ
   Это НЕ мобильное правило, общий фикс: на #pun-viewforum /
   #pun-messages / #pun-searchtopics иконка new/old уже стилизована
   (см. ваш основной CSS), а на главной (#pun-index) такого правила
   не было вообще — добавляю по аналогии, тем же кружком и цветом.
------------------------------------------------------------- */
#pun-index tbody.hasicon td.tcl div.icon {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin-right: 8px;
    background: none;
    box-shadow: none;
    border: none;
}
#pun-index tbody.hasicon td.tcl div.icon::before {
    content: "\f111";
    font-family: "Font Awesome 6 Pro";
    font-weight: 900;
    font-size: 8px;
    color: #a9a9a9;
    line-height: 1;
}
#pun-index tbody tr.inew td.tcl div.icon::before {
    color: #6462b5; /* есть новые сообщения — цвет как на inew в других таблицах */
}

@media screen and (max-width: 720px) {

  /* ---------- ФОН СТРАНИЦЫ: убираем совсем, чтобы не проглядывал по бокам ---------- */
  html,
  body {
    overflow-x: hidden;
    width: 100%;
  }
  body {
    background-image: none !important;
    background-color: #151515;
  }

  /* ---------- ОБЩИЙ КОНТЕЙНЕР: по центру, без бокового смещения ---------- */
  #pun {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 30px auto;
    padding: 0 10px 20px;
    box-sizing: border-box;
  }

  /* ---------- СТАРАЯ ДЕКОРАТИВНАЯ ШАПКА 1000x566 — прячем совсем,
     вместо неё ниже упрощённый #custom_table ---------- */
  #pun-title table {
    display: none;
  }

  /* ---------- УПРОЩЁННАЯ ШАПКА ----------
     Оставляем только текст (пост недели/активисты/постописцы),
     картинка шапки — только как фон внизу блока, приглушённая
     градиентом для читаемости текста. Картинки морда/кролик убраны. */
  .morda,
  .krolik {
    display: none !important;
  }
  #custom_table {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 54px 14px 14px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    color: #fff;
    background:
      linear-gradient(to bottom, rgba(0,0,0,.1), rgba(0,0,0,.8)),
      url(https://forumstatic.ru/files/001c/bd/d1/29056.png) center bottom / cover no-repeat,
      #151515;
    border-radius: 0 0 14px 14px;
  }
  #custom_table .postik,
  #custom_table .activ,
  #custom_table .postopiski {
    position: static;
    width: auto;
    font: 500 10px / 1.4 var(--def-font);
    text-transform: lowercase;
    text-shadow: 0 1px 3px rgba(0,0,0,.7);
  }
  #custom_table .author-name {
    font: italic 700 11px / 1 var(--def-font);
  }
  #custom_table a {
    color: #fff !important;
  }

  .spirit_nav-wrap {
    position: static;
    width: 100%;
    max-width: 220px;
    margin: 10px auto 0;
    transform: none;
  }

  /* ---------- ГАМБУРГЕР-МЕНЮ (без JS, чекбокс + :has()) ----------
     Требует небольшой HTML-вставки в начало HTML-верха —
     см. html-top-header.html. */
  .rf-mobile-nav-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  .rf-mobile-nav-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    width: 34px;
    height: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #151515;
    border-radius: 8px;
    cursor: pointer;
  }
  .rf-mobile-nav-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: transform .2s ease, opacity .2s ease;
  }
  body:has(.rf-mobile-nav-toggle:checked) .rf-mobile-nav-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body:has(.rf-mobile-nav-toggle:checked) .rf-mobile-nav-btn span:nth-child(2) {
    opacity: 0;
  }
  body:has(.rf-mobile-nav-toggle:checked) .rf-mobile-nav-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  body:has(.rf-mobile-nav-toggle:checked)::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 998;
  }

  /* ---------- МЕНЮ НАВИГАЦИИ: выезжающая панель слева ---------- */
  #pun-navlinks {
    position: fixed;
    top: 0;
    left: -260px;
    width: 220px;
    height: 100%;
    background: #1b1b1b;
    border-radius: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 60px 16px 20px;
    margin: 0;
    transition: left .25s ease;
    z-index: 999;
  }
  body:has(.rf-mobile-nav-toggle:checked) #pun-navlinks {
    left: 0;
  }
  #pun-navlinks .container {
    transform: none; /* убираем сдвиг, рассчитанный под картинку шапки */
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
    gap: 14px;
    font-size: 13px;
  }
  #pun-navlinks li {
    display: block;
    width: 100%;
  }
  #pun-navlinks a {
    color: #fff;
  }

  /* ---------- ЮЗЕРМЕНЮ: остаётся сверху, горизонтальный скролл ---------- */
  #pun-ulinks {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #pun-ulinks .container {
    transform: none;
    justify-content: flex-start;
    white-space: nowrap;
    gap: 8px;
    font-size: 10px;
    padding: 4px;
    margin-left: 0;
  }
  #pun-ulinks::-webkit-scrollbar {
    display: none;
  }

  /* ---------- СТАТУС "добро пожаловать" ---------- */
  #pun-status .container {
    margin: 0;
    text-align: center;
    padding: 8px 5px;
  }

  /* ---------- КАТЕГОРИИ: убираем боковые декоративные картинки ---------- */
  #pun .category {
    margin: 20px 0 0;
  }
  #pun .category::after {
    display: none;
  }
  #pun-category1, #pun-category2, #pun-category3,
  #pun-category4, #pun-category5, #pun-category6 {
    padding-left: 0;
    padding-right: 0;
  }

  /* ---------- ГЛАВНАЯ: список подфорумов ---------- */
  #pun-index .category tr {
    margin: 0 5px 10px;
    padding: 10px;
  }
  #pun-index .tclcon {
    width: auto;
  }
  #pun-index .tcl h3 {
    font-size: 16px;
  }
  #pun-index .category tr .tcr a {
    max-width: 100%;
    white-space: normal;
  }

  /* ---------- СТАТИСТИКА ---------- */
  #pun-stats .container {
    flex-direction: column;
    gap: 15px;
  }
  #pun-stats .statsinfo {
    width: auto;
  }

  /* ---------- ТАБЛИЦЫ ТЕМ / СООБЩЕНИЙ / ЛС ---------- */
  :is(#pun-viewforum, #pun-searchtopics, #pun-modviewforum,
      #profile.messages-container) tbody tr {
    flex-wrap: wrap;
  }
  :is(#pun-viewforum, #pun-searchtopics, #pun-modviewforum)
  tbody :is(.tc2, .tc3, .tcmod) {
    display: none; /* второстепенные числовые колонки, как на главной */
  }
  :is(#pun-viewforum, #pun-searchtopics, #pun-modviewforum,
      #profile.messages-container) tbody .tcr {
    flex: 1 1 100%;
    max-width: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
  #profile.messages-container tbody .pmtc22,
  #profile.messages-container tbody .pmtc33,
  #profile.messages-container tbody .pmtc24 {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  /* ---------- ПАНЕЛЬ ФОРМАТИРОВАНИЯ НАД ОТВЕТОМ ---------- */
  #form-buttons table {
    display: block;
  }
  #form-buttons tr {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    gap: 4px;
    margin: 4px 0;
  }
  #form-buttons td {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
  }

  /* ---------- АВТОР ПОСТА: горизонтальная карточка + маленький аватар ----------
     Декоративную боковую картинку (pa-fld4) скрываем — её абсолютные
     координаты рассчитаны под нефлоатнутый ПК-макет и один в один
     не переносятся. Сообщение (.post-body) идёт ниже карточки. */
  .post-author {
    float: none;
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px 0;
    padding: 8px;
    box-sizing: border-box;
    text-align: left;
  }
  .post-author::before,
  .pa-fld4 {
    display: none;
  }
  .post-author ul {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    width: 100%;
    padding: 0;
  }
  li.pa-avatar {
    flex: 0 0 auto;
    order: -1;
  }
  li.pa-avatar img {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px;
    max-height: 40px;
    border-radius: 8px;
    object-fit: cover;
  }
  .pa-author {
    position: static !important;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    padding: 0;
    justify-content: flex-start;
    font-size: 13px;
  }
  .pa-title {
    border-radius: 6px;
    margin: 0 !important;
  }
  .pa-fld1 {
    flex-basis: 100%; /* личное звание (имя/раса/описание перса) — отдельной строкой под шапкой карточки */
    order: 3;
    margin-top: 4px !important;
  }
  .pa-fld3,
  .pa-posts,
  .pa-respect,
  .pa-fld2,
  .pa-fld5 {
    margin: 0 !important;
  }
  .post-body {
    margin-left: 0;
    width: 100%;
  }
  .post h3 span {
    margin-left: 0;
  }
  .post-links {
    margin-left: 0;
  }
  .post-links ul {
    margin-left: 0;
    text-align: left;
    padding: 0 10px 20px 0;
  }

  /* ---------- ПРОФИЛЬ ---------- */
  #viewprofile tr {
    flex-direction: column;
    gap: 15px;
  }
  #viewprofile #profile-left {
    flex: none;
    width: auto;
  }
  #viewprofile #profile-right {
    padding: 10px !important;
  }

  /* ---------- ФОНЧИКИ (фоны для профиля) ---------- */
  .fonchiki {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
  }
  .fonchiki img {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 140px !important;
    min-height: 140px !important;
    max-height: 140px !important;
  }

  /* ---------- ВВ-КОД ВКЛАДКИ (.wrapper/.buttop/.butleft/.butright) ---------- */
  .butright,
  .butleft {
    grid-area: buttop;
    padding: 8px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  /* ---------- НОВОСТНЫЕ ПЛАШКИ / ССЫЛКИ В ПОДФОРУМЫ ---------- */
  .news-list,
  .podlink-container {
    justify-content: flex-start;
    padding: 0 5px;
  }

  /* ---------- ГОСТЕВАЯ КНИГА ---------- */
  .guestbookcode {
    position: static;
    float: none;
    width: auto;
    margin: 10px 0 0;
  }

  /* ---------- БАННЕРЫ ---------- */
  .banners {
    position: static;
    width: auto;
    margin: 10px 0 0 !important;
  }

  /* ---------- КНОПКИ ВВЕРХ/ВНИЗ ----------
     Изначальные координаты завязаны на custom_table (1000px канвас),
     который на мобильном уже не абсолютный — переносим кнопки
     в обычный угол экрана. */
  .scroll-btn {
    left: auto;
    right: 10px;
  }
  .scroll-btn.up {
    bottom: 70px;
    width: 50px;
    height: 38px;
  }
  .scroll-btn.down {
    bottom: 20px;
    width: 40px;
    height: 26px;
  }

}