/* 🚀 ОПТИМИЗИРОВАННАЯ UX-СИСТЕМА 2024-2025 */
/* Основана на современных рекомендациях Material Design, Apple HIG, WCAG 2.2 */

/* Импорт TileClickGuard стилей */
@import url('./tile-click-guard.css');

:root {
  /* —— ТИПОГРАФИКА: читаемость + iOS zoom prevention —— */
  --fs-body: 1rem;                             /* 16px - базовый размер */
  --fs-h1: 2.441rem;                           /* ~39px */
  --fs-h2: 1.953rem;                           /* ~31px */
  --fs-h3: 1.563rem;                           /* ~25px */
  --fs-h4: 1.25rem;                            /* 20px */
  --fs-small: 0.875rem;                        /* 14px */
  --fs-xs: 0.75rem;                            /* 12px */
  
  /* Адаптивные базовые размеры */
  --fs-mobile-base: 16px;                      /* Мобильная база */
  --fs-desktop-base: 18px;                     /* Десктопная база */
  --fs-input-safe: 16px;                       /* Критично! Предотвращает iOS auto-zoom */
  
  /* Line-height для WCAG 2.2 compliance */
  --lh-default: 1.5;                           /* Основной для body текста */
  --lh-heading: 1.3;                           /* Для заголовков */
  --lh-tight: 1.25;                            /* Плотный для UI элементов */
  
  /* Paragraph spacing (WCAG 2.2 SC 1.4.12) */
  --paragraph-spacing: 2em;                    /* 2× font-size для разделения */
  --letter-spacing: 0.02em;                    /* Улучшает читаемость */
  
  /* —— SPACING: унифицированная 4/8px grid система —— */
  --spacing-unit: 8px;                         /* Основной шаг сетки */
  --gap-xs: 4px;                               /* Мелкие элементы */
  --gap-sm: 8px;                               /* Малые */
  --gap-md: 16px;                              /* Средние */
  --gap-lg: 24px;                              /* Большие */
  --gap-xl: 32px;                              /* Очень большие */
  
  /* Специальные отступы для контента */
  --content-header-gap: 24px;                  /* Отступ от заголовка до контента */
  
  /* Container padding - адаптивные отступы */
  --container-mobile: 16px;                    /* 480px и меньше */
  --container-tablet: 24px;                    /* 768px */
  --container-desktop: 32px;                   /* 1024px */
  --container-wide: clamp(32px, 10vw, 200px);  /* 1280px+ с гибкостью */
  
  /* —— ТАП-ТАРГЕТЫ: минимум 44px для удобства касаний —— */
  --tap-min: 44px;                             /* Минимальный размер */
  --tap-comfort: 48px;                         /* Комфортный размер */
  --tap-large: 56px;                           /* Основные действия */
  --tap-radius: 8px;                           /* Радиус скругления */
  
  /* —— БРЕЙКПОИНТЫ: покрывают основные ширины устройств —— */
  --bp-xs: 480px;                              /* Мобильные */
  --bp-sm: 768px;                              /* Планшеты */
  --bp-md: 1024px;                             /* Десктоп */
  --bp-lg: 1280px;                             /* Большие экраны */
  
  /* —— МИКРОАНИМАЦИИ: GPU-оптимизированные и плавные —— */
  --anim-fast: 120ms;                          /* Быстрые hover/tap - 120ms */
  --anim-base: 240ms;                          /* Базовые transition - 240ms */
  --anim-slow: 300ms;                          /* Смена экранов - 300ms */
  --anim-overlay: 500ms;                       /* Модальные окна - 500ms */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1); /* Material Design easing */
  --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Пружинистый для hover */
  
  /* —— КАРТОЧКИ: единообразный стиль —— */
  --card-padding: var(--gap-md);               /* 16px */
  --card-radius: 12px;                         /* Скругление */
  --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.06); /* Тонкая тень */
  
  /* 🎯 КАТАЛОГ КАРТОЧЕК: оптимальное скругление по мобильным UX-стандартам */
  --card-radius-base: 12px;                    /* Баланс между дружелюбностью и чёткостью (Apple HIG + Material 3) */
  --card-radius-capsule: 50%;                  /* Для очень узких/низких плиток превратить в «капсулу» */
  
  /* —— SKELETON LOADERS для плавной загрузки —— */
  --skeleton-base: #2a2a2a;                    /* Темный базовый */
  --skeleton-highlight: #3a3a3a;               /* Подсветка */
  --skeleton-radius: 8px;                      /* Скругление */
  --skeleton-duration: 1.2s;                   /* Длительность анимации */
  
  /* —— ЦВЕТА И ЭФФЕКТЫ —— */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-glass: rgba(0, 0, 0, 0.8);
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --accent-primary: #3b82f6;                   /* Основной акцентный */
  --accent-blue: #3b82f6;
  --shadow-card: 0 8px 25px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 16px 50px rgba(0, 0, 0, 0.2);
  --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.5);
  --border-subtle: rgba(255, 255, 255, 0.1);
  
  /* —— GRID УСТАРЕВШИЕ (для совместимости) —— */
  --grid-base: var(--spacing-unit);             /* 8px */
  --grid-fine: var(--gap-xs);                  /* 4px */
    /* Убрал дублирующие переменные --duration-* (используем --anim-*) */
  --easing-base: var(--ease-default);          /* Material easing */
  --easing-spring: var(--ease-spring);         /* Пружинистый */
  
  /* 🎨 Dark Theme Color Tokens */
  --bg-page: #000000;
  --text-primary: #FFFFFF;
  --text-secondary: #A1A1AA;
  --tile-shadow-idle: 0 1px 2px rgba(255,255,255,0.05);
  --tile-shadow-hover: 0 8px 20px rgba(0,0,0,0.4);
  --overlay-text: rgba(0,0,0,0.55);
  --overlay-pressed: rgba(255,255,255,0.10);
  --focus-outline: #3B82F6;
  
  /* Skeleton Theme */
  --skeleton-base: rgba(255,255,255,0.12);
  --skeleton-highlight: rgba(255,255,255,0.24);
  
  /* Transition системы */
  --transition-fast: 50ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* —— БАЗОВЫЕ СТИЛИ (UX ОПТИМИЗАЦИЯ) —— */
html {
  font-size: var(--fs-mobile-base);             /* 16px базовый */
  line-height: var(--lh-default);               /* WCAG 2.2 compliance */
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Убираем рамки у всех изображений */
img {
  border: none;
  outline: none;
  box-shadow: none;
}

@media (min-width: 1024px) {
  html {
    font-size: var(--fs-desktop-base);          /* 18px на десктопе */
  }
}

/* —— ТАП-ТАРГЕТЫ: красивые и плавные (WCAG 2.2 + UX 2024) —— */
button, 
.btn, 
.tap-target,
[role="button"],
input[type="button"],
input[type="submit"] {
  min-height: var(--tap-comfort);               /* 48px комфортный */
  min-width: var(--tap-comfort);
  padding: var(--gap-sm) var(--gap-md);         /* 8px 16px */
  border-radius: var(--tap-radius);             /* 8px */
  
  /* ПЛАВНЫЕ АНИМАЦИИ как в модальном окне */
  transition: all var(--anim-fast) var(--ease-default);
  transform: translateZ(0);                     /* GPU ускорение */
  will-change: transform, box-shadow;
  
  cursor: pointer;
  outline: none;
  border: none;
  
  /* Микроинтерактивность */
  position: relative;
  overflow: hidden;
}

/* Hover эффекты с микроанимациями */
@media (hover: hover) {
  button:hover,
  .btn:hover,
  .tap-target:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: var(--shadow-hover);
    transition: all var(--anim-base) var(--ease-spring);
  }
}

/* Active состояние */
button:active,
.btn:active,
.tap-target:active {
  transform: translateY(0) scale(0.98) translateZ(0);
  transition: all var(--anim-fast) var(--ease-default);
}

/* Основные кнопки - больший размер и эффекты */
.btn-primary,
.btn-large {
  min-height: var(--tap-large);                /* 56px для главных действий */
  padding: var(--gap-md) var(--gap-lg);        /* 16px 24px */
  font-weight: 600;
  font-size: var(--fs-body);
  box-shadow: var(--card-shadow);
  
  background: linear-gradient(135deg, var(--accent-primary) 0%, #2563eb 100%);
  color: white;
  
  /* Ripple эффект */
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width var(--anim-slow) var(--ease-default), 
              height var(--anim-slow) var(--ease-default);
}

.btn-primary:active::before {
  width: 300px;
  height: 300px;
}

/* Input поля - критично важно для iOS */
input, 
textarea, 
select {
  font-size: var(--fs-input-safe) !important;  /* 16px предотвращает zoom в iOS */
  min-height: var(--tap-comfort);               /* 48px */
  padding: var(--gap-sm) var(--gap-md);         /* 8px 16px */
  border-radius: var(--tap-radius);             /* 8px */
  
  border: none;
  background: var(--bg-glass);
  color: var(--text-primary);
  
  /* Плавный фокус */
  transition: all var(--anim-base) var(--ease-default);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-focus);
  background: rgba(59, 130, 246, 0.05);
}

@media (min-width: 1024px) {
  input, textarea, select {
    font-size: var(--fs-desktop-base);          /* 18px на десктопе */
  }
}

/* —— КОНТЕЙНЕРЫ (АДАПТИВНЫЕ ОТСТУПЫ) —— */
.container-responsive {
  padding-left: var(--container-mobile);
  padding-right: var(--container-mobile);
}

@media (min-width: 768px) {
  .container-responsive {
    padding-left: var(--container-tablet);
    padding-right: var(--container-tablet);
  }
}

@media (min-width: 1024px) {
  .container-responsive {
    padding-left: var(--container-desktop);
    padding-right: var(--container-desktop);
  }
}

@media (min-width: 1280px) {
  .container-responsive {
    padding-left: var(--container-wide);
    padding-right: var(--container-wide);
  }
}

/* —— ТИПОГРАФИКА (FLUID + RESPONSIVE) —— */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-heading);               /* 1.3 для заголовков */
  letter-spacing: var(--letter-spacing);
  margin-bottom: calc(var(--grid-base) * 2);    /* 16px */
}

p, .paragraph {
  line-height: var(--lh-default);               /* 1.5 для текста */
  margin-bottom: var(--paragraph-spacing);      /* 2em между абзацами */
  letter-spacing: var(--letter-spacing);
}

/* Адаптивные размеры заголовков */
h1 { font-size: clamp(1.875rem, 3vw + 1.4rem, 2.5rem); }  /* ~30-40px */
h2 { font-size: clamp(1.5rem, 2.5vw + 1.2rem, 2rem); }    /* ~24-32px */
h3 { font-size: clamp(1.25rem, 2vw + 1rem, 1.5rem); }     /* ~20-24px */
h4 { font-size: clamp(1.125rem, 1.5vw + 0.9rem, 1.25rem); } /* ~18-20px */

/* —— ПРОСТЫЕ КРУПНЫЕ КАРТОЧКИ —— */

/* Базовая карточка - МАКСИМАЛЬНО КРУПНЫЕ ВО ВЕСЬ ЭКРАН */
.card-modern {
  position: relative;
  border-radius: 8px;                          /* Скругление со всех сторон */
  overflow: hidden;
  cursor: pointer;
  
  /* КОМПАКТНЫЕ размеры с правильными пропорциями 3:4 */
  aspect-ratio: 3/4;                            /* Соотношение 3:4 (ширина:высота) */
  height: 100%;                                 /* Заполняем всю высоту грида */
  width: 100%;                                  /* Заполняем всю ширину грида */
  
  /* Убираем рамки и фон */
  background: transparent;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  
  /* ПЛАВНЫЕ АНИМАЦИИ */
  transition: all var(--anim-base) var(--ease-default);
  transform: translateZ(0);                     /* GPU ускорение */
  will-change: transform, box-shadow;
}

@media (min-width: 600px) {
  .card-modern {
    border-radius: 12px;                        /* Скругление со всех сторон на планшетах */
  }
}

@media (min-width: 900px) {
  .card-modern {
    border-radius: 16px;                        /* Скругление со всех сторон на десктопе */
  }
}

/* Hover эффекты для карточек - АНИМАЦИИ ОТКЛЮЧЕНЫ ПО ЗАПРОСУ ПОЛЬЗОВАТЕЛЯ */
/* Убраны все hover эффекты для статичных карточек по запросу пользователя */
@media (hover: hover) and (pointer: fine) {
  /* Карточки полностью статичные - никакого взаимодействия при hover */
}

/* ОТКЛЮЧЕНИЕ ВСЕХ TAILWIND АНИМАЦИЙ МАСШТАБИРОВАНИЯ И HOVER ЭФФЕКТОВ ДЛЯ КАРТОЧЕК */
.group:hover .group-hover\:scale-105,
.group:hover .group-hover\:scale-110,
.hover\:scale-105:hover,
.card-modern:hover,
.card-modern:hover .card-image,
.style-card:hover,
.style-card:hover .card-image {
  transform: none !important;
  transition: none !important;
}

/* Сохраняем оригинальный blur для текстовой области */
.card-modern:hover .card-text-area,
.style-card:hover .card-text-area {
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  transform: none !important;
  transition: none !important;
}

/* ИСПРАВЛЕНИЕ: Сброс анимаций при переходах страниц */
.route-transition .card-modern,
.route-transition .card-modern .card-image,
.route-transition .card-modern .card-text-area {
  transform: none !important;
  transition: none !important;
}

/* ИСПРАВЛЕНИЕ: Сброс анимаций на touch устройствах при навигации */
@media (hover: none) and (pointer: coarse) {
  .card-modern {
    transform: translateZ(0) !important;
  }
  
  .card-modern .card-image {
    transform: translateZ(0) scale(1) !important;
  }
  
  .card-modern .card-text-area {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
  }
  
  /* При навигации сбрасываем все анимации */
  .navigation-in-progress .card-modern,
  .navigation-in-progress .card-modern .card-image,
  .navigation-in-progress .card-modern .card-text-area {
    transform: none !important;
    transition: none !important;
  }
}

/* Удалены активные состояния для карточек - больше нет анимаций взаимодействия */

/* Изображение на всю карточку без рамок с закруглением сверху */
.card-modern .card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;              /* Позиционируем изображение ближе к верху */
  display: block;
  
  /* Закругление только сверху - совпадает с карточкой */
  border-radius: 8px 8px 0 0;
  
  /* Убираем любые рамки */
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
  
  /* GPU ускорение и плавность */
  transform: translateZ(0) scale(1);
  transition: transform var(--anim-base) var(--ease-default);
  will-change: transform;
}

/* Модификатор для показа полного изображения без обрезки */
.card-modern .card-image.fit-contain {
  object-fit: contain;                      /* Показываем всё изображение */
  object-position: center center;          /* Центрируем полностью */
  background-color: rgba(0, 0, 0, 0.1);    /* Слегка затемняем пустые области */
}

/* Модификатор для фокусировки на верхней части изображения */
.card-modern .card-image.focus-top {
  object-position: center top;             /* Фокусируемся на верхней части */
}

/* Модификатор для портретных изображений */
.card-modern .card-image.portrait {
  object-position: center 30%;             /* Лучше для портретов */
}

/* Умная адаптивная текстовая область */
.card-text-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  
  /* Градиентное размытие от большего к меньшему (снизу вверх) - ПЛАВНЫЙ ПЕРЕХОД */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.5) 0%,      /* 50% прозрачности снизу */
    rgba(0, 0, 0, 0.45) 20%,    /* 45% на 20% */
    rgba(0, 0, 0, 0.35) 40%,    /* 35% на 40% */
    rgba(0, 0, 0, 0.25) 60%,    /* 25% на 60% */
    rgba(0, 0, 0, 0.15) 80%,    /* 15% на 80% */
    rgba(0, 0, 0, 0.05) 95%,    /* 5% на 95% */
    rgba(0, 0, 0, 0) 100%       /* 0% сверху - полная прозрачность */
  );
  
  /* Градиентное размытие - больше снизу, меньше сверху */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  
  /* Дополнительный эффект градиентного размытия через маску - УЛЬТРА ПЛАВНЫЙ */
  mask: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,        /* Полная видимость снизу */
    rgba(0, 0, 0, 0.95) 25%,    /* 95% на 25% */
    rgba(0, 0, 0, 0.85) 50%,    /* 85% на 50% */
    rgba(0, 0, 0, 0.7) 70%,     /* 70% на 70% */
    rgba(0, 0, 0, 0.5) 85%,     /* 50% на 85% */
    rgba(0, 0, 0, 0.3) 95%,     /* 30% на 95% */
    rgba(0, 0, 0, 0.1) 100%     /* 10% сверху */
  );
  -webkit-mask: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.95) 25%,
    rgba(0, 0, 0, 0.85) 50%,
    rgba(0, 0, 0, 0.7) 70%,
    rgba(0, 0, 0, 0.5) 85%,
    rgba(0, 0, 0, 0.3) 95%,
    rgba(0, 0, 0, 0.1) 100%
  );
  
  /* Точные отступы 12px сверху и снизу */
  padding: 12px 16px;
  
  /* Центрирование содержимого */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  
  /* Дополнительные правила для лучшего переноса */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  
  /* Плавные переходы только для transform, исключаем backdrop-filter */
  transition: transform var(--anim-base) var(--ease-default);
  transform: translateZ(0);
}

/* Умный заголовок карточки с правильными переносами */
.card-title {
  color: var(--text-primary);
  font-size: 1rem;                             /* 16px */
  font-weight: 600;
  line-height: 1.4;                            /* Увеличено для лучшего переноса */
  margin: 0;
  
  /* Правильный перенос текста */
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  
  /* Ограничение до 2 строк */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  
  /* Центрирование */
  text-align: center;
  width: 100%;
  
  /* Читаемость */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.02em;
}

/* Адаптивная высота области */
.card-text-area:has(.card-title) {
  min-height: calc(2.8em + 24px);              /* Высота для 2 строк + отступы */
}

/* Динамические классы для правильного позиционирования текста */
.card-text-area.single-line {
  min-height: calc(1.4em + 32px) !important;   /* Одна строка: достаточная высота */
  padding: 12px 16px !important;               /* UX стандарт: минимум 16px от краев */
  display: flex !important;
  align-items: flex-end !important;            /* Прижимаем к низу для одной строки */
  justify-content: center !important;
}

.card-text-area.multi-line {
  min-height: calc(2.8em + 36px) !important;   /* Две строки: комфортная высота */
  padding: 16px 20px !important;               /* UX стандарт: 20px от краев для многострочного */
  display: flex !important;
  align-items: center !important;              /* Центрируем для нескольких строк */
  justify-content: center !important;
}

/* Адаптивные отступы по UX стандартам */
@media (min-width: 600px) {
  .card-text-area.single-line {
    padding: 16px 20px !important;             /* Планшеты: комфортные отступы */
  }
  
  .card-text-area.multi-line {
    padding: 20px 24px !important;             /* Планшеты: просторные отступы */
  }
}

@media (min-width: 900px) {
  .card-text-area.single-line {
    padding: 18px 24px !important;             /* Десктоп: максимальный комфорт */
  }
  
  .card-text-area.multi-line {
    padding: 24px 28px !important;             /* Десктоп: премиум отступы */
  }
}

/* Подзаголовок карточки */
.card-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--fs-small);                   /* 14px из системы */
  font-weight: 400;
  line-height: var(--lh-tight);                 /* 1.25 */
  margin: 0;
  
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  letter-spacing: var(--letter-spacing);
}

@media (min-width: 600px) {
  .card-text-area {
    padding: 12px 24px;                        /* Точные отступы: 12px сверху/снизу, 24px слева/справа */
  }
  
  /* .card-title стили уже определены выше - убираем дублирование */
  
  .card-subtitle {
    font-size: var(--fs-body);                 /* 16px на планшетах */
  }
  
  /* Увеличиваем закругление изображений на планшетах */
  .card-modern .card-image {
    border-radius: 12px 12px 0 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
}

/* Focus для accessibility - красивый и заметный */
.card-modern:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 4px;
  box-shadow: var(--shadow-focus);
  
  /* Плавный переход фокуса */
  transition: all var(--anim-fast) var(--ease-default);
}



/* Premium badge стили */
.premium-badge {
  position: absolute;
  top: calc(var(--grid-base) * 1.5);             /* 12px от верха */
  right: calc(var(--grid-base) * 1.5);           /* 12px от края */
  
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  font-size: var(--fs-xs);                       /* 12px */
  font-weight: 700;
  padding: calc(var(--grid-base) * 1) calc(var(--grid-base) * 1.5); /* 8px 12px */
  border-radius: 999px;                          /* Полностью скругленный */
  
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  
  z-index: 10;
}

/* МАКСИМАЛЬНО КРУПНАЯ СЕТКА - 2 КОЛОНКИ ВО ВЕСЬ ЭКРАН */
.cards-grid {
  display: grid;
  gap: 12px;
  /* Больше колонок для более компактных карточек */
  grid-template-columns: repeat(2, 1fr);
  padding: 0;                                    /* Убираем внутренний padding */
  margin: 0;                                     /* Убираем margin */
  
  /* УМЕНЬШЕННЫЕ карточки - компактные размеры */
  min-height: auto;                              /* Автоматическая высота */
  height: auto;                                  /* Автоматическая высота */
  grid-auto-rows: auto;                          /* ИСПРАВЛЕНО: Автоматическая высота строк без минимума */
  
  /* Выравнивание по краям экрана */
  width: 100%;
  max-width: 100%;
}

/* Адаптивный отступ от заголовка до контента */
.content-header-gap {
  margin-top: var(--content-header-gap);         /* 24px базовый отступ */
}

/* Отступ для начального контента (категории) */
.content-initial-gap {
  margin-top: 8px;                               /* Меньший отступ для категорий */
}

/* Адаптивные варианты отступов */
@media (min-width: 768px) {
  .content-header-gap {
    margin-top: calc(var(--content-header-gap) + 8px); /* 32px на планшетах */
  }
  
  .content-initial-gap {
    margin-top: 12px;                            /* Немного больше на планшетах */
  }
}

@media (min-width: 1024px) {
  .content-header-gap {
    margin-top: calc(var(--content-header-gap) + 16px); /* 40px на десктопе */
  }
  
  .content-initial-gap {
    margin-top: 16px;                            /* Больше на десктопе */
  }
}

@media (min-width: 600px) {
  .cards-grid {
    gap: 16px;
    grid-template-columns: repeat(3, 1fr);       /* 3 колонки на планшетах */
    grid-auto-rows: auto;                        /* ИСПРАВЛЕНО: Автоматическая высота */
  }
}

@media (min-width: 900px) {
  .cards-grid {
    gap: 20px;
    grid-template-columns: repeat(4, 1fr);       /* 4 колонки на десктопе */
    grid-auto-rows: auto;                        /* ИСПРАВЛЕНО: Автоматическая высота */
  }
  
  /* Ещё больше закругление изображений на десктопе */
  .card-modern .card-image {
    border-radius: 16px 16px 0 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
}

/* Для очень больших экранов */
@media (min-width: 1200px) {
  .cards-grid {
    gap: 24px;
    grid-template-columns: repeat(5, 1fr);       /* 5 колонок на больших экранах */
    grid-auto-rows: auto;                        /* ИСПРАВЛЕНО: Автоматическая высота */
  }
}

/* Специальные состояния */
.card-selected {
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.3),
    0 0 0 3px var(--accent-primary),             /* Толстая синяя обводка */
    0 0 20px rgba(59, 130, 246, 0.5);           /* Свечение */
}

.card-selected .card-overlay {
  background: linear-gradient(
    to top,
    rgba(59, 130, 246, 0.4) 0%,
    rgba(0, 0, 0, 0.6) 40%,
    rgba(0, 0, 0, 0.3) 70%,
    transparent 100%
  );
}

/* —— КРАСИВЫЕ АНИМАЦИИ (GPU-ОПТИМИЗИРОВАННЫЕ) —— */

/* Плавное появление снизу */
@keyframes fade-in-up-smooth {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Первое дублирование @keyframes shimmer-smooth удалено */

/* Пульсация для loading состояний */
@keyframes pulse-smooth {
  0%, 100% { 
    opacity: 1;
    transform: scale(1) translateZ(0);
  }
  50% { 
    opacity: 0.7;
    transform: scale(1.02) translateZ(0);
  }
}

/* Bounce для уведомлений */
@keyframes bounce-smooth {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -8px, 0);
  }
  70% {
    transform: translate3d(0, -4px, 0);
  }
  90% {
    transform: translate3d(0, -2px, 0);
  }
}

/* Классы анимаций */

.animate-shimmer {
  background: linear-gradient(
    90deg, 
    var(--skeleton-base) 0%, 
    var(--skeleton-highlight) 50%, 
    var(--skeleton-base) 100%
  );
  background-size: 200% 100%;
  animation: shimmer-smooth var(--skeleton-duration) ease-in-out infinite;
  transform: translateZ(0);
}

.animate-pulse {
  animation: pulse-smooth var(--anim-overlay) var(--ease-default) infinite;
}

.animate-bounce {
  animation: bounce-smooth 1s var(--ease-spring);
}

/* —— CONTAINER QUERIES (СОВРЕМЕННЫЙ ПОДХОД) —— */
.grid-responsive {
  container-type: inline-size;
  display: grid;
  gap: var(--grid-base);                        /* 8px базовый */
  grid-template-columns: repeat(2, 1fr);       /* Мобильная база */
}

/* Container query вместо media query */
@container (min-width: 480px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--grid-base) * 1.5);         /* 12px */
  }
}

@container (min-width: 768px) {
  .grid-responsive {
    grid-template-columns: repeat(4, 1fr);
    gap: calc(var(--grid-base) * 2);           /* 16px */
  }
}

@container (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(5, 1fr);
    gap: calc(var(--grid-base) * 2.5);         /* 20px */
  }
}

/* Контейнеры для queries */
.categories-container,  
.styles-container {
  container-type: inline-size;
  container-name: content;
  height: 100%;                                  /* Заполняем всю высоту */
  display: flex;
  flex-direction: column;
}

/* 🚀 Анимации для роутера */
.route-transition {
  transition: all 0.2s ease-out;
}

.route-fade-out {
  opacity: 0;
  transform: translateY(10px);
}

.route-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* 🚀 УЛУЧШЕННЫЕ SHIMMER ЭФФЕКТЫ */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes shimmer-smooth {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Отдельная анимация для shimmer overlay */
@keyframes shimmer-wave {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Плавные индивидуальные анимации для карточек */
@keyframes fade-in-up-stagger {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Shimmer overlay для loading карточек */
.shimmer-animation {
  animation: shimmer-wave 2s ease-in-out infinite;
}

/* Индивидуальная загрузка карточек */
.loading-card {
  position: relative;
  overflow: hidden;
}

.loading-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer-wave 2.5s ease-in-out infinite;
  z-index: 1;
}

/* Улучшенные анимации появления */
.animate-fade-in-up {
  animation: fade-in-up-stagger 600ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Состояния загрузки изображений */
.loading-indicator {
  transition: opacity 300ms ease-out;
}

.card-image[data-loaded="false"] + .loading-indicator {
  opacity: 1;
}

.card-image[data-loaded="true"] + .loading-indicator {
  opacity: 0;
}

.animate-shimmer {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(255, 255, 255, 0.1) 50%, 
    rgba(255, 255, 255, 0) 100%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* 🚀 Плавные переходы для Progressive Images */
.progressive-img {
  transition: filter 0.3s ease-out;
}

.progressive-img.blur {
  filter: blur(20px);
}

.progressive-img.loaded {
  filter: none;
}

/* 🚀 Безопасные зоны для всех устройств */
.safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-left {
  padding-left: env(safe-area-inset-left);
}

.safe-area-right {
  padding-right: env(safe-area-inset-right);
}

/* 🚀 Адаптивные отступы с clamp() */
.responsive-padding {
  padding: clamp(0.75rem, 4vw, 1.5rem);
}

.responsive-margin {
  margin: clamp(0.5rem, 2vw, 1rem);
}

/* 🚀 Fluid Typography */
.text-fluid-sm {
  font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.text-fluid-base {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.text-fluid-lg {
  font-size: clamp(1rem, 3vw, 1.125rem);
}

.text-fluid-xl {
  font-size: clamp(1.125rem, 4vw, 1.25rem);
}

.text-fluid-2xl {
  font-size: clamp(1.25rem, 5vw, 1.5rem);
}

/* 🚀 Hover эффекты с будущими возможностями */
@media (hover: hover) {
  .hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  }
}

/* 🚀 Reduced motion поддержка - УЛУЧШЕННАЯ */
@media (prefers-reduced-motion: reduce) {
  /* Отключаем анимации но оставляем transitions для интерактивности */
  .animate-shimmer,
  .animate-pulse,
  .animate-bounce {
    animation: none;
  }
  
  .route-transition {
    transition: opacity var(--anim-fast) var(--ease-default) !important;
  }
  
  /* Карточки остаются интерактивными но без масштабирования */
  .card-modern {
    transition: box-shadow var(--anim-fast) var(--ease-default) !important;
  }
  
  /* Все hover эффекты карточек убраны - карточки полностью статичные */
  
  /* Кнопки остаются отзывчивыми */
  button,
  .btn {
    transition: background-color var(--anim-fast) var(--ease-default) !important;
  }
  
  button:hover,
  .btn:hover {
    transform: none !important;
  }
}

/* 🚀 Focus visible для доступности */
@supports selector(:focus-visible) {
  .focus-visible-only:focus {
    outline: none;
  }
  
  .focus-visible-only:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
  }
}

/* 🚀 Высокий контраст режим */
/* —— HEADER BUTTONS: унифицированные кнопки в шапке —— */
.header-button {
  /* Размер как у кнопки "Назад" */
  padding: 12px 16px;                           /* p-3 = 12px, но больше по горизонтали */
  border-radius: 12px;                          /* rounded-xl = 12px */
  min-height: 48px;                             /* Комфортный размер для касания */
  
  /* Одинаковые размеры - точное выравнивание */
  flex: 1 1 0;                                  /* Равные доли места */
  max-width: 220px;                             /* Увеличенная ширина */
  min-width: 160px;                             /* Минимальная ширина */
  
  /* Отключаем все анимации по запросу пользователя */
  transition: none !important;
  transform: none !important;
  will-change: auto;
  
  /* Выравнивание содержимого */
  display: flex;
  align-items: center;
  justify-content: center;                      /* Центрируем для простых кнопок */
  
  /* Типографика */
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;                             /* Немного больше высота строки */
  
  /* Предотвращение переноса текста */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  
  /* Убираем внутренние отступы у вложенных элементов */
  * {
    margin: 0;
    padding: 0;
  }
}

/* Сложные кнопки с аватаром */
.header-button.avatar-complex {
  justify-content: flex-start;                  /* Выравнивание по левому краю для аватаров */
  padding: 12px 16px;                           /* Такие же отступы как у кнопки генераций */
  background: transparent !important;          /* Убираем фон */
  min-height: 48px;                             /* Такая же высота как у кнопки генераций */
}

/* Кнопки аватара БЕЗ стрелки (неактивные) */
.header-button.avatar-static {
  cursor: default;                              /* Обычный курсор */
  pointer-events: none;                         /* Отключаем клики */
  opacity: 0.9;                                 /* Слегка притушено */
}

/* Отключённые кнопки аватара (для единообразия) */
.header-button.avatar-static:disabled {
  opacity: 0.9;                                 /* Такая же прозрачность */
  cursor: default;                              /* Обычный курсор */
}

/* Контейнер текста в кнопках */
.header-button .text-content {
  flex: 1;                                      /* Занимает всё доступное место */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;                                 /* Разрешает сжатие */
}

/* Строки текста в кнопках */
.header-button .text-content span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;                                  /* Полная ширина контейнера */
  display: block;
  line-height: 1.2;
}

/* Контейнеры шапки - удалено дублирование, правила выше */

/* 🌟 ПРЕМИУМ ЗЕЛЕНАЯ КНОПКА СОЗДАНИЯ АВАТАРА */
.header-button.create-avatar-premium {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25) !important;
  position: relative;
  overflow: hidden;
  justify-content: flex-start !important;
}

.header-button.create-avatar-premium::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.header-button.create-avatar-premium:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4) !important;
  transform: translateY(-2px) !important;
}

.header-button.create-avatar-premium:hover::before {
  left: 100%;
}

.header-button.create-avatar-premium:active {
  transform: translateY(-1px) scale(0.98) !important;
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.3) !important;
}

/* 🎨 КРАСИВЫЙ СЧЕТЧИК ГЕНЕРАЦИЙ */
.header-button.credits-counter {
  justify-content: center !important;
  background: transparent !important;
  border: none !important;
  min-height: 48px;                             /* Такая же высота как у кнопок аватара */
  padding: 12px 16px;                           /* Такие же отступы */
}

.header-button.credits-counter:hover {
  background: transparent !important;
  border: none !important;
}

.credits-main {
  padding: 2px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  min-width: 60px;
}

.credits-display {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease-out;
  transform-origin: center;
}

/* 😊 ЭМОДЗИ В КНОПКАХ - СТАТИЧНЫЕ (БЕЗ АНИМАЦИЙ) */
.header-button span:first-child {
  flex-shrink: 0;
  line-height: 1;
  /* Убираем все анимации по запросу пользователя */
  transition: none !important;
  transform: none !important;
}

/* Специальные стили для эмодзи в шапке */
.header-emoji {
  font-size: 0.875rem !important;        /* 14px - такой же размер как текст */
  line-height: 1.25 !important;          /* Правильная высота строки */
  vertical-align: baseline !important;   /* Выравнивание с текстом */
  display: inline !important;            /* Inline отображение */
  flex-shrink: 0;
  margin-left: 0.125rem;                 /* 2px отступ слева */
  margin-right: 0;                       /* без отступа справа - текст плотно к эмодзи */
  width: auto !important;                /* Автоматическая ширина - убираем w-6 */
  text-align: left !important;           /* Левое выравнивание вместо center */
  /* Убираем анимации для эмодзи по запросу пользователя */
  transition: none !important;
  transform: none !important;
  overflow: visible !important;          /* Предотвращаем обрезание */
  padding: 0 !important;                 /* Убираем padding который может обрезать */
}

/* Стрелочки и иконки - одинаковые отступы как у эмодзи */
.header-button svg {
  flex-shrink: 0;
  margin-left: 0.125rem !important;       /* 2px отступ слева - как у эмодзи */
}

/* Защита от сброса отступов при смене аватара - правила перенесены выше */

.header-button svg.ml-2 {
  margin-left: 0.125rem !important;       /* Переопределяем Tailwind ml-2 */
}

/* Hover для header кнопок - ОТКЛЮЧЕН */
@media (hover: hover) {
  .header-button:hover {
    /* Убираем все hover анимации по запросу пользователя */
    transform: none !important;
    box-shadow: none !important;
    transition: none !important;
  }
}

/* Active состояние - ОТКЛЮЧЕНО */
.header-button:active {
  /* Убираем все active анимации по запросу пользователя */
  transform: none !important;
  transition: none !important;
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
  .header-button {
    min-width: 120px;                           /* Чуть меньше на мобильных */
    max-width: 160px;
    padding: 10px 12px;                         /* Компактнее отступы */
    font-size: 13px;                            /* Чуть меньше шрифт */
  }
  
  /* Исключение для кнопки создания аватара - разрешаем полную ширину */
  .header-button.create-avatar-btn {
    max-width: none !important;                 /* Убираем ограничение ширины */
    min-width: auto !important;                 /* Автоматическая минимальная ширина */
    width: auto !important;                     /* Автоматическая ширина */
  }
}

/* Специальные правила для кнопки создания аватара */
.header-button.create-avatar-btn {
  /* Отключаем лишние анимации */
  transform: none !important;
  will-change: auto !important;
}

.header-button.create-avatar-btn:hover {
  transform: none !important;
  box-shadow: none !important;
}

.header-button.create-avatar-btn:active {
  transform: scale(0.98) !important;
  transition: transform 0.1s ease-out !important;
}

/* Текст кнопки создания аватара - убираем flex-1 чтобы не растягивался */
.header-button.create-avatar-btn .text-content {
  flex: none !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: flex-start !important;
}

@media (prefers-contrast: high) {
  .glass-card {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #ffffff;
  }
  
  .text-gray-400 {
    color: #ffffff;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   СОВРЕМЕННЫЕ КНОПКИ БЕЗ РАМОК (Modern Buttons 2024-25)
   ═══════════════════════════════════════════════════════════════════════════ */

/* === ОБЩИЙ РЕСЕТ ДЛЯ КНОПОК В МОДАЛЬНЫХ ОКНАХ ========================== */
/* === MODAL BUTTONS (BLUR BLEED FIXED) ===================================== */
.modal-content button,
.modal-content .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  user-select: none;
  overflow: hidden;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;                  /* Safari blur-bleed fix */
  background: rgba(255, 255, 255, 0.03);
  background-clip: padding-box;                   /* маскирует край */
  color: var(--text-primary);
  box-shadow: none;
  transition: all 150ms ease-out;
}

/* === ПЕРВИЧНАЯ КНОПКА (Gradient) ======================================== */
.modal-content .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
  color: white !important;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.28) !important;
  font-weight: 600;
  /* Обеспечиваем правильное позиционирование для ripple эффекта */
  position: relative;
  overflow: hidden;
}

/* === ВТОРИЧНАЯ КНОПКА (Glass - Blur Bleed Fixed) ======================= */
.modal-content .btn-secondary,
.modal-content button:not(.btn-primary):not(.avatar-option) {
  background: rgba(255, 255, 255, 0.04) !important;
  background-clip: padding-box;
  border: 1px solid transparent;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

/* === КНОПКИ ВЫБОРА АВАТАРА (BLUR BLEED FIXED) =========================== */
.avatar-option {
  position: relative;
  display: flex !important;
  align-items: center;
  width: 100%;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  border: 1px solid transparent;    /* Safari blur-bleed fix */
  background: rgba(255, 255, 255, 0.02) !important;
  background-clip: padding-box;     /* маскирует край */
  box-shadow: none;
  overflow: hidden;                 /* обрезает blur bleed */
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-bottom: 12px !important;
  
  /* === MD3/HIG COMPLIANT TRANSITIONS === */
  transition:
    transform var(--anim-fast) var(--ease-default),
    background-color var(--anim-fast) var(--ease-default),
    box-shadow var(--anim-fast) var(--ease-default);
  will-change: transform, background-color, box-shadow;
  
  /* === TOUCH OPTIMIZATION === */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: auto;
  z-index: 1;
  cursor: pointer;
}

/* === BLUR LAYER + STATE LAYER (BLUR BLEED FIXED) ======================= */
/* === УБРАЛИ BLUR ЭФФЕКТЫ ДЛЯ КНОПОК АВАТАРОВ ПО ЗАПРОСУ ПОЛЬЗОВАТЕЛЯ === */

/* === БЛОКИРОВКА ФОНОВОГО СКРОЛЛА ПРИ ОТКРЫТОЙ МОДАЛКЕ === */
.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

.modal-open .app-wrapper {
  overflow: hidden !important;   /* основная блокировка скролла */
  touch-action: none !important; /* блокирует прокрутку на touch */
  -webkit-overflow-scrolling: none !important;
  overscroll-behavior: none !important; /* предотвращает bounce на iOS */
}

/* ИСПРАВЛЕНИЕ: Область скролла аватаров должна работать даже при modal-open */
.modal-open .avatars-scroll-container {
  touch-action: pan-y !important; /* разрешаем вертикальный скролл */
  overflow-y: auto !important;    /* восстанавливаем скролл */
}

/* Последняя кнопка аватара не должна иметь отступ снизу */
.avatar-option:last-child {
  margin-bottom: 0 !important;
}

/* === КОНТЕЙНЕР СО СКРОЛЛОМ ДЛЯ АВАТАРОВ (АДАПТИВНАЯ ВЫСОТА) ================ */
.avatars-scroll-container {
  /* Скролл только по вертикали */
  overflow-y: auto !important;
  overflow-x: hidden !important;
  
  /* ИСПРАВЛЕНИЕ: Защищенные touch настройки для предотвращения конфликтов */
  touch-action: pan-y !important; /* разрешаем только вертикальный скролл */
  
  /* Плавный скролл на поддерживаемых устройствах */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
  
  /* ИСПРАВЛЕНИЕ: Дополнительная защита от внешних влияний */
  pointer-events: auto !important; /* убеждаемся что события доходят */
  
  /* Стилизация скроллбара для WebKit браузеров */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  
  /* Плавный переход высоты */
  transition: max-height 0.2s ease-out;
}

/* Адаптивная высота в зависимости от количества аватаров */
.avatars-scroll-container.avatars-1 {
  max-height: 80px; /* Высота для 1 аватара */
}

.avatars-scroll-container.avatars-2 {
  max-height: 152px; /* Высота для 2 аватаров */
}

.avatars-scroll-container.avatars-3 {
  max-height: 224px; /* Высота для 3 аватаров */
}

.avatars-scroll-container.avatars-4-plus {
  max-height: 280px; /* Фиксированная высота для 4+ аватаров (3.5 плиток) */
}

/* Кастомный скроллбар для WebKit (Chrome, Safari, Edge) */
.avatars-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.avatars-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.avatars-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.avatars-scroll-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Мобильная оптимизация - скрываем скроллбар на touch устройствах */
@media (hover: none) and (pointer: coarse) {
  .avatars-scroll-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }
  
  .avatars-scroll-container::-webkit-scrollbar {
    display: none; /* WebKit */
  }
}

/* Адаптивная высота для маленьких экранов */
@media (max-height: 600px) {
  .avatars-scroll-container.avatars-1 {
    max-height: 70px;
  }
  
  .avatars-scroll-container.avatars-2 {
    max-height: 130px;
  }
  
  .avatars-scroll-container.avatars-3 {
    max-height: 180px;
  }
  
  .avatars-scroll-container.avatars-4-plus {
    max-height: 200px; /* Уменьшаем для маленьких экранов */
  }
}

@media (max-height: 500px) {
  .avatars-scroll-container.avatars-1 {
    max-height: 60px;
  }
  
  .avatars-scroll-container.avatars-2 {
    max-height: 110px;
  }
  
  .avatars-scroll-container.avatars-3 {
    max-height: 150px;
  }
  
  .avatars-scroll-container.avatars-4-plus {
    max-height: 150px; /* Еще меньше для очень маленьких экранов */
  }
}

/* Disabled состояние для аватаров в обучении */
.avatar-option:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  background: rgba(255, 255, 255, 0.01) !important;
}

.avatar-option:disabled:hover {
  transform: none !important;
  background: rgba(255, 255, 255, 0.01) !important;
  box-shadow: none !important;
}

/* Выбранный аватар */
.avatar-option.selected,
.avatar-option[data-selected="true"] {
  background: rgba(59, 130, 246, 0.12) !important;
  box-shadow: none;
  transform: none;                                /* Убираем подъем */
}

/* === ИНТЕРАКТИВНЫЕ СОСТОЯНИЯ ============================================ */
.modal-content button:hover:not(:disabled),
.modal-content .btn:hover:not(:disabled) {
  transform: none;                                /* Убираем увеличение */
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none;
}

/* === HOVER/FOCUS (УПРОЩЕНО БЕЗ БЕЛЫХ ЦВЕТОВ) ========================== */
@media (hover: hover) and (pointer: fine) {
  .avatar-option:hover:not(:disabled),
  .avatar-option:focus-visible:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition-timing-function: var(--ease-spring);
  }
}

.avatar-option.selected:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.16) !important;
  box-shadow: none;
}

/* === ACTIVE / TAP STATE (УПРОЩЕНО БЕЗ БЕЛЫХ ЦВЕТОВ) =================== */
.avatar-option.active,
.avatar-option:active:not(:disabled) {
  transform: scale(0.97);
  transition-timing-function: var(--ease-default);
}

.avatar-option.selected.active,
.avatar-option.selected:active:not(:disabled) {
  background: rgba(59, 130, 246, 0.18) !important; /* менее яркий */
}

/* === BLUR BLEED FIX: REAL AVATAR MODAL (APPLE DESIGN AWARD SOLUTION) ==== */
#avatarModal,
.modal-backdrop {
  border-radius: 16px;              /* тот же радиус, что был */
  overflow: hidden;                 /* важно! обрезает bleed */
  background-clip: padding-box;     /* маскирует край */
  border: 1px solid transparent;    /* Safari-fix */
  isolation: isolate;               /* Chrome 120+ */
}

/* Псевдоэлемент с blur для устранения серых краёв */
#avatarModal::before,
.modal-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  pointer-events: none;
  transition: opacity 200ms var(--ease-default);
  z-index: -1; /* позади контента */
}

/* Fade-out без «серых краёв» */
#avatarModal.closing::before,
.modal-backdrop.closing::before { 
  opacity: 0; 
}

/* === POINTER EVENTS === */
.modal-backdrop {
  pointer-events: auto;                           /* Перехватываем клики по фону */
  background: rgba(0, 0, 0, 0.6);                /* Полупрозрачный темный фон */
}

.modal-content {
  pointer-events: auto;
}

/* Гарантируем что modal-content внутри backdrop всегда получает события */
.modal-backdrop .modal-content {
  pointer-events: auto;
}

/* === ДУБЛИРОВАНИЕ .modal-open УБРАНО (ОБЪЕДИНЕНО ВЫШЕ) === */

.modal-content button:active:not(:disabled),
.modal-content .btn:active:not(:disabled) {
  transform: scale(0.98);                         /* Только легкое сжатие */
  transition-duration: 50ms;
}

.modal-content button:focus-visible,
.modal-content .btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Специальные стили фокуса для аватаров */
.avatar-option:focus-visible {
  box-shadow: 0 0 0 4px rgba(96, 155, 255, 0.4) inset;
}

.modal-content button:disabled,
.modal-content .btn:disabled {
  opacity: 0.45;
  pointer-events: none;
  transform: none;
}

/* === МЯГКИЙ TAP-GLOW ДЛЯ МОБИЛЬНЫХ - ОПТИМИЗИРОВАННЫЙ ================= */
@media (hover: none) and (pointer: coarse) {
  .modal-content button:active:not(:disabled),
  .modal-content .btn:active:not(:disabled) {
    transform: scale(0.96) translateZ(0);
    background: rgba(59, 130, 246, 0.25);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.12);
    transition: transform 0.08s var(--ease-default),
                background 0.08s var(--ease-default),
                box-shadow 0.08s var(--ease-default);
    will-change: transform, background, box-shadow;
  }
  
  /* === AVATAR OPTION: ПРОСТОЕ МОБИЛЬНОЕ НАЖАТИЕ === */
  .avatar-option:active:not(:disabled) {
    transform: scale(0.97) translateZ(0);
    transition-duration: var(--anim-fast);
    transition-timing-function: var(--ease-default);
  }
  
  /* Быстрое восстановление после касания */
  .modal-content button:not(:active):not(:disabled),
  .modal-content .btn:not(:active):not(:disabled),
  .avatar-option:not(:active):not(:disabled) {
    transition: transform 0.12s var(--ease-default),
                background 0.12s var(--ease-default),
                box-shadow 0.12s var(--ease-default);
  }
}

/* === WCAG 2.2 ACCESSIBILITY: REDUCED MOTION ============================ */
/* === WCAG 2.2 ACCESSIBILITY: REDUCED MOTION (BLUR BLEED AWARE) ========= */
@media (prefers-reduced-motion: reduce) {
  .avatar-option,
  .avatar-option:hover,
  .avatar-option:active {
    transform: none !important;
    transition: background-color 120ms linear !important;
  }
  
  #avatarModal::before,
  .modal-backdrop::before {
    transition: opacity 120ms linear !important;
  }
  
  #avatarModal.closing::before,
  .modal-backdrop.closing::before {
    transition: opacity 120ms linear !important;
  }
}

/* === СПЕЦИАЛЬНЫЕ ЭФФЕКТЫ =============================================== */
/* Исправленный ripple эффект для кнопок в модальных окнах */
.modal-content .btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease-out, height 0.4s ease-out;
  pointer-events: none;
}

.modal-content .btn-primary:active::before {
  width: 300px;
  height: 300px;
}

/* Обеспечиваем что внутренние div элементы не влияют на ripple эффект */
.modal-content .btn-primary > div {
  position: relative;
  z-index: 1;
  /* Не блокируем pointer events, просто позиционируем выше ripple */
}

/* === ПЛАВНАЯ АНИМАЦИЯ МОДАЛЬНОГО ОКНА =================================== */
.modal-content {
  animation: modalFadeIn 0.2s ease-out forwards;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === КРАСИВАЯ АНИМАЦИЯ ЗАГРУЗКИ ========================================= */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Улучшенная анимация загрузки для кнопок */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* === SNACKBAR СИСТЕМА 2025 - ПОЛНАЯ РЕАЛИЗАЦИЯ ТЗ ====================== */

/* 🎯 АНИМАЦИИ - Material Design 3 + cubic-bezier(0.2,0,0,1) */
@keyframes snackbar-enter {
  0% {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes snackbar-exit {
  0% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
}

@keyframes snackbar-fade-only {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* 🎯 БАЗОВЫЙ КОНТЕЙНЕР - Material Design 3 спецификация */
.snackbar {
  /* Позиционирование - bottom-center с safe area */
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000; /* Выше всех элементов */
  
  /* Размеры согласно ТЗ */
  max-width: min(90vw, 600px);
  min-width: 288px; /* Material Design minimum */
  margin: 0 16px;
  
  /* Внешний вид - Material Design 3 */
  background: #323232; /* Dark neutral @ 92% */
  background: rgba(50, 50, 50, 0.92);
  border-radius: 12px; /* Mobile default */
  
  /* Elevation 6dp согласно ТЗ */
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  
  /* Анимация - 250ms cubic-bezier(0.2,0,0,1) */
  transition: all 250ms cubic-bezier(0.2, 0, 0, 1);
  will-change: transform, opacity;
  
  /* Flexbox layout для content + action */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  
  /* Padding 14px × 16px согласно ТЗ */
  padding: 14px 16px;
  min-height: 48px;
  
  /* Типографика - 14sp/1.4lh body-medium */
  font-size: 0.875rem; /* 14sp */
  font-weight: 500; /* Medium */
  line-height: 1.4;
  color: #ffffff;
  letter-spacing: 0.0178571429em; /* Material Design */
  
  /* Accessibility - атрибуты задаются через JavaScript */
  
  /* Text overflow handling */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* 🎯 КОНТЕНТ ОБЛАСТИ */
.snackbar__content {
  flex: 1; /* Занимает доступное пространство */
  text-align: left; /* По умолчанию слева */
  
  /* Наследуем шрифт от родительского .snackbar */
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  
  /* Single-line по умолчанию, 2-line fallback */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-clamp: 2; /* Стандартное свойство для совместимости */
}

/* 🎯 ACTION КНОПКА - согласно ТЗ */
.snackbar__action {
  /* Tap target min 44px для мобильных */
  min-width: 44px;
  min-height: 44px;
  margin-left: 0;
  padding: 6px 10px;
  
  /* Стиль - transparent bg, accent color text */
  background: transparent;
  border: none;
  color: #3b82f6; /* Accent color */
  
  /* Типографика - ALL-CAPS для Android стиля */
  font-size: 0.875rem; /* 14sp */
  font-weight: 600; /* Semi-bold */
  text-transform: uppercase;
  letter-spacing: 0.0892857143em; /* Увеличенный для CAPS */
  
  /* Интерактивность */
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 150ms cubic-bezier(0.2, 0, 0, 1);
  
  /* Hover/Focus состояния */
  position: relative;
  overflow: hidden;
}

.snackbar__action:hover {
  background: rgba(59, 130, 246, 0.08);
}

.snackbar__action:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.snackbar__action:active {
  background: rgba(59, 130, 246, 0.16);
  transform: scale(0.98);
}

/* Ripple эффект для action кнопки */
.snackbar__action::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease-out, height 0.3s ease-out;
  pointer-events: none;
}

.snackbar__action:active::before {
  width: 100px;
  height: 100px;
}

/* 🎯 СОСТОЯНИЯ АНИМАЦИИ */
.snackbar--entering {
  animation: snackbar-enter 250ms cubic-bezier(0.2, 0, 0, 1);
}

.snackbar--exiting {
  animation: snackbar-exit 250ms cubic-bezier(0.2, 0, 0, 1);
}

.snackbar--hidden {
  transform: translate(-50%, 100%);
  opacity: 0;
  pointer-events: none;
}

.snackbar--visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* 🎯 ВАРИАНТЫ SNACKBAR */
.snackbar--default {
  /* Только текст, без action - базовые стили уже применены */
  justify-content: center; /* Центрируем контейнер без action кнопки */
}

/* 🎯 ЦЕНТРИРУЕМ ТЕКСТ ТОЛЬКО ДЛЯ SNACKBAR БЕЗ КНОПКИ (с эмодзи) */
.snackbar--default .snackbar__content {
  text-align: center; /* Центрируем текст с эмодзи */
}

/* 🎯 ДЛЯ SNACKBAR С КНОПКОЙ - ТЕКСТ ПО ЛЕВОМУ КРАЮ */
.snackbar--with-action .snackbar__content {
  text-align: left;
  flex: 1; /* Занимает доступное пространство */
}

.snackbar--with-action {
  /* С action кнопкой - компактное расположение */
  justify-content: flex-start;
  gap: 8px;
  padding-right: 8px; /* Меньше справа для кнопки */
}

/* 🎯 СТЕКИНГ - max 2 snackbar */
.snackbar--stacked {
  transform: translate(-50%, -52px); /* Сдвиг вверх */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Меньшая тень */
  z-index: 999; /* Ниже основного */
}

/* 🎯 FAB SHIFT - сдвиг при наличии FAB */
.snackbar--fab-shift {
  bottom: calc(136px + env(safe-area-inset-bottom)); /* +72px для FAB */
}

/* 🎯 АДАПТИВНЫЕ РАЗМЕРЫ ПОД ДЛИНУ ТЕКСТА */

/* Компактный размер для коротких текстов (≤20 символов) */
.snackbar--compact {
  max-width: min(70vw, 320px);
  min-width: 240px;
}

.snackbar--compact-with-action {
  max-width: min(75vw, 380px);
  min-width: 280px;
}

/* Средний размер для текстов средней длины (21-40 символов) */
.snackbar--medium {
  max-width: min(85vw, 480px);
  min-width: 320px;
}

.snackbar--medium-with-action {
  max-width: min(90vw, 520px);
  min-width: 360px;
}

/* Полная ширина для длинных текстов (>40 символов) */
.snackbar--full {
  max-width: min(95vw, 600px);
  min-width: 400px;
}

.snackbar--full-with-action {
  max-width: min(95vw, 640px);
  min-width: 440px;
}

/* 🎯 АДАПТИВНОСТЬ */
@media (max-width: 480px) {
  .snackbar {
    bottom: calc(80px + env(safe-area-inset-bottom));
    margin: 0 12px;
    max-width: calc(100vw - 24px);
    min-width: 260px;
  }
  
  /* Мобильные адаптации для адаптивных размеров */
  .snackbar--compact {
    max-width: calc(80vw - 24px);
    min-width: 200px;
  }
  
  .snackbar--compact-with-action {
    max-width: calc(85vw - 24px);
    min-width: 240px;
  }
  
  .snackbar--medium {
    max-width: calc(90vw - 24px);
    min-width: 280px;
  }
  
  .snackbar--medium-with-action {
    max-width: calc(95vw - 24px);
    min-width: 300px;
  }
  
  .snackbar--full,
  .snackbar--full-with-action {
    max-width: calc(100vw - 24px);
    min-width: 320px;
    border-radius: 12px; /* Mobile */
    padding: 12px 14px; /* Меньше padding на мобильных */
  }
  
  /* Компактная кнопка на мобильных */
  .snackbar__action {
    min-width: 40px;
    min-height: 40px;
    padding: 4px 8px;
    font-size: 0.8125rem; /* 13px */
    font-weight: 600;
  }
  
  /* Текст снэкбара на мобильных - применяем ко всем типам snackbar */
  .snackbar,
  .snackbar--default,
  .snackbar--with-action {
    font-size: 0.8125rem !important; /* 13px - принудительно для мобильных */
    line-height: 1.3 !important;
  }
  
  /* Компактный gap для мобильных */
  .snackbar--with-action {
    gap: 6px;
  }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
  .snackbar,
  .snackbar--default,
  .snackbar--with-action {
    margin: 0 8px;
    padding: 10px 12px;
    min-width: 240px;
    font-size: 0.75rem !important; /* 12px - принудительно для очень маленьких экранов */
  }
  
  .snackbar__action {
    min-width: 36px;
    min-height: 36px;
    padding: 3px 6px;
    font-size: 0.75rem; /* 12px */
  }
  
  .snackbar--with-action {
    gap: 4px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .snackbar {
    bottom: calc(60px + env(safe-area-inset-bottom));
    border-radius: 16px; /* Tablet */
    max-width: 400px;
  }
}

@media (min-width: 769px) {
  .snackbar {
    bottom: calc(40px + env(safe-area-inset-bottom));
    border-radius: 16px; /* Desktop */
    max-width: 600px;
    
    /* Desktop fallback - bottom-left если нужно */
    /* left: 24px; transform: none; */ /* Раскомментировать для bottom-left */
  }
  
  .snackbar__action {
    /* Title Case для iOS стиля на больших экранах */
    text-transform: none;
    letter-spacing: 0.0178571429em;
  }
}

/* 🎯 LIGHT MODE ПОДДЕРЖКА */
@media (prefers-color-scheme: light) {
  .snackbar {
    background: #f5f5f5; /* Light neutral @ 100% */
    color: rgba(0, 0, 0, 0.87); /* 87% opacity */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  }
  
  .snackbar__action {
    color: #1976d2; /* Более темный accent для light mode */
  }
  
  .snackbar__action:hover {
    background: rgba(25, 118, 210, 0.08);
  }
  
  .snackbar__action:active {
    background: rgba(25, 118, 210, 0.16);
  }
}

/* 🎯 ACCESSIBILITY - prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .snackbar {
    transition: opacity 150ms ease-out;
  }
  
  .snackbar--entering {
    animation: snackbar-fade-only 150ms ease-out;
  }
  
  .snackbar--exiting {
    animation: none;
    opacity: 0;
  }
  
  .snackbar__action {
    transition: background-color 100ms ease-out;
  }
  
  .snackbar__action:active {
    transform: none;
  }
  
  .snackbar__action::before {
    display: none; /* Отключаем ripple */
  }
}

/* 🎯 HIGH CONTRAST ПОДДЕРЖКА */
@media (prefers-contrast: high) {
  .snackbar {
    border: 2px solid currentColor;
    box-shadow: none;
  }
  
  .snackbar__action {
    border: 1px solid currentColor;
  }
}

/* 🎯 LEGACY ПОДДЕРЖКА - старый класс .notification */
.notification {
  /* Наследуем все стили от .snackbar для обратной совместимости */
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  
  max-width: min(90vw, 600px);
  min-width: 288px;
  margin: 0 16px;
  
  background: rgba(50, 50, 50, 0.92);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  
  transition: all 250ms cubic-bezier(0.2, 0, 0, 1);
  will-change: transform, opacity;
  
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  
  padding: 14px 16px;
  min-height: 48px;
  
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: #ffffff;
  letter-spacing: 0.0178571429em;
  
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Fallback для браузеров без поддержки env() */
@supports not (bottom: env(safe-area-inset-bottom)) {
  .snackbar {
    bottom: 80px;
  }
  
  @media (max-width: 480px) {
    .snackbar {
      bottom: 100px;
    }
  }
  
  @media (min-width: 481px) and (max-width: 768px) {
    .snackbar {
      bottom: 84px;
    }
  }
  
  @media (min-width: 769px) {
    .snackbar {
      bottom: 72px;
    }
  }
}

/* 🎯 ТОЧНОЕ ВЫРАВНИВАНИЕ КНОПОК ШАПКИ ПО КРАЯМ СЕТКИ */
.header-aligned {
  /* Убираем стандартные отступы и выравниваем точно по краям сетки */
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.header-aligned > div {
  /* Контейнер с кнопками растягивается по всей ширине с отступами как у сетки */
  padding-left: 1rem; /* px-4 = 16px = 1rem */
  padding-right: 1rem;
  width: 100%;
}

.header-button-left {
  /* Левая кнопка (аватар) - выравнивание по левому краю */
  margin-left: 0 !important;
  padding-left: 0 !important;
  justify-self: flex-start;
}

.header-button-right {
  /* Правая кнопка (генерации) - выравнивание по правому краю */
  margin-right: 0 !important;
  padding-right: 0 !important;
  justify-self: flex-end;
}

/* Дополнительные стили для точного позиционирования */
.header-content-aligned {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0;
  margin: 0;
}

.header-content-aligned .header-button:first-child {
  /* Первая кнопка прижимается к левому краю */
  margin-left: 0;
  padding-left: 0;
}

.header-content-aligned .header-button:last-child {
  /* Последняя кнопка прижимается к правому краю */
  margin-right: 0;
  padding-right: 0;
}

/* 🎯 СПЕЦИФИЧНЫЕ СТИЛИ ДЛЯ ВЫРАВНИВАНИЯ КНОПКИ ГЕНЕРАЦИЙ */
.header-content-aligned .header-button.credits-counter {
  /* Убираем все отступы справа для точного выравнивания */
  margin-right: 0 !important;
  padding-right: 0 !important;
  
  /* Принудительно выравниваем по правому краю */
  margin-left: auto;
  justify-content: flex-end !important;
  
  /* Убираем ограничения по ширине */
  max-width: none !important;
  min-width: auto !important;
  flex: 0 0 auto !important;
}

.header-content-aligned .header-button.credits-counter .credits-main {
  /* Убираем внутренние отступы справа */
  padding-right: 0 !important;
  margin-right: 0 !important;
  
  /* Текст прижимаем к правому краю */
  text-align: right;
  justify-content: flex-end !important;
}

.header-content-aligned .header-button.credits-counter .credits-main span {
  /* Текст точно по правому краю */
  padding-right: 0 !important;
  margin-right: 0 !important;
}

/* 🎯 СПЕЦИФИЧНЫЕ СТИЛИ ДЛЯ ВЫРАВНИВАНИЯ ЛЕВОЙ КНОПКИ АВАТАРА */
.header-content-aligned .header-button:first-child {
  /* Левая кнопка точно по левому краю */
  margin-left: 0 !important;
  padding-left: 0 !important;
  justify-content: flex-start !important;
  
  /* Убираем ограничения по ширине */
  max-width: none !important;
  flex: 0 0 auto !important;
}

/* Убираем gap между кнопками для точного выравнивания */
.header-content-aligned {
  gap: 0 !important;
}

/* 🎯 ТОЧНОЕ СООТВЕТСТВИЕ LINE-HEIGHT ДЛЯ ВСЕХ КНОПОК ШАПКИ */
.header-button .text-sm,
.header-button span.text-sm,
.header-button div.text-sm {
  line-height: 1.2 !important; /* Точное соответствие CSS стандартам */
}

/* 🚫 ОТКЛЮЧЕНИЕ АНИМАЦИЙ ДЛЯ НЕКЛИКАБЕЛЬНОЙ КНОПКИ ГЕНЕРАЦИЙ */
.header-button.credits-counter {
  /* Отключаем все анимации и трансформации */
  transform: none !important;
  will-change: auto !important;
  transition: none !important;
  cursor: default !important; /* Убираем pointer cursor */
}

.header-button.credits-counter:hover {
  /* Отключаем hover анимации */
  transform: none !important;
  box-shadow: none !important;
  transition: none !important;
}

.header-button.credits-counter:active {
  /* Отключаем active анимации */
  transform: none !important;
  transition: none !important;
}

/* Отключаем анимации эмодзи/иконок внутри кнопки генераций */
.header-button.credits-counter span:first-child {
  transform: none !important;
  transition: none !important;
}

.header-button.credits-counter:hover span:first-child {
  transform: none !important;
}

.header-button.credits-counter:active span:first-child {
  transform: none !important;
}

/* Анимации эмодзи и текста ОТКЛЮЧЕНЫ по запросу пользователя */
.header-button:hover .header-emoji {
  transform: none !important;
}

.header-button:active .header-emoji {
  transform: none !important;
}

/* Статичный текст без анимаций */
.header-button span:first-child:not(.header-emoji) {
  transition: none !important;
  transform: none !important;
}

.header-button:hover span:first-child:not(.header-emoji) {
  transform: none !important;
}

.header-button:active span:first-child:not(.header-emoji) {
  transform: none !important;
}

/* === СОВРЕМЕННАЯ СИСТЕМА БЛОКИРОВКИ ЭЛЕМЕНТОВ (Best Practices 2024-2025) === */

/* Базовые состояния блокировки */
.blocking-none {
  /* Нормальное состояние - без блокировок */
  pointer-events: auto;
  opacity: 1;
  cursor: pointer;
  transition: all 0.2s ease-out;
}

.blocking-temporary {
  /* Временная блокировка БЕЗ визуальных эффектов */
  pointer-events: none;
  /* Убраны все визуальные изменения по запросу пользователя */
}

.blocking-permanent {
  /* Долговременная блокировка БЕЗ визуальных эффектов */
  pointer-events: none;
  /* Убраны все визуальные изменения по запросу пользователя */
}

.blocking-processing {
  /* Активная обработка БЕЗ визуальных эффектов */
  pointer-events: none;
  /* Убраны все визуальные изменения по запросу пользователя */
}

.blocking-error {
  /* Ошибочное состояние - доступен для повторной попытки */
  pointer-events: auto;
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.2s ease-out;
  border: 1px solid rgba(239, 68, 68, 0.3);
  position: relative;
}

.blocking-error::after {
  content: "⚠️";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 16px;
  z-index: 10;
}

/* Hover эффекты для ошибочного состояния */
@media (hover: hover) and (pointer: fine) {
  .blocking-error:hover {
    opacity: 0.8;
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
  }
}

/* Анимации */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Специальные стили для карточек стилей */
.style-card.blocking-permanent,
.style-card.blocking-processing {
  transform: scale(0.98) translateZ(0);
}

.style-card.blocking-temporary {
  transform: translateZ(0);
}

/* WCAG 2.2 Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .blocking-none,
  .blocking-temporary,
  .blocking-permanent,
  .blocking-processing,
  .blocking-error {
    transition: opacity 0.2s linear !important;
    transform: none !important;
  }
  
  .blocking-processing::before {
    animation: none !important;
  }
  
  .blocking-temporary::after {
    animation: none !important;
  }
}

/* Высокий контраст для accessibility */
@media (prefers-contrast: high) {
  .blocking-permanent {
    opacity: 0.3;
    filter: grayscale(0.7);
  }
  
  .blocking-error {
    border-color: rgba(239, 68, 68, 0.8);
  }
}

/* ========================================
   🎨 СОВРЕМЕННЫЕ КАТАЛОЖНЫЕ КАРТОЧКИ
   Быстрые анимации ≤50ms, тактильный отклик
   ======================================== */

/* 🎯 Исправленные базовые стили карточки с оптимальным скруглением */
.catalog-card {
  position: relative;
  aspect-ratio: 3/4;
  min-width: 136px;
  border-radius: var(--card-radius-base);       /* 12px - оптимальный баланс по мобильным UX-стандартам */
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-secondary);
  
  /* Hardware acceleration */
  transform: translateZ(0);
  will-change: transform, box-shadow;
  
  /* Transitions для всех состояний */
  transition: 
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth),
    filter var(--transition-fast);
  
  /* Default shadow согласно спеке */
  box-shadow: var(--tile-shadow-idle);
  
  /* Focus styles для accessibility */
  &:focus-visible {
    outline: 2px solid var(--focus-outline);
    outline-offset: 2px;
  }
  
  /* Disabled state */
  &.disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.3);
  }
}

/* Image в карточке */
.catalog-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  
  /* Progressive loading */
  &.loading {
    background: var(--bg-secondary);
    &::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 20px;
      height: 20px;
      margin: -10px 0 0 -10px;
      border: 2px solid var(--text-secondary);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
  }
}

/* 🎨 Исправленный Text overlay с правильным отступом и blur градиентом */
.catalog-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 20px 10px 20px; /* Уменьшенный нижний отступ в 2 раза для опускания текста ниже */
  
  /* Правильный градиент с плавным переходом от края */
  background: linear-gradient(
    transparent 0%,
    rgba(0, 0, 0, 0.1) 20%,
    rgba(0, 0, 0, 0.3) 50%,
    var(--overlay-text) 100%
  );
  
  /* Возвращаем blur с правильной маской для плавного перехода */
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  
  /* Маска для плавного перехода blur от края */
  -webkit-mask: linear-gradient(
    to top,
    black 40%,
    rgba(0, 0, 0, 0.8) 70%,
    transparent 100%
  );
  mask: linear-gradient(
    to top,
    black 40%,
    rgba(0, 0, 0, 0.8) 70%,
    transparent 100%
  );
  
  /* Адаптивные отступы */
  @media (max-width: 480px) {
    padding: 16px 16px 8px 16px; /* Уменьшенный нижний отступ в 2 раза на мобильных */
  }
  
  @media (min-width: 1024px) {
    padding: 24px 24px 12px 24px; /* Уменьшенный нижний отступ в 2 раза на больших экранах */
  }
}

/* 📝 Исправленный title text - по центру с правильными отступами */
.catalog-card-title {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px 0; /* Отступ снизу согласно spacing системе */
  text-align: center; /* По центру как требовалось */
  
  /* Text handling */
  overflow-wrap: break-word;
  hyphens: auto;
  word-break: break-word;
  
  /* Responsive sizing */
  @media (max-width: 480px) {
    font-size: 14px;
    margin-bottom: 6px; /* Меньший отступ на мобильных */
  }
  
  @media (min-width: 1024px) {
    margin-bottom: 10px; /* Больший отступ на десктопе */
  }
}

/* Premium badge */
.catalog-card-premium {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--card-radius-base);       /* Соответствует радиусу карточки */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* ========================================
   🎯 СОСТОЯНИЯ КАРТОЧЕК - СОВРЕМЕННЫЙ UX
   ======================================== */

/* 🎯 Исправленный hover состояние - согласно спеке */
@media (hover: hover) and (pointer: fine) {
  .catalog-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tile-shadow-hover);
    
    .catalog-card-overlay {
      background: linear-gradient(
        transparent 0%,
        rgba(0, 0, 0, 0.05) 20%,
        rgba(0, 0, 0, 0.25) 50%,
        rgba(0, 0, 0, 0.65) 100%
      );
    }
  }
}

/* Pressed состояние - КРИТИЧНО ≤50ms */
.catalog-card:active,
.catalog-card.pressed {
  transform: scale(0.97) translateZ(0);
  transition: transform var(--transition-fast);
  
  /* Subtle overlay highlight */
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-pressed);
    pointer-events: none;
    z-index: 1;
  }
}

/* Touch states для мобильных */
@media (hover: none) and (pointer: coarse) {
  .catalog-card:active {
    transform: scale(0.97);
    transition: transform 50ms ease-out;
  }
}

/* 🎯 Капсульное скругление для очень низких плиток (высота ≤ 48px) */
@media (max-height: 48px) {
  .catalog-card {
    border-radius: var(--card-radius-capsule); /* 50% - превращает в капсулу */
  }
}

/* Loading skeleton для карточек */
.catalog-card-skeleton {
  position: relative;
  aspect-ratio: 3/4;
  min-width: 136px;
  border-radius: var(--card-radius-base);       /* Соответствует радиусу карточки */
  overflow: hidden;
  background: var(--bg-secondary);
  
  /* Shimmer effect */
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.05),
      transparent
    );
    animation: shimmer 1.5s infinite;
  }
}

/* Shimmer animation */
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Spin animation для loading */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   📐 SPACING СИСТЕМА (согласно современным стандартам)
   ======================================== */

/*
  🎯 ПРИНЦИПЫ SPACING в карточках:
  
  ✅ Базовая единица: 4px (используется для всех отступов)
  ✅ Отступы в overlay: 16px-24px (зависит от размера экрана)
  ✅ Отступы между карточками: 16px-24px
  ✅ Отступы между элементами: 6px-10px
  
  📱 АДАПТИВНОСТЬ:
  • Мобильные (≤480px): 16px
  • Планшеты (768px-1024px): 20px
  • Десктопы (≥1024px): 24px
  
  🔗 Источники: Material Design, Human Interface Guidelines, UAE Design System
*/

/* ========================================
   📱 АДАПТИВНЫЕ ГРIDS
   ======================================== */

/* 🔧 Исправленная grid система с правильными отступами */
.catalog-grid {
  display: grid;
  gap: 16px; /* Увеличен базовый отступ между карточками */
  padding: 20px; /* Увеличен внешний отступ контейнера */
  
  /* Фиксированное количество колонок для предотвращения сдвигов */
  grid-template-columns: repeat(2, 1fr);
  
  /* Выравнивание элементов */
  align-items: start;
  justify-items: center;
  
  /* Tablet */
  @media (min-width: 768px) {
    gap: 20px; /* Больше пространства между карточками */
    padding: 24px;
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
    margin: 0 auto;
  }
  
  /* Desktop */
  @media (min-width: 1024px) {
    gap: 24px; /* Максимальный отступ на больших экранах */
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
    margin: 0 auto;
  }
}

/* ========================================
   ♿ ACCESSIBILITY IMPROVEMENTS  
   ======================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .catalog-card {
    border: 1px solid var(--text-primary);
  }
  
  .catalog-card-title {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .catalog-card,
  .catalog-card-skeleton::before {
    transition: none;
    animation: none;
  }
}

/* Focus improvements для screen readers */
/* Accessibility поддержка обеспечена в базовом блоке .catalog-card */

/* ========================================
   🔧 УТИЛИТЫ ДЛЯ СОСТОЯНИЙ
   ======================================== */

/* Состояние загрузки */
.catalog-card.loading {
  pointer-events: none;
  
  .catalog-card-image {
    filter: blur(2px);
    opacity: 0.7;
  }
}

/* Состояние ошибки */
.catalog-card.error {
  background: var(--bg-secondary);
  
  &::after {
    content: '⚠️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
  }
}

/* Premium карточки - особое выделение */
.catalog-card.premium {
  border: 1px solid rgba(255, 215, 0, 0.3);
  
  &:hover {
    border-color: rgba(255, 215, 0, 0.5);
  }
}

/* ========================================
   🎬 АНИМАЦИИ ПОЯВЛЕНИЯ И МИКРОИНТЕРАКЦИИ
   ======================================== */

/* Fade in up анимация для карточек */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.3s ease-out forwards;
  opacity: 0; /* Начинаем с прозрачности */
}

/* Pulse анимация для loading состояний */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Bounce анимация для успешных действий */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-15px);
  }
  70% {
    transform: translateY(-7px);
  }
  90% {
    transform: translateY(-3px);
  }
}

.animate-bounce {
  animation: bounce 1s ease-in-out;
}

/* Shake анимация для ошибок */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* ========================================
   🎨 СКЕЛЕТОНЫ С SHIMMER ЭФФЕКТОМ
   ======================================== */

/* 🎨 Обновленные стили для скелетонов - согласно теме */
.catalog-card-skeleton {
  /* Дополняем стили из основного блока */
  
  .skeleton-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(
      90deg,
      var(--skeleton-base) 25%,
      var(--skeleton-highlight) 50%,
      var(--skeleton-base) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
  
  .skeleton-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px; /* Согласованный отступ с основным overlay */
    
    @media (max-width: 480px) {
      padding: 16px;
    }
    
    @media (min-width: 1024px) {
      padding: 24px;
    }
  }
  
  .skeleton-title {
    height: 16px;
    background: var(--skeleton-base);
          border-radius: 8px;
      margin-bottom: 8px;
      animation: pulse 2s infinite;
    }
  
  .skeleton-subtitle {
    height: 12px;
    width: 70%;
    background: var(--skeleton-base);
    border-radius: 6px;
    animation: pulse 2s 0.5s infinite;
    margin: 0 auto; /* Центрируем */
  }
}

/* 🚨 ЭКРАН ОШИБКИ - СОВРЕМЕННЫЙ ДИЗАЙН 2025 */
.error-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1b69 50%, #1a1a1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}

.error-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(147, 51, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(239, 68, 68, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  animation: floating-bg 20s ease-in-out infinite;
  z-index: 0;
}

@keyframes floating-bg {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-20px) rotate(1deg); }
  66% { transform: translateY(10px) rotate(-1deg); }
}

.error-container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  width: 100%;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 3rem 2rem;
  box-shadow: none;
  animation: error-slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes error-slide-up {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.error-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: error-pulse 2s ease-in-out infinite;
  box-shadow: 
    0 0 40px rgba(239, 68, 68, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.error-icon::before {
  content: '';
  position: absolute;
  inset: -4px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 50%;
  z-index: -1;
  opacity: 0.3;
  animation: error-ring 2s ease-in-out infinite;
}

@keyframes error-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes error-ring {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.error-icon-emoji {
  font-size: 3.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.error-title {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.error-message {
  font-size: 1.125rem;
  color: #9ca3af;
  margin-bottom: 2.5rem;
  line-height: 1.6;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.error-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.error-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none !important;
  outline: none !important;
  border-radius: 16px;
  padding: 16px 32px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 
    0 4px 12px rgba(59, 130, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.error-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  transition: opacity 0.3s ease;
  opacity: 0;
}

.error-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px rgba(59, 130, 246, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: none !important;
  outline: none !important;
}

.error-btn:hover::before {
  opacity: 1;
}

.error-btn:active {
  transform: translateY(0);
  transition-duration: 0.1s;
  border: none !important;
  outline: none !important;
}

.error-btn:focus,
.error-btn:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: 
    0 8px 24px rgba(59, 130, 246, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.error-btn--secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  border: none !important;
  outline: none !important;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.error-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border: none !important;
  outline: none !important;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.error-btn--secondary:focus,
.error-btn--secondary:focus-visible {
  border: none !important;
  outline: none !important;
  background: rgba(255, 255, 255, 0.15);
}

.error-btn--secondary:active {
  border: none !important;
  outline: none !important;
}

.error-tip {
  background: rgba(59, 130, 246, 0.1);
  border: none;
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.error-tip-text {
  color: #bfdbfe;
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}



/* 🔄 АНИМАЦИЯ ЗАГРУЗКИ ДЛЯ КНОПКИ */
.error-btn-loading {
  pointer-events: none;
  opacity: 0.7;
}

.error-btn-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 📱 МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 480px) {
  .error-screen {
    padding: 1.5rem 1rem;
  }
  
  .error-container {
    padding: 2rem 1.5rem;
    border-radius: 0;
    margin: 0 0.5rem;
  }
  
  .error-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
  }
  
  .error-icon-emoji {
    font-size: 3rem;
  }
  
  .error-title {
    font-size: 1.75rem;
    margin-bottom: 0.875rem;
  }
  
  .error-message {
    font-size: 1rem;
    margin-bottom: 2rem;
  }
  
  .error-btn {
    padding: 14px 24px;
    font-size: 1rem;
    min-height: 48px;
    border-radius: 12px;
  }
  
  .error-tip {
    padding: 1.25rem;
    border-radius: 12px;
    margin-top: 1.25rem;
  }
  
  .error-tip-text {
    font-size: 0.875rem;
  }
}

@media (max-width: 360px) {
  .error-container {
    padding: 1.5rem 1rem;
    margin: 0 0.25rem;
  }
  
  .error-actions {
    gap: 0.75rem;
  }
  
  .error-btn {
    padding: 12px 20px;
    font-size: 0.9375rem;
    min-height: 44px;
  }
}

/* 🎯 ВЫСОКАЯ КОНТРАСТНОСТЬ */
@media (prefers-contrast: high) {
  .error-container {
    background: transparent;
    border: none;
  }
  
  .error-btn {
    border: none !important;
  }
  
  .error-tip {
    border: none;
  }
}

/* 🎭 УМЕНЬШЕННЫЕ АНИМАЦИИ */
@media (prefers-reduced-motion: reduce) {
  .error-screen::before,
  .error-icon,
  .error-icon::before {
    animation: none;
  }
  
  .error-container {
    animation: none;
    transform: none;
  }
  
  .error-btn {
    transition: none;
  }
  
  .error-btn:hover {
    transform: none;
  }
}