/*
 * Основной файл стилей для FML5‑Forum.
 * Использует CSS переменные для светлой и тёмной тем, поддерживает плавные
 * переходы, кастомный скроллбар, тени, градиенты и минималистичный вид.
 */

/* Цветовые переменные (перекрываются классом .dark-theme). Настройки по умолчанию описывают светлую схему, тёмная переопределяет их. */
:root {
  /* Скругления: карточки, кнопки и поля ввода */
  --radius-card: 12px;
  --radius-button: 8px;
  --radius-input: 6px;
  /* Цвета светлой темы (по умолчанию) */
  --background: #f7f8fa;
  --surface: #ffffff;
  --primary: #101418;
  --border: #d1d5db;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #4c8bf5;
  --accent-hover: #346ebd;
  --shadow-base: rgba(0, 0, 0, 0.08);
  --shadow-hover: rgba(0, 0, 0, 0.12);
  --scrollbar-bg: #e5e7eb;
  --scrollbar-thumb: #cbd5e1;

  /* Синтетические переменные для обратной совместимости:
     --radius и --shadow используются в существующих стилях. Привязываем их
     к новым системам скруглений и теней, чтобы не менять множество
     селекторов. */
  --radius: var(--radius-card);
  --shadow: var(--shadow-base);
}

/* Тёмная тема переопределяет базовые переменные */
.dark-theme {
  /* Переопределяем тёмную схему для лучшего контраста.  
     Повышаем яркость текста и muted‑цветов и делаем фон чуть светлее,
     чтобы улучшить читаемость. */
  --background: #0c1524;
  --surface: #1b273b;
  --primary: #14203a;
  --border: #324560;
  /* Для тёмной темы повышаем контраст текста и приглушённых цветов,
     чтобы заголовки и обычный текст оставались читаемыми на темном фоне. */
  --text: #ffffff;
  --muted: #bfc9da;
  --accent: #5a9cf3;
  --accent-hover: #417cd0;
  --shadow-base: rgba(0, 0, 0, 0.4);
  --shadow-hover: rgba(0, 0, 0, 0.55);
  --scrollbar-bg: #1b273b;
  --scrollbar-thumb: #2b3e5b;

  /* Поддержка существующих переменных */
  --radius: var(--radius-card);
  --shadow: var(--shadow-base);
}

/* Общие стили */
html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.01em;
  background-color: var(--background);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  /* Ссылки используют акцентный цвет для лучшей видимости в обеих темах */
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
  a:focus {
  color: var(--accent-hover);
}

/* Верхняя панель: логотип, навигация и действия выровнены по горизонтали */
/* Шапка сайта: компактная высота и строгое выравнивание */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  background: var(--primary);
  /* Используем основной цвет текста для шапки. Это обеспечивает
     достаточный контраст как в светлой, так и в тёмной теме. */
  color: var(--text);
  padding: 0 1rem;
  box-shadow: 0 1px 2px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Вторая панель под шапкой для навигации */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Используем цвет поверхности для второй панели, чтобы создать
     визуальное отделение навигации от основного хедера. */
  background: var(--surface);
  color: var(--text);
  height: 48px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px var(--shadow);
}
.sub-header .main-nav {
  flex: 1;
}

/* Ссылки навигации во второй панели используют цвет текста и
   выделяются акцентным цветом при наведении и когда активны. */
.sub-header .main-nav a {
  color: var(--text);
}
.sub-header .main-nav a:hover,
.sub-header .main-nav a:focus,
.sub-header .main-nav a[aria-current='page'] {
  background: var(--accent);
  color: var(--surface);
}

/* Кнопка уведомлений в верхней панели */
.notification-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.notification-btn:hover,
.notification-btn:focus {
  background: rgba(255, 255, 255, 0.15);
  color: var(--accent-hover);
}
/* В тёмной теме цвет и фон уведомлений адаптируются */
.dark-theme .notification-btn {
  color: var(--text);
}
.dark-theme .notification-btn:hover,
.dark-theme .notification-btn:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Layout: sidebar + main content */
.layout {
  display: flex;
  flex: 1;
  /* Вычисляем минимальную высоту: высота шапки (60px) + второй панели (48px) + приблизительная высота футера */
  min-height: calc(100vh - 108px);
}

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem;
  /* Мягкая тень для выделения боковой панели */
  box-shadow: 2px 0 6px var(--shadow-base);
  overflow-y: auto;
}

.sidebar-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  /* Отступ перенесён на обёртку search-wrapper */
  margin-bottom: 0;
}

/* Обёртка для поля поиска и кнопки поиска. На данный момент поиск размещён
   внутри формы в боковой панели, поэтому этот селектор также применяем
   к form в .sidebar-search */
.search-wrapper,
.sidebar-search form {
  display: flex;
  align-items: stretch;
  margin-bottom: 1rem;
  gap: 0.25rem;
}

/* Кнопка поиска рядом с полем ввода */
.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  font-size: 1rem;
  color: var(--surface);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-btn:hover,
  .search-btn:focus {
  background: var(--accent-hover);
}

.category-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-tree li {
  margin-bottom: 0.5rem;
}

.category-tree a {
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  display: block;
  border-radius: var(--radius-input);
  transition: background-color 0.2s ease;
}

.category-tree a:hover,
  .category-tree a:focus {
  background: var(--accent);
  color: var(--surface);
}

.category-tree ul ul {
  margin-left: 1rem;
}

/* Результаты поиска в боковой панели */
.sidebar-results h3 {
  margin-top: 0;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  /* Заголовок результатов поиска: используем акцентный цвет для лучшей видимости как в светлой, так и в тёмной теме */
  color: var(--accent);
}
.sidebar-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-results-list li {
  margin-bottom: 0.5rem;
}
.sidebar-results-list a {
  color: var(--text);
  text-decoration: none;
  display: block;
  padding: 0.25rem;
  border-radius: var(--radius-input);
  transition: background-color 0.2s ease;
}

/* Подсветка элементов результатов поиска при наведении и фокусе */
.sidebar-results-list a:hover,
.sidebar-results-list a:focus {
  background: var(--accent);
  color: var(--surface);
}
.sidebar-results-list a:hover,
  .sidebar-results-list a:focus {
  background: var(--accent);
  color: var(--surface);
}
.back-to-categories {
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--accent);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-button);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
}
.back-to-categories:hover,
.back-to-categories:focus {
  background: var(--accent-hover);
}

/* ------------------------------------------------------------------ */
/* Типографическая иерархия и основные размеры шрифтов
   Обеспечивают чёткое различие между уровнями заголовков и удобочитаемость
   обычного текста. */
h1,
h2,
h3,
h4,
h5 {
  font-family: 'Inter', sans-serif;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: 0.75rem;
}
h1 {
  font-size: 2rem;
  font-weight: 600;
}
h2 {
  font-size: 1.5rem;
  font-weight: 600;
}
h3 {
  font-size: 1.25rem;
  font-weight: 500;
}
h4 {
  font-size: 1.125rem;
  font-weight: 500;
}
h5 {
  font-size: 1rem;
  font-weight: 500;
}
p {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
}

/*
 * Базовые иконки: используем Cloudflare Icons.
 * Иконка представляет собой квадратный блок с маской. Цвет задаётся через currentColor.
 */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
/* Конкретные иконки (используются имена файлов из Cloudflare Icons) */
/* Подключаем иконки напрямую в виде Data URI, чтобы избежать зависимости от внешней сети. */
.icon-menu {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14%203.5H2v1h12v-1zM14%207.5H2v1h12v-1zM14%2011.5H2v1h12v-1z%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14%203.5H2v1h12v-1zM14%207.5H2v1h12v-1zM14%2011.5H2v1h12v-1z%22/%3E%20%3C/svg%3E");
}
.icon-search {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14.84%2013.377L9.75%208.75a4.577%204.577%200%2010-.673.738l5.088%204.627.675-.738zm-8.775-3.75A3.565%203.565%200%20119.63%206.052a3.57%203.57%200%2001-3.565%203.566v.01z%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14.84%2013.377L9.75%208.75a4.577%204.577%200%2010-.673.738l5.088%204.627.675-.738zm-8.775-3.75A3.565%203.565%200%20119.63%206.052a3.57%203.57%200%2001-3.565%203.566v.01z%22/%3E%20%3C/svg%3E");
}
.icon-plus {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14.003%208.466l-.006-1-5.5.031-.03-5.5-1%20.006.03%205.5-5.5.03.006%201%205.5-.03.03%205.5%201-.006-.03-5.5%205.5-.03z%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14.003%208.466l-.006-1-5.5.031-.03-5.5-1%20.006.03%205.5-5.5.03.006%201%205.5-.03.03%205.5%201-.006-.03-5.5%205.5-.03z%22/%3E%20%3C/svg%3E");
}
/* Для кнопки лайка используем звёздочку */
.icon-heart {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22m7.875%201.645%201.53%204.757h4.95l-4.005%202.94%201.53%204.756-4.005-2.94-4.005%202.94L5.4%209.342l-4.006-2.94h4.951l1.53-4.757Z%22/%3E%20%3Cpath%20d%3D%22M7.875%203.279%206.71%206.902H2.92l3.066%202.25-1.168%203.63%203.057-2.244%203.057%202.244-1.168-3.63%203.065-2.25H9.04L7.875%203.28ZM5.981%205.902l1.418-4.41h.952l1.418%204.41h4.587l.295.903-3.714%202.727%201.42%204.413-.773.556-3.709-2.722-3.71%202.723-.771-.557%201.42-4.413-3.715-2.727.295-.903h4.587Z%22%20fill-rule%3D%22evenodd%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22m7.875%201.645%201.53%204.757h4.95l-4.005%202.94%201.53%204.756-4.005-2.94-4.005%202.94L5.4%209.342l-4.006-2.94h4.951l1.53-4.757Z%22/%3E%20%3Cpath%20d%3D%22M7.875%203.279%206.71%206.902H2.92l3.066%202.25-1.168%203.63%203.057-2.244%203.057%202.244-1.168-3.63%203.065-2.25H9.04L7.875%203.28ZM5.981%205.902l1.418-4.41h.952l1.418%204.41h4.587l.295.903-3.714%202.727%201.42%204.413-.773.556-3.709-2.722-3.71%202.723-.771-.557%201.42-4.413-3.715-2.727.295-.903h4.587Z%22%20fill-rule%3D%22evenodd%22/%3E%20%3C/svg%3E");
}
.icon-trash {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M3.5%2013.621V5.25h1v8h7v-8h1v8.392l-.64.608H4.134l-.635-.629Z%22/%3E%20%3Cpath%20d%3D%22M6%206.25h1V12H6V6.25Zm3%200h1V12H9V6.25Z%22/%3E%20%3Cpath%20d%3D%22M2.5%204.5h11v-1h-3V2.125L9.876%201.5H6.124l-.624.625V3.5h-3v1Zm7-2h-3v1h3v-1Z%22%20fill-rule%3D%22evenodd%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M3.5%2013.621V5.25h1v8h7v-8h1v8.392l-.64.608H4.134l-.635-.629Z%22/%3E%20%3Cpath%20d%3D%22M6%206.25h1V12H6V6.25Zm3%200h1V12H9V6.25Z%22/%3E%20%3Cpath%20d%3D%22M2.5%204.5h11v-1h-3V2.125L9.876%201.5H6.124l-.624.625V3.5h-3v1Zm7-2h-3v1h3v-1Z%22%20fill-rule%3D%22evenodd%22/%3E%20%3C/svg%3E");
}
.icon-calendar {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14%203h-2.75V2h-1v1h-4.5V2h-1v1H2l-.5.5v9.977l.5.5h12l.5-.5V3.5L14%203zM4.75%204v1h1V4h4.5v1h1V4h2.25v1.72h-11V4h2.25zM2.5%2012.977v-6.25h11v6.25h-11z%22/%3E%20%3Cpath%20d%3D%22M5.25%209.39a.75.75%200%20100-1.5.75.75%200%20000%201.5zM5.25%2011.835a.75.75%200%20100-1.5.75.75%200%20000%201.5zM10.75%209.39a.75.75%200%20100-1.5.75.75%200%20000%201.5zM10.75%2010.335a.75.75%200%20100%201.5.75.75%200%20000-1.5zM8%209.39a.75.75%200%20100-1.5.75.75%200%20000%201.5zM8%2011.835a.75.75%200%20100-1.5.75.75%200%20000%201.5z%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M14%203h-2.75V2h-1v1h-4.5V2h-1v1H2l-.5.5v9.977l.5.5h12l.5-.5V3.5L14%203zM4.75%204v1h1V4h4.5v1h1V4h2.25v1.72h-11V4h2.25zM2.5%2012.977v-6.25h11v6.25h-11z%22/%3E%20%3Cpath%20d%3D%22M5.25%209.39a.75.75%200%20100-1.5.75.75%200%20000%201.5zM5.25%2011.835a.75.75%200%20100-1.5.75.75%200%20000%201.5zM10.75%209.39a.75.75%200%20100-1.5.75.75%200%20000%201.5zM10.75%2010.335a.75.75%200%20100%201.5.75.75%200%20000-1.5zM8%209.39a.75.75%200%20100-1.5.75.75%200%20000%201.5zM8%2011.835a.75.75%200%20100-1.5.75.75%200%20000%201.5z%22/%3E%20%3C/svg%3E");
}
.icon-info {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M8%201.5a6.5%206.5%200%20100%2013%206.5%206.5%200%20000-13zm0%2012a5.5%205.5%200%20110-11%205.5%205.5%200%20010%2011z%22/%3E%20%3Cpath%20d%3D%22M8.572%206.253H6.607v1h.965v3.812H6.397v1h3.35v-1H8.572V6.253zM8.49%204.032H7.235v1.255H8.49V4.032z%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M8%201.5a6.5%206.5%200%20100%2013%206.5%206.5%200%20000-13zm0%2012a5.5%205.5%200%20110-11%205.5%205.5%200%20010%2011z%22/%3E%20%3Cpath%20d%3D%22M8.572%206.253H6.607v1h.965v3.812H6.397v1h3.35v-1H8.572V6.253zM8.49%204.032H7.235v1.255H8.49V4.032z%22/%3E%20%3C/svg%3E");
}
.icon-help {
  mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M7.926%201.5a6.5%206.5%200%20106.5%206.5%206.508%206.508%200%2000-6.5-6.5zm0%2012a5.5%205.5%200%20115.5-5.5%205.507%205.507%200%2001-5.5%205.5z%22/%3E%20%3Cpath%20d%3D%22M7.892%2010.175a.68.68%200%2000-.494.204.664.664%200%2000-.208.491.672.672%200%2000.208.497.679.679%200%2000.494.204.668.668%200%2000.35-.094.734.734%200%2000.255-.254.686.686%200%2000-.112-.844.684.684%200%2000-.493-.204zM9.114%205.098a2.536%202.536%200%2000-1.073-.214%202.49%202.49%200%2000-1.018.204c-.3.13-.556.342-.739.612a1.84%201.84%200%2000-.295%201.013h1.136a.963.963%200%2001.148-.495.837.837%200%2001.333-.293.975.975%200%2001.43-.097.96.96%200%2001.443.102.78.78%200%2001.436.723.897.897%200%2001-.09.404%201.141%201.141%200%2001-.243.324c-.108.1-.225.19-.35.267a2.38%202.38%200%2000-.482.384%201.387%201.387%200%2000-.304.55c-.08.299-.117.608-.11.918v.082h1.061V9.5a1.846%201.846%200%2001.081-.569c.05-.15.133-.288.243-.403.126-.128.268-.24.422-.332.186-.11.357-.244.507-.4a1.598%201.598%200%2000.446-1.159%201.654%201.654%200%2000-.26-.932%201.692%201.692%200%2000-.722-.607z%22/%3E%20%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%20%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20aria-hidden%3D%22true%22%20fill%3D%22%23000%22%20role%3D%22presentation%22%20viewBox%3D%220%200%2016%2016%22%3E%20%3Cpath%20d%3D%22M7.926%201.5a6.5%206.5%200%20106.5%206.5%206.508%206.508%200%2000-6.5-6.5zm0%2012a5.5%205.5%200%20115.5-5.5%205.507%205.507%200%2001-5.5%205.5z%22/%3E%20%3Cpath%20d%3D%22M7.892%2010.175a.68.68%200%2000-.494.204.664.664%200%2000-.208.491.672.672%200%2000.208.497.679.679%200%2000.494.204.668.668%200%2000.35-.094.734.734%200%2000.255-.254.686.686%200%2000-.112-.844.684.684%200%2000-.493-.204zM9.114%205.098a2.536%202.536%200%2000-1.073-.214%202.49%202.49%200%2000-1.018.204c-.3.13-.556.342-.739.612a1.84%201.84%200%2000-.295%201.013h1.136a.963.963%200%2001.148-.495.837.837%200%2001.333-.293.975.975%200%2001.43-.097.96.96%200%2001.443.102.78.78%200%2001.436.723.897.897%200%2001-.09.404%201.141%201.141%200%2001-.243.324c-.108.1-.225.19-.35.267a2.38%202.38%200%2000-.482.384%201.387%201.387%200%2000-.304.55c-.08.299-.117.608-.11.918v.082h1.061V9.5a1.846%201.846%200%2001.081-.569c.05-.15.133-.288.243-.403.126-.128.268-.24.422-.332.186-.11.357-.244.507-.4a1.598%201.598%200%2000.446-1.159%201.654%201.654%200%2000-.26-.932%201.692%201.692%200%2000-.722-.607z%22/%3E%20%3C/svg%3E");
}

/* Иконка уведомлений (колокольчик) */
.icon-notification {
  /* Используем SVG-иконку колокольчика из Cloudflare Icons (адаптированную) */
  mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiMwMDAiIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTggMWE0IDQgMCAwMC00IDR2Mi41YzAgLjY2LS4yNCAxLjI5LS42OCAxLjc5TDIgMTFoMTJsLTEuMzItMS43MWMtLjQ0LS41LS42OC0xLjEzLS42OC0xLjc5VjVhNCA0IDAgMDAtNC00ek02LjUzIDE0aDIuOTRhMS41IDEuNSAwIDAxLTIuOTQgMHoiLz48L3N2Zz4=");
  -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiMwMDAiIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTggMWE0IDQgMCAwMC00IDR2Mi41YzAgLjY2LS4yNCAxLjI5LS42OCAxLjc5TDIgMTFoMTJsLTEuMzItMS43MWMtLjQ0LS41LS42OC0xLjEzLS42OC0xLjc5VjVhNCA0IDAgMDAtNC00ek02LjUzIDE0aDIuOTRhMS41IDEuNSAwIDAxLTIuOTQgMHoiLz48L3N2Zz4=");
}

.main-content {
  flex: 1;
  padding: 1rem;
  overflow-x: hidden;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  margin-right: 1rem;
}

/* Левый блок шапки: гамбургер и логотип */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Кнопка гамбургера */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.menu-toggle .icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Глобальный поиск в шапке */
.header-search {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.header-search input[type='search'] {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 180px;
}
.header-search button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.header-search button:hover,
.header-search button:focus {
  background: var(--accent-hover);
}
.header-search .icon {
  width: 1rem;
  height: 1rem;
}

/* Блок действий в шапке */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


/* Контейнер действий в шапке */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Скрытый класс для лэйблов (улучшает доступность) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.login-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  /* Уменьшаем высоту кнопки входа: меньше вертикальный отступ. */
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-button);
  transition: background-color 0.2s ease, color 0.2s ease;
  font-weight: 500;
}

.login-button:hover,
.login-button:focus {
  background: var(--accent);
  color: #fff;
}

/*
 * Кнопка смены темы представляет собой компактный слайдер со
 * смещающейся ручкой. Внутри используются две иконки солнца и луны,
 * которые меняются в зависимости от активной темы. Для создания
 * плавного движения используется свойство transform.
 */
/* Переключатель темы: минималистичный ползунок без эмодзи */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 20px;
  border: none;
  border-radius: 10px;
  background: var(--border);
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform 0.2s ease;
}
/* В тёмной теме ползунок смещается вправо и трек становится темнее */
.dark-theme .theme-toggle {
  background: var(--muted);
}
.dark-theme .theme-toggle::before {
  transform: translateX(24px);
  background: var(--surface);
}

.main-nav ul {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  gap: 0.25rem;
}

/*
 * Навигация: ссылки располагаются в строку без разделяющих линий.
 * Скругления углов делают активное состояние более заметным. Для
 * равномерных отступов между ссылками используем margin.
 */
.main-nav li {
  margin: 0;
}
.main-nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  text-align: center;
  color: var(--surface);
  font-weight: 500;
  border-radius: var(--radius-button);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.main-nav a:last-child {
  margin-right: 0;
}
/* Подсветка пунктов навигации в шапке при наведении и фокусе */
.main-nav a:hover,
.main-nav a:focus {
  background: rgba(255, 255, 255, 0.15);
  color: var(--surface);
}
.main-nav a[aria-current='page'] {
  background: rgba(255, 255, 255, 0.25);
  color: var(--surface);
}

/* В тёмной теме ссылки навигации должны быть светлыми для лучшего контраста */
.dark-theme .main-nav a {
  color: var(--text);
}
.dark-theme .main-nav a:hover,
.dark-theme .main-nav a:focus {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.dark-theme .main-nav a[aria-current='page'] {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

#progress-bar {
  height: 3px;
  width: 0;
  background: var(--accent);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1100;
  transition: width 0.4s ease;
}

#toast-container {
  position: fixed;
  /* Сдвигаем тосты ниже, чтобы они не перекрывали интерфейс */
  /* Размещаем уведомления в нижней части экрана, чтобы они не перекрывали шапку */
  top: auto;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
}

.toast {
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-button);
  box-shadow: 0 2px 6px var(--shadow-base);
  opacity: 0;
  transform: translateY(-10px);
  animation: slide-in 0.3s forwards;
}

@keyframes slide-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-footer {
  background: var(--surface);
  color: var(--muted);
  padding: 1rem;
  margin-top: auto;
  text-align: center;
  font-size: 0.9rem;
  border-top: 1px solid var(--shadow);
}

/* Scrollbar styling (WebKit-based browsers) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
  border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius);
}

/* Layout container classes for different pages */
.page {
  padding: 1rem;
}

/*
 * Сетка плиток на главной странице.
 * На десктопе используется фиксированное количество колонок (4),
 * чтобы обеспечить чёткое выравнивание элементов. Благодаря
 * grid-auto-flow: dense крупные плитки заполняют пустоты без
 * образования пробелов. На планшетах и мобильных устройствах
 * количество колонок снижается — 2 на планшетах и 1 на телефонах.
 */
.grid-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: flex-start;
  grid-auto-flow: dense;
}

/* Размеры плиток */
/*
 * Определения размеров плиток. Маленькие плитки занимают одну
 * ячейку сетки, средние — две колонки, большие — четыре колонки и две
 * строки. Высоты заданы примерно, но могут быть адаптированы
 * на основе содержимого. На меньших экранах эти правила переопределяются
 * в медиа‑запросах ниже.
 */
.tile--small {
  min-height: 180px;
  grid-column: span 1;
  grid-row: span 1;
}

.tile--medium {
  min-height: 280px;
  grid-column: span 2;
  grid-row: span 1;
}

.tile--large {
  min-height: 500px;
  grid-column: span 4;
  grid-row: span 2;
}

/* Стили для списка доступных плиток в модальном окне */
.tile-selector h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}
.tile-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}
.tile-option {
  background: var(--surface);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  font-size: 0.9rem;
}
.tile-option:hover,
.tile-option:focus {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
  outline: none;
}

/* Кнопка добавления плитки */
.add-tile-btn {
  /* Плавающая кнопка добавления новой плитки */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.add-tile-btn:hover,
.add-tile-btn:focus {
  background: #c96c18;
}

.tile {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  /* Мягкая тень по умолчанию для современных карточек */
  box-shadow: 0 1px 3px var(--shadow-base);
  padding: 1rem;
  position: relative;
  cursor: move;
  /* Плавная анимация для перемещения и наведения. Увеличено время перехода,
     чтобы использоваться при анимированном перетаскивании плиток. */
  transition: transform 0.3s ease, box-shadow 0.2s ease;
}

/* Post & discussion lists */
.post-list,
.discussion-list,
.upcoming-events,
.teacher-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Списки для новых плиток */
.important-list,
.rating-list,
.olymp-list,
.weather-list,
.top-users {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li,
.upcoming-events li,
.teacher-list li {
  margin-bottom: 0.5rem;
}

.discussion-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.badge {
  background: var(--accent);
  color: var(--surface);
  border-radius: 9999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
}

.schedule-table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tile:hover {
  /* Более заметная тень при наведении */
  box-shadow: 0 4px 8px var(--shadow-hover);
  transform: translateY(-2px);
}

/* === Анимация перетаскивания плиток ===
   Эти стили добавляют плавность и визуальный отклик при
   перетаскивании. Класс .dragging назначается плитке в JS. */
.tile.dragging {
  /* Уменьшаем непрозрачность и увеличиваем размер, чтобы подсветить плитку */
  opacity: 0.8;
  transform: scale(1.05);
  /* Поднимаем плитку над другими элементами */
  z-index: 1000;
  box-shadow: 0 8px 16px var(--shadow-hover);
  cursor: grabbing;
}

/* Позволяем элементам сетки плавно смещаться на новые позиции
   при изменении порядка. Без этого элементы прыгают мгновенно. */
.grid-tiles > .tile {
  transition: transform 0.3s ease;
}

/* === Исправление контраста текста в шапке ===
   В светлой теме текст в верхней панели был тёмным на тёмном фоне.
   Теперь используем белый цвет для улучшения читаемости. */
.app-header,
.app-header .logo {
  color: #ffffff;
}

/* Ссылки и кнопки в шапке наследуют белый цвет */
.app-header .header-actions > * {
  color: inherit;
}

/* Кнопка входа с белым текстом и белой рамкой. При наведении меняем фон */
.app-header .login-button {
  border-color: currentColor;
  color: currentColor;
}
.app-header .login-button:hover,
.app-header .login-button:focus {
  background: currentColor;
  color: var(--primary);
}

.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tile-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.tile-actions {
  display: flex;
  gap: 0.5rem;
}

.tile-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.1s ease;
}

.tile-actions button:hover,
.tile-actions button:focus {
  color: var(--accent);
}

/* Список событий выводится без карточек — одна колонка с разделителями */
/* Список событий выводится вертикальной лентой карточек */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Карточка события */
.event-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px var(--shadow-base);
  padding: 1rem;
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}
.event-row:hover {
  box-shadow: 0 4px 8px var(--shadow-hover);
}
.event-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.event-main {
  flex: 1;
}
.event-main .event-title {
  font-weight: 500;
  margin: 0;
}
.event-main .event-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
/* Перерисованный participate-btn для линейного списка */
.participate-btn {
  padding: 0.35rem 0.75rem;
  margin: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.participate-btn:hover,
.participate-btn:focus {
  background: var(--accent-hover);
}

/* ======================= */
/* Стили для новой системы плиток */
/* Посты: список элементов с аватарами, именем, датой и текстом */
.post-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.post-item:last-child {
  margin-bottom: 0;
}
.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.post-info {
  flex: 1;
}
.post-author {
  font-weight: 500;
}
.post-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.post-text {
  margin-top: 0.25rem;
  font-size: 0.9rem;
}
.post-buttons {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Общий стиль для кнопок внутри контента плиток */
.tile-content button,
.tile-content .btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: var(--radius-button);
  border: none;
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: inherit;
}
.tile-content button:hover,
.tile-content button:focus,
.tile-content .btn:hover,
.tile-content .btn:focus {
  background: var(--accent-hover);
}

/* Важное: список срочных сообщений */
.important-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.important-list li {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.important-list li:last-child {
  margin-bottom: 0;
}
.important-icon {
  color: var(--accent);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1;
  margin-top: 0.1rem;
}

/* Олимпиады: список с логотипом и датой */
.olymp-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.olymp-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.olymp-item:last-child {
  margin-bottom: 0;
}
.olymp-logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.olymp-info {
  flex: 1;
}
.olymp-subject {
  font-weight: 500;
}
.olymp-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* Заметка: текст и кнопка редактирования */
.note-text {
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
}
.note-edit-btn {
  /* наследует общие стили кнопок */
}

/* Чат с учителем: список учителей онлайн */
.chat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.chat-item:last-child {
  margin-bottom: 0;
}
.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.chat-name {
  flex: 1;
}
.chat-status {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Изображения в плитках (например, важное, расписание, посты) */
.tile-image {
  width: 100%;
  height: auto;
  margin-top: 0.75rem;
  border-radius: var(--radius-card);
  object-fit: cover;
}

/* Расписание в плитке: вертикальный список */
.schedule-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.schedule-item {
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}
.schedule-item:last-child {
  border-bottom: none;
}

/* Рейтинг: список пользователей */
.rating-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rating-list li {
  margin-bottom: 0.5rem;
}
.rating-list li:last-child {
  margin-bottom: 0;
}
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fade-in 0.3s forwards;
}

.modal {
  background: var(--surface);
  color: var(--text);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 400px;
  width: 90%;
  box-shadow: none;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-close:hover,
.modal-close:focus {
  color: var(--accent);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Стили .event-card и связанных элементов более не используются. */

/* Clubs gallery */
.club-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* --- Дополнительные разделы на главной странице --- */
.intro-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 1rem;
  margin-bottom: 1rem;
}
/* Внутренний контент и изображение в приветственном блоке */
.intro-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.intro-content h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  /* Используем основной цвет текста для заголовка приветственного блока
     чтобы обеспечить хороший контраст в обоих цветовых схемах */
  color: var(--text);
}
.intro-content p {
  margin: 0;
  /* Текст приветственного блока использует muted‑цвет для описания,
     который остаётся читаемым на разных фонах */
  color: var(--muted);
  font-size: 1rem;
}
.intro-image {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
  max-height: 200px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  background: var(--primary);
  color: #ffffff;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  transition: background-color 0.1s ease;
  cursor: pointer;
}

.tag:hover,
.tag:focus {
  background: var(--accent);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  flex: 1;
  min-width: 140px;
  padding: 0.75rem;
  text-align: center;
}

.stat-card h4 {
  margin: 0;
  font-size: 1.2rem;
  /* Используем основной цвет текста вместо primary, чтобы заголовки
     статистики были читаемы как на светлом, так и на тёмном фоне. */
  color: var(--text);
}

.stat-card p {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: var(--text);
}

/* Блок преимуществ на главной странице */
.features-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: background-color 0.1s ease;
}
.feature-card:hover {
  background: var(--surface);
}
.feature-icon {
  /* В минималистичном дизайне иконки для преимуществ не используются */
  display: none;
}
.feature-card h4 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  /* Заголовок карты преимущества использует основной текстовый цвет
     для лучшего контраста в обеих темах. */
  color: var(--text);
}
.feature-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Стиль для модального окна с результатами поиска */
.search-results .modal {
  max-width: 600px;
}

.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.search-results-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--shadow);
}

.search-results-list li:last-child {
  border-bottom: none;
}

.search-results-list strong {
  /* Выделяем результат поиска основным текстовым цветом. Это
     обеспечивает хорошую читаемость в обоих режимах. */
  color: var(--text);
}

.search-results-list p {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.club-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px var(--shadow-base);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: center;
  transition: background-color 0.1s ease;
}

.club-card:hover {
  background: var(--surface);
  box-shadow: 0 4px 8px var(--shadow-hover);
}

.club-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.club-card h4 {
  margin: 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

/* Универсальный блок вступления для страниц (события, кружки, библиотека, FAQ, Perserk) */
.page-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px var(--shadow-base);
  padding: 1rem;
  margin-bottom: 1rem;
}
.page-intro h2 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  /* Цвет заголовка раздела меняем на основной текстовый цвет. */
  color: var(--text);
}
.page-intro p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

/* Library list */
.resource-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.resource-item {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px var(--shadow);
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s ease;
}

.resource-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

.faq-section {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--shadow);
  padding: 0.5rem 0;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 200px;
}

/* Perserk page */
.iframe-wrapper {
  position: relative;
  height: 80vh;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px var(--shadow);
}

.iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.iframe-controls {
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reload-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.reload-btn:hover,
.reload-btn:focus {
  background: #e68600;
}

/* -------- Адаптивность -------- */
/* Mobile: ширина < 768px */
@media (max-width: 767.98px) {
  /* Убираем сайдбар и отображаем контент в одну колонку */
  .layout {
    flex-direction: column;
  }
  .sidebar {
    display: none;
  }
  .main-content {
    padding: 1rem;
  }
  /* Отображаем кнопку гамбургера */
  .menu-toggle {
    display: flex;
  }
  /* Скрываем поисковое поле для экономии места, оставляем только иконку */
  .header-search input[type='search'] {
    display: none;
  }

  /* На мобильных прячем вторую панель навигации, так как меню
     показывается в виде выпадающей панели */
  .sub-header {
    display: none;
  }
  /* Навигация становится вертикальной панелью, скрытой по умолчанию */
  .main-nav {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: var(--primary);
    padding: 0.5rem 1rem;
    display: none;
    box-shadow: 0 1px 2px var(--shadow);
  }
  .main-nav ul {
    flex-direction: column;
  }
  .main-nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  body.nav-open .main-nav {
    display: block;
  }
  /* Плитки на мобильном: одна колонка; все размеры занимают одну ячейку */
  .grid-tiles {
    grid-template-columns: 1fr;
  }
  .tile--small,
  .tile--medium,
  .tile--large {
    grid-column: span 1;
    grid-row: span 1;
  }
  /* Статистика и преимущества: одна колонка */
  .stats,
  .features-section {
    flex-direction: column;
  }
  .features-section {
    grid-template-columns: 1fr;
  }
}

/* ===== Motion and richer forum UI ===== */
* {
  transition-property: background-color, border-color, color, box-shadow, transform, opacity, filter;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body {
  background:
    radial-gradient(circle at 12% 10%, rgba(37, 99, 235, 0.09), transparent 28rem),
    radial-gradient(circle at 86% 20%, rgba(217, 119, 6, 0.08), transparent 26rem),
    var(--background);
}

.app-header {
  animation: header-drop 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.logo {
  position: relative;
}

.logo::after {
  content: '';
  position: absolute;
  left: 0;
  right: 28%;
  bottom: -6px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--warning));
  transform-origin: left;
  animation: logo-line 900ms 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.notification-btn i {
  animation: bell-wake 2.8s ease-in-out infinite;
}

.notification-badge {
  animation: badge-pulse 1.8s ease-in-out infinite;
}

.theme-toggle-modern {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.theme-toggle-modern::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 60%);
  opacity: 0;
}

.theme-toggle-modern:hover,
.theme-toggle-modern:focus {
  background: #fff;
  color: var(--primary);
  transform: translateY(-2px) rotate(-8deg);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.theme-toggle-modern:hover::before,
.theme-toggle-modern:focus::before {
  opacity: 1;
}

.theme-toggle-modern i {
  position: relative;
  z-index: 1;
  animation: theme-pop 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.theme-toggle-modern.is-dark {
  background: linear-gradient(135deg, #111827, #334155);
  color: #fde68a;
}

.main-nav a,
.quick-link,
.forum-category,
.hot-topic,
.topic-row,
.hero-action {
  position: relative;
  overflow: hidden;
}

.main-nav a::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--warning));
  transform: scaleX(0);
  transform-origin: left;
}

.main-nav a:hover::after,
.main-nav a:focus::after,
.main-nav a[aria-current='page']::after {
  transform: scaleX(1);
}

.quick-sidebar {
  animation: sidebar-in 520ms 120ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.quick-link:hover,
.quick-link:focus,
.quick-link[aria-current='page'] {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.main-content {
  opacity: 1;
  transform: translateY(0);
}

.main-content.is-transitioning {
  opacity: 0;
  transform: translateY(8px) scale(0.995);
}

.page {
  animation: page-enter 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.forum-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(217, 119, 6, 0.08), transparent 32%),
    var(--surface);
}

.forum-hero::before {
  content: '';
  position: absolute;
  inset: -45% auto auto -35%;
  width: 65%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.22), transparent 62%);
  filter: blur(10px);
  animation: hero-orbit 11s ease-in-out infinite alternate;
  pointer-events: none;
}

.forum-hero > * {
  position: relative;
  z-index: 1;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.52);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 1px 2px var(--shadow-base);
}

.dark-theme .hero-action {
  background: rgba(15, 23, 42, 0.72);
}

.hero-action--primary {
  background: linear-gradient(135deg, var(--accent), #22c55e);
  color: #fff;
  border-color: transparent;
}

.hero-action:hover,
.hero-action:focus {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px var(--shadow-hover);
}

.forum-hero-stats div,
.forum-alert,
.forum-board,
.forum-aside,
.mini-panel,
.page-intro,
.topic-table {
  animation: content-rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.forum-hero-stats div:nth-child(1) { animation-delay: 80ms; }
.forum-hero-stats div:nth-child(2) { animation-delay: 140ms; }
.forum-hero-stats div:nth-child(3) { animation-delay: 200ms; }

.forum-hero-stats div:hover,
.forum-alert:hover,
.mini-panel:hover,
.page-intro:hover,
.topic-table:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px var(--shadow-hover);
}

.forum-alert {
  position: relative;
}

.forum-alert--success {
  border-left-color: var(--success);
}

.forum-alert--success i {
  color: var(--success);
}

.forum-alert::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
}

.forum-alert:hover::after {
  border-color: rgba(37, 99, 235, 0.28);
}

.forum-category::before,
.hot-topic::before,
.topic-row::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--warning));
  transform: scaleY(0);
  transform-origin: top;
}

.forum-category:hover,
.forum-category:focus,
.hot-topic:hover,
.hot-topic:focus,
.topic-row:hover,
.topic-row:focus-within {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), transparent 70%), var(--surface);
  transform: translateX(3px);
}

.forum-category:hover::before,
.forum-category:focus::before,
.hot-topic:hover::before,
.hot-topic:focus::before,
.topic-row:hover::before,
.topic-row:focus-within::before {
  transform: scaleY(1);
}

.forum-category:hover .forum-category-icon,
.topic-row:hover .topic-icon {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.forum-category,
.hot-topic,
.activity-item,
.timeline-item,
.topic-row {
  animation: row-enter 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.forum-category:nth-child(1), .hot-topic:nth-child(1), .activity-item:nth-child(1), .timeline-item:nth-child(1), .topic-row:nth-child(1) { animation-delay: 70ms; }
.forum-category:nth-child(2), .hot-topic:nth-child(2), .activity-item:nth-child(2), .timeline-item:nth-child(2), .topic-row:nth-child(2) { animation-delay: 115ms; }
.forum-category:nth-child(3), .hot-topic:nth-child(3), .activity-item:nth-child(3), .timeline-item:nth-child(3), .topic-row:nth-child(3) { animation-delay: 160ms; }
.forum-category:nth-child(4), .hot-topic:nth-child(4), .activity-item:nth-child(4), .timeline-item:nth-child(4), .topic-row:nth-child(4) { animation-delay: 205ms; }
.forum-category:nth-child(5), .hot-topic:nth-child(5), .activity-item:nth-child(5), .timeline-item:nth-child(5), .topic-row:nth-child(5) { animation-delay: 250ms; }
.topic-row:nth-child(6) { animation-delay: 295ms; }
.topic-row:nth-child(7) { animation-delay: 340ms; }

.hot-topic b {
  animation: reply-breathe 2.4s ease-in-out infinite;
}

.forum-feed {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.85fr) minmax(260px, 0.85fr);
  gap: 16px;
}

.mini-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow-base);
  overflow: hidden;
}

.activity-list,
.timeline-list,
.poll-body {
  padding: 14px 16px;
}

.activity-item,
.timeline-item {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child,
.timeline-item:last-child {
  border-bottom: 0;
}

.activity-item span {
  width: max-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.11);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.activity-item time,
.timeline-item small {
  color: var(--muted);
  font-size: 0.82rem;
}

.timeline-item {
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
}

.timeline-item span {
  display: grid;
  gap: 1px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.poll-body {
  display: grid;
  gap: 9px;
}

.poll-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.poll-row b {
  color: var(--text);
}

.poll-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
  border: 1px solid var(--border);
}

.poll-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
  animation: bar-fill 780ms 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#progress-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--warning), var(--success));
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.45);
}

.toast {
  animation: toast-slide 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes header-drop {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes logo-line {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes bell-wake {
  0%, 68%, 100% { transform: rotate(0); }
  72% { transform: rotate(14deg); }
  76% { transform: rotate(-12deg); }
  80% { transform: rotate(8deg); }
  84% { transform: rotate(0); }
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.42); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@keyframes theme-pop {
  from { opacity: 0; transform: scale(0.6) rotate(-90deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes sidebar-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes content-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes row-enter {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes hero-orbit {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(42%, 24%) scale(1.18); }
}

@keyframes reply-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes bar-fill {
  from { width: 0; }
}

@keyframes toast-slide {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1023.98px) {
  .forum-feed {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .theme-toggle-modern,
  .notification-btn {
    width: 36px;
    height: 36px;
  }

  .forum-feed {
    gap: 12px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-action {
    justify-content: center;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Tablet: 768px – 1024px */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .sidebar {
    width: 180px;
  }
  /* На планшетах использем две колонки в сетке */
  .grid-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Размеры плиток на планшетах: средние и большие занимают всю ширину, большие — две строки */
  .tile--small {
    grid-column: span 1;
    grid-row: span 1;
  }
  .tile--medium {
    grid-column: span 2;
    grid-row: span 1;
  }
  .tile--large {
    grid-column: span 2;
    grid-row: span 2;
  }
}

/* Desktop: > 1024px – оставляем текущую компоновку */

/* ===== Forum redesign: Светлый классический / Темная тема ===== */
:root {
  --radius-card: 8px;
  --radius-button: 8px;
  --radius-input: 8px;
  --background: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --primary: #172033;
  --border: #d8dee8;
  --text: #17202f;
  --muted: #667085;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --warning: #d97706;
  --success: #15803d;
  --shadow-base: rgba(16, 24, 40, 0.08);
  --shadow-hover: rgba(16, 24, 40, 0.14);
  --radius: 8px;
}

.dark-theme {
  --background: #0a0f1d;
  --surface: #111827;
  --surface-soft: #0f172a;
  --primary: #050816;
  --border: #243047;
  --text: #f6f8fb;
  --muted: #aab6ca;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --warning: #f59e0b;
  --success: #4ade80;
  --shadow-base: rgba(0, 0, 0, 0.34);
  --shadow-hover: rgba(0, 0, 0, 0.48);
}

html,
body {
  letter-spacing: 0;
}

.app-header {
  height: 62px;
  background: var(--primary);
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.logo {
  font-size: 1.18rem;
  letter-spacing: 0;
}

.sub-header {
  height: 52px;
  justify-content: flex-start;
  padding: 0 18px;
  background: var(--surface);
  box-shadow: none;
}

.sub-header .main-nav {
  flex: none;
}

.main-nav ul {
  gap: 6px;
}

.main-nav a,
.sub-header .main-nav a {
  color: var(--text);
  border-radius: 8px;
  padding: 0.52rem 0.8rem;
}

.sub-header .main-nav a:hover,
.sub-header .main-nav a:focus,
.sub-header .main-nav a[aria-current='page'] {
  background: rgba(37, 99, 235, 0.11);
  color: var(--accent);
}

.header-actions {
  gap: 10px;
}

.notification-btn,
.theme-icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.notification-btn {
  position: relative;
  color: #fff;
}

.notification-btn:hover,
.notification-btn:focus,
.theme-icon-btn:hover,
.theme-icon-btn:focus,
.theme-icon-btn[aria-pressed='true'] {
  background: #fff;
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  border: 2px solid var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-switch {
  display: inline-flex;
  gap: 6px;
}

.theme-toggle {
  display: none;
}

.login-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.layout {
  align-items: stretch;
  min-height: calc(100vh - 114px);
}

.main-content {
  padding: 22px;
  min-width: 0;
}

.quick-sidebar {
  width: 58px;
  flex: 0 0 58px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 8px;
  position: sticky;
  top: 114px;
  height: calc(100vh - 114px);
  box-sizing: border-box;
  z-index: 10;
}

.quick-link {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid transparent;
}

.quick-link:hover,
.quick-link:focus,
.quick-link[aria-current='page'] {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.18);
}

.fa-chart-tree-map::before {
  content: "\f0e8";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

.forum-home {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
}

.forum-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 3px var(--shadow-base);
}

.forum-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.forum-hero h2 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.forum-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.forum-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 8px;
}

.forum-hero-stats div {
  min-width: 78px;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.forum-hero-stats strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.forum-hero-stats span,
.forum-section-title span,
.forum-category small,
.hot-topic small,
.topic-row small {
  color: var(--muted);
  font-size: 0.82rem;
}

.forum-alerts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.forum-alert {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 3px var(--shadow-base);
}

.forum-alert--primary {
  border-left-color: var(--accent);
}

.forum-alert i {
  color: var(--accent);
  font-size: 1.2rem;
}

.forum-alert strong,
.forum-alert span {
  display: block;
}

.forum-alert span {
  color: var(--muted);
  font-size: 0.9rem;
}

.forum-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.forum-board,
.forum-aside,
.topic-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow-base);
  overflow: hidden;
}

.forum-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.forum-section-title h3 {
  margin: 0;
  font-size: 1rem;
}

.forum-category-list,
.hot-topic-list {
  display: flex;
  flex-direction: column;
}

.forum-category {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 68px 68px minmax(120px, 160px);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.forum-category:last-child {
  border-bottom: 0;
}

.forum-category:hover,
.forum-category:focus {
  background: var(--surface-soft);
  color: var(--text);
}

.forum-category-icon,
.topic-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
}

.forum-category-main strong,
.forum-category-main small {
  display: block;
}

.forum-category-counts {
  text-align: center;
}

.forum-category-counts b,
.forum-category-counts small {
  display: block;
}

.forum-category-last {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.hot-topic {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hot-topic:last-child {
  border-bottom: 0;
}

.hot-topic:hover,
.hot-topic:focus {
  background: var(--surface-soft);
}

.hot-topic strong,
.hot-topic small {
  display: block;
}

.hot-topic b {
  min-width: 30px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.11);
  color: var(--accent);
  font-size: 0.86rem;
}

.topic-table {
  display: flex;
  flex-direction: column;
}

.topic-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.topic-row:last-child {
  border-bottom: 0;
}

.topic-row strong,
.topic-row small {
  display: block;
}

.topic-row span:not(.topic-icon),
.topic-row time {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.page-intro {
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow-base);
}

.toast {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  box-shadow: 0 12px 28px var(--shadow-hover);
}

.app-footer {
  display: none;
}

@media (max-width: 1023.98px) {
  .forum-shell {
    grid-template-columns: 1fr;
  }

  .forum-category {
    grid-template-columns: 42px minmax(0, 1fr) 60px 60px;
  }

  .forum-category-last {
    grid-column: 2 / -1;
    text-align: left;
  }
}

@media (max-width: 767.98px) {
  .app-header {
    padding: 0 10px;
  }

  .header-actions {
    gap: 6px;
  }

  .theme-icon-btn,
  .notification-btn {
    width: 36px;
    height: 36px;
  }

  .login-button {
    padding: 0 0.6rem;
  }

  .main-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 999;
  }

  body.nav-open .sub-header {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
  }

  .main-nav a {
    color: var(--text);
    border-bottom: 0;
    padding: 0.7rem 0.8rem;
  }

  .quick-sidebar {
    position: fixed;
    right: 8px;
    bottom: 8px;
    top: auto;
    width: auto;
    height: 50px;
    flex-direction: row;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 28px var(--shadow-hover);
    padding: 5px;
  }

  .main-content {
    padding: 14px;
    padding-bottom: 72px;
  }

  .forum-hero,
  .forum-alerts {
    grid-template-columns: 1fr;
  }

  .forum-hero {
    padding: 18px;
  }

  .forum-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .forum-category,
  .topic-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .forum-category-counts,
  .forum-category-last,
  .topic-row span:not(.topic-icon),
  .topic-row time {
    grid-column: 2;
    text-align: left;
  }
}

/* Final motion overrides after legacy forum layer */
.theme-switch,
.theme-icon-btn {
  display: none !important;
}

.theme-toggle-modern {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.theme-toggle-modern:hover,
.theme-toggle-modern:focus {
  background: #fff;
  color: var(--primary);
  transform: translateY(-2px) rotate(-8deg);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.theme-toggle-modern.is-dark {
  background: linear-gradient(135deg, #111827, #334155);
  color: #fde68a;
}

.forum-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(217, 119, 6, 0.08), transparent 32%),
    var(--surface);
}

.forum-alert--success {
  border-left-color: var(--success);
}

.forum-alert--success i {
  color: var(--success);
}

.forum-category:hover,
.forum-category:focus,
.hot-topic:hover,
.hot-topic:focus,
.topic-row:hover,
.topic-row:focus-within {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), transparent 70%), var(--surface);
  transform: translateX(3px);
}

.forum-category:hover .forum-category-icon,
.topic-row:hover .topic-icon {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.forum-feed {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.85fr) minmax(260px, 0.85fr);
  gap: 16px;
}

@media (max-width: 1023.98px) {
  .forum-feed {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .theme-toggle-modern,
  .notification-btn {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
