/* =========================================================
   TWINLY — MOBILE
   Только мобильная версия
   ========================================================= */

@media (max-width: 900px) {

  /* ---------------------------------------------------------
     GENERAL
     --------------------------------------------------------- */

  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .app-shell {
    display:block;
    width:100%;
    min-height:100vh;
  }

  .brand {
    display: none;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding-bottom: 84px;
  }


  /* ---------------------------------------------------------
     TOPBAR
     --------------------------------------------------------- */

  .topbar {
    width: 100%;
    height: 64px;
    padding: 0 16px;
    box-sizing: border-box;
  }

  .topbar-notification-icon {
    position: relative;
    display: inline-flex;
  }

  .topbar-notification-badge {
    position: absolute;
    top: -6px;
    right: -8px;

    min-width: 17px;
    height: 17px;
    padding: 0 4px;

    border-radius: 999px;

    background: #e53935;
    color: #fff;

    font-size: 10px;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
  }


  /* ---------------------------------------------------------
     CONTENT
     --------------------------------------------------------- */

  .content {
    width: 100%;
    max-width: none;
    padding: 18px 16px 96px;
    box-sizing: border-box;
  }


  /* ---------------------------------------------------------
     CHAT PAGE
     --------------------------------------------------------- */

  .main:has(.chat-window) {
    display: flex;
    flex-direction: column;

    height: calc(100dvh - 64px);
    min-height: 0;

    padding-bottom: 0;

    overflow: hidden;

    box-sizing: border-box;
  }

  .main:has(.chat-window) .topbar {
    display: none;
  }

  .content:has(.chat-window) {
    flex: 1 1 auto;

    width: 100%;
    min-height: 0;

    padding-top: 8px;
    padding-bottom: 84px;

    overflow: hidden;

    box-sizing: border-box;
  }

  .content:has(.chat-window) .chat-window {
    width: 100%;
    height: 100%;
    min-height: 0;

    overflow: hidden;
  }

  .content:has(.chat-window) .chat-window-header {
    gap: 8px;
    padding-bottom: 8px;
  }

  .content:has(.chat-window) .chat-back-button {
    width: 36px;
    height: 36px;

    font-size: 26px;
  }

  .content:has(.chat-window) .chat-window-user {
    gap: 8px;
  }

  .content:has(.chat-window) .chat-window-avatar {
    width: 36px;
    height: 36px;
  }

  .content:has(.chat-window) .chat-window-name {
    font-size: 15px;
  }


  /*
   * Open chat — hide mobile bottom navigation completely.
   */

  .app-shell:has(.chat-window) .sidebar {
    display: none;
  }

  .main:has(.chat-window) {
    height: 100dvh;
  }

  .content:has(.chat-window) {
    padding-bottom: 0;
  }


  /* ---------------------------------------------------------
     BOTTOM NAVIGATION
     --------------------------------------------------------- */

  .sidebar {
    position: fixed;

    z-index: 1000;

    left: 8px;
    right: 8px;
    bottom: 8px;

    top: auto;

    width: auto;
    height: 72px;

    padding: 5px;

    border: 1px solid var(--line);
    border-radius: 24px;

    background: var(--card);

    box-shadow:
      0 8px 30px rgba(32, 32, 32, .12);

    box-sizing: border-box;
  }

  .nav {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: row;

    align-items: stretch;
    justify-content: space-around;

    gap: 4px;
  }

  .nav button {
    flex: 1;

    min-width: 0;
    min-height: 60px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 3px;

    padding: 5px 4px;

    border: 0;
    border-radius: 18px;

    background: transparent;
    color: var(--muted);

    font-size: 11px;
    line-height: 1.1;

    box-shadow: none;

    transition:
      background .18s ease,
      color .18s ease,
      transform .15s ease;
  }

  .nav button:hover {
    background: var(--bg);
    color: var(--text);
  }

  .nav button:active {
    transform: scale(.95);
  }

  .nav button.active {
    background: var(--bg);
    color: var(--text);
    box-shadow: none;
  }

  .nav-icon {
    display: block;

    flex-shrink: 0;

    font-size: 21px;
    line-height: 23px;
  }

  .nav-icon {
    position: relative;
  }

  .nav-badge {
    position: absolute;

    top: -7px;
    right: -10px;

    min-width: 17px;
    height: 17px;

    padding: 0 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border-radius: 999px;

    background: #e53935;
    color: #fff;

    font-size: 10px;
    font-weight: 800;
    line-height: 17px;

    border: 2px solid var(--card);

    pointer-events: none;
  }

  .nav-label {
    display: block;

    width: 100%;
    max-width: 100%;

    padding: 0 2px;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;

    text-align: center;

    font-size: 11px;
    font-weight: 550;

    line-height: 1.1;
  }


  /* ---------------------------------------------------------
     COMMON BUTTONS
     --------------------------------------------------------- */

  .btn {
    border-radius: 17px;
  }


  /* ---------------------------------------------------------
     PROFILE ACTIONS
     --------------------------------------------------------- */

  .profile-actions {
    grid-template-columns: 1fr;
  }

  .profile-action {
    width: 100%;
    min-width: 0;

    padding: 16px 18px;

    border-radius: 18px;

    background: var(--card);

    box-sizing: border-box;

    transition:
      background .18s ease,
      transform .15s ease,
      box-shadow .18s ease,
      border-color .18s ease;
  }

  .profile-action:active {
    transform: scale(.985);
  }

  .profile-action span,
  .profile-action strong,
  .profile-action small {
    min-width: 0;

    overflow-wrap: anywhere;
  }

  .profile-action span:nth-child(2) {
    min-width: 0;
  }


  /* ---------------------------------------------------------
     PROFILE HEADER
     --------------------------------------------------------- */

  .profile-header {
    align-items: flex-start;

    flex-direction: column;

    padding: 18px;

    border-radius: 18px;

    background: var(--card);

    box-shadow: var(--shadow);
  }

  .profile-header .btn {
    width: 100%;
  }


  /* ---------------------------------------------------------
     PROFILE SECTIONS
     --------------------------------------------------------- */

  .profile-section {
    width: 100%;
    min-width: 0;

    margin-bottom: 16px;

    border-radius: 20px;

    background: var(--card);

    box-shadow: var(--shadow);

    overflow: hidden;
  }

  .profile-section h3 {
    padding-left: 20px;
    padding-right: 20px;
  }


  /*
   * ЦЕЛЬ ЗНАКОМСТВА
   *
   * Сам h3 уже имеет правильный отступ.
   * Отдельный div с выбранной целью
   * выравниваем по тому же левому краю.
   */

  .profile-section > div {
    box-sizing: border-box;
  }

  .profile-section > h3 + div {
    padding-left: 20px;
    padding-right: 20px;
  }


  /*
   * ИНТЕРЕСЫ
   *
   * Контейнер с овальными кнопками
   * начинается на том же уровне,
   * что и заголовок "Интересы".
   *
   * Внутренние отступы самих овалов
   * НЕ изменяем.
   */

  .profile-section > h3 + div[style*="display:flex"] {
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
  }


  /*
   * ПОЛ / ИЩУ
   *
   * Этот блок НЕ использует .profile-row.
   * Поэтому отдельное правило необходимо,
   * иначе текст прилипает к самому краю card.
   */

  .profile-section > div > strong {
    /* ничего не меняем */
  }

  .profile-section > div {
    overflow-wrap: anywhere;
  }


  /* ---------------------------------------------------------
     PROFILE ROWS
     --------------------------------------------------------- */

  .profile-row {
    width: 100%;
    min-width: 0;

    display: flex;

    align-items: flex-start;

    gap: 8px;

    padding: 15px 20px;

    border: 0;
    border-radius: 0;

    background: var(--card);

    color: var(--text);

    text-align: left;

    box-sizing: border-box;

    overflow: visible;

    line-height: 1.45;

    transition:
      background .18s ease,
      transform .15s ease;
  }

  .profile-row:active {
    background: var(--bg);
  }

  .profile-row span {
    min-width: 0;
  }

  .profile-row span:first-child {
    flex-shrink: 0;
  }

  .profile-row span:nth-child(2) {
    flex: 1;

    min-width: 0;

    padding: 0;

    overflow-wrap: anywhere;

    word-break: normal;
  }


  /* ---------------------------------------------------------
     SETTINGS
     --------------------------------------------------------- */

  .settings-list {
    border-radius: 20px;

    box-shadow: var(--shadow);

    overflow: hidden;
  }

  .settings-row {
    width: 100%;
    min-width: 0;

    padding: 15px 18px;

    box-sizing: border-box;

    transition:
      background .18s ease,
      transform .15s ease;
  }

  .settings-row:active {
    background: var(--bg);
  }

  .settings-page-header{
    gap:8px;
  }

  .settings-back{
    width:36px;
    height:36px;
    font-size:26px;
  }

  .settings-section-title{
    padding:14px 16px 10px;
  }

  .settings-choice{
    min-height:50px;
    padding:11px 16px;
  }

  .settings-switch-row{
    min-height:54px;
    padding:12px 16px;
  }

  .settings-security-info{
    padding:16px;
  }

  .settings-security-warning{
    padding:14px 16px;
  }

  .settings-security-modal{
    padding:20px;
  }

  .settings-security-actions{
    gap:8px;
  }


  /* =========================================================
     SMALL MOBILE
     ========================================================= */

  @media (max-width: 480px) {

    /* -------------------------------------------------------
       BOTTOM NAV
       ------------------------------------------------------- */

    .sidebar {
      left: 6px;
      right: 6px;
      bottom: 6px;

      top: auto;

      height: 70px;

      padding: 4px;

      border-radius: 22px;
    }

    .nav {
      gap: 3px;
    }

    .nav button {
      min-height: 60px;

      padding: 5px 2px;

      border-radius: 17px;
    }

    .nav-icon {
      font-size: 20px;

      line-height: 22px;
    }

    .nav-label {
      font-size: 10px;
    }


    /* -------------------------------------------------------
       CONTENT
       ------------------------------------------------------- */

    .main {
      padding-bottom: 82px;
    }

    .content {
      padding-left: 12px;
      padding-right: 12px;
      padding-bottom: 94px;
    }


    /* -------------------------------------------------------
       PROFILE
       ------------------------------------------------------- */

    .profile-row {
      padding-left: 18px;
      padding-right: 18px;
    }

    .profile-section h3 {
      padding-left: 18px;
      padding-right: 18px;
    }


    /*
     * Все текстовые элементы внутри
     * профильных секций начинаются
     * на одном уровне с заголовком.
     */

    .profile-section > h3 + div {
      padding-left: 18px;
      padding-right: 18px;
    }


    /*
     * Интересы:
     * сами овалы не меняем,
     * меняем только положение контейнера.
     */

    .profile-section > h3 + div[style*="display:flex"] {
      padding-left: 18px;
      padding-right: 18px;
    }
  }


  /* =========================================================
     VERY SMALL SCREENS
     ========================================================= */

  @media (max-width: 360px) {

    .sidebar {
      left: 4px;
      right: 4px;
      bottom: 4px;

      top: auto;

      border-radius: 20px;
    }

    .nav button {
      padding-left: 1px;
      padding-right: 1px;

      border-radius: 15px;
    }

    .nav-icon {
      font-size: 19px;
    }

    .nav-label {
      font-size: 9px;
    }

    .profile-row {
      padding-left: 16px;
      padding-right: 16px;
    }

    .profile-section h3 {
      padding-left: 16px;
      padding-right: 16px;
    }

    .profile-section > h3 + div {
      padding-left: 16px;
      padding-right: 16px;
    }

    .profile-section > h3 + div[style*="display:flex"] {
      padding-left: 16px;
      padding-right: 16px;
    }
  }

}

  /* =========================================================
     PWA INSTALL BUTTON
     ========================================================= */

  .pwa-store-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 18px auto;
    padding: 0 16px;
    box-sizing: border-box;
  }

  .pwa-store-button {
    width: 240px;
    min-height: 60px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;

    padding: 8px 18px;

    border: 1px solid var(--line);
    border-radius: 14px;

    background: #000;
    color: #fff;

    font: inherit;
    text-align: left;

    cursor: pointer;
    box-sizing: border-box;

    transition:
      transform .15s ease,
      opacity .15s ease;
  }

  .pwa-store-button:hover {
    opacity: .92;
    transform: translateY(-1px);
  }

  .pwa-store-button:active {
    transform: scale(.98);
  }

  .pwa-store-logo {
    flex: 0 0 auto;

    width: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 24px;
    line-height: 1;
  }

  .pwa-store-content {
    min-width: 0;

    display: flex;
    flex-direction: column;
  }

  .pwa-store-small {
    font-size: 10px;
    line-height: 1.1;
    font-weight: 500;
    letter-spacing: .2px;
  }

  .pwa-store-name {
    margin-top: 3px;

    font-size: 17px;
    line-height: 1.05;
    font-weight: 650;
    letter-spacing: -.2px;
  }

  /* =========================================================
     PWA INSTALL BUTTON — MOBILE
     ========================================================= */

  @media (max-width: 600px) {

    .pwa-store-button {
      width: min(100%, 280px);
    }

  }


  /* =========================================================
     BLOCKED USERS
     ========================================================= */

  .blocked-user-row{
    gap:10px;
    padding:12px 16px;
  }

  .blocked-user-photo{
    width:48px;
    min-width:48px;
    height:48px;
  }

  .blocked-user-name{
    font-size:14px;
  }

  .blocked-user-city{
    font-size:12px;
  }

  .blocked-user-unblock{
    min-height:36px;
    padding:0 10px;
    font-size:12px;
  }

  .blocked-user-actions{
    gap:6px;
  }

  .blocked-user-delete{
    min-height:36px;
    padding:0 10px;
    font-size:12px;
  }