/* ===============================
   📱 Адаптивная мобильная версия GoalUp
   =============================== */
@media (max-width: 768px) {

  /* ==== БАЗА ==== */
  html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: 15px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d0d 100%) !important;
    color: #eee;
  }

  main, section, div, header, footer {
    box-sizing: border-box;
  }

  /* ==== ШАПКА ==== */
  header {
    position: sticky;
    top: 0;
    z-index: 2000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    backdrop-filter: blur(12px);
    background: rgba(74, 20, 140, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  }

  .header-left h1 {
    margin: 0;
  }

  .header-left h1 a {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .user-info-link {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 10px;
  }

  .avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
  }

  .username {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
  }

  .btn-nav {
    color: #ffd700;
    font-weight: bold;
    text-decoration: none;
  }

  /* ==== ОСНОВНОЙ КОНТЕНТ ==== */
  main {
    width: 100%;
    padding: 12px 14px;
    margin: 0 auto;
  }

  .form-container,
  .profile-container,
  .profile-edit-grid,
  .welcome {
    width: 100%;
    max-width: 92%;
    margin: 20px auto;
    padding: 20px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    background: #fff;
  }

  /* ==== КНОПКИ ==== */
  .btn,
  button,
  input[type="submit"] {
    width: 90%;
    max-width: 300px;
    margin: 6px auto;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 15px;
    display: block;
    text-align: center;
  }

  .btn-alt {
    background: #ffd700;
    color: #4a148c;
  }

  .form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
  }

  /* === Правка кнопок "Сохранить" и "Отмена" === */
.form-actions .btn,
.form-actions .btn-alt {
  width: 100%;
  max-width: none;
  border-radius: 10px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

/* Сохранить — фиолетовая */
.form-actions .btn {
  background: #4a148c;
  color: #fff;
  border: none;
}

/* Отмена — жёлтая */
.form-actions .btn-alt {
  background: #ffd700;
  color: #4a148c;
  border: none;
}

/* Поведение при нажатии */
.form-actions .btn:active,
.form-actions .btn-alt:active {
  transform: scale(0.97);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

  /* ==== ПРОФИЛЬ ==== */
  .profile-container {
    text-align: center;
  }

  .profile-avatar img {
    width: 110px;
    height: 110px;
    border: 3px solid #4a148c;
    border-radius: 50%;
    object-fit: cover;
  }

  .profile-info p {
    margin: 6px 0;
    font-size: 14px;
    color: #333;
  }

  .profile-container .btn {
    width: 85%;
    max-width: 280px;
    margin: 6px auto;
    padding: 10px 0;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
  }

  .profile-container .btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  }

  /* ==== КАЛЕНДАРЬ ==== */
  #main-calendar {
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    padding: 10px;
    margin-top: 15px;
  }

/* ====== Исправление верстки событий в мобильной версии ====== */
@media (max-width: 768px) {
  .fc-daygrid-event {
    display: block !important;
    width: 100% !important;
    white-space: normal !important;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px !important;
    padding: 2px 4px !important;
    line-height: 1.2 !important;
  }

  .fc-daygrid-day-events {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .fc-daygrid-day-top {
    justify-content: center;
  }

  .fc-event-title {
    white-space: normal !important;
  }
}


  /* 🎛 Toolbar FullCalendar */
  .fc .fc-toolbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
  }

  /* Левая часть — навигация */
  .fc .fc-toolbar-chunk:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .fc-prev-button,
  .fc-next-button {
    background: #4a148c !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
    font-size: 16px;
    width: 38px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: background 0.2s ease, transform 0.1s ease;
  }

  .fc-prev-button:hover,
  .fc-next-button:hover {
    background: #6a1b9a !important;
    transform: scale(1.05);
  }

  /* Центр — название месяца */
  .fc-toolbar-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #000;
  }

  /* Правая часть — кнопки “Сегодня” и режимы */
  .fc .fc-toolbar-chunk:last-child {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .fc-today-button {
    background: #ffcc00 !important;
    color: #000 !important;
    border-radius: 8px;
    font-weight: 700;
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: background 0.2s ease;
  }

  .fc-today-button:hover {
    background: #ffd633 !important;
  }

  .fc .fc-button-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .fc .fc-button-group .fc-button {
    background: #4a148c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.1s ease;
  }

  .fc .fc-button-group .fc-button.fc-button-active {
    background: #222;
    color: #fff;
  }

  .fc .fc-button-group .fc-button:hover {
    background: #6a1b9a;
    transform: scale(1.05);
  }

  /* Сетка и события */
  .fc .fc-daygrid-day-frame {
    min-height: 65px !important;
    padding: 2px;
  }

  .fc .fc-day-today {
    background-color: rgba(255, 223, 0, 0.15) !important;
    outline: 2px solid #ffcc00;
    outline-offset: -2px;
  }

  .fc .fc-event {
    display: block;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  }

  .fc-event.default {
    background: #4a148c;
    color: #fff;
  }

  .fc-event.important {
    background: #e63946;
    color: #fff;
  }

  .fc-event.completed {
    background: #9e9e9e;
    color: #fff;
    text-decoration: line-through;
    opacity: 0.9;
  }

  /* ==== ЦЕЛИ ==== */
  .goals-page h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #4a148c;
    text-align: center;
  }

  .goals-page .btn {
    flex: 1;
    min-width: 130px;
    padding: 8px 0;
    font-size: 14px;
    border-radius: 8px;
    margin: 5px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
  }

  .goals-page .btn:active {
    transform: scale(0.96);
  }

  .goals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border-radius: 10px;
    overflow: hidden;
  }

  .goals-table th,
  .goals-table td {
    padding: 8px 6px;
    text-align: center;
    border: 1px solid #eee;
    word-break: break-word;
  }

  .goals-table th {
    background: #f5f3ff;
    color: #4a148c;
    font-weight: bold;
    font-size: 13.5px;
  }

  .goal-actions {
    display: flex;
    justify-content: center;
    gap: 6px;
  }

  .goal-action {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
  }

  .goal-action:active {
    transform: scale(0.9);
  }

  .goals-table td:nth-child(3) {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 600;
    font-size: 13.5px;
  }

  .goal-row.default td:nth-child(3) {
    color: #4a148c;
  }

  .goal-row.important td:nth-child(3) {
    color: #e63946;
  }

  .goal-row.completed td:nth-child(3) {
    color: #777;
    text-decoration: line-through;
  }

  /* ==== FOOTER ==== */
  footer {
    font-size: 13px;
    padding: 12px;
    text-align: center;
    color: #ccc;
    background: transparent !important;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
}

/* ==== Очень маленькие экраны ==== */
@media (max-width: 480px) {
  html, body { font-size: 14px; }
  header { padding: 6px 10px; }
  .header-left h1 a { font-size: 18px; }
  .avatar-small { width: 26px; height: 26px; }
  .btn { font-size: 13px; padding: 10px 0; }
  .welcome h2 { font-size: 20px; }
}

/* ==== Глобальные фиксы ==== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #1a1a2e 0%, #0d0d0d 100%) fixed !important;
  overflow-x: hidden;
  color: #eee;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #1a1a2e 0%, #0d0d0d 100%);
  background-size: cover;
}

@supports (height: 100svh) {
  html, body { height: 100svh; }
}

@supports not (height: 100svh) {
  html, body { min-height: -webkit-fill-available; }
}

html { overscroll-behavior: none; }

/* === Мини-фикс для тулбара FullCalendar === */
@media (max-width: 768px) {

  /* стрелки гарантированно видимы */
  .fc-prev-button,
  .fc-next-button {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* кнопка "Сегодня" — всегда жёлтая */
  .fc-today-button {
    background: #ffcc00 !important;
    color: #000 !important;
    font-weight: 700;
  }

  .fc-today-button:hover,
  .fc-today-button:active,
  .fc-today-button:focus {
    background: #ffd633 !important;
    color: #000 !important;
  }

  /* активный режим календаря — фиолетовый */
  .fc .fc-button-group .fc-button.fc-button-active {
    background: #4a148c !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  }

  /* hover для остальных кнопок */
  .fc .fc-button-group .fc-button:hover {
    background: #6a1b9a !important;
    color: #fff !important;
  }
}

/* Шапка колонок в week/day: компактно и без переноса */
@media (max-width: 768px) {
  .fc .fc-col-header-cell-cushion {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 0;
    color: #4a148c;
  }
}

/* ===============================
   🎯 Финальный вид целей в календаре — компактный
   =============================== */
@media (max-width: 768px) {

  /* убираем синие точки */
  .fc-daygrid-event-dot {
    display: none !important;
  }

  /* Общие параметры событий */
  .fc .fc-event {
    display: flex;
    align-items: center;
    gap: 2px; /* почти без отступа */
    width: 100%;
    border: none !important;
    background: transparent !important;
    border-radius: 0;
    padding: 0;
    margin: 1px 0;
    font-size: 9.5px; /* сильно уменьшили текст */
    font-weight: 500;
    line-height: 1.1;
    color: #111 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Полоска слева */
  .fc .fc-event::before {
    content: "";
    width: 3px;
    height: 15px;
    border-radius: 2px;
    margin-right: 0.001px; /* прижали текст к полоске */
    flex-shrink: 0;
  }

  /* Цвета целей */
  .fc-event.default::before {
    background: #4a148c; /* обычная */
  }

  .fc-event.important::before {
    background: #e63946; /* важная */
  }

  .fc-event.completed::before {
    background: #9e9e9e; /* завершённая */
  }

  /* Завершённые */
  .fc-event.completed {
    color: #777 !important;
    text-decoration: line-through;
    opacity: 0.85;
  }

  /* Скрыть время */
  .fc-event-time {
    display: none !important;
  }

  /* Заголовок цели */
  .fc-event-title {
    display: inline-block;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
  }

  /* Hover эффект */
  .fc .fc-event:hover {
    background: rgba(0, 0, 0, 0.05) !important;
  }
}
/* ===============================
   🧩 Автоматическая высота ячеек календаря
   =============================== */
@media (max-width: 768px) {

  /* Позволяем строкам расти, если целей много */
  .fc .fc-daygrid-day-frame {
    min-height: auto !important;
    height: auto !important;
    padding-bottom: 4px;
  }

  /* Контейнер для событий – колоночная верстка, не обрезаем */
  .fc .fc-daygrid-day-events {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Сами события – чтобы не прилипали и не наслаивались */
  .fc .fc-event {
    position: relative;
    margin: 1px 0;
    height: auto !important;
  }

  /* Заголовок цели может переноситься на вторую строку при необходимости */
  .fc-event-title {
    white-space: normal !important;
    line-height: 1.1;
  }
}
/* ===============================
   🔠 Уменьшение шрифта текста целей
   =============================== */
@media (max-width: 768px) {

  /* Текст целей меньше и тоньше */
  .fc .fc-event {
    font-size: 7.5px !important; 
    font-weight: 500;
    line-height: 1.05;
  }

  /* Текст заголовка */
  .fc-event-title {
    font-size: 7.5px !important;
    font-weight: 500;
  }

  /* Для завершённых — ещё чуть светлее */
  .fc-event.completed {
    color: #888 !important;
    font-size: 8px !important;
  }
}

/* ===============================
   🧹 Убираем прозрачные плашки у текста целей
   =============================== */
@media (max-width: 768px) {

  /* убираем фоны и тени у всех событий */
  .fc .fc-event,
  .fc .fc-daygrid-event,
  .fc .fc-daygrid-dot-event {
    background: none !important;
    box-shadow: none !important;
  }

  /* убираем белый фон при hover */
  .fc .fc-event:hover {
    background: none !important;
  }

  /* убираем внутренние рамки */
  .fc .fc-event-main {
    background: transparent !important;
    box-shadow: none !important;
  }

  /* сам текст остаётся */
  .fc-event-title {
    background: none !important;
  }
}
/* ===============================
   ⚙️ Прижимаем текст целей максимально близко к полоске
   =============================== */
@media (max-width: 768px) {

  /* Контейнер текста в событии */
  .fc-event-main-frame,
  .fc-event-title-container {
    padding-left: 0 !important;
    margin-left: 0 !important;
  }

  /* Сама цветная полоска */
  .fc .fc-event::before {
    width: 3px;
    height: 13px;
    border-radius: 2px;
    margin-right: 0 !important; /* полностью убираем зазор */
    flex-shrink: 0;
  }

  /* Текст цели */
  .fc-event-title {
    margin-left: 0 !important;
    padding-left: 0 !important;
  }

  /* Слегка корректируем выравнивание, чтобы текст не залезал на полоску */
  .fc .fc-event {
    gap: 0 !important;
  }
}
/* ===== Прелоадер ===== */
#loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #fff;
  border-top-color: #4a148c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* ===============================
   📅 ФИНАЛ: фикс для узкой колонки "Дата / Время"
   =============================== */
@media (max-width: 768px) {
  .goals-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
  }

  .goals-table th,
  .goals-table td {
    white-space: nowrap;
    vertical-align: middle;
  }

  /* 🔧 фиксируем ширину только даты */
  .goals-table th:nth-child(3),
  .goals-table td:nth-child(3) {
    width: 60px;     /* 👈 узкая колонка */
    min-width: 80px;
    text-align: center;
  }

  /* Остальные колонки гибкие */
  .goals-table th:nth-child(1),
  .goals-table td:nth-child(1) {
    width: 30%;
  }

  .goals-table th:nth-child(2),
  .goals-table td:nth-child(2) {
    width: 40%;
  }

  .goals-table th:nth-child(4),
  .goals-table td:nth-child(4) {
    width: 40%;
  }
}


@media (max-width: 768px) {
  .password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
  }

  .password-wrapper input {
    width: 100%;
    padding-right: 42px;
    box-sizing: border-box;
  }

  .toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
  }

  .toggle-password svg,
  .toggle-password i {
    width: 20px;
    height: 20px;
    stroke: #4a148c;
  }
}


/* ===============================
   👁 Абсолютный фикс для глазика на мобильных
   =============================== */
@media (max-width: 768px) {
  .password-wrapper {
    position: relative;
    display: block;
  }

  .password-wrapper input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 45px; /* место под глаз */
  }

  .toggle-password {
    position: absolute;
    right: 6px;
    top: 0;
    bottom: 0;
    margin: auto;
    background: #fff;
    border: 1px solid #4a148c;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
  }

  .toggle-password svg,
  .toggle-password i {
    width: 18px;
    height: 18px;
    stroke: #4a148c;
    display: block;
  }
}
/* ===============================
   📅 Красивый вид для режима "Неделя"
   =============================== */
@media (max-width: 768px) {

  /* заголовки дней недели */
  .fc-timeGridWeek-view .fc-col-header-cell {
    background: #f5f3ff !important;
    color: #4a148c !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    border: none !important;
    text-transform: lowercase;
    text-align: center !important;
  }

  /* дата под названием дня */
  .fc-timeGridWeek-view .fc-col-header-cell-cushion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #4a148c !important;
    font-size: 14px;
  }

  /* сетка недели — делаем мягкой */
  .fc-timeGridWeek-view .fc-timegrid-slot,
  .fc-timeGridWeek-view .fc-timegrid-axis {
    border-color: rgba(0, 0, 0, 0.05) !important;
  }

  /* ячейки текущего дня выделены */
  .fc-timeGridWeek-view .fc-day-today {
    background: rgba(255, 223, 0, 0.12) !important;
    outline: 2px solid #ffd700 !important;
    outline-offset: -2px;
  }

  /* события (цели) */
  .fc-timeGridWeek-view .fc-event {
    border-radius: 6px !important;
    font-size: 2px !important;
    font-weight: 200 !important;
    padding: 2px 3px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    overflow: hidden;
  }

  /* цвета по типу целей */
  .fc-event.default {
    background: #4a148c !important;
    color: #fff !important;
  }
  .fc-event.important {
    background: #e63946 !important;
    color: #fff !important;
  }
  .fc-event.completed {
    background: #9e9e9e !important;
    color: #fff !important;
    text-decoration: line-through;
  }

  /* отключаем "all-day" надпись */
  .fc-timeGridWeek-view .fc-timegrid-axis-cushion {
    color: transparent !important;
  }

  /* делаем прокрутку более гладкой */
  .fc-timeGridWeek-view .fc-timegrid-body {
    scroll-behavior: smooth;
  }

  /* кнопки вида */
  .fc .fc-button-group .fc-button {
    border-radius: 8px !important;
    font-size: 14px !important;
    padding: 4px 10px !important;
  }
}
/* ===============================
   📆 Исправление наложения дат в режиме "Неделя"
   =============================== */
@media (max-width: 768px) {
  /* заголовки дней (пн, вт, ср...) + дата под ними */
  .fc-timeGridWeek-view .fc-col-header-cell-cushion {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    align-items: center;
    white-space: normal !important;
    line-height: 1.1;
    font-size: 7px !important;
    color: #4a148c !important;
    text-align: center !important;
  }

  /* контейнер шапки — выравнивание и ширина */
  .fc-timeGridWeek-view .fc-col-header {
    table-layout: fixed !important;
  }

  /* сами ячейки заголовков */
  .fc-timeGridWeek-view .fc-col-header-cell {
    min-width: 48px !important;
    padding: 4px 2px !important;
    border: none !important;
    background: #f5f3ff !important;
  }

  /* уменьшаем шрифт заголовка, чтобы не вылезал */
  .fc-timeGridWeek-view .fc-scrollgrid-sync-inner {
    overflow: hidden !important;
  }
}

/* ===============================
   🎯 Центрирование целей в календаре (мобильная версия)
   =============================== */
@media (max-width: 768px) {
  /* Контейнер для событий — теперь по центру */
  .fc .fc-daygrid-day-events {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; /* центрируем горизонтально */
    justify-content: flex-start !important;
    gap: 2px;
  }

  /* Сами события — по центру текста */
  .fc .fc-daygrid-event {
    text-align: center !important;
    justify-content: center !important;
    width: 90% !important; /* чуть меньше ширины ячейки для воздуха */
    margin: 1px auto !important;
  }

  /* Текст цели — по центру */
  .fc-event-title {
    text-align: center !important;
    white-space: normal !important;
  }
}

/* ===============================  📱 Мобильная версия шапки (финальная, стильная версия) =============================== */
@media (max-width: 768px) {

  /* Базовый хедер */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(74, 20, 140, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 2000;
    position: sticky;
    top: 0;
  }

  .header-left h1 a {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
  }

  /* Скрываем старые кнопки */
  .header-actions.capsule {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }

  /* Кнопка-бургер */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6a11cb, #8f36ff);
    color: #fff;
    font-size: 22px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: all 0.25s ease;
  }

  .mobile-menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(155, 80, 255, 0.5);
  }

  .mobile-actions {
    position: absolute;
    top: 60px;
    right: 15px;
    background: rgba(40, 0, 80, 0.97);
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    z-index: 3000;
    overflow: hidden;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
  }

  .mobile-actions.show {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  /* Плавная анимация выезда */
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px) scale(0.98);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  /* Кнопки меню */
.mobile-actions a {
    display: inline-block;
    min-width: 170px;
    text-align: center;
    padding: 10px 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #7b2ff7, #9c4eff);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    transition: all 0.25s ease;
  }

  .mobile-actions a:hover {
    background: linear-gradient(135deg, #8f36ff, #b066ff);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(155, 80, 255, 0.4);
  }

  .mobile-actions a:active {
    transform: scale(0.98);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  }

  /* Разделение кнопок */
  .mobile-actions a + a {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }
}

  /* Правый блок */
  .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .user-info-link {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 10px;
  }

  .avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
  }

  .username {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
  }

  .btn-nav {
    color: #ffd700;
    font-weight: bold;
    text-decoration: none;
  }


/* Прячем капсулу на планшетах и телефонах */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .header-actions.capsule {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
  .mobile-menu-btn { display: flex !important; }
}

/* Мобильные и планшеты: прячем капсулу намертво, включаем бургер */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .header-actions.capsule {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .mobile-menu-btn { display: flex !important; }
}
