:root {
    color-scheme: light;
    --filters-width: 290px;
    --filters-left-margin: 12px;
    --filters-right-padding: 12px;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  *, *::before, *::after {
    box-sizing: border-box;
  }

  body {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  /* Left vertical filters panel */
  #filters {position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 20%;
    min-width: var(--filters-width);
    max-width: var(--filters-width);
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    z-index: 1100;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Убираем скролл у всего блока */
  }

  #filters #tabs {
    flex: 0 0 auto;
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 8px;
  }

  #filters-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-right: 4px;
  }

  #filters-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0; /* Необходимо для работы overflow в flex-контейнере */
    overflow-y: auto;
    overflow-x: hidden;
  }

  #filters-sports {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
  }

  #filters-distances-container {
    display: none; /* Скрыт по умолчанию */
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  #filters-distances-container > div:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 8px;
    align-items: center;
  }

  #filters-distances-container .filter-checkbox {
    white-space: nowrap;
  }

  #filter-today-btn {
    margin-right: 5px;
  }

  .distance-group {
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
  }

  .distance-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .distance-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }


  .filter-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .filter-date-range label {
    font-size: 11px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
    width: 100%;
  }

  .date-range-input-wrapper {
    position: relative;
    display: inline-block;
    flex: 1;
    min-width: 0;
  }

  .filter-date-range input {
    padding: 6px 20px 6px 5px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 160px;
    width: 160px;
  }

  .date-range-clear-btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
  }

  .date-range-clear-btn:hover {
    color: #333;
  }

  .filter-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    padding: 4px 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.6);
    transition: background-color 0.2s, border-color 0.2s;
  }

  .filter-checkbox .hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #0077ff;
    color: white;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1;
  }

  .filter-checkbox .hint-icon:hover {
    background-color: #0056b3;
  }

  .filter-checkbox:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.25);
  }

  .filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
  }

  .filter-checkbox label {
    cursor: pointer;
    user-select: none;
  }

  .filter-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: stretch;
  }

  .filter-actions .filter-action-btn {
    flex: 1 1 auto;
  }

  .filter-action-btn {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #ccc;
    background: #ffffff;
    color: #333;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s;
  }

  .filter-action-btn:hover {
    background: #f5f5f5;
    border-color: #999;
  }

  .filter-action-btn:active {
    background: #e5e5e5;
  }

  .tab-button {
    padding: 6px 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid transparent;
  }

  .tab-button.active {
    border-bottom-color: #0077ff;
    font-weight: 600;
  }

  .tab-button.logo {
    padding-bottom: 0px;
    margin-top: 4px;
    margin-right: 8px;
  }

  #views {
    flex: 1 1 auto;
    position: relative;
    min-height: 0;
    z-index: 1;
    /* Отступ слева: фильтры (left margin + width + right padding) */
    margin-left: calc(var(--filters-left-margin) + var(--filters-width) + var(--filters-right-padding));
    /* Отступ справа равен отступу слева для симметрии */
    margin-right: 12px;
  }

  .view {
    position: absolute;
    inset: 0;
    display: none;
  }

  .view.active {
    display: block;
  }

  /* Отступ снизу для календарного вида */
  #calendar-view.active,
  #my-calendar-view.active {
    padding-bottom: 10px;
    box-sizing: border-box;
  }

  /* Карта как подложка на весь viewport (даже под шапкой/фильтрами/футером) */
  #map-view {
    position: fixed;
    inset: 0;
    z-index: 0;
  }

  /* Фоновое изображение для календарного вида (аналогично карте) */
  #calendar-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url('/images/backgrounds/background1.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    pointer-events: none;
  }

  /* Скрываем фон, когда календарный вид не активен */
  #calendar-view:not(.active) #calendar-background,
  #my-calendar-view:not(.active) #calendar-background {
    display: none;
  }

  /* Top right buttons - only visible on map view */
  #top-right-buttons {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 1200;
  }

  /* Скрываем кнопки только на десктопе, когда map-view не активен */
  @media (min-width: 769px) {
    /* Увеличиваем минимальную ширину блока фильтров для широких устройств */
    #filters {
      min-width: var(--filters-width);
    }
    #views:has(#calendar-view.active) #top-right-buttons,
    #views:has(#my-calendar-view.active) #top-right-buttons {
      display: none;
    }

    /* Центрируем календарь между фильтрами и правым краем */
    /* Фильтры занимают: left margin + width + right padding */
    /* Правый отступ: 12px */
    /* Доступное пространство для календаря: 100vw - (left margin + width + right padding) - правый отступ */
    /* Для центрирования календаря нужно, чтобы отступ слева от фильтров = отступу справа */
    /* Так как #views уже имеет margin-left, нужно центрировать календарь внутри #views */
    #calendar-view.active,
    #my-calendar-view.active {
      display: flex;
      justify-content: center;
      align-items: flex-start;
      padding: 0;
    }

    #calendar,
    #my-calendar {
      /* Ширина календаря с учетом центрирования */
      width: calc(100vw - var(--filters-left-margin) - var(--filters-width) - var(--filters-right-padding) - 12px - 24px); /* 100vw - фильтры - правый отступ - боковые отступы календаря (12px*2) */
      max-width: calc(100vw - var(--filters-left-margin) - var(--filters-width) - var(--filters-right-padding) - 12px - 24px);
      margin: 0 auto;
    }
  }

  /* В мобильной версии JavaScript управляет видимостью кнопок */

  #top-right-buttons #footer-about-btn,
  #top-right-buttons #footer-report-btn,
  #top-right-buttons #footer-support-btn {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, transform 0.1s;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  #top-right-buttons #footer-about-btn:hover,
  #top-right-buttons #footer-report-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
  }

  #top-right-buttons #footer-report-btn {
    min-width: 32px;
  }

  #top-right-buttons #footer-support-btn {
    border: 1px solid #4ecdc4;
    background: #4ecdc4;
    color: #fff;
    font-weight: 500;
  }

  #top-right-buttons #footer-support-btn:hover {
    background: #45b8b0;
    border-color: #45b8b0;
    transform: translateY(-1px);
  }

  /* Модальное окно для формы отправки ошибки */
  #report-error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
  }

  #report-error-modal.hidden {
    display: none;
  }

  #report-error-modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  #report-error-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
  }

  #report-error-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
  }

  #report-error-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  #report-error-modal-close:hover {
    color: #333;
  }

  #create-calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
  }

  #create-calendar-modal.hidden {
    display: none;
  }

  #create-calendar-modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  #create-calendar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
  }

  #create-calendar-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
  }

  #create-calendar-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  #create-calendar-modal-close:hover {
    color: #333;
  }

  #clear-calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
  }

  #clear-calendar-modal.hidden {
    display: none;
  }

  #clear-calendar-modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  #clear-calendar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
  }

  #clear-calendar-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
  }

  #clear-calendar-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  #clear-calendar-modal-close:hover {
    color: #333;
  }

  #map {
    width: 100%;
    height: 100%;
  }

  /* Яндекс логотип в правом нижнем углу */
  #yandex-logo {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1200;
  }

  #yandex-logo a {
    display: block;
    pointer-events: auto;
  }

  #yandex-logo img {
    max-width: 120px;
    height: auto;
    opacity: 0.8;
    display: block;
  }

  #map-view:not(.active) #yandex-logo {
    display: none;
  }

  #calendar,
  #my-calendar {
    width: calc(100% - 60px); /* почти на всю ширину с отступами */
    margin-left: 0; /* вплотную к блоку фильтров */
    margin-right: 60px; /* отступ справа */
    position: relative;
    z-index: 1;
  }

  /* Для немобильной версии центрируем календарь между фильтрами и правым краем */
  @media (min-width: 769px) {
    #calendar,
    #my-calendar {
      /* Доступное пространство: 100vw - (left margin + width + right padding) - правый отступ */
      /* Для центрирования: календарь должен иметь одинаковые отступы слева и справа */
      /* Ширина календаря с учетом центрирования */
      width: calc(100vw - var(--filters-left-margin) - var(--filters-width) - var(--filters-right-padding) - 12px - 24px); /* 100vw - фильтры - правый отступ - боковые отступы (12px*2) */
      max-width: calc(100vw - var(--filters-left-margin) - var(--filters-width) - var(--filters-right-padding) - 12px - 24px);
      margin-left: auto;
      margin-right: auto;
    }
  }

  /* Стили для кнопок отправки форм с капчей */
  .report-error-submit,
  .create-calendar-submit {
    padding: 4px 12px;
    font-size: 11px;
    border: 1px solid #0077ff;
    background: #0077ff;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
  }

  .report-error-submit:hover:not(:disabled),
  .create-calendar-submit:hover:not(:disabled) {
    background: #0056cc;
    border-color: #0056cc;
  }

  .report-error-submit:disabled,
  .create-calendar-submit:disabled {
    border: 1px solid #ccc;
    background: #ccc;
    color: #999;
    cursor: not-allowed;
  }

  /* Стили для больших кнопок в модальных окнах */
  #report-error-modal .report-error-submit,
  #create-calendar-modal .create-calendar-submit {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 4px;
  }

  /* Кнопка "Создать личный календарь" в правом верхнем углу на десктопе */
  #create-calendar-btn {
    position: fixed;
    top: 30px;
    right: 60px;
    z-index: 1200;
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid #0077ff;
    background: #0077ff;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  /* Кнопка "Очистить календарь" в правом верхнем углу на десктопе */
  #clear-calendar-btn {
    position: fixed;
    top: 30px;
    right: 60px;
    z-index: 1200;
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid #0077ff;
    background: #0077ff;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  /* OpenLayers popup styles */
  /* Предотвращаем прокрутку карты при прокрутке списка событий в кластере на мобильных */
  .cluster-events-list {
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }

  .ol-popup {
    position: absolute;
    background-color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #cccccc;
    bottom: 12px;
    left: -50px;
    min-width: var(--filters-width);
    max-width: 400px;
    font-size: 14px;
    line-height: 1.4;
  }

  .ol-popup:after,
  .ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
  }

  .ol-popup:after {
    border-top-color: white;
    border-width: 10px;
    left: 48px;
    margin-left: -10px;
  }

  .ol-popup:before {
    border-top-color: #cccccc;
    border-width: 11px;
    left: 48px;
    margin-left: -11px;
  }

  .popup-title {
    font-weight: 600;
    margin-bottom: 4px;
  }

  .popup-line {
    margin: 2px 0;
  }

  /* Модальное окно */
  .modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
  }

  .modal.hidden {
    display: none;
  }

  .modal-content {
    background: #ffffff;
    border-radius: 6px;
    padding: 16px 20px;
    max-width: 480px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  }

  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }

  .modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
  }

  .modal-close {
    border: none;
    background: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
  }

  .modal-body {
    font-size: 14px;
  }

  .modal-body .line {
    margin-bottom: 4px;
  }

  .modal-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
  }

  .btn-primary {
    background-color: #0077ff;
    color: #ffffff;
    border-color: #0077ff;
  }

  .btn-secondary {
    background-color: #ffffff;
    color: #333333;
    border-color: #cccccc;
  }

  .btn-primary:hover {
    background-color: #005fcc;
    border-color: #005fcc;
  }

  .btn-secondary:hover {
    background-color: #f5f5f5;
  }

  .event-link {
    color: #0077ff;
    text-decoration: none;
  }

  .event-link:hover {
    text-decoration: underline;
  }

  /* События в календаре выглядят кликабельными */
  .fc-daygrid-event,
  .fc-daygrid-dot-event {
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  /* Подсветка события при наведении */
  .fc-daygrid-event:hover,
  .fc-daygrid-dot-event:hover {
    background-color: #0077ff;
    border-color: #0077ff;
    color: #ffffff;
  }

  /* Чтобы заголовок события тоже становился читаемым на подсветке */
  .fc-daygrid-event:hover .fc-event-title,
  .fc-daygrid-dot-event:hover .fc-event-title {
    color: #ffffff;
  }

  /* События в списке выглядят кликабельными */
  .fc-list-event {
    cursor: pointer;
  }

  .fc-list-event-title {
    cursor: pointer;
  }

  /* Скрыть столбец с длительностью в list view */
  .fc-list-event-time {
    display: none;
  }

  /* Подсветка выходных в календаре (суббота и воскресенье) */
  .fc .fc-day-sat,
  .fc .fc-day-sun {
    background-color: #fff5f5;
  }

  /* Вертикальное расположение элементов toolbar в FullCalendar */
  .fc-header-toolbar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .fc-toolbar-chunk {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .fc-toolbar-chunk.fc-toolbar-chunk-center {
    justify-content: center;
  }

  .fc-toolbar-chunk.fc-toolbar-chunk-right {
    justify-content: flex-end;
  }

  .fc-header-toolbar{
    margin-bottom: 10px !important;
    margin-top: 10px;
  }

  /* Серый фон для заголовков месяцев в multiMonth view (как fc-cell-shaded) */
  .fc-multimonth-header {
    background-color: rgba(208, 208, 208, 0.3) !important;
  }

  /* Полупрозрачный белый фон для календаря */
  .fc-view,
  .fc-dom-1 {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  }

  .event-modal-body-description {
    margin-top: 10px;
  }

  .event-modal-body-links {
    margin-top: 10px;
  }

  .fc-event-sport-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    color: #666;
    background-color: #f0f0f0;
    border-radius: 3px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    margin-left: 4px;
    pointer-events: none;
    user-select: none;
  }

  .fc-event-green-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    color: #666;
    background-color: #7bfd67;
    border-radius: 3px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    margin-left: 4px;
    pointer-events: none;
    user-select: none;
  }

  .fc-event-red-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    color: #666;
    background-color: #fe8989;
    border-radius: 3px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    margin-left: 4px;
    pointer-events: none;
    user-select: none;
  }

  .ol-zoom {
    top: auto;
    left: auto;
    bottom: 72px;
    right: 20px;
  }

  /* Мобильная адаптация */
  @media (max-width: 1000px) {
    /* Блоки toolbar по центру в мобильной версии */
    .fc-toolbar-chunk {
      justify-content: center !important;
    }

    /* Кнопка для открытия фильтров на мобильных */
    #mobile-filters-toggle {
      display: block;
      position: fixed;
      top: 12px;
      left: 12px;
      z-index: 1900;
      padding: 12px 16px;
      background: rgba(255, 255, 255, 0.9);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255, 255, 255, 0.35);
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 600;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      touch-action: manipulation;
      min-height: 44px;
      min-width: 44px;
    }

    /* Затемнение фона при открытых фильтрах */
    #filters-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 1999;
    }

    #filters-overlay.active {
      display: block;
    }

    /* Блок фильтров на мобильных - скрываем по умолчанию, делаем выдвижным */
    #filters {
      position: fixed;
      top: 0;
      left: -100%;
      width: 80%;
      max-width: 320px;
      height: 100vh;
      bottom: auto;
      z-index: 2000;
      transition: left 0.3s ease;
      border-radius: 0;
      border-left: none;
      border-top: none;
      border-bottom: none;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* Убеждаемся, что tabs не скроллятся и занимают минимум места */
    #filters #tabs {
      flex: 0 0 auto;
      flex-shrink: 0;
    }

    /* Контент фильтров должен прокручиваться */
    #filters #filters-content {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 80px;
    }

    #filters.mobile-open {
      left: 0;
    }

    /* Затемнение фона при открытых фильтрах */
    #filters-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 1999;
    }

    #filters-overlay.active {
      display: block;
    }

    /* Карта и календарь занимают всю ширину на мобильных */
    #views {
      margin-left: 0;
      width: 100%;
    }

    #map-view,
    #calendar-view,
    #my-calendar-view {
      width: 100%;
    }

    /* Кнопки внизу страницы в один ряд на мобильных */
    #top-right-buttons {
      position: fixed;
      bottom: 12px;
      left: 12px;
      right: 12px;
      top: auto;
      flex-direction: row;
      justify-content: center;
      gap: 6px;
      flex-wrap: nowrap;
      width: calc(100% - 24px);
      z-index: 1200;
    }

    /* В мобильной версии кнопки видны и в календарном виде */
    #calendar-view.active #top-right-buttons,
    #my-calendar-view.active #top-right-buttons {
      display: flex !important;
    }

    #top-right-buttons button {
      padding: 10px 12px;
      font-size: 12px;
      white-space: nowrap;
      flex: 0 0 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Уменьшаем размеры элементов фильтров */
    #filters {
      padding: 16px 12px;
    }

    .filter-date-range {
      width: 100%;
    }

    .filter-date-range label {
      flex-wrap: nowrap;
      gap: 6px;
      width: 100%;
    }

    .date-range-input-wrapper {
      flex: 1;
      min-width: 0;
    }

    .filter-date-range input {
      min-width: 0;
      width: 100%;
      font-size: 14px;
      padding: 8px 30px 8px 10px;
    }

    #filter-today-btn {
      flex-shrink: 0;
      white-space: nowrap;
    }

    .filter-checkbox {
      font-size: 11px;
      padding: 6px 8px;
      white-space: normal;
      word-wrap: break-word;
      line-height: 1.3;
    }

    /* Специально для чекбокса "Фильтр по дистанциям" на мобильных */
    #enable-distances-filter + span {
      font-size: 11px;
      line-height: 1.3;
    }

    .filter-action-btn {
      padding: 10px 16px;
      font-size: 13px;
      touch-action: manipulation;
    }

    /* Модальные окна на мобильных */
    .modal-content,
    #report-error-modal-content,
    #create-calendar-modal-content,
    #clear-calendar-modal-content {
      width: 90%;
      max-width: 90%;
      margin: 20px auto;
      max-height: 90vh;
      overflow-y: auto;
    }

    .modal-header,
    #report-error-modal-header,
    #create-calendar-modal-header,
    #clear-calendar-modal-header {
      padding: 16px;
    }

    .modal-title,
    #report-error-modal-title,
    #create-calendar-modal-title,
    #clear-calendar-modal-title {
      font-size: 18px;
    }

    .modal-body,
    #report-error-modal-body,
    #create-calendar-modal-body,
    #clear-calendar-modal-body {
      padding: 16px;
      font-size: 14px;
    }

    /* Кнопки управления картой OpenLayers */
    .ol-zoom {
      bottom: 80px;
      right: 12px;
    }

    .ol-zoom button {
      width: 36px;
      height: 36px;
      font-size: 18px;
    }

    /* Стили для ссылок быстрого выбора видов спорта */
  .quick-sport-btn {
    color: #0077ff;
    text-decoration: none;
    transition: opacity 0.2s;
  }
  
  .quick-sport-btn:hover {
    opacity: 0.7;
  }
  
  .quick-sport-btn:active {
    opacity: 0.5;
  }

  /* Логотип Яндекс на мобильных - справа вверху */
    #yandex-logo {
      top: 12px;
      right: 12px;
      bottom: auto;
    }

    #yandex-logo img {
      width: 80px;
      height: auto;
    }

    /* Календарь - на всю ширину с минимальным отступом */
    #calendar-view,
    #my-calendar-view {
      padding: 60px 8px 8px 8px;
      width: 100%;
    }

    /* Фоновое изображение смещено вправо на 200px в мобильной версии */
    #calendar-background {
      background-position-x: right;
      background-position-y: center;
    }

    /* Календарь занимает всю ширину с небольшими отступами */
    #calendar,
    #my-calendar {
      width: 100%;
      margin-left: 0;
      margin-right: 0;
      padding-bottom: 80px; /* Отступ снизу, чтобы кнопки не перекрывали календарь */
    }

    /* Переносы текста в списочном виде на мобильных */
    .fc-list-event-title,
    .fc-list-event-time,
    .fc-list-event {
      white-space: normal !important;
      word-wrap: break-word !important;
      overflow-wrap: break-word !important;
    }

    .fc-list-event-title {
      line-height: 1.4;
    }

    /* Минимальный padding и border-radius у FullCalendar на мобильных */
    .fc-view,
    .fc-dom-1 {
      padding: 8px !important;
      border-radius: 8px !important;
    }

    /* В мобильной версии календарь не растягивается до низа, только по содержимому */
    #calendar-view .fc,
    #my-calendar-view .fc {
      height: auto !important;
    }

    #calendar-view .fc-scroller,
    #my-calendar-view .fc-scroller {
      height: auto !important;
      overflow: visible !important;
    }

    /* Для multiMonth view высота по содержимому */
    .fc-multimonth {
      height: auto !important;
    }

    /* Кнопки "Создать личный календарь" и "Очистить календарь" в правом верхнем углу на мобильных */
    #create-calendar-btn,
    #clear-calendar-btn {
      position: fixed;
      top: 12px;
      right: 12px;
      z-index: 1200;
      margin-bottom: 0;
      padding: 10px 14px;
      font-size: 13px;
      touch-action: manipulation;
      background: #0077ff;
      backdrop-filter: blur(8px);
      border: 1px solid #0077ff;
      border-radius: 6px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }


    /* Улучшаем touch-цели для кнопок */
    button,
    .btn,
    .tab-button {
      min-height: 44px;
      min-width: 44px;
      touch-action: manipulation;
    }

    /* Увеличиваем размеры чекбоксов для touch */
    input[type="checkbox"] {
      width: 20px;
      height: 20px;
      min-width: 20px;
      min-height: 20px;
    }
  }

  @media (max-width: 480px) {
    #filters {
      width: 85%;
    }

    #mobile-filters-toggle {
      padding: 10px 14px;
      font-size: 13px;
    }

    .filter-date-range {
      width: 100%;
    }

    .filter-date-range label {
      flex-wrap: nowrap;
      gap: 6px;
      width: 100%;
    }

    .date-range-input-wrapper {
      flex: 1;
      min-width: 0;
    }

    .filter-date-range input {
      min-width: 0;
      width: 100%;
      font-size: 13px;
      padding: 6px 30px 6px 10px;
    }

    #filter-today-btn {
      flex-shrink: 0;
      white-space: nowrap;
    }

    #top-right-buttons {
      bottom: 8px;
      left: 8px;
      right: 8px;
      width: calc(100% - 16px);
      gap: 4px;
    }

    #top-right-buttons button {
      padding: 8px 10px;
      font-size: 11px;
      flex: 0 0 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .modal-content,
    #report-error-modal-content,
    #create-calendar-modal-content,
    #clear-calendar-modal-content {
      width: 95%;
      max-width: 95%;
    }
  }
