/* ===== ЗАЩИТА ОТ ГОРИЗОНТАЛЬНОГО СКРОЛЛА ===== */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  margin: 0;
  padding: 0;
}
*, *::before, *::after {
  box-sizing: border-box;
}

/* ===== БАЗОВАЯ АДАПТАЦИЯ ДЛЯ ТЕЛЕФОНОВ ===== */
@media (max-width: 768px) {
  .header {
    padding: 10px 15px;
    flex-wrap: wrap;
  }
  .header-left,
  .header-right {
    flex: 1;
  }
  .header-center {
    display: none;
  }
  .burger {
    display: flex;
  }
  .logo h1 {
    font-size: 18px;
  }
  .logo img {
    height: 36px;
  }
  .slogan {
    display: none;
  }
  .user-area a {
    font-size: 14px;
    padding: 6px 10px;
  }

  /* Мобильное меню */
  .nav-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10,12,16,0.98);
    z-index: 200;
    flex-direction: column;
    padding: 80px 20px 30px;
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(100%);
    opacity: 0;
  }
  .nav-mobile.open {
    display: flex;
    transform: translateX(0);
    opacity: 1;
  }
  .nav-mobile a {
    font-size: 16px;
    padding: 12px 0;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  /* Новости, состав, карусель */
  .news-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .members-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
    width: 100%;
  }
  #screenshotCarousel {
    max-width: 100% !important;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Все фиксированные блоки в футере и на главной */
  div[style*="max-width:600px"],
  div[style*="max-width:900px"],
  #siegeBar,
  .emblem-container,
  footer > div:first-child {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Таблицы */
  table {
    min-width: auto !important;
  }
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Формы */
  input, textarea, select, .btn {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }
  .btn {
    padding: 14px 20px;
    margin: 8px 0;
  }

  /* Футер и плеер */
  footer {
    padding: 20px 15px;
    font-size: 12px;
  }
  #musicPlayer {
    bottom: 70px;
    right: 10px;
  }
  #backToTop {
    bottom: 20px;
    right: 15px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .members-grid {
    grid-template-columns: 1fr !important;
  }
  .member-card {
    padding: 15px 10px;
  }
  .member-card img,
  .member-avatar {
    width: 50px;
    height: 50px;
  }
  #musicPlayer span {
    display: none;
  }
  #musicBtn {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  #volumeSlider {
    width: 50px;
  }
}

/* ===== Чиним заголовок "Скриншоты игроков" ===== */
@media (max-width: 768px) {
  .rank-title {
    max-width: 100% !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 18px;           /* чуть уменьшим для мобильных */
  }
}

/* ===== ПОЛНАЯ БЛОКИРОВКА СКРОЛЛА ДЛЯ ЗАГОЛОВКА СКРИНШОТОВ ===== */
@media (max-width: 768px) {
  /* Заголовок "Скриншоты игроков" и ему подобные */
  .rank-title {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow: hidden !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
    box-sizing: border-box;
    padding-left: 10px;
    padding-right: 10px;
  }
  /* Иконки внутри заголовка пусть не растягивают */
  .rank-title i,
  .rank-title .fas {
    display: inline-block;
    max-width: 100%;
  }
  /* Родительский контейнер карусели */
  #screenshotCarousel {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ===== ПЕРЕНОС ЗАГОЛОВКА "СКРИНШОТЫ ИГРОКОВ" В ДВЕ СТРОКИ ===== */
@media (max-width: 768px) {
  .rank-title {
    white-space: normal !important;   /* разрешаем перенос */
    word-break: break-word !important;
    hyphens: auto;
    font-size: 20px;                 /* чуть уменьшим, чтобы влезало */
    line-height: 1.3;
    padding-left: 5px;
    padding-right: 5px;
  }
  /* Если внутри есть иконка камеры, ограничим её ширину */
  .rank-title .fa-camera {
    font-size: 18px;                 /* подогнать под размер текста */
  }
}

/* ===== ПРИНУДИТЕЛЬНЫЙ ПЕРЕНОС ЗАГОЛОВКА НА МОБИЛЬНЫХ ===== */
@media (max-width: 768px) {
  .rank-title {
    display: block !important;       /* убираем flex, который мешает */
    white-space: normal !important;  /* разрешаем перенос */
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-size: 20px !important;
    line-height: 1.3;
    padding-left: 5px;
    padding-right: 5px;
    text-align: center !important;
  }
}
